void prot_user_get_level_reply( struct qqclient* qq, qqpacket* p ) { bytebuffer *buf = p->buf; uchar cmd; cmd = get_byte( buf ); get_int( buf ); //self number // DBG("cmd=%d", cmd ); switch( cmd ){ case 0x88: get_int( buf ); //00000003 unknown qq->level = get_word( buf ); //level qq->active_days = get_word( buf ); //active days get_word( buf ); //unknown qq->upgrade_days = get_word( buf ); //upgrade days DBG("level: %d active_days: %d upgrade_days: %d", qq->level, qq->active_days, qq->upgrade_days ); char event[32]; sprintf( event, "level^$%d^$%d^$%d", qq->level, qq->active_days, qq->upgrade_days ); qqclient_put_event( qq, event ); break; default: DBG("unknown cmd: 0x%x", cmd ); break; } }
EXPORT uint libqq_refresh( qqclient* qq ) { char event[16]; qqclient_set_process( qq, qq->process ); sprintf( event, "status^$%d", qq->mode ); qqclient_put_event( qq, event ); buddy_put_event( qq ); group_put_event( qq ); qun_put_event( qq ); qqclient_set_process( qq, qq->process ); return qq->number; }
EXPORT uint webqq_get_number( user* u ) { qqclient* qq = (qqclient*)u->qq; char event[16]; qqclient_set_process( qq, qq->process ); sprintf( event, "status^$%d", qq->mode ); qqclient_put_event( qq, event ); buddy_put_event( qq ); group_put_event( qq ); qun_put_event( qq ); qqclient_set_process( qq, qq->process ); return qq->number; }
void prot_user_change_status_reply( struct qqclient* qq, qqpacket* p ) { bytebuffer *buf = p->buf; if( get_byte( buf ) == '0' ){ qq->self->status = qq->mode; DBG("change status to %d", qq->mode ); char event[16]; sprintf( event, "status^$%d", qq->mode ); qqclient_put_event( qq, event ); }else{ DBG("change status failed."); } }
void prot_user_keep_alive_reply( struct qqclient* qq, qqpacket* p ) { bytebuffer *buf = p->buf; get_byte( buf ); //00 int onlines; onlines = get_int( buf ); int ip; ip = get_int( buf ); //client ip ushort port = get_word( buf ); //client port get_word( buf ); //unknown 00 3c uint server_time; server_time = get_int( buf ); //...5 zeros time_t t; t = CN_TIME( server_time ); char event[64]; sprintf( event, "keepalive^$%u", qq->number ); qqclient_put_event( qq, event ); // DBG("keepalive: %u ", qq->number ); port = ip= 0; }
int packetmgr_check_packet( struct qqclient* qq, int timeout ) { qqpacketmgr *mgr = &qq->packetmgr; qqpacket* p; time_t timeout_time = time(NULL) - timeout; //when locked, cannot recv packet till unlock. do{ p = loop_search( &mgr->sent_loop, (void*)timeout_time, timeout_searcher ); if( p ){ loop_remove( &mgr->sent_loop, p ); } if( p ){ if( p->send_times >= 10 ){ MSG("[%u] Failed to send the packet. command: %x\n", qq->number, p->command ); if( p->command == QQ_CMD_SEND_IM ){ buddy_msg_callback( qq, 10000, time(NULL), "刚才某条消息发送失败。" ); } //make an event to tell the program that we have a //problem. char event[64]; sprintf( event, "sendfailed^$%d^$%d", p->command, p->seqno ); qqclient_put_event( qq, event ); delete_func( p ); mgr->failed_packets ++; //To avoid too many failed packets, just shut it down. if( mgr->failed_packets > 5 || qq->process != P_LOGIN ){ qqclient_set_process( qq, P_ERROR ); } }else{ DBG("[%u] resend packet cmd: %x", qq->number, p->command ); packetmgr_put_urge( qq, p, 1 ); } } }while( 0 && p ); check_ready_packets(qq); return 0; }