summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-13 20:28:53 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-13 20:28:53 +0000
commitebb5967a19ee6abdd70a965ff8ca127df47f136f (patch)
tree4b83ace97e2b2d855be8474612014d9af787215e /modules
parente13f9deabc82ad42abb8adf1ab8d416a764aeafc (diff)
- changed match() polarity. match() now returns 0 on match and 1 on non-match
This cleans up several places where function pointers of different matching functions like irccmp/strcmp/match are passed to other functions. - added improved collapse() to match.c git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1652 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules')
-rw-r--r--modules/core/m_message.c2
-rw-r--r--modules/core/m_server.c8
-rw-r--r--modules/core/m_squit.c2
-rw-r--r--modules/m_dline.c8
-rw-r--r--modules/m_encap.c2
-rw-r--r--modules/m_etrace.c2
-rw-r--r--modules/m_kline.c8
-rw-r--r--modules/m_links.c2
-rw-r--r--modules/m_locops.c2
-rw-r--r--modules/m_module.c2
-rw-r--r--modules/m_pong.c2
-rw-r--r--modules/m_resv.c8
-rw-r--r--modules/m_stats.c4
-rw-r--r--modules/m_testmask.c6
-rw-r--r--modules/m_trace.c10
-rw-r--r--modules/m_who.c14
-rw-r--r--modules/m_whois.c2
-rw-r--r--modules/m_xline.c8
18 files changed, 46 insertions, 46 deletions
diff --git a/modules/core/m_message.c b/modules/core/m_message.c
index e72126d..f84e1a3 100644
--- a/modules/core/m_message.c
+++ b/modules/core/m_message.c
@@ -888,7 +888,7 @@ find_userhost(char *user, char *host, int *count)
if (!IsClient(c2ptr)) /* something other than a client */
continue;
- if ((!host || match(host, c2ptr->host)) &&
+ if ((!host || !match(host, c2ptr->host)) &&
irccmp(user, c2ptr->username) == 0)
{
(*count)++;
diff --git a/modules/core/m_server.c b/modules/core/m_server.c
index a1eb5e7..39fecd5 100644
--- a/modules/core/m_server.c
+++ b/modules/core/m_server.c
@@ -274,14 +274,14 @@ ms_server(struct Client *client_p, struct Client *source_p,
* leaf. If so, close the link.
*/
DLINK_FOREACH(ptr, conf->leaf_list.head)
- if (match(ptr->data, name))
+ if (!match(ptr->data, name))
{
llined = 1;
break;
}
DLINK_FOREACH(ptr, conf->hub_list.head)
- if (match(ptr->data, name))
+ if (!match(ptr->data, name))
{
hlined = 1;
break;
@@ -471,14 +471,14 @@ ms_sid(struct Client *client_p, struct Client *source_p,
* leaf. If so, close the link.
*/
DLINK_FOREACH(ptr, conf->leaf_list.head)
- if (match(ptr->data, parv[1]))
+ if (!match(ptr->data, parv[1]))
{
llined = 1;
break;
}
DLINK_FOREACH(ptr, conf->hub_list.head)
- if (match(ptr->data, parv[1]))
+ if (!match(ptr->data, parv[1]))
{
hlined = 1;
break;
diff --git a/modules/core/m_squit.c b/modules/core/m_squit.c
index 7ba9b43..fb15b3c 100644
--- a/modules/core/m_squit.c
+++ b/modules/core/m_squit.c
@@ -71,7 +71,7 @@ mo_squit(struct Client *client_p, struct Client *source_p,
if (IsServer(p) || IsMe(p))
{
- if (match(server, p->name))
+ if (!match(server, p->name))
{
target_p = p;
break;
diff --git a/modules/m_dline.c b/modules/m_dline.c
index a3b520d..7fd3142 100644
--- a/modules/m_dline.c
+++ b/modules/m_dline.c
@@ -183,7 +183,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
dlhost, reason);
/* Allow ON to apply local kline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -296,7 +296,7 @@ ms_dline(struct Client *client_p, struct Client *source_p,
"DLINE %s %s %s :%s",
parv[1], parv[2], parv[3], parv[4]);
- if (!match(parv[1], me.name))
+ if (match(parv[1], me.name))
return;
tkline_time = valid_tkline(parv[2], TK_SECONDS);
@@ -430,7 +430,7 @@ mo_undline(struct Client *client_p, struct Client *source_p,
"UNDLINE %s %s", target_server, addr);
/* Allow ON to apply local unkline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -464,7 +464,7 @@ me_undline(struct Client *client_p, struct Client *source_p,
addr = parv[2];
- if (!IsClient(source_p) || !match(parv[1], me.name))
+ if (!IsClient(source_p) || match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
diff --git a/modules/m_encap.c b/modules/m_encap.c
index bb312d4..7d24112 100644
--- a/modules/m_encap.c
+++ b/modules/m_encap.c
@@ -82,7 +82,7 @@ ms_encap(struct Client *client_p, struct Client *source_p,
sendto_match_servs(source_p, parv[1], CAP_ENCAP,
"ENCAP %s", buffer);
- if (!match(parv[1], me.name))
+ if (match(parv[1], me.name))
return;
if ((mptr = find_command(parv[2])) == NULL)
diff --git a/modules/m_etrace.c b/modules/m_etrace.c
index b98d8e3..0cf5062 100644
--- a/modules/m_etrace.c
+++ b/modules/m_etrace.c
@@ -105,7 +105,7 @@ do_etrace(struct Client *source_p, int parc, char *parv[])
if (wilds)
{
- if (match(tname, target_p->name))
+ if (!match(tname, target_p->name))
report_this_status(source_p, target_p, full_etrace);
}
else
diff --git a/modules/m_kline.c b/modules/m_kline.c
index 4b9e573..05fd865 100644
--- a/modules/m_kline.c
+++ b/modules/m_kline.c
@@ -105,7 +105,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
user, host, reason);
/* Allow ON to apply local kline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -146,7 +146,7 @@ me_kline(struct Client *client_p, struct Client *source_p,
if (parc != 6 || EmptyString(parv[5]))
return;
- if (!match(parv[1], me.name))
+ if (match(parv[1], me.name))
return;
tkline_time = valid_tkline(parv[2], TK_SECONDS);
@@ -332,7 +332,7 @@ mo_unkline(struct Client *client_p,struct Client *source_p,
target_server, user, host);
/* Allow ON to apply local unkline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -377,7 +377,7 @@ me_unkline(struct Client *client_p, struct Client *source_p,
kuser = parv[2];
khost = parv[3];
- if (!IsClient(source_p) || !match(parv[1], me.name))
+ if (!IsClient(source_p) || match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
diff --git a/modules/m_links.c b/modules/m_links.c
index 0ad525b..631d1d1 100644
--- a/modules/m_links.c
+++ b/modules/m_links.c
@@ -62,7 +62,7 @@ do_links(struct Client *source_p, int parc, char *parv[])
if (!HasUMode(source_p, UMODE_OPER))
continue;
- if (!EmptyString(mask) && !match(mask, target_p->name))
+ if (!EmptyString(mask) && match(mask, target_p->name))
continue;
/*
diff --git a/modules/m_locops.c b/modules/m_locops.c
index 99fe736..fd40ef3 100644
--- a/modules/m_locops.c
+++ b/modules/m_locops.c
@@ -71,7 +71,7 @@ ms_locops(struct Client *client_p, struct Client *source_p,
sendto_server(client_p, CAP_CLUSTER, 0, "LOCOPS %s :%s",
parv[1], parv[2]);
- if (!IsClient(source_p) || !match(parv[1], me.name))
+ if (!IsClient(source_p) || match(parv[1], me.name))
return;
if (find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
diff --git a/modules/m_module.c b/modules/m_module.c
index 755810c..02a8567 100644
--- a/modules/m_module.c
+++ b/modules/m_module.c
@@ -217,7 +217,7 @@ mo_module(struct Client *client_p, struct Client *source_p,
{
modp = ptr->data;
- if (parc > 2 && !match(parv[2], modp->name))
+ if (!EmpyString(parv[2]) && match(parv[2], modp->name))
continue;
sendto_one(source_p, form_str(RPL_MODLIST), me.name, source_p->name,
diff --git a/modules/m_pong.c b/modules/m_pong.c
index c12a0a6..6d472f7 100644
--- a/modules/m_pong.c
+++ b/modules/m_pong.c
@@ -58,7 +58,7 @@ ms_pong(struct Client *client_p, struct Client *source_p,
* That being the case, we will route, but only for registered clients (a
* case can be made to allow them only from servers). -Shadowfax
*/
- if (!EmptyString(destination) && !match(destination, me.name) &&
+ if (!EmptyString(destination) && match(destination, me.name) &&
irccmp(destination, me.id))
{
if ((target_p = hash_find_client(destination)) ||
diff --git a/modules/m_resv.c b/modules/m_resv.c
index 1cfd0e4..785c068 100644
--- a/modules/m_resv.c
+++ b/modules/m_resv.c
@@ -74,7 +74,7 @@ mo_resv(struct Client *client_p, struct Client *source_p,
"RESV %s %s :%s",
target_server, resv, reason);
/* Allow ON to apply local resv as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -137,7 +137,7 @@ ms_resv(struct Client *client_p, struct Client *source_p,
"RESV %s %s :%s",
parv[1], parv[2], parv[3]);
- if (!IsClient(source_p) || !match(parv[1], me.name))
+ if (!IsClient(source_p) || match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
@@ -171,7 +171,7 @@ mo_unresv(struct Client *client_p, struct Client *source_p,
target_server, resv);
/* Allow ON to apply local unresv as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -196,7 +196,7 @@ ms_unresv(struct Client *client_p, struct Client *source_p,
"UNRESV %s %s",
parv[1], parv[2]);
- if (!IsClient(source_p) || !match(parv[1], me.name))
+ if (!IsClient(source_p) || match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
diff --git a/modules/m_stats.c b/modules/m_stats.c
index 952a685..e90d762 100644
--- a/modules/m_stats.c
+++ b/modules/m_stats.c
@@ -1174,7 +1174,7 @@ parse_stats_args(int parc, char *parv[], int *doall, int *wilds)
if (!irccmp(name, from))
*doall = 2;
- else if (match(name, from))
+ else if (!match(name, from))
*doall = 1;
*wilds = has_wildcards(name);
@@ -1206,7 +1206,7 @@ stats_L_list(struct Client *source_p,char *name, int doall, int wilds,
!(MyConnect(source_p) && HasUMode(source_p, UMODE_OPER)) &&
!HasUMode(target_p, UMODE_OPER) && (target_p != source_p))
continue;
- if (!doall && wilds && !match(name, target_p->name))
+ if (!doall && wilds && match(name, target_p->name))
continue;
if (!(doall || wilds) && irccmp(name, target_p->name))
continue;
diff --git a/modules/m_testmask.c b/modules/m_testmask.c
index 20da840..78d02d5 100644
--- a/modules/m_testmask.c
+++ b/modules/m_testmask.c
@@ -89,11 +89,11 @@ mo_testmask(struct Client *client_p, struct Client *source_p,
{
const struct Client *target_p = ptr->data;
- if (!IsClient(target_p) || !match(given_nick, target_p->name))
+ if (!IsClient(target_p) || match(given_nick, target_p->name))
continue;
- if (match(given_user, target_p->username))
- if (match(given_host, target_p->host) || match(given_host, target_p->sockhost))
+ if (!match(given_user, target_p->username))
+ if (!match(given_host, target_p->host) || !match(given_host, target_p->sockhost))
++count[!MyConnect(target_p)];
}
diff --git a/modules/m_trace.c b/modules/m_trace.c
index 6116a75..77982fa 100644
--- a/modules/m_trace.c
+++ b/modules/m_trace.c
@@ -120,7 +120,7 @@ mo_trace(struct Client *client_p, struct Client *source_p,
{
ac2ptr = ptr->data;
- if (match(tname, ac2ptr->name))
+ if (!match(tname, ac2ptr->name))
break;
else
ac2ptr = NULL;
@@ -190,7 +190,7 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
source_p->name, source_p->username,
source_p->host, source_p->servptr->name);
- if (match(tname, me.name))
+ if (!match(tname, me.name))
doall = 1;
else if (!MyClient(source_p) && !strcmp(tname, me.id))
{
@@ -244,7 +244,7 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
!(MyConnect(source_p) && HasUMode(source_p, UMODE_OPER)) &&
!HasUMode(target_p, UMODE_OPER) && (target_p != source_p))
continue;
- if (!doall && wilds && !match(tname, target_p->name))
+ if (!doall && wilds && match(tname, target_p->name))
continue;
if (!dow && irccmp(tname, target_p->name))
continue;
@@ -256,7 +256,7 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
{
target_p = ptr->data;
- if (!doall && wilds && !match(tname, target_p->name))
+ if (!doall && wilds && match(tname, target_p->name))
continue;
if (!dow && irccmp(tname, target_p->name))
continue;
@@ -269,7 +269,7 @@ do_actual_trace(struct Client *source_p, int parc, char *parv[])
{
target_p = ptr->data;
- if (!doall && wilds && !match(tname, target_p->name))
+ if (!doall && wilds && match(tname, target_p->name))
continue;
if (!dow && irccmp(tname, target_p->name))
continue;
diff --git a/modules/m_who.c b/modules/m_who.c
index fa20fcd..a030715 100644
--- a/modules/m_who.c
+++ b/modules/m_who.c
@@ -171,11 +171,11 @@ who_common_channel(struct Client *source_p, struct Channel *chptr,
assert(target_p->servptr != NULL);
if ((mask == NULL) ||
- match(mask, target_p->name) || match(mask, target_p->username) ||
- match(mask, target_p->host) ||
+ !match(mask, target_p->name) || !match(mask, target_p->username) ||
+ !match(mask, target_p->host) ||
((!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) &&
- match(mask, target_p->servptr->name)) ||
- match(mask, target_p->info))
+ !match(mask, target_p->servptr->name)) ||
+ !match(mask, target_p->info))
{
do_who(source_p, target_p, NULL, "");
@@ -250,9 +250,9 @@ who_global(struct Client *source_p, char *mask, int server_oper)
assert(target_p->servptr != NULL);
if (!mask ||
- match(mask, target_p->name) || match(mask, target_p->username) ||
- match(mask, target_p->host) || match(mask, target_p->servptr->name) ||
- match(mask, target_p->info))
+ !match(mask, target_p->name) || !match(mask, target_p->username) ||
+ !match(mask, target_p->host) || !match(mask, target_p->servptr->name) ||
+ !match(mask, target_p->info))
{
do_who(source_p, target_p, NULL, "");
diff --git a/modules/m_whois.c b/modules/m_whois.c
index 682fc10..601c148 100644
--- a/modules/m_whois.c
+++ b/modules/m_whois.c
@@ -212,7 +212,7 @@ global_whois(struct Client *source_p, const char *nick)
if (!IsClient(target_p))
continue;
- if (!match(nick, target_p->name))
+ if (match(nick, target_p->name))
continue;
assert(target_p->servptr != NULL);
diff --git a/modules/m_xline.c b/modules/m_xline.c
index 037fc17..a0fcdbc 100644
--- a/modules/m_xline.c
+++ b/modules/m_xline.c
@@ -100,7 +100,7 @@ mo_xline(struct Client *client_p, struct Client *source_p,
target_server, gecos, (int)tkline_time, reason);
/* Allow ON to apply local xline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -193,7 +193,7 @@ relay_xline(struct Client *source_p, char *parv[])
"XLINE %s %s %s :%s",
parv[1], parv[2], parv[3], parv[4]);
- if (!match(parv[1], me.name))
+ if (match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
@@ -248,7 +248,7 @@ mo_unxline(struct Client *client_p, struct Client *source_p,
"UNXLINE %s %s", target_server, gecos);
/* Allow ON to apply local unxline as well if it matches */
- if (!match(target_server, me.name))
+ if (match(target_server, me.name))
return;
}
else
@@ -277,7 +277,7 @@ ms_unxline(struct Client *client_p, struct Client *source_p,
sendto_match_servs(source_p, parv[1], CAP_CLUSTER,
"UNXLINE %s %s", parv[1], parv[2]);
- if (!match(parv[1], me.name))
+ if (match(parv[1], me.name))
return;
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,