1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Remove broken by design /set translation.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4698 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-02-02 18:36:57 +00:00 committed by exg
parent ee59980363
commit c403b70de4
8 changed files with 0 additions and 181 deletions

View File

@ -34,7 +34,6 @@ libfe_common_core_a_SOURCES = \
printtext.c \ printtext.c \
fe-recode.c \ fe-recode.c \
themes.c \ themes.c \
translation.c \
window-activity.c \ window-activity.c \
window-commands.c \ window-commands.c \
window-items.c \ window-items.c \
@ -61,7 +60,6 @@ pkginc_fe_common_core_HEADERS = \
printtext.h \ printtext.h \
fe-recode.h \ fe-recode.h \
themes.h \ themes.h \
translation.h \
window-activity.h \ window-activity.h \
window-items.h \ window-items.h \
windows-layout.h \ windows-layout.h \

View File

@ -43,7 +43,6 @@
#include "printtext.h" #include "printtext.h"
#include "formats.h" #include "formats.h"
#include "themes.h" #include "themes.h"
#include "translation.h"
#include "fe-channels.h" #include "fe-channels.h"
#include "fe-windows.h" #include "fe-windows.h"
#include "window-activity.h" #include "window-activity.h"
@ -187,7 +186,6 @@ void fe_common_core_init(void)
fe_modules_init(); fe_modules_init();
fe_server_init(); fe_server_init();
fe_settings_init(); fe_settings_init();
translation_init();
windows_init(); windows_init();
window_activity_init(); window_activity_init();
window_commands_init(); window_commands_init();
@ -231,7 +229,6 @@ void fe_common_core_deinit(void)
fe_modules_deinit(); fe_modules_deinit();
fe_server_deinit(); fe_server_deinit();
fe_settings_deinit(); fe_settings_deinit();
translation_deinit();
windows_deinit(); windows_deinit();
window_activity_deinit(); window_activity_deinit();
window_commands_deinit(); window_commands_deinit();

View File

