libpurple/protocols/qq/group_im.c

branch
openq
changeset 31393
04447b1f6403
parent 30706
612b36b49058
equal deleted inserted replaced
31392:93902a4213b6 31393:04447b1f6403
159 } 159 }
160 g_list_free(flags); 160 g_list_free(flags);
161 } 161 }
162 162
163 void qq_room_got_chat_in(PurpleConnection *gc, 163 void qq_room_got_chat_in(PurpleConnection *gc,
164 guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time) 164 guint32 room_id, UID uid_from, const gchar *msg, time_t in_time)
165 { 165 {
166 PurpleConversation *conv; 166 PurpleConversation *conv;
167 qq_data *qd; 167 qq_data *qd;
168 qq_buddy_data *bd; 168 qq_buddy_data *bd;
169 qq_room_data *rmd; 169 qq_room_data *rmd;
205 /* recv an IM from a group chat */ 205 /* recv an IM from a group chat */
206 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) 206 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type)
207 { 207 {
208 gchar *msg_smiley, *msg_fmt, *msg_utf8; 208 gchar *msg_smiley, *msg_fmt, *msg_utf8;
209 gint bytes, tail_len; 209 gint bytes, tail_len;
210 qq_data *qd;
210 struct { 211 struct {
211 guint32 ext_id; 212 guint32 ext_id;
212 guint8 type8; 213 guint8 type8;
213 guint32 member_uid; 214 UID member_uid;
214 guint16 unknown; 215 guint16 unknown;
215 guint16 msg_seq; 216 guint16 msg_seq;
216 time_t send_time; 217 time_t send_time;
217 guint32 version; 218 guint32 version;
218 guint16 msg_len; 219 guint16 msg_len;
220 } im_text; 221 } im_text;
221 guint32 temp_id; 222 guint32 temp_id;
222 guint16 content_type; 223 guint16 content_type;
223 guint8 frag_count, frag_index; 224 guint8 frag_count, frag_index;
224 guint16 msg_id; 225 guint16 msg_id;
226 guint32 use_default_font;
225 qq_im_format *fmt = NULL; 227 qq_im_format *fmt = NULL;
228 qd = (qq_data *) gc->proto_data;
226 229
227 /* at least include im_text.msg_len */ 230 /* at least include im_text.msg_len */
228 g_return_if_fail(data != NULL && data_len > 23); 231 g_return_if_fail(data != NULL && data_len > 23);
232
233 use_default_font = (qd->custom) & QQ_CUSTOM_USE_DEFAULT_FONT;
229 234
230 /* qq_show_packet("ROOM_IM", data, data_len); */ 235 /* qq_show_packet("ROOM_IM", data, data_len); */
231 memset(&im_text, 0, sizeof(im_text)); 236 memset(&im_text, 0, sizeof(im_text));
232 bytes = 0; 237 bytes = 0;
233 bytes += qq_get32(&(im_text.ext_id), data + bytes); 238 bytes += qq_get32(&(im_text.ext_id), data + bytes);
277 } 282 }
278 283
279 /* group im_group has no flag to indicate whether it has font_attr or not */ 284 /* group im_group has no flag to indicate whether it has font_attr or not */
280 msg_smiley = qq_emoticon_to_purple(im_text.msg); 285 msg_smiley = qq_emoticon_to_purple(im_text.msg);
281 if (fmt != NULL) { 286 if (fmt != NULL) {
287 purple_debug_info("QQ", "going to use_default_font\n");
288 if (QQ_CUSTOM_USE_DEFAULT_FONT == use_default_font) {
289 qq_im_fmt_reset_font(fmt);
290 purple_debug_info("QQ", "use_default_font set\n");
291 }
282 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); 292 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley);
283 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); 293 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT);
294 purple_debug_info("QQ", "passed!\n");
284 g_free(msg_fmt); 295 g_free(msg_fmt);
285 qq_im_fmt_free(fmt); 296 qq_im_fmt_free(fmt);
286 } else { 297 } else {
287 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); 298 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT);
288 } 299 }

mercurial