From 316bd7d14271fdd9524175ed309a0622340b127d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 15 Jul 2001 14:07:48 +0000 Subject: [PATCH] Moved awaylog to core. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1629 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/Makefile.am | 1 + src/core/core.c | 5 ++++ src/{irc/core/irc-log.c => core/log-away.c} | 29 ++++++++++++--------- src/irc/core/Makefile.am | 1 - src/irc/core/irc-core.c | 5 ---- src/perl/Makefile.am | 17 +++++++++--- 6 files changed, 36 insertions(+), 22 deletions(-) rename src/{irc/core/irc-log.c => core/log-away.c} (82%) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 1dc2f5f9..042ca8c6 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -27,6 +27,7 @@ libcore_a_SOURCES = \ levels.c \ line-split.c \ log.c \ + log-away.c \ masks.c \ $(memdebug_src) \ misc.c \ diff --git a/src/core/core.c b/src/core/core.c index 87816316..f0a691f6 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -48,6 +48,9 @@ void chat_commands_init(void); void chat_commands_deinit(void); +void log_away_init(void); +void log_away_deinit(void); + int irssi_gui; static char *irssi_dir, *irssi_config_file; @@ -180,6 +183,7 @@ void core_init(int argc, char *argv[]) servers_init(); write_buffer_init(); log_init(); + log_away_init(); rawlog_init(); channels_init(); @@ -206,6 +210,7 @@ void core_deinit(void) channels_deinit(); rawlog_deinit(); + log_away_deinit(); log_deinit(); write_buffer_deinit(); servers_deinit(); diff --git a/src/irc/core/irc-log.c b/src/core/log-away.c similarity index 82% rename from src/irc/core/irc-log.c rename to src/core/log-away.c index 717686df..724e4b4a 100644 --- a/src/irc/core/irc-log.c +++ b/src/core/log-away.c @@ -1,7 +1,7 @@ /* - irc-log.c : irssi + log-away.c : Awaylog handling - Copyright (C) 1999-2000 Timo Sirainen + Copyright (C) 1999-2001 Timo Sirainen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,10 +22,9 @@ #include "signals.h" #include "levels.h" #include "log.h" +#include "servers.h" #include "settings.h" -#include "irc-servers.h" - static LOG_REC *awaylog; static int away_filepos; static int away_msgs; @@ -37,7 +36,7 @@ static void sig_log_written(LOG_REC *log) away_msgs++; } -static void event_away(IRC_SERVER_REC *server, const char *data) +static void awaylog_open(void) { const char *fname, *levelstr; LOG_REC *log; @@ -71,7 +70,7 @@ static void event_away(IRC_SERVER_REC *server, const char *data) away_msgs = 0; } -static void event_unaway(IRC_SERVER_REC *server, const char *data) +static void awaylog_close(void) { const char *fname; LOG_REC *log; @@ -92,7 +91,15 @@ static void event_unaway(IRC_SERVER_REC *server, const char *data) log_close(log); } -void irc_log_init(void) +static void sig_away_changed(SERVER_REC *server) +{ + if (server->usermode_away) + awaylog_open(); + else + awaylog_close(); +} + +void log_away_init(void) { awaylog = NULL; away_filepos = 0; @@ -102,13 +109,11 @@ void irc_log_init(void) settings_add_str("log", "awaylog_level", "msgs hilight"); signal_add("log written", (SIGNAL_FUNC) sig_log_written); - signal_add("event 306", (SIGNAL_FUNC) event_away); - signal_add("event 305", (SIGNAL_FUNC) event_unaway); + signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed); } -void irc_log_deinit(void) +void log_away_deinit(void) { signal_remove("log written", (SIGNAL_FUNC) sig_log_written); - signal_remove("event 306", (SIGNAL_FUNC) event_away); - signal_remove("event 305", (SIGNAL_FUNC) event_unaway); + signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed); } diff --git a/src/irc/core/Makefile.am b/src/irc/core/Makefile.am index 296a9a91..40204183 100644 --- a/src/irc/core/Makefile.am +++ b/src/irc/core/Makefile.am @@ -18,7 +18,6 @@ libirc_core_a_SOURCES = \ irc-chatnets.c \ irc-commands.c \ irc-expandos.c \ - irc-log.c \ irc-masks.c \ irc-nicklist.c \ irc-queries.c \ diff --git a/src/irc/core/irc-core.c b/src/irc/core/irc-core.c index cce9d0d7..b036d244 100644 --- a/src/irc/core/irc-core.c +++ b/src/irc/core/irc-core.c @@ -42,9 +42,6 @@ void irc_rawlog_deinit(void); void irc_expandos_init(void); void irc_expandos_deinit(void); -void irc_log_init(void); -void irc_log_deinit(void); - void lag_init(void); void lag_deinit(void); @@ -106,14 +103,12 @@ void irc_core_init(void) netsplit_init(); irc_rawlog_init(); irc_expandos_init(); - irc_log_init(); } void irc_core_deinit(void) { signal_emit("chat protocol deinit", 1, chat_protocol_find("IRC")); - irc_log_deinit(); irc_expandos_deinit(); irc_rawlog_deinit(); netsplit_deinit(); diff --git a/src/perl/Makefile.am b/src/perl/Makefile.am index 70cfee0c..5926eb2a 100644 --- a/src/perl/Makefile.am +++ b/src/perl/Makefile.am @@ -84,13 +84,21 @@ UI_SOURCES = \ ui/typemap \ ui/module.h +TEXTUI_SOURCES = \ + ui/TextUI.xs \ + ui/TextUI.pm \ + ui/Makefile.PL.in \ + ui/typemap \ + ui/module.h + EXTRA_DIST = \ libperl_dynaloader.la \ libperl_orig.la \ get-signals.pl \ $(CORE_SOURCES) \ $(IRC_SOURCES) \ - $(UI_SOURCES) + $(UI_SOURCES) \ + $(TEXTUI_SOURCES) noinst_HEADERS = \ module.h \ @@ -98,19 +106,20 @@ noinst_HEADERS = \ perl-signals.h all-local: - for dir in common irc ui; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR) PREFIX=$(PERL_LIB_DIR); fi; fi && ($(MAKE) || $(MAKE)) && cd ..; done + for dir in common irc ui textui; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR) PREFIX=$(PERL_LIB_DIR); fi; fi && ($(MAKE) || $(MAKE)) && cd ..; done # FIXME: remove after .99: the libfe_perl must not be used anymore install-exec-local: -(rm -f $(moduledir)/libfe_perl.*) - for dir in common irc ui; do cd $$dir && $(MAKE) install && cd ..; done + for dir in common irc ui textui; do cd $$dir && $(MAKE) install && cd ..; done clean-generic: - rm -f common/Irssi.c irc/Irc.c ui/UI.c + rm -f common/Irssi.c irc/Irc.c ui/UI.c textui/TextUI.c distclean: distclean-am -(cd common && $(MAKE) realclean && rm -f Makefile.PL) -(cd irc && $(MAKE) realclean && rm -f Makefile.PL) -(cd ui && $(MAKE) realclean && rm -f Makefile.PL) + -(cd textui && $(MAKE) realclean && rm -f Makefile.PL) libperl_core_la_LIBADD = $(PERL_LDFLAGS)