comparison src/browser/sat_browser/plugin_sec_otr.py @ 557:d0114855d6d4

browser_side (plugin OTR): fixes missing resource issue: - the problem might still happen but at least: - the session won't be started with a bare JID - if a session with a full JID exists and the user tries to send a message to a bare JID, he will get the big warning added (c.f last changeset)
author souliane <souliane@mailoo.org>
date Tue, 23 Sep 2014 10:53:52 +0200
parents 3aef7c5c7d3a
children 77372641e05d
comparison
equal deleted inserted replaced
556:3aef7c5c7d3a 557:d0114855d6d4
392 context.disconnect() 392 context.disconnect()
393 393
394 def fixResource(self, jid, cb): 394 def fixResource(self, jid, cb):
395 # FIXME: it's dirty, but libervia doesn't manage resources correctly now, refactoring is planed 395 # FIXME: it's dirty, but libervia doesn't manage resources correctly now, refactoring is planed
396 if jid.resource: 396 if jid.resource:
397 self.last_resources[jid.bare] = jid.resource
397 cb(jid) 398 cb(jid)
398 elif jid.bare in self.last_resources: 399 elif jid.bare in self.last_resources:
399 jid.resource = self.last_resources[jid.bare] 400 jid.setResource(self.last_resources[jid.bare])
400 cb(jid) 401 cb(jid)
401 else: 402 else:
402 def gotResource(resource): 403 def gotResource(resource):
403 jid.setResource(resource) 404 if resource:
405 jid.setResource(resource)
406 self.last_resources[jid.bare] = jid.resource
404 cb(jid) 407 cb(jid)
405 self.host.bridge.call('getLastResource', gotResource, jid.full()) 408 self.host.bridge.call('getLastResource', gotResource, jid.full())
406 409
407 def messageReceivedTrigger(self, from_jid, msg, msg_type, to_jid, extra): 410 def messageReceivedTrigger(self, from_jid, msg, msg_type, to_jid, extra):
408 if msg_type == C.MESS_TYPE_INFO: 411 if msg_type == C.MESS_TYPE_INFO: