Beispiel #1
0
 def addNeighbor(self, jid, initiating):
     jid = toJID(jid)
     if jid.userhost() in self.neighbors:
         return
     self._addNeighbor(jid, initiating)
     if self._rosterReceived:
         self.presence.subscribe(jid)
Beispiel #2
0
 def onFrame(self, iq):
     jid = toJID(iq['from'])
     neighbor = self._findNeighbor(jid)
     if neighbor:
         neighbor.onFrame(iq)
     else:
         iq.handled = True
         error = StanzaError('not-authorized')
         self.send(error.toResponse(iq))
Beispiel #3
0
 def sendWithCallbacks(self, jid, message, callback, *args, **kwargs):
     jid = toJID(jid)
     self._findNeighbor(jid).sendWithCallbacks(message, callback,
             *args, **kwargs)
Beispiel #4
0
 def sendWithDeferred(self, jid, message):
     jid = toJID(jid)
     return self._findNeighbor(jid).sendWithDeferred(message)
Beispiel #5
0
 def sendTo(self, jid, message):
     jid = toJID(jid)
     self._findNeighbor(jid).send(message)
Beispiel #6
0
 def onAuthenticate(self, iq):
     self._setAuthenticated(toJID(iq['from']))
     iq.handled = True
     reply = toResponse(iq, 'result')
     self.link.send(reply)
Beispiel #7
0
 def auth_ok(resp):
     self._setAuthenticated(toJID(resp['from']))
     self._do_send()