cpw.qulogic.msnp16: 0d4d5bc0: Allow setting the name of the current lo...

qulogic at pidgin.im qulogic at pidgin.im
Tue Dec 15 04:01:50 EST 2009


-----------------------------------------------------------------
Revision: 0d4d5bc02772b75cb871fb3fd91502023d9178e2
Ancestor: dba8aee4b9c1e9bca24851714615d52729eed120
Author: qulogic at pidgin.im
Date: 2009-12-15T03:58:03
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/0d4d5bc02772b75cb871fb3fd91502023d9178e2

Modified files:
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/notification.c

ChangeLog: 

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).

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	b3668411315e4aa60e83e55ef560cc392f789fdc
+++ libpurple/protocols/msn/msn.c	2961e3952b40ef583797c16b5b814fa993e730a2
@@ -359,6 +359,42 @@ static void
 }
 
 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 @@ msn_actions(PurplePlugin *plugin, gpoint
 	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 @@ msn_login(PurpleAccount *account)
 	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,
============================================================
--- libpurple/protocols/msn/notification.c	37f31f94937dda5fecbb679d0a307f9c43283a34
+++ libpurple/protocols/msn/notification.c	8e634c42d520fddbada5099aac1b6734a07dae20
@@ -1844,6 +1844,7 @@ void msn_notification_send_uux_private_e
 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 @@ void msn_notification_send_uux_private_e
 
 	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);


More information about the Commits mailing list