summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Short <zul@gentoo.org>2003-11-22 01:27:10 +0000
committerChuck Short <zul@gentoo.org>2003-11-22 01:27:10 +0000
commit725043f36d18abe140ecdda943f231de15c75882 (patch)
treed97ff5224ab3fe6426b59c5c7c29806a97879153 /net-irc/irssi-recode
parentNew version, closes 34020. (diff)
downloadhistorical-725043f36d18abe140ecdda943f231de15c75882.tar.gz
historical-725043f36d18abe140ecdda943f231de15c75882.tar.bz2
historical-725043f36d18abe140ecdda943f231de15c75882.zip
New version, closes 34020.
Diffstat (limited to 'net-irc/irssi-recode')
-rw-r--r--net-irc/irssi-recode/Manifest6
-rw-r--r--net-irc/irssi-recode/files/digest-irssi-recode-1.51
-rw-r--r--net-irc/irssi-recode/files/recode.c183
-rw-r--r--net-irc/irssi-recode/irssi-recode-1.5.ebuild37
-rw-r--r--net-irc/irssi-recode/metadata.xml5
5 files changed, 229 insertions, 3 deletions
diff --git a/net-irc/irssi-recode/Manifest b/net-irc/irssi-recode/Manifest
index 1bfe3edb52bc..4f45ca2918af 100644
--- a/net-irc/irssi-recode/Manifest
+++ b/net-irc/irssi-recode/Manifest
@@ -1,7 +1,7 @@
-MD5 aa1a562820b8ca180fa46e205acc174d irssi-recode-1.5.ebuild 1176
+MD5 7582835363634be1b4642103d6d8d1d5 irssi-recode-1.5.ebuild 1173
MD5 1c31c35488631f506139702491afe457 irssi-recode-1.36.ebuild 1256
-MD5 2ffc457acf59ae9633055a23fbe2635d ChangeLog 542
+MD5 cd657c368966bd6d672b1740449fdcd6 ChangeLog 707
MD5 44c39c6ad372a8e5a5e7ee3311f703a7 metadata.xml 160
MD5 cb17857da5af4446fef7e94d553277de files/digest-irssi-recode-1.36 64
MD5 cb17857da5af4446fef7e94d553277de files/digest-irssi-recode-1.5 64
-MD5 bb128d4991f99064cc7e120f8289d825 files/recode.c 5032
+MD5 e51356f9be170a9d9ab92dcb51983fe7 files/recode.c 5027
diff --git a/net-irc/irssi-recode/files/digest-irssi-recode-1.5 b/net-irc/irssi-recode/files/digest-irssi-recode-1.5
new file mode 100644
index 000000000000..0ecb65f16bf8
--- /dev/null
+++ b/net-irc/irssi-recode/files/digest-irssi-recode-1.5
@@ -0,0 +1 @@
+MD5 6d66982723e2eb8780ae3b8b3a7ba08d irssi-0.8.6.tar.bz2 746551
diff --git a/net-irc/irssi-recode/files/recode.c b/net-irc/irssi-recode/files/recode.c
new file mode 100644
index 000000000000..0005fbe247c9
--- /dev/null
+++ b/net-irc/irssi-recode/files/recode.c
@@ -0,0 +1,183 @@
+/*
+ * recode.c - a character set converter
+ * $Id: recode.c,v 1.1 2003/11/22 01:27:02 zul Exp $
+ *
+ * Copyright (c) 2003 Jean-Yves Lefort
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Jean-Yves Lefort nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * requirements:
+ *
+ * irssi 0.8.6 (built using --with-glib2)
+ * irssi 0.8.6 sources
+ * GLib 2.0 or superior
+ *
+ * compile:
+ *
+ * export IRSSI=~/src/irssi-0.8.6
+ * gcc -g -shared -DHAVE_CONFIG_H -I$IRSSI -I$IRSSI/src -I$IRSSI/src/core -I$IRSSI/src/fe-common/core `pkg-config --cflags glib-2.0` -o ~/.irssi/modules/librecode.so recode.c
+ *
+ * usage:
+ *
+ * /load recode
+ *
+ * Load the converter into irssi.
+ *
+ * If the terminal type is UTF-8, text which isn't
+ * encoded in UTF-8 will be converted from
+ * recode_fallback.
+ *
+ * If the terminal type isn't UTF-8, valid UTF-8 text
+ * will be converted to the terminal encoding.
+ *
+ * settings:
+ *
+ * recode_fallback
+ *
+ * If the terminal type is UTF-8 and a message is not
+ * valid UTF-8, recode will attempt to convert it from
+ * this character set.
+ */
+
+#include <glib.h>
+#include <string.h>
+
+/* irssi includes */
+#include "common.h"
+#include "signals.h"
+#include "modules.h"
+#include "formats.h"
+#include "levels.h"
+#include "printtext.h"
+#include "settings.h"
+
+/*** cpp *********************************************************************/
+
+#define MODULE_NAME "recode/core"
+
+/*** module formats **********************************************************/
+
+enum {
+ RECODE_TXT_MODULE_NAME,
+
+ RECODE_TXT_CONVERSION_ERROR
+};
+
+static FORMAT_REC recode_formats[] = {
+ { MODULE_NAME, "Character set converter", 0 },
+
+ { "recode_conversion_error", "$0 {error (unable to convert from $1 to $2: $3)}", 4, { FORMAT_STRING, FORMAT_STRING, FORMAT_STRING, FORMAT_STRING } },
+
+ { NULL, NULL, 0 }
+};
+
+/*** functions ***************************************************************/
+
+static void recode_print_text_cb (TEXT_DEST_REC *dest,
+ char *text,
+ char *stripped);
+
+/*** implementation **********************************************************/
+
+void
+recode_init (void)
+{
+ theme_register(recode_formats);
+
+ settings_add_str("misc", "recode_fallback", "ISO8859-15");
+
+ signal_add("print text", (SIGNAL_FUNC) recode_print_text_cb);
+
+ module_register("recode", "core");
+}
+
+void
+recode_deinit (void)
+{
+ signal_remove("print text", (SIGNAL_FUNC) recode_print_text_cb);
+
+ settings_remove("recode_fallback");
+
+ theme_unregister();
+}
+
+static void
+recode_print_text_cb (TEXT_DEST_REC *dest, char *text, char *stripped)
+{
+ const char *charset;
+ const char *from = NULL;
+ gboolean utf8;
+
+ charset = settings_get_str("term_type");
+ if (*charset)
+ /* we use the same test as irssi, so we use the deprecated g_strcasecmp() */
+ utf8 = ! g_strcasecmp(charset, "utf-8");
+ else
+ utf8 = g_get_charset(&charset);
+
+ if (utf8)
+ {
+ if (! g_utf8_validate(text, -1, NULL))
+ from = settings_get_str("recode_fallback");
+ }
+ else
+ {
+ if (g_utf8_validate(text, -1, NULL))
+ from = "UTF-8";
+ }
+
+ if (from)
+ {
+ GError *err = NULL;
+ char *converted;
+
+ converted = g_convert(text,
+ strlen(text),
+ charset,
+ from,
+ NULL,
+ NULL,
+ &err);
+ if (! converted)
+ {
+ converted = format_get_text(MODULE_NAME,
+ dest->window,
+ dest->server,
+ dest->target,
+ RECODE_TXT_CONVERSION_ERROR,
+ text,
+ from,
+ charset,
+ err->message);
+ g_error_free(err);
+ }
+
+ signal_continue(3, dest, converted, stripped);
+ g_free(converted);
+ }
+}
diff --git a/net-irc/irssi-recode/irssi-recode-1.5.ebuild b/net-irc/irssi-recode/irssi-recode-1.5.ebuild
new file mode 100644
index 000000000000..27eb2a57741b
--- /dev/null
+++ b/net-irc/irssi-recode/irssi-recode-1.5.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/irssi-recode/irssi-recode-1.5.ebuild,v 1.1 2003/11/22 01:27:02 zul Exp $
+
+IRSSI="0.8.6"
+
+DESCRIPTION="A third party character set converting module for the Irssi IRC client"
+SRC_URI="http://irssi.org/files/irssi-${IRSSI}.tar.bz2"
+HOMEPAGE="http://lefort.be.eu.org/irssi/"
+
+DEPEND=">=net-irc/irssi-${IRSSI}
+ >=dev-libs/glib-2.0"
+RDEPEND=""
+#Irssi needs to be compiled with glib-2
+
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~mips ~amd64 ~ia64"
+
+src_compile() {
+ touch ${WORKDIR}/irssi-${IRSSI}/config.h &&
+ gcc -g -shared -DHAVE_CONFIG_H -I${WORKDIR}/irssi-${IRSSI} -I${WORKDIR}/irssi-${IRSSI}/src \
+ -I${WORKDIR}/irssi-${IRSSI}/src/core -I${WORKDIR}/irssi-${IRSSI}/src/fe-common/core \
+ `pkg-config --cflags glib-2.0` -o ${T}/librecode.so ${FILESDIR}/recode.c || die
+}
+
+src_install() {
+ insinto /usr/lib/irssi/modules
+ doins ${T}/librecode.so
+}
+
+pkg_postinst() {
+einfo ""
+einfo "Type /load recode in Irssi to load this module."
+einfo "See ${FILESDIR}/recode.c for more information."
+einfo ""
+}
diff --git a/net-irc/irssi-recode/metadata.xml b/net-irc/irssi-recode/metadata.xml
new file mode 100644
index 000000000000..6ef15e900f17
--- /dev/null
+++ b/net-irc/irssi-recode/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-irc</herd>
+</pkgmetadata>