Exemplo n.º 1
0
 def send(self, recv_qq, msg):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_send')
     self.qq.session_id += 1
     message.body.setField('send_qq',self.qq.id)
     message.body.setField('recv_qq',recv_qq)
     message.body.setField('ver',basic.QQ_ver)
     message.body.setField('send_qq1',self.qq.id)
     message.body.setField('recv_qq1',recv_qq)
     message.body.setField('md5',md5.new(str(self.qq.id)+self.qq.session).digest())
     message.body.setField('type',11)
     message.body.setField('session_id',self.qq.session_id)
     message.body.setField('send_time',recv_qq)
     message.body.setField('send_face',0)
     message.body.setField('font_info',1)
     message.body.setField('msg_pass',1)
     message.body.setField('msg_id',1)
     message.body.setField('msg_type',1)
     message.body.setField('msg_data',msg)
     message.body.setField('msg_link',' '+chr(00))
     message.body.setField('msg_end',9)
     message.body.setField('msg_red',0)
     message.body.setField('msg_green',0)
     message.body.setField('msg_blue',0)
     message.body.setField('unknown',0)
     message.body.setField('encoding',0x8602)
     message.body.setField('info',a2b_hex('cbcecce5'))
     #尾部分长度固定为9
     message.body.setField('len',len(message.body.fields['msg_data'])+9)
     self.sendDataToQueue(message)
Exemplo n.º 2
0
 def recv(self, message):
     #将收到的消息的前16位返回给服务器,表示已经收到消息
     if message.body.fields['type'] == '好友消息' or message.body.fields['type'] == '陌生人消息':
         self.printl(message.body.fields['type'])
         try:
             print self.qq.friend_list[message.body.fields['send_qq']]['name']+':'+\
                 message.body.fields['msg_data']
         except KeyError:
             print str(message.body.fields['send_qq'])+':'+\
                 message.body.fields['msg_data']
     elif message.body.fields['type'] == '固定群消息':
         self.printl(message.body.fields['type'])
         try:
             print str(message.body.fields['send_qq'])+'_&_'+str(message.body.fields['send_qq1'])+':'+\
                 message.body.fields['msg_data'][0]
         except KeyError:
             print str(message.body.fields['send_qq'])+':'+\
                 message.body.fields['msg_data'][0]
     send_qq = message.body.fields['send_qq']
     recv_qq = message.body.fields['recv_qq']
     msg_id = message.body.fields['msg_id']
     send_ip = message.body.fields['send_ip']
     #发送流水号回服务器
     sequence = message.head.sequence
     message = qqmsg.outqqMessage(self.qq)
     message.head.sequence = sequence
     message.setMsgName('qq_recv')
     message.body.setField('send_qq',send_qq)
     message.body.setField('recv_qq',recv_qq)
     message.body.setField('msg_id',msg_id)
     message.body.setField('send_ip',send_ip)
     self.sendData(message)
Exemplo n.º 3
0
 def recv(self, message):
     #将收到的消息的前16位返回给服务器,表示已经收到消息
     if message.body.fields['type'] == '好友消息' or message.body.fields[
             'type'] == '陌生人消息':
         self.printl(message.body.fields['type'])
         try:
             print self.qq.friend_list[message.body.fields['send_qq']]['name']+':'+\
                 message.body.fields['msg_data']
         except KeyError:
             print str(message.body.fields['send_qq'])+':'+\
                 message.body.fields['msg_data']
     elif message.body.fields['type'] == '固定群消息':
         self.printl(message.body.fields['type'])
         try:
             print str(message.body.fields['send_qq'])+'_&_'+str(message.body.fields['send_qq1'])+':'+\
                 message.body.fields['msg_data'][0]
         except KeyError:
             print str(message.body.fields['send_qq'])+':'+\
                 message.body.fields['msg_data'][0]
     send_qq = message.body.fields['send_qq']
     recv_qq = message.body.fields['recv_qq']
     msg_id = message.body.fields['msg_id']
     send_ip = message.body.fields['send_ip']
     #发送流水号回服务器
     sequence = message.head.sequence
     message = qqmsg.outqqMessage(self.qq)
     message.head.sequence = sequence
     message.setMsgName('qq_recv')
     message.body.setField('send_qq', send_qq)
     message.body.setField('recv_qq', recv_qq)
     message.body.setField('msg_id', msg_id)
     message.body.setField('send_ip', send_ip)
     self.sendData(message)
