[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Dec 8 13:18:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-12-08 19:17:54 UTC
Commited by: Federico Mennite <ite at techmonkeys.org>

Modified files:
     lib/eggdrop/modvals.h modules/irc/chan.c modules/irc/cmdsirc.c
     modules/irc/irc.c modules/irc/irc.h modules/irc/msgcmds.c
     src/cmds.c src/misc.c

Log message:

Added a missing channel membercheck in a few commands. Patch by Axel Franke <eule at berlin.snafu.de>

---------------------- diff included ----------------------
Index: eggdrop1.7/lib/eggdrop/modvals.h
diff -u eggdrop1.7/lib/eggdrop/modvals.h:1.1 eggdrop1.7/lib/eggdrop/modvals.h:1.2
--- eggdrop1.7/lib/eggdrop/modvals.h:1.1	Sat Oct 27 11:34:47 2001
+++ eggdrop1.7/lib/eggdrop/modvals.h	Sat Dec  8 13:17:43 2001
@@ -1,7 +1,7 @@
 /*
  * modvals.h
  *
- * $Id: modvals.h,v 1.1 2001/10/27 16:34:47 ite Exp $
+ * $Id: modvals.h,v 1.2 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -79,6 +79,7 @@
 #define IRC_RECHECK_CHANNEL_MODES 6
 #define IRC_DO_CHANNEL_PART	  7
 #define IRC_CHECK_THIS_BAN	  8
+#define IRC_CHECK_THIS_USER	  9
 /* Notes */
 #define NOTES_CMD_NOTE		  4
 /* Console */
Index: eggdrop1.7/modules/irc/chan.c
diff -u eggdrop1.7/modules/irc/chan.c:1.3 eggdrop1.7/modules/irc/chan.c:1.4
--- eggdrop1.7/modules/irc/chan.c:1.3	Sat Dec  1 11:35:06 2001
+++ eggdrop1.7/modules/irc/chan.c	Sat Dec  8 13:17:43 2001
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.3 2001/12/01 17:35:06 ite Exp $
+ * $Id: chan.c,v 1.4 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -685,12 +685,109 @@
   }
 }
 
