degesch: support CASEMAPPING=rfc1459-strict
This commit is contained in:
parent
f57cc7923d
commit
2b2da0beab
21
common.c
21
common.c
|
@ -58,6 +58,16 @@
|
||||||
(link)->next = (following); \
|
(link)->next = (following); \
|
||||||
BLOCK_END
|
BLOCK_END
|
||||||
|
|
||||||
|
#define TRIVIAL_STRXFRM(name, fn) \
|
||||||
|
static size_t \
|
||||||
|
name (char *dest, const char *src, size_t n) \
|
||||||
|
{ \
|
||||||
|
size_t len = strlen (src); \
|
||||||
|
while (n-- && (*dest++ = (fn) (*src++))) \
|
||||||
|
; \
|
||||||
|
return len; \
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
transform_str (char *s, int (*tolower) (int c))
|
transform_str (char *s, int (*tolower) (int c))
|
||||||
{
|
{
|
||||||
|
@ -103,6 +113,17 @@ strncasecmp_ascii (const char *a, const char *b, size_t n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
irc_tolower_strict (int c)
|
||||||
|
{
|
||||||
|
if (c == '[') return '{';
|
||||||
|
if (c == ']') return '}';
|
||||||
|
if (c == '\\') return '|';
|
||||||
|
return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRIVIAL_STRXFRM (irc_strxfrm_strict, irc_tolower_strict)
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
resolve_relative_runtime_filename (const char *filename)
|
resolve_relative_runtime_filename (const char *filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5673,8 +5673,7 @@ irc_handle_isupport_casemapping (struct server *s, char *value)
|
||||||
else if (!strcmp (value, "rfc1459"))
|
else if (!strcmp (value, "rfc1459"))
|
||||||
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
||||||
else if (!strcmp (value, "rfc1459-strict"))
|
else if (!strcmp (value, "rfc1459-strict"))
|
||||||
// TODO: implement
|
irc_set_casemapping (s, irc_tolower_strict, irc_strxfrm_strict);
|
||||||
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue