diff libpurple/protocols/qq/group_im.c @ 31191:4deef745de87

2010.01.23 - flos <lonicerae(at)gmail.com> * added an option to force incoming message in chat room to use a default font instead of the font in message itself 2010.01.18 - flos <lonicerae(at)gmail.com> * added type 'UPDCLS' and 'UID' for implementing business logic layer 2010.01.13 - ccpaging <ccpaging(at)gmail.com> * qq2009-1 patch from ccpaging
author SHiNE CsyFeK <csyfek@gmail.com>
date Sun, 06 Feb 2011 05:23:22 +0000
parents 351d07aefb09
children
line wrap: on
line diff
--- a/libpurple/protocols/qq/group_im.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_im.c	Sun Feb 06 05:23:22 2011 +0000
@@ -161,7 +161,7 @@
 }
 
 void qq_room_got_chat_in(PurpleConnection *gc,
-		guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time)
+		guint32 room_id, UID uid_from, const gchar *msg, time_t in_time)
 {
 	PurpleConversation *conv;
 	qq_data *qd;
@@ -207,10 +207,11 @@
 {
 	gchar *msg_smiley, *msg_fmt, *msg_utf8;
 	gint bytes, tail_len;
+	qq_data *qd;
 	struct {
 		guint32 ext_id;
 		guint8 type8;
-		guint32 member_uid;
+		UID member_uid;
 		guint16 unknown;
 		guint16 msg_seq;
 		time_t send_time;
@@ -222,11 +223,15 @@
 	guint16 content_type;
 	guint8 frag_count, frag_index;
 	guint16 msg_id;
+	guint32 use_default_font;
 	qq_im_format *fmt = NULL;
+	qd = (qq_data *) gc->proto_data;
 
 	/* at least include im_text.msg_len */
 	g_return_if_fail(data != NULL && data_len > 23);
 
+	use_default_font = (qd->custom) & QQ_CUSTOM_USE_DEFAULT_FONT;
+
 	/* qq_show_packet("ROOM_IM", data, data_len); */
 	memset(&im_text, 0, sizeof(im_text));
 	bytes = 0;
@@ -279,8 +284,14 @@
 	/* group im_group has no flag to indicate whether it has font_attr or not */
 	msg_smiley = qq_emoticon_to_purple(im_text.msg);
 	if (fmt != NULL) {
+		purple_debug_info("QQ", "going to use_default_font\n");
+		if (QQ_CUSTOM_USE_DEFAULT_FONT == use_default_font) {
+			qq_im_fmt_reset_font(fmt);
+			purple_debug_info("QQ", "use_default_font set\n");
+		}
 		msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley);
 		msg_utf8 =  qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT);
+		purple_debug_info("QQ", "passed!\n");
 		g_free(msg_fmt);
 		qq_im_fmt_free(fmt);
 	} else {