comparison src/protocols/qq/group_conv.c @ 13870:983fd420e86b

[gaim-migrate @ 16340] Performed minor cleanup of the OpenQ codebase and patched it into the Gaim trunk as a prpl, providing basic QQ functionality. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Mon, 26 Jun 2006 02:58:54 +0000
parents
children ef8490f9e823
comparison
equal deleted inserted replaced
13869:5642f4658b59 13870:983fd420e86b
1 /**
2 * The QQ2003C protocol plugin
3 *
4 * for gaim
5 *
6 * Copyright (C) 2004 Puzzlebird
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 // START OF FILE
24 /*****************************************************************************/
25 #include <glib.h> // GList
26 #include "conversation.h" // GaimConversation
27
28 #include "utils.h" // uid_to_gaim_name
29 #include "buddy_status.h" // is_online
30 #include "group_conv.h"
31 #include "qq.h" // qq_buddy
32
33 /*****************************************************************************/
34 // show group conversation window
35 void qq_group_conv_show_window(GaimConnection * gc, qq_group * group)
36 {
37 GaimConversation *conv;
38 qq_data *qd;
39
40 g_return_if_fail(gc != NULL && gc->proto_data != NULL && group != NULL);
41 qd = (qq_data *) gc->proto_data;
42
43 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, /* add by gfhuang */group->group_name_utf8, gaim_connection_get_account(gc));
44 if (conv == NULL) // show only one window per group
45 serv_got_joined_chat(gc, qd->channel++, group->group_name_utf8);
46 } // qq_group_conv_show_window
47
48 /*****************************************************************************/
49 // refresh online member in group conversation window
50 void qq_group_conv_refresh_online_member(GaimConnection * gc, qq_group * group)
51 {
52 GList *names, *list, *flags;
53 qq_buddy *member;
54 gchar *member_name;
55 GaimConversation *conv;
56 gint flag;
57 g_return_if_fail(gc != NULL && group != NULL);
58
59 names = NULL;
60 flags = NULL;
61 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT /*gfhuang*/, group->group_name_utf8, gaim_connection_get_account(gc));
62 if (conv != NULL && group->members != NULL) {
63 list = group->members;
64 while (list != NULL) {
65 member = (qq_buddy *) list->data;
66 //always put it even offline, by gfhuang
67 names = g_list_append(names,
68 (member->nickname !=
69 NULL) ?
70 g_strdup(member->nickname) : uid_to_gaim_name(member->uid));
71
72 flag = 0;
73 if (is_online(member->status)) flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE); // TYPING to put online above OP and FOUNDER
74 if(1 == (member->role & 1)) flag |= GAIM_CBFLAGS_OP;
75 //if(4 == (member->role & 4)) flag |= GAIM_CBFLAGS_VOICE; //active, no use
76 if(member->uid == group->creator_uid) flag |= GAIM_CBFLAGS_FOUNDER;
77 flags = g_list_append(flags, GINT_TO_POINTER(flag));
78 list = list->next;
79 } // while list
80
81 gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv));
82 gaim_conv_chat_add_users(GAIM_CONV_CHAT(conv), names, NULL /*gfhuang*/, flags, FALSE /*gfhuang*/);
83 } // if conv
84 // clean up names
85 while (names != NULL) {
86 member_name = (gchar *) names->data;
87 names = g_list_remove(names, member_name);
88 g_free(member_name);
89 } // while name
90 // clean up flags, NOOOOOOOOOOOOOOOOOOOOOOO!!!!!! bugs, flags is not name! got by gfhuang
91 /*
92 while (flags != NULL) {
93 member_name = (gchar *) flags->data;
94 flags = g_list_remove(flags, member_name);
95 g_free(member_name);
96 }
97 */
98 g_list_free(flags);
99 } // qq_group_conv_show_window
100
101 /*****************************************************************************/
102 // END OF FILE