Mercurial > pidgin
comparison src/protocols/qq/group.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 | |
24 /*****************************************************************************/ | |
25 #include "internal.h" | 23 #include "internal.h" |
26 | 24 |
27 #include "debug.h" // gaim_debug | 25 #include "debug.h" |
28 #include "prpl.h" // struct proto_chat_entry | 26 #include "prpl.h" |
29 #include "request.h" // gaim_request_input | 27 #include "request.h" |
30 | 28 |
31 #include "utils.h" // qq_string_to_dec_value | 29 #include "group_hash.h" |
32 #include "group_hash.h" // QQ_GROUP_KEY_EXTERNAL_ID | 30 #include "group_info.h" |
33 #include "group_info.h" // qq_send_cmd_group_get_group_info | 31 #include "group_search.h" |
34 #include "group_search.h" // qq_send_cmd_group_search_group | 32 #include "utils.h" |
35 | 33 |
36 #include "group.h" | 34 #include "group.h" |
37 | 35 |
38 /*****************************************************************************/ | 36 static void _qq_group_search_callback(GaimConnection *gc, const gchar *input) |
39 static void _qq_group_search_callback(GaimConnection * gc, const gchar * input) | |
40 { | 37 { |
41 guint32 external_group_id; | 38 guint32 external_group_id; |
42 | 39 |
43 g_return_if_fail(gc != NULL && input != NULL); | 40 g_return_if_fail(gc != NULL && input != NULL); |
44 external_group_id = qq_string_to_dec_value(input); | 41 external_group_id = qq_string_to_dec_value(input); |
45 // 0x00000000 means search for demo group | 42 /* 0x00000000 means search for demo group */ |
46 qq_send_cmd_group_search_group(gc, external_group_id); | 43 qq_send_cmd_group_search_group(gc, external_group_id); |
47 } // _qq_group_search_callback | 44 } |
48 | 45 |
49 /*****************************************************************************/ | 46 /* This is needed for GaimChat node to be valid */ |
50 // This is needed for GaimChat node to be valid | 47 GList *qq_chat_info(GaimConnection *gc) |
51 GList *qq_chat_info(GaimConnection * gc) | |
52 { | 48 { |
53 GList *m; | 49 GList *m; |
54 struct proto_chat_entry *pce; | 50 struct proto_chat_entry *pce; |
55 | 51 |
56 m = NULL; | 52 m = NULL; |
69 pce->label = _("Status: "); | 65 pce->label = _("Status: "); |
70 pce->identifier = QQ_GROUP_KEY_MEMBER_STATUS_DESC; | 66 pce->identifier = QQ_GROUP_KEY_MEMBER_STATUS_DESC; |
71 m = g_list_append(m, pce); | 67 m = g_list_append(m, pce); |
72 | 68 |
73 return m; | 69 return m; |
74 } // qq_chat_info | 70 } |
75 | 71 |
76 /*****************************************************************************/ | 72 /* get a list of qq groups */ |
77 // get a list of qq groups | 73 GaimRoomlist *qq_roomlist_get_list(GaimConnection *gc) |
78 GaimRoomlist *qq_roomlist_get_list(GaimConnection * gc) | |
79 { | 74 { |
80 GList *fields; | 75 GList *fields; |
81 qq_data *qd; | 76 qq_data *qd; |
82 GaimRoomlist *rl; | 77 GaimRoomlist *rl; |
83 GaimRoomlistField *f; | 78 GaimRoomlistField *f; |
110 gaim_roomlist_set_fields(rl, fields); | 105 gaim_roomlist_set_fields(rl, fields); |
111 gaim_roomlist_set_in_progress(qd->roomlist, TRUE); | 106 gaim_roomlist_set_in_progress(qd->roomlist, TRUE); |
112 | 107 |
113 gaim_request_input(gc, _("QQ Qun"), | 108 gaim_request_input(gc, _("QQ Qun"), |
114 _("Please input external group ID"), | 109 _("Please input external group ID"), |
115 _ | 110 _("You can only search for permanent QQ group\nInput 0 or leave it blank to search for demo groups"), |
116 ("You can only search for permanent QQ group\nInput 0 or leave it blank to search for demo groups"), | |
117 NULL, FALSE, FALSE, NULL, _("Search"), | 111 NULL, FALSE, FALSE, NULL, _("Search"), |
118 G_CALLBACK(_qq_group_search_callback), _("Cancel"), NULL, gc); | 112 G_CALLBACK(_qq_group_search_callback), _("Cancel"), NULL, gc); |
119 | 113 |
120 return qd->roomlist; | 114 return qd->roomlist; |
121 } // qq_roomlist_get_list | 115 } |
122 | 116 |
123 /*****************************************************************************/ | 117 /* free roomlist space, I have no idea when this one is called ... */ |
124 // free roomlist space, I have no idea when this one is called ... | 118 void qq_roomlist_cancel(GaimRoomlist *list) |
125 void qq_roomlist_cancel(GaimRoomlist * list) | |
126 { | 119 { |
127 qq_data *qd; | 120 qq_data *qd; |
128 GaimConnection *gc; | 121 GaimConnection *gc; |
129 | 122 |
130 g_return_if_fail(list != NULL); | 123 g_return_if_fail(list != NULL); |
133 g_return_if_fail(gc != NULL && gc->proto_data != NULL); | 126 g_return_if_fail(gc != NULL && gc->proto_data != NULL); |
134 qd = (qq_data *) gc->proto_data; | 127 qd = (qq_data *) gc->proto_data; |
135 | 128 |
136 gaim_roomlist_set_in_progress(list, FALSE); | 129 gaim_roomlist_set_in_progress(list, FALSE); |
137 gaim_roomlist_unref(list); | 130 gaim_roomlist_unref(list); |
138 } // qq_roomlist_cancel | 131 } |
139 | 132 |
140 /*****************************************************************************/ | 133 /* this should be called upon signin, even when we did not open group chat window */ |
141 // this should be called upon signin, even we did not open group chat window | 134 void qq_group_init(GaimConnection *gc) |
142 void qq_group_init(GaimConnection * gc) | |
143 { | 135 { |
144 gint i; | 136 gint i; |
145 GaimAccount *account; | 137 GaimAccount *account; |
146 GaimChat *chat; | 138 GaimChat *chat; |
147 GaimGroup *gaim_group; | 139 GaimGroup *gaim_group; |
154 | 146 |
155 gaim_group = gaim_find_group(GAIM_GROUP_QQ_QUN); | 147 gaim_group = gaim_find_group(GAIM_GROUP_QQ_QUN); |
156 if (gaim_group == NULL) { | 148 if (gaim_group == NULL) { |
157 gaim_debug(GAIM_DEBUG_INFO, "QQ", "We have no QQ Qun\n"); | 149 gaim_debug(GAIM_DEBUG_INFO, "QQ", "We have no QQ Qun\n"); |
158 return; | 150 return; |
159 } // if group | 151 } |
160 | 152 |
161 i = 0; | 153 i = 0; |
162 for (node = ((GaimBlistNode *) gaim_group)->child; node != NULL; node = node->next) | 154 for (node = ((GaimBlistNode *) gaim_group)->child; node != NULL; node = node->next) |
163 if (GAIM_BLIST_NODE_IS_CHAT(node)) { // got one | 155 if (GAIM_BLIST_NODE_IS_CHAT(node)) { /* got one */ |
164 chat = (GaimChat *) node; | 156 chat = (GaimChat *) node; |
165 if (account != chat->account) | 157 if (account != chat->account) |
166 continue; // very important here ! | 158 continue; /* very important here ! */ |
167 group = qq_group_from_hashtable(gc, chat->components); | 159 group = qq_group_from_hashtable(gc, chat->components); |
168 if (group != NULL) { | 160 if (group != NULL) { |
169 i++; | 161 i++; |
170 qq_send_cmd_group_get_group_info(gc, group); // get group info and members | 162 qq_send_cmd_group_get_group_info(gc, group); /* get group info and members */ |
171 } // if group | 163 } |
172 } // if is chat | 164 } |
173 | 165 |
174 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Load %d QQ Qun configurations\n", i); | 166 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Load %d QQ Qun configurations\n", i); |
175 | 167 } |
176 } // qq_group_init | |
177 | |
178 /*****************************************************************************/ | |
179 // END OF FILE |