comparison src/prpl.c @ 2582:5efa8077107f

[gaim-migrate @ 2595] add committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 23 Oct 2001 04:54:45 +0000
parents 78a1cee07540
children 4424c670021d
comparison
equal deleted inserted replaced
2581:3e9906e1e5f6 2582:5efa8077107f
527 } 527 }
528 528
529 *len = 0; 529 *len = 0;
530 return NULL; 530 return NULL;
531 } 531 }
532
533 struct got_add {
534 struct gaim_connection *gc;
535 char *who;
536 char *alias;
537 };
538
539 static void dont_add(gpointer x, struct got_add *ga)
540 {
541 g_free(ga->who);
542 if (ga->alias)
543 g_free(ga->alias);
544 g_free(ga);
545 }
546
547 static void do_add(gpointer x, struct got_add *ga)
548 {
549 show_add_buddy(ga->gc, ga->who, NULL, ga->alias);
550 }
551
552 void show_got_added(struct gaim_connection *gc, const char *id,
553 const char *who, const char *alias, const char *msg)
554 {
555 char buf[BUF_LONG];
556 struct got_add *ga = g_new0(struct got_add, 1);
557
558 ga->gc = gc;
559 ga->who = g_strdup(who);
560 ga->alias = alias ? g_strdup(alias) : NULL;
561
562 g_snprintf(buf, sizeof(buf), _("%s%s%s%s has made %s their buddy%s%s%s"),
563 who,
564 alias ? " (" : "",
565 alias ? alias : "",
566 alias ? ")" : "",
567 id ? id : gc->displayname[0] ? gc->displayname : gc->username,
568 msg ? ": " : ".",
569 msg ? msg : "",
570 find_buddy(gc, ga->who) ? "" : _("\n\nDo you wish to add them to your buddy list?"));
571 if (find_buddy(gc, ga->who))
572 do_error_dialog(buf, "Added to List");
573 else
574 do_ask_dialog(buf, ga, do_add, dont_add);
575 }