Exemple #1
0
    def __init__(self):
        my_jid = JID(USER + '/Bot')
        self.my_jid = my_jid
        settings = XMPPSettings({
            "software_name": "qxbot",
            "software_version": __version__,
            "software_os": "Linux",
            "tls_verify_peer": False,
            "starttls": True,
            "ipv6": False,
            "poll_interval": 10,
        })

        settings["password"] = PASSWORD
        version_provider = VersionProvider(settings)
        event_queue = settings["event_queue"]
        self.webqq = WebQQ(QQ, event_queue)
        self.connected = False
        #self.mainloop = TornadoMainLoop(settings)
        self.mainloop = EpollMainLoop(settings)
        self.client = Client(my_jid, [self, version_provider], settings,
                             self.mainloop)
        self.logger = get_logger()
        self.msg_dispatch = MessageDispatch(self, self.webqq, BRIDGES)
        self.xmpp_msg_queue = Queue.Queue()
class MyDaemon(Daemon):
    def qq_init(self):
        user = raw_input('QQ:')
        pwd = getpass.getpass('Password: '******'a+')
        t = threading.Thread(target = webserver)
        t.daemon = True
        t.start()
        while 1:
            try:
                self.qq.step()
            except KeyboardInterrupt:
                print "CTRL+C met, exit!"
                return
            except Exception as e:
                print "Error : ", e
Exemple #3
0
def main():
    user = raw_input('QQ:')
    pwd = getpass.getpass('Password: ')
    qq = WebQQ(user, pwd)
    qq.on_gotmsg = reply_qq
    qq.login()
    while 1:
        time.sleep(0.5)
        try:
            qq.step()
        except KeyboardInterrupt:
            print "CTRL+C met, exit!"
            return
        except Exception as e:
            print "Error : ", e
 def qq_init(self):
     user = raw_input('QQ:')
     pwd = getpass.getpass('Password: ')
     self.qq = WebQQ(user, pwd)
     self.qq.on_gotmsg = reply_qq
     self.qq.login()