diff options
author | Valentin Batz <senneth@irssi.org> | 2004-12-20 13:59:15 +0000 |
---|---|---|
committer | vb <vb@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2004-12-20 13:59:15 +0000 |
commit | 7be7dd374c23054f379fdf8361b31d3f658953c0 (patch) | |
tree | 525c6f344817828c6a6aab58333f85d5c1b1458e /src/core/recode.c | |
parent | 5f81451df63acf5a809b5a551bc1b1e3e63ccfa0 (diff) | |
download | irssi-7be7dd374c23054f379fdf8361b31d3f658953c0.zip |
Added <tag>/<target> support for recode.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3692 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/recode.c')
-rw-r--r-- | src/core/recode.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/core/recode.c b/src/core/recode.c index 11128635..78d0be55 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -65,13 +65,14 @@ static gboolean is_translit(const char *charset) return (pos != NULL); } -char *recode_in(const char *str, const char *target) +char *recode_in(const SERVER_REC *server, const char *str, const char *target) { #ifdef HAVE_GLIB2 const char *from = NULL; const char *to = NULL; char *translit_to = NULL; char *recoded = NULL; + char *tagtarget = NULL; gboolean term_is_utf8, str_is_utf8, translit; int len; @@ -83,7 +84,13 @@ char *recode_in(const char *str, const char *target) str_is_utf8 = g_utf8_validate(str, len, NULL); translit = settings_get_bool("recode_transliterate"); - if (target != NULL) + if (server != NULL) + tagtarget = server->tag == NULL ? NULL : + g_strdup_printf("%s/%s", server->tag, target); + if (tagtarget != NULL) + from = iconfig_get_str("conversions", tagtarget, NULL); + g_free(tagtarget); + if (target != NULL && from == NULL) from = iconfig_get_str("conversions", target, NULL); term_is_utf8 = recode_get_charset(&to); @@ -115,7 +122,7 @@ char *recode_in(const char *str, const char *target) #endif } -char *recode_out(const char *str, const char *target) +char *recode_out(const SERVER_REC *server, const char *str, const char *target) { #ifdef HAVE_GLIB2 char *recoded = NULL; @@ -133,8 +140,16 @@ char *recode_out(const char *str, const char *target) if (target) { const char *to = NULL; char *translit_to = NULL; - - to = iconfig_get_str("conversions", target, NULL); + char *tagtarget = NULL; + + if (server != NULL) + tagtarget = server->tag == NULL ? NULL : + g_strdup_printf("%s/%s", server->tag, target); + if (tagtarget != NULL) + to = iconfig_get_str("conversions", tagtarget, NULL); + else + to = iconfig_get_str("conversions", target, NULL); + g_free(tagtarget); if (to == NULL || *to == '\0') /* default outgoing charset if set */ to = settings_get_str("recode_out_default_charset"); |