degesch: stubplement casemapping changes
This commit is contained in:
parent
c3439175d7
commit
63a65f9f7c
51
degesch.c
51
degesch.c
|
@ -2919,6 +2919,29 @@ irc_left_channel (struct channel *channel)
|
||||||
irc_channel_unlink_user (channel, iter);
|
irc_channel_unlink_user (channel, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
static void
|
||||||
|
irc_rehash_and_fix_conflicts (struct server *s)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
irc_set_casemapping (struct server *s,
|
||||||
|
irc_tolower_fn tolower, irc_strxfrm_fn strxfrm)
|
||||||
|
{
|
||||||
|
if (tolower == s->irc_tolower
|
||||||
|
&& strxfrm == s->irc_strxfrm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
s->irc_tolower = tolower;
|
||||||
|
s->irc_strxfrm = strxfrm;
|
||||||
|
|
||||||
|
// Ideally we would never have to do this but I can't think of a workaround
|
||||||
|
irc_rehash_and_fix_conflicts (s);
|
||||||
|
}
|
||||||
|
|
||||||
// --- Core functionality ------------------------------------------------------
|
// --- Core functionality ------------------------------------------------------
|
||||||
|
|
||||||
// Most of the core IRC code comes from ZyklonB which is mostly blocking.
|
// Most of the core IRC code comes from ZyklonB which is mostly blocking.
|
||||||
|
@ -3267,15 +3290,11 @@ on_irc_disconnected (struct server *s)
|
||||||
|
|
||||||
s->cap_echo_message = false;
|
s->cap_echo_message = false;
|
||||||
|
|
||||||
irc_tolower_fn old_tolower = s->irc_tolower;
|
// Need to call this before server_init_specifics()
|
||||||
irc_strxfrm_fn old_strxfrm = s->irc_strxfrm;
|
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
||||||
|
|
||||||
server_free_specifics (s);
|
server_free_specifics (s);
|
||||||
server_init_specifics (s);
|
server_init_specifics (s);
|
||||||
// TODO: compare with the original functions and merge users and their
|
|
||||||
// buffers as necessary; ideally we would never have to do this but
|
|
||||||
// I can't think of any good workaround
|
|
||||||
s->irc_tolower = old_tolower;
|
|
||||||
s->irc_strxfrm = old_strxfrm;
|
|
||||||
|
|
||||||
// Take any relevant actions
|
// Take any relevant actions
|
||||||
if (s->ctx->quitting)
|
if (s->ctx->quitting)
|
||||||
|
@ -5203,25 +5222,13 @@ irc_handle_isupport_prefix (struct server *s, char *value)
|
||||||
static void
|
static void
|
||||||
irc_handle_isupport_casemapping (struct server *s, char *value)
|
irc_handle_isupport_casemapping (struct server *s, char *value)
|
||||||
{
|
{
|
||||||
// TODO: reinitialize hashtables with the new tolower() and strxfrm(),
|
|
||||||
// note that collisions may arise on reconnecting
|
|
||||||
|
|
||||||
if (!strcmp (value, "ascii"))
|
if (!strcmp (value, "ascii"))
|
||||||
{
|
irc_set_casemapping (s, tolower_ascii, tolower_ascii_strxfrm);
|
||||||
s->irc_tolower = tolower_ascii;
|
|
||||||
s->irc_strxfrm = tolower_ascii_strxfrm;
|
|
||||||
}
|
|
||||||
else if (!strcmp (value, "rfc1459"))
|
else if (!strcmp (value, "rfc1459"))
|
||||||
{
|
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
||||||
s->irc_tolower = irc_tolower;
|
|
||||||
s->irc_strxfrm = irc_strxfrm;
|
|
||||||
}
|
|
||||||
else if (!strcmp (value, "rfc1459-strict"))
|
else if (!strcmp (value, "rfc1459-strict"))
|
||||||
{
|
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
s->irc_tolower = irc_tolower;
|
irc_set_casemapping (s, irc_tolower, irc_strxfrm);
|
||||||
s->irc_strxfrm = irc_strxfrm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue