소스 검색

* console.mod hacked out

svn: 651
Bryan Drewery 22 년 전
부모
커밋
226697a67c
6개의 변경된 파일29개의 추가작업 그리고 67개의 파일을 삭제
  1. 7 37
      src/cmds.c
  2. 1 1
      src/main.c
  3. 18 24
      src/mod/console.mod/console.c
  4. 2 0
      src/mod/console.mod/console.h
  5. 0 3
      src/mod/ctcp.mod/ctcp.c
  6. 1 2
      src/mod/static.h

+ 7 - 37
src/cmds.c

@@ -27,6 +27,7 @@
 #include "help.h"
 #include "traffic.h" /* egg_traffic_t */
 #include "core_binds.h"
+#include "src/mod/console.mod/console.h"
 
 #include <ctype.h>
 #include <stdlib.h>
@@ -1222,7 +1223,6 @@ static void cmd_console(struct userrec *u, int idx, char *par)
   char *nick, s[2], s1[512];
   int dest = 0, i, ok = 0, pls, md;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  module_entry *me;
   struct chanset_t *chan;
 
   if (!par[0]) {
@@ -1329,11 +1329,7 @@ static void cmd_console(struct userrec *u, int idx, char *par)
 	    masktype(dcc[dest].u.chat->con_flags),
 	    maskname(dcc[dest].u.chat->con_flags));
   }
-  /* New style autosave -- drummer,07/25/1999*/
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (dest);
-  }
+  console_dostore(dest);
 }
 
 void test_colors(int);
@@ -2415,7 +2411,6 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
 {
   char *arg;
   int newchan, oldchan;
-  module_entry *me;
 
   if (!(u->flags & USER_PARTY)) {
     dprintf(idx, STR("You don't have partyline access\n"));
@@ -2524,11 +2519,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
 	botnet_send_part_idx(idx, "");
     }
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (idx);
-  }
+  console_dostore(idx);
 }
 
 int exec_str(int idx, char *cmd) {
@@ -2630,8 +2621,6 @@ static void cmd_last(struct userrec *u, int idx, char *par) {
 
 static void cmd_echo(struct userrec *u, int idx, char *par)
 {
-  module_entry *me;
-
   if (!par[0]) {
     dprintf(idx, STR("Echo is currently %s.\n"), dcc[idx].status & STAT_ECHO ?
 	    "on" : "off");
@@ -2647,16 +2636,11 @@ static void cmd_echo(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("Usage: echo <on/off>\n"));
     return;
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (idx);
-  }
+  console_dostore(idx);
 }
 
 static void cmd_color(struct userrec *u, int idx, char *par)
 {
-  module_entry *me;
   int ansi = 0;
   char *of;
 
@@ -2682,11 +2666,7 @@ static void cmd_color(struct userrec *u, int idx, char *par)
   } else {
     return;
   }
-
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (idx);
-  }
+  console_dostore(idx);
 }
 
 int stripmodes(char *s)
