[eggheads-patches] PATCH: tcl_setuser.patch

Fabian Knittel fknittel at gmx.de
Sat Oct 23 10:05:25 CST 1999


[ tcl_setuser.patch ]

Includes the good part of rtc's supl.patch.

Fixes the tcl commands setuser <handle> LASTON, and
setuser <handle> XTRA. LASTON now works as discussed
on eggdev.

(I hope everyone understood that... I'm going to start
to sleep on my keyboard if i don't hurry up to bed...)

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Fri Oct 22 15:32:52 1999
+++ eggdrop1.3/doc/UPDATES1.3	Fri Oct 22 22:34:43 1999
@@ -4,6 +4,8 @@
 
 1.3.29
 Foundby   Fixedby   What....
+	  Fabian/   laston_tcl_set and _get were broken
+	  rtc
 dw	  Fabian    help_subst had broken columnated sections handling
 Michael   Fabian    small error in reset(exempts|invites) macro
 	  Fabian    removed newline from "msg already queued" message
diff -urN eggdrop1.3~/doc/tcl-commands.doc eggdrop1.3/doc/tcl-commands.doc
--- eggdrop1.3~/doc/tcl-commands.doc	Fri Oct 22 15:32:52 1999
+++ eggdrop1.3/doc/tcl-commands.doc	Sat Oct 23 00:42:19 1999
@@ -122,7 +122,9 @@
 |     LASTON - 2 forms:
 |              setuser <handle> laston <unixtime> <place>
 |                 sets global laston time
-|              setuser <handle> laston <unixtime> <channel> *
+|              setuser <handle> laston <unixtime>
+|                 sets global laston time, leaving the place field empty
+|              setuser <handle> laston <unixtime> <channel>
 |                 will set a users laston time in a channel record
 |                 (if it already exists)
 
diff -urN eggdrop1.3~/src/userent.c eggdrop1.3/src/userent.c
--- eggdrop1.3~/src/userent.c	Sat Oct 23 01:11:30 1999
+++ eggdrop1.3/src/userent.c	Sat Oct 23 00:27:59 1999
@@ -405,19 +405,28 @@
   struct laston_info *li;
   struct chanuserrec *cr;
 
-  BADARGS(5, 6, " handle LASTON time ?place?");
-  if (argc == 5) {
-    li = user_malloc(sizeof(struct laston_info));
+  BADARGS(4, 5, " handle LASTON time ?place?");
+  
+  if ((argc == 5) && argv[4][0] && strchr(CHANMETA, argv[4][0])) {
+    /* Search for matching channel */
+    for (cr = u->chanrec; cr; cr = cr->next)
+      if (!rfc_casecmp(cr->channel, argv[4])) {
+	cr->laston = atoi(argv[3]);
+	break;
+      }
+  }
+  /* Save globally */
+  li = user_malloc(sizeof(struct laston_info));
 
+  if (argc == 5) {
     li->lastonplace = user_malloc(strlen(argv[4]) + 1);
-    li->laston = atoi(argv[3]);
     strcpy(li->lastonplace, argv[4]);
-    set_user(&USERENTRY_LASTON, u, li);
   } else {
-    for (cr = u->chanrec; cr; cr = cr->next)
-      if (!rfc_casecmp(cr->channel, argv[4]))
-	cr->laston = atoi(argv[3]);
+    li->lastonplace = user_malloc(1);
+    li->lastonplace[0] = 0;
   }
+  li->laston = atoi(argv[3]);
+  set_user(&USERENTRY_LASTON, u, li);
   return TCL_OK;
 }
 
@@ -741,7 +750,7 @@
   strncpy(xk->key, argv[3], l);
   xk->key[l] = 0;
 
-  if (argc == 4) {
+  if (argc == 5) {
     int k = strlen(argv[4]);
     if (k > 500 - l)
       k = 500 - l;


More information about the Patches mailing list