+static void check_this_member(struct chanset_t *chan, char *nick, struct flag_record *fr)
+{
+  memberlist *m;
+  char s[UHOSTLEN], *p;
+
+  m = ismember(chan, nick);
+  if (!m || match_my_nick(nick))
+    return;
+
+  sprintf(s, "%s!%s", m->nick, m->userhost);
+  /* if channel user is current a chanop */
+  if (chan_hasop(m)) {
+  /* if user is channel deop */
+    if (chan_deop(*fr) ||
+	/* OR global deop and NOT channel op */
+	(glob_deop(*fr) && !chan_op(*fr))) {
+      /* de-op! */
+      add_mode(chan, '-', 'o', m->nick);
+      /* if channel mode is bitch */
+    } else if (channel_bitch(chan) &&
+	       /* AND the user isnt a channel op */
+	       (!chan_op(*fr) &&
+		/* AND the user isnt a global op, (or IS a chan deop) */
+		!(glob_op(*fr) && !chan_deop(*fr)))) {
+      /* de-op! mmmbop! */
+      add_mode(chan, '-', 'o', m->nick);
+    }
+  }
+  /* check vs invites */
+  if (use_invites &&
+      (u_match_mask(global_invites,s) ||
+       u_match_mask(chan->invites, s)))
+    refresh_invite(chan, s);
+  /* don't kickban if permanent exempted */
+  if (!(use_exempts &&
+	(u_match_mask(global_exempts,s) ||
+	 u_match_mask(chan->exempts, s)))) {
+    /* if match a ban */
+    if (u_match_mask(global_bans, s) ||
+        u_match_mask(chan->bans, s)) {
+      /* bewm */
+      refresh_ban_kick(chan, s, m->nick);
+      /* ^ will use the ban comment */
+    }
+    /* are they +k ? */
+    if (chan_kick(*fr) || glob_kick(*fr)) {
+      check_exemptlist(chan, s);
+      quickban(chan, m->userhost);
+      p = get_user(&USERENTRY_COMMENT, m->user);
+      dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
+	      p ? p : _("...and thank you for playing."));
+      m->flags |= SENTKICK;
+    }
+  }
+  /* now lets look at de-op'd ppl */
+  if (!chan_hasop(m) &&
+      /* if they're an op, channel or global (without channel +d) */
+      (chan_op(*fr) || (glob_op(*fr) && !chan_deop(*fr))) &&
+      /* and the channel is op on join, or they are auto-opped */
+      (channel_autoop(chan) || (glob_autoop(*fr) || chan_autoop(*fr)))) {
+    /* op them! */
+    add_mode(chan, '+', 'o', m->nick);
+    /* otherwise, lets check +v stuff if the llamas want it */
+  } else if (!chan_hasvoice(m) && !chan_hasop(m)) {
+    if ((channel_autovoice(chan) && !chan_quiet(*fr) &&
+	 (chan_voice(*fr) || glob_voice(*fr))) ||
+	  (!chan_quiet(*fr) && (glob_gvoice(*fr) || chan_gvoice(*fr)))) {
+      add_mode(chan, '+', 'v', m->nick);
+    }
+    /* do they have a voice on the channel */
+    if (chan_hasvoice(m) &&
+	/* do they have the +q & no +v */
+	(chan_quiet(*fr) || (glob_quiet(*fr) && !chan_voice(*fr)))) {
+      add_mode(chan, '-', 'v', m->nick);
+    }
+  }
+}
+
+static void check_this_user(char *hand)
+{
+  char s[UHOSTLEN];
+  memberlist *m;
+  struct userrec *u;
+  struct chanset_t *chan;
+  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+
+  for (chan = chanset; chan; chan = chan->next)
+    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+      sprintf(s, "%s!%s", m->nick, m->userhost);
+      u = m->user ? m->user : get_user_by_host(s);
+      if (u && !strcasecmp(u->handle, hand)) {
+	get_user_flagrec(u, &fr, chan->dname);
+	check_this_member(chan, m->nick, &fr);
+      }
+    }
+}
+
 /* Things to do when i just became a chanop:
  */
 static void recheck_channel(struct chanset_t *chan, int dobans)
 {
   memberlist *m;
-  char s[UHOSTLEN], *p;
+  char s[UHOSTLEN];
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   static int stacking = 0;
   int stop_reset = 0;
@@ -703,80 +800,10 @@
   /* Okay, sort through who needs to be deopped. */
   for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 
     sprintf(s, "%s!%s", m->nick, m->userhost);
-    if (!m->user)
-      m->user = get_user_by_host(s);
-    get_user_flagrec(m->user, &fr, chan->dname);
-    /* ignore myself */
-    if (!match_my_nick(m->nick)) {
-      /* if channel user is current a chanop */
-      if (chan_hasop(m)) {
-	if (glob_bot(fr))
-	  stop_reset = 1;
-	/* if user is channel deop */
-	if (chan_deop(fr) ||
-	/* OR global deop and NOT channel op */
-	    (glob_deop(fr) && !chan_op(fr))) {
-	  /* de-op! */
-	  add_mode(chan, '-', 'o', m->nick);
-	/* if channel mode is bitch */
-	} else if (channel_bitch(chan) &&
-	  /* AND the user isnt a channel op */
-		   (!chan_op(fr) &&
-	  /* AND the user isnt a global op, (or IS a chan deop) */
-		   !(glob_op(fr) && !chan_deop(fr)))) {
-	  /* de-op! mmmbop! */
-	  add_mode(chan, '-', 'o', m->nick);
-	}
-      }
-      /* check vs invites */
-      if (use_invites &&
-	  (u_match_mask(global_invites,s) ||
-	   u_match_mask(chan->invites, s)))
-	refresh_invite(chan, s);
-      /* don't kickban if permanent exempted */
-      if (!(use_exempts &&
-	    (u_match_mask(global_exempts,s) ||
-	     u_match_mask(chan->exempts, s)))) {
-        /* if match a ban */
-        if (u_match_mask(global_bans, s) ||
-            u_match_mask(chan->bans, s)) {
-	  /* bewm */
-	  refresh_ban_kick(chan, s, m->nick);
-	/* ^ will use the ban comment */
-	}
-	/* are they +k ? */
-	if (chan_kick(fr) || glob_kick(fr)) {
-	  check_exemptlist(chan, s);
-	  quickban(chan, m->userhost);
-	  p = get_user(&USERENTRY_COMMENT, m->user);
-	  dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
-		  p ? p : _("...and thank you for playing."));
-	  m->flags |= SENTKICK;
-	}
-      }
-      /* now lets look at de-op'd ppl */
-      if (!chan_hasop(m) &&
-	  /* if they're an op, channel or global (without channel +d) */
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))) &&
-	  /* and the channel is op on join, or they are auto-opped */
-	  (channel_autoop(chan) || (glob_autoop(fr) || chan_autoop(fr)))) {
-	/* op them! */
-	add_mode(chan, '+', 'o', m->nick);
-	  /* otherwise, lets check +v stuff if the llamas want it */
-      } else if (!chan_hasvoice(m) && !chan_hasop(m)) {
-	if ((channel_autovoice(chan) && !chan_quiet(fr) &&
-	     (chan_voice(fr) || glob_voice(fr))) ||
-	    (!chan_quiet(fr) && (glob_gvoice(fr) || chan_gvoice(fr)))) {
-	  add_mode(chan, '+', 'v', m->nick);
-	}
-	/* do they have a voice on the channel */
-	if (chan_hasvoice(m) &&
-	    /* do they have the +q & no +v */
-	    (chan_quiet(fr) || (glob_quiet(fr) && !chan_voice(fr)))) {
-	  add_mode(chan, '-', 'v', m->nick);
-	}
-      }
-    }
+    get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr, chan->dname);
+    if (glob_bot(fr) && chan_hasop(m) && !match_my_nick(m->nick))
+	stop_reset = 1;
+    check_this_member(chan, m->nick, &fr);
   }
   if (dobans) {
     if (channel_nouserbans(chan) && !stop_reset)
Index: eggdrop1.7/modules/irc/cmdsirc.c
diff -u eggdrop1.7/modules/irc/cmdsirc.c:1.1 eggdrop1.7/modules/irc/cmdsirc.c:1.2
--- eggdrop1.7/modules/irc/cmdsirc.c:1.1	Sat Oct 27 11:34:50 2001
+++ eggdrop1.7/modules/irc/cmdsirc.c	Sat Dec  8 13:17:43 2001
@@ -2,7 +2,7 @@
  * chancmds.c -- part of irc.mod
  *   handles commands direclty relating to channel interaction
  *
- * $Id: cmdsirc.c,v 1.1 2001/10/27 16:34:50 ite Exp $
+ * $Id: cmdsirc.c,v 1.2 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -868,9 +868,7 @@
     dprintf(idx, "Added hostmask %s to %s.\n", p1, u->handle);
     addhost_by_handle(hand, p1);
     get_user_flagrec(u, &user, chan->dname);
-    if ((chan_op(user) || (glob_op(user) && !chan_deop(user))) &&
-	(channel_autoop(chan) || glob_autoop(user) || chan_autoop(user)))
-      add_mode(chan, '+', 'o', m->nick);
+    check_this_user(hand);
   }
   putlog(LOG_CMDS, "*", "#%s# adduser %s %s", dcc[idx].nick, nick,
 	 hand == nick ? "" : hand);
