keeps old status after disconnection

This commit is contained in:
Jefry Lagrange 2011-06-07 23:50:45 -04:00
parent 7194260f98
commit 39a960f3e7
3 changed files with 16 additions and 5 deletions

View File

@ -784,6 +784,15 @@ class Connection(CommonConnection, ConnectionHandlers):
self.connection.disconnect()
self.last_connection = None
self.connection = None
def set_oldst(self): # Set old state
if self.old_show:
self.connected = gajim.SHOW_LIST.index(self.old_show)
gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
show=self.connected))
else: # we default to online
self.connected = 2
gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
show=gajim.SHOW_LIST[self.connected]))
def _disconnectedReconnCB(self):
"""

View File

@ -421,9 +421,10 @@ class XMPPDispatcher(PlugIn):
stanza.props = stanza.getProperties()
ID = stanza.getID()
# If server supports stream management
if self.sm != None and (stanza.getName() != 'r' and
stanza.getName() != 'a' and
stanza.getName() != 'enabled') :
if self.sm and self.sm.enabled and (stanza.getName() != 'r' or
stanza.getName() != 'a' or
stanza.getName() != 'enabled' or
stanza.getName() != 'resumed'):
# increments the number of stanzas that has been handled
self.sm.in_h = self.sm.in_h + 1
list_ = ['default'] # we will use all handlers:

View File

@ -72,7 +72,7 @@ class Smacks():
log.error('Attempted to resume without a valid session id ')
return
resume = Acks()
resume.buildResume(self.in_h, None)#self.session_id)
resume.buildResume(self.in_h, self.session_id)
self._owner.Connection.send(resume, True)
def send_ack(self, disp, stanza):
@ -104,6 +104,7 @@ class Smacks():
if stanza.getName() == 'resumed':
self.resuming = True
self.con.set_oldst()
if self.uqueue != []:
for i in self.uqueue:
self._owner.Connection.send(i, False)