Bläddra i källkod

* get_user_by_host() wasn't checking how I wanted, now doing it manually

svn: 1577
Bryan Drewery 21 år sedan
förälder
incheckning
ae8e8105a4
1 ändrade filer med 14 tillägg och 7 borttagningar
  1. 14 7
      src/mod/irc.mod/irc.c

+ 14 - 7
src/mod/irc.mod/irc.c

@@ -456,18 +456,25 @@ check_hostmask()
   if (!server_online || !botuserhost[0])
     return;
 
-  char s[UHOSTLEN + 2] = "", *tmp = botuserhost;
-  struct userrec *u = NULL;
+  char s[UHOSTLEN + 2] = "";
 
   checked_hostmask = 1;
 
-  sprintf(s, "*!%s", tmp);		/* just add actual user@ident, regardless of ~ */
+  sprintf(s, "*!%s", botuserhost);		/* just add actual user@ident, regardless of ~ */
 
   /* dont add the host if it conflicts with another in the userlist */
-  if ((u = get_user_by_host(s))) {
-    if (u != conf.bot->u)
-      putlog(LOG_WARN, "*", "My automatic hostmask '%s' would conflict with user: '%s'. (Not adding)", s, u->handle);
-    return;
+  struct userrec *u = NULL;
+  struct list_type *q = NULL;
+
+  for (u = userlist; u; u = u->next) {
+    q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
+    for (; q; q = q->next) {
+      if (wild_match(s, q->extra) || wild_match(q->extra, s)) {
+        if (u != conf.bot->u)
+          putlog(LOG_WARN, "*", "My automatic hostmask '%s' would conflict with user: '%s'. (Not adding)", s, u->handle);
+        return;
+      }
+    }
   }
 
   addhost_by_handle(conf.bot->nick, s);