changeset 11410:bc374facaeb2

[gaim-migrate @ 13647] You can now block other buddies. committer: Tailor Script <tailor@pidgin.im>
author Bartoz Oler <bartosz@pidgin.im>
date Thu, 01 Sep 2005 15:28:43 +0000
parents 1e495a5fcbbc
children 8caea199b018
files src/protocols/gg/gg.c
diffstat 1 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/gg/gg.c	Thu Sep 01 09:09:33 2005 +0000
+++ b/src/protocols/gg/gg.c	Thu Sep 01 15:28:43 2005 +0000
@@ -1567,6 +1567,36 @@
 }
 /* }}} */
 
+/*
+ */
+/* static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) {{{ */
+static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored)
+{
+	GaimConnection *gc;
+	GaimBuddy *buddy;
+	GGPInfo *info;
+	uin_t uin;
+
+	buddy = (GaimBuddy *)node;
+	gc = gaim_account_get_connection(gaim_buddy_get_account(buddy));
+	info = gc->proto_data;
+
+	uin = ggp_str_to_uin(gaim_buddy_get_name(buddy));
+
+	if (gaim_blist_node_get_bool(node, "blocked")) {
+		gaim_blist_node_set_bool(node, "blocked", FALSE);
+		gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
+		gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
+		gaim_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin);
+	} else {
+		gaim_blist_node_set_bool(node, "blocked", TRUE);
+		gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
+		gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
+		gaim_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin);
+	}
+}
+/* }}} */
+
 /* ---------------------------------------------------------------------- */
 /* ----- GaimPluginProtocolInfo ----------------------------------------- */
 /* ---------------------------------------------------------------------- */
@@ -1727,7 +1757,13 @@
 	if (!GAIM_BLIST_NODE_IS_BUDDY(node))
 		return NULL;
 
-	act = gaim_blist_node_action_new("Add to chat", ggp_bmenu_add_to_chat, NULL, NULL);
+	act = gaim_blist_node_action_new(_("Add to chat"), ggp_bmenu_add_to_chat, NULL, NULL);
+	m = g_list_append(m, act);
+
+	if (gaim_blist_node_get_bool(node, "blocked"))
+		act = gaim_blist_node_action_new(_("Unblock"), ggp_bmenu_block, NULL, NULL);
+	else
+		act = gaim_blist_node_action_new(_("Block"), ggp_bmenu_block, NULL, NULL);
 	m = g_list_append(m, act);
 
 	return m;