Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#loadmodule "extensions/m_sendbans";
#loadmodule "extensions/m_shedding";
#loadmodule "extensions/m_webirc";
#loadmodule "extensions/network_icon";
#loadmodule "extensions/no_kill_services";
#loadmodule "extensions/no_locops";
#loadmodule "extensions/no_oper_invis";
Expand Down Expand Up @@ -1535,6 +1536,9 @@ general {
* requires extensions/drain to be loaded.
*/
drain_reason = "This server is not accepting connections.";

/* network_icon_url: add a URL to an icon representing the network. */
#network_icon_url = "https://example.org/icon.png";
};

modules {
Expand Down
1 change: 1 addition & 0 deletions extensions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extension_LTLIBRARIES = \
m_sendbans.la \
m_shedding.la \
m_webirc.la \
network_icon.la \
no_kill_services.la \
no_locops.la \
no_oper_invis.la \
Expand Down
1 change: 1 addition & 0 deletions extensions/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extension_modules = [
'm_sendbans',
'm_shedding',
'm_webirc',
'network_icon',
'no_kill_services',
'no_locops',
'no_oper_invis',
Expand Down
71 changes: 71 additions & 0 deletions extensions/network_icon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Solanum: a slightly advanced ircd
* network_icon.c: Advertise a network icon.
*
* Copyright (C) 2026 internet-catte
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/

#include "stdinc.h"
#include "modules.h"
#include "newconf.h"
#include "supported.h"

static const char network_icon_desc[] = "Provides the draft/ICON ISUPPORT token for clients that support showing a network icon";

static int modinit(void);
static void moddeinit(void);
static void network_icon_init_conf(void *data);
static void network_icon_conf_set_url(void *data);

static char *network_icon_url = NULL;

mapi_hfn_list_av1 network_icon_hfnlist[] = {
{ "conf_read_start", network_icon_init_conf },
};

DECLARE_MODULE_AV2(network_icon, modinit, moddeinit, NULL, NULL, network_icon_hfnlist, NULL, NULL, network_icon_desc);

static int
modinit(void)
{
add_conf_item("general", "network_icon_url", CF_QSTRING, network_icon_conf_set_url);
add_isupport("draft/ICON", isupport_stringptr, &network_icon_url);
return 0;
}

static void
moddeinit(void)
{
delete_isupport("draft/ICON");
rb_free(network_icon_url);
remove_conf_item("general", "network_icon_url");
}

static void
network_icon_init_conf(void *data)
{
rb_free(network_icon_url);
network_icon_url = NULL;
}

static void
network_icon_conf_set_url(void *data)
{
rb_free(network_icon_url);
network_icon_url = rb_strdup(data);
}