# HG changeset patch # User Elliott Sales de Andrade # Date 1260849483 0 # Node ID dd430f788bdc96ae5544f78a20f83afa242abea8 # Parent b4dc2d27f24e6a3e48abe072d054e74a72da90c4 Allow setting the name of the current location. The default is still Pidgin because I have no idea how to determine the "Computer Description" that the official client uses by default (and I'm not even sure it exists on all platforms). diff -r b4dc2d27f24e -r dd430f788bdc libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Tue Dec 15 03:53:11 2009 +0000 +++ b/libpurple/protocols/msn/msn.c Tue Dec 15 03:58:03 2009 +0000 @@ -359,6 +359,42 @@ } static void +set_endpoint_cb(PurpleConnection *pc, const char *entry) +{ + MsnSession *session; + PurpleAccount *account; + + session = purple_connection_get_protocol_data(pc); + account = purple_connection_get_account(pc); + + /* Empty endpoint names are not allowed */ + if (!entry || !*entry) + return; + + purple_account_set_string(account, "endpoint-name", entry); + msn_notification_send_uux_private_endpointdata(session); +} + +static void +msn_show_set_endpoint_name(PurplePluginAction *action) +{ + PurpleConnection *pc; + PurpleAccount *account; + + pc = (PurpleConnection *)action->context; + account = purple_connection_get_account(pc); + + purple_request_input(pc, NULL, _("Set your location name."), + _("This is the name that identifies this location."), + purple_account_get_string(account, "endpoint-name", NULL), + FALSE, FALSE, NULL, + _("OK"), G_CALLBACK(set_endpoint_cb), + _("Cancel"), NULL, + account, NULL, NULL, + pc); +} + +static void msn_show_set_home_phone(PurplePluginAction *action) { PurpleConnection *gc; @@ -931,6 +967,11 @@ m = g_list_append(m, act); m = g_list_append(m, NULL); + act = purple_plugin_action_new(_("Set Location Name..."), + msn_show_set_endpoint_name); + m = g_list_append(m, act); + m = g_list_append(m, NULL); + act = purple_plugin_action_new(_("Set Home Phone Number..."), msn_show_set_home_phone); m = g_list_append(m, act); @@ -1065,6 +1106,10 @@ username = purple_account_get_string(account, "display-name", NULL); purple_connection_set_display_name(gc, username); + if (purple_account_get_string(account, "endpoint-name", NULL) == NULL) { + purple_account_set_string(account, "endpoint-name", "Pidgin"); + } + if (!msn_session_connect(session, host, port, http_method)) purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, diff -r b4dc2d27f24e -r dd430f788bdc libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Tue Dec 15 03:53:11 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Tue Dec 15 03:58:03 2009 +0000 @@ -1844,6 +1844,7 @@ void msn_notification_send_uux_private_endpointdata(MsnSession *session) { xmlnode *private; + const char *name; xmlnode *epname; xmlnode *idle; xmlnode *client_type; @@ -1853,9 +1854,9 @@ private = xmlnode_new("PrivateEndpointData"); - /* TODO: "Pidgin" is a temp EndPointName.. we must use hostid or some.*/ + name = purple_account_get_string(session->account, "endpoint-name", NULL); epname = xmlnode_new_child(private, "EpName"); - xmlnode_insert_data(epname, "Pidgin", -1); + xmlnode_insert_data(epname, name, -1); idle = xmlnode_new_child(private, "Idle"); xmlnode_insert_data(idle, "false", -1);