Skip to content

Commit

Permalink
Fix MODE broadcast being screwed up if sender was a server and it con…
Browse files Browse the repository at this point in the history
…tained a timestamp.

Someone changed an %s %lu to %s%lu so ':se.rv.er MODE #test +o Dummy 1444444443' became
':se.rv.er MODE #test +o Dummy1444444443' (missing space).
Re-indent code a little..
  • Loading branch information
syzop committed Jan 2, 2016
1 parent 7610fbc commit b7a1d50
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/modules/m_mode.c
Expand Up @@ -529,19 +529,27 @@ DLLFUNC void _do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, c

sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
sptr->name, chptr->chname, modebuf, parabuf);

if (IsServer(sptr) && sendts != -1)
sendto_server(cptr, 0, 0, ":%s MODE %s %s%s %s%lu",
sptr->name, chptr->chname, isbounce ? "&" : "",
modebuf, parabuf, sendts);
else if (samode && IsMe(sptr)) /* SAMODE is a special case: always send a TS of 0 (omitting TS==desynch) */
sendto_server(cptr, 0, 0, ":%s MODE %s %s %s 0",
sptr->name, chptr->chname, modebuf, parabuf);
else
sendto_server(cptr, 0, 0, ":%s MODE %s %s%s %s",
sptr->name, chptr->chname, isbounce ? "&" : "",
modebuf, parabuf);
/* tell them it's not a timestamp, in case the last param
** is a number. */
{
sendto_server(cptr, 0, 0,
":%s MODE %s %s%s %s %lu",
sptr->name, chptr->chname, isbounce ? "&" : "", modebuf, parabuf, sendts);
} else
if (samode && IsMe(sptr))
{
/* SAMODE is a special case: always send a TS of 0 (omitting TS==desynch) */
sendto_server(cptr, 0, 0,
":%s MODE %s %s %s 0",
sptr->name, chptr->chname, modebuf, parabuf);
} else
{
sendto_server(cptr, 0, 0,
":%s MODE %s %s%s %s",
sptr->name, chptr->chname, isbounce ? "&" : "", modebuf, parabuf);
/* tell them it's not a timestamp, in case the last param
** is a number. */
}

if (MyConnect(sptr))
RunHook7(HOOKTYPE_LOCAL_CHANMODE, cptr, sptr, chptr, modebuf, parabuf, sendts, samode);
Expand Down

0 comments on commit b7a1d50

Please sign in to comment.