* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: channel.c 3259 2007-03-15 18:09:08Z jilles $
+ * $Id: channel.c 3580 2007-11-07 23:45:14Z jilles $
*/
#include "stdinc.h"
{
struct Channel *chptr;
chptr = BlockHeapAlloc(channel_heap);
- DupNString(chptr->chname, chname, CHANNELLEN);
+ DupString(chptr->chname, chname);
return (chptr);
}
{
struct Ban *bptr;
bptr = BlockHeapAlloc(ban_heap);
- DupNString(bptr->banstr, banstr, BANLEN);
- DupNString(bptr->who, who, BANLEN);
+ DupString(bptr->banstr, banstr);
+ DupString(bptr->who, who);
return (bptr);
}
free_channel_list(&chptr->banlist);
free_channel_list(&chptr->exceptlist);
free_channel_list(&chptr->invexlist);
+ free_channel_list(&chptr->quietlist);
/* Free the topic */
free_topic(chptr);
{
/* Its already known as a possible spambot */
if(name != NULL)
- sendto_realops_snomask(SNO_BOTS, L_ALL,
+ sendto_realops_snomask(SNO_BOTS, L_NETWIDE,
"User %s (%s@%s) trying to join %s is a possible spambot",
source_p->name,
source_p->username, source_p->orighost, name);
else
- sendto_realops_snomask(SNO_BOTS, L_ALL,
+ sendto_realops_snomask(SNO_BOTS, L_NETWIDE,
"User %s (%s@%s) is a possible spambot",
source_p->name,
source_p->username, source_p->orighost);
}
}
-static const struct mode_letter
-{
- const unsigned int mode;
- const unsigned char letter;
-} flags[] =
+const struct mode_letter chmode_flags[] =
{
{MODE_INVITEONLY, 'i'},
{MODE_MODERATED, 'm'},
*
* inputs - pointer to channel
* - pointer to client
- * output - NONE
- * side effects - write the "simple" list of channel modes for channel
- * chptr onto buffer mbuf with the parameters in pbuf.
+ * output - string with simple modes
+ * side effects - result from previous calls overwritten
*
* Stolen from ShadowIRCd 4 --nenolod
*/
*mbuf++ = '+';
*pbuf = '\0';
- for (i = 0; flags[i].mode; ++i)
- if(chptr->mode.mode & flags[i].mode)
- *mbuf++ = flags[i].letter;
+ for (i = 0; chmode_flags[i].mode; ++i)
+ if(chptr->mode.mode & chmode_flags[i].mode)
+ *mbuf++ = chmode_flags[i].letter;
if(chptr->mode.limit)
{
*mbuf++ = 'l';
- if(IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p))
- pbuf += ircsprintf(pbuf, "%d ", chptr->mode.limit);
+ if(!IsClient(client_p) || IsMember(client_p, chptr))
+ pbuf += ircsprintf(pbuf, " %d", chptr->mode.limit);
}
if(*chptr->mode.key)
{
*mbuf++ = 'k';
- if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p))
- pbuf += ircsprintf(pbuf, "%s ", chptr->mode.key);
+ if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
+ pbuf += ircsprintf(pbuf, " %s", chptr->mode.key);
}
if(chptr->mode.join_num)
{
*mbuf++ = 'j';
- if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p))
- pbuf += ircsprintf(pbuf, "%d:%d ", chptr->mode.join_num,
+ if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
+ pbuf += ircsprintf(pbuf, " %d:%d", chptr->mode.join_num,
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';
- if(*pbuf || IsMember(client_p, chptr) || IsServer(client_p) || IsMe(client_p))
- pbuf += ircsprintf(pbuf, "%s ", chptr->mode.forward);
+ if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
+ pbuf += ircsprintf(pbuf, " %s", chptr->mode.forward);
}
*mbuf = '\0';
- ircsprintf(final, "%s %s", buf1, buf2);
+ strlcpy(final, buf1, sizeof final);
+ strlcat(final, buf2, sizeof final);
return final;
}