Index: eggdrop1.7/modules/irc/irc.c
diff -u eggdrop1.7/modules/irc/irc.c:1.1 eggdrop1.7/modules/irc/irc.c:1.2
--- eggdrop1.7/modules/irc/irc.c:1.1	Sat Oct 27 11:34:50 2001
+++ eggdrop1.7/modules/irc/irc.c	Sat Dec  8 13:17:43 2001
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.1 2001/10/27 16:34:50 ite Exp $
+ * $Id: irc.c,v 1.2 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -985,7 +985,8 @@
   (Function) recheck_channel_modes,
   (Function) do_channel_part,
   /* 8 - 11 */
-  (Function) check_this_ban
+  (Function) check_this_ban,
+  (Function) check_this_user,
 };
 
 char *start(Function * global_funcs)
Index: eggdrop1.7/modules/irc/irc.h
diff -u eggdrop1.7/modules/irc/irc.h:1.1 eggdrop1.7/modules/irc/irc.h:1.2
--- eggdrop1.7/modules/irc/irc.h:1.1	Sat Oct 27 11:34:50 2001
+++ eggdrop1.7/modules/irc/irc.h	Sat Dec  8 13:17:43 2001
@@ -1,7 +1,7 @@
 /*
  * irc.h -- part of irc.mod
  *
- * $Id: irc.h,v 1.1 2001/10/27 16:34:50 ite Exp $
+ * $Id: irc.h,v 1.2 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -94,6 +94,7 @@
 
 /* 8-11 */
 #define check_this_ban ((void(*)(struct chanset_t *,char *,int))irc_funcs[8])
+#define check_this_user ((void(*)(char *hand))irc_funcs[8])
 
 #endif				/* MAKING_IRC */
 
Index: eggdrop1.7/modules/irc/msgcmds.c
diff -u eggdrop1.7/modules/irc/msgcmds.c:1.1 eggdrop1.7/modules/irc/msgcmds.c:1.2
--- eggdrop1.7/modules/irc/msgcmds.c:1.1	Sat Oct 27 11:34:50 2001
+++ eggdrop1.7/modules/irc/msgcmds.c	Sat Dec  8 13:17:43 2001
@@ -2,7 +2,7 @@
  * msgcmds.c -- part of irc.mod
  *   all commands entered via /MSG
  *
