From bb41de8c0255887720f570e5f0594a497f9ea0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 14 Mar 2021 14:11:06 +0100 Subject: api: add info "weechat_daemon" --- src/plugins/plugin-api-info.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/plugins') 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 @@ -338,6 +338,27 @@ plugin_api_info_weechat_headless_cb (const void *pointer, void *data, return strdup (value); } +/* + * 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 " -- cgit v1.2.3