Exemplo n.º 1
0
static void process_qun_im( struct qqclient* qq, qqpacket* p, qqmessage* msg )
{
	bytebuffer *buf = p->buf;
	char tmp[MSG_CONTENT_LEN];
	get_int( buf );		//00 00 00 00  09SP1
	get_int( buf );		//ext_number
	get_byte( buf );	//normal qun or temp qun?
	msg->from = get_int( buf );
	if( msg->from == qq->number )
		return;
	get_word( buf );	//zero
	msg->msg_id = get_word( buf );
	msg->msg_time = get_int( buf );
	switch( msg->im_type ){
	case QQ_RECV_IM_QUN_IM_09:
		buf->pos += 16;
		parse_message_09( p, msg, tmp, MSG_CONTENT_LEN );
		strcpy( msg->msg_content, tmp );
		break;
	case QQ_RECV_IM_QUN_IM:
		buf->pos += 16;
		get_string( buf, tmp, MSG_CONTENT_LEN );
		gb_to_utf8( tmp, tmp, MSG_CONTENT_LEN-1 );
		trans_faces( tmp, msg->msg_content, MSG_CONTENT_LEN );
		break;
	}
	
//	DBG("process_qun_im(number:%u): ", msg->from );
//	puts( msg->msg_content );
	qun_msg_callback( qq, msg->from, msg->qun_number, msg->msg_time, msg->msg_content );
}
Exemplo n.º 2
0
static void process_buddy_im_text( struct qqclient* qq, qqpacket* p, qqmessage* msg )
{
	bytebuffer *buf = p->buf;
	char tmp[MSG_CONTENT_LEN];
	get_word( buf );	//session id
	msg->msg_time = get_int( buf );
	get_word( buf );	//face
	buf->pos += 4; 	//0000001
	//分片
	msg->slice_count = get_byte( buf );
	msg->slice_no = get_byte( buf );
	msg->msg_id = get_word( buf );
	msg->auto_reply = get_byte( buf );
	switch( msg->im_type ){
	case QQ_RECV_IM_BUDDY_09:
	case QQ_RECV_IM_BUDDY_09SP1:
		parse_message_09( p, msg, tmp, MSG_CONTENT_LEN );
		strcpy( msg->msg_content, tmp );
		break;
	case QQ_RECV_IM_BUDDY_0801:
		get_string( buf, tmp, MSG_CONTENT_LEN );
		gb_to_utf8( tmp, tmp, MSG_CONTENT_LEN-1 );
		trans_faces( tmp, msg->msg_content, MSG_CONTENT_LEN );
		break;
	case QQ_RECV_IM_BUDDY_0802:
		buf->pos += 8;
		get_string( buf, tmp, MSG_CONTENT_LEN );
		gb_to_utf8( tmp, tmp, MSG_CONTENT_LEN-1 );
		trans_faces( tmp, msg->msg_content, MSG_CONTENT_LEN );
		break;
	}
//	DBG("buddy msg from %u:", msg->from );
	if( qq->auto_reply[0]!='\0' ){ //
		prot_im_send_msg( qq, msg->from, qq->auto_reply );
		return;
	}
	buddy_msg_callback( qq, msg->from, msg->msg_time, msg->msg_content );
}