Пример #1
0
    def connectionMade(self):
        print "XMPP Connected !"

        mystream["xmpp_msg"] = self.xmlstream

        if not self.component:
            self.send(AvailablePresence())
Пример #2
0
    def onMessage(self, msg):

        if msg["type"] == 'chat' and hasattr(msg, "body") and msg.body:
            user = msg["from"]
            message = msg.body
            self.send(AvailablePresence())
            return self.bot.perform_action(user, message)
Пример #3
0
 def update_presence(self):
     self.send(
         AvailablePresence(
             statuses={
                 'C': 'at your service',
                 'en': 'at your service',
                 'de': 'stets zu Diensten'
             }))
Пример #4
0
    def onMessage(self, msg):
        donna = '[email protected]/Donnas-MacBook-Pro'
        adam = '[email protected]/Adam Czech'
        print str(msg)

        if msg["type"] == 'chat' and hasattr(msg, "body"):
            reply = domish.Element((None, "message"))
            reply["to"] = msg["from"]
            reply["from"] = msg["to"]
            reply["type"] = 'chat'
            if msg["from"] == adam:
                reply.addElement("body",
                                 content="What is your bidding my lord?")

            if str(msg.body) == 'status: away':
                self.send(AvailablePresence(show='away'))
                reply.addElement("body", content="Going away")
            elif str(msg.body).lower().startswith('can you'):
                reply.addElement("body", content="Yes")
                time.sleep(1)
            elif str(msg.body).lower().startswith('hey'):
                heyreply = "Hey good to hear from you"
                time.sleep(1)
                reply.addElement("body", content=heyreply)
            elif str(msg.body) == 'status: chat':
                self.send(AvailablePresence())
                reply.addElement("body", content="I'm back")
            elif str(msg.body) == 'status: xa':
                self.send(AvailablePresence(show='xa'))
                reply.addElement("body", content="Going away")
            elif str(msg.body) == 'b@d robot':
                reply.addElement("body",
                                 content="F**k you!!! ... I'm a real boy!!!")
            elif str(msg.body) == 'message:':
                #iself.send(AvailablePresence(statusLine='This is my status Line '))
                reply.addElement("body", content="!!!!!!!!")
            else:
                print "continue\n"  #reply.addElement("body", content=str(msg.body))

            localtime = time.asctime(time.localtime(time.time()))
            print "Local current time :", localtime
            self.send(reply)
Пример #5
0
    def connectionMade(self):
        self.send(AvailablePresence())

        # add handlers

        # join room
        pres = Presence()
        pres['to'] = self.room + '/' + self.nick
        x = pres.addElement((NS_MUC, 'x'))
        if not self.password is None:
            x.addElement('password', content = self.password)
        self.send(pres)
Пример #6
0
    def updateBalance(self, jid):
        client = database.getSMS77Client(JID(jid))
        if client != None:
            balance = client.getBalance()
            if balance != None:
                status = {
                    None: "Kontostand EUR " + balance,
                    "de": "Kontostand EUR " + balance,
                    "en": "account balance EUR " + balance
                }

                if balance != database.getBalance(JID(jid)):
                    self.send(AvailablePresence(JID(jid), None, status, 0))
                    database.setBalance(JID(jid), balance)
Пример #7
0
    def connectionMade(self):
        print 'Connected!'

        # send initial presence
        self.send(AvailablePresence())
Пример #8
0
    def connectionMade(self):
        log.msg('Connected!')

        # send initial presence
        self.send(AvailablePresence())
Пример #9
0
 def available(self, entity=None, show=None, statuses=None, priority=0, avatar=None):
     presence = AvailablePresence(entity, show, statuses, priority)
     if avatar:
         presence.addElement(('vcard-temp:x:update', 'x')).addElement("photo", content=avatar)
     self.send(presence)
Пример #10
0
    def connectionMade(self):
        """ Executed on establishment of connection. """

        print "Connection established."
        self.send(AvailablePresence())
Пример #11
0
 def connectionMade(self):
     # send initial presence
     self.send(AvailablePresence())
Пример #12
0
 def available(self, entity=None, show=None, statuses=None, priority=0):
     presence = AvailablePresence(entity, show, statuses, priority)
     presence.addElement(('vcard-temp:x:update', 'x')).addElement("photo", content=config.AVATAR) 
     self.send(presence)
Пример #13
0
 def connectionMade(self):
     self.logger.debug("XMPP connected")
     self.send(AvailablePresence())
Пример #14
0
    def connectionMade(self):
        """Send "available" presence once the connection is made"""
        log.msg("Xmpp client Connected!")

        # send initial presence
        self.send(AvailablePresence())
Пример #15
0
    def connectionMade(self):
        self.bot.logger.info("Connected!")

        # send initial presence
        self.send(AvailablePresence())
Пример #16
0
 def available(self, entity=None, show=None, statuses=None, priority=0):
     presence = AvailablePresence(entity, show, statuses, priority)
     presence.addElement(
         ('vcard-temp:x:update', 'x')).addElement("photo",
                                                  content=config.AVATAR)
     self.send(presence)