Awaylog is printed to screen when you set yourself unaway.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@275 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-02 01:15:51 +00:00 committed by cras
commit bf61b699da
4 changed files with 51 additions and 0 deletions

View file

@ -375,6 +375,25 @@ static void sig_log_create_failed(LOG_REC *log)
IRCTXT_LOG_CREATE_FAILED, log->fname, g_strerror(errno));
}
static void sig_awaylog_show(LOG_REC *log, gpointer pmsgs, gpointer pfilepos)
{
char *str;
int msgs, filepos;
msgs = GPOINTER_TO_INT(pmsgs);
filepos = GPOINTER_TO_INT(pfilepos);
if (msgs == 0)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_LOG_NO_AWAY_MSGS, log->fname);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_LOG_AWAY_MSGS, log->fname, msgs);
str = g_strdup_printf("\"%s\" %d", log->fname, filepos);
signal_emit("command cat", 1, str);
g_free(str);
}
}
static void read_settings(void)
{
int old_autolog = autolog_level;
@ -411,6 +430,7 @@ void fe_log_init(void)
signal_add("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
signal_add("log locked", (SIGNAL_FUNC) sig_log_locked);
signal_add("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
signal_add("awaylog show", (SIGNAL_FUNC) sig_awaylog_show);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
}
@ -431,5 +451,6 @@ void fe_log_deinit(void)
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
signal_remove("log locked", (SIGNAL_FUNC) sig_log_locked);
signal_remove("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
signal_remove("awaylog show", (SIGNAL_FUNC) sig_awaylog_show);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}

View file

@ -83,6 +83,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "log_list_footer", "", 0 },
{ "windowlog_file", "Window LOGFILE set to $0", 1, { 0 } },
{ "windowlog_file_logging", "Can't change window's logfile while log is on", 0 },
{ "no_away_msgs", "No new messages in awaylog", 1, { 0 } },
{ "away_msgs", "$1 new messages in awaylog:", 2, { 0, 1 } },
/* ---- */
{ NULL, "Misc", 0 },

View file

@ -57,6 +57,8 @@ enum {
IRCTXT_LOG_LIST_FOOTER,
IRCTXT_WINDOWLOG_FILE,
IRCTXT_WINDOWLOG_FILE_LOGGING,
IRCTXT_LOG_NO_AWAY_MSGS,
IRCTXT_LOG_AWAY_MSGS,
IRCTXT_FILL_6,