[cvslog] (2004-07-05 05:14:22 UTC) Module eggdrop1.6: Change committed!

cvslog cvs at tsss.org
Sun Jul 4 23:14:22 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2004-07-05 05:14:22 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     doc/AUTHORS doc/UPDATES1.6 doc/html/authors.html src/cmds.c
     src/patch.h src/tcl.c

Log message:

- Fixed Tcl encoding issues with .tcl and .set.
* Found by: fabulous, Miguel Ventura - Patch by: CoderX2


* Added Darko to AUTHORS.

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/AUTHORS
diff -u eggdrop1.6/doc/AUTHORS:1.24 eggdrop1.6/doc/AUTHORS:1.25
--- eggdrop1.6/doc/AUTHORS:1.24	Thu Jan  8 23:56:35 2004
+++ eggdrop1.6/doc/AUTHORS	Mon Jul  5 00:14:12 2004
@@ -1,4 +1,4 @@
-$Id: AUTHORS,v 1.24 2004/01/09 05:56:35 wcc Exp $
+$Id: AUTHORS,v 1.25 2004/07/05 05:14:12 wcc Exp $
 
 Eggdrop Developers and Contributers
 Last revised: March 9, 2002
@@ -21,6 +21,7 @@
     Ben        Ben Dover
     ButchBub   Scott Taylor
     Cybah      Jonathan Miles
+    darko``    Darko Ilic
     david      David Newhall II
     drummer    Dobos Lorant
     Dude       Matthew Stiefel
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.578 eggdrop1.6/doc/UPDATES1.6:1.579
--- eggdrop1.6/doc/UPDATES1.6:1.578	Sun Jul  4 23:37:33 2004
+++ eggdrop1.6/doc/UPDATES1.6	Mon Jul  5 00:14:12 2004
@@ -1,4 +1,4 @@
-$Id: UPDATES1.6,v 1.578 2004/07/05 04:37:33 wcc Exp $
+$Id: UPDATES1.6,v 1.579 2004/07/05 05:14:12 wcc Exp $
 
 Eggdrop Changes (since v1.6.0)
      _________________________________________________________________
@@ -11,6 +11,9 @@
     ftp://ftp.eggheads.org/pub/eggdrop/UPDATES/
 
   1.6.17:
+    - Fixed Tcl encoding issues with .tcl and .set.
+    * Found by: fabulous, Miguel Ventura - Patch by: CoderX2
+
     - Added a set of Finnish language files and a Finnish MOTD.
     * Patch by: Mikko Vester
 
Index: eggdrop1.6/doc/html/authors.html
diff -u eggdrop1.6/doc/html/authors.html:1.19 eggdrop1.6/doc/html/authors.html:1.20
--- eggdrop1.6/doc/html/authors.html:1.19	Thu Jan  8 23:56:35 2004
+++ eggdrop1.6/doc/html/authors.html	Mon Jul  5 00:14:12 2004
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: authors.html,v 1.19 2004/01/09 05:56:35 wcc Exp $ -->
+<!-- $Id: authors.html,v 1.20 2004/07/05 05:14:12 wcc Exp $ -->
 
 <html>
   <head>
@@ -58,6 +58,12 @@
       </tr>
 
       <tr>
+        <td>darko``</td>
+
+        <td>Darko Ilic</td>
+      </tr>
+
+      <tr>
         <td>david</td>
 
         <td>David Newhall II</td>
Index: eggdrop1.6/src/cmds.c
diff -u eggdrop1.6/src/cmds.c:1.107 eggdrop1.6/src/cmds.c:1.108
--- eggdrop1.6/src/cmds.c:1.107	Tue Apr  6 01:56:38 2004
+++ eggdrop1.6/src/cmds.c	Mon Jul  5 00:14:12 2004
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.107 2004/04/06 06:56:38 wcc Exp $
+ * $Id: cmds.c,v 1.108 2004/07/05 05:14:12 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -2198,6 +2198,11 @@
 static void cmd_tcl(struct userrec *u, int idx, char *msg)
 {
   int code;
+  char *result;
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DString dstr;
+#endif
 
   if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
     dprintf(idx, MISC_NOSUCHCMD);
@@ -2205,10 +2210,25 @@
   }
   debug1("tcl: evaluate (.tcl): %s", msg);
   code = Tcl_GlobalEval(interp, msg);
+
+#ifdef USE_TCL_ENCODING
+  /* properly convert string to system encoding. */
+  Tcl_DStringInit(&dstr);
+  Tcl_UtfToExternalDString(NULL, interp->result, -1, &dstr);
+  result = Tcl_DStringValue(&dstr);
+#else
+  /* use old pre-Tcl 8.1 way. */
+  result = interp->result;
+#endif
+  
   if (code == TCL_OK)
-    dumplots(idx, "Tcl: ", interp->result);
+    dumplots(idx, "Tcl: ", result);
   else
