summaryrefslogtreecommitdiff
path: root/src/core/expandos.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/expandos.c')
-rw-r--r--src/core/expandos.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/core/expandos.c b/src/core/expandos.c
index bed6c5eb..67aea837 100644
--- a/src/core/expandos.c
+++ b/src/core/expandos.c
@@ -57,7 +57,7 @@ static char *last_sent_msg, *last_sent_msg_body;
static char *last_privmsg_from, *last_public_from;
static char *sysname, *sysrelease, *sysarch;
-static const char *timestamp_format;
+static char *timestamp_format;
static int timestamp_seconds;
static time_t last_timestamp;
@@ -414,6 +414,13 @@ static char *expando_releasetime(SERVER_REC *server, void *item, int *free_ret)
return g_strdup_printf("%04d", IRSSI_VERSION_TIME);
}
+/* client abi */
+static char *expando_abiversion(SERVER_REC *server, void *item, int *free_ret)
+{
+ *free_ret = TRUE;
+ return g_strdup_printf("%d", IRSSI_ABI_VERSION);
+}
+
/* current working directory */
static char *expando_workdir(SERVER_REC *server, void *item, int *free_ret)
{
@@ -567,7 +574,9 @@ static int sig_timer(void)
static void read_settings(void)
{
- timestamp_format = settings_get_str("timestamp_format");
+ g_free_not_null(timestamp_format);
+ timestamp_format = g_strdup(settings_get_str("timestamp_format"));
+
timestamp_seconds =
strstr(timestamp_format, "%r") != NULL ||
strstr(timestamp_format, "%s") != NULL ||
@@ -656,6 +665,8 @@ void expandos_init(void)
"", EXPANDO_NEVER, NULL);
expando_create("versiontime", expando_releasetime,
"", EXPANDO_NEVER, NULL);
+ expando_create("abiversion", expando_abiversion,
+ "", EXPANDO_NEVER, NULL);
expando_create("W", expando_workdir, NULL);
expando_create("Y", expando_realname,
"window changed", EXPANDO_ARG_NONE,
@@ -708,14 +719,18 @@ void expandos_deinit(void)
g_free_not_null(char_expandos[n]);
g_hash_table_foreach_remove(expandos, free_expando, NULL);
- g_hash_table_destroy(expandos);
+ g_hash_table_destroy(expandos);
- g_free_not_null(last_sent_msg); g_free_not_null(last_sent_msg_body);
- g_free_not_null(last_privmsg_from); g_free_not_null(last_public_from);
- g_free_not_null(sysname); g_free_not_null(sysrelease);
- g_free_not_null(sysarch);
+ g_free_not_null(last_sent_msg);
+ g_free_not_null(last_sent_msg_body);
+ g_free_not_null(last_privmsg_from);
+ g_free_not_null(last_public_from);
+ g_free_not_null(sysname);
+ g_free_not_null(sysrelease);
+ g_free_not_null(sysarch);
+ g_free_not_null(timestamp_format);
- g_source_remove(timer_tag);
+ g_source_remove(timer_tag);
signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
signal_remove("message own_private", (SIGNAL_FUNC) sig_message_own_private);