[eggheads-patches] PATCH: botrec2.patch

Peter 'Rattacresh' Backes rtc at rhrk.uni-kl.de
Wed Oct 6 14:40:30 CST 1999


Same as botrec.patch but with auto+b'ing code commented out.
I repeat, this patch doesn't intruduce possibilities which didn't 
exist before (at least via workaround). Therefore, there shouldn't be 
problems that weren't already in older versions.
This patch tries its best to avoid user records without +b and the 
bots nick but it doesn't enforce them now (you can still manually 
edit the user file and remove the flag). You also can now rename any 
bot record to the bots own nick IF THE BOT IS CURRENTLY NOT 
CONNECTED. This was possible before via .whois <somebot>, .-bot 
<somebot> .+bot <botnetnick>, (set botnetnick to any flags somebot 
had).
This also should **avoid** sharing probs as you can't .+user 
<botnetnick> anymore...


-- Peter 'Rattacresh' Backes, rtc at rhrk.uni-kl.de

-------------- next part --------------
diff -urN eggdrop1.3.29/doc/UPDATES1.3 eggdrop1.3.29+botrec2/doc/UPDATES1.3
--- eggdrop1.3.29/doc/UPDATES1.3	Wed Oct  6 18:21:36 1999
+++ eggdrop1.3.29+botrec2/doc/UPDATES1.3	Wed Oct  6 18:20:36 1999
@@ -4,6 +4,9 @@
 
 1.3.29
 Foundby   Fixedby   What....
+          rtc       .chnick can now rename any +b to the bots nick if
+                    currently not connected, fixed .+user to not allow to
+                    create user accounts with the bots name.
 	  arthur2   duplicate entries removed from core.english.lang.
 Beige	  Fabian    killsock() could accidently free unused socket entries
           Tothwolf/ fixed way we get version number for Tcl_PkgProvide()
diff -urN eggdrop1.3.29/src/cmds.c eggdrop1.3.29+botrec2/src/cmds.c
--- eggdrop1.3.29/src/cmds.c	Wed Oct  6 18:21:36 1999
+++ eggdrop1.3.29+botrec2/src/cmds.c	Wed Oct  6 18:19:07 1999
@@ -801,8 +801,6 @@
   else if (get_user_by_handle(userlist, newhand) &&
           strcasecmp(hand, newhand))
     dprintf(idx, "Somebody is already using %s.\n", newhand);
-  else if (!strcasecmp(newhand, botnetnick))
-    dprintf(idx, "Hey! That's MY name!\n");
   else {
     u2 = get_user_by_handle(userlist, hand);
     atr2 = u2 ? u2->flags : 0;
@@ -816,6 +814,9 @@
       dprintf(idx, "Can't change the bot owner's handle.\n");
     else if (isowner(hand) && strcasecmp(dcc[idx].nick, hand))
       dprintf(idx, "Can't change the permanent bot owner's handle.\n");
+    else if (!strcasecmp(newhand, botnetnick) && (!(atr2 & USER_BOT) ||
+             nextbot(hand) != -1))
+      dprintf(idx, "Hey! That's MY name!\n");
     else if (change_handle(u2, newhand)) {
       putlog(LOG_CMDS, "*", "#%s# chnick %s %s", dcc[idx].nick,
             hand, newhand);
@@ -2264,11 +2265,13 @@
   host = newsplit(&par);
   if (strlen(handle) > HANDLEN)
     handle[HANDLEN] = 0;	/* max len = XX */
-  if (get_user_by_handle(userlist, handle)) {
+  if (get_user_by_handle(userlist, handle))
     dprintf(idx, "Someone already exists by that name.\n");
-  } else if (strchr(BADNICKCHARS, handle[0]) != NULL) {
+  else if (strchr(BADNICKCHARS, handle[0]) != NULL)
     dprintf(idx, "You can't start a nick with '%c'.\n", handle[0]);
-  } else {
+  else if (!strcasecmp(handle, botnetnick))
+    dprintf(idx, "Hey! That's MY name!\n");
+  else {
     putlog(LOG_CMDS, "*", "#%s# +user %s %s", dcc[idx].nick, handle, host);
     userlist = adduser(userlist, handle, host, "-", 0);
     dprintf(idx, "Added %s (%s) with no password or flags.\n", handle, host);
diff -urN eggdrop1.3.29/src/users.c eggdrop1.3.29+botrec2/src/users.c
--- eggdrop1.3.29/src/users.c	Wed Oct  6 18:21:36 1999
+++ eggdrop1.3.29+botrec2/src/users.c	Wed Oct  6 18:21:09 1999
@@ -1008,6 +1008,11 @@
   for (u = bu; u; u = u->next) {
     struct user_entry *e;
 
+    if (!(u->flags & USER_BOT) && !strcasecmp (u->handle, botnetnick)) {
+      putlog(LOG_MISC, "*", "(!) I have an user record, but without +b");
+      /* u->flags |= USER_BOT; */
+    }
+    
     for (e = u->entries; e; e = e->next)
       if (e->name) {
 	struct user_entry_type *uet = find_entry_type(e->name);


More information about the Patches mailing list