Explorar o código

* Removed bind table "event"
* Fixed check_bind_away() calls using sock instad of idx.


svn: 798

Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
2982588d43
Modificáronse 8 ficheiros con 9 adicións e 36 borrados
  1. 1 0
      doc/UPDATES
  2. 1 1
      src/botcmd.c
  3. 2 10
      src/core_binds.c
  4. 0 1
      src/core_binds.h
  5. 3 4
      src/dccutil.c
  6. 0 18
      src/main.c
  7. 1 1
      src/mod/module.h
  8. 1 1
      src/modules.c

+ 1 - 0
doc/UPDATES

@@ -8,6 +8,7 @@ This is a summary of ChangeLog basically.
 5.Added cmds: encrypt, decrypt, md5, sha1.
 6.Added AUTH cmds: md5, sha1.
 7.First time logins were broken.
+8.Cleaned up some code here and there (small fixes).
 
 1.1.3
 1.Fixed a very fatal bug with channel ctcps.

+ 1 - 1
src/botcmd.c

@@ -1210,7 +1210,7 @@ static void bot_away(int idx, char *par)
   sock = base64_to_int(etc);
   if (sock == 0)
     sock = partysock(bot, etc);
-  check_bind_away(bot, sock, par);
+  check_bind_away(bot, idx, par);
   if (par[0]) {
     partystat(bot, sock, PLSTAT_AWAY, 0);
     partyaway(bot, sock, par);

+ 2 - 10
src/core_binds.c

@@ -22,7 +22,7 @@ extern cmd_t 		C_dcc[];
 static bind_table_t *BT_link = NULL, *BT_disc = NULL, *BT_away = NULL, *BT_dcc = NULL;
 static bind_table_t *BT_chat = NULL, *BT_act = NULL, *BT_bcst = NULL, *BT_note = NULL;
 static bind_table_t *BT_bot = NULL, *BT_nkch = NULL, *BT_chon = NULL, *BT_chof = NULL;
-static bind_table_t *BT_chpt = NULL, *BT_chjn = NULL, *BT_time = NULL, *BT_event = NULL;
+static bind_table_t *BT_chpt = NULL, *BT_chjn = NULL, *BT_time = NULL;
 
 void core_binds_init()
 {
@@ -38,13 +38,10 @@ void core_binds_init()
         BT_dcc = bind_table_add("dcc", 3, "Uis", MATCH_PARTIAL, BIND_USE_ATTR);
         add_builtins("dcc", C_dcc);
         BT_disc = bind_table_add("disc", 1, "s", MATCH_MASK, BIND_STACKABLE);
-	BT_event = bind_table_add("event", 1, "s", MATCH_MASK, BIND_STACKABLE);
         BT_link = bind_table_add("link", 2, "ss", MATCH_MASK, BIND_STACKABLE);
         BT_nkch = bind_table_add("nkch", 2, "ss", MATCH_MASK, BIND_STACKABLE);
         BT_note = bind_table_add("note", 3 , "sss", MATCH_EXACT, 0);
 	BT_time = bind_table_add("time", 5, "iiiii", MATCH_MASK, BIND_STACKABLE);
-
-
 }
 
 void check_bind_dcc(const char *cmd, int idx, const char *text)
@@ -172,8 +169,7 @@ int check_bind_note(const char *from, const char *to, const char *text)
   return check_bind(BT_note, to, NULL, from, to, text);
 }
 
-void check_bind_chjn(const char *bot, const char *nick, int chan,
-                    const char type, int sock, const char *host)
+void check_bind_chjn(const char *bot, const char *nick, int chan, const char type, int sock, const char *host)
 {
   struct flag_record    fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
   char                  s[11] = "", t[2] = "";
@@ -218,7 +214,3 @@ void check_bind_time(struct tm *tm)
 	check_bind(BT_time, full, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 }
 
-void check_bind_event(char *event)
-{
-	check_bind(BT_event, event, NULL, event);
-}

+ 0 - 1
src/core_binds.h

@@ -4,7 +4,6 @@
 #ifndef MAKING_MODS
 void core_binds_init();
 void check_bind_time(struct tm *tm);
-void check_bind_event(char *event);
 void check_bind_dcc(const char *, int, const char *);
 void check_bind_chjn(const char *, const char *, int, char, int, const char *);
 void check_bind_chpt(const char *, const char *, int, int);

+ 3 - 4
src/dccutil.c

@@ -425,7 +425,7 @@ void not_away(int idx)
   dprintf(idx, "You're not away any more.\n");
   free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = NULL;
-  check_bind_away(conf.bot->nick, dcc[idx].sock, NULL);
+  check_bind_away(conf.bot->nick, idx, NULL);
 }
 
 void set_away(int idx, char *s)
@@ -442,14 +442,13 @@ void set_away(int idx, char *s)
     free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = strdup(s);
   if (dcc[idx].u.chat->channel >= 0) {
-    chanout_but(-1, dcc[idx].u.chat->channel,
-		"*** %s is now away: %s\n", dcc[idx].nick, s);
+    chanout_but(-1, dcc[idx].u.chat->channel, "*** %s is now away: %s\n", dcc[idx].nick, s);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
       botnet_send_away(-1, conf.bot->nick, dcc[idx].sock, s, idx);
     }
   }
   dprintf(idx, "You are now away.\n");
-  check_bind_away(conf.bot->nick, dcc[idx].sock, s);
+  check_bind_away(conf.bot->nick, idx, s);
 }
 
 

+ 0 - 18
src/main.c

@@ -467,21 +467,6 @@ static void core_halfhourly()
 #endif /* HUB */
 }
 
-static void event_rehash()
-{
-  check_bind_event("rehash");
-}
-
-static void event_prerehash()
-{
-  check_bind_event("prerehash");
-}
-
-static void event_save()
-{
-  check_bind_event("save");
-}
-
 static void event_resettraffic()
 {
 	traffic.out_total.irc += traffic.out_today.irc;
@@ -830,9 +815,6 @@ int main(int argc, char **argv)
   timer_create_secs(3600, "core_hourly", (Function) core_hourly);
   timer_create_secs(1800, "core_halfhourly", (Function) core_halfhourly);
 
-  add_hook(HOOK_REHASH, (Function) event_rehash);
-  add_hook(HOOK_PRE_REHASH, (Function) event_prerehash);
-  add_hook(HOOK_USERFILE, (Function) event_save);
   add_hook(HOOK_DAILY, (Function) event_resettraffic);
 
   debug0("main: entering loop");

+ 1 - 1
src/mod/module.h

@@ -214,7 +214,7 @@
 /* UNUSED 86 */
 #define open_telnet ((int (*) (char *, int))global[87])
 /* 88 - 91 */
-#define check_bind_event ((void * (*) (const char *))global[88])
+/* UNUSED 88 */
 #define my_memcpy ((void * (*) (void *, const void *, size_t))global[89])
 #define my_atoul ((IP(*)(char *))global[90])
 #define my_strcpy ((int (*)(char *, const char *))global[91])

+ 1 - 1
src/modules.c

@@ -232,7 +232,7 @@ Function global_table[] =
   (Function) 0,
   (Function) open_telnet,
   /* 88 - 91 */
-  (Function) check_bind_event,
+  (Function) 0,
   (Function) egg_memcpy,
   (Function) my_atoul,
   (Function) my_strcpy,