1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-30 05:36:38 +02:00

Fix another reputation issue: reputation not showing in WHOIS when

a remote user has just connected (could take up to 5 minutes) and
a fix required for previous commit for connthrottle.
This commit is contained in:
Bram Matthys
2019-05-11 14:15:52 +02:00
parent 7a7266bc2f
commit 3a0d8fc06c
+9 -5
View File
@@ -107,7 +107,7 @@ void config_setdefaults(void);
CMD_FUNC(reputation_cmd);
CMD_FUNC(reputationunperm);
int reputation_whois(aClient *sptr, aClient *acptr);
int reputation_handshake(aClient *sptr);
int reputation_set_on_connect(aClient *sptr);
int reputation_pre_lconnect(aClient *sptr);
int reputation_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs);
int reputation_config_run(ConfigFile *cf, ConfigEntry *ce, int type);
@@ -154,8 +154,9 @@ MOD_INIT(reputation)
config_setdefaults();
HookAdd(modinfo->handle, HOOKTYPE_CONFIGRUN, 0, reputation_config_run);
HookAdd(modinfo->handle, HOOKTYPE_WHOIS, 0, reputation_whois);
HookAdd(modinfo->handle, HOOKTYPE_HANDSHAKE, 0, reputation_handshake);
HookAdd(modinfo->handle, HOOKTYPE_HANDSHAKE, 0, reputation_set_on_connect);
HookAdd(modinfo->handle, HOOKTYPE_PRE_LOCAL_CONNECT, 2000000000, reputation_pre_lconnect); /* (prio: last) */
HookAdd(modinfo->handle, HOOKTYPE_REMOTE_CONNECT, -1000000000, reputation_set_on_connect); /* (prio: near-first) */
CommandAdd(ModInf.handle, "REPUTATION", reputation_cmd, MAXPARA, M_USER|M_SERVER);
CommandAdd(ModInf.handle, "REPUTATIONUNPERM", reputationunperm, MAXPARA, M_USER|M_SERVER);
return MOD_SUCCESS;
@@ -495,10 +496,12 @@ ReputationEntry *find_reputation_entry(char *ip)
return NULL;
}
/** Called when the user connects (very early, just after the
* TCP/IP connection has been established, before any data).
/** Called when the user connects.
* Locally: very early, just after the TCP/IP connection has
* been established, before any data.
* Remote user: early in the HOOKTYPE_REMOTE_CONNECT hook.
*/
int reputation_handshake(aClient *acptr)
int reputation_set_on_connect(aClient *acptr)
{
char *ip = acptr->ip;
ReputationEntry *e;
@@ -511,6 +514,7 @@ int reputation_handshake(aClient *acptr)
Reputation(acptr) = e->score; /* SET MODDATA */
}
}
return 0;
}