comparison libpurple/protocols/qq/buddy_opt.c @ 16442:08db93bbd798

Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 26 Apr 2007 12:25:49 +0000
parents 32c366eeeb99
children b9a0b1bd321b
comparison
equal deleted inserted replaced
16438:a46a0362dc34 16442:08db93bbd798
189 { 189 {
190 gint uid; 190 gint uid;
191 gchar *msg1, *msg2; 191 gchar *msg1, *msg2;
192 PurpleConnection *gc; 192 PurpleConnection *gc;
193 gc_and_uid *g2; 193 gc_and_uid *g2;
194 gchar *nombre;
194 195
195 g_return_if_fail(g != NULL); 196 g_return_if_fail(g != NULL);
196 197
197 gc = g->gc; 198 gc = g->gc;
198 uid = g->uid; 199 uid = g->uid;
205 g2->uid = uid; 206 g2->uid = uid;
206 207
207 msg1 = g_strdup_printf(_("You rejected %d's request"), uid); 208 msg1 = g_strdup_printf(_("You rejected %d's request"), uid);
208 msg2 = g_strdup(_("Input your reason:")); 209 msg2 = g_strdup(_("Input your reason:"));
209 210
211 nombre = uid_to_purple_name(uid);
210 purple_request_input(gc, _("Reject request"), msg1, msg2, 212 purple_request_input(gc, _("Reject request"), msg1, msg2,
211 _("Sorry, you are not my type..."), TRUE, FALSE, 213 _("Sorry, you are not my type..."), TRUE, FALSE,
212 NULL, _("Reject"), G_CALLBACK(_qq_reject_add_request_real), _("Cancel"), NULL, g2); 214 NULL, _("Reject"), G_CALLBACK(_qq_reject_add_request_real), _("Cancel"), NULL,
215 purple_connection_get_account(gc), nombre, NULL,
216 g2);
217 g_free(nombre);
213 } 218 }
214 219
215 void qq_add_buddy_with_gc_and_uid(gc_and_uid *g) 220 void qq_add_buddy_with_gc_and_uid(gc_and_uid *g)
216 { 221 {
217 gint uid; 222 gint uid;
343 guint8 *data; 348 guint8 *data;
344 GList *list; 349 GList *list;
345 PurpleBuddy *b; 350 PurpleBuddy *b;
346 gc_and_uid *g; 351 gc_and_uid *g;
347 qq_add_buddy_request *req; 352 qq_add_buddy_request *req;
353 gchar *nombre;
348 354
349 g_return_if_fail(buf != NULL && buf_len != 0); 355 g_return_if_fail(buf != NULL && buf_len != 0);
350 356
351 for_uid = 0; 357 for_uid = 0;
352 qd = (qq_data *) gc->proto_data; 358 qd = (qq_data *) gc->proto_data;
384 return; 390 return;
385 } 391 }
386 392
387 if (strtol(reply, NULL, 10) > 0) { /* need auth */ 393 if (strtol(reply, NULL, 10) > 0) { /* need auth */
388 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Add buddy attempt fails, need authentication\n"); 394 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Add buddy attempt fails, need authentication\n");
389 b = purple_find_buddy(gc->account, uid_to_purple_name(for_uid)); 395 nombre = uid_to_purple_name(for_uid);
396 b = purple_find_buddy(gc->account, nombre);
390 if (b != NULL) 397 if (b != NULL)
391 purple_blist_remove_buddy(b); 398 purple_blist_remove_buddy(b);
392 g = g_new0(gc_and_uid, 1); 399 g = g_new0(gc_and_uid, 1);
393 g->gc = gc; 400 g->gc = gc;
394 g->uid = for_uid; 401 g->uid = for_uid;
395 msg = g_strdup_printf(_("User %d needs authentication"), for_uid); 402 msg = g_strdup_printf(_("User %d needs authentication"), for_uid);
396 purple_request_input(gc, NULL, msg, 403 purple_request_input(gc, NULL, msg,
397 _("Input request here"), 404 _("Input request here"), /* TODO: Awkward string to fix post string freeze - standardize auth dialogues? -evands */
398 _("Would you be my friend?"), 405 _("Would you be my friend?"),
399 TRUE, FALSE, NULL, _("Send"), 406 TRUE, FALSE, NULL, _("Send"),
400 G_CALLBACK 407 G_CALLBACK
401 (_qq_send_packet_add_buddy_auth_with_gc_and_uid), 408 (_qq_send_packet_add_buddy_auth_with_gc_and_uid),
402 _("Cancel"), G_CALLBACK(qq_do_nothing_with_gc_and_uid), g); 409 _("Cancel"), G_CALLBACK(qq_do_nothing_with_gc_and_uid),
410 purple_connection_get_account(gc), nombre, NULL,
411 g);
403 g_free(msg); 412 g_free(msg);
413 g_free(nombre);
404 } else { /* add OK */ 414 } else { /* add OK */
405 qq_add_buddy_by_recv_packet(gc, for_uid, TRUE, TRUE); 415 qq_add_buddy_by_recv_packet(gc, for_uid, TRUE, TRUE);
406 msg = g_strdup_printf(_("You have added %d in buddy list"), for_uid); 416 msg = g_strdup_printf(_("You have added %d in buddy list"), for_uid);
407 purple_notify_info(gc, NULL, msg, NULL); 417 purple_notify_info(gc, NULL, msg, NULL);
408 g_free(msg); 418 g_free(msg);