Mercurial > pidgin
annotate src/protocols/msn/dialog.c @ 12323:fc464a0abccc
[gaim-migrate @ 14627]
Function prototypes need to be of the form foo(void); instead of foo(); for function that don't take any arguments. This allows the compiler to detect mistakes were someone passes arguments to such a function.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Sun, 04 Dec 2005 18:19:56 +0000 |
| parents | 926bd0e5f487 |
| children | 90f488e08216 |
| rev | line source |
|---|---|
| 10044 | 1 /** |
| 2 * @file dialog.c Dialog functions | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Gaim is the legal property of its developers, whose names are too numerous | |
| 7 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 8 * source distribution. | |
| 9 * | |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
| 12 * the Free Software Foundation; either version 2 of the License, or | |
| 13 * (at your option) any later version. | |
| 14 * | |
| 15 * This program is distributed in the hope that it will be useful, | |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 * GNU General Public License for more details. | |
| 19 * | |
| 20 * You should have received a copy of the GNU General Public License | |
| 21 * along with this program; if not, write to the Free Software | |
| 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 */ | |
| 24 | |
| 25 #include "msn.h" | |
| 26 | |
| 27 typedef struct | |
| 28 { | |
| 29 GaimConnection *gc; | |
| 30 char *who; | |
| 31 char *group; | |
| 32 gboolean add; | |
| 33 | |
| 34 } MsnAddRemData; | |
| 35 | |
| 36 static void | |
| 37 msn_add_cb(MsnAddRemData *data) | |
| 38 { | |
| 39 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL) | |
| 40 { | |
| 41 MsnSession *session = data->gc->proto_data; | |
| 42 MsnUserList *userlist = session->userlist; | |
| 43 | |
| 44 msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
| 45 } | |
| 46 | |
| 47 if (data->group != NULL) | |
| 48 g_free(data->group); | |
| 49 | |
| 50 g_free(data->who); | |
| 51 g_free(data); | |
| 52 } | |
| 53 | |
| 54 static void | |
| 55 msn_rem_cb(MsnAddRemData *data) | |
| 56 { | |
| 57 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL) | |
| 58 { | |
| 59 MsnSession *session = data->gc->proto_data; | |
| 60 MsnUserList *userlist = session->userlist; | |
| 61 | |
| 62 msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
| 63 } | |
| 64 | |
| 65 if (data->group != NULL) | |
| 66 g_free(data->group); | |
| 67 | |
| 68 g_free(data->who); | |
| 69 g_free(data); | |
| 70 } | |
| 71 | |
|
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
10310
diff
changeset
|
72 static void |
| 10044 | 73 msn_show_sync_issue(MsnSession *session, const char *passport, |
| 74 const char *group_name) | |
| 75 { | |
| 76 GaimConnection *gc; | |
| 77 GaimAccount *account; | |
| 78 MsnAddRemData *data; | |
| 79 char *msg, *reason; | |
| 80 GaimBuddy *buddy; | |
| 81 GaimGroup *group = NULL; | |
| 82 | |
| 83 account = session->account; | |
| 84 gc = gaim_account_get_connection(account); | |
| 85 | |
| 86 data = g_new0(MsnAddRemData, 1); | |
| 87 data->who = g_strdup(passport); | |
| 88 data->group = g_strdup(group_name); | |
| 89 data->gc = gc; | |
| 90 | |
| 10310 | 91 msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), |
| 10044 | 92 gaim_account_get_username(account), |
| 93 gaim_account_get_protocol_name(account)); | |
| 94 | |
| 95 if (group_name != NULL) | |
| 96 { | |
| 97 reason = g_strdup_printf(_("%s on the local list is " | |
| 98 "inside the group \"%s\" but not on " | |
| 99 "the server list. " | |
| 100 "Do you want this buddy to be added?"), | |
| 101 passport, group_name); | |
| 102 } | |
| 103 else | |
| 104 { | |
| 105 reason = g_strdup_printf(_("%s is on the local list but " | |
| 106 "not on the server list. " | |
| 107 "Do you want this buddy to be added?"), | |
| 108 passport); | |
| 109 } | |
| 110 | |
| 10116 | 111 gaim_request_action(gc, NULL, msg, reason, GAIM_DEFAULT_ACTION_NONE, |
| 112 data, 2, | |
| 10044 | 113 _("Yes"), G_CALLBACK(msn_add_cb), |
| 114 _("No"), G_CALLBACK(msn_rem_cb)); | |
| 115 | |
| 116 if (group_name != NULL) | |
| 117 group = gaim_find_group(group_name); | |
| 118 | |
| 119 if (group != NULL) | |
| 120 buddy = gaim_find_buddy_in_group(account, passport, group); | |
| 121 else | |
| 122 buddy = gaim_find_buddy(account, passport); | |
| 123 | |
| 124 if (buddy != NULL) | |
| 125 gaim_blist_remove_buddy(buddy); | |
| 126 | |
| 127 g_free(reason); | |
| 128 g_free(msg); | |
| 129 } |
