If the user sets a username (because they don't have one), and it succeeds,

Mon, 18 Feb 2008 19:20:39 +0000

author
Jeff Connelly <jeff2@soc.pidgin.im>
date
Mon, 18 Feb 2008 19:20:39 +0000
changeset 22439
7d55e1ec2825
parent 22436
3483af12d74f
child 22440
b0e121e36e69

If the user sets a username (because they don't have one), and it succeeds,
then set MsimSession.username as well and update the server alias, so that
outgoing messages correctly appear as from their username instead of uid.

Based on patch from Jaywalker. Closes #4857.

libpurple/protocols/myspace/myspace.c file | annotate | diff | comparison | revisions
libpurple/protocols/myspace/user.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/myspace/myspace.c	Sat Feb 16 21:29:02 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Mon Feb 18 19:20:39 2008 +0000
@@ -1578,9 +1578,6 @@
 	 * address and not username. Will be freed in msim_session_destroy(). */
 	session->username = msim_msg_get_string(msg, "uniquenick");
 
-	/* Set display name to username (otherwise will show email address) */
-	purple_connection_set_display_name(session->gc, session->username);
-
 	/* If user lacks a username, help them get one. */
 	if (msim_msg_get_integer(msg, "uniquenick") == session->userid) {
 		purple_debug_info("msim_is_username_set", "no username is set\n");
@@ -1614,6 +1611,9 @@
 	purple_connection_update_progress(session->gc, _("Connected"), 3, 4);
 	purple_connection_set_state(session->gc, PURPLE_CONNECTED);
 
+	/* Set display name to username (otherwise will show email address) */
+	purple_connection_set_display_name(session->gc, session->username);
+
 	body = msim_msg_new(
 			"UserID", MSIM_TYPE_INTEGER, session->userid,
 			NULL);
--- a/libpurple/protocols/myspace/user.c	Sat Feb 16 21:29:02 2008 +0000
+++ b/libpurple/protocols/myspace/user.c	Mon Feb 18 19:20:39 2008 +0000
@@ -564,7 +564,7 @@
  * Currently.. We're safe letting them get by without setting it.. Unless we hear otherwise..        *
  * So for now, give them a menu.. If this becomes an issue with the Official client.. boot them here */
 void msim_do_not_set_username_cb(PurpleConnection *gc) {
-	purple_debug_info("msim", "Dont set username");
+	purple_debug_info("msim", "Don't set username");
 
 	/* Protocol won't log in now without a username set.. Disconnect */
 	purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set"));
@@ -803,6 +803,7 @@
 		purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code);
 		if (code == 0) {
 			/* Good! */
+			session->username = username;
 			msim_we_are_logged_on(session);
 		} else {
 			purple_debug_info("msim_username_is_set", "code is %d",code);
@@ -813,7 +814,7 @@
 			&& lid == MG_MYSPACE_INFO_BY_STRING_LID) {
 		/* Not quite done... ONE MORE STEP :) */
 		rid = msim_new_reply_callback(session, msim_username_is_set_cb, data);
-		body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL);
+		body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username), NULL);
 		if (!msim_send(session, "persist", MSIM_TYPE_INTEGER, 1, 
 					"sesskey", MSIM_TYPE_INTEGER, session->sesskey,
 					"cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT, 

mercurial