Fix generate tag from address (servers.c)

The tag will be created from the domain name when the domain name begins with 'irc.'.
In this case, part of the address will be used to the point or the remaining part as a tag.
For example, irc.it-hobby.km.ua to will be make tag 'it-hobby'.
[08:22] [Lastick(+i)] [4:it-hobby/#samp(+Pnt)]
This commit is contained in:
Baytuch 2024-06-17 08:11:12 +03:00
parent 4dee3f3c81
commit cbbc41f1ab

View File

@ -78,6 +78,10 @@ static char *server_create_address_tag(const char *address)
/* try to generate a reasonable server tag */
if (strchr(address, '.') == NULL) {
start = end = NULL;
} else if (g_ascii_strncasecmp(address, "irc.", 4) == 0) {
/* irc.it-hobby.km.ua -> it-hobby, irc.karbo-labs.pp.ua -> karbo-labs */
end = strchr(address + 3 + 1, '.');
start = address + 3;
} else if (g_ascii_strncasecmp(address, "irc", 3) == 0 ||
g_ascii_strncasecmp(address, "chat", 4) == 0) {
/* irc-2.cs.hut.fi -> hut, chat.bt.net -> bt */