-    dumplots(idx, "Tcl error: ", interp->result);
+    dumplots(idx, "Tcl error: ", result);
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DStringFree(&dstr);
+#endif
 }
 
 /* Perform a 'set' command
@@ -2217,6 +2237,11 @@
 {
   int code;
   char s[512];
+  char *result;
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DString dstr;
+#endif
 
   if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
     dprintf(idx, MISC_NOSUCHCMD);
@@ -2232,13 +2257,28 @@
   }
   strcpy(s + 4, msg);
   code = Tcl_Eval(interp, s);
+
+#ifdef USE_TCL_ENCODING
+  /* properly convert string to system encoding. */
+  Tcl_DStringInit(&dstr);
+  Tcl_UtfToExternalDString(NULL, interp->result, -1, &dstr);
+  result = Tcl_DStringValue(&dstr);
+#else
+  /* use old pre-Tcl 8.1 way. */
+  result = interp->result;
+#endif
+
   if (code == TCL_OK) {
     if (!strchr(msg, ' '))
-      dumplots(idx, "Currently: ", interp->result);
+      dumplots(idx, "Currently: ", result);
     else
       dprintf(idx, "Ok, set.\n");
   } else
-    dprintf(idx, "Error: %s\n", interp->result);
+    dprintf(idx, "Error: %s\n", result);
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DStringFree(&dstr);
+#endif
 }
 
 static void cmd_module(struct userrec *u, int idx, char *par)
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.1113 eggdrop1.6/src/patch.h:1.1114
--- eggdrop1.6/src/patch.h:1.1113	Sun Jul  4 23:37:33 2004
+++ eggdrop1.6/src/patch.h	Mon Jul  5 00:14:12 2004
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.1113 2004/07/05 04:37:33 wcc Exp $
+ * $Id: patch.h,v 1.1114 2004/07/05 05:14:12 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1089002259");            /* current unixtime */
+patch("1089004451");            /* current unixtime */
 /*
  *
  *
  */
-patch("finnish");
+patch("tclencoding");
 /*
  *
  *
Index: eggdrop1.6/src/tcl.c
diff -u eggdrop1.6/src/tcl.c:1.79 eggdrop1.6/src/tcl.c:1.80
--- eggdrop1.6/src/tcl.c:1.79	Sun Jun 13 20:14:06 2004
+++ eggdrop1.6/src/tcl.c	Mon Jul  5 00:14:12 2004
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.79 2004/06/14 01:14:06 wcc Exp $
+ * $Id: tcl.c,v 1.80 2004/07/05 05:14:12 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -694,12 +694,32 @@
 void do_tcl(char *whatzit, char *script)
 {
   int code;
+  char *result;
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DString dstr;
+#endif
 
   code = Tcl_Eval(interp, script);
+
+#ifdef USE_TCL_ENCODING
+  /* properly convert string to system encoding. */
+  Tcl_DStringInit(&dstr);
+  Tcl_UtfToExternalDString(NULL, interp->result, -1, &dstr);
+  result = Tcl_DStringValue(&dstr);
+#else
+  /* use old pre-Tcl 8.1 way. */
+  result = interp->result;
+#endif
+
   if (code != TCL_OK) {
     putlog(LOG_MISC, "*", "Tcl error in script for '%s':", whatzit);
-    putlog(LOG_MISC, "*", "%s", interp->result);
+    putlog(LOG_MISC, "*", "%s", result);
   }
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DStringFree(&dstr);
+#endif
 }
 
 /* Interpret tcl file fname.
@@ -708,18 +728,40 @@
  */
 int readtclprog(char *fname)
 {
+  int code;
+  char *result;
+
+#ifdef USE_TCL_ENCODING
+  Tcl_DString dstr;
+#endif
+
   if (!file_readable(fname))
     return 0;
 
-  if (Tcl_EvalFile(interp, fname) != TCL_OK) {
+  code = Tcl_EvalFile(interp, fname);
+  result = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
+
+#ifdef USE_TCL_ENCODING
+  /* properly convert string to system encoding. */
+  Tcl_DStringInit(&dstr);
+  Tcl_UtfToExternalDString(NULL, result, -1, &dstr);
+  result = Tcl_DStringValue(&dstr);  
+#endif
+
+  if (code != TCL_OK) {
     putlog(LOG_MISC, "*", "Tcl error in file '%s':", fname);
-    putlog(LOG_MISC, "*", "%s",
-           Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
-    return 0;
+    putlog(LOG_MISC, "*", "%s", result);
+    code = 0; /* JJM: refactored to remove premature return */
+  } else {
+    /* Refresh internal variables */
+    code = 1;
   }
 
-  /* Refresh internal variables */
-  return 1;
+#ifdef USE_TCL_ENCODING
+  Tcl_DStringFree(&dstr);
+#endif
+
+  return code;
 }
 
 void add_tcl_strings(tcl_strings *list)
----------------------- End of diff -----------------------



More information about the Changes mailing list