keeps old status after disconnection
This commit is contained in:
		
							parent
							
								
									7194260f98
								
							
						
					
					
						commit
						39a960f3e7
					
				
					 3 changed files with 16 additions and 5 deletions
				
			
		|  | @ -784,7 +784,16 @@ class Connection(CommonConnection, ConnectionHandlers): | ||||||
|             self.connection.disconnect() |             self.connection.disconnect() | ||||||
|             self.last_connection = None |             self.last_connection = None | ||||||
|             self.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): |     def _disconnectedReconnCB(self): | ||||||
|         """ |         """ | ||||||
|         Called when we are disconnected |         Called when we are disconnected | ||||||
|  |  | ||||||
|  | @ -421,9 +421,10 @@ class XMPPDispatcher(PlugIn): | ||||||
|         stanza.props = stanza.getProperties() |         stanza.props = stanza.getProperties() | ||||||
|         ID = stanza.getID() |         ID = stanza.getID() | ||||||
|         # If server supports stream management |         # If server supports stream management | ||||||
|         if self.sm != None and (stanza.getName() != 'r' and  |         if self.sm and self.sm.enabled and (stanza.getName() != 'r' or  | ||||||
|                                  stanza.getName() != 'a' and |                                             stanza.getName() != 'a' or | ||||||
|                                  stanza.getName() != 'enabled') : |                                             stanza.getName() != 'enabled' or | ||||||
|  |                                             stanza.getName() != 'resumed'): | ||||||
|             # increments the number of stanzas that has been handled |             # increments the number of stanzas that has been handled | ||||||
|             self.sm.in_h = self.sm.in_h + 1 |             self.sm.in_h = self.sm.in_h + 1 | ||||||
|         list_ = ['default'] # we will use all handlers: |         list_ = ['default'] # we will use all handlers: | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ class Smacks(): | ||||||
|             log.error('Attempted to resume without a valid session id ') |             log.error('Attempted to resume without a valid session id ') | ||||||
|             return |             return | ||||||
|         resume = Acks() |         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)             |         self._owner.Connection.send(resume, True)             | ||||||
|      |      | ||||||
|     def send_ack(self, disp, stanza): |     def send_ack(self, disp, stanza): | ||||||
|  | @ -104,6 +104,7 @@ class Smacks(): | ||||||
|          |          | ||||||
|         if stanza.getName() == 'resumed': |         if stanza.getName() == 'resumed': | ||||||
|             self.resuming = True |             self.resuming = True | ||||||
|  |             self.con.set_oldst() | ||||||
|             if self.uqueue != []: |             if self.uqueue != []: | ||||||
|                 for i in self.uqueue: |                 for i in self.uqueue: | ||||||
|                     self._owner.Connection.send(i, False) |                     self._owner.Connection.send(i, False) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue