diff --git a/src/plugins/relay/CMakeLists.txt b/src/plugins/relay/CMakeLists.txt index 39537fa2a..0103e3d19 100644 --- a/src/plugins/relay/CMakeLists.txt +++ b/src/plugins/relay/CMakeLists.txt @@ -34,6 +34,7 @@ set(RELAY_SRC relay-raw.c relay-raw.h relay-remote.c relay-remote.h relay-server.c relay-server.h + relay-theme.c relay-theme.h relay-upgrade.c relay-upgrade.h relay-websocket.c relay-websocket.h # irc relay diff --git a/src/plugins/relay/relay-theme.c b/src/plugins/relay/relay-theme.c new file mode 100644 index 000000000..4d120e856 --- /dev/null +++ b/src/plugins/relay/relay-theme.c @@ -0,0 +1,73 @@ +/* + * SPDX-FileCopyrightText: 2026 Sébastien Helleu + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +/* relay contribution to built-in themes. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-theme.h" + + +const char *relay_theme_light[][2] = +{ + { "relay.color.status_auth_failed", "magenta" }, + { "relay.color.status_authenticating", "202" }, + { "relay.color.status_connecting", "default" }, + { "relay.color.status_disconnected", "red" }, + { "relay.color.text_selected", "default" }, + { NULL, NULL }, +}; + +void +relay_theme_register (const char *name, const char *entries[][2]) +{ + struct t_hashtable *overrides; + int i; + + if (!name || !entries) + return; + + overrides = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, NULL); + if (!overrides) + return; + + for (i = 0; entries[i][0]; i++) + weechat_hashtable_set (overrides, entries[i][0], entries[i][1]); + + weechat_theme_register (name, overrides); + + weechat_hashtable_free (overrides); +} + +void +relay_theme_init (void) +{ + relay_theme_register ("light", relay_theme_light); +} diff --git a/src/plugins/relay/relay-theme.h b/src/plugins/relay/relay-theme.h new file mode 100644 index 000000000..eb81b9115 --- /dev/null +++ b/src/plugins/relay/relay-theme.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2026 Sébastien Helleu + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#ifndef WEECHAT_PLUGIN_RELAY_THEME_H +#define WEECHAT_PLUGIN_RELAY_THEME_H + +extern void relay_theme_init (void); + +#endif /* WEECHAT_PLUGIN_RELAY_THEME_H */ diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index 16dfcc481..c170aaa29 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -38,6 +38,7 @@ #include "relay-raw.h" #include "relay-remote.h" #include "relay-server.h" +#include "relay-theme.h" #include "relay-upgrade.h" @@ -376,6 +377,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) relay_config_read (); + relay_theme_init (); + relay_network_init (); relay_command_init ();