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(&linebuf);
}
-/* sendto_channel_local_butone()
+/* sendto_channel_local_with_capability()
*
- * inputs - flags to send to, channel to send to, va_args
- * - user to ignore when sending
+ * 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_butone(struct Client *one, int type, struct Channel *chptr, const char *pattern, ...)
+sendto_channel_local_with_capability(int type, int caps, int negcaps, struct Channel *chptr, const char *pattern, ...)
{
va_list args;
buf_head_t linebuf;
msptr = ptr->data;
target_p = msptr->client_p;
- if(target_p == one)
- continue;
-
- if(IsIOError(target_p))
+ if(IsIOError(target_p) ||
+ !IsCapable(target_p, caps) ||
+ !NotCapable(target_p, negcaps))
continue;
if(type && ((msptr->flags & type) == 0))
rb_linebuf_donebuf(&linebuf);
}
-/*
- * sendto_common_channels_local()
+/* sendto_channel_local_butone()
*
- * inputs - pointer to client
- * - pattern to send
- * output - NONE
- * side effects - Sends a message to all people on local server who are
- * in same channel with user.
- * used by m_nick.c and exit_one_client.
+ * inputs - flags to send to, channel to send to, va_args
+ * - user to ignore when sending
+ * outputs - message to local channel members
+ * side effects -
*/
void
-sendto_common_channels_local(struct Client *user, const char *pattern, ...)
+sendto_channel_local_butone(struct Client *one, int type, 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_dlink_node *uptr;
- rb_dlink_node *next_uptr;
- struct Channel *chptr;
- struct Client *target_p;
- struct membership *msptr;
- struct membership *mscptr;
- buf_head_t linebuf;
-
- rb_linebuf_newbuf(&linebuf);
+
+ rb_linebuf_newbuf(&linebuf);
+
va_start(args, pattern);
rb_linebuf_putmsg(&linebuf, pattern, &args, NULL);
va_end(args);
- ++current_serial;
-
- RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head)
+ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
{
- mscptr = ptr->data;
- chptr = mscptr->chptr;
+ msptr = ptr->data;
+ target_p = msptr->client_p;
- RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head)
- {
- msptr = uptr->data;
- target_p = msptr->client_p;
+ if(target_p == one)
+ continue;
- if(IsIOError(target_p) ||
- target_p->serial == current_serial)
- continue;
+ if(IsIOError(target_p))
+ continue;
- target_p->serial = current_serial;
- send_linebuf(target_p, &linebuf);
- }
- }
+ if(type && ((msptr->flags & type) == 0))
+ continue;
- /* this can happen when the user isnt in any channels, but we still
- * need to send them the data, ie a nick change
- */
- if(MyConnect(user) && (user->serial != current_serial))
- send_linebuf(user, &linebuf);
+ _send_linebuf(target_p, &linebuf);
+ }
rb_linebuf_donebuf(&linebuf);
}
/*
- * sendto_common_channels_local_with_capability()
+ * sendto_common_channels_local()
*
* inputs - pointer to client
- * - capability
+ * - 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_with_capability(struct Client *user, int capability, const char *pattern, ...)
+sendto_common_channels_local(struct Client *user, int cap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
msptr = uptr->data;
target_p = msptr->client_p;
- if(!IsCapable(target_p, capability))
- continue;
-
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, ...)
-{
- va_list args;
- rb_dlink_node *ptr;
- rb_dlink_node *next_ptr;
- rb_dlink_node *uptr;
- rb_dlink_node *next_uptr;
- struct Channel *chptr;
- struct Client *target_p;
- struct membership *msptr;
- struct membership *mscptr;
- buf_head_t linebuf;
-
- rb_linebuf_newbuf(&linebuf);
- va_start(args, pattern);
- rb_linebuf_putmsg(&linebuf, pattern, &args, NULL);
- va_end(args);
-
- ++current_serial;
- /* Skip them -- jilles */
- user->serial = current_serial;
-
- RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head)
- {
- mscptr = ptr->data;
- chptr = mscptr->chptr;
-
- RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head)
- {
- msptr = uptr->data;
- target_p = msptr->client_p;
-
- if(IsIOError(target_p) ||
- target_p->serial == current_serial)
- continue;
-
- target_p->serial = current_serial;
- send_linebuf(target_p, &linebuf);
- }
- }
-
- rb_linebuf_donebuf(&linebuf);
-}
-
-/*
- * sendto_common_channels_local_with_capability_butone()
- *
- * inputs - pointer to client
- * - capability
- * - pattern to send
- * output - NONE
- * side effects - Sends a message to all people on local server who are
- * in same channel with user, except the user themselves.
- * used by m_nick.c and exit_one_client.
- */
-void
-sendto_common_channels_local_with_capability_butone(struct Client *user, int capability, const char *pattern, ...)
+sendto_common_channels_local_butone(struct Client *user, int cap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
msptr = uptr->data;
target_p = msptr->client_p;
- if(!IsCapable(target_p, capability))
- continue;
-
if(IsIOError(target_p) ||
- target_p->serial == current_serial)
+ target_p->serial == current_serial ||
+ !IsCapable(target_p, cap))
continue;
target_p->serial = current_serial;
}
}
- /* this can happen when the user isnt in any channels, but we still
- * need to send them the data, ie a nick change
- */
- if(MyConnect(user) && (user->serial != current_serial))
- send_linebuf(user, &linebuf);
-
rb_linebuf_donebuf(&linebuf);
}
-
/* sendto_match_butone()
*
* inputs - server not to send to, source, mask, type of mask, va_args