@ -31,7 +31,6 @@
#include "window-items.h" #include "window-items.h"
#include "formats.h" #include "formats.h"
#include "themes.h" #include "themes.h"
#include "translation.h"
#include "recode.h" #include "recode.h"
#include "utf8.h" #include "utf8.h"
@ -963,8 +962,6 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
*ptr++ = '\0'; *ptr++ = '\0';
break; break;
} }
*ptr = (char) translation_in[(int) (unsigned char) *ptr];
} }
if (type == 7) { if (type == 7) {

View File

@ -280,8 +280,6 @@ FORMAT_REC fecommon_core_formats[] = {
{ "set_item", "$0 = $1", 2, { 0, 0 } }, { "set_item", "$0 = $1", 2, { 0, 0 } },
{ "set_unknown", "Unknown setting $0", 1, { 0 } }, { "set_unknown", "Unknown setting $0", 1, { 0 } },
{ "set_not_boolean", "Setting {hilight $0} isn't boolean, use /SET", 1, { 0 } }, { "set_not_boolean", "Setting {hilight $0} isn't boolean, use /SET", 1, { 0 } },
{ "translation_not_found", "Error opening translation table file $0: $1", 2, { 0, 0 } },
{ "translation_file_error", "Error parsing translation table file $0", 1, { 0 } },
{ "no_completions", "There's no completions", 0 }, { "no_completions", "There's no completions", 0 },
{ "completion_removed", "Removed completion $0", 1, { 0 } }, { "completion_removed", "Removed completion $0", 1, { 0 } },
{ "completion_header", "%#Key Value Auto", 0 }, { "completion_header", "%#Key Value Auto", 0 },

View File

@ -245,8 +245,6 @@ enum {
TXT_SET_ITEM, TXT_SET_ITEM,
TXT_SET_UNKNOWN, TXT_SET_UNKNOWN,
TXT_SET_NOT_BOOLEAN, TXT_SET_NOT_BOOLEAN,
TXT_TRANSLATION_NOT_FOUND,
TXT_TRANSLATION_FILE_ERROR,
TXT_NO_COMPLETIONS, TXT_NO_COMPLETIONS,
TXT_COMPLETION_REMOVED, TXT_COMPLETION_REMOVED,
TXT_COMPLETION_HEADER, TXT_COMPLETION_HEADER,

View File

@ -1,152 +0,0 @@
/*
translation.c : irssi
Copyright (C) 1999-2000 Timo Sirainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "module.h"
#include "module-formats.h"
#include "signals.h"
#include "line-split.h"
#include "misc.h"
#include "levels.h"
#include "settings.h"
#include "printtext.h"
unsigned char translation_in[256], translation_out[256];
static char *current_translation;
void translation_reset(void)
{
int n;
for (n = 0; n < 256; n++)
translation_in[n] = (unsigned char) n;
for (n = 0; n < 256; n++)
translation_out[n] = (unsigned char) n;
}
void translate_output(char *text)
{
while (*text != '\0') {
*text = (char) translation_out[(int) (unsigned char) *text];
text++;
}
}
#define gethex(a) \
(i_isdigit(a) ? ((a)-'0') : (i_toupper(a)-'A'+10))
void translation_parse_line(const char *str, int *pos)
{
const char *ptr;
int value;
for (ptr = str; *ptr != '\0'; ptr++) {
if (ptr[0] != '0' || ptr[1] != 'x')
break;
ptr += 2;
value = (gethex(ptr[0]) << 4) + gethex(ptr[1]);
if (*pos < 256)
translation_in[*pos] = (unsigned char) value;
else
translation_out[*pos-256] = (unsigned char) value;
(*pos)++;
ptr += 2;
if (*ptr != ',') break;
}
}
int translation_read(const char *file)
{
char tmpbuf[1024], *str, *path;
LINEBUF_REC *buffer;
int f, pos, ret, recvlen;
g_return_val_if_fail(file != NULL, FALSE);
path = convert_home(file);
f = open(file, O_RDONLY);
g_free(path);
if (f == -1) {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_TRANSLATION_NOT_FOUND, file,
g_strerror(errno));
return FALSE;
}
pos = 0; buffer = NULL;
while (pos < 512) {
recvlen = read(f, tmpbuf, sizeof(tmpbuf));
ret = line_split(tmpbuf, recvlen, &str, &buffer);
if (ret <= 0) break;
translation_parse_line(str, &pos);
}
line_split_free(buffer);
close(f);
if (pos != 512) {
translation_reset();
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_TRANSLATION_FILE_ERROR, file);
}
return pos == 512;
}
static void read_settings(void)
{
const char *translation;
translation = settings_get_str("translation");
if (*translation == '\0') {
if (current_translation != NULL) {
g_free_and_null(current_translation);
translation_reset();
}
return;
}
if (current_translation == NULL ||
strcmp(translation, current_translation) != 0) {
g_free_not_null(current_translation);
current_translation = g_strdup(translation);
translation_read(translation);
}
}
void translation_init(void)
{
translation_reset();
current_translation = NULL;
settings_add_str("misc", "translation", "");
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
read_settings();
}
void translation_deinit(void)
{
read_settings();
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}

View File

@ -1,12 +0,0 @@
#ifndef __TRANSLATION_H
#define __TRANSLATION_H
extern unsigned char translation_in[256], translation_out[256];
int translation_read(const char *file);
void translate_output(char *text);
void translation_init(void);
void translation_deinit(void);
#endif

View File

@ -30,7 +30,6 @@
#include "completion.h" #include "completion.h"
#include "command-history.h" #include "command-history.h"
#include "keyboard.h" #include "keyboard.h"
#include "translation.h"
#include "printtext.h" #include "printtext.h"
#include "term.h" #include "term.h"
@ -283,7 +282,6 @@ static void paste_send(void)
history = command_history_current(active_win); history = command_history_current(active_win);
command_history_add(history, text); command_history_add(history, text);
translate_output(text);
signal_emit("send command", 3, text, signal_emit("send command", 3, text,
active_win->active_server, active_win->active); active_win->active_server, active_win->active);
g_free(text); g_free(text);
@ -296,7 +294,6 @@ static void paste_send(void)
history = command_history_current(active_win); history = command_history_current(active_win);
command_history_add(history, str->str); command_history_add(history, str->str);
translate_output(str->str);
signal_emit("send command", 3, str->str, signal_emit("send command", 3, str->str,
active_win->active_server, active_win->active_server,
active_win->active); active_win->active);
@ -547,8 +544,6 @@ static void key_send_line(void)
add_history = *str == '\0' ? NULL : g_strdup(str); add_history = *str == '\0' ? NULL : g_strdup(str);
history = command_history_current(active_win); history = command_history_current(active_win);
translate_output(str);
if (redir == NULL) { if (redir == NULL) {
signal_emit("send command", 3, str, signal_emit("send command", 3, str,
active_win->active_server, active_win->active_server,