[eggheads-patches] PATCH: helpall.patch

Fabian Knittel fknittel at gmx.de
Fri Oct 8 22:43:00 CST 1999


[ helpall.patch ]

Calls to '.help *' are now converted to '.help all', which
is more sensible and stops flooding partyline users.

Other variants, like .help **, .help *?*? are also converted.


On  5 Okt, Fabian Knittel wrote:
> On Fri, Oct 01, 1999 at 09:21:06PM +0200, Per/dw wrote:
>> if you .help *
>> be prapared to kill the bot and some very nice
>> never ending flood....
>> 
>> Found by     Fixed by
>> ranjha        ???
>> 
>> (in the current cvs and RC1)
> 
> If I do .help * it just lists all help entries... maybe you just think
> it's never ending because the list is so long?
> 
> Maybe we should someone block ".help *" calls.. and automatically make
> that a ".help all" call. Only e.g. ".help d*" would be accepted as a
> valid search pattern. Any thoughts?

Don't let my english teacher see that english... gosh..

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Sat Oct  9 01:51:59 1999
+++ eggdrop1.3/doc/UPDATES1.3	Sat Oct  9 01:47:48 1999
@@ -4,6 +4,7 @@
 
 1.3.29
 Foundby   Fixedby   What....
+ranjha	  Fabian    .help * is now converted to .help all
 Ben	  Fabian    .su doesn't expect a pwd for the target user anymore, if
 		    called as an owner
           dw        kicks weren't being logged
diff -urN eggdrop1.3~/src/cmds.c eggdrop1.3/src/cmds.c
--- eggdrop1.3~/src/cmds.c	Sat Oct  9 01:51:59 1999
+++ eggdrop1.3/src/cmds.c	Sat Oct  9 01:51:55 1999
@@ -410,18 +410,25 @@
 
 static void cmd_help(struct userrec *u, int idx, char *par)
 {
-  struct flag_record fr =
-  {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
 
   get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
-  rmspace(par);			/* maintain some sanity */
   if (par[0]) {
     putlog(LOG_CMDS, "*", "#%s# help %s", dcc[idx].nick, par);
     if (!strcmp(par, "all"))
       tellallhelp(idx, "all", &fr);
-    else if (strchr(par, '*') || strchr(par, '?'))
-      tellwildhelp(idx, par, &fr);
-    else
+    else if (strchr(par, '*') || strchr(par, '?')) {
+      char *p = par;
+
+      /* Check if the search pattern only consists of '*' and/or '?'
+       * If it does, show help for "all" instead of listing all help
+       * entries. */
+      for (p = par; *p && ((*p == '*') || (*p == '?')); p++);
+      if (*p)
+        tellwildhelp(idx, par, &fr);
+      else
+	tellallhelp(idx, "all", &fr);
+    } else
       tellhelp(idx, par, &fr, 0);
   } else {
     putlog(LOG_CMDS, "*", "#%s# help", dcc[idx].nick);


More information about the Patches mailing list