Explorar o código

* Fixed some more overlapping strcpys
* Removed H_filt


svn: 512

Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
a4c45bda40
Modificáronse 6 ficheiros con 10 adicións e 59 borrados
  1. 4 2
      src/botcmd.c
  2. 0 2
      src/dcc.c
  3. 2 2
      src/mod/module.h
  4. 2 2
      src/modules.c
  5. 1 49
      src/tclhash.c
  6. 1 2
      src/tclhash.h

+ 4 - 2
src/botcmd.c

@@ -87,7 +87,8 @@ static void bot_chan2(int idx, char *msg)
   /* Strip annoying control chars */
   for (p = from; *p;) {
     if ((*p < 32) || (*p == 127))
-      strcpy(p, p + 1);
+//      strcpy(p, p + 1);
+      sprintf(p, "%s", p + 1);
     else
       p++;
   }
@@ -233,7 +234,8 @@ static void bot_actchan(int idx, char *par)
   chan = base64_to_int(p);
   for (p = from; *p;) {
     if ((*p < 32) || (*p == 127))
-      strcpy(p, p + 1);
+      sprintf(p, "%s", p + 1);
+//      strcpy(p, p + 1);
     else
       p++;
   }

+ 0 - 2
src/dcc.c

@@ -1008,8 +1008,6 @@ static void dcc_chat(int idx, char *buf, int i)
      detect_dcc_flood(&dcc[idx].timeval, dcc[idx].u.chat, idx))
     return;
   dcc[idx].timeval = now;
-  if (buf[0])
-    strcpy(buf, check_tcl_filt(idx, buf));
   if (buf[0]) {
     /* Check for beeps and cancel annoying ones */
     v = buf;

+ 2 - 2
src/mod/module.h

@@ -316,12 +316,12 @@
 #define expected_memory ((int(*)(void))global[168])
 #define tell_mem_status ((void(*)(char *))global[169])
 #define do_restart (*(int *)(global[170]))
-#define check_tcl_filt ((const char *(*)(int, const char *))global[171])
+/* --- UNUSED 171 */
 /* 172 - 175 */
 #define add_hook(a,b) (((void (*) (int, Function))global[172])(a,b))
 #define del_hook(a,b) (((void (*) (int, Function))global[173])(a,b))
 #define H_dcc (*(p_tcl_bind_list *)(global[174]))
-#define H_filt (*(p_tcl_bind_list *)(global[175]))
+/* --- UNUSED 175 */
 /* 176 - 179 */
 #define H_chon (*(p_tcl_bind_list *)(global[176]))
 #define H_chof (*(p_tcl_bind_list *)(global[177]))

+ 2 - 2
src/modules.c

@@ -368,12 +368,12 @@ Function global_table[] =
   (Function) expected_memory,
   (Function) tell_mem_status,
   (Function) & do_restart,	/* int					*/
-  (Function) check_tcl_filt,
+  (Function) 0,
   /* 172 - 175 */
   (Function) add_hook,
   (Function) del_hook,
   (Function) & H_dcc,		/* p_tcl_bind_list *			*/
-  (Function) & H_filt,		/* p_tcl_bind_list *			*/
+  (Function) 0,
   /* 176 - 179 */
   (Function) & H_chon,		/* p_tcl_bind_list *			*/
   (Function) & H_chof,		/* p_tcl_bind_list *			*/

+ 1 - 49
src/tclhash.c

@@ -27,7 +27,7 @@ extern char		dcc_prefix[];
 p_tcl_bind_list		bind_table_list;
 p_tcl_bind_list		H_chat, H_act, H_bcst, H_chon, H_chof,
 			H_load, H_unld, H_link, H_disc, H_dcc, H_chjn, H_chpt,
-			H_bot, H_time, H_nkch, H_away, H_note, H_filt, H_event;
+			H_bot, H_time, H_nkch, H_away, H_note, H_event;
 
 static int builtin_2char();
 static int builtin_3char();
@@ -35,7 +35,6 @@ static int builtin_5int();
 static int builtin_char();
 static int builtin_chpt();
 static int builtin_chjn();
-static int builtin_idxchar();
 static int builtin_charidx();
 static int builtin_chat();
 static int builtin_dcc();
@@ -206,7 +205,6 @@ void init_bind(void)
   H_nkch = add_bind_table("nkch", HT_STACKABLE, builtin_2char);
   H_load = add_bind_table("load", HT_STACKABLE, builtin_char);
   H_link = add_bind_table("link", HT_STACKABLE, builtin_2char);
-  H_filt = add_bind_table("filt", HT_STACKABLE, builtin_idxchar);
   H_disc = add_bind_table("disc", HT_STACKABLE, builtin_char);
   H_dcc = add_bind_table("dcc", 0, builtin_dcc);
   H_chpt = add_bind_table("chpt", HT_STACKABLE, builtin_chpt);
@@ -557,30 +555,6 @@ static int builtin_chjn STDVAR
   return TCL_OK;
 }
 
