Example #1
0
void prot_qun_cmd_reply( struct qqclient* qq, qqpacket* p )
{
	bytebuffer *buf = p->buf;
	uchar cmd = get_byte( buf );
	uchar result = get_byte( buf );
	if( result != 0 ){
		DBG("result = %d", result );
		return ;
	}
	uint number = get_int( buf );
	qqqun* q = qun_get( qq, number, 0 );
	if( !q ){
		DBG("q==null");
		return;
	}
	switch( cmd ){
		case 0x2A:	//send msg;
			break;
		case 0x72:
			parse_quninfo( qq, p, q );
			break;
		case 0x0C:
			parse_memberinfo( qq, p, q );
			break;
		case 0x0B:
			parse_online( qq, p, q );
			break;
		case 0x0F:
			parse_membername( qq, p, q );
			break;
		default:
			DBG("unknown cmd = %x", cmd );
	}

}
Example #2
0
void qun_msg_callback ( qqclient* qq, uint uid, uint int_uid,
	time_t t, char* msg )
{
	qqqun* q;
	char timestr[24];
	struct tm * timeinfo, * tmnow;
	char* str;
	int len, d1, d2;
	time_t t_now;
	t_now = time(NULL);
  	tmnow = localtime( &t_now );
  	d1 = tmnow->tm_mday;
  	timeinfo = localtime ( &t );
  	d2 = timeinfo->tm_mday;
  	if( d1 != d2 ){
		strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	}else{
		strftime( timestr, 24, "%H:%M:%S", timeinfo );
	}
	q = qun_get( qq, int_uid, 1 );
	if( !q ){
		DBG (("error: q=NULL"));
		return;
	}
	len = strlen( msg );
	NEW( char *, str, len+64 );
	sprintf( str, "clustermsg^$%u^$%u^$%s^$%s", q->ext_number, uid, timestr, msg );
	qqclient_put_message( qq, str );
}
Example #3
0
void qun_msg_callback ( qqclient* qq, uint uid, uint int_uid,
	time_t t, char* msg )
{
	qqqun* q;
	char timestr[24];
	struct tm * timeinfo;
	char* str;
	int len;
  	timeinfo = localtime ( &t );
	strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	q = qun_get( qq, int_uid, 1 );
	if( !q ){
		DBG("error: q=NULL");
		return;
	}
	len = strlen( msg );
	NEW( str, len+64 );
	sprintf( str, "clustermsg^$%u^$%u^$%s^$%s", q->ext_number, uid, timestr, msg );
	qqclient_put_message( qq, str );
}
Example #4
0
void prot_login_get_list_reply( struct qqclient* qq, qqpacket* p )
{
    bytebuffer *buf = p->buf;
    ushort next_pos, len;
    len = get_word( buf );	//00 9C
    get_int( buf );	//00 00 00 00
    next_pos = get_word( buf );
    if( next_pos > 0x0000 ) {
        //Well, i don't know how to judge whether we have got the whole list, so I just
        //tested the length.
        DBG("next_pos = %d", next_pos );
        if( len == 0x038A ) {
            prot_login_get_list( qq, ++ qq->data.login_list_count );
        }
    } else {
        prot_login_send_info( qq );
    }
    while( buf->pos < buf->len-2 ) {	//2zeros in the end
        uint number = get_int( buf );
        uchar type = get_byte( buf );
        uchar gid = get_byte( buf );
        if( type == 0x04 )	//if it is a qun
        {
#ifndef NO_QUN_INFO
            qun_get( qq, number, 1 );
#endif
        } else if( type == 0x01 ) {
#ifndef NO_BUDDY_INFO
            qqbuddy* b = buddy_get( qq, number, 1 );
            if( b )
                b->gid = gid / 4;
#endif
        }
        number = type = gid = 0;
    }
}