Exemplo n.º 1
0
    def connectionLost(self, reason):
        log.msg("Disconnected!")

        global message_conn
        if message_conn == self:
            message_conn = None

        gear_client.submit("gear_connection_lost", "")
Exemplo n.º 2
0
    def connectionInitialized(self):
        super(XmppGearsPresenceProtocol, self).connectionInitialized()

        self.connected = time.time()

        global presence_conn
        presence_conn = self

        gear_client.submit("gear_presence_connected", "")
Exemplo n.º 3
0
 def __onMessage(self, msg):
     if msg.getAttribute("type") == 'chat' and hasattr(msg, "body") and msg.body:
         gear_client.submit("gear_message_new", { "to": msg["to"], "from" : msg["from"], "from_bare": JID(msg["from"]).userhost(), "body": unicode(msg.body), "raw": msg.toXml().encode("utf-8")})
     else:
         log.msg("Non-chat/body message: %s" % msg.toXml())
Exemplo n.º 4
0
    def _set_status(self, u, status, cb=None):
        if status is None:
            status = "available"

        log.msg("_set_status: %s %s" % (u, status))
        gear_client.submit("gear_presence_update", { "jid" : u, "status": status } )