mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 16:45:42 +02:00
Add new plugin "relay", new function "string_format_size" in plugin API
This commit is contained in:
@@ -49,6 +49,7 @@ OPTION(DISABLE_FIFO "Disable FIFO plugin")
|
||||
OPTION(DISABLE_IRC "Disable IRC plugin")
|
||||
OPTION(DISABLE_LOGGER "Disable Logger plugin")
|
||||
OPTION(DISABLE_NOTIFY "Disable Notify plugin")
|
||||
OPTION(DISABLE_RELAY "Disable Relay plugin")
|
||||
OPTION(DISABLE_SCRIPTS "Disable script plugins")
|
||||
OPTION(DISABLE_PERL "Disable Perl scripting language")
|
||||
OPTION(DISABLE_PYTHON "Disable Python scripting language")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2008-11-23
|
||||
ChangeLog - 2008-12-10
|
||||
|
||||
|
||||
Version 0.2.7 (under dev!):
|
||||
* new relay plugin (network communication between WeeChat and remote
|
||||
application)
|
||||
* add support for more than one proxy, with proxy selection for each IRC
|
||||
server (task #6859)
|
||||
* add smart join/part/quit message filter in IRC plugin (task #8503)
|
||||
@@ -48,7 +50,7 @@ Version 0.2.7 (under dev!):
|
||||
* add /reload command to reload WeeChat and plugins config files
|
||||
(signal SIGHUP is catched to reload config files)
|
||||
* new plugins: alias, debug, demo, fifo, irc, logger, notify, tcl, trigger,
|
||||
xfer
|
||||
xfer, relay
|
||||
* add hooks: command, timer, file descriptor, connection, print, signal,
|
||||
config, completion, modifier, info, infolist
|
||||
* new plugin API with many new functions: hooks, buffer management, bars,
|
||||
|
||||
@@ -101,6 +101,7 @@ AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
|
||||
AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC])
|
||||
AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER])
|
||||
AH_VERBATIM([PLUGIN_NOTIFY], [#undef PLUGIN_NOTIFY])
|
||||
AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
@@ -126,6 +127,7 @@ AC_ARG_ENABLE(fifo, [ --disable-fifo turn off Fifo plugin (def
|
||||
AC_ARG_ENABLE(irc, [ --disable-irc turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes)
|
||||
AC_ARG_ENABLE(logger, [ --disable-logger turn off Logger plugin (default=compiled)],enable_logger=$enableval,enable_logger=yes)
|
||||
AC_ARG_ENABLE(notify, [ --disable-notify turn off Notify plugin (default=compiled)],enable_notify=$enableval,enable_notify=yes)
|
||||
AC_ARG_ENABLE(relay, [ --disable-relay turn off Relay plugin (default=compiled)],enable_relay=$enableval,enable_relay=yes)
|
||||
AC_ARG_ENABLE(scripts, [ --disable-scripts turn off script plugins (default=compiled if found)],enable_scripts=$enableval,enable_scripts=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)
|
||||
@@ -396,6 +398,18 @@ else
|
||||
not_asked="$not_asked notify"
|
||||
fi
|
||||
|
||||
# --------------------------------- relay --------------------------------------
|
||||
|
||||
if test "x$enable_relay" = "xyes" ; then
|
||||
RELAY_CFLAGS=""
|
||||
RELAY_LFLAGS=""
|
||||
AC_SUBST(RELAY_CFLAGS)
|
||||
AC_SUBST(RELAY_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_RELAY)
|
||||
else
|
||||
not_asked="$not_asked relay"
|
||||
fi
|
||||
|
||||
# ---------------------------------- perl --------------------------------------
|
||||
|
||||
PERL_VERSION=
|
||||
@@ -961,6 +975,7 @@ AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_NOTIFY, test "$enable_notify" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
@@ -991,6 +1006,7 @@ AC_OUTPUT([Makefile
|
||||
src/plugins/irc/Makefile
|
||||
src/plugins/logger/Makefile
|
||||
src/plugins/notify/Makefile
|
||||
src/plugins/relay/Makefile
|
||||
src/plugins/scripts/Makefile
|
||||
src/plugins/scripts/perl/Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
@@ -1056,6 +1072,9 @@ fi
|
||||
if test "x$enable_notify" = "xyes"; then
|
||||
listplugins="$listplugins notify"
|
||||
fi
|
||||
if test "x$enable_relay" = "xyes"; then
|
||||
listplugins="$listplugins relay"
|
||||
fi
|
||||
if test "x$enable_perl" = "xyes"; then
|
||||
listplugins="$listplugins perl($PERL_VERSION)"
|
||||
fi
|
||||
|
||||
Vendored
+1
-1
@@ -54,7 +54,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, weechat-curses (= ${binary:Version}
|
||||
Suggests: weechat-scripts
|
||||
Description: Plugins for WeeChat
|
||||
This package provides some plugins to enhance WeeChat. It currently ships
|
||||
the following plugins: Perl, Python, Ruby, Lua, Tcl, Aspell and Fifo.
|
||||
the following plugins: Perl, Python, Ruby, Lua, Tcl, Aspell, Relay and Fifo.
|
||||
|
||||
Package: weechat-doc
|
||||
Section: doc
|
||||
|
||||
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
usr/lib/weechat/plugins/aspell.so
|
||||
usr/lib/weechat/plugins/fifo.so
|
||||
usr/lib/weechat/plugins/relay.so
|
||||
usr/lib/weechat/plugins/perl.so
|
||||
usr/lib/weechat/plugins/python.so
|
||||
usr/lib/weechat/plugins/ruby.so
|
||||
usr/lib/weechat/plugins/lua.so
|
||||
usr/lib/weechat/plugins/aspell.so
|
||||
usr/lib/weechat/plugins/tcl.so
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<command>/relay</command>
|
||||
<programlisting>
|
||||
relay control
|
||||
|
||||
Open buffer with relay clients list
|
||||
</programlisting>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<row>
|
||||
<entry>infolist</entry>
|
||||
<entry>relay</entry>
|
||||
<entry>list of relay clients</entry>
|
||||
</row>
|
||||
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -66,10 +66,10 @@ my %plugin_list = ("weechat" => "co", "alias" => "",
|
||||
"aspell" => "o", "charset" => "co",
|
||||
"demo" => "co", "fifo" => "co",
|
||||
"irc" => "co", "logger" => "co",
|
||||
"notify" => "co", "perl" => "",
|
||||
"python" => "", "ruby" => "",
|
||||
"lua" => "", "tcl" => "",
|
||||
"xfer" => "co");
|
||||
"notify" => "co", "relay" => "co",
|
||||
"perl" => "", "python" => "",
|
||||
"ruby" => "", "lua" => "",
|
||||
"tcl" => "", "xfer" => "co");
|
||||
|
||||
# options to ignore
|
||||
my @ignore_options = ("aspell\\.dict\\..*",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<command>/relay</command>
|
||||
<programlisting>
|
||||
relay control
|
||||
|
||||
Open buffer with relay clients list
|
||||
</programlisting>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<row>
|
||||
<entry>infolist</entry>
|
||||
<entry>relay</entry>
|
||||
<entry>list of relay clients</entry>
|
||||
</row>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<command>/relay</command>
|
||||
<programlisting>
|
||||
contrôle du relai
|
||||
|
||||
Ouverture du tampon avec la liste des clients pour le relai
|
||||
</programlisting>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
********* WARNING! *********
|
||||
|
||||
This file is autogenerated with docgen.pl script. *** DO NOT EDIT! ***
|
||||
docgen.pl builds XML doc files to include in many languages
|
||||
-->
|
||||
|
||||
<row>
|
||||
<entry>infolist</entry>
|
||||
<entry>relay</entry>
|
||||
<entry>liste des clients pour le relai</entry>
|
||||
</row>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@
|
||||
<!ENTITY notify_commands.xml SYSTEM "autogen/notify_commands.xml">
|
||||
<!ENTITY perl_commands.xml SYSTEM "autogen/perl_commands.xml">
|
||||
<!ENTITY python_commands.xml SYSTEM "autogen/python_commands.xml">
|
||||
<!ENTITY relay_commands.xml SYSTEM "autogen/relay_commands.xml">
|
||||
<!ENTITY ruby_commands.xml SYSTEM "autogen/ruby_commands.xml">
|
||||
<!ENTITY tcl_commands.xml SYSTEM "autogen/tcl_commands.xml">
|
||||
<!ENTITY weechat_commands.xml SYSTEM "autogen/weechat_commands.xml">
|
||||
@@ -21,6 +22,7 @@
|
||||
<!ENTITY charset_options.xml SYSTEM "autogen/charset_options.xml">
|
||||
<!ENTITY irc_options.xml SYSTEM "autogen/irc_options.xml">
|
||||
<!ENTITY logger_options.xml SYSTEM "autogen/logger_options.xml">
|
||||
<!ENTITY relay_options.xml SYSTEM "autogen/relay_options.xml">
|
||||
<!ENTITY weechat_options.xml SYSTEM "autogen/weechat_options.xml">
|
||||
<!ENTITY xfer_options.xml SYSTEM "autogen/xfer_options.xml">
|
||||
|
||||
@@ -30,5 +32,6 @@
|
||||
<!ENTITY fifo_infos.xml SYSTEM "autogen/fifo_infos.xml">
|
||||
<!ENTITY irc_infos.xml SYSTEM "autogen/irc_infos.xml">
|
||||
<!ENTITY logger_infos.xml SYSTEM "autogen/logger_infos.xml">
|
||||
<!ENTITY relay_infos.xml SYSTEM "autogen/relay_infos.xml">
|
||||
<!ENTITY weechat_infos.xml SYSTEM "autogen/weechat_infos.xml">
|
||||
<!ENTITY xfer_infos.xml SYSTEM "autogen/xfer_infos.xml">
|
||||
|
||||
@@ -148,6 +148,22 @@
|
||||
./src/plugins/plugin-config.c
|
||||
./src/plugins/plugin-config.h
|
||||
./src/plugins/plugin.h
|
||||
./src/plugins/relay/relay-buffer.c
|
||||
./src/plugins/relay/relay-buffer.h
|
||||
./src/plugins/relay/relay.c
|
||||
./src/plugins/relay/relay-client.c
|
||||
./src/plugins/relay/relay-client.h
|
||||
./src/plugins/relay/relay-command.c
|
||||
./src/plugins/relay/relay-command.h
|
||||
./src/plugins/relay/relay-config.c
|
||||
./src/plugins/relay/relay-config.h
|
||||
./src/plugins/relay/relay.h
|
||||
./src/plugins/relay/relay-info.c
|
||||
./src/plugins/relay/relay-info.h
|
||||
./src/plugins/relay/relay-network.c
|
||||
./src/plugins/relay/relay-network.h
|
||||
./src/plugins/relay/relay-upgrade.c
|
||||
./src/plugins/relay/relay-upgrade.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
./src/plugins/scripts/lua/weechat-lua-api.h
|
||||
./src/plugins/scripts/lua/weechat-lua.c
|
||||
|
||||
@@ -149,6 +149,22 @@ SET(WEECHAT_SOURCES
|
||||
./src/plugins/plugin-config.c
|
||||
./src/plugins/plugin-config.h
|
||||
./src/plugins/plugin.h
|
||||
./src/plugins/relay/relay-buffer.c
|
||||
./src/plugins/relay/relay-buffer.h
|
||||
./src/plugins/relay/relay.c
|
||||
./src/plugins/relay/relay-client.c
|
||||
./src/plugins/relay/relay-client.h
|
||||
./src/plugins/relay/relay-command.c
|
||||
./src/plugins/relay/relay-command.h
|
||||
./src/plugins/relay/relay-config.c
|
||||
./src/plugins/relay/relay-config.h
|
||||
./src/plugins/relay/relay.h
|
||||
./src/plugins/relay/relay-info.c
|
||||
./src/plugins/relay/relay-info.h
|
||||
./src/plugins/relay/relay-network.c
|
||||
./src/plugins/relay/relay-network.h
|
||||
./src/plugins/relay/relay-upgrade.c
|
||||
./src/plugins/relay/relay-upgrade.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
./src/plugins/scripts/lua/weechat-lua-api.h
|
||||
./src/plugins/scripts/lua/weechat-lua.c
|
||||
|
||||
+154
-38
File diff suppressed because it is too large
Load Diff
@@ -1244,3 +1244,39 @@ string_iconv_fprintf (FILE *file, const char *data, ...)
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* string_format_size: format a string with size and unit name (bytes, KB, MB, GB)
|
||||
* note: returned value has to be free() after use
|
||||
*/
|
||||
|
||||
char *
|
||||
string_format_size (unsigned long size)
|
||||
{
|
||||
char *unit_name[] = { N_("bytes"), N_("KB"), N_("MB"), N_("GB") };
|
||||
char *unit_format[] = { "%.0f", "%.1f", "%.02f", "%.02f" };
|
||||
float unit_divide[] = { 1, 1024, 1024*1024, 1024*1024*1024 };
|
||||
char format_size[128], str_size[128];
|
||||
int num_unit;
|
||||
|
||||
str_size[0] = '\0';
|
||||
|
||||
if (size < 1024*10)
|
||||
num_unit = 0;
|
||||
else if (size < 1024*1024)
|
||||
num_unit = 1;
|
||||
else if (size < 1024*1024*1024)
|
||||
num_unit = 2;
|
||||
else
|
||||
num_unit = 3;
|
||||
|
||||
snprintf (format_size, sizeof (format_size),
|
||||
"%s %%s",
|
||||
unit_format[num_unit]);
|
||||
snprintf (str_size, sizeof (str_size),
|
||||
format_size,
|
||||
((float)size) / ((float)(unit_divide[num_unit])),
|
||||
(size <= 1) ? _("byte") : _(unit_name[num_unit]));
|
||||
|
||||
return strdup (str_size);
|
||||
}
|
||||
|
||||
@@ -55,5 +55,6 @@ extern char *string_iconv_to_internal (const char *charset, const char *string);
|
||||
extern char *string_iconv_from_internal (const char *charset,
|
||||
const char *string);
|
||||
extern void string_iconv_fprintf (FILE *file, const char *data, ...);
|
||||
extern char *string_format_size (unsigned long size);
|
||||
|
||||
#endif /* wee-string.h */
|
||||
|
||||
@@ -1156,9 +1156,6 @@ gui_buffer_clear (struct t_gui_buffer *buffer)
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
/* remove buffer from hotlist */
|
||||
gui_hotlist_remove_buffer (buffer);
|
||||
|
||||
/* remove all lines */
|
||||
gui_chat_line_free_all (buffer);
|
||||
|
||||
|
||||
@@ -66,6 +66,10 @@ IF(NOT DISABLE_NOTIFY)
|
||||
ADD_SUBDIRECTORY( notify )
|
||||
ENDIF(NOT DISABLE_NOTIFY)
|
||||
|
||||
IF(NOT DISABLE_RELAY)
|
||||
ADD_SUBDIRECTORY( relay )
|
||||
ENDIF(NOT DISABLE_RELAY)
|
||||
|
||||
IF(NOT DISABLE_SCRIPTS AND NOT DISABLE_PERL AND NOT DISABLE_PYTHON AND NOT DISABLE_RUBY AND NOT DISABLE_LUA AND NOT DISABLE_TCL)
|
||||
ADD_SUBDIRECTORY( scripts )
|
||||
ENDIF(NOT DISABLE_SCRIPTS AND NOT DISABLE_PERL AND NOT DISABLE_PYTHON AND NOT DISABLE_RUBY AND NOT DISABLE_LUA AND NOT DISABLE_TCL)
|
||||
|
||||
@@ -58,6 +58,10 @@ if PLUGIN_NOTIFY
|
||||
notify_dir = notify
|
||||
endif
|
||||
|
||||
if PLUGIN_RELAY
|
||||
relay_dir = relay
|
||||
endif
|
||||
|
||||
if PLUGIN_PERL
|
||||
script_dir = scripts
|
||||
endif
|
||||
@@ -87,5 +91,5 @@ xfer_dir = xfer
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(alias_dir) $(aspell_dir) $(charset_dir) $(demo_dir) $(fifo_dir) \
|
||||
$(irc_dir) $(logger_dir) $(notify_dir) $(script_dir) \
|
||||
$(irc_dir) $(logger_dir) $(notify_dir) $(relay_dir) $(script_dir) \
|
||||
$(trigger_dir) $(xfer_dir)
|
||||
|
||||
@@ -346,6 +346,7 @@ plugin_load (const char *filename)
|
||||
new_plugin->string_build_with_exploded = &string_build_with_exploded;
|
||||
new_plugin->string_split_command = &string_split_command;
|
||||
new_plugin->string_free_splitted_command = &string_free_splitted_command;
|
||||
new_plugin->string_format_size = &string_format_size;
|
||||
|
||||
new_plugin->utf8_has_8bits = &utf8_has_8bits;
|
||||
new_plugin->utf8_is_valid = &utf8_is_valid;
|
||||
@@ -829,9 +830,6 @@ plugin_reload_name (const char *name)
|
||||
if (filename)
|
||||
{
|
||||
plugin_unload (ptr_plugin);
|
||||
gui_chat_printf (NULL,
|
||||
_("Plugin \"%s\" unloaded"),
|
||||
name);
|
||||
plugin_load (filename);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
ADD_LIBRARY(relay MODULE
|
||||
relay.c relay.h
|
||||
relay-buffer.c relay-buffer.h
|
||||
relay-client.c relay-client.h
|
||||
relay-command.c relay-command.h
|
||||
relay-config.c relay-config.h
|
||||
relay-info.c relay-info.h
|
||||
relay-network.c relay-network.h
|
||||
relay-upgrade.c relay-upgrade.h)
|
||||
SET_TARGET_PROPERTIES(relay PROPERTIES PREFIX "")
|
||||
|
||||
TARGET_LINK_LIBRARIES(relay)
|
||||
|
||||
INSTALL(TARGETS relay LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
|
||||
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = relay.la
|
||||
|
||||
relay_la_SOURCES = relay.c \
|
||||
relay.h \
|
||||
relay-buffer.c \
|
||||
relay-buffer.h \
|
||||
relay-client.c \
|
||||
relay-client.h \
|
||||
relay-command.c \
|
||||
relay-command.h \
|
||||
relay-config.c \
|
||||
relay-config.h \
|
||||
relay-info.c \
|
||||
relay-info.h \
|
||||
relay-network.c \
|
||||
relay-network.h \
|
||||
relay-upgrade.c \
|
||||
relay-upgrade.h
|
||||
|
||||
relau_la_LDFLAGS = -module
|
||||
relay_la_LIBADD = $(RELAY_LFLAGS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_DISPLAY_H
|
||||
#define __WEECHAT_RELAY_DISPLAY_H 1
|
||||
|
||||
extern struct t_gui_buffer *relay_buffer;
|
||||
extern int relay_buffer_selected_line;
|
||||
|
||||
extern void relay_buffer_refresh (const char *hotlist);
|
||||
extern int relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
|
||||
const char *input_data);
|
||||
extern int relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
|
||||
extern void relay_buffer_open ();
|
||||
|
||||
#endif /* relay-buffer.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_CLIENT_H
|
||||
#define __WEECHAT_RELAY_CLIENT_H 1
|
||||
|
||||
/* relay status */
|
||||
|
||||
enum t_relay_status
|
||||
{
|
||||
RELAY_STATUS_CONNECTING = 0, /* connecting to client */
|
||||
RELAY_STATUS_WAITING_AUTH, /* waiting AUTH from client */
|
||||
RELAY_STATUS_CONNECTED, /* connected to client */
|
||||
RELAY_STATUS_AUTH_FAILED, /* AUTH failed with client */
|
||||
RELAY_STATUS_DISCONNECTED, /* disconnected from client */
|
||||
/* number of relay status */
|
||||
RELAY_NUM_STATUS,
|
||||
};
|
||||
|
||||
/* macros for status */
|
||||
|
||||
#define RELAY_CLIENT_HAS_ENDED(status) ((status == RELAY_STATUS_AUTH_FAILED) || \
|
||||
(status == RELAY_STATUS_DISCONNECTED))
|
||||
|
||||
/* relay client */
|
||||
|
||||
struct t_relay_client
|
||||
{
|
||||
int sock; /* socket for connection */
|
||||
char *address; /* string with IP address */
|
||||
enum t_relay_status status; /* status (connecting, active,..) */
|
||||
time_t start_time; /* time of client connection */
|
||||
struct t_hook *hook_fd; /* hook for socket or child pipe */
|
||||
struct t_hook *hook_timer; /* timeout for recever accept */
|
||||
time_t last_activity; /* time of last byte received/sent */
|
||||
unsigned long bytes_recv; /* bytes received from client */
|
||||
unsigned long bytes_sent; /* bytes sent to client */
|
||||
struct t_relay_client *prev_client;/* link to previous client */
|
||||
struct t_relay_client *next_client;/* link to next client */
|
||||
};
|
||||
|
||||
extern char *relay_client_status_string[];
|
||||
extern struct t_relay_client *relay_clients;
|
||||
extern struct t_relay_client *last_relay_client;
|
||||
extern int relay_client_count;
|
||||
|
||||
extern int relay_client_valid (struct t_relay_client *client);
|
||||
extern struct t_relay_client *relay_client_search_by_number (int number);
|
||||
extern struct t_relay_client *relay_client_new (int sock, char *address);
|
||||
extern void relay_client_set_status (struct t_relay_client *client,
|
||||
enum t_relay_status status);
|
||||
extern void relay_client_free (struct t_relay_client *client);
|
||||
extern void relay_client_disconnect (struct t_relay_client *client);
|
||||
extern void relay_client_disconnect_all ();
|
||||
extern int relay_client_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_relay_client *client);
|
||||
extern void relay_client_print_log ();
|
||||
|
||||
#endif /* relay-client.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_COMMAND_H
|
||||
#define __WEECHAT_RELAY_COMMAND_H 1
|
||||
|
||||
extern void relay_command_init ();
|
||||
|
||||
#endif /* relay-command.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_CONFIG_H
|
||||
#define __WEECHAT_RELAY_CONFIG_H 1
|
||||
|
||||
#define RELAY_CONFIG_NAME "relay"
|
||||
|
||||
extern struct t_config_file *relay_config;
|
||||
|
||||
extern struct t_config_option *relay_config_look_auto_open_buffer;
|
||||
|
||||
extern struct t_config_option *relay_config_color_text;
|
||||
extern struct t_config_option *relay_config_color_text_bg;
|
||||
extern struct t_config_option *relay_config_color_text_selected;
|
||||
extern struct t_config_option *relay_config_color_status[];
|
||||
|
||||
extern struct t_config_option *relay_config_network_listen_port_range;
|
||||
|
||||
extern int relay_config_init ();
|
||||
extern int relay_config_read ();
|
||||
extern int relay_config_write ();
|
||||
|
||||
#endif /* relay-config.h */
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* relay-info.c: info and infolist hooks for relay plugin */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
#include "relay-client.h"
|
||||
|
||||
|
||||
/*
|
||||
* relay_info_get_infolist_cb: callback called when relay infolist is asked
|
||||
*/
|
||||
|
||||
struct t_infolist *
|
||||
relay_info_get_infolist_cb (void *data, const char *infolist_name,
|
||||
void *pointer, const char *arguments)
|
||||
{
|
||||
struct t_infolist *ptr_infolist;
|
||||
struct t_relay_client *ptr_client;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "relay") == 0)
|
||||
{
|
||||
if (pointer && !relay_client_valid (pointer))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = weechat_infolist_new ();
|
||||
if (ptr_infolist)
|
||||
{
|
||||
if (pointer)
|
||||
{
|
||||
/* build list with only one relay */
|
||||
if (!relay_client_add_to_infolist (ptr_infolist, pointer))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
return ptr_infolist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all relays */
|
||||
for (ptr_client = relay_clients; ptr_client;
|
||||
ptr_client = ptr_client->next_client)
|
||||
{
|
||||
if (!relay_client_add_to_infolist (ptr_infolist, ptr_client))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* relay_info_init: initialize info and infolist hooks for relay plugin
|
||||
*/
|
||||
|
||||
void
|
||||
relay_info_init ()
|
||||
{
|
||||
/* relay infolist hooks */
|
||||
weechat_hook_infolist ("relay", N_("list of relay clients"),
|
||||
&relay_info_get_infolist_cb, NULL);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_INFO_H
|
||||
#define __WEECHAT_RELAY_INFO_H 1
|
||||
|
||||
extern void relay_info_init ();
|
||||
|
||||
#endif /* relay-info.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_NETWORK_H
|
||||
#define __WEECHAT_RELAY_NETWORK_H 1
|
||||
|
||||
extern int relay_network_init ();
|
||||
extern void relay_network_end ();
|
||||
|
||||
#endif /* relay-network.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_UPGRADE_H
|
||||
#define __WEECHAT_RELAY_UPGRADE_H 1
|
||||
|
||||
#define RELAY_UPGRADE_FILENAME "relay"
|
||||
|
||||
/* For developers: please add new values ONLY AT THE END of enums */
|
||||
|
||||
enum t_relay_upgrade_type
|
||||
{
|
||||
RELAY_UPGRADE_TYPE_RELAY = 0,
|
||||
};
|
||||
|
||||
extern int relay_upgrade_save ();
|
||||
extern int relay_upgrade_load ();
|
||||
|
||||
#endif /* relay-upgrade.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2008 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_RELAY_H
|
||||
#define __WEECHAT_RELAY_H 1
|
||||
|
||||
#define weechat_plugin weechat_relay_plugin
|
||||
#define RELAY_PLUGIN_NAME "relay"
|
||||
|
||||
extern struct t_weechat_plugin *weechat_relay_plugin;
|
||||
|
||||
#endif /* relay.h */
|
||||
@@ -155,6 +155,7 @@ struct t_weechat_plugin
|
||||
const char *separator);
|
||||
char **(*string_split_command) (const char *command, char separator);
|
||||
void (*string_free_splitted_command) (char **splitted_command);
|
||||
char *(*string_format_size) (unsigned long size);
|
||||
|
||||
/* UTF-8 strings */
|
||||
int (*utf8_has_8bits) (const char *string);
|
||||
@@ -651,6 +652,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->string_split_command(__command, __separator)
|
||||
#define weechat_string_free_splitted_command(__splitted_command) \
|
||||
weechat_plugin->string_free_splitted_command(__splitted_command)
|
||||
#define weechat_string_format_size(__size) \
|
||||
weechat_plugin->string_format_size(__size)
|
||||
|
||||
/* UTF-8 strings */
|
||||
#define weechat_utf8_has_8bits(__string) \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -189,7 +189,7 @@ xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
}
|
||||
|
||||
/*
|
||||
* xfer_command: xfer command
|
||||
* xfer_command_init: add /xfer command
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -197,7 +197,10 @@ xfer_command_init ()
|
||||
{
|
||||
weechat_hook_command ("xfer",
|
||||
N_("xfer control"),
|
||||
"",
|
||||
N_("Open buffer with xfer list"),
|
||||
"[list | listfull]",
|
||||
N_(" list: list xfer\n"
|
||||
"listfull: list xfer (verbose)\n\n"
|
||||
"Without argument, this command opens buffer "
|
||||
"with xfer list."),
|
||||
"list|listfull", &xfer_command_xfer, NULL);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ xfer_network_send_file_fork (struct t_xfer *xfer)
|
||||
xfer->child_pid = pid;
|
||||
xfer->hook_fd = weechat_hook_fd (xfer->child_read,
|
||||
1, 0, 0,
|
||||
xfer_network_child_read_cb,
|
||||
&xfer_network_child_read_cb,
|
||||
xfer);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ xfer_network_recv_file_fork (struct t_xfer *xfer)
|
||||
xfer->child_pid = pid;
|
||||
xfer->hook_fd = weechat_hook_fd (xfer->child_read,
|
||||
1, 0, 0,
|
||||
xfer_network_child_read_cb,
|
||||
&xfer_network_child_read_cb,
|
||||
xfer);
|
||||
}
|
||||
|
||||
|
||||
@@ -1277,7 +1277,7 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer)
|
||||
}
|
||||
|
||||
/*
|
||||
* xfer_print_log: print DCC infos in log (usually for crash dump)
|
||||
* xfer_print_log: print xfer infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -1294,6 +1294,9 @@ xfer_print_log ()
|
||||
weechat_log_printf (" type. . . . . . . . : %d (%s)",
|
||||
ptr_xfer->type,
|
||||
xfer_type_string[ptr_xfer->type]);
|
||||
weechat_log_printf (" protocol. . . . . . : %d (%s)",
|
||||
ptr_xfer->protocol,
|
||||
xfer_protocol_string[ptr_xfer->protocol]);
|
||||
weechat_log_printf (" remote_nick . . . . : '%s'", ptr_xfer->remote_nick);
|
||||
weechat_log_printf (" local_nick. . . . . : '%s'", ptr_xfer->local_nick);
|
||||
weechat_log_printf (" filename. . . . . . : '%s'", ptr_xfer->filename);
|
||||
@@ -1314,6 +1317,8 @@ xfer_print_log ()
|
||||
weechat_log_printf (" child_pid . . . . . : %d", ptr_xfer->child_pid);
|
||||
weechat_log_printf (" child_read. . . . . : %d", ptr_xfer->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d", ptr_xfer->child_write);
|
||||
weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_xfer->hook_fd);
|
||||
weechat_log_printf (" hook_timer. . . . . : 0x%lx", ptr_xfer->hook_timer);
|
||||
weechat_log_printf (" unterminated_message: '%s'", ptr_xfer->unterminated_message);
|
||||
weechat_log_printf (" file. . . . . . . . : %d", ptr_xfer->file);
|
||||
weechat_log_printf (" local_filename. . . : '%s'", ptr_xfer->local_filename);
|
||||
@@ -1380,7 +1385,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
xfer_create_directories ();
|
||||
|
||||
xfer_command_init ();
|
||||
|
||||
|
||||
weechat_hook_signal ("upgrade", &xfer_signal_upgrade_cb, NULL);
|
||||
weechat_hook_signal ("xfer_add", &xfer_add_cb, NULL);
|
||||
weechat_hook_signal ("xfer_start_resume", &xfer_start_resume_cb, NULL);
|
||||
weechat_hook_signal ("xfer_accept_resume", &xfer_accept_resume_cb, NULL);
|
||||
|
||||
Reference in New Issue
Block a user