-static int builtin_idxchar STDVAR
-{
-  Function F = (Function) cd;
-  int idx;
-  char *r;
-Context;
-  BADARGS(3, 3, " idx args");
-  CHECKVALIDITY(builtin_idxchar);
-  if (atoi(argv[1]) < 0) { /* this is a remote-simul idx */
-    idx = atoi(argv[1]) * -1;
-  } else {
-    idx = findidx(atoi(argv[1]));
-  }
-  if (idx < 0) {
-    Tcl_AppendResult(irp, "invalid idx", NULL);
-    return TCL_ERROR;
-  }
-  r = (((char *(*)()) F) (idx, argv[2]));
-
-  Tcl_ResetResult(irp);
-  Tcl_AppendResult(irp, r, NULL);
-  return TCL_OK;
-}
-
 int findanyidx(register int z)
 {
   register int j;
@@ -950,28 +924,6 @@ void check_tcl_loadunld(const char *mod, tcl_bind_list_t *tl)
   check_tcl_bind(tl, mod, 0, " $_lu1", MATCH_MASK | BIND_STACKABLE);
 }
 
-const char *check_tcl_filt(int idx, const char *text)
-{
-  char			s[11];
-  int			x;
-  struct flag_record	fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  egg_snprintf(s, sizeof s, "%ld", dcc[idx].sock);
-  get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
-  Tcl_SetVar(interp, "_filt1", (char *) s, 0);
-  Tcl_SetVar(interp, "_filt2", (char *) text, 0);
-  x = check_tcl_bind(H_filt, text, &fr, " $_filt1 $_filt2",
-		     MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE |
-		     BIND_WANTRET | BIND_ALTER_ARGS);
-  if (x == BIND_EXECUTED || x == BIND_EXEC_LOG) {
-    if (interp->result == NULL || !interp->result[0])
-      return "";
-    else
-      return interp->result;
-  } else
-    return text;
-}
-
 int check_tcl_note(const char *from, const char *to, const char *text)
 {
   int	x;

+ 1 - 2
src/tclhash.h

@@ -82,7 +82,6 @@ void check_tcl_chpt(const char *, const char *, int, int);
 void check_tcl_bot(const char *, const char *, const char *);
 void check_tcl_link(const char *, const char *);
 void check_tcl_disc(const char *);
-const char *check_tcl_filt(int, const char *);
 int check_tcl_note(const char *, const char *, const char *);
 void check_tcl_listen(const char *, int);
 void check_tcl_time(struct tm *);
@@ -110,7 +109,7 @@ void add_builtins(tcl_bind_list_t *, cmd_t *);
 int check_validity(char *, Function);
 extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof;
 extern p_tcl_bind_list H_load, H_unld, H_dcc, H_bot, H_link;
-extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc, H_event;
+extern p_tcl_bind_list H_away, H_nkch, H_disc, H_event;
 
 #endif