summaryrefslogtreecommitdiff
path: root/net-im/centericq
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2003-10-08 19:03:09 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2003-10-08 19:03:09 +0000
commit54540550d7e10479452b1c443427e29e70ec3a14 (patch)
tree5c757b4a49c839cf6d1a0aa98d77aad1df5a59a9 /net-im/centericq
parentAdd libtlen 20030721, backend for interoperability with (diff)
- Original program can't send/receive non-ASCII chars correctly
in MSN/Yahoo. This patch can fix that. Also note that original config file has problem in writing default charset setting to file. - Bump PORTREVISION PR: 57734 Submitted by: maintainer
Notes
Notes: svn path=/head/; revision=90658
Diffstat (limited to 'net-im/centericq')
-rw-r--r--net-im/centericq/Makefile4
-rw-r--r--net-im/centericq/files/patch-icqconf.cc11
-rw-r--r--net-im/centericq/files/patch-msnhook.cc164
-rw-r--r--net-im/centericq/files/patch-utf8conv.h61
-rw-r--r--net-im/centericq/files/patch-yahoohook.cc11
5 files changed, 31 insertions, 220 deletions
diff --git a/net-im/centericq/Makefile b/net-im/centericq/Makefile
index c0aa12a53f23..becb45bc6430 100644
--- a/net-im/centericq/Makefile
+++ b/net-im/centericq/Makefile
@@ -8,7 +8,7 @@
PORTNAME= centericq
PORTVERSION= 4.9.7
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net
MASTER_SITES= http://konst.org.ua/download/
@@ -67,7 +67,7 @@ post-patch:
${MV} -f ${file} ${file}.orig ; \
${GREP} -v "_G_config.h" ${file}.orig > ${file})
.endfor
-
+
.if !defined(NOPORTDOCS)
post-install:
@${MKDIR} ${DOCSDIR}
diff --git a/net-im/centericq/files/patch-icqconf.cc b/net-im/centericq/files/patch-icqconf.cc
new file mode 100644
index 000000000000..21c75b162f44
--- /dev/null
+++ b/net-im/centericq/files/patch-icqconf.cc
@@ -0,0 +1,11 @@
+--- src/icqconf.cc.orig Wed Oct 1 08:27:45 2003
++++ src/icqconf.cc Wed Oct 8 17:28:21 2003
+@@ -270,7 +270,7 @@
+ if(getantispam()) f << "antispam" << endl;
+ if(getmailcheck()) f << "mailcheck" << endl;
+ if(getaskaway()) f << "askaway" << endl;
+- f << "defcharset" << getdefcharset() << endl;
++ f << "defcharset\t" << getdefcharset() << endl;
+
+ param = "";
+ for(protocolname pname = icq; pname != protocolname_size; (int) pname += 1)
diff --git a/net-im/centericq/files/patch-msnhook.cc b/net-im/centericq/files/patch-msnhook.cc
index d33decdd28ae..0756a7f29c98 100644
--- a/net-im/centericq/files/patch-msnhook.cc
+++ b/net-im/centericq/files/patch-msnhook.cc
@@ -1,29 +1,20 @@
--- src/hooks/msnhook.cc.orig Tue Sep 30 19:38:43 2003
-+++ src/hooks/msnhook.cc Tue Oct 7 10:20:29 2003
-@@ -33,6 +33,7 @@
- #include "accountmanager.h"
- #include "eventmanager.h"
- #include "imlogger.h"
-+#include "utf8conv.h"
- #include "connwrap.h"
-
- #include "msn_bittybits.h"
-@@ -248,7 +249,8 @@
++++ src/hooks/msnhook.cc Wed Oct 8 17:44:13 2003
+@@ -248,7 +248,7 @@
}
icqcontact *c = clist.get(ev.getcontact());
- text = siconv(text, conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset(), "utf8");
-+// text = siconv(text, conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset(), "utf8");
-+ text = StrToUtf8(text);
++ text = siconv(text, conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset(), "utf-8");
if(c)
if(c->getstatus() != offline || !c->inlist()) {
-@@ -378,11 +380,11 @@
+@@ -378,11 +378,11 @@
void msnhook::checkfriendly(icqcontact *c, const string friendlynick, bool forcefetch) {
string oldnick = c->getnick();
- string newnick = unmime(friendlynick);
-+ string newnick = Utf8ToStr(unmime(friendlynick));
++ string newnick = siconv(unmime(friendlynick), "utf-8", conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset());
c->setnick(newnick);
@@ -32,153 +23,12 @@
c->setdispnick(newnick);
face.relaxedupdate();
}
-@@ -602,7 +604,8 @@
+@@ -602,7 +602,7 @@
mhook.checkinlist(ic);
- string text = siconv(msg->body, "utf8", conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset());
-+// string text = siconv(msg->body, "utf8", conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset());
-+ string text = Utf8ToStr(msg->body);
++ string text = siconv(msg->body, "utf-8", conf.getrussian(msn) ? "koi8-u" : conf.getdefcharset());
em.store(immessage(ic, imevent::incoming, text));
}
-@@ -779,5 +782,139 @@
- log(string("[OUT] ") + buf);
- }
- }
-+
-+#if HAVE_ICONV_H
-+int safe_iconv( iconv_t handle, const char **inbuf, size_t *inbytesleft,
-+ char **outbuf, size_t *outbytesleft)
-+{
-+ int ret;
-+ while (*inbytesleft) {
-+ ret = iconv( handle, inbuf, inbytesleft,
-+ outbuf, outbytesleft);
-+ if (!*inbytesleft || !*outbytesleft)
-+ return ret;
-+ /*got invalid seq - so replace it with '?' */
-+ **outbuf = '?'; (*outbuf)++; (*outbytesleft)--;
-+ (*inbuf)++; (*inbytesleft)--;
-+ }
-+ return ret;
-+}
-+
-+const char* guess_current_locale_charset()
-+{
-+ char *lang, *ch;
-+ /* Return previously learned charset */
-+ if (loc_charset[0])
-+ return loc_charset;
-+
-+ lang = getenv("LANG");
-+ if (!lang) {
-+ strcpy( loc_charset, DEFAULT_CHARSET );
-+ return loc_charset;
-+ };
-+ ch = strrchr( lang, '.' );
-+ if (!ch)
-+ strcpy( loc_charset, DEFAULT_CHARSET );
-+ else {
-+ iconv_t pt;
-+ ch++;
-+ strncpy( loc_charset, ch, sizeof(loc_charset) );
-+ /* try to open iconv handle using guessed charset */
-+ if ( (pt = iconv_open( loc_charset, loc_charset )) == (iconv_t)(-1) )
-+ {
-+ strcpy( loc_charset, DEFAULT_CHARSET );
-+ } else {
-+ iconv_close(pt);
-+ };
-+
-+ }
-+
-+ return loc_charset;
-+}
-+
-+char *StrToUtf8( const char *inbuf )
-+{
-+ size_t length = strlen( inbuf );
-+ size_t outmaxlength = UTF8_BUF_LENGTH;
-+ char *outbuf = utf8_buf;
-+ char *outbuf_save = outbuf;
-+ int ret;
-+
-+ iconv_t handle = iconv_open( "utf-8", guess_current_locale_charset() );
-+ if(((int) handle) != -1) {
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+ return outbuf_save;
-+ } else {
-+ return (char *)inbuf;
-+ };
-+}
-+
-+std::string StrToUtf8( const std::string &instr )
-+{
-+ size_t length = instr.length();
-+ size_t outmaxlength = UTF8_BUF_LENGTH;
-+ const char *inbuf = instr.c_str();
-+ char *outbuf = utf8_buf;
-+ char *outbuf_save = outbuf;
-+ int ret;
-+
-+ iconv_t handle = iconv_open( "utf-8", guess_current_locale_charset() );
-+ if(((int) handle) != -1) {
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+
-+ std::string return_me = outbuf_save;
-+ return return_me;
-+ } else {
-+ return instr;
-+ };
-+}
-+
-+char *Utf8ToStr( const char *inbuf )
-+{
-+ size_t length = strlen( inbuf );
-+ size_t outmaxlength = UTF8_BUF_LENGTH / 4;
-+ char *outbuf = utf8_buf;
-+ char *outbuf_save = outbuf;
-+ int ret;
-+
-+ iconv_t handle = iconv_open( guess_current_locale_charset(), "utf-8" );
-+ if(((int) handle) != -1) {
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+ return outbuf_save;
-+ } else {
-+ return (char *)inbuf;
-+ };
-+}
-+
-+std::string Utf8ToStr( const std::string &instr )
-+{
-+ size_t length = instr.length();
-+ const char *inbuf = instr.c_str();
-+ size_t outmaxlength = UTF8_BUF_LENGTH / 4;
-+ char *outbuf = utf8_buf;
-+ char *outbuf_save = outbuf;
-+ int ret;
-+
-+ iconv_t handle = iconv_open( guess_current_locale_charset(), "utf-8" );
-+
-+ if(((int) handle) != -1) {
-+ ret = safe_iconv( handle, (const char **) &inbuf, &length, &outbuf, &outmaxlength );
-+ *outbuf = '\0';
-+ iconv_close( handle );
-+ std::string return_me = outbuf_save;
-+ return return_me;
-+ } else {
-+ return instr;
-+ };
-+}
-+#endif /* HAVE_ICONV_H */
-
- #endif
diff --git a/net-im/centericq/files/patch-utf8conv.h b/net-im/centericq/files/patch-utf8conv.h
deleted file mode 100644
index 838fe7c819be..000000000000
--- a/net-im/centericq/files/patch-utf8conv.h
+++ /dev/null
@@ -1,61 +0,0 @@
---- src/hooks/utf8conv.h Thu Jan 1 08:00:00 1970
-+++ src/hooks/utf8conv.h Tue Nov 26 16:10:40 2002
-@@ -0,0 +1,58 @@
-+/*-------------------------------------------------------*/
-+/* utf8conv.h ( Utf8 Converter ) */
-+/*-------------------------------------------------------*/
-+/* target : Converting Utf8 from/to string/char */
-+/* modifier : clsung@dragon2.net */
-+/* create : unknown */
-+/* update : 02/11/26 */
-+/*-------------------------------------------------------*/
-+#ifndef _UTF8CONV_
-+#define _UTF8CONV_
-+
-+#ifndef HAVE_ICONV_H
-+#define HAVE_ICONV_H
-+#endif
-+
-+#ifdef HAVE_ICONV_H
-+#include <iconv.h>
-+#endif
-+#include <string>
-+#define DEFAULT_CHARSET "ISO-8859-1"
-+#define UTF8_BUF_LENGTH 2048
-+/* charset name cache buffer */
-+static char loc_charset[32];
-+static char utf8_buf[UTF8_BUF_LENGTH]; // max 401 length or per message
-+/*
-+** Name: safe_iconv
-+** Purpose: 'Fault-tolerant' version if iconv. Replaces invalid seq with '?'
-+** Input: see iconv manpage
-+*/
-+int safe_iconv( iconv_t handle, const char **inbuf, size_t *inbytesleft,
-+ char **outbuf, size_t *outbytesleft);
-+
-+/*
-+** Name: guess_current_locale_charset
-+** Purpose: Try to guess default charset for the current locale
-+** Output: charset name
-+** FIXME: is there more right method for guessing charset
-+ than scanning $LANG ?
-+*/
-+const char* guess_current_locale_charset();
-+
-+/*
-+** Name: Str2Utf8
-+** Purpose: convert a string in UTF-8 format
-+** Input: inbuf - the string to convert
-+** Output: a new string in UTF-8 format
-+*/
-+char *StrToUtf8( const char *inbuf );
-+std::string StrToUtf8( const std::string &instr );
-+/*
-+** Name: Utf8ToStr
-+** Purpose: revert UTF-8 string conversion
-+** Input: inbuf - the string to decode
-+** Output: a new decoded string
-+*/
-+char *Utf8ToStr( const char *inbuf );
-+std::string Utf8ToStr( const std::string &instr );
-+#endif
diff --git a/net-im/centericq/files/patch-yahoohook.cc b/net-im/centericq/files/patch-yahoohook.cc
new file mode 100644
index 000000000000..11f5885fd615
--- /dev/null
+++ b/net-im/centericq/files/patch-yahoohook.cc
@@ -0,0 +1,11 @@
+--- src/hooks/yahoohook.cc.orig Fri Oct 3 03:55:06 2003
++++ src/hooks/yahoohook.cc Wed Oct 8 17:29:21 2003
+@@ -556,7 +556,7 @@
+
+ string yahoohook::decode(const string &text, bool utf) {
+ if(utf)
+- return siconv(text, "utf8",
++ return siconv(text, "utf-8",
+ conf.getrussian(proto) ? "koi8-u" : conf.getdefcharset());
+
+ return rushtmlconv("wk", text);