send: add negation argument to sendto_common_channels_local() and friends

This commit is contained in:
William Pitcock 2015-11-19 22:43:45 -06:00
parent 8e9e22b4d3
commit 583f064fef
7 changed files with 21 additions and 17 deletions

View File

@ -68,8 +68,8 @@ extern void sendto_channel_local_with_capability(int type, int caps, int negcaps
extern void sendto_channel_local_with_capability_butone(struct Client *, int type, int caps, int negcaps, struct Channel *,
const char *, ...) AFP(6, 7);
extern void sendto_common_channels_local(struct Client *, int cap, const char *, ...) AFP(3, 4);
extern void sendto_common_channels_local_butone(struct Client *, int cap, const char *, ...) AFP(3, 4);
extern void sendto_common_channels_local(struct Client *, int cap, int negcap, const char *, ...) AFP(4, 5);
extern void sendto_common_channels_local_butone(struct Client *, int cap, int negcap, const char *, ...) AFP(4, 5);
extern void sendto_match_butone(struct Client *, struct Client *,

View File

@ -712,7 +712,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
source_p->name, nick, source_p->username, source_p->host);
/* send the nick change to the users channels */
sendto_common_channels_local(source_p, NOCAPS, ":%s!%s@%s NICK :%s",
sendto_common_channels_local(source_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
source_p->name, source_p->username, source_p->host, nick);
/* send the nick change to servers.. */
@ -773,7 +773,7 @@ change_remote_nick(struct Client *client_p, struct Client *source_p,
monitor_signoff(source_p);
}
sendto_common_channels_local(source_p, NOCAPS, ":%s!%s@%s NICK :%s",
sendto_common_channels_local(source_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
source_p->name, source_p->username, source_p->host, nick);
if(source_p->user)

View File

@ -85,7 +85,7 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p
":%s AWAY", use_id(source_p));
free_away(source_p);
sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY",
sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%s@%s AWAY",
source_p->name, source_p->username, source_p->host);
}
if(MyConnect(source_p))
@ -119,7 +119,7 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p
sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
":%s AWAY :%s", use_id(source_p), source_p->user->away);
sendto_common_channels_local_butone(source_p,
CLICAP_AWAY_NOTIFY,
CLICAP_AWAY_NOTIFY, NOCAPS,
":%s!%s@%s AWAY :%s",
source_p->name,
source_p->username,

View File

@ -134,7 +134,7 @@ me_su(struct Client *client_p, struct Client *source_p,
else
rb_strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser));
sendto_common_channels_local_butone(target_p, CLICAP_ACCOUNT_NOTIFY, ":%s!%s@%s ACCOUNT %s",
sendto_common_channels_local_butone(target_p, CLICAP_ACCOUNT_NOTIFY, NOCAPS, ":%s!%s@%s ACCOUNT %s",
target_p->name, target_p->username, target_p->host,
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser);
@ -258,7 +258,7 @@ doit:
target_p->name, parv[2], target_p->username,
target_p->host);
sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
sendto_common_channels_local(target_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
target_p->name, target_p->username,
target_p->host, parv[2]);

View File

@ -666,7 +666,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time)
invalidate_bancache_user(client_p);
sendto_common_channels_local(client_p, NOCAPS, ":%s!%s@%s NICK :%s",
sendto_common_channels_local(client_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
client_p->name, client_p->username, client_p->host, nick);
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s NICK %s :%ld",
use_id(client_p), nick, (long) client_p->tsinfo);
@ -1185,7 +1185,7 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli
if(IsOper(source_p))
rb_dlinkFindDestroy(source_p, &oper_list);
sendto_common_channels_local(source_p, NOCAPS, ":%s!%s@%s QUIT :%s",
sendto_common_channels_local(source_p, NOCAPS, NOCAPS, ":%s!%s@%s QUIT :%s",
source_p->name,
source_p->username, source_p->host, comment);

View File

@ -1431,7 +1431,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
vsnprintf(reason, 255, format, ap);
va_end(ap);
sendto_common_channels_local_butone(target_p, NOCAPS, ":%s!%s@%s QUIT :%s",
sendto_common_channels_local_butone(target_p, NOCAPS, NOCAPS, ":%s!%s@%s QUIT :%s",
target_p->name, target_p->username, target_p->host,
reason);
@ -1474,7 +1474,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
/* Resend away message to away-notify enabled clients. */
if (target_p->user->away)
sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%s@%s AWAY :%s",
nick, user, host,
target_p->user->away);
@ -1486,7 +1486,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
}
else if(changed_case)
{
sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
sendto_common_channels_local(target_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
target_p->name, target_p->username,
target_p->host, nick);

View File

@ -778,6 +778,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
*
* inputs - pointer to client
* - capability mask
* - negated capability mask
* - pattern to send
* output - NONE
* side effects - Sends a message to all people on local server who are
@ -785,7 +786,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
* used by m_nick.c and exit_one_client.
*/
void
sendto_common_channels_local(struct Client *user, int cap, const char *pattern, ...)
sendto_common_channels_local(struct Client *user, int cap, int negcap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
@ -817,7 +818,8 @@ sendto_common_channels_local(struct Client *user, int cap, const char *pattern,
if(IsIOError(target_p) ||
target_p->serial == current_serial ||
!IsCapable(target_p, cap))
!IsCapable(target_p, cap) ||
!NotCapable(target_p, negcap))
continue;
target_p->serial = current_serial;
@ -839,13 +841,14 @@ sendto_common_channels_local(struct Client *user, int cap, const char *pattern,
*
* inputs - pointer to client
* - capability mask
* - negated 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, int cap, const char *pattern, ...)
sendto_common_channels_local_butone(struct Client *user, int cap, int negcap, const char *pattern, ...)
{
va_list args;
rb_dlink_node *ptr;
@ -879,7 +882,8 @@ sendto_common_channels_local_butone(struct Client *user, int cap, const char *pa
if(IsIOError(target_p) ||
target_p->serial == current_serial ||
!IsCapable(target_p, cap))
!IsCapable(target_p, cap) ||
!NotCapable(target_p, negcap))
continue;
target_p->serial = current_serial;