changeset 22259:6e5d37105189

Display buddies' phone numbers in the tooltip for MSN buddies if we have them
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 03 Feb 2008 17:37:58 +0000
parents fbd8297fe387
children b13bb5f49ecd
files libpurple/protocols/msn/msn.c libpurple/protocols/msnp9/msn.c libpurple/protocols/msnp9/notification.c libpurple/protocols/msnp9/sync.c
diffstat 4 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Sun Feb 03 17:33:02 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Feb 03 17:37:58 2008 +0000
@@ -655,8 +655,22 @@
 	 */
 	if (full && user)
 	{
+		const char *phone;
+
 		purple_notify_user_info_add_pair(user_info, _("Blocked"),
 									   ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No")));
+
+		phone = msn_user_get_home_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone);
+
+		phone = msn_user_get_work_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone);
+
+		phone = msn_user_get_mobile_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone);
 	}
 }
 
--- a/libpurple/protocols/msnp9/msn.c	Sun Feb 03 17:33:02 2008 +0000
+++ b/libpurple/protocols/msnp9/msn.c	Sun Feb 03 17:37:58 2008 +0000
@@ -557,8 +557,22 @@
 	 * you, which is the important information that this is trying to convey. */
 	if (full && user)
 	{
+		const char *phone;
+
 		purple_notify_user_info_add_pair(user_info, _("Blocked"),
 									   ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No")));
+
+		phone = msn_user_get_home_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone);
+
+		phone = msn_user_get_work_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone);
+
+		phone = msn_user_get_mobile_phone(user);
+		if (phone != NULL)
+			purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone);
 	}
 }
 
--- a/libpurple/protocols/msnp9/notification.c	Sun Feb 03 17:33:02 2008 +0000
+++ b/libpurple/protocols/msnp9/notification.c	Sun Feb 03 17:37:58 2008 +0000
@@ -840,6 +840,38 @@
 }
 
 static void
+bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+{
+	const char *type, *value, *passport;
+	MsnUser *user;
+
+	passport = cmd->params[1];
+	user = msn_userlist_find_user(cmdproc->session->userlist, passport);
+
+	g_return_if_fail(user != NULL);
+
+	type     = cmd->params[2];
+	value    = cmd->params[3];
+
+	if (value)
+	{
+		if (!strcmp(type, "MOB"))
+		{
+			if (!strcmp(value, "Y"))
+				user->mobile = TRUE;
+			else if (!strcmp(value, "N"))
+				user->mobile = FALSE;
+		}
+		else if (!strcmp(type, "PHH"))
+			msn_user_set_home_phone(user, purple_url_decode(value));
+		else if (!strcmp(type, "PHW"))
+			msn_user_set_work_phone(user, purple_url_decode(value));
+		else if (!strcmp(type, "PHM"))
+			msn_user_set_mobile_phone(user, purple_url_decode(value));
+	}
+}
+
+static void
 reg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
@@ -1435,6 +1467,7 @@
 	msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd);
 	msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd);
 	msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd);
+	msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd);
 
 	msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd);
 	msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd);
--- a/libpurple/protocols/msnp9/sync.c	Sun Feb 03 17:33:02 2008 +0000
+++ b/libpurple/protocols/msnp9/sync.c	Sun Feb 03 17:37:58 2008 +0000
@@ -206,6 +206,8 @@
 		{
 			if (!strcmp(value, "Y"))
 				user->mobile = TRUE;
+			else if (!strcmp(value, "N"))
+				user->mobile = FALSE;
 		}
 		else if (!strcmp(type, "PHH"))
 			msn_user_set_home_phone(user, purple_url_decode(value));