فهرست منبع

* Port [3502] to 1.2.14
* Fix assuming exempts/invites are always available
* Fix undernet WHOX parsing (also grab IP now)
* Fixed bots having problems with kick/bans on undernet.



svn: 3503

Bryan Drewery 19 سال پیش
والد
کامیت
d1be0c5a47
7فایلهای تغییر یافته به همراه22 افزوده شده و 51 حذف شده
  1. 1 0
      doc/UPDATES
  2. 2 2
      src/misc.c
  3. 0 32
      src/mod/channels.mod/cmdschan.c
  4. 14 11
      src/mod/irc.mod/chan.c
  5. 1 2
      src/mod/irc.mod/cmdsirc.c
  6. 2 2
      src/mod/irc.mod/irc.c
  7. 2 2
      src/mod/server.mod/servmsg.c

+ 1 - 0
doc/UPDATES

@@ -55,6 +55,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Bad uname EMAILS now include the localhub's nick. (fixes #354)
 * -host now accepts partial host masks, ie, '-host user@host'.
 * Rewrote cmd_mdop into cmd_mmode. See 'help mmode' on a leaf bot.
+* Fixed bots having problems with kick/bans on undernet.
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 2 - 2
src/misc.c

@@ -40,8 +40,8 @@
 #include <signal.h>
 
 int		server_lag = 0;	/* GUESS! */
-bool		use_invites = 1;            /* Jason/drummer */
-bool		use_exempts = 1;            /* Jason/drummer */
+bool		use_invites = 0;
+bool		use_exempts = 0;
 
 /*
  *    Misc functions

+ 0 - 32
src/mod/channels.mod/cmdschan.c

@@ -158,19 +158,11 @@ static void cmd_pls_ban(int idx, char *par)
 
 static void cmd_pls_exempt(int idx, char *par)
 { 
-  if (!use_exempts) {
-    dprintf(idx, "This command can only be used with use-exempts enabled.\n");
-    return;
-  }
   cmd_pls_mask('e', idx, par);
 }
 
 static void cmd_pls_invite(int idx, char *par)
 {
-  if (!use_invites) {
-    dprintf(idx, "This command can only be used with use-invites enabled.\n");
-    return;
-  }
   cmd_pls_mask('I', idx, par);
 }
 
@@ -295,19 +287,11 @@ static void cmd_mns_ban(int idx, char *par)
 
 static void cmd_mns_exempt(int idx, char *par)
 {
-  if (!use_exempts) {
-    dprintf(idx, "This command can only be used with use-exempts enabled.\n");
-    return;
-  }
   cmd_mns_mask('e', idx, par);
 }
 
 static void cmd_mns_invite(int idx, char *par)
 {
-  if (!use_invites) {
-    dprintf(idx, "This command can only be used with use-invites enabled.\n");
-    return;
-  }
   cmd_mns_mask('I', idx, par);
 }
 
@@ -334,19 +318,11 @@ static void cmd_bans(int idx, char *par)
 
 static void cmd_exempts(int idx, char *par)
 {
-  if (!use_exempts) {
-    dprintf(idx, "This command can only be used with use-exempts enabled.\n");
-    return;
-  }
   cmd_masks('e', idx, par);
 }
 
 static void cmd_invites(int idx, char *par)
 {
-  if (!use_invites) {
-    dprintf(idx, "This command can only be used with use-invites enabled.\n");
-    return;
-  }
   cmd_masks('I', idx, par);
 }
 
@@ -672,17 +648,9 @@ static void cmd_stick_yn(int idx, char *par, int yn)
   }
   /* Now deal with exemptions */
   if (!egg_strcasecmp(stick_type, "exempt")) {
-    if (!use_exempts) {
-      dprintf(idx, "This command can only be used with use-exempts enabled.\n");
-      return;
-    }
     type = 'e';
     str_type = "exempt";
   } else if (!egg_strcasecmp(stick_type, "invite")) {
-    if (!use_invites) {
-      dprintf(idx, "This command can only be used with use-invites enabled.\n");
-      return;
-    }
     type = 'I';
     str_type = "invite";
   } else if (!egg_strcasecmp(stick_type, "ban")) {

+ 14 - 11
src/mod/irc.mod/chan.c

@@ -1577,7 +1577,6 @@ static int got324(char *from, char *msg)
   return 0;
 }
 
