diff mcabber/src/utils.c @ 977:5b01de4ac5e1

Cosmetic changes
author Alexis Hildebrandt <afh [at] 2drop [dot] net>
date Tue, 10 Oct 2006 20:15:06 +0200
parents 527d6f234924
children ea939ff047d8
line wrap: on
line diff
--- a/mcabber/src/utils.c	Tue Oct 10 19:43:32 2006 +0200
+++ b/mcabber/src/utils.c	Tue Oct 10 20:15:06 2006 +0200
@@ -39,6 +39,7 @@
 #include <glib.h>
 
 #include <config.h>
+#include "utils.h"
 #include "logprint.h"
 
 static int DebugEnabled;
@@ -313,7 +314,7 @@
 
   if (!jid) return 1;
 
-  domain = strchr(jid, '@');
+  domain = strchr(jid, JID_DOMAIN_SEPARATOR);
 
   /* the username is optional */
   if (!domain) {
@@ -325,8 +326,8 @@
     domain++;
 
     /* check for low and invalid ascii characters in the username */
-    for (str = jid; *str != '@'; str++) {
-      if (*str <= 32 || *str == ':' || *str == '@' ||
+    for (str = jid; *str != JID_DOMAIN_SEPARATOR; str++) {
+      if (*str <= ' ' || *str == ':' || *str == JID_DOMAIN_SEPARATOR ||
               *str == '<' || *str == '>' || *str == '\'' ||
               *str == '"' || *str == '&') {
         return 1;
@@ -335,7 +336,7 @@
     /* the username is okay as far as we can tell without LIBIDN */
   }
 
-  resource = strchr(domain, '/');
+  resource = strchr(domain, JID_RESOURCE_SEPARATOR);
 
   /* the resource is optional */
   if (resource) {
@@ -355,7 +356,7 @@
   if (domlen > 1023) return 1;
 
   /* make sure the hostname is valid characters */
-  for (str = domain; *str != '\0' && *str != '/'; str++) {
+  for (str = domain; *str != '\0' && *str != JID_RESOURCE_SEPARATOR; str++) {
     if (!(isalnum(*str) || *str == '.' || *str == '-' || *str == '_'))
       return 1;
   }