changeset 22268:1f3481447197

In msimprpl, if login fails, and the user's password is greater than 10 characters, note this in the login failure message and offer a URL to shorten it. MySpaceIM apparently limits passwords to 10 characters maximum now. Closes #4369.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Wed, 06 Feb 2008 05:37:32 +0000
parents 7bd8ec61e687
children 0e68dab2a362 762174f38807
files libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h
diffstat 2 files changed, 21 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Mon Feb 04 04:04:02 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Wed Feb 06 05:37:32 2008 +0000
@@ -290,27 +290,6 @@
 	gc->proto_data = msim_session_new(acct);
 	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC;
 
-#ifdef MSIM_MAX_PASSWORD_LENGTH
-	/* Passwords are limited in length. */
-	if (strlen(acct->password) > MSIM_MAX_PASSWORD_LENGTH) {
-		gchar *str;
-
-		str = g_strdup_printf(
-				_("Sorry, passwords over %d characters in length (yours is "
-				"%d) are not supported by MySpace."), 
-				MSIM_MAX_PASSWORD_LENGTH,
-				(int)strlen(acct->password));
-
-		/* Notify an error message also, because this is important! */
-		purple_notify_error(acct, _("MySpaceIM Error"), str, NULL);
-
-		purple_connection_error_reason (gc,
-			PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, str);
-		g_free(str);
-		return;
-	}
-#endif
-
 	/* 1. connect to server */
 	purple_connection_update_progress(gc, _("Connecting"),
 								  0,   /* which connection step this is */
@@ -1862,6 +1841,24 @@
 				reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 				if (!purple_account_get_remember_password(session->account))
 					purple_account_set_password(session->account, NULL);
+#ifdef MSIM_MAX_PASSWORD_LENGTH
+				if (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH) {
+					gchar *suggestion;
+
+					suggestion = g_strdup_printf(_("%s Your password is "
+							"%d characters, greater than the "
+							"expected maximum length of %d for "
+							"MySpaceIM. Please shorten your "
+							"password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."),
+							full_errmsg, (int)
+							strlen(session->account->password),
+							MSIM_MAX_PASSWORD_LENGTH);
+
+					/* Replace full_errmsg. */
+					g_free(full_errmsg);
+					full_errmsg = suggestion;
+				}
+#endif		
 				break;
 			case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */
 				reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
--- a/libpurple/protocols/myspace/myspace.h	Mon Feb 04 04:04:02 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Wed Feb 06 05:37:32 2008 +0000
@@ -84,9 +84,9 @@
  * http://settings.myspace.com/index.cfm?fuseaction=user.changepassword
  * (though curiously, not on the 'current password' field). */
 
-/* Not defined; instead have the client reject the password, until libpurple
- * supports specifying a length limit on the protocol's password. */
-/* #define MSIM_MAX_PASSWORD_LENGTH    10	*/
+/* After login fails, if password is greater than this many characters,
+ * warn user that it may be too long. */
+#define MSIM_MAX_PASSWORD_LENGTH    10
 
 /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */
 #define MSIM_CLIENT_VERSION         697