Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Program Files (x86)\\Python39-32\\python.exe"
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pyfire XMPP Project
===================
Pyfire 2.0 XMPP Server Project
===============================

Having used some other implementations in the past, we decided to roll our own. Development just has begun, so don't expect anything fancy yet...

Dependencies
============

- Python 2.6 with ElementTree 1.3 or Python 2.7
- Python 3.9 with ElementTree
- Tornado
- pyzmq (Python bindings for libzmq, ØMQ)
- sqlalchemy
Expand Down
4 changes: 2 additions & 2 deletions bin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import functools
import contextlib
import socket
import thread
import _thread

from zmq.eventloop import ioloop

Expand All @@ -45,7 +45,7 @@ def start_client_listener():
io_loop.start()
except (KeyboardInterrupt, SystemExit):
io_loop.stop()
print "exited cleanly"
print("exited cleanly")

def fire_up():
import pyfire.storage
Expand Down
2 changes: 1 addition & 1 deletion pyfire/auth/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:license: BSD, see LICENSE for more details.
"""

from thread import allocate_lock
from _thread import allocate_lock

from pyfire.auth.backends import InvalidAuthenticationError

Expand Down
6 changes: 3 additions & 3 deletions pyfire/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
:license: BSD, see LICENSE for more details.
"""

import ConfigParser
import configparser
import os.path

config = ConfigParser.SafeConfigParser()
config = configparser.SafeConfigParser()

config.add_section('database')
config.set('database', 'dburi', 'sqlite:///pyfire.db')
Expand Down Expand Up @@ -42,5 +42,5 @@ def getlist(section, option, separator=','):
# some handy shortcuts
get = config.get
getint = config.getint
NoOptionError = ConfigParser.NoOptionError
NoOptionError = configparser.NoOptionError
set = config.set
4 changes: 2 additions & 2 deletions pyfire/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _handle_events(self, fd, events):
while True:
try:
connection, address = self._sockets[fd].accept()
except socket.error, e:
except(socket.error, e):
if e.args[0] in (errno.EWOULDBLOCK, errno.EAGAIN):
return
raise
Expand All @@ -121,7 +121,7 @@ def _handle_events(self, fd, events):
self._connections[address] = XMPPConnection(stream, address)
if not self.checker._running:
self.checker.start()
except Exception, e:
except (Exception, e):
exc_type, exc_value, exc_traceback = sys.exc_info()
log.error("Error in connection callback, %s" % str(e))
for line in traceback.format_tb(exc_traceback):
Expand Down
2 changes: 1 addition & 1 deletion pyfire/singletons.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:license: BSD, see LICENSE for more details.
"""

from thread import allocate_lock
from _thread import allocate_lock

import zmq

Expand Down
4 changes: 2 additions & 2 deletions pyfire/stanza_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:license: BSD, see LICENSE for more details.
"""

import cPickle
import pickle
import zmq
from zmq.eventloop import ioloop, zmqstream
import xml.etree.ElementTree as ET
Expand Down Expand Up @@ -76,6 +76,6 @@ def handle_stanza(self, msgs):
self.forwarder.send(cPickle.dumps(resp))
else:
self.forwarder.send(cPickle.dumps(response))
except StanzaError, e:
except (StanzaError, e):
# send caught errors back to sender
self.forwarder.send(cPickle.dumps(e.element))
6 changes: 3 additions & 3 deletions pyfire/stream/stanzas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
:license: BSD, see LICENSE for more details.
"""

import cPickle
import pickle
import uuid
from thread import allocate_lock
from _thread import allocate_lock
import xml.etree.ElementTree as ET

import zmq
Expand Down Expand Up @@ -103,7 +103,7 @@ def contenthandler(self, tree):
raise NotAuthorizedError
self.publish_stanza(tree)

except StreamError, e:
except(StreamError, e):
self.send_string(unicode(e))
self.connection.stop_connection()

Expand Down
2 changes: 1 addition & 1 deletion pyfire/stream/stanzas/iq/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class Query(object):
"""Handles all iq-query xmpp frames"""

__slots__ = ('handler', 'request', 'response', 'sender')
__slots__ = ( 'request', 'response', 'sender')

def handle(self, request, sender):
self.request = request
Expand Down
2 changes: 1 addition & 1 deletion pyfire/zmq_forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import uuid
import random
import cPickle
import pickle
import zmq
from zmq.eventloop import ioloop, zmqstream

Expand Down