Mercurial > pidgin
comparison libpurple/privacy.c @ 32771:52fb2e955198
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 6ee8e5cba5c96a1f2171038180b636724b258817)
to branch 'im.pidgin.pidgin' (head 92cc5e21737e6702460525c581295fdd26a2380f)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 13 Apr 2012 07:39:04 +0000 |
parents | f75041cb3fec |
children |
comparison
equal
deleted
inserted
replaced
32770:1e0ded0cb2ee | 32771:52fb2e955198 |
---|---|
262 void | 262 void |
263 purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, | 263 purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, |
264 gboolean restore) | 264 gboolean restore) |
265 { | 265 { |
266 GSList *list; | 266 GSList *list; |
267 PurplePrivacyType type = account->perm_deny; | 267 PurplePrivacyType type = purple_account_get_privacy_type(account); |
268 | 268 |
269 switch (account->perm_deny) { | 269 switch (type) { |
270 case PURPLE_PRIVACY_ALLOW_ALL: | 270 case PURPLE_PRIVACY_ALLOW_ALL: |
271 return; | 271 return; |
272 case PURPLE_PRIVACY_ALLOW_USERS: | 272 case PURPLE_PRIVACY_ALLOW_USERS: |
273 purple_privacy_permit_add(account, who, local); | 273 purple_privacy_permit_add(account, who, local); |
274 break; | 274 break; |
285 if (!purple_strequal(norm, person)) | 285 if (!purple_strequal(norm, person)) |
286 purple_privacy_permit_remove(account, person, local); | 286 purple_privacy_permit_remove(account, person, local); |
287 } | 287 } |
288 } | 288 } |
289 purple_privacy_permit_add(account, who, local); | 289 purple_privacy_permit_add(account, who, local); |
290 account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; | 290 purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); |
291 break; | 291 break; |
292 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: | 292 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
293 if (!purple_find_buddy(account, who)) { | 293 if (!purple_find_buddy(account, who)) { |
294 add_all_buddies_to_permit_list(account, local); | 294 add_all_buddies_to_permit_list(account, local); |
295 purple_privacy_permit_add(account, who, local); | 295 purple_privacy_permit_add(account, who, local); |
296 account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; | 296 purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); |
297 } | 297 } |
298 break; | 298 break; |
299 default: | 299 default: |
300 g_return_if_reached(); | 300 g_return_if_reached(); |
301 } | 301 } |
302 | 302 |
303 /* Notify the server if the privacy setting was changed */ | 303 /* Notify the server if the privacy setting was changed */ |
304 if (type != account->perm_deny && purple_account_is_connected(account)) | 304 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) |
305 serv_set_permit_deny(purple_account_get_connection(account)); | 305 serv_set_permit_deny(purple_account_get_connection(account)); |
306 } | 306 } |
307 | 307 |
308 /* | 308 /* |
309 * TODO: All callers of this function pass in FALSE for local and | 309 * TODO: All callers of this function pass in FALSE for local and |
314 void | 314 void |
315 purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, | 315 purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, |
316 gboolean restore) | 316 gboolean restore) |
317 { | 317 { |
318 GSList *list; | 318 GSList *list; |
319 PurplePrivacyType type = account->perm_deny; | 319 PurplePrivacyType type = purple_account_get_privacy_type(account); |
320 | 320 |
321 switch (account->perm_deny) { | 321 switch (type) { |
322 case PURPLE_PRIVACY_ALLOW_ALL: | 322 case PURPLE_PRIVACY_ALLOW_ALL: |
323 if (!restore) { | 323 if (!restore) { |
324 /* Empty the deny-list. */ | 324 /* Empty the deny-list. */ |
325 const char *norm = purple_normalize(account, who); | 325 const char *norm = purple_normalize(account, who); |
326 for (list = account->deny; list != NULL; ) { | 326 for (list = account->deny; list != NULL; ) { |
329 if (!purple_strequal(norm, person)) | 329 if (!purple_strequal(norm, person)) |
330 purple_privacy_deny_remove(account, person, local); | 330 purple_privacy_deny_remove(account, person, local); |
331 } | 331 } |
332 } | 332 } |
333 purple_privacy_deny_add(account, who, local); | 333 purple_privacy_deny_add(account, who, local); |
334 account->perm_deny = PURPLE_PRIVACY_DENY_USERS; | 334 purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); |
335 break; | 335 break; |
336 case PURPLE_PRIVACY_ALLOW_USERS: | 336 case PURPLE_PRIVACY_ALLOW_USERS: |
337 purple_privacy_permit_remove(account, who, local); | 337 purple_privacy_permit_remove(account, who, local); |
338 break; | 338 break; |
339 case PURPLE_PRIVACY_DENY_USERS: | 339 case PURPLE_PRIVACY_DENY_USERS: |
343 break; | 343 break; |
344 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: | 344 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
345 if (purple_find_buddy(account, who)) { | 345 if (purple_find_buddy(account, who)) { |
346 add_all_buddies_to_permit_list(account, local); | 346 add_all_buddies_to_permit_list(account, local); |
347 purple_privacy_permit_remove(account, who, local); | 347 purple_privacy_permit_remove(account, who, local); |
348 account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; | 348 purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); |
349 } | 349 } |
350 break; | 350 break; |
351 default: | 351 default: |
352 g_return_if_reached(); | 352 g_return_if_reached(); |
353 } | 353 } |
354 | 354 |
355 /* Notify the server if the privacy setting was changed */ | 355 /* Notify the server if the privacy setting was changed */ |
356 if (type != account->perm_deny && purple_account_is_connected(account)) | 356 if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) |
357 serv_set_permit_deny(purple_account_get_connection(account)); | 357 serv_set_permit_deny(purple_account_get_connection(account)); |
358 } | 358 } |
359 | 359 |
360 gboolean | 360 gboolean |
361 purple_privacy_check(PurpleAccount *account, const char *who) | 361 purple_privacy_check(PurpleAccount *account, const char *who) |
362 { | 362 { |
363 GSList *list; | 363 GSList *list; |
364 | 364 |
365 switch (account->perm_deny) { | 365 switch (purple_account_get_privacy_type(account)) { |
366 case PURPLE_PRIVACY_ALLOW_ALL: | 366 case PURPLE_PRIVACY_ALLOW_ALL: |
367 return TRUE; | 367 return TRUE; |
368 | 368 |
369 case PURPLE_PRIVACY_DENY_ALL: | 369 case PURPLE_PRIVACY_DENY_ALL: |
370 return FALSE; | 370 return FALSE; |