Mercurial > pidgin.yaz
comparison src/protocols/qq/group_conv.c @ 14021:ef8490f9e823
[gaim-migrate @ 16618]
Replaced all C++-style comments with C-style ones.
Cleaned up some comments and implemented a more consistent formatting scheme.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Huetsch <markhuetsch> |
---|---|
date | Wed, 02 Aug 2006 15:35:36 +0000 |
parents | 983fd420e86b |
children |
comparison
equal
deleted
inserted
replaced
14020:13e7ba964993 | 14021:ef8490f9e823 |
---|---|
18 * You should have received a copy of the GNU General Public License | 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 | 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 | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 */ | 21 */ |
22 | 22 |
23 // START OF FILE | 23 #include <glib.h> |
24 /*****************************************************************************/ | 24 #include "conversation.h" |
25 #include <glib.h> // GList | |
26 #include "conversation.h" // GaimConversation | |
27 | 25 |
28 #include "utils.h" // uid_to_gaim_name | 26 #include "buddy_status.h" |
29 #include "buddy_status.h" // is_online | |
30 #include "group_conv.h" | 27 #include "group_conv.h" |
31 #include "qq.h" // qq_buddy | 28 #include "qq.h" |
29 #include "utils.h" | |
32 | 30 |
33 /*****************************************************************************/ | 31 /* show group conversation window */ |
34 // show group conversation window | 32 void qq_group_conv_show_window(GaimConnection *gc, qq_group *group) |
35 void qq_group_conv_show_window(GaimConnection * gc, qq_group * group) | |
36 { | 33 { |
37 GaimConversation *conv; | 34 GaimConversation *conv; |
38 qq_data *qd; | 35 qq_data *qd; |
39 | 36 |
40 g_return_if_fail(gc != NULL && gc->proto_data != NULL && group != NULL); | 37 g_return_if_fail(gc != NULL && gc->proto_data != NULL && group != NULL); |
41 qd = (qq_data *) gc->proto_data; | 38 qd = (qq_data *) gc->proto_data; |
42 | 39 |
43 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, /* add by gfhuang */group->group_name_utf8, gaim_connection_get_account(gc)); | 40 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, group->group_name_utf8, gaim_connection_get_account(gc)); |
44 if (conv == NULL) // show only one window per group | 41 if (conv == NULL) /* show only one window per group */ |
45 serv_got_joined_chat(gc, qd->channel++, group->group_name_utf8); | 42 serv_got_joined_chat(gc, qd->channel++, group->group_name_utf8); |
46 } // qq_group_conv_show_window | 43 } |
47 | 44 |
48 /*****************************************************************************/ | 45 /* refresh online member in group conversation window */ |
49 // refresh online member in group conversation window | 46 void qq_group_conv_refresh_online_member(GaimConnection *gc, qq_group *group) |
50 void qq_group_conv_refresh_online_member(GaimConnection * gc, qq_group * group) | |
51 { | 47 { |
52 GList *names, *list, *flags; | 48 GList *names, *list, *flags; |
53 qq_buddy *member; | 49 qq_buddy *member; |
54 gchar *member_name; | 50 gchar *member_name; |
55 GaimConversation *conv; | 51 GaimConversation *conv; |
56 gint flag; | 52 gint flag; |
57 g_return_if_fail(gc != NULL && group != NULL); | 53 g_return_if_fail(gc != NULL && group != NULL); |
58 | 54 |
59 names = NULL; | 55 names = NULL; |
60 flags = NULL; | 56 flags = NULL; |
61 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT /*gfhuang*/, group->group_name_utf8, gaim_connection_get_account(gc)); | 57 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, group->group_name_utf8, gaim_connection_get_account(gc)); |
62 if (conv != NULL && group->members != NULL) { | 58 if (conv != NULL && group->members != NULL) { |
63 list = group->members; | 59 list = group->members; |
64 while (list != NULL) { | 60 while (list != NULL) { |
65 member = (qq_buddy *) list->data; | 61 member = (qq_buddy *) list->data; |
66 //always put it even offline, by gfhuang | 62 /* always put it even offline */ |
67 names = g_list_append(names, | 63 names = g_list_append(names, |
68 (member->nickname != | 64 (member->nickname != |
69 NULL) ? | 65 NULL) ? |
70 g_strdup(member->nickname) : uid_to_gaim_name(member->uid)); | 66 g_strdup(member->nickname) : uid_to_gaim_name(member->uid)); |
71 | 67 |
72 flag = 0; | 68 flag = 0; |
73 if (is_online(member->status)) flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE); // TYPING to put online above OP and FOUNDER | 69 /* TYPING to put online above OP and FOUNDER */ |
70 if (is_online(member->status)) flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE); | |
74 if(1 == (member->role & 1)) flag |= GAIM_CBFLAGS_OP; | 71 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; | 72 if(member->uid == group->creator_uid) flag |= GAIM_CBFLAGS_FOUNDER; |
77 flags = g_list_append(flags, GINT_TO_POINTER(flag)); | 73 flags = g_list_append(flags, GINT_TO_POINTER(flag)); |
78 list = list->next; | 74 list = list->next; |
79 } // while list | 75 } |
80 | 76 |
81 gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv)); | 77 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*/); | 78 gaim_conv_chat_add_users(GAIM_CONV_CHAT(conv), names, NULL, flags, FALSE); |
83 } // if conv | 79 } |
84 // clean up names | 80 /* clean up names */ |
85 while (names != NULL) { | 81 while (names != NULL) { |
86 member_name = (gchar *) names->data; | 82 member_name = (gchar *) names->data; |
87 names = g_list_remove(names, member_name); | 83 names = g_list_remove(names, member_name); |
88 g_free(member_name); | 84 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 } | 85 } |
97 */ | |
98 g_list_free(flags); | 86 g_list_free(flags); |
99 } // qq_group_conv_show_window | 87 } |
100 | |
101 /*****************************************************************************/ | |
102 // END OF FILE |