Exemplo n.º 4
0
 def on_qq_login(self, message):
     '''
     这个也是登陆过程中自动处理的一部分,当登陆成功后,self.qq.login这个属性为1,否则则没有登陆成功。
     调用了lib后可以通过这个属性来判断是否登陆成功。
     '''
     if message.body.fields['status'][0] == 1:
         #self.transport.connect(util.ip2string(message.body.fields['ip']),8000)
         self.qq.server = (util.ip2string(message.body.fields['ip']), 8000)
         defer.succeed(self.pre_login())
     else:
         if message.body.fields['status'][0] == 5:
             print message.body.fields['data'][0]
         elif message.body.fields['status'][0] == 6:
             self.printl('您的号码[' + str(self.qq.id) +
                         ']可能存在异常情况,已受到限制登录保护,需激活后才能正常登录。\
                         激活地址是:\
                         电信或网通用户 :im.qq.com/jh或activate.qq.com\
                         教育网用户: activateedu.qq.com')
         else:
             self.printl('登陆成功')
             self.qq.login = 1
             self.qq.session = message.body.fields['session']
             message = qqmsg.outqqMessage(self.qq)
             message.setMsgName('qq_chang_status')
             message.body.setField('online', basic.QQ_status['online'])
             message.body.setField('video', basic.QQ_video)
             self.sendDataToQueue(message)
Exemplo n.º 5
0
 def send(self, recv_qq, msg):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_send')
     self.qq.session_id += 1
     message.body.setField('send_qq', self.qq.id)
     message.body.setField('recv_qq', recv_qq)
     message.body.setField('ver', basic.QQ_ver)
     message.body.setField('send_qq1', self.qq.id)
     message.body.setField('recv_qq1', recv_qq)
     message.body.setField(
         'md5',
         md5.new(str(self.qq.id) + self.qq.session).digest())
     message.body.setField('type', 11)
     message.body.setField('session_id', self.qq.session_id)
     message.body.setField('send_time', recv_qq)
     message.body.setField('send_face', 0)
     message.body.setField('font_info', 1)
     message.body.setField('msg_pass', 1)
     message.body.setField('msg_id', 1)
     message.body.setField('msg_type', 1)
     message.body.setField('msg_data', msg)
     message.body.setField('msg_link', ' ' + chr(00))
     message.body.setField('msg_end', 9)
     message.body.setField('msg_red', 0)
     message.body.setField('msg_green', 0)
     message.body.setField('msg_blue', 0)
     message.body.setField('unknown', 0)
     message.body.setField('encoding', 0x8602)
     message.body.setField('info', a2b_hex('cbcecce5'))
     #尾部分长度固定为9
     message.body.setField('len', len(message.body.fields['msg_data']) + 9)
     self.sendData(message)
Exemplo n.º 6
0
 def on_qq_login(self,message):
     '''
     这个也是登陆过程中自动处理的一部分,当登陆成功后,self.qq.login这个属性为1,否则则没有登陆成功。
     调用了lib后可以通过这个属性来判断是否登陆成功。
     '''
     if message.body.fields['status'][0]==1:
         #self.transport.connect(util.ip2string(message.body.fields['ip']),8000)
         self.qq.server=(util.ip2string(message.body.fields['ip']),8000)
         defer.succeed(self.pre_login())
     else:
         if message.body.fields['status'][0]==5:
             print message.body.fields['data'][0]
         elif message.body.fields['status'][0]==6:
             self.printl('您的号码[' + str(self.qq.id) + ']可能存在异常情况,已受到限制登录保护,需激活后才能正常登录。\
                         激活地址是:\
                         电信或网通用户 :im.qq.com/jh或activate.qq.com\
                         教育网用户: activateedu.qq.com') 
         else:
             self.printl('登陆成功')
             self.qq.login = 1
             self.qq.session=message.body.fields['session']
             message = qqmsg.outqqMessage(self.qq)
             message.setMsgName('qq_chang_status')
             message.body.setField('online',basic.QQ_status['online'])
             message.body.setField('video',basic.QQ_video)
             self.sendDataToQueue(message)
Exemplo n.º 7
0
 def get_friend_online(self, start):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_get_friend_online')
     message.body.setField('type', 0x02)
     message.body.setField('start', start)
     message.body.setField('unknown', 0)
     message.body.setField('unknown1', 0)
     self.sendData(message)