- * $Id: msgcmds.c,v 1.1 2001/10/27 16:34:50 ite Exp $
+ * $Id: msgcmds.c,v 1.2 2001/12/08 19:17:43 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -171,7 +171,6 @@
 {
   char s[UHOSTLEN], s1[UHOSTLEN], *pass, who[NICKLEN];
   struct userrec *u2;
-  memberlist *mx;
 
   if (match_my_nick(nick))
     return 1;
@@ -212,28 +211,12 @@
 	dprintf(DP_HELP, _("NOTICE %s :Youre not %s, youre %s.\n"), nick, who, u->handle);
       return 1;
     } else {
-      struct chanset_t *chan;
-      struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
       putlog(LOG_CMDS, "*", "(%s!%s) !*! IDENT %s", nick, host, who);
       snprintf(s, sizeof s, "%s!%s", nick, host);
       maskhost(s, s1);
       dprintf(DP_HELP, "NOTICE %s :%s: %s\n", nick, _("Added hostmask"), s1);
       addhost_by_handle(who, s1);
-      for (chan = chanset; chan; chan = chan->next) {
-	get_user_flagrec(u2, &fr, chan->dname);
-	/* Is the channel or the user marked auto-op? */
-	if ((channel_autoop(chan) || glob_autoop(fr) || chan_autoop(fr)) &&
-           (mx = ismember(chan, nick)) &&
-	   /* ... and isn't the user chanop already? */
-	   !chan_hasop(mx) && !chan_sentop(mx) &&
-	   /* ... and are they actually validly +o? */
-	   !chan_sentop(mx) && (chan_op(fr) || (glob_op(fr) &&
-	   !chan_deop(fr)))) {
-	  add_mode(chan, '+', 'o', nick);
-          mx->flags |= SENTOP;
-        }
-      }
+      check_this_user(who);
       return 1;
     }
   }
@@ -273,6 +256,7 @@
       putlog(LOG_CMDS, "*", "(%s!%s) !*! ADDHOST %s", nick, host, par);
       dprintf(DP_HELP, "NOTICE %s :%s: %s\n", nick, _("Added hostmask"), par);
       addhost_by_handle(u->handle, par);
+      check_this_user(u->handle);
       return 1;
     }
   }
Index: eggdrop1.7/src/cmds.c
diff -u eggdrop1.7/src/cmds.c:1.78 eggdrop1.7/src/cmds.c:1.79
--- eggdrop1.7/src/cmds.c:1.78	Sat Dec  8 09:59:26 2001
+++ eggdrop1.7/src/cmds.c	Sat Dec  8 13:17:44 2001
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.78 2001/12/08 15:59:26 ite Exp $
+ * $Id: cmds.c,v 1.79 2001/12/08 19:17:44 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1611,12 +1611,11 @@
 	      chan->dname, work);
     else
       dprintf(idx, "No flags for %s on %s.\n", hand, chan->dname);
-    if (chg && (me = module_find("irc", 0, 0))) {
-      Function *func = me->funcs;
-
-      if (chan)
-	(func[IRC_RECHECK_CHANNEL]) (chan, 0);
-    }
+  }
+  if (chg && (me = module_find("irc", 0, 0))) {
+    Function *func = me->funcs;
+    
+    (func[IRC_CHECK_THIS_USER]) (hand);
   }
   if (tmpchg)
     free(tmpchg);
@@ -2471,6 +2470,7 @@
   struct userrec *u2;
   struct list_type *q;
   struct flag_record fr = {FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  module_entry *me;
 
   if (!par[0]) {
     dprintf(idx, "Usage: +host [handle] <newhostmask>\n");
@@ -2527,6 +2527,11 @@
   putlog(LOG_CMDS, "*", "#%s# +host %s %s", dcc[idx].nick, handle, host);
   addhost_by_handle(handle, host);
   dprintf(idx, "Added '%s' to %s\n", host, handle);
+  if ((me = module_find("irc", 0, 0))) {
+    Function *func = me->funcs;
+
+    (func[IRC_CHECK_THIS_USER]) (handle);
+  }
 }
 
 static void cmd_mns_host(struct userrec *u, int idx, char *par)
Index: eggdrop1.7/src/misc.c
diff -u eggdrop1.7/src/misc.c:1.53 eggdrop1.7/src/misc.c:1.54
--- eggdrop1.7/src/misc.c:1.53	Sat Dec  8 10:16:39 2001
+++ eggdrop1.7/src/misc.c	Sat Dec  8 13:17:44 2001
@@ -6,7 +6,7 @@
  *   help system
  *   motd display and %var substitution
  *
- * $Id: misc.c,v 1.53 2001/12/08 16:16:39 ite Exp $
+ * $Id: misc.c,v 1.54 2001/12/08 19:17:44 ite Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -638,7 +638,7 @@
     case 'A':
       towrite = admin;
       break;
-    case 'n';
+    case 'n':
       towrite = network;
       break;
     case 'T':
----------------------- End of diff -----------------------



More information about the Changes mailing list