mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-07 16:23:13 +02:00
Fix various channel modes showing up as duplicate in 004 and 005.
Yeah I forgot we hardcoded these somewhere, now they are gone.. poof!
This commit is contained in:
@@ -183,10 +183,6 @@ extern MODVAR unsigned char char_atribs[];
|
||||
#define CHPAR1 "beIqa"
|
||||
#endif /* PREFIX_AQ */
|
||||
|
||||
#define CHPAR2 "k"
|
||||
#define CHPAR3 "l"
|
||||
#define CHPAR4 "psmntir"
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Used to display a string to the GUI interface.
|
||||
|
||||
+33
-3
@@ -104,22 +104,52 @@ static void make_cmodestr(void)
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
int sort_cmodes_cmp(char x, char y)
|
||||
{
|
||||
if (x < y)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sort_cmodes(void)
|
||||
{
|
||||
int i, j;
|
||||
Cmode swap;
|
||||
|
||||
/* This sorts the Channelmode_Table alphabetically,
|
||||
* that is: lower characters first (a-z) and then upper (A-Z)
|
||||
*/
|
||||
for (i = 0; i < EXTCMODETABLESZ; i++)
|
||||
{
|
||||
for (j = i+1; j < EXTCMODETABLESZ; j++)
|
||||
{
|
||||
if (sort_cmodes_cmp(Channelmode_Table[i].mode, Channelmode_Table[j].mode))
|
||||
{
|
||||
memcpy(&swap, &Channelmode_Table[j], sizeof(Cmode));
|
||||
memcpy(&Channelmode_Table[j], &Channelmode_Table[i], sizeof(Cmode));
|
||||
memcpy(&Channelmode_Table[i], &swap, sizeof(Cmode));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Check for changes - if any are detected, we broadcast the change */
|
||||
void extcmodes_check_for_changes(void)
|
||||
{
|
||||
char chanmodes[256];
|
||||
ISupport *isup;
|
||||
|
||||
//sort_cmodes();
|
||||
make_cmodestr();
|
||||
make_extcmodestr();
|
||||
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR1, EXPAR1);
|
||||
safe_strdup(me.server->features.chanmodes[0], chanmodes);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR2, EXPAR2);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s", EXPAR2);
|
||||
safe_strdup(me.server->features.chanmodes[1], chanmodes);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR3, EXPAR3);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s", EXPAR3);
|
||||
safe_strdup(me.server->features.chanmodes[2], chanmodes);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s%s", CHPAR4, EXPAR4);
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s", EXPAR4);
|
||||
safe_strdup(me.server->features.chanmodes[3], chanmodes);
|
||||
|
||||
ircsnprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ void isupport_init(void)
|
||||
ISupportSet(NULL, "CASEMAPPING", "ascii");
|
||||
ISupportSet(NULL, "NETWORK", NETWORK_NAME_005);
|
||||
ISupportSetFmt(NULL, "CHANMODES",
|
||||
CHPAR1 "%s," CHPAR2 "%s," CHPAR3 "%s," CHPAR4 "%s",
|
||||
CHPAR1 "%s,%s,%s,%s",
|
||||
EXPAR1, EXPAR2, EXPAR3, EXPAR4);
|
||||
ISupportSet(NULL, "PREFIX", CHPFIX);
|
||||
ISupportSet(NULL, "CHANTYPES", "#");
|
||||
|
||||
+1
-1
@@ -9476,6 +9476,7 @@ void start_listeners(void)
|
||||
/* Actually use configuration */
|
||||
void config_run(void)
|
||||
{
|
||||
extcmodes_check_for_changes();
|
||||
start_listeners();
|
||||
free_all_config_resources();
|
||||
}
|
||||
@@ -10766,7 +10767,6 @@ int rehash_internal(Client *client)
|
||||
unload_all_unused_caps();
|
||||
unload_all_unused_history_backends();
|
||||
// unload_all_unused_moddata(); -- this will crash
|
||||
extcmodes_check_for_changes();
|
||||
umodes_check_for_changes();
|
||||
charsys_check_for_changes();
|
||||
loop.rehashing = 0;
|
||||
|
||||
@@ -1089,7 +1089,6 @@ int InitUnrealIRCd(int argc, char *argv[])
|
||||
me.local->fd = -1;
|
||||
SetMe(&me);
|
||||
make_server(&me);
|
||||
extcmodes_check_for_changes();
|
||||
umodes_check_for_changes();
|
||||
charsys_check_for_changes();
|
||||
clicap_init();
|
||||
|
||||
+2
-2
@@ -214,8 +214,8 @@ void send_proto(Client *client, ConfigItem_link *aconf)
|
||||
ClientCapabilityFindReal("message-tags") ? "MTAGS" : "");
|
||||
|
||||
/* Second line */
|
||||
sendto_one(client, NULL, "PROTOCTL CHANMODES=%s%s,%s%s,%s%s,%s%s USERMODES=%s BOOTED=%lld PREFIX=%s SID=%s MLOCK TS=%lld EXTSWHOIS",
|
||||
CHPAR1, EXPAR1, CHPAR2, EXPAR2, CHPAR3, EXPAR3, CHPAR4, EXPAR4,
|
||||
sendto_one(client, NULL, "PROTOCTL CHANMODES=%s%s,%s,%s,%s USERMODES=%s BOOTED=%lld PREFIX=%s SID=%s MLOCK TS=%lld EXTSWHOIS",
|
||||
CHPAR1, EXPAR1, EXPAR2, EXPAR3, EXPAR4,
|
||||
umodestring, (long long)me.local->fake_lag, prefix->value,
|
||||
me.id, (long long)TStime());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user