From: Richard L. <rl...@us...> - 2005-07-17 23:37:13
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18623/src Modified Files: gtkblist.c gtkprivacy.c privacy.c privacy.h Log Message: Patch #1234440, from sadrul "Mark blocked users in the buddy-list" Patch #1234197, from sadrul "New API fn gaim_privacy_check" Plus changes by me. (Read as: blame me if it's busted, thank sadrul if it works) Basically, all this stuff boils down to the following: We composite a new blocked.png onto the prpl icon in the buddy list if the user is blocked. MSN was the only prpl that used the old blocked.png. However, it looks bad to overlay both icons, so I removed the use of blocked.png from the MSN prpl. As an MSN user, I think the result is intuitive. Index: gtkblist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkblist.c,v retrieving revision 1.262 retrieving revision 1.263 diff -u -d -p -r1.262 -r1.263 --- gtkblist.c 5 Jul 2005 03:08:49 -0000 1.262 +++ gtkblist.c 17 Jul 2005 23:36:20 -0000 1.263 @@ -3079,6 +3079,27 @@ gaim_gtk_blist_get_status_icon(GaimBlist { gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE); } + + if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) + { + GdkPixbuf *emblem; + char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "blocked.png", NULL); + + emblem = gdk_pixbuf_new_from_file(filename, NULL); + g_free(filename); + + if (emblem) + { + gdk_pixbuf_composite(emblem, scale, + 0, 0, scalesize, scalesize, + 0, 0, + (double)scalesize / gdk_pixbuf_get_width(emblem), + (double)scalesize / gdk_pixbuf_get_height(emblem), + GDK_INTERP_BILINEAR, + 224); + g_object_unref(emblem); + } + } } return scale; Index: gtkprivacy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkprivacy.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -p -r1.26 -r1.27 --- gtkprivacy.c 30 Jun 2005 21:21:20 -0000 1.26 +++ gtkprivacy.c 17 Jul 2005 23:36:33 -0000 1.27 @@ -31,6 +31,7 @@ #include "request.h" #include "util.h" +#include "gtkblist.h" #include "gtkprivacy.h" #include "gtkutils.h" @@ -271,6 +272,7 @@ type_changed_cb(GtkOptionMenu *optmenu, } gaim_blist_schedule_save(); + gaim_gtk_blist_refresh(gaim_get_blist()); } static void Index: privacy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/privacy.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -p -r1.15 -r1.16 --- privacy.c 20 Mar 2005 01:42:53 -0000 1.15 +++ privacy.c 17 Jul 2005 23:36:33 -0000 1.16 @@ -170,6 +170,40 @@ gaim_privacy_deny_remove(GaimAccount *ac return TRUE; } +gboolean +gaim_privacy_check(GaimAccount *account, const char *who) +{ + GSList *list; + + switch (account->perm_deny) { + case GAIM_PRIVACY_ALLOW_ALL: + return TRUE; + + case GAIM_PRIVACY_DENY_ALL: + return FALSE; + + case GAIM_PRIVACY_ALLOW_USERS: + for (list=account->permit; list!=NULL; list=list->next) { + if (!gaim_utf8_strcasecmp(who, gaim_normalize(account, (char *)list->data))) + return TRUE; + } + return FALSE; + + case GAIM_PRIVACY_DENY_USERS: + for (list=account->deny; list!=NULL; list=list->next) { + if (!gaim_utf8_strcasecmp(who, gaim_normalize( account, (char *)list->data ))) + return FALSE; + } + return TRUE; + + case GAIM_PRIVACY_ALLOW_BUDDYLIST: + return (gaim_find_buddy(account, who) != NULL); + + default: + g_return_val_if_reached(TRUE); + } +} + void gaim_privacy_set_ui_ops(GaimPrivacyUiOps *ops) { Index: privacy.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/privacy.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -p -r1.12 -r1.13 --- privacy.h 21 Feb 2004 07:01:42 -0000 1.12 +++ privacy.h 17 Jul 2005 23:36:33 -0000 1.13 @@ -107,6 +107,17 @@ gboolean gaim_privacy_deny_add(GaimAccou gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name, gboolean local_only); + +/** + * Check the privacy-setting for a user. + * + * @param account The account. + * @param who The name of the user. + * + * @return TRUE if the user is allowed to send messages, or @c FALSE otherwise. + */ +gboolean gaim_privacy_check(GaimAccount *account, const char *who); + /** * Sets the UI operations structure for the privacy subsystem. * |