1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-10 23:03:13 +02:00

Communicate server featureset (and changes) across server links.

Previously various information was only available for directly attached
servers, since it is communicated via PROTOCTL.
Now, we will also communicate information about leafs behind us.
IRCOps can use the /SINFO command to see these server features.
Services codes don't need to do anything, or at least are not expected
to do anything. They can still receive the information and do something
with it, of course...
Read the following technical documentation for full information,
as it will outline very specific rules for using the command S2S:
https://www.unrealircd.org/docs/Server_protocol:SINFO_command
This commit is contained in:
Bram Matthys
2019-03-23 17:56:59 +01:00
parent 335a7569bb
commit ab50bf2afc
18 changed files with 437 additions and 53 deletions
+60 -5
View File
@@ -216,7 +216,6 @@ char *num = NULL;
*/
void send_proto(aClient *cptr, ConfigItem_link *aconf)
{
char buf[1024];
Isupport *prefix = IsupportFind("PREFIX");
/* CAUTION: If adding a token to an existing PROTOCTL line below,
@@ -228,10 +227,8 @@ void send_proto(aClient *cptr, ConfigItem_link *aconf)
iConf.ban_setter_sync ? "SJSBY" : "");
/* Second line */
snprintf(buf, sizeof(buf), "CHANMODES=%s%s,%s%s,%s%s,%s%s PREFIX=%s NICKCHARS=%s SID=%s MLOCK TS=%ld EXTSWHOIS",
CHPAR1, EXPAR1, CHPAR2, EXPAR2, CHPAR3, EXPAR3, CHPAR4, EXPAR4, prefix->value, charsys_get_current_languages(), me.id, (long)TStime());
sendto_one(cptr, "PROTOCTL %s", buf);
sendto_one(cptr, "PROTOCTL CHANMODES=%s%s,%s%s,%s%s,%s%s USERMODES=%s BOOTED=%ld PREFIX=%s NICKCHARS=%s SID=%s MLOCK TS=%ld EXTSWHOIS",
CHPAR1, EXPAR1, CHPAR2, EXPAR2, CHPAR3, EXPAR3, CHPAR4, EXPAR4, umodestring, me.local->since, prefix->value, charsys_get_current_languages(), me.id, (long)TStime());
}
#ifndef IRCDTOTALVERSION
@@ -1386,3 +1383,61 @@ aClient *find_non_pending_net_duplicates(aClient *cptr)
return NULL;
}
void parse_chanmodes_protoctl(aClient *sptr, char *str)
{
char *modes, *p;
char copy[256];
strlcpy(copy, str, sizeof(copy));
modes = strtoken(&p, copy, ",");
if (modes)
{
safestrdup(sptr->serv->features.chanmodes[0], modes);
modes = strtoken(&p, NULL, ",");
if (modes)
{
safestrdup(sptr->serv->features.chanmodes[1], modes);
modes = strtoken(&p, NULL, ",");
if (modes)
{
safestrdup(sptr->serv->features.chanmodes[2], modes);
modes = strtoken(&p, NULL, ",");
if (modes)
{
safestrdup(sptr->serv->features.chanmodes[3], modes);
}
}
}
}
}
static char previous_langsinuse[512];
static int previous_langsinuse_ready = 0;
void charsys_check_for_changes(void)
{
char *langsinuse = charsys_get_current_languages();
/* already called by charsys_finish() */
safestrdup(me.serv->features.nickchars, langsinuse);
if (!previous_langsinuse_ready)
{
previous_langsinuse_ready = 1;
strlcpy(previous_langsinuse, langsinuse, sizeof(previous_langsinuse));
return; /* not booted yet. then we are done here. */
}
if (strcmp(langsinuse, previous_langsinuse))
{
ircd_log(LOG_ERROR, "Permitted nick characters changed at runtime: %s -> %s",
previous_langsinuse, langsinuse);
sendto_realops("Permitted nick characters changed at runtime: %s -> %s",
previous_langsinuse, langsinuse);
/* Broadcast change to all (locally connected) servers */
sendto_server(&me, 0, 0, "PROTOCTL NICKCHARS=%s", langsinuse);
}
strlcpy(previous_langsinuse, langsinuse, sizeof(previous_langsinuse));
}