|

楼主 |
发表于 2004-3-25 22:39:37
|
显示全部楼层
多谢aries1998兄的提醒,确实是一个bug, 请人工修改gaim_cvs_0319/src/protocols/qq/qq_im.c 中的 _qq_process_recv_im_normal_text 函数。改为如下:
[PHP]/*****************************************************************************/
// process received normal text IM
void _qq_process_recv_normal_im_text
(guint8 *data, guint8 **cursor, gint len,
qq_recv_normal_im_common *common, GaimConnection *gc) {
guint16 gaim_msg_type;
gchar *name;
gchar *msg_with_gaim_smiley;
gchar *msg_utf8_encoded;
qq_data *qd;
qq_recv_normal_im_text *im_text;
g_return_if_fail(gc != NULL && gc->proto_data != NULL && common != NULL);
qd = (qq_data *)gc->proto_data;
// now it is QQ_NORMAL_IM_TEXT
if (*cursor >= (data+len-1)) {
gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Received normal IM text is empty\n");
return;
} else im_text = g_newa(qq_recv_normal_im_text, 1);
im_text->common = common;
// push data into im_text
read_packet_w (data, cursor, len, &(im_text->msg_seq));
read_packet_dw (data, cursor, len, &(im_text->send_time));
read_packet_b (data, cursor, len, &(im_text->unknown1));
read_packet_b (data, cursor, len, &(im_text->sender_icon));
read_packet_data(data, cursor, len, (guint8 *)&(im_text->unknown2), 3);
read_packet_b (data, cursor, len, &(im_text->is_there_font_attr));
read_packet_data(data, cursor, len, (guint8 *)&(im_text->unknown3), 4);
read_packet_b (data, cursor, len, &(im_text->msg_type));
// we need to check if this is auto-reply
// QQ2003iii build 0304, returns the msg without font_attr
// even the is_there_font_attr shows 0x01, and msg does not ends with 0x00
if (im_text->msg_type == QQ_IM_AUTO_REPLY) {
im_text->is_there_font_attr = 0x00; // indeed there is no this flag
im_text->msg = g_strndup(*cursor, data + len - *cursor);
} else { // it is normal mesasge
im_text->msg = g_strdup(*cursor); *cursor += strlen(im_text->msg)+1;
im_text->font_attr_len = data + len - *cursor;
im_text->font_attr = g_memdup(*cursor, im_text->font_attr_len);
}// if im_text->msg_type
name = uid_to_gaim_name(common->sender_uid);
if (gaim_find_buddy(gc->account, name) == NULL)
qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE);
gaim_msg_type =
(im_text->msg_type == QQ_IM_AUTO_REPLY) ? GAIM_CONV_IM_AUTO_RESP : 0;
msg_with_gaim_smiley = qq_smiley_to_gaim(im_text->msg);
msg_utf8_encoded = im_text->is_there_font_attr ?
qq_encode_to_gaim(im_text->font_attr,
im_text->font_attr_len,
msg_with_gaim_smiley) :
qq_to_utf8(msg_with_gaim_smiley, QQ_CHARSET_DEFAULT);
// send encoded to gaim, note that we use im_text->send_time,
// not the time we receive the message
// as it may have been dealyed when I am not online.
serv_got_im(gc, name, msg_utf8_encoded,
gaim_msg_type, (time_t)im_text->send_time);
g_free(msg_utf8_encoded);
g_free(msg_with_gaim_smiley); g_free(name);
g_free(im_text->msg);
if (im_text->is_there_font_attr) g_free(im_text->font_attr);
}// _qq_process_recv_normal_im_text
[/PHP] |
|