diff options
author | Elliott Sales de Andrade <qulogic@pidgin.im> | 2010-12-05 09:06:00 +0000 |
---|---|---|
committer | Elliott Sales de Andrade <qulogic@pidgin.im> | 2010-12-05 09:06:00 +0000 |
commit | cb4c93a9c9e2a3721d1b20342394a334b23e5cba (patch) | |
tree | c2e3bc07cb65043c61f387ad11a925412c6508f4 /libpurple/protocols/msn/msn.c | |
parent | 93c19315b8343429980813d9e3aa4a308991e9ba (diff) | |
download | pidgin-cb4c93a9c9e2a3721d1b20342394a334b23e5cba.tar.gz |
Add account action to enable/disable connecting from multiple
locations simultaneously.
Fixes #13017.
Diffstat (limited to 'libpurple/protocols/msn/msn.c')
-rw-r--r-- | libpurple/protocols/msn/msn.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 1b10f773d2..e23b5e3a06 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -589,6 +589,67 @@ msn_show_locations(PurplePluginAction *action) } 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, gpointer context) 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); |