-
 static void memberlist_reposition(struct chanset_t *chan, memberlist *target) {
   /* Move target from it's current position to it's correct sorted position */
   memberlist *old = NULL, *m = NULL;
@@ -1615,7 +1614,7 @@ static void memberlist_reposition(struct chanset_t *chan, memberlist *target) {
 }
 
 
-static int got352or4(struct chanset_t *chan, char *user, char *host, char *nick, char *flags, int hops)
+static int got352or4(struct chanset_t *chan, char *user, char *host, char *nick, char *flags, int hops, char* realname, char* ip)
 {
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0 };
   char userhost[UHOSTLEN] = "";
@@ -1672,7 +1671,8 @@ static int got352or4(struct chanset_t *chan, char *user, char *host, char *nick,
   if (!m->userhost[0])
     simple_snprintf(m->userhost, sizeof(m->userhost), "%s@%s", user, host);
 
-  simple_snprintf(userhost, sizeof(userhost), "%s!%s", nick, m->userhost);
+  if (!m->userip[0] && ip)
+    simple_snprintf(m->userip, sizeof(m->userip), "%s@%s", user, ip);
 
   if (me) {			/* Is it me? */
 //    strcpy(botuserhost, m->userhost);		/* Yes, save my own userhost */
@@ -1690,7 +1690,7 @@ static int got352or4(struct chanset_t *chan, char *user, char *host, char *nick,
   }
 
   //userhost failed, let's try resolving them...
-  if (!m->user && doresolv(chan)) {
+  if (!m->user && !ip && doresolv(chan)) { /* !ip.. already checked for user earlier if set */
     if (is_dotted_ip(host))
       simple_snprintf(m->userip, sizeof(m->userip), "%s@%s", user, host);
     else  
@@ -1745,7 +1745,7 @@ static int got352(char *from, char *msg)
   chname = newsplit(&msg);	/* Grab the channel */
   chan = findchan(chname);	/* See if I'm on channel */
   if (chan) {			/* Am I? */
-    char *nick = NULL, *user = NULL, *host = NULL, *flags = NULL, *hops = NULL;
+    char *nick = NULL, *user = NULL, *host = NULL, *flags = NULL, *hops = NULL, *realname = NULL;
 
     user = newsplit(&msg);	/* Grab the user */
     host = newsplit(&msg);	/* Grab the host */
@@ -1753,8 +1753,9 @@ static int got352(char *from, char *msg)
     nick = newsplit(&msg);	/* Grab the nick */
     flags = newsplit(&msg);	/* Grab the flags */
     hops = newsplit(&msg);	/* grab server hops */
-    hops++;
-    got352or4(chan, user, host, nick, flags, atoi(hops));
+    ++hops;			/* Skip the : */
+    realname = newsplit(&msg);	/* realname/gecos */
+    got352or4(chan, user, host, nick, flags, atoi(hops), realname, NULL);
   }
   return 0;
 }
@@ -1770,15 +1771,17 @@ static int got354(char *from, char *msg)
       struct chanset_t *chan = findchan(chname);	/* See if I'm on channel */
 
       if (chan) {		/* Am I? */
-        char *nick = NULL, *user = NULL, *host = NULL, *flags = NULL, *hops = NULL;
+        char *nick = NULL, *user = NULL, *host = NULL, *flags = NULL, *hops = NULL, *realname = NULL, *ip = NULL;
 
 	user = newsplit(&msg);	/* Grab the user */
+        ip = newsplit(&msg);    /** Get the numeric IP :) */
 	host = newsplit(&msg);	/* Grab the host */
 	nick = newsplit(&msg);	/* Grab the nick */
 	flags = newsplit(&msg);	/* Grab the flags */
-        hops = newsplit(&msg);  /* yay for hops, does iru even have hops?? */
-        hops++;
-	got352or4(chan, user, host, nick, flags, atoi(hops));
+        hops = newsplit(&msg);  /* server hops */
+        ++hops;			/* Skip the : */
+        realname = newsplit(&msg); /* realname/gecos */
+	got352or4(chan, user, host, nick, flags, atoi(hops), realname, ip);
       }
     }
   }

+ 1 - 2
src/mod/irc.mod/cmdsirc.c

@@ -261,8 +261,7 @@ static void cmd_kickban(int idx, char *par)
       dprintf(idx, "%s is another channel bot!\n", nick);
       return;
     }
-    if (use_exempts && (u_match_mask(global_exempts,s) ||
-        u_match_mask(chan->exempts, s))) {
+    if (u_match_mask(global_exempts,s) || u_match_mask(chan->exempts, s)) {
       dprintf(idx, "%s is permanently exempted!\n", nick);
       return;
     }

+ 2 - 2
src/mod/irc.mod/irc.c

@@ -1224,8 +1224,8 @@ reset_chan_info(struct chanset_t *chan)
     }
     /* These 2 need to get out asap, so into the mode queue */
     dprintf(DP_MODE, "MODE %s\n", chan->name);
-    if (use_354)
-      dprintf(DP_MODE, "WHO %s %%c%%h%%n%%u%%f\n", chan->name);
+    if (use_354) /* Added benefit of getting numeric IP! :) */
+      dprintf(DP_MODE, "WHO %s %%c%%h%%n%%u%%f%%r%%d%%i\n", chan->name);
     else
       dprintf(DP_MODE, "WHO %s\n", chan->name);
     /* clear_channel nuked the data...so */

+ 2 - 2
src/mod/server.mod/servmsg.c

@@ -1230,10 +1230,10 @@ hide_chans(const char *nick, struct userrec *u, char *_channels, bool publicOnly
         
         (!publicOnly && (
           getnick(u->handle, chan) || 
-          !(chan->channel.mode & (CHANPRIV|CHANSEC)) || 
+          !(channel_hidden(chan)) || 
           chk_op(fr, chan)
         )) ||
-        (publicOnly && !(chan->channel.mode & (CHANPRIV|CHANSEC)))
+        (publicOnly && !(channel_hidden(chan)))
        ) {
       if (chans[0])
         simple_snprintf(chans, len, "%s %s%s", chans, s, chname);