1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-27 22:56:37 +02:00

Optimization: history: use HasCapabilityFast() instead of HasCapability()

This makes it so the capability bit lookup is done only once on module load
and not on each client JOIN.
This commit is contained in:
Bram Matthys
2025-09-29 17:17:20 +02:00
parent e42610ebba
commit 80a381c76a
+5 -1
View File
@@ -37,6 +37,9 @@ Cmode_t EXTMODE_HISTORY = 0L;
static cfgstruct cfg;
static cfgstruct test;
/* Externally looked up */
long CAP_CHATHISTORY_DRAFT = 0;
#define HistoryEnabled(channel) (channel->mode.mode & EXTMODE_HISTORY)
/* Forward declarations */
@@ -99,6 +102,7 @@ MOD_INIT()
MOD_LOAD()
{
long CAP_CHATHISTORY_DRAFT = ClientCapabilityBit("draft/chathistory");
CommandOverrideAdd(modinfo->handle, "MODE", 0, override_mode);
CommandOverrideAdd(modinfo->handle, "SVSMODE", 0, override_mode);
CommandOverrideAdd(modinfo->handle, "SVS2MODE", 0, override_mode);
@@ -688,7 +692,7 @@ int history_join(Client *client, Channel *channel, MessageTag *mtags)
/* No history-on-join for clients that implement CHATHISTORY,
* they will pull history themselves if they need it.
*/
if (HasCapability(client, "draft/chathistory") /*|| HasCapability(client, "chathistory")*/)
if (HasCapabilityFast(client, CAP_CHATHISTORY_DRAFT) /*|| HasCapabilityFast(client, CAP_CHATHISTORY)*/)
return 0;
if (MyUser(client) && can_receive_history(client))