Add capability parameter to sendto_common_channels_local() and sendto_common_channels_local_butone().

This commit is contained in:
William Pitcock 2010-12-15 22:55:05 -06:00
parent 0b2b2f7753
commit 7a948bdaa7
6 changed files with 16 additions and 12 deletions

View file

@ -63,8 +63,8 @@ extern void sendto_channel_opmod(struct Client *one, struct Client *source_p,
extern void sendto_channel_local(int type, struct Channel *, const char *, ...) AFP(3, 4); extern void sendto_channel_local(int type, struct Channel *, const char *, ...) AFP(3, 4);
extern void sendto_channel_local_butone(struct Client *, int type, struct Channel *, const char *, ...) AFP(4, 5); extern void sendto_channel_local_butone(struct Client *, int type, struct Channel *, const char *, ...) AFP(4, 5);
extern void sendto_common_channels_local(struct Client *, const char *, ...) AFP(2, 3); extern void sendto_common_channels_local(struct Client *, int cap, const char *, ...) AFP(3, 4);
extern void sendto_common_channels_local_butone(struct Client *, const char *, ...) AFP(2, 3); extern void sendto_common_channels_local_butone(struct Client *, int cap, const char *, ...) AFP(3, 4);
extern void sendto_match_butone(struct Client *, struct Client *, extern void sendto_match_butone(struct Client *, struct Client *,

View file

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

View file

@ -217,7 +217,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
target_p->name, parv[2], target_p->username, target_p->name, parv[2], target_p->username,
target_p->host); target_p->host);
sendto_common_channels_local(target_p, ":%s!%s@%s NICK :%s", sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
target_p->name, target_p->username, target_p->name, target_p->username,
target_p->host, parv[2]); target_p->host, parv[2]);

View file

@ -1140,7 +1140,7 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli
if(IsOper(source_p)) if(IsOper(source_p))
rb_dlinkFindDestroy(source_p, &oper_list); rb_dlinkFindDestroy(source_p, &oper_list);
sendto_common_channels_local(source_p, ":%s!%s@%s QUIT :%s", sendto_common_channels_local(source_p, NOCAPS, ":%s!%s@%s QUIT :%s",
source_p->name, source_p->name,
source_p->username, source_p->host, comment); source_p->username, source_p->host, comment);

View file

@ -1429,7 +1429,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
vsnprintf(reason, 255, format, ap); vsnprintf(reason, 255, format, ap);
va_end(ap); va_end(ap);
sendto_common_channels_local_butone(target_p, ":%s!%s@%s QUIT :%s", sendto_common_channels_local_butone(target_p, NOCAPS, ":%s!%s@%s QUIT :%s",
target_p->name, target_p->username, target_p->host, target_p->name, target_p->username, target_p->host,
reason); reason);
@ -1471,7 +1471,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
} }
else if(changed_case) else if(changed_case)
{ {
sendto_common_channels_local(target_p, ":%s!%s@%s NICK :%s", sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
target_p->name, target_p->username, target_p->name, target_p->username,
target_p->host, nick); target_p->host, nick);
} }

View file

@ -702,6 +702,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
* sendto_common_channels_local() * sendto_common_channels_local()
* *
* inputs - pointer to client * inputs - pointer to client
* - capability mask
* - pattern to send * - pattern to send
* output - NONE * output - NONE
* side effects - Sends a message to all people on local server who are * side effects - Sends a message to all people on local server who are
@ -709,7 +710,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
* used by m_nick.c and exit_one_client. * used by m_nick.c and exit_one_client.
*/ */
void 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; va_list args;
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -740,7 +741,8 @@ sendto_common_channels_local(struct Client *user, const char *pattern, ...)
target_p = msptr->client_p; target_p = msptr->client_p;
if(IsIOError(target_p) || if(IsIOError(target_p) ||
target_p->serial == current_serial) target_p->serial == current_serial ||
!IsCapable(target_p, cap))
continue; continue;
target_p->serial = current_serial; target_p->serial = current_serial;
@ -761,13 +763,14 @@ sendto_common_channels_local(struct Client *user, const char *pattern, ...)
* sendto_common_channels_local_butone() * sendto_common_channels_local_butone()
* *
* inputs - pointer to client * inputs - pointer to client
* - capability mask
* - pattern to send * - pattern to send
* output - NONE * output - NONE
* side effects - Sends a message to all people on local server who are * side effects - Sends a message to all people on local server who are
* in same channel with user, except for user itself. * in same channel with user, except for user itself.
*/ */
void 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; va_list args;
rb_dlink_node *ptr; rb_dlink_node *ptr;
@ -800,7 +803,8 @@ sendto_common_channels_local_butone(struct Client *user, const char *pattern, ..
target_p = msptr->client_p; target_p = msptr->client_p;
if(IsIOError(target_p) || if(IsIOError(target_p) ||
target_p->serial == current_serial) target_p->serial == current_serial ||
!IsCapable(target_p, cap))
continue; continue;
target_p->serial = current_serial; target_p->serial = current_serial;