From: Don S. <ri...@us...> - 2005-02-04 20:31:59
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18139 Modified Files: bnet.c buddy.c buddy.h Log Message: Privacy support for RFE #1115491 Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** bnet.c 27 Jan 2005 21:26:41 -0000 1.34 --- bnet.c 4 Feb 2005 20:31:34 -0000 1.35 *************** *** 35,38 **** --- 35,39 ---- #include "conn.h" #include "intl.h" + #include "privacy.h" static GaimPlugin *_bnet_plugin = NULL; *************** *** 171,174 **** --- 172,203 ---- } + + static void bnet_set_permit_deny(GaimConnection *gc) { + GaimAccount *account = gaim_connection_get_account(gc); + GSList *deny; + + switch (account->perm_deny) { + case GAIM_PRIVACY_ALLOW_ALL: + for (deny = account->deny; deny; deny = deny->next) + bnet_user_unsquelch(gc, deny->data); + break; + + case GAIM_PRIVACY_ALLOW_USERS: + for (deny = account->deny; deny; deny = deny->next) + bnet_user_unsquelch(gc, deny->data); + break; + + case GAIM_PRIVACY_ALLOW_BUDDYLIST: + case GAIM_PRIVACY_DENY_USERS: + for (deny = account->deny; deny; deny = deny->next) + bnet_user_squelch(gc, deny->data); + break; + + case GAIM_PRIVACY_DENY_ALL: + default: + break; + } + } + /****************************************************************************** * Protocol/Plugin stuff *************** *** 206,213 **** NULL, /* remove_buddies */ NULL, /* add_permit */ ! NULL, /* add_deny */ NULL, /* rem_permit */ ! NULL, /* rem_deny */ ! NULL, /* set_permit_deny */ NULL, /* warn */ bnet_chat_join, /* join_chat */ --- 235,242 ---- NULL, /* remove_buddies */ NULL, /* add_permit */ ! bnet_user_squelch, /* add_deny */ NULL, /* rem_permit */ ! bnet_user_unsquelch, /* rem_deny */ ! bnet_set_permit_deny, /* set_permit_deny */ NULL, /* warn */ bnet_chat_join, /* join_chat */ Index: buddy.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** buddy.h 21 Jan 2005 05:45:52 -0000 1.9 --- buddy.h 4 Feb 2005 20:31:34 -0000 1.10 *************** *** 56,59 **** --- 56,61 ---- void bnet_user_free(BNetUser *user); void bnet_user_info(GaimConnection *gc, const gchar *who); + void bnet_user_squelch(GaimConnection *gc, const gchar *who); + void bnet_user_unsquelch(GaimConnection *gc, const gchar *who); /* Users API */ Index: buddy.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** buddy.c 4 Feb 2005 19:41:28 -0000 1.15 --- buddy.c 4 Feb 2005 20:31:34 -0000 1.16 *************** *** 90,93 **** --- 90,116 ---- } + + void bnet_user_squelch(GaimConnection *gc, const gchar *who) { + BNetConn *conn = BNET_CONN(gc->proto_data); + + if (conn->vw_nick) + g_free(conn->vw_nick); + conn->vw_nick = g_strdup(gaim_normalize(conn->account, who)); + + gaim_debug_info("bnet", "/squelch %s\n", who); + bnet_conn_send(conn, "/squelch %s\n", who); + } + + void bnet_user_unsquelch(GaimConnection *gc, const gchar *who) { + BNetConn *conn = BNET_CONN(gc->proto_data); + + if (conn->vw_nick) + g_free(conn->vw_nick); + conn->vw_nick = g_strdup(gaim_normalize(conn->account, who)); + + gaim_debug_info("bnet", "/unsquelch %s\n", who); + bnet_conn_send(conn, "/unsquelch %s\n", who); + } + /****************************************************************************** * Users API |