Esempio n. 1
0
void prot_login_send_info_reply( struct qqclient* qq, qqpacket* p )
{
    bytebuffer *buf = p->buf;
//	hex_dump( buf->data, buf->len );
    uchar result = get_byte( buf );
    if( result != 0 )
    {
        DBG("login result = %d", result );
        qqclient_set_process( qq, P_ERROR );
        return;
    }
    get_data( buf, qq->data.session_key, sizeof(qq->data.session_key) );
    DBG("session key: " );
    hex_dump( qq->data.session_key, 16 );
    if( qq->number != get_int( buf ) ) {
        DBG("qq->number is wrong?");
    }
    qq->client_ip = get_int( buf );
    qq->client_port = get_word( buf );
    qq->local_ip = get_int( buf );
    qq->local_port = get_word( buf );
    qq->login_time = get_int( buf );
    get_byte( buf );	//03
    get_byte( buf );	//mode
    buf->pos += 96;
    qq->last_login_time = get_int( buf );
    //prepare IM key
    uchar data[20];
    *(uint*)data = htonl( qq->number );
    memcpy( data+4, qq->data.session_key, 16 );
    //md5
    md5_state_t mst;
    md5_init( &mst );
    md5_append( &mst, (md5_byte_t*)data, 20 );
    md5_finish( &mst, (md5_byte_t*)qq->data.im_key );
    //
    time_t t;
    t = CN_TIME( qq->last_login_time );
    DBG("last login time: %s", ctime( &t ) );
    qqclient_set_process( qq, P_LOGIN );

    //get information
    prot_user_change_status( qq );
    prot_user_get_level( qq );
#ifndef NO_GROUP_INFO
    group_update_list( qq );
#endif
#ifndef NO_BUDDY_INFO
    buddy_update_list( qq );
#endif
#ifndef NO_QUN_INFO
    qun_update_all( qq );
#endif
    qq->online_clock = 0;
}
Esempio n. 2
0
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;
}