From 1179dc8a73104eb97bfa78a5edd147c2be570b32 Mon Sep 17 00:00:00 2001 From: pk910 Date: Wed, 26 Dec 2012 08:54:17 +0100 Subject: [PATCH] fixed propagation of user mode changes (user should ALWAYS be notified) --- ircd/s_user.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ircd/s_user.c b/ircd/s_user.c index 6014487..e5d17b9 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -948,6 +948,8 @@ void send_umode_out(struct Client *cptr, struct Client *sptr, } if (cptr && MyUser(cptr)) send_umode(cptr, sptr, old, ALL_UMODES, 0); + if (sptr && sptr != cptr && MyUser(sptr)) + send_umode(sptr, sptr, old, ALL_UMODES, 0); } @@ -1396,6 +1398,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, ClearOverrideCC(sptr); if (!FlagHas(&setflags, FLAG_KEEPCONN_ENABLED) && IsKeepConnEnabled(sptr) && !HasPriv(sptr, PRIV_SET_KEEPCONN)) ClearKeepConnEnabled(sptr); + if(keepconn && !HasPriv(sptr, PRIV_SET_KEEPCONN)) + keepconn = NULL; /* Opers are able to fake the webirc usermode only if FEAT_FAKE_WEBIRC is true. */ if (!FlagHas(&setflags, FLAG_WEBIRC) && IsWebIRC(sptr) && !(feature_bool(FEAT_FAKE_WEBIRC) && IsOper(sptr))) ClearWebIRC(sptr); @@ -1458,6 +1462,9 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, } if (!FlagHas(&setflags, FLAG_KEEPCONN_ENABLED) && IsKeepConnEnabled(sptr)) { sptr->keepconn = atoi(keepconn); + } else if(keepconn && sptr->keepconn != atoi(keepconn)) { + FlagClr(&setflags, FLAG_KEEPCONN_ENABLED); + sptr->keepconn = atoi(keepconn); } if (IsRegistered(sptr)) { @@ -1586,7 +1593,7 @@ int send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old, int flag; char *m; int what = MODE_NULL; - int add_fakehost = 0, add_account = 0; + int add_fakehost = 0, add_account = 0, add_keepconn = 0; /* * Build a string in umodeBuf to represent the change in the user's @@ -1613,6 +1620,10 @@ int send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old, if(!serv_modes || FlagHas(old, flag)) continue; add_fakehost = 1; } + + if(flag == FLAG_KEEPCONN_ENABLED) { + add_keepconn = 1; + } switch (sendset) { @@ -1678,6 +1689,11 @@ int send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old, while((*m++ = *t++)) ; /* Empty loop */ --m; /* back up over previous nul-termination */ } + + if(add_keepconn) { + *m++ = ' '; + m += sprintf(m, "%u", sptr->keepconn); + } *m = '\0'; if (*umodeBuf && cptr) -- 2.20.1