Mercurial > pidgin
diff src/protocols/oscar/util.c @ 8092:697221d5d0ff
[gaim-migrate @ 8791]
Give a nice little warning if you add an AIM or ICQ buddy with an invalid
name. I'm thinking some of those bug reports on SF about "Could not add
buddy with no name" are caused by this. Hopefully. Sometime before the
next release I'll probably actually remove invalid people from the local
list.
Also recognize the WinAIM Video and Camera caps.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 13 Jan 2004 05:44:37 +0000 |
parents | 5d7063e137da |
children | 990314a962fb |
line wrap: on
line diff
--- a/src/protocols/oscar/util.c Tue Jan 13 03:02:59 2004 +0000 +++ b/src/protocols/oscar/util.c Tue Jan 13 05:44:37 2004 +0000 @@ -157,6 +157,37 @@ return 0; } +/** + * Check if the given screen name is a valid AIM or ICQ screen name. + * + * @return 1 if the screen name is valid, 0 if not. + */ +faim_export int aim_snvalid(const char *sn) +{ + int isICQ = 0; + int i = 0; + + if (!sn) + return 0; + + if (isdigit(sn[0])) + isICQ = 1; + + while (sn[i] != '\0') { + /* If it started with a digit then it betta be all digits, ho */ + if (isICQ) { + if (!isdigit(sn[i])) + return 0; + } else { + if (!isalnum(sn[i]) && (sn[i] != ' ')) + return 0; + } + i++; + } + + return 1; +} + /* * int snlen(const char *) *