comparison src/protocols/qq/group_im.c @ 14050:6342ffdeb3ac

[gaim-migrate @ 16663] Eliminated some warnings. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Mon, 07 Aug 2006 07:39:00 +0000
parents ef8490f9e823
children
comparison
equal deleted inserted replaced
14049:8294485b79db 14050:6342ffdeb3ac
43 guint8 group_type; 43 guint8 group_type;
44 guint32 member_uid; 44 guint32 member_uid;
45 guint16 msg_seq; 45 guint16 msg_seq;
46 time_t send_time; 46 time_t send_time;
47 guint16 msg_len; 47 guint16 msg_len;
48 guint8 *msg; 48 gchar *msg;
49 guint8 *font_attr; 49 guint8 *font_attr;
50 gint font_attr_len; 50 gint font_attr_len;
51 } qq_recv_group_im; 51 } qq_recv_group_im;
52 52
53 /* send IM to a group */ 53 /* send IM to a group */
54 void qq_send_packet_group_im(GaimConnection *gc, qq_group *group, const gchar *msg) 54 void qq_send_packet_group_im(GaimConnection *gc, qq_group *group, const gchar *msg)
55 { 55 {
56 gint data_len, bytes; 56 gint data_len, bytes;
57 guint8 *raw_data, *cursor; 57 guint8 *raw_data, *cursor, *send_im_tail;
58 guint16 msg_len; 58 guint16 msg_len;
59 gchar *msg_filtered; 59 gchar *msg_filtered;
60 60
61 g_return_if_fail(gc != NULL && group != NULL && msg != NULL); 61 g_return_if_fail(gc != NULL && group != NULL && msg != NULL);
62 62
68 68
69 bytes = 0; 69 bytes = 0;
70 bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_SEND_MSG); 70 bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_SEND_MSG);
71 bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id); 71 bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id);
72 bytes += create_packet_w(raw_data, &cursor, msg_len + QQ_SEND_IM_AFTER_MSG_LEN); 72 bytes += create_packet_w(raw_data, &cursor, msg_len + QQ_SEND_IM_AFTER_MSG_LEN);
73 bytes += create_packet_data(raw_data, &cursor, (gchar *) msg_filtered, msg_len); 73 bytes += create_packet_data(raw_data, &cursor, (guint8 *) msg_filtered, msg_len);
74 guint8 *send_im_tail = qq_get_send_im_tail(NULL, NULL, NULL, 74 send_im_tail = qq_get_send_im_tail(NULL, NULL, NULL,
75 FALSE, FALSE, FALSE, 75 FALSE, FALSE, FALSE,
76 QQ_SEND_IM_AFTER_MSG_LEN); 76 QQ_SEND_IM_AFTER_MSG_LEN);
77 bytes += create_packet_data(raw_data, &cursor, (gchar *) send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN); 77 bytes += create_packet_data(raw_data, &cursor, send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN);
78 g_free(send_im_tail); 78 g_free(send_im_tail);
79 g_free(msg_filtered); 79 g_free(msg_filtered);
80 80
81 if (bytes == data_len) /* create OK */ 81 if (bytes == data_len) /* create OK */
82 qq_send_group_cmd(gc, group, raw_data, data_len); 82 qq_send_group_cmd(gc, group, raw_data, data_len);
294 294
295 g_free(msg); 295 g_free(msg);
296 } 296 }
297 297
298 /* recv an IM from a group chat */ 298 /* recv an IM from a group chat */
299 void qq_process_recv_group_im 299 void qq_process_recv_group_im(guint8 *data, guint8 **cursor, gint data_len,
300 (guint8 *data, guint8 **cursor, gint data_len, guint32 internal_group_id, GaimConnection *gc, guint16 im_type) 300 guint32 internal_group_id, GaimConnection *gc, guint16 im_type)
301 { 301 {
302 gchar *msg_with_gaim_smiley, *msg_utf8_encoded, *im_src_name; 302 gchar *msg_with_gaim_smiley, *msg_utf8_encoded, *im_src_name;
303 guint16 unknown; 303 guint16 unknown;
304 guint32 unknown4; 304 guint32 unknown4;
305 GaimConversation *conv; 305 GaimConversation *conv;
360 skip_len = 10; 360 skip_len = 10;
361 else 361 else
362 skip_len = 0; 362 skip_len = 0;
363 *cursor += skip_len; 363 *cursor += skip_len;
364 364
365 im_group->msg = g_strdup(*cursor); 365 im_group->msg = g_strdup((gchar *) *cursor);
366 *cursor += strlen(im_group->msg) + 1; 366 *cursor += strlen(im_group->msg) + 1;
367 /* there might not be any font_attr, check it */ 367 /* there might not be any font_attr, check it */
368 im_group->font_attr_len = im_group->msg_len - strlen(im_group->msg) - 1 - skip_len; 368 im_group->font_attr_len = im_group->msg_len - strlen(im_group->msg) - 1 - skip_len;
369 if (im_group->font_attr_len > 0) 369 if (im_group->font_attr_len > 0)
370 im_group->font_attr = g_memdup(*cursor, im_group->font_attr_len); 370 im_group->font_attr = g_memdup(*cursor, im_group->font_attr_len);