[svn] Merge old trunk r2065,r2067:

channel_modes(): get rid of the trailing space
also make the *pbuf check work like it should
(don't call IsMember another time if we already
gave one parameter)
simplify a bit more, update comments
This commit is contained in:
jilles 2007-04-26 16:01:16 -07:00
parent 4636e5cbac
commit f1e35c19a7
3 changed files with 24 additions and 15 deletions

View File

@ -1,3 +1,12 @@
jilles 2007/04/25 15:22:28 UTC (20070425-3426)
Log:
webirc bugfix
Changes: Modified:
+1 -1 trunk/extensions/m_webirc.c (File Modified)
jilles 2007/04/25 15:21:34 UTC (20070425-3424) jilles 2007/04/25 15:21:34 UTC (20070425-3424)
Log: Log:
chghost: refuse spoofs which are empty or start with a colon chghost: refuse spoofs which are empty or start with a colon

View File

@ -1 +1 @@
#define SERNO "20070425-3424" #define SERNO "20070425-3426"

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
* *
* $Id: channel.c 3259 2007-03-15 18:09:08Z jilles $ * $Id: channel.c 3432 2007-04-26 23:01:16Z jilles $
*/ */
#include "stdinc.h" #include "stdinc.h"
@ -1110,9 +1110,8 @@ static const struct mode_letter
* *
* inputs - pointer to channel * inputs - pointer to channel
* - pointer to client * - pointer to client
* output - NONE * output - string with simple modes
* side effects - write the "simple" list of channel modes for channel * side effects - result from previous calls overwritten
* chptr onto buffer mbuf with the parameters in pbuf.
* *
* Stolen from ShadowIRCd 4 --nenolod * Stolen from ShadowIRCd 4 --nenolod
*/ */
@ -1137,38 +1136,39 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
{ {
*mbuf++ = 'l'; *mbuf++ = 'l';
if(IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p)) if(!IsClient(client_p) || IsMember(client_p, chptr))
pbuf += ircsprintf(pbuf, "%d ", chptr->mode.limit); pbuf += ircsprintf(pbuf, " %d", chptr->mode.limit);
} }
if(*chptr->mode.key) if(*chptr->mode.key)
{ {
*mbuf++ = 'k'; *mbuf++ = 'k';
if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += ircsprintf(pbuf, "%s ", chptr->mode.key); pbuf += ircsprintf(pbuf, " %s", chptr->mode.key);
} }
if(chptr->mode.join_num) if(chptr->mode.join_num)
{ {
*mbuf++ = 'j'; *mbuf++ = 'j';
if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += ircsprintf(pbuf, "%d:%d ", chptr->mode.join_num, pbuf += ircsprintf(pbuf, " %d:%d", chptr->mode.join_num,
chptr->mode.join_time); chptr->mode.join_time);
} }
if(*chptr->mode.forward && (ConfigChannel.use_forward || IsServer(client_p) || IsMe(client_p))) if(*chptr->mode.forward && (ConfigChannel.use_forward || !IsClient(client_p)))
{ {
*mbuf++ = 'f'; *mbuf++ = 'f';
if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += ircsprintf(pbuf, "%s ", chptr->mode.forward); pbuf += ircsprintf(pbuf, " %s", chptr->mode.forward);
} }
*mbuf = '\0'; *mbuf = '\0';
ircsprintf(final, "%s %s", buf1, buf2); strlcpy(final, buf1, sizeof final);
strlcat(final, buf2, sizeof final);
return final; return final;
} }