diff --git a/include/client.h b/include/client.h index 8af1709..22b7662 100644 --- a/include/client.h +++ b/include/client.h @@ -53,6 +53,8 @@ struct Blacklist; #define IDLEN 10 +#define TGCHANGE_NUM 10 /* how many targets we keep track of */ + /* * pre declare structs */ @@ -255,7 +257,7 @@ struct LocalUser struct AuthRequest *auth_request; /* target change stuff */ - uint32_t targets[10]; /* targets were aware of (fnv32(use_id(target_p))) */ + uint32_t targets[TGCHANGE_NUM]; /* targets were aware of (fnv32(use_id(target_p))) */ unsigned int targinfo[2]; /* cyclic array, no in use */ time_t target_last; /* last time we cleared a slot */ diff --git a/modules/core/m_message.c b/modules/core/m_message.c index 66ddace..5af579f 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -642,9 +642,9 @@ msg_channel_flags(int p_or_n, const char *command, struct Client *client_p, command, c, chptr->chname, text); } -#define PREV_FREE_TARGET(x) ((FREE_TARGET(x) == 0) ? 9 : FREE_TARGET(x) - 1) -#define PREV_TARGET(i) ((i == 0) ? i = 9 : --i) -#define NEXT_TARGET(i) ((i == 9) ? i = 0 : ++i) +#define PREV_FREE_TARGET(x) ((FREE_TARGET(x) == 0) ? TGCHANGE_NUM - 1 : FREE_TARGET(x) - 1) +#define PREV_TARGET(i) ((i == 0) ? i = TGCHANGE_NUM - 1 : --i) +#define NEXT_TARGET(i) ((i == TGCHANGE_NUM - 1) ? i = 0 : ++i) static void expire_tgchange(void *unused) @@ -715,7 +715,7 @@ add_target(struct Client *source_p, struct Client *target_p) source_p->localClient->target_last = rb_current_time(); } /* cant clear any, full target list */ - else if(USED_TARGETS(source_p) == 10) + else if(USED_TARGETS(source_p) == TGCHANGE_NUM) { ServerStats.is_tgch++; add_tgchange(source_p->sockhost);