summaryrefslogtreecommitdiff
path: root/src/fe-common/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-common/core')
-rw-r--r--src/fe-common/core/fe-log.c21
-rw-r--r--src/fe-common/core/module-formats.c2
-rw-r--r--src/fe-common/core/module-formats.h2
3 files changed, 25 insertions, 0 deletions
diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c
index 6dcf7e40..116821c3 100644
--- a/src/fe-common/core/fe-log.c
+++ b/src/fe-common/core/fe-log.c
@@ -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);
}
diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c
index abbf0f46..2371db45 100644
--- a/src/fe-common/core/module-formats.c
+++ b/src/fe-common/core/module-formats.c
@@ -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 },
diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h
index 137c718f..cc38d4ae 100644
--- a/src/fe-common/core/module-formats.h
+++ b/src/fe-common/core/module-formats.h
@@ -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,