im.pidgin.pidgin: 27ebb66171c1a1a757cd8d3e325c91e159b1d048

jeff2 at soc.pidgin.im jeff2 at soc.pidgin.im
Mon Feb 18 14:25:55 EST 2008


-----------------------------------------------------------------
Revision: 27ebb66171c1a1a757cd8d3e325c91e159b1d048
Ancestor: 782f53e182e5aae0645ddca95945dd0c104330ff
Author: jeff2 at soc.pidgin.im
Date: 2008-02-18T19:20:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/27ebb66171c1a1a757cd8d3e325c91e159b1d048

Modified files:
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/myspace/user.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	ee341704dfd8a14b94fc3a2d9050b1990d6a3fda
+++ libpurple/protocols/myspace/myspace.c	b8672d241bb608c52d3ce590017fef4d53863550
@@ -1578,9 +1578,6 @@ msim_is_username_set(MsimSession *sessio
 	 * 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 @@ gboolean msim_we_are_logged_on(MsimSessi
 	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);
============================================================
--- libpurple/protocols/myspace/user.c	68ab845b755bd7d58084bd7dae3ad80beaa6ddff
+++ libpurple/protocols/myspace/user.c	2d3226fb37480df5657d5a9fa564c58a22bcd5b3
@@ -564,7 +564,7 @@ void msim_do_not_set_username_cb(PurpleC
  * 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 @@ static void msim_username_is_set_cb(Msim
 		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 @@ static void msim_username_is_set_cb(Msim
 			&& 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, 


More information about the Commits mailing list