unsigned long current_serial = 0L;
+struct Client *remote_rehash_oper_p;
+
/* send_linebuf()
*
* inputs - client to send to, linebuf to attach
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Max SendQ limit exceeded for %s: %u > %lu",
- get_server_name(to, HIDE_IP),
+ to->name,
rb_linebuf_len(&to->localClient->buf_sendq),
get_sendq(to));
get_sendq(to));
}
- if(IsClient(to))
- to->flags |= FLAGS_SENDQEX;
-
- dead_link(to);
+ dead_link(to, 1);
return -1;
}
else
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
{
- dead_link(to);
+ dead_link(to, 0);
return;
}
}
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((msptr->flags & CHFL_CHANOP) == 0)
+ 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()
*
rb_linebuf_donebuf(&linebuf);
}
+/* sendto_channel_local_with_capability()
+ *
+ * inputs - flags to send to, caps, negate caps, channel to send to, va_args
+ * outputs - message to local channel members
+ * side effects -
+ */
+void
+sendto_channel_local_with_capability(int type, int caps, int negcaps, struct Channel *chptr, const char *pattern, ...)
+{
+ va_list args;
+ buf_head_t linebuf;
+ struct membership *msptr;
+ struct Client *target_p;
+ rb_dlink_node *ptr;
+ rb_dlink_node *next_ptr;
+
+ rb_linebuf_newbuf(&linebuf);
+
+ va_start(args, pattern);
+ rb_linebuf_putmsg(&linebuf, pattern, &args, NULL);
+ va_end(args);
+
+ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
+ {
+ msptr = ptr->data;
+ target_p = msptr->client_p;
+
+ if(IsIOError(target_p) ||
+ !IsCapable(target_p, caps) ||
+ !NotCapable(target_p, negcaps))
+ continue;
+
+ if(type && ((msptr->flags & type) == 0))
+ continue;
+
+ _send_linebuf(target_p, &linebuf);
+ }
+
+ rb_linebuf_donebuf(&linebuf);
+}
+
/* sendto_channel_local_butone()
*
* inputs - flags to send to, channel to send to, va_args
* sendto_common_channels_local()
*
* inputs - pointer to client
+ * - capability mask
* - pattern to send
* output - NONE
* side effects - Sends a message to all people on local server who are
* used by m_nick.c and exit_one_client.
*/
void
-sendto_common_channels_local(struct Client *user, const char *pattern, ...)
+sendto_common_channels_local(struct Client *user, int cap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
target_p = msptr->client_p;
if(IsIOError(target_p) ||
- target_p->serial == current_serial)
+ target_p->serial == current_serial ||
+ !IsCapable(target_p, cap))
continue;
target_p->serial = current_serial;
* sendto_common_channels_local_butone()
*
* inputs - pointer to client
+ * - capability mask
* - pattern to send
* output - NONE
* side effects - Sends a message to all people on local server who are
* in same channel with user, except for user itself.
*/
void
-sendto_common_channels_local_butone(struct Client *user, const char *pattern, ...)
+sendto_common_channels_local_butone(struct Client *user, int cap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
target_p = msptr->client_p;
if(IsIOError(target_p) ||
- target_p->serial == current_serial)
+ target_p->serial == current_serial ||
+ !IsCapable(target_p, cap))
continue;
target_p->serial = current_serial;
":%s ENCAP * SNOTE %c :%s",
me.id, snobuf[1], buf);
}
+ else if (remote_rehash_oper_p != NULL)
+ {
+ /* rather a lot of copying around, oh well -- jilles */
+ va_start(args, pattern);
+ rb_vsnprintf(buf, sizeof(buf), pattern, args);
+ va_end(args);
+ rb_linebuf_putmsg(&linebuf, pattern, NULL,
+ ":%s NOTICE * :*** Notice -- %s", me.name, buf);
+ sendto_one_notice(remote_rehash_oper_p, ":*** Notice -- %s", buf);
+ }
else
{
va_start(args, pattern);