1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Moved awaylog to core.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1629 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-07-15 14:07:48 +00:00 committed by cras
parent de5348a084
commit 316bd7d142
6 changed files with 36 additions and 22 deletions

View File

@ -27,6 +27,7 @@ libcore_a_SOURCES = \
levels.c \ levels.c \
line-split.c \ line-split.c \
log.c \ log.c \
log-away.c \
masks.c \ masks.c \
$(memdebug_src) \ $(memdebug_src) \
misc.c \ misc.c \

View File

@ -48,6 +48,9 @@
void chat_commands_init(void); void chat_commands_init(void);
void chat_commands_deinit(void); void chat_commands_deinit(void);
void log_away_init(void);
void log_away_deinit(void);
int irssi_gui; int irssi_gui;
static char *irssi_dir, *irssi_config_file; static char *irssi_dir, *irssi_config_file;
@ -180,6 +183,7 @@ void core_init(int argc, char *argv[])
servers_init(); servers_init();
write_buffer_init(); write_buffer_init();
log_init(); log_init();
log_away_init();
rawlog_init(); rawlog_init();
channels_init(); channels_init();
@ -206,6 +210,7 @@ void core_deinit(void)
channels_deinit(); channels_deinit();
rawlog_deinit(); rawlog_deinit();
log_away_deinit();
log_deinit(); log_deinit();
write_buffer_deinit(); write_buffer_deinit();
servers_deinit(); servers_deinit();

View File

@ -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 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 it under the terms of the GNU General Public License as published by
@ -22,10 +22,9 @@
#include "signals.h" #include "signals.h"
#include "levels.h" #include "levels.h"
#include "log.h" #include "log.h"
#include "servers.h"
#include "settings.h" #include "settings.h"
#include "irc-servers.h"
static LOG_REC *awaylog; static LOG_REC *awaylog;
static int away_filepos; static int away_filepos;
static int away_msgs; static int away_msgs;
@ -37,7 +36,7 @@ static void sig_log_written(LOG_REC *log)
away_msgs++; away_msgs++;
} }
static void event_away(IRC_SERVER_REC *server, const char *data) static void awaylog_open(void)
{ {
const char *fname, *levelstr; const char *fname, *levelstr;
LOG_REC *log; LOG_REC *log;
@ -71,7 +70,7 @@ static void event_away(IRC_SERVER_REC *server, const char *data)
away_msgs = 0; away_msgs = 0;
} }
static void event_unaway(IRC_SERVER_REC *server, const char *data) static void awaylog_close(void)
{ {
const char *fname; const char *fname;
LOG_REC *log; LOG_REC *log;
@ -92,7 +91,15 @@ static void event_unaway(IRC_SERVER_REC *server, const char *data)
log_close(log); 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; awaylog = NULL;
away_filepos = 0; away_filepos = 0;
@ -102,13 +109,11 @@ void irc_log_init(void)
settings_add_str("log", "awaylog_level", "msgs hilight"); settings_add_str("log", "awaylog_level", "msgs hilight");
signal_add("log written", (SIGNAL_FUNC) sig_log_written); signal_add("log written", (SIGNAL_FUNC) sig_log_written);
signal_add("event 306", (SIGNAL_FUNC) event_away); signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed);
signal_add("event 305", (SIGNAL_FUNC) event_unaway);
} }
void irc_log_deinit(void) void log_away_deinit(void)
{ {
signal_remove("log written", (SIGNAL_FUNC) sig_log_written); signal_remove("log written", (SIGNAL_FUNC) sig_log_written);
signal_remove("event 306", (SIGNAL_FUNC) event_away); signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed);
signal_remove("event 305", (SIGNAL_FUNC) event_unaway);
} }

View File

@ -18,7 +18,6 @@ libirc_core_a_SOURCES = \
irc-chatnets.c \ irc-chatnets.c \
irc-commands.c \ irc-commands.c \
irc-expandos.c \ irc-expandos.c \
irc-log.c \
irc-masks.c \ irc-masks.c \
irc-nicklist.c \ irc-nicklist.c \
irc-queries.c \ irc-queries.c \

View File

@ -42,9 +42,6 @@ void irc_rawlog_deinit(void);
void irc_expandos_init(void); void irc_expandos_init(void);
void irc_expandos_deinit(void); void irc_expandos_deinit(void);
void irc_log_init(void);
void irc_log_deinit(void);
void lag_init(void); void lag_init(void);
void lag_deinit(void); void lag_deinit(void);
@ -106,14 +103,12 @@ void irc_core_init(void)
netsplit_init(); netsplit_init();
irc_rawlog_init(); irc_rawlog_init();
irc_expandos_init(); irc_expandos_init();
irc_log_init();
} }
void irc_core_deinit(void) void irc_core_deinit(void)
{ {
signal_emit("chat protocol deinit", 1, chat_protocol_find("IRC")); signal_emit("chat protocol deinit", 1, chat_protocol_find("IRC"));
irc_log_deinit();
irc_expandos_deinit(); irc_expandos_deinit();
irc_rawlog_deinit(); irc_rawlog_deinit();
netsplit_deinit(); netsplit_deinit();

View File

@ -84,13 +84,21 @@ UI_SOURCES = \
ui/typemap \ ui/typemap \
ui/module.h ui/module.h
TEXTUI_SOURCES = \
ui/TextUI.xs \
ui/TextUI.pm \
ui/Makefile.PL.in \
ui/typemap \
ui/module.h
EXTRA_DIST = \ EXTRA_DIST = \
libperl_dynaloader.la \ libperl_dynaloader.la \
libperl_orig.la \ libperl_orig.la \
get-signals.pl \ get-signals.pl \
$(CORE_SOURCES) \ $(CORE_SOURCES) \
$(IRC_SOURCES) \ $(IRC_SOURCES) \
$(UI_SOURCES) $(UI_SOURCES) \
$(TEXTUI_SOURCES)
noinst_HEADERS = \ noinst_HEADERS = \
module.h \ module.h \
@ -98,19 +106,20 @@ noinst_HEADERS = \
perl-signals.h perl-signals.h
all-local: 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 # FIXME: remove after .99: the libfe_perl must not be used anymore
install-exec-local: install-exec-local:
-(rm -f $(moduledir)/libfe_perl.*) -(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: 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 distclean: distclean-am
-(cd common && $(MAKE) realclean && rm -f Makefile.PL) -(cd common && $(MAKE) realclean && rm -f Makefile.PL)
-(cd irc && $(MAKE) realclean && rm -f Makefile.PL) -(cd irc && $(MAKE) realclean && rm -f Makefile.PL)
-(cd ui && $(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) libperl_core_la_LIBADD = $(PERL_LDFLAGS)