soc.2009.telepathy: 7a0b649d: Basic support for buddy tooltips and inf...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Fri Jun 19 08:30:54 EDT 2009


-----------------------------------------------------------------
Revision: 7a0b649d7beb2d299a565891eed9e4de70085276
Ancestor: e32efd08d7d6e23c94ba5ffd8d2577845946b1c3
Author: sttwister at soc.pidgin.im
Date: 2009-06-19T12:17:00
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/7a0b649d7beb2d299a565891eed9e4de70085276

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Basic support for buddy tooltips and info dialog

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	2fd9b36e01f333c263d79b7fa9bce00efe276617
+++ libpurple/protocols/telepathy/telepathy.c	0db440d678ebf25365170f4831d9ad96ee3df8c6
@@ -197,6 +197,27 @@ telepathy_status_text(PurpleBuddy* buddy
 	}
 }
 
+static void
+telepathy_tooltip_text (PurpleBuddy *buddy,
+                        PurpleNotifyUserInfo *user_info,
+			gboolean full)
+{
+	//const gchar *name = purple_buddy_get_name(buddy);
+	const gchar *alias = purple_buddy_get_alias(buddy);
+	gchar *status = telepathy_status_text(buddy);
+	
+	purple_debug_info("telepathy", "Showing tooltip text for %s\n",
+			purple_buddy_get_name(buddy));
+
+	purple_notify_user_info_add_pair(user_info, _("Alias"), alias);
+
+	if (status != NULL)
+	{
+		purple_notify_user_info_add_pair(user_info, _("Status"), status);
+		g_free(status);
+	}
+}
+
 /* TODO: Do a proper query of the "status" property */
 static GList *
 telepathy_status_types(PurpleAccount *acct)
@@ -415,6 +436,30 @@ static void
 }
 
 static void
+telepathy_get_info (PurpleConnection *gc, const char *who)
+{
+	PurpleNotifyUserInfo *user_info = purple_notify_user_info_new();
+	PurpleBuddy *buddy = purple_find_buddy(
+			purple_connection_get_account(gc),
+			who);
+	gchar *status = telepathy_status_text(buddy);
+
+	purple_debug_info("telepathy", "Getting info for %s\n", who);
+
+	purple_notify_user_info_add_pair(user_info,
+			_("Alias"), purple_buddy_get_alias(buddy));
+
+	if (status != NULL)
+	{
+		purple_notify_user_info_add_pair(user_info,
+				_("Status"), status);
+		g_free(status);
+	}
+
+	purple_notify_userinfo(gc, who, user_info, NULL, NULL);
+}
+
+static void
 telepathy_set_status (PurpleAccount *account, PurpleStatus *status)
 {
 	PurpleConnection *gc = purple_account_get_connection(account);
@@ -492,7 +537,7 @@ static PurplePluginProtocolInfo telepath
 	telepathy_list_icon,                  /* list_icon */
 	NULL,                                /* list_emblem */
 	telepathy_status_text,                /* status_text */
-	NULL,               /* tooltip_text */
+	telepathy_tooltip_text,               /* tooltip_text */
 	telepathy_status_types,               /* status_types */
 	NULL,            /* blist_node_menu */
 	NULL,                  /* chat_info */
@@ -502,7 +547,7 @@ static PurplePluginProtocolInfo telepath
 	telepathy_send_im,                    /* send_im */
 	NULL,                   /* set_info */
 	telepathy_send_typing,                /* send_typing */
-	NULL,                   /* get_info */
+	telepathy_get_info,                   /* get_info */
 	telepathy_set_status,                 /* set_status */
 	NULL,                   /* set_idle */
 	NULL,              /* change_passwd */


More information about the Commits mailing list