* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id: send.c 3520 2007-06-30 22:15:35Z jilles $
*/
#include "stdinc.h"
#include "channel.h"
#include "class.h"
#include "client.h"
-#include "common.h"
#include "match.h"
#include "ircd.h"
#include "numeric.h"
static void
linebuf_put_msgvbuf(struct MsgBuf *msgbuf, buf_head_t *linebuf, unsigned int capmask, const char *pattern, va_list *va)
{
- char buf[IRCD_BUFSIZE];
+ char buf[BUFSIZE];
rb_linebuf_newbuf(linebuf);
msgbuf_unparse_prefix(buf, sizeof buf, msgbuf, capmask);
rb_linebuf_putprefix(linebuf, pattern, va, buf);
-}
+}
/* linebuf_put_msgbuf
*
msgbuf->origin = buf;
msgbuf->cmd = cmd;
- if (IsPerson(from))
+ if (from != NULL && IsPerson(from))
snprintf(buf, sizeof buf, "%s!%s@%s", from->name, from->username, from->host);
- else
+ else if (from != NULL)
rb_strlcpy(buf, from->name, sizeof buf);
+ else
+ rb_strlcpy(buf, me.name, sizeof buf);
hdata.client = from;
hdata.arg1 = msgbuf;
}
rb_linebuf_donebuf(&linebuf);
-
}
/* sendto_channel_flags()
sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
struct Channel *chptr, const char *pattern, ...)
{
- char buf[IRCD_BUFSIZE];
+ char buf[BUFSIZE];
va_list args;
buf_head_t rb_linebuf_local;
buf_head_t rb_linebuf_id;
struct membership *msptr;
rb_dlink_node *ptr;
rb_dlink_node *next_ptr;
- unsigned int current_capmask = 0;
+ int current_capmask = 0;
struct MsgBuf msgbuf;
rb_linebuf_newbuf(&rb_linebuf_local);
msptr = ptr->data;
target_p = msptr->client_p;
- if(IsIOError(target_p->from) || target_p->from == one)
+ if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one))
+ continue;
+
+ if(MyClient(source_p) && !IsCapable(source_p, CLICAP_ECHO_MESSAGE) && target_p == one)
continue;
if(type && ((msptr->flags & type) == 0))
msptr = ptr->data;
target_p = msptr->client_p;
- if(IsIOError(target_p->from) || target_p->from == one)
+ if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one))
+ continue;
+
+ if(MyClient(source_p) && !IsCapable(source_p, CLICAP_ECHO_MESSAGE) && target_p == one)
continue;
if((msptr->flags & CHFL_CHANOP) == 0)