コード例 #1
0
 def __init__(self, jid, host, password, port, authcallback):
     self.authcallback = authcallback
     self.vcard = VCardHandler()
     self.presence = PresenceClientProtocol()
     # XXX: This is a hack. See https://github.com/ralphm/wokkel/issues/5
     # Not yet sure what the best way of dealing with this is.
     jid = JID(u'@'.join(
         (doubleEscapeNode(unescapeNode(jid.user)), jid.host)))
     super(UserClient, self).__init__(
         jid, password,
         extra_handlers=[self.vcard, self.presence],
         host=host,
         port=port)
コード例 #2
0
    def __init__(self, jid, jdomain, password, pubsub_jid):

        jid = JID(jid)
        self.pubsub_jid = JID(pubsub_jid)
        self.admin = AdminHandler()
        self.pubsub = PubSubHandler()
        self.chat = ChatHandler()
        self.presence = PresenceClientProtocol()

        super(AdminClient, self).__init__(
            jid,
            password,
            extra_handlers=[self.admin, self.pubsub, self.chat, self.presence],
            host=jdomain)
コード例 #3
0
    def createXMPPClients(self, jid, password):
        """
        Create XMPP clients.

        @return: C{(xmppClient, pubsubClient)}
        """
        xmppClient = XMPPClient(jid, password)
        xmppClient.startService()

        presence = PresenceClientProtocol()
        presence.setHandlerParent(xmppClient)
        presence.available(priority=127)

        pubsubClient = SuperfeedrClient(self)
        pubsubClient.setHandlerParent(xmppClient)

        return xmppClient, pubsubClient
コード例 #4
0
class AdminClient(XMPPClient):
    implements(IAdminClient)

    def __init__(self, jid, host, password, port):
        try:
            jid = JID(jid)
        except RuntimeError, e:
            log.warn(e)
            return

        self.admin = AdminHandler()
        self.chat = ChatHandler()
        self.presence = PresenceClientProtocol()
        super(AdminClient, self).__init__(
            jid, password,
            extra_handlers=[self.admin, self.chat, self.presence],
            host=host,
            port=port)