Ticket #1056: RemoteNotify.patch

File RemoteNotify.patch, 1.6 KB (added by BlackLotus, 15 years ago)
  • remotenotify/jabberbot.py

    diff -up RemoteNotify-old/remotenotify/jabberbot.py RemoteNotify/remotenotify/jabberbot.py
    old new import deluge.common as common  
    4545import deluge.error as error
    4646from deluge.ui.console import mapping
    4747import time
     48import re
    4849
    4950myJid = None
    5051myPass = None
    def authd(xmlstream):  
    226227
    227228def gotIq(el):
    228229  global myBuddies,myJid
    229   if el['type'] == 'result' and el['to']==myJid.full() and el['from']==myJid.userhost():
     230  jidR=re.compile('([^/]+)/?.*')
     231  if el['type'] == 'result' and el['to']==myJid.full() and jidR.search(el['from']).group(1)==myJid.userhost():
    230232    print('got Iq result')
    231233    query = list(el.elements())[0]
    232234    for item in query.elements():
    class JabberThread(Thread):  
    356357    def run(self):
    357358        print 'Starting Jabber Thread'
    358359        global started, connector, inited,deluge,myJid,myPass,dalock
     360        jServerR=re.compile('.+@(.+)')
     361        myServer=jServerR.search(myJid.userhost()).group(1)
    359362        if not started:
    360363          started = True
    361364          if not inited:
    class JabberThread(Thread):  
    364367            deluge = delugeConn()
    365368            factory = jabberclient.basicClientFactory(myJid, myPass)
    366369            factory.addBootstrap('//event/stream/authd',authd)
    367             connector = reactor.connectTCP('jabber.org',5222,factory)
     370            connector = reactor.connectTCP(myServer,5222,factory)
    368371            dalock = threading.Lock()
    369372            reactor.callLater(20, checkWorkQueue)
    370373          # TODO: load jid and so on