Esempio n. 1
0
 def on_pubmsg(self, c, e):
     a = e.arguments[0]
     nick = e.source.nick
     if self.xmppbot != None:
         if self.translate:
             translated = bingtranslate.translate(a, self.translate_from, self.translate_to)
             self.xmppbot.send_message("<%s> %s [%s]"%(nick, translated.decode("utf8"), a))
         else:
             self.xmppbot.send_message("<%s> %s"%(nick, a))
Esempio n. 2
0
 def xmpp_message(self, con, event):
     type = event.getType()
     fromjid = event.getFrom().getStripped()
     body = event.getBody()
     if type in ["message", "chat", None] and fromjid == self.remotejid and body:
         #sys.stdout.write(body + "\n")
         if self.ircbot != None:
             if self.translate:
                 translated = bingtranslate.translate(body, self.translate_from, self.translate_to)
                 self.ircbot.send_message("%s [%s]"%(translated.decode("utf8"), body))
             else:
                 self.ircbot.send_message(body)