diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-01-18 20:17:59 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-01-18 20:17:59 +0000 |
commit | 1471e45206d10c9f5e13b753da7b2fb063241e5b (patch) | |
tree | 892e0de480cc31775de51b919cc6ea0ea56af6e0 /modules | |
parent | 942b67fa8f75c27e31b1036ccd74d9e4f8348d05 (diff) |
- m_gline.c:ms_gline(): improved readability. Removed extranous IsClient() test.
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2862 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules')
-rw-r--r-- | modules/m_gline.c | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/modules/m_gline.c b/modules/m_gline.c index a739772..b429351 100644 --- a/modules/m_gline.c +++ b/modules/m_gline.c @@ -300,6 +300,7 @@ ms_gline(struct Client *client_p, struct Client *source_p, const char *reason = NULL; /* reason for "victims" demise */ const char *user = NULL; const char *host = NULL; /* user and host of GLINE "victim" */ + const char *p = NULL; if (!IsClient(source_p)) return 0; @@ -320,49 +321,43 @@ ms_gline(struct Client *client_p, struct Client *source_p, ":%s GLINE %s %s :%s", source_p->name, user, host, reason); - if (ConfigFileEntry.glines) - { - if (!valid_wild_card(source_p, 1, 2, user, host)) - return 0; + if (!ConfigFileEntry.glines) + return 0; - if (IsClient(source_p)) - { - const char *p = NULL; + if (!valid_wild_card(source_p, 1, 2, user, host)) + return 0; - if ((p = strchr(host, '/'))) - { - int bitlen = strtol(++p, NULL, 10); - int min_bitlen = strchr(host, ':') ? ConfigFileEntry.gline_min_cidr6 : + if ((p = strchr(host, '/'))) + { + int bitlen = strtol(++p, NULL, 10); + int min_bitlen = strchr(host, ':') ? ConfigFileEntry.gline_min_cidr6 : ConfigFileEntry.gline_min_cidr; - if (bitlen < min_bitlen) - { - sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "%s is requesting a GLINE with a CIDR mask < %d for [%s@%s] [%s]", - get_oper_name(source_p), min_bitlen, - user, host, reason); - return 0; - } - } + if (bitlen < min_bitlen) + { + sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, + "%s is requesting a GLINE with a CIDR mask < %d for [%s@%s] [%s]", + get_oper_name(source_p), min_bitlen, + user, host, reason); + return 0; } + } - /* If at least 3 opers agree this user should be G lined then do it */ - if (check_majority(source_p, user, host, reason, GLINE_PENDING_ADD_TYPE) == - GLINE_ALREADY_VOTED) - { - sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "oper or server has already voted"); - return 0; - } - - sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, - "%s requesting G-Line for [%s@%s] [%s]", - get_oper_name(source_p), - user, host, reason); - ilog(LOG_TYPE_GLINE, "G-Line for [%s@%s] [%s] requested by %s", - user, host, reason, get_oper_name(source_p)); + /* If at least 3 opers agree this user should be G lined then do it */ + if (check_majority(source_p, user, host, reason, GLINE_PENDING_ADD_TYPE) == + GLINE_ALREADY_VOTED) + { + sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, + "oper or server has already voted"); + return 0; } + sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, + "%s requesting G-Line for [%s@%s] [%s]", + get_oper_name(source_p), + user, host, reason); + ilog(LOG_TYPE_GLINE, "G-Line for [%s@%s] [%s] requested by %s", + user, host, reason, get_oper_name(source_p)); return 0; } |