예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
    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
예제 #4
0
 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())
예제 #5
0
파일: sm.py 프로젝트: nagecai/xmppserver
 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)