summaryrefslogtreecommitdiff
path: root/src/plugins/plugin-api-info.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-03-14 14:11:06 +0100
committerSébastien Helleu <flashcode@flashtux.org>2021-03-14 14:11:06 +0100
commitbb41de8c0255887720f570e5f0594a497f9ea0a0 (patch)
treec9c53d02779c6ad36d5f36a1d931a18fe5a4c284 /src/plugins/plugin-api-info.c
parenta02a2fbaaea197df68630fefb2e6d1d2003de8dc (diff)
downloadweechat-bb41de8c0255887720f570e5f0594a497f9ea0a0.zip
api: add info "weechat_daemon"
Diffstat (limited to 'src/plugins/plugin-api-info.c')
-rw-r--r--src/plugins/plugin-api-info.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/plugin-api-info.c b/src/plugins/plugin-api-info.c
index 3d8c75aad..773742581 100644
--- a/src/plugins/plugin-api-info.c
+++ b/src/plugins/plugin-api-info.c
@@ -339,6 +339,27 @@ plugin_api_info_weechat_headless_cb (const void *pointer, void *data,
}
/*
+ * Returns WeeChat info "weechat_daemon".
+ */
+
+char *
+plugin_api_info_weechat_daemon_cb (const void *pointer, void *data,
+ const char *info_name,
+ const char *arguments)
+{
+ char value[32];
+
+ /* make C compiler happy */
+ (void) pointer;
+ (void) data;
+ (void) info_name;
+ (void) arguments;
+
+ snprintf (value, sizeof (value), "%d", weechat_daemon);
+ return strdup (value);
+}
+
+/*
* Returns WeeChat info "auto_connect".
*/
@@ -1804,6 +1825,10 @@ plugin_api_info_init ()
hook_info (NULL, "weechat_headless",
N_("1 if WeeChat is running headless"),
NULL, &plugin_api_info_weechat_headless_cb, NULL, NULL);
+ hook_info (NULL, "weechat_daemon",
+ N_("1 if WeeChat is running in daemon mode "
+ "(headless, in background)"),
+ NULL, &plugin_api_info_weechat_daemon_cb, NULL, NULL);
hook_info (NULL, "auto_connect",
N_("1 if automatic connection to servers is enabled, "
"0 if it has been disabled by the user (option \"-a\" or "