mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 18:53:13 +02:00
Prevent multiple spaces in a MODE message
This commit is contained in:
@@ -2771,3 +2771,5 @@ seen. gmtime warning still there
|
||||
reported by blotter45 (#0001400).
|
||||
- Made ./Config remember the libcurl directory, reported by ace (#0001505).
|
||||
- Fixed a problem with the snprintf() check, reported by virusx (#0001510).
|
||||
- Fixed a bug where multiple spaces could appear in a MODE message, reported by Airnike
|
||||
(#0001169).
|
||||
|
||||
+19
-6
@@ -1075,6 +1075,10 @@ void channel_modes(aClient *cptr, char *mbuf, char *pbuf, aChannel *chptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the trailing space from the parameters -- codemastr */
|
||||
if (*pbuf)
|
||||
pbuf[strlen(pbuf)-1]=0;
|
||||
|
||||
*mbuf++ = '\0';
|
||||
return;
|
||||
}
|
||||
@@ -1143,6 +1147,19 @@ static int send_mode_list(aClient *cptr, char *chname, TS creationtime, Member *
|
||||
return sent;
|
||||
}
|
||||
|
||||
/* A little kludge to prevent sending double spaces -- codemastr */
|
||||
static inline void send_channel_mode(aClient *cptr, char *from, aChannel *chptr)
|
||||
{
|
||||
if (*parabuf)
|
||||
sendto_one(cptr, ":%s %s %s %s %s %lu", from,
|
||||
(IsToken(cptr) ? TOK_MODE : MSG_MODE), chptr->chname,
|
||||
modebuf, parabuf, chptr->creationtime);
|
||||
else
|
||||
sendto_one(cptr, ":%s %s %s %s %lu", from,
|
||||
(IsToken(cptr) ? TOK_MODE : MSG_MODE), chptr->chname,
|
||||
modebuf, chptr->creationtime);
|
||||
}
|
||||
|
||||
/*
|
||||
* send "cptr" a full list of the modes for channel chptr.
|
||||
*/
|
||||
@@ -1159,9 +1176,7 @@ void send_channel_modes(aClient *cptr, aChannel *chptr)
|
||||
sent = send_mode_list(cptr, chptr->chname, chptr->creationtime,
|
||||
chptr->members, CHFL_CHANOP, 'o');
|
||||
if (!sent && chptr->creationtime)
|
||||
sendto_one(cptr, ":%s %s %s %s %s %lu", me.name,
|
||||
(IsToken(cptr) ? TOK_MODE : MSG_MODE), chptr->chname,
|
||||
modebuf, parabuf, chptr->creationtime);
|
||||
send_channel_mode(cptr, me.name, chptr);
|
||||
else if (modebuf[1] || *parabuf)
|
||||
sendmodeto_one(cptr, me.name,
|
||||
chptr->chname, modebuf, parabuf, chptr->creationtime);
|
||||
@@ -1173,9 +1188,7 @@ void send_channel_modes(aClient *cptr, aChannel *chptr)
|
||||
sent = send_mode_list(cptr, chptr->chname, chptr->creationtime,
|
||||
chptr->members, CHFL_HALFOP, 'h');
|
||||
if (!sent && chptr->creationtime)
|
||||
sendto_one(cptr, ":%s %s %s %s %s %lu", me.name,
|
||||
(IsToken(cptr) ? TOK_MODE : MSG_MODE), chptr->chname,
|
||||
modebuf, parabuf, chptr->creationtime);
|
||||
send_channel_mode(cptr, me.name, chptr);
|
||||
else if (modebuf[1] || *parabuf)
|
||||
sendmodeto_one(cptr, me.name,
|
||||
chptr->chname, modebuf, parabuf, chptr->creationtime);
|
||||
|
||||
Reference in New Issue
Block a user