Show
Ignore:
Timestamp:
08/30/07 22:35:52 (15 months ago)
Author:
roidelapluie
Message:

add a now argument to the send function, so that stanza is sent
instantly instead of added to queue. Use it to send answer to adhoc
command when we disconnect. fixes #3008 and #2808

Location:
branches/gajim_0.11.1/src/common
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/common/commands.py

    r7940 r8632  
    136136                # if going offline, we need to push response so it won't go into 
    137137                # queue and disappear 
    138                 self.connection.connection.send(response, presencetype == 'offline') 
     138                self.connection.connection.send(response, now = presencetype == 'offline') 
    139139 
    140140                # send new status 
  • branches/gajim_0.11.1/src/common/xmpp/dispatcher_nb.py

    r7462 r8632  
    400400                self.SendAndWaitForResponse(stanza, 0, func, args) 
    401401         
    402         def send(self, stanza, is_message = False): 
     402        def send(self, stanza, is_message = False, now = False): 
    403403                ''' Serialise stanza and put it on the wire. Assign an unique ID to it before send. 
    404404                        Returns assigned ID.''' 
    405405                if type(stanza) in [type(''), type(u'')]:  
    406                         return self._owner.Connection.send(stanza) 
     406                        return self._owner.Connection.send(stanza, now = now) 
    407407                if not isinstance(stanza, Protocol):  
    408408                        _ID=None 
     
    428428                stanza.setParent(self._metastream) 
    429429                if is_message: 
    430                         self._owner.Connection.send(stanza, True) 
     430                        self._owner.Connection.send(stanza, True, now = now) 
    431431                else: 
    432                         self._owner.Connection.send(stanza) 
     432                        self._owner.Connection.send(stanza, now = now) 
    433433                return _ID 
    434434         
  • branches/gajim_0.11.1/src/common/xmpp/transports_nb.py

    r7535 r8632  
    326326                return True 
    327327 
    328         def send(self, raw_data): 
     328        def send(self, raw_data, now = False): 
    329329                '''Append raw_data to the queue of messages to be send.  
    330330                If supplied data is unicode string, encode it to utf-8. 
     
    337337                elif not isinstance(r, str):  
    338338                        r = ustr(r).encode('utf-8') 
    339                 self.sendqueue.append(r) 
     339                if now: 
     340                        self.sendqueue.insert(0, r) 
     341                        self._do_send() 
     342                else: 
     343                        self.sendqueue.append(r) 
    340344                self._plug_idle() 
    341345