Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/utils.c @ 1058:c0d44a9a99bc
Code cleanup
Cosmetics. Mostly get rid of "jid" variables, as it is a structure pointer
defined in libjabber/jabber.h.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 30 Nov 2006 19:51:09 +0100 |
parents | ea939ff047d8 |
children | 8e12137fab20 |
comparison
equal
deleted
inserted
replaced
1057:4cdf19d9c74e | 1058:c0d44a9a99bc |
---|---|
304 * really convenient for our usage. | 304 * really convenient for our usage. |
305 * | 305 * |
306 * Check if the full JID is valid | 306 * Check if the full JID is valid |
307 * Return 0 if it is valid, non zero otherwise | 307 * Return 0 if it is valid, non zero otherwise |
308 */ | 308 */ |
309 int check_jid_syntax(char *jid) | 309 int check_jid_syntax(char *fjid) |
310 { | 310 { |
311 char *str; | 311 char *str; |
312 char *domain, *resource; | 312 char *domain, *resource; |
313 int domlen; | 313 int domlen; |
314 | 314 |
315 if (!jid) return 1; | 315 if (!fjid) return 1; |
316 | 316 |
317 domain = strchr(jid, JID_DOMAIN_SEPARATOR); | 317 domain = strchr(fjid, JID_DOMAIN_SEPARATOR); |
318 | 318 |
319 /* the username is optional */ | 319 /* the username is optional */ |
320 if (!domain) { | 320 if (!domain) { |
321 domain = jid; | 321 domain = fjid; |
322 } else { | 322 } else { |
323 /* node identifiers may not be longer than 1023 bytes */ | 323 /* node identifiers may not be longer than 1023 bytes */ |
324 if ((domain == jid) || (domain-jid > 1023)) | 324 if ((domain == fjid) || (domain-fjid > 1023)) |
325 return 1; | 325 return 1; |
326 domain++; | 326 domain++; |
327 | 327 |
328 /* check for low and invalid ascii characters in the username */ | 328 /* check for low and invalid ascii characters in the username */ |
329 for (str = jid; *str != JID_DOMAIN_SEPARATOR; str++) { | 329 for (str = fjid; *str != JID_DOMAIN_SEPARATOR; str++) { |
330 if (*str <= ' ' || *str == ':' || *str == JID_DOMAIN_SEPARATOR || | 330 if (*str <= ' ' || *str == ':' || *str == JID_DOMAIN_SEPARATOR || |
331 *str == '<' || *str == '>' || *str == '\'' || | 331 *str == '<' || *str == '>' || *str == '\'' || |
332 *str == '"' || *str == '&') { | 332 *str == '"' || *str == '&') { |
333 return 1; | 333 return 1; |
334 } | 334 } |