From: <mar...@us...> - 2007-04-04 04:07:19
|
Revision: 18232 http://svn.sourceforge.net/gaim/?rev=18232&view=rev Author: markhuetsch Date: 2007-04-03 21:07:16 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Fixed a bug where gaim was playing n x n times user leaving chat room sound when opening a QQ protocol chat room, n equaling the number of users in the chat room. Patch by gnap. Modified Paths: -------------- trunk/libgaim/protocols/qq/group_conv.c trunk/libgaim/protocols/qq/group_im.c Modified: trunk/libgaim/protocols/qq/group_conv.c =================================================================== --- trunk/libgaim/protocols/qq/group_conv.c 2007-04-04 04:02:28 UTC (rev 18231) +++ trunk/libgaim/protocols/qq/group_conv.c 2007-04-04 04:07:16 UTC (rev 18232) @@ -50,7 +50,7 @@ { GList *names, *list, *flags; qq_buddy *member; - gchar *member_name; + gchar *member_name, *member_uid; GaimConversation *conv; gint flag; g_return_if_fail(group != NULL); @@ -63,23 +63,40 @@ list = group->members; while (list != NULL) { member = (qq_buddy *) list->data; - /* always put it even offline */ - names = g_list_append(names, - /* we need unique identifiers for everyone in the chat or else we'll - * run into problems with functions like get_cb_real_name from qq.c */ - (member->nickname != NULL && *(member->nickname) != '\0') ? + /* we need unique identifiers for everyone in the chat or else we'll + * run into problems with functions like get_cb_real_name from qq.c */ + member_name = (member->nickname != NULL && *(member->nickname) != '\0') ? g_strdup_printf("%s (qq-%u)", member->nickname, member->uid) : - g_strdup_printf("(qq-%u)", member->uid)); + g_strdup_printf("(qq-%u)", member->uid); + member_uid = g_strdup_printf("(qq-%u)", member->uid); + flag = 0; /* TYPING to put online above OP and FOUNDER */ - if (is_online(member->status)) flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE); + if (is_online(member->status)) + flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE); if(1 == (member->role & 1)) flag |= GAIM_CBFLAGS_OP; if(member->uid == group->creator_uid) flag |= GAIM_CBFLAGS_FOUNDER; + + if(gaim_conv_chat_find_user(GAIM_CONV_CHAT(conv), member_name)) + { + gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(conv), + member_name, + flag); + }else if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(conv), member_uid)) + { + gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(conv), + member_uid, + flag); + gaim_conv_chat_rename_user(GAIM_CONV_CHAT(conv), member_uid, member_name); + }else{ + /* always put it even offline */ + names = g_list_append(names, member_name); flags = g_list_append(flags, GINT_TO_POINTER(flag)); + } + g_free(member_uid); list = list->next; } - gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv)); gaim_conv_chat_add_users(GAIM_CONV_CHAT(conv), names, NULL, flags, FALSE); } /* clean up names */ Modified: trunk/libgaim/protocols/qq/group_im.c =================================================================== --- trunk/libgaim/protocols/qq/group_im.c 2007-04-04 04:02:28 UTC (rev 18231) +++ trunk/libgaim/protocols/qq/group_im.c 2007-04-04 04:07:16 UTC (rev 18232) @@ -63,6 +63,7 @@ g_return_if_fail(group != NULL && msg != NULL); msg_filtered = gaim_markup_strip_html(msg); + gaim_debug(GAIM_DEBUG_INFO, "QQ_MESG", "filterd qq qun mesg: %s\n", msg_filtered); msg_len = strlen(msg_filtered); data_len = 7 + msg_len + QQ_SEND_IM_AFTER_MSG_LEN; raw_data = g_newa(guint8, data_len); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |