comparison 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
comparison
equal deleted inserted replaced
8091:56b74730715f 8092:697221d5d0ff
155 memcpy(ip, hptr->h_addr_list[0], 4); 155 memcpy(ip, hptr->h_addr_list[0], 4);
156 156
157 return 0; 157 return 0;
158 } 158 }
159 159
160 /**
161 * Check if the given screen name is a valid AIM or ICQ screen name.
162 *
163 * @return 1 if the screen name is valid, 0 if not.
164 */
165 faim_export int aim_snvalid(const char *sn)
166 {
167 int isICQ = 0;
168 int i = 0;
169
170 if (!sn)
171 return 0;
172
173 if (isdigit(sn[0]))
174 isICQ = 1;
175
176 while (sn[i] != '\0') {
177 /* If it started with a digit then it betta be all digits, ho */
178 if (isICQ) {
179 if (!isdigit(sn[i]))
180 return 0;
181 } else {
182 if (!isalnum(sn[i]) && (sn[i] != ' '))
183 return 0;
184 }
185 i++;
186 }
187
188 return 1;
189 }
190
160 /* 191 /*
161 * int snlen(const char *) 192 * int snlen(const char *)
162 * 193 *
163 * This takes a screen name and returns its length without 194 * This takes a screen name and returns its length without
164 * spaces. If there are no spaces in the SN, then the 195 * spaces. If there are no spaces in the SN, then the