def _timeout(self): self.ping_timeout = None # send stream error self.xmlstream.sendStreamError(error.StreamError('connection-timeout')) # broadcast unavailable presence if self.xmlstream.otherEntity is not None: stanza = xmppim.UnavailablePresence() stanza['from'] = self.xmlstream.otherEntity.full() self.parent.forward(stanza)
def connectionLost(self, reason): if self.xmlstream and self.xmlstream.otherEntity is not None and self.parent._presence is not None: # void the current presence self.presence(None) # send unavailable presence stanza = xmppim.UnavailablePresence() stanza['from'] = self.xmlstream.otherEntity.full() self.parent.forward(stanza) # notify c2s stanza.consumed = False self.parent.router.local_presence(self.xmlstream.otherEntity, stanza)
def leave(self, room_jid): """Leave a MUC room. See: http://xmpp.org/extensions/xep-0045.html#exit @param room_jid: The room entity id you want to exit. @type room_jid: L{jid.JID} """ r = self._getRoom(room_jid) p = xmppim.UnavailablePresence(to=r.entity_id) d = self.sendDeferred(p, timeout=DEFER_TIMEOUT) # add observer for joining the room self.xmlstream.addOnetimeObserver( PRESENCE + "[@from='%s' and @type='unavailable']" % (r.entity_id.full()), self._leftRoom, 1, d) return d
def leave(self, room): self.parent.log.info(u"Leaving %s", room) jid = JID('%s/%s' % (room, self.parent.nick)) presence = xmppim.UnavailablePresence(to=jid) self.xmlstream.send(presence) self.rooms.remove(room.lower())
def connectionLost(self, reason): if self.xmlstream and self.xmlstream.otherEntity is not None: stanza = xmppim.UnavailablePresence() stanza['from'] = self.xmlstream.otherEntity.full() self.parent.forward(stanza, True)