X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/dbbe21ed037a7395b671724c0a7c04c90cbaa10d..d25c6eb1b223d1a0993dde9a28c97ef95e54bceb:/src/send.c diff --git a/src/send.c b/src/send.c index 0da51d3..db98c57 100644 --- a/src/send.c +++ b/src/send.c @@ -85,10 +85,7 @@ _send_linebuf(struct Client *to, buf_head_t *linebuf) get_sendq(to)); } - if(IsClient(to)) - to->flags |= FLAGS_SENDQEX; - - dead_link(to); + dead_link(to, 1); return -1; } else @@ -200,7 +197,7 @@ send_queued(struct Client *to) if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) { - dead_link(to); + dead_link(to, 0); return; } } @@ -531,6 +528,93 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p, rb_linebuf_donebuf(&rb_linebuf_id); } +/* sendto_channel_flags() + * + * inputs - server not to send to, flags needed, source, channel, va_args + * outputs - message is sent to channel members + * side effects - + */ +void +sendto_channel_opmod(struct Client *one, struct Client *source_p, + struct Channel *chptr, const char *command, + const char *text) +{ + buf_head_t rb_linebuf_local; + buf_head_t rb_linebuf_old; + buf_head_t rb_linebuf_new; + struct Client *target_p; + struct membership *msptr; + rb_dlink_node *ptr; + rb_dlink_node *next_ptr; + + rb_linebuf_newbuf(&rb_linebuf_local); + rb_linebuf_newbuf(&rb_linebuf_old); + rb_linebuf_newbuf(&rb_linebuf_new); + + current_serial++; + + if(IsServer(source_p)) + rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL, + ":%s %s %s :%s", + source_p->name, command, chptr->chname, text); + else + rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL, + ":%s!%s@%s %s %s :%s", + source_p->name, source_p->username, + source_p->host, command, chptr->chname, text); + + if (chptr->mode.mode & MODE_MODERATED) + rb_linebuf_putmsg(&rb_linebuf_old, NULL, NULL, + ":%s %s %s :%s", + use_id(source_p), command, chptr->chname, text); + else + rb_linebuf_putmsg(&rb_linebuf_old, NULL, NULL, + ":%s NOTICE @%s :<%s:%s> %s", + use_id(source_p->servptr), chptr->chname, + source_p->name, chptr->chname, text); + rb_linebuf_putmsg(&rb_linebuf_new, NULL, NULL, + ":%s %s =%s :%s", + use_id(source_p), command, chptr->chname, text); + + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head) + { + msptr = ptr->data; + target_p = msptr->client_p; + + if(IsIOError(target_p->from) || target_p->from == one) + continue; + + if(!is_any_op(msptr)) + continue; + + if(IsDeaf(target_p)) + continue; + + if(!MyClient(target_p)) + { + /* if we've got a specific type, target must support + * CHW.. --fl + */ + if(NotCapable(target_p->from, CAP_CHW)) + continue; + + if(target_p->from->serial != current_serial) + { + if (IsCapable(target_p->from, CAP_EOPMOD)) + send_linebuf_remote(target_p, source_p, &rb_linebuf_new); + else + send_linebuf_remote(target_p, source_p, &rb_linebuf_old); + target_p->from->serial = current_serial; + } + } + else + _send_linebuf(target_p, &rb_linebuf_local); + } + + rb_linebuf_donebuf(&rb_linebuf_local); + rb_linebuf_donebuf(&rb_linebuf_old); + rb_linebuf_donebuf(&rb_linebuf_new); +} /* sendto_channel_local() * @@ -562,7 +646,12 @@ sendto_channel_local(int type, struct Channel *chptr, const char *pattern, ...) if(IsIOError(target_p)) continue; - if(type && ((msptr->flags & type) == 0)) + if(type == ONLY_OPERS) + { + if(!IsOper(target_p)) + continue; + } + else if(type && ((msptr->flags & type) == 0)) continue; _send_linebuf(target_p, &linebuf);