mirror of
https://github.com/irssi/irssi.git
synced 2026-08-21 17:42:49 +02:00
Implement the UTF8ONLY IRCv3 specification
https://ircv3.net/specs/extensions/utf8-only
This commit is contained in:
parent
e31d42b381
commit
3fa42b3805
3 changed files with 21 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ static GHashTable *uniqids, *uniqstrids;
|
||||||
static GHashTable *idlookup, *stridlookup;
|
static GHashTable *idlookup, *stridlookup;
|
||||||
static int next_uniq_id;
|
static int next_uniq_id;
|
||||||
|
|
||||||
void *module_check_cast(void *object, int type_pos, const char *id)
|
const void *module_check_cast(const void *object, int type_pos, const char *id)
|
||||||
{
|
{
|
||||||
return object == NULL || module_find_id(id,
|
return object == NULL || module_find_id(id,
|
||||||
G_STRUCT_MEMBER(int, object, type_pos)) == -1 ? NULL : object;
|
G_STRUCT_MEMBER(int, object, type_pos)) == -1 ? NULL : object;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name);
|
||||||
#define MODULE_CHECK_CAST_MODULE(object, cast, type_field, module, id) \
|
#define MODULE_CHECK_CAST_MODULE(object, cast, type_field, module, id) \
|
||||||
((cast *) module_check_cast_module(object, \
|
((cast *) module_check_cast_module(object, \
|
||||||
offsetof(cast, type_field), module, id))
|
offsetof(cast, type_field), module, id))
|
||||||
void *module_check_cast(void *object, int type_pos, const char *id);
|
const void *module_check_cast(const void *object, int type_pos, const char *id);
|
||||||
void *module_check_cast_module(void *object, int type_pos,
|
void *module_check_cast_module(void *object, int type_pos,
|
||||||
const char *module, const char *id);
|
const char *module, const char *id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
#include <irssi/src/lib-config/iconfig.h>
|
#include <irssi/src/lib-config/iconfig.h>
|
||||||
#include <irssi/src/core/misc.h>
|
#include <irssi/src/core/misc.h>
|
||||||
|
|
||||||
|
#include <irssi/src/irc/core/irc.h>
|
||||||
|
#include <irssi/src/irc/core/irc-servers.h>
|
||||||
|
|
||||||
static char *translit_charset;
|
static char *translit_charset;
|
||||||
static gboolean term_is_utf8;
|
static gboolean term_is_utf8;
|
||||||
|
|
||||||
|
|
@ -65,6 +68,22 @@ static char *find_conversion(const SERVER_REC *server, const char *target)
|
||||||
{
|
{
|
||||||
char *conv = NULL;
|
char *conv = NULL;
|
||||||
|
|
||||||
|
if (IS_IRC_SERVER(server))
|
||||||
|
{
|
||||||
|
IRC_SERVER_REC *irc_server = (IRC_SERVER_REC *) server;
|
||||||
|
if (g_hash_table_lookup(irc_server->isupport, "utf8only"))
|
||||||
|
{
|
||||||
|
/* "Clients implementing this specification MUST NOT send non-UTF-8
|
||||||
|
* data to the server once they have seen this token."
|
||||||
|
* "If a client implementing this specification sees this token,
|
||||||
|
* they MUST set their outgoing encoding to UTF-8 without requiring
|
||||||
|
* any user intervention."
|
||||||
|
* -- https://ircv3.net/specs/extensions/utf8-only
|
||||||
|
*/
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (server != NULL && target != NULL) {
|
if (server != NULL && target != NULL) {
|
||||||
char *tagtarget = g_strdup_printf("%s/%s", server->tag, target);
|
char *tagtarget = g_strdup_printf("%s/%s", server->tag, target);
|
||||||
conv = iconfig_get_str("conversions", tagtarget, NULL);
|
conv = iconfig_get_str("conversions", tagtarget, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue