comparison console/gntaccount.c @ 13985:a7b1d2ab9cb0

[gaim-migrate @ 16555] Do not crash when you close the debug window, or use the "/clear" command. Enable the stuff in gntaccount.c that were waiting on the request-ui. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 24 Jul 2006 01:03:07 +0000
parents c9509bd42d7a
children 7109e6397a31
comparison
equal deleted inserted replaced
13984:599b35acd842 13985:a7b1d2ab9cb0
642 void gg_accounts_uninit() 642 void gg_accounts_uninit()
643 { 643 {
644 gnt_widget_destroy(accounts.window); 644 gnt_widget_destroy(accounts.window);
645 } 645 }
646 646
647 #if 0
648 /* The following uiops stuff are copied from gtkaccount.c */ 647 /* The following uiops stuff are copied from gtkaccount.c */
649 /* Need to do some work on notify- and request-ui before this works */
650 typedef struct 648 typedef struct
651 { 649 {
652 GaimAccount *account; 650 GaimAccount *account;
653 char *username; 651 char *username;
654 char *alias; 652 char *alias;
691 689
692 g_free(buffer); 690 g_free(buffer);
693 } 691 }
694 692
695 static void 693 static void
694 free_add_user_data(AddUserData *data)
695 {
696 g_free(data->username);
697
698 if (data->alias != NULL)
699 g_free(data->alias);
700
701 g_free(data);
702 }
703
704 static void
705 add_user_cb(AddUserData *data)
706 {
707 GaimConnection *gc = gaim_account_get_connection(data->account);
708
709 if (g_list_find(gaim_connections_get_all(), gc))
710 {
711 gaim_blist_request_add_buddy(data->account, data->username,
712 NULL, data->alias);
713 }
714
715 free_add_user_data(data);
716 }
717
718 static void
696 request_add(GaimAccount *account, const char *remote_user, 719 request_add(GaimAccount *account, const char *remote_user,
697 const char *id, const char *alias, 720 const char *id, const char *alias,
698 const char *msg) 721 const char *msg)
699 { 722 {
700 char *buffer; 723 char *buffer;
707 data->account = account; 730 data->account = account;
708 data->username = g_strdup(remote_user); 731 data->username = g_strdup(remote_user);
709 data->alias = (alias != NULL ? g_strdup(alias) : NULL); 732 data->alias = (alias != NULL ? g_strdup(alias) : NULL);
710 733
711 buffer = make_info(account, gc, remote_user, id, alias, msg); 734 buffer = make_info(account, gc, remote_user, id, alias, msg);
712 #if 0
713 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), 735 gaim_request_action(NULL, NULL, _("Add buddy to your list?"),
714 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, 736 buffer, GAIM_DEFAULT_ACTION_NONE, data, 2,
715 _("Add"), G_CALLBACK(add_user_cb), 737 _("Add"), G_CALLBACK(add_user_cb),
716 _("Cancel"), G_CALLBACK(free_add_user_data)); 738 _("Cancel"), G_CALLBACK(free_add_user_data));
717 #endif
718 g_free(buffer); 739 g_free(buffer);
719 } 740 }
720 741
721 static GaimAccountUiOps ui_ops = 742 static GaimAccountUiOps ui_ops =
722 { 743 {
723 .notify_added = notify_added, 744 .notify_added = notify_added,
724 .status_changed = NULL, 745 .status_changed = NULL,
725 .request_add = request_add 746 .request_add = request_add
726 }; 747 };
727 #else
728
729 static GaimAccountUiOps ui_ops =
730 {
731 .notify_added = NULL,
732 .status_changed = NULL,
733 .request_add = NULL
734 };
735
736 #endif
737 748
738 GaimAccountUiOps *gg_accounts_get_ui_ops() 749 GaimAccountUiOps *gg_accounts_get_ui_ops()
739 { 750 {
740 return &ui_ops; 751 return &ui_ops;
741 } 752 }