comparison libpurple/privacy.c @ 29471:d83ee160ffb6

propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052) to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 19 Aug 2009 00:46:04 +0000
parents 14ce47859540
children f75041cb3fec
comparison
equal deleted inserted replaced
29470:7a3458436140 29471:d83ee160ffb6
33 gboolean local_only) 33 gboolean local_only)
34 { 34 {
35 GSList *l; 35 GSList *l;
36 char *name; 36 char *name;
37 PurpleBuddy *buddy; 37 PurpleBuddy *buddy;
38 PurpleBlistUiOps *blist_ops;
38 39
39 g_return_val_if_fail(account != NULL, FALSE); 40 g_return_val_if_fail(account != NULL, FALSE);
40 g_return_val_if_fail(who != NULL, FALSE); 41 g_return_val_if_fail(who != NULL, FALSE);
41 42
42 name = g_strdup(purple_normalize(account, who)); 43 name = g_strdup(purple_normalize(account, who));
60 serv_add_permit(purple_account_get_connection(account), who); 61 serv_add_permit(purple_account_get_connection(account), who);
61 62
62 if (privacy_ops != NULL && privacy_ops->permit_added != NULL) 63 if (privacy_ops != NULL && privacy_ops->permit_added != NULL)
63 privacy_ops->permit_added(account, who); 64 privacy_ops->permit_added(account, who);
64 65
65 purple_blist_schedule_save(); 66 blist_ops = purple_blist_get_ui_ops();
67 if (blist_ops != NULL && blist_ops->save_account != NULL)
68 blist_ops->save_account(account);
66 69
67 /* This lets the UI know a buddy has had its privacy setting changed */ 70 /* This lets the UI know a buddy has had its privacy setting changed */
68 buddy = purple_find_buddy(account, name); 71 buddy = purple_find_buddy(account, name);
69 if (buddy != NULL) { 72 if (buddy != NULL) {
70 purple_signal_emit(purple_blist_get_handle(), 73 purple_signal_emit(purple_blist_get_handle(),
79 { 82 {
80 GSList *l; 83 GSList *l;
81 const char *name; 84 const char *name;
82 PurpleBuddy *buddy; 85 PurpleBuddy *buddy;
83 char *del; 86 char *del;
87 PurpleBlistUiOps *blist_ops;
84 88
85 g_return_val_if_fail(account != NULL, FALSE); 89 g_return_val_if_fail(account != NULL, FALSE);
86 g_return_val_if_fail(who != NULL, FALSE); 90 g_return_val_if_fail(who != NULL, FALSE);
87 91
88 name = purple_normalize(account, who); 92 name = purple_normalize(account, who);
107 serv_rem_permit(purple_account_get_connection(account), who); 111 serv_rem_permit(purple_account_get_connection(account), who);
108 112
109 if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) 113 if (privacy_ops != NULL && privacy_ops->permit_removed != NULL)
110 privacy_ops->permit_removed(account, who); 114 privacy_ops->permit_removed(account, who);
111 115
112 purple_blist_schedule_save(); 116 blist_ops = purple_blist_get_ui_ops();
117 if (blist_ops != NULL && blist_ops->save_account != NULL)
118 blist_ops->save_account(account);
113 119
114 buddy = purple_find_buddy(account, name); 120 buddy = purple_find_buddy(account, name);
115 if (buddy != NULL) { 121 if (buddy != NULL) {
116 purple_signal_emit(purple_blist_get_handle(), 122 purple_signal_emit(purple_blist_get_handle(),
117 "buddy-privacy-changed", buddy); 123 "buddy-privacy-changed", buddy);
125 gboolean local_only) 131 gboolean local_only)
126 { 132 {
127 GSList *l; 133 GSList *l;
128 char *name; 134 char *name;
129 PurpleBuddy *buddy; 135 PurpleBuddy *buddy;
136 PurpleBlistUiOps *blist_ops;
130 137
131 g_return_val_if_fail(account != NULL, FALSE); 138 g_return_val_if_fail(account != NULL, FALSE);
132 g_return_val_if_fail(who != NULL, FALSE); 139 g_return_val_if_fail(who != NULL, FALSE);
133 140
134 name = g_strdup(purple_normalize(account, who)); 141 name = g_strdup(purple_normalize(account, who));
152 serv_add_deny(purple_account_get_connection(account), who); 159 serv_add_deny(purple_account_get_connection(account), who);
153 160
154 if (privacy_ops != NULL && privacy_ops->deny_added != NULL) 161 if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
155 privacy_ops->deny_added(account, who); 162 privacy_ops->deny_added(account, who);
156 163
157 purple_blist_schedule_save(); 164 blist_ops = purple_blist_get_ui_ops();
165 if (blist_ops != NULL && blist_ops->save_account != NULL)
166 blist_ops->save_account(account);
158 167
159 buddy = purple_find_buddy(account, name); 168 buddy = purple_find_buddy(account, name);
160 if (buddy != NULL) { 169 if (buddy != NULL) {
161 purple_signal_emit(purple_blist_get_handle(), 170 purple_signal_emit(purple_blist_get_handle(),
162 "buddy-privacy-changed", buddy); 171 "buddy-privacy-changed", buddy);
170 { 179 {
171 GSList *l; 180 GSList *l;
172 const char *normalized; 181 const char *normalized;
173 char *name; 182 char *name;
174 PurpleBuddy *buddy; 183 PurpleBuddy *buddy;
184 PurpleBlistUiOps *blist_ops;
175 185
176 g_return_val_if_fail(account != NULL, FALSE); 186 g_return_val_if_fail(account != NULL, FALSE);
177 g_return_val_if_fail(who != NULL, FALSE); 187 g_return_val_if_fail(who != NULL, FALSE);
178 188
179 normalized = purple_normalize(account, who); 189 normalized = purple_normalize(account, who);
203 purple_signal_emit(purple_blist_get_handle(), 213 purple_signal_emit(purple_blist_get_handle(),
204 "buddy-privacy-changed", buddy); 214 "buddy-privacy-changed", buddy);
205 } 215 }
206 216
207 g_free(name); 217 g_free(name);
208 purple_blist_schedule_save(); 218
219 blist_ops = purple_blist_get_ui_ops();
220 if (blist_ops != NULL && blist_ops->save_account != NULL)
221 blist_ops->save_account(account);
209 222
210 return TRUE; 223 return TRUE;
211 } 224 }
212 225
213 /** 226 /**