comparison libpurple/protocols/qq/group_join.c @ 24066:dbc7a9742f8d

2008.09.26 - ccpaging <ccpaging(at)gmail.com> * Added 'Request/Add/Remove Buddy' functions
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 14:35:05 +0000
parents bdfcfd71449c
children dc112387190f
comparison
equal deleted inserted replaced
24065:bdfcfd71449c 24066:dbc7a9742f8d
28 #include "notify.h" 28 #include "notify.h"
29 #include "request.h" 29 #include "request.h"
30 #include "server.h" 30 #include "server.h"
31 31
32 #include "char_conv.h" 32 #include "char_conv.h"
33 #include "im.h"
33 #include "group_conv.h" 34 #include "group_conv.h"
34 #include "group_find.h" 35 #include "group_find.h"
35 #include "group_internal.h" 36 #include "group_internal.h"
36 #include "group_info.h" 37 #include "group_info.h"
37 #include "group_join.h" 38 #include "group_join.h"
188 gint bytes; 189 gint bytes;
189 guint32 id; 190 guint32 id;
190 PurpleChat *chat; 191 PurpleChat *chat;
191 qq_group *group; 192 qq_group *group;
192 qq_data *qd; 193 qq_data *qd;
194 gchar *msg;
193 195
194 g_return_if_fail(data != NULL && len > 0); 196 g_return_if_fail(data != NULL && len > 0);
195 qd = (qq_data *) gc->proto_data; 197 qd = (qq_data *) gc->proto_data;
196 198
197 if (len < 4) { 199 if (len < 4) {
202 bytes = 0; 204 bytes = 0;
203 bytes += qq_get32(&id, data + bytes); 205 bytes += qq_get32(&id, data + bytes);
204 206
205 group = qq_room_search_id(gc, id); 207 group = qq_room_search_id(gc, id);
206 if (group != NULL) { 208 if (group != NULL) {
209 msg = g_strdup_printf(_("Successed quit Qun %s (%d)"),
210 group->title_utf8, group->ext_id);
207 chat = purple_blist_find_chat 211 chat = purple_blist_find_chat
208 (purple_connection_get_account(gc), g_strdup_printf("%d", group->ext_id)); 212 (purple_connection_get_account(gc), g_strdup_printf("%d", group->ext_id));
209 if (chat != NULL) 213 if (chat != NULL)
210 purple_blist_remove_chat(chat); 214 purple_blist_remove_chat(chat);
211 qq_group_delete_internal_record(qd, id); 215 qq_group_delete_internal_record(qd, id);
212 } 216 } else {
213 purple_notify_info(gc, _("QQ Qun Operation"), _("Successed:"), _("Remove from Qun")); 217 msg = g_strdup(_("Successed quit Qun"));
218 }
219 qq_got_attention(gc, msg);
220 g_free(msg);
214 } 221 }
215 222
216 /* Process the reply to group_auth subcmd */ 223 /* Process the reply to group_auth subcmd */
217 void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc) 224 void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc)
218 { 225 {
230 } 237 }
231 bytes = 0; 238 bytes = 0;
232 bytes += qq_get32(&id, data + bytes); 239 bytes += qq_get32(&id, data + bytes);
233 g_return_if_fail(id > 0); 240 g_return_if_fail(id > 0);
234 241
235 purple_notify_info(gc, _("QQ Qun Operation"), _("Successed:"), _("Join to Qun")); 242 qq_got_attention(gc, _("Successed join to Qun"));
236 } 243 }
237 244
238 /* process group cmd reply "join group" */ 245 /* process group cmd reply "join group" */
239 void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc) 246 void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc)
240 { 247 {
318 qq_set_pending_id(&qd->joining_groups, ext_id, TRUE); 325 qq_set_pending_id(&qd->joining_groups, ext_id, TRUE);
319 qq_send_cmd_group_search_group(gc, ext_id); 326 qq_send_cmd_group_search_group(gc, ext_id);
320 } 327 }
321 } 328 }
322 329
323 void qq_group_exit(PurpleConnection *gc, GHashTable *data) 330 void qq_room_quit(PurpleConnection *gc, GHashTable *data)
324 { 331 {
325 gchar *id_ptr; 332 gchar *id_ptr;
326 guint32 id; 333 guint32 id;
327 qq_add_request *add_req; 334 qq_add_request *add_req;
328 335
336 add_req = g_new0(qq_add_request, 1); 343 add_req = g_new0(qq_add_request, 1);
337 add_req->gc = gc; 344 add_req->gc = gc;
338 add_req->uid = id; 345 add_req->uid = id;
339 346
340 purple_request_action(gc, _("QQ Qun Operation"), 347 purple_request_action(gc, _("QQ Qun Operation"),
341 _("Are you sure you want to leave this Qun?"), 348 _("Quit Qun"),
342 _("Note, if you are the creator, \nthis operation will eventually remove this Qun."), 349 _("Note, if you are the creator, \nthis operation will eventually remove this Qun."),
343 1, 350 1,
344 purple_connection_get_account(gc), NULL, NULL, 351 purple_connection_get_account(gc), NULL, NULL,
345 add_req, 2, _("Cancel"), 352 add_req, 2, _("Cancel"),
346 G_CALLBACK(qq_group_cancel_cb), 353 G_CALLBACK(qq_group_cancel_cb),