diff -up RemoteNotify-old/remotenotify/jabberbot.py RemoteNotify/remotenotify/jabberbot.py
old
|
new
|
import deluge.common as common
|
45 | 45 | import deluge.error as error |
46 | 46 | from deluge.ui.console import mapping |
47 | 47 | import time |
| 48 | import re |
48 | 49 | |
49 | 50 | myJid = None |
50 | 51 | myPass = None |
… |
… |
def authd(xmlstream):
|
226 | 227 | |
227 | 228 | def gotIq(el): |
228 | 229 | 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(): |
230 | 232 | print('got Iq result') |
231 | 233 | query = list(el.elements())[0] |
232 | 234 | for item in query.elements(): |
… |
… |
class JabberThread(Thread):
|
356 | 357 | def run(self): |
357 | 358 | print 'Starting Jabber Thread' |
358 | 359 | global started, connector, inited,deluge,myJid,myPass,dalock |
| 360 | jServerR=re.compile('.+@(.+)') |
| 361 | myServer=jServerR.search(myJid.userhost()).group(1) |
359 | 362 | if not started: |
360 | 363 | started = True |
361 | 364 | if not inited: |
… |
… |
class JabberThread(Thread):
|
364 | 367 | deluge = delugeConn() |
365 | 368 | factory = jabberclient.basicClientFactory(myJid, myPass) |
366 | 369 | factory.addBootstrap('//event/stream/authd',authd) |
367 | | connector = reactor.connectTCP('jabber.org',5222,factory) |
| 370 | connector = reactor.connectTCP(myServer,5222,factory) |
368 | 371 | dalock = threading.Lock() |
369 | 372 | reactor.callLater(20, checkWorkQueue) |
370 | 373 | # TODO: load jid and so on |