im.pidgin.pidgin: 782f53e182e5aae0645ddca95945dd0c104330ff
jeff2 at soc.pidgin.im
jeff2 at soc.pidgin.im
Sat Feb 16 16:35:51 EST 2008
-----------------------------------------------------------------
Revision: 782f53e182e5aae0645ddca95945dd0c104330ff
Ancestor: 5781d39f495daa6c1aaac51861fb1cd79d6869f0
Author: jeff2 at soc.pidgin.im
Date: 2008-02-16T21:29:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/782f53e182e5aae0645ddca95945dd0c104330ff
Modified files:
libpurple/protocols/myspace/myspace.h
libpurple/protocols/myspace/user.c
libpurple/protocols/myspace/user.h
ChangeLog:
In msimprpl, add msim_is_valid_username() to check whether a username
is valid (not whether it exists). Not used anywhere, but will help #4855.
-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.h 27bdbf2302bc6d261286b5d29145745aa05bc54b
+++ libpurple/protocols/myspace/myspace.h b562edaec50b976c20cdfe642b92f5560e438a96
@@ -89,6 +89,9 @@
* warn user that it may be too long. */
#define MSIM_MAX_PASSWORD_LENGTH 10
+/* Maximum length of usernames, when setting. */
+#define MSIM_MAX_USERNAME_LENGTH 25
+
/* Build version of MySpaceIM to report to servers (1.0.xxx.0) */
#define MSIM_CLIENT_VERSION 697
============================================================
--- libpurple/protocols/myspace/user.c c3d59eb6811a7e6f0f426a8d626fa02a80cb0749
+++ libpurple/protocols/myspace/user.c 68ab845b755bd7d58084bd7dae3ad80beaa6ddff
@@ -496,6 +496,19 @@ msim_is_userid(const gchar *user)
return strspn(user, "0123456789") == strlen(user);
}
+/** Return whether a given username is syntactically valid.
+ * Note: does not actually check that the user exists. */
+gboolean
+msim_is_valid_username(const gchar *user)
+{
+ return !msim_is_userid(user) && /* Not all numeric */
+ strlen(user) <= MSIM_MAX_USERNAME_LENGTH
+ && strspn(user, "0123456789"
+ "abcdefghijklmnopqrstuvwxyz"
+ "_"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == strlen(user);
+}
+
/**
* Check if a string is an email address (contains an @).
*
============================================================
--- libpurple/protocols/myspace/user.h cd9979c445f2cd58e5c302d6c448beaea0ca71e3
+++ libpurple/protocols/myspace/user.h e630e48e95179f76d169f70dc8ceb53c8c8b7994
@@ -51,6 +51,7 @@ gboolean msim_is_email(const gchar *user
gboolean msim_store_user_info(MsimSession *session, MsimMessage *msg, MsimUser *user);
gboolean msim_is_userid(const gchar *user);
gboolean msim_is_email(const gchar *user);
+gboolean msim_is_valid_username(const gchar *user);
void msim_lookup_user(MsimSession *session, const gchar *user, MSIM_USER_LOOKUP_CB cb, gpointer data);
void msim_set_username_cb(PurpleConnection *gc);
void msim_do_not_set_username_cb(PurpleConnection *gc);
More information about the Commits
mailing list