# HG changeset patch # User Mikael Berthe # Date 1127843549 -7200 # Node ID 471c9ccde0288ed824628e04fc255184236664fc # Parent 9d0e7260725109f02a129131d452d7fd065ea939 Make username optional in check_jid_syntax() This allows sending message/status to a Jabber agent, for example. diff -r 9d0e72607251 -r 471c9ccde028 mcabber/src/utils.c --- a/mcabber/src/utils.c Mon Sep 26 22:45:10 2005 +0200 +++ b/mcabber/src/utils.c Tue Sep 27 19:52:29 2005 +0200 @@ -266,24 +266,27 @@ if (!jid) return 1; domain = strchr(jid, '@'); - if (!domain) return 1; - /* node identifiers may not be longer than 1023 bytes */ - if ((domain == jid) || (domain-jid > 1023)) - return 1; - domain++; + /* the username is optional */ + if (!domain) { + domain = jid; + } else { + /* node identifiers may not be longer than 1023 bytes */ + if ((domain == jid) || (domain-jid > 1023)) + return 1; + domain++; - /* check for low and invalid ascii characters in the username */ - for (str = jid; *str != '@'; str++) { - if (*str <= 32 || *str == ':' || *str == '@' || - *str == '<' || *str == '>' || *str == '\'' || - *str == '"' || *str == '&') { - return 1; + /* check for low and invalid ascii characters in the username */ + for (str = jid; *str != '@'; str++) { + if (*str <= 32 || *str == ':' || *str == '@' || + *str == '<' || *str == '>' || *str == '\'' || + *str == '"' || *str == '&') { + return 1; + } } + /* the username is okay as far as we can tell without LIBIDN */ } - /* the username is okay as far as we can tell without LIBIDN */ - resource = strchr(domain, '/'); /* the resource is optional */