mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
Added charset plugin (WeeChat is now full UTF-8 for internal data storage), fixed compilation problems with FreeBSD, fixed status bar display bug
This commit is contained in:
@@ -9,17 +9,11 @@ Developers:
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
* Scripts plugins
|
||||
|
||||
Kolter <kolter@openics.org>
|
||||
Web : http://kolter.free.fr
|
||||
kolter <kolter@openics.org>
|
||||
IRC : nick is "kolter" @ irc.freenode.net
|
||||
Jabber: kolter@im.openics.org
|
||||
|
||||
|
||||
Debian packager:
|
||||
@@ -47,7 +41,7 @@ Pavel Shevchuk, IRC: "Stalwart"
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
server: irc.freenode.net, channels: #weechat and #weechat-fr (french)
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-11-04
|
||||
ChangeLog - 2006-11-08
|
||||
|
||||
|
||||
Version 0.2.2 (under dev!):
|
||||
* /charset command and charset conversions now made by "charset" plugin
|
||||
* fixed display bug in status bar, wrong length when using UTF-8
|
||||
* fixed bug with ignore: now any IRC command is allowed
|
||||
* fixed crash with Ctrl-T (transpose) and one char on line (bug #18153)
|
||||
* added "modifier" in plugins API
|
||||
|
||||
+26
-4
@@ -86,7 +86,7 @@ AC_MSG_RESULT($ac_cv_type_socklen_t)
|
||||
# Checks for library functions.
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname regexec])
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strndup strncasecmp strpbrk strrchr strstr uname regexec])
|
||||
|
||||
# Variables in config.h
|
||||
|
||||
@@ -99,6 +99,7 @@ AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
|
||||
AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL])
|
||||
AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
|
||||
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
|
||||
AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
@@ -109,6 +110,7 @@ AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interf
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --disable-perl Turn off Perl script plugin (default=compiled if found)],enable_perl=$enableval,enable_perl=yes)
|
||||
AC_ARG_ENABLE(python, [ --disable-python Turn off Python script plugin (default=compiled if found)],enable_python=$enableval,enable_python=yes)
|
||||
@@ -118,7 +120,7 @@ AC_ARG_WITH(lua-inc, [ --with-lua-inc=DIR, Lua include files are i
|
||||
AC_ARG_WITH(lua-lib, [ --with-lua-lib=DIR, Lua library files are in DIR (default=autodetect)],lua_lib=$withval,lua_lib='')
|
||||
AC_ARG_WITH(lua-suffix, [ --with-lua-suffix=ARG Lua is suffixed with ARG (default=autodetect)],lua_suffix=$withval,lua_suffix='')
|
||||
AC_ARG_ENABLE(aspell, [ --disable-aspell Turn off Aspell plugin (default=compiled if found)],enable_aspell=$enableval,enable_aspell=yes)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_ENABLE(charset, [ --disable-charset Turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes)
|
||||
AC_ARG_WITH(doc_xsl_prefix, [ --with-doc-xsl-prefix=DIR Docbook html/chunk.xsl is in DIR (default=autodetect)],doc_xsl_prefix=$withval,doc_xsl_prefix='')
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=1)],debug=$withval,debug=1)
|
||||
|
||||
@@ -195,6 +197,7 @@ fi
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
iconv_found="no"
|
||||
ICONV_LFLAGS=""
|
||||
|
||||
AC_CHECK_HEADER(iconv.h,ac_found_iconv_header="yes",ac_found_iconv_header="no")
|
||||
if test "x$ac_found_iconv_header" = "xyes" ; then
|
||||
@@ -203,7 +206,8 @@ if test "x$ac_found_iconv_header" = "xyes" ; then
|
||||
AC_CHECK_LIB(iconv,libiconv_open,ac_found_iconv_lib="yes",ac_found_iconv_lib="no")
|
||||
fi
|
||||
if test "x$ac_found_iconv_lib" = "xyes" ; then
|
||||
LIBS="$LIBS -liconv"
|
||||
ICONV_LFLAGS="-liconv"
|
||||
LIBS="$LIBS $ICONV_LFLAGS"
|
||||
fi
|
||||
AC_MSG_CHECKING(for iconv usability in programs)
|
||||
AC_TRY_RUN([
|
||||
@@ -242,6 +246,7 @@ if test "x$enable_plugins" != "xyes" ; then
|
||||
enable_ruby="no"
|
||||
enable_lua="no"
|
||||
enable_aspell="no"
|
||||
enable_charset="no"
|
||||
fi
|
||||
|
||||
# ---------------------------------- perl --------------------------------------
|
||||
@@ -549,6 +554,19 @@ if test "x$enable_aspell" = "xyes" ; then
|
||||
AC_DEFINE(PLUGIN_ASPELL)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# charset
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_charset" = "xyes" ; then
|
||||
CHARSET_CFLAGS=""
|
||||
CHARSET_LFLAGS=""
|
||||
CHARSET_LFLAGS="$CHARSET_LFLAGS $ICONV_LFLAGS"
|
||||
AC_SUBST(CHARSET_CFLAGS)
|
||||
AC_SUBST(CHARSET_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_CHARSET)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# dynamic loader
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -572,6 +590,7 @@ if test "x$enable_plugins" = "xyes" ; then
|
||||
enable_ruby="no"
|
||||
enable_lua="no"
|
||||
enable_aspell="no"
|
||||
enable_charset="no"
|
||||
not_found="$not_found plugins"
|
||||
fi
|
||||
fi
|
||||
@@ -757,6 +776,7 @@ AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
|
||||
|
||||
@@ -777,7 +797,8 @@ AC_OUTPUT([Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/Makefile
|
||||
src/plugins/scripts/lua/Makefile
|
||||
src/plugins/aspell/Makefile
|
||||
src/plugins/aspell/Makefile
|
||||
src/plugins/charset/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/wxwidgets/Makefile
|
||||
@@ -857,6 +878,7 @@ echo " Python plugin....... : $enable_python $PYTHON_STATUS"
|
||||
echo " Ruby plugin......... : $enable_ruby $RUBY_STATUS"
|
||||
echo " Lua plugin.......... : $enable_lua $LUA_STATUS"
|
||||
echo " Aspell plugin....... : $enable_aspell"
|
||||
echo " Charset plugin...... : $enable_charset"
|
||||
echo "Compile with debug info........... : $msg_debug_compiler"
|
||||
echo " Backtrace........... : $enable_backtrace"
|
||||
echo "Build doc..........................: $enable_doc"
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>WeeChat-Slogan (wenn leer, wird keiner benutzt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>ISO-Zeichensatz zum Dekodieren von Nachrichten vom Server (wird nur benutzt, wenn UTF-8 als Locale eingestellt ist; wenn nichts angegeben wird und die Locale UTF-8 ist, findet keine Konvertierung statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>UTF-Zeichensatz zum Dekodieren von Nachrichten vom Server (wird nur benutzt, wenn die Locale nicht UTF-8 ist; wenn nichts angegeben wird und die Locale nicht UTF-8 ist, findet keine Konvertierung statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Zeichensatz zum Enkodieren von Nachrichten zum Server, wie zum Beispiel: UTF-8, ISO-8859-1 (wenn nichts angegeben wird, findet keine Konversion statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Erzwingt internen WeeChat-Zeichensatz (sollte normalerweise leer sein, dadurch wird der erkannte Zeichensatz benutzt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>Boolean</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze für den Server und die Channels, um ISO-Nachrichten zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze für Server und Channels, um UTF zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze, um Nachrichten vom Server und aus Channels zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz,..)</entry>
|
||||
</row>
|
||||
|
||||
+264
-33
@@ -512,6 +512,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Fenster neu aufbauen
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + T</entry>
|
||||
<entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
Transpose chars
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + U</entry>
|
||||
<entry>
|
||||
@@ -525,19 +532,27 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Rückschritt </entry>
|
||||
<entry>Strg + Y</entry>
|
||||
<entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
Paste clipboard content
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Rückschritt / Strg + H</entry>
|
||||
<entry>
|
||||
Lösche das vorhergehende Zeichen in der Kommandozeile
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Entfernen </entry>
|
||||
<entry>Entfernen</entry>
|
||||
<entry>
|
||||
Lösche das nächste Zeichen in der Kommandozeile
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Tabulator </entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<entry>Tabulator / Shift + Tabulator</entry>
|
||||
<entry>
|
||||
Vervollständige ein Kommando oder Nick
|
||||
(wiederhole: finde nächste Vervollständigung)
|
||||
@@ -550,7 +565,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Eingabe</entry>
|
||||
<entry>Eingabe / Strg + J / Strg + M</entry>
|
||||
<entry>
|
||||
Führe ein Kommando aus oder sende eine Nachricht
|
||||
</entry>
|
||||
@@ -593,7 +608,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> F6 / Alt + Rechts </entry>
|
||||
<entry>F6 / Alt + Rechts</entry>
|
||||
<entry>
|
||||
Gehe zum nächsten Puffer
|
||||
</entry>
|
||||
@@ -1262,6 +1277,132 @@ fi
|
||||
|
||||
<section id="secAPIFunctions">
|
||||
<title>API Funktionen</title>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new plugin charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new charset to use
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string to WeeChat internal charset (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset to convert
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string from internal WeeChat charset (UTF-8) to another.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: target charset
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
@@ -2436,7 +2577,8 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
<screen>plugin->handler_remove_all (plugin);</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_add">
|
||||
<title>modifier_add</title>
|
||||
|
||||
@@ -2577,6 +2719,7 @@ modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_remove">
|
||||
<title>modifier_remove</title>
|
||||
|
||||
@@ -2614,6 +2757,7 @@ modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_remove_all">
|
||||
<title>modifier_remove_all</title>
|
||||
|
||||
@@ -4635,25 +4779,25 @@ end
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::register(name, version, end_function, description);
|
||||
weechat::register(name, version, end_function, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.register(name, version, end_function, description)
|
||||
Weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4686,6 +4830,13 @@ end
|
||||
<option>description</option>: eine kurze Beschreibung des Skripts
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<option>charset</option>: charset used by script, you should
|
||||
set this if script is not written with UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4695,16 +4846,78 @@ end
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("test", "1.0", "end_test", "Test script!");
|
||||
weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new script charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new script charset
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if new charset was set, 0 if an error occured.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5327,7 +5540,7 @@ end
|
||||
-- lua
|
||||
weechat.add_timer_handler(60, "my_timer")
|
||||
function my_timer()
|
||||
weechat.print("this is timer handler)
|
||||
weechat.print("this is timer handler")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
@@ -5644,6 +5857,7 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
@@ -5738,32 +5952,49 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "my_function");
|
||||
sub my_function
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
function my_function(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_remove_modifier">
|
||||
<title>remove_modifier</title>
|
||||
|
||||
@@ -5821,16 +6052,16 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "my_function");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7121,8 +7352,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
Entwickler
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ starte eingebauten WeeChat/IRC-Befehl (ohne Plugin-Handler oder Aliase)
|
||||
Befehl: auszuführender Befehl (falls nicht vorhanden wird automatisch ein '/' vorangestellt)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) Zeichensatz]</command>
|
||||
<programlisting>
|
||||
ändere Zeichensatz für den Server oder Channel
|
||||
|
||||
decode_iso: Zeichensatz um ISO zu decoden
|
||||
decode_utf: Zeichensatz um UTF zu decoden
|
||||
encode: der zum encoden benutzte Zeichensatz
|
||||
Zeichensatz: Zeichensatz, der benutzt werden soll (zum Beispiel: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>WeeChat slogan (if empty, slogan is not used)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>ISO charset for decoding messages from server (used only if locale is UTF-8) (if empty, messages are not converted if locale is UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>UTF charset for decoding messages from server (used only if locale is not UTF-8) (if empty, messages are not converted if locale is not UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Charset for encoding messages sent to server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Forces internal WeeChat charset (should be empty in most cases, that means detected charset is used)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>boolean</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
|
||||
+248
-30
@@ -508,6 +508,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Redraw whole window
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
Transpose chars
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + U</entry>
|
||||
<entry>
|
||||
@@ -521,7 +527,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace</entry>
|
||||
<entry>Ctrl + Y</entry>
|
||||
<entry>
|
||||
Paste clipboard content
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace / Ctrl + H</entry>
|
||||
<entry>
|
||||
Delete previous char in command line
|
||||
</entry>
|
||||
@@ -533,7 +545,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Tab</entry>
|
||||
<entry>Tab / Shift + Tab</entry>
|
||||
<entry>
|
||||
Complete command or nick
|
||||
(Tab again: find next completion)
|
||||
@@ -546,7 +558,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Enter</entry>
|
||||
<entry>Enter / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Execute command or send message
|
||||
</entry>
|
||||
@@ -1260,6 +1272,129 @@ fi
|
||||
<section id="secAPIFunctions">
|
||||
<title>API functions</title>
|
||||
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new plugin charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new charset to use
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string to WeeChat internal charset (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset to convert
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string from internal WeeChat charset (UTF-8) to another.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: target charset
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
|
||||
@@ -4670,25 +4805,25 @@ end
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::register(name, version, end_function, description);
|
||||
weechat::register(name, version, end_function, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.register(name, version, end_function, description)
|
||||
Weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4721,6 +4856,12 @@ end
|
||||
<option>description</option>: short description of script
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset used by script, you should
|
||||
set this if script is not written with UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4730,16 +4871,77 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("test", "1.0", "end_test", "Test script!");
|
||||
weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new script charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new script charset
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if new charset was set, 0 if an error occured.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5367,7 +5569,7 @@ end
|
||||
-- lua
|
||||
weechat.add_timer_handler(60, "my_timer")
|
||||
function my_timer()
|
||||
weechat.print("this is timer handler)
|
||||
weechat.print("this is timer handler")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
@@ -5776,27 +5978,43 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "my_function");
|
||||
sub my_function
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
function my_function(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
@@ -5859,16 +6077,16 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "my_function");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7162,8 +7380,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
developer
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ launch WeeChat/IRC builtin command (do not look at plugins handlers or aliases)
|
||||
command: command to execute (a '/' is automatically added if not found at beginning of command)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) charset]</command>
|
||||
<programlisting>
|
||||
change charset for server or channel
|
||||
|
||||
decode_iso: charset used for decoding ISO
|
||||
decode_utf: charset used for decoding UTF
|
||||
encode: charset used for encoding messages
|
||||
charset: charset to use (for example: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>Slogan WeeChat (si vide, le slogan ne sera pas utilisé)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>Jeu de caractères ISO pour décoder les messages du serveur (utilisé seulement si la locale est UTF-8) (si non renseigné, les messages ne sont pas convertis si la locale est UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>Jeu de caractères UTF pour décoder les messages du serveur (utilisé seulement si la locale n'est pas UTF-8) (si non renseigné, les messages ne sont pas convertis si la locale n'est pas UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Jeu de caractères pour encoder les messages envoyés au serveur, exemples: UTF-8, ISO-8859-1 (si non renseigné, les messages ne sont pas convertis)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Force le jeu de caractères interne à WeeChat (doit être vide dans la plupart des cas, ce qui signifie que le jeu de caractères détecté est utilisé)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>booléen</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Liste des niveaux de notifications (séparés par des virgules) pour les canaux de ce serveur (format: #canal:1,..), un nom de canal '*' est réservé pour la notification par défaut du serveur</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour décoder l'ISO (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour décoder l'UTF (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour encoder les messages (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
|
||||
+255
-29
@@ -517,6 +517,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Réafficher toute la fenêtre
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
Inverser deux caractères
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + U</entry>
|
||||
<entry>
|
||||
@@ -530,7 +536,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace</entry>
|
||||
<entry>Ctrl + Y</entry>
|
||||
<entry>
|
||||
Coller le contenu du presse-papiers
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace / Ctrl + H</entry>
|
||||
<entry>
|
||||
Effacer le caractère précédent sur la ligne de commande
|
||||
</entry>
|
||||
@@ -542,7 +554,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Tab</entry>
|
||||
<entry>Tab / Shift + Tab</entry>
|
||||
<entry>
|
||||
Compléter la commande ou le pseudo
|
||||
(Tab de nouveau: trouver la complétion suivante)
|
||||
@@ -556,7 +568,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Entrée</entry>
|
||||
<entry>Entrée / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Exécuter la commande ou envoyer le message
|
||||
</entry>
|
||||
@@ -1276,6 +1288,136 @@ fi
|
||||
|
||||
<section id="secFonctionsInterface">
|
||||
<title>Fonctions de l'interface (API)</title>
|
||||
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Change le jeu de caractères de l'extension.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : nouveau jeu de caractères à utiliser
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convertit une chaîne de caractères vers le jeu de caractères
|
||||
interne WeeChat (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : le jeu de caractères de départ
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option> : la chaîne à convertir
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : la chaîne convertie.
|
||||
</para>
|
||||
<para>
|
||||
Note : le résultat doit être libéré par un appel à la fonction
|
||||
"free" après utilisation.
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convertit une chaîne de caractères depuis le jeu de caractères
|
||||
interne WeeChat (UTF-8) vers un autre.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : le jeu de caractères voulu
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option> : la chaîne à convertir
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : la chaîne convertie.
|
||||
</para>
|
||||
<para>
|
||||
Note : le résultat doit être libéré par un appel à la fonction
|
||||
"free" après utilisation.
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
@@ -4782,25 +4924,25 @@ end
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::register(nom, version, fonction_de_fin, description);
|
||||
weechat::register(nom, version, fonction_de_fin, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.register(nom, version, fonction_de_fin, description)
|
||||
weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.register(nom, version, fonction_de_fin, description)
|
||||
Weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.register(nom, version, fonction_de_fin, description)
|
||||
weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4833,6 +4975,12 @@ end
|
||||
<option>description</option> : brève description du script
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : jeu de caractères du script, à
|
||||
préciser si le script n'est pas écrit en UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4843,20 +4991,82 @@ end
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("essai", "1.0", "fin_essai", "Script d'essai !");
|
||||
weechat::register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="sec_script_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.set_charsetr(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Change le jeu de caractères du script.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : nouveau jeu de caractères
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : 1 si le nouveau jeu de caractères a été
|
||||
mis en place, 0 si une erreur s'est produite.
|
||||
</para>
|
||||
<para>
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_print">
|
||||
<title>print</title>
|
||||
|
||||
@@ -5897,27 +6107,43 @@ weechat.remove_keyboard_handler("mon_clavier")
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "ma_fonction");
|
||||
sub ma_fonction
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
def ma_fonction(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
def ma_fonction(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
function ma_fonction(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
@@ -5980,16 +6206,16 @@ end
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "ma_fonction");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7293,8 +7519,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
développeur
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ lance une commande WeeChat/IRC interne (sans regarder les gestionnaires de comma
|
||||
commande: commande à exécuter (un '/' est automatiquement ajouté s'il n'est pas trouvé au début de la commande)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) charset]</command>
|
||||
<programlisting>
|
||||
changer le jeu de caractères pour le serveur ou le canal
|
||||
|
||||
decode_iso: jeu de caractères utilisé pour décoder l'ISO
|
||||
decode_utf: jeu de caractères utilisé pour décoder l'UTF
|
||||
encode: jeu de caractères utilisé pour encoder les messages
|
||||
charset: jeu de caractères à utiliser (par exemple: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
+752
-883
File diff suppressed because it is too large
Load Diff
@@ -42,10 +42,11 @@
|
||||
#include "weechat.h"
|
||||
#include "backtrace.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/*
|
||||
* weechat_backtrace_printf: display a backtrage line (on stderr and in WeeChat log)
|
||||
* weechat_backtrace_printf: display a backtrace line (on stderr and in WeeChat log)
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -58,7 +59,7 @@ weechat_backtrace_printf (char *message, ...)
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
fprintf (stderr, "%s", buffer);
|
||||
weechat_iconv_fprintf (stderr, "%s", buffer);
|
||||
weechat_log_printf ("%s", buffer);
|
||||
}
|
||||
|
||||
|
||||
+21
-273
@@ -74,13 +74,6 @@ t_weechat_command weechat_commands[] =
|
||||
N_("command"),
|
||||
N_("command: command to execute (a '/' is automatically added if not found at beginning of command)\n"),
|
||||
"%w|%i", 0, MAX_ARGS, 1, NULL, weechat_cmd_builtin },
|
||||
{ "charset", N_("change charset for server or channel"),
|
||||
N_("[(decode_iso | decode_utf | encode) charset]"),
|
||||
N_("decode_iso: charset used for decoding ISO\n"
|
||||
"decode_utf: charset used for decoding UTF\n"
|
||||
" encode: charset used for encoding messages\n"
|
||||
" charset: charset to use (for example: ISO-8859-15, UTF-8,..)"),
|
||||
"decode_iso|decode_utf|encode", 0, 2, 0, weechat_cmd_charset, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
@@ -293,7 +286,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
int only_builtin)
|
||||
{
|
||||
int i, rc, argc, argc2, return_code, length1, length2;
|
||||
char *command, *pos, *ptr_args, *ptr_args2, *ptr_args3;
|
||||
char *command, *pos, *ptr_args, *ptr_args2;
|
||||
char **argv, **argv2, *alias_command;
|
||||
char **commands, **ptr_cmd, **ptr_next_cmd;
|
||||
char *args_replaced, *vars_replaced, *new_ptr_cmd;
|
||||
@@ -497,16 +490,13 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_args2 = (weechat_commands[i].conversion && ptr_args) ?
|
||||
channel_iconv_encode (server, channel, ptr_args) : NULL;
|
||||
ptr_args3 = (weechat_commands[i].conversion
|
||||
&& cfg_irc_colors_send && ptr_args) ?
|
||||
(char *)gui_color_encode ((ptr_args2) ? (unsigned char *)ptr_args2 :
|
||||
(unsigned char *)ptr_args) : NULL;
|
||||
ptr_args2 = (weechat_commands[i].conversion
|
||||
&& cfg_irc_colors_send
|
||||
&& ptr_args) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
|
||||
if (weechat_commands[i].cmd_function_args)
|
||||
{
|
||||
argv2 = explode_string ((ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args),
|
||||
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
|
||||
" ", 0, &argc2);
|
||||
return_code = (int) (weechat_commands[i].cmd_function_args)
|
||||
(server, channel, argc2, argv2);
|
||||
@@ -514,8 +504,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
return_code = (int) (weechat_commands[i].cmd_function_1arg)
|
||||
(server, channel, (ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args));
|
||||
(server, channel, (ptr_args2) ? ptr_args2 : ptr_args);
|
||||
if (return_code < 0)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
@@ -525,8 +514,6 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
if (ptr_args2)
|
||||
free (ptr_args2);
|
||||
if (ptr_args3)
|
||||
free (ptr_args3);
|
||||
}
|
||||
free_exploded_string (argv);
|
||||
free (command);
|
||||
@@ -592,16 +579,13 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
free (command);
|
||||
return 0;
|
||||
}
|
||||
ptr_args2 = (irc_commands[i].conversion && ptr_args) ?
|
||||
channel_iconv_encode (server, channel, ptr_args) : NULL;
|
||||
ptr_args3 = (irc_commands[i].conversion
|
||||
&& cfg_irc_colors_send && ptr_args) ?
|
||||
(char *)gui_color_encode ((ptr_args2) ? (unsigned char *)ptr_args2 :
|
||||
(unsigned char *)ptr_args) : NULL;
|
||||
ptr_args2 = (irc_commands[i].conversion
|
||||
&& cfg_irc_colors_send
|
||||
&& ptr_args) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
|
||||
if (irc_commands[i].cmd_function_args)
|
||||
{
|
||||
argv2 = explode_string ((ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args),
|
||||
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
|
||||
" ", 0, &argc2);
|
||||
return_code = (int) (irc_commands[i].cmd_function_args)
|
||||
(server, channel, argc2, argv2);
|
||||
@@ -609,8 +593,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
return_code = (int) (irc_commands[i].cmd_function_1arg)
|
||||
(server, channel, (ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args));
|
||||
(server, channel, (ptr_args2) ? ptr_args2 : ptr_args);
|
||||
if (return_code < 0)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
@@ -620,8 +603,6 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
if (ptr_args2)
|
||||
free (ptr_args2);
|
||||
if (ptr_args3)
|
||||
free (ptr_args3);
|
||||
}
|
||||
free_exploded_string (argv);
|
||||
free (command);
|
||||
@@ -742,7 +723,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
{
|
||||
t_gui_buffer *buffer;
|
||||
char *new_cmd, *ptr_cmd, *pos;
|
||||
char *command_with_colors, *command_encoded;
|
||||
char *command_with_colors;
|
||||
|
||||
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
@@ -791,9 +772,6 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
command_with_colors = (cfg_irc_colors_send) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_cmd) : NULL;
|
||||
|
||||
command_encoded = channel_iconv_encode (server, channel,
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
|
||||
if (CHANNEL(buffer)->dcc_chat)
|
||||
{
|
||||
if (((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat))->sock < 0)
|
||||
@@ -806,8 +784,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
{
|
||||
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
|
||||
"%s\r\n",
|
||||
(command_encoded) ? command_encoded :
|
||||
((command_with_colors) ? command_with_colors : ptr_cmd));
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
user_message_display (server, buffer,
|
||||
(command_with_colors) ?
|
||||
command_with_colors : ptr_cmd);
|
||||
@@ -815,13 +792,10 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
}
|
||||
else
|
||||
user_message (server, buffer,
|
||||
(command_encoded) ? command_encoded :
|
||||
((command_with_colors) ? command_with_colors : ptr_cmd));
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
|
||||
if (command_with_colors)
|
||||
free (command_with_colors);
|
||||
if (command_encoded)
|
||||
free (command_encoded);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1394,232 +1368,6 @@ weechat_cmd_builtin (t_irc_server *server, t_irc_channel *channel,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset_display: display charsets for a server or channel
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_cmd_charset_display (t_gui_buffer *buffer)
|
||||
{
|
||||
char *server_item = "server", *ptr_item;
|
||||
char *value, *string, *herited;
|
||||
int length;
|
||||
|
||||
if ((BUFFER_IS_SERVER(buffer) && (SERVER(buffer)))
|
||||
|| BUFFER_IS_CHANNEL(buffer)
|
||||
|| BUFFER_IS_PRIVATE(buffer))
|
||||
{
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for server %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = server_item;
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL(buffer))
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for channel %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = CHANNEL(buffer)->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for private %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = CHANNEL(buffer)->name;
|
||||
}
|
||||
|
||||
/* decode ISO */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_decode_iso),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_decode_iso (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "decode_iso: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, ", ");
|
||||
free (string);
|
||||
|
||||
/* decode UTF */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_decode_utf),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_decode_utf (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "decode_utf: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, ", ");
|
||||
free (string);
|
||||
|
||||
/* encode */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_encode),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_encode (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "encode: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
free (string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset_set: set a charset for server or channel
|
||||
* from_internal == 1 if charset is used to encode data,
|
||||
* 0 if charset is used to decode data
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_charset_set (t_gui_buffer *buffer, char **string, char *charset,
|
||||
int from_internal)
|
||||
{
|
||||
int iconv_ok;
|
||||
|
||||
if (charset)
|
||||
{
|
||||
if (from_internal)
|
||||
iconv_ok = weechat_iconv_check (NULL, charset);
|
||||
else
|
||||
iconv_ok = weechat_iconv_check (charset, NULL);
|
||||
|
||||
if (!iconv_ok)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s charset \"%s\" is not available\n"),
|
||||
WEECHAT_ERROR, charset);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, "server", charset);
|
||||
else
|
||||
config_option_list_remove (string, "server");
|
||||
weechat_cmd_charset_display (buffer);
|
||||
}
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL(buffer) ||
|
||||
BUFFER_IS_PRIVATE(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, CHANNEL(buffer)->name, charset);
|
||||
else
|
||||
config_option_list_remove (string, CHANNEL(buffer)->name);
|
||||
weechat_cmd_charset_display (buffer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset: change charset for server or channel
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_charset (t_irc_server *server, t_irc_channel *channel,
|
||||
int argc, char **argv)
|
||||
{
|
||||
t_gui_buffer *buffer;
|
||||
int rc;
|
||||
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
|
||||
if (argc == 0)
|
||||
weechat_cmd_charset_display (buffer);
|
||||
else
|
||||
{
|
||||
if (ascii_strcasecmp (argv[0], "decode_iso") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_decode_iso),
|
||||
(argc > 1) ? argv[1] : NULL, 0);
|
||||
else if (ascii_strcasecmp (argv[0], "decode_utf") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_decode_utf),
|
||||
(argc > 1) ? argv[1] : NULL, 0);
|
||||
else if (ascii_strcasecmp (argv[0], "encode") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_encode),
|
||||
(argc > 1) ? argv[1] : NULL, 1);
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "charset");
|
||||
return -1;
|
||||
}
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
@@ -2996,8 +2744,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
server_tmp.username, server_tmp.realname,
|
||||
server_tmp.hostname,
|
||||
server_tmp.command, 1, server_tmp.autojoin, 1, NULL,
|
||||
NULL, NULL, NULL);
|
||||
server_tmp.command, 1, server_tmp.autojoin, 1, NULL);
|
||||
if (new_server)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
@@ -3789,9 +3536,10 @@ weechat_cmd_upgrade (t_irc_server *server, t_irc_channel *channel,
|
||||
plugin_init (1);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
|
||||
free (exec_args[0]);
|
||||
free (exec_args[3]);
|
||||
|
||||
@@ -60,7 +60,6 @@ extern void user_command (t_irc_server *, t_irc_channel *, char *, int);
|
||||
extern int weechat_cmd_alias (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_buffer (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_builtin (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_charset (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_clear (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_connect (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_dcc (t_irc_server *, t_irc_channel *, char *);
|
||||
|
||||
@@ -664,7 +664,7 @@ completion_list_add_servers (t_completion *completion)
|
||||
void
|
||||
completion_list_add_topic (t_completion *completion)
|
||||
{
|
||||
char *string, *string2;
|
||||
char *string;
|
||||
|
||||
if (!completion->server || !completion->channel
|
||||
|| !((t_irc_channel *)(completion->channel))->topic
|
||||
@@ -676,16 +676,11 @@ completion_list_add_topic (t_completion *completion)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
|
||||
else
|
||||
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0);
|
||||
string2 = channel_iconv_decode ((t_irc_server *)(completion->server),
|
||||
(t_irc_channel *)(completion->channel),
|
||||
(string) ? string : ((t_irc_channel *)(completion->channel))->topic);
|
||||
completion_list_add (completion,
|
||||
(string2) ? string2 : ((string) ?
|
||||
string : ((t_irc_channel *)(completion->channel))->topic));
|
||||
(string) ?
|
||||
string : ((t_irc_channel *)(completion->channel))->topic);
|
||||
if (string)
|
||||
free (string);
|
||||
if (string2)
|
||||
free (string2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-12
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
char *weechat_log_filename = NULL; /* log name (~/.weechat/weechat.log) */
|
||||
@@ -99,11 +100,11 @@ weechat_log_init ()
|
||||
{
|
||||
if (!weechat_log_open (NULL, "w"))
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unable to create/append to log file\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using \"--dir\" command line option.\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unable to create/append to log file\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using \"--dir\" command line option.\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -142,12 +143,13 @@ weechat_log_printf (char *message, ...)
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
weechat_iconv_fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (weechat_log_file, "%s", buffer);
|
||||
weechat_iconv_fprintf (weechat_log_file, "%s", buffer);
|
||||
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
@@ -212,8 +214,8 @@ weechat_log_crash_rename ()
|
||||
getpid());
|
||||
if (rename (old_name, new_name) == 0)
|
||||
{
|
||||
fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
weechat_iconv_fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
weechat_log_open (new_name, "a");
|
||||
free (old_name);
|
||||
free (new_name);
|
||||
|
||||
+22
-24
@@ -38,6 +38,7 @@
|
||||
#include "session.h"
|
||||
#include "hotlist.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -265,9 +266,6 @@ session_save_servers (FILE *file)
|
||||
rc = rc && (session_write_int (file, SESSION_SERV_LAG, ptr_server->lag));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_CHECK_TIME, &(ptr_server->lag_check_time), sizeof (struct timeval)));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_NEXT_CHECK, &(ptr_server->lag_next_check), sizeof (time_t)));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_ISO, ptr_server->charset_decode_iso));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_UTF, ptr_server->charset_decode_utf));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_ENCODE, ptr_server->charset_encode));
|
||||
rc = rc && (session_write_id (file, SESSION_SERV_END));
|
||||
|
||||
if (!rc)
|
||||
@@ -510,21 +508,21 @@ session_crash (FILE *file, char *message, ...)
|
||||
|
||||
fclose (file);
|
||||
gui_main_end ();
|
||||
fprintf (stderr, "%s %s\n",
|
||||
WEECHAT_ERROR, buffer);
|
||||
fprintf (stderr,
|
||||
_("Last operation with session file was at position %ld, "
|
||||
"read of %d bytes\n"),
|
||||
session_last_read_pos,
|
||||
session_last_read_length);
|
||||
fprintf (stderr,
|
||||
_("Please send %s/%s, %s/%s and "
|
||||
"above messages to WeeChat developers for support.\n"
|
||||
"Be careful, private info may be in these files.\n"),
|
||||
weechat_home,
|
||||
WEECHAT_LOG_NAME,
|
||||
weechat_home,
|
||||
WEECHAT_SESSION_NAME);
|
||||
weechat_iconv_fprintf (stderr, "%s %s\n",
|
||||
WEECHAT_ERROR, buffer);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("Last operation with session file was at position %ld, "
|
||||
"read of %d bytes\n"),
|
||||
session_last_read_pos,
|
||||
session_last_read_length);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("Please send %s/%s, %s/%s and "
|
||||
"above messages to WeeChat developers for support.\n"
|
||||
"Be careful, private info may be in these files.\n"),
|
||||
weechat_home,
|
||||
WEECHAT_LOG_NAME,
|
||||
weechat_home,
|
||||
WEECHAT_SESSION_NAME);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -995,14 +993,14 @@ session_load_server (FILE *file)
|
||||
case SESSION_SERV_LAG_NEXT_CHECK:
|
||||
rc = rc && (session_read_buf (file, &(session_current_server->lag_next_check), sizeof (time_t)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_iso)));
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_utf)));
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_ENCODE:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_encode)));
|
||||
case SESSION_SERV_CHARSET_ENCODE__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
|
||||
@@ -87,9 +87,9 @@ enum t_session_server
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF,
|
||||
SESSION_SERV_CHARSET_ENCODE,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO__UNUSED,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF__UNUSED,
|
||||
SESSION_SERV_CHARSET_ENCODE__UNUSED,
|
||||
SESSION_SERV_HOSTNAME,
|
||||
SESSION_SERV_NICK_MODES,
|
||||
SESSION_SERV_AWAY_MESSAGE
|
||||
|
||||
+44
-36
@@ -39,12 +39,12 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
int local_utf8 = 0;
|
||||
|
||||
|
||||
/*
|
||||
* utf8_init: initializes UTF-8 in WeeChat
|
||||
*/
|
||||
@@ -52,26 +52,17 @@ int local_utf8 = 0;
|
||||
void
|
||||
utf8_init ()
|
||||
{
|
||||
local_utf8 = 0;
|
||||
|
||||
if (cfg_look_charset_internal && cfg_look_charset_internal[0])
|
||||
{
|
||||
if (strstr (cfg_look_charset_internal, "UTF-8")
|
||||
|| strstr (cfg_look_charset_internal, "utf-8"))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
else if ((local_charset)
|
||||
&& ((strstr (local_charset, "UTF-8")
|
||||
|| strstr (local_charset, "utf-8"))))
|
||||
local_utf8 = 1;
|
||||
local_utf8 = (ascii_strcasecmp (local_charset, "UTF-8") == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_is_valid: return 1 if UTF-8 string is valid, 0 otherwise
|
||||
* if error is not NULL, it's set with first non valid UTF-8
|
||||
* char in string, if any
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
utf8_is_valid (char *string, char **error)
|
||||
{
|
||||
while (string && string[0])
|
||||
{
|
||||
@@ -79,7 +70,11 @@ utf8_is_valid (char *string)
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes, should be: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
@@ -88,7 +83,11 @@ utf8_is_valid (char *string)
|
||||
if (!string[1] || !string[2]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes, should be: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
@@ -98,18 +97,47 @@ utf8_is_valid (char *string)
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 4;
|
||||
}
|
||||
/* UTF-8, 1 byte, should be: 0vvvvvvv */
|
||||
else if ((unsigned char)(string[0]) >= 0x80)
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
string++;
|
||||
}
|
||||
if (error)
|
||||
*error = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_normalize: normalize UTF-8 string: remove non UTF-8 chars and
|
||||
* replace them by a char
|
||||
*/
|
||||
|
||||
void
|
||||
utf8_normalize (char *string, char replacement)
|
||||
{
|
||||
char *error;
|
||||
|
||||
while (string && string[0])
|
||||
{
|
||||
if (utf8_is_valid (string, &error))
|
||||
return;
|
||||
error[0] = replacement;
|
||||
string = error + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_prev_char: return previous UTF-8 char in a string
|
||||
*/
|
||||
@@ -122,9 +150,6 @@ utf8_prev_char (char *string_start, char *string)
|
||||
|
||||
string--;
|
||||
|
||||
if (!local_utf8)
|
||||
return string;
|
||||
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 2 bytes */
|
||||
@@ -164,9 +189,6 @@ utf8_next_char (char *string)
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + 1;
|
||||
|
||||
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
@@ -223,9 +245,6 @@ utf8_strlen (char *string)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string && string[0])
|
||||
{
|
||||
@@ -248,14 +267,6 @@ utf8_strnlen (char *string, int bytes)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
{
|
||||
length = strlen (string);
|
||||
if (bytes > length)
|
||||
return length;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string && string[0] && (string - start < bytes))
|
||||
@@ -280,7 +291,7 @@ utf8_width_screen (char *string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
return utf8_strlen (string);
|
||||
|
||||
num_char = mbstowcs (NULL, string, 0) + 1;
|
||||
wstring = (wchar_t *) malloc ((num_char + 1) * sizeof (wchar_t));
|
||||
@@ -310,9 +321,6 @@ utf8_add_offset (char *string, int offset)
|
||||
if (!string)
|
||||
return string;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string && string[0] && (count < offset))
|
||||
{
|
||||
@@ -333,7 +341,7 @@ utf8_real_pos (char *string, int pos)
|
||||
int count, real_pos;
|
||||
char *next_char;
|
||||
|
||||
if (!string || !local_utf8)
|
||||
if (!string)
|
||||
return pos;
|
||||
|
||||
count = 0;
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@
|
||||
extern int local_utf8;
|
||||
|
||||
extern void utf8_init ();
|
||||
extern int utf8_is_valid (char *);
|
||||
extern int utf8_is_valid (char *, char **);
|
||||
extern void utf8_normalize (char *, char);
|
||||
extern char *utf8_prev_char (char *, char *);
|
||||
extern char *utf8_next_char (char *);
|
||||
extern int utf8_char_size (char *);
|
||||
|
||||
+91
-22
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
@@ -32,9 +33,34 @@
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
/*
|
||||
* strndup: define strndup function if not existing (FreeBSD and maybe other)
|
||||
*/
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
char *
|
||||
strndup (char *string, int length)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if ((int)strlen (string) < length)
|
||||
return strdup (string);
|
||||
|
||||
result = (char *)malloc (length + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
memcpy (result, string, length);
|
||||
result[length] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ascii_tolower: locale independant string conversion to lower case
|
||||
*/
|
||||
@@ -217,32 +243,75 @@ weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_check: check a charset
|
||||
* if a charset is NULL, internal charset is used
|
||||
* weechat_iconv_to_internal: convert user string (input, script, ..) to
|
||||
* WeeChat internal storage charset
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_iconv_check (char *from_code, char *to_code)
|
||||
char *
|
||||
weechat_iconv_to_internal (char *charset, char *string)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *input, *output;
|
||||
|
||||
input = strdup (string);
|
||||
if (input)
|
||||
{
|
||||
if (utf8_is_valid (input, NULL))
|
||||
return input;
|
||||
|
||||
output = weechat_iconv ((charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
WEECHAT_INTERNAL_CHARSET,
|
||||
input);
|
||||
utf8_normalize (output, '?');
|
||||
free (input);
|
||||
return output;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_from_internal: convert internal string to terminal charset,
|
||||
* for display
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_iconv_from_internal (char *charset, char *string)
|
||||
{
|
||||
char *input, *output;
|
||||
|
||||
input = strdup (string);
|
||||
if (input)
|
||||
{
|
||||
utf8_normalize (input, '?');
|
||||
output = weechat_iconv (WEECHAT_INTERNAL_CHARSET,
|
||||
(charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
input);
|
||||
free (input);
|
||||
return output;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_fprintf: encode to terminal charset, then call fprintf on a file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_iconv_fprintf (FILE *file, char *data, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[4096];
|
||||
char *buf2;
|
||||
|
||||
if (!from_code || !from_code[0])
|
||||
from_code = (cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset;
|
||||
|
||||
if (!to_code || !to_code[0])
|
||||
to_code = (cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset;
|
||||
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
return 0;
|
||||
iconv_close (cd);
|
||||
return 1;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
va_start (argptr, data);
|
||||
vsnprintf (buf, sizeof (buf) - 1, data, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_from_internal (NULL, buf);
|
||||
fprintf (file, "%s", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+6
-1
@@ -21,13 +21,18 @@
|
||||
#ifndef __WEECHAT_UTIL_H
|
||||
#define __WEECHAT_UTIL_H 1
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
extern char *strndup (char *, int);
|
||||
#endif
|
||||
extern void ascii_tolower (char *);
|
||||
extern void ascii_toupper (char *);
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern char *ascii_strcasestr (char *, char *);
|
||||
extern char *weechat_iconv (char *, char *, char *);
|
||||
extern int weechat_iconv_check (char *, char *);
|
||||
extern char *weechat_iconv_to_internal (char *, char *);
|
||||
extern char *weechat_iconv_from_internal (char *, char *);
|
||||
extern void weechat_iconv_fprintf (FILE *, char *, ...);
|
||||
extern char *weechat_strreplace (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
|
||||
+140
-126
@@ -98,27 +98,30 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
|
||||
void
|
||||
weechat_display_usage (char *exec_name)
|
||||
{
|
||||
printf ("\n");
|
||||
printf (_("%s (c) Copyright 2003-2006, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
printf ("\n\n");
|
||||
printf (_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
printf ("\n\n");
|
||||
printf (_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
printf("\n");
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s (c) Copyright 2003-2006, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
weechat_iconv_fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -130,7 +133,8 @@ weechat_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
printf (_("WeeChat configuration options (<weechat_home>/weechat.rc):\n\n"));
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("WeeChat configuration options (<weechat_home>/weechat.rc):\n\n"));
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if (weechat_options[i])
|
||||
@@ -138,60 +142,61 @@ weechat_display_config_options ()
|
||||
j = 0;
|
||||
while (weechat_options[i][j].option_name)
|
||||
{
|
||||
printf ("* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
printf (_(" . type: boolean\n"));
|
||||
printf (_(" . values: 'on' or 'off'\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (stdout, _(" . type: boolean\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: 'on' or 'off'\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
printf (_(" . type: integer\n"));
|
||||
printf (_(" . values: between %d and %d\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
printf (_(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (stdout, _(" . type: integer\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: between %d and %d\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
printf (_(" . type: string\n"));
|
||||
printf (_(" . values: "));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: "));
|
||||
k = 0;
|
||||
while (weechat_options[i][j].array_values[k])
|
||||
{
|
||||
printf ("'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
weechat_iconv_fprintf (stdout, "'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
if (weechat_options[i][j].array_values[k + 1])
|
||||
printf (", ");
|
||||
weechat_iconv_fprintf (stdout, ", ");
|
||||
k++;
|
||||
}
|
||||
printf ("\n");
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
printf (_(" . type: color\n"));
|
||||
printf (_(" . values: Curses or Gtk color\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: color\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: Curses or Gtk color\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
printf (_(" . type: string\n"));
|
||||
printf (_(" . values: any string\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: any string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -209,43 +214,44 @@ weechat_display_commands (int weechat_cmd, int irc_cmd)
|
||||
|
||||
if (weechat_cmd)
|
||||
{
|
||||
printf (_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
printf ("* %s", weechat_commands[i].command_name);
|
||||
weechat_iconv_fprintf (stdout, "* %s", weechat_commands[i].command_name);
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(weechat_commands[i].arguments));
|
||||
weechat_iconv_fprintf (stdout, " %s\n\n", _(weechat_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(weechat_commands[i].command_description));
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n", _(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
|
||||
if (irc_cmd)
|
||||
{
|
||||
printf (_("IRC commands:\n"));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _("IRC commands:\n"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args ||
|
||||
irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
printf ("* %s", irc_commands[i].command_name);
|
||||
weechat_iconv_fprintf (stdout, "* %s", irc_commands[i].command_name);
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(irc_commands[i].arguments));
|
||||
weechat_iconv_fprintf (stdout, " %s\n\n", _(irc_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(irc_commands[i].command_description));
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n", _(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
@@ -261,14 +267,15 @@ weechat_display_key_functions ()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf (_("Internal key functions:\n"));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _("Internal key functions:\n"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
printf ("* %s: %s\n",
|
||||
gui_key_functions[i].function_name,
|
||||
_(gui_key_functions[i].description));
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s: %s\n",
|
||||
gui_key_functions[i].function_name,
|
||||
_(gui_key_functions[i].description));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -283,14 +290,16 @@ weechat_display_keys ()
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
|
||||
printf (_("%s default keys:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s default keys:\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
printf ("* %s => %s\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
(ptr_key->function) ? gui_keyboard_function_search_by_ptr (ptr_key->function) : ptr_key->command);
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s => %s\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
(ptr_key->function) ? gui_keyboard_function_search_by_ptr (ptr_key->function) : ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
@@ -331,9 +340,9 @@ weechat_parse_args (int argc, char *argv[])
|
||||
weechat_home = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --dir option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s missing argument for --dir option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +373,7 @@ weechat_parse_args (int argc, char *argv[])
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
weechat_iconv_fprintf (stdout, "\n%s%s", WEE_LICENSE);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
@@ -376,16 +385,16 @@ weechat_parse_args (int argc, char *argv[])
|
||||
weechat_session = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
weechat_iconv_fprintf (stdout, PACKAGE_VERSION "\n");
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-w") == 0)
|
||||
@@ -398,8 +407,9 @@ weechat_parse_args (int argc, char *argv[])
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -411,19 +421,19 @@ weechat_parse_args (int argc, char *argv[])
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, NULL, 0,
|
||||
server_tmp.autojoin, 1, NULL, NULL,
|
||||
NULL, NULL))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_tmp.autojoin, 1, NULL))
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
server_cmd_line = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,8 +452,8 @@ weechat_create_dir (char *directory)
|
||||
/* exit if error (except if directory already exists) */
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
weechat_iconv_fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -466,8 +476,8 @@ weechat_create_home_dirs ()
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
@@ -475,8 +485,8 @@ weechat_create_home_dirs ()
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!weechat_home)
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
@@ -488,8 +498,8 @@ weechat_create_home_dirs ()
|
||||
{
|
||||
if (!S_ISDIR (statinfo.st_mode))
|
||||
{
|
||||
fprintf (stderr, _("%s home (%s) is not a directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_iconv_fprintf (stderr, _("%s home (%s) is not a directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -497,8 +507,8 @@ weechat_create_home_dirs ()
|
||||
/* create home directory; error is fatal */
|
||||
if (!weechat_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -521,8 +531,8 @@ weechat_create_config_dirs ()
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -537,8 +547,8 @@ weechat_create_config_dirs ()
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -774,19 +784,20 @@ weechat_sigsegv ()
|
||||
server_free_all ();
|
||||
gui_main_end ();
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
|
||||
weechat_iconv_fprintf (stderr, "\n");
|
||||
weechat_iconv_fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
|
||||
if (!weechat_log_crash_rename ())
|
||||
fprintf (stderr, "*** Full crash dump was saved to %s/weechat.log file.\n",
|
||||
weechat_home);
|
||||
fprintf (stderr, "***\n");
|
||||
fprintf (stderr, "*** Please help WeeChat developers to fix this bug:\n");
|
||||
fprintf (stderr, "*** 1. If you have a core file, please run: gdb weechat-curses core\n");
|
||||
fprintf (stderr, "*** then issue \"bt\" command and send result to developers\n");
|
||||
fprintf (stderr, "*** To enable core files with bash shell: ulimit -c 10000\n");
|
||||
fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
weechat_iconv_fprintf (stderr,
|
||||
"*** Full crash dump was saved to %s/weechat.log file.\n",
|
||||
weechat_home);
|
||||
weechat_iconv_fprintf (stderr, "***\n");
|
||||
weechat_iconv_fprintf (stderr, "*** Please help WeeChat developers to fix this bug:\n");
|
||||
weechat_iconv_fprintf (stderr, "*** 1. If you have a core file, please run: gdb weechat-curses core\n");
|
||||
weechat_iconv_fprintf (stderr, "*** then issue \"bt\" command and send result to developers\n");
|
||||
weechat_iconv_fprintf (stderr, "*** To enable core files with bash shell: ulimit -c 10000\n");
|
||||
weechat_iconv_fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
|
||||
weechat_iconv_fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
weechat_iconv_fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
|
||||
weechat_backtrace ();
|
||||
|
||||
@@ -804,12 +815,16 @@ main (int argc, char *argv[])
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (PACKAGE, "UTF-8");
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#else
|
||||
local_charset = strdup ("");
|
||||
#endif
|
||||
utf8_init ();
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
@@ -824,7 +839,6 @@ main (int argc, char *argv[])
|
||||
command_index_build (); /* build cmd index for completion */
|
||||
weechat_config_read (); /* read configuration */
|
||||
weechat_create_config_dirs (); /* create config directories */
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_main_init (); /* init WeeChat interface */
|
||||
fifo_create (); /* FIFO pipe for remote control */
|
||||
if (weechat_session)
|
||||
|
||||
@@ -93,10 +93,15 @@
|
||||
#endif
|
||||
|
||||
/* some systems (like GNU/Hurd) doesn't define PATH_MAX */
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/* internal charset */
|
||||
|
||||
#define WEECHAT_INTERNAL_CHARSET "UTF-8"
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern char *weechat_argv0;
|
||||
|
||||
+192
-235
@@ -71,10 +71,6 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode_iso;
|
||||
char *cfg_look_charset_decode_utf;
|
||||
char *cfg_look_charset_encode;
|
||||
char *cfg_look_charset_internal;
|
||||
int cfg_look_one_server_buffer;
|
||||
int cfg_look_scroll_amount;
|
||||
int cfg_look_open_near_server;
|
||||
@@ -134,24 +130,6 @@ t_config_option weechat_options_look[] =
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
|
||||
{ "look_charset_decode_iso", N_("ISO charset for decoding messages from server (used only if locale is UTF-8)"),
|
||||
N_("ISO charset for decoding messages from server (used only if locale is UTF-8) "
|
||||
"(if empty, messages are not converted if locale is UTF-8)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_decode_iso, config_change_charset },
|
||||
{ "look_charset_decode_utf", N_("UTF charset for decoding messages from server (used only if locale is not UTF-8)"),
|
||||
N_("UTF charset for decoding messages from server (used only if locale is not UTF-8) "
|
||||
"(if empty, messages are not converted if locale is not UTF-8)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode_utf, config_change_charset },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_charset },
|
||||
{ "look_charset_internal", N_("forces internal WeeChat charset (should be empty in most cases)"),
|
||||
N_("forces internal WeeChat charset (should be empty in most cases, that means detected charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_internal, config_change_charset },
|
||||
{ "look_one_server_buffer", N_("use same buffer for all servers"),
|
||||
N_("use same buffer for all servers"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
@@ -1031,21 +1009,6 @@ t_config_option weechat_options_server[] =
|
||||
"default notify level"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.notify_levels), config_change_notify_levels },
|
||||
{ "server_charset_decode_iso", N_("charset for decoding ISO on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode ISO (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_iso), config_change_noop },
|
||||
{ "server_charset_decode_utf", N_("charset for decoding UTF on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode UTF (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_utf), config_change_noop },
|
||||
{ "server_charset_encode", N_("charset for encoding messages on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to encode messages (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_encode), config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1572,12 +1535,6 @@ config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
return (void *)(&server->autorejoin);
|
||||
if (ascii_strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
return (void *)(&server->notify_levels);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_iso") == 0)
|
||||
return (void *)(&server->charset_decode_iso);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_utf") == 0)
|
||||
return (void *)(&server->charset_decode_utf);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_encode") == 0)
|
||||
return (void *)(&server->charset_encode);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
@@ -1810,9 +1767,7 @@ config_allocate_server (char *filename, int line_number)
|
||||
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||
cfg_server.hostname, cfg_server.command,
|
||||
cfg_server.command_delay, cfg_server.autojoin,
|
||||
cfg_server.autorejoin, cfg_server.notify_levels,
|
||||
cfg_server.charset_decode_iso, cfg_server.charset_decode_utf,
|
||||
cfg_server.charset_encode))
|
||||
cfg_server.autorejoin, cfg_server.notify_levels))
|
||||
{
|
||||
server_free_all ();
|
||||
gui_printf (NULL,
|
||||
@@ -1895,7 +1850,7 @@ config_read ()
|
||||
FILE *file;
|
||||
int section, line_number, i, option_number;
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
char line[1024], *ptr_line, *ptr_line2, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
@@ -1924,6 +1879,14 @@ config_read ()
|
||||
line_number++;
|
||||
if (ptr_line)
|
||||
{
|
||||
/* encode line to internal charset */
|
||||
ptr_line2 = weechat_iconv_to_internal (NULL, ptr_line);
|
||||
if (ptr_line2)
|
||||
{
|
||||
snprintf (line, sizeof (line) - 1, "%s", ptr_line2);
|
||||
free (ptr_line2);
|
||||
}
|
||||
|
||||
/* skip spaces */
|
||||
while (ptr_line[0] == ' ')
|
||||
ptr_line++;
|
||||
@@ -2091,19 +2054,19 @@ config_read ()
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line,
|
||||
weechat_options[section][option_number].min,
|
||||
@@ -2112,15 +2075,15 @@ config_read ()
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
i = 0;
|
||||
while (weechat_options[section][option_number].array_values[i])
|
||||
{
|
||||
gui_printf (NULL, "\"%s\" ",
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
i++;
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
@@ -2128,7 +2091,7 @@ config_read ()
|
||||
case OPTION_TYPE_COLOR:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid color "
|
||||
"name for option '%s'\n"),
|
||||
"name for option '%s'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number,
|
||||
ptr_line);
|
||||
@@ -2196,48 +2159,48 @@ config_create_default ()
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, _("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
weechat_log_printf (_("Creating default config file\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
weechat_iconv_fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
weechat_iconv_fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
weechat_iconv_fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].default_int) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].default_int) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
case OPTION_TYPE_COLOR:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2245,7 +2208,7 @@ config_create_default ()
|
||||
}
|
||||
|
||||
/* default key bindings */
|
||||
fprintf (file, "\n[keys]\n");
|
||||
weechat_iconv_fprintf (file, "\n[keys]\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
@@ -2253,79 +2216,79 @@ config_create_default ()
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
}
|
||||
else
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
|
||||
/* default aliases */
|
||||
fprintf (file, "\n[alias]\n");
|
||||
fprintf (file, "SAY = \"msg *\"\n");
|
||||
fprintf (file, "BYE = \"quit\"\n");
|
||||
fprintf (file, "EXIT = \"quit\"\n");
|
||||
fprintf (file, "SIGNOFF = \"quit\"\n");
|
||||
fprintf (file, "C = \"clear\"\n");
|
||||
fprintf (file, "CL = \"clear\"\n");
|
||||
fprintf (file, "CLOSE = \"buffer close\"\n");
|
||||
fprintf (file, "CHAT = \"dcc chat\"\n");
|
||||
fprintf (file, "IG = \"ignore\"\n");
|
||||
fprintf (file, "J = \"join\"\n");
|
||||
fprintf (file, "K = \"kick\"\n");
|
||||
fprintf (file, "KB = \"kickban\"\n");
|
||||
fprintf (file, "LEAVE = \"part\"\n");
|
||||
fprintf (file, "M = \"msg\"\n");
|
||||
fprintf (file, "MUB = \"unban *\"\n");
|
||||
fprintf (file, "N = \"names\"\n");
|
||||
fprintf (file, "Q = \"query\"\n");
|
||||
fprintf (file, "T = \"topic\"\n");
|
||||
fprintf (file, "UB = \"unban\"\n");
|
||||
fprintf (file, "UNIG = \"unignore\"\n");
|
||||
fprintf (file, "W = \"who\"\n");
|
||||
fprintf (file, "WC = \"window merge\"\n");
|
||||
fprintf (file, "WI = \"whois\"\n");
|
||||
fprintf (file, "WW = \"whowas\"\n");
|
||||
weechat_iconv_fprintf (file, "\n[alias]\n");
|
||||
weechat_iconv_fprintf (file, "SAY = \"msg *\"\n");
|
||||
weechat_iconv_fprintf (file, "BYE = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "EXIT = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "SIGNOFF = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "C = \"clear\"\n");
|
||||
weechat_iconv_fprintf (file, "CL = \"clear\"\n");
|
||||
weechat_iconv_fprintf (file, "CLOSE = \"buffer close\"\n");
|
||||
weechat_iconv_fprintf (file, "CHAT = \"dcc chat\"\n");
|
||||
weechat_iconv_fprintf (file, "IG = \"ignore\"\n");
|
||||
weechat_iconv_fprintf (file, "J = \"join\"\n");
|
||||
weechat_iconv_fprintf (file, "K = \"kick\"\n");
|
||||
weechat_iconv_fprintf (file, "KB = \"kickban\"\n");
|
||||
weechat_iconv_fprintf (file, "LEAVE = \"part\"\n");
|
||||
weechat_iconv_fprintf (file, "M = \"msg\"\n");
|
||||
weechat_iconv_fprintf (file, "MUB = \"unban *\"\n");
|
||||
weechat_iconv_fprintf (file, "N = \"names\"\n");
|
||||
weechat_iconv_fprintf (file, "Q = \"query\"\n");
|
||||
weechat_iconv_fprintf (file, "T = \"topic\"\n");
|
||||
weechat_iconv_fprintf (file, "UB = \"unban\"\n");
|
||||
weechat_iconv_fprintf (file, "UNIG = \"unignore\"\n");
|
||||
weechat_iconv_fprintf (file, "W = \"who\"\n");
|
||||
weechat_iconv_fprintf (file, "WC = \"window merge\"\n");
|
||||
weechat_iconv_fprintf (file, "WI = \"whois\"\n");
|
||||
weechat_iconv_fprintf (file, "WW = \"whowas\"\n");
|
||||
|
||||
/* no ignore by default */
|
||||
|
||||
/* default server is freenode */
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name = \"freenode\"\n");
|
||||
fprintf (file, "server_autoconnect = on\n");
|
||||
fprintf (file, "server_autoreconnect = on\n");
|
||||
fprintf (file, "server_autoreconnect_delay = 30\n");
|
||||
fprintf (file, "server_address = \"irc.freenode.net\"\n");
|
||||
fprintf (file, "server_port = 6667\n");
|
||||
fprintf (file, "server_ipv6 = off\n");
|
||||
fprintf (file, "server_ssl = off\n");
|
||||
fprintf (file, "server_password = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "\n[server]\n");
|
||||
weechat_iconv_fprintf (file, "server_name = \"freenode\"\n");
|
||||
weechat_iconv_fprintf (file, "server_autoconnect = on\n");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect = on\n");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect_delay = 30\n");
|
||||
weechat_iconv_fprintf (file, "server_address = \"irc.freenode.net\"\n");
|
||||
weechat_iconv_fprintf (file, "server_port = 6667\n");
|
||||
weechat_iconv_fprintf (file, "server_ipv6 = off\n");
|
||||
weechat_iconv_fprintf (file, "server_ssl = off\n");
|
||||
weechat_iconv_fprintf (file, "server_password = \"\"\n");
|
||||
|
||||
/* Get the user's name from /etc/passwd */
|
||||
if ((my_passwd = getpwuid (geteuid ())) != NULL)
|
||||
{
|
||||
fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
|
||||
if ((!my_passwd->pw_gecos)
|
||||
|| (my_passwd->pw_gecos[0] == '\0')
|
||||
|| (my_passwd->pw_gecos[0] == ',')
|
||||
|| (my_passwd->pw_gecos[0] == ' '))
|
||||
fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
|
||||
else
|
||||
{
|
||||
realname = strdup (my_passwd->pw_gecos);
|
||||
pos = strchr (realname, ',');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
fprintf (file, "server_realname = \"%s\"\n",
|
||||
realname);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n",
|
||||
realname);
|
||||
if (pos)
|
||||
pos[0] = ',';
|
||||
free (realname);
|
||||
@@ -2334,26 +2297,26 @@ config_create_default ()
|
||||
else
|
||||
{
|
||||
/* default values if /etc/passwd can't be read */
|
||||
fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
fprintf (file, "server_nick1 = \"weechat1\"\n");
|
||||
fprintf (file, "server_nick2 = \"weechat2\"\n");
|
||||
fprintf (file, "server_nick3 = \"weechat3\"\n");
|
||||
fprintf (file, "server_username = \"weechat\"\n");
|
||||
fprintf (file, "server_realname = \"WeeChat default realname\"\n");
|
||||
weechat_iconv_fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"weechat1\"\n");
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"weechat2\"\n");
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"weechat3\"\n");
|
||||
weechat_iconv_fprintf (file, "server_username = \"weechat\"\n");
|
||||
weechat_iconv_fprintf (file, "server_realname = \"WeeChat default realname\"\n");
|
||||
}
|
||||
|
||||
fprintf (file, "server_hostname = \"\"\n");
|
||||
fprintf (file, "server_command = \"\"\n");
|
||||
fprintf (file, "server_command_delay = 0\n");
|
||||
fprintf (file, "server_autojoin = \"\"\n");
|
||||
fprintf (file, "server_autorejoin = on\n");
|
||||
fprintf (file, "server_notify_levels = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
fprintf (file, "server_charset_encode = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_hostname = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_command = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_command_delay = 0\n");
|
||||
weechat_iconv_fprintf (file, "server_autojoin = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_autorejoin = on\n");
|
||||
weechat_iconv_fprintf (file, "server_notify_levels = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_encode = \"\"\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
@@ -2406,57 +2369,57 @@ config_write (char *config_name)
|
||||
weechat_log_printf (_("Saving config to disk\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
weechat_iconv_fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
weechat_iconv_fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
weechat_iconv_fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int &&
|
||||
*weechat_options[i][j].ptr_int) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int &&
|
||||
*weechat_options[i][j].ptr_int) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
*weechat_options[i][j].ptr_int :
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
*weechat_options[i][j].ptr_int :
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
|
||||
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
|
||||
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
gui_color_get_name (*weechat_options[i][j].ptr_int) :
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
gui_color_get_name (*weechat_options[i][j].ptr_int) :
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_string) ?
|
||||
*weechat_options[i][j].ptr_string :
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_string) ?
|
||||
*weechat_options[i][j].ptr_string :
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2464,7 +2427,7 @@ config_write (char *config_name)
|
||||
}
|
||||
|
||||
/* keys section */
|
||||
fprintf (file, "\n[keys]\n");
|
||||
weechat_iconv_fprintf (file, "\n[keys]\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
@@ -2472,37 +2435,37 @@ config_write (char *config_name)
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
}
|
||||
else
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
|
||||
/* alias section */
|
||||
fprintf (file, "\n[alias]\n");
|
||||
weechat_iconv_fprintf (file, "\n[alias]\n");
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_alias->alias_name, ptr_alias->alias_command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_alias->alias_name, ptr_alias->alias_command);
|
||||
}
|
||||
|
||||
/* ignore section */
|
||||
fprintf (file, "\n[ignore]\n");
|
||||
weechat_iconv_fprintf (file, "\n[ignore]\n");
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
fprintf (file, "ignore = \"%s,%s,%s,%s\"\n",
|
||||
ptr_ignore->mask,
|
||||
ptr_ignore->type,
|
||||
ptr_ignore->channel_name,
|
||||
ptr_ignore->server_name);
|
||||
weechat_iconv_fprintf (file, "ignore = \"%s,%s,%s,%s\"\n",
|
||||
ptr_ignore->mask,
|
||||
ptr_ignore->type,
|
||||
ptr_ignore->channel_name,
|
||||
ptr_ignore->server_name);
|
||||
}
|
||||
|
||||
/* server section */
|
||||
@@ -2511,44 +2474,38 @@ config_write (char *config_name)
|
||||
{
|
||||
if (!ptr_server->command_line)
|
||||
{
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
|
||||
fprintf (file, "server_autoconnect = %s\n",
|
||||
(ptr_server->autoconnect) ? "on" : "off");
|
||||
fprintf (file, "server_autoreconnect = %s\n",
|
||||
(ptr_server->autoreconnect) ? "on" : "off");
|
||||
fprintf (file, "server_autoreconnect_delay = %d\n",
|
||||
ptr_server->autoreconnect_delay);
|
||||
fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
|
||||
fprintf (file, "server_port = %d\n", ptr_server->port);
|
||||
fprintf (file, "server_ipv6 = %s\n",
|
||||
(ptr_server->ipv6) ? "on" : "off");
|
||||
fprintf (file, "server_ssl = %s\n",
|
||||
(ptr_server->ssl) ? "on" : "off");
|
||||
fprintf (file, "server_password = \"%s\"\n",
|
||||
(ptr_server->password) ? ptr_server->password : "");
|
||||
fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
|
||||
fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
|
||||
fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
|
||||
fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
|
||||
fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
|
||||
fprintf (file, "server_hostname = \"%s\"\n",
|
||||
(ptr_server->hostname) ? ptr_server->hostname : "");
|
||||
fprintf (file, "server_command = \"%s\"\n",
|
||||
(ptr_server->command) ? ptr_server->command : "");
|
||||
fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
|
||||
fprintf (file, "server_autojoin = \"%s\"\n",
|
||||
(ptr_server->autojoin) ? ptr_server->autojoin : "");
|
||||
fprintf (file, "server_autorejoin = %s\n",
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
fprintf (file, "server_charset_decode_iso = \"%s\"\n",
|
||||
(ptr_server->charset_decode_iso) ? ptr_server->charset_decode_iso : "");
|
||||
fprintf (file, "server_charset_decode_utf = \"%s\"\n",
|
||||
(ptr_server->charset_decode_utf) ? ptr_server->charset_decode_utf : "");
|
||||
fprintf (file, "server_charset_encode = \"%s\"\n",
|
||||
(ptr_server->charset_encode) ? ptr_server->charset_encode : "");
|
||||
weechat_iconv_fprintf (file, "\n[server]\n");
|
||||
weechat_iconv_fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
|
||||
weechat_iconv_fprintf (file, "server_autoconnect = %s\n",
|
||||
(ptr_server->autoconnect) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect = %s\n",
|
||||
(ptr_server->autoreconnect) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect_delay = %d\n",
|
||||
ptr_server->autoreconnect_delay);
|
||||
weechat_iconv_fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
|
||||
weechat_iconv_fprintf (file, "server_port = %d\n", ptr_server->port);
|
||||
weechat_iconv_fprintf (file, "server_ipv6 = %s\n",
|
||||
(ptr_server->ipv6) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_ssl = %s\n",
|
||||
(ptr_server->ssl) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_password = \"%s\"\n",
|
||||
(ptr_server->password) ? ptr_server->password : "");
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
|
||||
weechat_iconv_fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
|
||||
weechat_iconv_fprintf (file, "server_hostname = \"%s\"\n",
|
||||
(ptr_server->hostname) ? ptr_server->hostname : "");
|
||||
weechat_iconv_fprintf (file, "server_command = \"%s\"\n",
|
||||
(ptr_server->command) ? ptr_server->command : "");
|
||||
weechat_iconv_fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
|
||||
weechat_iconv_fprintf (file, "server_autojoin = \"%s\"\n",
|
||||
(ptr_server->autojoin) ? ptr_server->autojoin : "");
|
||||
weechat_iconv_fprintf (file, "server_autorejoin = %s\n",
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +92,6 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode_iso;
|
||||
extern char *cfg_look_charset_decode_utf;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_one_server_buffer;
|
||||
extern int cfg_look_open_near_server;
|
||||
extern int cfg_look_scroll_amount;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "gui-curses.h"
|
||||
@@ -186,9 +187,7 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
if (CHANNEL(buffer)->topic)
|
||||
{
|
||||
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
|
||||
buf2 = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
buf2 = weechat_iconv_from_internal (NULL, (buf) ? buf : CHANNEL(buffer)->topic);
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_title, 0, 0,
|
||||
format, (buf2) ? buf2 : CHANNEL(buffer)->topic);
|
||||
if (buf)
|
||||
@@ -429,7 +428,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
|
||||
void
|
||||
gui_chat_display_word_raw (t_gui_window *window, char *string)
|
||||
{
|
||||
char *prev_char, *next_char, saved_char;
|
||||
char *prev_char, *next_char, saved_char, *output;
|
||||
|
||||
wmove (GUI_CURSES(window)->win_chat,
|
||||
window->win_chat_cursor_y,
|
||||
@@ -446,10 +445,15 @@ gui_chat_display_word_raw (t_gui_window *window, char *string)
|
||||
{
|
||||
saved_char = next_char[0];
|
||||
next_char[0] = '\0';
|
||||
if (((signed char)(prev_char[0]) == -110) && (!prev_char[1]))
|
||||
if (((unsigned char)(prev_char[0]) == 146) && (!prev_char[1]))
|
||||
wprintw (GUI_CURSES(window)->win_chat, ".");
|
||||
else
|
||||
wprintw (GUI_CURSES(window)->win_chat, "%s", prev_char);
|
||||
{
|
||||
output = weechat_iconv_from_internal (NULL, prev_char);
|
||||
wprintw (GUI_CURSES(window)->win_chat, "%s", (output) ? output : prev_char);
|
||||
if (output)
|
||||
free (output);
|
||||
}
|
||||
next_char[0] = saved_char;
|
||||
}
|
||||
|
||||
@@ -921,12 +925,14 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_chat, i, 0, "%s %-16s ",
|
||||
(ptr_dcc == dcc_selected) ? "***" : " ",
|
||||
ptr_dcc->nick);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%s", buf);
|
||||
free (buf);
|
||||
buf = weechat_iconv_from_internal (NULL,
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%s",
|
||||
(buf) ? buf : ((DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename));
|
||||
if (buf)
|
||||
free (buf);
|
||||
if (DCC_IS_FILE(ptr_dcc->type))
|
||||
{
|
||||
if (ptr_dcc->filename_suffix > 0)
|
||||
@@ -943,11 +949,11 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%-10s", buf);
|
||||
free (buf);
|
||||
buf = weechat_iconv_from_internal (NULL, _(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%-10s",
|
||||
(buf) ? buf : _(dcc_status_string[ptr_dcc->status]));
|
||||
if (buf)
|
||||
free (buf);
|
||||
|
||||
/* other infos */
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_chat,
|
||||
@@ -1016,13 +1022,12 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
unit_name[num_unit]);
|
||||
buf = weechat_iconv_from_internal (NULL, unit_name[num_unit]);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, format,
|
||||
((float)ptr_dcc->bytes_per_sec) / ((float)(unit_divide[num_unit])),
|
||||
buf);
|
||||
free (buf);
|
||||
(buf) ? buf : unit_name[num_unit]);
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -81,7 +82,7 @@ gui_infobar_draw (t_gui_buffer *buffer, int erase)
|
||||
t_gui_window *ptr_win;
|
||||
time_t time_seconds;
|
||||
struct tm *local_time;
|
||||
char text_time[1024 + 1];
|
||||
char text_time[1024 + 1], *buf;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) buffer;
|
||||
@@ -122,7 +123,10 @@ gui_infobar_draw (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_infobar, " | ");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_infobar, gui_infobar->color);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_infobar, "%s", gui_infobar->text);
|
||||
buf = weechat_iconv_from_internal (NULL, gui_infobar->text);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_infobar, "%s", (buf) ? buf : gui_infobar->text);
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
|
||||
wnoutrefresh (GUI_CURSES(ptr_win)->win_infobar);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -243,7 +244,7 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
|
||||
int
|
||||
gui_input_draw_text (t_gui_window *window, int input_width)
|
||||
{
|
||||
char *ptr_start, *ptr_next, saved_char;
|
||||
char *ptr_start, *ptr_next, saved_char, *output;
|
||||
int pos_mask, size, last_color, color, count_cursor, offset_cursor;
|
||||
|
||||
ptr_start = utf8_add_offset (window->buffer->input_buffer,
|
||||
@@ -273,7 +274,10 @@ gui_input_draw_text (t_gui_window *window, int input_width)
|
||||
gui_input_set_color (window, color);
|
||||
}
|
||||
last_color = color;
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s", ptr_start);
|
||||
output = weechat_iconv_from_internal (NULL, ptr_start);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s", (output) ? output : ptr_start);
|
||||
if (output)
|
||||
free (output);
|
||||
if (count_cursor > 0)
|
||||
{
|
||||
offset_cursor += utf8_width_screen (ptr_start);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
@@ -198,7 +199,7 @@ void
|
||||
gui_keyboard_read ()
|
||||
{
|
||||
int key, i, insert_ok;
|
||||
char key_str[32];
|
||||
char key_str[32], *key_utf;
|
||||
char *buffer_before_key;
|
||||
#ifdef PLUGINS
|
||||
char key_str2[33];
|
||||
@@ -281,6 +282,14 @@ gui_keyboard_read ()
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
|
||||
/* convert input to UTF-8 is user is not using UTF-8 as locale */
|
||||
if (!local_utf8)
|
||||
{
|
||||
key_utf = weechat_iconv_to_internal (NULL, key_str);
|
||||
strncpy (key_str, key_utf, sizeof (key_str));
|
||||
key_str[sizeof (key_str) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -78,7 +79,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("<servers>"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, _("<servers>"));
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "] ");
|
||||
@@ -90,7 +91,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "%s", SERVER(ptr_win->buffer)->name);
|
||||
if (SERVER(ptr_win->buffer)->is_away)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("(away)"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, _("(away)"));
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "] ");
|
||||
@@ -210,13 +211,16 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
switch (ptr_win->buffer->type)
|
||||
{
|
||||
case BUFFER_TYPE_STANDARD:
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("[not connected] "));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
_("[not connected] "));
|
||||
break;
|
||||
case BUFFER_TYPE_DCC:
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "<DCC> ");
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
"<DCC> ");
|
||||
break;
|
||||
case BUFFER_TYPE_RAW_DATA:
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("<RAW_IRC> "));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
_("<RAW_IRC> "));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -228,7 +232,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("Act: "));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, _("Act: "));
|
||||
|
||||
names_count = 0;
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist;
|
||||
@@ -299,7 +303,8 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, ":");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "DCC");
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
"DCC");
|
||||
break;
|
||||
case BUFFER_TYPE_RAW_DATA:
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "%d",
|
||||
@@ -309,7 +314,8 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, ":");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("RAW_IRC"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
_("RAW_IRC"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -330,8 +336,9 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, COLOR_WIN_STATUS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("Lag: %.1f"),
|
||||
((float)(SERVER(ptr_win->buffer)->lag)) / 1000);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status,
|
||||
_("Lag: %.1f"),
|
||||
((float)(SERVER(ptr_win->buffer)->lag)) / 1000);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "]");
|
||||
@@ -342,21 +349,25 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
if (BUFFER_HAS_NICKLIST(ptr_win->buffer))
|
||||
{
|
||||
snprintf (str_nicks, sizeof (str_nicks) - 1, "%d", CHANNEL(ptr_win->buffer)->nicks_count);
|
||||
x = ptr_win->win_status_width - strlen (str_nicks) - 4;
|
||||
x = ptr_win->win_status_width - utf8_strlen (str_nicks) - 4;
|
||||
}
|
||||
else
|
||||
x = ptr_win->win_status_width - 2;
|
||||
more = strdup (_("-MORE-"));
|
||||
x -= strlen (more) - 1;
|
||||
x -= utf8_strlen (more) - 1;
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, COLOR_WIN_STATUS_MORE);
|
||||
if (ptr_win->scroll)
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_status, 0, x, "%s", more);
|
||||
{
|
||||
wmove (GUI_CURSES(ptr_win)->win_status, 0, x);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, "%s", more);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (format, sizeof (format) - 1, "%%-%ds", (int)(strlen (more)));
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_status, 0, x, format, " ");
|
||||
snprintf (format, sizeof (format) - 1, "%%-%ds", (int)(utf8_strlen (more)));
|
||||
wmove (GUI_CURSES(ptr_win)->win_status, 0, x);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, format, " ");
|
||||
}
|
||||
if (BUFFER_HAS_NICKLIST(ptr_win->buffer))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <libgen.h>
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/log.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
@@ -130,6 +132,27 @@ gui_window_objects_free (t_gui_window *window, int free_separator)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_wprintw: decode then display string with wprintw
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_wprintw (WINDOW *window, char *data, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[4096];
|
||||
char *buf2;
|
||||
|
||||
va_start (argptr, data);
|
||||
vsnprintf (buf, sizeof (buf) - 1, data, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_from_internal (NULL, buf);
|
||||
wprintw (window, "%s", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_curses_clear: clear a Curses window
|
||||
*/
|
||||
|
||||
@@ -90,6 +90,7 @@ extern void gui_keyboard_default_bindings ();
|
||||
extern void gui_keyboard_read ();
|
||||
|
||||
/* window functions */
|
||||
extern void gui_window_wprintw (WINDOW *, char *, ...);
|
||||
extern void gui_window_curses_clear (WINDOW *, int);
|
||||
extern void gui_window_set_weechat_color (WINDOW *, int);
|
||||
extern void gui_window_refresh_screen_sigwinch ();
|
||||
|
||||
@@ -408,8 +408,8 @@ gui_action_delete_line (t_gui_window *window)
|
||||
void
|
||||
gui_action_transpose_chars (t_gui_window *window)
|
||||
{
|
||||
char *start, *prev_char, saved_char[4];
|
||||
int size_current_char, size_start_char;
|
||||
char *start, *prev_char, saved_char[5];
|
||||
int size_prev_char, size_start_char;
|
||||
int pos_prev_char, pos_start;
|
||||
|
||||
if (window->buffer->has_input)
|
||||
@@ -426,18 +426,18 @@ gui_action_transpose_chars (t_gui_window *window)
|
||||
prev_char = utf8_prev_char (window->buffer->input_buffer,
|
||||
start);
|
||||
pos_prev_char = prev_char - window->buffer->input_buffer;
|
||||
size_current_char = start - prev_char;
|
||||
size_prev_char = start - prev_char;
|
||||
size_start_char = utf8_char_size (start);
|
||||
|
||||
memcpy (saved_char, prev_char, size_current_char);
|
||||
memcpy (saved_char, prev_char, size_prev_char);
|
||||
memcpy (prev_char, start, size_start_char);
|
||||
memcpy (start, saved_char, size_current_char);
|
||||
memcpy (prev_char + size_start_char, saved_char, size_prev_char);
|
||||
|
||||
memcpy (saved_char, window->buffer->input_buffer_color_mask + pos_prev_char, size_current_char);
|
||||
memcpy (saved_char, window->buffer->input_buffer_color_mask + pos_prev_char, size_prev_char);
|
||||
memcpy (window->buffer->input_buffer_color_mask + pos_prev_char,
|
||||
window->buffer->input_buffer_color_mask + pos_start, size_start_char);
|
||||
memcpy (window->buffer->input_buffer_color_mask + pos_start,
|
||||
saved_char, size_current_char);
|
||||
memcpy (window->buffer->input_buffer_color_mask + pos_prev_char + size_start_char,
|
||||
saved_char, size_prev_char);
|
||||
|
||||
window->buffer->input_buffer_pos++;
|
||||
|
||||
|
||||
+18
-49
@@ -41,6 +41,7 @@
|
||||
#include "../common/hotlist.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/util.c"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
@@ -223,7 +224,7 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
|
||||
time_t date;
|
||||
struct tm *local_time;
|
||||
int time_first_digit, time_last_digit;
|
||||
char *buf2, *pos;
|
||||
char *pos;
|
||||
int i;
|
||||
va_list argptr;
|
||||
|
||||
@@ -243,8 +244,9 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
weechat_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n");
|
||||
weechat_log_printf ("%s gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n",
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,15 +263,12 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
|
||||
|
||||
if (!buf[0])
|
||||
return;
|
||||
|
||||
if (gui_init_ok)
|
||||
buf2 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf);
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
utf8_normalize (buf, '?');
|
||||
|
||||
if (gui_init_ok)
|
||||
{
|
||||
pos = buf2;
|
||||
pos = buf;
|
||||
while (pos)
|
||||
{
|
||||
date = time (NULL);
|
||||
@@ -353,9 +352,7 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
|
||||
}
|
||||
}
|
||||
else
|
||||
printf ("%s", buf2);
|
||||
|
||||
free (buf2);
|
||||
weechat_iconv_fprintf (stdout, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -407,7 +404,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
static char buf[1024];
|
||||
va_list argptr;
|
||||
t_gui_infobar *ptr_infobar;
|
||||
char *pos;
|
||||
char *buf2, *ptr_buf, *pos;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
@@ -416,8 +413,11 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
|
||||
if (ptr_infobar)
|
||||
{
|
||||
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
|
||||
ptr_buf = (buf2) ? buf2 : buf;
|
||||
|
||||
ptr_infobar->color = color;
|
||||
ptr_infobar->text = strdup (buf);
|
||||
ptr_infobar->text = strdup (ptr_buf);
|
||||
pos = strchr (ptr_infobar->text, '\n');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
@@ -425,43 +425,12 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
ptr_infobar->next_infobar = gui_infobar;
|
||||
gui_infobar = ptr_infobar;
|
||||
gui_infobar_draw (gui_current_window->buffer, 1);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
weechat_log_printf (_("Not enough memory for infobar message\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_infobar_printf_from_buffer: remove color, convert charset, then
|
||||
* display message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
gui_infobar_printf_from_buffer (t_gui_buffer *buffer, int time_displayed,
|
||||
int color, char *message1, char *message, ...)
|
||||
{
|
||||
static char buf[1024];
|
||||
va_list argptr;
|
||||
char *buf2, *buf3;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
|
||||
|
||||
if (buf2)
|
||||
buf3 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf2);
|
||||
else
|
||||
buf3 = NULL;
|
||||
|
||||
gui_infobar_printf (time_displayed, color,
|
||||
"%s%s", message1,
|
||||
(buf3) ? buf3 : ((buf2) ? buf2 : buf));
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
if (buf3)
|
||||
free (buf3);
|
||||
weechat_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+5
-5
@@ -53,7 +53,7 @@ gui_log_write_date (t_gui_buffer *buffer)
|
||||
if (date_tmp)
|
||||
{
|
||||
strftime (buf_time, sizeof (buf_time) - 1, cfg_log_timestamp, date_tmp);
|
||||
fprintf (buffer->log_file, "%s ", buf_time);
|
||||
weechat_iconv_fprintf (buffer->log_file, "%s ", buf_time);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
@@ -71,8 +71,8 @@ gui_log_write_line (t_gui_buffer *buffer, char *message)
|
||||
if (buffer->log_file)
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
fprintf (buffer->log_file, "%s\n",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
weechat_iconv_fprintf (buffer->log_file,
|
||||
"%s\n", (msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
@@ -91,8 +91,8 @@ gui_log_write (t_gui_buffer *buffer, char *message)
|
||||
if (buffer->log_file)
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
fprintf (buffer->log_file, "%s",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
weechat_iconv_fprintf (buffer->log_file,
|
||||
"%s", (msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
|
||||
+4
-4
@@ -177,14 +177,14 @@ extern void gui_log_start (t_gui_buffer *);
|
||||
extern void gui_log_end (t_gui_buffer *);
|
||||
|
||||
/* other */
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_infobar_remove_all ();
|
||||
extern int gui_word_strlen (t_gui_window *, char *);
|
||||
extern int gui_word_real_pos (t_gui_window *, char *, int);
|
||||
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, char *, ...);
|
||||
extern void gui_printf_raw_data (void *, int, int, char *);
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_infobar_remove_all ();
|
||||
extern void gui_input_optimize_size (t_gui_buffer *);
|
||||
extern void gui_input_init_color_mask (t_gui_buffer *);
|
||||
extern void gui_input_move (t_gui_buffer *, char *, char *, int );
|
||||
|
||||
@@ -258,143 +258,6 @@ string_is_channel (char *string)
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_iso: get decode iso value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_iso (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_iso (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_iso (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_utf: get decode utf value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_utf (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_utf (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_utf (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_encode: get encode value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_encode (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_encode (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_encode (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_iconv_decode: convert string to local charset
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_decode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *from_charset, *string2;
|
||||
|
||||
if (!local_utf8 || !utf8_is_valid (string))
|
||||
{
|
||||
if (local_utf8)
|
||||
from_charset = channel_get_charset_decode_iso (server, channel);
|
||||
else
|
||||
from_charset = channel_get_charset_decode_utf (server, channel);
|
||||
string2 = weechat_iconv (from_charset,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
string);
|
||||
free (from_charset);
|
||||
return string2;
|
||||
}
|
||||
else
|
||||
return strdup (string);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_encode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *to_charset, *string2;
|
||||
|
||||
to_charset = channel_get_charset_encode (server, channel);
|
||||
string2 = weechat_iconv ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
to_charset,
|
||||
string);
|
||||
free (to_charset);
|
||||
return string2;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
|
||||
+5
-16
@@ -1196,9 +1196,8 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
|
||||
if (!ptr_dcc || (ptr_dcc->sock < 0))
|
||||
return;
|
||||
|
||||
@@ -1217,10 +1216,7 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
#endif
|
||||
buf2 = channel_iconv_encode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
buffer);
|
||||
if (dcc_chat_send (ptr_dcc, buf2, strlen (buf2)) <= 0)
|
||||
if (dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0)
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
PREFIX_ERROR);
|
||||
@@ -1229,7 +1225,6 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
WEECHAT_ERROR, ptr_dcc->nick);
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1242,7 +1237,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
fd_set read_fd;
|
||||
static struct timeval timeout;
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
char *ptr_buf_color;
|
||||
int num_read;
|
||||
|
||||
@@ -1307,11 +1302,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
|
||||
if (ptr_buf)
|
||||
{
|
||||
ptr_buf2 = channel_iconv_decode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
ptr_buf);
|
||||
ptr_buf_color = (char *)gui_color_decode ((ptr_buf2) ?
|
||||
(unsigned char *)ptr_buf2 : (unsigned char *)ptr_buf,
|
||||
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
|
||||
cfg_irc_colors_receive);
|
||||
|
||||
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
|
||||
@@ -1326,7 +1317,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
ptr_dcc->nick,
|
||||
(ptr_buf_color) ? ptr_buf_color : ((ptr_buf2) ? ptr_buf2 : ptr_buf));
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1338,8 +1329,6 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
if (ptr_buf_color)
|
||||
free (ptr_buf_color);
|
||||
if (ptr_buf2)
|
||||
free (ptr_buf2);
|
||||
}
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
|
||||
@@ -428,13 +428,4 @@ irc_display_server (t_irc_server *server)
|
||||
gui_printf (NULL, " server_notify_levels . . . : %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
gui_printf (NULL, " server_charset_decode_iso. : %s\n",
|
||||
(server->charset_decode_iso && server->charset_decode_iso[0]) ?
|
||||
server->charset_decode_iso : "");
|
||||
gui_printf (NULL, " server_charset_decode_utf. : %s\n",
|
||||
(server->charset_decode_utf && server->charset_decode_utf[0]) ?
|
||||
server->charset_decode_utf : "");
|
||||
gui_printf (NULL, " server_charset_encode. . . : %s\n",
|
||||
(server->charset_encode && server->charset_encode[0]) ?
|
||||
server->charset_encode : "");
|
||||
}
|
||||
|
||||
+20
-28
@@ -977,11 +977,10 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
nick);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->buffer != gui_current_window->buffer) )
|
||||
gui_infobar_printf_from_buffer (ptr_channel->buffer,
|
||||
cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
@@ -1348,12 +1347,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
if ( (cfg_look_infobar)
|
||||
&& (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->buffer != gui_current_window->buffer) )
|
||||
gui_infobar_printf_from_buffer (ptr_channel->buffer,
|
||||
cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel %s: * %s %s"),
|
||||
ptr_channel->name, nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
@@ -1479,12 +1476,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
if ( (cfg_look_infobar)
|
||||
&& (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->buffer != gui_current_window->buffer) )
|
||||
gui_infobar_printf_from_buffer (ptr_channel->buffer,
|
||||
cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel"), " %s: %s> %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel %s: %s> %s"),
|
||||
ptr_channel->name, nick, pos);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
#ifdef PLUGINS
|
||||
@@ -1909,12 +1904,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
if ( (cfg_look_infobar)
|
||||
&& (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->buffer != gui_current_window->buffer) )
|
||||
gui_infobar_printf_from_buffer (ptr_channel->buffer,
|
||||
cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Channel %s: * %s %s"),
|
||||
ptr_channel->name, nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
@@ -2013,11 +2006,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
COLOR_WIN_CHAT_HIGHLIGHT, 0);
|
||||
if ((cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->buffer != gui_current_window->buffer))
|
||||
gui_infobar_printf_from_buffer (ptr_channel->buffer,
|
||||
cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
|
||||
+11
-115
@@ -46,6 +46,7 @@
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/util.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -93,9 +94,6 @@ server_init (t_irc_server *server)
|
||||
server->autojoin = NULL;
|
||||
server->autorejoin = 0;
|
||||
server->notify_levels = NULL;
|
||||
server->charset_decode_iso = NULL;
|
||||
server->charset_decode_utf = NULL;
|
||||
server->charset_encode = NULL;
|
||||
|
||||
/* internal vars */
|
||||
server->child_pid = 0;
|
||||
@@ -189,10 +187,10 @@ server_init_with_url (char *irc_url, t_irc_server *server)
|
||||
server->nick1 = strdup (my_passwd->pw_name);
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
weechat_iconv_fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
free (url);
|
||||
return -1;
|
||||
}
|
||||
@@ -259,7 +257,9 @@ server_alloc ()
|
||||
/* alloc memory for new server */
|
||||
if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot allocate new server\n"), WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s cannot allocate new server\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -314,12 +314,6 @@ server_destroy (t_irc_server *server)
|
||||
free (server->autojoin);
|
||||
if (server->notify_levels)
|
||||
free (server->notify_levels);
|
||||
if (server->charset_decode_iso)
|
||||
free (server->charset_decode_iso);
|
||||
if (server->charset_decode_utf)
|
||||
free (server->charset_decode_utf);
|
||||
if (server->charset_encode)
|
||||
free (server->charset_encode);
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
if (server->nick)
|
||||
@@ -389,9 +383,7 @@ server_new (char *name, int autoconnect, int autoreconnect,
|
||||
int port, int ipv6, int ssl, char *password,
|
||||
char *nick1, char *nick2, char *nick3, char *username,
|
||||
char *realname, char *hostname, char *command, int command_delay,
|
||||
char *autojoin, int autorejoin, char *notify_levels,
|
||||
char *charset_decode_iso, char *charset_decode_utf,
|
||||
char *charset_encode)
|
||||
char *autojoin, int autorejoin, char *notify_levels)
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
@@ -402,16 +394,13 @@ server_new (char *name, int autoconnect, int autoreconnect,
|
||||
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"hostname: %s, command:%s, autojoin:%s, autorejoin:%s, "
|
||||
"notify_levels:%s, decode_iso:%s, decode_utf:%s, encode:%s)\n",
|
||||
"notify_levels:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(hostname) ? hostname : "", (command) ? command : "",
|
||||
(autojoin) ? autojoin : "", (autorejoin) ? "on" : "off",
|
||||
(notify_levels) ? notify_levels : "",
|
||||
(charset_decode_iso) ? charset_decode_iso : "",
|
||||
(charset_decode_utf) ? charset_decode_utf : "",
|
||||
(charset_encode) ? charset_encode : "");
|
||||
(notify_levels) ? notify_levels : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
@@ -443,102 +432,12 @@ server_new (char *name, int autoconnect, int autoreconnect,
|
||||
new_server->autorejoin = autorejoin;
|
||||
new_server->notify_levels =
|
||||
(notify_levels) ? strdup (notify_levels) : NULL;
|
||||
new_server->charset_decode_iso =
|
||||
(charset_decode_iso) ? strdup (charset_decode_iso) : NULL;
|
||||
new_server->charset_decode_utf =
|
||||
(charset_decode_utf) ? strdup (charset_decode_utf) : NULL;
|
||||
new_server->charset_encode =
|
||||
(charset_encode) ? strdup (charset_encode) : NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return new_server;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_iso: get decode iso value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_iso (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_utf: get decode utf value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_utf (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_encode: get encode value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_encode (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_send: send data to IRC server
|
||||
*/
|
||||
@@ -2144,9 +2043,6 @@ server_print_log (t_irc_server *server)
|
||||
weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
weechat_log_printf (" charset_decode_iso. : %s\n", server->charset_decode_iso);
|
||||
weechat_log_printf (" charset_decode_utf. : %s\n", server->charset_decode_utf);
|
||||
weechat_log_printf (" charset_encode. . . : %s\n", server->charset_encode);
|
||||
weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
|
||||
+1
-7
@@ -143,9 +143,6 @@ struct t_irc_server
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
char *notify_levels; /* channels notify levels */
|
||||
char *charset_decode_iso; /* channels charsets for decoding ISO */
|
||||
char *charset_decode_utf; /* channels charsets for decoding UTF */
|
||||
char *charset_encode; /* channels charsets for encoding msgs */
|
||||
|
||||
/* internal vars */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
@@ -340,8 +337,7 @@ extern void server_free (t_irc_server *);
|
||||
extern void server_free_all ();
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
char *, char *, int, char *, int, char *, char *,
|
||||
char *, char *);
|
||||
char *, char *, int, char *, int, char *);
|
||||
extern char *server_get_charset_decode_iso (t_irc_server *);
|
||||
extern char *server_get_charset_decode_utf (t_irc_server *);
|
||||
extern char *server_get_charset_encode (t_irc_server *);
|
||||
@@ -388,8 +384,6 @@ extern int string_is_channel (char *);
|
||||
extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_decode_utf (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_iconv_decode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern char *channel_iconv_encode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *, int);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
|
||||
@@ -37,7 +37,11 @@ if PLUGIN_ASPELL
|
||||
aspell_dir = aspell
|
||||
endif
|
||||
|
||||
SUBDIRS = $(script_dir) $(aspell_dir)
|
||||
if PLUGIN_CHARSET
|
||||
charset_dir = charset
|
||||
endif
|
||||
|
||||
SUBDIRS = $(script_dir) $(aspell_dir) $(charset_dir)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2003-2006 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(CHARSET_CFLAGS)
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = charset.la
|
||||
|
||||
charset_la_SOURCES = weechat-charset.h weechat-charset.c
|
||||
charset_la_LDFLAGS = -module
|
||||
charset_la_LIBADD = $(CHARSET_LFLAGS)
|
||||
@@ -0,0 +1,668 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2006 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* weechat-charset.c: Charset plugin for WeeChat */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define __USE_GNU
|
||||
#include <string.h>
|
||||
#include <iconv.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "weechat-charset.h"
|
||||
|
||||
|
||||
char *weechat_charset_excluded_cmd[] = { "ping", "pong", NULL };
|
||||
|
||||
char *weechat_charset_terminal = NULL;
|
||||
char *weechat_charset_internal = NULL;
|
||||
|
||||
/* set to 1 by /charset debug (hidden option) */
|
||||
int weechat_charset_debug = 0;
|
||||
|
||||
|
||||
/*
|
||||
* weechat_charset_strndup: define strndup function if not existing (FreeBSD and maybe other)
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_charset_strndup (char *string, int length)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if ((int)strlen (string) < length)
|
||||
return strdup (string);
|
||||
|
||||
result = (char *)malloc (length + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
memcpy (result, string, length);
|
||||
result[length] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_default_decode: set "global.decode" option if needed
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_charset_default_decode (t_weechat_plugin *plugin)
|
||||
{
|
||||
char *global_decode;
|
||||
int rc;
|
||||
|
||||
global_decode = plugin->get_plugin_config (plugin, "global.decode");
|
||||
|
||||
/* if global decode is not set, we may set it, depending on terminal charset */
|
||||
if (!global_decode || !global_decode[0])
|
||||
{
|
||||
/* set global decode charset to terminal if different from internal */
|
||||
/* otherwise use ISO-8859-1 */
|
||||
if (weechat_charset_terminal && weechat_charset_internal
|
||||
&& (strcasecmp (weechat_charset_terminal, weechat_charset_internal) != 0))
|
||||
rc = plugin->set_plugin_config (plugin,
|
||||
"global.decode",
|
||||
weechat_charset_terminal);
|
||||
else
|
||||
rc = plugin->set_plugin_config (plugin,
|
||||
"global.decode",
|
||||
"ISO-8859-1");
|
||||
if (rc)
|
||||
plugin->print_server (plugin,
|
||||
"Charset: setting \"charset.global.decode\" to %s",
|
||||
weechat_charset_terminal);
|
||||
else
|
||||
plugin->print_server (plugin,
|
||||
"Charset: failed to set \"charset.global.decode\" option.");
|
||||
}
|
||||
if (global_decode)
|
||||
free (global_decode);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_check: check if a charset is valid
|
||||
* if a charset is NULL, internal charset is used
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_charset_check (char *charset)
|
||||
{
|
||||
iconv_t cd;
|
||||
|
||||
if (!charset || !charset[0])
|
||||
return 0;
|
||||
|
||||
cd = iconv_open (charset, weechat_charset_internal);
|
||||
if (cd == (iconv_t)(-1))
|
||||
return 0;
|
||||
|
||||
iconv_close (cd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_get_config: read a charset in config file
|
||||
* we first in this order: channel, server, global
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_charset_get_config (t_weechat_plugin *plugin,
|
||||
char *type, char *server, char *channel)
|
||||
{
|
||||
static char option[1024];
|
||||
char *value;
|
||||
|
||||
/* we try channel first */
|
||||
if (server && channel)
|
||||
{
|
||||
snprintf (option, sizeof (option) - 1, "%s.%s.%s", type, server, channel);
|
||||
value = plugin->get_plugin_config (plugin, option);
|
||||
if (value && value[0])
|
||||
return value;
|
||||
if (value)
|
||||
free (value);
|
||||
}
|
||||
|
||||
/* channel not found, we try server only */
|
||||
if (server)
|
||||
{
|
||||
snprintf (option, sizeof (option) - 1, "%s.%s", type, server);
|
||||
value = plugin->get_plugin_config (plugin, option);
|
||||
if (value && value[0])
|
||||
return value;
|
||||
if (value)
|
||||
free (value);
|
||||
}
|
||||
|
||||
/* nothing found, we try global charset */
|
||||
snprintf (option, sizeof (option) - 1, "global.%s", type);
|
||||
value = plugin->get_plugin_config (plugin, option);
|
||||
if (value && value[0])
|
||||
return value;
|
||||
if (value)
|
||||
free (value);
|
||||
|
||||
/* nothing found => no decode/encode for this message! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_set_config: set a charset in config file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_charset_set_config (t_weechat_plugin *plugin,
|
||||
char *type, char *server, char *channel, char *value)
|
||||
{
|
||||
static char option[1024];
|
||||
|
||||
if (server && channel)
|
||||
snprintf (option, sizeof (option) - 1, "%s.%s.%s", type, server, channel);
|
||||
else if (server)
|
||||
snprintf (option, sizeof (option) - 1, "%s.%s", type, server);
|
||||
else
|
||||
return;
|
||||
|
||||
plugin->set_plugin_config (plugin, option, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_command_allowed: return 1 if command can be decoded/encoded
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_charset_command_allowed (char *command)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!command)
|
||||
return 0;
|
||||
|
||||
for (i = 0; weechat_charset_excluded_cmd[i]; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_charset_excluded_cmd[i], command) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* command can be decoded/recoded */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_parse_irc_msg: return nick, command, channel and position
|
||||
* of arguments in IRC message
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_charset_parse_irc_msg (char *message, char **nick, char **command,
|
||||
char **channel, char **pos_args)
|
||||
{
|
||||
char *pos, *pos2, *pos3;
|
||||
|
||||
*nick = NULL;
|
||||
*command = NULL;
|
||||
*channel = NULL;
|
||||
*pos_args = NULL;
|
||||
if (message[0] == ':')
|
||||
{
|
||||
pos = message + 1;
|
||||
pos2 = strchr (pos, '!');
|
||||
if (pos2)
|
||||
*nick = weechat_charset_strndup (pos, pos2 - pos);
|
||||
else
|
||||
{
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
*nick = weechat_charset_strndup (pos, pos2 - pos);
|
||||
}
|
||||
pos = strchr (message, ' ');
|
||||
if (!pos)
|
||||
pos = message;
|
||||
}
|
||||
else
|
||||
pos = message;
|
||||
|
||||
if (pos && pos[0])
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
*command = strndup (pos, pos2 - pos);
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
if (pos2[0] == ':')
|
||||
*pos_args = pos2 + 1;
|
||||
else
|
||||
{
|
||||
if ((pos2[0] == '#') || (pos2[0] == '&')
|
||||
|| (pos2[0] == '+') || (pos2[0] == '!'))
|
||||
{
|
||||
pos3 = strchr (pos2, ' ');
|
||||
if (pos3)
|
||||
*channel = weechat_charset_strndup (pos2, pos3 - pos2);
|
||||
else
|
||||
*channel = strdup (pos2);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos3 = strchr (pos2, ' ');
|
||||
if (!*nick)
|
||||
{
|
||||
if (pos3)
|
||||
*nick = weechat_charset_strndup (pos2, pos3 - pos2);
|
||||
else
|
||||
*nick = strdup (pos2);
|
||||
}
|
||||
}
|
||||
if (pos3)
|
||||
{
|
||||
while (pos3[0] == ' ')
|
||||
pos3++;
|
||||
*pos_args = (pos3[0] == ':') ? pos3 + 1 : pos3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_irc_in: transform charset for incoming messages
|
||||
* convert from any charset to WeeChat internal
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_charset_irc_in (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
char *nick, *command, *channel, *charset, *ptr_args;
|
||||
char *decoded, *output;
|
||||
int length;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
output = NULL;
|
||||
|
||||
weechat_charset_parse_irc_msg (argv[1], &nick, &command, &channel, &ptr_args);
|
||||
|
||||
if (weechat_charset_command_allowed (command))
|
||||
{
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"decode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset IN: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (ptr_args && charset)
|
||||
{
|
||||
decoded = plugin->iconv_to_internal (plugin, charset, ptr_args);
|
||||
if (decoded)
|
||||
{
|
||||
length = strlen (decoded) + (ptr_args - argv[1]) + 1;
|
||||
output = (char *)malloc (length + 1);
|
||||
strncpy (output, argv[1], ptr_args - argv[1]);
|
||||
output[ptr_args - argv[1]] = '\0';
|
||||
strcat (output, decoded);
|
||||
free (decoded);
|
||||
}
|
||||
}
|
||||
|
||||
if (charset)
|
||||
free (charset);
|
||||
}
|
||||
|
||||
if (nick)
|
||||
free (nick);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
free (channel);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_irc_out: transform charset for outgoing messages
|
||||
* convert from WeeChat internal charset to other
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_charset_irc_out (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
char *nick, *command, *channel, *charset, *ptr_args;
|
||||
char *encoded, *output;
|
||||
int length;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
output = NULL;
|
||||
|
||||
weechat_charset_parse_irc_msg (argv[1], &nick, &command, &channel, &ptr_args);
|
||||
|
||||
if (weechat_charset_command_allowed (command))
|
||||
{
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"encode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset OUT: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (ptr_args && charset)
|
||||
{
|
||||
encoded = plugin->iconv_from_internal (plugin, charset, ptr_args);
|
||||
if (encoded)
|
||||
{
|
||||
length = strlen (encoded) + (ptr_args - argv[1]) + 1;
|
||||
output = (char *)malloc (length + 1);
|
||||
strncpy (output, argv[1], ptr_args - argv[1]);
|
||||
output[ptr_args - argv[1]] = '\0';
|
||||
strcat (output, encoded);
|
||||
free (encoded);
|
||||
}
|
||||
}
|
||||
|
||||
if (charset)
|
||||
free (charset);
|
||||
}
|
||||
|
||||
if (nick)
|
||||
free (nick);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
free (channel);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_display: display charsets (global/server/channel)
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_charset_display (t_weechat_plugin *plugin,
|
||||
int display_on_server, char *server, char *channel)
|
||||
{
|
||||
char *decode, *encode;
|
||||
static char option[1024];
|
||||
|
||||
decode = NULL;
|
||||
encode = NULL;
|
||||
|
||||
/* display global settings */
|
||||
if (!server && !channel)
|
||||
{
|
||||
decode = plugin->get_plugin_config (plugin, "global.decode");
|
||||
encode = plugin->get_plugin_config (plugin, "global.encode");
|
||||
|
||||
if (display_on_server)
|
||||
plugin->print_server (plugin,
|
||||
"Charset: global charsets: decode = %s, encode = %s",
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
else
|
||||
plugin->print (plugin, NULL, NULL,
|
||||
"Charset: global charsets: decode = %s, encode = %s",
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
}
|
||||
|
||||
/* display server settings */
|
||||
if (server && !channel)
|
||||
{
|
||||
snprintf (option, sizeof (option) - 1, "decode.%s", server);
|
||||
decode = plugin->get_plugin_config (plugin, option);
|
||||
snprintf (option, sizeof (option) - 1, "encode.%s", server);
|
||||
encode = plugin->get_plugin_config (plugin, option);
|
||||
|
||||
if (display_on_server)
|
||||
plugin->print_server (plugin,
|
||||
"Charset: decode / encode charset for server %s: %s / %s",
|
||||
server,
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
else
|
||||
plugin->print (plugin, NULL, NULL,
|
||||
"Charset: decode / encode charset for server %s: %s / %s",
|
||||
server,
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
}
|
||||
|
||||
/* display chan/nick settings */
|
||||
if (server && channel)
|
||||
{
|
||||
snprintf (option, sizeof (option) - 1, "decode.%s.%s", server, channel);
|
||||
decode = plugin->get_plugin_config (plugin, option);
|
||||
snprintf (option, sizeof (option) - 1, "encode.%s.%s", server, channel);
|
||||
encode = plugin->get_plugin_config (plugin, option);
|
||||
|
||||
if (display_on_server)
|
||||
plugin->print_server (plugin,
|
||||
"Charset: decode / encode charset for %s/%s: %s / %s",
|
||||
server, channel,
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
else
|
||||
plugin->print (plugin, NULL, NULL,
|
||||
"Charset: decode / encode charset for %s/%s: %s / %s",
|
||||
server, channel,
|
||||
(decode) ? decode : "(none)",
|
||||
(encode) ? encode : "(none)");
|
||||
}
|
||||
|
||||
if (decode)
|
||||
free (decode);
|
||||
if (encode)
|
||||
free (encode);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_cmd: /charset command
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_charset_cmd (t_weechat_plugin *plugin,
|
||||
int cmd_argc, char **cmd_argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int argc;
|
||||
char **argv, *server, *channel;
|
||||
|
||||
if (cmd_argc < 3)
|
||||
return PLUGIN_RC_KO;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
if (cmd_argv[2])
|
||||
argv = plugin->explode_string (plugin, cmd_argv[2], " ", 0, &argc);
|
||||
else
|
||||
{
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
}
|
||||
|
||||
/* get command context */
|
||||
server = plugin->get_info (plugin, "server", NULL);
|
||||
channel = plugin->get_info (plugin, "channel", NULL);
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 0:
|
||||
plugin->print_server (plugin, "");
|
||||
weechat_charset_display (plugin, 1, NULL, NULL);
|
||||
weechat_charset_display (plugin, 1, server, NULL);
|
||||
if (channel)
|
||||
weechat_charset_display (plugin, 1, server, channel);
|
||||
break;
|
||||
case 1:
|
||||
if (strcasecmp (argv[0], "decode") == 0)
|
||||
{
|
||||
weechat_charset_set_config (plugin, "decode", server, channel, NULL);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "encode") == 0)
|
||||
{
|
||||
weechat_charset_set_config (plugin, "encode", server, channel, NULL);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "debug") == 0)
|
||||
{
|
||||
weechat_charset_debug ^= 1;
|
||||
plugin->print (plugin, NULL, NULL,
|
||||
"Charset: debug [%s].",
|
||||
(weechat_charset_debug) ? "ON" : "off");
|
||||
}
|
||||
else if (strcasecmp (argv[0], "reset") == 0)
|
||||
{
|
||||
weechat_charset_set_config (plugin, "decode", server, channel, NULL);
|
||||
weechat_charset_set_config (plugin, "encode", server, channel, NULL);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!weechat_charset_check (argv[0]))
|
||||
plugin->print_server (plugin,
|
||||
"Charset error: invalid charset \"%s\"",
|
||||
argv[0]);
|
||||
else
|
||||
{
|
||||
weechat_charset_set_config (plugin, "decode", server, channel, argv[0]);
|
||||
weechat_charset_set_config (plugin, "encode", server, channel, argv[0]);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!weechat_charset_check (argv[1]))
|
||||
plugin->print_server (plugin,
|
||||
"Charset error: invalid charset \"%s\"",
|
||||
argv[1]);
|
||||
else
|
||||
{
|
||||
if (strcasecmp (argv[0], "decode") == 0)
|
||||
{
|
||||
weechat_charset_set_config (plugin, "decode", server, channel, argv[1]);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "encode") == 0)
|
||||
{
|
||||
weechat_charset_set_config (plugin, "encode", server, channel, argv[1]);
|
||||
weechat_charset_display (plugin, 0, server, channel);
|
||||
}
|
||||
else
|
||||
plugin->print_server (plugin,
|
||||
"Charset error: unknown option \"%s\"",
|
||||
argv[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (server)
|
||||
free (server);
|
||||
if (channel)
|
||||
free (channel);
|
||||
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_init: init charset plugin
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
{
|
||||
t_plugin_modifier *msg_irc_in, *msg_irc_out;
|
||||
t_plugin_handler *cmd_handler;
|
||||
|
||||
/* get terminal & internal charsets */
|
||||
weechat_charset_terminal = plugin->get_info (plugin, "charset_terminal", NULL);
|
||||
weechat_charset_internal = plugin->get_info (plugin, "charset_internal", NULL);
|
||||
|
||||
/* display message */
|
||||
plugin->print_server (plugin, "Charset plugin starting, terminal charset: %s (WeeChat internal: %s)",
|
||||
weechat_charset_terminal, weechat_charset_internal);
|
||||
|
||||
/* set global default decode charset */
|
||||
weechat_charset_default_decode (plugin);
|
||||
|
||||
/* add command handler */
|
||||
cmd_handler = plugin->cmd_handler_add (plugin, "charset",
|
||||
"Charset management by server or channel",
|
||||
"[[decode | encode] charset] | [reset]",
|
||||
" decode: set a decoding charset for server/channel\n"
|
||||
" encode: set an encofing charset for server/channel\n"
|
||||
"charset: the charset for decoding or encoding messages\n"
|
||||
" reset: reset charsets for server/channel\n\n"
|
||||
"To set global decode/encode charset (for all servers), use /setp charset.global.decode "
|
||||
"or /setp charset.global.encode\n"
|
||||
"To see all charsets for all servers, use /setp charset",
|
||||
"decode|encode|reset",
|
||||
&weechat_charset_cmd,
|
||||
NULL, NULL);
|
||||
|
||||
/* add messge modifier */
|
||||
msg_irc_in = plugin->modifier_add (plugin, "irc_in", "*",
|
||||
&weechat_charset_irc_in,
|
||||
NULL, NULL);
|
||||
msg_irc_out = plugin->modifier_add (plugin, "irc_out", "*",
|
||||
&weechat_charset_irc_out,
|
||||
NULL, NULL);
|
||||
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_end: end charset plugin
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (weechat_charset_terminal)
|
||||
free (weechat_charset_terminal);
|
||||
if (weechat_charset_internal)
|
||||
free (weechat_charset_internal);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2006 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* weechat-charset.h: Charset plugin support for WeeChat */
|
||||
|
||||
#ifndef WEECHAT_CHARSET__H
|
||||
#define WEECHAT_CHARSET__H 1
|
||||
|
||||
#define _PLUGIN_NAME "charset"
|
||||
#define _PLUGIN_VERSION "0.1"
|
||||
#define _PLUGIN_DESC "Charset plugin for WeeChat"
|
||||
|
||||
char plugin_name[] = _PLUGIN_NAME;
|
||||
char plugin_version[] = _PLUGIN_VERSION;
|
||||
char plugin_description[] = _PLUGIN_DESC;
|
||||
|
||||
#endif /* WEECHAT_CHARSET__H */
|
||||
@@ -230,7 +230,7 @@ plugin_config_read ()
|
||||
char *filename;
|
||||
FILE *file;
|
||||
int line_number;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
char line[1024], *ptr_line, *ptr_line2, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
|
||||
@@ -250,6 +250,14 @@ plugin_config_read ()
|
||||
line_number++;
|
||||
if (ptr_line)
|
||||
{
|
||||
/* encode line to internal charset */
|
||||
ptr_line2 = weechat_iconv_to_internal (NULL, ptr_line);
|
||||
if (ptr_line2)
|
||||
{
|
||||
snprintf (line, sizeof (line) - 1, "%s", ptr_line2);
|
||||
free (ptr_line2);
|
||||
}
|
||||
|
||||
/* skip spaces */
|
||||
while (ptr_line[0] == ' ')
|
||||
ptr_line++;
|
||||
@@ -357,19 +365,19 @@ plugin_config_write ()
|
||||
}
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s plugins configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when options are updated.\n#\n"));
|
||||
weechat_iconv_fprintf (file, _("#\n# %s plugins configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
weechat_iconv_fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when options are updated.\n#\n"));
|
||||
|
||||
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
|
||||
ptr_plugin_option = ptr_plugin_option->next_option)
|
||||
{
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_plugin_option->name,
|
||||
ptr_plugin_option->value);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_plugin_option->name,
|
||||
ptr_plugin_option->value);
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
|
||||
+128
-24
@@ -31,11 +31,13 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "plugins-config.h"
|
||||
#include "../common/command.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/util.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
@@ -164,6 +166,7 @@ weechat_plugin_print (t_weechat_plugin *plugin,
|
||||
t_gui_buffer *ptr_buffer;
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
@@ -172,8 +175,12 @@ weechat_plugin_print (t_weechat_plugin *plugin,
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s\n", buf);
|
||||
gui_printf (ptr_buffer, "%s\n", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -185,6 +192,7 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
@@ -192,8 +200,12 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "%s\n", buf);
|
||||
gui_printf (NULL, "%s\n", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -205,6 +217,7 @@ weechat_plugin_print_infobar (t_weechat_plugin *plugin, int time_displayed, char
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
char *buf2;
|
||||
|
||||
if (!plugin || (time_displayed < 0) || !message)
|
||||
return;
|
||||
@@ -212,7 +225,12 @@ weechat_plugin_print_infobar (t_weechat_plugin *plugin, int time_displayed, char
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, "%s", buf);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, "%s",
|
||||
(buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -239,7 +257,7 @@ weechat_plugin_infobar_remove (t_weechat_plugin *plugin, int how_many)
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_log: add a message on logs
|
||||
* weechat_plugin_log: add a message in buffer log file
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -249,6 +267,7 @@ weechat_plugin_log (t_weechat_plugin *plugin,
|
||||
t_gui_buffer *ptr_buffer;
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
@@ -258,8 +277,12 @@ weechat_plugin_log (t_weechat_plugin *plugin,
|
||||
{
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
gui_log_write_line (ptr_buffer, buf);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
gui_log_write_line (ptr_buffer, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,6 +429,7 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char *command2;
|
||||
|
||||
if (!plugin || !command)
|
||||
return;
|
||||
@@ -421,12 +445,15 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
command2 = weechat_iconv_to_internal (plugin->charset, command);
|
||||
if (ptr_server && ptr_channel)
|
||||
user_command (ptr_server, ptr_channel, command, 0);
|
||||
user_command (ptr_server, ptr_channel, (command2) ? command2 : command, 0);
|
||||
else if (ptr_server && (ptr_server->buffer))
|
||||
user_command (ptr_server, NULL, command, 0);
|
||||
user_command (ptr_server, NULL, (command2) ? command2 : command, 0);
|
||||
else
|
||||
user_command (NULL, NULL, command, 0);
|
||||
user_command (NULL, NULL, (command2) ? command2 : command, 0);
|
||||
if (command2)
|
||||
free (command2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,6 +498,14 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
|
||||
{
|
||||
return strdup (WEECHAT_SHAREDIR);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "charset_terminal") == 0)
|
||||
{
|
||||
return strdup (local_charset);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "charset_internal") == 0)
|
||||
{
|
||||
return strdup (WEECHAT_INTERNAL_CHARSET);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "inactivity") == 0)
|
||||
{
|
||||
if (gui_last_activity_time == 0)
|
||||
@@ -480,13 +515,17 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
|
||||
return_str = (char *) malloc (32);
|
||||
if (!return_str)
|
||||
return NULL;
|
||||
snprintf (return_str, 32, "%ld", inactivity);
|
||||
snprintf (return_str, 32, "%ld", (long int)inactivity);
|
||||
return return_str;
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "input") == 0)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
return strdup (gui_current_window->buffer->input_buffer);
|
||||
{
|
||||
return_str = weechat_iconv_from_internal (plugin->charset,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
return (return_str) ? return_str : strdup ("");
|
||||
}
|
||||
else
|
||||
return strdup ("");
|
||||
}
|
||||
@@ -868,9 +907,6 @@ weechat_plugin_get_server_info (t_weechat_plugin *plugin)
|
||||
new_server_info->autojoin = (ptr_server->autojoin) ? strdup (ptr_server->autojoin) : strdup ("");
|
||||
new_server_info->autorejoin = ptr_server->autorejoin;
|
||||
new_server_info->notify_levels = (ptr_server->notify_levels) ? strdup (ptr_server->notify_levels) : strdup ("");
|
||||
new_server_info->charset_decode_iso = (ptr_server->charset_decode_iso) ? strdup (ptr_server->charset_decode_iso) : strdup ("");
|
||||
new_server_info->charset_decode_utf = (ptr_server->charset_decode_utf) ? strdup (ptr_server->charset_decode_utf) : strdup ("");
|
||||
new_server_info->charset_encode = (ptr_server->charset_encode) ? strdup (ptr_server->charset_encode) : strdup ("");
|
||||
new_server_info->is_connected = ptr_server->is_connected;
|
||||
new_server_info->ssl_connected = ptr_server->ssl_connected;
|
||||
new_server_info->nick = (ptr_server->nick) ? strdup (ptr_server->nick) : strdup ("");
|
||||
@@ -931,12 +967,6 @@ weechat_plugin_free_server_info (t_weechat_plugin *plugin, t_plugin_server_info
|
||||
free (server_info->autojoin);
|
||||
if (server_info->notify_levels)
|
||||
free (server_info->notify_levels);
|
||||
if (server_info->charset_decode_iso)
|
||||
free (server_info->charset_decode_iso);
|
||||
if (server_info->charset_decode_utf)
|
||||
free (server_info->charset_decode_utf);
|
||||
if (server_info->charset_encode)
|
||||
free (server_info->charset_encode);
|
||||
if (server_info->nick)
|
||||
free (server_info->nick);
|
||||
new_server_info = server_info->next_server;
|
||||
@@ -1116,7 +1146,8 @@ weechat_plugin_free_nick_info (t_weechat_plugin *plugin, t_plugin_nick_info *nic
|
||||
void
|
||||
weechat_plugin_input_color (t_weechat_plugin *plugin, int color, int start, int length)
|
||||
{
|
||||
int i;
|
||||
int i, begin, end;
|
||||
char *pos1, *pos2;
|
||||
|
||||
if (!plugin
|
||||
|| (!gui_current_window->buffer->has_input)
|
||||
@@ -1131,8 +1162,23 @@ weechat_plugin_input_color (t_weechat_plugin *plugin, int color, int start, int
|
||||
gui_input_init_color_mask (gui_current_window->buffer);
|
||||
else
|
||||
{
|
||||
if (local_utf8)
|
||||
{
|
||||
begin = start;
|
||||
end = start + length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos1 = utf8_add_offset (gui_current_window->buffer->input_buffer,
|
||||
start);
|
||||
pos2 = pos1;
|
||||
for (i = 0; i < length; i++)
|
||||
pos2 = utf8_next_char (pos2);
|
||||
begin = pos1 - gui_current_window->buffer->input_buffer;
|
||||
end = begin + (pos2 - pos1) - 1;
|
||||
}
|
||||
color %= GUI_NUM_IRC_COLORS;
|
||||
for (i = start; i < start + length; i++)
|
||||
for (i = begin; i <= end; i++)
|
||||
{
|
||||
gui_current_window->buffer->input_buffer_color_mask[i] =
|
||||
'0' + color;
|
||||
@@ -1317,6 +1363,7 @@ weechat_plugin_get_buffer_data (t_weechat_plugin *plugin, char *server, char *ch
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_plugin_buffer_line *buffer_line, *last_buffer_line, *new_buffer_line;
|
||||
t_gui_line *ptr_line;
|
||||
char *data1, *data2;
|
||||
|
||||
if (!plugin)
|
||||
return NULL;
|
||||
@@ -1336,8 +1383,19 @@ weechat_plugin_get_buffer_data (t_weechat_plugin *plugin, char *server, char *ch
|
||||
{
|
||||
new_buffer_line->date = ptr_line->date;
|
||||
new_buffer_line->nick = (ptr_line->nick) ? strdup (ptr_line->nick) : NULL;
|
||||
new_buffer_line->data = (ptr_line->data) ?
|
||||
(char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0) : NULL;
|
||||
if (ptr_line->data)
|
||||
{
|
||||
data1 = (char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0);
|
||||
data2 = (data1) ? weechat_iconv_from_internal (plugin->charset, data1) : NULL;
|
||||
if (data2)
|
||||
new_buffer_line->data = data2;
|
||||
else
|
||||
new_buffer_line->data = ptr_line->data;
|
||||
if (data1)
|
||||
free (data1);
|
||||
}
|
||||
else
|
||||
new_buffer_line->data = NULL;
|
||||
|
||||
new_buffer_line->prev_line = last_buffer_line;
|
||||
new_buffer_line->next_line = NULL;
|
||||
@@ -1375,3 +1433,49 @@ weechat_plugin_free_buffer_data (t_weechat_plugin *plugin, t_plugin_buffer_line
|
||||
buffer_line = new_buffer_line;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_set_charset: set plugin charset
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
{
|
||||
if (!plugin || !charset)
|
||||
return;
|
||||
|
||||
if (plugin->charset)
|
||||
free (plugin->charset);
|
||||
|
||||
plugin->charset = (charset) ? strdup (charset) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_iconv_to_internal: encode string from a charset to WeeChat
|
||||
* internal charset
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_iconv_to_internal (t_weechat_plugin *plugin,
|
||||
char *charset, char *string)
|
||||
{
|
||||
if (!plugin || !string)
|
||||
return NULL;
|
||||
|
||||
return weechat_iconv_to_internal (charset, string);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_iconv_from_internal: encode string from WeeChat internal
|
||||
* charset to another
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_iconv_from_internal (t_weechat_plugin *plugin,
|
||||
char *charset, char *string)
|
||||
{
|
||||
if (!plugin || !string)
|
||||
return NULL;
|
||||
|
||||
return weechat_iconv_from_internal (charset, string);
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ plugin_load (char *filename)
|
||||
{
|
||||
char *full_name;
|
||||
void *handle;
|
||||
char *name, *description, *version;
|
||||
char *name, *description, *version, *charset;
|
||||
t_weechat_init_func *init_func;
|
||||
t_weechat_plugin *new_plugin;
|
||||
|
||||
@@ -1015,6 +1015,8 @@ plugin_load (char *filename)
|
||||
free (full_name);
|
||||
return NULL;
|
||||
}
|
||||
/* look for plugin charset (optional) */
|
||||
charset = dlsym (handle, "plugin_charset");
|
||||
/* look for plugin init function */
|
||||
init_func = dlsym (handle, "weechat_plugin_init");
|
||||
if (!init_func)
|
||||
@@ -1037,6 +1039,7 @@ plugin_load (char *filename)
|
||||
new_plugin->name = strdup (name);
|
||||
new_plugin->description = strdup (description);
|
||||
new_plugin->version = strdup (version);
|
||||
new_plugin->charset = (charset) ? strdup (charset) : NULL;
|
||||
|
||||
/* functions */
|
||||
new_plugin->ascii_strcasecmp = &weechat_ascii_strcasecmp;
|
||||
@@ -1080,6 +1083,9 @@ plugin_load (char *filename)
|
||||
new_plugin->free_buffer_info = &weechat_plugin_free_buffer_info;
|
||||
new_plugin->get_buffer_data = &weechat_plugin_get_buffer_data;
|
||||
new_plugin->free_buffer_data = &weechat_plugin_free_buffer_data;
|
||||
new_plugin->set_charset = &weechat_plugin_set_charset;
|
||||
new_plugin->iconv_to_internal = &weechat_plugin_iconv_to_internal;
|
||||
new_plugin->iconv_from_internal = &weechat_plugin_iconv_from_internal;
|
||||
|
||||
/* handlers */
|
||||
new_plugin->handlers = NULL;
|
||||
@@ -1265,6 +1271,8 @@ plugin_remove (t_weechat_plugin *plugin)
|
||||
free (plugin->description);
|
||||
if (plugin->version)
|
||||
free (plugin->version);
|
||||
if (plugin->charset)
|
||||
free (plugin->charset);
|
||||
free (plugin);
|
||||
|
||||
weechat_plugins = new_weechat_plugins;
|
||||
|
||||
@@ -224,7 +224,7 @@ weechat_lua_modifier (t_weechat_plugin *plugin,
|
||||
static int
|
||||
weechat_lua_register (lua_State *L)
|
||||
{
|
||||
const char *name, *version, *shutdown_func, *description;
|
||||
const char *name, *version, *shutdown_func, *description, *charset;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
@@ -236,10 +236,11 @@ weechat_lua_register (lua_State *L)
|
||||
version = NULL;
|
||||
shutdown_func = NULL;
|
||||
description = NULL;
|
||||
charset = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n != 4)
|
||||
if ((n < 4) || (n > 5))
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
@@ -247,12 +248,24 @@ weechat_lua_register (lua_State *L)
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
name = lua_tostring (lua_current_interpreter, -4);
|
||||
version = lua_tostring (lua_current_interpreter, -3);
|
||||
shutdown_func = lua_tostring (lua_current_interpreter, -2);
|
||||
description = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 4:
|
||||
name = lua_tostring (lua_current_interpreter, -4);
|
||||
version = lua_tostring (lua_current_interpreter, -3);
|
||||
shutdown_func = lua_tostring (lua_current_interpreter, -2);
|
||||
description = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
case 5:
|
||||
name = lua_tostring (lua_current_interpreter, -5);
|
||||
version = lua_tostring (lua_current_interpreter, -4);
|
||||
shutdown_func = lua_tostring (lua_current_interpreter, -3);
|
||||
description = lua_tostring (lua_current_interpreter, -2);
|
||||
charset = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (weechat_script_search (lua_plugin, &lua_scripts, (char *) name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
@@ -273,7 +286,8 @@ weechat_lua_register (lua_State *L)
|
||||
(char *) name,
|
||||
(char *) version,
|
||||
(char *) shutdown_func,
|
||||
(char *) description);
|
||||
(char *) description,
|
||||
(char *) charset);
|
||||
if (lua_current_script)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
@@ -291,6 +305,51 @@ weechat_lua_register (lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_set_charset: set script charset
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_set_charset (lua_State *L)
|
||||
{
|
||||
const char *charset;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to set charset, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
charset = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"set_charset\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
charset = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
weechat_script_set_charset (lua_plugin,
|
||||
lua_current_script,
|
||||
(char *) charset);
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
@@ -1531,18 +1590,6 @@ weechat_lua_get_server_info (lua_State *L)
|
||||
lua_pushstring (lua_current_interpreter, ptr_server->notify_levels);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "charset_decode_iso");
|
||||
lua_pushstring (lua_current_interpreter, ptr_server->charset_decode_iso);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "charset_decode_utf");
|
||||
lua_pushstring (lua_current_interpreter, ptr_server->charset_decode_utf);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "charset_encode");
|
||||
lua_pushstring (lua_current_interpreter, ptr_server->charset_encode);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "is_connected");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_server->is_connected);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
@@ -2062,6 +2109,7 @@ weechat_lua_constant_plugin_rc_ok_ignore_all (lua_State *L)
|
||||
static
|
||||
const struct luaL_reg weechat_lua_funcs[] = {
|
||||
{ "register", weechat_lua_register },
|
||||
{ "set_charset", weechat_lua_set_charset },
|
||||
{ "print", weechat_lua_print },
|
||||
{ "print_server", weechat_lua_print_server },
|
||||
{ "print_infobar", weechat_lua_print_infobar },
|
||||
|
||||
@@ -271,11 +271,11 @@ weechat_perl_timer_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int *r, ret;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
int *r;
|
||||
int ret;
|
||||
|
||||
r = (int *) weechat_perl_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
SCRIPT_EXEC_INT,
|
||||
@@ -343,7 +343,7 @@ weechat_perl_modifier (t_weechat_plugin *plugin,
|
||||
|
||||
static XS (XS_weechat_register)
|
||||
{
|
||||
char *name, *version, *shutdown_func, *description;
|
||||
char *name, *version, *shutdown_func, *description, *charset;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
@@ -352,7 +352,7 @@ static XS (XS_weechat_register)
|
||||
|
||||
perl_current_script = NULL;
|
||||
|
||||
if (items != 4)
|
||||
if ((items < 4) || (items > 5))
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
@@ -364,6 +364,7 @@ static XS (XS_weechat_register)
|
||||
version = SvPV (ST (1), PL_na);
|
||||
shutdown_func = SvPV (ST (2), PL_na);
|
||||
description = SvPV (ST (3), PL_na);
|
||||
charset = (items == 5) ? SvPV (ST (4), PL_na) : NULL;
|
||||
|
||||
if (weechat_script_search (perl_plugin, &perl_scripts, name))
|
||||
{
|
||||
@@ -382,7 +383,7 @@ static XS (XS_weechat_register)
|
||||
(perl_current_script_filename) ?
|
||||
perl_current_script_filename : "",
|
||||
name, version, shutdown_func,
|
||||
description);
|
||||
description, charset);
|
||||
if (perl_current_script)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
@@ -398,6 +399,40 @@ static XS (XS_weechat_register)
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::set_charset: set script charset
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_set_charset)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to set charset, "
|
||||
"script not initialized");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"set_charset\" function");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
weechat_script_set_charset (perl_plugin,
|
||||
perl_current_script,
|
||||
SvPV (ST (0), PL_na));
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
@@ -438,9 +473,9 @@ static XS (XS_weechat_print)
|
||||
server_name = SvPV (ST (2), PL_na);
|
||||
}
|
||||
|
||||
perl_plugin->print (perl_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
weechat_script_print (perl_plugin, perl_current_script,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -475,7 +510,8 @@ static XS (XS_weechat_print_server)
|
||||
|
||||
message = SvPV (ST (0), PL_na);
|
||||
|
||||
perl_plugin->print_server (perl_plugin, "%s", message);
|
||||
weechat_script_print_server (perl_plugin, perl_current_script,
|
||||
"%s", message);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -507,10 +543,9 @@ static XS (XS_weechat_print_infobar)
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
perl_plugin->print_infobar (perl_plugin,
|
||||
SvIV (ST (0)),
|
||||
"%s",
|
||||
SvPV (ST (1), PL_na));
|
||||
weechat_script_print_infobar (perl_plugin, perl_current_script,
|
||||
SvIV (ST (0)),
|
||||
"%s", SvPV (ST (1), PL_na));
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -580,9 +615,9 @@ static XS (XS_weechat_log)
|
||||
server_name = SvPV (ST (2), PL_na);
|
||||
}
|
||||
|
||||
perl_plugin->log (perl_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
weechat_script_log (perl_plugin, perl_current_script,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -625,9 +660,9 @@ static XS (XS_weechat_command)
|
||||
server_name = SvPV (ST (2), PL_na);
|
||||
}
|
||||
|
||||
perl_plugin->exec_command (perl_plugin,
|
||||
server_name, channel_name,
|
||||
SvPV (ST (0), PL_na));
|
||||
weechat_script_exec_command (perl_plugin, perl_current_script,
|
||||
server_name, channel_name,
|
||||
SvPV (ST (0), PL_na));
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -1338,9 +1373,6 @@ static XS (XS_weechat_get_server_info)
|
||||
hv_store (server_hash_member, "autojoin", 8, newSVpv (ptr_server->autojoin, 0), 0);
|
||||
hv_store (server_hash_member, "autorejoin", 10, newSViv (ptr_server->autorejoin), 0);
|
||||
hv_store (server_hash_member, "notify_levels", 13, newSVpv (ptr_server->notify_levels, 0), 0);
|
||||
hv_store (server_hash_member, "charset_decode_iso", 18, newSVpv (ptr_server->charset_decode_iso, 0), 0);
|
||||
hv_store (server_hash_member, "charset_decode_utf", 18, newSVpv (ptr_server->charset_decode_utf, 0), 0);
|
||||
hv_store (server_hash_member, "charset_encode", 14, newSVpv (ptr_server->charset_encode, 0), 0);
|
||||
hv_store (server_hash_member, "is_connected", 12, newSViv (ptr_server->is_connected), 0);
|
||||
hv_store (server_hash_member, "ssl_connected", 13, newSViv (ptr_server->ssl_connected), 0);
|
||||
hv_store (server_hash_member, "nick", 4, newSVpv (ptr_server->nick, 0), 0);
|
||||
@@ -1755,6 +1787,7 @@ weechat_perl_xs_init (pTHX)
|
||||
|
||||
/* interface functions */
|
||||
newXS ("weechat::register", XS_weechat_register, "weechat");
|
||||
newXS ("weechat::set_charset", XS_weechat_set_charset, "weechat");
|
||||
newXS ("weechat::print", XS_weechat_print, "weechat");
|
||||
newXS ("weechat::print_server", XS_weechat_print_server, "weechat");
|
||||
newXS ("weechat::print_infobar", XS_weechat_print_infobar, "weechat");
|
||||
|
||||
@@ -266,7 +266,7 @@ weechat_python_modifier (t_weechat_plugin *plugin,
|
||||
static PyObject *
|
||||
weechat_python_register (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *name, *version, *shutdown_func, *description;
|
||||
char *name, *version, *shutdown_func, *description, *charset;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
@@ -277,8 +277,10 @@ weechat_python_register (PyObject *self, PyObject *args)
|
||||
version = NULL;
|
||||
shutdown_func = NULL;
|
||||
description = NULL;
|
||||
charset = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ssss", &name, &version, &shutdown_func, &description))
|
||||
if (!PyArg_ParseTuple (args, "ssss|s", &name, &version, &shutdown_func,
|
||||
&description, &charset))
|
||||
{
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
@@ -303,7 +305,7 @@ weechat_python_register (PyObject *self, PyObject *args)
|
||||
(python_current_script_filename) ?
|
||||
python_current_script_filename : "",
|
||||
name, version, shutdown_func,
|
||||
description);
|
||||
description, charset);
|
||||
if (python_current_script)
|
||||
{
|
||||
python_plugin->print_server (python_plugin,
|
||||
@@ -317,6 +319,46 @@ weechat_python_register (PyObject *self, PyObject *args)
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_set_charset: set script charset
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_set_charset (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *charset;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to set charset, "
|
||||
"script not initialized");
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
charset = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &charset))
|
||||
{
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"set_charset\" function");
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
if (charset)
|
||||
weechat_script_set_charset (python_plugin,
|
||||
python_current_script,
|
||||
charset);
|
||||
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
@@ -1303,12 +1345,6 @@ weechat_python_get_server_info (PyObject *self, PyObject *args)
|
||||
Py_BuildValue("i", ptr_server->autorejoin));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "notify_levels"),
|
||||
Py_BuildValue("s", ptr_server->notify_levels));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "charset_decode_iso"),
|
||||
Py_BuildValue("s", ptr_server->charset_decode_iso));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "charset_decode_utf"),
|
||||
Py_BuildValue("s", ptr_server->charset_decode_utf));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "charset_encode"),
|
||||
Py_BuildValue("s", ptr_server->charset_encode));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "is_connected"),
|
||||
Py_BuildValue("i", ptr_server->is_connected));
|
||||
PyDict_SetItem(server_hash_member, Py_BuildValue("s", "ssl_connected"),
|
||||
@@ -1714,6 +1750,7 @@ weechat_python_get_buffer_data (PyObject *self, PyObject *args)
|
||||
static
|
||||
PyMethodDef weechat_python_funcs[] = {
|
||||
{ "register", weechat_python_register, METH_VARARGS, "" },
|
||||
{ "set_charset", weechat_python_set_charset, METH_VARARGS, "" },
|
||||
{ "prnt", weechat_python_print, METH_VARARGS, "" },
|
||||
{ "print_server", weechat_python_print_server, METH_VARARGS, "" },
|
||||
{ "print_infobar", weechat_python_print_infobar, METH_VARARGS, "" },
|
||||
|
||||
@@ -303,15 +303,28 @@ weechat_ruby_modifier (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
VALUE shutdown_func, VALUE description)
|
||||
weechat_ruby_register (int argc, VALUE *argv, VALUE class)
|
||||
{
|
||||
char *c_name, *c_version, *c_shutdown_func, *c_description;
|
||||
VALUE name, version, shutdown_func, description, charset;
|
||||
char *c_name, *c_version, *c_shutdown_func, *c_description, *c_charset;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
ruby_current_script = NULL;
|
||||
|
||||
name = Qnil;
|
||||
version = Qnil;
|
||||
shutdown_func = Qnil;
|
||||
description = Qnil;
|
||||
charset = Qnil;
|
||||
c_name = NULL;
|
||||
c_version = NULL;
|
||||
c_shutdown_func = NULL;
|
||||
c_description = NULL;
|
||||
c_charset = NULL;
|
||||
|
||||
rb_scan_args (argc, argv, "41", &name, &version, &shutdown_func, &description, &charset);
|
||||
|
||||
if (NIL_P (name) || NIL_P (version) || NIL_P (shutdown_func) || NIL_P (description))
|
||||
{
|
||||
@@ -331,6 +344,12 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
c_shutdown_func = STR2CSTR (shutdown_func);
|
||||
c_description = STR2CSTR (description);
|
||||
|
||||
if (!NIL_P (charset))
|
||||
{
|
||||
Check_Type (charset, T_STRING);
|
||||
c_charset = STR2CSTR (charset);
|
||||
}
|
||||
|
||||
if (weechat_script_search (ruby_plugin, &ruby_scripts, c_name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
@@ -348,7 +367,7 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
(ruby_current_script_filename) ?
|
||||
ruby_current_script_filename : "",
|
||||
c_name, c_version, c_shutdown_func,
|
||||
c_description);
|
||||
c_description, c_charset);
|
||||
if (ruby_current_script)
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
@@ -362,6 +381,47 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_set_charset: set script charset
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_set_charset (VALUE class, VALUE charset)
|
||||
{
|
||||
char *c_charset;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to set charset, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_charset = NULL;
|
||||
|
||||
if (NIL_P (c_charset))
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_charset\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (charset, T_STRING);
|
||||
c_charset = STR2CSTR (charset);
|
||||
|
||||
if (c_charset)
|
||||
weechat_script_set_charset (ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_charset);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
@@ -1523,12 +1583,6 @@ weechat_ruby_get_server_info (VALUE class)
|
||||
INT2FIX(ptr_server->autorejoin));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("notify_levels"),
|
||||
rb_str_new2(ptr_server->notify_levels));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("charset_decode_iso"),
|
||||
rb_str_new2(ptr_server->charset_decode_iso));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("charset_decode_utf"),
|
||||
rb_str_new2(ptr_server->charset_decode_utf));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("charset_encode"),
|
||||
rb_str_new2(ptr_server->charset_encode));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("is_connected"),
|
||||
INT2FIX(ptr_server->is_connected));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("ssl_connected"),
|
||||
@@ -2420,7 +2474,8 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_WEECHAT", INT2NUM(PLUGIN_RC_OK_IGNORE_WEECHAT));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_PLUGINS", INT2NUM(PLUGIN_RC_OK_IGNORE_PLUGINS));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL));
|
||||
rb_define_module_function (ruby_mWeechat, "register", weechat_ruby_register, 4);
|
||||
rb_define_module_function (ruby_mWeechat, "register", weechat_ruby_register, -1);
|
||||
rb_define_module_function (ruby_mWeechat, "set_charset", weechat_ruby_set_charset, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "print", weechat_ruby_print, -1);
|
||||
rb_define_module_function (ruby_mWeechat, "print_server", weechat_ruby_print_server, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "print_infobar", weechat_ruby_print_infobar, 2);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@@ -199,7 +200,8 @@ weechat_script_add (t_weechat_plugin *plugin,
|
||||
t_plugin_script **script_list,
|
||||
char *filename,
|
||||
char *name, char *version,
|
||||
char *shutdown_func, char *description)
|
||||
char *shutdown_func, char *description,
|
||||
char *charset)
|
||||
{
|
||||
t_plugin_script *new_script;
|
||||
|
||||
@@ -221,6 +223,7 @@ weechat_script_add (t_weechat_plugin *plugin,
|
||||
new_script->version = strdup (version);
|
||||
new_script->shutdown_func = strdup (shutdown_func);
|
||||
new_script->description = strdup (description);
|
||||
new_script->charset = (charset) ? strdup (charset) : NULL;
|
||||
|
||||
/* add new script to list */
|
||||
if ((*script_list))
|
||||
@@ -288,6 +291,8 @@ weechat_script_remove (t_weechat_plugin *plugin,
|
||||
free (script->version);
|
||||
if (script->shutdown_func)
|
||||
free (script->shutdown_func);
|
||||
if (script->charset)
|
||||
free (script->charset);
|
||||
|
||||
/* remove script from list */
|
||||
if (script->prev_script)
|
||||
@@ -301,6 +306,122 @@ weechat_script_remove (t_weechat_plugin *plugin,
|
||||
free (script);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_print: print a message on a server or channel buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, buf) : NULL;
|
||||
plugin->print (plugin, server, channel, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_print_server: print a message on server buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print_server (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, buf) : NULL;
|
||||
plugin->print_server (plugin, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_print_infobar: print a message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print_infobar (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
int time_displayed, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
char *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, buf) : NULL;
|
||||
plugin->print_infobar (plugin, time_displayed, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_log: add a message in buffer log file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_log (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
char *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, buf) : NULL;
|
||||
plugin->log (plugin, server, channel, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_exec_command: execute a command (simulate user entry)
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_exec_command (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel, char *command)
|
||||
{
|
||||
char *command2;
|
||||
|
||||
command2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, command) : NULL;
|
||||
plugin->exec_command (plugin, server, channel,
|
||||
(command2) ? command2 : command);
|
||||
if (command2)
|
||||
free (command2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_remove_handler: remove a handler for a script
|
||||
* for a msg handler, arg1=irc command, arg2=function
|
||||
@@ -494,3 +615,21 @@ weechat_script_set_plugin_config (t_weechat_plugin *plugin,
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_set_charset: set charset for script
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_set_charset (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *charset)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (script->charset)
|
||||
free (script->charset);
|
||||
|
||||
script->charset = (charset) ? strdup (charset) : NULL;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ struct t_plugin_script
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *shutdown_func; /* function when script is unloaded */
|
||||
char *charset; /* script charset */
|
||||
|
||||
t_plugin_script *prev_script; /* link to previous script */
|
||||
t_plugin_script *next_script; /* link to next script */
|
||||
@@ -51,9 +52,24 @@ extern char *weechat_script_search_full_name (t_weechat_plugin *,
|
||||
char *, char *);
|
||||
extern t_plugin_script *weechat_script_add (t_weechat_plugin *,
|
||||
t_plugin_script **, char *, char *,
|
||||
char *, char *, char *);
|
||||
char *, char *, char *, char *);
|
||||
extern void weechat_script_remove (t_weechat_plugin *,
|
||||
t_plugin_script **, t_plugin_script *);
|
||||
extern void weechat_script_print (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *, ...);
|
||||
extern void weechat_script_print_server (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, ...);
|
||||
extern void weechat_script_print_infobar (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
int, char *, ...);
|
||||
extern void weechat_script_log (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *, ...);
|
||||
extern void weechat_script_exec_command (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *);
|
||||
extern void weechat_script_remove_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
@@ -72,5 +88,8 @@ extern char *weechat_script_get_plugin_config (t_weechat_plugin *,
|
||||
extern int weechat_script_set_plugin_config (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
extern void weechat_script_set_charset (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
|
||||
#endif /* weechat-script.h */
|
||||
|
||||
@@ -101,9 +101,6 @@ struct t_plugin_server_info
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
char *notify_levels; /* channels notify levels */
|
||||
char *charset_decode_iso; /* channels charsets for decoding ISO */
|
||||
char *charset_decode_utf; /* channels charsets for decoding UTF */
|
||||
char *charset_encode; /* channels charsets for encoding msgs */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
int ssl_connected; /* = 1 if connected with SSL */
|
||||
char *nick; /* current nickname */
|
||||
@@ -279,6 +276,7 @@ struct t_weechat_plugin
|
||||
char *name; /* plugin name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *charset; /* charset used by plugin */
|
||||
|
||||
/* plugin handlers */
|
||||
t_plugin_handler *handlers; /* pointer to first handler */
|
||||
@@ -361,6 +359,10 @@ struct t_weechat_plugin
|
||||
void (*free_buffer_info) (t_weechat_plugin *, t_plugin_buffer_info *);
|
||||
t_plugin_buffer_line *(*get_buffer_data) (t_weechat_plugin *, char *, char *);
|
||||
void (*free_buffer_data) (t_weechat_plugin *, t_plugin_buffer_line *);
|
||||
|
||||
void (*set_charset) (t_weechat_plugin *, char *);
|
||||
char *(*iconv_to_internal) (t_weechat_plugin *, char *, char *);
|
||||
char *(*iconv_from_internal) (t_weechat_plugin *, char *, char *);
|
||||
|
||||
/* WeeChat developers: ALWAYS add new functions at the end */
|
||||
};
|
||||
@@ -433,4 +435,9 @@ extern void weechat_plugin_free_buffer_info (t_weechat_plugin *, t_plugin_buffer
|
||||
extern t_plugin_buffer_line *weechat_plugin_get_buffer_data (t_weechat_plugin *, char *, char *);
|
||||
extern void weechat_plugin_free_buffer_data (t_weechat_plugin *, t_plugin_buffer_line *);
|
||||
|
||||
/* iconv functions */
|
||||
extern void weechat_plugin_set_charset (t_weechat_plugin *, char *);
|
||||
extern char *weechat_plugin_iconv_to_internal (t_weechat_plugin *, char *, char *);
|
||||
extern char *weechat_plugin_iconv_from_internal (t_weechat_plugin *, char *, char *);
|
||||
|
||||
#endif /* weechat-plugin.h */
|
||||
|
||||
+2
-8
@@ -9,17 +9,11 @@ Developers:
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
* Scripts plugins
|
||||
|
||||
Kolter <kolter@openics.org>
|
||||
Web : http://kolter.free.fr
|
||||
kolter <kolter@openics.org>
|
||||
IRC : nick is "kolter" @ irc.freenode.net
|
||||
Jabber: kolter@im.openics.org
|
||||
|
||||
|
||||
Debian packager:
|
||||
@@ -47,7 +41,7 @@ Pavel Shevchuk, IRC: "Stalwart"
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
server: irc.freenode.net, channels: #weechat and #weechat-fr (french)
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-11-04
|
||||
ChangeLog - 2006-11-08
|
||||
|
||||
|
||||
Version 0.2.2 (under dev!):
|
||||
* /charset command and charset conversions now made by "charset" plugin
|
||||
* fixed display bug in status bar, wrong length when using UTF-8
|
||||
* fixed bug with ignore: now any IRC command is allowed
|
||||
* fixed crash with Ctrl-T (transpose) and one char on line (bug #18153)
|
||||
* added "modifier" in plugins API
|
||||
|
||||
+26
-4
@@ -86,7 +86,7 @@ AC_MSG_RESULT($ac_cv_type_socklen_t)
|
||||
# Checks for library functions.
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname regexec])
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strndup strncasecmp strpbrk strrchr strstr uname regexec])
|
||||
|
||||
# Variables in config.h
|
||||
|
||||
@@ -99,6 +99,7 @@ AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
|
||||
AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL])
|
||||
AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
|
||||
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
|
||||
AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
@@ -109,6 +110,7 @@ AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interf
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --disable-perl Turn off Perl script plugin (default=compiled if found)],enable_perl=$enableval,enable_perl=yes)
|
||||
AC_ARG_ENABLE(python, [ --disable-python Turn off Python script plugin (default=compiled if found)],enable_python=$enableval,enable_python=yes)
|
||||
@@ -118,7 +120,7 @@ AC_ARG_WITH(lua-inc, [ --with-lua-inc=DIR, Lua include files are i
|
||||
AC_ARG_WITH(lua-lib, [ --with-lua-lib=DIR, Lua library files are in DIR (default=autodetect)],lua_lib=$withval,lua_lib='')
|
||||
AC_ARG_WITH(lua-suffix, [ --with-lua-suffix=ARG Lua is suffixed with ARG (default=autodetect)],lua_suffix=$withval,lua_suffix='')
|
||||
AC_ARG_ENABLE(aspell, [ --disable-aspell Turn off Aspell plugin (default=compiled if found)],enable_aspell=$enableval,enable_aspell=yes)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_ENABLE(charset, [ --disable-charset Turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes)
|
||||
AC_ARG_WITH(doc_xsl_prefix, [ --with-doc-xsl-prefix=DIR Docbook html/chunk.xsl is in DIR (default=autodetect)],doc_xsl_prefix=$withval,doc_xsl_prefix='')
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=1)],debug=$withval,debug=1)
|
||||
|
||||
@@ -195,6 +197,7 @@ fi
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
iconv_found="no"
|
||||
ICONV_LFLAGS=""
|
||||
|
||||
AC_CHECK_HEADER(iconv.h,ac_found_iconv_header="yes",ac_found_iconv_header="no")
|
||||
if test "x$ac_found_iconv_header" = "xyes" ; then
|
||||
@@ -203,7 +206,8 @@ if test "x$ac_found_iconv_header" = "xyes" ; then
|
||||
AC_CHECK_LIB(iconv,libiconv_open,ac_found_iconv_lib="yes",ac_found_iconv_lib="no")
|
||||
fi
|
||||
if test "x$ac_found_iconv_lib" = "xyes" ; then
|
||||
LIBS="$LIBS -liconv"
|
||||
ICONV_LFLAGS="-liconv"
|
||||
LIBS="$LIBS $ICONV_LFLAGS"
|
||||
fi
|
||||
AC_MSG_CHECKING(for iconv usability in programs)
|
||||
AC_TRY_RUN([
|
||||
@@ -242,6 +246,7 @@ if test "x$enable_plugins" != "xyes" ; then
|
||||
enable_ruby="no"
|
||||
enable_lua="no"
|
||||
enable_aspell="no"
|
||||
enable_charset="no"
|
||||
fi
|
||||
|
||||
# ---------------------------------- perl --------------------------------------
|
||||
@@ -549,6 +554,19 @@ if test "x$enable_aspell" = "xyes" ; then
|
||||
AC_DEFINE(PLUGIN_ASPELL)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# charset
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_charset" = "xyes" ; then
|
||||
CHARSET_CFLAGS=""
|
||||
CHARSET_LFLAGS=""
|
||||
CHARSET_LFLAGS="$CHARSET_LFLAGS $ICONV_LFLAGS"
|
||||
AC_SUBST(CHARSET_CFLAGS)
|
||||
AC_SUBST(CHARSET_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_CHARSET)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# dynamic loader
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -572,6 +590,7 @@ if test "x$enable_plugins" = "xyes" ; then
|
||||
enable_ruby="no"
|
||||
enable_lua="no"
|
||||
enable_aspell="no"
|
||||
enable_charset="no"
|
||||
not_found="$not_found plugins"
|
||||
fi
|
||||
fi
|
||||
@@ -757,6 +776,7 @@ AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
|
||||
|
||||
@@ -777,7 +797,8 @@ AC_OUTPUT([Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/Makefile
|
||||
src/plugins/scripts/lua/Makefile
|
||||
src/plugins/aspell/Makefile
|
||||
src/plugins/aspell/Makefile
|
||||
src/plugins/charset/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/wxwidgets/Makefile
|
||||
@@ -857,6 +878,7 @@ echo " Python plugin....... : $enable_python $PYTHON_STATUS"
|
||||
echo " Ruby plugin......... : $enable_ruby $RUBY_STATUS"
|
||||
echo " Lua plugin.......... : $enable_lua $LUA_STATUS"
|
||||
echo " Aspell plugin....... : $enable_aspell"
|
||||
echo " Charset plugin...... : $enable_charset"
|
||||
echo "Compile with debug info........... : $msg_debug_compiler"
|
||||
echo " Backtrace........... : $enable_backtrace"
|
||||
echo "Build doc..........................: $enable_doc"
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>WeeChat-Slogan (wenn leer, wird keiner benutzt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>ISO-Zeichensatz zum Dekodieren von Nachrichten vom Server (wird nur benutzt, wenn UTF-8 als Locale eingestellt ist; wenn nichts angegeben wird und die Locale UTF-8 ist, findet keine Konvertierung statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>UTF-Zeichensatz zum Dekodieren von Nachrichten vom Server (wird nur benutzt, wenn die Locale nicht UTF-8 ist; wenn nichts angegeben wird und die Locale nicht UTF-8 ist, findet keine Konvertierung statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Zeichensatz zum Enkodieren von Nachrichten zum Server, wie zum Beispiel: UTF-8, ISO-8859-1 (wenn nichts angegeben wird, findet keine Konversion statt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Erzwingt internen WeeChat-Zeichensatz (sollte normalerweise leer sein, dadurch wird der erkannte Zeichensatz benutzt)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>Boolean</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze für den Server und die Channels, um ISO-Nachrichten zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze für Server und Channels, um UTF zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Zeichensätze, um Nachrichten vom Server und aus Channels zu dekodieren (Format: Server:Zeichensatz,#Channel:Zeichensatz,..)</entry>
|
||||
</row>
|
||||
|
||||
+264
-33
@@ -512,6 +512,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Fenster neu aufbauen
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + T</entry>
|
||||
<entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
Transpose chars
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + U</entry>
|
||||
<entry>
|
||||
@@ -525,19 +532,27 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Rückschritt </entry>
|
||||
<entry>Strg + Y</entry>
|
||||
<entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
Paste clipboard content
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Rückschritt / Strg + H</entry>
|
||||
<entry>
|
||||
Lösche das vorhergehende Zeichen in der Kommandozeile
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Entfernen </entry>
|
||||
<entry>Entfernen</entry>
|
||||
<entry>
|
||||
Lösche das nächste Zeichen in der Kommandozeile
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> Tabulator </entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<entry>Tabulator / Shift + Tabulator</entry>
|
||||
<entry>
|
||||
Vervollständige ein Kommando oder Nick
|
||||
(wiederhole: finde nächste Vervollständigung)
|
||||
@@ -550,7 +565,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Eingabe</entry>
|
||||
<entry>Eingabe / Strg + J / Strg + M</entry>
|
||||
<entry>
|
||||
Führe ein Kommando aus oder sende eine Nachricht
|
||||
</entry>
|
||||
@@ -593,7 +608,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> F6 / Alt + Rechts </entry>
|
||||
<entry>F6 / Alt + Rechts</entry>
|
||||
<entry>
|
||||
Gehe zum nächsten Puffer
|
||||
</entry>
|
||||
@@ -1262,6 +1277,132 @@ fi
|
||||
|
||||
<section id="secAPIFunctions">
|
||||
<title>API Funktionen</title>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new plugin charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new charset to use
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string to WeeChat internal charset (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset to convert
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string from internal WeeChat charset (UTF-8) to another.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: target charset
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
@@ -2436,7 +2577,8 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
<screen>plugin->handler_remove_all (plugin);</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_add">
|
||||
<title>modifier_add</title>
|
||||
|
||||
@@ -2577,6 +2719,7 @@ modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_remove">
|
||||
<title>modifier_remove</title>
|
||||
|
||||
@@ -2614,6 +2757,7 @@ modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secAPI_modifier_remove_all">
|
||||
<title>modifier_remove_all</title>
|
||||
|
||||
@@ -4635,25 +4779,25 @@ end
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::register(name, version, end_function, description);
|
||||
weechat::register(name, version, end_function, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.register(name, version, end_function, description)
|
||||
Weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4686,6 +4830,13 @@ end
|
||||
<option>description</option>: eine kurze Beschreibung des Skripts
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<option>charset</option>: charset used by script, you should
|
||||
set this if script is not written with UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4695,16 +4846,78 @@ end
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("test", "1.0", "end_test", "Test script!");
|
||||
weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new script charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new script charset
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if new charset was set, 0 if an error occured.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5327,7 +5540,7 @@ end
|
||||
-- lua
|
||||
weechat.add_timer_handler(60, "my_timer")
|
||||
function my_timer()
|
||||
weechat.print("this is timer handler)
|
||||
weechat.print("this is timer handler")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
@@ -5644,6 +5857,7 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
@@ -5738,32 +5952,49 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "my_function");
|
||||
sub my_function
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
function my_function(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
<section id="secScript_remove_modifier">
|
||||
<title>remove_modifier</title>
|
||||
|
||||
@@ -5821,16 +6052,16 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "my_function");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7121,8 +7352,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
Entwickler
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ starte eingebauten WeeChat/IRC-Befehl (ohne Plugin-Handler oder Aliase)
|
||||
Befehl: auszuführender Befehl (falls nicht vorhanden wird automatisch ein '/' vorangestellt)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) Zeichensatz]</command>
|
||||
<programlisting>
|
||||
ändere Zeichensatz für den Server oder Channel
|
||||
|
||||
decode_iso: Zeichensatz um ISO zu decoden
|
||||
decode_utf: Zeichensatz um UTF zu decoden
|
||||
encode: der zum encoden benutzte Zeichensatz
|
||||
Zeichensatz: Zeichensatz, der benutzt werden soll (zum Beispiel: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>WeeChat slogan (if empty, slogan is not used)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>ISO charset for decoding messages from server (used only if locale is UTF-8) (if empty, messages are not converted if locale is UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>UTF charset for decoding messages from server (used only if locale is not UTF-8) (if empty, messages are not converted if locale is not UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Charset for encoding messages sent to server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Forces internal WeeChat charset (should be empty in most cases, that means detected charset is used)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>boolean</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)</entry>
|
||||
</row>
|
||||
|
||||
+248
-30
@@ -508,6 +508,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Redraw whole window
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
Transpose chars
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + U</entry>
|
||||
<entry>
|
||||
@@ -521,7 +527,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace</entry>
|
||||
<entry>Ctrl + Y</entry>
|
||||
<entry>
|
||||
Paste clipboard content
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace / Ctrl + H</entry>
|
||||
<entry>
|
||||
Delete previous char in command line
|
||||
</entry>
|
||||
@@ -533,7 +545,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Tab</entry>
|
||||
<entry>Tab / Shift + Tab</entry>
|
||||
<entry>
|
||||
Complete command or nick
|
||||
(Tab again: find next completion)
|
||||
@@ -546,7 +558,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Enter</entry>
|
||||
<entry>Enter / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Execute command or send message
|
||||
</entry>
|
||||
@@ -1260,6 +1272,129 @@ fi
|
||||
<section id="secAPIFunctions">
|
||||
<title>API functions</title>
|
||||
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new plugin charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new charset to use
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string to WeeChat internal charset (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset to convert
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convert string from internal WeeChat charset (UTF-8) to another.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: target charset
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option>: string to convert
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: converted string.
|
||||
</para>
|
||||
<para>
|
||||
Note: result has to be free by a call to "free" after use.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
|
||||
@@ -4670,25 +4805,25 @@ end
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::register(name, version, end_function, description);
|
||||
weechat::register(name, version, end_function, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.register(name, version, end_function, description)
|
||||
Weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.register(name, version, end_function, description)
|
||||
weechat.register(name, version, end_function, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4721,6 +4856,12 @@ end
|
||||
<option>description</option>: short description of script
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: charset used by script, you should
|
||||
set this if script is not written with UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4730,16 +4871,77 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("test", "1.0", "end_test", "Test script!");
|
||||
weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("test", "1.0", "end_test", "Test script!")
|
||||
weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Set new script charset.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option>: new script charset
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if new charset was set, 0 if an error occured.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5367,7 +5569,7 @@ end
|
||||
-- lua
|
||||
weechat.add_timer_handler(60, "my_timer")
|
||||
function my_timer()
|
||||
weechat.print("this is timer handler)
|
||||
weechat.print("this is timer handler")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
@@ -5776,27 +5978,43 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "my_function");
|
||||
sub my_function
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
def my_function(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "my_function")
|
||||
function my_function(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
@@ -5859,16 +6077,16 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "my_function");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "my_function")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7162,8 +7380,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
developer
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ launch WeeChat/IRC builtin command (do not look at plugins handlers or aliases)
|
||||
command: command to execute (a '/' is automatically added if not found at beginning of command)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) charset]</command>
|
||||
<programlisting>
|
||||
change charset for server or channel
|
||||
|
||||
decode_iso: charset used for decoding ISO
|
||||
decode_utf: charset used for decoding UTF
|
||||
encode: charset used for encoding messages
|
||||
charset: charset to use (for example: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
@@ -40,34 +40,6 @@
|
||||
<entry>'the geekest IRC client!'</entry>
|
||||
<entry>Slogan WeeChat (si vide, le slogan ne sera pas utilisé)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_iso</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'ISO-8859-1'</entry>
|
||||
<entry>Jeu de caractères ISO pour décoder les messages du serveur (utilisé seulement si la locale est UTF-8) (si non renseigné, les messages ne sont pas convertis si la locale est UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_decode_utf</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>'UTF-8'</entry>
|
||||
<entry>Jeu de caractères UTF pour décoder les messages du serveur (utilisé seulement si la locale n'est pas UTF-8) (si non renseigné, les messages ne sont pas convertis si la locale n'est pas UTF-8)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_encode</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Jeu de caractères pour encoder les messages envoyés au serveur, exemples: UTF-8, ISO-8859-1 (si non renseigné, les messages ne sont pas convertis)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_charset_internal</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Force le jeu de caractères interne à WeeChat (doit être vide dans la plupart des cas, ce qui signifie que le jeu de caractères détecté est utilisé)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_one_server_buffer</option></entry>
|
||||
<entry>booléen</entry>
|
||||
@@ -1237,24 +1209,3 @@
|
||||
<entry>''</entry>
|
||||
<entry>Liste des niveaux de notifications (séparés par des virgules) pour les canaux de ce serveur (format: #canal:1,..), un nom de canal '*' est réservé pour la notification par défaut du serveur</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour décoder l'ISO (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_utf</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour décoder l'UTF (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_encode</option></entry>
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des jeux de caractères (séparés par des virgules) pour le serveur et les canaux, pour encoder les messages (format: server:charset,#canal:charset,..)</entry>
|
||||
</row>
|
||||
|
||||
+255
-29
@@ -517,6 +517,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Réafficher toute la fenêtre
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
Inverser deux caractères
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + U</entry>
|
||||
<entry>
|
||||
@@ -530,7 +536,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace</entry>
|
||||
<entry>Ctrl + Y</entry>
|
||||
<entry>
|
||||
Coller le contenu du presse-papiers
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Backspace / Ctrl + H</entry>
|
||||
<entry>
|
||||
Effacer le caractère précédent sur la ligne de commande
|
||||
</entry>
|
||||
@@ -542,7 +554,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Tab</entry>
|
||||
<entry>Tab / Shift + Tab</entry>
|
||||
<entry>
|
||||
Compléter la commande ou le pseudo
|
||||
(Tab de nouveau: trouver la complétion suivante)
|
||||
@@ -556,7 +568,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Entrée</entry>
|
||||
<entry>Entrée / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Exécuter la commande ou envoyer le message
|
||||
</entry>
|
||||
@@ -1276,6 +1288,136 @@ fi
|
||||
|
||||
<section id="secFonctionsInterface">
|
||||
<title>Fonctions de l'interface (API)</title>
|
||||
|
||||
<section id="secAPI_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void set_charset (t_weechat_plugin *plugin, char *charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Change le jeu de caractères de l'extension.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : nouveau jeu de caractères à utiliser
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>plugin->set_charset (plugin, "ISO-8859-1");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_to_internal">
|
||||
<title>iconv_to_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convertit une chaîne de caractères vers le jeu de caractères
|
||||
interne WeeChat (UTF-8).
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : le jeu de caractères de départ
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option> : la chaîne à convertir
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : la chaîne convertie.
|
||||
</para>
|
||||
<para>
|
||||
Note : le résultat doit être libéré par un appel à la fonction
|
||||
"free" après utilisation.
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_iconv_from_internal">
|
||||
<title>iconv_from_internal</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
|
||||
char *string)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Convertit une chaîne de caractères depuis le jeu de caractères
|
||||
interne WeeChat (UTF-8) vers un autre.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : le jeu de caractères voulu
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>string</option> : la chaîne à convertir
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : la chaîne convertie.
|
||||
</para>
|
||||
<para>
|
||||
Note : le résultat doit être libéré par un appel à la fonction
|
||||
"free" après utilisation.
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à");</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_ascii_strcasecmp">
|
||||
<title>ascii_strcasecmp</title>
|
||||
@@ -4782,25 +4924,25 @@ end
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::register(nom, version, fonction_de_fin, description);
|
||||
weechat::register(nom, version, fonction_de_fin, description, [charset]);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.register(nom, version, fonction_de_fin, description)
|
||||
weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.register(nom, version, fonction_de_fin, description)
|
||||
Weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.register(nom, version, fonction_de_fin, description)
|
||||
weechat.register(nom, version, fonction_de_fin, description, [charset])
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4833,6 +4975,12 @@ end
|
||||
<option>description</option> : brève description du script
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : jeu de caractères du script, à
|
||||
préciser si le script n'est pas écrit en UTF-8
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -4843,20 +4991,82 @@ end
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::register("essai", "1.0", "fin_essai", "Script d'essai !");
|
||||
weechat::register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !")
|
||||
weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="sec_script_set_charset">
|
||||
<title>set_charset</title>
|
||||
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::set_charset(charset);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.set_charsetr(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.set_charset(charset)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Change le jeu de caractères du script.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>charset</option> : nouveau jeu de caractères
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : 1 si le nouveau jeu de caractères a été
|
||||
mis en place, 0 si une erreur s'est produite.
|
||||
</para>
|
||||
<para>
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::set_charset("ISO-8859-1");
|
||||
|
||||
# python
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
|
||||
# ruby
|
||||
Weechat.set_charset("ISO-8859-1")
|
||||
|
||||
-- lua
|
||||
weechat.set_charset("ISO-8859-1")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_print">
|
||||
<title>print</title>
|
||||
|
||||
@@ -5897,27 +6107,43 @@ weechat.remove_keyboard_handler("mon_clavier")
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_modifier("irc_in", "privmsg", "ma_fonction");
|
||||
sub ma_fonction
|
||||
weechat::add_modifier("irc_in", "privmsg", "mod_in");
|
||||
weechat::add_modifier("irc_out", "privmsg", "mod_out");
|
||||
sub mod_in
|
||||
{
|
||||
# TODO
|
||||
return "$_[1] [modifier IN]";
|
||||
}
|
||||
sub mod_out
|
||||
{
|
||||
return "$_[1] [modifier OUT]";
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
def ma_fonction(serveur, args):
|
||||
# TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(serveur, args):
|
||||
return args + " [modifier IN]"
|
||||
def mod_out(serveur, args):
|
||||
return args + " [modifier OUT]"
|
||||
|
||||
# ruby
|
||||
Weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
def ma_fonction(server, args)
|
||||
# TODO
|
||||
Weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
Weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
def mod_in(server, args)
|
||||
return args + " [modifier IN]"
|
||||
end
|
||||
def mod_out(server, args)
|
||||
return args + " [modifier OUT]"
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
function ma_fonction(server, args)
|
||||
-- TODO
|
||||
weechat.add_modifier("irc_in", "privmsg", "mod_in")
|
||||
weechat.add_modifier("irc_out", "privmsg", "mod_out")
|
||||
function mod_in(server, args)
|
||||
return args .. " [modifier IN]"
|
||||
end
|
||||
function mod_out(server, args)
|
||||
return args .. " [modifier OUT]"
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
@@ -5980,16 +6206,16 @@ end
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_modifier("irc_in", "privmsg", "ma_fonction");
|
||||
weechat::remove_modifier("irc_in", "privmsg", "mod_in");
|
||||
|
||||
# python
|
||||
weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
Weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
|
||||
-- lua
|
||||
weechat.remove_modifier("irc_in", "privmsg", "ma_fonction")
|
||||
weechat.remove_modifier("irc_in", "privmsg", "mod_in")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
@@ -7293,8 +7519,8 @@ end
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<emphasis>Kolter</emphasis>
|
||||
<email>kolter AT free.fr</email> -
|
||||
<emphasis>kolter (Emmanuel Bouthenot)</emphasis>
|
||||
<email>kolter AT openics.org</email> -
|
||||
développeur
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -39,16 +39,6 @@ lance une commande WeeChat/IRC interne (sans regarder les gestionnaires de comma
|
||||
commande: commande à exécuter (un '/' est automatiquement ajouté s'il n'est pas trouvé au début de la commande)
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>charset [(decode_iso | decode_utf | encode) charset]</command>
|
||||
<programlisting>
|
||||
changer le jeu de caractères pour le serveur ou le canal
|
||||
|
||||
decode_iso: jeu de caractères utilisé pour décoder l'ISO
|
||||
decode_utf: jeu de caractères utilisé pour décoder l'UTF
|
||||
encode: jeu de caractères utilisé pour encoder les messages
|
||||
charset: jeu de caractères à utiliser (par exemple: ISO-8859-15, UTF-8,..)
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<programlisting>
|
||||
|
||||
+757
-1109
File diff suppressed because it is too large
Load Diff
+757
-1094
File diff suppressed because it is too large
Load Diff
+757
-1095
File diff suppressed because it is too large
Load Diff
+758
-923
File diff suppressed because it is too large
Load Diff
+757
-926
File diff suppressed because it is too large
Load Diff
+757
-1109
File diff suppressed because it is too large
Load Diff
+752
-883
File diff suppressed because it is too large
Load Diff
@@ -42,10 +42,11 @@
|
||||
#include "weechat.h"
|
||||
#include "backtrace.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/*
|
||||
* weechat_backtrace_printf: display a backtrage line (on stderr and in WeeChat log)
|
||||
* weechat_backtrace_printf: display a backtrace line (on stderr and in WeeChat log)
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -58,7 +59,7 @@ weechat_backtrace_printf (char *message, ...)
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
fprintf (stderr, "%s", buffer);
|
||||
weechat_iconv_fprintf (stderr, "%s", buffer);
|
||||
weechat_log_printf ("%s", buffer);
|
||||
}
|
||||
|
||||
|
||||
+21
-273
@@ -74,13 +74,6 @@ t_weechat_command weechat_commands[] =
|
||||
N_("command"),
|
||||
N_("command: command to execute (a '/' is automatically added if not found at beginning of command)\n"),
|
||||
"%w|%i", 0, MAX_ARGS, 1, NULL, weechat_cmd_builtin },
|
||||
{ "charset", N_("change charset for server or channel"),
|
||||
N_("[(decode_iso | decode_utf | encode) charset]"),
|
||||
N_("decode_iso: charset used for decoding ISO\n"
|
||||
"decode_utf: charset used for decoding UTF\n"
|
||||
" encode: charset used for encoding messages\n"
|
||||
" charset: charset to use (for example: ISO-8859-15, UTF-8,..)"),
|
||||
"decode_iso|decode_utf|encode", 0, 2, 0, weechat_cmd_charset, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
@@ -293,7 +286,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
int only_builtin)
|
||||
{
|
||||
int i, rc, argc, argc2, return_code, length1, length2;
|
||||
char *command, *pos, *ptr_args, *ptr_args2, *ptr_args3;
|
||||
char *command, *pos, *ptr_args, *ptr_args2;
|
||||
char **argv, **argv2, *alias_command;
|
||||
char **commands, **ptr_cmd, **ptr_next_cmd;
|
||||
char *args_replaced, *vars_replaced, *new_ptr_cmd;
|
||||
@@ -497,16 +490,13 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_args2 = (weechat_commands[i].conversion && ptr_args) ?
|
||||
channel_iconv_encode (server, channel, ptr_args) : NULL;
|
||||
ptr_args3 = (weechat_commands[i].conversion
|
||||
&& cfg_irc_colors_send && ptr_args) ?
|
||||
(char *)gui_color_encode ((ptr_args2) ? (unsigned char *)ptr_args2 :
|
||||
(unsigned char *)ptr_args) : NULL;
|
||||
ptr_args2 = (weechat_commands[i].conversion
|
||||
&& cfg_irc_colors_send
|
||||
&& ptr_args) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
|
||||
if (weechat_commands[i].cmd_function_args)
|
||||
{
|
||||
argv2 = explode_string ((ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args),
|
||||
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
|
||||
" ", 0, &argc2);
|
||||
return_code = (int) (weechat_commands[i].cmd_function_args)
|
||||
(server, channel, argc2, argv2);
|
||||
@@ -514,8 +504,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
return_code = (int) (weechat_commands[i].cmd_function_1arg)
|
||||
(server, channel, (ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args));
|
||||
(server, channel, (ptr_args2) ? ptr_args2 : ptr_args);
|
||||
if (return_code < 0)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
@@ -525,8 +514,6 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
if (ptr_args2)
|
||||
free (ptr_args2);
|
||||
if (ptr_args3)
|
||||
free (ptr_args3);
|
||||
}
|
||||
free_exploded_string (argv);
|
||||
free (command);
|
||||
@@ -592,16 +579,13 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
free (command);
|
||||
return 0;
|
||||
}
|
||||
ptr_args2 = (irc_commands[i].conversion && ptr_args) ?
|
||||
channel_iconv_encode (server, channel, ptr_args) : NULL;
|
||||
ptr_args3 = (irc_commands[i].conversion
|
||||
&& cfg_irc_colors_send && ptr_args) ?
|
||||
(char *)gui_color_encode ((ptr_args2) ? (unsigned char *)ptr_args2 :
|
||||
(unsigned char *)ptr_args) : NULL;
|
||||
ptr_args2 = (irc_commands[i].conversion
|
||||
&& cfg_irc_colors_send
|
||||
&& ptr_args) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
|
||||
if (irc_commands[i].cmd_function_args)
|
||||
{
|
||||
argv2 = explode_string ((ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args),
|
||||
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
|
||||
" ", 0, &argc2);
|
||||
return_code = (int) (irc_commands[i].cmd_function_args)
|
||||
(server, channel, argc2, argv2);
|
||||
@@ -609,8 +593,7 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
return_code = (int) (irc_commands[i].cmd_function_1arg)
|
||||
(server, channel, (ptr_args3) ? ptr_args3 :
|
||||
((ptr_args2) ? ptr_args2 : ptr_args));
|
||||
(server, channel, (ptr_args2) ? ptr_args2 : ptr_args);
|
||||
if (return_code < 0)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
@@ -620,8 +603,6 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
if (ptr_args2)
|
||||
free (ptr_args2);
|
||||
if (ptr_args3)
|
||||
free (ptr_args3);
|
||||
}
|
||||
free_exploded_string (argv);
|
||||
free (command);
|
||||
@@ -742,7 +723,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
{
|
||||
t_gui_buffer *buffer;
|
||||
char *new_cmd, *ptr_cmd, *pos;
|
||||
char *command_with_colors, *command_encoded;
|
||||
char *command_with_colors;
|
||||
|
||||
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
@@ -791,9 +772,6 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
command_with_colors = (cfg_irc_colors_send) ?
|
||||
(char *)gui_color_encode ((unsigned char *)ptr_cmd) : NULL;
|
||||
|
||||
command_encoded = channel_iconv_encode (server, channel,
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
|
||||
if (CHANNEL(buffer)->dcc_chat)
|
||||
{
|
||||
if (((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat))->sock < 0)
|
||||
@@ -806,8 +784,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
{
|
||||
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
|
||||
"%s\r\n",
|
||||
(command_encoded) ? command_encoded :
|
||||
((command_with_colors) ? command_with_colors : ptr_cmd));
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
user_message_display (server, buffer,
|
||||
(command_with_colors) ?
|
||||
command_with_colors : ptr_cmd);
|
||||
@@ -815,13 +792,10 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
}
|
||||
else
|
||||
user_message (server, buffer,
|
||||
(command_encoded) ? command_encoded :
|
||||
((command_with_colors) ? command_with_colors : ptr_cmd));
|
||||
(command_with_colors) ? command_with_colors : ptr_cmd);
|
||||
|
||||
if (command_with_colors)
|
||||
free (command_with_colors);
|
||||
if (command_encoded)
|
||||
free (command_encoded);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1394,232 +1368,6 @@ weechat_cmd_builtin (t_irc_server *server, t_irc_channel *channel,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset_display: display charsets for a server or channel
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_cmd_charset_display (t_gui_buffer *buffer)
|
||||
{
|
||||
char *server_item = "server", *ptr_item;
|
||||
char *value, *string, *herited;
|
||||
int length;
|
||||
|
||||
if ((BUFFER_IS_SERVER(buffer) && (SERVER(buffer)))
|
||||
|| BUFFER_IS_CHANNEL(buffer)
|
||||
|| BUFFER_IS_PRIVATE(buffer))
|
||||
{
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for server %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = server_item;
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL(buffer))
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for channel %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = CHANNEL(buffer)->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_nolog (NULL, _("Charsets for private %s%s%s: "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
ptr_item = CHANNEL(buffer)->name;
|
||||
}
|
||||
|
||||
/* decode ISO */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_decode_iso),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_decode_iso (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "decode_iso: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, ", ");
|
||||
free (string);
|
||||
|
||||
/* decode UTF */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_decode_utf),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_decode_utf (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "decode_utf: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, ", ");
|
||||
free (string);
|
||||
|
||||
/* encode */
|
||||
herited = NULL;
|
||||
config_option_list_get_value (&(SERVER(buffer)->charset_encode),
|
||||
ptr_item, &value, &length);
|
||||
if (value && (length > 0))
|
||||
{
|
||||
string = strdup (value);
|
||||
string[length] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
string = strdup ("");
|
||||
herited = channel_get_charset_encode (SERVER(buffer),
|
||||
CHANNEL(buffer));
|
||||
}
|
||||
gui_printf (NULL, "encode: \"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
string,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (herited)
|
||||
{
|
||||
gui_printf (NULL, _(" (inherited: \"%s%s%s\")"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
herited,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
free (herited);
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
free (string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset_set: set a charset for server or channel
|
||||
* from_internal == 1 if charset is used to encode data,
|
||||
* 0 if charset is used to decode data
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_charset_set (t_gui_buffer *buffer, char **string, char *charset,
|
||||
int from_internal)
|
||||
{
|
||||
int iconv_ok;
|
||||
|
||||
if (charset)
|
||||
{
|
||||
if (from_internal)
|
||||
iconv_ok = weechat_iconv_check (NULL, charset);
|
||||
else
|
||||
iconv_ok = weechat_iconv_check (charset, NULL);
|
||||
|
||||
if (!iconv_ok)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s charset \"%s\" is not available\n"),
|
||||
WEECHAT_ERROR, charset);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, "server", charset);
|
||||
else
|
||||
config_option_list_remove (string, "server");
|
||||
weechat_cmd_charset_display (buffer);
|
||||
}
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL(buffer) ||
|
||||
BUFFER_IS_PRIVATE(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, CHANNEL(buffer)->name, charset);
|
||||
else
|
||||
config_option_list_remove (string, CHANNEL(buffer)->name);
|
||||
weechat_cmd_charset_display (buffer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_charset: change charset for server or channel
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_charset (t_irc_server *server, t_irc_channel *channel,
|
||||
int argc, char **argv)
|
||||
{
|
||||
t_gui_buffer *buffer;
|
||||
int rc;
|
||||
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
|
||||
if (argc == 0)
|
||||
weechat_cmd_charset_display (buffer);
|
||||
else
|
||||
{
|
||||
if (ascii_strcasecmp (argv[0], "decode_iso") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_decode_iso),
|
||||
(argc > 1) ? argv[1] : NULL, 0);
|
||||
else if (ascii_strcasecmp (argv[0], "decode_utf") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_decode_utf),
|
||||
(argc > 1) ? argv[1] : NULL, 0);
|
||||
else if (ascii_strcasecmp (argv[0], "encode") == 0)
|
||||
rc = weechat_cmd_charset_set (buffer,
|
||||
&(SERVER(buffer)->charset_encode),
|
||||
(argc > 1) ? argv[1] : NULL, 1);
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "charset");
|
||||
return -1;
|
||||
}
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
@@ -2996,8 +2744,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
server_tmp.username, server_tmp.realname,
|
||||
server_tmp.hostname,
|
||||
server_tmp.command, 1, server_tmp.autojoin, 1, NULL,
|
||||
NULL, NULL, NULL);
|
||||
server_tmp.command, 1, server_tmp.autojoin, 1, NULL);
|
||||
if (new_server)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
@@ -3789,9 +3536,10 @@ weechat_cmd_upgrade (t_irc_server *server, t_irc_channel *channel,
|
||||
plugin_init (1);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
|
||||
free (exec_args[0]);
|
||||
free (exec_args[3]);
|
||||
|
||||
@@ -60,7 +60,6 @@ extern void user_command (t_irc_server *, t_irc_channel *, char *, int);
|
||||
extern int weechat_cmd_alias (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_buffer (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_builtin (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int weechat_cmd_charset (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_clear (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_connect (t_irc_server *, t_irc_channel *, int, char **);
|
||||
extern int weechat_cmd_dcc (t_irc_server *, t_irc_channel *, char *);
|
||||
|
||||
@@ -664,7 +664,7 @@ completion_list_add_servers (t_completion *completion)
|
||||
void
|
||||
completion_list_add_topic (t_completion *completion)
|
||||
{
|
||||
char *string, *string2;
|
||||
char *string;
|
||||
|
||||
if (!completion->server || !completion->channel
|
||||
|| !((t_irc_channel *)(completion->channel))->topic
|
||||
@@ -676,16 +676,11 @@ completion_list_add_topic (t_completion *completion)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
|
||||
else
|
||||
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0);
|
||||
string2 = channel_iconv_decode ((t_irc_server *)(completion->server),
|
||||
(t_irc_channel *)(completion->channel),
|
||||
(string) ? string : ((t_irc_channel *)(completion->channel))->topic);
|
||||
completion_list_add (completion,
|
||||
(string2) ? string2 : ((string) ?
|
||||
string : ((t_irc_channel *)(completion->channel))->topic));
|
||||
(string) ?
|
||||
string : ((t_irc_channel *)(completion->channel))->topic);
|
||||
if (string)
|
||||
free (string);
|
||||
if (string2)
|
||||
free (string2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-12
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
char *weechat_log_filename = NULL; /* log name (~/.weechat/weechat.log) */
|
||||
@@ -99,11 +100,11 @@ weechat_log_init ()
|
||||
{
|
||||
if (!weechat_log_open (NULL, "w"))
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unable to create/append to log file\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using \"--dir\" command line option.\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unable to create/append to log file\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using \"--dir\" command line option.\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -142,12 +143,13 @@ weechat_log_printf (char *message, ...)
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
weechat_iconv_fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (weechat_log_file, "%s", buffer);
|
||||
weechat_iconv_fprintf (weechat_log_file, "%s", buffer);
|
||||
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
@@ -212,8 +214,8 @@ weechat_log_crash_rename ()
|
||||
getpid());
|
||||
if (rename (old_name, new_name) == 0)
|
||||
{
|
||||
fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
weechat_iconv_fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
weechat_log_open (new_name, "a");
|
||||
free (old_name);
|
||||
free (new_name);
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "session.h"
|
||||
#include "hotlist.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -265,9 +266,6 @@ session_save_servers (FILE *file)
|
||||
rc = rc && (session_write_int (file, SESSION_SERV_LAG, ptr_server->lag));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_CHECK_TIME, &(ptr_server->lag_check_time), sizeof (struct timeval)));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_NEXT_CHECK, &(ptr_server->lag_next_check), sizeof (time_t)));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_ISO, ptr_server->charset_decode_iso));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_UTF, ptr_server->charset_decode_utf));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_ENCODE, ptr_server->charset_encode));
|
||||
rc = rc && (session_write_id (file, SESSION_SERV_END));
|
||||
|
||||
if (!rc)
|
||||
@@ -510,21 +508,21 @@ session_crash (FILE *file, char *message, ...)
|
||||
|
||||
fclose (file);
|
||||
gui_main_end ();
|
||||
fprintf (stderr, "%s %s\n",
|
||||
WEECHAT_ERROR, buffer);
|
||||
fprintf (stderr,
|
||||
_("Last operation with session file was at position %ld, "
|
||||
"read of %d bytes\n"),
|
||||
session_last_read_pos,
|
||||
session_last_read_length);
|
||||
fprintf (stderr,
|
||||
_("Please send %s/%s, %s/%s and "
|
||||
"above messages to WeeChat developers for support.\n"
|
||||
"Be careful, private info may be in these files.\n"),
|
||||
weechat_home,
|
||||
WEECHAT_LOG_NAME,
|
||||
weechat_home,
|
||||
WEECHAT_SESSION_NAME);
|
||||
weechat_iconv_fprintf (stderr, "%s %s\n",
|
||||
WEECHAT_ERROR, buffer);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("Last operation with session file was at position %ld, "
|
||||
"read of %d bytes\n"),
|
||||
session_last_read_pos,
|
||||
session_last_read_length);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("Please send %s/%s, %s/%s and "
|
||||
"above messages to WeeChat developers for support.\n"
|
||||
"Be careful, private info may be in these files.\n"),
|
||||
weechat_home,
|
||||
WEECHAT_LOG_NAME,
|
||||
weechat_home,
|
||||
WEECHAT_SESSION_NAME);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -995,14 +993,14 @@ session_load_server (FILE *file)
|
||||
case SESSION_SERV_LAG_NEXT_CHECK:
|
||||
rc = rc && (session_read_buf (file, &(session_current_server->lag_next_check), sizeof (time_t)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_iso)));
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_utf)));
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_ENCODE:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_encode)));
|
||||
case SESSION_SERV_CHARSET_ENCODE__UNUSED:
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
|
||||
@@ -87,9 +87,9 @@ enum t_session_server
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF,
|
||||
SESSION_SERV_CHARSET_ENCODE,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO__UNUSED,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF__UNUSED,
|
||||
SESSION_SERV_CHARSET_ENCODE__UNUSED,
|
||||
SESSION_SERV_HOSTNAME,
|
||||
SESSION_SERV_NICK_MODES,
|
||||
SESSION_SERV_AWAY_MESSAGE
|
||||
|
||||
+44
-36
@@ -39,12 +39,12 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
int local_utf8 = 0;
|
||||
|
||||
|
||||
/*
|
||||
* utf8_init: initializes UTF-8 in WeeChat
|
||||
*/
|
||||
@@ -52,26 +52,17 @@ int local_utf8 = 0;
|
||||
void
|
||||
utf8_init ()
|
||||
{
|
||||
local_utf8 = 0;
|
||||
|
||||
if (cfg_look_charset_internal && cfg_look_charset_internal[0])
|
||||
{
|
||||
if (strstr (cfg_look_charset_internal, "UTF-8")
|
||||
|| strstr (cfg_look_charset_internal, "utf-8"))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
else if ((local_charset)
|
||||
&& ((strstr (local_charset, "UTF-8")
|
||||
|| strstr (local_charset, "utf-8"))))
|
||||
local_utf8 = 1;
|
||||
local_utf8 = (ascii_strcasecmp (local_charset, "UTF-8") == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_is_valid: return 1 if UTF-8 string is valid, 0 otherwise
|
||||
* if error is not NULL, it's set with first non valid UTF-8
|
||||
* char in string, if any
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
utf8_is_valid (char *string, char **error)
|
||||
{
|
||||
while (string && string[0])
|
||||
{
|
||||
@@ -79,7 +70,11 @@ utf8_is_valid (char *string)
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes, should be: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
@@ -88,7 +83,11 @@ utf8_is_valid (char *string)
|
||||
if (!string[1] || !string[2]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes, should be: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
@@ -98,18 +97,47 @@ utf8_is_valid (char *string)
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
string += 4;
|
||||
}
|
||||
/* UTF-8, 1 byte, should be: 0vvvvvvv */
|
||||
else if ((unsigned char)(string[0]) >= 0x80)
|
||||
{
|
||||
if (error)
|
||||
*error = string;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
string++;
|
||||
}
|
||||
if (error)
|
||||
*error = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_normalize: normalize UTF-8 string: remove non UTF-8 chars and
|
||||
* replace them by a char
|
||||
*/
|
||||
|
||||
void
|
||||
utf8_normalize (char *string, char replacement)
|
||||
{
|
||||
char *error;
|
||||
|
||||
while (string && string[0])
|
||||
{
|
||||
if (utf8_is_valid (string, &error))
|
||||
return;
|
||||
error[0] = replacement;
|
||||
string = error + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_prev_char: return previous UTF-8 char in a string
|
||||
*/
|
||||
@@ -122,9 +150,6 @@ utf8_prev_char (char *string_start, char *string)
|
||||
|
||||
string--;
|
||||
|
||||
if (!local_utf8)
|
||||
return string;
|
||||
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 2 bytes */
|
||||
@@ -164,9 +189,6 @@ utf8_next_char (char *string)
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + 1;
|
||||
|
||||
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
@@ -223,9 +245,6 @@ utf8_strlen (char *string)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string && string[0])
|
||||
{
|
||||
@@ -248,14 +267,6 @@ utf8_strnlen (char *string, int bytes)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
{
|
||||
length = strlen (string);
|
||||
if (bytes > length)
|
||||
return length;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string && string[0] && (string - start < bytes))
|
||||
@@ -280,7 +291,7 @@ utf8_width_screen (char *string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
return utf8_strlen (string);
|
||||
|
||||
num_char = mbstowcs (NULL, string, 0) + 1;
|
||||
wstring = (wchar_t *) malloc ((num_char + 1) * sizeof (wchar_t));
|
||||
@@ -310,9 +321,6 @@ utf8_add_offset (char *string, int offset)
|
||||
if (!string)
|
||||
return string;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string && string[0] && (count < offset))
|
||||
{
|
||||
@@ -333,7 +341,7 @@ utf8_real_pos (char *string, int pos)
|
||||
int count, real_pos;
|
||||
char *next_char;
|
||||
|
||||
if (!string || !local_utf8)
|
||||
if (!string)
|
||||
return pos;
|
||||
|
||||
count = 0;
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
extern int local_utf8;
|
||||
|
||||
extern void utf8_init ();
|
||||
extern int utf8_is_valid (char *);
|
||||
extern int utf8_is_valid (char *, char **);
|
||||
extern void utf8_normalize (char *, char);
|
||||
extern char *utf8_prev_char (char *, char *);
|
||||
extern char *utf8_next_char (char *);
|
||||
extern int utf8_char_size (char *);
|
||||
|
||||
+91
-22
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
@@ -32,9 +33,34 @@
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
/*
|
||||
* strndup: define strndup function if not existing (FreeBSD and maybe other)
|
||||
*/
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
char *
|
||||
strndup (char *string, int length)
|
||||
{
|
||||
char *result;
|
||||
|
||||
if ((int)strlen (string) < length)
|
||||
return strdup (string);
|
||||
|
||||
result = (char *)malloc (length + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
memcpy (result, string, length);
|
||||
result[length] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ascii_tolower: locale independant string conversion to lower case
|
||||
*/
|
||||
@@ -217,32 +243,75 @@ weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_check: check a charset
|
||||
* if a charset is NULL, internal charset is used
|
||||
* weechat_iconv_to_internal: convert user string (input, script, ..) to
|
||||
* WeeChat internal storage charset
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_iconv_check (char *from_code, char *to_code)
|
||||
char *
|
||||
weechat_iconv_to_internal (char *charset, char *string)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *input, *output;
|
||||
|
||||
input = strdup (string);
|
||||
if (input)
|
||||
{
|
||||
if (utf8_is_valid (input, NULL))
|
||||
return input;
|
||||
|
||||
output = weechat_iconv ((charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
WEECHAT_INTERNAL_CHARSET,
|
||||
input);
|
||||
utf8_normalize (output, '?');
|
||||
free (input);
|
||||
return output;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_from_internal: convert internal string to terminal charset,
|
||||
* for display
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_iconv_from_internal (char *charset, char *string)
|
||||
{
|
||||
char *input, *output;
|
||||
|
||||
input = strdup (string);
|
||||
if (input)
|
||||
{
|
||||
utf8_normalize (input, '?');
|
||||
output = weechat_iconv (WEECHAT_INTERNAL_CHARSET,
|
||||
(charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
input);
|
||||
free (input);
|
||||
return output;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_iconv_fprintf: encode to terminal charset, then call fprintf on a file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_iconv_fprintf (FILE *file, char *data, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[4096];
|
||||
char *buf2;
|
||||
|
||||
if (!from_code || !from_code[0])
|
||||
from_code = (cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset;
|
||||
|
||||
if (!to_code || !to_code[0])
|
||||
to_code = (cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset;
|
||||
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
return 0;
|
||||
iconv_close (cd);
|
||||
return 1;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
va_start (argptr, data);
|
||||
vsnprintf (buf, sizeof (buf) - 1, data, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_from_internal (NULL, buf);
|
||||
fprintf (file, "%s", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,13 +21,18 @@
|
||||
#ifndef __WEECHAT_UTIL_H
|
||||
#define __WEECHAT_UTIL_H 1
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
extern char *strndup (char *, int);
|
||||
#endif
|
||||
extern void ascii_tolower (char *);
|
||||
extern void ascii_toupper (char *);
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern char *ascii_strcasestr (char *, char *);
|
||||
extern char *weechat_iconv (char *, char *, char *);
|
||||
extern int weechat_iconv_check (char *, char *);
|
||||
extern char *weechat_iconv_to_internal (char *, char *);
|
||||
extern char *weechat_iconv_from_internal (char *, char *);
|
||||
extern void weechat_iconv_fprintf (FILE *, char *, ...);
|
||||
extern char *weechat_strreplace (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
|
||||
+140
-126
@@ -98,27 +98,30 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
|
||||
void
|
||||
weechat_display_usage (char *exec_name)
|
||||
{
|
||||
printf ("\n");
|
||||
printf (_("%s (c) Copyright 2003-2006, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
printf ("\n\n");
|
||||
printf (_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
printf ("\n\n");
|
||||
printf (_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
printf("\n");
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s (c) Copyright 2003-2006, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
weechat_iconv_fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -130,7 +133,8 @@ weechat_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
printf (_("WeeChat configuration options (<weechat_home>/weechat.rc):\n\n"));
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("WeeChat configuration options (<weechat_home>/weechat.rc):\n\n"));
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if (weechat_options[i])
|
||||
@@ -138,60 +142,61 @@ weechat_display_config_options ()
|
||||
j = 0;
|
||||
while (weechat_options[i][j].option_name)
|
||||
{
|
||||
printf ("* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
printf (_(" . type: boolean\n"));
|
||||
printf (_(" . values: 'on' or 'off'\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (stdout, _(" . type: boolean\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: 'on' or 'off'\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
printf (_(" . type: integer\n"));
|
||||
printf (_(" . values: between %d and %d\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
printf (_(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (stdout, _(" . type: integer\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: between %d and %d\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
printf (_(" . type: string\n"));
|
||||
printf (_(" . values: "));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: "));
|
||||
k = 0;
|
||||
while (weechat_options[i][j].array_values[k])
|
||||
{
|
||||
printf ("'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
weechat_iconv_fprintf (stdout, "'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
if (weechat_options[i][j].array_values[k + 1])
|
||||
printf (", ");
|
||||
weechat_iconv_fprintf (stdout, ", ");
|
||||
k++;
|
||||
}
|
||||
printf ("\n");
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
printf (_(" . type: color\n"));
|
||||
printf (_(" . values: Curses or Gtk color\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: color\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: Curses or Gtk color\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
printf (_(" . type: string\n"));
|
||||
printf (_(" . values: any string\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
weechat_iconv_fprintf (stdout, _(" . type: string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . values: any string\n"));
|
||||
weechat_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -209,43 +214,44 @@ weechat_display_commands (int weechat_cmd, int irc_cmd)
|
||||
|
||||
if (weechat_cmd)
|
||||
{
|
||||
printf (_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
printf ("* %s", weechat_commands[i].command_name);
|
||||
weechat_iconv_fprintf (stdout, "* %s", weechat_commands[i].command_name);
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(weechat_commands[i].arguments));
|
||||
weechat_iconv_fprintf (stdout, " %s\n\n", _(weechat_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(weechat_commands[i].command_description));
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n", _(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
|
||||
if (irc_cmd)
|
||||
{
|
||||
printf (_("IRC commands:\n"));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _("IRC commands:\n"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args ||
|
||||
irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
printf ("* %s", irc_commands[i].command_name);
|
||||
weechat_iconv_fprintf (stdout, "* %s", irc_commands[i].command_name);
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(irc_commands[i].arguments));
|
||||
weechat_iconv_fprintf (stdout, " %s\n\n", _(irc_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(irc_commands[i].command_description));
|
||||
weechat_iconv_fprintf (stdout, "\n\n");
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n", _(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
weechat_iconv_fprintf (stdout, "%s\n\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
@@ -261,14 +267,15 @@ weechat_display_key_functions ()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf (_("Internal key functions:\n"));
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout, _("Internal key functions:\n"));
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
printf ("* %s: %s\n",
|
||||
gui_key_functions[i].function_name,
|
||||
_(gui_key_functions[i].description));
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s: %s\n",
|
||||
gui_key_functions[i].function_name,
|
||||
_(gui_key_functions[i].description));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -283,14 +290,16 @@ weechat_display_keys ()
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
|
||||
printf (_("%s default keys:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
weechat_iconv_fprintf (stdout,
|
||||
_("%s default keys:\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, "\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
printf ("* %s => %s\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
(ptr_key->function) ? gui_keyboard_function_search_by_ptr (ptr_key->function) : ptr_key->command);
|
||||
weechat_iconv_fprintf (stdout,
|
||||
"* %s => %s\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
(ptr_key->function) ? gui_keyboard_function_search_by_ptr (ptr_key->function) : ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
@@ -331,9 +340,9 @@ weechat_parse_args (int argc, char *argv[])
|
||||
weechat_home = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --dir option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s missing argument for --dir option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +373,7 @@ weechat_parse_args (int argc, char *argv[])
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
weechat_iconv_fprintf (stdout, "\n%s%s", WEE_LICENSE);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
@@ -376,16 +385,16 @@ weechat_parse_args (int argc, char *argv[])
|
||||
weechat_session = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
weechat_iconv_fprintf (stdout, PACKAGE_VERSION "\n");
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-w") == 0)
|
||||
@@ -398,8 +407,9 @@ weechat_parse_args (int argc, char *argv[])
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -411,19 +421,19 @@ weechat_parse_args (int argc, char *argv[])
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, NULL, 0,
|
||||
server_tmp.autojoin, 1, NULL, NULL,
|
||||
NULL, NULL))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_tmp.autojoin, 1, NULL))
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
server_cmd_line = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
weechat_iconv_fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,8 +452,8 @@ weechat_create_dir (char *directory)
|
||||
/* exit if error (except if directory already exists) */
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
weechat_iconv_fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -466,8 +476,8 @@ weechat_create_home_dirs ()
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
@@ -475,8 +485,8 @@ weechat_create_home_dirs ()
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!weechat_home)
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_iconv_fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
@@ -488,8 +498,8 @@ weechat_create_home_dirs ()
|
||||
{
|
||||
if (!S_ISDIR (statinfo.st_mode))
|
||||
{
|
||||
fprintf (stderr, _("%s home (%s) is not a directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_iconv_fprintf (stderr, _("%s home (%s) is not a directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -497,8 +507,8 @@ weechat_create_home_dirs ()
|
||||
/* create home directory; error is fatal */
|
||||
if (!weechat_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
@@ -521,8 +531,8 @@ weechat_create_config_dirs ()
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -537,8 +547,8 @@ weechat_create_config_dirs ()
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -774,19 +784,20 @@ weechat_sigsegv ()
|
||||
server_free_all ();
|
||||
gui_main_end ();
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
|
||||
weechat_iconv_fprintf (stderr, "\n");
|
||||
weechat_iconv_fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
|
||||
if (!weechat_log_crash_rename ())
|
||||
fprintf (stderr, "*** Full crash dump was saved to %s/weechat.log file.\n",
|
||||
weechat_home);
|
||||
fprintf (stderr, "***\n");
|
||||
fprintf (stderr, "*** Please help WeeChat developers to fix this bug:\n");
|
||||
fprintf (stderr, "*** 1. If you have a core file, please run: gdb weechat-curses core\n");
|
||||
fprintf (stderr, "*** then issue \"bt\" command and send result to developers\n");
|
||||
fprintf (stderr, "*** To enable core files with bash shell: ulimit -c 10000\n");
|
||||
fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
weechat_iconv_fprintf (stderr,
|
||||
"*** Full crash dump was saved to %s/weechat.log file.\n",
|
||||
weechat_home);
|
||||
weechat_iconv_fprintf (stderr, "***\n");
|
||||
weechat_iconv_fprintf (stderr, "*** Please help WeeChat developers to fix this bug:\n");
|
||||
weechat_iconv_fprintf (stderr, "*** 1. If you have a core file, please run: gdb weechat-curses core\n");
|
||||
weechat_iconv_fprintf (stderr, "*** then issue \"bt\" command and send result to developers\n");
|
||||
weechat_iconv_fprintf (stderr, "*** To enable core files with bash shell: ulimit -c 10000\n");
|
||||
weechat_iconv_fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
|
||||
weechat_iconv_fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
weechat_iconv_fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
|
||||
weechat_backtrace ();
|
||||
|
||||
@@ -804,12 +815,16 @@ main (int argc, char *argv[])
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (PACKAGE, "UTF-8");
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#else
|
||||
local_charset = strdup ("");
|
||||
#endif
|
||||
utf8_init ();
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
@@ -824,7 +839,6 @@ main (int argc, char *argv[])
|
||||
command_index_build (); /* build cmd index for completion */
|
||||
weechat_config_read (); /* read configuration */
|
||||
weechat_create_config_dirs (); /* create config directories */
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_main_init (); /* init WeeChat interface */
|
||||
fifo_create (); /* FIFO pipe for remote control */
|
||||
if (weechat_session)
|
||||
|
||||
@@ -93,10 +93,15 @@
|
||||
#endif
|
||||
|
||||
/* some systems (like GNU/Hurd) doesn't define PATH_MAX */
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/* internal charset */
|
||||
|
||||
#define WEECHAT_INTERNAL_CHARSET "UTF-8"
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern char *weechat_argv0;
|
||||
|
||||
+192
-235
@@ -71,10 +71,6 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode_iso;
|
||||
char *cfg_look_charset_decode_utf;
|
||||
char *cfg_look_charset_encode;
|
||||
char *cfg_look_charset_internal;
|
||||
int cfg_look_one_server_buffer;
|
||||
int cfg_look_scroll_amount;
|
||||
int cfg_look_open_near_server;
|
||||
@@ -134,24 +130,6 @@ t_config_option weechat_options_look[] =
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
|
||||
{ "look_charset_decode_iso", N_("ISO charset for decoding messages from server (used only if locale is UTF-8)"),
|
||||
N_("ISO charset for decoding messages from server (used only if locale is UTF-8) "
|
||||
"(if empty, messages are not converted if locale is UTF-8)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_decode_iso, config_change_charset },
|
||||
{ "look_charset_decode_utf", N_("UTF charset for decoding messages from server (used only if locale is not UTF-8)"),
|
||||
N_("UTF charset for decoding messages from server (used only if locale is not UTF-8) "
|
||||
"(if empty, messages are not converted if locale is not UTF-8)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode_utf, config_change_charset },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_charset },
|
||||
{ "look_charset_internal", N_("forces internal WeeChat charset (should be empty in most cases)"),
|
||||
N_("forces internal WeeChat charset (should be empty in most cases, that means detected charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_internal, config_change_charset },
|
||||
{ "look_one_server_buffer", N_("use same buffer for all servers"),
|
||||
N_("use same buffer for all servers"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
@@ -1031,21 +1009,6 @@ t_config_option weechat_options_server[] =
|
||||
"default notify level"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.notify_levels), config_change_notify_levels },
|
||||
{ "server_charset_decode_iso", N_("charset for decoding ISO on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode ISO (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_iso), config_change_noop },
|
||||
{ "server_charset_decode_utf", N_("charset for decoding UTF on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode UTF (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_utf), config_change_noop },
|
||||
{ "server_charset_encode", N_("charset for encoding messages on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to encode messages (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_encode), config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1572,12 +1535,6 @@ config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
return (void *)(&server->autorejoin);
|
||||
if (ascii_strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
return (void *)(&server->notify_levels);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_iso") == 0)
|
||||
return (void *)(&server->charset_decode_iso);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_utf") == 0)
|
||||
return (void *)(&server->charset_decode_utf);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_encode") == 0)
|
||||
return (void *)(&server->charset_encode);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
@@ -1810,9 +1767,7 @@ config_allocate_server (char *filename, int line_number)
|
||||
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||
cfg_server.hostname, cfg_server.command,
|
||||
cfg_server.command_delay, cfg_server.autojoin,
|
||||
cfg_server.autorejoin, cfg_server.notify_levels,
|
||||
cfg_server.charset_decode_iso, cfg_server.charset_decode_utf,
|
||||
cfg_server.charset_encode))
|
||||
cfg_server.autorejoin, cfg_server.notify_levels))
|
||||
{
|
||||
server_free_all ();
|
||||
gui_printf (NULL,
|
||||
@@ -1895,7 +1850,7 @@ config_read ()
|
||||
FILE *file;
|
||||
int section, line_number, i, option_number;
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
char line[1024], *ptr_line, *ptr_line2, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
@@ -1924,6 +1879,14 @@ config_read ()
|
||||
line_number++;
|
||||
if (ptr_line)
|
||||
{
|
||||
/* encode line to internal charset */
|
||||
ptr_line2 = weechat_iconv_to_internal (NULL, ptr_line);
|
||||
if (ptr_line2)
|
||||
{
|
||||
snprintf (line, sizeof (line) - 1, "%s", ptr_line2);
|
||||
free (ptr_line2);
|
||||
}
|
||||
|
||||
/* skip spaces */
|
||||
while (ptr_line[0] == ' ')
|
||||
ptr_line++;
|
||||
@@ -2091,19 +2054,19 @@ config_read ()
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line,
|
||||
weechat_options[section][option_number].min,
|
||||
@@ -2112,15 +2075,15 @@ config_read ()
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
i = 0;
|
||||
while (weechat_options[section][option_number].array_values[i])
|
||||
{
|
||||
gui_printf (NULL, "\"%s\" ",
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
i++;
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
@@ -2128,7 +2091,7 @@ config_read ()
|
||||
case OPTION_TYPE_COLOR:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid color "
|
||||
"name for option '%s'\n"),
|
||||
"name for option '%s'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number,
|
||||
ptr_line);
|
||||
@@ -2196,48 +2159,48 @@ config_create_default ()
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
weechat_iconv_fprintf (stdout, _("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
weechat_log_printf (_("Creating default config file\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
weechat_iconv_fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
weechat_iconv_fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
weechat_iconv_fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].default_int) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].default_int) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
case OPTION_TYPE_COLOR:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2245,7 +2208,7 @@ config_create_default ()
|
||||
}
|
||||
|
||||
/* default key bindings */
|
||||
fprintf (file, "\n[keys]\n");
|
||||
weechat_iconv_fprintf (file, "\n[keys]\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
@@ -2253,79 +2216,79 @@ config_create_default ()
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
}
|
||||
else
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
|
||||
/* default aliases */
|
||||
fprintf (file, "\n[alias]\n");
|
||||
fprintf (file, "SAY = \"msg *\"\n");
|
||||
fprintf (file, "BYE = \"quit\"\n");
|
||||
fprintf (file, "EXIT = \"quit\"\n");
|
||||
fprintf (file, "SIGNOFF = \"quit\"\n");
|
||||
fprintf (file, "C = \"clear\"\n");
|
||||
fprintf (file, "CL = \"clear\"\n");
|
||||
fprintf (file, "CLOSE = \"buffer close\"\n");
|
||||
fprintf (file, "CHAT = \"dcc chat\"\n");
|
||||
fprintf (file, "IG = \"ignore\"\n");
|
||||
fprintf (file, "J = \"join\"\n");
|
||||
fprintf (file, "K = \"kick\"\n");
|
||||
fprintf (file, "KB = \"kickban\"\n");
|
||||
fprintf (file, "LEAVE = \"part\"\n");
|
||||
fprintf (file, "M = \"msg\"\n");
|
||||
fprintf (file, "MUB = \"unban *\"\n");
|
||||
fprintf (file, "N = \"names\"\n");
|
||||
fprintf (file, "Q = \"query\"\n");
|
||||
fprintf (file, "T = \"topic\"\n");
|
||||
fprintf (file, "UB = \"unban\"\n");
|
||||
fprintf (file, "UNIG = \"unignore\"\n");
|
||||
fprintf (file, "W = \"who\"\n");
|
||||
fprintf (file, "WC = \"window merge\"\n");
|
||||
fprintf (file, "WI = \"whois\"\n");
|
||||
fprintf (file, "WW = \"whowas\"\n");
|
||||
weechat_iconv_fprintf (file, "\n[alias]\n");
|
||||
weechat_iconv_fprintf (file, "SAY = \"msg *\"\n");
|
||||
weechat_iconv_fprintf (file, "BYE = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "EXIT = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "SIGNOFF = \"quit\"\n");
|
||||
weechat_iconv_fprintf (file, "C = \"clear\"\n");
|
||||
weechat_iconv_fprintf (file, "CL = \"clear\"\n");
|
||||
weechat_iconv_fprintf (file, "CLOSE = \"buffer close\"\n");
|
||||
weechat_iconv_fprintf (file, "CHAT = \"dcc chat\"\n");
|
||||
weechat_iconv_fprintf (file, "IG = \"ignore\"\n");
|
||||
weechat_iconv_fprintf (file, "J = \"join\"\n");
|
||||
weechat_iconv_fprintf (file, "K = \"kick\"\n");
|
||||
weechat_iconv_fprintf (file, "KB = \"kickban\"\n");
|
||||
weechat_iconv_fprintf (file, "LEAVE = \"part\"\n");
|
||||
weechat_iconv_fprintf (file, "M = \"msg\"\n");
|
||||
weechat_iconv_fprintf (file, "MUB = \"unban *\"\n");
|
||||
weechat_iconv_fprintf (file, "N = \"names\"\n");
|
||||
weechat_iconv_fprintf (file, "Q = \"query\"\n");
|
||||
weechat_iconv_fprintf (file, "T = \"topic\"\n");
|
||||
weechat_iconv_fprintf (file, "UB = \"unban\"\n");
|
||||
weechat_iconv_fprintf (file, "UNIG = \"unignore\"\n");
|
||||
weechat_iconv_fprintf (file, "W = \"who\"\n");
|
||||
weechat_iconv_fprintf (file, "WC = \"window merge\"\n");
|
||||
weechat_iconv_fprintf (file, "WI = \"whois\"\n");
|
||||
weechat_iconv_fprintf (file, "WW = \"whowas\"\n");
|
||||
|
||||
/* no ignore by default */
|
||||
|
||||
/* default server is freenode */
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name = \"freenode\"\n");
|
||||
fprintf (file, "server_autoconnect = on\n");
|
||||
fprintf (file, "server_autoreconnect = on\n");
|
||||
fprintf (file, "server_autoreconnect_delay = 30\n");
|
||||
fprintf (file, "server_address = \"irc.freenode.net\"\n");
|
||||
fprintf (file, "server_port = 6667\n");
|
||||
fprintf (file, "server_ipv6 = off\n");
|
||||
fprintf (file, "server_ssl = off\n");
|
||||
fprintf (file, "server_password = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "\n[server]\n");
|
||||
weechat_iconv_fprintf (file, "server_name = \"freenode\"\n");
|
||||
weechat_iconv_fprintf (file, "server_autoconnect = on\n");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect = on\n");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect_delay = 30\n");
|
||||
weechat_iconv_fprintf (file, "server_address = \"irc.freenode.net\"\n");
|
||||
weechat_iconv_fprintf (file, "server_port = 6667\n");
|
||||
weechat_iconv_fprintf (file, "server_ipv6 = off\n");
|
||||
weechat_iconv_fprintf (file, "server_ssl = off\n");
|
||||
weechat_iconv_fprintf (file, "server_password = \"\"\n");
|
||||
|
||||
/* Get the user's name from /etc/passwd */
|
||||
if ((my_passwd = getpwuid (geteuid ())) != NULL)
|
||||
{
|
||||
fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
|
||||
fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
|
||||
if ((!my_passwd->pw_gecos)
|
||||
|| (my_passwd->pw_gecos[0] == '\0')
|
||||
|| (my_passwd->pw_gecos[0] == ',')
|
||||
|| (my_passwd->pw_gecos[0] == ' '))
|
||||
fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
|
||||
else
|
||||
{
|
||||
realname = strdup (my_passwd->pw_gecos);
|
||||
pos = strchr (realname, ',');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
fprintf (file, "server_realname = \"%s\"\n",
|
||||
realname);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n",
|
||||
realname);
|
||||
if (pos)
|
||||
pos[0] = ',';
|
||||
free (realname);
|
||||
@@ -2334,26 +2297,26 @@ config_create_default ()
|
||||
else
|
||||
{
|
||||
/* default values if /etc/passwd can't be read */
|
||||
fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
fprintf (file, "server_nick1 = \"weechat1\"\n");
|
||||
fprintf (file, "server_nick2 = \"weechat2\"\n");
|
||||
fprintf (file, "server_nick3 = \"weechat3\"\n");
|
||||
fprintf (file, "server_username = \"weechat\"\n");
|
||||
fprintf (file, "server_realname = \"WeeChat default realname\"\n");
|
||||
weechat_iconv_fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"weechat1\"\n");
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"weechat2\"\n");
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"weechat3\"\n");
|
||||
weechat_iconv_fprintf (file, "server_username = \"weechat\"\n");
|
||||
weechat_iconv_fprintf (file, "server_realname = \"WeeChat default realname\"\n");
|
||||
}
|
||||
|
||||
fprintf (file, "server_hostname = \"\"\n");
|
||||
fprintf (file, "server_command = \"\"\n");
|
||||
fprintf (file, "server_command_delay = 0\n");
|
||||
fprintf (file, "server_autojoin = \"\"\n");
|
||||
fprintf (file, "server_autorejoin = on\n");
|
||||
fprintf (file, "server_notify_levels = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
fprintf (file, "server_charset_encode = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_hostname = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_command = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_command_delay = 0\n");
|
||||
weechat_iconv_fprintf (file, "server_autojoin = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_autorejoin = on\n");
|
||||
weechat_iconv_fprintf (file, "server_notify_levels = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
weechat_iconv_fprintf (file, "server_charset_encode = \"\"\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
@@ -2406,57 +2369,57 @@ config_write (char *config_name)
|
||||
weechat_log_printf (_("Saving config to disk\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
weechat_iconv_fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
weechat_iconv_fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
weechat_iconv_fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int &&
|
||||
*weechat_options[i][j].ptr_int) ?
|
||||
"on" : "off");
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int &&
|
||||
*weechat_options[i][j].ptr_int) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
*weechat_options[i][j].ptr_int :
|
||||
weechat_options[i][j].default_int);
|
||||
weechat_iconv_fprintf (file, "%s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
*weechat_options[i][j].ptr_int :
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
|
||||
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
|
||||
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
gui_color_get_name (*weechat_options[i][j].ptr_int) :
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
gui_color_get_name (*weechat_options[i][j].ptr_int) :
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_string) ?
|
||||
*weechat_options[i][j].ptr_string :
|
||||
weechat_options[i][j].default_string);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_string) ?
|
||||
*weechat_options[i][j].ptr_string :
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2464,7 +2427,7 @@ config_write (char *config_name)
|
||||
}
|
||||
|
||||
/* keys section */
|
||||
fprintf (file, "\n[keys]\n");
|
||||
weechat_iconv_fprintf (file, "\n[keys]\n");
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
|
||||
@@ -2472,37 +2435,37 @@ config_write (char *config_name)
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
}
|
||||
else
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
ptr_key->command);
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
|
||||
/* alias section */
|
||||
fprintf (file, "\n[alias]\n");
|
||||
weechat_iconv_fprintf (file, "\n[alias]\n");
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_alias->alias_name, ptr_alias->alias_command);
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
ptr_alias->alias_name, ptr_alias->alias_command);
|
||||
}
|
||||
|
||||
/* ignore section */
|
||||
fprintf (file, "\n[ignore]\n");
|
||||
weechat_iconv_fprintf (file, "\n[ignore]\n");
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
fprintf (file, "ignore = \"%s,%s,%s,%s\"\n",
|
||||
ptr_ignore->mask,
|
||||
ptr_ignore->type,
|
||||
ptr_ignore->channel_name,
|
||||
ptr_ignore->server_name);
|
||||
weechat_iconv_fprintf (file, "ignore = \"%s,%s,%s,%s\"\n",
|
||||
ptr_ignore->mask,
|
||||
ptr_ignore->type,
|
||||
ptr_ignore->channel_name,
|
||||
ptr_ignore->server_name);
|
||||
}
|
||||
|
||||
/* server section */
|
||||
@@ -2511,44 +2474,38 @@ config_write (char *config_name)
|
||||
{
|
||||
if (!ptr_server->command_line)
|
||||
{
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
|
||||
fprintf (file, "server_autoconnect = %s\n",
|
||||
(ptr_server->autoconnect) ? "on" : "off");
|
||||
fprintf (file, "server_autoreconnect = %s\n",
|
||||
(ptr_server->autoreconnect) ? "on" : "off");
|
||||
fprintf (file, "server_autoreconnect_delay = %d\n",
|
||||
ptr_server->autoreconnect_delay);
|
||||
fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
|
||||
fprintf (file, "server_port = %d\n", ptr_server->port);
|
||||
fprintf (file, "server_ipv6 = %s\n",
|
||||
(ptr_server->ipv6) ? "on" : "off");
|
||||
fprintf (file, "server_ssl = %s\n",
|
||||
(ptr_server->ssl) ? "on" : "off");
|
||||
fprintf (file, "server_password = \"%s\"\n",
|
||||
(ptr_server->password) ? ptr_server->password : "");
|
||||
fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
|
||||
fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
|
||||
fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
|
||||
fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
|
||||
fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
|
||||
fprintf (file, "server_hostname = \"%s\"\n",
|
||||
(ptr_server->hostname) ? ptr_server->hostname : "");
|
||||
fprintf (file, "server_command = \"%s\"\n",
|
||||
(ptr_server->command) ? ptr_server->command : "");
|
||||
fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
|
||||
fprintf (file, "server_autojoin = \"%s\"\n",
|
||||
(ptr_server->autojoin) ? ptr_server->autojoin : "");
|
||||
fprintf (file, "server_autorejoin = %s\n",
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
fprintf (file, "server_charset_decode_iso = \"%s\"\n",
|
||||
(ptr_server->charset_decode_iso) ? ptr_server->charset_decode_iso : "");
|
||||
fprintf (file, "server_charset_decode_utf = \"%s\"\n",
|
||||
(ptr_server->charset_decode_utf) ? ptr_server->charset_decode_utf : "");
|
||||
fprintf (file, "server_charset_encode = \"%s\"\n",
|
||||
(ptr_server->charset_encode) ? ptr_server->charset_encode : "");
|
||||
weechat_iconv_fprintf (file, "\n[server]\n");
|
||||
weechat_iconv_fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
|
||||
weechat_iconv_fprintf (file, "server_autoconnect = %s\n",
|
||||
(ptr_server->autoconnect) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect = %s\n",
|
||||
(ptr_server->autoreconnect) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_autoreconnect_delay = %d\n",
|
||||
ptr_server->autoreconnect_delay);
|
||||
weechat_iconv_fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
|
||||
weechat_iconv_fprintf (file, "server_port = %d\n", ptr_server->port);
|
||||
weechat_iconv_fprintf (file, "server_ipv6 = %s\n",
|
||||
(ptr_server->ipv6) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_ssl = %s\n",
|
||||
(ptr_server->ssl) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_password = \"%s\"\n",
|
||||
(ptr_server->password) ? ptr_server->password : "");
|
||||
weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
|
||||
weechat_iconv_fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
|
||||
weechat_iconv_fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
|
||||
weechat_iconv_fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
|
||||
weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
|
||||
weechat_iconv_fprintf (file, "server_hostname = \"%s\"\n",
|
||||
(ptr_server->hostname) ? ptr_server->hostname : "");
|
||||
weechat_iconv_fprintf (file, "server_command = \"%s\"\n",
|
||||
(ptr_server->command) ? ptr_server->command : "");
|
||||
weechat_iconv_fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
|
||||
weechat_iconv_fprintf (file, "server_autojoin = \"%s\"\n",
|
||||
(ptr_server->autojoin) ? ptr_server->autojoin : "");
|
||||
weechat_iconv_fprintf (file, "server_autorejoin = %s\n",
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
weechat_iconv_fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +92,6 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode_iso;
|
||||
extern char *cfg_look_charset_decode_utf;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_one_server_buffer;
|
||||
extern int cfg_look_open_near_server;
|
||||
extern int cfg_look_scroll_amount;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "gui-curses.h"
|
||||
@@ -186,9 +187,7 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
if (CHANNEL(buffer)->topic)
|
||||
{
|
||||
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
|
||||
buf2 = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
buf2 = weechat_iconv_from_internal (NULL, (buf) ? buf : CHANNEL(buffer)->topic);
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_title, 0, 0,
|
||||
format, (buf2) ? buf2 : CHANNEL(buffer)->topic);
|
||||
if (buf)
|
||||
@@ -429,7 +428,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
|
||||
void
|
||||
gui_chat_display_word_raw (t_gui_window *window, char *string)
|
||||
{
|
||||
char *prev_char, *next_char, saved_char;
|
||||
char *prev_char, *next_char, saved_char, *output;
|
||||
|
||||
wmove (GUI_CURSES(window)->win_chat,
|
||||
window->win_chat_cursor_y,
|
||||
@@ -446,10 +445,15 @@ gui_chat_display_word_raw (t_gui_window *window, char *string)
|
||||
{
|
||||
saved_char = next_char[0];
|
||||
next_char[0] = '\0';
|
||||
if (((signed char)(prev_char[0]) == -110) && (!prev_char[1]))
|
||||
if (((unsigned char)(prev_char[0]) == 146) && (!prev_char[1]))
|
||||
wprintw (GUI_CURSES(window)->win_chat, ".");
|
||||
else
|
||||
wprintw (GUI_CURSES(window)->win_chat, "%s", prev_char);
|
||||
{
|
||||
output = weechat_iconv_from_internal (NULL, prev_char);
|
||||
wprintw (GUI_CURSES(window)->win_chat, "%s", (output) ? output : prev_char);
|
||||
if (output)
|
||||
free (output);
|
||||
}
|
||||
next_char[0] = saved_char;
|
||||
}
|
||||
|
||||
@@ -921,12 +925,14 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_chat, i, 0, "%s %-16s ",
|
||||
(ptr_dcc == dcc_selected) ? "***" : " ",
|
||||
ptr_dcc->nick);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%s", buf);
|
||||
free (buf);
|
||||
buf = weechat_iconv_from_internal (NULL,
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%s",
|
||||
(buf) ? buf : ((DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename));
|
||||
if (buf)
|
||||
free (buf);
|
||||
if (DCC_IS_FILE(ptr_dcc->type))
|
||||
{
|
||||
if (ptr_dcc->filename_suffix > 0)
|
||||
@@ -943,11 +949,11 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--");
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%-10s", buf);
|
||||
free (buf);
|
||||
buf = weechat_iconv_from_internal (NULL, _(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, "%-10s",
|
||||
(buf) ? buf : _(dcc_status_string[ptr_dcc->status]));
|
||||
if (buf)
|
||||
free (buf);
|
||||
|
||||
/* other infos */
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_chat,
|
||||
@@ -1016,13 +1022,12 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
unit_name[num_unit]);
|
||||
buf = weechat_iconv_from_internal (NULL, unit_name[num_unit]);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_chat, format,
|
||||
((float)ptr_dcc->bytes_per_sec) / ((float)(unit_divide[num_unit])),
|
||||
buf);
|
||||
free (buf);
|
||||
(buf) ? buf : unit_name[num_unit]);
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user