Mercurial > pidgin.yaz
changeset 31183:0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
author | masca@cpw.pidgin.im |
---|---|
date | Fri, 28 May 2010 08:28:37 +0000 |
parents | a34622165ecd |
children | 3de6fd89e8c4 |
files | libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/msn.h libpurple/protocols/msn/msnutils.c libpurple/protocols/msn/msnutils.h libpurple/protocols/msn/userlist.c |
diffstat | 6 files changed, 34 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c Fri May 28 08:21:21 2010 +0000 +++ b/libpurple/protocols/msn/contact.c Fri May 28 08:28:37 2010 +0000 @@ -29,6 +29,7 @@ #include "contact.h" #include "xmlnode.h" #include "group.h" +#include "msnutils.h" #include "soap.h" #include "nexus.h" #include "user.h"
--- a/libpurple/protocols/msn/msn.c Fri May 28 08:21:21 2010 +0000 +++ b/libpurple/protocols/msn/msn.c Fri May 28 08:28:37 2010 +0000 @@ -117,29 +117,6 @@ return buf; } -gboolean -msn_email_is_valid(const char *passport) -{ - if (purple_email_is_valid(passport)) { - /* Special characters aren't allowed in domains, so only go to '@' */ - while (*passport != '@') { - if (*passport == '/') - return FALSE; - else if (*passport == '?') - return FALSE; - else if (*passport == '=') - return FALSE; - /* MSN also doesn't like colons, but that's checked already */ - - passport++; - } - - return TRUE; - } - - return FALSE; -} - static gboolean msn_send_attention(PurpleConnection *gc, const char *username, guint type) {
--- a/libpurple/protocols/msn/msn.h Fri May 28 08:21:21 2010 +0000 +++ b/libpurple/protocols/msn/msn.h Fri May 28 08:28:37 2010 +0000 @@ -117,7 +117,6 @@ ((MSN_CLIENT_ID_VERSION << 24) | \ (MSN_CLIENT_ID_CAPABILITIES)) -gboolean msn_email_is_valid(const char *passport); void msn_set_public_alias(PurpleConnection *gc, const char *alias, PurpleSetPublicAliasSuccessCallback success_cb,
--- a/libpurple/protocols/msn/msnutils.c Fri May 28 08:21:21 2010 +0000 +++ b/libpurple/protocols/msn/msnutils.c Fri May 28 08:28:37 2010 +0000 @@ -474,6 +474,29 @@ *ret_port = port; } +gboolean +msn_email_is_valid(const char *passport) +{ + if (purple_email_is_valid(passport)) { + /* Special characters aren't allowed in domains, so only go to '@' */ + while (*passport != '@') { + if (*passport == '/') + return FALSE; + else if (*passport == '?') + return FALSE; + else if (*passport == '=') + return FALSE; + /* MSN also doesn't like colons, but that's checked already */ + + passport++; + } + + return TRUE; + } + + return FALSE; +} + /*************************************************************************** * MSN Challenge Computing Function ***************************************************************************/
--- a/libpurple/protocols/msn/msnutils.h Fri May 28 08:21:21 2010 +0000 +++ b/libpurple/protocols/msn/msnutils.h Fri May 28 08:28:37 2010 +0000 @@ -64,6 +64,15 @@ void msn_parse_socket(const char *str, char **ret_host, int *ret_port); /** + * Verify if the email is a vaild passport. + * + * @param passport The email + * + * @return True if it is a valid passport, else FALSE + */ +gboolean msn_email_is_valid(const char *passport); + +/** * Handle MSN Challenge Computation * This algorithm references * http://imfreedom.org/wiki/index.php/MSN:NS/Challenges