comparison libpurple/protocols/myspace/myspace.c @ 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 e808d83d797e
children 762174f38807
comparison
equal deleted inserted replaced
22265:7bd8ec61e687 22268:1f3481447197
288 288
289 gc = purple_account_get_connection(acct); 289 gc = purple_account_get_connection(acct);
290 gc->proto_data = msim_session_new(acct); 290 gc->proto_data = msim_session_new(acct);
291 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; 291 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC;
292 292
293 #ifdef MSIM_MAX_PASSWORD_LENGTH
294 /* Passwords are limited in length. */
295 if (strlen(acct->password) > MSIM_MAX_PASSWORD_LENGTH) {
296 gchar *str;
297
298 str = g_strdup_printf(
299 _("Sorry, passwords over %d characters in length (yours is "
300 "%d) are not supported by MySpace."),
301 MSIM_MAX_PASSWORD_LENGTH,
302 (int)strlen(acct->password));
303
304 /* Notify an error message also, because this is important! */
305 purple_notify_error(acct, _("MySpaceIM Error"), str, NULL);
306
307 purple_connection_error_reason (gc,
308 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, str);
309 g_free(str);
310 return;
311 }
312 #endif
313
314 /* 1. connect to server */ 293 /* 1. connect to server */
315 purple_connection_update_progress(gc, _("Connecting"), 294 purple_connection_update_progress(gc, _("Connecting"),
316 0, /* which connection step this is */ 295 0, /* which connection step this is */
317 4); /* total number of steps */ 296 4); /* total number of steps */
318 297
1860 switch (err) { 1839 switch (err) {
1861 case MSIM_ERROR_INCORRECT_PASSWORD: /* Incorrect password */ 1840 case MSIM_ERROR_INCORRECT_PASSWORD: /* Incorrect password */
1862 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; 1841 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
1863 if (!purple_account_get_remember_password(session->account)) 1842 if (!purple_account_get_remember_password(session->account))
1864 purple_account_set_password(session->account, NULL); 1843 purple_account_set_password(session->account, NULL);
1844 #ifdef MSIM_MAX_PASSWORD_LENGTH
1845 if (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH) {
1846 gchar *suggestion;
1847
1848 suggestion = g_strdup_printf(_("%s Your password is "
1849 "%d characters, greater than the "
1850 "expected maximum length of %d for "
1851 "MySpaceIM. Please shorten your "
1852 "password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."),
1853 full_errmsg, (int)
1854 strlen(session->account->password),
1855 MSIM_MAX_PASSWORD_LENGTH);
1856
1857 /* Replace full_errmsg. */
1858 g_free(full_errmsg);
1859 full_errmsg = suggestion;
1860 }
1861 #endif
1865 break; 1862 break;
1866 case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */ 1863 case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */
1867 reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; 1864 reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
1868 if (!purple_account_get_remember_password(session->account)) 1865 if (!purple_account_get_remember_password(session->account))
1869 purple_account_set_password(session->account, NULL); 1866 purple_account_set_password(session->account, NULL);