pidgin: 5bf6c707: Add account action to enable/disable con..

qulogic at pidgin.im qulogic at pidgin.im
Sun Dec 5 04:13:09 EST 2010


----------------------------------------------------------------------
Revision: 5bf6c7070fe27d6defcb578ffc5670b8c44c292c
Parent:   0462ef3072cf2d01a3fcdd5c96067e897b1c78b6
Author:   qulogic at pidgin.im
Date:     12/05/10 04:06:00
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5bf6c7070fe27d6defcb578ffc5670b8c44c292c

Changelog: 

Add account action to enable/disable connecting from multiple
locations simultaneously.

Fixes #13017.

Changes against parent 0462ef3072cf2d01a3fcdd5c96067e897b1c78b6

  patched  ChangeLog
  patched  libpurple/protocols/msn/msn.c

-------------- next part --------------
============================================================
--- ChangeLog	a7400c00cbdfe4a8364958bd5ad64a0d257e644d
+++ ChangeLog	8eb128e72a5264838545f29b222cd224e3e07e8f
@@ -31,7 +31,8 @@ version 2.7.8 (??/??/????):
 	  characters. (#8508)
 	* Fix receiving messages from users on Yahoo and other federated
 	  services. (#13022)
-	* Correctly remove old endpoints when they sign out.
+	* Correctly remove old endpoints from the list when they sign out.
+	* Add option to disable connections from multiple locations. (#13017)
 
 version 2.7.7 (11/23/2010):
 	General:
============================================================
--- libpurple/protocols/msn/msn.c	0533a53c03498b4b19388c0110f19e5ed420ff69
+++ libpurple/protocols/msn/msn.c	12b73f249c6fb0d063179fa50e89c8b47c9599b2
@@ -589,6 +589,67 @@ static void
 }
 
 static void
+enable_mpop_cb(PurpleConnection *pc)
+{
+	MsnSession *session = purple_connection_get_protocol_data(pc);
+
+	purple_debug_info("msn", "Enabling MPOP\n");
+
+	session->enable_mpop = TRUE;
+	msn_annotate_contact(session, "Me", "MSN.IM.MPOP", "1", NULL);
+
+	purple_prpl_got_account_actions(purple_connection_get_account(pc));
+}
+
+static void
+disable_mpop_cb(PurpleConnection *pc)
+{
+	PurpleAccount *account = purple_connection_get_account(pc);
+	MsnSession *session = purple_connection_get_protocol_data(pc);
+	GSList *l;
+
+	purple_debug_info("msn", "Disabling MPOP\n");
+
+	session->enable_mpop = FALSE;
+	msn_annotate_contact(session, "Me", "MSN.IM.MPOP", "0", NULL);
+
+	for (l = session->user->endpoints; l; l = l->next) {
+		MsnUserEndpoint *ep = l->data;
+		char *user;
+
+		if (ep->id[0] != '\0' && strncasecmp(ep->id + 1, session->guid, 36) == 0)
+			/* Don't kick myself */
+			continue;
+
+		purple_debug_info("msn", "Disconnecting Endpoint %s\n", ep->id);
+
+		user = g_strdup_printf("%s;%s", purple_account_get_username(account), ep->id);
+		msn_notification_send_uun(session, user, MSN_UNIFIED_NOTIFICATION_MPOP, "goawyplzthxbye");
+		g_free(user);
+	}
+
+	purple_prpl_got_account_actions(account);
+}
+
+static void
+msn_show_set_mpop(PurplePluginAction *action)
+{
+	PurpleConnection *pc;
+
+	pc = (PurpleConnection *)action->context;
+
+	purple_request_action(pc, NULL, _("Allow multiple logins?"),
+						_("Do you want to allow or disallow connecting from "
+						  "multiple locations simultaneously?"),
+						PURPLE_DEFAULT_ACTION_NONE,
+						purple_connection_get_account(pc), NULL, NULL,
+						pc, 3,
+						_("Allow"), G_CALLBACK(enable_mpop_cb),
+						_("Disallow"), G_CALLBACK(disable_mpop_cb),
+						_("Cancel"), NULL);
+}
+
+static void
 msn_show_set_home_phone(PurplePluginAction *action)
 {
 	PurpleConnection *gc;
@@ -1200,6 +1261,10 @@ msn_actions(PurplePlugin *plugin, gpoint
 	m = g_list_append(m, act);
 #endif
 
+	act = purple_plugin_action_new(_("Allow/Disallow Multiple Logins..."),
+			msn_show_set_mpop);
+	m = g_list_append(m, act);
+
 	act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."),
 			msn_show_set_mobile_pages);
 	m = g_list_append(m, act);


More information about the Commits mailing list