[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Dec 29 14:56:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-12-29 20:55:42 UTC
Commited by: Jeff Fisher <guppy at techmonkeys.org>

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

Log message:

added my optionalchannelarg patch from 1.6 (with the fixes BarkerJr pointed out)

---------------------- diff included ----------------------
Index: eggdrop1.7/doc/UPDATES1.6
diff -u eggdrop1.7/doc/UPDATES1.6:1.180 eggdrop1.7/doc/UPDATES1.6:1.181
--- eggdrop1.7/doc/UPDATES1.6:1.180	Sat Dec 29 14:36:16 2001
+++ eggdrop1.7/doc/UPDATES1.6	Sat Dec 29 14:55:31 2001
@@ -1,10 +1,14 @@
-$Id: UPDATES1.6,v 1.180 2001/12/29 20:36:16 guppy Exp $
+$Id: UPDATES1.6,v 1.181 2001/12/29 20:55:31 guppy Exp $
 
 Changes in eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.8
 Found by  Fixed by  What...
+          BarkerJr  fixed a small bug in guppy's last patch
+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
 Tothwolf  guppy     .servers doesn't trunicate server names anymore
Index: eggdrop1.7/doc/tcl-commands.doc
diff -u eggdrop1.7/doc/tcl-commands.doc:1.63 eggdrop1.7/doc/tcl-commands.doc:1.64
--- eggdrop1.7/doc/tcl-commands.doc:1.63	Sat Dec 29 14:36:16 2001
+++ eggdrop1.7/doc/tcl-commands.doc	Sat Dec 29 14:55:31 2001
@@ -479,26 +479,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 
@@ -510,9 +513,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
@@ -567,8 +570,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.7/modules/irc/tclirc.c
diff -u eggdrop1.7/modules/irc/tclirc.c:1.7 eggdrop1.7/modules/irc/tclirc.c:1.8
--- eggdrop1.7/modules/irc/tclirc.c:1.7	Sat Dec 29 14:36:17 2001
+++ eggdrop1.7/modules/irc/tclirc.c	Sat Dec 29 14:55:31 2001
@@ -1,7 +1,7 @@
 /*
  * tclirc.c -- part of irc.mod
  *
- * $Id: tclirc.c,v 1.7 2001/12/29 20:36:17 guppy Exp $
+ * $Id: tclirc.c,v 1.8 2001/12/29 20:55:31 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 > 1) {
+    chan = findchan_by_dname(argv[1]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[1], 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 > 1) {
+    chan = findchan_by_dname(argv[1]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[1], 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 > 1) {
+    chan = findchan_by_dname(argv[1]);
+    thechan = chan;
+    if (!thechan) {
+      Tcl_AppendResult(irp, "illegal channel: ", argv[1], 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;
 }
 
@@ -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 && !irccmp(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.7/src/patch.h
diff -u eggdrop1.7/src/patch.h:1.565 eggdrop1.7/src/patch.h:1.566
--- eggdrop1.7/src/patch.h:1.565	Sat Dec 29 14:36:17 2001
+++ eggdrop1.7/src/patch.h	Sat Dec 29 14:55:31 2001
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.565 2001/12/29 20:36:17 guppy Exp $
+ * $Id: patch.h,v 1.566 2001/12/29 20:55:31 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,17 +41,17 @@
  *
  *
  */
-patch("1009657939");		/* current unixtime */
+patch("1009659053");		/* current unixtime */
 /*
  *
  *
  */
-patch("onchanfix");
+patch("optionalchannelarg2");
 /*
  *
  *
  */
-patch("onchanfix");
+patch("optionalchannelarg2");
 /*
  *
  *
----------------------- End of diff -----------------------



More information about the Changes mailing list