mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
Add rfc1459:: case compliance namespace.
This commit is contained in:
parent
3f6d567285
commit
f112111e51
40 changed files with 606 additions and 520 deletions
|
@ -59,7 +59,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
}
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1]))
|
||||
if(!rfc1459::is_chan_prefix(parv[1][0]) || !check_channel_name(parv[1]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME), parv[1]);
|
||||
|
|
|
@ -42,15 +42,15 @@ strip_colour(char *string)
|
|||
switch (*c)
|
||||
{
|
||||
case 3:
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
{
|
||||
c++;
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
c++;
|
||||
if(c[1] == ',' && IsDigit(c[2]))
|
||||
if(c[1] == ',' && rfc1459::is_digit(c[2]))
|
||||
{
|
||||
c += 2;
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
@ -95,15 +95,15 @@ strip_unprintable(char *string)
|
|||
switch (*c)
|
||||
{
|
||||
case 3:
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
{
|
||||
c++;
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
c++;
|
||||
if(c[1] == ',' && IsDigit(c[2]))
|
||||
if(c[1] == ',' && rfc1459::is_digit(c[2]))
|
||||
{
|
||||
c += 2;
|
||||
if(IsDigit(c[1]))
|
||||
if(rfc1459::is_digit(c[1]))
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,72 +71,12 @@ extern int ircncmp(const char *s1, const char *s2, int n);
|
|||
#define EmptyString(x) ((x) == NULL || *(x) == '\0')
|
||||
#define CheckEmpty(x) EmptyString(x) ? "" : x
|
||||
|
||||
/*
|
||||
* character macros
|
||||
*/
|
||||
extern const unsigned char irctolower_tab[];
|
||||
#define irctolower(c) (irctolower_tab[(unsigned char)(c)])
|
||||
|
||||
extern const unsigned char irctoupper_tab[];
|
||||
#define irctoupper(c) (irctoupper_tab[(unsigned char)(c)])
|
||||
|
||||
extern const unsigned int CharAttrs[];
|
||||
|
||||
#define PRINT_C 0x001
|
||||
#define CNTRL_C 0x002
|
||||
#define ALPHA_C 0x004
|
||||
#define PUNCT_C 0x008
|
||||
#define DIGIT_C 0x010
|
||||
#define SPACE_C 0x020
|
||||
#define NICK_C 0x040
|
||||
#define CHAN_C 0x080
|
||||
#define KWILD_C 0x100
|
||||
#define CHANPFX_C 0x200
|
||||
#define USER_C 0x400
|
||||
#define HOST_C 0x800
|
||||
#define NONEOS_C 0x1000
|
||||
#define SERV_C 0x2000
|
||||
#define EOL_C 0x4000
|
||||
#define MWILD_C 0x8000
|
||||
#define LET_C 0x10000 /* an actual letter */
|
||||
#define FCHAN_C 0x20000 /* a 'fake' channel char */
|
||||
|
||||
#define IsHostChar(c) (CharAttrs[(unsigned char)(c)] & HOST_C)
|
||||
#define IsUserChar(c) (CharAttrs[(unsigned char)(c)] & USER_C)
|
||||
#define IsChanPrefix(c) (CharAttrs[(unsigned char)(c)] & CHANPFX_C)
|
||||
#define IsChanChar(c) (CharAttrs[(unsigned char)(c)] & CHAN_C)
|
||||
#define IsFakeChanChar(c) (CharAttrs[(unsigned char)(c)] & FCHAN_C)
|
||||
#define IsKWildChar(c) (CharAttrs[(unsigned char)(c)] & KWILD_C)
|
||||
#define IsMWildChar(c) (CharAttrs[(unsigned char)(c)] & MWILD_C)
|
||||
#define IsNickChar(c) (CharAttrs[(unsigned char)(c)] & NICK_C)
|
||||
#define IsServChar(c) (CharAttrs[(unsigned char)(c)] & (NICK_C | SERV_C))
|
||||
#define IsIdChar(c) (CharAttrs[(unsigned char)(c)] & (DIGIT_C | LET_C))
|
||||
#define IsLetter(c) (CharAttrs[(unsigned char)(c)] & LET_C)
|
||||
#define IsCntrl(c) (CharAttrs[(unsigned char)(c)] & CNTRL_C)
|
||||
#define IsAlpha(c) (CharAttrs[(unsigned char)(c)] & ALPHA_C)
|
||||
#define IsSpace(c) (CharAttrs[(unsigned char)(c)] & SPACE_C)
|
||||
#define IsLower(c) (IsAlpha((c)) && ((unsigned char)(c) > 0x5f))
|
||||
#define IsUpper(c) (IsAlpha((c)) && ((unsigned char)(c) < 0x60))
|
||||
#define IsDigit(c) (CharAttrs[(unsigned char)(c)] & DIGIT_C)
|
||||
#define IsXDigit(c) (IsDigit(c) || ('a' <= (c) && (c) <= 'f') || \
|
||||
('A' <= (c) && (c) <= 'F'))
|
||||
#define IsAlNum(c) (CharAttrs[(unsigned char)(c)] & (DIGIT_C | ALPHA_C))
|
||||
#define IsPrint(c) (CharAttrs[(unsigned char)(c)] & PRINT_C)
|
||||
#define IsAscii(c) ((unsigned char)(c) < 0x80)
|
||||
#define IsGraph(c) (IsPrint((c)) && ((unsigned char)(c) != 0x32))
|
||||
#define IsPunct(c) (!(CharAttrs[(unsigned char)(c)] & \
|
||||
(CNTRL_C | ALPHA_C | DIGIT_C)))
|
||||
|
||||
#define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
|
||||
#define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)
|
||||
|
||||
|
||||
/* Below are used for radix trees and the like */
|
||||
static inline void irccasecanon(char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
*str = irctoupper(*str);
|
||||
*str = rfc1459::toupper(*str);
|
||||
str++;
|
||||
}
|
||||
return;
|
||||
|
|
129
include/ircd/rfc1459.h
Normal file
129
include/ircd/rfc1459.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* charybdis: 21st Century IRC++d
|
||||
* rfc1459.h: RFC1459 Specification API
|
||||
*
|
||||
* Copyright (C) 2016 Charybdis Development Team
|
||||
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_RFC1459_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
namespace rfc1459 {
|
||||
namespace character
|
||||
{
|
||||
enum attr : uint
|
||||
{
|
||||
PRINT = 0x00000001,
|
||||
CNTRL = 0x00000002,
|
||||
ALPHA = 0x00000004,
|
||||
PUNCT = 0x00000008,
|
||||
DIGIT = 0x00000010,
|
||||
SPACE = 0x00000020,
|
||||
NICK = 0x00000040,
|
||||
CHAN = 0x00000080,
|
||||
KWILD = 0x00000100,
|
||||
CHANPFX = 0x00000200,
|
||||
USER = 0x00000400,
|
||||
HOST = 0x00000800,
|
||||
NONEOS = 0x00001000,
|
||||
SERV = 0x00002000,
|
||||
EOL = 0x00004000,
|
||||
MWILD = 0x00008000,
|
||||
LET = 0x00010000, // an actual letter
|
||||
FCHAN = 0x00020000, // a 'fake' channel char
|
||||
};
|
||||
|
||||
using attr_t = std::underlying_type<attr>::type;
|
||||
|
||||
extern const std::array<attr_t, 256> attrs;
|
||||
extern const std::array<unsigned char, 256> tolower_tab;
|
||||
extern const std::array<unsigned char, 256> toupper_tab;
|
||||
|
||||
bool is(const unsigned char &c, const attr &attr);
|
||||
bool is(const char &c, const attr &attr);
|
||||
auto &tolower(const unsigned char &c);
|
||||
auto &toupper(const unsigned char &c);
|
||||
}
|
||||
|
||||
using character::is;
|
||||
using character::toupper;
|
||||
using character::tolower;
|
||||
|
||||
inline bool is_print(const char &c) { return is(c, character::PRINT); }
|
||||
inline bool is_host(const char &c) { return is(c, character::HOST); }
|
||||
inline bool is_user(const char &c) { return is(c, character::USER); }
|
||||
inline bool is_chan(const char &c) { return is(c, character::CHAN); }
|
||||
inline bool is_chan_prefix(const char &c) { return is(c, character::CHANPFX); }
|
||||
inline bool is_fake_chan(const char &c) { return is(c, character::FCHAN); }
|
||||
inline bool is_kwild(const char &c) { return is(c, character::KWILD); }
|
||||
inline bool is_mwild(const char &c) { return is(c, character::MWILD); }
|
||||
inline bool is_nick(const char &c) { return is(c, character::NICK); }
|
||||
inline bool is_letter(const char &c) { return is(c, character::LET); }
|
||||
inline bool is_digit(const char &c) { return is(c, character::DIGIT); }
|
||||
inline bool is_cntrl(const char &c) { return is(c, character::CNTRL); }
|
||||
inline bool is_alpha(const char &c) { return is(c, character::ALPHA); }
|
||||
inline bool is_space(const char &c) { return is(c, character::SPACE); }
|
||||
inline bool is_noneos(const char &c) { return is(c, character::NONEOS); }
|
||||
inline bool is_eol(const char &c) { return is(c, character::EOL); }
|
||||
inline bool is_serv(const char &c) { return is(c, character::SERV) || is_nick(c); }
|
||||
inline bool is_id(const char &c) { return is_digit(c) || is_letter(c); }
|
||||
inline bool is_alnum(const char &c) { return is_digit(c) || is_alpha(c); }
|
||||
inline bool is_punct(const char &c) { return !is_cntrl(c) && !is_alnum(c); }
|
||||
inline bool is_lower(const char &c) { return is_alpha(c) && uint8_t(c) > 0x5f; }
|
||||
inline bool is_upper(const char &c) { return is_alpha(c) && uint8_t(c) < 0x60; }
|
||||
inline bool is_graph(const char &c) { return is_print(c) && uint8_t(c) != 0x32; }
|
||||
inline bool is_ascii(const char &c) { return uint8_t(c) < 0x80; }
|
||||
inline bool is_xdigit(const char &c)
|
||||
{
|
||||
return is_digit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');
|
||||
}
|
||||
|
||||
inline auto &
|
||||
character::tolower(const unsigned char &c)
|
||||
{
|
||||
return tolower_tab[c];
|
||||
}
|
||||
|
||||
inline auto &
|
||||
character::toupper(const unsigned char &c)
|
||||
{
|
||||
return toupper_tab[c];
|
||||
}
|
||||
|
||||
inline bool
|
||||
character::is(const char &c,
|
||||
const attr &attr)
|
||||
{
|
||||
return is(reinterpret_cast<const unsigned char &>(c), attr);
|
||||
}
|
||||
|
||||
inline bool
|
||||
character::is(const unsigned char &c,
|
||||
const attr &attr)
|
||||
{
|
||||
return (attrs[c] & attr) == attr;
|
||||
}
|
||||
|
||||
} // namespace rfc1459
|
||||
} // namespace ircd
|
||||
#endif // __cplusplus
|
|
@ -37,6 +37,7 @@ namespace ircd
|
|||
#include "util.h"
|
||||
#include "defaults.h"
|
||||
#include "exception.h"
|
||||
#include "rfc1459.h"
|
||||
#include "fs.h"
|
||||
#include "listener.h"
|
||||
#include "s_assert.h"
|
||||
|
|
|
@ -71,6 +71,7 @@ libircd_la_SOURCES = \
|
|||
ratelimit.cc \
|
||||
reject.cc \
|
||||
restart.cc \
|
||||
rfc1459.cc \
|
||||
s_conf.cc \
|
||||
s_newconf.cc \
|
||||
s_serv.cc \
|
||||
|
|
|
@ -230,16 +230,12 @@ bandb_check_kline(struct ConfItem *aconf)
|
|||
return 0;
|
||||
|
||||
for(p = aconf->user; *p; p++)
|
||||
{
|
||||
if(!IsUserChar(*p) && !IsKWildChar(*p))
|
||||
if(!rfc1459::is_user(*p) && !rfc1459::is_kwild(*p))
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(p = aconf->host; *p; p++)
|
||||
{
|
||||
if(!IsHostChar(*p) && !IsKWildChar(*p))
|
||||
if(!rfc1459::is_host(*p) && !rfc1459::is_kwild(*p))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -278,10 +274,8 @@ bandb_check_resv_channel(struct ConfItem *aconf)
|
|||
return 0;
|
||||
|
||||
for(p = aconf->host; *p; p++)
|
||||
{
|
||||
if(!IsChanChar(*p))
|
||||
if(!rfc1459::is_chan(*p))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ check_channel_name(const char *name)
|
|||
|
||||
for (; *name; ++name)
|
||||
{
|
||||
if(!IsChanChar(*name))
|
||||
if(!rfc1459::is_chan(*name))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ check_string(char *s)
|
|||
|
||||
for(; *s; ++s)
|
||||
{
|
||||
if(IsSpace(*s))
|
||||
if(rfc1459::is_space(*s))
|
||||
{
|
||||
*s = '\0';
|
||||
break;
|
||||
|
@ -411,7 +411,7 @@ pretty_mask(const char *idmask)
|
|||
*t = '~';
|
||||
if (*t == '~')
|
||||
t++;
|
||||
*t = irctolower(*t);
|
||||
*t = rfc1459::tolower(*t);
|
||||
return mask_buf + old_mask_pos;
|
||||
}
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time)
|
|||
continue;
|
||||
|
||||
/* Skip users that already have UID nicks. */
|
||||
if(IsDigit(client_p->name[0]))
|
||||
if(rfc1459::is_digit(client_p->name[0]))
|
||||
continue;
|
||||
|
||||
if(match_esc(mask, client_p->name))
|
||||
|
@ -831,13 +831,13 @@ clean_nick(const char *nick, int loc_client)
|
|||
if(*nick == '-' || *nick == '\0')
|
||||
return 0;
|
||||
|
||||
if(loc_client && IsDigit(*nick))
|
||||
if(loc_client && rfc1459::is_digit(*nick))
|
||||
return 0;
|
||||
|
||||
for(; *nick; nick++)
|
||||
{
|
||||
len++;
|
||||
if(!IsNickChar(*nick))
|
||||
if(!rfc1459::is_nick(*nick))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -898,7 +898,7 @@ find_chasing(struct Client *source_p, const char *user, int *chasing)
|
|||
if(chasing)
|
||||
*chasing = 0;
|
||||
|
||||
if(who || IsDigit(*user))
|
||||
if(who || rfc1459::is_digit(*user))
|
||||
return who;
|
||||
|
||||
if(!(who = whowas_get_history(user, (long) KILLCHASETIMELIMIT)))
|
||||
|
|
|
@ -39,7 +39,7 @@ match_extban(const char *banstr, struct Client *client_p, struct Channel *chptr,
|
|||
invert = 1;
|
||||
p++;
|
||||
}
|
||||
f = extban_table[(unsigned char) irctolower(*p)];
|
||||
f = extban_table[(unsigned char) rfc1459::tolower(*p)];
|
||||
if (*p != '\0')
|
||||
{
|
||||
p++;
|
||||
|
@ -71,7 +71,7 @@ valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr,
|
|||
p = banstr + 1;
|
||||
if (*p == '~')
|
||||
p++;
|
||||
f = extban_table[(unsigned char) irctolower(*p)];
|
||||
f = extban_table[(unsigned char) rfc1459::tolower(*p)];
|
||||
if (*p != '\0')
|
||||
{
|
||||
p++;
|
||||
|
@ -96,7 +96,7 @@ get_extban_string(void)
|
|||
|
||||
j = 0;
|
||||
for (i = 1; i < 256; i++)
|
||||
if (i == irctolower(i) && extban_table[i])
|
||||
if (i == rfc1459::tolower(i) && extban_table[i])
|
||||
e[j++] = i;
|
||||
e[j] = 0;
|
||||
return e;
|
||||
|
|
|
@ -60,7 +60,7 @@ fnv_hash_upper(const unsigned char *s, int bits)
|
|||
|
||||
while (*s)
|
||||
{
|
||||
h ^= irctoupper(*s++);
|
||||
h ^= rfc1459::toupper(*s++);
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
if (bits < 32)
|
||||
|
@ -105,7 +105,7 @@ fnv_hash_upper_len(const unsigned char *s, int bits, int len)
|
|||
const unsigned char *x = s + len;
|
||||
while (*s && s < x)
|
||||
{
|
||||
h ^= irctoupper(*s++);
|
||||
h ^= rfc1459::toupper(*s++);
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
if (bits < 32)
|
||||
|
@ -294,7 +294,7 @@ find_client(const char *name)
|
|||
return NULL;
|
||||
|
||||
/* hunting for an id, not a nick */
|
||||
if(IsDigit(*name))
|
||||
if(rfc1459::is_digit(*name))
|
||||
return (find_id(name));
|
||||
|
||||
return (Client *)rb_radixtree_retrieve(client_name_tree, name);
|
||||
|
@ -327,7 +327,7 @@ find_server(struct Client *source_p, const char *name)
|
|||
return NULL;
|
||||
|
||||
if((source_p == NULL || !MyClient(source_p)) &&
|
||||
IsDigit(*name) && strlen(name) == 3)
|
||||
rfc1459::is_digit(*name) && strlen(name) == 3)
|
||||
{
|
||||
target_p = find_id(name);
|
||||
return(target_p);
|
||||
|
|
|
@ -171,7 +171,7 @@ hash_text(const char *start)
|
|||
|
||||
while(*p)
|
||||
{
|
||||
h = (h << 4) - (h + (unsigned char) irctolower(*p++));
|
||||
h = (h << 4) - (h + (unsigned char) rfc1459::tolower(*p++));
|
||||
}
|
||||
|
||||
return (h & (ATABLE_SIZE - 1));
|
||||
|
|
357
ircd/match.cc
357
ircd/match.cc
|
@ -84,14 +84,14 @@ int match(const char *mask, const char *name)
|
|||
else
|
||||
{
|
||||
m_tmp = m;
|
||||
for (n_tmp = n; *n && irctolower(*n) != irctolower(*m); n++);
|
||||
for (n_tmp = n; *n && rfc1459::tolower(*n) != rfc1459::tolower(*m); n++);
|
||||
}
|
||||
}
|
||||
/* and fall through */
|
||||
default:
|
||||
if (!*n)
|
||||
return (*m != '\0' ? 0 : 1);
|
||||
if (irctolower(*m) != irctolower(*n))
|
||||
if (rfc1459::tolower(*m) != rfc1459::tolower(*n))
|
||||
goto backtrack;
|
||||
m++;
|
||||
n++;
|
||||
|
@ -156,14 +156,14 @@ int mask_match(const char *mask, const char *name)
|
|||
else
|
||||
{
|
||||
m_tmp = m;
|
||||
for (n_tmp = n; *n && irctolower(*n) != irctolower(*m); n++);
|
||||
for (n_tmp = n; *n && rfc1459::tolower(*n) != rfc1459::tolower(*m); n++);
|
||||
}
|
||||
}
|
||||
/* and fall through */
|
||||
default:
|
||||
if (!*n)
|
||||
return (*m != '\0' ? 0 : 1);
|
||||
if (irctolower(*m) != irctolower(*n))
|
||||
if (rfc1459::tolower(*m) != rfc1459::tolower(*n))
|
||||
goto backtrack;
|
||||
m++;
|
||||
n++;
|
||||
|
@ -277,15 +277,15 @@ match_esc(const char *mask, const char *name)
|
|||
}
|
||||
|
||||
if(quote)
|
||||
match1 = *m == 's' ? *n == ' ' : irctolower(*m) == irctolower(*n);
|
||||
match1 = *m == 's' ? *n == ' ' : rfc1459::tolower(*m) == rfc1459::tolower(*n);
|
||||
else if(*m == '?')
|
||||
match1 = 1;
|
||||
else if(*m == '@')
|
||||
match1 = IsLetter(*n);
|
||||
match1 = rfc1459::is_letter(*n);
|
||||
else if(*m == '#')
|
||||
match1 = IsDigit(*n);
|
||||
match1 = rfc1459::is_digit(*n);
|
||||
else
|
||||
match1 = irctolower(*m) == irctolower(*n);
|
||||
match1 = rfc1459::tolower(*m) == rfc1459::tolower(*n);
|
||||
if(match1)
|
||||
{
|
||||
if(*m)
|
||||
|
@ -561,7 +561,7 @@ int irccmp(const char *s1, const char *s2)
|
|||
s_assert(s1 != NULL);
|
||||
s_assert(s2 != NULL);
|
||||
|
||||
while ((res = irctoupper(*str1) - irctoupper(*str2)) == 0)
|
||||
while ((res = rfc1459::toupper(*str1) - rfc1459::toupper(*str2)) == 0)
|
||||
{
|
||||
if (*str1 == '\0')
|
||||
return 0;
|
||||
|
@ -579,7 +579,7 @@ int ircncmp(const char *s1, const char *s2, int n)
|
|||
s_assert(s1 != NULL);
|
||||
s_assert(s2 != NULL);
|
||||
|
||||
while ((res = irctoupper(*str1) - irctoupper(*str2)) == 0)
|
||||
while ((res = rfc1459::toupper(*str1) - rfc1459::toupper(*str2)) == 0)
|
||||
{
|
||||
str1++;
|
||||
str2++;
|
||||
|
@ -590,340 +590,5 @@ int ircncmp(const char *s1, const char *s2, int n)
|
|||
return (res);
|
||||
}
|
||||
|
||||
const unsigned char irctolower_tab[] = {
|
||||
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
|
||||
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
|
||||
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
||||
0x1e, 0x1f,
|
||||
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
|
||||
'*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
':', ';', '<', '=', '>', '?',
|
||||
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
|
||||
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
||||
'_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
|
||||
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
||||
0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
||||
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
|
||||
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
|
||||
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
|
||||
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
||||
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
|
||||
const unsigned char irctoupper_tab[] = {
|
||||
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
|
||||
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
|
||||
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
||||
0x1e, 0x1f,
|
||||
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
|
||||
'*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
|
||||
0x5f,
|
||||
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
|
||||
0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
||||
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
|
||||
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
|
||||
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
|
||||
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
||||
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
|
||||
/*
|
||||
* CharAttrs table
|
||||
*
|
||||
* NOTE: RFC 1459 sez: anything but a ^G, comma, or space is allowed
|
||||
* for channel names
|
||||
*/
|
||||
const unsigned int CharAttrs[] = {
|
||||
/* 0 */ CNTRL_C,
|
||||
/* 1 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 2 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* 3 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* 4 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 5 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 6 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 7 BEL */ CNTRL_C | NONEOS_C,
|
||||
/* 8 \b */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 9 \t */ CNTRL_C | SPACE_C | CHAN_C | NONEOS_C,
|
||||
/* 10 \n */ CNTRL_C | SPACE_C | CHAN_C | NONEOS_C | EOL_C,
|
||||
/* 11 \v */ CNTRL_C | SPACE_C | CHAN_C | NONEOS_C,
|
||||
/* 12 \f */ CNTRL_C | SPACE_C | CHAN_C | NONEOS_C,
|
||||
/* 13 \r */ CNTRL_C | SPACE_C | CHAN_C | NONEOS_C | EOL_C,
|
||||
/* 14 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 15 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 16 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 17 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 18 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 19 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 20 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 21 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 22 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* 23 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 24 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 25 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 26 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 27 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 28 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 29 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* 30 */ CNTRL_C | CHAN_C | NONEOS_C,
|
||||
/* 31 */ CNTRL_C | CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* SP */ PRINT_C | SPACE_C,
|
||||
/* ! */ PRINT_C | KWILD_C | CHAN_C | NONEOS_C,
|
||||
/* " */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* # */ PRINT_C | MWILD_C | CHANPFX_C | CHAN_C | NONEOS_C,
|
||||
/* $ */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* % */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* & */ PRINT_C | CHANPFX_C | CHAN_C | NONEOS_C,
|
||||
/* ' */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* ( */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* ) */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* * */ PRINT_C | KWILD_C | MWILD_C | CHAN_C | NONEOS_C,
|
||||
/* + */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* , */ PRINT_C | NONEOS_C,
|
||||
/* - */ PRINT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* . */ PRINT_C | KWILD_C | CHAN_C | NONEOS_C | USER_C | HOST_C | SERV_C,
|
||||
/* / */ PRINT_C | CHAN_C | NONEOS_C | HOST_C,
|
||||
/* 0 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 1 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 2 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 3 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 4 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 5 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 6 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 7 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 8 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* 9 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* : */ PRINT_C | CHAN_C | NONEOS_C | HOST_C,
|
||||
/* ; */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* < */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* = */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* > */ PRINT_C | CHAN_C | NONEOS_C,
|
||||
/* ? */ PRINT_C | KWILD_C | MWILD_C | CHAN_C | NONEOS_C,
|
||||
/* @ */ PRINT_C | KWILD_C | MWILD_C | CHAN_C | NONEOS_C,
|
||||
/* A */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* B */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* C */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* D */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* E */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* F */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* G */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* H */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* I */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* J */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* K */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* L */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* M */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* N */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* O */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* P */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* Q */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* R */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* S */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* T */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* U */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* V */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* W */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* X */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* Y */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* Z */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* [ */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* \ */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* ] */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* ^ */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* _ */ PRINT_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* ` */ PRINT_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* a */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* b */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* c */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* d */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* e */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* f */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* g */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* h */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* i */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* j */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* k */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* l */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* m */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* n */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* o */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* p */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* q */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* r */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* s */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* t */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* u */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* v */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* w */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* x */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* y */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* z */ PRINT_C | ALPHA_C | LET_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||
/* { */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* | */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* } */ PRINT_C | ALPHA_C | NICK_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* ~ */ PRINT_C | ALPHA_C | CHAN_C | NONEOS_C | USER_C,
|
||||
/* del */ CHAN_C | NONEOS_C,
|
||||
/* 0x80 */ CHAN_C | NONEOS_C,
|
||||
/* 0x81 */ CHAN_C | NONEOS_C,
|
||||
/* 0x82 */ CHAN_C | NONEOS_C,
|
||||
/* 0x83 */ CHAN_C | NONEOS_C,
|
||||
/* 0x84 */ CHAN_C | NONEOS_C,
|
||||
/* 0x85 */ CHAN_C | NONEOS_C,
|
||||
/* 0x86 */ CHAN_C | NONEOS_C,
|
||||
/* 0x87 */ CHAN_C | NONEOS_C,
|
||||
/* 0x88 */ CHAN_C | NONEOS_C,
|
||||
/* 0x89 */ CHAN_C | NONEOS_C,
|
||||
/* 0x8A */ CHAN_C | NONEOS_C,
|
||||
/* 0x8B */ CHAN_C | NONEOS_C,
|
||||
/* 0x8C */ CHAN_C | NONEOS_C,
|
||||
/* 0x8D */ CHAN_C | NONEOS_C,
|
||||
/* 0x8E */ CHAN_C | NONEOS_C,
|
||||
/* 0x8F */ CHAN_C | NONEOS_C,
|
||||
/* 0x90 */ CHAN_C | NONEOS_C,
|
||||
/* 0x91 */ CHAN_C | NONEOS_C,
|
||||
/* 0x92 */ CHAN_C | NONEOS_C,
|
||||
/* 0x93 */ CHAN_C | NONEOS_C,
|
||||
/* 0x94 */ CHAN_C | NONEOS_C,
|
||||
/* 0x95 */ CHAN_C | NONEOS_C,
|
||||
/* 0x96 */ CHAN_C | NONEOS_C,
|
||||
/* 0x97 */ CHAN_C | NONEOS_C,
|
||||
/* 0x98 */ CHAN_C | NONEOS_C,
|
||||
/* 0x99 */ CHAN_C | NONEOS_C,
|
||||
/* 0x9A */ CHAN_C | NONEOS_C,
|
||||
/* 0x9B */ CHAN_C | NONEOS_C,
|
||||
/* 0x9C */ CHAN_C | NONEOS_C,
|
||||
/* 0x9D */ CHAN_C | NONEOS_C,
|
||||
/* 0x9E */ CHAN_C | NONEOS_C,
|
||||
/* 0x9F */ CHAN_C | NONEOS_C,
|
||||
/* 0xA0 */ CHAN_C | FCHAN_C | NONEOS_C,
|
||||
/* 0xA1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xA9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xAA */ CHAN_C | NONEOS_C,
|
||||
/* 0xAB */ CHAN_C | NONEOS_C,
|
||||
/* 0xAC */ CHAN_C | NONEOS_C,
|
||||
/* 0xAD */ CHAN_C | NONEOS_C,
|
||||
/* 0xAE */ CHAN_C | NONEOS_C,
|
||||
/* 0xAF */ CHAN_C | NONEOS_C,
|
||||
/* 0xB0 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xB9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xBA */ CHAN_C | NONEOS_C,
|
||||
/* 0xBB */ CHAN_C | NONEOS_C,
|
||||
/* 0xBC */ CHAN_C | NONEOS_C,
|
||||
/* 0xBD */ CHAN_C | NONEOS_C,
|
||||
/* 0xBE */ CHAN_C | NONEOS_C,
|
||||
/* 0xBF */ CHAN_C | NONEOS_C,
|
||||
/* 0xC0 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xC9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xCA */ CHAN_C | NONEOS_C,
|
||||
/* 0xCB */ CHAN_C | NONEOS_C,
|
||||
/* 0xCC */ CHAN_C | NONEOS_C,
|
||||
/* 0xCD */ CHAN_C | NONEOS_C,
|
||||
/* 0xCE */ CHAN_C | NONEOS_C,
|
||||
/* 0xCF */ CHAN_C | NONEOS_C,
|
||||
/* 0xD0 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xD9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xDA */ CHAN_C | NONEOS_C,
|
||||
/* 0xDB */ CHAN_C | NONEOS_C,
|
||||
/* 0xDC */ CHAN_C | NONEOS_C,
|
||||
/* 0xDD */ CHAN_C | NONEOS_C,
|
||||
/* 0xDE */ CHAN_C | NONEOS_C,
|
||||
/* 0xDF */ CHAN_C | NONEOS_C,
|
||||
/* 0xE0 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xE9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xEA */ CHAN_C | NONEOS_C,
|
||||
/* 0xEB */ CHAN_C | NONEOS_C,
|
||||
/* 0xEC */ CHAN_C | NONEOS_C,
|
||||
/* 0xED */ CHAN_C | NONEOS_C,
|
||||
/* 0xEE */ CHAN_C | NONEOS_C,
|
||||
/* 0xEF */ CHAN_C | NONEOS_C,
|
||||
/* 0xF0 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF1 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF2 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF3 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF4 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF5 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF6 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF7 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF8 */ CHAN_C | NONEOS_C,
|
||||
/* 0xF9 */ CHAN_C | NONEOS_C,
|
||||
/* 0xFA */ CHAN_C | NONEOS_C,
|
||||
/* 0xFB */ CHAN_C | NONEOS_C,
|
||||
/* 0xFC */ CHAN_C | NONEOS_C,
|
||||
/* 0xFD */ CHAN_C | NONEOS_C,
|
||||
/* 0xFE */ CHAN_C | NONEOS_C,
|
||||
/* 0xFF */ CHAN_C | NONEOS_C
|
||||
};
|
||||
|
||||
|
||||
} // namespace ircd
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ conf_set_serverinfo_name(void *data)
|
|||
|
||||
for(s = (char *)data; *s != '\0'; s++)
|
||||
{
|
||||
if(!IsServChar(*s))
|
||||
if(!rfc1459::is_serv(*s))
|
||||
{
|
||||
conf_report_error("Ignoring serverinfo::name "
|
||||
"-- bogus servername.");
|
||||
|
@ -176,7 +176,7 @@ conf_set_serverinfo_name(void *data)
|
|||
|
||||
s = (char *)data;
|
||||
|
||||
if(IsDigit(*s))
|
||||
if(rfc1459::is_digit(*s))
|
||||
{
|
||||
conf_report_error("Ignoring serverinfo::name -- cannot begin with digit.");
|
||||
return;
|
||||
|
@ -195,8 +195,10 @@ conf_set_serverinfo_sid(void *data)
|
|||
|
||||
if(ServerInfo.sid[0] == '\0')
|
||||
{
|
||||
if(!IsDigit(sid[0]) || !IsIdChar(sid[1]) ||
|
||||
!IsIdChar(sid[2]) || sid[3] != '\0')
|
||||
if(!rfc1459::is_digit(sid[0]) ||
|
||||
!rfc1459::is_id(sid[1]) ||
|
||||
!rfc1459::is_id(sid[2]) ||
|
||||
sid[3] != '\0')
|
||||
{
|
||||
conf_report_error("Ignoring serverinfo::sid "
|
||||
"-- bogus sid.");
|
||||
|
@ -1771,7 +1773,7 @@ conf_set_service_name(void *data)
|
|||
|
||||
for(s = (char *)data; *s != '\0'; s++)
|
||||
{
|
||||
if(!IsServChar(*s))
|
||||
if(!rfc1459::is_serv(*s))
|
||||
{
|
||||
conf_report_error("Ignoring service::name "
|
||||
"-- bogus servername.");
|
||||
|
|
|
@ -107,7 +107,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
|
|||
}
|
||||
}
|
||||
|
||||
if(IsDigit(*msgbuf.cmd) && IsDigit(*(msgbuf.cmd + 1)) && IsDigit(*(msgbuf.cmd + 2)))
|
||||
if(rfc1459::is_digit(*msgbuf.cmd) && rfc1459::is_digit(*(msgbuf.cmd + 1)) && rfc1459::is_digit(*(msgbuf.cmd + 2)))
|
||||
{
|
||||
mptr = NULL;
|
||||
numeric = atoi(msgbuf.cmd);
|
||||
|
@ -344,7 +344,7 @@ remove_unknown(struct Client *client_p, const char *lsender, char *lbuffer)
|
|||
* #XX is a SID (SQUIT)
|
||||
* meep.foo is a server (SQUIT)
|
||||
*/
|
||||
if((IsDigit(lsender[0]) && slen == 3) ||
|
||||
if((rfc1459::is_digit(lsender[0]) && slen == 3) ||
|
||||
(strchr(lsender, '.') != NULL))
|
||||
{
|
||||
sendto_realops_snomask(SNO_DEBUG, L_ALL,
|
||||
|
@ -356,7 +356,7 @@ remove_unknown(struct Client *client_p, const char *lsender, char *lbuffer)
|
|||
get_id(&me, client_p), lsender,
|
||||
lbuffer, client_p->name);
|
||||
}
|
||||
else if(!IsDigit(lsender[0]))
|
||||
else if(!rfc1459::is_digit(lsender[0]))
|
||||
;
|
||||
else if(slen != 9)
|
||||
sendto_realops_snomask(SNO_DEBUG, L_ALL,
|
||||
|
|
365
ircd/rfc1459.cc
Normal file
365
ircd/rfc1459.cc
Normal file
|
@ -0,0 +1,365 @@
|
|||
/**
|
||||
* charybdis: libirc: Formal IRC library
|
||||
* rfc1459.cc: rfc1459 compliance implementation
|
||||
*
|
||||
* Copyright (C) 2016 Charybdis Development Team
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using namespace ircd;
|
||||
|
||||
decltype(rfc1459::character::tolower_tab)
|
||||
rfc1459::character::tolower_tab
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
|
||||
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
||||
0x1e, 0x1f,
|
||||
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
|
||||
'*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
':', ';', '<', '=', '>', '?',
|
||||
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
|
||||
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
||||
'_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
|
||||
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
||||
0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
||||
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
|
||||
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
|
||||
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
|
||||
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
||||
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
|
||||
decltype(rfc1459::character::toupper_tab)
|
||||
rfc1459::character::toupper_tab
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
|
||||
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
||||
0x1e, 0x1f,
|
||||
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
|
||||
'*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
|
||||
0x5f,
|
||||
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
|
||||
0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
||||
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
|
||||
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
|
||||
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
|
||||
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
||||
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
|
||||
/*
|
||||
* CharAttrs table
|
||||
*
|
||||
* NOTE: RFC 1459 sez: anything but a ^G, comma, or space is allowed
|
||||
* for channel names
|
||||
*/
|
||||
const decltype(rfc1459::character::attrs)
|
||||
rfc1459::character::attrs
|
||||
{{
|
||||
/* 0 */ CNTRL,
|
||||
/* 1 */ CNTRL | CHAN | NONEOS,
|
||||
/* 2 */ CNTRL | CHAN | FCHAN | NONEOS,
|
||||
/* 3 */ CNTRL | CHAN | FCHAN | NONEOS,
|
||||
/* 4 */ CNTRL | CHAN | NONEOS,
|
||||
/* 5 */ CNTRL | CHAN | NONEOS,
|
||||
/* 6 */ CNTRL | CHAN | NONEOS,
|
||||
/* 7 BEL */ CNTRL | NONEOS,
|
||||
/* 8 \b */ CNTRL | CHAN | NONEOS,
|
||||
/* 9 \t */ CNTRL | SPACE | CHAN | NONEOS,
|
||||
/* 10 \n */ CNTRL | SPACE | CHAN | NONEOS | EOL,
|
||||
/* 11 \v */ CNTRL | SPACE | CHAN | NONEOS,
|
||||
/* 12 \f */ CNTRL | SPACE | CHAN | NONEOS,
|
||||
/* 13 \r */ CNTRL | SPACE | CHAN | NONEOS | EOL,
|
||||
/* 14 */ CNTRL | CHAN | NONEOS,
|
||||
/* 15 */ CNTRL | CHAN | NONEOS,
|
||||
/* 16 */ CNTRL | CHAN | NONEOS,
|
||||
/* 17 */ CNTRL | CHAN | NONEOS,
|
||||
/* 18 */ CNTRL | CHAN | NONEOS,
|
||||
/* 19 */ CNTRL | CHAN | NONEOS,
|
||||
/* 20 */ CNTRL | CHAN | NONEOS,
|
||||
/* 21 */ CNTRL | CHAN | NONEOS,
|
||||
/* 22 */ CNTRL | CHAN | FCHAN | NONEOS,
|
||||
/* 23 */ CNTRL | CHAN | NONEOS,
|
||||
/* 24 */ CNTRL | CHAN | NONEOS,
|
||||
/* 25 */ CNTRL | CHAN | NONEOS,
|
||||
/* 26 */ CNTRL | CHAN | NONEOS,
|
||||
/* 27 */ CNTRL | CHAN | NONEOS,
|
||||
/* 28 */ CNTRL | CHAN | NONEOS,
|
||||
/* 29 */ CNTRL | CHAN | FCHAN | NONEOS,
|
||||
/* 30 */ CNTRL | CHAN | NONEOS,
|
||||
/* 31 */ CNTRL | CHAN | FCHAN | NONEOS,
|
||||
/* SP */ PRINT | SPACE,
|
||||
/* ! */ PRINT | KWILD | CHAN | NONEOS,
|
||||
/* " */ PRINT | CHAN | NONEOS,
|
||||
/* # */ PRINT | MWILD | CHANPFX | CHAN | NONEOS,
|
||||
/* $ */ PRINT | CHAN | NONEOS,
|
||||
/* % */ PRINT | CHAN | NONEOS,
|
||||
/* & */ PRINT | CHANPFX | CHAN | NONEOS,
|
||||
/* ' */ PRINT | CHAN | NONEOS,
|
||||
/* ( */ PRINT | CHAN | NONEOS,
|
||||
/* ) */ PRINT | CHAN | NONEOS,
|
||||
/* * */ PRINT | KWILD | MWILD | CHAN | NONEOS,
|
||||
/* + */ PRINT | CHAN | NONEOS,
|
||||
/* , */ PRINT | NONEOS,
|
||||
/* - */ PRINT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* . */ PRINT | KWILD | CHAN | NONEOS | USER | HOST | SERV,
|
||||
/* / */ PRINT | CHAN | NONEOS | HOST,
|
||||
/* 0 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 1 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 2 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 3 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 4 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 5 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 6 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 7 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 8 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* 9 */ PRINT | DIGIT | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* : */ PRINT | CHAN | NONEOS | HOST,
|
||||
/* ; */ PRINT | CHAN | NONEOS,
|
||||
/* < */ PRINT | CHAN | NONEOS,
|
||||
/* = */ PRINT | CHAN | NONEOS,
|
||||
/* > */ PRINT | CHAN | NONEOS,
|
||||
/* ? */ PRINT | KWILD | MWILD | CHAN | NONEOS,
|
||||
/* @ */ PRINT | KWILD | MWILD | CHAN | NONEOS,
|
||||
/* A */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* B */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* C */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* D */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* E */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* F */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* G */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* H */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* I */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* J */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* K */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* L */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* M */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* N */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* O */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* P */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* Q */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* R */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* S */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* T */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* U */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* V */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* W */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* X */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* Y */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* Z */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* [ */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* \ */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* ] */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* ^ */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* _ */ PRINT | NICK | CHAN | NONEOS | USER,
|
||||
/* ` */ PRINT | NICK | CHAN | NONEOS | USER,
|
||||
/* a */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* b */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* c */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* d */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* e */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* f */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* g */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* h */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* i */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* j */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* k */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* l */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* m */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* n */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* o */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* p */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* q */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* r */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* s */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* t */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* u */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* v */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* w */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* x */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* y */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* z */ PRINT | ALPHA | LET | NICK | CHAN | NONEOS | USER | HOST,
|
||||
/* { */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* | */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* } */ PRINT | ALPHA | NICK | CHAN | NONEOS | USER,
|
||||
/* ~ */ PRINT | ALPHA | CHAN | NONEOS | USER,
|
||||
/* del */ CHAN | NONEOS,
|
||||
/* 0x80 */ CHAN | NONEOS,
|
||||
/* 0x81 */ CHAN | NONEOS,
|
||||
/* 0x82 */ CHAN | NONEOS,
|
||||
/* 0x83 */ CHAN | NONEOS,
|
||||
/* 0x84 */ CHAN | NONEOS,
|
||||
/* 0x85 */ CHAN | NONEOS,
|
||||
/* 0x86 */ CHAN | NONEOS,
|
||||
/* 0x87 */ CHAN | NONEOS,
|
||||
/* 0x88 */ CHAN | NONEOS,
|
||||
/* 0x89 */ CHAN | NONEOS,
|
||||
/* 0x8A */ CHAN | NONEOS,
|
||||
/* 0x8B */ CHAN | NONEOS,
|
||||
/* 0x8C */ CHAN | NONEOS,
|
||||
/* 0x8D */ CHAN | NONEOS,
|
||||
/* 0x8E */ CHAN | NONEOS,
|
||||
/* 0x8F */ CHAN | NONEOS,
|
||||
/* 0x90 */ CHAN | NONEOS,
|
||||
/* 0x91 */ CHAN | NONEOS,
|
||||
/* 0x92 */ CHAN | NONEOS,
|
||||
/* 0x93 */ CHAN | NONEOS,
|
||||
/* 0x94 */ CHAN | NONEOS,
|
||||
/* 0x95 */ CHAN | NONEOS,
|
||||
/* 0x96 */ CHAN | NONEOS,
|
||||
/* 0x97 */ CHAN | NONEOS,
|
||||
/* 0x98 */ CHAN | NONEOS,
|
||||
/* 0x99 */ CHAN | NONEOS,
|
||||
/* 0x9A */ CHAN | NONEOS,
|
||||
/* 0x9B */ CHAN | NONEOS,
|
||||
/* 0x9C */ CHAN | NONEOS,
|
||||
/* 0x9D */ CHAN | NONEOS,
|
||||
/* 0x9E */ CHAN | NONEOS,
|
||||
/* 0x9F */ CHAN | NONEOS,
|
||||
/* 0xA0 */ CHAN | FCHAN | NONEOS,
|
||||
/* 0xA1 */ CHAN | NONEOS,
|
||||
/* 0xA2 */ CHAN | NONEOS,
|
||||
/* 0xA3 */ CHAN | NONEOS,
|
||||
/* 0xA4 */ CHAN | NONEOS,
|
||||
/* 0xA5 */ CHAN | NONEOS,
|
||||
/* 0xA6 */ CHAN | NONEOS,
|
||||
/* 0xA7 */ CHAN | NONEOS,
|
||||
/* 0xA8 */ CHAN | NONEOS,
|
||||
/* 0xA9 */ CHAN | NONEOS,
|
||||
/* 0xAA */ CHAN | NONEOS,
|
||||
/* 0xAB */ CHAN | NONEOS,
|
||||
/* 0xAC */ CHAN | NONEOS,
|
||||
/* 0xAD */ CHAN | NONEOS,
|
||||
/* 0xAE */ CHAN | NONEOS,
|
||||
/* 0xAF */ CHAN | NONEOS,
|
||||
/* 0xB0 */ CHAN | NONEOS,
|
||||
/* 0xB1 */ CHAN | NONEOS,
|
||||
/* 0xB2 */ CHAN | NONEOS,
|
||||
/* 0xB3 */ CHAN | NONEOS,
|
||||
/* 0xB4 */ CHAN | NONEOS,
|
||||
/* 0xB5 */ CHAN | NONEOS,
|
||||
/* 0xB6 */ CHAN | NONEOS,
|
||||
/* 0xB7 */ CHAN | NONEOS,
|
||||
/* 0xB8 */ CHAN | NONEOS,
|
||||
/* 0xB9 */ CHAN | NONEOS,
|
||||
/* 0xBA */ CHAN | NONEOS,
|
||||
/* 0xBB */ CHAN | NONEOS,
|
||||
/* 0xBC */ CHAN | NONEOS,
|
||||
/* 0xBD */ CHAN | NONEOS,
|
||||
/* 0xBE */ CHAN | NONEOS,
|
||||
/* 0xBF */ CHAN | NONEOS,
|
||||
/* 0xC0 */ CHAN | NONEOS,
|
||||
/* 0xC1 */ CHAN | NONEOS,
|
||||
/* 0xC2 */ CHAN | NONEOS,
|
||||
/* 0xC3 */ CHAN | NONEOS,
|
||||
/* 0xC4 */ CHAN | NONEOS,
|
||||
/* 0xC5 */ CHAN | NONEOS,
|
||||
/* 0xC6 */ CHAN | NONEOS,
|
||||
/* 0xC7 */ CHAN | NONEOS,
|
||||
/* 0xC8 */ CHAN | NONEOS,
|
||||
/* 0xC9 */ CHAN | NONEOS,
|
||||
/* 0xCA */ CHAN | NONEOS,
|
||||
/* 0xCB */ CHAN | NONEOS,
|
||||
/* 0xCC */ CHAN | NONEOS,
|
||||
/* 0xCD */ CHAN | NONEOS,
|
||||
/* 0xCE */ CHAN | NONEOS,
|
||||
/* 0xCF */ CHAN | NONEOS,
|
||||
/* 0xD0 */ CHAN | NONEOS,
|
||||
/* 0xD1 */ CHAN | NONEOS,
|
||||
/* 0xD2 */ CHAN | NONEOS,
|
||||
/* 0xD3 */ CHAN | NONEOS,
|
||||
/* 0xD4 */ CHAN | NONEOS,
|
||||
/* 0xD5 */ CHAN | NONEOS,
|
||||
/* 0xD6 */ CHAN | NONEOS,
|
||||
/* 0xD7 */ CHAN | NONEOS,
|
||||
/* 0xD8 */ CHAN | NONEOS,
|
||||
/* 0xD9 */ CHAN | NONEOS,
|
||||
/* 0xDA */ CHAN | NONEOS,
|
||||
/* 0xDB */ CHAN | NONEOS,
|
||||
/* 0xDC */ CHAN | NONEOS,
|
||||
/* 0xDD */ CHAN | NONEOS,
|
||||
/* 0xDE */ CHAN | NONEOS,
|
||||
/* 0xDF */ CHAN | NONEOS,
|
||||
/* 0xE0 */ CHAN | NONEOS,
|
||||
/* 0xE1 */ CHAN | NONEOS,
|
||||
/* 0xE2 */ CHAN | NONEOS,
|
||||
/* 0xE3 */ CHAN | NONEOS,
|
||||
/* 0xE4 */ CHAN | NONEOS,
|
||||
/* 0xE5 */ CHAN | NONEOS,
|
||||
/* 0xE6 */ CHAN | NONEOS,
|
||||
/* 0xE7 */ CHAN | NONEOS,
|
||||
/* 0xE8 */ CHAN | NONEOS,
|
||||
/* 0xE9 */ CHAN | NONEOS,
|
||||
/* 0xEA */ CHAN | NONEOS,
|
||||
/* 0xEB */ CHAN | NONEOS,
|
||||
/* 0xEC */ CHAN | NONEOS,
|
||||
/* 0xED */ CHAN | NONEOS,
|
||||
/* 0xEE */ CHAN | NONEOS,
|
||||
/* 0xEF */ CHAN | NONEOS,
|
||||
/* 0xF0 */ CHAN | NONEOS,
|
||||
/* 0xF1 */ CHAN | NONEOS,
|
||||
/* 0xF2 */ CHAN | NONEOS,
|
||||
/* 0xF3 */ CHAN | NONEOS,
|
||||
/* 0xF4 */ CHAN | NONEOS,
|
||||
/* 0xF5 */ CHAN | NONEOS,
|
||||
/* 0xF6 */ CHAN | NONEOS,
|
||||
/* 0xF7 */ CHAN | NONEOS,
|
||||
/* 0xF8 */ CHAN | NONEOS,
|
||||
/* 0xF9 */ CHAN | NONEOS,
|
||||
/* 0xFA */ CHAN | NONEOS,
|
||||
/* 0xFB */ CHAN | NONEOS,
|
||||
/* 0xFC */ CHAN | NONEOS,
|
||||
/* 0xFD */ CHAN | NONEOS,
|
||||
/* 0xFE */ CHAN | NONEOS,
|
||||
/* 0xFF */ CHAN | NONEOS
|
||||
}};
|
|
@ -978,18 +978,13 @@ valid_wild_card(const char *luser, const char *lhost)
|
|||
/* check there are enough non wildcard chars */
|
||||
p = luser;
|
||||
while((tmpch = *p++))
|
||||
{
|
||||
if(!IsKWildChar(tmpch))
|
||||
{
|
||||
/* found enough chars, return */
|
||||
if(!rfc1459::is_kwild(tmpch))
|
||||
if(++nonwild >= ConfigFileEntry.min_nonwildcard)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1; // found enough chars, return
|
||||
|
||||
/* try host, as user didnt contain enough */
|
||||
/* special case for cidr masks -- jilles */
|
||||
if((p = strrchr(lhost, '/')) != NULL && IsDigit(p[1]))
|
||||
if((p = strrchr(lhost, '/')) != NULL && rfc1459::is_digit(p[1]))
|
||||
{
|
||||
bitlen = atoi(p + 1);
|
||||
/* much like non-cidr for ipv6, rather arbitrary for ipv4 */
|
||||
|
@ -1003,11 +998,9 @@ valid_wild_card(const char *luser, const char *lhost)
|
|||
{
|
||||
p = lhost;
|
||||
while((tmpch = *p++))
|
||||
{
|
||||
if(!IsKWildChar(tmpch))
|
||||
if(!rfc1459::is_kwild(tmpch))
|
||||
if(++nonwild >= ConfigFileEntry.min_nonwildcard)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -653,7 +653,7 @@ clean_resv_nick(const char *nick)
|
|||
int q = 0;
|
||||
int ch = 0;
|
||||
|
||||
if(*nick == '-' || IsDigit(*nick))
|
||||
if(*nick == '-' || rfc1459::is_digit(*nick))
|
||||
return 0;
|
||||
|
||||
while ((tmpch = *nick++))
|
||||
|
@ -662,7 +662,7 @@ clean_resv_nick(const char *nick)
|
|||
q++;
|
||||
else if(tmpch == '*')
|
||||
as++;
|
||||
else if(IsNickChar(tmpch))
|
||||
else if(rfc1459::is_nick(tmpch))
|
||||
ch++;
|
||||
else
|
||||
return 0;
|
||||
|
@ -702,7 +702,7 @@ valid_wild_card_simple(const char *data)
|
|||
if(++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
|
||||
return 1;
|
||||
}
|
||||
else if(!IsMWildChar(tmpch))
|
||||
else if(!rfc1459::is_mwild(tmpch))
|
||||
{
|
||||
/* if we have enough nonwildchars, return */
|
||||
if(++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
|
||||
|
@ -723,7 +723,7 @@ valid_temp_time(const char *p)
|
|||
|
||||
while(*p)
|
||||
{
|
||||
if(IsDigit(*p))
|
||||
if(rfc1459::is_digit(*p))
|
||||
{
|
||||
result *= 10;
|
||||
result += ((*p) & 0xF);
|
||||
|
|
|
@ -208,7 +208,7 @@ hunt_server(struct Client *client_p, struct Client *source_p,
|
|||
return (HUNTED_PASS);
|
||||
}
|
||||
|
||||
if(MyClient(source_p) || !IsDigit(parv[server][0]))
|
||||
if(MyClient(source_p) || !rfc1459::is_digit(parv[server][0]))
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER), parv[server]);
|
||||
return (HUNTED_NOSUCH);
|
||||
|
|
|
@ -792,7 +792,7 @@ valid_hostname(const char *hostname)
|
|||
|
||||
while (*p)
|
||||
{
|
||||
if(!IsHostChar(*p))
|
||||
if(!rfc1459::is_host(*p))
|
||||
return false;
|
||||
if(*p == '.' || *p == ':')
|
||||
found_sep++;
|
||||
|
@ -807,7 +807,7 @@ valid_hostname(const char *hostname)
|
|||
if(found_sep == 0)
|
||||
return false;
|
||||
|
||||
if(last_slash && IsDigit(last_slash[1]))
|
||||
if(last_slash && rfc1459::is_digit(last_slash[1]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -843,7 +843,7 @@ valid_username(const char *username)
|
|||
* i.e. reject jokers who have '-@somehost' or '.@somehost'
|
||||
* or "-hi-@somehost", "h-----@somehost" would still be accepted.
|
||||
*/
|
||||
if(!IsAlNum(*p))
|
||||
if(!rfc1459::is_alnum(*p))
|
||||
return false;
|
||||
|
||||
while (*++p)
|
||||
|
@ -853,10 +853,10 @@ valid_username(const char *username)
|
|||
dots++;
|
||||
if(dots > ConfigFileEntry.dots_in_ident)
|
||||
return false;
|
||||
if(!IsUserChar(p[1]))
|
||||
if(!rfc1459::is_user(p[1]))
|
||||
return false;
|
||||
}
|
||||
else if(!IsUserChar(*p))
|
||||
else if(!rfc1459::is_user(*p))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -963,26 +963,18 @@ check_channel_name_loc(struct Client *source_p, const char *name)
|
|||
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
|
||||
{
|
||||
for(p = name; *p; ++p)
|
||||
{
|
||||
if(!IsChanChar(*p) || IsFakeChanChar(*p))
|
||||
if(!rfc1459::is_chan(*p) || rfc1459::is_fake_chan(*p))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(p = name; *p; ++p)
|
||||
{
|
||||
if(!IsChanChar(*p))
|
||||
if(!rfc1459::is_chan(*p))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(ConfigChannel.only_ascii_channels)
|
||||
{
|
||||
for(p = name; *p; ++p)
|
||||
if(*p < 33 || *p > 126)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -205,10 +205,10 @@ ms_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
* not an uid, automatically rewrite the KILL for this new nickname.
|
||||
* --this keeps servers in synch when nick change and kill collide
|
||||
*/
|
||||
if(IsDigit(*user) || (!(target_p = whowas_get_history(user, (long) KILLCHASETIMELIMIT))))
|
||||
if(rfc1459::is_digit(*user) || (!(target_p = whowas_get_history(user, (long) KILLCHASETIMELIMIT))))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
|
||||
form_str(ERR_NOSUCHNICK), IsDigit(*user) ? "*" : user);
|
||||
form_str(ERR_NOSUCHNICK), rfc1459::is_digit(*user) ? "*" : user);
|
||||
return;
|
||||
}
|
||||
sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name);
|
||||
|
|
|
@ -250,7 +250,7 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
|
|||
* here plain old channel msg?
|
||||
*/
|
||||
|
||||
if(IsChanPrefix(*nick))
|
||||
if(rfc1459::is_chan_prefix(*nick))
|
||||
{
|
||||
/* ignore send of local channel to a server (should not happen) */
|
||||
if(IsServer(client_p) && *nick == '&')
|
||||
|
@ -407,7 +407,7 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
|
|||
/* dont give this numeric when source is local,
|
||||
* because its misleading --anfl
|
||||
*/
|
||||
if(!MyClient(source_p) && IsDigit(*nick))
|
||||
if(!MyClient(source_p) && rfc1459::is_digit(*nick))
|
||||
sendto_one(source_p, ":%s %d %s * :Target left IRC. "
|
||||
"Failed to deliver: [%.20s]",
|
||||
get_id(&me, source_p), ERR_NOSUCHNICK,
|
||||
|
|
|
@ -83,7 +83,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
}
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(*dest))
|
||||
if(!rfc1459::is_chan_prefix(*dest))
|
||||
{
|
||||
/* if here, it has to be a non-channel name */
|
||||
user_mode(client_p, source_p, parc, parv);
|
||||
|
@ -157,7 +157,7 @@ ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
struct membership *msptr;
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
||||
return;
|
||||
|
@ -194,7 +194,7 @@ ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
struct Channel *chptr = NULL;
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
||||
return;
|
||||
|
@ -267,7 +267,7 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
int mems;
|
||||
struct Client *fakesource_p;
|
||||
|
||||
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
return;
|
||||
|
||||
if((chptr = find_channel(parv[2])) == NULL)
|
||||
|
|
|
@ -474,7 +474,7 @@ ms_save(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Ignored SAVE message for non-person %s from %s",
|
||||
target_p->name, source_p->name);
|
||||
else if (IsDigit(target_p->name[0]))
|
||||
else if (rfc1459::is_digit(target_p->name[0]))
|
||||
sendto_realops_snomask(SNO_DEBUG, L_ALL,
|
||||
"Ignored noop SAVE message for %s from %s",
|
||||
target_p->name, source_p->name);
|
||||
|
@ -501,7 +501,7 @@ clean_username(const char *username)
|
|||
{
|
||||
len++;
|
||||
|
||||
if(!IsUserChar(*username))
|
||||
if(!rfc1459::is_user(*username))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ clean_host(const char *host)
|
|||
{
|
||||
len++;
|
||||
|
||||
if(!IsHostChar(*host))
|
||||
if(!rfc1459::is_host(*host))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -544,14 +544,14 @@ clean_uid(const char *uid, const char *sid)
|
|||
if(strncmp(uid, sid, strlen(sid)))
|
||||
return false;
|
||||
|
||||
if(!IsDigit(*uid++))
|
||||
if(!rfc1459::is_digit(*uid++))
|
||||
return false;
|
||||
|
||||
for(; *uid; uid++)
|
||||
{
|
||||
len++;
|
||||
|
||||
if(!IsIdChar(*uid))
|
||||
if(!rfc1459::is_id(*uid))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -874,7 +874,7 @@ perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
|
|||
sendto_one(client_p, ":%s SAVE %s %ld", me.id,
|
||||
source_p->id, (long)newts);
|
||||
/* don't send a redundant nick change */
|
||||
if (!IsDigit(source_p->name[0]))
|
||||
if (!rfc1459::is_digit(source_p->name[0]))
|
||||
change_remote_nick(client_p, source_p, SAVE_NICKTS, source_p->id, 1);
|
||||
}
|
||||
else
|
||||
|
@ -924,7 +924,7 @@ perform_nickchange_collides(struct Client *source_p, struct Client *client_p,
|
|||
sendto_one(client_p, ":%s SAVE %s %ld", me.id,
|
||||
source_p->id, (long)newts);
|
||||
/* send a :<id> NICK <id> <ts> (!) */
|
||||
if (!IsDigit(source_p->name[0]))
|
||||
if (!rfc1459::is_digit(source_p->name[0]))
|
||||
change_remote_nick(client_p, source_p, SAVE_NICKTS, source_p->id, 1);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -550,8 +550,10 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
return;
|
||||
}
|
||||
|
||||
if(!IsDigit(parv[3][0]) || !IsIdChar(parv[3][1]) ||
|
||||
!IsIdChar(parv[3][2]) || parv[3][3] != '\0')
|
||||
if(!rfc1459::is_digit(parv[3][0]) ||
|
||||
!rfc1459::is_id(parv[3][1]) ||
|
||||
!rfc1459::is_id(parv[3][2]) ||
|
||||
parv[3][3] != '\0')
|
||||
{
|
||||
sendto_one(client_p, "ERROR :Invalid SID");
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
|
@ -734,7 +736,7 @@ bogus_host(const char *host)
|
|||
|
||||
for(s = host; *s; s++)
|
||||
{
|
||||
if(!IsServChar(*s))
|
||||
if(!rfc1459::is_serv(*s))
|
||||
{
|
||||
bogus_server = true;
|
||||
break;
|
||||
|
|
|
@ -95,7 +95,7 @@ clicap_find(const char *data, int *negate, int *finished)
|
|||
return NULL;
|
||||
|
||||
/* skip any whitespace */
|
||||
while(*p && IsSpace(*p))
|
||||
while(*p && rfc1459::is_space(*p))
|
||||
p++;
|
||||
|
||||
if(EmptyString(p))
|
||||
|
|
|
@ -51,7 +51,7 @@ clean_host(const char *host)
|
|||
{
|
||||
len++;
|
||||
|
||||
if(!IsHostChar(*host))
|
||||
if(!rfc1459::is_host(*host))
|
||||
return false;
|
||||
if(*host == '/')
|
||||
last_slash = host;
|
||||
|
@ -60,7 +60,7 @@ clean_host(const char *host)
|
|||
if(len > HOSTLEN)
|
||||
return false;
|
||||
|
||||
if(last_slash && IsDigit(last_slash[1]))
|
||||
if(last_slash && rfc1459::is_digit(last_slash[1]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -66,7 +66,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
target_p = find_person(parv[1]);
|
||||
if(target_p == NULL)
|
||||
{
|
||||
if(!MyClient(source_p) && IsDigit(parv[1][0]))
|
||||
if(!MyClient(source_p) && rfc1459::is_digit(parv[1][0]))
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
|
||||
"* :Target left IRC. Failed to invite to %s",
|
||||
parv[2]);
|
||||
|
|
|
@ -134,7 +134,7 @@ clean_string(char *dest, const unsigned char *src, size_t len)
|
|||
if(len <= 1)
|
||||
break;
|
||||
}
|
||||
else if(!IsPrint(*src)) /* if NOT printable */
|
||||
else if(!rfc1459::is_print(*src)) // if NOT printable
|
||||
{
|
||||
*d++ = '^';
|
||||
--len;
|
||||
|
|
|
@ -200,7 +200,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if (*args == '<')
|
||||
{
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
{
|
||||
params->users_max = atoi(args);
|
||||
if (params->users_max == 0)
|
||||
|
@ -212,7 +212,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
else if (*args == '>')
|
||||
{
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
params->users_min = atoi(args) + 1;
|
||||
else
|
||||
params->users_min = 0;
|
||||
|
@ -224,7 +224,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
{
|
||||
/* Creation time earlier than last x minutes. */
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
{
|
||||
params->created_max = rb_current_time() - (60 * atoi(args));
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
{
|
||||
/* Creation time within last x minutes. */
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
{
|
||||
params->created_min = rb_current_time() - (60 * atoi(args));
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
{
|
||||
/* Topic change time earlier than last x minutes. */
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
{
|
||||
params->topic_max = rb_current_time() - (60 * atoi(args));
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
{
|
||||
/* Topic change time within last x minutes. */
|
||||
args++;
|
||||
if (IsDigit(*args))
|
||||
if (rfc1459::is_digit(*args))
|
||||
{
|
||||
params->topic_min = rb_current_time() - (60 * atoi(args));
|
||||
}
|
||||
|
|
|
@ -88,8 +88,10 @@ mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if(parc == 5 && atoi(parv[3]) >= 6)
|
||||
{
|
||||
/* only mark as TS6 if the SID is valid.. */
|
||||
if(IsDigit(parv[4][0]) && IsIdChar(parv[4][1]) &&
|
||||
IsIdChar(parv[4][2]) && parv[4][3] == '\0' &&
|
||||
if(rfc1459::is_digit(parv[4][0]) &&
|
||||
rfc1459::is_id(parv[4][1]) &&
|
||||
rfc1459::is_id(parv[4][2]) &&
|
||||
parv[4][3] == '\0' &&
|
||||
EmptyString(client_p->id))
|
||||
{
|
||||
client_p->localClient->caps |= CAP_TS6;
|
||||
|
|
|
@ -89,7 +89,7 @@ ms_ping(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
get_id(source_p, target_p), source_p->name,
|
||||
get_id(target_p, target_p));
|
||||
/* not directed at an id.. */
|
||||
else if(!IsDigit(*destination))
|
||||
else if(!rfc1459::is_digit(*destination))
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER),
|
||||
destination);
|
||||
|
|
|
@ -62,7 +62,7 @@ ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
get_id(target_p, target_p));
|
||||
else
|
||||
{
|
||||
if(!IsDigit(*destination))
|
||||
if(!rfc1459::is_digit(*destination))
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER), destination);
|
||||
return;
|
||||
|
|
|
@ -158,7 +158,7 @@ me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(!MyClient(target_p))
|
||||
return;
|
||||
|
||||
if(!clean_nick(parv[2], 0) || IsDigit(parv[2][0]))
|
||||
if(!clean_nick(parv[2], 0) || rfc1459::is_digit(parv[2][0]))
|
||||
return;
|
||||
|
||||
curts = atol(parv[4]);
|
||||
|
@ -300,7 +300,7 @@ h_svc_whois(hook_data_client *data)
|
|||
* store both an ID number and an account name in one field.
|
||||
* If only digits are present, leave as is.
|
||||
*/
|
||||
while(IsDigit(*p))
|
||||
while(rfc1459::is_digit(*p))
|
||||
p++;
|
||||
if(*p == '\0')
|
||||
p = data->target->user->suser;
|
||||
|
|
|
@ -64,7 +64,7 @@ clean_username(const char *username)
|
|||
{
|
||||
len++;
|
||||
|
||||
if(!IsUserChar(*username))
|
||||
if(!rfc1459::is_user(*username))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ clean_host(const char *host)
|
|||
{
|
||||
len++;
|
||||
|
||||
if(!IsHostChar(*host))
|
||||
if(!rfc1459::is_host(*host))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
|||
{
|
||||
/* Strip leading digits, unless it's purely numeric. */
|
||||
const char *p = login;
|
||||
while(IsDigit(*p))
|
||||
while(rfc1459::is_digit(*p))
|
||||
p++;
|
||||
if(!*p)
|
||||
p = login;
|
||||
|
|
|
@ -1727,7 +1727,7 @@ stats_l_client(struct Client *source_p, struct Client *target_p,
|
|||
{
|
||||
sendto_one_numeric(source_p, RPL_STATSLINKINFO, Lformat,
|
||||
show_ip(source_p, target_p) ?
|
||||
(IsUpper(statchar) ?
|
||||
(rfc1459::is_upper(statchar) ?
|
||||
get_client_name(target_p, SHOW_IP) :
|
||||
get_client_name(target_p, HIDE_IP)) :
|
||||
get_client_name(target_p, MASK_IP),
|
||||
|
|
|
@ -518,7 +518,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
|
|||
q = target_p->user->suser;
|
||||
if (!EmptyString(q))
|
||||
{
|
||||
while(IsDigit(*q))
|
||||
while(rfc1459::is_digit(*q))
|
||||
q++;
|
||||
if(*q == '\0')
|
||||
q = target_p->user->suser;
|
||||
|
|
|
@ -121,7 +121,7 @@ ms_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER),
|
||||
IsDigit(parv[1][0]) ? "*" : parv[1]);
|
||||
rfc1459::is_digit(parv[1][0]) ? "*" : parv[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue