From 7a948bdaa742cd403b5398d6a356632d5196ea4c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 15 Dec 2010 22:55:05 -0600 Subject: [PATCH] Add capability parameter to sendto_common_channels_local() and sendto_common_channels_local_butone(). --- include/send.h | 4 ++-- modules/core/m_nick.c | 4 ++-- modules/m_services.c | 2 +- src/client.c | 2 +- src/s_user.c | 4 ++-- src/send.c | 12 ++++++++---- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/send.h b/include/send.h index 9e5c16b6..f9fbd38f 100644 --- a/include/send.h +++ b/include/send.h @@ -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_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_butone(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 *, int cap, const char *, ...) AFP(3, 4); extern void sendto_match_butone(struct Client *, struct Client *, diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 4deeed60..6361b2c6 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -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); /* 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); /* 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); } - 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); if(source_p->user) diff --git a/modules/m_services.c b/modules/m_services.c index a74695c7..03436edb 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -217,7 +217,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p, target_p->name, parv[2], target_p->username, 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->host, parv[2]); diff --git a/src/client.c b/src/client.c index 144e3288..892c88cd 100644 --- a/src/client.c +++ b/src/client.c @@ -1140,7 +1140,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, ":%s!%s@%s QUIT :%s", + sendto_common_channels_local(source_p, NOCAPS, ":%s!%s@%s QUIT :%s", source_p->name, source_p->username, source_p->host, comment); diff --git a/src/s_user.c b/src/s_user.c index 4782304e..3e7fa710 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -1429,7 +1429,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, ":%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, reason); @@ -1471,7 +1471,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, ":%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->host, nick); } diff --git a/src/send.c b/src/send.c index 4aebff91..a0099762 100644 --- a/src/send.c +++ b/src/send.c @@ -702,6 +702,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr, * 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 @@ -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. */ 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; @@ -740,7 +741,8 @@ sendto_common_channels_local(struct Client *user, const char *pattern, ...) 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; @@ -761,13 +763,14 @@ sendto_common_channels_local(struct Client *user, const char *pattern, ...) * 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; @@ -800,7 +803,8 @@ sendto_common_channels_local_butone(struct Client *user, const char *pattern, .. 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;