changeset 14964:1aa9839ca599

[gaim-migrate @ 17742] Fixed a bug (1310664) where a buddy already listed in the Evolution addressbook would still have an "Add to Address Book" menuitem in the context menu when using the gevolution plugin. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 13 Nov 2006 03:53:46 +0000
parents b933bffead6e
children 89ef5680f228
files gtk/plugins/gevolution/gevolution.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/plugins/gevolution/gevolution.c	Mon Nov 13 03:28:15 2006 +0000
+++ b/gtk/plugins/gevolution/gevolution.c	Mon Nov 13 03:53:46 2006 +0000
@@ -276,23 +276,30 @@
 {
 	GaimMenuAction *act;
 	GaimBuddy *buddy;
+	EContact *contact;
 
 	if (!GAIM_BLIST_NODE_IS_BUDDY(node))
 		return;
 
 	buddy = (GaimBuddy *)node;
 
-	if (gevo_prpl_is_supported(buddy->account, buddy))
+	if (!gevo_prpl_is_supported(gaim_buddy_get_account(buddy), buddy))
+		return;
+
+	contact = gevo_search_buddy_in_contacts(buddy, NULL);
+
+	if (contact == NULL)
 	{
 		act = gaim_menu_action_new(_("Add to Address Book"),
 		                           GAIM_CALLBACK(menu_item_activate_cb),
 		                           NULL, NULL);
 		*menu = g_list_append(*menu, act);
-		act = gaim_menu_action_new(_("Send E-Mail"),
-		                           GAIM_CALLBACK(menu_item_send_mail_activate_cb),
-		                           NULL, NULL);
-		*menu = g_list_append(*menu, act);
 	}
+
+	act = gaim_menu_action_new(_("Send E-Mail"),
+							   GAIM_CALLBACK(menu_item_send_mail_activate_cb),
+							   NULL, NULL);
+	*menu = g_list_append(*menu, act);
 }
 
 /* TODO: Something in here leaks 1 reference to a bonobo object! */
@@ -531,7 +538,7 @@
 	N_("Provides integration with Evolution."),
 	                                                  /**  description    */
 	N_("Provides integration with Evolution."),
-	"Christian Hammond <chipx86@gnupdate.org>",       /**< author         */
+	"Christian Hammond <chipx86@chipx86.com>",        /**< author         */
 	GAIM_WEBSITE,                                     /**< homepage       */
 
 	plugin_load,                                      /**< load           */