@@ -2772,7 +2752,6 @@ static void cmd_strip(struct userrec *u, int idx, char *par)
 {
   char *nick, *changes, *c, s[2];
   int dest = 0, i, pls, md, ok = 0;
-  module_entry *me;
 
   if (!par[0]) {
     dprintf(idx, STR("Your current strip settings are: %s (%s).\n"),
@@ -2839,11 +2818,7 @@ static void cmd_strip(struct userrec *u, int idx, char *par)
   /* Set highlight flag here so user is able to control stripping of
    * bold also as intended -- dw 27/12/1999
    */
-  /* New style autosave here too -- rtc, 09/28/1999*/
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (dest);
-  }
+  console_dostore(dest);
 }
 
 static void cmd_su(struct userrec *u, int idx, char *par)
@@ -2941,7 +2916,6 @@ static void cmd_fixcodes(struct userrec *u, int idx, char *par)
 static void cmd_page(struct userrec *u, int idx, char *par)
 {
   int a;
-  module_entry *me;
 
   if (!par[0]) {
     if (dcc[idx].status & STAT_PAGE) {
@@ -2971,11 +2945,7 @@ static void cmd_page(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("Usage: page <off or #>\n"));
     return;
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
-  if ((me = module_find("console", 0, 0))) {
-    Function *func = me->funcs;
-    (func[CONSOLE_DOSTORE]) (idx);
-  }
+  console_dostore(idx);
 }
 
 /* Evaluate a Tcl command, send output to a dcc user.

+ 1 - 1
src/main.c

@@ -1208,7 +1208,7 @@ int main(int argc, char **argv)
   module_load("share");
   update_init();
   module_load("notes");
-  module_load("console");
+  console_init();
   ctcp_init();
   module_load("compress");
   chanprog();

+ 18 - 24
src/mod/console.mod/console.c

@@ -5,13 +5,23 @@
  *
  */
 
-#define MODULE_NAME "console"
-#define MAKING_CONSOLE
-#include "src/mod/module.h"
-#include <stdlib.h>
+#undef MAKING_MODS
 #include "console.h"
+#include "src/common.h"
+#include "src/tclhash.h"
+#include "src/tandem.h"
+#include "src/cmds.h"
+#include "src/users.h"
+#include "src/userent.h"
+#include "src/botmsg.h"
+#include "src/userrec.h"
+#include "src/users.h"
+#include "src/misc.h"
+#include "src/core_binds.h"
+
+extern int noshare;
+extern char botnetnick[];
 
-static Function *global = NULL;
 static int console_autosave = 1;
 static int info_party = 1;
 
@@ -206,7 +216,7 @@ static int console_dupuser(struct userrec *new, struct userrec *old,
   struct console_info *i = e->u.extra, *j;
 
   j = malloc(sizeof(struct console_info));
-  my_memcpy(j, i, sizeof(struct console_info));
+  egg_memcpy(j, i, sizeof(struct console_info));
 
   j->channel = strdup(i->channel);
   return set_user(e->type, new, j);
@@ -326,7 +336,7 @@ static int console_store(struct userrec *u, int idx, char *par)
 }
 
 /* cmds.c:cmd_console calls this, better than chof bind - drummer,07/25/1999 */
-static int console_dostore(int idx)
+int console_dostore(int idx)
 {
   if (console_autosave)
     console_store(dcc[idx].user, idx, NULL);
@@ -345,27 +355,11 @@ static cmd_t mydcc[] =
   {NULL,	NULL,	NULL,			NULL}
 };
 
-EXPORT_SCOPE char *console_start();
-
-static Function console_table[] =
-{
-  (Function) console_start,
-  (Function) NULL,
-  (Function) NULL,
-  (Function) NULL,
-  (Function) console_dostore,
-};
-
-char *console_start(Function * global_funcs)
+void console_init()
 {
-  global = global_funcs;
-
-  module_register(MODULE_NAME, console_table, 1, 1);
-
   add_builtins("dcc", mydcc);
   add_builtins("chon", mychon);
 
   USERENTRY_CONSOLE.get = def_get;
   add_entry_type(&USERENTRY_CONSOLE);
-  return NULL;
 }

+ 2 - 0
src/mod/console.mod/console.h

@@ -18,4 +18,6 @@
 #define CONSOLE_NO		"no"
 #define CONSOLE_COLOR		"Color:"
 
+int console_dostore(int);
+
 #endif				/* _EGG_MOD_CONSOLE_CONSOLE_H */

+ 0 - 3
src/mod/ctcp.mod/ctcp.c

@@ -668,9 +668,6 @@ static int ctcp_CHAT(char *nick, char *uhost, struct userrec *u, char *object, c
        * -poptix 5/1/1997 */
       dprintf(DP_HELP, "PRIVMSG %s :\001DCC CHAT chat %lu %u\001\n", nick, iptolong(getmyip()), dcc[ix].port);
     }
-
-
-
     return 1;
 }
 

+ 1 - 2
src/mod/static.h

@@ -7,7 +7,6 @@
 
 char *channels_start();
 char *compress_start();
-char *console_start();
 char *dns_start();
 #ifdef LEAF
 char *irc_start();
@@ -19,6 +18,7 @@ char *server_start();
 char *share_start();
 char *transfer_start();
 
+void console_init();
 void ctcp_init();
 void update_init();
 
@@ -26,7 +26,6 @@ static void link_statics()
 {
   check_static("channels", channels_start);
   check_static("compress", compress_start);
-  check_static("console", console_start);
   check_static("dns", dns_start);
 #ifdef LEAF
   check_static("irc", irc_start);