[cvslog] Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Thu Dec 20 12:53:02 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2001-12-20 18:52:21 UTC
Commited by: Jeff Fisher <guppy at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 doc/tcl-commands.doc src/patch.h
     src/mod/irc.mod/tclirc.c

Log message:

applied a few more changes to some tcl commands to make them take an optional channel argument

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.262 eggdrop1.6/doc/UPDATES1.6:1.263
--- eggdrop1.6/doc/UPDATES1.6:1.262	Thu Dec 20 11:37:19 2001
+++ eggdrop1.6/doc/UPDATES1.6	Thu Dec 20 12:52:10 2001
@@ -1,10 +1,13 @@
-$Id: UPDATES1.6,v 1.262 2001/12/20 17:37:19 guppy Exp $
+$Id: UPDATES1.6,v 1.263 2001/12/20 18:52:10 guppy Exp $
 
 Changes in eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.8
 Found by  Fixed by  What...
+various   guppy     tcl_botisvoice, tcl_botisop, tcl_botonchan, tcl_onchansplit, tcl_isop,
+                    tcl_isvoice, and tcl_handonchan all take channel as an optional argument
+                    now
 Abraham   guppy     tcl_onchan can now be used without a channel to check all the bot's 
                     channels
 various   stdarg/   added tcl_traffic (a modified copy of stdarg's original patch)
Index: eggdrop1.6/doc/tcl-commands.doc
diff -u eggdrop1.6/doc/tcl-commands.doc:1.62 eggdrop1.6/doc/tcl-commands.doc:1.63
--- eggdrop1.6/doc/tcl-commands.doc:1.62	Thu Dec 20 11:37:19 2001
+++ eggdrop1.6/doc/tcl-commands.doc	Thu Dec 20 12:52:10 2001
@@ -477,26 +477,29 @@
   isbotnick <nick>
     returns: "1" if the nick matches the botnick; "0" otherwise
 
-  botisop <channel>
-    returns: "1" if the bot is an op on that channel; "0" otherwise
-
-  botisvoice <channel>
-    returns: "1" if the bot is has a voice on that channel; "0" otherwise
-
-  botonchan <channel>
-   returns: "1" if the bot is on that channel; "0" otherwise
-
-  isop <nickname> <channel>
-    returns: "1" if someone by that nickname is on the channel and has chop;
-      "0" otherwise
+  botisop [channel]
+    returns: "1" if the bot is an op on that channel (or a channel if no
+      channel is specified); "0" otherwise
+
+  botisvoice [channel]
+    returns: "1" if the bot is has a voice on that channel (or a channel if 
+     no channel is specified); "0" otherwise
+
+  botonchan [channel]
+   returns: "1" if the bot is on that channel (or a channel if no channel is
+     specified); "0" otherwise
+
+  isop <nickname> [channel]
+    returns: "1" if someone by that nickname is on the channel (or a channel
+      if no channel name is specified) and has chop; "0" otherwise
 
   wasop <nickname> <channel>
     returns: "1" if someone that just got opped/deopped in the chan had op
       before the modechange; "0" otherwise
 
-  isvoice <nickname> <channel>
-    returns: "1" if someone by that nickname is on the channel and has voice
-      (+v); "0" otherwise
+  isvoice <nickname> [channel]
+    returns: "1" if someone by that nickname is on the channel (or a channel
+      if no channel is specified) and has voice (+v); "0" otherwise
 
   onchan <nickname> [channel]
     returns: "1" if someone by that nickname is on the bot's channel (or 
@@ -508,9 +511,9 @@
     if <nickname> not found, returns ""
     if <nickname> found but unknown, returns "*"
 
-  handonchan <handle> <channel>
-    returns: "1" if the the user at host for someone on the channel matches
-      for the handle given; "0" otherwise
+  handonchan <handle> [channel]
+    returns: "1" if the the user at host for someone on the channel (or a channel
+      if no channel name is specified) matches for the handle given; "0" otherwise
 
   hand2nick <handle> [channel]
     returns: nickname of the first person on the <channel> whose user at host
@@ -565,8 +568,9 @@
   getchanjoin <nickname> <channel>
     returns: timestamp of when that person joined the channel
 
-  onchansplit <nick> <channel>
-    returns: "1" if that nick is split from the channel; "0" otherwise
+  onchansplit <nick> [channel]
+    returns: "1" if that nick is split from the channel (or a channel if no
+      channel is specified); "0" otherwise
 
   chanlist <channel> [flags[&chanflags]]
     flags are any flags that are global flags, the '&' denotes to look for
Index: eggdrop1.6/src/mod/irc.mod/tclirc.c
diff -u eggdrop1.6/src/mod/irc.mod/tclirc.c:1.27 eggdrop1.6/src/mod/irc.mod/tclirc.c:1.28
--- eggdrop1.6/src/mod/irc.mod/tclirc.c:1.27	Thu Dec 20 11:37:20 2001
+++ eggdrop1.6/src/mod/irc.mod/tclirc.c	Thu Dec 20 12:52:11 2001
@@ -1,7 +1,7 @@
 /*
  * tclirc.c -- part of irc.mod
  *
- * $Id: tclirc.c,v 1.27 2001/12/20 17:37:20 guppy Exp $
+ * $Id: tclirc.c,v 1.28 2001/12/20 18:52:11 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -67,18 +67,27 @@
 
 static int tcl_botisop STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
 
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[1], NULL);
-    return TCL_ERROR;
+  BADARGS(1, 2, " ?channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+   
+  while (chan && (thechan == NULL || thechan == chan)) {
+    if (me_op(chan)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  if (me_op(chan))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
 
@@ -101,72 +110,108 @@
 
 static int tcl_botisvoice STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
   memberlist *mx;
 
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[1], NULL);
-    return TCL_ERROR;
+  BADARGS(1, 2, " ?channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+    
+  while (chan && (thechan == NULL || thechan == chan)) {
+    if ((mx = ismember(chan, botname)) && chan_hasvoice(mx)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  if ((mx = ismember(chan, botname)) && chan_hasvoice(mx))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
 
 static int tcl_botonchan STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
 
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[1], NULL);
-    return TCL_ERROR;
+  BADARGS(1, 2, " ?channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+
+  while (chan && (thechan == NULL || thechan == chan)) {
+    if (ismember(chan, botname)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  if (ismember(chan, botname))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL); 
   return TCL_OK;
 }
 
 static int tcl_isop STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
   memberlist *mx;
-
-  BADARGS(3, 3, " nick channel");
-  chan = findchan_by_dname(argv[2]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
+      
+  BADARGS(2, 3, " ?nick channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+  
+  while (chan && (thechan == NULL || thechan == chan)) {
+    if ((mx = ismember(chan, argv[1])) && chan_hasop(mx)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  if ((mx = ismember(chan, argv[1])) && chan_hasop(mx))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
 
 static int tcl_isvoice STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
   memberlist *mx;
 
-  BADARGS(3, 3, " nick channel");
-  chan = findchan_by_dname(argv[2]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
+  BADARGS(2, 3, " ?nick channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+    
+  while (chan && (thechan == NULL || thechan == chan)) {
+    if ((mx = ismember(chan, argv[1])) && chan_hasvoice(mx)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  if ((mx = ismember(chan, argv[1])) && chan_hasvoice(mx))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
 
@@ -195,19 +240,19 @@
 
   BADARGS(2, 3, " nickname ?channel?");
   if (argc > 2) {
-  chan = findchan_by_dname(argv[2]);
+    chan = findchan_by_dname(argv[2]);
     thechan = chan;
-    if (!thechan) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
+    if (!thechan) { 
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
   } else
    chan = chanset;
 
   while (chan && (thechan == NULL || thechan == chan)) {
     if (ismember(chan, argv[1])) {
-    Tcl_AppendResult(irp, "1", NULL);
-  return TCL_OK;
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
     }
     chan = chan->next;
   }
@@ -217,20 +262,28 @@
 
 static int tcl_handonchan STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
   memberlist *m;
 
-  BADARGS(3, 3, " handle channel");
-  chan = findchan_by_dname(argv[2]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    if (m->user && !rfc_casecmp(m->user->handle, argv[1])) {
-      Tcl_AppendResult(irp, "1", NULL);
-      return TCL_OK;
+  BADARGS(2, 3, " handle ?channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
     }
+  } else
+   chan = chanset;
+
+  while (chan && (thechan == NULL || thechan == chan)) {
+    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+      if (m->user && !rfc_casecmp(m->user->handle, argv[1])) {
+	Tcl_AppendResult(irp, "1", NULL);
+	return TCL_OK;
+      }
+    }
+    chan = chan->next;
   }
   Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
@@ -316,19 +369,29 @@
 
 static int tcl_onchansplit STDVAR
 {
-  struct chanset_t *chan;
+  struct chanset_t *chan, *thechan = NULL;
   memberlist *m;
 
-  BADARGS(3, 3, " nickname channel");
-  if (!(chan = findchan_by_dname(argv[2]))) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
+  BADARGS(2, 3, " nickname ?channel?");
+  if (argc > 2) {
+    chan = findchan_by_dname(argv[2]);   
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
+      return TCL_ERROR;
+    }
+  } else
+   chan = chanset;
+  
+  while (chan && (thechan == NULL || thechan == chan)) {
+    m = ismember(chan, argv[1]);
+    if (m && chan_issplit(m)) {
+      Tcl_AppendResult(irp, "1", NULL);
+      return TCL_OK;
+    }
+    chan = chan->next;
   }
-  m = ismember(chan, argv[1]);
-  if (m && chan_issplit(m))
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
+  Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
 
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.639 eggdrop1.6/src/patch.h:1.640
--- eggdrop1.6/src/patch.h:1.639	Thu Dec 20 11:37:19 2001
+++ eggdrop1.6/src/patch.h	Thu Dec 20 12:52:11 2001
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.639 2001/12/20 17:37:19 guppy Exp $
+ * $Id: patch.h,v 1.640 2001/12/20 18:52:11 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1008869718");		/* current unixtime */
+patch("1008874067");		/* current unixtime */
 /*
  *
  *
  */
-patch("onchanfix");
+patch("optionalchannelarg");
 /*
  *
  *
----------------------- End of diff -----------------------



More information about the Changes mailing list