Exemplo n.º 8
0
 def alive(self):
     """
     用户QQ号的字符串形式,其他地方是数字方式。
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_alive')
     message.body.setField('qq',str(self.qq.id))
     self.sendData(message)
Exemplo n.º 9
0
 def alive(self):
     """
     用户QQ号的字符串形式,其他地方是数字方式。
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_alive')
     message.body.setField('qq', str(self.qq.id))
     self.sendData(message)
Exemplo n.º 10
0
 def get_friend_online(self, start):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_get_friend_online')
     message.body.setField('type', 0x02)
     message.body.setField('start', start)
     message.body.setField('unknown',0)
     message.body.setField('unknown1',0)
     self.sendDataToQueue(message)
Exemplo n.º 11
0
 def alive(self):
     """
     用户QQ号的字符串形式,其他地方是数字方式。
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_alive')
     message.body.setField('qq',str(self.qq.id))
     self.sendDataToQueue(message)
     reactor.callLater(60, self.alive)
Exemplo n.º 12
0
 def alive(self):
     """
     用户QQ号的字符串形式,其他地方是数字方式。
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_alive')
     message.body.setField('qq', str(self.qq.id))
     self.sendDataToQueue(message)
     reactor.callLater(60, self.alive)
Exemplo n.º 13
0
 def logout(self):
     """
     序号不自动,指定为0xFFFF
     用session key加密的password key
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_logout')
     message.head.sequence = 0xffff
     message.body.setField('key', self.qq.md5pwd)
     self.sendData(message)
Exemplo n.º 14
0
 def logout(self):
     """
     序号不自动,指定为0xFFFF
     用session key加密的password key
     """
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_logout')
     message.head.sequence=0xffff
     message.body.setField('key',self.qq.md5pwd)
     self.sendDataToQueue(message)
Exemplo n.º 15
0
 def group_send(self, recv_group, msg):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_group_cmd')
     self.qq.session_id += 1
     message.body.setField('cmd_type', basic.GROUP_cmd['send'])
     message.body.setField('recv_group', recv_group)
     message.body.setField('len', len(msg) + 14)
     message.body.setField('msg_data', msg)
     message.body.setField('msg_link', ' ' + chr(00))
     message.body.setField('msg_end', 9)
     message.body.setField('msg_red', 0)
     message.body.setField('msg_green', 0)
     message.body.setField('msg_blue', 0)
     message.body.setField('unknown', 0)
     message.body.setField('encoding', 0x8602)
     message.body.setField('info', a2b_hex('cbcecce5'))
     message.body.setField('end_len', 13)
     self.sendDataToQueue(message)
Exemplo n.º 16
0
 def group_send(self, recv_group, msg):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_group_cmd')
     self.qq.session_id += 1
     message.body.setField('cmd_type',basic.GROUP_cmd['send'])
     message.body.setField('recv_group',recv_group)
     message.body.setField('len',len(msg)+14)
     message.body.setField('msg_data',msg)
     message.body.setField('msg_link',' '+chr(00))
     message.body.setField('msg_end',9)
     message.body.setField('msg_red',0)
     message.body.setField('msg_green',0)
     message.body.setField('msg_blue',0)
     message.body.setField('unknown',0)
     message.body.setField('encoding',0x8602)
     message.body.setField('info',a2b_hex('cbcecce5'))
     message.body.setField('end_len',13)
     self.sendDataToQueue(message)
Exemplo n.º 17
0
 def on_qq_login(self,message):
     '''
     这个也是登陆过程中自动处理的一部分,当登陆成功后,self.qq.login这个属性为1,否则则没有登陆成功。
     调用了lib后可以通过这个属性来判断是否登陆成功。
     '''
     if message.body.fields['status'][0]==1:
         self.qq.server=(util.ip2string(message.body.fields['ip']),8000)
         self.pre_login()
     else:
         if message.body.fields['status'][0]==5:
             print message.body.fields['data'][0]
         elif message.body.fields['status'][0]==6:
             self.printl('您的号码[' + str(self.qq.id) + ']可能存在异常情况,已受到限制登录保护,请用标准QQ客户端登陆并激活后才能正常登录。') 
         else:
             self.printl('登陆成功')
             self.qq.session=message.body.fields['session']
             message = qqmsg.outqqMessage(self.qq)
             message.setMsgName('qq_chang_status')
             message.body.setField('online',basic.QQ_status['online'])
             message.body.setField('video',basic.QQ_video)
             self.sendData(message)
Exemplo n.º 18
0
 def on_qq_pre_login(self,message):
     '''
     当收到登陆令牌后,判断令牌是否正确。
     然后发送qq_login的报文开始登陆。
     由于这个部分是自动处理的,所以当发送登陆令牌请求包后,会自动工作到改变在线状态为止。
     '''
     status=message.body.fields['status']
     pre_len=message.body.fields['pre_len']
     pre=message.body.fields['pre']
     if status != 0:
         print '申请登陆令牌错!'
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_login')
     message.body.setField('initkey',self.qq.initkey)
     message.body.setField('md5',tea.encrypt('',self.qq.md5pwd))
     message.body.setField('16_51',a2b_hex(basic.QQ_login_16_51))
     message.body.setField('login_status',chr(basic.QQ_login['normal']))
     message.body.setField('53_68',a2b_hex(basic.QQ_login_53_68))
     message.body.setField('pre_len',chr(pre_len))
     message.body.setField('pre',pre[0])
     message.body.setField('unknown',chr(0x40))
     message.body.setField('login_end',a2b_hex(basic.QQ_login_end))
     message.body.setField('end',(416-len(message.body))*chr(00))
     self.sendDataToQueue(message)
Exemplo n.º 19
0
 def on_qq_pre_login(self, message):
     '''
     当收到登陆令牌后,判断令牌是否正确。
     然后发送qq_login的报文开始登陆。
     由于这个部分是自动处理的,所以当发送登陆令牌请求包后,会自动工作到改变在线状态为止。
     '''
     status = message.body.fields['status']
     pre_len = message.body.fields['pre_len']
     pre = message.body.fields['pre']
     if status != 0:
         print '申请登陆令牌错!'
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_login')
     message.body.setField('initkey', self.qq.initkey)
     message.body.setField('md5', tea.encrypt('', self.qq.md5pwd))
     message.body.setField('16_51', a2b_hex(basic.QQ_login_16_51))
     message.body.setField('login_status', chr(basic.QQ_login['normal']))
     message.body.setField('53_68', a2b_hex(basic.QQ_login_53_68))
     message.body.setField('pre_len', chr(pre_len))
     message.body.setField('pre', pre[0])
     message.body.setField('unknown', chr(0x40))
     message.body.setField('login_end', a2b_hex(basic.QQ_login_end))
     message.body.setField('end', (416 - len(message.body)) * chr(00))
     self.sendDataToQueue(message)
Exemplo n.º 20
0
    def recv(self, message):
        #将收到的消息的前16位返回给服务器,表示已经收到消息
        sequence = message.head.sequence
        send_qq = message.body.fields['send_qq']
        recv_qq = message.body.fields['recv_qq']
        msg_id = message.body.fields['msg_id']
        send_ip = message.body.fields['send_ip']
        if message.body.fields['type'] == '固定群消息':
            #203073669:1073669
            #211722757:9722757
            #205237013:3237013
            #484964496:15964496
            #204567903:2567903
            #211112120:9112120

            self.printl(message.body.fields['type'])
            print str(message.body.fields['group_id'])+':'+\
                  str(send_qq)+link1+\
                  str(message.body.fields['send_qq1'])+link2+\
                  message.body.fields['msg_data'][0]

            if message.body.fields['group_id'] == 9112120:
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id'] == 1073669:
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id'] == 9722757:
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id'] == 3237013:
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id'] == 15964496:
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id'] == 2567903:
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])

            #将接受到的流水号发送出去。
            message = qqmsg.outqqMessage(self.qq)
            message.head.sequence = sequence
            message.setMsgName('qq_recv')
            message.body.setField('send_qq', send_qq)
            message.body.setField('recv_qq', recv_qq)
            message.body.setField('msg_id', msg_id)
            message.body.setField('send_ip', send_ip)
            self.sendDataToQueue(message)
        #如果不为群消息。
        elif message.body.fields['type'] == '好友消息' or \
           message.body.fields['type'] == '陌生人消息' :
            self.printl(message.body.fields['type'])
            self.printl(message.body.fields['type'])
            try:
                print self.qq.friend_list[message.body.fields['send_qq']]['name']+':'+\
                    message.body.fields['msg_data']
            except KeyError:
                print str(message.body.fields['send_qq'])+':'+\
                    message.body.fields['msg_data']
            #将接受到的流水号发送出去。
            message = qqmsg.outqqMessage(self.qq)
            message.head.sequence = sequence
            message.setMsgName('qq_recv')
            message.body.setField('send_qq', send_qq)
            message.body.setField('recv_qq', recv_qq)
            message.body.setField('msg_id', msg_id)
            message.body.setField('send_ip', send_ip)
            self.sendDataToQueue(message)
Exemplo n.º 21
0
 def pre_login(self):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_pre_login')
     message.body.setField('unknown',0)
     self.sendData(message)
Exemplo n.º 22
0
 def pre_login(self):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_pre_login')
     message.body.setField('unknown', 0)
     self.sendData(message)
Exemplo n.º 23
0
 def pre_login(self):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_pre_login')
     message.body.setField('unknown', 0)
     self.sendDataToQueue(message)
     qqp.qqClientQueueProtocol.connectionMade(self)
Exemplo n.º 24
0
 def get_friend_list(self, start):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_get_friend_list')
     message.body.setField('start', start)
     message.body.setField('sorted', basic.QQ_friend_list_sorted)
     self.sendData(message)
Exemplo n.º 25
0
 def get_friend_list(self, start):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_get_friend_list')
     message.body.setField('start', start)
     message.body.setField('sorted',basic.QQ_friend_list_sorted)
     self.sendDataToQueue(message)
Exemplo n.º 26
0
    def recv(self, message):
        #将收到的消息的前16位返回给服务器,表示已经收到消息
        sequence = message.head.sequence
        send_qq = message.body.fields['send_qq']
        recv_qq = message.body.fields['recv_qq']
        msg_id = message.body.fields['msg_id']
        send_ip = message.body.fields['send_ip'] 
        if message.body.fields['type'] == '固定群消息' :
            #203073669:1073669
            #211722757:9722757
            #205237013:3237013
            #484964496:15964496
            #204567903:2567903
            #211112120:9112120
            
            self.printl(message.body.fields['type'])
            print str(message.body.fields['group_id'])+':'+\
                  str(send_qq)+link1+\
                  str(message.body.fields['send_qq1'])+link2+\
                  message.body.fields['msg_data'][0]

            if message.body.fields['group_id']==9112120 :
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id']==1073669 :
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id']==9722757 :
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id']==3237013 :
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id']==15964496 :
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(204567903)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
            elif message.body.fields['group_id']==2567903 :
                self.qq.bri.append(str(203073669)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211722757)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(205237013)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(484964496)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                self.qq.bri.append(str(211112120)+'$%^'+str(message.body.fields['group_id'])+link1+\
                                              str(message.body.fields['send_qq1'])+link2+\
                                              message.body.fields['msg_data'][0])
                   
            #将接受到的流水号发送出去。
            message = qqmsg.outqqMessage(self.qq)
            message.head.sequence = sequence
            message.setMsgName('qq_recv')
            message.body.setField('send_qq',send_qq)
            message.body.setField('recv_qq',recv_qq)
            message.body.setField('msg_id',msg_id)
            message.body.setField('send_ip',send_ip)
            self.sendDataToQueue(message)
        #如果不为群消息。
        elif message.body.fields['type'] == '好友消息' or \
           message.body.fields['type'] == '陌生人消息' :
            self.printl(message.body.fields['type'])
            self.printl(message.body.fields['type'])
            try:
                print self.qq.friend_list[message.body.fields['send_qq']]['name']+':'+\
                    message.body.fields['msg_data']
            except KeyError:
                print str(message.body.fields['send_qq'])+':'+\
                    message.body.fields['msg_data']
            #将接受到的流水号发送出去。
            message = qqmsg.outqqMessage(self.qq)
            message.head.sequence = sequence
            message.setMsgName('qq_recv')
            message.body.setField('send_qq',send_qq)
            message.body.setField('recv_qq',recv_qq)
            message.body.setField('msg_id',msg_id)
            message.body.setField('send_ip',send_ip)
            self.sendDataToQueue(message)
Exemplo n.º 27
0
 def pre_login(self):
     message = qqmsg.outqqMessage(self.qq)
     message.setMsgName('qq_pre_login')
     message.body.setField('unknown',0)
     self.sendDataToQueue(message)
     qqp.qqClientQueueProtocol.connectionMade(self)