changeset 17665:5c2720824798

Fail with our own error message if an entered password is greater than 8 characters. Previously, passwords >8 characters caused login to fail, but with the generic error code 260. The reason for this password length limitation has not yet been determined, but it is better to fail with a more descriptive error message than a generic 1.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 25 Jun 2007 05:38:56 +0000
parents 8ee3fd09a543
children d81f57b8b3d1
files libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Mon Jun 25 05:24:44 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Mon Jun 25 05:38:56 2007 +0000
@@ -275,6 +275,28 @@
     gc = purple_account_get_connection(acct);
     gc->proto_data = msim_session_new(acct);
 
+	if (strlen(acct->password) > MSIM_MAX_PASSWORD_LENGTH)
+	{
+		gchar *str;
+
+
+		/* TODO: Find out why >8 is problematic. The web site lets you have
+		 * long passwords, but reportedly the official IM client does not
+		 * allow more than 8 characters to be entered. Just entering the first
+		 * 8 does not, on first try, appear to work. */
+		str = g_strdup_printf(_("Sorry, passwords over %d characters in length (yours is %d) are "
+					"currently not supported by the MySpaceIM plugin."), MSIM_MAX_PASSWORD_LENGTH,
+				(int)strlen(acct->password));
+
+		/* Notify an error message also, because this is important! */
+		purple_notify_error(acct, g_strdup(_("MySpaceIM Error")), str, NULL);
+
+        purple_connection_error(gc, str);
+		
+		g_free(str);
+	}
+
+
     /* 1. connect to server */
     purple_connection_update_progress(gc, _("Connecting"),
                                   0,   /* which connection step this is */
--- a/libpurple/protocols/myspace/myspace.h	Mon Jun 25 05:24:44 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Mon Jun 25 05:38:56 2007 +0000
@@ -75,6 +75,8 @@
 
 /* Constants */
 
+#define MSIM_MAX_PASSWORD_LENGTH 	8
+
 /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */
 #define MSIM_CLIENT_VERSION     673