X-Git-Url: https://code.delx.au/pymsnt/blobdiff_plain/bea02c52c5c41e4cb49182c8bf972e340e00da2d..ab3667805a3bb1f43d9a3dcbfe74d3d15b0ea0fa:/src/main.py diff --git a/src/main.py b/src/main.py index 4b4d906..eb90dd4 100644 --- a/src/main.py +++ b/src/main.py @@ -25,7 +25,7 @@ except: from twisted.internet import default as bestreactor print selectWarning except: - print "Unable to find a reactor.\nExiting..." + print "Unable to find a reactor. Please make sure you have Twisted properly installed.\nExiting..." sys.exit(1) bestreactor.install() @@ -96,6 +96,7 @@ from tlib.xmlw import Element, jid, component from debug import LogEvent, INFO, WARN, ERROR import debug +import svninfo import utils import xdb import avatar @@ -114,6 +115,10 @@ import housekeep class PyTransport(component.Service): def __init__(self): LogEvent(INFO) + try: + LogEvent(INFO, msg="SVN r" + str(svninfo.getSVNVersion())) + except: + pass # Discovery, as well as some builtin features self.discovery = disco.ServerDiscovery(self) @@ -255,6 +260,7 @@ class PyTransport(component.Service): body = child.__str__() LogEvent(INFO, "", "Sending error response to a message outside of session.") jabw.sendErrorMessage(self, fro, to, "auth", "not-authorized", lang.get(ulang).notLoggedIn, body) + jabw.sendPresence(self, fro, to, ptype="unavailable") def onPresence(self, el): fro = el.getAttribute("from") @@ -293,25 +299,24 @@ class PyTransport(component.Service): elif el.getAttribute("type") != "error": LogEvent(INFO, "", "Sending unavailable presence to non-logged in user.") - pres = Element((None, "presence")) - pres.attributes["from"] = to - pres.attributes["to"] = fro - pres.attributes["type"] = "unavailable" - self.send(pres) + jabw.sendPresence(self, fro, to, ptype="unavailable") return elif ptype and (ptype.startswith("subscribe") or ptype.startswith("unsubscribe")): # They haven't logged in, and are trying to change subscription to a user + # No, lets not log them in. Lets send an error :) + jabw.sendPresence(self, fro, to, ptype="error") + # Lets log them in and then do it - LogEvent(INFO, "", "Attempting to create a session to do subscription stuff.") - s = session.makeSession(self, froj.userhost(), ulang) - if s: - self.sessions[froj.userhost()] = s - LogEvent(INFO, "", "New session created.") - # Tell the session there's a new resource - s.handleResourcePresence(froj.userhost(), froj.resource, toj.userhost(), toj.resource, 0, None, None, None) - # Send this subscription - s.onPresence(el) + #LogEvent(INFO, "", "Attempting to create a session to do subscription stuff.") + #s = session.makeSession(self, froj.userhost(), ulang) + #if s: + # self.sessions[froj.userhost()] = s + # LogEvent(INFO, "", "New session created.") + # # Tell the session there's a new resource + # s.handleResourcePresence(froj.userhost(), froj.resource, toj.userhost(), toj.resource, 0, None, None, None) + # # Send this subscription + # s.onPresence(el) class App: