Przeglądaj źródła

* Fixes for +e/I checking on op.

svn: 232
Bryan Drewery 22 lat temu
rodzic
commit
ed26e8d6a7
2 zmienionych plików z 21 dodań i 17 usunięć
  1. 7 1
      src/mod/irc.mod/irc.c
  2. 14 16
      src/mod/irc.mod/mode.c

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

@@ -922,12 +922,15 @@ static int any_ops(struct chanset_t *chan)
  */
 static void reset_chan_info(struct chanset_t *chan)
 {
+  int opped = 0;
   /* Don't reset the channel if we're already resetting it */
   if (channel_inactive(chan)) {
     dprintf(DP_MODE,"PART %s\n", chan->name);
     return;
   }
   if (!channel_pending(chan)) {
+    if (me_op(chan))
+      opped += 1;
     nfree(chan->channel.key);
     chan->channel.key = (char *) channel_malloc(1);
     chan->channel.key[0] = 0;
@@ -939,9 +942,12 @@ static void reset_chan_info(struct chanset_t *chan)
       dprintf(DP_MODE, "MODE %s +b\n", chan->name);
     }
 #ifdef S_IRCNET
-    if (me_op(chan)) {
+    if (opped) {
+/* FIXME: broken +e checking */
+putlog(LOG_DEBUG, "@", "I AM +o in %s, need to send +e", chan->dname);
       if (!(chan->ircnet_status & CHAN_ASKED_EXEMPTS) &&
   	  use_exempts == 1) {
+putlog(LOG_DEBUG, "@", "I AM NOW CHECKING +e for %s", chan->dname);
         chan->ircnet_status |= CHAN_ASKED_EXEMPTS;
         dprintf(DP_MODE, "MODE %s +e\n", chan->name);
       }

+ 14 - 16
src/mod/irc.mod/mode.c

@@ -662,32 +662,30 @@ static void got_ban(struct chanset_t *chan, char *nick, char *from, char *who)
       add_mode(chan, '-', 'b', who);
       return;
     }
-      for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-       egg_snprintf(s1, sizeof s1, "%s!%s", m->nick, m->userhost);
-	if (wild_match(who, s1)) {
-	  u = get_user_by_host(s1);
-	  if (u) {
-	    get_user_flagrec(u, &victim, chan->dname);
-          if (channel_private(chan) && !glob_bot(victim) && !chan_op(victim) && !glob_owner(victim))
-            goto skip;
-          if (((glob_op(victim) && !chan_deop(victim)) ||
-              chan_op(victim)) && !glob_master(user) &&
-              !glob_bot(user) && !chan_master(user) && !isexempted(chan, s1)) {
-                if (target_priority(chan, m, 0))
-		  add_mode(chan, '-', 'b', who);
-                  return;
+    /* remove bans on ops unless a master/bot set it */
+    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+      egg_snprintf(s1, sizeof s1, "%s!%s", m->nick, m->userhost);
+      if (wild_match(who, s1)) {
+        u = get_user_by_host(s1);
+	if (u) {
+	  get_user_flagrec(u, &victim, chan->dname);
+          if (chk_op(victim, chan) && !chan_master(user) && !glob_master(user) && 
+             !glob_bot(user) && !isexempted(chan, s1)) {
+            if (target_priority(chan, m, 0))
+              add_mode(chan, '-', 'b', who);
+            return;
 	  }
 	}
       }
     }
   }
-  skip:;
   refresh_exempt(chan, who);
+  /* This looks for bans added through bot and tacks on banned: if a description is found */
   if (nick[0] && channel_enforcebans(chan)) {
     register maskrec *b;
     int cycle;
     char resn[512]="";
-
+    /* The point of this cycle crap is to first check chan->bans then global_bans */
     for (cycle = 0; cycle < 2; cycle++) {
       for (b = cycle ? chan->bans : global_bans; b; b = b->next) {
 	if (wild_match(b->mask, who)) {