changeset 5364:379beab3d157

[gaim-migrate @ 5740] If you have MSN Mobile support, you can now enable or disable it from the Protocol Actions menu. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 13 May 2003 08:36:36 +0000
parents ebebc833cf77
children fa63b4c784b9
files src/protocols/msn/msn.c src/protocols/msn/notification.c
diffstat 2 files changed, 72 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Tue May 13 08:03:27 2003 +0000
+++ b/src/protocols/msn/msn.c	Tue May 13 08:36:36 2003 +0000
@@ -67,7 +67,7 @@
 }
 
 static void
-msn_set_phone_number(gpointer data, const char *type, const char *entry)
+msn_set_prp(gpointer data, const char *type, const char *entry)
 {
 	struct gaim_connection *gc = data;
 	MsnSession *session = gc->proto_data;
@@ -89,22 +89,36 @@
 static void
 msn_set_home_phone_cb(gpointer data, char *entry)
 {
-	msn_set_phone_number(data, "PHH", entry);
+	msn_set_prp(data, "PHH", entry);
 }
 
 static void
 msn_set_work_phone_cb(gpointer data, char *entry)
 {
-	msn_set_phone_number(data, "PHW", entry);
+	msn_set_prp(data, "PHW", entry);
 }
 
 static void
 msn_set_mobile_phone_cb(gpointer data, char *entry)
 {
-	msn_set_phone_number(data, "PHM", entry);
+	msn_set_prp(data, "PHM", entry);
+}
+
+static void
+__enable_msn_pages_cb(struct gaim_connection *gc)
+{
+	msn_set_prp(gc, "MOB", "Y");
 }
 
 static void
+__disable_msn_pages_cb(struct gaim_connection *gc)
+{
+	msn_set_prp(gc, "MOB", "N");
+}
+
+/* -- */
+
+static void
 msn_show_set_friendly_name(struct gaim_connection *gc)
 {
 	do_prompt_dialog(_("Set Friendly Name:"), gc->displayname,
@@ -141,6 +155,36 @@
 					 gc, msn_set_mobile_phone_cb, NULL);
 }
 
+#if 0
+static void
+msn_show_set_mobile_support(struct gaim_connection *gc)
+{
+	MsnSession *session = gc->proto_data;
+
+	do_ask_dialog(_("MSN Mobile Support"),
+				  _("Do you want to enable or disable MSN Mobile "
+					"device support?"),
+				  gc,
+				  _("Enable"), __enable_msn_mobile_cb,
+				  _("Disable"), __disable_msn_mobile_cb,
+				  session->prpl->handle, FALSE);
+}
+#endif
+
+static void
+msn_show_set_mobile_pages(struct gaim_connection *gc)
+{
+	MsnSession *session = gc->proto_data;
+
+	do_ask_dialog(_("MSN Mobile Pages"),
+				  _("Do you want to allow or disallow people on your buddy "
+					"list to send you mobile pages?"),
+				  gc,
+				  _("Allow"), __enable_msn_pages_cb,
+				  _("Disallow"), __disable_msn_pages_cb,
+				  session->prpl->handle, FALSE);
+}
+
 /**************************************************************************
  * Protocol Plugin ops
  **************************************************************************/
@@ -226,6 +270,8 @@
 	pam->gc = gc;
 	m = g_list_append(m, pam);
 
+	m = g_list_append(m, NULL);
+
 	pam = g_new0(struct proto_actions_menu, 1);
 	pam->label = _("Set Home Phone Number");
 	pam->callback = msn_show_set_home_phone;
@@ -244,6 +290,22 @@
 	pam->gc = gc;
 	m = g_list_append(m, pam);
 
+	m = g_list_append(m, NULL);
+
+#if 0
+	pam = g_new0(struct proto_actions_menu, 1);
+	pam->label = _("Enable/Disable Mobile Devices");
+	pam->callback = msn_show_set_mobile_support;
+	pam->gc = gc;
+	m = g_list_append(m, pam);
+#endif
+
+	pam = g_new0(struct proto_actions_menu, 1);
+	pam->label = _("Allow/Disallow Mobile Pages");
+	pam->callback = msn_show_set_mobile_pages;
+	pam->gc = gc;
+	m = g_list_append(m, pam);
+
 	return m;
 }
 
--- a/src/protocols/msn/notification.c	Tue May 13 08:03:27 2003 +0000
+++ b/src/protocols/msn/notification.c	Tue May 13 08:36:36 2003 +0000
@@ -446,11 +446,12 @@
 
 	if (value != NULL) {
 		if (!strcmp(type, "MOB")) {
-			if (!strcmp(value, "Y")) {
-				gaim_debug(GAIM_DEBUG_MISC, "msn",
-						   "%s has a pager\n", passport);
-				if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
-					status = b->uc | (1 << 5);
+			if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
+				if (GAIM_BUDDY_IS_ONLINE(b)) {
+					if (!strcmp(value, "Y"))
+						status = (b->uc | (1 << 5));
+					else if (!strcmp(value, "N"))
+						status = (b->uc ^ (1 << 5));
 
 					serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
 				}