Пример #1
0
class AdminClient(XMPPClient, PubSubClientMixIn):

    implements(IAdminClient)

    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)

    def _authd(self, xs):
        super(AdminClient, self)._authd(xs)
        self.presence.available()
        ev = AdminClientConnected(self)
        notify(ev)

    def _disconnected(self, reason):
        super(AdminClient, self)._disconnected(reason)
        ev = AdminClientDisconnected(self)
        notify(ev)
Пример #2
0
class AdminClient(XMPPClient, PubSubClientMixIn):

    implements(IAdminClient)

    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)

    def _authd(self, xs):
        super(AdminClient, self)._authd(xs)
        self.presence.available()
        ev = AdminClientConnected(self)
        notify(ev)

    def _disconnected(self, reason):
        super(AdminClient, self)._disconnected(reason)
        ev = AdminClientDisconnected(self)
        notify(ev)
Пример #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