diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2007-03-20 10:13:25 +0300 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2007-03-20 10:13:25 +0300 |
commit | 3bf528d9887c498f553253d477cc90d844e7d306 (patch) | |
tree | 05d5de7517767e114a5ccd5841496cfd0e043c22 | |
parent | 61949ac74dcc63f34961b7550859fe14036ab820 (diff) |
add now argument to send funtions in zeroconf connection. fixes #3045
-rw-r--r-- | src/common/zeroconf/client_zeroconf.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index bd0872126..e11dda12b 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -310,8 +310,9 @@ class P2PConnection(IdleObject, PlugIn): if not recv_handler(None) and _tmp == self.on_receive: self.on_receive = recv_handler - def send(self, packet, is_message = False): - '''Append stanza to the queue of messages to be send. + def send(self, packet, is_message = False, now = False): + '''Append stanza to the queue of messages to be send if now is + False, else send it instantly. If supplied data is unicode string, encode it to utf-8. ''' if self.state <= 0: @@ -324,7 +325,11 @@ class P2PConnection(IdleObject, PlugIn): elif not isinstance(r, str): r = ustr(r).encode('utf-8') - self.sendqueue.append((r, is_message)) + if now: + self.sendqueue.insert(0, (r, is_message)) + self._do_send() + else: + self.sendqueue.append((r, is_message)) self._plug_idle() def read_timeout(self): @@ -617,7 +622,7 @@ class ClientZeroconf: return self.roster.getRoster() return {} - def send(self, stanza, is_message = False): + def send(self, stanza, is_message = False, now = False): stanza.setFrom(self.roster.zeroconf.name) to = stanza.getTo() |