summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
commitdfdf42e27b033730178bf8884e2f4a1e6c960791 (patch)
tree6f7a25f6df49089832aabc6448bd6e527de2ea0e /src
parent2a83aae85e68a8c7431f372f39131b09fea7bca1 (diff)
downloadweechat-dfdf42e27b033730178bf8884e2f4a1e6c960791.zip
core: remove unneeded whitespace
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/core/wee-backtrace.c8
-rw-r--r--src/core/wee-command.c626
-rw-r--r--src/core/wee-completion.c188
-rw-r--r--src/core/wee-config-file.c328
-rw-r--r--src/core/wee-config.c290
-rw-r--r--src/core/wee-debug.c74
-rw-r--r--src/core/wee-hashtable.c144
-rw-r--r--src/core/wee-hashtable.h6
-rw-r--r--src/core/wee-hdata.c78
-rw-r--r--src/core/wee-hook.c662
-rw-r--r--src/core/wee-hook.h8
-rw-r--r--src/core/wee-infolist.c130
-rw-r--r--src/core/wee-input.c22
-rw-r--r--src/core/wee-list.c48
-rw-r--r--src/core/wee-log.c18
-rw-r--r--src/core/wee-network.c154
-rw-r--r--src/core/wee-proxy.c88
-rw-r--r--src/core/wee-proxy.h2
-rw-r--r--src/core/wee-string.c306
-rw-r--r--src/core/wee-upgrade-file.c108
-rw-r--r--src/core/wee-upgrade.c96
-rw-r--r--src/core/wee-utf8.c76
-rw-r--r--src/core/wee-util.c64
-rw-r--r--src/core/weechat.c20
-rw-r--r--src/core/weechat.h2
-rw-r--r--src/gui/curses/CMakeLists.txt2
-rw-r--r--src/gui/curses/gui-curses-bar-window.c76
-rw-r--r--src/gui/curses/gui-curses-chat.c196
-rw-r--r--src/gui/curses/gui-curses-color.c168
-rw-r--r--src/gui/curses/gui-curses-key.c46
-rw-r--r--src/gui/curses/gui-curses-main.c108
-rw-r--r--src/gui/curses/gui-curses-mouse.c54
-rw-r--r--src/gui/curses/gui-curses-window.c298
-rw-r--r--src/gui/gtk/gui-gtk-bar-window.c8
-rw-r--r--src/gui/gtk/gui-gtk-chat.c22
-rw-r--r--src/gui/gtk/gui-gtk-color.c22
-rw-r--r--src/gui/gtk/gui-gtk-main.c72
-rw-r--r--src/gui/gtk/gui-gtk-mouse.c6
-rw-r--r--src/gui/gtk/gui-gtk-window.c124
-rw-r--r--src/gui/gui-bar-item.c348
-rw-r--r--src/gui/gui-bar-window.c158
-rw-r--r--src/gui/gui-bar.c278
-rw-r--r--src/gui/gui-bar.h2
-rw-r--r--src/gui/gui-buffer.c508
-rw-r--r--src/gui/gui-buffer.h30
-rw-r--r--src/gui/gui-chat.c134
-rw-r--r--src/gui/gui-chat.h2
-rw-r--r--src/gui/gui-color.c84
-rw-r--r--src/gui/gui-color.h4
-rw-r--r--src/gui/gui-completion.c184
-rw-r--r--src/gui/gui-completion.h4
-rw-r--r--src/gui/gui-cursor.c50
-rw-r--r--src/gui/gui-filter.c92
-rw-r--r--src/gui/gui-focus.c34
-rw-r--r--src/gui/gui-history.c32
-rw-r--r--src/gui/gui-hotlist.c70
-rw-r--r--src/gui/gui-input.c178
-rw-r--r--src/gui/gui-key.c216
-rw-r--r--src/gui/gui-layout.c144
-rw-r--r--src/gui/gui-layout.h4
-rw-r--r--src/gui/gui-line.c192
-rw-r--r--src/gui/gui-nicklist.c218
-rw-r--r--src/gui/gui-window.c216
-rw-r--r--src/gui/gui-window.h24
-rw-r--r--src/plugins/alias/alias-config.c60
-rw-r--r--src/plugins/alias/alias-info.c10
-rw-r--r--src/plugins/alias/alias.c158
-rw-r--r--src/plugins/aspell/weechat-aspell-config.c70
-rw-r--r--src/plugins/aspell/weechat-aspell-speller.c40
-rw-r--r--src/plugins/aspell/weechat-aspell-speller.h2
-rw-r--r--src/plugins/aspell/weechat-aspell.c176
-rw-r--r--src/plugins/charset/charset.c94
-rw-r--r--src/plugins/demo/demo.c48
-rw-r--r--src/plugins/fifo/fifo-info.c4
-rw-r--r--src/plugins/fifo/fifo.c78
-rw-r--r--src/plugins/irc/irc-bar-item.c116
-rw-r--r--src/plugins/irc/irc-buffer.c30
-rw-r--r--src/plugins/irc/irc-channel.c134
-rw-r--r--src/plugins/irc/irc-color.c34
-rw-r--r--src/plugins/irc/irc-command.c740
-rw-r--r--src/plugins/irc/irc-completion.c112
-rw-r--r--src/plugins/irc/irc-config.c236
-rw-r--r--src/plugins/irc/irc-ctcp.c156
-rw-r--r--src/plugins/irc/irc-debug.c8
-rw-r--r--src/plugins/irc/irc-display.c6
-rw-r--r--src/plugins/irc/irc-ignore.c72
-rw-r--r--src/plugins/irc/irc-ignore.h2
-rw-r--r--src/plugins/irc/irc-info.c48
-rw-r--r--src/plugins/irc/irc-input.c52
-rw-r--r--src/plugins/irc/irc-message.c110
-rw-r--r--src/plugins/irc/irc-mode.c18
-rw-r--r--src/plugins/irc/irc-msgbuffer.c16
-rw-r--r--src/plugins/irc/irc-nick.c184
-rw-r--r--src/plugins/irc/irc-notify.c118
-rw-r--r--src/plugins/irc/irc-notify.h2
-rw-r--r--src/plugins/irc/irc-protocol.c768
-rw-r--r--src/plugins/irc/irc-raw.c60
-rw-r--r--src/plugins/irc/irc-redirect.c176
-rw-r--r--src/plugins/irc/irc-sasl.c38
-rw-r--r--src/plugins/irc/irc-server.c560
-rw-r--r--src/plugins/irc/irc-server.h2
-rw-r--r--src/plugins/irc/irc-upgrade.c36
-rw-r--r--src/plugins/irc/irc.c64
-rw-r--r--src/plugins/logger/logger-buffer.c48
-rw-r--r--src/plugins/logger/logger-config.c66
-rw-r--r--src/plugins/logger/logger-info.c10
-rw-r--r--src/plugins/logger/logger-tail.c20
-rw-r--r--src/plugins/logger/logger.c230
-rw-r--r--src/plugins/plugin-api.c92
-rw-r--r--src/plugins/plugin-config.c48
-rw-r--r--src/plugins/plugin.c212
-rw-r--r--src/plugins/relay/relay-buffer.c28
-rw-r--r--src/plugins/relay/relay-client-irc.c146
-rw-r--r--src/plugins/relay/relay-client-weechat.c34
-rw-r--r--src/plugins/relay/relay-client.c66
-rw-r--r--src/plugins/relay/relay-command.c28
-rw-r--r--src/plugins/relay/relay-completion.c22
-rw-r--r--src/plugins/relay/relay-config.c62
-rw-r--r--src/plugins/relay/relay-info.c10
-rw-r--r--src/plugins/relay/relay-raw.c62
-rw-r--r--src/plugins/relay/relay-server.c70
-rw-r--r--src/plugins/relay/relay-upgrade.c32
-rw-r--r--src/plugins/relay/relay.c54
-rw-r--r--src/plugins/rmodifier/rmodifier-command.c16
-rw-r--r--src/plugins/rmodifier/rmodifier-completion.c6
-rw-r--r--src/plugins/rmodifier/rmodifier-config.c36
-rw-r--r--src/plugins/rmodifier/rmodifier-debug.c8
-rw-r--r--src/plugins/rmodifier/rmodifier-info.c10
-rw-r--r--src/plugins/rmodifier/rmodifier.c98
-rw-r--r--src/plugins/scripts/guile/weechat-guile-api.c1344
-rw-r--r--src/plugins/scripts/guile/weechat-guile.c136
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c1816
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c106
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c1630
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c140
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c1392
-rw-r--r--src/plugins/scripts/python/weechat-python.c184
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c2078
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c158
-rw-r--r--src/plugins/scripts/script-api.c380
-rw-r--r--src/plugins/scripts/script-callback.c8
-rw-r--r--src/plugins/scripts/script.c166
-rw-r--r--src/plugins/scripts/script.h4
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c1618
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c112
-rw-r--r--src/plugins/weechat-plugin.h42
-rw-r--r--src/plugins/xfer/xfer-buffer.c34
-rw-r--r--src/plugins/xfer/xfer-chat.c58
-rw-r--r--src/plugins/xfer/xfer-command.c26
-rw-r--r--src/plugins/xfer/xfer-completion.c6
-rw-r--r--src/plugins/xfer/xfer-config.c24
-rw-r--r--src/plugins/xfer/xfer-dcc.c28
-rw-r--r--src/plugins/xfer/xfer-file.c30
-rw-r--r--src/plugins/xfer/xfer-info.c10
-rw-r--r--src/plugins/xfer/xfer-network.c70
-rw-r--r--src/plugins/xfer/xfer-upgrade.c18
-rw-r--r--src/plugins/xfer/xfer.c244
-rw-r--r--src/plugins/xfer/xfer.h4
159 files changed, 12987 insertions, 12987 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b806b408..5b1ec5c9b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -97,7 +97,7 @@ ENDIF(ENABLE_GCRYPT)
# Check for GnuTLS
IF(ENABLE_GNUTLS)
FIND_PACKAGE(GnuTLS)
-
+
IF(GNUTLS_FOUND)
STRING(REGEX REPLACE "/[^/]*$" "" GNUTLS_LIBRARY_PATH "${GNUTLS_LIBRARY}")
ADD_DEFINITIONS(-DHAVE_GNUTLS)
diff --git a/src/core/wee-backtrace.c b/src/core/wee-backtrace.c
index fd121f084..1bc49df3f 100644
--- a/src/core/wee-backtrace.c
+++ b/src/core/wee-backtrace.c
@@ -80,14 +80,14 @@ weechat_backtrace_addr2line (int number, void *address, const char *symbol)
char cmd_line[1024];
char line[1024], *ptr_line, *pos;
char function_name[1024];
-
+
rc = dladdr (address, &info);
if ((rc == 0) || !info.dli_fname || !info.dli_fname[0])
{
weechat_backtrace_printf ("%03d %s", number, symbol);
return;
}
-
+
addr = address;
if (info.dli_fbase >= (const void *) 0x40000000)
addr = (void *)((unsigned long)((const char *) addr) -
@@ -166,7 +166,7 @@ weechat_backtrace ()
#ifdef HAVE_BACKTRACE
trace_size = backtrace (trace, BACKTRACE_MAX);
symbols = backtrace_symbols (trace, trace_size);
-
+
for (i = 0; i < trace_size; i++)
{
weechat_backtrace_addr2line (i + 1, trace[i], symbols[i]);
@@ -175,6 +175,6 @@ weechat_backtrace ()
weechat_backtrace_printf (" No backtrace info (no debug info available "
"or no backtrace possible on your system).");
#endif
-
+
weechat_backtrace_printf ("======= End of backtrace =======");
}
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index b52d12b99..8225baa05 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -84,7 +84,7 @@ command_bar_list (int full)
{
struct t_gui_bar *ptr_bar;
char str_size[16];
-
+
if (gui_bars)
{
gui_chat_printf (NULL, "");
@@ -161,11 +161,11 @@ COMMAND_CALLBACK(bar)
struct t_gui_bar *ptr_bar;
struct t_gui_bar_item *ptr_item;
struct t_gui_window *ptr_window;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
/* list of bars */
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
@@ -173,14 +173,14 @@ COMMAND_CALLBACK(bar)
command_bar_list (0);
return WEECHAT_RC_OK;
}
-
+
/* full list of bars */
if ((argc == 2) && (string_strcasecmp (argv[1], "listfull") == 0))
{
command_bar_list (1);
return WEECHAT_RC_OK;
}
-
+
/* list of bar items */
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "listitems") == 0)))
@@ -200,10 +200,10 @@ COMMAND_CALLBACK(bar)
}
else
gui_chat_printf (NULL, _("No bar item defined"));
-
+
return WEECHAT_RC_OK;
}
-
+
/* add a new bar */
if (string_strcasecmp (argv[1], "add") == 0)
{
@@ -292,7 +292,7 @@ COMMAND_CALLBACK(bar)
return WEECHAT_RC_OK;
}
-
+
/* create default bars */
if (string_strcasecmp (argv[1], "default") == 0)
{
@@ -314,7 +314,7 @@ COMMAND_CALLBACK(bar)
gui_bar_create_default ();
return WEECHAT_RC_OK;
}
-
+
/* delete a bar */
if (string_strcasecmp (argv[1], "del") == 0)
{
@@ -340,10 +340,10 @@ COMMAND_CALLBACK(bar)
gui_chat_printf (NULL, _("Bar deleted"));
gui_bar_create_default_input ();
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* set a bar property */
if (string_strcasecmp (argv[1], "set") == 0)
{
@@ -366,10 +366,10 @@ COMMAND_CALLBACK(bar)
argv[3], argv[2]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* hide a bar */
if (string_strcasecmp (argv[1], "hide") == 0)
{
@@ -385,7 +385,7 @@ COMMAND_CALLBACK(bar)
}
if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_set (ptr_bar, "hidden", "1");
-
+
return WEECHAT_RC_OK;
}
@@ -404,10 +404,10 @@ COMMAND_CALLBACK(bar)
}
if (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_set (ptr_bar, "hidden", "0");
-
+
return WEECHAT_RC_OK;
}
-
+
/* toggle a bar visible/hidden */
if (string_strcasecmp (argv[1], "toggle") == 0)
{
@@ -423,10 +423,10 @@ COMMAND_CALLBACK(bar)
}
gui_bar_set (ptr_bar, "hidden",
CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) ? "0" : "1");
-
+
return WEECHAT_RC_OK;
}
-
+
/* scroll in a bar */
if (string_strcasecmp (argv[1], "scroll") == 0)
{
@@ -462,7 +462,7 @@ COMMAND_CALLBACK(bar)
}
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("%sError: unknown option for \"%s\" "
"command"),
@@ -483,7 +483,7 @@ command_buffer_display_localvar (void *data,
/* make C compiler happy */
(void) data;
(void) hashtable;
-
+
if (key)
{
if (value)
@@ -512,17 +512,17 @@ COMMAND_CALLBACK(buffer)
long number, number1, number2;
char *error, *value, *pos, *str_number1, *pos_number2;
int i, target_buffer;
-
+
/* make C compiler happy */
(void) data;
-
+
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
{
/* list buffers */
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Buffers list:"));
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -539,10 +539,10 @@ COMMAND_CALLBACK(buffer)
GUI_COLOR(GUI_COLOR_CHAT),
gui_buffer_notify_string[ptr_buffer->notify]);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* clear content of buffer */
if (string_strcasecmp (argv[1], "clear") == 0)
{
@@ -594,10 +594,10 @@ COMMAND_CALLBACK(buffer)
if (buffer->type == GUI_BUFFER_TYPE_FORMATTED)
gui_buffer_clear (buffer);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* move buffer to another number in the list */
if (string_strcasecmp (argv[1], "move") == 0)
{
@@ -625,10 +625,10 @@ COMMAND_CALLBACK(buffer)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* merge buffer with another number in the list */
if (string_strcasecmp (argv[1], "merge") == 0)
{
@@ -649,10 +649,10 @@ COMMAND_CALLBACK(buffer)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* unmerge buffer */
if (string_strcasecmp (argv[1], "unmerge") == 0)
{
@@ -679,10 +679,10 @@ COMMAND_CALLBACK(buffer)
}
}
gui_buffer_unmerge (buffer, (int) number);
-
+
return WEECHAT_RC_OK;
}
-
+
/* close buffer */
if (string_strcasecmp (argv[1], "close") == 0)
{
@@ -774,10 +774,10 @@ COMMAND_CALLBACK(buffer)
gui_buffer_close (ptr_buffer);
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* set notify level */
if (string_strcasecmp (argv[1], "notify") == 0)
{
@@ -785,7 +785,7 @@ COMMAND_CALLBACK(buffer)
config_weechat_notify_set (buffer, argv_eol[2]);
return WEECHAT_RC_OK;
}
-
+
/* display local variables on buffer */
if (string_strcasecmp (argv[1], "localvar") == 0)
{
@@ -805,7 +805,7 @@ COMMAND_CALLBACK(buffer)
}
return WEECHAT_RC_OK;
}
-
+
/* set a property on buffer */
if (string_strcasecmp (argv[1], "set") == 0)
{
@@ -814,7 +814,7 @@ COMMAND_CALLBACK(buffer)
gui_buffer_set (buffer, argv[2], (value) ? value : argv_eol[3]);
if (value)
free (value);
-
+
return WEECHAT_RC_OK;
}
@@ -857,7 +857,7 @@ COMMAND_CALLBACK(buffer)
}
return WEECHAT_RC_OK;
}
-
+
/* relative jump '-' */
if (argv[1][0] == '-')
{
@@ -872,10 +872,10 @@ COMMAND_CALLBACK(buffer)
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* relative jump '+' */
if (argv[1][0] == '+')
{
@@ -889,10 +889,10 @@ COMMAND_CALLBACK(buffer)
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* smart jump (jump to previous buffer for current number) */
if (argv[1][0] == '*')
{
@@ -916,10 +916,10 @@ COMMAND_CALLBACK(buffer)
}
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* jump to buffer by number or name */
error = NULL;
number = strtol (argv[1], &error, 10);
@@ -936,7 +936,7 @@ COMMAND_CALLBACK(buffer)
if (ptr_buffer)
gui_window_switch_to_buffer (gui_current_window, ptr_buffer, 1);
}
-
+
return WEECHAT_RC_OK;
}
@@ -951,22 +951,22 @@ COMMAND_CALLBACK(color)
long number;
int i;
struct t_gui_color_palette *color_palette;
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc == 1)
{
gui_color_buffer_open ();
return WEECHAT_RC_OK;
}
-
+
/* add a color alias */
if (string_strcasecmp (argv[1], "alias") == 0)
{
COMMAND_MIN_ARGS(4, "color alias");
-
+
/* check color number */
error = NULL;
number = strtol (argv[2], &error, 10);
@@ -988,7 +988,7 @@ COMMAND_CALLBACK(color)
argv[2], 0, gui_color_get_term_colors ());
return WEECHAT_RC_OK;
}
-
+
/* check other arguments */
str_alias = NULL;
str_rgb = NULL;
@@ -1011,7 +1011,7 @@ COMMAND_CALLBACK(color)
strcat (str_color, ";");
strcat (str_color, str_rgb);
}
-
+
/* add color alias */
snprintf (str_command, sizeof (str_command),
"/set weechat.palette.%d \"%s\"",
@@ -1020,12 +1020,12 @@ COMMAND_CALLBACK(color)
input_exec_command (buffer, 1, NULL, str_command);
return WEECHAT_RC_OK;
}
-
+
/* delete a color alias */
if (string_strcasecmp (argv[1], "unalias") == 0)
{
COMMAND_MIN_ARGS(3, "color unalias");
-
+
/* check color number */
error = NULL;
number = strtol (argv[2], &error, 10);
@@ -1047,7 +1047,7 @@ COMMAND_CALLBACK(color)
argv[2], 0, gui_color_get_term_colors ());
return WEECHAT_RC_OK;
}
-
+
/* search color */
color_palette = gui_color_palette_get ((int)number);
if (!color_palette)
@@ -1058,7 +1058,7 @@ COMMAND_CALLBACK(color)
argv[2]);
return WEECHAT_RC_OK;
}
-
+
/* delete color alias */
snprintf (str_command, sizeof (str_command),
"/unset weechat.palette.%d",
@@ -1066,21 +1066,21 @@ COMMAND_CALLBACK(color)
input_exec_command (buffer, 1, NULL, str_command);
return WEECHAT_RC_OK;
}
-
+
/* reset color pairs */
if (string_strcasecmp (argv[1], "reset") == 0)
{
gui_color_reset_pairs ();
return WEECHAT_RC_OK;
}
-
+
/* switch WeeChat/terminal colors */
if (string_strcasecmp (argv[1], "switch") == 0)
{
gui_color_switch_colors ();
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -1093,10 +1093,10 @@ COMMAND_CALLBACK(command)
int length;
char *command;
struct t_weechat_plugin *ptr_plugin;
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
ptr_plugin = NULL;
@@ -1127,7 +1127,7 @@ COMMAND_CALLBACK(command)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1139,18 +1139,18 @@ COMMAND_CALLBACK(cursor)
{
char *pos, *str_x, *error;
int x, y;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if (argc == 1)
{
gui_cursor_mode_toggle ();
return WEECHAT_RC_OK;
}
-
+
if (string_strcasecmp (argv[1], "go") == 0)
{
if (argc > 2)
@@ -1181,7 +1181,7 @@ COMMAND_CALLBACK(cursor)
}
return WEECHAT_RC_OK;
}
-
+
if (string_strcasecmp (argv[1], "move") == 0)
{
if (argc > 2)
@@ -1205,7 +1205,7 @@ COMMAND_CALLBACK(cursor)
}
return WEECHAT_RC_OK;
}
-
+
if (string_strcasecmp (argv[1], "stop") == 0)
{
gui_cursor_mode_toggle ();
@@ -1224,17 +1224,17 @@ COMMAND_CALLBACK(debug)
struct t_config_option *ptr_option;
struct t_weechat_plugin *ptr_plugin;
int debug;
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, "Debug:");
-
+
ptr_option = config_weechat_debug_get (PLUGIN_CORE);
gui_chat_printf (NULL, " %s: %d",
PLUGIN_CORE,
@@ -1248,7 +1248,7 @@ COMMAND_CALLBACK(debug)
}
return WEECHAT_RC_OK;
}
-
+
if (string_strcasecmp (argv[1], "dump") == 0)
{
if (argc > 2)
@@ -1351,7 +1351,7 @@ COMMAND_CALLBACK(debug)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1386,11 +1386,11 @@ command_filter_display (struct t_gui_filter *filter)
COMMAND_CALLBACK(filter)
{
struct t_gui_filter *ptr_filter;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
{
@@ -1401,7 +1401,7 @@ COMMAND_CALLBACK(filter)
(gui_filters_enabled) ?
_("Message filtering enabled") :
_("Message filtering disabled"));
-
+
if (gui_filters)
{
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
@@ -1417,10 +1417,10 @@ COMMAND_CALLBACK(filter)
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
_("No message filter defined"));
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* enable global filtering or a filter */
if (string_strcasecmp (argv[1], "enable") == 0)
{
@@ -1498,7 +1498,7 @@ COMMAND_CALLBACK(filter)
}
return WEECHAT_RC_OK;
}
-
+
/* toggle global filtering or a filter on/off */
if (string_strcasecmp (argv[1], "toggle") == 0)
{
@@ -1531,7 +1531,7 @@ COMMAND_CALLBACK(filter)
}
return WEECHAT_RC_OK;
}
-
+
/* add filter */
if (string_strcasecmp (argv[1], "add") == 0)
{
@@ -1559,9 +1559,9 @@ COMMAND_CALLBACK(filter)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
ptr_filter = gui_filter_new (1, argv[2], argv[3], argv[4], argv_eol[5]);
-
+
if (ptr_filter)
{
gui_chat_printf (NULL, "");
@@ -1576,7 +1576,7 @@ COMMAND_CALLBACK(filter)
_("%sError adding filter"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1611,10 +1611,10 @@ COMMAND_CALLBACK(filter)
argv[2]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete filter */
if (string_strcasecmp (argv[1], "del") == 0)
{
@@ -1654,7 +1654,7 @@ COMMAND_CALLBACK(filter)
}
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
_("%sError: unknown option for \"%s\" "
"command"),
@@ -1679,7 +1679,7 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin,
int command_found, length, max_length, list_size;
int cols, lines, col, line, index;
char str_format[64], str_command[256], str_line[2048];
-
+
if (verbose)
{
command_found = 0;
@@ -1718,7 +1718,7 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin,
{
max_length = -1;
list = weelist_new ();
-
+
/*
* build list of commands for plugin and save max length of command
* names
@@ -1737,7 +1737,7 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin,
WEECHAT_LIST_POS_SORT, NULL);
}
}
-
+
/* use list to display commands, sorted by columns */
list_size = weelist_size (list);
if ((max_length > 0) && (list_size > 0))
@@ -1749,10 +1749,10 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin,
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
plugin_get_name (plugin),
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
-
+
snprintf (str_format, sizeof (str_format),
" %%-%ds", max_length);
-
+
/* auto compute number of colums, max size is 90% of chat width */
cols = ((gui_current_window->win_chat_width * 90) / 100) / (max_length + 1);
if (cols == 0)
@@ -1781,7 +1781,7 @@ command_help_list_plugin_commands (struct t_weechat_plugin *plugin,
gui_chat_printf (NULL, " %s", str_line);
}
}
-
+
weelist_free (list);
}
}
@@ -1794,10 +1794,10 @@ void
command_help_list_commands (int verbose)
{
struct t_weechat_plugin *ptr_plugin;
-
+
/* WeeChat commands */
command_help_list_plugin_commands (NULL, verbose);
-
+
/* plugins commands */
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
@@ -1818,12 +1818,12 @@ COMMAND_CALLBACK(help)
int i, length, command_found, first_line_displayed, verbose;
char *string, *ptr_string, *pos_double_pipe, *pos_end;
char empty_string[1] = { '\0' }, str_format[64];
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
/* display help for all commands */
if ((argc == 1)
|| ((argc > 1) && (string_strncasecmp (argv[1], "-list", 5) == 0)))
@@ -1847,7 +1847,7 @@ COMMAND_CALLBACK(help)
command_help_list_commands (verbose);
return WEECHAT_RC_OK;
}
-
+
/* look for command */
command_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
@@ -1904,7 +1904,7 @@ COMMAND_CALLBACK(help)
}
if (string)
free (string);
-
+
if (pos_double_pipe)
{
ptr_string = pos_double_pipe + 2;
@@ -1934,7 +1934,7 @@ COMMAND_CALLBACK(help)
}
if (command_found)
return WEECHAT_RC_OK;
-
+
/* look for option */
config_file_search_with_string (argv[1], NULL, NULL, &ptr_option, NULL);
if (ptr_option)
@@ -2177,13 +2177,13 @@ COMMAND_CALLBACK(help)
}
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("%sNo help available, \"%s\" is not a command or an "
"option"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[1]);
-
+
return WEECHAT_RC_OK;
}
@@ -2195,13 +2195,13 @@ COMMAND_CALLBACK(history)
{
struct t_gui_history *ptr_history;
int n, n_total, n_user, displayed;
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
n_user = CONFIG_INTEGER(config_history_display_default);
-
+
if (argc == 2)
{
if (string_strcasecmp (argv[1], "clear") == 0)
@@ -2212,7 +2212,7 @@ COMMAND_CALLBACK(history)
else
n_user = atoi (argv[1]);
}
-
+
if (buffer->history)
{
n_total = 1;
@@ -2238,7 +2238,7 @@ COMMAND_CALLBACK(history)
displayed = 1;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2250,7 +2250,7 @@ COMMAND_CALLBACK(input)
{
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (string_strcasecmp (argv[1], "clipboard_paste") == 0)
@@ -2345,7 +2345,7 @@ COMMAND_CALLBACK(input)
else if (string_strcasecmp (argv[1], "redo") == 0)
gui_input_redo (buffer);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2357,9 +2357,9 @@ void
command_key_display (struct t_gui_key *key, struct t_gui_key *default_key)
{
char *expanded_name;
-
+
expanded_name = gui_key_get_expanded_name (key->key);
-
+
if (default_key)
{
gui_chat_printf (NULL, " %s%s => %s%s %s(%s%s %s%s)",
@@ -2381,7 +2381,7 @@ command_key_display (struct t_gui_key *key, struct t_gui_key *default_key)
GUI_COLOR(GUI_COLOR_CHAT),
key->command);
}
-
+
if (expanded_name)
free (expanded_name);
}
@@ -2398,7 +2398,7 @@ command_key_display_list (const char *message_no_key,
int keys_count)
{
struct t_gui_key *ptr_key;
-
+
if (keys_count == 0)
gui_chat_printf (NULL, message_no_key,
gui_key_context_string[context]);
@@ -2424,7 +2424,7 @@ command_key_display_listdiff (int context)
{
struct t_gui_key *ptr_key, *ptr_default_key;
int count_added, count_deleted;
-
+
/* list keys added or redefined */
count_added = 0;
for (ptr_key = gui_keys[context]; ptr_key; ptr_key = ptr_key->next_key)
@@ -2457,7 +2457,7 @@ command_key_display_listdiff (int context)
}
}
}
-
+
/* list keys deleted */
count_deleted = 0;
for (ptr_default_key = gui_default_keys[context]; ptr_default_key;
@@ -2485,7 +2485,7 @@ command_key_display_listdiff (int context)
}
}
}
-
+
/* display a message if all key bindings are default bindings */
if ((count_added == 0) && (count_deleted == 0))
{
@@ -2507,17 +2507,17 @@ command_key_reset (int context, const char *key)
char *internal_code;
struct t_gui_key *ptr_key, *ptr_default_key, *ptr_new_key;
int rc;
-
+
internal_code = gui_key_get_internal_code (key);
if (!internal_code)
return WEECHAT_RC_ERROR;
-
+
ptr_key = gui_key_search (gui_keys[context],
internal_code);
ptr_default_key = gui_key_search (gui_default_keys[context],
internal_code);
free (internal_code);
-
+
if (ptr_key || ptr_default_key)
{
if (ptr_key && ptr_default_key)
@@ -2595,11 +2595,11 @@ COMMAND_CALLBACK(key)
char *internal_code;
struct t_gui_key *ptr_new_key;
int old_keys_count, keys_added, i, context, rc;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
/* display all key bindings (current keys) */
if ((argc == 1) || (string_strcasecmp (argv[1], "list") == 0))
{
@@ -2618,7 +2618,7 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* display redefined or key bindings added */
if (string_strcasecmp (argv[1], "listdiff") == 0)
{
@@ -2632,7 +2632,7 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* display default key bindings */
if (string_strcasecmp (argv[1], "listdefault") == 0)
{
@@ -2653,12 +2653,12 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* bind a key (or display binding) */
if (string_strcasecmp (argv[1], "bind") == 0)
{
COMMAND_MIN_ARGS(3, "key bind");
-
+
/* display a key binding */
if (argc == 3)
{
@@ -2682,7 +2682,7 @@ COMMAND_CALLBACK(key)
free (internal_code);
return WEECHAT_RC_OK;
}
-
+
/* bind new key */
gui_key_verbose = 1;
ptr_new_key = gui_key_bind (NULL, GUI_KEY_CONTEXT_DEFAULT,
@@ -2698,12 +2698,12 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* bind a key for given context (or display binding) */
if (string_strcasecmp (argv[1], "bindctxt") == 0)
{
COMMAND_MIN_ARGS(4, "key bindctxt");
-
+
/* search context */
context = gui_key_search_context (argv[2]);
if (context < 0)
@@ -2738,7 +2738,7 @@ COMMAND_CALLBACK(key)
free (internal_code);
return WEECHAT_RC_OK;
}
-
+
/* bind new key */
gui_key_verbose = 1;
ptr_new_key = gui_key_bind (NULL, context,
@@ -2754,7 +2754,7 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* unbind a key */
if (string_strcasecmp (argv[1], "unbind") == 0)
{
@@ -2803,20 +2803,20 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* reset a key to default binding */
if (string_strcasecmp (argv[1], "reset") == 0)
{
COMMAND_MIN_ARGS(3, "key reset");
-
+
return command_key_reset (GUI_KEY_CONTEXT_DEFAULT, argv[2]);
}
-
+
/* reset a key to default binding for a given context */
if (string_strcasecmp (argv[1], "resetctxt") == 0)
{
COMMAND_MIN_ARGS(4, "key reset");
-
+
/* search context */
context = gui_key_search_context (argv[2]);
if (context < 0)
@@ -2827,10 +2827,10 @@ COMMAND_CALLBACK(key)
argv[2]);
return WEECHAT_RC_OK;
}
-
+
return command_key_reset (context, argv[3]);
}
-
+
/* reset ALL keys (only with "-yes", for security reason) */
if (string_strcasecmp (argv[1], "resetall") == 0)
{
@@ -2861,7 +2861,7 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
/* add missing keys */
if (string_strcasecmp (argv[1], "missing") == 0)
{
@@ -2885,13 +2885,13 @@ COMMAND_CALLBACK(key)
}
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("%sError: unknown option for \"%s\" "
"command"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"key");
-
+
return WEECHAT_RC_OK;
}
@@ -2904,7 +2904,7 @@ command_layout_display_tree (struct t_gui_layout_window *layout_window,
int indent)
{
char format[128];
-
+
if (layout_window)
{
if (layout_window->plugin_name)
@@ -2944,10 +2944,10 @@ command_layout_display_tree (struct t_gui_layout_window *layout_window,
(layout_window->split_horiz) ?
_("horizontal split") : _("vertical split"));
}
-
+
if (layout_window->child1)
command_layout_display_tree (layout_window->child1, indent + 1);
-
+
if (layout_window->child2)
command_layout_display_tree (layout_window->child2, indent + 1);
}
@@ -2961,12 +2961,12 @@ COMMAND_CALLBACK(layout)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
int flag_buffers, flag_windows;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
/* display all key bindings */
if (argc == 1)
{
@@ -2995,13 +2995,13 @@ COMMAND_CALLBACK(layout)
}
else
gui_chat_printf (NULL, _("No layout saved"));
-
+
return WEECHAT_RC_OK;
}
-
+
flag_buffers = 1;
flag_windows = 1;
-
+
if (argc > 2)
{
if (string_strcasecmp (argv[2], "buffers") == 0)
@@ -3009,7 +3009,7 @@ COMMAND_CALLBACK(layout)
else if (string_strcasecmp (argv[2], "windows") == 0)
flag_buffers = 0;
}
-
+
/* save layout */
if (string_strcasecmp (argv[1], "save") == 0)
{
@@ -3026,10 +3026,10 @@ COMMAND_CALLBACK(layout)
_("Layout saved for windows (buffer displayed by "
"each window)"));
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* apply layout */
if (string_strcasecmp (argv[1], "apply") == 0)
{
@@ -3037,7 +3037,7 @@ COMMAND_CALLBACK(layout)
gui_layout_buffer_apply (gui_layout_buffers);
if (flag_windows)
gui_layout_window_apply (gui_layout_windows, -1);
-
+
return WEECHAT_RC_OK;
}
@@ -3056,10 +3056,10 @@ COMMAND_CALLBACK(layout)
gui_chat_printf (NULL,
_("Layout reset for windows"));
}
-
+
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -3078,11 +3078,11 @@ command_mouse_timer_cb (void *data, int remaining_calls)
gui_mouse_disable ();
else
gui_mouse_enable ();
-
+
return WEECHAT_RC_OK;
}
-/*
+/*
* command_mouse_timer: timer for toggling mouse
*/
@@ -3091,7 +3091,7 @@ command_mouse_timer (const char *delay)
{
long seconds;
char *error;
-
+
error = NULL;
seconds = strtol (delay, &error, 10);
if (error && !error[0] && (seconds > 0))
@@ -3110,13 +3110,13 @@ COMMAND_CALLBACK(mouse)
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if (argc == 1)
{
gui_mouse_display_state ();
return WEECHAT_RC_OK;
}
-
+
/* enable mouse */
if (string_strcasecmp (argv[1], "enable") == 0)
{
@@ -3125,7 +3125,7 @@ COMMAND_CALLBACK(mouse)
command_mouse_timer (argv[2]);
return WEECHAT_RC_OK;
}
-
+
/* disable mouse */
if (string_strcasecmp (argv[1], "disable") == 0)
{
@@ -3134,7 +3134,7 @@ COMMAND_CALLBACK(mouse)
command_mouse_timer (argv[2]);
return WEECHAT_RC_OK;
}
-
+
/* toggle mouse */
if (string_strcasecmp (argv[1], "toggle") == 0)
{
@@ -3146,7 +3146,7 @@ COMMAND_CALLBACK(mouse)
command_mouse_timer (argv[2]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -3159,16 +3159,16 @@ COMMAND_CALLBACK(mute)
int length, mute_mode;
char *command, *ptr_command;
struct t_gui_buffer *mute_buffer, *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc >= 2)
{
mute_mode = GUI_CHAT_MUTE_BUFFER;
mute_buffer = gui_buffer_search_main ();
ptr_command = argv_eol[1];
-
+
if (string_strcasecmp (argv[1], "-current") == 0)
{
mute_buffer = buffer;
@@ -3189,12 +3189,12 @@ COMMAND_CALLBACK(mute)
mute_buffer = NULL;
ptr_command = argv_eol[2];
}
-
+
if (ptr_command && ptr_command[0])
{
gui_chat_mute = mute_mode;
gui_chat_mute_buffer = mute_buffer;
-
+
if (string_is_command_char (ptr_command))
{
input_exec_command (buffer, 1, NULL, ptr_command);
@@ -3210,12 +3210,12 @@ COMMAND_CALLBACK(mute)
free (command);
}
}
-
+
gui_chat_mute = GUI_CHAT_MUTE_DISABLED;
gui_chat_mute_buffer = NULL;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -3229,26 +3229,26 @@ command_plugin_list (const char *name, int full)
struct t_weechat_plugin *ptr_plugin;
struct t_hook *ptr_hook;
int plugins_found, hook_found, interval;
-
+
gui_chat_printf (NULL, "");
if (!name)
{
gui_chat_printf (NULL, _("Plugins loaded:"));
}
-
+
plugins_found = 0;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
if (!name || (string_strcasestr (ptr_plugin->name, name)))
{
plugins_found++;
-
+
if (full)
{
gui_chat_printf (NULL, "");
-
+
/* plugin info */
gui_chat_printf (NULL,
" %s%s %s[%sv%s%s]%s: %s (%s)",
@@ -3261,13 +3261,13 @@ command_plugin_list (const char *name, int full)
GUI_COLOR(GUI_COLOR_CHAT),
ptr_plugin->description,
ptr_plugin->filename);
-
+
/* second line of plugin info */
gui_chat_printf (NULL,
_(" written by \"%s\", license: %s"),
ptr_plugin->author,
ptr_plugin->license);
-
+
/* commands hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
@@ -3287,7 +3287,7 @@ command_plugin_list (const char *name, int full)
HOOK_COMMAND(ptr_hook, description) ? ")" : "");
}
}
-
+
/* command_run hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND_RUN]; ptr_hook;
@@ -3302,7 +3302,7 @@ command_plugin_list (const char *name, int full)
HOOK_COMMAND_RUN(ptr_hook, command));
}
}
-
+
/* timers hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_TIMER]; ptr_hook;
@@ -3335,7 +3335,7 @@ command_plugin_list (const char *name, int full)
(NG_("millisecond", "milliseconds", interval)));
}
}
-
+
/* fd hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_FD]; ptr_hook;
@@ -3359,7 +3359,7 @@ command_plugin_list (const char *name, int full)
_(" exception") : "");
}
}
-
+
/* process hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_PROCESS]; ptr_hook;
@@ -3378,7 +3378,7 @@ command_plugin_list (const char *name, int full)
HOOK_PROCESS(ptr_hook, child_pid));
}
}
-
+
/* connect hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_CONNECT]; ptr_hook;
@@ -3399,7 +3399,7 @@ command_plugin_list (const char *name, int full)
HOOK_CONNECT(ptr_hook, child_pid));
}
}
-
+
/* prints hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_PRINT]; ptr_hook;
@@ -3423,7 +3423,7 @@ command_plugin_list (const char *name, int full)
HOOK_PRINT(ptr_hook, message) : _("(none)"));
}
}
-
+
/* signals hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_SIGNAL]; ptr_hook;
@@ -3440,7 +3440,7 @@ command_plugin_list (const char *name, int full)
HOOK_SIGNAL(ptr_hook, signal) : _("(all)"));
}
}
-
+
/* config options hooked */
hook_found = 0;
for (ptr_hook = weechat_hooks[HOOK_TYPE_CONFIG]; ptr_hook;
@@ -3525,7 +3525,7 @@ COMMAND_CALLBACK(plugin)
(void) data;
(void) buffer;
(void) argv_eol;
-
+
switch (argc)
{
case 1:
@@ -3574,7 +3574,7 @@ COMMAND_CALLBACK(plugin)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"plugin");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3586,7 +3586,7 @@ void
command_proxy_list ()
{
struct t_proxy *ptr_proxy;
-
+
if (weechat_proxies)
{
gui_chat_printf (NULL, "");
@@ -3626,11 +3626,11 @@ COMMAND_CALLBACK(proxy)
long value;
char *error;
struct t_proxy *ptr_proxy;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
/* list of bars */
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
@@ -3638,7 +3638,7 @@ COMMAND_CALLBACK(proxy)
command_proxy_list ();
return WEECHAT_RC_OK;
}
-
+
/* add a new proxy */
if (string_strcasecmp (argv[1], "add") == 0)
{
@@ -3690,10 +3690,10 @@ COMMAND_CALLBACK(proxy)
argv[5], argv[2]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete a proxy */
if (string_strcasecmp (argv[1], "del") == 0)
{
@@ -3717,10 +3717,10 @@ COMMAND_CALLBACK(proxy)
proxy_free (ptr_proxy);
gui_chat_printf (NULL, _("Proxy deleted"));
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* set a proxy property */
if (string_strcasecmp (argv[1], "set") == 0)
{
@@ -3743,10 +3743,10 @@ COMMAND_CALLBACK(proxy)
argv[3], argv[2]);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("%sError: unknown option for \"%s\" "
"command"),
@@ -3763,11 +3763,11 @@ COMMAND_CALLBACK(quit)
{
int confirm_ok;
char *pos_args;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
confirm_ok = 0;
pos_args = NULL;
if (argc > 1)
@@ -3781,7 +3781,7 @@ COMMAND_CALLBACK(quit)
else
pos_args = argv_eol[1];
}
-
+
/* if confirmation is required, check that "-yes" is given */
if (CONFIG_BOOLEAN(config_look_confirm_quit) && !confirm_ok)
{
@@ -3791,16 +3791,16 @@ COMMAND_CALLBACK(quit)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
/*
* send quit signal: some plugins like irc use this signal to disconnect
* from servers
*/
hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, pos_args);
-
+
/* force end of WeeChat main loop */
weechat_quit = 1;
-
+
return WEECHAT_RC_OK;
}
@@ -3812,13 +3812,13 @@ void
command_reload_file (struct t_config_file *config_file)
{
int rc;
-
+
if (config_file->callback_reload)
rc = (int) (config_file->callback_reload)
(config_file->callback_reload_data, config_file);
else
rc = config_file_reload (config_file);
-
+
if (rc == WEECHAT_RC_OK)
{
gui_chat_printf (NULL,
@@ -3842,12 +3842,12 @@ COMMAND_CALLBACK(reload)
{
struct t_config_file *ptr_config_file;
int i;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if (argc > 1)
{
for (i = 1; i < argc; i++)
@@ -3873,7 +3873,7 @@ COMMAND_CALLBACK(reload)
command_reload_file (ptr_config_file);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -3887,24 +3887,24 @@ command_repeat_timer_cb (void *data, int remaining_calls)
char **repeat_args;
int i;
struct t_gui_buffer *ptr_buffer;
-
+
repeat_args = (char **)data;
-
+
if (!repeat_args)
return WEECHAT_RC_ERROR;
-
+
if (repeat_args[0] && repeat_args[1] && repeat_args[2])
{
/* search buffer, fallback to core buffer if not found */
ptr_buffer = gui_buffer_search_by_name (repeat_args[0], repeat_args[1]);
if (!ptr_buffer)
ptr_buffer = gui_buffer_search_main ();
-
+
/* execute command */
if (ptr_buffer)
input_exec_command (ptr_buffer, 1, NULL, repeat_args[2]);
}
-
+
if (remaining_calls == 0)
{
for (i = 0; i < 3; i++)
@@ -3914,7 +3914,7 @@ command_repeat_timer_cb (void *data, int remaining_calls)
}
free (repeat_args);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3926,16 +3926,16 @@ COMMAND_CALLBACK(repeat)
{
int arg_count, count, interval, length, i;
char *error, *command, **repeat_args;
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc < 3)
return WEECHAT_RC_OK;
-
+
arg_count = 1;
interval = 0;
-
+
if ((argc >= 5) && (string_strcasecmp (argv[1], "-interval") == 0))
{
error = NULL;
@@ -3944,7 +3944,7 @@ COMMAND_CALLBACK(repeat)
interval = 0;
arg_count = 3;
}
-
+
error = NULL;
count = (int)strtol (argv[arg_count], &error, 10);
if (!error || error[0] || (count < 1))
@@ -3955,7 +3955,7 @@ COMMAND_CALLBACK(repeat)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
if (string_is_command_char (argv_eol[arg_count + 1]))
command = strdup (argv_eol[arg_count + 1]);
else
@@ -3965,7 +3965,7 @@ COMMAND_CALLBACK(repeat)
if (command)
snprintf (command, length, "/%s", argv_eol[arg_count + 1]);
}
-
+
if (command)
{
input_exec_command (buffer, 1, NULL, command);
@@ -4001,7 +4001,7 @@ COMMAND_CALLBACK(repeat)
free (command);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4035,7 +4035,7 @@ COMMAND_CALLBACK(save)
{
struct t_config_file *ptr_config_file;
int i;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
@@ -4068,7 +4068,7 @@ COMMAND_CALLBACK(save)
command_save_file (ptr_config_file);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4089,7 +4089,7 @@ command_set_display_section (struct t_config_file *config_file,
GUI_COLOR(GUI_COLOR_CHAT),
config_file->filename);
}
-
+
/*
* command_set_display_option: display configuration option
*/
@@ -4195,9 +4195,9 @@ command_set_display_option_list (const char *message, const char *search)
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_full_name;
-
+
number_found = 0;
-
+
for (ptr_config = config_files; ptr_config;
ptr_config = ptr_config->next_config)
{
@@ -4205,7 +4205,7 @@ command_set_display_option_list (const char *message, const char *search)
ptr_section = ptr_section->next_section)
{
section_displayed = 0;
-
+
for (ptr_option = ptr_section->options; ptr_option;
ptr_option = ptr_option->next_option)
{
@@ -4236,10 +4236,10 @@ command_set_display_option_list (const char *message, const char *search)
}
}
}
-
+
return number_found;
}
-
+
/*
* command_set: set config options
*/
@@ -4249,20 +4249,20 @@ COMMAND_CALLBACK(set)
char *value;
int number_found, rc;
struct t_config_option *ptr_option, *ptr_option_before;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
/* display list of options */
if (argc < 3)
{
number_found = 0;
-
+
number_found += command_set_display_option_list (NULL,
(argc == 2) ?
argv[1] : NULL);
-
+
if (number_found == 0)
{
if (argc == 2)
@@ -4309,7 +4309,7 @@ COMMAND_CALLBACK(set)
}
return WEECHAT_RC_OK;
}
-
+
/* set option value */
config_file_search_with_string (argv[1], NULL, NULL, &ptr_option_before,
NULL);
@@ -4347,7 +4347,7 @@ COMMAND_CALLBACK(set)
gui_chat_printf (NULL, _("Option changed"));
break;
}
-
+
return WEECHAT_RC_OK;
}
@@ -4362,15 +4362,15 @@ COMMAND_CALLBACK(unset)
struct t_config_option *ptr_option, *next_option;
char *option_full_name;
int length, number_reset, number_removed;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv;
-
+
number_reset = 0;
number_removed = 0;
-
+
if (argc >= 2)
{
for (ptr_config = config_files; ptr_config;
@@ -4383,7 +4383,7 @@ COMMAND_CALLBACK(unset)
while (ptr_option)
{
next_option = ptr_option->next_option;
-
+
length = strlen (ptr_config->name) + 1
+ strlen (ptr_section->name) + 1
+ strlen (ptr_option->name) + 1;
@@ -4421,7 +4421,7 @@ COMMAND_CALLBACK(unset)
}
free (option_full_name);
}
-
+
ptr_option = next_option;
}
}
@@ -4431,7 +4431,7 @@ COMMAND_CALLBACK(unset)
number_reset,
number_removed);
}
-
+
return WEECHAT_RC_OK;
}
@@ -4445,12 +4445,12 @@ COMMAND_CALLBACK(upgrade)
char *exec_args[7] = { NULL, "-a", "--dir", NULL, "--upgrade", NULL };
struct stat stat_buf;
int rc;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv;
-
+
/*
* it is forbidden to upgrade while there are some background process
* (hook type "process" or "connect")
@@ -4463,7 +4463,7 @@ COMMAND_CALLBACK(upgrade)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
if (argc > 1)
{
ptr_binary = string_expand_home (argv_eol[1]);
@@ -4496,7 +4496,7 @@ COMMAND_CALLBACK(upgrade)
}
else
ptr_binary = strdup (weechat_argv0);
-
+
if (!ptr_binary)
{
gui_chat_printf (NULL,
@@ -4504,14 +4504,14 @@ COMMAND_CALLBACK(upgrade)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("Upgrading WeeChat with binary file: \"%s\"..."),
ptr_binary);
-
+
/* send "upgrade" signal to plugins */
hook_signal_send ("upgrade", WEECHAT_HOOK_SIGNAL_STRING, NULL);
-
+
if (!upgrade_weechat_save ())
{
gui_chat_printf (NULL,
@@ -4520,13 +4520,13 @@ COMMAND_CALLBACK(upgrade)
free (ptr_binary);
return WEECHAT_RC_OK;
}
-
+
exec_args[0] = ptr_binary;
exec_args[3] = strdup (weechat_home);
-
+
weechat_quit = 1;
weechat_upgrading = 1;
-
+
/* save layout, unload plugins, save config, then upgrade */
gui_layout_save_on_exit ();
plugin_end ();
@@ -4534,21 +4534,21 @@ COMMAND_CALLBACK(upgrade)
(void) config_weechat_write ();
gui_main_end (1);
log_close ();
-
+
execvp (exec_args[0], exec_args);
-
+
/* this code should not be reached if execvp is ok */
string_iconv_fprintf (stderr, "\n\n*****\n");
string_iconv_fprintf (stderr,
_("***** Error: exec failed (program: \"%s\"), exiting WeeChat"),
exec_args[0]);
string_iconv_fprintf (stderr, "\n*****\n\n");
-
+
free (exec_args[0]);
free (exec_args[3]);
-
+
exit (EXIT_FAILURE);
-
+
/* never executed */
return WEECHAT_RC_ERROR;
}
@@ -4562,17 +4562,17 @@ COMMAND_CALLBACK(uptime)
time_t running_time;
int day, hour, min, sec;
char string[512];
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
running_time = time (NULL) - weechat_first_start_time;
day = running_time / (60 * 60 * 24);
hour = (running_time % (60 * 60 * 24)) / (60 * 60);
min = ((running_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((running_time % (60 * 60 * 24)) % (60 * 60)) % 60;
-
+
if ((argc >= 2) && (string_strcasecmp (argv[1], "-o") == 0))
{
snprintf (string, sizeof (string),
@@ -4622,7 +4622,7 @@ COMMAND_CALLBACK(uptime)
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
util_get_time_string (&weechat_first_start_time));
}
-
+
return WEECHAT_RC_OK;
}
@@ -4636,7 +4636,7 @@ command_version_display (struct t_gui_buffer *buffer,
int translated_string)
{
char string[512];
-
+
if (send_to_buffer_as_input)
{
if (translated_string)
@@ -4710,7 +4710,7 @@ command_version_display (struct t_gui_buffer *buffer,
COMMAND_CALLBACK(version)
{
int send_to_buffer_as_input, translated_string;
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
@@ -4728,10 +4728,10 @@ COMMAND_CALLBACK(version)
translated_string = 1;
}
}
-
+
command_version_display (buffer, send_to_buffer_as_input,
translated_string);
-
+
return WEECHAT_RC_OK;
}
@@ -4745,34 +4745,34 @@ command_wait_timer_cb (void *data, int remaining_calls)
char **timer_args;
int i;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
timer_args = (char **)data;
-
+
if (!timer_args)
return WEECHAT_RC_ERROR;
-
+
if (timer_args[0] && timer_args[1] && timer_args[2])
{
/* search buffer, fallback to core buffer if not found */
ptr_buffer = gui_buffer_search_by_name (timer_args[0], timer_args[1]);
if (!ptr_buffer)
ptr_buffer = gui_buffer_search_main ();
-
+
/* execute command */
if (ptr_buffer)
input_data (ptr_buffer, timer_args[2]);
}
-
+
for (i = 0; i < 3; i++)
{
if (timer_args[i])
free (timer_args[i]);
}
free (timer_args);
-
+
return WEECHAT_RC_OK;
}
@@ -4785,10 +4785,10 @@ COMMAND_CALLBACK(wait)
char *pos, *str_number, *error;
long number, factor, delay;
char **timer_args;
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
pos = argv[1];
@@ -4796,10 +4796,10 @@ COMMAND_CALLBACK(wait)
{
pos++;
}
-
+
/* default is seconds (1000 milliseconds) */
factor = 1000;
-
+
if ((pos != argv[1]) && pos[0])
{
str_number = string_strndup (argv[1], pos - argv[1]);
@@ -4816,7 +4816,7 @@ COMMAND_CALLBACK(wait)
}
else
str_number = strdup (argv[1]);
-
+
if (str_number)
{
error = NULL;
@@ -4825,7 +4825,7 @@ COMMAND_CALLBACK(wait)
{
free (str_number);
delay = number * factor;
-
+
/* build arguments for timer callback */
timer_args = malloc (3 * sizeof (*timer_args));
if (!timer_args)
@@ -4838,18 +4838,18 @@ COMMAND_CALLBACK(wait)
timer_args[0] = strdup (gui_buffer_get_plugin_name (buffer));
timer_args[1] = strdup (buffer->name);
timer_args[2] = strdup (argv_eol[2]);
-
+
/* schedule command, execute it after "delay" milliseconds */
hook_timer (NULL, delay, 0, 1,
&command_wait_timer_cb, timer_args);
-
+
return WEECHAT_RC_OK;
}
free (str_number);
return WEECHAT_RC_ERROR;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4863,19 +4863,19 @@ COMMAND_CALLBACK(window)
char *error;
long number;
int win_args;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
{
/* list all windows */
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Windows list:"));
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_chat_printf (NULL, "%s[%s%d%s] (%s%d:%d%s;%s%dx%d%s) ",
@@ -4892,17 +4892,17 @@ COMMAND_CALLBACK(window)
ptr_win->win_height,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* refresh screen */
if (string_strcasecmp (argv[1], "refresh") == 0)
{
gui_window_ask_refresh (2);
return WEECHAT_RC_OK;
}
-
+
/* balance windows */
if (string_strcasecmp (argv[1], "balance") == 0)
{
@@ -4910,7 +4910,7 @@ COMMAND_CALLBACK(window)
gui_window_ask_refresh (1);
return WEECHAT_RC_OK;
}
-
+
/*
* search window, for actions related to a given window
* (default is current window if no number is given)
@@ -4935,21 +4935,21 @@ COMMAND_CALLBACK(window)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
-
+
/* page up */
if (string_strcasecmp (argv[1], "page_up") == 0)
{
gui_window_page_up (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* page down */
if (string_strcasecmp (argv[1], "page_down") == 0)
{
gui_window_page_down (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* vertical scroll */
if (string_strcasecmp (argv[1], "scroll") == 0)
{
@@ -4957,7 +4957,7 @@ COMMAND_CALLBACK(window)
gui_window_scroll (ptr_win, argv[win_args]);
return WEECHAT_RC_OK;
}
-
+
/* horizontal scroll in window (for buffers with free content) */
if (string_strcasecmp (argv[1], "scroll_horiz") == 0)
{
@@ -4968,49 +4968,49 @@ COMMAND_CALLBACK(window)
}
return WEECHAT_RC_OK;
}
-
+
/* scroll up */
if (string_strcasecmp (argv[1], "scroll_up") == 0)
{
gui_window_scroll_up (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* scroll down */
if (string_strcasecmp (argv[1], "scroll_down") == 0)
{
gui_window_scroll_down (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* scroll to top of window */
if (string_strcasecmp (argv[1], "scroll_top") == 0)
{
gui_window_scroll_top (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* scroll to bottom of window */
if (string_strcasecmp (argv[1], "scroll_bottom") == 0)
{
gui_window_scroll_bottom (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* scroll to previous highlight */
if (string_strcasecmp (argv[1], "scroll_previous_highlight") == 0)
{
gui_window_scroll_previous_highlight (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* scroll to next highlight */
if (string_strcasecmp (argv[1], "scroll_next_highlight") == 0)
{
gui_window_scroll_next_highlight (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* split window horizontally */
if (string_strcasecmp (argv[1], "splith") == 0)
{
@@ -5026,10 +5026,10 @@ COMMAND_CALLBACK(window)
}
else
gui_window_split_horizontal (ptr_win, 50);
-
+
return WEECHAT_RC_OK;
}
-
+
/* split window vertically */
if (string_strcasecmp (argv[1], "splitv") == 0)
{
@@ -5045,10 +5045,10 @@ COMMAND_CALLBACK(window)
}
else
gui_window_split_vertical (ptr_win, 50);
-
+
return WEECHAT_RC_OK;
}
-
+
/* resize window */
if (string_strcasecmp (argv[1], "resize") == 0)
{
@@ -5078,7 +5078,7 @@ COMMAND_CALLBACK(window)
}
return WEECHAT_RC_OK;
}
-
+
/* merge windows */
if (string_strcasecmp (argv[1], "merge") == 0)
{
@@ -5110,49 +5110,49 @@ COMMAND_CALLBACK(window)
}
return WEECHAT_RC_OK;
}
-
+
/* switch to previous window */
if (string_strcasecmp (argv[1], "-1") == 0)
{
gui_window_switch_previous (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* switch to next window */
if (string_strcasecmp (argv[1], "+1") == 0)
{
gui_window_switch_next (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* switch to window above */
if (string_strcasecmp (argv[1], "up") == 0)
{
gui_window_switch_up (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* switch to window below */
if (string_strcasecmp (argv[1], "down") == 0)
{
gui_window_switch_down (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* switch to window on the left */
if (string_strcasecmp (argv[1], "left") == 0)
{
gui_window_switch_left (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* switch to window on the right */
if (string_strcasecmp (argv[1], "right") == 0)
{
gui_window_switch_right (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* swap windows */
if (string_strcasecmp (argv[1], "swap") == 0)
{
@@ -5182,14 +5182,14 @@ COMMAND_CALLBACK(window)
}
return WEECHAT_RC_OK;
}
-
+
/* zoom window */
if (string_strcasecmp (argv[1], "zoom") == 0)
{
gui_window_zoom (ptr_win);
return WEECHAT_RC_OK;
}
-
+
/* jump to window by buffer number */
if (string_strncasecmp (argv[1], "b", 1) == 0)
{
@@ -5201,7 +5201,7 @@ COMMAND_CALLBACK(window)
return WEECHAT_RC_OK;
}
}
-
+
/* jump to window by number */
error = NULL;
number = strtol (argv[1], &error, 10);
@@ -5210,7 +5210,7 @@ COMMAND_CALLBACK(window)
gui_window_switch_by_number (number);
return WEECHAT_RC_OK;
}
-
+
gui_chat_printf (NULL,
_("%sError: unknown option for \"%s\" "
"command"),
@@ -6083,12 +6083,12 @@ command_startup (int plugins_loaded)
{
char *command, **commands, **ptr_cmd;
struct t_gui_buffer *weechat_buffer;
-
+
if (plugins_loaded)
command = CONFIG_STRING(config_startup_command_after_plugins);
else
command = CONFIG_STRING(config_startup_command_before_plugins);
-
+
if (command && command[0])
{
commands = string_split_command (command, ';');
diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c
index 6f4bc06e2..631054968 100644
--- a/src/core/wee-completion.c
+++ b/src/core/wee-completion.c
@@ -65,18 +65,18 @@ completion_list_add_bars_names_cb (void *data,
struct t_gui_completion *completion)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
gui_completion_list_add (completion, ptr_bar->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -91,18 +91,18 @@ completion_list_add_bars_options_cb (void *data,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++)
{
gui_completion_list_add (completion, gui_bar_option_string[i],
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -117,19 +117,19 @@ completion_list_add_buffers_names_cb (void *data,
struct t_gui_completion *completion)
{
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
gui_completion_list_add (completion, ptr_buffer->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -145,12 +145,12 @@ completion_list_add_buffers_numbers_cb (void *data,
{
struct t_gui_buffer *ptr_buffer;
char str_number[32];
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -158,7 +158,7 @@ completion_list_add_buffers_numbers_cb (void *data,
gui_completion_list_add (completion, str_number,
0, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -175,12 +175,12 @@ completion_list_add_buffers_plugins_names_cb (void *data,
{
struct t_gui_buffer *ptr_buffer;
char name[512];
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -190,7 +190,7 @@ completion_list_add_buffers_plugins_names_cb (void *data,
gui_completion_list_add (completion, name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -206,19 +206,19 @@ completion_list_add_buffer_properties_set_cb (void *data,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; gui_buffer_properties_set[i]; i++)
{
gui_completion_list_add (completion,
gui_buffer_properties_set[i],
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -234,12 +234,12 @@ completion_list_add_buffer_properties_get_cb (void *data,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; gui_buffer_properties_get_integer[i]; i++)
{
gui_completion_list_add (completion,
@@ -258,7 +258,7 @@ completion_list_add_buffer_properties_get_cb (void *data,
gui_buffer_properties_get_pointer[i],
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -274,19 +274,19 @@ completion_list_add_windows_numbers_cb (void *data,
{
struct t_gui_window *ptr_win;
char str_number[32];
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
snprintf (str_number, sizeof (str_number), "%d", ptr_win->number);
gui_completion_list_add (completion, str_number,
0, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -302,7 +302,7 @@ completion_list_map_add_palette_color_cb (void *data,
/* make C compiler happy */
(void) hashtable;
(void) value;
-
+
gui_completion_list_add ((struct t_gui_completion *)data,
(char *)key,
0, WEECHAT_LIST_POS_SORT);
@@ -322,11 +322,11 @@ completion_list_add_palette_colors_cb (void *data,
(void) data;
(void) completion_item;
(void) buffer;
-
+
hashtable_map (gui_color_hash_palette_color,
&completion_list_map_add_palette_color_cb,
completion);
-
+
return WEECHAT_RC_OK;
}
@@ -341,19 +341,19 @@ completion_list_add_config_files_cb (void *data,
struct t_gui_completion *completion)
{
struct t_config_file *ptr_config_file;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
gui_completion_list_add (completion, ptr_config_file->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -375,19 +375,19 @@ completion_list_add_filename_cb (void *data,
struct dirent *entry;
struct stat statbuf;
char home[3] = { '~', DIR_SEPARATOR_CHAR, '\0' };
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
buf_len = PATH_MAX;
buf = malloc (buf_len);
if (!buf)
return WEECHAT_RC_OK;
-
+
completion->add_space = 0;
-
+
if ((strncmp (completion->base_word, home, 2) == 0) && getenv("HOME"))
{
real_prefix = strdup (getenv("HOME"));
@@ -407,7 +407,7 @@ completion_list_add_filename_cb (void *data,
prefix = strdup (DIR_SEPARATOR);
}
}
-
+
snprintf (buf, buf_len, "%s", completion->base_word + strlen (prefix));
p = strrchr (buf, DIR_SEPARATOR_CHAR);
if (p)
@@ -422,7 +422,7 @@ completion_list_add_filename_cb (void *data,
path_d = strdup ("");
path_b = strdup (buf);
}
-
+
sprintf (buf, "%s%s%s", real_prefix, DIR_SEPARATOR, path_d);
d_name = strdup (buf);
dp = opendir (d_name);
@@ -434,12 +434,12 @@ completion_list_add_filename_cb (void *data,
{
if (strcmp (entry->d_name, ".") == 0 || strcmp (entry->d_name, "..") == 0)
continue;
-
+
snprintf (buf, buf_len, "%s%s%s",
d_name, DIR_SEPARATOR, entry->d_name);
if (stat (buf, &statbuf) == -1)
continue;
-
+
snprintf (buf, buf_len, "%s%s%s%s%s%s",
prefix,
((strcmp(prefix, "") == 0)
@@ -448,21 +448,21 @@ completion_list_add_filename_cb (void *data,
strcmp(path_d, "") == 0 ? "" : DIR_SEPARATOR,
entry->d_name,
S_ISDIR(statbuf.st_mode) ? DIR_SEPARATOR : "");
-
+
gui_completion_list_add (completion, buf,
0, WEECHAT_LIST_POS_SORT);
}
}
closedir (dp);
}
-
+
free (d_name);
free (prefix);
free (real_prefix);
free (path_d);
free (path_b);
free (buf);
-
+
return WEECHAT_RC_OK;
}
@@ -477,19 +477,19 @@ completion_list_add_filters_cb (void *data,
struct t_gui_completion *completion)
{
struct t_gui_filter *ptr_filter;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
gui_completion_list_add (completion, ptr_filter->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -504,12 +504,12 @@ completion_list_add_commands_cb (void *data,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -520,7 +520,7 @@ completion_list_add_commands_cb (void *data,
HOOK_COMMAND(ptr_hook, command),
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -535,12 +535,12 @@ completion_list_add_infos_cb (void *data,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_INFO]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -551,7 +551,7 @@ completion_list_add_infos_cb (void *data,
HOOK_INFO(ptr_hook, info_name),
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -566,12 +566,12 @@ completion_list_add_infolists_cb (void *data,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -582,7 +582,7 @@ completion_list_add_infolists_cb (void *data,
HOOK_INFOLIST(ptr_hook, infolist_name),
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -599,12 +599,12 @@ completion_list_add_nicks_cb (void *data,
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
int count_before;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
count_before = weelist_size (completion->completion_list);
hook_completion_exec (completion->buffer->plugin,
"nick",
@@ -630,7 +630,7 @@ completion_list_add_nicks_cb (void *data,
&ptr_group, &ptr_nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -650,12 +650,12 @@ completion_list_add_config_options_cb (void *data,
struct t_config_option *ptr_option;
int length;
char *option_full_name;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_config = config_files; ptr_config;
ptr_config = ptr_config->next_config)
{
@@ -682,7 +682,7 @@ completion_list_add_config_options_cb (void *data,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -697,19 +697,19 @@ completion_list_add_plugins_cb (void *data,
struct t_gui_completion *completion)
{
struct t_weechat_plugin *ptr_plugin;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
gui_completion_list_add (completion, ptr_plugin->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -728,12 +728,12 @@ completion_list_add_plugins_commands_cb (void *data,
char *pos_space, *plugin_name;
struct t_weechat_plugin *ptr_plugin;
struct t_hook *ptr_hook;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (completion->args)
{
pos_space = strchr (completion->args, ' ');
@@ -742,7 +742,7 @@ completion_list_add_plugins_commands_cb (void *data,
pos_space - completion->args);
else
plugin_name = strdup (completion->args);
-
+
if (plugin_name)
{
ptr_plugin = NULL;
@@ -772,7 +772,7 @@ completion_list_add_plugins_commands_cb (void *data,
free (plugin_name);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -788,7 +788,7 @@ completion_list_map_add_color_alias_cb (void *data,
/* make C compiler happy */
(void) hashtable;
(void) value;
-
+
gui_completion_list_add ((struct t_gui_completion *)data,
(char *)key,
0, WEECHAT_LIST_POS_SORT);
@@ -813,12 +813,12 @@ completion_list_add_config_option_values_cb (void *data,
struct t_config_section *ptr_section, *section_found;
struct t_config_option *option_found;
struct t_gui_color_palette *color_palette;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (completion->args)
{
pos_space = strchr (completion->args, ' ');
@@ -827,16 +827,16 @@ completion_list_add_config_option_values_cb (void *data,
pos_space - completion->args);
else
option_full_name = strdup (completion->args);
-
+
if (option_full_name)
{
file = NULL;
section = NULL;
pos_option = NULL;
-
+
pos_section = strchr (option_full_name, '.');
pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL;
-
+
if (pos_section && pos_option)
{
file = string_strndup (option_full_name,
@@ -1043,7 +1043,7 @@ completion_list_add_config_option_values_cb (void *data,
free (section);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1059,12 +1059,12 @@ completion_list_add_weechat_commands_cb (void *data,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -1078,7 +1078,7 @@ completion_list_add_weechat_commands_cb (void *data,
0, WEECHAT_LIST_POS_SORT);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1093,19 +1093,19 @@ completion_list_add_proxies_names_cb (void *data,
struct t_gui_completion *completion)
{
struct t_proxy *ptr_proxy;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_proxy = weechat_proxies; ptr_proxy;
ptr_proxy = ptr_proxy->next_proxy)
{
gui_completion_list_add (completion, ptr_proxy->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1120,18 +1120,18 @@ completion_list_add_proxies_options_cb (void *data,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; i < PROXY_NUM_OPTIONS; i++)
{
gui_completion_list_add (completion, proxy_option_string[i],
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1146,18 +1146,18 @@ completion_list_add_keys_contexts_cb (void *data,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
gui_completion_list_add (completion, gui_key_context_string[i],
0, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1174,7 +1174,7 @@ completion_list_add_keys_codes_cb (void *data,
int i;
struct t_gui_key *ptr_key;
char *expanded_name;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
@@ -1192,7 +1192,7 @@ completion_list_add_keys_codes_cb (void *data,
free (expanded_name);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1211,7 +1211,7 @@ completion_list_add_keys_codes_for_reset_cb (void *data,
int i;
struct t_gui_key *ptr_key, *ptr_default_key;
char *expanded_name;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
@@ -1234,7 +1234,7 @@ completion_list_add_keys_codes_for_reset_cb (void *data,
free (expanded_name);
}
}
-
+
/* keys deleted */
for (ptr_default_key = gui_default_keys[i]; ptr_default_key;
ptr_default_key = ptr_default_key->next_key)
@@ -1251,7 +1251,7 @@ completion_list_add_keys_codes_for_reset_cb (void *data,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1268,15 +1268,15 @@ completion_list_add_cursor_areas_cb (void *data,
{
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
/* add "chat" for chat area */
gui_completion_list_add (completion, "chat", 0, WEECHAT_LIST_POS_SORT);
-
+
/* add bar windows (of current window) */
for (ptr_bar_win = gui_current_window->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
@@ -1292,7 +1292,7 @@ completion_list_add_cursor_areas_cb (void *data,
0, WEECHAT_LIST_POS_SORT);
}
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 12f3ac612..4cdcb4123 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -65,17 +65,17 @@ struct t_config_file *
config_file_search (const char *name)
{
struct t_config_file *ptr_config;
-
+
if (!name)
return NULL;
-
+
for (ptr_config = config_files; ptr_config;
ptr_config = ptr_config->next_config)
{
if (string_strcasecmp (ptr_config->name, name) == 0)
return ptr_config;
}
-
+
/* configuration file not found */
return NULL;
}
@@ -93,14 +93,14 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
struct t_config_file *new_config_file;
char *filename;
int length;
-
+
if (!name)
return NULL;
-
+
/* it's NOT authorized to create two configuration files with same filename */
if (config_file_search (name))
return NULL;
-
+
new_config_file = malloc (sizeof (*new_config_file));
if (new_config_file)
{
@@ -132,7 +132,7 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
new_config_file->callback_reload_data = callback_reload_data;
new_config_file->sections = NULL;
new_config_file->last_section = NULL;
-
+
new_config_file->prev_config = last_config_file;
new_config_file->next_config = NULL;
if (config_files)
@@ -141,7 +141,7 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
config_files = new_config_file;
last_config_file = new_config_file;
}
-
+
return new_config_file;
}
@@ -179,13 +179,13 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
void *callback_delete_option_data)
{
struct t_config_section *new_section;
-
+
if (!config_file || !name)
return NULL;
-
+
if (config_file_search_section (config_file, name))
return NULL;
-
+
new_section = malloc (sizeof (*new_section));
if (new_section)
{
@@ -210,7 +210,7 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
new_section->callback_delete_option_data = callback_delete_option_data;
new_section->options = NULL;
new_section->last_option = NULL;
-
+
new_section->prev_section = config_file->last_section;
new_section->next_section = NULL;
if (config_file->sections)
@@ -219,7 +219,7 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
config_file->sections = new_section;
config_file->last_section = new_section;
}
-
+
return new_section;
}
@@ -235,14 +235,14 @@ config_file_search_section (struct t_config_file *config_file,
if (!config_file || !section_name)
return NULL;
-
+
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
{
if (string_strcasecmp (ptr_section->name, section_name) == 0)
return ptr_section;
}
-
+
/* section not found */
return NULL;
}
@@ -256,10 +256,10 @@ config_file_option_full_name (struct t_config_option *option)
{
int length_option;
char *option_full_name;
-
+
if (!option)
return NULL;
-
+
length_option = strlen (option->config_file->name) + 1 +
strlen (option->section->name) + 1 + strlen (option->name) + 1;
option_full_name = malloc (length_option);
@@ -271,7 +271,7 @@ config_file_option_full_name (struct t_config_option *option)
option->section->name,
option->name);
}
-
+
return option_full_name;
}
@@ -283,7 +283,7 @@ void
config_file_hook_config_exec (struct t_config_option *option)
{
char *option_full_name, str_value[256];
-
+
if (option)
{
option_full_name = config_file_option_full_name (option);
@@ -322,7 +322,7 @@ config_file_hook_config_exec (struct t_config_option *option)
}
else
hook_config_exec (option_full_name, NULL);
-
+
free (option_full_name);
}
}
@@ -347,7 +347,7 @@ config_file_option_find_pos (struct t_config_section *section, const char *name)
return ptr_option;
}
}
-
+
/* position not found (we will add to the end of list) */
return NULL;
}
@@ -361,10 +361,10 @@ void
config_file_option_insert_in_section (struct t_config_option *option)
{
struct t_config_option *pos_option;
-
+
if (!option || !option->section)
return;
-
+
if (option->section->options)
{
pos_option = config_file_option_find_pos (option->section,
@@ -407,7 +407,7 @@ struct t_config_option *
config_file_option_malloc ()
{
struct t_config_option *new_option;
-
+
new_option = malloc (sizeof (*new_option));
if (new_option)
{
@@ -432,7 +432,7 @@ config_file_option_malloc ()
new_option->prev_option = NULL;
new_option->next_option = NULL;
}
-
+
return new_option;
}
@@ -463,14 +463,14 @@ config_file_new_option (struct t_config_file *config_file,
int var_type, int_value, argc, i, index_value;
long number;
char *error;
-
+
if (!name)
return NULL;
-
+
if (config_file && section
&& config_file_search_option (config_file, section, name))
return NULL;
-
+
var_type = -1;
for (i = 0; i < CONFIG_NUM_OPTION_TYPES; i++)
{
@@ -487,7 +487,7 @@ config_file_new_option (struct t_config_file *config_file,
type);
return NULL;
}
-
+
if (!null_value_allowed)
{
if (default_value && !value)
@@ -497,7 +497,7 @@ config_file_new_option (struct t_config_file *config_file,
if (!default_value || !value)
return NULL;
}
-
+
new_option = config_file_option_malloc ();
if (new_option)
{
@@ -677,14 +677,14 @@ config_file_new_option (struct t_config_file *config_file,
new_option->prev_option = NULL;
new_option->next_option = NULL;
}
-
+
/* run config hook(s) */
if (new_option->config_file && new_option->section)
{
config_file_hook_config_exec (new_option);
}
}
-
+
return new_option;
error:
@@ -730,7 +730,7 @@ config_file_search_option (struct t_config_file *config_file,
}
}
}
-
+
/* option not found */
return NULL;
}
@@ -749,10 +749,10 @@ config_file_search_section_option (struct t_config_file *config_file,
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
-
+
*section_found = NULL;
*option_found = NULL;
-
+
if (section)
{
for (ptr_option = section->options; ptr_option;
@@ -810,15 +810,15 @@ config_file_search_with_string (const char *option_name,
*option = NULL;
if (pos_option_name)
*pos_option_name = NULL;
-
+
ptr_config = NULL;
ptr_section = NULL;
ptr_option = NULL;
-
+
file_name = NULL;
section_name = NULL;
pos_option = NULL;
-
+
pos_section = strchr (option_name, '.');
pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL;
if (pos_section && pos_option)
@@ -845,12 +845,12 @@ config_file_search_with_string (const char *option_name,
}
}
}
-
+
if (file_name)
free (file_name);
if (section_name)
free (section_name);
-
+
if (config_file)
*config_file = ptr_config;
if (section)
@@ -867,10 +867,10 @@ int
config_file_string_boolean_is_valid (const char *text)
{
int i;
-
+
if (!text)
return 0;
-
+
for (i = 0; config_boolean_true[i]; i++)
{
if (string_strcasecmp (text, config_boolean_true[i]) == 0)
@@ -882,7 +882,7 @@ config_file_string_boolean_is_valid (const char *text)
if (string_strcasecmp (text, config_boolean_false[i]) == 0)
return 1;
}
-
+
/* text is not a boolean */
return 0;
}
@@ -896,16 +896,16 @@ int
config_file_string_to_boolean (const char *text)
{
int i;
-
+
if (!text)
return CONFIG_BOOLEAN_FALSE;
-
+
for (i = 0; config_boolean_true[i]; i++)
{
if (string_strcasecmp (text, config_boolean_true[i]) == 0)
return CONFIG_BOOLEAN_TRUE;
}
-
+
return CONFIG_BOOLEAN_FALSE;
}
@@ -921,12 +921,12 @@ int
config_file_option_reset (struct t_config_option *option, int run_callback)
{
int rc, old_value_was_null;
-
+
if (!option)
return WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option->default_value)
{
old_value_was_null = (option->value == NULL);
@@ -1018,20 +1018,20 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
&& run_callback && option->callback_change)
{
(void)(option->callback_change)(option->callback_change_data, option);
}
-
+
/* run config hook(s) */
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
&& option->config_file && option->section)
{
config_file_hook_config_exec (option);
}
-
+
return rc;
}
@@ -1050,12 +1050,12 @@ config_file_option_set (struct t_config_option *option, const char *value,
int value_int, i, rc, new_value_ok, old_value_was_null, old_value;
long number;
char *error;
-
+
if (!option)
return WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option->callback_check_value)
{
if (!(int)(option->callback_check_value)
@@ -1064,7 +1064,7 @@ config_file_option_set (struct t_config_option *option, const char *value,
value))
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
-
+
if (value)
{
old_value_was_null = (option->value == NULL);
@@ -1329,21 +1329,21 @@ config_file_option_set (struct t_config_option *option, const char *value,
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
-
+
/* run callback if asked and value was changed */
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
&& run_callback && option->callback_change)
{
(void)(option->callback_change)(option->callback_change_data, option);
}
-
+
/* run config hook(s) */
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
&& option->config_file && option->section)
{
config_file_hook_config_exec (option);
}
-
+
return rc;
}
@@ -1359,12 +1359,12 @@ int
config_file_option_set_null (struct t_config_option *option, int run_callback)
{
int rc;
-
+
if (!option)
return WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
/* null value is authorized only if it's allowed in option */
if (option->null_value_allowed)
{
@@ -1379,21 +1379,21 @@ config_file_option_set_null (struct t_config_option *option, int run_callback)
rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
}
}
-
+
/* run callback if asked and value was changed */
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
&& run_callback && option->callback_change)
{
(void)(option->callback_change)(option->callback_change_data, option);
}
-
+
/* run config hook(s) */
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
&& option->config_file && option->section)
{
config_file_hook_config_exec (option);
}
-
+
return rc;
}
@@ -1411,12 +1411,12 @@ config_file_option_unset (struct t_config_option *option)
{
int rc;
char *option_full_name;
-
+
if (!option)
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
-
+
rc = WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET;
-
+
if (option->section && option->section->user_can_delete_options)
{
/* delete option */
@@ -1426,7 +1426,7 @@ config_file_option_unset (struct t_config_option *option)
(option->callback_delete_data,
option);
}
-
+
option_full_name = config_file_option_full_name (option);
if (option->section->callback_delete_option)
@@ -1442,7 +1442,7 @@ config_file_option_unset (struct t_config_option *option)
config_file_option_free (option);
rc = WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
-
+
if (option_full_name)
{
hook_config_exec (option_full_name, NULL);
@@ -1465,7 +1465,7 @@ config_file_option_unset (struct t_config_option *option)
break;
}
}
-
+
return rc;
}
@@ -1478,7 +1478,7 @@ config_file_option_rename (struct t_config_option *option,
const char *new_name)
{
char *str_new_name;
-
+
if (!option || !new_name || !new_name[0]
|| config_file_search_option (option->config_file, option->section, new_name))
return;
@@ -1498,12 +1498,12 @@ config_file_option_rename (struct t_config_option *option,
if (option->section->last_option == option)
(option->section)->last_option = option->prev_option;
}
-
+
/* rename option */
if (option->name)
free (option->name);
option->name = str_new_name;
-
+
/* re-insert option in section */
if (option->section)
config_file_option_insert_in_section (option);
@@ -1520,7 +1520,7 @@ config_file_option_get_pointer (struct t_config_option *option,
{
if (!option || !property)
return NULL;
-
+
if (string_strcasecmp (property, "config_file") == 0)
return option->config_file;
else if (string_strcasecmp (property, "section") == 0)
@@ -1545,7 +1545,7 @@ config_file_option_get_pointer (struct t_config_option *option,
return option->prev_option;
else if (string_strcasecmp (property, "next_option") == 0)
return option->next_option;
-
+
return NULL;
}
@@ -1559,7 +1559,7 @@ config_file_option_is_null (struct t_config_option *option)
{
if (!option)
return 1;
-
+
return (option->value) ? 0 : 1;
}
@@ -1573,7 +1573,7 @@ config_file_option_default_is_null (struct t_config_option *option)
{
if (!option)
return 1;
-
+
return (option->default_value) ? 0 : 1;
}
@@ -1595,12 +1595,12 @@ config_file_option_set_with_string (const char *option_name, const char *value)
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *pos_option;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND;
-
+
config_file_search_with_string (option_name, &ptr_config, &ptr_section,
&ptr_option, &pos_option);
-
+
if (ptr_config && ptr_section)
{
if (ptr_option)
@@ -1623,7 +1623,7 @@ config_file_option_set_with_string (const char *option_name, const char *value)
}
}
}
-
+
return rc;
}
@@ -1636,7 +1636,7 @@ config_file_option_boolean (struct t_config_option *option)
{
if (!option)
return 0;
-
+
if (option->type == CONFIG_OPTION_TYPE_BOOLEAN)
return CONFIG_BOOLEAN(option);
else
@@ -1652,7 +1652,7 @@ config_file_option_boolean_default (struct t_config_option *option)
{
if (!option)
return 0;
-
+
if (option->type == CONFIG_OPTION_TYPE_BOOLEAN)
return CONFIG_BOOLEAN_DEFAULT(option);
else
@@ -1668,7 +1668,7 @@ config_file_option_integer (struct t_config_option *option)
{
if (!option)
return 0;
-
+
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
@@ -1696,7 +1696,7 @@ config_file_option_integer_default (struct t_config_option *option)
{
if (!option)
return 0;
-
+
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
@@ -1724,7 +1724,7 @@ config_file_option_string (struct t_config_option *option)
{
if (!option)
return NULL;
-
+
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
@@ -1755,7 +1755,7 @@ config_file_option_string_default (struct t_config_option *option)
{
if (!option)
return NULL;
-
+
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
@@ -1813,12 +1813,12 @@ config_file_write_option (struct t_config_file *config_file,
struct t_config_option *option)
{
int rc;
-
+
if (!config_file || !config_file->file || !option)
return 0;
-
+
rc = 1;
-
+
if (option->value)
{
switch (option->type)
@@ -1858,7 +1858,7 @@ config_file_write_option (struct t_config_file *config_file,
rc = string_iconv_fprintf (config_file->file, "%s\n",
option->name);
}
-
+
return rc;
}
@@ -1873,10 +1873,10 @@ config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...)
{
int rc;
-
+
if (!config_file || !option_name)
return 0;
-
+
if (value && value[0])
{
weechat_va_format (value);
@@ -1892,7 +1892,7 @@ config_file_write_line (struct t_config_file *config_file,
free (vbuffer);
}
}
-
+
return (string_iconv_fprintf (config_file->file, "\n[%s]\n",
option_name));
}
@@ -1914,7 +1914,7 @@ config_file_write_internal (struct t_config_file *config_file,
char *filename, *filename2;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
-
+
if (!config_file)
return WEECHAT_CONFIG_WRITE_ERROR;
@@ -1926,7 +1926,7 @@ config_file_write_internal (struct t_config_file *config_file,
return WEECHAT_CONFIG_WRITE_MEMORY_ERROR;
snprintf (filename, filename_length, "%s%s%s",
weechat_home, DIR_SEPARATOR, config_file->filename);
-
+
/*
* build temporary filename, this temp file will be renamed to filename
* after write
@@ -1938,11 +1938,11 @@ config_file_write_internal (struct t_config_file *config_file,
return WEECHAT_CONFIG_WRITE_MEMORY_ERROR;
}
snprintf (filename2, filename_length + 32, "%s.weechattmp", filename);
-
+
log_printf (_("Writing configuration file %s %s"),
config_file->filename,
(default_options) ? _("(default options)") : "");
-
+
/* open temp file in write mode */
config_file->file = fopen (filename2, "wb");
if (!config_file->file)
@@ -1953,7 +1953,7 @@ config_file_write_internal (struct t_config_file *config_file,
filename2);
goto error;
}
-
+
/* write header with name of config file and WeeChat version */
if (!string_iconv_fprintf (config_file->file, "#\n"))
goto error;
@@ -1961,7 +1961,7 @@ config_file_write_internal (struct t_config_file *config_file,
"# %s -- %s v%s\n#\n",
config_file->filename, PACKAGE_NAME, PACKAGE_VERSION))
goto error;
-
+
/* write all sections */
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
@@ -1995,31 +1995,31 @@ config_file_write_internal (struct t_config_file *config_file,
}
}
}
-
+
if (fflush (config_file->file) != 0)
goto error;
-
+
/* close temp file */
fclose (config_file->file);
config_file->file = NULL;
-
+
/* update file mode */
chmod (filename2, 0600);
-
+
/* remove target file */
unlink (filename);
-
+
/* rename temp file to target file */
rc = rename (filename2, filename);
-
+
free (filename);
free (filename2);
-
+
if (rc != 0)
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
return WEECHAT_CONFIG_WRITE_OK;
-
+
error:
gui_chat_printf (NULL,
_("%sError writing configuration file \"%s\""),
@@ -2069,10 +2069,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char line[1024], *ptr_line, *ptr_line2, *pos, *pos2;
-
+
if (!config_file)
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
-
+
/* build filename */
filename_length = strlen (weechat_home) + strlen (config_file->filename) + 2;
filename = malloc (filename_length);
@@ -2095,10 +2095,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
}
-
+
if (!reload)
log_printf (_("Reading configuration file %s"), config_file->filename);
-
+
/* read all lines */
ptr_section = NULL;
line_number = 0;
@@ -2115,7 +2115,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
snprintf (line, sizeof (line) - 1, "%s", ptr_line2);
free (ptr_line2);
}
-
+
/* skip spaces */
while (ptr_line[0] == ' ')
ptr_line++;
@@ -2155,7 +2155,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
else
{
undefined_value = 1;
-
+
/* remove CR/LF */
pos = strchr (line, '\r');
if (pos != NULL)
@@ -2163,13 +2163,13 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
pos = strchr (line, '\n');
if (pos != NULL)
pos[0] = '\0';
-
+
pos = strstr (line, " =");
if (pos)
{
pos[0] = '\0';
pos += 2;
-
+
/* remove spaces before '=' */
pos2 = pos - 3;
while ((pos2 > line) && (pos2[0] == ' '))
@@ -2177,13 +2177,13 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
pos2[0] = '\0';
pos2--;
}
-
+
/* skip spaces after '=' */
while (pos[0] && (pos[0] == ' '))
{
pos++;
}
-
+
if (pos[0]
&& string_strcasecmp (pos, WEECHAT_CONFIG_OPTION_NULL) != 0)
{
@@ -2209,7 +2209,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
}
}
}
-
+
if (ptr_section && ptr_section->callback_read)
{
ptr_option = NULL;
@@ -2248,7 +2248,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
}
}
}
-
+
switch (rc)
{
case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND:
@@ -2283,11 +2283,11 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
}
}
}
-
+
fclose (config_file->file);
config_file->file = NULL;
free (filename);
-
+
return WEECHAT_CONFIG_READ_OK;
}
@@ -2319,12 +2319,12 @@ config_file_reload (struct t_config_file *config_file)
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
int rc;
-
+
if (!config_file)
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
-
+
log_printf (_("Reloading configuration file %s"), config_file->filename);
-
+
/* init "loaded" flag for all options */
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
@@ -2338,10 +2338,10 @@ config_file_reload (struct t_config_file *config_file)
}
}
}
-
+
/* read configuration file */
rc = config_file_read_internal (config_file, 1);
-
+
/* reset options not found in configuration file */
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
@@ -2356,7 +2356,7 @@ config_file_reload (struct t_config_file *config_file)
}
}
}
-
+
return rc;
}
@@ -2388,12 +2388,12 @@ config_file_option_free (struct t_config_option *option)
{
struct t_config_section *ptr_section;
struct t_config_option *new_options;
-
+
if (!option)
return;
-
+
ptr_section = option->section;
-
+
/* remove option from section */
if (ptr_section)
{
@@ -2410,10 +2410,10 @@ config_file_option_free (struct t_config_option *option)
(option->next_option)->prev_option = option->prev_option;
ptr_section->options = new_options;
}
-
+
/* free data */
config_file_option_free_data (option);
-
+
free (option);
}
@@ -2426,7 +2426,7 @@ config_file_section_free_options (struct t_config_section *section)
{
if (!section)
return;
-
+
while (section->options)
{
config_file_option_free (section->options);
@@ -2442,12 +2442,12 @@ config_file_section_free (struct t_config_section *section)
{
struct t_config_file *ptr_config;
struct t_config_section *new_sections;
-
+
if (!section)
return;
-
+
ptr_config = section->config_file;
-
+
/* remove section */
if (ptr_config->last_section == section)
ptr_config->last_section = section->prev_section;
@@ -2458,17 +2458,17 @@ config_file_section_free (struct t_config_section *section)
}
else
new_sections = section->next_section;
-
+
if (section->next_section)
(section->next_section)->prev_section = section->prev_section;
-
+
/* free data */
config_file_section_free_options (section);
if (section->name)
free (section->name);
-
+
free (section);
-
+
ptr_config->sections = new_sections;
}
@@ -2480,10 +2480,10 @@ void
config_file_free (struct t_config_file *config_file)
{
struct t_config_file *new_config_files;
-
+
if (!config_file)
return;
-
+
/* remove configuration file */
if (last_config_file == config_file)
last_config_file = config_file->prev_config;
@@ -2494,10 +2494,10 @@ config_file_free (struct t_config_file *config_file)
}
else
new_config_files = config_file->next_config;
-
+
if (config_file->next_config)
(config_file->next_config)->prev_config = config_file->prev_config;
-
+
/* free data */
while (config_file->sections)
{
@@ -2507,9 +2507,9 @@ config_file_free (struct t_config_file *config_file)
free (config_file->name);
if (config_file->filename)
free (config_file->filename);
-
+
free (config_file);
-
+
config_files = new_config_files;
}
@@ -2534,15 +2534,15 @@ void
config_file_free_all_plugin (struct t_weechat_plugin *plugin)
{
struct t_config_file *ptr_config, *next_config;
-
+
ptr_config = config_files;
while (ptr_config)
{
next_config = ptr_config->next_config;
-
+
if (ptr_config->plugin == plugin)
config_file_free (ptr_config);
-
+
ptr_config = next_config;
}
}
@@ -2555,10 +2555,10 @@ struct t_hdata *
config_file_hdata_config_file_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config");
if (hdata)
{
@@ -2586,10 +2586,10 @@ struct t_hdata *
config_file_hdata_config_section_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section");
if (hdata)
{
@@ -2623,10 +2623,10 @@ struct t_hdata *
config_file_hdata_config_option_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option");
if (hdata)
{
@@ -2669,10 +2669,10 @@ config_file_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
int length;
char *option_full_name, value[128], *string_values;
-
+
if (!infolist)
return 0;
-
+
for (ptr_config = config_files; ptr_config;
ptr_config = ptr_config->next_config)
{
@@ -2960,7 +2960,7 @@ config_file_add_to_infolist (struct t_infolist *infolist,
}
}
}
-
+
return 1;
}
@@ -2974,7 +2974,7 @@ config_file_print_log ()
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
-
+
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
@@ -2992,7 +2992,7 @@ config_file_print_log ()
log_printf (" last_section . . . . . : 0x%lx", ptr_config_file->last_section);
log_printf (" prev_config. . . . . . : 0x%lx", ptr_config_file->prev_config);
log_printf (" next_config. . . . . . : 0x%lx", ptr_config_file->next_config);
-
+
for (ptr_section = ptr_config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
{
@@ -3014,7 +3014,7 @@ config_file_print_log ()
log_printf (" last_option. . . . . . . . : 0x%lx", ptr_section->last_option);
log_printf (" prev_section . . . . . . . : 0x%lx", ptr_section->prev_section);
log_printf (" next_section . . . . . . . : 0x%lx", ptr_section->next_section);
-
+
for (ptr_option = ptr_section->options; ptr_option;
ptr_option = ptr_option->next_option)
{
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 42a65a044..147ee728d 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -252,7 +252,7 @@ config_change_save_config_on_exit (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!CONFIG_BOOLEAN(config_look_save_config_on_exit))
{
gui_chat_printf (NULL,
@@ -272,7 +272,7 @@ config_change_title (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
}
@@ -287,7 +287,7 @@ config_change_buffers (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_window_ask_refresh (1);
}
@@ -301,7 +301,7 @@ config_change_buffer_content (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (gui_ok)
gui_current_window->refresh_needed = 1;
}
@@ -316,7 +316,7 @@ config_change_buffer_notify_default (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_buffer_notify_set_all ();
}
@@ -330,7 +330,7 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_chat_time_length = gui_chat_get_time_length ();
gui_chat_change_time_format ();
if (gui_ok)
@@ -347,7 +347,7 @@ config_change_eat_newline_glitch (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (gui_ok)
{
if (CONFIG_BOOLEAN(config_look_eat_newline_glitch))
@@ -367,14 +367,14 @@ config_change_highlight_regex (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (config_highlight_regex)
{
regfree (config_highlight_regex);
free (config_highlight_regex);
config_highlight_regex = NULL;
}
-
+
if (CONFIG_STRING(config_look_highlight_regex)
&& CONFIG_STRING(config_look_highlight_regex)[0])
{
@@ -402,14 +402,14 @@ config_change_highlight_tags (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (config_highlight_tags)
{
string_free_split (config_highlight_tags);
config_highlight_tags = NULL;
}
config_num_highlight_tags = 0;
-
+
if (CONFIG_STRING(config_look_highlight_tags)
&& CONFIG_STRING(config_look_highlight_tags)[0])
{
@@ -428,7 +428,7 @@ config_change_hotlist (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_hotlist_resort ();
}
@@ -442,7 +442,7 @@ config_change_read_marker (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_window_ask_refresh (1);
}
@@ -456,7 +456,7 @@ config_change_prefix (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_chat_prefix_build ();
}
@@ -468,11 +468,11 @@ void
config_change_prefix_align_min (void *data, struct t_config_option *option)
{
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -494,7 +494,7 @@ config_change_color (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (gui_ok)
{
gui_color_init_weechat ();
@@ -512,7 +512,7 @@ config_change_nick_colors (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_color_buffer_display ();
}
@@ -527,7 +527,7 @@ config_change_network_gnutls_ca_file (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (network_init_ok)
network_set_gnutls_ca_file ();
}
@@ -546,15 +546,15 @@ config_day_change_timer_cb (void *data, int remaining_calls)
int new_mday;
char text_time[256], *text_time2;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
gettimeofday (&tv_time, NULL);
local_time = localtime (&tv_time.tv_sec);
new_mday = local_time->tm_mday;
-
+
if ((config_day_change_old_day >= 0)
&& (new_mday != config_day_change_old_day))
{
@@ -580,14 +580,14 @@ config_day_change_timer_cb (void *data, int remaining_calls)
free (text_time2);
gui_add_hotlist = 1;
}
-
+
/* send signal "day_changed" */
strftime (text_time, sizeof (text_time), "%Y-%m-%d", local_time);
hook_signal_send ("day_changed", WEECHAT_HOOK_SIGNAL_STRING, text_time);
}
-
+
config_day_change_old_day = new_mday;
-
+
return WEECHAT_RC_OK;
}
@@ -600,11 +600,11 @@ void
config_weechat_init_after_read ()
{
int i;
-
+
gui_buffer_notify_set_all ();
-
+
proxy_use_temp_proxies ();
-
+
gui_bar_use_temp_bars ();
if (gui_bars)
{
@@ -619,7 +619,7 @@ config_weechat_init_after_read ()
/* no bar defined => create default bars */
gui_bar_create_default ();
}
-
+
/* if no key was found config file, then we use default bindings */
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
@@ -640,38 +640,38 @@ int
config_weechat_reload_cb (void *data, struct t_config_file *config_file)
{
int i, rc;
-
+
/* make C compiler happy */
(void) data;
-
+
/* remove all keys */
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
gui_key_free_all (&gui_keys[i], &last_gui_key[i],
&gui_keys_count[i]);
}
-
+
/* remove all proxies */
proxy_free_all ();
-
+
/* remove all bars */
gui_bar_free_all ();
-
+
/* remove layout */
gui_layout_buffer_reset (&gui_layout_buffers, &last_gui_layout_buffer);
gui_layout_window_reset (&gui_layout_windows);
-
+
/* remove all notify levels */
config_file_section_free_options (weechat_config_section_notify);
-
+
/* remove all filters */
gui_filter_free_all ();
-
+
rc = config_file_reload (config_file);
-
+
if (rc == WEECHAT_CONFIG_READ_OK)
config_weechat_init_after_read ();
-
+
return rc;
}
@@ -697,11 +697,11 @@ config_weechat_debug_set_all ()
{
struct t_config_option *ptr_option;
struct t_weechat_plugin *ptr_plugin;
-
+
/* set debug for core */
ptr_option = config_weechat_debug_get (PLUGIN_CORE);
weechat_debug_core = (ptr_option) ? CONFIG_INTEGER(ptr_option) : 0;
-
+
/* set debug for plugins */
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
@@ -722,7 +722,7 @@ config_weechat_debug_change_cb (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
config_weechat_debug_set_all ();
}
@@ -739,12 +739,12 @@ config_weechat_debug_create_option_cb (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = config_file_search_option (config_file, section,
@@ -777,10 +777,10 @@ config_weechat_debug_create_option_cb (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
/* set debug level for "core" and all plugins */
config_weechat_debug_set_all ();
-
+
return rc;
}
@@ -798,11 +798,11 @@ config_weechat_debug_delete_option_cb (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
config_file_option_free (option);
-
+
config_weechat_debug_set_all ();
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -830,11 +830,11 @@ config_weechat_palette_change_cb (void *data,
{
char *error;
int number;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
error = NULL;
number = (int)strtol (option->name, &error, 10);
if (error && !error[0])
@@ -857,10 +857,10 @@ config_weechat_palette_create_option_cb (void *data,
struct t_config_option *ptr_option;
char *error;
int rc, number;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
error = NULL;
@@ -908,7 +908,7 @@ config_weechat_palette_create_option_cb (void *data,
_("%sError: palette option must be numeric"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
}
-
+
return rc;
}
@@ -924,19 +924,19 @@ config_weechat_palette_delete_option_cb (void *data,
{
char *error;
int number;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
error = NULL;
number = (int)strtol (option->name, &error, 10);
if (error && !error[0])
gui_color_palette_remove (number);
-
+
config_file_option_free (option);
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -952,12 +952,12 @@ config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file,
char *pos_option, *proxy_name;
struct t_proxy *ptr_temp_proxy;
int index_option;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name)
{
pos_option = strchr (option_name, '.');
@@ -982,7 +982,7 @@ config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file,
/* add new temp proxy at end of queue */
ptr_temp_proxy->prev_proxy = last_weechat_temp_proxy;
ptr_temp_proxy->next_proxy = NULL;
-
+
if (!weechat_temp_proxies)
weechat_temp_proxies = ptr_temp_proxy;
else
@@ -990,7 +990,7 @@ config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file,
last_weechat_temp_proxy = ptr_temp_proxy;
}
}
-
+
if (ptr_temp_proxy)
{
index_option = proxy_search_option (pos_option);
@@ -1000,12 +1000,12 @@ config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file,
value);
}
}
-
+
free (proxy_name);
}
}
}
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -1021,12 +1021,12 @@ config_weechat_bar_read_cb (void *data, struct t_config_file *config_file,
char *pos_option, *bar_name;
struct t_gui_bar *ptr_temp_bar;
int index_option;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name)
{
pos_option = strchr (option_name, '.');
@@ -1051,7 +1051,7 @@ config_weechat_bar_read_cb (void *data, struct t_config_file *config_file,
/* add new temp bar at end of queue */
ptr_temp_bar->prev_bar = last_gui_temp_bar;
ptr_temp_bar->next_bar = NULL;
-
+
if (!gui_temp_bars)
gui_temp_bars = ptr_temp_bar;
else
@@ -1059,7 +1059,7 @@ config_weechat_bar_read_cb (void *data, struct t_config_file *config_file,
last_gui_temp_bar = ptr_temp_bar;
}
}
-
+
if (ptr_temp_bar)
{
index_option = gui_bar_search_option (pos_option);
@@ -1069,12 +1069,12 @@ config_weechat_bar_read_cb (void *data, struct t_config_file *config_file,
value);
}
}
-
+
free (bar_name);
}
}
}
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -1091,12 +1091,12 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
char **argv, *error1, *error2, *error3, *error4;
long number1, number2, number3, number4;
struct t_gui_layout_window *parent;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name && value && value[0])
{
if (string_strcasecmp (option_name, "buffer") == 0)
@@ -1153,7 +1153,7 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
}
}
}
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -1176,21 +1176,21 @@ config_weechat_layout_write_tree (struct t_config_file *config_file,
(layout_window->buffer_name) ?
layout_window->buffer_name : "-"))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
if (layout_window->child1)
{
if (config_weechat_layout_write_tree (config_file,
layout_window->child1) != WEECHAT_CONFIG_WRITE_OK)
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
if (layout_window->child2)
{
if (config_weechat_layout_write_tree (config_file,
layout_window->child2) != WEECHAT_CONFIG_WRITE_OK)
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1203,13 +1203,13 @@ config_weechat_layout_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!config_file_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
@@ -1219,14 +1219,14 @@ config_weechat_layout_write_cb (void *data, struct t_config_file *config_file,
ptr_layout_buffer->number))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
if (gui_layout_windows)
{
if (config_weechat_layout_write_tree (config_file,
gui_layout_windows) != WEECHAT_CONFIG_WRITE_OK)
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1240,7 +1240,7 @@ config_weechat_notify_change_cb (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
gui_buffer_notify_set_all ();
}
@@ -1258,12 +1258,12 @@ config_weechat_notify_create_option_cb (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = config_file_search_option (config_file, section,
@@ -1296,10 +1296,10 @@ config_weechat_notify_create_option_cb (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
gui_buffer_notify_set_all ();
-
+
return rc;
}
@@ -1318,11 +1318,11 @@ config_weechat_notify_delete_option_cb (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
config_file_option_free (option);
-
+
gui_buffer_notify_set_all ();
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -1339,10 +1339,10 @@ config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify)
const char *plugin_name;
char *option_name;
int i, value, length;
-
+
if (!buffer || !notify)
return 0;
-
+
value = -1;
for (i = 0; i < GUI_BUFFER_NUM_NOTIFY; i++)
{
@@ -1354,14 +1354,14 @@ config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify)
}
if ((value < 0) && (strcmp (notify, "reset") != 0))
return 0;
-
+
plugin_name = gui_buffer_get_plugin_name (buffer);
length = strlen (plugin_name) + 1 + strlen (buffer->name) + 1;
option_name = malloc (length);
if (option_name)
{
snprintf (option_name, length, "%s.%s", plugin_name, buffer->name);
-
+
/* create/update option */
config_weechat_notify_create_option_cb (NULL,
weechat_config_file,
@@ -1371,7 +1371,7 @@ config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify)
NULL : gui_buffer_notify_string[value]);
return 1;
}
-
+
return 0;
}
@@ -1387,12 +1387,12 @@ config_weechat_filter_read_cb (void *data,
{
char **argv, **argv_eol;
int argc;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name && value && value[0])
{
argv = string_split (value, ";", 0, 0, &argc);
@@ -1407,7 +1407,7 @@ config_weechat_filter_read_cb (void *data,
if (argv_eol)
string_free_split (argv_eol);
}
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -1420,13 +1420,13 @@ config_weechat_filter_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_filter *ptr_filter;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!config_file_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
@@ -1439,7 +1439,7 @@ config_weechat_filter_write_cb (void *data, struct t_config_file *config_file,
ptr_filter->regex))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1454,11 +1454,11 @@ config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
{
int context;
char *pos;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
-
+
if (option_name)
{
context = GUI_KEY_CONTEXT_DEFAULT;
@@ -1469,7 +1469,7 @@ config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
if (context < 0)
context = GUI_KEY_CONTEXT_DEFAULT;
}
-
+
if (value && value[0])
{
/* bind key (overwrite any binding with same key) */
@@ -1481,7 +1481,7 @@ config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
gui_key_unbind (NULL, context, option_name);
}
}
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -1496,10 +1496,10 @@ config_weechat_key_write_cb (void *data, struct t_config_file *config_file,
struct t_gui_key *ptr_key;
char *pos, *expanded_name;
int rc, context;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!config_file_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
@@ -1526,7 +1526,7 @@ config_weechat_key_write_cb (void *data, struct t_config_file *config_file,
return WEECHAT_CONFIG_WRITE_ERROR;
}
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1541,12 +1541,12 @@ config_weechat_init_options ()
struct t_config_section *ptr_section;
int i;
char section_name[128];
-
+
weechat_config_file = config_file_new (NULL, WEECHAT_CONFIG_NAME,
&config_weechat_reload_cb, NULL);
if (!weechat_config_file)
return 0;
-
+
/* debug */
ptr_section = config_file_new_section (weechat_config_file, "debug",
1, 1,
@@ -1559,9 +1559,9 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
weechat_config_section_debug = ptr_section;
-
+
/* startup */
ptr_section = config_file_new_section (weechat_config_file, "startup",
0, 0,
@@ -1572,7 +1572,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_startup_command_after_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"command_after_plugins", "string",
@@ -1593,7 +1593,7 @@ config_weechat_init_options ()
"display_version", "boolean",
N_("display WeeChat version at startup"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* look */
ptr_section = config_file_new_section (weechat_config_file, "look",
0, 0,
@@ -1604,7 +1604,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_look_align_end_of_lines = config_file_new_option (
weechat_config_file, ptr_section,
"align_end_of_lines", "integer",
@@ -2051,7 +2051,7 @@ config_weechat_init_options ()
N_("time format for dates converted to strings and displayed in "
"messages"),
NULL, 0, 0, "%a, %d %b %Y %T", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* palette */
ptr_section = config_file_new_section (weechat_config_file, "palette",
1, 1,
@@ -2064,7 +2064,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
/* colors */
ptr_section = config_file_new_section (weechat_config_file, "color",
0, 0,
@@ -2075,9 +2075,9 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
weechat_config_section_color = ptr_section;
-
+
/* general color settings */
config_color_separator = config_file_new_option (
weechat_config_file, ptr_section,
@@ -2414,7 +2414,7 @@ config_weechat_init_options ()
N_("text color for offline nicknames"),
NULL, -1, 0, "blue", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
-
+
/* completion */
ptr_section = config_file_new_section (weechat_config_file, "completion",
0, 0,
@@ -2425,7 +2425,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_completion_default_template = config_file_new_option (
weechat_config_file, ptr_section,
"default_template", "string",
@@ -2482,7 +2482,7 @@ config_weechat_init_options ()
"partial_completion_count", "boolean",
N_("display count for each partial completion in bar item"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* history */
ptr_section = config_file_new_section (weechat_config_file, "history",
0, 0,
@@ -2493,7 +2493,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_history_max_lines = config_file_new_option (
weechat_config_file, ptr_section,
"max_lines", "integer",
@@ -2517,7 +2517,7 @@ config_weechat_init_options ()
N_("maximum number of commands to display by default in "
"history listing (0 = unlimited)"),
NULL, 0, INT_MAX, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* proxies */
ptr_section = config_file_new_section (weechat_config_file, "proxy",
0, 0,
@@ -2529,7 +2529,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
weechat_config_section_proxy = ptr_section;
/* network */
@@ -2542,7 +2542,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_network_gnutls_ca_file = config_file_new_option (
weechat_config_file, ptr_section,
"gnutls_ca_file", "string",
@@ -2555,7 +2555,7 @@ config_weechat_init_options ()
"gnutls_handshake_timeout", "integer",
N_("timeout (in seconds) for gnutls handshake"),
NULL, 1, INT_MAX, "30", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* plugin */
ptr_section = config_file_new_section (weechat_config_file, "plugin",
0, 0,
@@ -2566,7 +2566,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
config_plugin_autoload = config_file_new_option (
weechat_config_file, ptr_section,
"autoload", "string",
@@ -2605,7 +2605,7 @@ config_weechat_init_options ()
"save_config_on_unload", "boolean",
N_("save configuration files when unloading plugins"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* bars */
ptr_section = config_file_new_section (weechat_config_file, "bar",
0, 0,
@@ -2617,9 +2617,9 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
weechat_config_section_bar = ptr_section;
-
+
/* layout */
ptr_section = config_file_new_section (weechat_config_file, "layout",
0, 0,
@@ -2631,7 +2631,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
/* notify */
ptr_section = config_file_new_section (weechat_config_file, "notify",
1, 1,
@@ -2645,9 +2645,9 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
weechat_config_section_notify = ptr_section;
-
+
/* filters */
ptr_section = config_file_new_section (weechat_config_file, "filter",
0, 0,
@@ -2660,7 +2660,7 @@ config_weechat_init_options ()
config_file_free (weechat_config_file);
return 0;
}
-
+
/* keys */
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
@@ -2680,7 +2680,7 @@ config_weechat_init_options ()
return 0;
}
}
-
+
return 1;
}
@@ -2695,15 +2695,15 @@ config_weechat_init ()
int rc;
struct timeval tv_time;
struct tm *local_time;
-
+
rc = config_weechat_init_options ();
-
+
if (!rc)
{
gui_chat_printf (NULL,
_("FATAL: error initializing configuration options"));
}
-
+
if (!config_day_change_timer)
{
/* create timer to check if day has changed */
@@ -2721,7 +2721,7 @@ config_weechat_init ()
config_change_highlight_regex (NULL, NULL);
if (!config_highlight_tags)
config_change_highlight_tags (NULL, NULL);
-
+
return rc;
}
@@ -2737,18 +2737,18 @@ int
config_weechat_read ()
{
int rc;
-
+
rc = config_file_read (weechat_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
config_weechat_init_after_read ();
-
+
if (rc != WEECHAT_CONFIG_READ_OK)
{
gui_chat_printf (NULL,
_("%sError reading configuration"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
}
-
+
return rc;
}
diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c
index 14eabec89..6cdacb0f6 100644
--- a/src/core/wee-debug.c
+++ b/src/core/wee-debug.c
@@ -69,14 +69,14 @@ debug_dump (int crash)
/* prevent reentrance */
if (debug_dump_active)
exit (EXIT_FAILURE);
-
+
if (crash)
{
debug_dump_active = 1;
log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...");
weechat_log_use_time = 0;
}
-
+
log_printf ("");
if (crash)
{
@@ -97,19 +97,19 @@ debug_dump (int crash)
gui_bar_print_log ();
gui_bar_item_print_log ();
gui_hotlist_print_log ();
-
+
hdata_print_log ();
-
+
infolist_print_log ();
-
+
hook_print_log ();
-
+
config_file_print_log ();
-
+
proxy_print_log ();
-
+
plugin_print_log ();
-
+
log_printf ("");
log_printf ("****** End of WeeChat dump ******");
log_printf ("");
@@ -127,10 +127,10 @@ debug_dump_cb (void *data, const char *signal, const char *type_data,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data || (string_strcasecmp ((char *)signal_data, "core") == 0))
debug_dump (0);
-
+
return WEECHAT_RC_OK;
}
@@ -145,7 +145,7 @@ debug_sigsegv ()
debug_dump (1);
unhook_all ();
gui_main_end (0);
-
+
string_iconv_fprintf (stderr, "\n");
string_iconv_fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
if (!log_crash_rename ())
@@ -160,9 +160,9 @@ debug_sigsegv ()
string_iconv_fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
string_iconv_fprintf (stderr, "*** (be careful, private info may be in this file since\n");
string_iconv_fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
-
+
weechat_backtrace ();
-
+
/* shutdown with error code */
weechat_shutdown (EXIT_FAILURE, 1);
}
@@ -179,9 +179,9 @@ debug_buffer_cb (void *data, const char *signal, const char *type_data,
(void) data;
(void) signal;
(void) type_data;
-
+
gui_buffer_dump_hexa ((struct t_gui_buffer *)signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -193,7 +193,7 @@ void
debug_windows_tree_display (struct t_gui_window_tree *tree, int indent)
{
char format[128];
-
+
if (tree)
{
if (tree->window)
@@ -229,7 +229,7 @@ debug_windows_tree_display (struct t_gui_window_tree *tree, int indent)
tree->split_horizontal,
tree->child1, tree->child2);
}
-
+
if (tree->child1)
debug_windows_tree_display (tree->child1, indent + 1);
if (tree->child2)
@@ -262,9 +262,9 @@ debug_windows_cb (void *data, const char *signal, const char *type_data,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
debug_windows_tree ();
-
+
return WEECHAT_RC_OK;
}
@@ -277,9 +277,9 @@ debug_memory ()
{
#ifdef HAVE_MALLINFO
struct mallinfo info;
-
+
info = mallinfo ();
-
+
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Memory usage (see \"man mallinfo\" for help):"));
gui_chat_printf (NULL, " arena :%10d", info.arena);
@@ -310,12 +310,12 @@ debug_hdata_hash_var_map_cb (void *data,
{
struct t_weelist *list;
char str_offset[16];
-
+
/* make C compiler happy */
(void) hashtable;
-
+
list = (struct t_weelist *)data;
-
+
snprintf (str_offset, sizeof (str_offset),
"%12d", (*((int *)value)) & 0xFFFF);
weelist_add (list, str_offset, WEECHAT_LIST_POS_SORT, (void *)key);
@@ -333,7 +333,7 @@ debug_hdata_hash_list_map_cb (void *data,
/* make C compiler happy */
(void) data;
(void) hashtable;
-
+
gui_chat_printf (NULL,
" list: %s -> 0x%lx",
(char *)key,
@@ -352,13 +352,13 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
struct t_weelist *list;
struct t_weelist_item *ptr_item;
void *ptr_value;
-
+
/* make C compiler happy */
(void) data;
(void) hashtable;
-
+
ptr_hdata = (struct t_hdata *)value;
-
+
gui_chat_printf (NULL,
" hdata 0x%lx: \"%s\", %d vars, %d lists:",
ptr_hdata, (const char *)key,
@@ -366,11 +366,11 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
"items_count"),
hashtable_get_integer (ptr_hdata->hash_list,
"items_count"));
-
+
/* display lists */
hashtable_map (ptr_hdata->hash_list,
&debug_hdata_hash_list_map_cb, NULL);
-
+
/* display vars */
list = weelist_new ();
hashtable_map (ptr_hdata->hash_var,
@@ -399,12 +399,12 @@ void
debug_hdata ()
{
int count;
-
+
count = hashtable_get_integer (weechat_hdata, "items_count");
-
+
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, "%d hdata in memory", count);
-
+
if (count > 0)
hashtable_map (weechat_hdata, &debug_hdata_map_cb, NULL);
}
@@ -421,21 +421,21 @@ debug_infolists ()
struct t_infolist_var *ptr_var;
int i, count, count_items, count_vars, size_structs, size_data;
int total_items, total_vars, total_size;
-
+
count = 0;
for (ptr_infolist = weechat_infolists; ptr_infolist;
ptr_infolist = ptr_infolist->next_infolist)
{
count++;
}
-
+
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, "%d infolists in memory (%s)", count,
(count == 0) ?
"this is ok!" :
"WARNING: this is probably a memory leak in WeeChat or "
"plugins/scripts!");
-
+
if (count > 0)
{
i = 0;
diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c
index 41349a1bd..90eaa8a43 100644
--- a/src/core/wee-hashtable.c
+++ b/src/core/wee-hashtable.c
@@ -52,16 +52,16 @@ int
hashtable_get_type (const char *type)
{
int i;
-
+
if (!type)
return -1;
-
+
for (i = 0; i < HASHTABLE_NUM_TYPES; i++)
{
if (string_strcasecmp (hashtable_type_string[i], type) == 0)
return i;
}
-
+
/* type not found */
return -1;
}
@@ -75,7 +75,7 @@ hashtable_hash_key_string_cb (struct t_hashtable *hashtable, const void *key)
{
const char *ptr_key;
unsigned long hash;
-
+
/* variant of djb2 hash */
hash = 5381;
for (ptr_key = (const char *)key; ptr_key[0]; ptr_key++)
@@ -95,7 +95,7 @@ hashtable_keycmp_string_cb (struct t_hashtable *hashtable,
{
/* make C compiler happy */
(void) hashtable;
-
+
return strcmp ((const char *)key1, (const char *)key2);
}
@@ -111,17 +111,17 @@ hashtable_new (int size,
{
struct t_hashtable *new_hashtable;
int i, type_keys_int, type_values_int;
-
+
type_keys_int = hashtable_get_type (type_keys);
if (type_keys_int < 0)
return NULL;
type_values_int = hashtable_get_type (type_values);
if (type_values_int < 0)
return NULL;
-
+
if ((type_keys_int != HASHTABLE_STRING) && (!callback_hash_key || !callback_keycmp))
return NULL;
-
+
new_hashtable = malloc (sizeof (*new_hashtable));
if (new_hashtable)
{
@@ -140,17 +140,17 @@ hashtable_new (int size,
new_hashtable->htable[i] = NULL;
}
new_hashtable->items_count = 0;
-
+
if ((type_keys_int == HASHTABLE_STRING) && !callback_hash_key)
new_hashtable->callback_hash_key = &hashtable_hash_key_string_cb;
else
new_hashtable->callback_hash_key = callback_hash_key;
-
+
if ((type_keys_int == HASHTABLE_STRING) && !callback_keycmp)
new_hashtable->callback_keycmp = &hashtable_keycmp_string_cb;
else
new_hashtable->callback_keycmp = callback_keycmp;
-
+
new_hashtable->callback_free_value = NULL;
}
return new_hashtable;
@@ -281,14 +281,14 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
{
unsigned int hash;
struct t_hashtable_item *ptr_item, *pos_item, *new_item;
-
+
if (!hashtable || !key
|| ((hashtable->type_keys == HASHTABLE_BUFFER) && (key_size <= 0))
|| ((hashtable->type_values == HASHTABLE_BUFFER) && (value_size <= 0)))
{
return 0;
}
-
+
/* search position for item in hash table */
hash = hashtable->callback_hash_key (hashtable, key);
pos_item = NULL;
@@ -299,7 +299,7 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
{
pos_item = ptr_item;
}
-
+
/* replace value if item is already in hash table */
if (ptr_item && (hashtable->callback_keycmp (hashtable, key, ptr_item->key) == 0))
{
@@ -309,12 +309,12 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
&ptr_item->value, &ptr_item->value_size);
return 1;
}
-
+
/* create new item */
new_item = malloc (sizeof (*new_item));
if (!new_item)
return 0;
-
+
/* set key and value */
hashtable_alloc_type (hashtable->type_keys,
key, key_size,
@@ -322,7 +322,7 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
hashtable_alloc_type (hashtable->type_values,
value, value_size,
&new_item->value, &new_item->value_size);
-
+
/* add item */
if (pos_item)
{
@@ -342,9 +342,9 @@ hashtable_set_with_size (struct t_hashtable *hashtable,
(hashtable->htable[hash])->prev_item = new_item;
hashtable->htable[hash] = new_item;
}
-
+
hashtable->items_count++;
-
+
return 1;
}
@@ -374,10 +374,10 @@ hashtable_get_item (struct t_hashtable *hashtable, const void *key,
{
unsigned int key_hash;
struct t_hashtable_item *ptr_item;
-
+
if (!hashtable)
return NULL;
-
+
key_hash = hashtable->callback_hash_key (hashtable, key);
if (hash)
*hash = key_hash;
@@ -386,13 +386,13 @@ hashtable_get_item (struct t_hashtable *hashtable, const void *key,
ptr_item = ptr_item->next_item)
{
}
-
+
if (ptr_item
&& (hashtable->callback_keycmp (hashtable, key, ptr_item->key) == 0))
{
return ptr_item;
}
-
+
return NULL;
}
@@ -406,9 +406,9 @@ void *
hashtable_get (struct t_hashtable *hashtable, const void *key)
{
struct t_hashtable_item *ptr_item;
-
+
ptr_item = hashtable_get_item (hashtable, key, NULL);
-
+
return (ptr_item) ? ptr_item->value : NULL;
}
@@ -433,22 +433,22 @@ hashtable_map (struct t_hashtable *hashtable,
{
int i;
struct t_hashtable_item *ptr_item, *ptr_next_item;
-
+
if (!hashtable)
return;
-
+
for (i = 0; i < hashtable->size; i++)
{
ptr_item = hashtable->htable[i];
while (ptr_item)
{
ptr_next_item = ptr_item->next_item;
-
+
(void) (callback_map) (callback_map_data,
hashtable,
ptr_item->key,
ptr_item->value);
-
+
ptr_item = ptr_next_item;
}
}
@@ -465,10 +465,10 @@ hashtable_duplicate_map_cb (void *data,
const void *key, const void *value)
{
struct t_hashtable *hashtable2;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hashtable2 = (struct t_hashtable *)data;
if (hashtable2)
hashtable_set (hashtable2, key, value);
@@ -482,7 +482,7 @@ struct t_hashtable *
hashtable_dup (struct t_hashtable *hashtable)
{
struct t_hashtable *new_hashtable;
-
+
new_hashtable = hashtable_new (hashtable->size,
hashtable_type_string[hashtable->type_keys],
hashtable_type_string[hashtable->type_values],
@@ -495,7 +495,7 @@ hashtable_dup (struct t_hashtable *hashtable)
&hashtable_duplicate_map_cb,
new_hashtable);
}
-
+
return new_hashtable;
}
@@ -511,13 +511,13 @@ hashtable_get_list_keys_map_cb (void *data,
{
struct t_weelist *list;
char str_key[128];
-
+
/* make C compiler happy */
(void) hashtable;
(void) value;
-
+
list = (struct t_weelist *)data;
-
+
switch (hashtable->type_keys)
{
case HASHTABLE_INTEGER:
@@ -550,7 +550,7 @@ struct t_weelist *
hashtable_get_list_keys (struct t_hashtable *hashtable)
{
struct t_weelist *weelist;
-
+
weelist = weelist_new ();
if (weelist)
hashtable_map (hashtable, &hashtable_get_list_keys_map_cb, weelist);
@@ -571,7 +571,7 @@ hashtable_get_integer (struct t_hashtable *hashtable, const char *property)
else if (string_strcasecmp (property, "items_count") == 0)
return hashtable->items_count;
}
-
+
return 0;
}
@@ -586,12 +586,12 @@ hashtable_compute_length_keys_cb (void *data,
{
char str_value[128];
int *length;
-
+
/* make C compiler happy */
(void) value;
-
+
length = (int *)data;
-
+
switch (hashtable->type_keys)
{
case HASHTABLE_INTEGER:
@@ -626,10 +626,10 @@ hashtable_compute_length_values_cb (void *data,
{
char str_value[128];
int *length;
-
+
/* make C compiler happy */
(void) key;
-
+
length = (int *)data;
if (value)
@@ -686,15 +686,15 @@ hashtable_build_string_keys_cb (void *data,
{
char str_value[128];
char *str;
-
+
/* make C compiler happy */
(void) value;
-
+
str = (char *)data;
-
+
if (str[0])
strcat (str, ",");
-
+
switch (hashtable->type_keys)
{
case HASHTABLE_INTEGER:
@@ -729,12 +729,12 @@ hashtable_build_string_values_cb (void *data,
{
char str_value[128];
char *str;
-
+
/* make C compiler happy */
(void) key;
-
+
str = (char *)data;
-
+
if (str[0])
strcat (str, ",");
@@ -779,12 +779,12 @@ hashtable_build_string_keys_values_cb (void *data,
{
char str_value[128];
char *str;
-
+
str = (char *)data;
-
+
if (str[0])
strcat (str, ",");
-
+
switch (hashtable->type_keys)
{
case HASHTABLE_INTEGER:
@@ -806,7 +806,7 @@ hashtable_build_string_keys_values_cb (void *data,
case HASHTABLE_NUM_TYPES:
break;
}
-
+
strcat (str, ":");
if (value)
@@ -854,13 +854,13 @@ hashtable_get_keys_values (struct t_hashtable *hashtable,
int length;
struct t_weelist *list_keys;
struct t_weelist_item *ptr_item;
-
+
if (hashtable->keys_values)
{
free (hashtable->keys_values);
hashtable->keys_values = NULL;
}
-
+
/* first compute length of string */
length = 0;
hashtable_map (hashtable,
@@ -870,7 +870,7 @@ hashtable_get_keys_values (struct t_hashtable *hashtable,
&length);
if (length == 0)
return hashtable->keys_values;
-
+
/* build string */
hashtable->keys_values = malloc (length + 1);
if (!hashtable->keys_values)
@@ -911,7 +911,7 @@ hashtable_get_keys_values (struct t_hashtable *hashtable,
&hashtable_build_string_values_cb),
hashtable->keys_values);
}
-
+
return hashtable->keys_values;
}
@@ -939,7 +939,7 @@ hashtable_get_string (struct t_hashtable *hashtable, const char *property)
else if (string_strcasecmp (property, "keys_values_sorted") == 0)
return hashtable_get_keys_values (hashtable, 1, 1, 1);
}
-
+
return NULL;
}
@@ -971,11 +971,11 @@ hashtable_add_to_infolist (struct t_hashtable *hashtable,
int i, item_number;
struct t_hashtable_item *ptr_item;
char option_name[128];
-
+
if (!hashtable || (hashtable->type_keys != HASHTABLE_STRING)
|| !infolist_item || !prefix)
return 0;
-
+
item_number = 0;
for (i = 0; i < hashtable->size; i++)
{
@@ -1037,11 +1037,11 @@ hashtable_remove_item (struct t_hashtable *hashtable,
{
if (!hashtable || !item)
return;
-
+
/* free key and value */
hashtable_free_value (hashtable, item);
hashtable_free_key (hashtable, item);
-
+
/* remove item from list */
if (item->prev_item)
(item->prev_item)->next_item = item->next_item;
@@ -1049,9 +1049,9 @@ hashtable_remove_item (struct t_hashtable *hashtable,
(item->next_item)->prev_item = item->prev_item;
if (hashtable->htable[hash] == item)
hashtable->htable[hash] = item->next_item;
-
+
free (item);
-
+
hashtable->items_count--;
}
@@ -1064,10 +1064,10 @@ hashtable_remove (struct t_hashtable *hashtable, const void *key)
{
struct t_hashtable_item *ptr_item;
unsigned int hash;
-
+
if (!hashtable || !key)
return;
-
+
ptr_item = hashtable_get_item (hashtable, key, &hash);
if (ptr_item)
hashtable_remove_item (hashtable, ptr_item, hash);
@@ -1081,10 +1081,10 @@ void
hashtable_remove_all (struct t_hashtable *hashtable)
{
int i;
-
+
if (!hashtable)
return;
-
+
for (i = 0; i < hashtable->size; i++)
{
while (hashtable->htable[i])
@@ -1103,7 +1103,7 @@ hashtable_free (struct t_hashtable *hashtable)
{
if (!hashtable)
return;
-
+
hashtable_remove_all (hashtable);
free (hashtable->htable);
if (hashtable->keys_values)
@@ -1120,7 +1120,7 @@ hashtable_print_log (struct t_hashtable *hashtable, const char *name)
{
struct t_hashtable_item *ptr_item;
int i;
-
+
log_printf ("");
log_printf ("[hashtable %s (addr:0x%lx)]", name, hashtable);
log_printf (" size . . . . . . . . . : %d", hashtable->size);
@@ -1134,7 +1134,7 @@ hashtable_print_log (struct t_hashtable *hashtable, const char *name)
hashtable_type_string[hashtable->type_values]);
log_printf (" callback_hash_key. . . : 0x%lx", hashtable->callback_hash_key);
log_printf (" callback_keycmp. . . . : 0x%lx", hashtable->callback_keycmp);
-
+
for (i = 0; i < hashtable->size; i++)
{
log_printf (" htable[%06d] . . . . : 0x%lx", i, hashtable->htable[i]);
diff --git a/src/core/wee-hashtable.h b/src/core/wee-hashtable.h
index c4ac29a8b..4c8eecf2f 100644
--- a/src/core/wee-hashtable.h
+++ b/src/core/wee-hashtable.h
@@ -91,16 +91,16 @@ struct t_hashtable
struct t_hashtable_item **htable; /* table to map hashes with linked */
/* lists */
int items_count; /* number of items in hashtable */
-
+
/* type for keys and values */
enum t_hashtable_type type_keys; /* type for keys: int/str/pointer */
enum t_hashtable_type type_values; /* type for values: int/str/pointer */
-
+
/* callbacks */
t_hashtable_hash_key *callback_hash_key; /* hash key to int value */
t_hashtable_keycmp *callback_keycmp; /* compare two keys */
t_hashtable_free_value *callback_free_value; /* callback to free value */
-
+
/* keys/values as string */
char *keys_values; /* keys/values as string (NULL if */
/* never asked) */
diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c
index 510c21ce6..b36d6f6b6 100644
--- a/src/core/wee-hdata.c
+++ b/src/core/wee-hdata.c
@@ -51,10 +51,10 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
const char *var_prev, const char *var_next)
{
struct t_hdata *new_hdata;
-
+
if (!hdata_name || !hdata_name[0])
return NULL;
-
+
new_hdata = malloc (sizeof (*new_hdata));
if (new_hdata)
{
@@ -78,7 +78,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
NULL);
hashtable_set (weechat_hdata, hdata_name, new_hdata);
}
-
+
return new_hdata;
}
@@ -91,7 +91,7 @@ hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type,
const char *hdata_name)
{
int value;
-
+
if (hdata && name)
{
value = (type << 16) | (offset & 0xFFFF);
@@ -120,14 +120,14 @@ int
hdata_get_var_offset (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
-
+
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return (*ptr_value) & 0xFFFF;
}
-
+
return -1;
}
@@ -139,14 +139,14 @@ int
hdata_get_var_type (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
-
+
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return (*ptr_value) >> 16;
}
-
+
return -1;
}
@@ -158,14 +158,14 @@ const char *
hdata_get_var_type_string (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
-
+
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return hdata_type_string[(*ptr_value) >> 16];
}
-
+
return NULL;
}
@@ -179,7 +179,7 @@ hdata_get_var_hdata (struct t_hdata *hdata, const char *name)
{
if (hdata && name)
return (const char *)hashtable_get (hdata->hash_var_hdata, name);
-
+
return NULL;
}
@@ -191,14 +191,14 @@ void *
hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return pointer + offset;
}
-
+
return NULL;
}
@@ -212,7 +212,7 @@ hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset)
{
if (hdata && pointer)
return pointer + offset;
-
+
return NULL;
}
@@ -224,14 +224,14 @@ void *
hdata_get_list (struct t_hdata *hdata, const char *name)
{
void *ptr_value;
-
+
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_list, name);
if (ptr_value)
return *((void **)ptr_value);
}
-
+
return NULL;
}
@@ -244,12 +244,12 @@ hdata_move (struct t_hdata *hdata, void *pointer, int count)
{
char *ptr_var;
int i, abs_count;
-
+
if (hdata && pointer && (count != 0))
{
ptr_var = (count < 0) ? hdata->var_prev : hdata->var_next;
abs_count = abs(count);
-
+
for (i = 0; i < abs_count; i++)
{
pointer = hdata_pointer (hdata, pointer, ptr_var);
@@ -257,7 +257,7 @@ hdata_move (struct t_hdata *hdata, void *pointer, int count)
return pointer;
}
}
-
+
return NULL;
}
@@ -269,14 +269,14 @@ int
hdata_integer (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((int *)(pointer + offset));
}
-
+
return 0;
}
@@ -288,14 +288,14 @@ long
hdata_long (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((long *)(pointer + offset));
}
-
+
return 0;
}
@@ -307,14 +307,14 @@ const char *
hdata_string (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((char **)(pointer + offset));
}
-
+
return NULL;
}
@@ -326,14 +326,14 @@ void *
hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((void **)(pointer + offset));
}
-
+
return NULL;
}
@@ -345,14 +345,14 @@ time_t
hdata_time (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
-
+
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((time_t *)(pointer + offset));
}
-
+
return 0;
}
@@ -388,7 +388,7 @@ hdata_get_string (struct t_hdata *hdata, const char *property)
else if (string_strcasecmp (property, "list_keys_values") == 0)
return hashtable_get_string (hdata->hash_list, "keys_values");
}
-
+
return NULL;
}
@@ -409,7 +409,7 @@ hdata_free (struct t_hdata *hdata)
hashtable_free (hdata->hash_var_hdata);
if (hdata->hash_list)
hashtable_free (hdata->hash_list);
-
+
free (hdata);
}
@@ -422,9 +422,9 @@ hdata_free_all_plugin_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hdata *ptr_hdata;
-
+
ptr_hdata = (struct t_hdata *)value;
-
+
if (ptr_hdata->plugin == (struct t_weechat_plugin *)data)
{
hdata_free (ptr_hdata);
@@ -451,12 +451,12 @@ hdata_free_all_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hdata *ptr_hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_hdata = (struct t_hdata *)value;
-
+
hdata_free (ptr_hdata);
hashtable_remove (hashtable, key);
}
@@ -480,13 +480,13 @@ hdata_print_log_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hdata *ptr_hdata;
-
+
/* make C compiler happy */
(void) data;
(void) hashtable;
-
+
ptr_hdata = (struct t_hdata *)value;
-
+
log_printf ("");
log_printf ("[hdata (addr:0x%lx, name:'%s')]", ptr_hdata, (const char *)key);
log_printf (" plugin . . . . . . . . : 0x%lx", ptr_hdata->plugin);
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index a2e579d5e..36773f4af 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -82,7 +82,7 @@ void
hook_init ()
{
int type;
-
+
for (type = 0; type < HOOK_NUM_TYPES; type++)
{
weechat_hooks[type] = NULL;
@@ -99,16 +99,16 @@ int
hook_search_type (const char *type)
{
int i;
-
+
if (!type)
return -1;
-
+
for (i = 0; i < HOOK_NUM_TYPES; i++)
{
if (strcmp (hook_type_string[i], type) == 0)
return i;
}
-
+
/* type not found */
return -1;
}
@@ -124,7 +124,7 @@ hook_find_pos (struct t_hook *hook)
{
struct t_hook *ptr_hook;
int rc_cmp;
-
+
if (hook->type == HOOK_TYPE_COMMAND)
{
/* for command hook, sort on command name */
@@ -152,7 +152,7 @@ hook_find_pos (struct t_hook *hook)
return ptr_hook;
}
}
-
+
/* position not found, add at the end */
return NULL;
}
@@ -207,9 +207,9 @@ hook_remove_from_list (struct t_hook *hook)
{
struct t_hook *new_hooks;
int type;
-
+
type = hook->type;
-
+
if (last_weechat_hook[hook->type] == hook)
last_weechat_hook[hook->type] = hook->prev_hook;
if (hook->prev_hook)
@@ -219,12 +219,12 @@ hook_remove_from_list (struct t_hook *hook)
}
else
new_hooks = hook->next_hook;
-
+
if (hook->next_hook)
(hook->next_hook)->prev_hook = hook->prev_hook;
-
+
free (hook);
-
+
weechat_hooks[type] = new_hooks;
}
@@ -246,10 +246,10 @@ hook_remove_deleted ()
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (ptr_hook->deleted)
hook_remove_from_list (ptr_hook);
-
+
ptr_hook = next_hook;
}
}
@@ -273,12 +273,12 @@ hook_get_priority_and_name (const char *name,
{
char *pos, *str_priority, *error;
long number;
-
+
if (priority)
*priority = HOOK_PRIORITY_DEFAULT;
if (ptr_name)
*ptr_name = name;
-
+
pos = strchr (name, '|');
if (pos)
{
@@ -314,7 +314,7 @@ hook_init_data (struct t_hook *hook, struct t_weechat_plugin *plugin,
hook->priority = priority;
hook->callback_data = callback_data;
hook->hook_data = NULL;
-
+
if (weechat_debug_core >= 2)
{
gui_chat_printf (NULL,
@@ -347,7 +347,7 @@ hook_valid (struct t_hook *hook)
return 1;
}
}
-
+
/* hook not found */
return 0;
}
@@ -371,7 +371,7 @@ hook_exec_end ()
{
if (hook_exec_recursion > 0)
hook_exec_recursion--;
-
+
if (hook_exec_recursion == 0)
hook_remove_deleted ();
}
@@ -384,7 +384,7 @@ struct t_hook *
hook_search_command (struct t_weechat_plugin *plugin, const char *command)
{
struct t_hook *ptr_hook;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -393,7 +393,7 @@ hook_search_command (struct t_weechat_plugin *plugin, const char *command)
&& (string_strcasecmp (HOOK_COMMAND(ptr_hook, command), command) == 0))
return ptr_hook;
}
-
+
/* command hook not found for plugin */
return NULL;
}
@@ -410,7 +410,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
struct t_weelist *list;
char *pos_completion, *pos_double_pipe, *pos_start, *pos_end;
char **items, *last_space, *ptr_template;
-
+
/* split templates using "||" as separator */
hook_command->cplt_num_templates = 1;
pos_completion = hook_command->completion;
@@ -458,7 +458,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
else
pos_completion = pos_double_pipe + 2;
}
-
+
/* for each template, split/count args */
hook_command->cplt_templates_static = malloc (hook_command->cplt_num_templates *
sizeof (*hook_command->cplt_templates_static));
@@ -504,7 +504,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
last_space - hook_command->cplt_templates[i]);
else
hook_command->cplt_templates_static[i] = strdup (hook_command->cplt_templates[i]);
-
+
/* build arguments for each template */
hook_command->cplt_template_args[i] = string_split (hook_command->cplt_templates[i],
" ", 0, 0,
@@ -512,7 +512,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
if (hook_command->cplt_template_num_args[i] > hook_command->cplt_template_num_args_concat)
hook_command->cplt_template_num_args_concat = hook_command->cplt_template_num_args[i];
}
-
+
/*
* build strings with concatentaion of items from different templates
* for each argument: these strings will be used when completing argument
@@ -583,10 +583,10 @@ hook_command (struct t_weechat_plugin *plugin, const char *command,
struct t_hook_command *new_hook_command;
int priority;
const char *ptr_command;
-
+
if (!callback)
return NULL;
-
+
if (hook_search_command (plugin, command))
{
gui_chat_printf (NULL,
@@ -597,7 +597,7 @@ hook_command (struct t_weechat_plugin *plugin, const char *command,
plugin_get_name (plugin));
return NULL;
}
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -607,11 +607,11 @@ hook_command (struct t_weechat_plugin *plugin, const char *command,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (command, &priority, &ptr_command);
hook_init_data (new_hook, plugin, HOOK_TYPE_COMMAND, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_command;
new_hook_command->callback = callback;
new_hook_command->command = strdup ((ptr_command) ? ptr_command :
@@ -621,7 +621,7 @@ hook_command (struct t_weechat_plugin *plugin, const char *command,
new_hook_command->args_description = strdup ((args_description) ?
args_description : "");
new_hook_command->completion = strdup ((completion) ? completion : "");
-
+
/* build completion variables for command */
new_hook_command->cplt_num_templates = 0;
new_hook_command->cplt_templates = NULL;
@@ -631,9 +631,9 @@ hook_command (struct t_weechat_plugin *plugin, const char *command,
new_hook_command->cplt_template_num_args_concat = 0;
new_hook_command->cplt_template_args_concat = NULL;
hook_command_build_completion (new_hook_command);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -656,16 +656,16 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
struct t_hook *hook_for_plugin, *hook_for_other_plugin;
char **argv, **argv_eol, *ptr_command_name;
int argc, rc, number_for_other_plugin;
-
+
if (!buffer || !string || !string[0])
return -1;
-
+
rc = hook_command_run_exec (buffer, string);
if (rc == WEECHAT_RC_OK_EAT)
return 1;
-
+
rc = -1;
-
+
argv = string_split (string, " ", 0, 0, &argc);
if (argc == 0)
{
@@ -673,11 +673,11 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
return -1;
}
argv_eol = string_split (string, " ", 1, 0, NULL);
-
+
ptr_command_name = utf8_next_char (argv[0]);
-
+
hook_exec_start ();
-
+
hook_for_plugin = NULL;
hook_for_other_plugin = NULL;
number_for_other_plugin = 0;
@@ -685,7 +685,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& (string_strcasecmp (ptr_command_name,
HOOK_COMMAND(ptr_hook, command)) == 0))
@@ -705,10 +705,10 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
}
}
}
-
+
ptr_hook = next_hook;
}
-
+
if (!hook_for_plugin && !hook_for_other_plugin)
{
/* command not found */
@@ -729,7 +729,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
{
ptr_hook = (hook_for_plugin) ?
hook_for_plugin : hook_for_other_plugin;
-
+
if (ptr_hook->running >= HOOK_COMMAND_MAX_CALLS)
rc = -3;
else
@@ -745,12 +745,12 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
}
}
}
-
+
string_free_split (argv);
string_free_split (argv_eol);
-
+
hook_exec_end ();
-
+
return rc;
}
@@ -766,10 +766,10 @@ hook_command_run (struct t_weechat_plugin *plugin, const char *command,
struct t_hook_command_run *new_hook_command_run;
int priority;
const char *ptr_command;
-
+
if (!callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -779,18 +779,18 @@ hook_command_run (struct t_weechat_plugin *plugin, const char *command,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (command, &priority, &ptr_command);
hook_init_data (new_hook, plugin, HOOK_TYPE_COMMAND_RUN, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_command_run;
new_hook_command_run->callback = callback;
new_hook_command_run->command = strdup ((ptr_command) ? ptr_command :
((command) ? command : ""));
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -805,10 +805,10 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
int rc, hook_matching, length;
char *command2;
const char *ptr_command;
-
+
ptr_command = command;
command2 = NULL;
-
+
if (command[0] != '/')
{
length = strlen (command) + 1;
@@ -819,12 +819,12 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
ptr_command = command2;
}
}
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND_RUN];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& HOOK_COMMAND_RUN(ptr_hook, command))
@@ -832,7 +832,7 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
hook_matching = string_match (ptr_command,
HOOK_COMMAND_RUN(ptr_hook, command),
0);
-
+
if (!hook_matching
&& !strchr (HOOK_COMMAND_RUN(ptr_hook, command), ' '))
{
@@ -840,7 +840,7 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
HOOK_COMMAND_RUN(ptr_hook, command),
utf8_strlen (HOOK_COMMAND_RUN(ptr_hook, command))) == 0);
}
-
+
if (hook_matching)
{
ptr_hook->running = 1;
@@ -856,13 +856,13 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
}
}
}
-
+
ptr_hook = next_hook;
}
-
+
if (command2)
free (command2);
-
+
return WEECHAT_RC_OK;
}
@@ -876,7 +876,7 @@ hook_timer_init (struct t_hook *hook)
time_t time_now;
struct tm *local_time, *gm_time;
int local_hour, gm_hour, diff_hour;
-
+
gettimeofday (&HOOK_TIMER(hook, last_exec), NULL);
time_now = time (NULL);
local_time = localtime(&time_now);
@@ -897,7 +897,7 @@ hook_timer_init (struct t_hook *hook)
}
else
diff_hour = local_hour - gm_hour;
-
+
if ((HOOK_TIMER(hook, interval) >= 1000)
&& (HOOK_TIMER(hook, align_second) > 0))
{
@@ -912,11 +912,11 @@ hook_timer_init (struct t_hook *hook)
((HOOK_TIMER(hook, last_exec).tv_sec + (diff_hour * 3600)) %
HOOK_TIMER(hook, align_second));
}
-
+
/* init next call with date of last call */
HOOK_TIMER(hook, next_exec).tv_sec = HOOK_TIMER(hook, last_exec).tv_sec;
HOOK_TIMER(hook, next_exec).tv_usec = HOOK_TIMER(hook, last_exec).tv_usec;
-
+
/* add interval to next call date */
util_timeval_add (&HOOK_TIMER(hook, next_exec), HOOK_TIMER(hook, interval));
}
@@ -932,10 +932,10 @@ hook_timer (struct t_weechat_plugin *plugin, long interval, int align_second,
{
struct t_hook *new_hook;
struct t_hook_timer *new_hook_timer;
-
+
if ((interval <= 0) || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -945,20 +945,20 @@ hook_timer (struct t_weechat_plugin *plugin, long interval, int align_second,
free (new_hook);
return NULL;
}
-
+
hook_init_data (new_hook, plugin, HOOK_TYPE_TIMER, HOOK_PRIORITY_DEFAULT,
callback_data);
-
+
new_hook->hook_data = new_hook_timer;
new_hook_timer->callback = callback;
new_hook_timer->interval = interval;
new_hook_timer->align_second = align_second;
new_hook_timer->remaining_calls = max_calls;
-
+
hook_timer_init (new_hook);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -975,9 +975,9 @@ hook_timer_check_system_clock ()
time_t now;
long diff_time;
struct t_hook *ptr_hook;
-
+
now = time (NULL);
-
+
/*
* check if difference with previous time is more than 10 seconds:
* if it is, then consider it's clock skew and reinitialize all timers
@@ -992,7 +992,7 @@ hook_timer_check_system_clock ()
"reinitializing all timers"),
diff_time);
}
-
+
/* reinitialize all timers */
for (ptr_hook = weechat_hooks[HOOK_TYPE_TIMER]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
@@ -1001,7 +1001,7 @@ hook_timer_check_system_clock ()
hook_timer_init (ptr_hook);
}
}
-
+
hook_last_system_time = now;
}
@@ -1018,13 +1018,13 @@ hook_timer_time_to_next (struct timeval *tv_timeout)
int found;
struct timeval tv_now;
long diff_usec;
-
+
hook_timer_check_system_clock ();
-
+
found = 0;
tv_timeout->tv_sec = 0;
tv_timeout->tv_usec = 0;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_TIMER]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -1037,7 +1037,7 @@ hook_timer_time_to_next (struct timeval *tv_timeout)
tv_timeout->tv_usec = HOOK_TIMER(ptr_hook, next_exec).tv_usec;
}
}
-
+
/* no timeout found, return 2 seconds by default */
if (!found)
{
@@ -1045,9 +1045,9 @@ hook_timer_time_to_next (struct timeval *tv_timeout)
tv_timeout->tv_usec = 0;
return;
}
-
+
gettimeofday (&tv_now, NULL);
-
+
/* next timeout is past date! */
if (util_timeval_cmp (tv_timeout, &tv_now) < 0)
{
@@ -1055,7 +1055,7 @@ hook_timer_time_to_next (struct timeval *tv_timeout)
tv_timeout->tv_usec = 0;
return;
}
-
+
tv_timeout->tv_sec = tv_timeout->tv_sec - tv_now.tv_sec;
diff_usec = tv_timeout->tv_usec - tv_now.tv_usec;
if (diff_usec >= 0)
@@ -1065,7 +1065,7 @@ hook_timer_time_to_next (struct timeval *tv_timeout)
tv_timeout->tv_sec--;
tv_timeout->tv_usec = 1000000 + diff_usec;
}
-
+
/*
* to detect clock skew, we ensure there's a call to timers every
* 2 seconds max
@@ -1086,18 +1086,18 @@ hook_timer_exec ()
{
struct timeval tv_time;
struct t_hook *ptr_hook, *next_hook;
-
+
hook_timer_check_system_clock ();
-
+
gettimeofday (&tv_time, NULL);
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_TIMER];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (util_timeval_cmp (&HOOK_TIMER(ptr_hook, next_exec),
@@ -1113,10 +1113,10 @@ hook_timer_exec ()
{
HOOK_TIMER(ptr_hook, last_exec).tv_sec = tv_time.tv_sec;
HOOK_TIMER(ptr_hook, last_exec).tv_usec = tv_time.tv_usec;
-
+
util_timeval_add (&HOOK_TIMER(ptr_hook, next_exec),
HOOK_TIMER(ptr_hook, interval));
-
+
if (HOOK_TIMER(ptr_hook, remaining_calls) > 0)
{
HOOK_TIMER(ptr_hook, remaining_calls)--;
@@ -1125,10 +1125,10 @@ hook_timer_exec ()
}
}
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -1140,14 +1140,14 @@ struct t_hook *
hook_search_fd (int fd)
{
struct t_hook *ptr_hook;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_FD]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
if (!ptr_hook->deleted && (HOOK_FD(ptr_hook, fd) == fd))
return ptr_hook;
}
-
+
/* fd hook not found */
return NULL;
}
@@ -1163,10 +1163,10 @@ hook_fd (struct t_weechat_plugin *plugin, int fd, int flag_read,
{
struct t_hook *new_hook;
struct t_hook_fd *new_hook_fd;
-
+
if ((fd < 0) || hook_search_fd (fd) || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -1176,10 +1176,10 @@ hook_fd (struct t_weechat_plugin *plugin, int fd, int flag_read,
free (new_hook);
return NULL;
}
-
+
hook_init_data (new_hook, plugin, HOOK_TYPE_FD, HOOK_PRIORITY_DEFAULT,
callback_data);
-
+
new_hook->hook_data = new_hook_fd;
new_hook_fd->callback = callback;
new_hook_fd->fd = fd;
@@ -1191,9 +1191,9 @@ hook_fd (struct t_weechat_plugin *plugin, int fd, int flag_read,
new_hook_fd->flags |= HOOK_FD_FLAG_WRITE;
if (flag_exception)
new_hook_fd->flags |= HOOK_FD_FLAG_EXCEPTION;
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -1251,7 +1251,7 @@ hook_fd_set (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
}
}
}
-
+
return max_fd;
}
@@ -1263,14 +1263,14 @@ void
hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
{
struct t_hook *ptr_hook, *next_hook;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_FD];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (((HOOK_FD(ptr_hook, flags) & HOOK_FD_FLAG_READ)
@@ -1285,10 +1285,10 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
HOOK_FD(ptr_hook, fd));
ptr_hook->running = 0;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -1304,21 +1304,21 @@ hook_process (struct t_weechat_plugin *plugin,
struct t_hook *new_hook;
struct t_hook_process *new_hook_process;
char *stdout_buffer, *stderr_buffer;
-
+
if (!command || !command[0] || !callback)
return NULL;
-
+
stdout_buffer = malloc (HOOK_PROCESS_BUFFER_SIZE + 1);
if (!stdout_buffer)
return NULL;
-
+
stderr_buffer = malloc (HOOK_PROCESS_BUFFER_SIZE + 1);
if (!stderr_buffer)
{
free (stdout_buffer);
return NULL;
}
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
{
@@ -1334,10 +1334,10 @@ hook_process (struct t_weechat_plugin *plugin,
free (new_hook);
return NULL;
}
-
+
hook_init_data (new_hook, plugin, HOOK_TYPE_PROCESS, HOOK_PRIORITY_DEFAULT,
callback_data);
-
+
new_hook->hook_data = new_hook_process;
new_hook_process->callback = callback;
new_hook_process->command = strdup (command);
@@ -1354,11 +1354,11 @@ hook_process (struct t_weechat_plugin *plugin,
new_hook_process->buffer[HOOK_PROCESS_STDERR] = stderr_buffer;
new_hook_process->buffer_size[HOOK_PROCESS_STDOUT] = 0;
new_hook_process->buffer_size[HOOK_PROCESS_STDERR] = 0;
-
+
hook_add_to_list (new_hook);
-
+
hook_process_run (new_hook);
-
+
return new_hook;
}
@@ -1371,13 +1371,13 @@ void
hook_process_child (struct t_hook *hook_process)
{
char *exec_args[4] = { "sh", "-c", NULL, NULL };
-
+
/*
* close stdin, so that process will fail to read stdin (process reading
* stdin should not be run inside WeeChat!)
*/
close (STDIN_FILENO);
-
+
/* redirect stdout/stderr to pipe (so that father process can read them) */
close (HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT]));
close (HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDERR]));
@@ -1391,11 +1391,11 @@ hook_process_child (struct t_hook *hook_process)
{
_exit (EXIT_FAILURE);
}
-
+
/* launch command */
exec_args[2] = HOOK_PROCESS(hook_process, command);
execvp (exec_args[0], exec_args);
-
+
/* should not be executed if execvp was ok */
fprintf (stderr, "Error with command '%s'\n",
HOOK_PROCESS(hook_process, command));
@@ -1410,7 +1410,7 @@ void
hook_process_send_buffers (struct t_hook *hook_process, int callback_rc)
{
int i, size;
-
+
/* add '\0' at end of stdout and stderr */
for (i = 0; i < 2; i++)
{
@@ -1418,7 +1418,7 @@ hook_process_send_buffers (struct t_hook *hook_process, int callback_rc)
if (size > 0)
HOOK_PROCESS(hook_process, buffer[i])[size] = '\0';
}
-
+
/* send buffers to callback */
(void) (HOOK_PROCESS(hook_process, callback))
(hook_process->callback_data,
@@ -1428,7 +1428,7 @@ hook_process_send_buffers (struct t_hook *hook_process, int callback_rc)
HOOK_PROCESS(hook_process, buffer[HOOK_PROCESS_STDOUT]) : NULL,
(HOOK_PROCESS(hook_process, buffer_size[HOOK_PROCESS_STDERR]) > 0) ?
HOOK_PROCESS(hook_process, buffer[HOOK_PROCESS_STDERR]) : NULL);
-
+
/* reset size for stdout and stderr */
HOOK_PROCESS(hook_process, buffer_size[HOOK_PROCESS_STDOUT]) = 0;
HOOK_PROCESS(hook_process, buffer_size[HOOK_PROCESS_STDERR]) = 0;
@@ -1444,7 +1444,7 @@ hook_process_add_to_buffer (struct t_hook *hook_process, int index_buffer,
{
if (HOOK_PROCESS(hook_process, buffer_size[index_buffer]) + size > HOOK_PROCESS_BUFFER_SIZE)
hook_process_send_buffers (hook_process, WEECHAT_HOOK_PROCESS_RUNNING);
-
+
memcpy (HOOK_PROCESS(hook_process, buffer[index_buffer]) +
HOOK_PROCESS(hook_process, buffer_size[index_buffer]),
buffer, size);
@@ -1462,10 +1462,10 @@ hook_process_child_read (struct t_hook *hook_process, int fd,
{
char buffer[4096];
int num_read;
-
+
if (hook_process->deleted)
return;
-
+
num_read = read (fd, buffer, sizeof (buffer) - 1);
if (num_read > 0)
{
@@ -1488,7 +1488,7 @@ int
hook_process_child_read_stdout_cb (void *arg_hook_process, int fd)
{
struct t_hook *hook_process;
-
+
hook_process = (struct t_hook *)arg_hook_process;
hook_process_child_read (hook_process, fd, HOOK_PROCESS_STDOUT,
&(HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDOUT])));
@@ -1504,7 +1504,7 @@ int
hook_process_child_read_stderr_cb (void *arg_hook_process, int fd)
{
struct t_hook *hook_process;
-
+
hook_process = (struct t_hook *)arg_hook_process;
hook_process_child_read (hook_process, fd, HOOK_PROCESS_STDERR,
&(HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDERR])));
@@ -1520,15 +1520,15 @@ hook_process_timer_cb (void *arg_hook_process, int remaining_calls)
{
struct t_hook *hook_process;
int status, rc;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
hook_process = (struct t_hook *)arg_hook_process;
-
+
if (hook_process->deleted)
return WEECHAT_RC_OK;
-
+
if (remaining_calls == 0)
{
hook_process_send_buffers (hook_process, WEECHAT_HOOK_PROCESS_ERROR);
@@ -1556,7 +1556,7 @@ hook_process_timer_cb (void *arg_hook_process, int remaining_calls)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1571,7 +1571,7 @@ hook_process_run (struct t_hook *hook_process)
int pipe_stdout[2], pipe_stderr[2], timeout, max_calls;
long interval;
pid_t pid;
-
+
/* create pipe for child process (stdout) */
if (pipe (pipe_stdout) < 0)
{
@@ -1595,13 +1595,13 @@ hook_process_run (struct t_hook *hook_process)
unhook (hook_process);
return;
}
-
+
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT]) = pipe_stdout[0];
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDOUT]) = pipe_stdout[1];
-
+
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDERR]) = pipe_stderr[0];
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]) = pipe_stderr[1];
-
+
switch (pid = fork ())
{
/* fork failed */
@@ -1627,21 +1627,21 @@ hook_process_run (struct t_hook *hook_process)
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDOUT]) = -1;
close (HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]));
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]) = -1;
-
+
HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDOUT]) =
hook_fd (hook_process->plugin,
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT]),
1, 0, 0,
&hook_process_child_read_stdout_cb,
hook_process);
-
+
HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDERR]) =
hook_fd (hook_process->plugin,
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDERR]),
1, 0, 0,
&hook_process_child_read_stderr_cb,
hook_process);
-
+
timeout = HOOK_PROCESS(hook_process, timeout);
interval = 100;
max_calls = 0;
@@ -1679,7 +1679,7 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
{
struct t_hook *new_hook;
struct t_hook_connect *new_hook_connect;
-
+
#ifndef HAVE_GNUTLS
/* make C compiler happy */
(void) gnutls_sess;
@@ -1687,10 +1687,10 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
(void) gnutls_dhkey_size;
(void) gnutls_priorities;
#endif
-
+
if ((sock < 0) || !address || (port <= 0) || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -1700,10 +1700,10 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
free (new_hook);
return NULL;
}
-
+
hook_init_data (new_hook, plugin, HOOK_TYPE_CONNECT, HOOK_PRIORITY_DEFAULT,
callback_data);
-
+
new_hook->hook_data = new_hook_connect;
new_hook_connect->callback = callback;
new_hook_connect->proxy = (proxy) ? strdup (proxy) : NULL;
@@ -1728,11 +1728,11 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
new_hook_connect->handshake_hook_timer = NULL;
new_hook_connect->handshake_fd_flags = 0;
new_hook_connect->handshake_ip_address = NULL;
-
+
hook_add_to_list (new_hook);
-
+
network_connect_with_fork (new_hook);
-
+
return new_hook;
}
@@ -1746,7 +1746,7 @@ hook_connect_gnutls_verify_certificates (gnutls_session_t tls_session)
{
struct t_hook *ptr_hook;
int rc;
-
+
rc = -1;
ptr_hook = weechat_hooks[HOOK_TYPE_CONNECT];
while (ptr_hook)
@@ -1764,7 +1764,7 @@ hook_connect_gnutls_verify_certificates (gnutls_session_t tls_session)
}
ptr_hook = ptr_hook->next_hook;
}
-
+
return rc;
}
#endif
@@ -1787,7 +1787,7 @@ hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
{
struct t_hook *ptr_hook;
int rc;
-
+
rc = -1;
ptr_hook = weechat_hooks[HOOK_TYPE_CONNECT];
while (ptr_hook)
@@ -1805,7 +1805,7 @@ hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
}
ptr_hook = ptr_hook->next_hook;
}
-
+
return rc;
}
#endif
@@ -1821,10 +1821,10 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
{
struct t_hook *new_hook;
struct t_hook_print *new_hook_print;
-
+
if (!callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -1834,10 +1834,10 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
free (new_hook);
return NULL;
}
-
+
hook_init_data (new_hook, plugin, HOOK_TYPE_PRINT, HOOK_PRIORITY_DEFAULT,
callback_data);
-
+
new_hook->hook_data = new_hook_print;
new_hook_print->callback = callback;
new_hook_print->buffer = buffer;
@@ -1853,9 +1853,9 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
}
new_hook_print->message = (message) ? strdup (message) : NULL;
new_hook_print->strip_colors = strip_colors;
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -1869,13 +1869,13 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
struct t_hook *ptr_hook, *next_hook;
char *prefix_no_color, *message_no_color;
int tags_match, tag_found, i, j;
-
+
if (!line->data->message || !line->data->message[0])
return;
-
+
prefix_no_color = (line->data->prefix) ?
gui_color_decode (line->data->prefix, NULL) : NULL;
-
+
message_no_color = gui_color_decode (line->data->message, NULL);
if (!message_no_color)
{
@@ -1883,14 +1883,14 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
free (prefix_no_color);
return;
}
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_PRINT];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (!HOOK_PRINT(ptr_hook, buffer)
@@ -1933,7 +1933,7 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
}
else
tags_match = 1;
-
+
/* run callback */
if (tags_match)
{
@@ -1948,15 +1948,15 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
ptr_hook->running = 0;
}
}
-
+
ptr_hook = next_hook;
}
-
+
if (prefix_no_color)
free (prefix_no_color);
if (message_no_color)
free (message_no_color);
-
+
hook_exec_end ();
}
@@ -1972,10 +1972,10 @@ hook_signal (struct t_weechat_plugin *plugin, const char *signal,
struct t_hook_signal *new_hook_signal;
int priority;
const char *ptr_signal;
-
+
if (!signal || !signal[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -1985,17 +1985,17 @@ hook_signal (struct t_weechat_plugin *plugin, const char *signal,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (signal, &priority, &ptr_signal);
hook_init_data (new_hook, plugin, HOOK_TYPE_SIGNAL, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_signal;
new_hook_signal->callback = callback;
new_hook_signal->signal = strdup ((ptr_signal) ? ptr_signal : signal);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2007,14 +2007,14 @@ void
hook_signal_send (const char *signal, const char *type_data, void *signal_data)
{
struct t_hook *ptr_hook, *next_hook;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_SIGNAL];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_match (signal, HOOK_SIGNAL(ptr_hook, signal), 0)))
@@ -2024,10 +2024,10 @@ hook_signal_send (const char *signal, const char *type_data, void *signal_data)
(ptr_hook->callback_data, signal, type_data, signal_data);
ptr_hook->running = 0;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -2043,10 +2043,10 @@ hook_hsignal (struct t_weechat_plugin *plugin, const char *signal,
struct t_hook_hsignal *new_hook_hsignal;
int priority;
const char *ptr_signal;
-
+
if (!signal || !signal[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2056,17 +2056,17 @@ hook_hsignal (struct t_weechat_plugin *plugin, const char *signal,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (signal, &priority, &ptr_signal);
hook_init_data (new_hook, plugin, HOOK_TYPE_HSIGNAL, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_hsignal;
new_hook_hsignal->callback = callback;
new_hook_hsignal->signal = strdup ((ptr_signal) ? ptr_signal : signal);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2078,14 +2078,14 @@ void
hook_hsignal_send (const char *signal, struct t_hashtable *hashtable)
{
struct t_hook *ptr_hook, *next_hook;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_HSIGNAL];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_match (signal, HOOK_HSIGNAL(ptr_hook, signal), 0)))
@@ -2095,10 +2095,10 @@ hook_hsignal_send (const char *signal, struct t_hashtable *hashtable)
(ptr_hook->callback_data, signal, hashtable);
ptr_hook->running = 0;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -2114,10 +2114,10 @@ hook_config (struct t_weechat_plugin *plugin, const char *option,
struct t_hook_config *new_hook_config;
int priority;
const char *ptr_option;
-
+
if (!callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2127,18 +2127,18 @@ hook_config (struct t_weechat_plugin *plugin, const char *option,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (option, &priority, &ptr_option);
hook_init_data (new_hook, plugin, HOOK_TYPE_CONFIG, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_config;
new_hook_config->callback = callback;
new_hook_config->option = strdup ((ptr_option) ? ptr_option :
((option) ? option : ""));
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2150,14 +2150,14 @@ void
hook_config_exec (const char *option, const char *value)
{
struct t_hook *ptr_hook, *next_hook;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_CONFIG];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (!HOOK_CONFIG(ptr_hook, option)
@@ -2168,10 +2168,10 @@ hook_config_exec (const char *option, const char *value)
(ptr_hook->callback_data, option, value);
ptr_hook->running = 0;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -2188,11 +2188,11 @@ hook_completion (struct t_weechat_plugin *plugin, const char *completion_item,
struct t_hook_completion *new_hook_completion;
int priority;
const char *ptr_completion_item;
-
+
if (!completion_item || !completion_item[0]
|| strchr (completion_item, ' ') || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2202,20 +2202,20 @@ hook_completion (struct t_weechat_plugin *plugin, const char *completion_item,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (completion_item, &priority, &ptr_completion_item);
hook_init_data (new_hook, plugin, HOOK_TYPE_COMPLETION, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_completion;
new_hook_completion->callback = callback;
new_hook_completion->completion_item = strdup ((ptr_completion_item) ?
ptr_completion_item : completion_item);
new_hook_completion->description = strdup ((description) ?
description : "");
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2253,17 +2253,17 @@ hook_completion_exec (struct t_weechat_plugin *plugin,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook, *next_hook;
-
+
/* make C compiler happy */
(void) plugin;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_COMPLETION];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_COMPLETION(ptr_hook, completion_item),
@@ -2274,10 +2274,10 @@ hook_completion_exec (struct t_weechat_plugin *plugin,
(ptr_hook->callback_data, completion_item, buffer, completion);
ptr_hook->running = 0;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
}
@@ -2293,10 +2293,10 @@ hook_modifier (struct t_weechat_plugin *plugin, const char *modifier,
struct t_hook_modifier *new_hook_modifier;
int priority;
const char *ptr_modifier;
-
+
if (!modifier || !modifier[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2306,17 +2306,17 @@ hook_modifier (struct t_weechat_plugin *plugin, const char *modifier,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (modifier, &priority, &ptr_modifier);
hook_init_data (new_hook, plugin, HOOK_TYPE_MODIFIER, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_modifier;
new_hook_modifier->callback = callback;
new_hook_modifier->modifier = strdup ((ptr_modifier) ? ptr_modifier : modifier);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2330,25 +2330,25 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
{
struct t_hook *ptr_hook, *next_hook;
char *new_msg, *message_modified;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (!modifier || !modifier[0])
return NULL;
-
+
new_msg = NULL;
message_modified = strdup (string);
if (!message_modified)
return NULL;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_MODIFIER];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_MODIFIER(ptr_hook, modifier),
@@ -2359,7 +2359,7 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
(ptr_hook->callback_data, modifier, modifier_data,
message_modified);
ptr_hook->running = 0;
-
+
/* empty string returned => message dropped */
if (new_msg && !new_msg[0])
{
@@ -2367,7 +2367,7 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
hook_exec_end ();
return new_msg;
}
-
+
/* new message => keep it as base for next modifier */
if (new_msg)
{
@@ -2375,12 +2375,12 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
message_modified = new_msg;
}
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
-
+
return message_modified;
}
@@ -2397,10 +2397,10 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
struct t_hook_info *new_hook_info;
int priority;
const char *ptr_info_name;
-
+
if (!info_name || !info_name[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2410,10 +2410,10 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (info_name, &priority, &ptr_info_name);
hook_init_data (new_hook, plugin, HOOK_TYPE_INFO, priority, callback_data);
-
+
new_hook->hook_data = new_hook_info;
new_hook_info->callback = callback;
new_hook_info->info_name = strdup ((ptr_info_name) ?
@@ -2421,9 +2421,9 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
new_hook_info->description = strdup ((description) ? description : "");
new_hook_info->args_description = strdup ((args_description) ?
args_description : "");
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2437,20 +2437,20 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
{
struct t_hook *ptr_hook, *next_hook;
const char *value;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (!info_name || !info_name[0])
return NULL;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_INFO];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_INFO(ptr_hook, info_name),
@@ -2460,16 +2460,16 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
value = (HOOK_INFO(ptr_hook, callback))
(ptr_hook->callback_data, info_name, arguments);
ptr_hook->running = 0;
-
+
hook_exec_end ();
return value;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
-
+
/* info not found */
return NULL;
}
@@ -2489,10 +2489,10 @@ hook_info_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
struct t_hook_info_hashtable *new_hook_info_hashtable;
int priority;
const char *ptr_info_name;
-
+
if (!info_name || !info_name[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2502,11 +2502,11 @@ hook_info_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (info_name, &priority, &ptr_info_name);
hook_init_data (new_hook, plugin, HOOK_TYPE_INFO_HASHTABLE, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_info_hashtable;
new_hook_info_hashtable->callback = callback;
new_hook_info_hashtable->info_name = strdup ((ptr_info_name) ?
@@ -2516,9 +2516,9 @@ hook_info_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
args_description : "");
new_hook_info_hashtable->output_description = strdup ((output_description) ?
output_description : "");
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2532,20 +2532,20 @@ hook_info_get_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
{
struct t_hook *ptr_hook, *next_hook;
struct t_hashtable *value;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (!info_name || !info_name[0])
return NULL;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_INFO_HASHTABLE];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_INFO_HASHTABLE(ptr_hook, info_name),
@@ -2555,16 +2555,16 @@ hook_info_get_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
value = (HOOK_INFO_HASHTABLE(ptr_hook, callback))
(ptr_hook->callback_data, info_name, hashtable);
ptr_hook->running = 0;
-
+
hook_exec_end ();
return value;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
-
+
/* info not found */
return NULL;
}
@@ -2583,10 +2583,10 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
struct t_hook_infolist *new_hook_infolist;
int priority;
const char *ptr_infolist_name;
-
+
if (!infolist_name || !infolist_name[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2596,11 +2596,11 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (infolist_name, &priority, &ptr_infolist_name);
hook_init_data (new_hook, plugin, HOOK_TYPE_INFOLIST, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_infolist;
new_hook_infolist->callback = callback;
new_hook_infolist->infolist_name = strdup ((ptr_infolist_name) ?
@@ -2610,9 +2610,9 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
pointer_description : "");
new_hook_infolist->args_description = strdup ((args_description) ?
args_description : "");
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2626,20 +2626,20 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
{
struct t_hook *ptr_hook, *next_hook;
struct t_infolist *value;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_INFOLIST(ptr_hook, infolist_name),
@@ -2649,16 +2649,16 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
value = (HOOK_INFOLIST(ptr_hook, callback))
(ptr_hook->callback_data, infolist_name, pointer, arguments);
ptr_hook->running = 0;
-
+
hook_exec_end ();
return value;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
-
+
/* infolist not found */
return NULL;
}
@@ -2676,10 +2676,10 @@ hook_hdata (struct t_weechat_plugin *plugin, const char *hdata_name,
struct t_hook_hdata *new_hook_hdata;
int priority;
const char *ptr_hdata_name;
-
+
if (!hdata_name || !hdata_name[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2689,19 +2689,19 @@ hook_hdata (struct t_weechat_plugin *plugin, const char *hdata_name,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (hdata_name, &priority, &ptr_hdata_name);
hook_init_data (new_hook, plugin, HOOK_TYPE_HDATA, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_hdata;
new_hook_hdata->callback = callback;
new_hook_hdata->hdata_name = strdup ((ptr_hdata_name) ?
ptr_hdata_name : hdata_name);
new_hook_hdata->description = strdup ((description) ? description : "");
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2714,27 +2714,27 @@ hook_hdata_get (struct t_weechat_plugin *plugin, const char *hdata_name)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hdata *value;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (!hdata_name || !hdata_name[0])
return NULL;
-
+
if (weechat_hdata)
{
value = hashtable_get (weechat_hdata, hdata_name);
if (value)
return value;
}
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_HDATA];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (strcmp (HOOK_HDATA(ptr_hook, hdata_name), hdata_name) == 0))
@@ -2744,16 +2744,16 @@ hook_hdata_get (struct t_weechat_plugin *plugin, const char *hdata_name)
(ptr_hook->callback_data,
HOOK_HDATA(ptr_hook, hdata_name));
ptr_hook->running = 0;
-
+
hook_exec_end ();
return value;
}
-
+
ptr_hook = next_hook;
}
-
+
hook_exec_end ();
-
+
/* hdata not found */
return NULL;
}
@@ -2770,10 +2770,10 @@ hook_focus (struct t_weechat_plugin *plugin, const char *area,
struct t_hook_focus *new_hook_focus;
int priority;
const char *ptr_area;
-
+
if (!area || !area[0] || !callback)
return NULL;
-
+
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
@@ -2783,17 +2783,17 @@ hook_focus (struct t_weechat_plugin *plugin, const char *area,
free (new_hook);
return NULL;
}
-
+
hook_get_priority_and_name (area, &priority, &ptr_area);
hook_init_data (new_hook, plugin, HOOK_TYPE_FOCUS, priority,
callback_data);
-
+
new_hook->hook_data = new_hook_focus;
new_hook_focus->callback = callback;
new_hook_focus->area = strdup ((ptr_area) ? ptr_area : area);
-
+
hook_add_to_list (new_hook);
-
+
return new_hook;
}
@@ -2806,10 +2806,10 @@ hook_focus_hashtable_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hashtable *hashtable1;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hashtable1 = (struct t_hashtable *)data;
if (hashtable1 && key && value)
@@ -2828,10 +2828,10 @@ hook_focus_hashtable_map2_cb (void *data, struct t_hashtable *hashtable,
struct t_hashtable *hashtable1;
int length;
char *key2;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hashtable1 = (struct t_hashtable *)data;
length = strlen ((const char *)key) + 1 + 1;
@@ -2860,26 +2860,26 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
const char *focus1_chat, *focus1_bar_item_name, *keys;
char **list_keys, *new_key;
int num_keys, i, length, focus1_is_chat;
-
+
if (!hashtable_focus1)
return NULL;
-
+
focus1_chat = hashtable_get (hashtable_focus1, "_chat");
focus1_is_chat = (focus1_chat && (strcmp (focus1_chat, "1") == 0));
focus1_bar_item_name = hashtable_get (hashtable_focus1, "_bar_item_name");
-
+
hashtable1 = hashtable_dup (hashtable_focus1);
if (!hashtable1)
return NULL;
hashtable2 = (hashtable_focus2) ? hashtable_dup (hashtable_focus2) : NULL;
-
+
hook_exec_start ();
-
+
ptr_hook = weechat_hooks[HOOK_TYPE_FOCUS];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
-
+
if (!ptr_hook->deleted
&& !ptr_hook->running
&& ((focus1_is_chat
@@ -2906,7 +2906,7 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
hashtable_free (hashtable_ret);
}
}
-
+
/* run callback for focus #2 */
if (hashtable2)
{
@@ -2930,10 +2930,10 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
}
}
}
-
+
ptr_hook = next_hook;
}
-
+
if (hashtable2)
{
hashtable_map (hashtable2, &hook_focus_hashtable_map2_cb, hashtable1);
@@ -2964,9 +2964,9 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
}
}
}
-
+
hook_exec_end ();
-
+
return hashtable1;
}
@@ -2978,15 +2978,15 @@ void
unhook (struct t_hook *hook)
{
int i;
-
+
/* invalid hook? */
if (!hook_valid (hook))
return;
-
+
/* hook already deleted? */
if (hook->deleted)
return;
-
+
if (weechat_debug_core >= 2)
{
gui_chat_printf (NULL,
@@ -2994,7 +2994,7 @@ unhook (struct t_hook *hook)
hook->type, hook_type_string[hook->type],
hook->plugin, plugin_get_name (hook->plugin));
}
-
+
/* free data */
if (hook->hook_data)
{
@@ -3178,7 +3178,7 @@ unhook (struct t_hook *hook)
free (hook->hook_data);
hook->hook_data = NULL;
}
-
+
/* remove hook from list (if there's no hook exec pending) */
if (hook_exec_recursion == 0)
{
@@ -3201,7 +3201,7 @@ unhook_all_plugin (struct t_weechat_plugin *plugin)
{
int type;
struct t_hook *ptr_hook, *next_hook;
-
+
for (type = 0; type < HOOK_NUM_TYPES; type++)
{
ptr_hook = weechat_hooks[type];
@@ -3224,7 +3224,7 @@ unhook_all ()
{
int type;
struct t_hook *ptr_hook, *next_hook;
-
+
for (type = 0; type < HOOK_NUM_TYPES; type++)
{
ptr_hook = weechat_hooks[type];
@@ -3266,14 +3266,14 @@ hook_add_to_infolist_type (struct t_infolist *infolist, int type,
break;
}
}
-
+
if (!match)
continue;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_pointer (ptr_item, "pointer", ptr_hook))
return 0;
if (!infolist_new_var_pointer (ptr_item, "plugin", ptr_hook->plugin))
@@ -3624,7 +3624,7 @@ hook_add_to_infolist_type (struct t_infolist *infolist, int type,
break;
}
}
-
+
return 1;
}
@@ -3641,13 +3641,13 @@ hook_add_to_infolist (struct t_infolist *infolist, const char *arguments)
const char *pos_arguments;
char *type;
int i, type_int;
-
+
if (!infolist)
return 0;
-
+
type = NULL;
pos_arguments = NULL;
-
+
if (arguments && arguments[0])
{
pos_arguments = strchr (arguments, ',');
@@ -3659,18 +3659,18 @@ hook_add_to_infolist (struct t_infolist *infolist, const char *arguments)
else
type = strdup (arguments);
}
-
+
type_int = (type) ? hook_search_type (type) : -1;
-
+
for (i = 0; i < HOOK_NUM_TYPES; i++)
{
if ((type_int < 0) || (type_int == i))
hook_add_to_infolist_type (infolist, i, pos_arguments);
}
-
+
if (type)
free (type);
-
+
return 1;
}
@@ -3685,7 +3685,7 @@ hook_print_log ()
struct t_hook *ptr_hook;
struct tm *local_time;
char text_time[1024];
-
+
for (type = 0; type < HOOK_NUM_TYPES; type++)
{
for (ptr_hook = weechat_hooks[type]; ptr_hook;
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 37edded47..a3ca2f52d 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -108,7 +108,7 @@ struct t_hook
int running; /* 1 if hook is currently running */
int priority; /* priority (to sort hooks) */
void *callback_data; /* data sent to callback */
-
+
/* hook data (depends on hook type) */
void *hook_data; /* hook specific data */
struct t_hook *prev_hook; /* link to previous hook */
@@ -128,17 +128,17 @@ struct t_hook_command
char *args; /* (for /help) command arguments */
char *args_description; /* (for /help) args long description*/
char *completion; /* template for completion */
-
+
/* templates */
int cplt_num_templates; /* number of templates for compl. */
char **cplt_templates; /* completion templates */
char **cplt_templates_static; /* static part of template (at */
/* beginning */
-
+
/* arguments for each template */
int *cplt_template_num_args; /* number of arguments for template */
char ***cplt_template_args; /* arguments for each template */
-
+
/* concatenation of arg N for each template */
int cplt_template_num_args_concat; /* number of concatened arguments */
char **cplt_template_args_concat; /* concatened arguments */
diff --git a/src/core/wee-infolist.c b/src/core/wee-infolist.c
index 31f484925..875f2e41d 100644
--- a/src/core/wee-infolist.c
+++ b/src/core/wee-infolist.c
@@ -54,7 +54,7 @@ infolist_new (struct t_weechat_plugin *plugin)
new_infolist->items = NULL;
new_infolist->last_item = NULL;
new_infolist->ptr_item = NULL;
-
+
new_infolist->prev_infolist = last_weechat_infolist;
new_infolist->next_infolist = NULL;
if (weechat_infolists)
@@ -63,7 +63,7 @@ infolist_new (struct t_weechat_plugin *plugin)
weechat_infolists = new_infolist;
last_weechat_infolist = new_infolist;
}
-
+
return new_infolist;
}
@@ -82,7 +82,7 @@ infolist_new_item (struct t_infolist *infolist)
new_item->vars = NULL;
new_item->last_var = NULL;
new_item->fields = NULL;
-
+
new_item->prev_item = infolist->last_item;
new_item->next_item = NULL;
if (infolist->items)
@@ -91,7 +91,7 @@ infolist_new_item (struct t_infolist *infolist)
infolist->items = new_item;
infolist->last_item = new_item;
}
-
+
return new_item;
}
@@ -104,10 +104,10 @@ infolist_new_var_integer (struct t_infolist_item *item,
const char *name, int value)
{
struct t_infolist_var *new_var;
-
+
if (!item || !name || !name[0])
return NULL;
-
+
new_var = malloc (sizeof (*new_var));
if (new_var)
{
@@ -116,7 +116,7 @@ infolist_new_var_integer (struct t_infolist_item *item,
new_var->value = malloc (sizeof (int));
if (new_var->value)
*((int *)new_var->value) = value;
-
+
new_var->prev_var = item->last_var;
new_var->next_var = NULL;
if (item->vars)
@@ -125,7 +125,7 @@ infolist_new_var_integer (struct t_infolist_item *item,
item->vars = new_var;
item->last_var = new_var;
}
-
+
return new_var;
}
@@ -138,17 +138,17 @@ infolist_new_var_string (struct t_infolist_item *item,
const char *name, const char *value)
{
struct t_infolist_var *new_var;
-
+
if (!item || !name || !name[0])
return NULL;
-
+
new_var = malloc (sizeof (*new_var));
if (new_var)
{
new_var->name = strdup (name);
new_var->type = INFOLIST_STRING;
new_var->value = (value) ? strdup (value) : NULL;
-
+
new_var->prev_var = item->last_var;
new_var->next_var = NULL;
if (item->vars)
@@ -157,7 +157,7 @@ infolist_new_var_string (struct t_infolist_item *item,
item->vars = new_var;
item->last_var = new_var;
}
-
+
return new_var;
}
@@ -170,17 +170,17 @@ infolist_new_var_pointer (struct t_infolist_item *item,
const char *name, void *pointer)
{
struct t_infolist_var *new_var;
-
+
if (!item || !name || !name[0])
return NULL;
-
+
new_var = malloc (sizeof (*new_var));
if (new_var)
{
new_var->name = strdup (name);
new_var->type = INFOLIST_POINTER;
new_var->value = pointer;
-
+
new_var->prev_var = item->last_var;
new_var->next_var = NULL;
if (item->vars)
@@ -189,7 +189,7 @@ infolist_new_var_pointer (struct t_infolist_item *item,
item->vars = new_var;
item->last_var = new_var;
}
-
+
return new_var;
}
@@ -202,10 +202,10 @@ infolist_new_var_buffer (struct t_infolist_item *item,
const char *name, void *pointer, int size)
{
struct t_infolist_var *new_var;
-
+
if (!item || !name || !name[0] || (size <= 0))
return NULL;
-
+
new_var = malloc (sizeof (*new_var));
if (new_var)
{
@@ -215,7 +215,7 @@ infolist_new_var_buffer (struct t_infolist_item *item,
if (new_var->value)
memcpy (new_var->value, pointer, size);
new_var->size = size;
-
+
new_var->prev_var = item->last_var;
new_var->next_var = NULL;
if (item->vars)
@@ -224,7 +224,7 @@ infolist_new_var_buffer (struct t_infolist_item *item,
item->vars = new_var;
item->last_var = new_var;
}
-
+
return new_var;
}
@@ -237,10 +237,10 @@ infolist_new_var_time (struct t_infolist_item *item,
const char *name, time_t time)
{
struct t_infolist_var *new_var;
-
+
if (!item || !name || !name[0])
return NULL;
-
+
new_var = malloc (sizeof (*new_var));
if (new_var)
{
@@ -249,7 +249,7 @@ infolist_new_var_time (struct t_infolist_item *item,
new_var->value = malloc (sizeof (time_t));
if (new_var->value)
*((time_t *)new_var->value) = time;
-
+
new_var->prev_var = item->last_var;
new_var->next_var = NULL;
if (item->vars)
@@ -258,7 +258,7 @@ infolist_new_var_time (struct t_infolist_item *item,
item->vars = new_var;
item->last_var = new_var;
}
-
+
return new_var;
}
@@ -272,14 +272,14 @@ int
infolist_valid (struct t_infolist *infolist)
{
struct t_infolist *ptr_infolist;
-
+
for (ptr_infolist = weechat_infolists; ptr_infolist;
ptr_infolist = ptr_infolist->next_infolist)
{
if (ptr_infolist == infolist)
return 1;
}
-
+
/* list not found */
return 0;
}
@@ -339,25 +339,25 @@ infolist_fields (struct t_infolist *infolist)
{
struct t_infolist_var *ptr_var;
int length;
-
+
if (!infolist || !infolist->ptr_item)
return NULL;
/* list of fields already asked ? if yes, just return string */
if (infolist->ptr_item->fields)
return infolist->ptr_item->fields;
-
+
length = 0;
for (ptr_var = infolist->ptr_item->vars;
ptr_var; ptr_var = ptr_var->next_var)
{
length += strlen (ptr_var->name) + 3;
}
-
+
infolist->ptr_item->fields = malloc (length + 1);
if (!infolist->ptr_item->fields)
return NULL;
-
+
infolist->ptr_item->fields[0] = '\0';
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
@@ -384,7 +384,7 @@ infolist_fields (struct t_infolist *infolist)
if (ptr_var->next_var)
strcat (infolist->ptr_item->fields, ",");
}
-
+
return infolist->ptr_item->fields;
}
@@ -396,10 +396,10 @@ int
infolist_integer (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
-
+
if (!infolist || !infolist->ptr_item || !var || !var[0])
return 0;
-
+
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
@@ -411,7 +411,7 @@ infolist_integer (struct t_infolist *infolist, const char *var)
return 0;
}
}
-
+
/* variable not found */
return 0;
}
@@ -424,10 +424,10 @@ const char *
infolist_string (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
-
+
if (!infolist || !infolist->ptr_item || !var || !var[0])
return NULL;
-
+
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
@@ -439,7 +439,7 @@ infolist_string (struct t_infolist *infolist, const char *var)
return NULL;
}
}
-
+
/* variable not found */
return NULL;
}
@@ -452,10 +452,10 @@ void *
infolist_pointer (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
-
+
if (!infolist || !infolist->ptr_item || !var || !var[0])
return NULL;
-
+
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
@@ -467,7 +467,7 @@ infolist_pointer (struct t_infolist *infolist, const char *var)
return NULL;
}
}
-
+
/* variable not found */
return NULL;
}
@@ -482,10 +482,10 @@ infolist_buffer (struct t_infolist *infolist, const char *var,
int *size)
{
struct t_infolist_var *ptr_var;
-
+
if (!infolist || !infolist->ptr_item || !var || !var[0])
return NULL;
-
+
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
@@ -500,7 +500,7 @@ infolist_buffer (struct t_infolist *infolist, const char *var,
return NULL;
}
}
-
+
/* variable not found */
return NULL;
}
@@ -513,10 +513,10 @@ time_t
infolist_time (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
-
+
if (!infolist || !infolist->ptr_item || !var || !var[0])
return 0;
-
+
for (ptr_var = infolist->ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
@@ -528,7 +528,7 @@ infolist_time (struct t_infolist *infolist, const char *var)
return 0;
}
}
-
+
/* variable not found */
return 0;
}
@@ -542,7 +542,7 @@ infolist_var_free (struct t_infolist_item *item,
struct t_infolist_var *var)
{
struct t_infolist_var *new_vars;
-
+
/* remove var */
if (item->last_var == var)
item->last_var = var->prev_var;
@@ -553,10 +553,10 @@ infolist_var_free (struct t_infolist_item *item,
}
else
new_vars = var->next_var;
-
+
if (var->next_var)
(var->next_var)->prev_var = var->prev_var;
-
+
/* free data */
if (var->name)
free (var->name);
@@ -568,9 +568,9 @@ infolist_var_free (struct t_infolist_item *item,
{
free (var->value);
}
-
+
free (var);
-
+
item->vars = new_vars;
}
@@ -583,7 +583,7 @@ infolist_item_free (struct t_infolist *infolist,
struct t_infolist_item *item)
{
struct t_infolist_item *new_items;
-
+
/* remove var */
if (infolist->last_item == item)
infolist->last_item = item->prev_item;
@@ -594,10 +594,10 @@ infolist_item_free (struct t_infolist *infolist,
}
else
new_items = item->next_item;
-
+
if (item->next_item)
(item->next_item)->prev_item = item->prev_item;
-
+
/* free data */
while (item->vars)
{
@@ -605,9 +605,9 @@ infolist_item_free (struct t_infolist *infolist,
}
if (item->fields)
free (item->fields);
-
+
free (item);
-
+
infolist->items = new_items;
}
@@ -619,7 +619,7 @@ void
infolist_free (struct t_infolist *infolist)
{
struct t_infolist *new_weechat_infolists;
-
+
/* remove list */
if (last_weechat_infolist == infolist)
last_weechat_infolist = infolist->prev_infolist;
@@ -630,18 +630,18 @@ infolist_free (struct t_infolist *infolist)
}
else
new_weechat_infolists = infolist->next_infolist;
-
+
if (infolist->next_infolist)
(infolist->next_infolist)->prev_infolist = infolist->prev_infolist;
-
+
/* free data */
while (infolist->items)
{
infolist_item_free (infolist, infolist->items);
}
-
+
free (infolist);
-
+
weechat_infolists = new_weechat_infolists;
}
@@ -653,7 +653,7 @@ void
infolist_free_all_plugin (struct t_weechat_plugin *plugin)
{
struct t_infolist *ptr_infolist, *next_infolist;
-
+
ptr_infolist = weechat_infolists;
while (ptr_infolist)
{
@@ -674,7 +674,7 @@ infolist_print_log ()
struct t_infolist *ptr_infolist;
struct t_infolist_item *ptr_item;
struct t_infolist_var *ptr_var;
-
+
for (ptr_infolist = weechat_infolists; ptr_infolist;
ptr_infolist = ptr_infolist->next_infolist)
{
@@ -686,7 +686,7 @@ infolist_print_log ()
log_printf (" ptr_item . . . . . . . : 0x%lx", ptr_infolist->ptr_item);
log_printf (" prev_infolist. . . . . : 0x%lx", ptr_infolist->prev_infolist);
log_printf (" next_infolist. . . . . : 0x%lx", ptr_infolist->next_infolist);
-
+
for (ptr_item = ptr_infolist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -696,7 +696,7 @@ infolist_print_log ()
log_printf (" last_var . . . . . . . : 0x%lx", ptr_item->last_var);
log_printf (" prev_item. . . . . . . : 0x%lx", ptr_item->prev_item);
log_printf (" next_item. . . . . . . : 0x%lx", ptr_item->next_item);
-
+
for (ptr_var = ptr_item->vars; ptr_var;
ptr_var = ptr_var->next_var)
{
diff --git a/src/core/wee-input.c b/src/core/wee-input.c
index d803002d4..bb9aecfdd 100644
--- a/src/core/wee-input.c
+++ b/src/core/wee-input.c
@@ -71,17 +71,17 @@ input_exec_command (struct t_gui_buffer *buffer,
{
int rc;
char *command, *pos, *ptr_args;
-
+
if ((!string) || (!string[0]))
return;
-
+
command = strdup (string);
if (!command)
return ;
-
+
/* look for end of command */
ptr_args = NULL;
-
+
pos = &command[strlen (command) - 1];
if (pos[0] == ' ')
{
@@ -89,9 +89,9 @@ input_exec_command (struct t_gui_buffer *buffer,
pos--;
pos[1] = '\0';
}
-
+
rc = hook_command_exec (buffer, any_plugin, plugin, command);
-
+
pos = strchr (command, ' ');
if (pos)
{
@@ -103,7 +103,7 @@ input_exec_command (struct t_gui_buffer *buffer,
if (!ptr_args[0])
ptr_args = NULL;
}
-
+
switch (rc)
{
case 0: /* command hooked, KO */
@@ -161,10 +161,10 @@ input_data (struct t_gui_buffer *buffer, const char *data)
char *pos, *buf;
const char *ptr_data, *ptr_data_for_buffer;
int length, char_size;
-
+
if (!buffer || !data || !data[0] || (data[0] == '\r') || (data[0] == '\n'))
return;
-
+
/* use new data (returned by plugin) */
ptr_data = data;
while (ptr_data && ptr_data[0])
@@ -172,7 +172,7 @@ input_data (struct t_gui_buffer *buffer, const char *data)
pos = strchr (ptr_data, '\n');
if (pos)
pos[0] = '\0';
-
+
ptr_data_for_buffer = string_input_for_buffer (ptr_data);
if (ptr_data_for_buffer)
{
@@ -202,7 +202,7 @@ input_data (struct t_gui_buffer *buffer, const char *data)
/* input string is a command */
input_exec_command (buffer, 1, buffer->plugin, ptr_data);
}
-
+
if (pos)
{
pos[0] = '\n';
diff --git a/src/core/wee-list.c b/src/core/wee-list.c
index 948b3acdd..889faeb7a 100644
--- a/src/core/wee-list.c
+++ b/src/core/wee-list.c
@@ -64,7 +64,7 @@ weelist_find_pos (struct t_weelist *weelist, const char *data)
if (!weelist || !data)
return NULL;
-
+
for (ptr_item = weelist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -87,7 +87,7 @@ weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
if (!weelist || !item)
return;
-
+
if (weelist->items)
{
/* remove element if already in list */
@@ -106,7 +106,7 @@ weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
pos_item = NULL;
else
pos_item = weelist_find_pos (weelist, item->data);
-
+
if (pos_item)
{
/* insert data into the list (before position found) */
@@ -145,10 +145,10 @@ weelist_add (struct t_weelist *weelist, const char *data, const char *where,
void *user_data)
{
struct t_weelist_item *new_item;
-
+
if (!weelist || !data || !data[0] || !where || !where[0])
return NULL;
-
+
new_item = malloc (sizeof (*new_item));
if (new_item)
{
@@ -171,7 +171,7 @@ weelist_search (struct t_weelist *weelist, const char *data)
if (!weelist || !data)
return NULL;
-
+
for (ptr_item = weelist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -192,7 +192,7 @@ weelist_search_pos (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
int i;
-
+
if (!weelist || !data)
return -1;
@@ -219,7 +219,7 @@ weelist_casesearch (struct t_weelist *weelist, const char *data)
if (!weelist || !data)
return NULL;
-
+
for (ptr_item = weelist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -240,10 +240,10 @@ weelist_casesearch_pos (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
int i;
-
+
if (!weelist || !data)
return -1;
-
+
for (ptr_item = weelist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -267,7 +267,7 @@ weelist_get (struct t_weelist *weelist, int position)
if (!weelist)
return NULL;
-
+
i = 0;
ptr_item = weelist->items;
while (ptr_item)
@@ -305,7 +305,7 @@ weelist_next (struct t_weelist_item *item)
{
if (item)
return item->next_item;
-
+
return NULL;
}
@@ -318,7 +318,7 @@ weelist_prev (struct t_weelist_item *item)
{
if (item)
return item->prev_item;
-
+
return NULL;
}
@@ -331,7 +331,7 @@ weelist_string (struct t_weelist_item *item)
{
if (item)
return item->data;
-
+
return NULL;
}
@@ -344,7 +344,7 @@ weelist_size (struct t_weelist *weelist)
{
if (weelist)
return weelist->size;
-
+
return 0;
}
@@ -356,10 +356,10 @@ void
weelist_remove (struct t_weelist *weelist, struct t_weelist_item *item)
{
struct t_weelist_item *new_items;
-
+
if (!weelist || !item)
return;
-
+
/* remove item from list */
if (weelist->last_item == item)
weelist->last_item = item->prev_item;
@@ -370,16 +370,16 @@ weelist_remove (struct t_weelist *weelist, struct t_weelist_item *item)
}
else
new_items = item->next_item;
-
+
if (item->next_item)
(item->next_item)->prev_item = item->prev_item;
-
+
/* free data */
if (item->data)
free (item->data);
free (item);
weelist->items = new_items;
-
+
weelist->size--;
}
@@ -392,7 +392,7 @@ weelist_remove_all (struct t_weelist *weelist)
{
if (!weelist)
return;
-
+
while (weelist->items)
{
weelist_remove (weelist, weelist->items);
@@ -408,7 +408,7 @@ weelist_free (struct t_weelist *weelist)
{
if (!weelist)
return;
-
+
weelist_remove_all (weelist);
free (weelist);
}
@@ -421,9 +421,9 @@ void
weelist_print_log (struct t_weelist *weelist, const char *name)
{
struct t_weelist_item *ptr_item;
-
+
log_printf ("[weelist %s (addr:0x%lx)]", name, weelist);
-
+
for (ptr_item = weelist->items; ptr_item;
ptr_item = ptr_item->next_item)
{
diff --git a/src/core/wee-log.c b/src/core/wee-log.c
index 97f5347bc..c6adceb15 100644
--- a/src/core/wee-log.c
+++ b/src/core/wee-log.c
@@ -74,7 +74,7 @@ log_open (const char *filename, const char *mode)
snprintf (weechat_log_filename, filename_length,
"%s/%s", weechat_home, WEECHAT_LOG_NAME);
}
-
+
weechat_log_file = fopen (weechat_log_filename, mode);
if (!weechat_log_file)
{
@@ -129,10 +129,10 @@ log_printf (const char *message, ...)
char *ptr_buffer;
static time_t seconds;
struct tm *date_tmp;
-
+
if (!weechat_log_file)
return;
-
+
weechat_va_format (message);
if (vbuffer)
{
@@ -146,7 +146,7 @@ log_printf (const char *message, ...)
ptr_buffer[0] = '.';
ptr_buffer++;
}
-
+
if (!weechat_log_use_time)
string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer);
else
@@ -163,9 +163,9 @@ log_printf (const char *message, ...)
else
string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer);
}
-
+
fflush (weechat_log_file);
-
+
free (vbuffer);
}
}
@@ -179,7 +179,7 @@ log_printf_hexa (const char *spaces, const char *string)
{
int msg_pos, hexa_pos, ascii_pos;
char hexa[(16 * 3) + 1], ascii[(16 * 2) + 1];
-
+
msg_pos = 0;
hexa_pos = 0;
ascii_pos = 0;
@@ -243,13 +243,13 @@ log_crash_rename ()
if (!weechat_log_filename)
return 0;
-
+
old_name = strdup (weechat_log_filename);
if (!old_name)
return 0;
log_close ();
-
+
length = strlen (weechat_home) + 128;
new_name = malloc (length);
if (new_name)
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index e226c57b6..c381d988c 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -71,7 +71,7 @@ network_set_gnutls_ca_file ()
{
#ifdef HAVE_GNUTLS
char *ca_path, *ca_path2;
-
+
ca_path = string_expand_home (CONFIG_STRING(config_network_gnutls_ca_file));
if (ca_path)
{
@@ -97,7 +97,7 @@ network_init ()
#ifdef HAVE_GNUTLS
gnutls_global_init ();
gnutls_certificate_allocate_credentials (&gnutls_xcred);
-
+
network_set_gnutls_ca_file ();
#if LIBGNUTLS_VERSION_NUMBER >= 0x02090a
/* for gnutls >= 2.9.10 */
@@ -152,7 +152,7 @@ network_pass_httpproxy (struct t_proxy *proxy, int sock, const char *address,
{
char buffer[256], authbuf[128], authbuf_base64[512];
int n, m;
-
+
if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
@@ -172,20 +172,20 @@ network_pass_httpproxy (struct t_proxy *proxy, int sock, const char *address,
n = snprintf (buffer, sizeof (buffer),
"CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port);
}
-
+
m = send (sock, buffer, n, 0);
if (n != m)
return 0;
-
+
n = recv (sock, buffer, sizeof (buffer), 0);
-
+
/* success result must be like: "HTTP/1.0 200 OK" */
if (n < 12)
return 0;
-
+
if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3))
return 0;
-
+
/* connection ok */
return 1;
}
@@ -202,34 +202,34 @@ network_resolve (const char *hostname, char *ip, int *version)
{
char ipbuffer[NI_MAXHOST];
struct addrinfo *res;
-
+
if (version != NULL)
*version = 0;
-
+
res = NULL;
-
+
if (getaddrinfo (hostname, NULL, NULL, &res) != 0)
return 0;
-
+
if (!res)
return 0;
-
+
if (getnameinfo (res->ai_addr, res->ai_addrlen, ipbuffer, sizeof(ipbuffer),
NULL, 0, NI_NUMERICHOST) != 0)
{
freeaddrinfo (res);
return 0;
}
-
+
if ((res->ai_family == AF_INET) && (version != NULL))
*version = 4;
if ((res->ai_family == AF_INET6) && (version != NULL))
*version = 6;
-
+
strcpy (ip, ipbuffer);
-
+
freeaddrinfo (res);
-
+
/* resolution ok */
return 1;
}
@@ -246,11 +246,11 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
int port)
{
/* socks4 protocol is explained here: http://en.wikipedia.org/wiki/SOCKS */
-
+
struct t_network_socks4 socks4;
unsigned char buffer[24];
char ip_addr[NI_MAXHOST];
-
+
socks4.version = 4;
socks4.method = 1;
socks4.port = htons (port);
@@ -258,14 +258,14 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
socks4.address = inet_addr (ip_addr);
strncpy (socks4.user, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
sizeof (socks4.user) - 1);
-
+
send (sock, (char *) &socks4, 8 + strlen (socks4.user) + 1, 0);
recv (sock, buffer, sizeof (buffer), 0);
-
+
/* connection ok */
if ((buffer[0] == 0) && (buffer[1] == 90))
return 1;
-
+
/* connection failed */
return 0;
}
@@ -285,26 +285,26 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
* socks5 protocol is explained in RFC 1928
* socks5 authentication with username/pass is explained in RFC 1929
*/
-
+
struct t_network_socks5 socks5;
unsigned char buffer[288];
int username_len, password_len, addr_len, addr_buffer_len;
unsigned char *addr_buffer;
-
+
socks5.version = 5;
socks5.nmethods = 1;
-
+
if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
socks5.method = 2; /* with authentication */
else
socks5.method = 0; /* without authentication */
-
+
send (sock, (char *) &socks5, sizeof(socks5), 0);
/* server socks5 must respond with 2 bytes */
if (recv (sock, buffer, 2, 0) != 2)
return 0;
-
+
if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
@@ -314,14 +314,14 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
* - socks version (buffer[0]) = 5 => socks5
* - socks method (buffer[1]) = 2 => authentication
*/
-
+
if (buffer[0] != 5 || buffer[1] != 2)
return 0;
-
+
/* authentication as in RFC 1929 */
username_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]));
password_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]));
-
+
/* make username/password buffer */
buffer[0] = 1;
buffer[1] = (unsigned char) username_len;
@@ -329,13 +329,13 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
buffer[2 + username_len] = (unsigned char) password_len;
memcpy (buffer + 3 + username_len,
CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]), password_len);
-
+
send (sock, buffer, 3 + username_len + password_len, 0);
-
+
/* server socks5 must respond with 2 bytes */
if (recv (sock, buffer, 2, 0) != 2)
return 0;
-
+
/* buffer[1] = auth state, must be 0 for success */
if (buffer[1] != 0)
return 0;
@@ -351,7 +351,7 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
if (!((buffer[0] == 5) && (buffer[1] == 0)))
return 0;
}
-
+
/* authentication successful then giving address/port to connect */
addr_len = strlen(address);
addr_buffer_len = 4 + 1 + addr_len + 2;
@@ -365,17 +365,17 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
addr_buffer[4] = (unsigned char) addr_len;
memcpy (addr_buffer + 5, address, addr_len); /* server address */
*((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */
-
+
send (sock, addr_buffer, addr_buffer_len, 0);
free (addr_buffer);
-
+
/* dialog with proxy server */
if (recv (sock, buffer, 4, 0) != 4)
return 0;
-
+
if (!((buffer[0] == 5) && (buffer[1] == 0)))
return 0;
-
+
/* buffer[3] = address type */
switch (buffer[3])
{
@@ -413,7 +413,7 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
default:
return 0;
}
-
+
/* connection ok */
return 1;
}
@@ -429,9 +429,9 @@ network_pass_proxy (const char *proxy, int sock, const char *address, int port)
{
int rc;
struct t_proxy *ptr_proxy;
-
+
rc = 0;
-
+
ptr_proxy = proxy_search (proxy);
if (ptr_proxy)
{
@@ -466,7 +466,7 @@ network_connect_to (const char *proxy, int sock,
struct hostent *hostent;
char *ip4;
int ret;
-
+
ptr_proxy = NULL;
if (proxy && proxy[0])
{
@@ -474,13 +474,13 @@ network_connect_to (const char *proxy, int sock,
if (!ptr_proxy)
return 0;
}
-
+
if (ptr_proxy)
{
memset (&addr, 0, sizeof (addr));
addr.sin_addr.s_addr = htonl (address);
ip4 = inet_ntoa(addr.sin_addr);
-
+
memset (&addr, 0, sizeof (addr));
addr.sin_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
addr.sin_family = AF_INET;
@@ -520,12 +520,12 @@ network_connect_child (struct t_hook *hook_connect)
char ipv4_address[INET_ADDRSTRLEN + 1], ipv6_address[INET6_ADDRSTRLEN + 1];
char status_ok_without_address[1 + 5 + 1];
int rc, length, num_written;
-
+
res = NULL;
res_local = NULL;
-
+
status_str[1] = '\0';
-
+
ptr_proxy = NULL;
if (HOOK_CONNECT(hook_connect, proxy)
&& HOOK_CONNECT(hook_connect, proxy)[0])
@@ -541,7 +541,7 @@ network_connect_child (struct t_hook *hook_connect)
return;
}
}
-
+
if (ptr_proxy)
{
/* get info about peer */
@@ -578,12 +578,12 @@ network_connect_child (struct t_hook *hook_connect)
freeaddrinfo (res);
return;
}
-
+
if (CONFIG_BOOLEAN(ptr_proxy->options[PROXY_OPTION_IPV6]))
((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
else
((struct sockaddr_in *)(res->ai_addr))->sin_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
-
+
/* connect to peer */
if (connect (HOOK_CONNECT(hook_connect, sock),
res->ai_addr, res->ai_addrlen) != 0)
@@ -596,7 +596,7 @@ network_connect_child (struct t_hook *hook_connect)
freeaddrinfo (res);
return;
}
-
+
if (!network_pass_proxy (HOOK_CONNECT(hook_connect, proxy),
HOOK_CONNECT(hook_connect, sock),
HOOK_CONNECT(hook_connect, address),
@@ -652,7 +652,7 @@ network_connect_child (struct t_hook *hook_connect)
return;
}
}
-
+
/* get info about peer */
memset (&hints, 0, sizeof(hints));
hints.ai_family = (HOOK_CONNECT(hook_connect, ipv6)) ? AF_INET6 : AF_INET;
@@ -672,9 +672,9 @@ network_connect_child (struct t_hook *hook_connect)
freeaddrinfo (res_local);
return;
}
-
+
status_str[0] = '0' + WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND;
-
+
/* try all IP addresses found, stop when connection is ok */
for (ptr_res = res; ptr_res; ptr_res = ptr_res->ai_next)
{
@@ -682,7 +682,7 @@ network_connect_child (struct t_hook *hook_connect)
if ((HOOK_CONNECT(hook_connect, ipv6) && (ptr_res->ai_family != AF_INET6))
|| ((!HOOK_CONNECT(hook_connect, ipv6) && (ptr_res->ai_family != AF_INET))))
continue;
-
+
/* connect to peer */
if (HOOK_CONNECT(hook_connect, ipv6))
((struct sockaddr_in6 *)(ptr_res->ai_addr))->sin6_port =
@@ -690,7 +690,7 @@ network_connect_child (struct t_hook *hook_connect)
else
((struct sockaddr_in *)(ptr_res->ai_addr))->sin_port =
htons (HOOK_CONNECT(hook_connect, port));
-
+
if (connect (HOOK_CONNECT(hook_connect, sock),
ptr_res->ai_addr, ptr_res->ai_addrlen) == 0)
{
@@ -701,7 +701,7 @@ network_connect_child (struct t_hook *hook_connect)
status_str[0] = '0' + WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED;
}
}
-
+
if (status_str[0] == '0' + WEECHAT_HOOK_CONNECT_OK)
{
status_ok_with_address = NULL;
@@ -736,7 +736,7 @@ network_connect_child (struct t_hook *hook_connect)
status_str, (int)strlen (ptr_address), ptr_address);
}
}
-
+
if (status_ok_with_address)
{
num_written = write (HOOK_CONNECT(hook_connect, child_write),
@@ -759,7 +759,7 @@ network_connect_child (struct t_hook *hook_connect)
status_str, 1);
(void) num_written;
}
-
+
if (res)
freeaddrinfo (res);
if (res_local)
@@ -778,14 +778,14 @@ network_connect_gnutls_handshake_fd_cb (void *arg_hook_connect, int fd)
{
struct t_hook *hook_connect;
int rc, direction, flags;
-
+
/* make C compiler happy */
(void) fd;
-
+
hook_connect = (struct t_hook *)arg_hook_connect;
-
+
rc = gnutls_handshake (*HOOK_CONNECT(hook_connect, gnutls_sess));
-
+
if ((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED))
{
direction = gnutls_record_get_direction (*HOOK_CONNECT(hook_connect, gnutls_sess));
@@ -837,7 +837,7 @@ network_connect_gnutls_handshake_fd_cb (void *arg_hook_connect, int fd)
HOOK_CONNECT(hook_connect, handshake_ip_address));
unhook (hook_connect);
}
-
+
return WEECHAT_RC_OK;
}
#endif
@@ -852,14 +852,14 @@ network_connect_gnutls_handshake_timer_cb (void *arg_hook_connect,
int remaining_calls)
{
struct t_hook *hook_connect;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
hook_connect = (struct t_hook *)arg_hook_connect;
-
+
HOOK_CONNECT(hook_connect, handshake_hook_timer) = NULL;
-
+
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR,
@@ -867,7 +867,7 @@ network_connect_gnutls_handshake_timer_cb (void *arg_hook_connect,
gnutls_strerror (GNUTLS_E_EXPIRED),
HOOK_CONNECT(hook_connect, handshake_ip_address));
unhook (hook_connect);
-
+
return WEECHAT_RC_OK;
}
#endif
@@ -889,11 +889,11 @@ network_connect_child_read_cb (void *arg_hook_connect, int fd)
/* make C compiler happy */
(void) fd;
-
+
hook_connect = (struct t_hook *)arg_hook_connect;
-
+
ip_address = NULL;
-
+
num_read = read (HOOK_CONNECT(hook_connect, child_read),
buffer, sizeof (buffer));
if (num_read > 0)
@@ -1011,10 +1011,10 @@ network_connect_child_read_cb (void *arg_hook_connect, int fd)
(hook_connect->callback_data, buffer[0] - '0', 0, NULL, ip_address);
unhook (hook_connect);
}
-
+
if (ip_address)
free (ip_address);
-
+
return WEECHAT_RC_OK;
}
@@ -1031,7 +1031,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
const char *pos_error;
#endif
pid_t pid;
-
+
#ifdef HAVE_GNUTLS
/* initialize GnuTLS if SSL asked */
if (HOOK_CONNECT(hook_connect, gnutls_sess))
@@ -1064,7 +1064,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
(gnutls_transport_ptr) ((unsigned long) HOOK_CONNECT(hook_connect, sock)));
}
#endif
-
+
/* create pipe for child process */
if (pipe (child_pipe) < 0)
{
@@ -1077,7 +1077,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
}
HOOK_CONNECT(hook_connect, child_read) = child_pipe[0];
HOOK_CONNECT(hook_connect, child_write) = child_pipe[1];
-
+
switch (pid = fork ())
{
/* fork failed */
diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c
index 7e3406d17..26a263f67 100644
--- a/src/core/wee-proxy.c
+++ b/src/core/wee-proxy.c
@@ -59,16 +59,16 @@ int
proxy_search_option (const char *option_name)
{
int i;
-
+
if (!option_name)
return -1;
-
+
for (i = 0; i < PROXY_NUM_OPTIONS; i++)
{
if (string_strcasecmp (proxy_option_string[i], option_name) == 0)
return i;
}
-
+
/* proxy option not found */
return -1;
}
@@ -82,16 +82,16 @@ int
proxy_search_type (const char *type)
{
int i;
-
+
if (!type)
return -1;
-
+
for (i = 0; i < PROXY_NUM_TYPES; i++)
{
if (string_strcasecmp (proxy_type_string[i], type) == 0)
return i;
}
-
+
/* type not found */
return -1;
}
@@ -104,17 +104,17 @@ struct t_proxy *
proxy_search (const char *name)
{
struct t_proxy *ptr_proxy;
-
+
if (!name || !name[0])
return NULL;
-
+
for (ptr_proxy = weechat_proxies; ptr_proxy;
ptr_proxy = ptr_proxy->next_proxy)
{
if (strcmp (ptr_proxy->name, name) == 0)
return ptr_proxy;
}
-
+
/* proxy not found */
return NULL;
}
@@ -129,9 +129,9 @@ proxy_search_with_option_name (const char *option_name)
{
char *proxy_name, *pos_option;
struct t_proxy *ptr_proxy;
-
+
ptr_proxy = NULL;
-
+
pos_option = strchr (option_name, '.');
if (pos_option)
{
@@ -147,7 +147,7 @@ proxy_search_with_option_name (const char *option_name)
free (proxy_name);
}
}
-
+
return ptr_proxy;
}
@@ -160,10 +160,10 @@ proxy_set_name (struct t_proxy *proxy, const char *name)
{
int length;
char *option_name;
-
+
if (!name || !name[0])
return;
-
+
length = strlen (name) + 64;
option_name = malloc (length);
if (option_name)
@@ -180,11 +180,11 @@ proxy_set_name (struct t_proxy *proxy, const char *name)
config_file_option_rename (proxy->options[PROXY_OPTION_USERNAME], option_name);
snprintf (option_name, length, "%s.password", name);
config_file_option_rename (proxy->options[PROXY_OPTION_PASSWORD], option_name);
-
+
if (proxy->name)
free (proxy->name);
proxy->name = strdup (name);
-
+
free (option_name);
}
}
@@ -199,7 +199,7 @@ proxy_set (struct t_proxy *proxy, const char *property, const char *value)
{
if (!proxy || !property || !value)
return 0;
-
+
if (string_strcasecmp (property, "name") == 0)
{
proxy_set_name (proxy, value);
@@ -235,7 +235,7 @@ proxy_set (struct t_proxy *proxy, const char *property, const char *value)
config_file_option_set (proxy->options[PROXY_OPTION_PASSWORD], value, 1);
return 1;
}
-
+
return 0;
}
@@ -250,9 +250,9 @@ proxy_create_option (const char *proxy_name, int index_option,
struct t_config_option *ptr_option;
int length;
char *option_name;
-
+
ptr_option = NULL;
-
+
length = strlen (proxy_name) + 1 +
strlen (proxy_option_string[index_option]) + 1;
option_name = malloc (length);
@@ -260,7 +260,7 @@ proxy_create_option (const char *proxy_name, int index_option,
{
snprintf (option_name, length, "%s.%s",
proxy_name, proxy_option_string[index_option]);
-
+
switch (index_option)
{
case PROXY_OPTION_TYPE:
@@ -316,7 +316,7 @@ proxy_create_option (const char *proxy_name, int index_option,
}
free (option_name);
}
-
+
return ptr_option;
}
@@ -330,7 +330,7 @@ proxy_create_option_temp (struct t_proxy *temp_proxy, int index_option,
const char *value)
{
struct t_config_option *new_option;
-
+
new_option = proxy_create_option (temp_proxy->name,
index_option,
value);
@@ -347,7 +347,7 @@ proxy_alloc (const char *name)
{
struct t_proxy *new_proxy;
int i;
-
+
new_proxy = malloc (sizeof (*new_proxy));
if (new_proxy)
{
@@ -359,7 +359,7 @@ proxy_alloc (const char *name)
new_proxy->prev_proxy = NULL;
new_proxy->next_proxy = NULL;
}
-
+
return new_proxy;
}
@@ -377,7 +377,7 @@ proxy_new_with_options (const char *name,
struct t_config_option *password)
{
struct t_proxy *new_proxy;
-
+
/* create proxy */
new_proxy = proxy_alloc (name);
if (new_proxy)
@@ -388,7 +388,7 @@ proxy_new_with_options (const char *name,
new_proxy->options[PROXY_OPTION_PORT] = port;
new_proxy->options[PROXY_OPTION_USERNAME] = username;
new_proxy->options[PROXY_OPTION_PASSWORD] = password;
-
+
/* add proxy to proxies list */
new_proxy->prev_proxy = last_weechat_proxy;
if (weechat_proxies)
@@ -398,7 +398,7 @@ proxy_new_with_options (const char *name,
last_weechat_proxy = new_proxy;
new_proxy->next_proxy = NULL;
}
-
+
return new_proxy;
}
@@ -414,18 +414,18 @@ proxy_new (const char *name, const char *type, const char *ipv6,
struct t_config_option *option_type, *option_ipv6, *option_address;
struct t_config_option *option_port, *option_username, *option_password;
struct t_proxy *new_proxy;
-
+
if (!name || !name[0])
return NULL;
-
+
/* it's not possible to create 2 proxies with same name */
if (proxy_search (name))
return NULL;
-
+
/* look for type */
if (proxy_search_type (type) < 0)
return NULL;
-
+
option_type = proxy_create_option (name, PROXY_OPTION_TYPE,
type);
option_ipv6 = proxy_create_option (name, PROXY_OPTION_IPV6,
@@ -438,7 +438,7 @@ proxy_new (const char *name, const char *type, const char *ipv6,
(username) ? username : "");
option_password = proxy_create_option (name, PROXY_OPTION_PASSWORD,
(password) ? password : "");
-
+
new_proxy = proxy_new_with_options (name, option_type, option_ipv6,
option_address, option_port,
option_username, option_password);
@@ -457,7 +457,7 @@ proxy_new (const char *name, const char *type, const char *ipv6,
if (option_password)
config_file_option_free (option_password);
}
-
+
return new_proxy;
}
@@ -470,7 +470,7 @@ proxy_use_temp_proxies ()
{
struct t_proxy *ptr_temp_proxy, *next_temp_proxy;
int i, num_options_ok;
-
+
for (ptr_temp_proxy = weechat_temp_proxies; ptr_temp_proxy;
ptr_temp_proxy = ptr_temp_proxy->next_proxy)
{
@@ -486,7 +486,7 @@ proxy_use_temp_proxies ()
if (ptr_temp_proxy->options[i])
num_options_ok++;
}
-
+
if (num_options_ok == PROXY_NUM_OPTIONS)
{
proxy_new_with_options (ptr_temp_proxy->name,
@@ -509,16 +509,16 @@ proxy_use_temp_proxies ()
}
}
}
-
+
/* free all temp proxies */
while (weechat_temp_proxies)
{
next_temp_proxy = weechat_temp_proxies->next_proxy;
-
+
if (weechat_temp_proxies->name)
free (weechat_temp_proxies->name);
free (weechat_temp_proxies);
-
+
weechat_temp_proxies = next_temp_proxy;
}
last_weechat_temp_proxy = NULL;
@@ -532,10 +532,10 @@ void
proxy_free (struct t_proxy *proxy)
{
int i;
-
+
if (!proxy)
return;
-
+
/* remove proxy from proxies list */
if (proxy->prev_proxy)
(proxy->prev_proxy)->next_proxy = proxy->next_proxy;
@@ -545,7 +545,7 @@ proxy_free (struct t_proxy *proxy)
weechat_proxies = proxy->next_proxy;
if (last_weechat_proxy == proxy)
last_weechat_proxy = proxy->prev_proxy;
-
+
/* free data */
if (proxy->name)
free (proxy->name);
@@ -553,7 +553,7 @@ proxy_free (struct t_proxy *proxy)
{
config_file_option_free (proxy->options[i]);
}
-
+
free (proxy);
}
@@ -578,7 +578,7 @@ void
proxy_print_log ()
{
struct t_proxy *ptr_proxy;
-
+
for (ptr_proxy = weechat_proxies; ptr_proxy;
ptr_proxy = ptr_proxy->next_proxy)
{
diff --git a/src/core/wee-proxy.h b/src/core/wee-proxy.h
index fd22463d7..b449377c6 100644
--- a/src/core/wee-proxy.h
+++ b/src/core/wee-proxy.h
@@ -45,7 +45,7 @@ struct t_proxy
{
char *name; /* proxy name */
struct t_config_option *options[PROXY_NUM_OPTIONS];
-
+
struct t_proxy *prev_proxy; /* link to previous bar */
struct t_proxy *next_proxy; /* link to next bar */
};
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 2ffeb583e..ad534cbb6 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -69,17 +69,17 @@ char *
string_strndup (const char *string, int length)
{
char *result;
-
+
if ((int)strlen (string) < length)
return strdup (string);
-
+
result = malloc (length + 1);
if (!result)
return NULL;
-
+
memcpy (result, string, length);
result[length] = '\0';
-
+
return result;
}
@@ -121,10 +121,10 @@ int
string_strcasecmp (const char *string1, const char *string2)
{
int diff;
-
+
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
-
+
while (string1[0] && string2[0])
{
diff = utf8_charcasecmp (string1, string2);
@@ -134,7 +134,7 @@ string_strcasecmp (const char *string1, const char *string2)
string1 = utf8_next_char (string1);
string2 = utf8_next_char (string2);
}
-
+
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
}
@@ -147,22 +147,22 @@ int
string_strncasecmp (const char *string1, const char *string2, int max)
{
int count, diff;
-
+
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
-
+
count = 0;
while ((count < max) && string1[0] && string2[0])
{
diff = utf8_charcasecmp (string1, string2);
if (diff != 0)
return diff;
-
+
string1 = utf8_next_char (string1);
string2 = utf8_next_char (string2);
count++;
}
-
+
if (count >= max)
return 0;
else
@@ -178,14 +178,14 @@ string_strcmp_ignore_chars (const char *string1, const char *string2,
const char *chars_ignored, int case_sensitive)
{
int diff;
-
+
if (!string1 && !string2)
return 0;
if (!string1 && string2)
return -1;
if (string1 && !string2)
return 1;
-
+
while (string1 && string1[0] && string2 && string2[0])
{
/* skip ignored chars */
@@ -205,16 +205,16 @@ string_strcmp_ignore_chars (const char *string1, const char *string2,
return -1;
if (string1 && string1[0] && (!string2 || !string2[0]))
return 1;
-
+
/* look at diff */
diff = (case_sensitive) ?
(int)string1[0] - (int)string2[0] : utf8_charcasecmp (string1, string2);
if (diff != 0)
return diff;
-
+
string1 = utf8_next_char (string1);
string2 = utf8_next_char (string2);
-
+
/* skip ignored chars */
while (string1 && string1[0] && strchr (chars_ignored, string1[0]))
{
@@ -240,20 +240,20 @@ char *
string_strcasestr (const char *string, const char *search)
{
int length_search;
-
+
length_search = utf8_strlen (search);
-
+
if (!string || !search || (length_search == 0))
return NULL;
-
+
while (string[0])
{
if (string_strncasecmp (string, search, length_search) == 0)
return (char *)string;
-
+
string = utf8_next_char (string);
}
-
+
return NULL;
}
@@ -268,19 +268,19 @@ string_match (const char *string, const char *mask, int case_sensitive)
{
char last, *mask2;
int len_string, len_mask, rc;
-
+
if (!mask || !mask[0])
return 0;
-
+
/* if mask is "*", then any string matches */
if (strcmp (mask, "*") == 0)
return 1;
-
+
len_string = strlen (string);
len_mask = strlen (mask);
-
+
last = mask[len_mask - 1];
-
+
/* mask begins with "*" */
if ((mask[0] == '*') && (last != '*'))
{
@@ -296,7 +296,7 @@ string_match (const char *string, const char *mask, int case_sensitive)
/* no match */
return 0;
}
-
+
/* mask ends with "*" */
if ((mask[0] != '*') && (last == '*'))
{
@@ -312,7 +312,7 @@ string_match (const char *string, const char *mask, int case_sensitive)
/* no match */
return 0;
}
-
+
/* mask begins and ends with "*" */
if ((mask[0] == '*') && (last == '*'))
{
@@ -331,12 +331,12 @@ string_match (const char *string, const char *mask, int case_sensitive)
free (mask2);
return rc;
}
-
+
/* no "*" at all, compare strings */
if ((case_sensitive && (strcmp (string, mask) == 0))
|| (!case_sensitive && (string_strcasecmp (string, mask) == 0)))
return 1;
-
+
/* no match */
return 0;
}
@@ -352,13 +352,13 @@ string_replace (const char *string, const char *search, const char *replace)
const char *pos;
char *new_string;
int length1, length2, length_new, count;
-
+
if (!string || !search || !replace)
return NULL;
-
+
length1 = strlen (search);
length2 = strlen (replace);
-
+
/* count number of strings to replace */
count = 0;
pos = string;
@@ -367,19 +367,19 @@ string_replace (const char *string, const char *search, const char *replace)
count++;
pos += length1;
}
-
+
/* easy: no string to replace! */
if (count == 0)
return strdup (string);
-
+
/* compute needed memory for new string */
length_new = strlen (string) - (count * length1) + (count * length2) + 1;
-
+
/* allocate new string */
new_string = malloc (length_new);
if (!new_string)
return strdup (string);
-
+
/* replace all occurrences */
new_string[0] = '\0';
while (string && string[0])
@@ -409,22 +409,22 @@ string_expand_home (const char *path)
{
char *ptr_home, *str;
int length;
-
+
if (!path)
return NULL;
-
+
if (!path[0] || (path[0] != '~') || (path[1] != DIR_SEPARATOR_CHAR))
return strdup (path);
-
+
ptr_home = getenv ("HOME");
-
+
length = strlen (ptr_home) + strlen (path + 1) + 1;
str = malloc (length);
if (!str)
return strdup (path);
-
+
snprintf (str, length, "%s%s", ptr_home, path + 1);
-
+
return str;
}
@@ -440,7 +440,7 @@ string_remove_quotes (const char *string, const char *quotes)
{
int length;
const char *pos_start, *pos_end;
-
+
if (!string || !quotes)
return NULL;
@@ -460,14 +460,14 @@ string_remove_quotes (const char *string, const char *quotes)
}
if (!pos_start[0] || !pos_end[0] || (pos_end <= pos_start))
return strdup (string);
-
+
if (strchr (quotes, pos_start[0]) && (pos_end[0] == pos_start[0]))
{
if (pos_end == (pos_start + 1))
return strdup ("");
return string_strndup (pos_start + 1, pos_end - pos_start - 1);
}
-
+
return strdup (string);
}
@@ -480,16 +480,16 @@ char *
string_strip (const char *string, int left, int right, const char *chars)
{
const char *ptr_start, *ptr_end;
-
+
if (!string)
return NULL;
-
+
if (!string[0])
return strdup (string);
-
+
ptr_start = string;
ptr_end = string + strlen (string) - 1;
-
+
if (left)
{
while (ptr_start[0] && strchr (chars, ptr_start[0]))
@@ -499,7 +499,7 @@ string_strip (const char *string, int left, int right, const char *chars)
if (!ptr_start[0])
return strdup (ptr_start);
}
-
+
if (right)
{
while ((ptr_end >= ptr_start) && strchr (chars, ptr_end[0]))
@@ -509,7 +509,7 @@ string_strip (const char *string, int left, int right, const char *chars)
if (ptr_end < ptr_start)
return strdup ("");
}
-
+
return string_strndup (ptr_start, ptr_end - ptr_start + 1);
}
@@ -581,7 +581,7 @@ string_convert_hex_chars (const char *string)
}
output[pos_output] = '\0';
}
-
+
return output;
}
@@ -593,13 +593,13 @@ int
string_is_word_char (const char *string)
{
wint_t c = utf8_wide_char (string);
-
+
if (c == WEOF)
return 0;
-
+
if (iswalnum (c))
return 1;
-
+
switch (c)
{
case '-':
@@ -607,7 +607,7 @@ string_is_word_char (const char *string)
case '|':
return 1;
}
-
+
/* not a 'word char' */
return 0;
}
@@ -623,10 +623,10 @@ string_has_highlight (const char *string, const char *highlight_words)
{
char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end;
int end, length, startswith, endswith, wildcard_start, wildcard_end;
-
+
if (!string || !string[0] || !highlight_words || !highlight_words[0])
return 0;
-
+
/* convert both strings to lower case */
msg = strdup (string);
if (!msg)
@@ -639,7 +639,7 @@ string_has_highlight (const char *string, const char *highlight_words)
return 0;
}
string_tolower (highlight);
-
+
pos = highlight;
end = 0;
while (!end)
@@ -657,7 +657,7 @@ string_has_highlight (const char *string, const char *highlight_words)
free (highlight);
return 0;
}
-
+
length = pos_end - pos;
pos_end[0] = '\0';
if (length > 0)
@@ -673,7 +673,7 @@ string_has_highlight (const char *string, const char *highlight_words)
length--;
}
}
-
+
if (length > 0)
{
msg_pos = msg;
@@ -699,14 +699,14 @@ string_has_highlight (const char *string, const char *highlight_words)
msg_pos = match_post;
}
}
-
+
if (!end)
pos = pos_end + 1;
}
-
+
free (msg);
free (highlight);
-
+
/* no highlight found */
return 0;
}
@@ -724,16 +724,16 @@ string_has_highlight_regex_compiled (const char *string, regex_t *regex)
int rc, startswith, endswith;
regmatch_t regex_match;
const char *match_pre;
-
+
if (!string || !regex)
return 0;
-
+
while (string && string[0])
{
rc = regexec (regex, string, 1, &regex_match, 0);
if ((rc != 0) || (regex_match.rm_so < 0) || (regex_match.rm_eo < 0))
break;
-
+
startswith = (regex_match.rm_so == 0);
if (!startswith)
{
@@ -748,10 +748,10 @@ string_has_highlight_regex_compiled (const char *string, regex_t *regex)
}
if (startswith && endswith)
return 1;
-
+
string += regex_match.rm_eo;
}
-
+
/* no highlight found */
return 0;
}
@@ -767,17 +767,17 @@ string_has_highlight_regex (const char *string, const char *regex)
{
regex_t reg;
int rc;
-
+
if (!string || !regex || !regex[0])
return 0;
-
+
if (regcomp (&reg, regex, REG_EXTENDED) != 0)
return 0;
-
+
rc = string_has_highlight_regex_compiled (string, &reg);
-
+
regfree (&reg);
-
+
return rc;
}
@@ -793,14 +793,14 @@ string_mask_to_regex (const char *mask)
const char *ptr_mask;
int index_result;
char *regex_special_char = ".[]{}()?+";
-
+
if (!mask)
return NULL;
-
+
result = malloc ((strlen (mask) * 2) + 1);
if (!result)
return NULL;
-
+
result[0] = '\0';
index_result = 0;
ptr_mask = mask;
@@ -821,13 +821,13 @@ string_mask_to_regex (const char *mask)
/* standard char, just copy it */
else
result[index_result++] = ptr_mask[0];
-
+
ptr_mask++;
}
-
+
/* add final '\0' */
result[index_result] = '\0';
-
+
return result;
}
@@ -853,17 +853,17 @@ string_split (const char *string, const char *separators, int keep_eol,
int i, j, n_items;
char *string2, **array;
char *ptr, *ptr1, *ptr2;
-
+
if (num_items != NULL)
*num_items = 0;
-
+
if (!string || !string[0] || !separators || !separators[0])
return NULL;
-
+
string2 = string_strip (string, 1, (keep_eol == 2) ? 0 : 1, separators);
if (!string2 || !string2[0])
return NULL;
-
+
/* calculate number of items */
ptr = string2;
i = 1;
@@ -876,16 +876,16 @@ string_split (const char *string, const char *separators, int keep_eol,
i++;
}
n_items = i;
-
+
if ((num_items_max != 0) && (n_items > num_items_max))
n_items = num_items_max;
-
+
array = malloc ((n_items + 1) * sizeof (array[0]));
if (!array)
return NULL;
-
+
ptr1 = string2;
-
+
for (i = 0; i < n_items; i++)
{
while (ptr1[0] && (strchr (separators, ptr1[0]) != NULL))
@@ -911,7 +911,7 @@ string_split (const char *string, const char *separators, int keep_eol,
}
}
}
-
+
if ((ptr1 == NULL) || (ptr2 == NULL))
{
array[i] = NULL;
@@ -960,13 +960,13 @@ string_split (const char *string, const char *separators, int keep_eol,
}
}
}
-
+
array[i] = NULL;
if (num_items != NULL)
*num_items = i;
-
+
free (string2);
-
+
return array;
}
@@ -978,7 +978,7 @@ void
string_free_split (char **split_string)
{
int i;
-
+
if (split_string)
{
for (i = 0; split_string[i]; i++)
@@ -999,23 +999,23 @@ string_build_with_split_string (const char **split_string,
{
int i, length, length_separator;
char *result;
-
+
if (!split_string)
return NULL;
-
+
length = 0;
length_separator = (separator) ? strlen (separator) : 0;
-
+
for (i = 0; split_string[i]; i++)
{
length += strlen (split_string[i]) + length_separator;
}
-
+
result = malloc (length + 1);
if (result)
{
result[0] = '\0';
-
+
for (i = 0; split_string[i]; i++)
{
strcat (result, split_string[i]);
@@ -1023,7 +1023,7 @@ string_build_with_split_string (const char **split_string,
strcat (result, separator);
}
}
-
+
return result;
}
@@ -1045,7 +1045,7 @@ string_split_command (const char *command, char separator)
if (!command || !command[0])
return NULL;
-
+
nb_substr = 1;
ptr = command;
while ( (p = strchr(ptr, separator)) != NULL)
@@ -1057,14 +1057,14 @@ string_split_command (const char *command, char separator)
array = malloc ((nb_substr + 1) * sizeof (array[0]));
if (!array)
return NULL;
-
+
buffer = malloc (strlen(command) + 1);
if (!buffer)
{
free (array);
return NULL;
}
-
+
ptr = command;
str_idx = 0;
arr_idx = 0;
@@ -1097,17 +1097,17 @@ string_split_command (const char *command, char separator)
str_idx++;
ptr++;
}
-
+
buffer[str_idx] = '\0';
p = buffer;
while (*p == ' ') p++;
if (p && p[0])
array[arr_idx++] = strdup (p);
-
+
array[arr_idx] = NULL;
-
+
free (buffer);
-
+
array2 = realloc (array, (arr_idx + 1) * sizeof(array[0]));
if (!array2)
{
@@ -1115,7 +1115,7 @@ string_split_command (const char *command, char separator)
free (array);
return NULL;
}
-
+
return array2;
}
@@ -1147,14 +1147,14 @@ string_iconv (int from_utf8, const char *from_code, const char *to_code,
const char *string)
{
char *outbuf;
-
+
#ifdef HAVE_ICONV
iconv_t cd;
char *inbuf, *ptr_inbuf, *ptr_outbuf, *next_char;
char *ptr_inbuf_shift;
int done;
size_t err, inbytesleft, outbytesleft;
-
+
if (from_code && from_code[0] && to_code && to_code[0]
&& (string_strcasecmp(from_code, to_code) != 0))
{
@@ -1243,7 +1243,7 @@ string_iconv (int from_utf8, const char *from_code, const char *to_code,
(void) to_code;
outbuf = strdup (string);
#endif /* HAVE_ICONV */
-
+
return outbuf;
}
@@ -1257,24 +1257,24 @@ char *
string_iconv_to_internal (const char *charset, const char *string)
{
char *input, *output;
-
+
if (!string)
return NULL;
-
+
input = strdup (string);
if (!input)
return NULL;
-
+
/*
* optimized for UTF-8: if charset is NULL => we use term charset => if
* this charset is already UTF-8, then no iconv is needed
*/
if (local_utf8 && (!charset || !charset[0]))
return input;
-
+
if (utf8_has_8bits (input) && utf8_is_valid (input, NULL))
return input;
-
+
output = string_iconv (0,
(charset && charset[0]) ?
charset : weechat_local_charset,
@@ -1297,21 +1297,21 @@ char *
string_iconv_from_internal (const char *charset, const char *string)
{
char *input, *output;
-
+
if (!string)
return NULL;
-
+
input = strdup (string);
if (!input)
return NULL;
-
+
/*
* optimized for UTF-8: if charset is NULL => we use term charset => if
* this charset is already UTF-8, then no iconv needed
*/
if (local_utf8 && (!charset || !charset[0]))
return input;
-
+
utf8_normalize (input, '?');
output = string_iconv (1,
WEECHAT_INTERNAL_CHARSET,
@@ -1334,7 +1334,7 @@ string_iconv_fprintf (FILE *file, const char *data, ...)
{
char *buf2;
int rc, num_written;
-
+
rc = 0;
weechat_va_format (data);
if (vbuffer)
@@ -1346,7 +1346,7 @@ string_iconv_fprintf (FILE *file, const char *data, ...)
free (buf2);
free (vbuffer);
}
-
+
return rc;
}
@@ -1363,9 +1363,9 @@ string_format_size (unsigned long long size)
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)
@@ -1374,7 +1374,7 @@ string_format_size (unsigned long long size)
num_unit = 2;
else
num_unit = 3;
-
+
snprintf (format_size, sizeof (format_size),
"%s %%s",
unit_format[num_unit]);
@@ -1382,7 +1382,7 @@ string_format_size (unsigned long long size)
format_size,
((float)size) / ((float)(unit_divide[num_unit])),
(size <= 1) ? _("byte") : _(unit_name[num_unit]));
-
+
return strdup (str_size);
}
@@ -1395,7 +1395,7 @@ string_convbase64_8x3_to_6x4 (const char *from, char *to)
{
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789+/";
-
+
to[0] = base64_table [ (from[0] & 0xfc) >> 2 ];
to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ];
to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ];
@@ -1413,10 +1413,10 @@ string_encode_base64 (const char *from, int length, char *to)
{
const char *ptr_from;
char *ptr_to;
-
+
ptr_from = from;
ptr_to = to;
-
+
while (length >= 3)
{
string_convbase64_8x3_to_6x4 (ptr_from, ptr_to);
@@ -1424,7 +1424,7 @@ string_encode_base64 (const char *from, int length, char *to)
ptr_to += 4 * sizeof (*ptr_to);
length -= 3;
}
-
+
if (length > 0)
{
char rest[3] = { 0, 0, 0 };
@@ -1475,13 +1475,13 @@ string_decode_base64 (const char *from, char *to)
unsigned char c, in[4], out[3];
unsigned char base64_table[]="|$$$}rstuvwxyz{$$$$$$$>?"
"@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
-
+
ptr_from = from;
ptr_to = to;
-
+
ptr_to[0] = '\0';
to_length = 0;
-
+
while (ptr_from && ptr_from[0])
{
length = 0;
@@ -1519,9 +1519,9 @@ string_decode_base64 (const char *from, char *to)
}
}
}
-
+
ptr_to[0] = '\0';
-
+
return to_length;
}
@@ -1534,24 +1534,24 @@ int
string_is_command_char (const char *string)
{
const char *ptr_command_chars;
-
+
if (!string)
return 0;
-
+
if (string[0] == '/')
return 1;
-
+
ptr_command_chars = CONFIG_STRING(config_look_command_chars);
if (!ptr_command_chars || !ptr_command_chars[0])
return 0;
-
+
while (ptr_command_chars && ptr_command_chars[0])
{
if (utf8_charcmp (ptr_command_chars, string) == 0)
return 1;
ptr_command_chars = utf8_next_char (ptr_command_chars);
}
-
+
return 0;
}
@@ -1566,11 +1566,11 @@ const char *
string_input_for_buffer (const char *string)
{
char *pos_slash, *pos_space, *next_char;
-
+
/* special case for C comments pasted in input line */
if (strncmp (string, "/*", 2) == 0)
return string;
-
+
/*
* special case if string starts with '/': to allow to paste a path line
* "/path/to/file.txt", we check if next '/' is after a space or not
@@ -1579,28 +1579,28 @@ string_input_for_buffer (const char *string)
{
pos_slash = strchr (string + 1, '/');
pos_space = strchr (string + 1, ' ');
-
+
/*
* if there's no other '/' of if '/' is after first space,
* then it is a command, and return NULL
*/
if (!pos_slash || (pos_space && pos_slash > pos_space))
return NULL;
-
+
return (string[1] == '/') ? string + 1 : string;
}
-
+
/* if string does not start with a command char, then it's not command */
if (!string_is_command_char (string))
return string;
-
+
/* check if first char is doubled: if yes, then it's not a command */
next_char = utf8_next_char (string);
if (!next_char || !next_char[0])
return string;
if (utf8_charcmp (string, next_char) == 0)
return next_char;
-
+
/* string is a command */
return NULL;
}
@@ -1619,15 +1619,15 @@ string_replace_with_hashtable (const char *string,
int length, length_value, index_string, index_result;
char *result, *result2, *key;
const char *pos_end_name, *ptr_value;
-
+
*errors = 0;
-
+
if (!string)
return NULL;
-
+
if (!hashtable)
return strdup (string);
-
+
length = strlen (string) + 1;
result = malloc (length);
if (result)
@@ -1676,7 +1676,7 @@ string_replace_with_hashtable (const char *string,
result[index_result++] = string[index_string++];
(*errors)++;
}
-
+
free (key);
}
else
@@ -1690,6 +1690,6 @@ string_replace_with_hashtable (const char *string,
}
result[index_result] = '\0';
}
-
+
return result;
}
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c
index 9af4910c4..eba5e96bf 100644
--- a/src/core/wee-upgrade-file.c
+++ b/src/core/wee-upgrade-file.c
@@ -94,7 +94,7 @@ upgrade_file_write_integer (struct t_upgrade_file *upgrade_file, int value)
{
if (fwrite ((void *)(&value), sizeof (value), 1, upgrade_file->file) <= 0)
return 0;
-
+
return 1;
}
@@ -108,7 +108,7 @@ upgrade_file_write_time (struct t_upgrade_file *upgrade_file, time_t date)
{
if (fwrite ((void *)(&date), sizeof (date), 1, upgrade_file->file) <= 0)
return 0;
-
+
return 1;
}
@@ -122,7 +122,7 @@ upgrade_file_write_string (struct t_upgrade_file *upgrade_file,
const char *string)
{
int length;
-
+
if (string && string[0])
{
length = strlen (string);
@@ -136,7 +136,7 @@ upgrade_file_write_string (struct t_upgrade_file *upgrade_file,
if (!upgrade_file_write_integer (upgrade_file, 0))
return 0;
}
-
+
return 1;
}
@@ -161,7 +161,7 @@ upgrade_file_write_buffer (struct t_upgrade_file *upgrade_file, void *pointer,
if (!upgrade_file_write_integer (upgrade_file, 0))
return 0;
}
-
+
return 1;
}
@@ -176,10 +176,10 @@ upgrade_file_new (const char *filename, int write)
{
int length;
struct t_upgrade_file *new_upgrade_file;
-
+
if (!filename)
return NULL;
-
+
new_upgrade_file = malloc (sizeof (*new_upgrade_file));
if (new_upgrade_file)
{
@@ -193,33 +193,33 @@ upgrade_file_new (const char *filename, int write)
}
snprintf (new_upgrade_file->filename, length, "%s/%s.upgrade",
weechat_home, filename);
-
+
/* open file in read or write mode */
if (write)
new_upgrade_file->file = fopen (new_upgrade_file->filename, "wb");
else
new_upgrade_file->file = fopen (new_upgrade_file->filename, "rb");
-
+
if (!new_upgrade_file->file)
{
free (new_upgrade_file->filename);
free (new_upgrade_file);
return NULL;
}
-
+
/* change permissions if write mode */
if (write)
{
chmod (new_upgrade_file->filename, 0600);
-
+
/* write signature */
upgrade_file_write_string (new_upgrade_file, UPGRADE_SIGNATURE);
}
-
+
/* init positions */
new_upgrade_file->last_read_pos = 0;
new_upgrade_file->last_read_length = 0;
-
+
/* add upgrade file to list of upgrade files */
new_upgrade_file->prev_upgrade = last_upgrade_file;
new_upgrade_file->next_upgrade = NULL;
@@ -245,7 +245,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
char **argv;
const char *fields;
void *buf;
-
+
/* write all infolist variables */
infolist_reset_item_cursor (infolist);
while (infolist_next (infolist))
@@ -261,7 +261,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
UPGRADE_ERROR(_("write - object id"), "");
return 0;
}
-
+
fields = infolist_fields (infolist);
if (fields)
{
@@ -376,12 +376,12 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
if (argv)
string_free_split (argv);
}
-
+
/* write object end */
if (!upgrade_file_write_integer (upgrade_file, UPGRADE_TYPE_OBJECT_END))
return 0;
}
-
+
return 1;
}
@@ -416,28 +416,28 @@ int
upgrade_file_read_string (struct t_upgrade_file *upgrade_file, char **string)
{
int length;
-
+
if (string && *string)
{
free (*string);
*string = NULL;
}
-
+
if (!upgrade_file_read_integer (upgrade_file, &length))
return 0;
-
+
upgrade_file->last_read_pos = ftell (upgrade_file->file);
upgrade_file->last_read_length = length;
-
+
if (string)
{
if (length == 0)
return 1;
-
+
(*string) = malloc (length + 1);
if (!(*string))
return 0;
-
+
if (fread ((void *)(*string), length, 1, upgrade_file->file) <= 0)
{
free (*string);
@@ -464,10 +464,10 @@ upgrade_file_read_string_utf8 (struct t_upgrade_file *upgrade_file,
{
if (!upgrade_file_read_string (upgrade_file, string))
return 0;
-
+
if (string && *string)
utf8_normalize (*string, '?');
-
+
return 1;
}
@@ -481,23 +481,23 @@ upgrade_file_read_buffer (struct t_upgrade_file *upgrade_file,
{
if (!buffer)
return 0;
-
+
if (*buffer)
{
free (*buffer);
*buffer = NULL;
}
-
+
if (!upgrade_file_read_integer (upgrade_file, size))
return 0;
-
+
if (*size > 0)
{
upgrade_file->last_read_pos = ftell (upgrade_file->file);
upgrade_file->last_read_length = *size;
-
+
*buffer = malloc (*size);
-
+
if (*buffer)
{
if (fread (*buffer, *size, 1, upgrade_file->file) <= 0)
@@ -509,7 +509,7 @@ upgrade_file_read_buffer (struct t_upgrade_file *upgrade_file,
return 0;
}
}
-
+
return 1;
}
@@ -522,7 +522,7 @@ upgrade_file_read_time (struct t_upgrade_file *upgrade_file, time_t *time)
{
upgrade_file->last_read_pos = ftell (upgrade_file->file);
upgrade_file->last_read_length = sizeof (*time);
-
+
if (time)
{
if (fread ((void *)time, sizeof (*time), 1, upgrade_file->file) <= 0)
@@ -533,7 +533,7 @@ upgrade_file_read_time (struct t_upgrade_file *upgrade_file, time_t *time)
if (fseek (upgrade_file->file, sizeof (*time), SEEK_CUR) < 0)
return 0;
}
-
+
return 1;
}
@@ -551,14 +551,14 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
char *name, *value_str;
void *buffer;
time_t time;
-
+
rc = 0;
-
+
infolist = NULL;
name = NULL;
value_str = NULL;
buffer = NULL;
-
+
if (!upgrade_file_read_integer (upgrade_file, &type))
{
if (feof (upgrade_file->file))
@@ -567,19 +567,19 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
UPGRADE_ERROR(_("read - object type"), "");
goto end;
}
-
+
if (type != UPGRADE_TYPE_OBJECT_START)
{
UPGRADE_ERROR(_("read - bad object type ('object start' expected)"), "");
goto end;
}
-
+
if (!upgrade_file_read_integer (upgrade_file, &object_id))
{
UPGRADE_ERROR(_("read - object id"), "");
goto end;
}
-
+
infolist = infolist_new ();
if (!infolist)
{
@@ -592,7 +592,7 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
UPGRADE_ERROR(_("read - infolist item creation"), "");
goto end;
}
-
+
while (1)
{
if (!upgrade_file_read_integer (upgrade_file, &type))
@@ -600,10 +600,10 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
UPGRADE_ERROR(_("read - object type"), "");
goto end;
}
-
+
if (type == UPGRADE_TYPE_OBJECT_END)
break;
-
+
if (type == UPGRADE_TYPE_OBJECT_VAR)
{
if (!upgrade_file_read_string (upgrade_file, &name))
@@ -621,7 +621,7 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
UPGRADE_ERROR(_("read - variable type"), "");
goto end;
}
-
+
switch (type_var)
{
case INFOLIST_INTEGER:
@@ -661,9 +661,9 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
}
}
}
-
+
rc = 1;
-
+
if (upgrade_file->callback_read)
{
if ((int)(upgrade_file->callback_read) (upgrade_file->callback_read_data,
@@ -672,7 +672,7 @@ upgrade_file_read_object (struct t_upgrade_file *upgrade_file)
infolist) == WEECHAT_RC_ERROR)
rc = 0;
}
-
+
end:
if (infolist)
infolist_free (infolist);
@@ -682,7 +682,7 @@ end:
free (value_str);
if (buffer)
free (buffer);
-
+
return rc;
}
@@ -700,35 +700,35 @@ upgrade_file_read (struct t_upgrade_file *upgrade_file,
void *callback_read_data)
{
char *signature;
-
+
if (!upgrade_file)
return 0;
-
+
upgrade_file->callback_read = callback_read;
upgrade_file->callback_read_data = callback_read_data;
-
+
signature = NULL;
if (!upgrade_file_read_string (upgrade_file, &signature))
{
UPGRADE_ERROR(_("read - signature not found"), "");
return 0;
}
-
+
if (!signature || (strcmp (signature, UPGRADE_SIGNATURE) != 0))
{
UPGRADE_ERROR(_("read - bad signature (upgrade file format may have "
"changed since last version)"), "");
return 0;
}
-
+
free (signature);
-
+
while (!feof (upgrade_file->file))
{
if (!upgrade_file_read_object (upgrade_file))
return 0;
}
-
+
return 1;
}
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c
index c6e33b636..f1ee1da43 100644
--- a/src/core/wee-upgrade.c
+++ b/src/core/wee-upgrade.c
@@ -71,14 +71,14 @@ upgrade_weechat_save_history (struct t_upgrade_file *upgrade_file,
struct t_infolist_item *ptr_item;
struct t_gui_history *ptr_history;
int rc;
-
+
if (!last_history)
return 1;
-
+
ptr_infolist = infolist_new ();
if (!ptr_infolist)
return 0;
-
+
ptr_history = last_history;
while (ptr_history)
{
@@ -88,23 +88,23 @@ upgrade_weechat_save_history (struct t_upgrade_file *upgrade_file,
infolist_free (ptr_infolist);
return 0;
}
-
+
if (!infolist_new_var_string (ptr_item, "text", ptr_history->text))
{
infolist_free (ptr_infolist);
return 0;
}
-
+
ptr_history = ptr_history->prev_history;
}
-
+
rc = upgrade_file_write_object (upgrade_file,
UPGRADE_WEECHAT_TYPE_HISTORY,
ptr_infolist);
infolist_free (ptr_infolist);
if (!rc)
return 0;
-
+
return 1;
}
@@ -119,7 +119,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
int rc;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -138,7 +138,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
infolist_free (ptr_infolist);
if (!rc)
return 0;
-
+
/* save nicklist */
if (ptr_buffer->nicklist)
{
@@ -157,7 +157,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save buffer lines */
for (ptr_line = ptr_buffer->own_lines->first_line; ptr_line;
ptr_line = ptr_line->next_line)
@@ -179,7 +179,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save command/text history of buffer */
if (ptr_buffer->history)
{
@@ -189,7 +189,7 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
return 1;
}
@@ -203,11 +203,11 @@ upgrade_weechat_save_misc (struct t_upgrade_file *upgrade_file)
struct t_infolist *ptr_infolist;
struct t_infolist_item *ptr_item;
int rc;
-
+
ptr_infolist = infolist_new ();
if (!ptr_infolist)
return 0;
-
+
ptr_item = infolist_new_item (ptr_infolist);
if (!ptr_item)
{
@@ -229,12 +229,12 @@ upgrade_weechat_save_misc (struct t_upgrade_file *upgrade_file)
infolist_free (ptr_infolist);
return 0;
}
-
+
rc = upgrade_file_write_object (upgrade_file,
UPGRADE_WEECHAT_TYPE_MISC,
ptr_infolist);
infolist_free (ptr_infolist);
-
+
return rc;
}
@@ -248,7 +248,7 @@ upgrade_weechat_save_hotlist (struct t_upgrade_file *upgrade_file)
struct t_infolist *ptr_infolist;
struct t_gui_hotlist *ptr_hotlist;
int rc;
-
+
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -267,7 +267,7 @@ upgrade_weechat_save_hotlist (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
return 1;
}
@@ -282,39 +282,39 @@ upgrade_weechat_save_layout_window_tree (struct t_upgrade_file *upgrade_file,
{
struct t_infolist *ptr_infolist;
int rc;
-
+
ptr_infolist = infolist_new ();
if (!ptr_infolist)
return 0;
-
+
if (!gui_layout_window_add_to_infolist (ptr_infolist, layout_window))
{
infolist_free (ptr_infolist);
return 0;
}
-
+
rc = upgrade_file_write_object (upgrade_file,
UPGRADE_WEECHAT_TYPE_LAYOUT_WINDOW,
ptr_infolist);
-
+
infolist_free (ptr_infolist);
if (!rc)
return 0;
-
+
if (layout_window->child1)
{
if (!upgrade_weechat_save_layout_window_tree (upgrade_file,
layout_window->child1))
return 0;
}
-
+
if (layout_window->child2)
{
if (!upgrade_weechat_save_layout_window_tree (upgrade_file,
layout_window->child2))
return 0;
}
-
+
return 1;
}
@@ -327,16 +327,16 @@ upgrade_weechat_save_layout_window (struct t_upgrade_file *upgrade_file)
{
struct t_gui_layout_window *layout_windows;
int rc;
-
+
/* get current layout for windows */
layout_windows = NULL;
gui_layout_window_save (&layout_windows);
/* save tree with layout of windows */
rc = upgrade_weechat_save_layout_window_tree (upgrade_file, layout_windows);
-
+
gui_layout_window_remove_all (&layout_windows);
-
+
return rc;
}
@@ -350,7 +350,7 @@ upgrade_weechat_save ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME, 1);
if (!upgrade_file)
return 0;
@@ -361,9 +361,9 @@ upgrade_weechat_save ()
rc &= upgrade_weechat_save_misc (upgrade_file);
rc &= upgrade_weechat_save_hotlist (upgrade_file);
rc &= upgrade_weechat_save_layout_window (upgrade_file);
-
+
upgrade_file_close (upgrade_file);
-
+
return rc;
}
@@ -387,11 +387,11 @@ upgrade_weechat_read_cb (void *data,
struct timeval creation_time;
void *buf;
int i, size, index, length;
-
+
/* make C compiler happy */
(void) data;
(void) upgrade_file;
-
+
infolist_reset_item_cursor (infolist);
while (infolist_next (infolist))
{
@@ -673,7 +673,7 @@ upgrade_weechat_read_cb (void *data,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -687,40 +687,40 @@ upgrade_weechat_load ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME, 0);
rc = upgrade_file_read (upgrade_file, &upgrade_weechat_read_cb, NULL);
-
+
if (!hotlist_reset)
gui_hotlist_clear ();
-
+
gui_color_buffer_assign ();
gui_color_buffer_display ();
-
+
if (upgrade_layout_buffers)
{
gui_layout_buffer_apply (upgrade_layout_buffers);
gui_layout_buffer_remove_all (&upgrade_layout_buffers,
&last_upgrade_layout_buffer);
}
-
+
if (upgrade_layout_windows)
{
gui_layout_window_apply (upgrade_layout_windows, -1);
gui_layout_window_remove_all (&upgrade_layout_windows);
}
-
+
if (upgrade_set_current_window > 0)
gui_window_switch_by_number (upgrade_set_current_window);
-
+
if (upgrade_set_current_buffer)
{
gui_window_switch_to_buffer (gui_current_window,
upgrade_set_current_buffer, 0);
}
-
+
gui_layout_buffer_get_number_all (gui_layout_buffers);
-
+
return rc;
}
@@ -733,7 +733,7 @@ upgrade_weechat_remove_file_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
if (string_match (filename, "*.upgrade", 1))
{
if (weechat_debug_core >= 2)
@@ -752,13 +752,13 @@ upgrade_weechat_end ()
{
struct timeval tv_now;
long time_diff;
-
+
/* remove .upgrade files */
util_exec_on_files (weechat_home,
0,
NULL,
&upgrade_weechat_remove_file_cb);
-
+
/* display message for end of /upgrade with duration */
gettimeofday (&tv_now, NULL);
time_diff = util_timeval_diff (&weechat_current_start_timeval, &tv_now);
@@ -767,10 +767,10 @@ upgrade_weechat_end ()
_("Upgrade done (%.02f %s)"),
((float)time_diff) / 1000,
NG_("second", "seconds", time_diff / 1000));
-
+
/* upgrading ended */
weechat_upgrading = 0;
-
+
/* send signal for end of /upgrade */
hook_signal_send ("upgrade_ended", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c
index 1ef32542e..d61261f33 100644
--- a/src/core/wee-utf8.c
+++ b/src/core/wee-utf8.c
@@ -137,7 +137,7 @@ void
utf8_normalize (char *string, char replacement)
{
char *error;
-
+
while (string && string[0])
{
if (utf8_is_valid (string, &error))
@@ -156,9 +156,9 @@ utf8_prev_char (const char *string_start, const char *string)
{
if (!string || (string <= string_start))
return NULL;
-
+
string--;
-
+
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
{
/* UTF-8, at least 2 bytes */
@@ -197,7 +197,7 @@ utf8_next_char (const char *string)
{
if (!string)
return NULL;
-
+
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
{
@@ -237,12 +237,12 @@ int
utf8_char_int (const char *string)
{
const unsigned char *ptr_string;
-
+
if (!string)
return 0;
-
+
ptr_string = (unsigned char *)string;
-
+
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
if ((ptr_string[0] & 0xE0) == 0xC0)
{
@@ -293,10 +293,10 @@ utf8_wide_char (const char *string)
{
int char_size;
wint_t result;
-
+
if (!string || !string[0])
return WEOF;
-
+
char_size = utf8_char_size (string);
switch (char_size)
{
@@ -333,7 +333,7 @@ utf8_char_size (const char *string)
{
if (!string)
return 0;
-
+
return utf8_next_char (string) - string;
}
@@ -345,10 +345,10 @@ int
utf8_strlen (const char *string)
{
int length;
-
+
if (!string)
return 0;
-
+
length = 0;
while (string && string[0])
{
@@ -367,10 +367,10 @@ utf8_strnlen (const char *string, int bytes)
{
char *start;
int length;
-
+
if (!string)
return 0;
-
+
start = (char *)string;
length = 0;
while (string && string[0] && (string - start < bytes))
@@ -391,24 +391,24 @@ utf8_strlen_screen (const char *string)
{
int length, num_char;
wchar_t *wstring;
-
+
if (!string)
return 0;
-
+
if (!local_utf8)
return utf8_strlen (string);
-
+
num_char = mbstowcs (NULL, string, 0) + 1;
wstring = malloc ((num_char + 1) * sizeof (wstring[0]));
if (!wstring)
return utf8_strlen (string);
-
+
if (mbstowcs (wstring, string, num_char) == (size_t)(-1))
{
free (wstring);
return utf8_strlen (string);
}
-
+
length = wcswidth (wstring, num_char);
free (wstring);
return length;
@@ -422,13 +422,13 @@ int
utf8_charcmp (const char *string1, const char *string2)
{
int length1, length2, i, diff;
-
+
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
-
+
length1 = utf8_char_size (string1);
length2 = utf8_char_size (string2);
-
+
i = 0;
while ((i < length1) && (i < length2))
{
@@ -455,18 +455,18 @@ int
utf8_charcasecmp (const char *string1, const char *string2)
{
wint_t wchar1, wchar2;
-
+
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
-
+
wchar1 = utf8_wide_char (string1);
if ((wchar1 >= 'A') && (wchar1 <= 'Z'))
wchar1 += ('a' - 'A');
-
+
wchar2 = utf8_wide_char (string2);
if ((wchar2 >= 'A') && (wchar2 <= 'Z'))
wchar2 += ('a' - 'A');
-
+
return (wchar1 < wchar2) ? -1 : ((wchar1 == wchar2) ? 0 : 1);
}
@@ -480,17 +480,17 @@ utf8_char_size_screen (const char *string)
{
int char_size;
char utf_char[16];
-
+
if (!string)
return 0;
-
+
char_size = utf8_char_size (string);
if (char_size == 0)
return 0;
-
+
memcpy (utf_char, string, char_size);
utf_char[char_size] = '\0';
-
+
return utf8_strlen_screen (utf_char);
}
@@ -503,7 +503,7 @@ utf8_add_offset (const char *string, int offset)
{
if (!string)
return NULL;
-
+
while (string && string[0] && (offset > 0))
{
string = utf8_next_char (string);
@@ -522,10 +522,10 @@ utf8_real_pos (const char *string, int pos)
{
int count, real_pos;
char *next_char;
-
+
if (!string)
return pos;
-
+
count = 0;
real_pos = 0;
while (string && string[0] && (count < pos))
@@ -548,10 +548,10 @@ utf8_pos (const char *string, int real_pos)
{
int count;
char *limit;
-
+
if (!string || !weechat_local_charset)
return real_pos;
-
+
count = 0;
limit = (char *)string + real_pos;
while (string && string[0] && (string < limit))
@@ -570,13 +570,13 @@ char *
utf8_strndup (const char *string, int length)
{
const char *end;
-
+
if (!string || (length < 0))
return NULL;
-
+
if (length == 0)
return strdup ("");
-
+
end = utf8_add_offset (string, length);
if (!end || (end == string))
return strdup (string);
diff --git a/src/core/wee-util.c b/src/core/wee-util.c
index da3906825..d5e517fd9 100644
--- a/src/core/wee-util.c
+++ b/src/core/wee-util.c
@@ -73,10 +73,10 @@ long
util_timeval_diff (struct timeval *tv1, struct timeval *tv2)
{
long diff_sec, diff_usec;
-
+
diff_sec = tv2->tv_sec - tv1->tv_sec;
diff_usec = tv2->tv_usec - tv1->tv_usec;
-
+
if (diff_usec < 0)
{
diff_usec += 1000000;
@@ -93,7 +93,7 @@ void
util_timeval_add (struct timeval *tv, long interval)
{
long usec;
-
+
tv->tv_sec += (interval / 1000);
usec = tv->tv_usec + ((interval % 1000) * 1000);
if (usec > 1000000)
@@ -115,11 +115,11 @@ util_get_time_string (const time_t *date)
{
struct tm *local_time;
static char text_time[128];
-
+
local_time = localtime (date);
strftime (text_time, sizeof (text_time),
CONFIG_STRING(config_look_time_format), local_time);
-
+
return text_time;
}
@@ -131,7 +131,7 @@ void
util_catch_signal (int signum, void (*handler)(int))
{
struct sigaction act;
-
+
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = handler;
@@ -148,18 +148,18 @@ util_mkdir_home (const char *directory, int mode)
{
char *dir_name;
int dir_length;
-
+
if (!directory)
return 0;
-
+
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (directory) + 2;
dir_name = malloc (dir_length);
if (!dir_name)
return 0;
-
+
snprintf (dir_name, dir_length, "%s/%s", weechat_home, directory);
-
+
if (mkdir (dir_name, mode) < 0)
{
if (errno != EEXIST)
@@ -168,7 +168,7 @@ util_mkdir_home (const char *directory, int mode)
return 0;
}
}
-
+
free (dir_name);
return 1;
}
@@ -183,13 +183,13 @@ util_mkdir (const char *directory, int mode)
{
if (!directory)
return 0;
-
+
if (mkdir (directory, mode) < 0)
{
if (errno != EEXIST)
return 0;
}
-
+
return 1;
}
@@ -204,26 +204,26 @@ util_mkdir_parents (const char *directory, int mode)
char *string, *ptr_string, *pos_sep;
struct stat buf;
int rc;
-
+
if (!directory)
return 0;
-
+
string = strdup (directory);
if (!string)
return 0;
-
+
ptr_string = string;
while (ptr_string[0] == DIR_SEPARATOR_CHAR)
{
ptr_string++;
}
-
+
while (ptr_string && ptr_string[0])
{
pos_sep = strchr (ptr_string, DIR_SEPARATOR_CHAR);
if (pos_sep)
pos_sep[0] = '\0';
-
+
rc = stat (string, &buf);
if ((rc < 0) || !S_ISDIR(buf.st_mode))
{
@@ -234,7 +234,7 @@ util_mkdir_parents (const char *directory, int mode)
return 0;
}
}
-
+
if (pos_sep)
{
pos_sep[0] = DIR_SEPARATOR_CHAR;
@@ -243,9 +243,9 @@ util_mkdir_parents (const char *directory, int mode)
else
ptr_string = NULL;
}
-
+
free (string);
-
+
return 1;
}
@@ -262,10 +262,10 @@ util_exec_on_files (const char *directory, int hidden_files, void *data,
DIR *dir;
struct dirent *entry;
struct stat statbuf;
-
+
if (!directory || !callback)
return;
-
+
dir = opendir (directory);
if (dir)
{
@@ -302,11 +302,11 @@ util_search_full_lib_name (const char *filename, const char *sys_directory)
char *name_with_ext, *final_name;
int length;
struct stat st;
-
+
/* filename is already a full path */
if (strchr (filename, '/') || strchr (filename, '\\'))
return strdup (filename);
-
+
length = strlen (filename) + 16;
if (CONFIG_STRING(config_plugin_extension)
&& CONFIG_STRING(config_plugin_extension)[0])
@@ -319,7 +319,7 @@ util_search_full_lib_name (const char *filename, const char *sys_directory)
&& CONFIG_STRING(config_plugin_extension)
&& CONFIG_STRING(config_plugin_extension)[0])
strcat (name_with_ext, CONFIG_STRING(config_plugin_extension));
-
+
/* try WeeChat user's dir */
length = strlen (weechat_home) + strlen (name_with_ext) +
strlen (sys_directory) + 16;
@@ -337,7 +337,7 @@ util_search_full_lib_name (const char *filename, const char *sys_directory)
return final_name;
}
free (final_name);
-
+
/* try WeeChat global lib dir */
length = strlen (WEECHAT_LIBDIR) + strlen (name_with_ext) +
strlen (sys_directory) + 16;
@@ -372,10 +372,10 @@ util_file_get_content (const char *filename)
char *buffer, *buffer2;
FILE *f;
size_t count, fp;
-
+
buffer = NULL;
fp = 0;
-
+
f = fopen (filename, "r");
if (f)
{
@@ -408,7 +408,7 @@ util_file_get_content (const char *filename)
buffer[fp] = '\0';
fclose (f);
}
-
+
return buffer;
}
@@ -430,7 +430,7 @@ util_version_number (const char *version)
char **items, buf[64], *ptr_item, *error;
int num_items, i, version_int[4], index_buf;
long number;
-
+
items = string_split (version, ".", 0, 4, &num_items);
for (i = 0; i < 4; i++)
{
@@ -468,7 +468,7 @@ util_version_number (const char *version)
}
if (items)
string_free_split (items);
-
+
return (version_int[0] << 24) | (version_int[1] << 16)
| (version_int[2] << 8) | version_int[3];
}
diff --git a/src/core/weechat.c b/src/core/weechat.c
index 66bcb3d17..735fc15f7 100644
--- a/src/core/weechat.c
+++ b/src/core/weechat.c
@@ -197,14 +197,14 @@ void
weechat_parse_args (int argc, char *argv[])
{
int i;
-
+
weechat_argv0 = strdup (argv[0]);
weechat_upgrading = 0;
weechat_home = NULL;
weechat_server_cmd_line = 0;
weechat_auto_load_plugins = 1;
weechat_plugin_no_dlclose = 0;
-
+
for (i = 1; i < argc; i++)
{
if ((strcmp (argv[i], "-c") == 0)
@@ -323,7 +323,7 @@ weechat_create_home_dirs ()
weechat_shutdown (EXIT_FAILURE, 0);
}
}
-
+
/* create home directory; error is fatal */
if (!util_mkdir (weechat_home, 0755))
{
@@ -383,7 +383,7 @@ weechat_shutdown (int return_code, int crash)
free (weechat_local_charset);
network_end ();
-
+
if (crash)
abort();
else
@@ -398,21 +398,21 @@ int
main (int argc, char *argv[])
{
weechat_init_vars (); /* initialize some variables */
-
+
setlocale (LC_ALL, ""); /* initialize gettext */
#ifdef ENABLE_NLS
bindtextdomain (PACKAGE, LOCALEDIR);
bind_textdomain_codeset (PACKAGE, "UTF-8");
textdomain (PACKAGE);
#endif
-
+
#ifdef HAVE_LANGINFO_CODESET
weechat_local_charset = strdup (nl_langinfo (CODESET));
#else
weechat_local_charset = strdup ("");
#endif
utf8_init ();
-
+
util_catch_signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
util_catch_signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
util_catch_signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal */
@@ -449,9 +449,9 @@ main (int argc, char *argv[])
gui_layout_window_apply (gui_layout_windows, -1); /* apply win layout */
if (weechat_upgrading)
upgrade_weechat_end (); /* remove .upgrade files + signal */
-
+
gui_main_loop (); /* WeeChat main loop */
-
+
gui_layout_save_on_exit (); /* save layout */
plugin_end (); /* end plugin interface(s) */
if (CONFIG_BOOLEAN(config_look_save_config_on_exit))
@@ -463,6 +463,6 @@ main (int argc, char *argv[])
unhook_all (); /* remove all hooks */
hdata_end (); /* end hdata */
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
-
+
return EXIT_SUCCESS; /* make C compiler happy */
}
diff --git a/src/core/weechat.h b/src/core/weechat.h
index 2d0644b33..269a362e6 100644
--- a/src/core/weechat.h
+++ b/src/core/weechat.h
@@ -75,7 +75,7 @@
"\n" \
"You should have received a copy of the GNU General Public License\n" \
"along with WeeChat. If not, see <http://www.gnu.org/licenses/>.\n\n"
-
+
/* directory separator, depending on OS */
#ifdef _WIN32
diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt
index 8362df107..2630201db 100644
--- a/src/gui/curses/CMakeLists.txt
+++ b/src/gui/curses/CMakeLists.txt
@@ -47,7 +47,7 @@ IF(NCURSES_FOUND)
ADD_DEFINITIONS(-DHAVE_NCURSES_H)
ENDIF(NCURSES_HEADERS)
ENDIF(NCURSESW_HEADERS)
-
+
LIST(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
ENDIF(NCURSES_FOUND)
diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c
index 31501e458..e975b9148 100644
--- a/src/gui/curses/gui-curses-bar-window.c
+++ b/src/gui/curses/gui-curses-bar-window.c
@@ -52,7 +52,7 @@ int
gui_bar_window_objects_init (struct t_gui_bar_window *bar_window)
{
struct t_gui_bar_window_curses_objects *new_objects;
-
+
new_objects = malloc (sizeof (*new_objects));
if (new_objects)
{
@@ -92,7 +92,7 @@ gui_bar_window_create_win (struct t_gui_bar_window *bar_window)
{
if (CONFIG_BOOLEAN(bar_window->bar->options[GUI_BAR_OPTION_HIDDEN]))
return;
-
+
if (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar)
{
delwin (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar);
@@ -103,12 +103,12 @@ gui_bar_window_create_win (struct t_gui_bar_window *bar_window)
delwin (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator);
GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator = NULL;
}
-
+
GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar = newwin (bar_window->height,
bar_window->width,
bar_window->y,
bar_window->x);
-
+
if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR]))
{
switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]))
@@ -161,7 +161,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
{
int x_with_hidden, size_on_screen, low_char, hidden;
char utf_char[16], *next_char, *output;
-
+
if (!string || !string[0])
return 1;
@@ -173,11 +173,11 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
}
-
+
x_with_hidden = *x;
hidden = 0;
-
+
while (string && string[0])
{
switch (string[0])
@@ -317,10 +317,10 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
next_char = utf8_next_char (string);
if (!next_char)
break;
-
+
memcpy (utf_char, string, next_char - string);
utf_char[next_char - string] = '\0';
-
+
if ((((unsigned char)utf_char[0]) < 32) && (!utf_char[1]))
{
low_char = 1;
@@ -333,7 +333,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (!gui_chat_utf_char_valid (utf_char))
snprintf (utf_char, sizeof (utf_char), " ");
}
-
+
size_on_screen = utf8_char_size_screen (utf_char);
if (size_on_screen > 0)
{
@@ -355,7 +355,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
(*y)++;
wmove (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, *y, *x);
}
-
+
output = string_iconv_from_internal (NULL, utf_char);
if (low_char)
wattron (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, A_REVERSE);
@@ -365,7 +365,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
wattroff (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, A_REVERSE);
if (output)
free (output);
-
+
*x += size_on_screen;
}
}
@@ -399,10 +399,10 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
int diff, max_length, optimal_number_of_lines;
int some_data_not_displayed, separator_horizontal, separator_vertical;
int index_item, index_subitem, index_line;
-
+
if (!gui_init_ok)
return;
-
+
if (!str_start_input[0])
{
snprintf (str_start_input, sizeof (str_start_input), "%c%c%c",
@@ -410,34 +410,34 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_START_INPUT_CHAR);
length_start_input = strlen (str_start_input);
-
+
snprintf (str_start_input_hidden, sizeof (str_start_input_hidden), "%c%c%c",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR);
length_start_input_hidden = strlen (str_start_input_hidden);
-
+
snprintf (str_cursor, sizeof (str_cursor), "%c%c%c",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_MOVE_CURSOR_CHAR);
}
-
+
/*
* these values will be overwritten later (by gui_bar_window_print_string)
* if cursor has to move somewhere in bar window
*/
bar_window->cursor_x = -1;
bar_window->cursor_y = -1;
-
+
/* remove coords */
gui_bar_window_coords_free (bar_window);
index_item = -1;
index_subitem = -1;
index_line = 0;
-
+
filling = gui_bar_get_filling (bar_window->bar);
-
+
content = gui_bar_window_content_get_with_filling (bar_window, window);
if (content)
{
@@ -452,7 +452,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
bar_window->scroll_x = 0;
}
}
-
+
items = string_split (content, "\n", 0, 0, &items_count);
if (items_count == 0)
{
@@ -473,14 +473,14 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
for (line = 0; line < items_count; line++)
{
length_on_screen = gui_chat_strlen_screen (items[line]);
-
+
pos_cursor = strstr (items[line], str_cursor);
if (pos_cursor && (gui_chat_strlen_screen (pos_cursor) == 0))
length_on_screen++;
-
+
if (length_on_screen > max_length)
max_length = length_on_screen;
-
+
if (length_on_screen % bar_window->width == 0)
num_lines = length_on_screen / bar_window->width;
else
@@ -491,7 +491,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
if (max_length == 0)
max_length = 1;
-
+
switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]))
{
case GUI_BAR_POSITION_BOTTOM:
@@ -512,7 +512,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
break;
}
}
-
+
gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
@@ -540,7 +540,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
chars_available =
((bar_window->height - y - 1) * bar_window->width) + /* next lines */
(bar_window->width - x - 1); /* chars on current line */
-
+
length_screen_before_cursor = -1;
length_screen_after_cursor = -1;
@@ -551,13 +551,13 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
length_screen_after_cursor = gui_chat_strlen_screen (pos_cursor);
free (buf);
}
-
+
if ((length_screen_before_cursor < 0) || (length_screen_after_cursor < 0))
{
length_screen_before_cursor = gui_chat_strlen_screen (items[line]);
length_screen_after_cursor = 0;
}
-
+
diff = length_screen_before_cursor - chars_available;
if (diff > 0)
{
@@ -567,12 +567,12 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
- 1
- (diff % CONFIG_INTEGER(config_look_input_cursor_scroll)));
}
-
+
/* compute new start for displaying input */
new_start_input = pos_after_start_input + gui_chat_string_real_pos (pos_after_start_input, diff);
if (new_start_input > pos_cursor)
new_start_input = pos_cursor;
-
+
buf = malloc (strlen (items[line]) + length_start_input_hidden + 1);
if (buf)
{
@@ -597,7 +597,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
/* add input (will be displayed) */
size = strlen (new_start_input) + 1;
memmove (buf + index, new_start_input, size);
-
+
free (items[line]);
items[line] = buf;
}
@@ -605,7 +605,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
}
-
+
if ((bar_window->scroll_y == 0)
|| (line >= bar_window->scroll_y))
{
@@ -618,7 +618,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
some_data_not_displayed = 1;
}
-
+
if (x < bar_window->width)
{
if (filling == GUI_BAR_FILLING_HORIZONTAL)
@@ -644,7 +644,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
&index_line);
}
}
-
+
x = 0;
y++;
}
@@ -706,7 +706,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_FG]),
CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG]));
}
-
+
/*
* move cursor if it was asked in an item content (input_text does that
* to move cursor in user input text)
@@ -729,7 +729,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
else
wnoutrefresh (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar);
-
+
if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR]))
{
separator_horizontal = ACS_HLINE;
@@ -779,7 +779,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
wnoutrefresh (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator);
}
-
+
refresh ();
}
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 008e92cb5..e910b6c0d 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -67,22 +67,22 @@ int
gui_chat_marker_for_line (struct t_gui_buffer *buffer, struct t_gui_line *line)
{
struct t_gui_line *last_read_line;
-
+
/* marker is disabled in config? */
if (CONFIG_INTEGER(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_LINE)
return 0;
-
+
/* marker is not set for buffer? */
if (!buffer->lines->last_read_line)
return 0;
-
+
last_read_line = buffer->lines->last_read_line;
if (!last_read_line->data->displayed)
last_read_line = gui_line_get_prev_displayed (last_read_line);
-
+
if (!last_read_line)
return 0;
-
+
while (line)
{
if (last_read_line == line)
@@ -91,10 +91,10 @@ gui_chat_marker_for_line (struct t_gui_buffer *buffer, struct t_gui_line *line)
return 1;
return (gui_line_get_next_displayed (line) != NULL) ? 1 : 0;
}
-
+
if (line->data->displayed)
break;
-
+
line = line->next_line;
}
return 0;
@@ -112,7 +112,7 @@ gui_chat_reset_style (struct t_gui_window *window, struct t_gui_line *line,
int color_default)
{
int color;
-
+
color = color_default;
if ((window != gui_current_window) &&
CONFIG_BOOLEAN(config_look_color_inactive_window))
@@ -124,7 +124,7 @@ gui_chat_reset_style (struct t_gui_window *window, struct t_gui_line *line,
{
color = color_inactive_buffer;
}
-
+
if (reset_attributes)
gui_window_reset_style (GUI_WINDOW_OBJECTS(window)->win_chat, color);
else
@@ -166,7 +166,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
{
int x, size_on_screen;
char *read_marker_string, *default_string = "- ";
-
+
if (!simulate)
{
gui_window_coords_init_line (window, window->win_chat_cursor_y);
@@ -218,7 +218,7 @@ gui_chat_string_next_char (struct t_gui_window *window, struct t_gui_line *line,
apply_style = 0;
}
}
-
+
while (string[0])
{
switch (string[0])
@@ -320,7 +320,7 @@ gui_chat_string_next_char (struct t_gui_window *window, struct t_gui_line *line,
break;
}
}
-
+
/* nothing found except color/attrib codes, so return NULL */
return NULL;
}
@@ -339,17 +339,17 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
{
char *next_char, *output, utf_char[16];
int x, chars_displayed, display_char, size_on_screen;
-
+
if (display)
{
wmove (GUI_WINDOW_OBJECTS(window)->win_chat,
window->win_chat_cursor_y,
window->win_chat_cursor_x);
}
-
+
chars_displayed = 0;
x = window->win_chat_cursor_x;
-
+
while (string && string[0])
{
string = gui_chat_string_next_char (window, line,
@@ -357,7 +357,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
apply_style_inactive);
if (!string)
return chars_displayed;
-
+
next_char = utf8_next_char (string);
if (display && next_char)
{
@@ -365,10 +365,10 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
utf_char[next_char - string] = '\0';
if (!gui_chat_utf_char_valid (utf_char))
snprintf (utf_char, sizeof (utf_char), " ");
-
+
display_char = (window->buffer->type != GUI_BUFFER_TYPE_FREE)
|| (x >= window->scroll->start_col);
-
+
size_on_screen = utf8_strlen_screen (utf_char);
if ((max_chars_on_screen > 0)
&& (chars_displayed + size_on_screen > max_chars_on_screen))
@@ -386,10 +386,10 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
}
x += size_on_screen;
}
-
+
string = next_char;
}
-
+
return chars_displayed;
}
@@ -412,25 +412,25 @@ gui_chat_display_word (struct t_gui_window *window,
attr_t *ptr_attrs;
short pair;
short *ptr_pair;
-
+
if (!word ||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
return;
-
+
if (!simulate && (window->win_chat_cursor_y < window->coords_size))
window->coords[window->win_chat_cursor_y].line = line;
-
+
data = strdup (word);
if (!data)
return;
-
+
end_line = data + strlen (data);
-
+
if (word_end && word_end[0])
data[word_end - word] = '\0';
else
word_end = NULL;
-
+
ptr_data = data;
while (ptr_data && ptr_data[0])
{
@@ -483,7 +483,7 @@ gui_chat_display_word (struct t_gui_window *window,
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].data = (char *)word + (ptr_data - data);
}
-
+
chars_to_display = gui_chat_strlen_screen (ptr_data);
/* too long for current line */
@@ -527,9 +527,9 @@ gui_chat_display_word (struct t_gui_window *window,
}
ptr_data += strlen (ptr_data);
}
-
+
window->win_chat_cursor_x += num_displayed;
-
+
/* display new line? */
if ((!prefix && (ptr_data >= end_line)) ||
(((simulate) ||
@@ -537,12 +537,12 @@ gui_chat_display_word (struct t_gui_window *window,
(window->win_chat_cursor_x > (gui_chat_get_real_width (window) - 1))))
gui_chat_display_new_line (window, num_lines, count,
lines_displayed, simulate);
-
+
if ((!prefix && (ptr_data >= end_line)) ||
((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height)))
ptr_data = NULL;
}
-
+
free (data);
}
@@ -563,7 +563,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
const char *short_name;
int i, length, length_allowed, num_spaces;
struct t_gui_lines *mixed_lines;
-
+
if (!simulate)
{
if (window->win_chat_cursor_y < window->coords_size)
@@ -573,7 +573,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT);
}
-
+
/* display time */
if (window->buffer->time_for_each_line
&& (line->data->str_time && line->data->str_time[0]))
@@ -586,7 +586,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
CONFIG_BOOLEAN(config_look_color_inactive_time));
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].time_x2 = window->win_chat_cursor_x - 1;
-
+
if (!simulate)
{
gui_chat_reset_style (window, line, 1,
@@ -599,7 +599,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
simulate,
CONFIG_BOOLEAN(config_look_color_inactive_time));
}
-
+
/* display buffer name (if many buffers are merged) */
mixed_lines = line->data->buffer->mixed_lines;
if (mixed_lines)
@@ -617,7 +617,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
short_name = gui_buffer_get_short_name (line->data->buffer);
length = gui_chat_strlen_screen (short_name);
num_spaces = length_allowed - length;
-
+
if (CONFIG_INTEGER(config_look_prefix_buffer_align) == CONFIG_LOOK_PREFIX_BUFFER_ALIGN_RIGHT)
{
if (!simulate)
@@ -635,7 +635,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
CONFIG_BOOLEAN(config_look_color_inactive_prefix_buffer));
}
}
-
+
if (!simulate)
{
gui_chat_reset_style (window, line, 1,
@@ -647,10 +647,10 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
GUI_COLOR_CHAT_PREFIX_BUFFER,
GUI_COLOR_CHAT_PREFIX_BUFFER);
}
-
+
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].buffer_x1 = window->win_chat_cursor_x;
-
+
/* not enough space to display full buffer name? => truncate it! */
if ((CONFIG_INTEGER(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE)
&& (num_spaces < 0))
@@ -671,10 +671,10 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
lines_displayed, simulate,
CONFIG_BOOLEAN(config_look_color_inactive_prefix_buffer));
}
-
+
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].buffer_x2 = window->win_chat_cursor_x - 1;
-
+
if ((CONFIG_INTEGER(config_look_prefix_buffer_align) != CONFIG_LOOK_PREFIX_BUFFER_ALIGN_NONE)
&& (num_spaces < 0))
{
@@ -720,7 +720,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
}
}
}
-
+
/* display prefix */
if (line->data->prefix
&& (line->data->prefix[0]
@@ -733,7 +733,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT);
}
-
+
if (CONFIG_INTEGER(config_look_prefix_align_max) > 0)
{
length_allowed =
@@ -742,9 +742,9 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
}
else
length_allowed = window->buffer->lines->prefix_max_length;
-
+
num_spaces = length_allowed - line->data->prefix_length;
-
+
if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_RIGHT)
{
for (i = 0; i < num_spaces; i++)
@@ -755,7 +755,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
CONFIG_BOOLEAN(config_look_color_inactive_prefix));
}
}
-
+
prefix_highlighted = NULL;
if (line->data->highlight)
{
@@ -798,10 +798,10 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
GUI_COLOR_CHAT);
}
}
-
+
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].prefix_x1 = window->win_chat_cursor_x;
-
+
/* not enough space to display full prefix? => truncate it! */
if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
&& (num_spaces < 0))
@@ -825,13 +825,13 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
simulate,
CONFIG_BOOLEAN(config_look_color_inactive_prefix));
}
-
+
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].prefix_x2 = window->win_chat_cursor_x - 1;
-
+
if (prefix_highlighted)
free (prefix_highlighted);
-
+
if (!simulate)
{
gui_chat_reset_style (window, line, 1,
@@ -839,7 +839,7 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT);
}
-
+
if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_LEFT)
{
for (i = 0; i < num_spaces; i++)
@@ -916,10 +916,10 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
int word_length_with_spaces, word_length;
char *ptr_data, *ptr_end_offset, *next_char;
char *ptr_style, *message_with_tags;
-
+
if (!line)
return 0;
-
+
if (simulate)
{
x = window->win_chat_cursor_x;
@@ -938,18 +938,18 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
window->win_chat_cursor_x = x;
window->win_chat_cursor_y = y;
}
-
+
/* calculate marker position (maybe not used for this line!) */
if (window->buffer->time_for_each_line && line->data->str_time)
read_marker_x = x + gui_chat_strlen_screen (line->data->str_time);
else
read_marker_x = x;
read_marker_y = y;
-
+
lines_displayed = 0;
-
+
marker_line = gui_chat_marker_for_line (window->buffer, line);
-
+
/* display time and prefix */
gui_chat_display_time_to_prefix (window, line, num_lines, count,
&lines_displayed, simulate);
@@ -959,7 +959,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
window->coords[window->win_chat_cursor_y].data = line->data->message;
window->coords_x_message = window->win_chat_cursor_x;
}
-
+
/* reset color & style for a new line */
if (!simulate)
{
@@ -978,7 +978,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
GUI_COLOR_CHAT);
}
}
-
+
if (!line->data->message || !line->data->message[0])
{
gui_chat_display_new_line (window, num_lines, count,
@@ -997,9 +997,9 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
&word_start_offset,
&word_end_offset,
&word_length_with_spaces, &word_length);
-
+
ptr_end_offset = ptr_data + word_end_offset;
-
+
if (word_length > 0)
{
/* spaces + word too long for current line but ok for next line */
@@ -1029,14 +1029,14 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
/* jump to start of word */
ptr_data += word_start_offset;
}
-
+
/* display word */
gui_chat_display_word (window, line, ptr_data,
ptr_end_offset + 1,
0, num_lines, count, &lines_displayed,
simulate,
CONFIG_BOOLEAN(config_look_color_inactive_message));
-
+
if ((!simulate) && (window->win_chat_cursor_y >= window->win_chat_height))
ptr_data = NULL;
else
@@ -1045,7 +1045,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
ptr_data = ptr_end_offset + 1;
if (*(ptr_data - 1) == '\0')
ptr_data = NULL;
-
+
if (window->win_chat_cursor_x == 0)
{
while (ptr_data && (ptr_data[0] == ' '))
@@ -1071,14 +1071,14 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (message_with_tags)
free (message_with_tags);
}
-
+
if (marker_line)
{
gui_chat_display_horizontal_line (window, simulate);
gui_chat_display_new_line (window, num_lines, count,
&lines_displayed, simulate);
}
-
+
if (simulate)
{
window->win_chat_cursor_x = x;
@@ -1114,7 +1114,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
}
}
}
-
+
return lines_displayed;
}
@@ -1132,15 +1132,15 @@ gui_chat_display_line_y (struct t_gui_window *window, struct t_gui_line *line,
GUI_COLOR_CHAT_INACTIVE_WINDOW,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT);
-
+
window->win_chat_cursor_x = 0;
window->win_chat_cursor_y = y;
-
+
wmove (GUI_WINDOW_OBJECTS(window)->win_chat,
window->win_chat_cursor_y,
window->win_chat_cursor_x);
wclrtoeol (GUI_WINDOW_OBJECTS(window)->win_chat);
-
+
if (gui_chat_display_word_raw (window, line, line->data->message,
window->win_chat_width, 1,
CONFIG_BOOLEAN(config_look_color_inactive_message)) < window->win_chat_width)
@@ -1160,12 +1160,12 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
int difference)
{
int backward, current_size;
-
+
if (!line || !line_pos)
return;
-
+
backward = (difference < 0);
-
+
if (!(*line))
{
/* if looking backward, start at last line of buffer */
@@ -1191,7 +1191,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
}
else
current_size = gui_chat_display_line (window, *line, 0, 1);
-
+
while ((*line) && (difference != 0))
{
/* looking backward */
@@ -1231,7 +1231,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
difference--;
}
}
-
+
/* first or last line reached */
if (!(*line))
{
@@ -1261,21 +1261,21 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
char format_empty[32];
int i, line_pos, count, old_scrolling, old_lines_after;
int y_start, y_end, y;
-
+
if (!gui_ok)
return;
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->buffer->number == buffer->number)
{
gui_window_coords_alloc (ptr_win);
-
+
gui_chat_reset_style (ptr_win, NULL, 1,
GUI_COLOR_CHAT_INACTIVE_WINDOW,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT);
-
+
if (erase)
{
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_chat_width);
@@ -1285,10 +1285,10 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
format_empty, " ");
}
}
-
+
ptr_win->win_chat_cursor_x = 0;
ptr_win->win_chat_cursor_y = 0;
-
+
switch (ptr_win->buffer->type)
{
case GUI_BUFFER_TYPE_FORMATTED:
@@ -1306,9 +1306,9 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
gui_chat_calculate_line_diff (ptr_win, &ptr_line, &line_pos,
(-1) * (ptr_win->win_chat_height - 1));
}
-
+
count = 0;
-
+
if (line_pos > 0)
{
/* display end of first line at top of screen */
@@ -1323,19 +1323,19 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
else
ptr_win->scroll->first_line_displayed =
(ptr_line == gui_line_get_first_displayed (ptr_win->buffer));
-
+
/* display lines */
while (ptr_line && (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1))
{
count = gui_chat_display_line (ptr_win, ptr_line, 0, 0);
ptr_line = gui_line_get_next_displayed (ptr_line);
}
-
+
old_scrolling = ptr_win->scroll->scrolling;
old_lines_after = ptr_win->scroll->lines_after;
-
+
ptr_win->scroll->scrolling = (ptr_win->win_chat_cursor_y > ptr_win->win_chat_height - 1);
-
+
/* check if last line of buffer is entirely displayed and scrolling */
/* if so, disable scroll indicator */
if (!ptr_line && ptr_win->scroll->scrolling)
@@ -1344,14 +1344,14 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
|| (count == ptr_win->win_chat_height))
ptr_win->scroll->scrolling = 0;
}
-
+
if (!ptr_win->scroll->scrolling
&& (ptr_win->scroll->start_line == gui_line_get_first_displayed (ptr_win->buffer)))
{
ptr_win->scroll->start_line = NULL;
ptr_win->scroll->start_line_pos = 0;
}
-
+
ptr_win->scroll->lines_after = 0;
if (ptr_win->scroll->scrolling && ptr_line)
{
@@ -1364,30 +1364,30 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
}
ptr_win->scroll->lines_after++;
}
-
+
if ((ptr_win->scroll->scrolling != old_scrolling)
|| (ptr_win->scroll->lines_after != old_lines_after))
{
hook_signal_send ("window_scrolled",
WEECHAT_HOOK_SIGNAL_POINTER, ptr_win);
}
-
+
if (!ptr_win->scroll->scrolling
&& ptr_win->scroll->reset_allowed)
{
ptr_win->scroll->start_line = NULL;
ptr_win->scroll->start_line_pos = 0;
}
-
+
/* cursor is below end line of chat window? */
if (ptr_win->win_chat_cursor_y > ptr_win->win_chat_height - 1)
{
ptr_win->win_chat_cursor_x = 0;
ptr_win->win_chat_cursor_y = ptr_win->win_chat_height - 1;
}
-
+
ptr_win->scroll->reset_allowed = 0;
-
+
break;
case GUI_BUFFER_TYPE_FREE:
/* display at position of scrolling */
@@ -1425,9 +1425,9 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
wnoutrefresh (GUI_WINDOW_OBJECTS(ptr_win)->win_chat);
}
}
-
+
refresh ();
-
+
if (buffer->type == GUI_BUFFER_TYPE_FREE)
{
for (ptr_line = buffer->lines->first_line; ptr_line;
@@ -1436,7 +1436,7 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
ptr_line->data->refresh_needed = 0;
}
}
-
+
buffer->chat_refresh_needed = 0;
}
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 7ec534591..69533a6cc 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -144,7 +144,7 @@ gui_color_assign (int *color, const char *color_name)
{
int flag, extra_attr, color_index, number;
char *error;
-
+
/* read extended attributes */
extra_attr = 0;
while ((flag = gui_color_attr_get_flag (color_name[0])) > 0)
@@ -152,7 +152,7 @@ gui_color_assign (int *color, const char *color_name)
extra_attr |= flag;
color_name++;
}
-
+
/* is it a color alias? */
number = gui_color_palette_get_alias (color_name);
if (number >= 0)
@@ -160,7 +160,7 @@ gui_color_assign (int *color, const char *color_name)
*color = number | GUI_COLOR_EXTENDED_FLAG | extra_attr;
return 1;
}
-
+
/* is it a color number? */
error = NULL;
number = (int)strtol (color_name, &error, 10);
@@ -182,7 +182,7 @@ gui_color_assign (int *color, const char *color_name)
return 1;
}
}
-
+
/* color not found */
return 0;
}
@@ -202,15 +202,15 @@ gui_color_assign_by_diff (int *color, const char *color_name, int diff)
int index, list_size;
struct t_weelist_item *ptr_item;
const char *name;
-
+
index = weelist_search_pos (gui_color_list_with_alias, color_name);
if (index < 0)
index = 0;
-
+
list_size = weelist_size (gui_color_list_with_alias);
-
+
diff = diff % (list_size + 1);
-
+
if (diff > 0)
{
index = (index + diff) % (list_size + 1);
@@ -227,14 +227,14 @@ gui_color_assign_by_diff (int *color, const char *color_name, int diff)
index += list_size;
}
}
-
+
ptr_item = weelist_get (gui_color_list_with_alias, index);
if (!ptr_item)
return 0;
name = weelist_string (ptr_item);
if (name)
return gui_color_assign (color, name);
-
+
return 0;
}
@@ -269,26 +269,26 @@ void
gui_color_get_pairs_arrays (short **foregrounds, short **backgrounds)
{
int i, fg, bg, index;
-
+
if (!foregrounds || !backgrounds)
return;
-
+
*foregrounds = NULL;
*backgrounds = NULL;
-
+
*foregrounds = malloc (sizeof (*foregrounds[0]) * (gui_color_num_pairs + 1));
if (!*foregrounds)
goto error;
*backgrounds = malloc (sizeof (*backgrounds[0]) * (gui_color_num_pairs + 1));
if (!*backgrounds)
goto error;
-
+
for (i = 0; i <= gui_color_num_pairs; i++)
{
(*foregrounds)[i] = -2;
(*backgrounds)[i] = -2;
}
-
+
for (bg = -1; bg <= gui_color_term_colors; bg++)
{
for (fg = -1; fg <= gui_color_term_colors; fg++)
@@ -302,7 +302,7 @@ gui_color_get_pairs_arrays (short **foregrounds, short **backgrounds)
}
}
}
-
+
return;
error:
@@ -329,12 +329,12 @@ gui_color_timer_warning_pairs_full (void *data, int remaining_calls)
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
gui_chat_printf (NULL,
_("Warning: the %d color pairs are used, do "
"\"/color reset\" to remove unused pairs"),
gui_color_num_pairs);
-
+
return WEECHAT_RC_OK;
}
@@ -348,20 +348,20 @@ int
gui_color_get_pair (int fg, int bg)
{
int index;
-
+
/* only one color when displaying terminal colors */
if (gui_color_use_term_colors)
return COLOR_WHITE;
-
+
/* if invalid color, use default fg/bg */
if (fg > gui_color_term_colors)
fg = -1;
if (bg > gui_color_term_colors)
bg = -1;
-
+
/* compute index for gui_color_pairs with foreground and background */
index = ((bg + 1) * (gui_color_term_colors + 2)) + (fg + 1);
-
+
/* pair not allocated for this fg/bg? */
if (gui_color_pairs[index] == 0)
{
@@ -378,7 +378,7 @@ gui_color_get_pair (int fg, int bg)
}
return 1;
}
-
+
/* create a new pair if no pair exists for this fg/bg */
gui_color_pairs_used++;
gui_color_pairs[index] = gui_color_pairs_used;
@@ -391,7 +391,7 @@ gui_color_get_pair (int fg, int bg)
}
gui_color_buffer_refresh_needed = 1;
}
-
+
return gui_color_pairs[index];
}
@@ -403,7 +403,7 @@ int
gui_color_weechat_get_pair (int weechat_color)
{
int fg, bg;
-
+
if ((weechat_color < 0) || (weechat_color > GUI_COLOR_NUM_COLORS - 1))
{
fg = -1;
@@ -413,13 +413,13 @@ gui_color_weechat_get_pair (int weechat_color)
{
fg = gui_color[weechat_color]->foreground;
bg = gui_color[weechat_color]->background;
-
+
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
}
-
+
return gui_color_get_pair (fg, bg);
}
@@ -434,14 +434,14 @@ gui_color_get_name (int num_color)
static int index_color = 0;
char str_attr[8];
struct t_gui_color_palette *ptr_color_palette;
-
+
/* init color string */
index_color = (index_color + 1) % 16;
color[index_color][0] = '\0';
-
+
/* build string with extra-attributes */
gui_color_attr_build_string (num_color, str_attr);
-
+
if (num_color & GUI_COLOR_EXTENDED_FLAG)
{
/* search alias */
@@ -466,7 +466,7 @@ gui_color_get_name (int num_color)
str_attr,
gui_weechat_colors[num_color & GUI_COLOR_EXTENDED_MASK].string);
}
-
+
return color[index_color];
}
@@ -484,7 +484,7 @@ gui_color_build (int number, int foreground, int background)
foreground = 0;
if (background < 0)
background = 0;
-
+
/* allocate color */
if (!gui_color[number])
{
@@ -493,7 +493,7 @@ gui_color_build (int number, int foreground, int background)
return;
gui_color[number]->string = malloc (4);
}
-
+
/* set foreground and attributes */
if (foreground & GUI_COLOR_EXTENDED_FLAG)
{
@@ -511,13 +511,13 @@ gui_color_build (int number, int foreground, int background)
gui_color[number]->attributes |= A_REVERSE;
if (foreground & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
gui_color[number]->attributes |= A_UNDERLINE;
-
+
/* set background */
if (background & GUI_COLOR_EXTENDED_FLAG)
gui_color[number]->background = background & GUI_COLOR_EXTENDED_MASK;
else
gui_color[number]->background = gui_weechat_colors[background & GUI_COLOR_EXTENDED_MASK].background;
-
+
/* set string */
if (gui_color[number]->string)
{
@@ -535,7 +535,7 @@ void
gui_color_init_vars ()
{
int size;
-
+
gui_color_term_has_colors = (has_colors ()) ? 1 : 0;
gui_color_term_colors = 0;
gui_color_term_color_pairs = 0;
@@ -547,13 +547,13 @@ gui_color_init_vars ()
gui_color_pairs = NULL;
}
gui_color_pairs_used = 0;
-
+
if (gui_color_term_has_colors)
{
gui_color_term_colors = COLORS;
gui_color_term_color_pairs = COLOR_PAIRS;
gui_color_term_can_change_color = (can_change_color ()) ? 1 : 0;
-
+
gui_color_num_pairs = (gui_color_term_color_pairs >= 256) ?
255 : gui_color_term_color_pairs - 1;
size = (gui_color_term_colors + 2)
@@ -563,7 +563,7 @@ gui_color_init_vars ()
if (gui_color_pairs)
memset (gui_color_pairs, 0, size);
gui_color_pairs_used = 0;
-
+
/* reserved for future usage */
/*
gui_color_term_color_content = malloc (sizeof (gui_color_term_color_content[0]) *
@@ -621,7 +621,7 @@ void
gui_color_init_pairs_terminal ()
{
int i;
-
+
if (gui_color_term_has_colors)
{
for (i = 1; i <= gui_color_num_pairs; i++)
@@ -644,7 +644,7 @@ gui_color_init_pairs_weechat ()
{
int i;
short *foregrounds, *backgrounds;
-
+
if (gui_color_term_has_colors)
{
gui_color_get_pairs_arrays (&foregrounds, &backgrounds);
@@ -676,7 +676,7 @@ gui_color_display_terminal_colors ()
{
int lines, line, col, color;
char str_line[1024], str_color[64];
-
+
initscr ();
if (has_colors ())
{
@@ -754,12 +754,12 @@ gui_color_buffer_display ()
int y, i, lines, line, col, color, max_color, num_items;
char str_line[1024], str_color[64], str_rgb[64], **items;
struct t_gui_color_palette *color_palette;
-
+
if (!gui_color_buffer)
return;
-
+
gui_buffer_clear (gui_color_buffer);
-
+
/* set title buffer */
gui_buffer_set_title (gui_color_buffer,
_("WeeChat colors | Actions: "
@@ -767,7 +767,7 @@ gui_color_buffer_display ()
"[z] Reset colors [q] Close buffer | "
"Keys: [alt-c] Temporarily switch to terminal "
"colors"));
-
+
/* display terminal/colors infos */
y = 0;
gui_chat_printf_y (gui_color_buffer, y++,
@@ -777,7 +777,7 @@ gui_color_buffer_display ()
gui_color_term_colors,
gui_color_term_color_pairs,
(gui_color_term_can_change_color) ? "yes" : "no");
-
+
/* display palette of colors */
y++;
if (gui_color_use_term_colors)
@@ -851,7 +851,7 @@ gui_color_buffer_display ()
_("Last auto reset of pairs: %s"),
(gui_color_pairs_auto_reset_last == 0) ?
"-" : ctime (&gui_color_pairs_auto_reset_last));
-
+
/* display WeeChat basic colors */
y++;
gui_chat_printf_y (gui_color_buffer, y++,
@@ -887,7 +887,7 @@ gui_color_buffer_display ()
gui_chat_printf_y (gui_color_buffer, y++,
" %s", str_line);
}
-
+
/* display nick colors */
y++;
gui_chat_printf_y (gui_color_buffer, y++,
@@ -927,7 +927,7 @@ gui_color_buffer_display ()
}
string_free_split (items);
}
-
+
/* display palette colors */
if (hashtable_get_integer (gui_color_hash_palette_color,
"items_count") > 0)
@@ -969,7 +969,7 @@ gui_color_buffer_display ()
}
}
}
-
+
/* display content of colors */
if (gui_color_term_color_content)
{
@@ -999,9 +999,9 @@ gui_color_timer_cb (void *data, int remaining_calls)
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
gui_color_timer--;
-
+
if (gui_color_timer <= 0)
{
if (gui_color_use_term_colors)
@@ -1014,7 +1014,7 @@ gui_color_timer_cb (void *data, int remaining_calls)
gui_color_buffer_display_timer ();
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1030,7 +1030,7 @@ gui_color_switch_colors ()
unhook (gui_color_hook_timer);
gui_color_hook_timer = NULL;
}
-
+
/*
* when we press alt-c many times quickly, this just adds some time for
* display of terminal colors
@@ -1045,19 +1045,19 @@ gui_color_switch_colors ()
else
{
gui_color_use_term_colors ^= 1;
-
+
if (gui_color_use_term_colors)
gui_color_init_pairs_terminal ();
else
gui_color_init_pairs_weechat ();
-
+
gui_color_buffer_refresh_needed = 1;
gui_window_ask_refresh (1);
if (gui_color_use_term_colors)
gui_color_timer = GUI_COLOR_TIMER_TERM_COLORS;
}
-
+
if (gui_color_use_term_colors)
{
gui_color_hook_timer = hook_timer (NULL, 1000, 0, 0,
@@ -1116,7 +1116,7 @@ gui_color_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
{
gui_color_reset_pairs ();
}
-
+
return WEECHAT_RC_OK;
}
@@ -1130,9 +1130,9 @@ gui_color_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
gui_color_buffer = NULL;
-
+
return WEECHAT_RC_OK;
}
@@ -1175,12 +1175,12 @@ gui_color_buffer_open ()
gui_buffer_set (gui_color_buffer, "key_bind_meta-c", "/color switch");
}
}
-
+
if (!gui_color_buffer)
return;
-
+
gui_window_switch_to_buffer (gui_current_window, gui_color_buffer, 1);
-
+
gui_color_buffer_display ();
}
@@ -1196,13 +1196,13 @@ gui_color_palette_add_alias_cb (void *data,
struct t_gui_color_palette *color_palette;
char *error;
int number;
-
+
/* make C compiler happy */
(void) data;
(void) hashtable;
-
+
color_palette = (struct t_gui_color_palette *)value;
-
+
if (color_palette && color_palette->alias)
{
error = NULL;
@@ -1226,13 +1226,13 @@ gui_color_palette_build_aliases ()
int i;
struct t_gui_color_palette *color_palette;
char str_number[64];
-
+
if (!gui_color_hash_palette_alias || !gui_color_list_with_alias
|| !gui_color_hash_palette_color)
{
gui_color_palette_alloc_structs ();
}
-
+
hashtable_remove_all (gui_color_hash_palette_alias);
weelist_remove_all (gui_color_list_with_alias);
for (i = 0; i < GUI_CURSES_NUM_WEECHAT_COLORS; i++)
@@ -1277,10 +1277,10 @@ gui_color_palette_new (int number, const char *value)
char **items, *pos, *pos2, *error1, *error2, *error3;
char *str_alias, *str_rgb, str_number[64];
int num_items, i, r, g, b;
-
+
if (!value)
return NULL;
-
+
new_color_palette = malloc (sizeof (*new_color_palette));
if (new_color_palette)
{
@@ -1288,10 +1288,10 @@ gui_color_palette_new (int number, const char *value)
new_color_palette->r = -1;
new_color_palette->g = -1;
new_color_palette->b = -1;
-
+
str_alias = NULL;
str_rgb = NULL;
-
+
items = string_split (value, ";", 0, 0, &num_items);
if (items)
{
@@ -1307,12 +1307,12 @@ gui_color_palette_new (int number, const char *value)
str_alias = items[i];
}
}
-
+
if (str_alias)
{
new_color_palette->alias = strdup (str_alias);
}
-
+
if (str_rgb)
{
pos = strchr (str_rgb, '/');
@@ -1350,7 +1350,7 @@ gui_color_palette_new (int number, const char *value)
new_color_palette->alias = strdup (str_number);
}
}
-
+
return new_color_palette;
}
@@ -1363,10 +1363,10 @@ gui_color_palette_free (struct t_gui_color_palette *color_palette)
{
if (!color_palette)
return;
-
+
if (color_palette->alias)
free (color_palette->alias);
-
+
free (color_palette);
}
@@ -1386,9 +1386,9 @@ gui_color_init_weechat ()
{
gui_weechat_colors = gui_weechat_colors_no_bold;
}
-
+
gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_chat_bg));
-
+
gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT_TIME, CONFIG_COLOR(config_color_chat_time), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT_TIME_DELIMITERS, CONFIG_COLOR(config_color_chat_time_delimiters), CONFIG_COLOR(config_color_chat_bg));
@@ -1416,7 +1416,7 @@ gui_color_init_weechat ()
gui_color_build (GUI_COLOR_CHAT_INACTIVE_WINDOW, CONFIG_COLOR(config_color_chat_inactive_window), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT_INACTIVE_BUFFER, CONFIG_COLOR(config_color_chat_inactive_buffer), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT_PREFIX_BUFFER_INACTIVE_BUFFER, CONFIG_COLOR(config_color_chat_prefix_buffer_inactive_buffer), CONFIG_COLOR(config_color_chat_bg));
-
+
/*
* define old nick colors for compatibility on /upgrade with previous
* versions: these colors have been removed in version 0.3.4 and replaced
@@ -1443,7 +1443,7 @@ void
gui_color_pre_init ()
{
int i;
-
+
for (i = 0; i < GUI_COLOR_NUM_COLORS; i++)
{
gui_color[i] = NULL;
@@ -1476,7 +1476,7 @@ void
gui_color_dump ()
{
int fg, bg, index, used;
-
+
gui_chat_printf (NULL, "");
gui_chat_printf (NULL,
_("WeeChat colors (in use: %d, left: %d):"),
@@ -1510,7 +1510,7 @@ void
gui_color_end ()
{
int i;
-
+
for (i = 0; i < GUI_COLOR_NUM_COLORS; i++)
{
gui_color_free (gui_color[i]);
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index a303b4f77..43df4f42d 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -59,14 +59,14 @@ gui_key_default_bind (int context, const char *key, const char *command)
{
struct t_gui_key *ptr_key;
char *internal_code;
-
+
internal_code = gui_key_get_internal_code (key);
-
+
ptr_key = gui_key_search (gui_keys[context],
(internal_code) ? internal_code : key);
if (!ptr_key)
gui_key_new (NULL, context, key, command);
-
+
if (internal_code)
free (internal_code);
}
@@ -205,7 +205,7 @@ gui_key_default_bindings (int context)
BIND(/* m-< */ "meta-<", "/input jump_previously_visited_buffer");
BIND(/* m-> */ "meta->", "/input jump_next_visited_buffer");
BIND(/* m-m */ "meta-m", "/mouse toggle");
-
+
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
{
@@ -292,7 +292,7 @@ gui_key_flush ()
static int length_key_str = 0;
char key_temp[2], *key_utf, *input_old, *ptr_char, *next_char, *ptr_error;
char utf_partial_char[16];
-
+
/*
* if there's no paste pending, then we use buffer and do actions
* according to keys
@@ -301,13 +301,13 @@ gui_key_flush ()
{
if (gui_key_buffer_size > 0)
gui_key_last_activity_time = time (NULL);
-
+
for (i = 0; i < gui_key_buffer_size; i++)
{
key = gui_key_buffer[i];
insert_ok = 1;
utf_partial_char[0] = '\0';
-
+
if (gui_mouse_event_pending || (key < 32) || (key == 127))
{
if (gui_mouse_event_pending)
@@ -340,7 +340,7 @@ gui_key_flush ()
key_str[length_key_str] = (char)key;
key_str[length_key_str + 1] = '\0';
length_key_str++;
-
+
/*
* replace invalid chars by "?", but NOT last char of
* string, if it is incomplete UTF-8 char (another char
@@ -385,13 +385,13 @@ gui_key_flush ()
{
hook_signal_send ("key_pressed",
WEECHAT_HOOK_SIGNAL_STRING, key_str);
-
+
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
input_old = (gui_current_window->buffer->input_buffer) ?
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
else
input_old = NULL;
-
+
if ((gui_key_pressed (key_str) != 0) && (insert_ok)
&& (!gui_cursor_mode))
{
@@ -402,7 +402,7 @@ gui_key_flush ()
gui_completion_stop (gui_current_window->buffer->completion, 0);
gui_input_text_changed_modifier_and_signal (gui_current_window->buffer, 1);
}
-
+
/* incremental text search in buffer */
if ((gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
&& ((input_old == NULL)
@@ -436,11 +436,11 @@ gui_key_flush ()
gui_window_search_restart (gui_current_window);
}
}
-
+
if (input_old)
free (input_old);
}
-
+
/* prepare incomplete UTF-8 char for next iteration */
if (utf_partial_char[0])
strcpy (key_str, utf_partial_char);
@@ -448,7 +448,7 @@ gui_key_flush ()
key_str[0] = '\0';
length_key_str = strlen (key_str);
}
-
+
gui_key_buffer_reset ();
}
}
@@ -462,11 +462,11 @@ gui_key_read_cb (void *data, int fd)
{
int ret, i, accept_paste, cancel_paste, text_added_to_buffer, paste_lines;
unsigned char buffer[4096];
-
+
/* make C compiler happy */
(void) data;
(void) fd;
-
+
accept_paste = 0;
cancel_paste = 0;
text_added_to_buffer = 0;
@@ -484,11 +484,11 @@ gui_key_read_cb (void *data, int fd)
}
if (ret <= 0)
return WEECHAT_RC_OK;
-
+
/* ctrl-Y: accept paste */
if (buffer[0] == 25)
accept_paste = 1;
-
+
/* ctrl-N: cancel paste */
if (buffer[0] == 14)
cancel_paste = 1;
@@ -506,7 +506,7 @@ gui_key_read_cb (void *data, int fd)
}
if (ret < 0)
return WEECHAT_RC_OK;
-
+
for (i = 0; i < ret; i++)
{
/* add all chars (ignore a '\n' after a '\r') */
@@ -517,10 +517,10 @@ gui_key_read_cb (void *data, int fd)
gui_key_buffer_add (buffer[i]);
}
}
-
+
text_added_to_buffer = 1;
}
-
+
if (gui_key_paste_pending)
{
/* user is ok for pasting text, let's paste! */
@@ -548,8 +548,8 @@ gui_key_read_cb (void *data, int fd)
}
}
}
-
+
gui_key_flush ();
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index c6f5750c3..a8bf1c58a 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -73,10 +73,10 @@ gui_main_pre_init (int *argc, char **argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
/* pre-init colors */
gui_color_pre_init ();
-
+
/* init some variables for chat area */
gui_chat_init ();
}
@@ -91,68 +91,68 @@ gui_main_init ()
struct t_gui_buffer *ptr_buffer;
struct t_gui_bar *ptr_bar;
struct t_gui_bar_window *ptr_bar_win;
-
+
initscr ();
-
+
if (CONFIG_BOOLEAN(config_look_eat_newline_glitch))
gui_term_set_eat_newline_glitch (0);
-
+
curs_set (1);
noecho ();
nodelay (stdscr, TRUE);
raw ();
-
+
gui_color_init ();
-
+
/* build prefixes according to config */
gui_chat_prefix_build ();
-
+
refresh ();
-
+
gui_term_cols = COLS;
gui_term_lines = LINES;
-
+
gui_window_read_terminal_size ();
-
+
/* init clipboard buffer */
gui_input_clipboard = NULL;
-
+
/* get time length */
gui_chat_time_length = gui_chat_get_time_length ();
-
+
/* init bar items */
gui_bar_item_init ();
-
+
gui_init_ok = 0;
-
+
/* create core buffer */
ptr_buffer = gui_buffer_new (NULL, GUI_BUFFER_MAIN,
NULL, NULL, NULL, NULL);
if (ptr_buffer)
{
gui_init_ok = 1;
-
+
ptr_buffer->num_displayed = 1;
-
+
/* set short name */
if (!ptr_buffer->short_name)
ptr_buffer->short_name = strdup (GUI_BUFFER_MAIN);
-
+
/* set title for core buffer */
gui_buffer_set_title (ptr_buffer,
"WeeChat " PACKAGE_VERSION " "
WEECHAT_COPYRIGHT_DATE " - " WEECHAT_WEBSITE);
-
+
/* create main window (using full space) */
if (gui_window_new (NULL, ptr_buffer, 0, 0,
gui_term_cols, gui_term_lines, 100, 100))
{
gui_current_window = gui_windows;
-
+
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
}
-
+
/*
* create bar windows for root bars (they were read from config,
* but no window was created, GUI was not initialized)
@@ -172,7 +172,7 @@ gui_main_init ()
gui_bar_window_create_win (ptr_bar_win);
}
}
-
+
if (CONFIG_BOOLEAN(config_look_mouse))
gui_mouse_enable ();
else
@@ -241,21 +241,21 @@ gui_main_refreshs ()
struct t_gui_window *ptr_win;
struct t_gui_buffer *ptr_buffer;
struct t_gui_bar *ptr_bar;
-
+
/* refresh color buffer if needed */
if (gui_color_buffer_refresh_needed)
{
gui_color_buffer_display ();
gui_color_buffer_refresh_needed = 0;
}
-
+
/* refresh window if needed */
if (gui_window_refresh_needed)
{
gui_window_refresh_screen ((gui_window_refresh_needed > 1) ? 1 : 0);
gui_window_refresh_needed = 0;
}
-
+
/* refresh bars if needed */
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
@@ -264,7 +264,7 @@ gui_main_refreshs ()
gui_bar_draw (ptr_bar);
}
}
-
+
/* refresh windows if needed */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -275,7 +275,7 @@ gui_main_refreshs ()
ptr_win->refresh_needed = 0;
}
}
-
+
/* refresh chat buffers if needed */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -286,7 +286,7 @@ gui_main_refreshs ()
(ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0);
}
}
-
+
/* refresh bars if needed */
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
@@ -295,7 +295,7 @@ gui_main_refreshs ()
gui_bar_draw (ptr_bar);
}
}
-
+
/* move cursor (for cursor mode) */
if (gui_cursor_mode)
gui_window_move_cursor ();
@@ -313,25 +313,25 @@ gui_main_loop ()
fd_set read_fds, write_fds, except_fds;
int max_fd;
int ready;
-
+
weechat_quit = 0;
-
+
/* catch SIGTERM signal: quit program */
util_catch_signal (SIGTERM, &gui_main_signal_sigterm);
util_catch_signal (SIGQUIT, &gui_main_signal_sigquit);
-
+
/* catch SIGHUP signal: reload configuration */
util_catch_signal (SIGHUP, &gui_main_signal_sighup);
-
+
/* catch SIGWINCH signal: redraw screen */
util_catch_signal (SIGWINCH, &gui_main_signal_sigwinch);
-
+
/* hook stdin (read keyboard) */
hook_fd_keyboard = hook_fd (NULL, STDIN_FILENO, 1, 0, 0,
&gui_key_read_cb, NULL);
-
+
gui_window_ask_refresh (1);
-
+
while (!weechat_quit)
{
/* reload config, if SIGHUP reveived */
@@ -342,7 +342,7 @@ gui_main_loop ()
"files"));
command_reload (NULL, NULL, 0, NULL, NULL);
}
-
+
/* execute hook timers */
hook_timer_exec ();
@@ -354,13 +354,13 @@ gui_main_loop ()
gui_color_pairs_auto_reset = 0;
gui_color_pairs_auto_reset_pending = 1;
}
-
+
gui_main_refreshs ();
if (gui_window_refresh_needed)
gui_main_refreshs ();
-
+
gui_color_pairs_auto_reset_pending = 0;
-
+
/* wait for keyboard or network activity */
FD_ZERO (&read_fds);
FD_ZERO (&write_fds);
@@ -374,7 +374,7 @@ gui_main_loop ()
hook_fd_exec (&read_fds, &write_fds, &except_fds);
}
}
-
+
/* remove keyboard hook */
unhook (hook_fd_keyboard);
}
@@ -400,55 +400,55 @@ gui_main_end (int clean_exit)
if (gui_window_refresh_needed)
gui_main_refreshs ();
}
-
+
/* disable mouse */
gui_mouse_disable ();
-
+
/* remove bar items and bars */
gui_bar_item_end ();
gui_bar_free_all ();
-
+
/* remove filters */
gui_filter_free_all ();
-
+
/* free clipboard buffer */
if (gui_input_clipboard)
free (gui_input_clipboard);
-
+
/* delete layout saved */
gui_layout_window_remove_all (&gui_layout_windows);
gui_layout_buffer_remove_all (&gui_layout_buffers, &last_gui_layout_buffer);
-
+
/* delete all windows */
while (gui_windows)
{
gui_window_free (gui_windows);
}
gui_window_tree_free (&gui_windows_tree);
-
+
/* delete all buffers */
while (gui_buffers)
{
gui_buffer_close (gui_buffers);
}
-
+
gui_ok = 0;
gui_init_ok = 0;
-
+
/* delete global history */
gui_history_global_free ();
-
+
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_set_title (NULL);
-
+
/* end color */
gui_color_end ();
-
+
/* free some variables used for chat area */
gui_chat_end ();
}
-
+
/* end of Curses output */
refresh ();
endwin ();
diff --git a/src/gui/curses/gui-curses-mouse.c b/src/gui/curses/gui-curses-mouse.c
index 6462f9d42..d37cef5ad 100644
--- a/src/gui/curses/gui-curses-mouse.c
+++ b/src/gui/curses/gui-curses-mouse.c
@@ -139,9 +139,9 @@ gui_mouse_grab_event2input ()
{
struct t_gui_focus_info *focus_info;
static char area[256];
-
+
area[0] = '\0';
-
+
focus_info = gui_focus_get_info (gui_mouse_event_x[0],
gui_mouse_event_y[0]);
if (focus_info)
@@ -166,7 +166,7 @@ gui_mouse_grab_event2input ()
}
gui_focus_free_info (focus_info);
}
-
+
return area;
}
@@ -178,7 +178,7 @@ void
gui_mouse_grab_end (const char *mouse_key)
{
char mouse_key_input[256];
-
+
/* insert mouse key in input */
if (gui_current_window->buffer->input)
{
@@ -202,7 +202,7 @@ gui_mouse_grab_end (const char *mouse_key)
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_input_text_changed_modifier_and_signal (gui_current_window->buffer, 1);
}
-
+
gui_mouse_grab = 0;
}
@@ -216,9 +216,9 @@ gui_mouse_event_timer_cb (void *data, int remaining_calls)
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
gui_mouse_event_end ();
-
+
return WEECHAT_RC_OK;
}
@@ -230,10 +230,10 @@ void
gui_mouse_event_init ()
{
gui_mouse_event_pending = 1;
-
+
if (gui_mouse_event_timer)
unhook (gui_mouse_event_timer);
-
+
gui_mouse_event_timer = hook_timer (NULL,
CONFIG_INTEGER(config_look_mouse_timer_delay),
0, 1,
@@ -251,9 +251,9 @@ gui_mouse_event_code2key (const char *code)
double diff_x, diff_y, distance, angle, pi4;
static char key[128];
char *ptr_code;
-
+
key[0] = '\0';
-
+
/*
* mouse code must have at least:
* one code (for event) + X + Y == 3 bytes or 3 UTF-8 chars
@@ -262,7 +262,7 @@ gui_mouse_event_code2key (const char *code)
length = (code_utf8) ? utf8_strlen (code) : (int)strlen (code);
if (length < 3)
return NULL;
-
+
/* get coordinates and button */
if (code_utf8)
{
@@ -283,23 +283,23 @@ gui_mouse_event_code2key (const char *code)
x = 0;
if (y < 0)
y = 0;
-
+
/* ignore code if it's motion/end code received as first event */
if ((gui_mouse_event_index == 0)
&& (MOUSE_CODE_MOTION(code[0]) || MOUSE_CODE_END(code[0])))
{
return NULL;
}
-
+
/* set data in "gui_mouse_event_xxx" */
gui_mouse_event_x[gui_mouse_event_index] = x;
gui_mouse_event_y[gui_mouse_event_index] = y;
if (gui_mouse_event_index == 0)
gui_mouse_event_button = code[0];
-
+
if (gui_mouse_event_index == 0)
gui_mouse_event_index = 1;
-
+
/*
* browse wheel codes, if one code is found, return event name immediately
*/
@@ -313,10 +313,10 @@ gui_mouse_event_code2key (const char *code)
return key;
}
}
-
+
if (!MOUSE_CODE_END(code[0]))
return NULL;
-
+
/* add name of button event */
for (i = 0; gui_mouse_button_codes[i][0]; i++)
{
@@ -326,16 +326,16 @@ gui_mouse_event_code2key (const char *code)
break;
}
}
-
+
/*
* Mouse gesture: if (x,y) on release is different from (x,y) on click,
* compute distance and angle between 2 points.
*
* Distance: sqrt((x2-x1)²+(y2-y1)²)
* Angle : atan2(x1-x1, y2-y1)
- *
+ *
* Angle:
- *
+ *
* 3.14 pi
* /\
* -2.35 || 2.35 3/4 * pi
@@ -360,7 +360,7 @@ gui_mouse_event_code2key (const char *code)
* buttonX-gesture-right | 3..39 | 0.78..2.35
* buttonX-gesture-right-long | >= 40 |
*/
-
+
distance = 0;
if (key[0]
&& ((gui_mouse_event_x[0] != gui_mouse_event_x[1])
@@ -400,7 +400,7 @@ gui_mouse_event_code2key (const char *code)
}
}
}
-
+
return key;
}
@@ -412,16 +412,16 @@ void
gui_mouse_event_end ()
{
const char *mouse_key;
-
+
gui_mouse_event_pending = 0;
-
+
/* end mouse event timer */
if (gui_mouse_event_timer)
{
unhook (gui_mouse_event_timer);
gui_mouse_event_timer = NULL;
}
-
+
/* get key from mouse code */
mouse_key = gui_mouse_event_code2key (gui_key_combo_buffer);
if (mouse_key && mouse_key[0])
@@ -438,6 +438,6 @@ gui_mouse_event_end ()
}
gui_mouse_event_reset ();
}
-
+
gui_key_combo_buffer[0] = '\0';
}
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 238588da9..3301e4c1d 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -93,7 +93,7 @@ gui_window_read_terminal_size ()
{
struct winsize size;
int new_width, new_height;
-
+
if (ioctl (fileno (stdout), TIOCGWINSZ, &size) == 0)
{
resizeterm (size.ws_row, size.ws_col);
@@ -106,7 +106,7 @@ gui_window_read_terminal_size ()
gui_term_cols = new_width;
gui_term_lines = new_height;
}
-
+
gui_ok = ((gui_term_cols >= GUI_WINDOW_MIN_WIDTH)
&& (gui_term_lines >= GUI_WINDOW_MIN_HEIGHT));
}
@@ -119,7 +119,7 @@ int
gui_window_objects_init (struct t_gui_window *window)
{
struct t_gui_window_curses_objects *new_objects;
-
+
new_objects = malloc (sizeof (*new_objects));
if (new_objects)
{
@@ -159,7 +159,7 @@ gui_window_clear_weechat (WINDOW *window, int weechat_color)
{
if (!gui_ok)
return;
-
+
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_weechat_get_pair (weechat_color)));
werase (window);
wmove (window, 0, 0);
@@ -174,17 +174,17 @@ gui_window_clear (WINDOW *window, int fg, int bg)
{
if (!gui_ok)
return;
-
+
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
else
fg = gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].foreground;
-
+
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
else
bg = gui_weechat_colors[bg & GUI_COLOR_EXTENDED_MASK].background;
-
+
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_get_pair (fg, bg)));
werase (window);
wmove (window, 0, 0);
@@ -241,7 +241,7 @@ gui_window_reset_style (WINDOW *window, int weechat_color)
gui_window_current_style_bg = -1;
gui_window_current_style_attr = 0;
gui_window_current_color_attr = 0;
-
+
wattroff (window, A_BOLD | A_UNDERLINE | A_REVERSE);
wattron (window, COLOR_PAIR(gui_color_weechat_get_pair (weechat_color)) |
gui_color[weechat_color]->attributes);
@@ -289,7 +289,7 @@ gui_window_set_color (WINDOW *window, int fg, int bg)
{
gui_window_current_style_fg = fg;
gui_window_current_style_bg = bg;
-
+
wattron (window, COLOR_PAIR(gui_color_get_pair (fg, bg)));
}
@@ -301,13 +301,13 @@ void
gui_window_set_weechat_color (WINDOW *window, int num_color)
{
int fg, bg;
-
+
if ((num_color >= 0) && (num_color < GUI_COLOR_NUM_COLORS))
{
gui_window_reset_style (window, num_color);
fg = gui_color[num_color]->foreground;
bg = gui_color[num_color]->background;
-
+
/*
* if not real white, we use default terminal foreground instead of
* white if bold attribute is set
@@ -317,7 +317,7 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
{
fg = -1;
}
-
+
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
@@ -335,11 +335,11 @@ void
gui_window_set_custom_color_fg (WINDOW *window, int fg)
{
int current_bg, attributes;
-
+
if (fg >= 0)
{
current_bg = gui_window_current_style_bg;
-
+
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
{
if (fg & GUI_COLOR_EXTENDED_BOLD_FLAG)
@@ -375,7 +375,7 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
attributes |= gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
gui_window_set_color_style (window, attributes);
fg = gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].foreground;
-
+
/*
* if not real white, we use default terminal foreground instead of
* white if bold attribute is set
@@ -385,7 +385,7 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
{
fg = -1;
}
-
+
gui_window_set_color (window, fg, current_bg);
}
}
@@ -400,12 +400,12 @@ void
gui_window_set_custom_color_bg (WINDOW *window, int bg)
{
int current_attr, current_fg;
-
+
if (bg >= 0)
{
current_attr = gui_window_current_style_attr;
current_fg = gui_window_current_style_fg;
-
+
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
{
gui_window_set_color (window,
@@ -432,7 +432,7 @@ void
gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
{
int attributes;
-
+
if ((fg >= 0) && (bg >= 0))
{
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
@@ -468,7 +468,7 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
attributes |= gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
gui_window_set_color_style (window, attributes);
fg = gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].foreground;
-
+
/*
* if not real white, we use default terminal foreground instead of
* white if bold attribute is set
@@ -479,7 +479,7 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
fg = -1;
}
}
-
+
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
else
@@ -488,7 +488,7 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
bg = (gui_color_term_colors >= 16) ?
gui_weechat_colors[bg].background : gui_weechat_colors[bg].foreground;
}
-
+
gui_window_set_color (window, fg, bg);
}
}
@@ -522,9 +522,9 @@ gui_window_string_apply_color_fg (unsigned char **string, WINDOW *window)
unsigned char *ptr_string;
char str_fg[6], *error;
int fg, extra_attr, flag;
-
+
ptr_string = *string;
-
+
if (ptr_string[0] == GUI_COLOR_EXTENDED_CHAR)
{
ptr_string++;
@@ -577,7 +577,7 @@ gui_window_string_apply_color_fg (unsigned char **string, WINDOW *window)
ptr_string += 2;
}
}
-
+
*string = ptr_string;
}
@@ -594,9 +594,9 @@ gui_window_string_apply_color_bg (unsigned char **string, WINDOW *window)
unsigned char *ptr_string;
char str_bg[6], *error;
int bg;
-
+
ptr_string = *string;
-
+
if (ptr_string[0] == GUI_COLOR_EXTENDED_CHAR)
{
if (ptr_string[1] && ptr_string[2] && ptr_string[3]
@@ -636,7 +636,7 @@ gui_window_string_apply_color_bg (unsigned char **string, WINDOW *window)
ptr_string += 2;
}
}
-
+
*string = ptr_string;
}
@@ -654,9 +654,9 @@ gui_window_string_apply_color_fg_bg (unsigned char **string, WINDOW *window)
unsigned char *ptr_string;
char str_fg[6], str_bg[6], *error;
int fg, bg, extra_attr, flag;
-
+
ptr_string = *string;
-
+
str_fg[0] = '\0';
str_bg[0] = '\0';
fg = -1;
@@ -756,7 +756,7 @@ gui_window_string_apply_color_fg_bg (unsigned char **string, WINDOW *window)
{
gui_window_set_custom_color_fg_bg (window, fg, bg);
}
-
+
*string = ptr_string;
}
@@ -774,9 +774,9 @@ gui_window_string_apply_color_pair (unsigned char **string, WINDOW *window)
unsigned char *ptr_string;
char str_pair[6], *error;
int pair;
-
+
ptr_string = *string;
-
+
if ((isdigit (ptr_string[0])) && (isdigit (ptr_string[1]))
&& (isdigit (ptr_string[2])) && (isdigit (ptr_string[3]))
&& (isdigit (ptr_string[4])))
@@ -794,7 +794,7 @@ gui_window_string_apply_color_pair (unsigned char **string, WINDOW *window)
}
ptr_string += 5;
}
-
+
*string = ptr_string;
}
@@ -813,9 +813,9 @@ gui_window_string_apply_color_weechat (unsigned char **string, WINDOW *window)
unsigned char *ptr_string;
char str_number[3], *error;
int weechat_color;
-
+
ptr_string = *string;
-
+
if (isdigit (ptr_string[0]) && isdigit (ptr_string[1]))
{
if (window)
@@ -833,7 +833,7 @@ gui_window_string_apply_color_weechat (unsigned char **string, WINDOW *window)
}
ptr_string += 2;
}
-
+
*string = ptr_string;
}
@@ -850,9 +850,9 @@ void
gui_window_string_apply_color_set_attr (unsigned char **string, WINDOW *window)
{
unsigned char *ptr_string;
-
+
ptr_string = *string;
-
+
switch (ptr_string[0])
{
case GUI_COLOR_ATTR_BOLD_CHAR:
@@ -875,7 +875,7 @@ gui_window_string_apply_color_set_attr (unsigned char **string, WINDOW *window)
gui_window_set_color_style (window, A_UNDERLINE);
break;
}
-
+
*string = ptr_string;
}
@@ -892,9 +892,9 @@ void
gui_window_string_apply_color_remove_attr (unsigned char **string, WINDOW *window)
{
unsigned char *ptr_string;
-
+
ptr_string = *string;
-
+
switch (ptr_string[0])
{
case GUI_COLOR_ATTR_BOLD_CHAR:
@@ -917,7 +917,7 @@ gui_window_string_apply_color_remove_attr (unsigned char **string, WINDOW *windo
gui_window_remove_color_style (window, A_UNDERLINE);
break;
}
-
+
*string = ptr_string;
}
@@ -938,18 +938,18 @@ gui_window_calculate_pos_size (struct t_gui_window *window)
gui_ok = 0;
return;
}
-
+
for (ptr_bar_win = window->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
{
gui_bar_window_calculate_pos_size (ptr_bar_win, window);
}
-
+
add_bottom = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_BOTTOM);
add_top = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_TOP);
add_left = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_LEFT);
add_right = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_RIGHT);
-
+
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + add_top;
window->win_chat_width = window->win_width - add_left - add_right;
@@ -969,13 +969,13 @@ void
gui_window_draw_separator (struct t_gui_window *window)
{
int separator_vertical;
-
+
if (GUI_WINDOW_OBJECTS(window)->win_separator)
{
delwin (GUI_WINDOW_OBJECTS(window)->win_separator);
GUI_WINDOW_OBJECTS(window)->win_separator = NULL;
}
-
+
if (window->win_x > gui_bar_root_get_size (NULL, GUI_BAR_POSITION_LEFT))
{
GUI_WINDOW_OBJECTS(window)->win_separator = newwin (window->win_height,
@@ -1007,7 +1007,7 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer)
{
if (!gui_ok)
return;
-
+
gui_chat_draw (buffer, 1);
}
@@ -1022,7 +1022,7 @@ gui_window_redraw_all_buffers ()
if (!gui_ok)
return;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1041,14 +1041,14 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
{
struct t_gui_bar_window *ptr_bar_window;
struct t_gui_buffer *old_buffer;
-
+
if (!gui_ok)
return;
-
+
gui_buffer_add_value_num_displayed (window->buffer, -1);
-
+
old_buffer = window->buffer;
-
+
if (window->buffer->number != buffer->number)
{
gui_window_scroll_switch (window, buffer);
@@ -1071,18 +1071,18 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
}
}
}
-
+
window->buffer = buffer;
gui_buffer_add_value_num_displayed (buffer, 1);
-
+
if (!weechat_upgrading && (old_buffer != buffer))
gui_hotlist_remove_buffer (buffer);
-
+
if (gui_ok)
{
gui_bar_window_remove_unused_bars (window);
gui_bar_window_add_missing_bars (window);
-
+
/* create bar windows */
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
@@ -1091,12 +1091,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
gui_bar_window_calculate_pos_size (ptr_bar_window, window);
gui_bar_window_create_win (ptr_bar_window);
}
-
+
gui_window_calculate_pos_size (window);
-
+
/* destroy Curses windows */
gui_window_objects_free (window, 0);
-
+
/* create Curses windows */
if (GUI_WINDOW_OBJECTS(window)->win_chat)
delwin (GUI_WINDOW_OBJECTS(window)->win_chat);
@@ -1107,29 +1107,29 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
gui_window_draw_separator (window);
gui_buffer_ask_chat_refresh (window->buffer, 2);
}
-
+
if (window->buffer->type == GUI_BUFFER_TYPE_FREE)
{
window->scroll->scrolling = 0;
window->scroll->lines_after = 0;
}
-
+
gui_buffer_set_active_buffer (buffer);
-
+
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
{
ptr_bar_window->bar->bar_refresh_needed = 1;
}
-
+
if (CONFIG_BOOLEAN(config_look_read_marker_always_show)
&& set_last_read && !window->buffer->lines->last_read_line)
{
window->buffer->lines->last_read_line = window->buffer->lines->last_line;
}
-
+
gui_input_move_to_buffer (old_buffer, window->buffer);
-
+
hook_signal_send ("buffer_switch",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -1143,12 +1143,12 @@ gui_window_switch (struct t_gui_window *window)
{
struct t_gui_window *old_window;
int changes;
-
+
if (gui_current_window == window)
return;
-
+
old_window = gui_current_window;
-
+
gui_current_window = window;
changes = gui_bar_window_remove_unused_bars (old_window)
|| gui_bar_window_add_missing_bars (old_window);
@@ -1159,12 +1159,12 @@ gui_window_switch (struct t_gui_window *window)
gui_current_window->buffer, 1);
gui_current_window = window;
}
-
+
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer, 1);
-
+
old_window->refresh_needed = 1;
-
+
gui_input_move_to_buffer (old_window->buffer, window->buffer);
}
@@ -1177,17 +1177,17 @@ gui_window_page_up (struct t_gui_window *window)
{
char scroll[32];
int num_lines;
-
+
if (!gui_ok)
return;
-
+
num_lines = ((window->win_chat_height - 1) *
CONFIG_INTEGER(config_look_scroll_page_percent)) / 100;
if (num_lines < 1)
num_lines = 1;
else if (num_lines > window->win_chat_height - 1)
num_lines = window->win_chat_height - 1;
-
+
switch (window->buffer->type)
{
case GUI_BUFFER_TYPE_FORMATTED:
@@ -1227,17 +1227,17 @@ gui_window_page_down (struct t_gui_window *window)
struct t_gui_line *ptr_line;
int line_pos, num_lines;
char scroll[32];
-
+
if (!gui_ok)
return;
-
+
num_lines = ((window->win_chat_height - 1) *
CONFIG_INTEGER(config_look_scroll_page_percent)) / 100;
if (num_lines < 1)
num_lines = 1;
else if (num_lines > window->win_chat_height - 1)
num_lines = window->win_chat_height - 1;
-
+
switch (window->buffer->type)
{
case GUI_BUFFER_TYPE_FORMATTED:
@@ -1246,7 +1246,7 @@ gui_window_page_down (struct t_gui_window *window)
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
&window->scroll->start_line_pos,
num_lines);
-
+
/* check if we can display all */
ptr_line = window->scroll->start_line;
line_pos = window->scroll->start_line_pos;
@@ -1282,7 +1282,7 @@ void
gui_window_scroll_up (struct t_gui_window *window)
{
char scroll[32];
-
+
if (!gui_ok)
return;
@@ -1326,10 +1326,10 @@ gui_window_scroll_down (struct t_gui_window *window)
struct t_gui_line *ptr_line;
int line_pos;
char scroll[32];
-
+
if (!gui_ok)
return;
-
+
switch (window->buffer->type)
{
case GUI_BUFFER_TYPE_FORMATTED:
@@ -1338,14 +1338,14 @@ gui_window_scroll_down (struct t_gui_window *window)
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
&window->scroll->start_line_pos,
CONFIG_INTEGER(config_look_scroll_amount));
-
+
/* check if we can display all */
ptr_line = window->scroll->start_line;
line_pos = window->scroll->start_line_pos;
gui_chat_calculate_line_diff (window, &ptr_line,
&line_pos,
window->win_chat_height - 1);
-
+
if (!ptr_line)
{
window->scroll->start_line = NULL;
@@ -1376,7 +1376,7 @@ gui_window_scroll_top (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
switch (window->buffer->type)
{
case GUI_BUFFER_TYPE_FORMATTED:
@@ -1410,7 +1410,7 @@ void
gui_window_scroll_bottom (struct t_gui_window *window)
{
char scroll[32];
-
+
if (!gui_ok)
return;
@@ -1459,10 +1459,10 @@ gui_window_auto_resize (struct t_gui_window_tree *tree,
{
int size1, size2;
struct t_gui_window_tree *parent;
-
+
if (!gui_ok)
return 0;
-
+
if (tree)
{
if (tree->window)
@@ -1533,10 +1533,10 @@ gui_window_refresh_windows ()
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_bar *ptr_bar;
int add_bottom, add_top, add_left, add_right;
-
+
if (!gui_ok)
return;
-
+
old_current_window = gui_current_window;
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
@@ -1549,12 +1549,12 @@ gui_window_refresh_windows ()
gui_bar_ask_refresh (ptr_bar);
}
}
-
+
add_bottom = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_BOTTOM);
add_top = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_TOP);
add_left = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_LEFT);
add_right = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_RIGHT);
-
+
if (gui_window_auto_resize (gui_windows_tree, add_left, add_top,
gui_window_get_width () - add_left - add_right,
gui_window_get_height () - add_top - add_bottom,
@@ -1568,7 +1568,7 @@ gui_window_refresh_windows ()
}
gui_window_zoom (gui_current_window);
}
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_calculate_pos_size (ptr_win);
@@ -1579,7 +1579,7 @@ gui_window_refresh_windows ()
}
ptr_win->refresh_needed = 1;
}
-
+
gui_current_window = old_current_window;
}
@@ -1592,15 +1592,15 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int height1, height2;
-
+
if (!gui_ok)
return NULL;
-
+
new_window = NULL;
-
+
height1 = (window->win_height * percentage) / 100;
height2 = window->win_height - height1;
-
+
if ((height1 >= GUI_WINDOW_MIN_HEIGHT) && (height2 >= GUI_WINDOW_MIN_HEIGHT)
&& (percentage > 0) && (percentage < 100))
{
@@ -1614,17 +1614,17 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage)
window->win_y = new_window->win_y + new_window->win_height;
window->win_height = height2;
window->win_height_pct = 100 - percentage;
-
+
/* assign same buffer for new window (top window) */
gui_buffer_add_value_num_displayed (new_window->buffer, 1);
-
+
window->refresh_needed = 1;
new_window->refresh_needed = 1;
-
+
gui_window_switch (new_window);
}
}
-
+
return new_window;
}
@@ -1637,15 +1637,15 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int width1, width2;
-
+
if (!gui_ok)
return NULL;
-
+
new_window = NULL;
-
+
width1 = (window->win_width * percentage) / 100;
width2 = window->win_width - width1 - 1;
-
+
if ((width1 >= GUI_WINDOW_MIN_WIDTH) && (width2 >= GUI_WINDOW_MIN_WIDTH)
&& (percentage > 0) && (percentage < 100))
{
@@ -1658,20 +1658,20 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage)
/* reduce old window height (left window) */
window->win_width = width1;
window->win_width_pct = 100 - percentage;
-
+
/* assign same buffer for new window (right window) */
gui_buffer_add_value_num_displayed (new_window->buffer, 1);
-
+
window->refresh_needed = 1;
new_window->refresh_needed = 1;
-
+
gui_window_switch (new_window);
-
+
/* create & draw separator */
gui_window_draw_separator (gui_current_window);
}
}
-
+
return new_window;
}
@@ -1684,10 +1684,10 @@ gui_window_resize (struct t_gui_window *window, int percentage)
{
struct t_gui_window_tree *parent;
int old_split_pct, add_bottom, add_top, add_left, add_right;
-
+
if (!gui_ok)
return;
-
+
parent = window->ptr_tree->parent_node;
if (parent)
{
@@ -1701,12 +1701,12 @@ gui_window_resize (struct t_gui_window *window, int percentage)
{
parent->split_pct = 100 - percentage;
}
-
+
add_bottom = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_BOTTOM);
add_top = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_TOP);
add_left = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_LEFT);
add_right = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_RIGHT);
-
+
if (gui_window_auto_resize (gui_windows_tree, add_left, add_top,
gui_window_get_width () - add_left - add_right,
gui_window_get_height () - add_top - add_bottom,
@@ -1726,10 +1726,10 @@ gui_window_resize_delta (struct t_gui_window *window, int delta_percentage)
{
struct t_gui_window_tree *parent;
int old_split_pct, add_bottom, add_top, add_left, add_right;
-
+
if (!gui_ok)
return;
-
+
parent = window->ptr_tree->parent_node;
if (parent)
{
@@ -1747,12 +1747,12 @@ gui_window_resize_delta (struct t_gui_window *window, int delta_percentage)
parent->split_pct = 1;
else if (parent->split_pct > 99)
parent->split_pct = 99;
-
+
add_bottom = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_BOTTOM);
add_top = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_TOP);
add_left = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_LEFT);
add_right = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_RIGHT);
-
+
if (gui_window_auto_resize (gui_windows_tree, add_left, add_top,
gui_window_get_width () - add_left - add_right,
gui_window_get_height () - add_top - add_bottom,
@@ -1771,19 +1771,19 @@ int
gui_window_merge (struct t_gui_window *window)
{
struct t_gui_window_tree *parent, *sister;
-
+
if (!gui_ok)
return 0;
-
+
parent = window->ptr_tree->parent_node;
if (parent)
{
sister = (parent->child1->window == window) ?
parent->child2 : parent->child1;
-
+
if (!(sister->window))
return 0;
-
+
if (window->win_y == sister->window->win_y)
{
/* horizontal merge */
@@ -1800,10 +1800,10 @@ gui_window_merge (struct t_gui_window *window)
window->win_x = sister->window->win_x;
if (sister->window->win_y < window->win_y)
window->win_y = sister->window->win_y;
-
+
gui_window_free (sister->window);
gui_window_tree_node_to_leaf (parent, window);
-
+
gui_window_switch_to_buffer (window, window->buffer, 1);
return 1;
}
@@ -1818,17 +1818,17 @@ void
gui_window_merge_all (struct t_gui_window *window)
{
int num_deleted, add_bottom, add_top, add_left, add_right;
-
+
if (!gui_ok)
return;
-
+
num_deleted = 0;
while (gui_windows->next_window)
{
gui_window_free ((gui_windows == window) ? gui_windows->next_window : gui_windows);
num_deleted++;
}
-
+
if (num_deleted > 0)
{
gui_window_tree_free (&gui_windows_tree);
@@ -1843,10 +1843,10 @@ gui_window_merge_all (struct t_gui_window *window)
window->win_y = add_top;
window->win_width = gui_window_get_width () - add_left - add_right;
window->win_height = gui_window_get_height () - add_top - add_bottom;
-
+
window->win_width_pct = 100;
window->win_height_pct = 100;
-
+
gui_current_window = window;
gui_window_switch_to_buffer (window, window->buffer, 1);
}
@@ -1866,7 +1866,7 @@ gui_window_side_by_side (struct t_gui_window *win1, struct t_gui_window *win2)
{
if (!gui_ok)
return 0;
-
+
/* win2 over win1 ? */
if (win2->win_y + win2->win_height == win1->win_y)
{
@@ -1896,7 +1896,7 @@ gui_window_side_by_side (struct t_gui_window *win1, struct t_gui_window *win2)
return 0;
return 3;
}
-
+
/* win2 on the left ? */
if (win2->win_x + win2->win_width + 1 == win1->win_x)
{
@@ -1918,10 +1918,10 @@ void
gui_window_switch_up (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -1942,10 +1942,10 @@ void
gui_window_switch_down (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -1966,10 +1966,10 @@ void
gui_window_switch_left (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -1990,10 +1990,10 @@ void
gui_window_switch_right (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -2015,7 +2015,7 @@ int
gui_window_balance_count (struct t_gui_window_tree *tree, int split_horizontal)
{
int count;
-
+
count = 0;
if (tree)
{
@@ -2043,7 +2043,7 @@ int
gui_window_balance (struct t_gui_window_tree *tree)
{
int balanced, count_left, count_right, new_split_pct;
-
+
balanced = 0;
if (tree && tree->child1 && tree->child2)
{
@@ -2086,12 +2086,12 @@ gui_window_swap (struct t_gui_window *window, int direction)
struct t_gui_window_tree *parent, *sister;
struct t_gui_window *window2, *ptr_win;
struct t_gui_buffer *buffer1;
-
+
if (!window || !gui_ok)
return;
-
+
window2 = NULL;
-
+
if (direction == 0)
{
/* search sister window */
@@ -2118,7 +2118,7 @@ gui_window_swap (struct t_gui_window *window, int direction)
}
}
}
-
+
/* let's swap! */
if (window2 && (window->buffer != window2->buffer))
{
@@ -2144,7 +2144,7 @@ gui_window_refresh_screen (int full_refresh)
gui_window_read_terminal_size ();
refresh ();
}
-
+
gui_window_refresh_windows ();
}
@@ -2158,7 +2158,7 @@ gui_window_set_title (const char *title)
char *shell, *shellname;
char *envterm = getenv ("TERM");
char *envshell = getenv ("SHELL");
-
+
if (envterm)
{
if (title && title[0])
diff --git a/src/gui/gtk/gui-gtk-bar-window.c b/src/gui/gtk/gui-gtk-bar-window.c
index d9d3b5841..cfa073ba7 100644
--- a/src/gui/gtk/gui-gtk-bar-window.c
+++ b/src/gui/gtk/gui-gtk-bar-window.c
@@ -45,7 +45,7 @@ int
gui_bar_window_objects_init (struct t_gui_bar_window *bar_window)
{
struct t_gui_bar_window_gtk_objects *new_objects;
-
+
new_objects = malloc (sizeof (*new_objects));
if (new_objects)
{
@@ -75,7 +75,7 @@ void
gui_bar_window_create_win (struct t_gui_bar_window *bar_window)
{
(void) bar_window;
-
+
/* TODO: write this function for Gtk */
}
@@ -91,7 +91,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
(void) bar_window;
(void) string;
(void) max_chars;
-
+
/* TODO: write this function for Gtk */
return 0;
}
@@ -106,7 +106,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
(void) bar_window;
(void) window;
-
+
/* TODO: write this function for Gtk */
}
diff --git a/src/gui/gtk/gui-gtk-chat.c b/src/gui/gtk/gui-gtk-chat.c
index 5f441b89b..ddbf062da 100644
--- a/src/gui/gtk/gui-gtk-chat.c
+++ b/src/gui/gtk/gui-gtk-chat.c
@@ -96,7 +96,7 @@ gui_chat_reset_style (struct t_gui_window *window)
GUI_WINDOW_OBJECTS(window)->current_style_bg = -1;
GUI_WINDOW_OBJECTS(window)->current_style_attr = 0;
GUI_WINDOW_OBJECTS(window)->current_color_attr = 0;
-
+
/* TODO: change following function call */
/*gui_window_set_weechat_color (window->win_chat, COLOR_WIN_CHAT);*/
gui_chat_remove_style (window,
@@ -183,7 +183,7 @@ gui_chat_string_next_char (struct t_gui_window *window, struct t_gui_line *line,
(void) line;
(void) apply_style;
(void) apply_style_inactive;
-
+
return (char *)string;
}
@@ -196,7 +196,7 @@ void
gui_chat_display_word_raw (struct t_gui_window *window, const char *string)
{
/*char *prev_char, *next_char, saved_char;*/
-
+
/* TODO: write this function for Gtk */
(void) window;
(void) string;
@@ -215,7 +215,7 @@ gui_chat_display_word (struct t_gui_window *window,
{
/*char *end_line, saved_char_end, saved_char;
int pos_saved_char, chars_to_display, num_displayed;*/
-
+
/* TODO: write this function for Gtk */
(void) window;
(void) line;
@@ -258,12 +258,12 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, struct t_gui_line **l
int *line_pos, int difference)
{
int backward, current_size;
-
+
if (!line || !line_pos)
return;
-
+
backward = (difference < 0);
-
+
if (!(*line))
{
/* if looking backward, start at last line of buffer */
@@ -289,7 +289,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, struct t_gui_line **l
}
else
current_size = gui_chat_display_line (window, *line, 0, 1);
-
+
while ((*line) && (difference != 0))
{
/* looking backward */
@@ -329,7 +329,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, struct t_gui_line **l
difference--;
}
}
-
+
/* first or last line reached */
if (!(*line))
{
@@ -365,10 +365,10 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
int num_unit;
char format[32], date[128], *buf;
struct tm *date_tmp;*/
-
+
if (!gui_ok)
return;
-
+
/* TODO: write this function for Gtk */
(void) buffer;
(void) erase;
diff --git a/src/gui/gtk/gui-gtk-color.c b/src/gui/gtk/gui-gtk-color.c
index 50f8220af..67a9a4a4a 100644
--- a/src/gui/gtk/gui-gtk-color.c
+++ b/src/gui/gtk/gui-gtk-color.c
@@ -65,13 +65,13 @@ int
gui_color_search (const char *color_name)
{
int i;
-
+
for (i = 0; gui_weechat_colors[i].string; i++)
{
if (string_strcasecmp (gui_weechat_colors[i].string, color_name) == 0)
return i;
}
-
+
/* color not found */
return -1;
}
@@ -84,7 +84,7 @@ int
gui_color_assign (int *color, const char *color_name)
{
int i;
-
+
/* look for curses colors in table */
i = 0;
while (gui_weechat_colors[i].string)
@@ -96,7 +96,7 @@ gui_color_assign (int *color, const char *color_name)
}
i++;
}
-
+
/* color not found */
return 0;
}
@@ -117,7 +117,7 @@ gui_color_assign_by_diff (int *color, const char *color_name, int diff)
(void) color;
(void) color_name;
(void) diff;
-
+
return 1;
}
@@ -150,7 +150,7 @@ gui_color_get_pair (int fg, int bg)
{
(void) fg;
(void) bg;
-
+
return 0;
}
@@ -162,7 +162,7 @@ int
gui_color_weechat_get_pair (int weechat_color)
{
(void) weechat_color;
-
+
return 0;
}
@@ -194,7 +194,7 @@ void
gui_color_rebuild_weechat ()
{
int i;
-
+
for (i = 0; i < GUI_COLOR_NUM_COLORS; i++)
{
if (gui_color[i])
@@ -290,7 +290,7 @@ gui_color_palette_new (int number, const char *value)
/* This function does nothing in Gtk GUI */
(void) number;
(void) value;
-
+
return NULL;
}
@@ -313,7 +313,7 @@ void
gui_color_pre_init ()
{
int i;
-
+
for (i = 0; i < GUI_COLOR_NUM_COLORS; i++)
{
gui_color[i] = NULL;
@@ -348,7 +348,7 @@ void
gui_color_end ()
{
int i;
-
+
for (i = 0; i < GUI_COLOR_NUM_COLORS; i++)
{
gui_color_free (gui_color[i]);
diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c
index 358dc733c..d6a7d0e3d 100644
--- a/src/gui/gtk/gui-gtk-main.c
+++ b/src/gui/gtk/gui-gtk-main.c
@@ -71,10 +71,10 @@ gui_main_pre_init (int *argc, char **argv[])
{
/* pre-init colors */
gui_color_pre_init ();
-
+
/* init some variables for chat area */
gui_chat_init ();
-
+
/* Initialise Gtk */
gtk_init (argc, argv);
}
@@ -90,55 +90,55 @@ gui_main_init ()
struct t_gui_bar *ptr_bar;
struct t_gui_bar_window *ptr_bar_win;
GdkColor color_fg, color_bg;
-
+
gui_color_init ();
-
+
gui_ok = 1;
-
+
/* build prefixes according to config */
gui_chat_prefix_build ();
-
+
/* init clipboard buffer */
gui_input_clipboard = NULL;
-
+
/* create Gtk widgets */
-
+
gdk_color_parse ("white", &color_fg);
gdk_color_parse ("black", &color_bg);
-
+
gui_gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (gui_gtk_main_window), PACKAGE_STRING);
-
+
g_signal_connect (G_OBJECT (gui_gtk_main_window), "destroy", gtk_main_quit, NULL);
-
+
gui_gtk_vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (gui_gtk_vbox1);
gtk_container_add (GTK_CONTAINER (gui_gtk_main_window), gui_gtk_vbox1);
-
+
gui_gtk_entry_topic = gtk_entry_new ();
gtk_widget_show (gui_gtk_entry_topic);
gtk_box_pack_start (GTK_BOX (gui_gtk_vbox1), gui_gtk_entry_topic, FALSE, FALSE, 0);
gtk_widget_modify_text (gui_gtk_entry_topic, GTK_STATE_NORMAL, &color_fg);
gtk_widget_modify_base (gui_gtk_entry_topic, GTK_STATE_NORMAL, &color_bg);
-
+
gui_gtk_notebook1 = gtk_notebook_new ();
gtk_widget_show (gui_gtk_notebook1);
gtk_box_pack_start (GTK_BOX (gui_gtk_vbox1), gui_gtk_notebook1, TRUE, TRUE, 0);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (gui_gtk_notebook1), GTK_POS_BOTTOM);
-
+
gui_gtk_vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (gui_gtk_vbox2);
gtk_container_add (GTK_CONTAINER (gui_gtk_notebook1), gui_gtk_vbox2);
-
+
gui_gtk_hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (gui_gtk_hbox1);
gtk_box_pack_start (GTK_BOX (gui_gtk_vbox2), gui_gtk_hbox1, TRUE, TRUE, 0);
-
+
gui_gtk_hpaned1 = gtk_hpaned_new ();
gtk_widget_show (gui_gtk_hpaned1);
gtk_box_pack_start (GTK_BOX (gui_gtk_hbox1), gui_gtk_hpaned1, TRUE, TRUE, 0);
gtk_paned_set_position (GTK_PANED (gui_gtk_hpaned1), 0);
-
+
gui_gtk_scrolledwindow_chat = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (gui_gtk_scrolledwindow_chat);
gtk_paned_pack1 (GTK_PANED (gui_gtk_hpaned1), gui_gtk_scrolledwindow_chat,
@@ -148,7 +148,7 @@ gui_main_init ()
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_widget_modify_text (gui_gtk_scrolledwindow_chat, GTK_STATE_NORMAL, &color_fg);
gtk_widget_modify_base (gui_gtk_scrolledwindow_chat, GTK_STATE_NORMAL, &color_bg);
-
+
gui_gtk_scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (gui_gtk_scrolledwindow_nick);
gtk_paned_pack2 (GTK_PANED (gui_gtk_hpaned1), gui_gtk_scrolledwindow_nick,
@@ -158,45 +158,45 @@ gui_main_init ()
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_widget_modify_text (gui_gtk_scrolledwindow_nick, GTK_STATE_NORMAL, &color_fg);
gtk_widget_modify_base (gui_gtk_scrolledwindow_nick, GTK_STATE_NORMAL, &color_bg);
-
+
gui_gtk_entry_input = gtk_entry_new ();
gtk_widget_show (gui_gtk_entry_input);
gtk_box_pack_start (GTK_BOX (gui_gtk_vbox2), gui_gtk_entry_input, FALSE,
FALSE, 0);
gtk_widget_modify_text (gui_gtk_entry_input, GTK_STATE_NORMAL, &color_fg);
gtk_widget_modify_base (gui_gtk_entry_input, GTK_STATE_NORMAL, &color_bg);
-
+
gui_gtk_label1 = gtk_label_new (_("server"));
gtk_widget_show (gui_gtk_label1);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (gui_gtk_notebook1),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (gui_gtk_notebook1), 0),
gui_gtk_label1);
gtk_label_set_justify (GTK_LABEL (gui_gtk_label1), GTK_JUSTIFY_LEFT);
-
+
gtk_widget_show_all (gui_gtk_main_window);
-
+
gui_init_ok = 0;
-
+
/* create core buffer */
ptr_buffer = gui_buffer_new (NULL, "weechat", NULL, NULL, NULL, NULL);
if (ptr_buffer)
{
gui_init_ok = 1;
-
+
/* set title for core buffer */
gui_buffer_set_title (ptr_buffer,
"WeeChat " WEECHAT_COPYRIGHT_DATE
" - " WEECHAT_WEBSITE);
-
+
/* create main window (using full space) */
if (gui_window_new (NULL, ptr_buffer, 0, 0, 0, 0, 100, 100))
{
gui_current_window = gui_windows;
-
+
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
}
-
+
/*
* create bar windows for root bars (they were read from config,
* but no window was created (GUI was not initialized)
@@ -243,18 +243,18 @@ gui_main_end (int clean_exit)
/* remove bar items and bars */
gui_bar_item_end ();
gui_bar_free_all ();
-
+
/* remove filters */
gui_filter_free_all ();
-
+
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
-
+
/* delete layout saved */
gui_layout_window_remove_all (&gui_layout_windows);
gui_layout_buffer_remove_all (&gui_layout_buffers, &last_gui_layout_buffer);
-
+
/* delete all windows */
while (gui_windows)
{
@@ -262,23 +262,23 @@ gui_main_end (int clean_exit)
/* TODO: destroy Gtk widgets */
}
gui_window_tree_free (&gui_windows_tree);
-
+
/* delete all buffers */
while (gui_buffers)
{
gui_buffer_close (gui_buffers);
}
-
+
/* delete global history */
gui_history_global_free ();
-
+
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_set_title (NULL);
-
+
/* end color */
gui_color_end ();
-
+
/* free some variables used for chat area */
gui_chat_end ();
}
diff --git a/src/gui/gtk/gui-gtk-mouse.c b/src/gui/gtk/gui-gtk-mouse.c
index 65c1bfe56..535a4a571 100644
--- a/src/gui/gtk/gui-gtk-mouse.c
+++ b/src/gui/gtk/gui-gtk-mouse.c
@@ -67,7 +67,7 @@ void
gui_mouse_grab_init (int area)
{
(void) area;
-
+
/* This function does nothing in Gtk GUI */
}
@@ -89,9 +89,9 @@ const char *
gui_mouse_event_code2key (const char *code)
{
(void) code;
-
+
/* This function does nothing in Gtk GUI */
-
+
return NULL;
}
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index 3c44bb418..8fefbea2e 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -70,7 +70,7 @@ int
gui_window_objects_init (struct t_gui_window *window)
{
struct t_gui_window_gtk_objects *new_objects;
-
+
if ((new_objects = malloc (sizeof (*new_objects))))
{
window->gui_objects = new_objects;
@@ -131,7 +131,7 @@ gui_window_draw_separator (struct t_gui_window *window)
/* TODO: write this function for Gtk */
/*if (window->win_separator)
delwin (window->win_separator);
-
+
if (window->win_x > 0)
{
window->win_separator = newwin (window->win_height,
@@ -176,14 +176,14 @@ gui_window_switch (struct t_gui_window *window)
{
if (gui_current_window == window)
return;
-
+
/* remove unused bars from current window */
/* ... */
-
+
gui_current_window = window;
-
+
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
-
+
gui_window_redraw_buffer (gui_current_window->buffer);
}
@@ -197,9 +197,9 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
int set_last_read)
{
GtkTextIter start, end;
-
+
gui_buffer_add_value_num_displayed (window->buffer, -1);
-
+
if (window->buffer != buffer)
{
window->scroll->start_line = NULL;
@@ -223,10 +223,10 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
}
}
}
-
+
window->buffer = buffer;
gui_window_calculate_pos_size (window);
-
+
if (!GUI_WINDOW_OBJECTS(window)->textview_chat)
{
GUI_WINDOW_OBJECTS(window)->textview_chat = gtk_text_view_new ();
@@ -235,20 +235,20 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
gtk_widget_set_size_request (GUI_WINDOW_OBJECTS(window)->textview_chat, 300, -1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (GUI_WINDOW_OBJECTS(window)->textview_chat), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (GUI_WINDOW_OBJECTS(window)->textview_chat), FALSE);
-
+
GUI_WINDOW_OBJECTS(window)->textbuffer_chat = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (GUI_WINDOW_OBJECTS(window)->textview_chat), GUI_WINDOW_OBJECTS(window)->textbuffer_chat);
-
+
/*GUI_WINDOW_OBJECTS(window)->texttag_chat = gtk_text_buffer_create_tag(GUI_WINDOW_OBJECTS(window)->textbuffer_chat, "courier", "font_family", "lucida");*/
gtk_text_buffer_get_bounds (GUI_WINDOW_OBJECTS(window)->textbuffer_chat, &start, &end);
gtk_text_buffer_apply_tag (GUI_WINDOW_OBJECTS(window)->textbuffer_chat, GUI_WINDOW_OBJECTS(window)->texttag_chat, &start, &end);
}
-
+
window->scroll->start_line = NULL;
window->scroll->start_line_pos = 0;
-
+
gui_buffer_add_value_num_displayed (buffer, 1);
-
+
gui_hotlist_remove_buffer (buffer);
}
@@ -261,7 +261,7 @@ gui_window_page_up (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
if (!window->scroll->first_line_displayed)
{
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
@@ -282,16 +282,16 @@ gui_window_page_down (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
int line_pos;
-
+
if (!gui_ok)
return;
-
+
if (window->scroll->start_line)
{
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
&window->scroll->start_line_pos,
window->win_chat_height - 1);
-
+
/* check if we can display all */
ptr_line = window->scroll->start_line;
line_pos = window->scroll->start_line_pos;
@@ -303,7 +303,7 @@ gui_window_page_down (struct t_gui_window *window)
window->scroll->start_line = NULL;
window->scroll->start_line_pos = 0;
}
-
+
gui_chat_draw (window->buffer, 0);
}
}
@@ -317,7 +317,7 @@ gui_window_scroll_up (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
if (!window->scroll->first_line_displayed)
{
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
@@ -339,29 +339,29 @@ gui_window_scroll_down (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
int line_pos;
-
+
if (!gui_ok)
return;
-
+
if (window->scroll->start_line)
{
gui_chat_calculate_line_diff (window, &window->scroll->start_line,
&window->scroll->start_line_pos,
CONFIG_INTEGER(config_look_scroll_amount));
-
+
/* check if we can display all */
ptr_line = window->scroll->start_line;
line_pos = window->scroll->start_line_pos;
gui_chat_calculate_line_diff (window, &ptr_line,
&line_pos,
window->win_chat_height - 1);
-
+
if (!ptr_line)
{
window->scroll->start_line = NULL;
window->scroll->start_line_pos = 0;
}
-
+
gui_chat_draw (window->buffer, 0);
}
}
@@ -375,7 +375,7 @@ gui_window_scroll_top (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
if (!window->scroll->first_line_displayed)
{
window->scroll->start_line = window->buffer->lines->first_line;
@@ -393,7 +393,7 @@ gui_window_scroll_bottom (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
if (window->scroll->start_line)
{
window->scroll->start_line = NULL;
@@ -415,7 +415,7 @@ gui_window_auto_resize (struct t_gui_window_tree *tree,
int simulate)
{
int size1, size2;
-
+
if (tree)
{
if (tree->window)
@@ -465,7 +465,7 @@ void
gui_window_refresh_windows ()
{
/*struct t_gui_window *ptr_win, *old_current_window;*/
-
+
if (gui_ok)
{
/* TODO: write this function for Gtk */
@@ -481,15 +481,15 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int height1, height2;
-
+
if (!gui_ok)
return NULL;
-
+
new_window = NULL;
-
+
height1 = (window->win_height * percentage) / 100;
height2 = window->win_height - height1;
-
+
if ((percentage > 0) && (percentage <= 100))
{
new_window = gui_window_new (window, window->buffer,
@@ -502,18 +502,18 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage)
window->win_y = new_window->win_y + new_window->win_height;
window->win_height = height2;
window->win_height_pct = 100 - percentage;
-
+
/* assign same buffer for new window (top window) */
gui_buffer_add_value_num_displayed (new_window->buffer, 1);
-
+
gui_window_switch_to_buffer (window, window->buffer, 1);
-
+
gui_current_window = new_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
-
+
return new_window;
}
@@ -526,15 +526,15 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int width1, width2;
-
+
if (!gui_ok)
return NULL;
-
+
new_window = NULL;
-
+
width1 = (window->win_width * percentage) / 100;
width2 = window->win_width - width1 - 1;
-
+
if ((percentage > 0) && (percentage <= 100))
{
new_window = gui_window_new (window, window->buffer,
@@ -546,21 +546,21 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage)
/* reduce old window height (left window) */
window->win_width = width1;
window->win_width_pct = 100 - percentage;
-
+
/* assign same buffer for new window (right window) */
gui_buffer_add_value_num_displayed (new_window->buffer, 1);
-
+
gui_window_switch_to_buffer (window, window->buffer, 1);
-
+
gui_current_window = new_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
-
+
/* create & draw separator */
gui_window_draw_separator (gui_current_window);
}
}
-
+
return new_window;
}
@@ -596,16 +596,16 @@ int
gui_window_merge (struct t_gui_window *window)
{
struct t_gui_window_tree *parent, *sister;
-
+
parent = window->ptr_tree->parent_node;
if (parent)
{
sister = (parent->child1->window == window) ?
parent->child2 : parent->child1;
-
+
if (!(sister->window))
return 0;
-
+
if (window->win_y == sister->window->win_y)
{
/* horizontal merge */
@@ -622,10 +622,10 @@ gui_window_merge (struct t_gui_window *window)
window->win_x = sister->window->win_x;
if (sister->window->win_y < window->win_y)
window->win_y = sister->window->win_y;
-
+
gui_window_free (sister->window);
gui_window_tree_node_to_leaf (parent, window);
-
+
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_window_redraw_buffer (window->buffer);
return 1;
@@ -685,7 +685,7 @@ gui_window_side_by_side (struct t_gui_window *win1, struct t_gui_window *win2)
return 0;
return 3;
}
-
+
/* win2 on the left ? */
if (win2->win_x + win2->win_width + 1 == win1->win_x)
{
@@ -707,7 +707,7 @@ void
gui_window_switch_up (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -730,7 +730,7 @@ void
gui_window_switch_down (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -753,7 +753,7 @@ void
gui_window_switch_left (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -776,7 +776,7 @@ void
gui_window_switch_right (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
-
+
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
@@ -801,7 +801,7 @@ int
gui_window_balance (struct t_gui_window_tree *tree)
{
(void) tree;
-
+
/* TODO: write this function for Gtk */
return 0;
}
@@ -820,7 +820,7 @@ gui_window_swap (struct t_gui_window *window, int direction)
{
(void) window;
(void) direction;
-
+
/* TODO: write this function for Gtk */
}
@@ -832,7 +832,7 @@ void
gui_window_refresh_screen (int full_refresh)
{
(void) full_refresh;
-
+
/* TODO: write this function for Gtk */
}
@@ -844,7 +844,7 @@ void
gui_window_set_title (const char *title)
{
(void) title;
-
+
/* TODO: write this function for Gtk */
}
@@ -857,7 +857,7 @@ gui_window_send_clipboard (const char *storage_unit, const char *text)
{
(void) storage_unit;
(void) text;
-
+
/* TODO: write this function for Gtk */
}
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 57b64c531..42eacc543 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -94,17 +94,17 @@ int
gui_bar_item_valid (struct t_gui_bar_item *bar_item)
{
struct t_gui_bar_item *ptr_bar_item;
-
+
if (!bar_item)
return 0;
-
+
for (ptr_bar_item = gui_bar_items; ptr_bar_item;
ptr_bar_item = ptr_bar_item->next_item)
{
if (ptr_bar_item == bar_item)
return 1;
}
-
+
/* bar item not found */
return 0;
}
@@ -117,16 +117,16 @@ struct t_gui_bar_item *
gui_bar_item_search (const char *item_name)
{
struct t_gui_bar_item *ptr_item;
-
+
if (!item_name || !item_name[0])
return NULL;
-
+
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
{
if (strcmp (ptr_item->name, item_name) == 0)
return ptr_item;
}
-
+
/* bar item not found */
return NULL;
}
@@ -146,13 +146,13 @@ gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin,
{
struct t_gui_bar_item *ptr_item, *item_found_plugin;
struct t_gui_bar_item *item_found_without_plugin;
-
+
if (!item_name || !item_name[0])
return NULL;
-
+
item_found_plugin = NULL;
item_found_without_plugin = NULL;
-
+
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
{
if (strcmp (ptr_item->name, item_name) == 0)
@@ -168,10 +168,10 @@ gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin,
}
}
}
-
+
if (item_found_without_plugin)
return item_found_without_plugin;
-
+
return item_found_plugin;
}
@@ -186,9 +186,9 @@ gui_bar_item_used_in_a_bar (const char *item_name, int partial_name)
{
struct t_gui_bar *ptr_bar;
int i, j, length;
-
+
length = strlen (item_name);
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
for (i = 0; i < ptr_bar->items_count; i++)
@@ -210,7 +210,7 @@ gui_bar_item_used_in_a_bar (const char *item_name, int partial_name)
}
}
}
-
+
/* item not used by any bar */
return 0;
}
@@ -230,17 +230,17 @@ gui_bar_item_set_prefix_name_suffix (const char *item_name,
{
const char *ptr, *start, *end;
int valid_char;
-
+
*prefix = NULL;
*name = NULL;
*suffix = NULL;
-
+
if (!item_name)
return;
-
+
start = NULL;
end = NULL;
-
+
ptr = item_name;
while (ptr[0])
{
@@ -290,10 +290,10 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
int length;
struct t_gui_bar_item *ptr_item;
struct t_weechat_plugin *ptr_plugin;
-
+
if (!bar->items_array[item][subitem])
return NULL;
-
+
item_value = NULL;
if (bar->items_name[item][subitem])
{
@@ -317,7 +317,7 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
if (!item_value)
return NULL;
}
-
+
length = 0;
if (bar->items_prefix[item][subitem])
length += 64 + strlen (bar->items_prefix[item][subitem]) + 1; /* color + prefix + color */
@@ -325,7 +325,7 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
length += strlen (item_value) + 1;
if (bar->items_suffix[item][subitem])
length += 32 + strlen (bar->items_suffix[item][subitem]) + 1; /* color + suffix */
-
+
result = NULL;
if (length > 0)
{
@@ -359,7 +359,7 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
str_attr,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_FG]) & GUI_COLOR_EXTENDED_MASK);
}
-
+
/* color for bar delimiters */
gui_color_attr_build_string (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]),
str_attr);
@@ -393,10 +393,10 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
(bar->items_suffix[item][subitem]) ? bar->items_suffix[item][subitem] : "");
}
}
-
+
if (item_value)
free (item_value);
-
+
return result;
}
@@ -408,10 +408,10 @@ int
gui_bar_item_count_lines (char *string)
{
int count, i;
-
+
if (!string || !string[0])
return 0;
-
+
count = 1;
i = 0;
while (string[i])
@@ -420,7 +420,7 @@ gui_bar_item_count_lines (char *string)
count++;
i++;
}
-
+
return count;
}
@@ -436,14 +436,14 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
void *build_callback_data)
{
struct t_gui_bar_item *new_bar_item;
-
+
if (!name || !name[0])
return NULL;
-
+
/* it's not possible to create 2 bar items with same name for same plugin */
if (gui_bar_item_search_with_plugin (plugin, 1, name))
return NULL;
-
+
/* create bar item */
new_bar_item = malloc (sizeof (*new_bar_item));
if (new_bar_item)
@@ -452,7 +452,7 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
new_bar_item->name = strdup (name);
new_bar_item->build_callback = build_callback;
new_bar_item->build_callback_data = build_callback_data;
-
+
/* add bar item to bar items queue */
new_bar_item->prev_item = last_gui_bar_item;
if (gui_bar_items)
@@ -461,10 +461,10 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
gui_bar_items = new_bar_item;
last_gui_bar_item = new_bar_item;
new_bar_item->next_item = NULL;
-
+
return new_bar_item;
}
-
+
/* failed to create bar item */
return NULL;
}
@@ -480,7 +480,7 @@ gui_bar_item_update (const char *item_name)
struct t_gui_window *ptr_window;
struct t_gui_bar_window *ptr_bar_window;
int i, j;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
for (i = 0; i < ptr_bar->items_count; i++)
@@ -526,7 +526,7 @@ gui_bar_item_free (struct t_gui_bar_item *item)
{
/* force refresh of bars displaying this bar item */
gui_bar_item_update (item->name);
-
+
/* remove bar item from bar items list */
if (item->prev_item)
(item->prev_item)->next_item = item->next_item;
@@ -536,11 +536,11 @@ gui_bar_item_free (struct t_gui_bar_item *item)
gui_bar_items = item->next_item;
if (last_gui_bar_item == item)
last_gui_bar_item = item->prev_item;
-
+
/* free data */
if (item->name)
free (item->name);
-
+
free (item);
}
@@ -570,10 +570,10 @@ gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin)
while (ptr_item)
{
next_item = ptr_item->next_item;
-
+
if (ptr_item->plugin == plugin)
gui_bar_item_free (ptr_item);
-
+
ptr_item = next_item;
}
}
@@ -589,14 +589,14 @@ gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
char *text_paste_pending = N_("%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No");
char *ptr_message, *buf;
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (window && (window != gui_current_window))
return NULL;
-
+
if (!gui_key_paste_pending)
return NULL;
@@ -607,7 +607,7 @@ gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
snprintf (buf, length, ptr_message,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_actions))),
gui_key_get_paste_lines ());
-
+
return buf;
}
@@ -620,19 +620,19 @@ gui_bar_item_default_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
const char *nick;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
nick = (const char *)hashtable_get (window->buffer->local_variables,
"nick");
if (!nick)
return NULL;
-
+
return strdup (nick);
}
@@ -648,17 +648,17 @@ gui_bar_item_default_input_search (void *data, struct t_gui_bar_item *item,
char *text_search_exact = N_("Text search (exact)");
char *ptr_message, *buf;
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
if (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
return NULL;
-
+
ptr_message = (window->buffer->text_search_exact) ?
_(text_search_exact) : _(text_search);
length = 16 + strlen (ptr_message) + 1;
@@ -673,7 +673,7 @@ gui_bar_item_default_input_search (void *data, struct t_gui_bar_item *item,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_text_not_found))),
ptr_message);
}
-
+
return buf;
}
@@ -689,14 +689,14 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
char str_cursor[16], *buf;
const char *pos_cursor;
int length, length_cursor, length_start_input, buf_pos;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
snprintf (str_cursor, sizeof (str_cursor), "%c%c%c",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_BAR_CHAR,
@@ -707,11 +707,11 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_START_INPUT_CHAR);
length_start_input = strlen (str_start_input);
-
+
/* for modifiers */
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)(window->buffer));
-
+
/* execute modifier with basic string (without cursor tag) */
ptr_input = NULL;
if (!gui_cursor_mode)
@@ -727,7 +727,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
ptr_input = (window->buffer->input_buffer) ?
strdup (window->buffer->input_buffer) : NULL;
}
-
+
/* insert "move cursor" id in string */
if (ptr_input)
{
@@ -738,10 +738,10 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
if (buf)
{
buf_pos = 0;
-
+
if (!pos_cursor)
pos_cursor = ptr_input;
-
+
/* add beginning of buffer */
if (pos_cursor != ptr_input)
{
@@ -753,7 +753,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
str_cursor);
/* add end of buffer */
strcat (buf, pos_cursor);
-
+
free (ptr_input);
ptr_input = buf;
}
@@ -762,7 +762,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
{
ptr_input = strdup (str_cursor);
}
-
+
/* execute modifier with cursor in string */
if (!gui_cursor_mode)
{
@@ -774,7 +774,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
free (ptr_input);
ptr_input = ptr_input2;
}
-
+
/* insert "start input" at beginning of string */
if (ptr_input)
{
@@ -796,7 +796,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
snprintf (ptr_input, length, "%s%s", str_start_input, str_cursor);
}
}
-
+
return ptr_input;
}
@@ -811,23 +811,23 @@ gui_bar_item_default_time (void *data, struct t_gui_bar_item *item,
time_t date;
struct tm *local_time;
char text_time[128], text_time2[128];
-
+
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
-
+
date = time (NULL);
local_time = localtime (&date);
if (strftime (text_time, sizeof (text_time),
CONFIG_STRING(config_look_item_time_format),
local_time) == 0)
return NULL;
-
+
snprintf (text_time2, sizeof (text_time2), "%s%s",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_time))),
text_time);
-
+
return strdup (text_time2);
}
@@ -840,15 +840,15 @@ gui_bar_item_default_buffer_count (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[32];
-
+
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
-
+
snprintf (buf, sizeof (buf), "%d",
(last_gui_buffer) ? last_gui_buffer->number : 0);
-
+
return strdup (buf);
}
@@ -861,14 +861,14 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
const char *plugin_name;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
plugin_name = gui_buffer_get_plugin_name (window->buffer);
return (plugin_name) ? strdup (plugin_name) : strdup ("");
}
@@ -882,18 +882,18 @@ gui_bar_item_default_buffer_number (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[64];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
snprintf (buf, sizeof (buf), "%s%d",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_number))),
window->buffer->number);
-
+
return strdup (buf);
}
@@ -906,18 +906,18 @@ gui_bar_item_default_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[256];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
snprintf (buf, sizeof (buf), "%s%s",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_name))),
window->buffer->name);
-
+
return strdup (buf);
}
@@ -930,22 +930,22 @@ gui_bar_item_default_buffer_filter (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[512];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
if (!gui_filters_enabled || !gui_filters || !window->buffer->lines->lines_hidden)
return NULL;
-
+
snprintf (buf, sizeof (buf),
"%s%s",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_filter))),
CONFIG_STRING(config_look_item_buffer_filter));
-
+
return strdup (buf);
}
@@ -960,20 +960,20 @@ gui_bar_item_default_buffer_nicklist_count (void *data,
struct t_gui_window *window)
{
char buf[32];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
if (!window->buffer->nicklist)
return NULL;
-
+
snprintf (buf, sizeof (buf), "%d",
window->buffer->nicklist_visible_count);
-
+
return strdup (buf);
}
@@ -986,21 +986,21 @@ gui_bar_item_default_scroll (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[64];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
if (!window->scroll->scrolling)
return NULL;
-
+
snprintf (buf, sizeof (buf), _("%s-MORE(%d)-"),
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_more))),
window->scroll->lines_after);
-
+
return strdup (buf);
}
@@ -1016,20 +1016,20 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
struct t_gui_hotlist *ptr_hotlist;
int numbers_count, names_count, display_name, count_max;
int priority, priority_min, priority_min_displayed, private;
-
+
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
-
+
if (!gui_hotlist)
return NULL;
-
+
buf[0] = '\0';
-
+
/* TRANSLATORS: if possible use short word or abbreviation here ("Act" is abbreviation of "Activity" in english) */
strcat (buf, _("Act: "));
-
+
buffer_without_name_displayed = NULL;
if (CONFIG_BOOLEAN(config_look_hotlist_unique_numbers) && last_gui_buffer)
{
@@ -1037,7 +1037,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
if (buffer_without_name_displayed)
memset (buffer_without_name_displayed, 0, last_gui_buffer->number);
}
-
+
numbers_count = 0;
names_count = 0;
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
@@ -1061,13 +1061,13 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
display_name = 0;
break;
}
-
+
display_name = ((CONFIG_BOOLEAN(config_look_hotlist_names_merged_buffers)
&& (gui_buffer_count_merged_buffers (ptr_hotlist->buffer->number) > 1))
|| (display_name
&& (CONFIG_INTEGER(config_look_hotlist_names_count) != 0)
&& (names_count < CONFIG_INTEGER(config_look_hotlist_names_count))));
-
+
if (display_name || !buffer_without_name_displayed
|| (buffer_without_name_displayed[ptr_hotlist->buffer->number - 1] == 0))
{
@@ -1078,7 +1078,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, CONFIG_STRING(config_look_hotlist_buffer_separator));
}
-
+
switch (ptr_hotlist->priority)
{
case GUI_HOTLIST_LOW:
@@ -1102,11 +1102,11 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
}
sprintf (buf + strlen (buf), "%d", ptr_hotlist->buffer->number);
numbers_count++;
-
+
if (display_name)
{
names_count++;
-
+
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, ":");
strcat (buf, GUI_COLOR_CUSTOM_BAR_FG);
@@ -1125,7 +1125,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
if (buffer_without_name_displayed)
buffer_without_name_displayed[ptr_hotlist->buffer->number - 1] = 1;
}
-
+
/* display messages count by priority */
if (CONFIG_INTEGER(config_look_hotlist_count_max) > 0)
{
@@ -1200,15 +1200,15 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
strcat (buf, ")");
}
}
-
+
if (strlen (buf) > sizeof (buf) - 64)
break;
}
}
-
+
if (buffer_without_name_displayed)
free (buffer_without_name_displayed);
-
+
return strdup (buf);
}
@@ -1223,25 +1223,25 @@ gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
int length;
char *buf, number_str[16];
struct t_gui_completion_partial *ptr_item;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
if (!window->buffer->completion
|| !window->buffer->completion->partial_completion_list)
return NULL;
-
+
length = 1;
for (ptr_item = window->buffer->completion->partial_completion_list;
ptr_item; ptr_item = ptr_item->next_item)
{
length += strlen (ptr_item->word) + 32;
}
-
+
buf = malloc (length);
if (buf)
{
@@ -1264,7 +1264,7 @@ gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
strcat (buf, " ");
}
}
-
+
return buf;
}
@@ -1279,10 +1279,10 @@ gui_bar_item_default_buffer_title (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
return (window->buffer->title) ?
strdup (window->buffer->title) : NULL;
}
@@ -1300,14 +1300,14 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
struct t_config_option *ptr_option;
int i, length;
char *buf;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
length = 1;
ptr_group = NULL;
ptr_nick = NULL;
@@ -1349,7 +1349,7 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
{
if (buf[0])
strcat (buf, "\n");
-
+
if (ptr_nick)
{
if (window->buffer->nicklist_display_groups)
@@ -1420,7 +1420,7 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
}
}
-
+
return buf;
}
@@ -1433,16 +1433,16 @@ gui_bar_item_default_window_number (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[64];
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = gui_current_window;
-
+
snprintf (buf, sizeof (buf), "%d", window->number);
-
+
return strdup (buf);
}
@@ -1461,30 +1461,30 @@ gui_bar_item_focus_buffer_nicklist (void *data,
const char *str_window, *str_bar_item_line;
struct t_gui_window *window;
char *error;
-
+
/* make C compiler happy */
(void) data;
-
+
str_window = hashtable_get (info, "_window");
str_bar_item_line = hashtable_get (info, "_bar_item_line");
-
+
if (!str_window || !str_window[0]
|| !str_bar_item_line || !str_bar_item_line[0])
return NULL;
-
+
rc = sscanf (str_window, "%lx", &value);
if ((rc == EOF) || (rc == 0))
return NULL;
-
+
window = (struct t_gui_window *)value;
if (!window)
return NULL;
-
+
error = NULL;
bar_item_line = (int) strtol (str_bar_item_line, &error, 10);
if (!error || error[0])
return NULL;
-
+
i = 0;
ptr_group = NULL;
ptr_nick = NULL;
@@ -1502,10 +1502,10 @@ gui_bar_item_focus_buffer_nicklist (void *data,
}
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
}
-
+
if (i != bar_item_line)
return NULL;
-
+
if (ptr_nick)
{
hashtable_set (info, "nick", ptr_nick->name);
@@ -1531,17 +1531,17 @@ gui_bar_item_timer_cb (void *data, int remaining_calls)
struct tm *local_time;
static char item_time_text[128] = { '\0' };
char new_item_time_text[128];
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
date = time (NULL);
local_time = localtime (&date);
if (strftime (new_item_time_text, sizeof (new_item_time_text),
CONFIG_STRING(config_look_item_time_format),
local_time) == 0)
return WEECHAT_RC_OK;
-
+
/*
* we update item only if it changed since last time
* for example if time is only hours:minutes, we'll update
@@ -1553,7 +1553,7 @@ gui_bar_item_timer_cb (void *data, int remaining_calls)
"%s", new_item_time_text);
gui_bar_item_update ((char *)data);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1570,9 +1570,9 @@ gui_bar_item_signal_cb (void *data, const char *signal,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
gui_bar_item_update ((char *)data);
-
+
return WEECHAT_RC_OK;
}
@@ -1584,7 +1584,7 @@ void
gui_bar_item_hook_signal (const char *signal, const char *item)
{
struct t_gui_bar_item_hook *bar_item_hook;
-
+
bar_item_hook = malloc (sizeof (*bar_item_hook));
if (bar_item_hook)
{
@@ -1604,14 +1604,14 @@ void
gui_bar_item_init ()
{
char name[128];
-
+
/* input paste */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE],
&gui_bar_item_default_input_paste, NULL);
gui_bar_item_hook_signal ("input_paste_pending",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE]);
-
+
/* input prompt */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT],
@@ -1620,7 +1620,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT]);
gui_bar_item_hook_signal ("buffer_switch",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT]);
-
+
/* input search */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH],
@@ -1629,7 +1629,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH]);
gui_bar_item_hook_signal ("input_text_changed",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH]);
-
+
/* input text */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT],
@@ -1638,14 +1638,14 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
gui_bar_item_hook_signal ("buffer_switch",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
-
+
/* time */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_TIME],
&gui_bar_item_default_time, NULL);
gui_bar_item_timer = hook_timer (NULL, 1000, 1, 0, &gui_bar_item_timer_cb,
gui_bar_item_names[GUI_BAR_ITEM_TIME]);
-
+
/* buffer count */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT],
@@ -1654,7 +1654,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT]);
gui_bar_item_hook_signal ("buffer_closed",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT]);
-
+
/* buffer plugin */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN],
@@ -1663,7 +1663,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN]);
gui_bar_item_hook_signal ("buffer_renamed",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN]);
-
+
/* buffer number */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NUMBER],
@@ -1678,7 +1678,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NUMBER]);
gui_bar_item_hook_signal ("buffer_closed",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NUMBER]);
-
+
/* buffer name */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NAME],
@@ -1689,7 +1689,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NAME]);
gui_bar_item_hook_signal ("buffer_moved",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NAME]);
-
+
/* buffer filter */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER],
@@ -1698,7 +1698,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER]);
gui_bar_item_hook_signal ("filters_*",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER]);
-
+
/* buffer nicklist count */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT],
@@ -1707,14 +1707,14 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT]);
gui_bar_item_hook_signal ("nicklist_*",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT]);
-
+
/* scroll indicator */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_SCROLL],
&gui_bar_item_default_scroll, NULL);
gui_bar_item_hook_signal ("window_scrolled",
gui_bar_item_names[GUI_BAR_ITEM_SCROLL]);
-
+
/* hotlist */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_HOTLIST],
@@ -1725,14 +1725,14 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_HOTLIST]);
gui_bar_item_hook_signal ("buffer_closed",
gui_bar_item_names[GUI_BAR_ITEM_HOTLIST]);
-
+
/* completion (possible words when a partial completion occurs) */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_COMPLETION],
&gui_bar_item_default_completion, NULL);
gui_bar_item_hook_signal ("partial_completion",
gui_bar_item_names[GUI_BAR_ITEM_COMPLETION]);
-
+
/* buffer title */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_TITLE],
@@ -1741,7 +1741,7 @@ gui_bar_item_init ()
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_TITLE]);
gui_bar_item_hook_signal ("buffer_switch",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_TITLE]);
-
+
/* buffer nicklist */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST],
@@ -1753,7 +1753,7 @@ gui_bar_item_init ()
snprintf (name, sizeof (name), "2000|%s",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST]);
hook_focus (NULL, name, &gui_bar_item_focus_buffer_nicklist, NULL);
-
+
/* window number */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_WINDOW_NUMBER],
@@ -1770,18 +1770,18 @@ void
gui_bar_item_end ()
{
struct t_gui_bar_item_hook *next_bar_item_hook;
-
+
/* remove hooks */
while (gui_bar_item_hooks)
{
next_bar_item_hook = gui_bar_item_hooks->next_hook;
-
+
unhook (gui_bar_item_hooks->hook);
free (gui_bar_item_hooks);
-
+
gui_bar_item_hooks = next_bar_item_hook;
}
-
+
/* remove bar items */
gui_bar_item_free_all ();
}
@@ -1794,10 +1794,10 @@ struct t_hdata *
gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
if (hdata)
{
@@ -1823,14 +1823,14 @@ gui_bar_item_add_to_infolist (struct t_infolist *infolist,
struct t_gui_bar_item *bar_item)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !bar_item)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_pointer (ptr_item, "plugin", bar_item->plugin))
return 0;
if (!infolist_new_var_string (ptr_item, "name", bar_item->name))
@@ -1839,7 +1839,7 @@ gui_bar_item_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_pointer (ptr_item, "build_callback_data", bar_item->build_callback_data))
return 0;
-
+
return 1;
}
@@ -1851,7 +1851,7 @@ void
gui_bar_item_print_log ()
{
struct t_gui_bar_item *ptr_item;
-
+
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
{
log_printf ("");
diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c
index a87aec710..2523b85ef 100644
--- a/src/gui/gui-bar-window.c
+++ b/src/gui/gui-bar-window.c
@@ -57,17 +57,17 @@ gui_bar_window_valid (struct t_gui_bar_window *bar_window)
struct t_gui_bar *ptr_bar;
struct t_gui_window *ptr_window;
struct t_gui_bar_window *ptr_bar_window;
-
+
if (!bar_window)
return 0;
-
+
/* check root bars */
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (ptr_bar->bar_window && (ptr_bar->bar_window == bar_window))
return 1;
}
-
+
/* check window bars */
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
@@ -79,7 +79,7 @@ gui_bar_window_valid (struct t_gui_bar_window *bar_window)
return 1;
}
}
-
+
/* bar window not found */
return 0;
}
@@ -99,7 +99,7 @@ gui_bar_window_search_bar (struct t_gui_window *window, struct t_gui_bar *bar)
if (ptr_bar_win->bar == bar)
return ptr_bar_win;
}
-
+
/* bar window not found for window */
return NULL;
}
@@ -122,12 +122,12 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
struct t_gui_bar_window *ptr_bar_window;
int filling, num_cols, column, lines, lines_old, i, j, coord_x, coord_y;
int item, subitem;
-
+
*bar_window = NULL;
*bar_item = NULL;
*bar_item_line = -1;
*bar_item_col = -1;
-
+
if (window)
{
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
@@ -157,14 +157,14 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
}
}
}
-
+
if (*bar_window)
{
filling = gui_bar_get_filling ((*bar_window)->bar);
-
+
*bar_item_line = y - (*bar_window)->y + (*bar_window)->scroll_y;
*bar_item_col = x - (*bar_window)->x + (*bar_window)->scroll_x;
-
+
if ((filling == GUI_BAR_FILLING_COLUMNS_HORIZONTAL)
&& ((*bar_window)->screen_col_size > 0))
{
@@ -173,7 +173,7 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
*bar_item_line = (*bar_item_line * num_cols) + column;
*bar_item_col = *bar_item_col - (column * ((*bar_window)->screen_col_size));
}
-
+
if ((filling == GUI_BAR_FILLING_COLUMNS_VERTICAL)
&& ((*bar_window)->screen_col_size > 0))
{
@@ -181,7 +181,7 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
*bar_item_line = (column * ((*bar_window)->height)) + *bar_item_line;
*bar_item_col = *bar_item_col % ((*bar_window)->screen_col_size);
}
-
+
if (filling == GUI_BAR_FILLING_HORIZONTAL)
{
i = 0;
@@ -260,7 +260,7 @@ gui_bar_window_get_size (struct t_gui_bar *bar, struct t_gui_window *window,
{
struct t_gui_bar_window *ptr_bar_window;
int total_size;
-
+
total_size = 0;
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
@@ -305,10 +305,10 @@ gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window,
{
int x1, y1, x2, y2;
int add_bottom, add_top, add_left, add_right;
-
+
if (CONFIG_BOOLEAN(bar_window->bar->options[GUI_BAR_OPTION_HIDDEN]))
return;
-
+
if (window)
{
x1 = window->win_x;
@@ -331,7 +331,7 @@ gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window,
add_left = gui_bar_root_get_size (bar_window->bar, GUI_BAR_POSITION_LEFT);
add_right = gui_bar_root_get_size (bar_window->bar, GUI_BAR_POSITION_RIGHT);
}
-
+
switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]))
{
case GUI_BAR_POSITION_BOTTOM:
@@ -372,7 +372,7 @@ struct t_gui_bar_window *
gui_bar_window_find_pos (struct t_gui_bar *bar, struct t_gui_window *window)
{
struct t_gui_bar_window *ptr_bar_window;
-
+
for (ptr_bar_window = window->bar_windows; ptr_bar_window;
ptr_bar_window = ptr_bar_window->next_bar_window)
{
@@ -380,7 +380,7 @@ gui_bar_window_find_pos (struct t_gui_bar *bar, struct t_gui_window *window)
CONFIG_INTEGER(ptr_bar_window->bar->options[GUI_BAR_OPTION_PRIORITY]))
return ptr_bar_window;
}
-
+
/* position not found, best position is at the end */
return NULL;
}
@@ -416,14 +416,14 @@ gui_bar_window_content_alloc (struct t_gui_bar_window *bar_window)
sizeof (*bar_window->items_refresh_needed));
if (!bar_window->items_refresh_needed)
goto error;
-
+
for (i = 0; i < bar_window->items_count; i++)
{
bar_window->items_content[i] = NULL;
bar_window->items_num_lines[i] = NULL;
bar_window->items_refresh_needed[i] = NULL;
}
-
+
for (i = 0; i < bar_window->items_count; i++)
{
bar_window->items_subcount[i] = bar_window->bar->items_subcount[i];
@@ -450,7 +450,7 @@ gui_bar_window_content_alloc (struct t_gui_bar_window *bar_window)
}
}
return;
-
+
error:
if (bar_window->items_subcount)
{
@@ -497,7 +497,7 @@ void
gui_bar_window_content_free (struct t_gui_bar_window *bar_window)
{
int i, j;
-
+
if (bar_window->items_content)
{
for (i = 0; i < bar_window->items_count; i++)
@@ -545,7 +545,7 @@ gui_bar_window_content_build_item (struct t_gui_bar_window *bar_window,
bar_window->items_content[index_item][index_subitem] = NULL;
}
bar_window->items_num_lines[index_item][index_subitem] = 0;
-
+
/* build item, but only if there's a buffer in window */
if ((window && window->buffer)
|| (gui_current_window && gui_current_window->buffer))
@@ -571,10 +571,10 @@ gui_bar_window_content_build (struct t_gui_bar_window *bar_window,
struct t_gui_window *window)
{
int i, j;
-
+
gui_bar_window_content_free (bar_window);
gui_bar_window_content_alloc (bar_window);
-
+
for (i = 0; i < bar_window->items_count; i++)
{
for (j = 0; j < bar_window->items_subcount[i]; j++)
@@ -600,7 +600,7 @@ gui_bar_window_content_get (struct t_gui_bar_window *bar_window,
gui_bar_window_content_build_item (bar_window, window,
index_item, index_subitem);
}
-
+
/* return content */
return bar_window->items_content[index_item][index_subitem];
}
@@ -625,15 +625,15 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
int length_reinit_color_space, length_start_item, length;
int max_length, max_length_screen;
int total_items, columns, lines;
-
+
if (!bar_window->items_subcount || !bar_window->items_content
|| !bar_window->items_num_lines || !bar_window->items_refresh_needed)
return NULL;
-
+
snprintf (str_reinit_color, sizeof (str_reinit_color),
"%c",
GUI_COLOR_RESET_CHAR);
-
+
snprintf (str_reinit_color_space, sizeof (str_reinit_color_space),
"%c ",
GUI_COLOR_RESET_CHAR);
@@ -646,14 +646,14 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_START_LINE_ITEM);
-
+
snprintf (str_start_item, sizeof (str_start_item),
"%c%c%c",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_BAR_CHAR,
GUI_COLOR_BAR_START_ITEM);
length_start_item = strlen (str_start_item);
-
+
content_length = 1;
content = malloc (content_length);
if (content)
@@ -690,7 +690,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
}
else
item_value = NULL;
-
+
content_length += ((filling == GUI_BAR_FILLING_HORIZONTAL) ? length_start_item : 0) +
length_reinit_color_space +
strlen ((item_value) ? item_value : ptr_content);
@@ -719,7 +719,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
strcat (content,
(item_value) ? item_value : ptr_content);
first_sub_item = 0;
-
+
if (item_value)
free (item_value);
at_least_one_item = 1;
@@ -778,11 +778,11 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
for (j = 0; split_items[i][sub][j]; j++)
{
total_items++;
-
+
length = strlen (split_items[i][sub][j]);
if (length > max_length)
max_length = length;
-
+
length = gui_chat_strlen_screen (split_items[i][sub][j]);
if (length > max_length_screen)
max_length_screen = length;
@@ -813,9 +813,9 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
lines = bar_window->height;
}
bar_window->screen_col_size = max_length_screen + 1;
-
+
/* build array with pointers to split items */
-
+
linear_items = malloc (total_items * sizeof (*linear_items));
if (linear_items)
{
@@ -836,7 +836,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
}
}
}
-
+
/* build content with lines and columns */
content_length = 1 + (lines *
((columns *
@@ -859,7 +859,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
index = (i * columns) + j;
else
index = (j * lines) + i;
-
+
if (index >= total_items)
{
for (k = 0; k < max_length_screen; k++)
@@ -888,10 +888,10 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
content[index_content++] = '\n';
}
content[index_content] = '\0';
-
+
free (linear_items);
}
-
+
for (i = 0; i < bar_window->items_count; i++)
{
if (split_items[i])
@@ -909,13 +909,13 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
case GUI_BAR_NUM_FILLING:
break;
}
-
+
if (content_length == 1)
{
free (content);
content = NULL;
}
-
+
return content;
}
@@ -929,7 +929,7 @@ gui_bar_window_coords_add (struct t_gui_bar_window *bar_window,
int x, int y)
{
struct t_gui_bar_window_coords **coords2;
-
+
if (!bar_window->coords)
{
bar_window->coords_count = 1;
@@ -968,7 +968,7 @@ void
gui_bar_window_coords_free (struct t_gui_bar_window *bar_window)
{
int i;
-
+
if (bar_window->coords)
{
for (i = 0; i < bar_window->coords_count; i++)
@@ -991,7 +991,7 @@ gui_bar_window_insert (struct t_gui_bar_window *bar_window,
struct t_gui_window *window)
{
struct t_gui_bar_window *pos_bar_window;
-
+
if (window->bar_windows)
{
pos_bar_window = gui_bar_window_find_pos (bar_window->bar, window);
@@ -1033,17 +1033,17 @@ void
gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
{
struct t_gui_bar_window *new_bar_window;
-
+
if (CONFIG_BOOLEAN(bar->options[GUI_BAR_OPTION_HIDDEN]))
return;
-
+
if (window)
{
if ((CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW)
&& (!gui_bar_check_conditions_for_window (bar, window)))
return;
}
-
+
new_bar_window = malloc (sizeof (*new_bar_window));
if (new_bar_window)
{
@@ -1059,7 +1059,7 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
new_bar_window->prev_bar_window = NULL;
new_bar_window->next_bar_window = NULL;
}
-
+
new_bar_window->x = 0;
new_bar_window->y = 0;
new_bar_window->width = 1;
@@ -1080,7 +1080,7 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
new_bar_window->coords = NULL;
gui_bar_window_objects_init (new_bar_window);
gui_bar_window_content_alloc (new_bar_window);
-
+
if (gui_init_ok)
{
gui_bar_window_calculate_pos_size (new_bar_window, window);
@@ -1112,9 +1112,9 @@ gui_bar_window_get_max_size_in_window (struct t_gui_bar_window *bar_window,
struct t_gui_window *window)
{
int max_size;
-
+
max_size = 1;
-
+
if (bar_window && window)
{
switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]))
@@ -1133,7 +1133,7 @@ gui_bar_window_get_max_size_in_window (struct t_gui_bar_window *bar_window,
break;
}
}
-
+
return max_size;
}
@@ -1147,7 +1147,7 @@ gui_bar_window_get_max_size (struct t_gui_bar_window *bar_window,
{
int max_size_found, max_size;
struct t_gui_window *ptr_window;
-
+
if (window)
{
max_size_found = gui_bar_window_get_max_size_in_window (bar_window,
@@ -1167,7 +1167,7 @@ gui_bar_window_get_max_size (struct t_gui_bar_window *bar_window,
if (max_size_found == INT_MAX)
max_size_found = 1;
}
-
+
return max_size_found;
}
@@ -1180,7 +1180,7 @@ gui_bar_window_set_current_size (struct t_gui_bar_window *bar_window,
struct t_gui_window *window, int size)
{
int new_size, max_size;
-
+
if (size == 0)
new_size = 1;
else
@@ -1194,7 +1194,7 @@ gui_bar_window_set_current_size (struct t_gui_bar_window *bar_window,
new_size = 1;
}
}
-
+
if (bar_window->current_size != new_size)
{
max_size = gui_bar_window_get_max_size (bar_window, window);
@@ -1235,15 +1235,15 @@ gui_bar_window_free (struct t_gui_bar_window *bar_window,
if (window->last_bar_window == bar_window)
window->last_bar_window = bar_window->prev_bar_window;
}
-
+
/* free data */
gui_bar_window_content_free (bar_window);
gui_bar_window_coords_free (bar_window);
gui_bar_window_objects_free (bar_window);
free (bar_window->gui_objects);
-
+
free (bar_window);
-
+
gui_window_ask_refresh (1);
}
@@ -1258,24 +1258,24 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window)
{
int rc;
struct t_gui_bar_window *ptr_bar_win, *next_bar_win;
-
+
rc = 0;
ptr_bar_win = window->bar_windows;
while (ptr_bar_win)
{
next_bar_win = ptr_bar_win->next_bar_window;
-
+
if ((CONFIG_INTEGER(ptr_bar_win->bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW)
&& (!gui_bar_check_conditions_for_window (ptr_bar_win->bar, window)))
{
gui_bar_window_free (ptr_bar_win, window);
rc = 1;
}
-
+
ptr_bar_win = next_bar_win;
}
-
+
return rc;
}
@@ -1290,9 +1290,9 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
{
int rc;
struct t_gui_bar *ptr_bar;
-
+
rc = 0;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if ((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_WINDOW)
@@ -1305,7 +1305,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
}
}
}
-
+
return rc;
}
@@ -1323,7 +1323,7 @@ gui_bar_window_scroll (struct t_gui_bar_window *bar_window,
int add, int percent, int value)
{
int old_scroll_x, old_scroll_y;
-
+
old_scroll_x = bar_window->scroll_x;
old_scroll_y = bar_window->scroll_y;
@@ -1367,13 +1367,13 @@ gui_bar_window_scroll (struct t_gui_bar_window *bar_window,
bar_window->scroll_y -= value;
}
}
-
+
if (bar_window->scroll_x < 0)
bar_window->scroll_x = 0;
-
+
if (bar_window->scroll_y < 0)
bar_window->scroll_y = 0;
-
+
/* refresh only if scroll has changed (X and/or Y) */
if ((old_scroll_x != bar_window->scroll_x)
|| (old_scroll_y != bar_window->scroll_y))
@@ -1390,10 +1390,10 @@ struct t_hdata *
gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window");
if (hdata)
{
@@ -1434,14 +1434,14 @@ gui_bar_window_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
int i, j;
char option_name[64];
-
+
if (!infolist || !bar_window)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_pointer (ptr_item, "bar", bar_window->bar))
return 0;
if (!infolist_new_var_integer (ptr_item, "x", bar_window->x))
@@ -1484,7 +1484,7 @@ gui_bar_window_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_pointer (ptr_item, "gui_objects", bar_window->gui_objects))
return 0;
-
+
return 1;
}
@@ -1496,7 +1496,7 @@ void
gui_bar_window_print_log (struct t_gui_bar_window *bar_window)
{
int i, j;
-
+
log_printf ("");
log_printf (" [window bar (addr:0x%lx)]", bar_window);
log_printf (" bar. . . . . . . . . . : 0x%lx ('%s')",
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index baf9a5502..eef66d3b7 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -82,16 +82,16 @@ int
gui_bar_valid (struct t_gui_bar *bar)
{
struct t_gui_bar *ptr_bar;
-
+
if (!bar)
return 0;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (ptr_bar == bar)
return 1;
}
-
+
/* bar not found */
return 0;
}
@@ -106,16 +106,16 @@ int
gui_bar_search_option (const char *option_name)
{
int i;
-
+
if (!option_name)
return -1;
-
+
for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++)
{
if (string_strcasecmp (gui_bar_option_string[i], option_name) == 0)
return i;
}
-
+
/* bar option not found */
return -1;
}
@@ -129,16 +129,16 @@ int
gui_bar_search_type (const char *type)
{
int i;
-
+
if (!type)
return -1;
-
+
for (i = 0; i < GUI_BAR_NUM_TYPES; i++)
{
if (string_strcasecmp (gui_bar_type_string[i], type) == 0)
return i;
}
-
+
/* type not found */
return -1;
}
@@ -152,16 +152,16 @@ int
gui_bar_search_position (const char *position)
{
int i;
-
+
if (!position)
return -1;
-
+
for (i = 0; i < GUI_BAR_NUM_POSITIONS; i++)
{
if (string_strcasecmp (gui_bar_position_string[i], position) == 0)
return i;
}
-
+
/* position not found */
return -1;
}
@@ -179,10 +179,10 @@ gui_bar_get_min_width (struct t_gui_bar *bar)
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win;
int min_width;
-
+
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
return bar->bar_window->width;
-
+
min_width = INT_MAX;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -196,10 +196,10 @@ gui_bar_get_min_width (struct t_gui_bar *bar)
}
}
}
-
+
if (min_width == INT_MAX)
return 0;
-
+
return min_width;
}
@@ -216,10 +216,10 @@ gui_bar_get_min_height (struct t_gui_bar *bar)
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win;
int min_height;
-
+
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
return bar->bar_window->height;
-
+
min_height = INT_MAX;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -233,10 +233,10 @@ gui_bar_get_min_height (struct t_gui_bar *bar)
}
}
}
-
+
if (min_height == INT_MAX)
return 0;
-
+
return min_height;
}
@@ -251,10 +251,10 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size)
{
struct t_gui_window *ptr_window;
int sub_width, sub_height;
-
+
sub_width = 0;
sub_height = 0;
-
+
switch (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]))
{
case GUI_BAR_POSITION_BOTTOM:
@@ -268,7 +268,7 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size)
case GUI_BAR_NUM_POSITIONS:
break;
}
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
@@ -280,7 +280,7 @@ gui_bar_check_size_add (struct t_gui_bar *bar, int add_size)
return 0;
}
}
-
+
/* new size ok */
return 1;
}
@@ -296,7 +296,7 @@ gui_bar_get_filling (struct t_gui_bar *bar)
if ((CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_BOTTOM)
|| (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_POSITION]) == GUI_BAR_POSITION_TOP))
return CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM]);
-
+
return CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT]);
}
@@ -309,13 +309,13 @@ struct t_gui_bar *
gui_bar_find_pos (struct t_gui_bar *bar)
{
struct t_gui_bar *ptr_bar;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_PRIORITY]) >= CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_PRIORITY]))
return ptr_bar;
}
-
+
/* bar not found, add to end of list */
return NULL;
}
@@ -329,7 +329,7 @@ void
gui_bar_insert (struct t_gui_bar *bar)
{
struct t_gui_bar *pos_bar;
-
+
if (gui_bars)
{
pos_bar = gui_bar_find_pos (bar);
@@ -394,7 +394,7 @@ gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
return 0;
}
}
-
+
/*
* call a modifier that will tell us if bar is displayed or not,
* for example it can be used to display nicklist on some buffers
@@ -415,7 +415,7 @@ gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
rc = 1;
if (str_displayed)
free (str_displayed);
-
+
return rc;
}
@@ -428,7 +428,7 @@ gui_bar_root_get_size (struct t_gui_bar *bar, enum t_gui_bar_position position)
{
struct t_gui_bar *ptr_bar;
int total_size;
-
+
total_size = 0;
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
@@ -457,16 +457,16 @@ struct t_gui_bar *
gui_bar_search (const char *name)
{
struct t_gui_bar *ptr_bar;
-
+
if (!name || !name[0])
return NULL;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (strcmp (ptr_bar->name, name) == 0)
return ptr_bar;
}
-
+
/* bar not found */
return NULL;
}
@@ -481,9 +481,9 @@ gui_bar_search_with_option_name (const char *option_name)
{
char *bar_name, *pos_option;
struct t_gui_bar *ptr_bar;
-
+
ptr_bar = NULL;
-
+
pos_option = strchr (option_name, '.');
if (pos_option)
{
@@ -498,7 +498,7 @@ gui_bar_search_with_option_name (const char *option_name)
free (bar_name);
}
}
-
+
return ptr_bar;
}
@@ -511,10 +511,10 @@ gui_bar_content_build_bar_windows (struct t_gui_bar *bar)
{
struct t_gui_window *ptr_window;
struct t_gui_bar_window *ptr_bar_window;
-
+
if (!bar)
return;
-
+
if (bar->bar_window)
{
gui_bar_window_content_build (bar->bar_window, NULL);
@@ -552,7 +552,7 @@ void
gui_bar_refresh (struct t_gui_bar *bar)
{
struct t_gui_window *ptr_win;
-
+
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
gui_window_ask_refresh (1);
else
@@ -574,7 +574,7 @@ gui_bar_draw (struct t_gui_bar *bar)
{
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win;
-
+
if (!CONFIG_BOOLEAN(bar->options[GUI_BAR_OPTION_HIDDEN]))
{
if (bar->bar_window)
@@ -610,7 +610,7 @@ gui_bar_apply_current_size (struct t_gui_bar *bar)
{
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win;
-
+
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
{
gui_bar_window_set_current_size (bar->bar_window,
@@ -644,7 +644,7 @@ void
gui_bar_free_items_arrays (struct t_gui_bar *bar)
{
int i, j;
-
+
for (i = 0; i < bar->items_count; i++)
{
if (bar->items_array[i])
@@ -702,9 +702,9 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
{
int i, j, count;
char **tmp_array;
-
+
gui_bar_free_items_arrays (bar);
-
+
if (items && items[0])
{
tmp_array = string_split (items, ",", 0, 0, &count);
@@ -773,10 +773,10 @@ gui_bar_config_change_hidden (void *data, struct t_config_option *option)
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win, *next_bar_win;
int bar_window_exists;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
@@ -801,7 +801,7 @@ gui_bar_config_change_hidden (void *data, struct t_config_option *option)
while (ptr_bar_win)
{
next_bar_win = ptr_bar_win->next_bar_window;
-
+
if (ptr_bar_win->bar == ptr_bar)
{
if (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
@@ -809,7 +809,7 @@ gui_bar_config_change_hidden (void *data, struct t_config_option *option)
else
bar_window_exists = 1;
}
-
+
ptr_bar_win = next_bar_win;
}
if (!bar_window_exists
@@ -833,10 +833,10 @@ gui_bar_config_change_priority (void *data, struct t_config_option *option)
struct t_gui_bar *ptr_bar;
struct t_gui_window *ptr_win;
struct t_gui_bar_window *bar_windows, *ptr_bar_win, *next_bar_win;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
@@ -855,9 +855,9 @@ gui_bar_config_change_priority (void *data, struct t_config_option *option)
(ptr_bar->prev_bar)->next_bar = ptr_bar->next_bar;
if (ptr_bar->next_bar)
(ptr_bar->next_bar)->prev_bar = ptr_bar->prev_bar;
-
+
gui_bar_insert (ptr_bar);
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
bar_windows = ptr_win->bar_windows;
@@ -873,7 +873,7 @@ gui_bar_config_change_priority (void *data, struct t_config_option *option)
ptr_bar_win = next_bar_win;
}
}
-
+
gui_window_ask_refresh (1);
}
}
@@ -886,16 +886,16 @@ void
gui_bar_config_change_conditions (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
if (ptr_bar->conditions_array)
string_free_split (ptr_bar->conditions_array);
-
+
if (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])
&& CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])[0])
{
@@ -909,7 +909,7 @@ gui_bar_config_change_conditions (void *data, struct t_config_option *option)
ptr_bar->conditions_array = NULL;
}
}
-
+
gui_window_ask_refresh (1);
}
@@ -921,14 +921,14 @@ void
gui_bar_config_change_position (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
-
+
gui_window_ask_refresh (1);
}
@@ -940,14 +940,14 @@ void
gui_bar_config_change_filling (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
-
+
gui_window_ask_refresh (1);
}
@@ -963,10 +963,10 @@ gui_bar_config_check_size (void *data, struct t_config_option *option,
long number;
char *error;
int new_value;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
@@ -1000,7 +1000,7 @@ gui_bar_config_check_size (void *data, struct t_config_option *option,
}
if (new_value < 0)
return 0;
-
+
if ((new_value > 0) &&
((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]) == 0)
|| (new_value > CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]))))
@@ -1010,10 +1010,10 @@ gui_bar_config_check_size (void *data, struct t_config_option *option,
new_value - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE])))
return 0;
}
-
+
return 1;
}
-
+
return 0;
}
@@ -1025,10 +1025,10 @@ void
gui_bar_config_change_size (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
{
@@ -1046,7 +1046,7 @@ gui_bar_config_change_size_max (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
char value[32];
-
+
/* make C compiler happy */
(void) data;
(void) option;
@@ -1074,10 +1074,10 @@ void
gui_bar_config_change_color (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
@@ -1091,10 +1091,10 @@ void
gui_bar_config_change_separator (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
@@ -1108,10 +1108,10 @@ void
gui_bar_config_change_items (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
@@ -1131,10 +1131,10 @@ gui_bar_set_name (struct t_gui_bar *bar, const char *name)
{
int length;
char *option_name;
-
+
if (!name || !name[0])
return;
-
+
length = strlen (name) + 64;
option_name = malloc (length);
if (option_name)
@@ -1167,11 +1167,11 @@ gui_bar_set_name (struct t_gui_bar *bar, const char *name)
config_file_option_rename (bar->options[GUI_BAR_OPTION_SEPARATOR], option_name);
snprintf (option_name, length, "%s.items", name);
config_file_option_rename (bar->options[GUI_BAR_OPTION_ITEMS], option_name);
-
+
if (bar->name)
free (bar->name);
bar->name = strdup (name);
-
+
free (option_name);
}
}
@@ -1186,7 +1186,7 @@ gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value)
{
if (!bar || !property || !value)
return 0;
-
+
if (string_strcasecmp (property, "name") == 0)
{
gui_bar_set_name (bar, value);
@@ -1264,7 +1264,7 @@ gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value)
gui_bar_draw (bar);
return 1;
}
-
+
return 0;
}
@@ -1280,13 +1280,13 @@ gui_bar_default_items (const char *bar_name)
{
int i;
static char empty_items[1] = { '\0' };
-
+
for (i = 0; gui_bar_items_default_for_bars[i][0]; i++)
{
if (strcmp (gui_bar_items_default_for_bars[i][0], bar_name) == 0)
return gui_bar_items_default_for_bars[i][1];
}
-
+
/* no default items in bar */
return empty_items;
}
@@ -1301,9 +1301,9 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
struct t_config_option *ptr_option;
int length;
char *option_name;
-
+
ptr_option = NULL;
-
+
length = strlen (bar_name) + 1 +
strlen (gui_bar_option_string[index_option]) + 1;
option_name = malloc (length);
@@ -1311,7 +1311,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
{
snprintf (option_name, length, "%s.%s",
bar_name, gui_bar_option_string[index_option]);
-
+
switch (index_option)
{
case GUI_BAR_OPTION_HIDDEN:
@@ -1449,7 +1449,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
}
free (option_name);
}
-
+
return ptr_option;
}
@@ -1463,7 +1463,7 @@ gui_bar_create_option_temp (struct t_gui_bar *temp_bar, int index_option,
const char *value)
{
struct t_config_option *new_option;
-
+
new_option = gui_bar_create_option (temp_bar->name,
index_option,
value);
@@ -1526,7 +1526,7 @@ gui_bar_alloc (const char *name)
{
struct t_gui_bar *new_bar;
int i;
-
+
new_bar = malloc (sizeof (*new_bar));
if (new_bar)
{
@@ -1547,7 +1547,7 @@ gui_bar_alloc (const char *name)
new_bar->prev_bar = NULL;
new_bar->next_bar = NULL;
}
-
+
return new_bar;
}
@@ -1574,7 +1574,7 @@ gui_bar_new_with_options (const char *name,
{
struct t_gui_bar *new_bar;
struct t_gui_window *ptr_win;
-
+
/* create bar */
new_bar = gui_bar_alloc (name);
if (new_bar)
@@ -1613,10 +1613,10 @@ gui_bar_new_with_options (const char *name,
gui_bar_set_items_array (new_bar, CONFIG_STRING(items));
new_bar->bar_window = NULL;
new_bar->bar_refresh_needed = 1;
-
+
/* add bar to bars list */
gui_bar_insert (new_bar);
-
+
/* add window bar */
if (CONFIG_INTEGER(new_bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
{
@@ -1634,7 +1634,7 @@ gui_bar_new_with_options (const char *name,
}
}
}
-
+
return new_bar;
}
@@ -1658,22 +1658,22 @@ gui_bar_new (const char *name, const char *hidden, const char *priority,
struct t_config_option *option_color_bg, *option_separator;
struct t_config_option *option_items;
struct t_gui_bar *new_bar;
-
+
if (!name || !name[0])
return NULL;
-
+
/* it's not possible to create 2 bars with same name */
if (gui_bar_search (name))
return NULL;
-
+
/* look for type */
if (gui_bar_search_type (type) < 0)
return NULL;
-
+
/* look for position */
if (gui_bar_search_position (position) < 0)
return NULL;
-
+
option_hidden = gui_bar_create_option (name, GUI_BAR_OPTION_HIDDEN,
hidden);
option_priority = gui_bar_create_option (name, GUI_BAR_OPTION_PRIORITY,
@@ -1743,7 +1743,7 @@ gui_bar_new (const char *name, const char *hidden, const char *priority,
if (option_items)
config_file_option_free (option_items);
}
-
+
return new_bar;
}
@@ -1756,7 +1756,7 @@ gui_bar_use_temp_bars ()
{
struct t_gui_bar *ptr_temp_bar, *next_temp_bar;
int i, num_options_ok;
-
+
for (ptr_temp_bar = gui_temp_bars; ptr_temp_bar;
ptr_temp_bar = ptr_temp_bar->next_bar)
{
@@ -1772,7 +1772,7 @@ gui_bar_use_temp_bars ()
if (ptr_temp_bar->options[i])
num_options_ok++;
}
-
+
if (num_options_ok == GUI_BAR_NUM_OPTIONS)
{
gui_bar_new_with_options (ptr_temp_bar->name,
@@ -1803,16 +1803,16 @@ gui_bar_use_temp_bars ()
}
}
}
-
+
/* free all temp bars */
while (gui_temp_bars)
{
next_temp_bar = gui_temp_bars->next_bar;
-
+
if (gui_temp_bars->name)
free (gui_temp_bars->name);
free (gui_temp_bars);
-
+
gui_temp_bars = next_temp_bar;
}
last_gui_temp_bar = NULL;
@@ -1828,7 +1828,7 @@ gui_bar_create_default_input ()
struct t_gui_bar *ptr_bar;
int length;
char *buf;
-
+
/* search an input_text item */
if (!gui_bar_item_used_in_a_bar (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT], 1))
{
@@ -1889,7 +1889,7 @@ void
gui_bar_create_default_title ()
{
struct t_gui_bar *ptr_bar;
-
+
/* search title bar */
ptr_bar = gui_bar_search (GUI_BAR_DEFAULT_NAME_TITLE);
if (!ptr_bar)
@@ -1925,7 +1925,7 @@ void
gui_bar_create_default_status ()
{
struct t_gui_bar *ptr_bar;
-
+
/* search status bar */
ptr_bar = gui_bar_search (GUI_BAR_DEFAULT_NAME_STATUS);
if (!ptr_bar)
@@ -1961,7 +1961,7 @@ void
gui_bar_create_default_nicklist ()
{
struct t_gui_bar *ptr_bar;
-
+
/* search nicklist bar */
ptr_bar = gui_bar_search (GUI_BAR_DEFAULT_NAME_NICKLIST);
if (!ptr_bar)
@@ -2010,7 +2010,7 @@ void
gui_bar_update (const char *name)
{
struct t_gui_bar *ptr_bar;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])
@@ -2034,13 +2034,13 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
long number;
char *str, *error;
int length, add_x, add, percent, scroll_beginning, scroll_end;
-
+
if (!bar)
return 0;
-
+
if (CONFIG_BOOLEAN(bar->options[GUI_BAR_OPTION_HIDDEN]))
return 1;
-
+
add_x = 0;
str = NULL;
number = 0;
@@ -2048,7 +2048,7 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
percent = 0;
scroll_beginning = 0;
scroll_end = 0;
-
+
if ((scroll[0] == 'x') || (scroll[0] == 'X'))
{
add_x = 1;
@@ -2064,7 +2064,7 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
if (gui_bar_get_filling (bar) == GUI_BAR_FILLING_HORIZONTAL)
add_x = 1;
}
-
+
if ((scroll[0] == 'b') || (scroll[0] == 'B'))
{
scroll_beginning = 1;
@@ -2086,11 +2086,11 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
}
else
return 0;
-
+
length = strlen (scroll);
if (length == 0)
return 0;
-
+
if (scroll[length - 1] == '%')
{
str = string_strndup (scroll, length - 1);
@@ -2100,17 +2100,17 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
str = strdup (scroll);
if (!str)
return 0;
-
+
error = NULL;
number = strtol (str, &error, 10);
-
+
if (!error || error[0] || (number <= 0))
{
free (str);
return 0;
}
}
-
+
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
{
gui_bar_window_scroll (bar->bar_window, NULL,
@@ -2130,10 +2130,10 @@ gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_window *window,
}
}
}
-
+
if (str)
free (str);
-
+
return 1;
}
@@ -2145,10 +2145,10 @@ void
gui_bar_free (struct t_gui_bar *bar)
{
int i;
-
+
if (!bar)
return;
-
+
/* remove bar window(s) */
if (bar->bar_window)
{
@@ -2157,7 +2157,7 @@ gui_bar_free (struct t_gui_bar *bar)
}
else
gui_bar_free_bar_windows (bar);
-
+
/* remove bar from bars list */
if (bar->prev_bar)
(bar->prev_bar)->next_bar = bar->next_bar;
@@ -2167,7 +2167,7 @@ gui_bar_free (struct t_gui_bar *bar)
gui_bars = bar->next_bar;
if (last_gui_bar == bar)
last_gui_bar = bar->prev_bar;
-
+
/* free data */
if (bar->name)
free (bar->name);
@@ -2179,7 +2179,7 @@ gui_bar_free (struct t_gui_bar *bar)
if (bar->conditions_array)
string_free_split (bar->conditions_array);
gui_bar_free_items_arrays (bar);
-
+
free (bar);
}
@@ -2205,7 +2205,7 @@ gui_bar_free_bar_windows (struct t_gui_bar *bar)
{
struct t_gui_window *ptr_win;
struct t_gui_bar_window *ptr_bar_win, *next_bar_win;
-
+
if (bar->bar_window)
{
gui_bar_window_free (bar->bar_window, NULL);
@@ -2219,10 +2219,10 @@ gui_bar_free_bar_windows (struct t_gui_bar *bar)
while (ptr_bar_win)
{
next_bar_win = ptr_bar_win->next_bar_window;
-
+
if (ptr_bar_win->bar == bar)
gui_bar_window_free (ptr_bar_win, ptr_win);
-
+
ptr_bar_win = next_bar_win;
}
}
@@ -2237,10 +2237,10 @@ struct t_hdata *
gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar");
if (hdata)
{
@@ -2276,10 +2276,10 @@ gui_bar_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
int i, j;
char option_name[64];
-
+
if (!infolist || !bar)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -2349,7 +2349,7 @@ gui_bar_add_to_infolist (struct t_infolist *infolist,
}
if (!infolist_new_var_pointer (ptr_item, "bar_window", bar->bar_window))
return 0;
-
+
return 1;
}
@@ -2362,7 +2362,7 @@ gui_bar_print_log ()
{
struct t_gui_bar *ptr_bar;
int i, j;
-
+
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
log_printf ("");
@@ -2418,7 +2418,7 @@ gui_bar_print_log ()
log_printf (" bar_refresh_needed . . : %d", ptr_bar->bar_refresh_needed);
log_printf (" prev_bar . . . . . . . : 0x%lx", ptr_bar->prev_bar);
log_printf (" next_bar . . . . . . . : 0x%lx", ptr_bar->next_bar);
-
+
if (ptr_bar->bar_window)
gui_bar_window_print_log (ptr_bar->bar_window);
}
diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h
index 76e141b14..22c3a6ff8 100644
--- a/src/gui/gui-bar.h
+++ b/src/gui/gui-bar.h
@@ -82,7 +82,7 @@ struct t_gui_bar
/* user choices */
char *name; /* bar name */
struct t_config_option *options[GUI_BAR_NUM_OPTIONS];
-
+
/* internal vars */
int conditions_count; /* number of conditions */
char **conditions_array; /* bar conditions (after split) */
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 925b3788f..ea7f9dde3 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -118,7 +118,7 @@ gui_buffer_get_plugin_name (struct t_gui_buffer *buffer)
{
if (buffer->plugin_name_for_upgrade)
return buffer->plugin_name_for_upgrade;
-
+
return plugin_get_name (buffer->plugin);
}
@@ -143,10 +143,10 @@ gui_buffer_local_var_add (struct t_gui_buffer *buffer, const char *name,
const char *value)
{
void *ptr_value;
-
+
if (!buffer || !buffer->local_variables || !name || !value)
return;
-
+
ptr_value = hashtable_get (buffer->local_variables, name);
hashtable_set (buffer->local_variables, name, value);
hook_signal_send ((ptr_value) ?
@@ -162,10 +162,10 @@ void
gui_buffer_local_var_remove (struct t_gui_buffer *buffer, const char *name)
{
void *ptr_value;
-
+
if (!buffer || !buffer->local_variables || !name)
return;
-
+
ptr_value = hashtable_get (buffer->local_variables, name);
if (ptr_value)
{
@@ -203,14 +203,14 @@ gui_buffer_notify_get (struct t_gui_buffer *buffer)
char *option_name, *ptr_end;
int length;
struct t_config_option *ptr_option;
-
+
plugin_name = gui_buffer_get_plugin_name (buffer);
length = strlen (plugin_name) + 1 + strlen (buffer->name) + 1;
option_name = malloc (length);
if (option_name)
{
snprintf (option_name, length, "%s.%s", plugin_name, buffer->name);
-
+
ptr_end = option_name + strlen (option_name);
while (ptr_end >= option_name)
{
@@ -233,13 +233,13 @@ gui_buffer_notify_get (struct t_gui_buffer *buffer)
ptr_option = config_file_search_option (weechat_config_file,
weechat_config_section_notify,
option_name);
-
+
free (option_name);
-
+
if (ptr_option)
return CONFIG_INTEGER(ptr_option);
}
-
+
/* notify level not found */
return CONFIG_INTEGER(config_look_buffer_notify_default);
}
@@ -252,10 +252,10 @@ void
gui_buffer_notify_set (struct t_gui_buffer *buffer)
{
int old_notify, new_notify;
-
+
old_notify = buffer->notify;
new_notify = gui_buffer_notify_get (buffer);
-
+
if (new_notify != old_notify)
{
buffer->notify = new_notify;
@@ -282,7 +282,7 @@ void
gui_buffer_notify_set_all ()
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -298,11 +298,11 @@ struct t_gui_buffer *
gui_buffer_find_pos (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
/* if no number is asked by layout, then add to the end by default */
if (buffer->layout_number < 1)
return NULL;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -319,7 +319,7 @@ gui_buffer_find_pos (struct t_gui_buffer *buffer)
}
}
}
-
+
/* position not found, add to the end */
return NULL;
}
@@ -332,7 +332,7 @@ void
gui_buffer_insert (struct t_gui_buffer *buffer, int automatic_merge)
{
struct t_gui_buffer *pos, *ptr_buffer;
-
+
pos = gui_buffer_find_pos (buffer);
if (pos)
{
@@ -415,10 +415,10 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
struct t_gui_buffer *new_buffer;
struct t_gui_completion *new_completion;
int first_buffer_creation;
-
+
if (!name || !name[0])
return NULL;
-
+
if (gui_buffer_search_by_name (plugin_get_name (plugin), name))
{
gui_chat_printf (NULL,
@@ -428,7 +428,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
name);
return NULL;
}
-
+
/* create new buffer */
new_buffer = malloc (sizeof (*new_buffer));
if (new_buffer)
@@ -436,7 +436,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
/* init buffer */
new_buffer->plugin = plugin;
new_buffer->plugin_name_for_upgrade = NULL;
-
+
/* number will be set later (when inserting buffer in list) */
gui_layout_buffer_get_number (gui_layout_buffers,
plugin_get_name (plugin),
@@ -450,21 +450,21 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->num_displayed = 0;
new_buffer->active = 1;
new_buffer->print_hooks_enabled = 1;
-
+
/* close callback */
new_buffer->close_callback = close_callback;
new_buffer->close_callback_data = close_callback_data;
-
+
/* title */
new_buffer->title = NULL;
-
+
/* chat content */
new_buffer->own_lines = gui_lines_alloc ();
new_buffer->mixed_lines = NULL;
new_buffer->lines = new_buffer->own_lines;
new_buffer->time_for_each_line = 1;
new_buffer->chat_refresh_needed = 2;
-
+
/* nicklist */
new_buffer->nicklist = 0;
new_buffer->nicklist_case_sensitive = 0;
@@ -473,14 +473,14 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->nicklist_display_groups = 1;
new_buffer->nicklist_visible_count = 0;
gui_nicklist_add_group (new_buffer, NULL, "root", NULL, 0);
-
+
/* input */
new_buffer->input = 1;
new_buffer->input_callback = input_callback;
new_buffer->input_callback_data = input_callback_data;
new_buffer->input_get_unknown_commands = 0;
gui_buffer_input_buffer_init (new_buffer);
-
+
/* undo for input */
new_buffer->input_undo_snap = malloc (sizeof (*(new_buffer->input_undo_snap)));
(new_buffer->input_undo_snap)->data = NULL;
@@ -491,7 +491,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->last_input_undo = NULL;
new_buffer->ptr_input_undo = NULL;
new_buffer->input_undo_count = 0;
-
+
/* init completion */
new_completion = malloc (sizeof (*new_completion));
if (new_completion)
@@ -499,19 +499,19 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->completion = new_completion;
gui_completion_buffer_init (new_completion, new_buffer);
}
-
+
/* init history */
new_buffer->history = NULL;
new_buffer->last_history = NULL;
new_buffer->ptr_history = NULL;
new_buffer->num_history = 0;
-
+
/* text search */
new_buffer->text_search = GUI_TEXT_SEARCH_DISABLED;
new_buffer->text_search_exact = 0;
new_buffer->text_search_found = 0;
new_buffer->text_search_input = NULL;
-
+
/* highlight */
new_buffer->highlight_words = NULL;
new_buffer->highlight_regex = NULL;
@@ -519,19 +519,19 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->highlight_tags = NULL;
new_buffer->highlight_tags_count = 0;
new_buffer->highlight_tags_array = NULL;
-
+
/* hotlist */
new_buffer->hotlist_max_level_nicks = hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
NULL);
-
+
/* keys */
new_buffer->keys = NULL;
new_buffer->last_key = NULL;
new_buffer->keys_count = 0;
-
+
/* local variables */
new_buffer->local_variables = hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
@@ -541,20 +541,20 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
hashtable_set (new_buffer->local_variables,
"plugin", plugin_get_name (plugin));
hashtable_set (new_buffer->local_variables, "name", name);
-
+
/* add buffer to buffers list */
first_buffer_creation = (gui_buffers == NULL);
gui_buffer_insert (new_buffer, 1);
-
+
/* set notify level */
new_buffer->notify = gui_buffer_notify_get (new_buffer);
-
+
/*
* check if this buffer should be assigned to a window,
* according to windows layout saved
*/
gui_layout_window_check_buffer (new_buffer);
-
+
if (first_buffer_creation)
{
gui_buffer_visited_add (new_buffer);
@@ -567,7 +567,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
}
else
return NULL;
-
+
return new_buffer;
}
@@ -581,18 +581,18 @@ int
gui_buffer_valid (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
/* NULL buffer is valid (it's for printing on first buffer) */
if (!buffer)
return 1;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer == buffer)
return 1;
}
-
+
/* buffer not found */
return 0;
}
@@ -609,10 +609,10 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
int length, length_var, index_string, index_result;
char *result, *result2, *local_var;
const char *pos_end_name, *ptr_value;
-
+
if (!string)
return NULL;
-
+
length = strlen (string) + 1;
result = malloc (length);
if (result)
@@ -661,7 +661,7 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
}
else
result[index_result++] = string[index_string++];
-
+
free (local_var);
}
else
@@ -675,7 +675,7 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
}
result[index_result] = '\0';
}
-
+
return result;
}
@@ -690,9 +690,9 @@ gui_buffer_full_name_match_list (const char *full_name,
{
int i, match;
char *ptr_name;
-
+
match = 0;
-
+
for (i = 0; i < num_buffers; i++)
{
ptr_name = buffers[i];
@@ -706,7 +706,7 @@ gui_buffer_full_name_match_list (const char *full_name,
match = 1;
}
}
-
+
return match;
}
@@ -728,12 +728,12 @@ gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
{
char **buffers, buffer_full_name[512];
int num_buffers, match;
-
+
if (!string || !string[0])
return 0;
-
+
match = 0;
-
+
buffers = string_split (string, ",", 0, 0, &num_buffers);
if (buffers)
{
@@ -744,7 +744,7 @@ gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
num_buffers, buffers);
string_free_split (buffers);
}
-
+
return match;
}
@@ -757,7 +757,7 @@ void
gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin)
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -766,7 +766,7 @@ gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin)
{
free (ptr_buffer->plugin_name_for_upgrade);
ptr_buffer->plugin_name_for_upgrade = NULL;
-
+
ptr_buffer->plugin = plugin;
}
}
@@ -781,16 +781,16 @@ int
gui_buffer_property_in_list (char *properties[], char *property)
{
int i;
-
+
if (!properties || !property)
return 0;
-
+
for (i = 0; properties[i]; i++)
{
if (strcmp (properties[i], property) == 0)
return 1;
}
-
+
/* property not found in list */
return 0;
}
@@ -859,7 +859,7 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
else if (string_strcasecmp (property, "text_search_found") == 0)
return buffer->text_search_found;
}
-
+
return 0;
}
@@ -871,7 +871,7 @@ const char *
gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
const char *ptr_value;
-
+
if (buffer && property)
{
if (string_strcasecmp (property, "plugin") == 0)
@@ -902,7 +902,7 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
return ptr_value;
}
}
-
+
return NULL;
}
@@ -920,7 +920,7 @@ gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property)
else if (string_strcasecmp (property, "highlight_regex_compiled") == 0)
return buffer->highlight_regex_compiled;
}
-
+
return NULL;
}
@@ -947,9 +947,9 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
if (buffer->name)
free (buffer->name);
buffer->name = strdup (name);
-
+
gui_buffer_local_var_add (buffer, "name", name);
-
+
hook_signal_send ("buffer_renamed",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -969,11 +969,11 @@ gui_buffer_set_short_name (struct t_gui_buffer *buffer, const char *short_name)
}
buffer->short_name = (short_name && short_name[0]) ?
strdup (short_name) : NULL;
-
+
if (buffer->mixed_lines)
gui_line_compute_buffer_max_length (buffer, buffer->mixed_lines);
gui_buffer_ask_chat_refresh (buffer, 1);
-
+
hook_signal_send ("buffer_renamed",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -987,9 +987,9 @@ gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
{
if (buffer->type == type)
return;
-
+
gui_line_free_all (buffer);
-
+
buffer->type = type;
gui_buffer_ask_chat_refresh (buffer, 2);
@@ -1007,7 +1007,7 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
if (buffer->title)
free (buffer->title);
buffer->title = (new_title && new_title[0]) ? strdup (new_title) : NULL;
-
+
hook_signal_send ("buffer_title_changed",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -1098,12 +1098,12 @@ gui_buffer_set_highlight_words_list (struct t_gui_buffer *buffer,
length += strlen (ptr_string) + 1;
}
length += 2; /* '\n' + '\0' */
-
+
/* allocate memory */
words = malloc (length);
if (!words)
return;
-
+
/* build string */
words[0] = '\0';
for (ptr_list_item = weelist_get (list, 0); ptr_list_item;
@@ -1117,9 +1117,9 @@ gui_buffer_set_highlight_words_list (struct t_gui_buffer *buffer,
strcat (words, ",");
}
}
-
+
gui_buffer_set_highlight_words (buffer, words);
-
+
free (words);
}
@@ -1134,19 +1134,19 @@ gui_buffer_add_highlight_words (struct t_gui_buffer *buffer,
char **current_words, **add_words;
int current_count, add_count, i;
struct t_weelist *list;
-
+
if (!words_to_add)
return;
-
+
list = weelist_new ();
if (!list)
return;
-
+
current_words = string_split (buffer->highlight_words, ",", 0, 0,
&current_count);
add_words = string_split (words_to_add, ",", 0, 0,
&add_count);
-
+
for (i = 0; i < current_count; i++)
{
if (!weelist_search (list, current_words[i]))
@@ -1157,11 +1157,11 @@ gui_buffer_add_highlight_words (struct t_gui_buffer *buffer,
if (!weelist_search (list, add_words[i]))
weelist_add (list, add_words[i], WEECHAT_LIST_POS_END, NULL);
}
-
+
gui_buffer_set_highlight_words_list (buffer, list);
-
+
weelist_free (list);
-
+
if (current_words)
string_free_split (current_words);
if (add_words)
@@ -1179,19 +1179,19 @@ gui_buffer_remove_highlight_words (struct t_gui_buffer *buffer,
char **current_words, **remove_words;
int current_count, remove_count, i, j, to_remove;
struct t_weelist *list;
-
+
if (!words_to_remove)
return;
-
+
list = weelist_new ();
if (!list)
return;
-
+
current_words = string_split (buffer->highlight_words, ",", 0, 0,
&current_count);
remove_words = string_split (words_to_remove, ",", 0, 0,
&remove_count);
-
+
for (i = 0; i < current_count; i++)
{
/* search if word is to be removed or not */
@@ -1207,11 +1207,11 @@ gui_buffer_remove_highlight_words (struct t_gui_buffer *buffer,
if (!to_remove)
weelist_add (list, current_words[i], WEECHAT_LIST_POS_END, NULL);
}
-
+
gui_buffer_set_highlight_words_list (buffer, list);
-
+
weelist_free (list);
-
+
if (current_words)
string_free_split (current_words);
if (remove_words)
@@ -1237,7 +1237,7 @@ gui_buffer_set_highlight_regex (struct t_gui_buffer *buffer,
free (buffer->highlight_regex_compiled);
buffer->highlight_regex_compiled = NULL;
}
-
+
if (new_highlight_regex && new_highlight_regex[0])
{
buffer->highlight_regex = strdup (new_highlight_regex);
@@ -1278,7 +1278,7 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
buffer->highlight_tags_array = NULL;
}
buffer->highlight_tags_count = 0;
-
+
if (new_highlight_tags)
{
buffer->highlight_tags = strdup (new_highlight_tags);
@@ -1303,9 +1303,9 @@ gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
char **nicks, *pos, *error;
int nicks_count, value, i;
long number;
-
+
hashtable_remove_all (buffer->hotlist_max_level_nicks);
-
+
if (new_hotlist_max_level_nicks && new_hotlist_max_level_nicks[0])
{
nicks = string_split (new_hotlist_max_level_nicks, ",", 0, 0,
@@ -1345,10 +1345,10 @@ gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
char **nicks, *pos, *error;
int nicks_count, value, i;
long number;
-
+
if (!nicks_to_add)
return;
-
+
nicks = string_split (nicks_to_add, ",", 0, 0, &nicks_count);
if (nicks)
{
@@ -1384,10 +1384,10 @@ gui_buffer_remove_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
{
char **nicks, *pos;
int nicks_count, i;
-
+
if (!nicks_to_remove)
return;
-
+
nicks = string_split (nicks_to_remove, ",", 0, 0, &nicks_count);
if (nicks)
{
@@ -1427,10 +1427,10 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer)
{
refresh = ((buffer->lines->last_read_line != NULL)
&& (buffer->lines->last_read_line != buffer->lines->last_line));
-
+
buffer->lines->last_read_line = buffer->lines->last_line;
buffer->lines->first_line_not_read = (buffer->lines->last_read_line) ? 0 : 1;
-
+
if (refresh)
gui_buffer_ask_chat_refresh (buffer, 2);
}
@@ -1446,10 +1446,10 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
{
long number;
char *error;
-
+
if (!property || !value)
return;
-
+
/* properties that does NOT need a buffer */
if (string_strcasecmp (property, "hotlist") == 0)
{
@@ -1465,10 +1465,10 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
(void) gui_hotlist_add (buffer, number, NULL);
}
}
-
+
if (!buffer)
return;
-
+
/* properties that need a buffer */
if (string_strcasecmp (property, "unread") == 0)
{
@@ -1646,7 +1646,7 @@ gui_buffer_set_pointer (struct t_gui_buffer *buffer, const char *property,
{
if (!buffer || !property)
return;
-
+
if (string_strcasecmp (property, "close_callback") == 0)
{
buffer->close_callback = pointer;
@@ -1674,13 +1674,13 @@ gui_buffer_compute_num_displayed ()
{
struct t_gui_buffer *ptr_buffer;
struct t_gui_window *ptr_window;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->num_displayed = 0;
}
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
@@ -1698,7 +1698,7 @@ void
gui_buffer_add_value_num_displayed (struct t_gui_buffer *buffer, int value)
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1721,11 +1721,11 @@ gui_buffer_is_main (const char *plugin_name, const char *name)
/* if plugin is set and is not "core", then it's NOT main buffer */
if (plugin_name && (strcmp (plugin_name, plugin_get_name (NULL)) != 0))
return 0;
-
+
/* if name is set and is not "weechat", then it's NOT main buffer */
if (name && (strcmp (name, GUI_BUFFER_MAIN) != 0))
return 0;
-
+
/* it's main buffer */
return 1;
}
@@ -1738,7 +1738,7 @@ struct t_gui_buffer *
gui_buffer_search_main ()
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1747,7 +1747,7 @@ gui_buffer_search_main ()
&& (strcmp (ptr_buffer->name, GUI_BUFFER_MAIN) == 0))
return ptr_buffer;
}
-
+
/* buffer not found (should never occur!) */
return NULL;
}
@@ -1761,10 +1761,10 @@ gui_buffer_search_by_name (const char *plugin, const char *name)
{
struct t_gui_buffer *ptr_buffer;
int plugin_match;
-
+
if (!name || !name[0])
return gui_current_window->buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1782,7 +1782,7 @@ gui_buffer_search_by_name (const char *plugin, const char *name)
}
}
}
-
+
/* buffer not found */
return NULL;
}
@@ -1797,9 +1797,9 @@ gui_buffer_search_by_full_name (const char *full_name)
{
struct t_gui_buffer *ptr_buffer;
char *name, *pos;
-
+
ptr_buffer = NULL;
-
+
name = strdup (full_name);
if (name)
{
@@ -1811,7 +1811,7 @@ gui_buffer_search_by_full_name (const char *full_name)
}
free (name);
}
-
+
return ptr_buffer;
}
@@ -1825,22 +1825,22 @@ gui_buffer_search_by_partial_name (const char *plugin, const char *name)
struct t_gui_buffer *ptr_start_buffer, *ptr_buffer, *buffer_partial_match[3];
int plugin_match, length_name;
const char *pos;
-
+
if (!name || !name[0])
return gui_current_window->buffer;
-
+
/* 0: mathces beginning of buffer name, 1: in the middle, 2: the end */
buffer_partial_match[0] = NULL;
buffer_partial_match[1] = NULL;
buffer_partial_match[2] = NULL;
-
+
length_name = strlen (name);
ptr_buffer = gui_current_window->buffer->next_buffer;
if (!ptr_buffer)
ptr_buffer = gui_buffers;
ptr_start_buffer = ptr_buffer;
-
+
while (ptr_buffer)
{
if (ptr_buffer->name)
@@ -1891,15 +1891,15 @@ gui_buffer_search_by_partial_name (const char *plugin, const char *name)
if (ptr_buffer == ptr_start_buffer)
break;
}
-
+
/* matches end of name? */
if (buffer_partial_match[2])
return buffer_partial_match[2];
-
+
/* matches beginning of name? */
if (buffer_partial_match[0])
return buffer_partial_match[0];
-
+
/*
* return buffer partially matching in name
* (may be NULL if no buffer was found)
@@ -1915,14 +1915,14 @@ struct t_gui_buffer *
gui_buffer_search_by_number (int number)
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->number == number)
return ptr_buffer;
}
-
+
/* buffer not found */
return NULL;
}
@@ -1936,7 +1936,7 @@ gui_buffer_search_by_layout_number (int layout_number,
int layout_number_merge_order)
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1946,7 +1946,7 @@ gui_buffer_search_by_layout_number (int layout_number,
return ptr_buffer;
}
}
-
+
/* buffer not found */
return NULL;
}
@@ -1961,16 +1961,16 @@ gui_buffer_count_merged_buffers (int number)
{
struct t_gui_buffer *ptr_buffer;
int count;
-
+
count = 0;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->number == number)
count++;
}
-
+
return count;
}
@@ -1988,7 +1988,7 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer)
if (!buffer)
return 0;
-
+
buffer_found = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -2000,11 +2000,11 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer)
return 0;
}
}
-
+
/* buffer found, and all windows were scrolled */
if (buffer_found)
return 1;
-
+
/* buffer not found */
return 0;
}
@@ -2017,13 +2017,13 @@ void
gui_buffer_clear (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_win;
-
+
if (!buffer)
return;
-
+
/* remove all lines */
gui_line_free_all (buffer);
-
+
/* remove any scroll for buffer */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -2034,9 +2034,9 @@ gui_buffer_clear (struct t_gui_buffer *buffer)
ptr_win->scroll->start_line_pos = 0;
}
}
-
+
gui_hotlist_remove_buffer (buffer);
-
+
gui_buffer_ask_chat_refresh (buffer, 2);
}
@@ -2048,7 +2048,7 @@ void
gui_buffer_clear_all ()
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -2068,24 +2068,24 @@ gui_buffer_close (struct t_gui_buffer *buffer)
struct t_gui_buffer *ptr_buffer, *ptr_back_to_buffer;
int index;
struct t_gui_buffer_visited *ptr_buffer_visited;
-
+
hook_signal_send ("buffer_closing",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
-
+
if (buffer->close_callback)
{
(void)(buffer->close_callback) (buffer->close_callback_data, buffer);
}
-
+
ptr_back_to_buffer = NULL;
-
+
/* first unmerge buffer if it is merged to at least one other buffer */
if (gui_buffer_count_merged_buffers (buffer->number) > 1)
{
ptr_back_to_buffer = gui_buffer_get_next_active_buffer (buffer);
gui_buffer_unmerge (buffer, -1);
}
-
+
if (!weechat_quit)
{
/*
@@ -2104,7 +2104,7 @@ gui_buffer_close (struct t_gui_buffer *buffer)
ptr_buffer_visited = NULL;
}
}
-
+
/* switch to another buffer in each window that displays buffer */
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
@@ -2144,27 +2144,27 @@ gui_buffer_close (struct t_gui_buffer *buffer)
}
}
}
-
+
gui_hotlist_remove_buffer (buffer);
if (gui_hotlist_initial_buffer == buffer)
gui_hotlist_initial_buffer = NULL;
-
+
gui_buffer_visited_remove_by_buffer (buffer);
-
+
/* decrease buffer number for all next buffers */
for (ptr_buffer = buffer->next_buffer; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->number--;
}
-
+
/* free all lines */
gui_line_free_all (buffer);
if (buffer->own_lines)
free (buffer->own_lines);
if (buffer->mixed_lines)
free (buffer->mixed_lines);
-
+
/* free some data */
if (buffer->title)
free (buffer->title);
@@ -2203,7 +2203,7 @@ gui_buffer_close (struct t_gui_buffer *buffer)
&buffer->keys_count);
gui_buffer_local_var_remove_all (buffer);
hashtable_free (buffer->local_variables);
-
+
/* remove buffer from buffers list */
if (buffer->prev_buffer)
(buffer->prev_buffer)->next_buffer = buffer->next_buffer;
@@ -2213,17 +2213,17 @@ gui_buffer_close (struct t_gui_buffer *buffer)
gui_buffers = buffer->next_buffer;
if (last_gui_buffer == buffer)
last_gui_buffer = buffer->prev_buffer;
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window->buffer == buffer)
ptr_window->buffer = gui_buffers;
}
-
+
hook_signal_send ("buffer_closed",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
-
+
free (buffer);
}
@@ -2235,11 +2235,11 @@ void
gui_buffer_switch_by_number (struct t_gui_window *window, int number)
{
struct t_gui_buffer *ptr_buffer;
-
+
/* invalid buffer */
if ((number < 0) || (number == window->buffer->number))
return;
-
+
/* search for buffer in the list */
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
@@ -2261,7 +2261,7 @@ void
gui_buffer_set_active_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -2279,7 +2279,7 @@ struct t_gui_buffer *
gui_buffer_get_next_active_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
if (buffer->next_buffer
&& (buffer->next_buffer->number == buffer->number))
return buffer->next_buffer;
@@ -2307,7 +2307,7 @@ struct t_gui_buffer *
gui_buffer_get_previous_active_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
if (buffer->prev_buffer
&& (buffer->prev_buffer->number == buffer->number))
return buffer->prev_buffer;
@@ -2335,18 +2335,18 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number)
{
struct t_gui_buffer *ptr_first_buffer, *ptr_last_buffer, *ptr_buffer;
struct t_gui_buffer *ptr_buffer_pos;
-
+
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
-
+
if (number < 1)
number = 1;
-
+
/* buffer number is already ok ? */
if (number == buffer->number)
return;
-
+
ptr_first_buffer = NULL;
ptr_last_buffer = NULL;
for (ptr_buffer = gui_buffers; ptr_buffer;
@@ -2359,15 +2359,15 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number)
ptr_last_buffer = ptr_buffer;
}
}
-
+
/* error when looking for buffers */
if (!ptr_first_buffer || !ptr_last_buffer)
return;
-
+
/* if group of buffers found is all buffers, then we can't move buffers! */
if ((ptr_first_buffer == gui_buffers) && (ptr_last_buffer == last_gui_buffer))
return;
-
+
/* remove buffer(s) from list */
if (ptr_first_buffer == gui_buffers)
{
@@ -2383,14 +2383,14 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number)
(ptr_first_buffer->prev_buffer)->next_buffer = ptr_last_buffer->next_buffer;
if (ptr_last_buffer->next_buffer)
(ptr_last_buffer->next_buffer)->prev_buffer = ptr_first_buffer->prev_buffer;
-
+
/* compute "number - 1" for all buffers after buffer(s) */
for (ptr_buffer = ptr_last_buffer->next_buffer; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->number--;
}
-
+
if (number == 1)
{
for (ptr_buffer = ptr_first_buffer; ptr_buffer;
@@ -2446,14 +2446,14 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number)
last_gui_buffer = ptr_last_buffer;
}
}
-
+
/* compute "number + 1" for all buffers after buffer(s) */
for (ptr_buffer = ptr_last_buffer->next_buffer; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->number++;
}
-
+
hook_signal_send ("buffer_moved",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -2468,17 +2468,17 @@ gui_buffer_merge (struct t_gui_buffer *buffer,
{
struct t_gui_buffer *ptr_buffer;
int target_number;
-
+
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
-
+
if ((buffer == target_buffer) || (buffer->number == target_buffer->number))
return;
-
+
if (gui_buffer_count_merged_buffers (buffer->number) > 1)
gui_buffer_unmerge (buffer, -1);
-
+
/* check if current buffer and target buffers are type "formatted" */
if ((buffer->type != GUI_BUFFER_TYPE_FORMATTED)
|| (target_buffer->type != GUI_BUFFER_TYPE_FORMATTED))
@@ -2489,33 +2489,33 @@ gui_buffer_merge (struct t_gui_buffer *buffer,
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return;
}
-
+
/* move buffer immediately after number we want to merge to */
target_number = (buffer->number < target_buffer->number) ?
target_buffer->number : target_buffer->number + 1;
if (buffer->number != target_number)
gui_buffer_move_to_number (buffer, target_number);
-
+
/* change number */
buffer->number--;
-
+
/* mix lines */
gui_line_mix_buffers (buffer);
-
+
/* set buffer as active in merged buffers group */
gui_buffer_set_active_buffer (buffer);
-
+
/* compute "number - 1" for next buffers */
for (ptr_buffer = buffer->next_buffer; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->number--;
}
-
+
gui_buffer_compute_num_displayed ();
-
+
gui_window_ask_refresh (1);
-
+
hook_signal_send ("buffer_merged",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -2531,19 +2531,19 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
{
int num_merged;
struct t_gui_buffer *ptr_buffer, *ptr_new_active_buffer;
-
+
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
-
+
ptr_new_active_buffer = NULL;
-
+
num_merged = gui_buffer_count_merged_buffers (buffer->number);
-
+
/* can't unmerge if buffer is not merged to at least one buffer */
if (num_merged < 2)
return;
-
+
/* by default, we move buffer to buffer->number + 1 */
if ((number < 1) || (number == buffer->number))
{
@@ -2554,7 +2554,7 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
if (number > last_gui_buffer->number + 1)
number = last_gui_buffer->number + 1;
}
-
+
if (num_merged == 2)
{
/* only one buffer will remain, so it will not be merged any more */
@@ -2581,7 +2581,7 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
buffer->mixed_lines = NULL;
buffer->lines = buffer->own_lines;
}
-
+
/* remove buffer from list */
if (buffer->prev_buffer)
(buffer->prev_buffer)->next_buffer = buffer->next_buffer;
@@ -2591,7 +2591,7 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
gui_buffers = buffer->next_buffer;
if (last_gui_buffer == buffer)
last_gui_buffer = buffer->prev_buffer;
-
+
/* move buffer */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -2625,7 +2625,7 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
{
ptr_buffer->number++;
}
-
+
gui_buffer_compute_num_displayed ();
if (ptr_new_active_buffer)
@@ -2634,9 +2634,9 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
gui_line_compute_buffer_max_length (ptr_new_active_buffer,
ptr_new_active_buffer->mixed_lines);
}
-
+
gui_window_ask_refresh (1);
-
+
hook_signal_send ("buffer_unmerged",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -2650,7 +2650,7 @@ gui_buffer_unmerge_all ()
{
int number;
struct t_gui_buffer *ptr_buffer;
-
+
number = 1;
while (number <= last_gui_buffer->number)
{
@@ -2674,12 +2674,12 @@ void
gui_buffer_sort_by_layout_number ()
{
struct t_gui_buffer *ptr_buffer, *ptr_next_buffer;
-
+
ptr_buffer = gui_buffers;
-
+
gui_buffers = NULL;
last_gui_buffer = NULL;
-
+
while (ptr_buffer)
{
ptr_next_buffer = ptr_buffer->next_buffer;
@@ -2702,7 +2702,7 @@ gui_buffer_undo_snap (struct t_gui_buffer *buffer)
(buffer->input_undo_snap)->data = NULL;
}
(buffer->input_undo_snap)->pos = 0;
-
+
if (CONFIG_INTEGER(config_look_input_undo_max) > 0)
{
(buffer->input_undo_snap)->data = (buffer->input_buffer) ?
@@ -2736,11 +2736,11 @@ void
gui_buffer_undo_add (struct t_gui_buffer *buffer)
{
struct t_gui_input_undo *new_undo;
-
+
/* undo disabled by config */
if (CONFIG_INTEGER(config_look_input_undo_max) == 0)
goto end;
-
+
/*
* if nothing has changed since snapshot of input buffer, then do nothing
* (just discard snapshot)
@@ -2750,7 +2750,7 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
{
goto end;
}
-
+
/* max number of undo reached? */
if ((buffer->input_undo_count > 0)
&& (buffer->input_undo_count >= CONFIG_INTEGER(config_look_input_undo_max) + 1))
@@ -2758,7 +2758,7 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
/* remove older undo in buffer (first in list) */
gui_buffer_undo_free (buffer, buffer->input_undo);
}
-
+
/* remove all undos after current undo */
if (buffer->ptr_input_undo)
{
@@ -2767,7 +2767,7 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
gui_buffer_undo_free (buffer, buffer->ptr_input_undo->next_undo);
}
}
-
+
/* if input is the same as current undo, then do not add it */
if (buffer->ptr_input_undo
&& (buffer->ptr_input_undo)->data
@@ -2776,11 +2776,11 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
{
goto end;
}
-
+
new_undo = (struct t_gui_input_undo *)malloc (sizeof (*new_undo));
if (!new_undo)
goto end;
-
+
if ((buffer->input_undo_snap)->data)
{
new_undo->data = strdup ((buffer->input_undo_snap)->data);
@@ -2792,7 +2792,7 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
strdup (buffer->input_buffer) : NULL;
new_undo->pos = buffer->input_buffer_pos;
}
-
+
/* add undo to the list */
new_undo->prev_undo = buffer->last_input_undo;
new_undo->next_undo = NULL;
@@ -2801,10 +2801,10 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
else
buffer->input_undo = new_undo;
buffer->last_input_undo = new_undo;
-
+
buffer->ptr_input_undo = new_undo;
buffer->input_undo_count++;
-
+
end:
gui_buffer_undo_snap_free (buffer);
}
@@ -2825,11 +2825,11 @@ gui_buffer_undo_free (struct t_gui_buffer *buffer,
else
buffer->ptr_input_undo = (buffer->ptr_input_undo)->prev_undo;
}
-
+
/* free data */
if (undo->data)
free (undo->data);
-
+
/* remove undo from list */
if (undo->prev_undo)
(undo->prev_undo)->next_undo = undo->next_undo;
@@ -2839,9 +2839,9 @@ gui_buffer_undo_free (struct t_gui_buffer *buffer,
buffer->input_undo = undo->next_undo;
if (buffer->last_input_undo == undo)
buffer->last_input_undo = undo->prev_undo;
-
+
free (undo);
-
+
buffer->input_undo_count--;
}
@@ -2853,7 +2853,7 @@ void
gui_buffer_undo_free_all (struct t_gui_buffer *buffer)
{
gui_buffer_undo_snap_free (buffer);
-
+
while (buffer->input_undo)
{
gui_buffer_undo_free (buffer, buffer->input_undo);
@@ -2868,17 +2868,17 @@ struct t_gui_buffer_visited *
gui_buffer_visited_search (struct t_gui_buffer *buffer)
{
struct t_gui_buffer_visited *ptr_buffer_visited;
-
+
if (!buffer)
return NULL;
-
+
for (ptr_buffer_visited = gui_buffers_visited; ptr_buffer_visited;
ptr_buffer_visited = ptr_buffer_visited->next_buffer)
{
if (ptr_buffer_visited->buffer == buffer)
return ptr_buffer_visited;
}
-
+
/* visited buffer not found */
return NULL;
}
@@ -2893,10 +2893,10 @@ gui_buffer_visited_search_by_number (int number)
{
struct t_gui_buffer_visited *ptr_buffer_visited;
int i;
-
+
if ((number < 0) || (number >= gui_buffers_visited_count))
return NULL;
-
+
i = 0;
for (ptr_buffer_visited = gui_buffers_visited; ptr_buffer_visited;
ptr_buffer_visited = ptr_buffer_visited->next_buffer)
@@ -2905,7 +2905,7 @@ gui_buffer_visited_search_by_number (int number)
return ptr_buffer_visited;
i++;
}
-
+
/* visited buffer not found (should never be reached) */
return NULL;
}
@@ -2919,7 +2919,7 @@ gui_buffer_visited_remove (struct t_gui_buffer_visited *buffer_visited)
{
if (!buffer_visited)
return;
-
+
/* remove visited buffer from list */
if (buffer_visited->prev_buffer)
(buffer_visited->prev_buffer)->next_buffer = buffer_visited->next_buffer;
@@ -2929,12 +2929,12 @@ gui_buffer_visited_remove (struct t_gui_buffer_visited *buffer_visited)
gui_buffers_visited = buffer_visited->next_buffer;
if (last_gui_buffer_visited == buffer_visited)
last_gui_buffer_visited = buffer_visited->prev_buffer;
-
+
free (buffer_visited);
-
+
if (gui_buffers_visited_count > 0)
gui_buffers_visited_count--;
-
+
if (gui_buffers_visited_index >= gui_buffers_visited_count)
gui_buffers_visited_index = -1;
}
@@ -2948,7 +2948,7 @@ void
gui_buffer_visited_remove_by_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_buffer_visited *buffer_visited;
-
+
if (!buffer)
return;
@@ -2978,25 +2978,25 @@ struct t_gui_buffer_visited *
gui_buffer_visited_add (struct t_gui_buffer *buffer)
{
struct t_gui_buffer_visited *new_buffer_visited;
-
+
if (!buffer)
return NULL;
-
+
new_buffer_visited = gui_buffer_visited_search (buffer);
if (new_buffer_visited)
gui_buffer_visited_remove (new_buffer_visited);
-
+
/* remove old buffer(s) visited if list is too long */
while (gui_buffers_visited_count > CONFIG_INTEGER(config_history_max_visited_buffers))
{
gui_buffer_visited_remove (gui_buffers_visited);
}
-
+
new_buffer_visited = malloc (sizeof (*new_buffer_visited));
if (new_buffer_visited)
{
new_buffer_visited->buffer = buffer;
-
+
new_buffer_visited->prev_buffer = last_gui_buffer_visited;
new_buffer_visited->next_buffer = NULL;
if (gui_buffers_visited)
@@ -3004,11 +3004,11 @@ gui_buffer_visited_add (struct t_gui_buffer *buffer)
else
gui_buffers_visited = new_buffer_visited;
last_gui_buffer_visited = new_buffer_visited;
-
+
gui_buffers_visited_count++;
gui_buffers_visited_index = -1;
}
-
+
return new_buffer_visited;
}
@@ -3023,7 +3023,7 @@ gui_buffer_visited_get_index_previous ()
{
if ((gui_buffers_visited_count < 2) || (gui_buffers_visited_index == 0))
return -1;
-
+
if (gui_buffers_visited_index < 0)
return gui_buffers_visited_count - 2;
else
@@ -3042,7 +3042,7 @@ gui_buffer_visited_get_index_next ()
if ((gui_buffers_visited_count < 2)
|| (gui_buffers_visited_index >= gui_buffers_visited_count - 1))
return -1;
-
+
return gui_buffers_visited_index + 1;
}
@@ -3054,10 +3054,10 @@ struct t_hdata *
gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer");
if (hdata)
{
@@ -3138,10 +3138,10 @@ struct t_hdata *
gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo");
if (hdata)
{
@@ -3161,10 +3161,10 @@ struct t_hdata *
gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer");
if (hdata)
{
@@ -3190,10 +3190,10 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
struct t_gui_key *ptr_key;
char option_name[64];
int i;
-
+
if (!infolist || !buffer)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -3297,7 +3297,7 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!hashtable_add_to_infolist (buffer->local_variables, ptr_item, "localvar"))
return 0;
-
+
return 1;
}
@@ -3312,7 +3312,7 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
int num_line;
char *prefix_without_colors, *message_without_colors, *tags;
char buf[256];
-
+
log_printf ("[buffer dump hexa (addr:0x%lx)]", buffer);
num_line = 1;
for (ptr_line = buffer->lines->first_line; ptr_line;
@@ -3343,7 +3343,7 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
snprintf (buf, sizeof (buf), "%s", ctime (&ptr_line->data->date_printed));
buf[strlen (buf) - 1] = '\0';
log_printf (" date_printed: %d = %s", ptr_line->data->date_printed, buf);
-
+
/* display raw message for line */
if (ptr_line->data->message)
{
@@ -3367,7 +3367,7 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
log_printf (" no message for line %d", num_line);
}
}
-
+
num_line++;
}
}
@@ -3385,7 +3385,7 @@ gui_buffer_print_log ()
struct t_gui_input_undo *ptr_undo;
char *tags;
int num;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -3465,30 +3465,30 @@ gui_buffer_print_log ()
log_printf (" local_variables . . . . : 0x%lx", ptr_buffer->local_variables);
log_printf (" prev_buffer . . . . . . : 0x%lx", ptr_buffer->prev_buffer);
log_printf (" next_buffer . . . . . . : 0x%lx", ptr_buffer->next_buffer);
-
+
if (ptr_buffer->hotlist_max_level_nicks)
{
hashtable_print_log (ptr_buffer->hotlist_max_level_nicks,
"hotlist_max_level_nicks");
}
-
+
if (ptr_buffer->keys)
{
log_printf ("");
log_printf (" => keys:");
gui_key_print_log (ptr_buffer);
}
-
+
if (ptr_buffer->local_variables)
{
hashtable_print_log (ptr_buffer->local_variables,
"local_variables");
}
-
+
log_printf ("");
log_printf (" => nicklist:");
gui_nicklist_print_log (ptr_buffer->nicklist_root, 0);
-
+
log_printf ("");
log_printf (" => last 100 lines:");
num = 0;
@@ -3502,7 +3502,7 @@ gui_buffer_print_log ()
ptr_line = ptr_buffer->own_lines->first_line;
else
ptr_line = ptr_line->next_line;
-
+
while (ptr_line)
{
num--;
@@ -3520,17 +3520,17 @@ gui_buffer_print_log ()
ptr_line->data->message);
if (tags)
free (tags);
-
+
ptr_line = ptr_line->next_line;
}
-
+
if (ptr_buffer->completion)
{
log_printf ("");
gui_completion_print_log (ptr_buffer->completion);
}
}
-
+
log_printf ("");
log_printf ("[visited buffers]");
num = 1;
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index d9b9a71cf..628877ac6 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -72,7 +72,7 @@ struct t_gui_buffer
* loaded
*/
char *plugin_name_for_upgrade; /* plugin name when upgrading */
-
+
int number; /* buffer number (first is 1) */
int layout_number; /* number of buffer saved in layout */
int layout_number_merge_order; /* order in merge for layout */
@@ -88,15 +88,15 @@ struct t_gui_buffer
/* merged and that this one is not */
/* selected buffer */
int print_hooks_enabled; /* 1 if print hooks are enabled */
-
+
/* close callback */
int (*close_callback)(void *data, /* called when buffer is closed */
struct t_gui_buffer *buffer);
void *close_callback_data; /* data for callback */
-
+
/* buffer title */
char *title; /* buffer title */
-
+
/* chat content */
struct t_gui_lines *own_lines; /* lines (for this buffer only) */
struct t_gui_lines *mixed_lines; /* mixed lines (if buffers merged) */
@@ -105,7 +105,7 @@ struct t_gui_buffer
int time_for_each_line; /* time is displayed for each line? */
int chat_refresh_needed; /* refresh for chat is needed ? */
/* (1=refresh, 2=erase+refresh) */
-
+
/* nicklist */
int nicklist; /* = 1 if nicklist is enabled */
int nicklist_case_sensitive; /* nicks are case sensitive ? */
@@ -113,7 +113,7 @@ struct t_gui_buffer
int nicklist_max_length; /* max length for a nick */
int nicklist_display_groups; /* display groups ? */
int nicklist_visible_count; /* number of nicks/groups to display */
-
+
/* inupt */
int input; /* = 1 if input is enabled */
int (*input_callback)(void *data, /* called when user send data */
@@ -129,29 +129,29 @@ struct t_gui_buffer
int input_buffer_length; /* number of chars in buffer */
int input_buffer_pos; /* position into buffer */
int input_buffer_1st_display; /* first char displayed on screen */
-
+
/* undo/redo for input */
struct t_gui_input_undo *input_undo_snap; /* snapshot of input buffer */
struct t_gui_input_undo *input_undo; /* undo for input */
struct t_gui_input_undo *last_input_undo; /* last undo for input */
struct t_gui_input_undo *ptr_input_undo; /* pointer to current undo */
int input_undo_count; /* number of undos */
-
+
/* completion */
struct t_gui_completion *completion; /* completion */
-
+
/* history */
struct t_gui_history *history; /* commands history */
struct t_gui_history *last_history;/* last command in history */
struct t_gui_history *ptr_history; /* current command in history */
int num_history; /* number of commands in history */
-
+
/* text search */
int text_search; /* text search type */
int text_search_exact; /* exact search (case sensitive) ? */
int text_search_found; /* 1 if text found, otherwise 0 */
char *text_search_input; /* input saved before text search */
-
+
/* highlight settings for buffer */
char *highlight_words; /* list of words to highlight */
char *highlight_regex; /* regex for highlight */
@@ -160,19 +160,19 @@ struct t_gui_buffer
int highlight_tags_count; /* number of tags to highlight */
/* (if 0, any tag is highlighted) */
char **highlight_tags_array; /* tags to highlight */
-
+
/* hotlist settings for buffer */
struct t_hashtable *hotlist_max_level_nicks; /* max hotlist level for */
/* some nicks */
-
+
/* keys associated to buffer */
struct t_gui_key *keys; /* keys specific to buffer */
struct t_gui_key *last_key; /* last key for buffer */
int keys_count; /* number of keys in buffer */
-
+
/* local variables */
struct t_hashtable *local_variables; /* local variables */
-
+
/* link to previous/next buffer */
struct t_gui_buffer *prev_buffer; /* link to previous buffer */
struct t_gui_buffer *next_buffer; /* link to next buffer */
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 2bb982874..25b4922f5 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -73,7 +73,7 @@ gui_chat_init ()
gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = strdup (gui_chat_prefix_empty);
gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = strdup (gui_chat_prefix_empty);
gui_chat_prefix[GUI_CHAT_PREFIX_QUIT] = strdup (gui_chat_prefix_empty);
-
+
/* some hsignals */
hook_hsignal (NULL, "chat_quote_time_prefix_message",
&gui_chat_hsignal_quote_line_cb, NULL);
@@ -93,7 +93,7 @@ gui_chat_prefix_build ()
{
char prefix[128];
int i;
-
+
for (i = 0; i < GUI_CHAT_NUM_PREFIXES; i++)
{
if (gui_chat_prefix[i])
@@ -102,27 +102,27 @@ gui_chat_prefix_build ()
gui_chat_prefix[i] = NULL;
}
}
-
+
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ERROR),
CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ERROR]));
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR] = strdup (prefix);
-
+
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_NETWORK),
CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_NETWORK]));
gui_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = strdup (prefix);
-
+
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ACTION),
CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ACTION]));
gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = strdup (prefix);
-
+
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_JOIN),
CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_JOIN]));
gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = strdup (prefix);
-
+
snprintf (prefix, sizeof (prefix), "%s%s\t",
GUI_COLOR(GUI_COLOR_CHAT_PREFIX_QUIT),
CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_QUIT]));
@@ -140,13 +140,13 @@ gui_chat_utf_char_valid (const char *utf_char)
/* chars below 32 are not valid */
if ((unsigned char)utf_char[0] < 32)
return 0;
-
+
/* 146 or 0x7F are not valid */
if ((((unsigned char)(utf_char[0]) == 146)
|| ((unsigned char)(utf_char[0]) == 0x7F))
&& (!utf_char[1]))
return 0;
-
+
/* any other char is valid */
return 1;
}
@@ -160,7 +160,7 @@ int
gui_chat_strlen_screen (const char *string)
{
int length, size_on_screen;
-
+
length = 0;
while (string && string[0])
{
@@ -209,7 +209,7 @@ char *
gui_chat_string_add_offset_screen (const char *string, int offset_screen)
{
int size_on_screen;
-
+
while (string && string[0] && (offset_screen > 0))
{
string = gui_chat_string_next_char (NULL, NULL,
@@ -235,10 +235,10 @@ gui_chat_string_real_pos (const char *string, int pos)
{
const char *real_pos, *ptr_string;
int size_on_screen;
-
+
if (pos <= 0)
return 0;
-
+
real_pos = string;
ptr_string = string;
while (ptr_string && ptr_string[0] && (pos > 0))
@@ -271,14 +271,14 @@ gui_chat_get_word_info (struct t_gui_window *window,
const char *start_data;
char *next_char, *next_char2;
int leading_spaces, char_size;
-
+
*word_start_offset = 0;
*word_end_offset = 0;
*word_length_with_spaces = 0;
*word_length = 0;
-
+
start_data = data;
-
+
leading_spaces = 1;
while (data && data[0])
{
@@ -331,17 +331,17 @@ gui_chat_get_time_string (time_t date)
char *text_with_color;
int i, time_first_digit, time_last_digit, last_color;
struct tm *local_time;
-
+
if (!CONFIG_STRING(config_look_buffer_time_format)
|| !CONFIG_STRING(config_look_buffer_time_format)[0])
return NULL;
-
+
local_time = localtime (&date);
if (strftime (text_time, sizeof (text_time),
CONFIG_STRING(config_look_buffer_time_format),
local_time) == 0)
return NULL;
-
+
if (strstr (text_time, "${"))
{
text_with_color = gui_color_string_replace_colors (text_time);
@@ -352,7 +352,7 @@ gui_chat_get_time_string (time_t date)
free (text_with_color);
}
}
-
+
time_first_digit = -1;
time_last_digit = -1;
i = 0;
@@ -366,7 +366,7 @@ gui_chat_get_time_string (time_t date)
}
i++;
}
-
+
text_time2[0] = '\0';
text_time_char[1] = '\0';
last_color = -1;
@@ -419,7 +419,7 @@ gui_chat_get_time_string (time_t date)
}
i++;
}
-
+
return strdup (text_time2);
}
@@ -434,21 +434,21 @@ gui_chat_get_time_length ()
time_t date;
char *text_time;
int length;
-
+
if (!CONFIG_STRING(config_look_buffer_time_format)
|| !CONFIG_STRING(config_look_buffer_time_format)[0])
return 0;
-
+
length = 0;
date = time (NULL);
text_time = gui_chat_get_time_string (date);
-
+
if (text_time)
{
length = gui_chat_strlen_screen (text_time);
free (text_time);
}
-
+
return length;
}
@@ -487,7 +487,7 @@ gui_chat_build_string_prefix_message (struct t_gui_line *line)
{
char *string, *string_without_colors;
int length;
-
+
length = 0;
if (line->data->prefix)
length += strlen (line->data->prefix);
@@ -495,7 +495,7 @@ gui_chat_build_string_prefix_message (struct t_gui_line *line)
if (line->data->message)
length += strlen (line->data->message);
length++;
-
+
string = malloc (length);
if (string)
{
@@ -516,7 +516,7 @@ gui_chat_build_string_prefix_message (struct t_gui_line *line)
string = string_without_colors;
}
}
-
+
return string;
}
@@ -530,7 +530,7 @@ gui_chat_build_string_message_tags (struct t_gui_line *line)
{
int i, length;
char *buf;
-
+
length = 64 + 2;
if (line->data->message)
length += strlen (line->data->message);
@@ -539,7 +539,7 @@ gui_chat_build_string_message_tags (struct t_gui_line *line)
length += strlen (line->data->tags_array[i]) + 1;
}
length += 2;
-
+
buf = malloc (length);
buf[0] = '\0';
if (line->data->message)
@@ -555,7 +555,7 @@ gui_chat_build_string_message_tags (struct t_gui_line *line)
}
strcat (buf, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
strcat (buf, "]");
-
+
return buf;
}
@@ -575,13 +575,13 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
char *pos, *pos_prefix, *pos_tab, *pos_end, *pos_lines;
char *modifier_data, *new_msg, *ptr_msg, *lines_waiting;
struct t_gui_line *ptr_line;
-
+
if (!gui_buffer_valid (buffer))
return;
-
+
if (!message)
return;
-
+
if (gui_init_ok)
{
if (!buffer)
@@ -589,10 +589,10 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
if (!buffer)
return;
-
+
if (buffer->type != GUI_BUFFER_TYPE_FORMATTED)
buffer = gui_buffers;
-
+
if (buffer->type != GUI_BUFFER_TYPE_FORMATTED)
return;
}
@@ -602,19 +602,19 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
|| ((gui_chat_mute == GUI_CHAT_MUTE_BUFFER)
&& (gui_chat_mute_buffer == buffer)))
return;
-
+
weechat_va_format (message);
if (!vbuffer)
return;
-
+
utf8_normalize (vbuffer, '?');
-
+
date_printed = time (NULL);
if (date <= 0)
date = date_printed;
-
+
at_least_one_message_printed = 0;
-
+
pos = vbuffer;
while (pos)
{
@@ -622,7 +622,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
pos_end = strchr (pos, '\n');
if (pos_end)
pos_end[0] = '\0';
-
+
/* call modifier for message printed ("weechat_print") */
new_msg = NULL;
if (buffer)
@@ -661,11 +661,11 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
}
}
}
-
+
pos_prefix = NULL;
display_time = 1;
ptr_msg = (new_msg) ? new_msg : pos;
-
+
/* space followed by tab => prefix ignored */
if ((ptr_msg[0] == ' ') && (ptr_msg[1] == '\t'))
{
@@ -691,7 +691,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
}
}
}
-
+
if (gui_init_ok)
{
ptr_line = gui_line_add (buffer, (display_time) ? date : 0,
@@ -748,16 +748,16 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
memcpy (pos_lines, ptr_msg, strlen (ptr_msg) + 1);
}
}
-
+
if (new_msg)
free (new_msg);
-
+
pos = (pos_end && pos_end[1]) ? pos_end + 1 : NULL;
}
-
+
if (gui_init_ok && at_least_one_message_printed)
gui_buffer_ask_chat_refresh (buffer, 1);
-
+
end:
free (vbuffer);
}
@@ -773,25 +773,25 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
{
struct t_gui_line *ptr_line;
int i, num_lines_to_add;
-
+
if (gui_init_ok)
{
if (!buffer)
buffer = gui_buffer_search_main ();
-
+
if (buffer->type != GUI_BUFFER_TYPE_FREE)
buffer = gui_buffers;
-
+
if (buffer->type != GUI_BUFFER_TYPE_FREE)
return;
}
-
+
weechat_va_format (message);
if (!vbuffer)
return;
-
+
utf8_normalize (vbuffer, '?');
-
+
/* no message: delete line */
if (!vbuffer[0])
{
@@ -840,7 +840,7 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
else
string_iconv_fprintf (stdout, "%s\n", vbuffer);
}
-
+
free (vbuffer);
}
@@ -853,7 +853,7 @@ gui_chat_print_lines_waiting_buffer ()
{
char **lines;
int num_lines, i;
-
+
if (gui_chat_lines_waiting_buffer)
{
lines = string_split (gui_chat_lines_waiting_buffer, "\n", 0, 0,
@@ -889,26 +889,26 @@ gui_chat_hsignal_quote_line_cb (void *data, const char *signal,
const char *time, *prefix, *message;
int length_time, length_prefix, length_message, length;
char *str;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!gui_current_window->buffer->input)
return WEECHAT_RC_OK;
-
+
time = (strstr (signal, "time")) ?
hashtable_get (hashtable, "_chat_line_time") : NULL;
prefix = (strstr (signal, "prefix")) ?
hashtable_get (hashtable, "_chat_line_prefix") : NULL;
message = hashtable_get (hashtable, "_chat_line_message");
-
+
if (!message)
return WEECHAT_RC_OK;
-
+
length_time = (time) ? strlen (time) : 0;
length_prefix = (prefix) ? strlen (prefix) : 0;
length_message = strlen (message);
-
+
length = length_time + 1 + length_prefix + 1 +
strlen (CONFIG_STRING(config_look_prefix_suffix)) + 1 +
length_message + 1 + 1;
@@ -928,7 +928,7 @@ gui_chat_hsignal_quote_line_cb (void *data, const char *signal,
gui_input_text_changed_modifier_and_signal (gui_current_window->buffer, 1);
free (str);
}
-
+
return WEECHAT_RC_OK;
}
@@ -940,7 +940,7 @@ void
gui_chat_end ()
{
int i;
-
+
/* free prefixes */
for (i = 0; i < GUI_CHAT_NUM_PREFIXES; i++)
{
@@ -950,7 +950,7 @@ gui_chat_end ()
gui_chat_prefix[i] = NULL;
}
}
-
+
/* free lines waiting for buffer (should always be NULL here) */
if (gui_chat_lines_waiting_buffer)
{
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index f7ff32f0e..d63ab31d0 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -37,7 +37,7 @@ enum t_gui_chat_prefix
GUI_CHAT_PREFIX_ACTION,
GUI_CHAT_PREFIX_JOIN,
GUI_CHAT_PREFIX_QUIT,
-
+
GUI_CHAT_NUM_PREFIXES,
};
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index d2a8e94de..19b508efb 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -62,7 +62,7 @@ const char *
gui_color_search_config (const char *color_name)
{
struct t_config_option *ptr_option;
-
+
if (color_name)
{
for (ptr_option = weechat_config_section_color->options;
@@ -79,7 +79,7 @@ gui_color_search_config (const char *color_name)
}
}
}
-
+
/* color not found */
return NULL;
}
@@ -94,19 +94,19 @@ gui_color_attr_get_flag (char c)
{
if (c == GUI_COLOR_EXTENDED_BOLD_CHAR)
return GUI_COLOR_EXTENDED_BOLD_FLAG;
-
+
if (c == GUI_COLOR_EXTENDED_REVERSE_CHAR)
return GUI_COLOR_EXTENDED_REVERSE_FLAG;
-
+
if (c == GUI_COLOR_EXTENDED_ITALIC_CHAR)
return GUI_COLOR_EXTENDED_ITALIC_FLAG;
-
+
if (c == GUI_COLOR_EXTENDED_UNDERLINE_CHAR)
return GUI_COLOR_EXTENDED_UNDERLINE_FLAG;
-
+
if (c == GUI_COLOR_EXTENDED_KEEPATTR_CHAR)
return GUI_COLOR_EXTENDED_KEEPATTR_FLAG;
-
+
return 0;
}
@@ -120,9 +120,9 @@ void
gui_color_attr_build_string (int color, char *str_attr)
{
int i;
-
+
i = 0;
-
+
if (color & GUI_COLOR_EXTENDED_BOLD_FLAG)
str_attr[i++] = GUI_COLOR_EXTENDED_BOLD_CHAR;
if (color & GUI_COLOR_EXTENDED_REVERSE_FLAG)
@@ -133,7 +133,7 @@ gui_color_attr_build_string (int color, char *str_attr)
str_attr[i++] = GUI_COLOR_EXTENDED_UNDERLINE_CHAR;
if (color & GUI_COLOR_EXTENDED_KEEPATTR_FLAG)
str_attr[i++] = GUI_COLOR_EXTENDED_KEEPATTR_CHAR;
-
+
str_attr[i] = '\0';
}
@@ -150,14 +150,14 @@ gui_color_get_custom (const char *color_name)
char color_fg[32], color_bg[32];
char *pos_delim, *str_fg, *pos_bg, *error, *color_attr;
const char *ptr_color_name;
-
+
/* attribute or other color name (GUI dependent) */
index_color = (index_color + 1) % 32;
color[index_color][0] = '\0';
-
+
if (!color_name || !color_name[0])
return color[index_color];
-
+
if (string_strcasecmp (color_name, "reset") == 0)
{
snprintf (color[index_color], sizeof (color[index_color]),
@@ -261,7 +261,7 @@ gui_color_get_custom (const char *color_name)
color_attr = NULL;
color_fg[0] = '\0';
color_bg[0] = '\0';
-
+
/* read extra attributes (bold, ..) */
ptr_color_name = color_name;
while (gui_color_attr_get_flag (ptr_color_name[0]) > 0)
@@ -273,7 +273,7 @@ gui_color_get_custom (const char *color_name)
color_attr = string_strndup (color_name,
ptr_color_name - color_name);
}
-
+
pos_delim = strchr (ptr_color_name, ',');
if (!pos_delim)
pos_delim = strchr (ptr_color_name, ':');
@@ -291,7 +291,7 @@ gui_color_get_custom (const char *color_name)
str_fg = strdup (ptr_color_name);
pos_bg = NULL;
}
-
+
if (str_fg)
{
fg_term = gui_color_palette_get_alias (str_fg);
@@ -330,7 +330,7 @@ gui_color_get_custom (const char *color_name)
bg = gui_color_search (pos_bg);
}
}
-
+
if (fg_term >= 0)
{
snprintf (color_fg, sizeof (color_fg), "%c%s%05d",
@@ -344,7 +344,7 @@ gui_color_get_custom (const char *color_name)
(color_attr) ? color_attr : "",
fg);
}
-
+
if (bg_term >= 0)
{
snprintf (color_bg, sizeof (color_bg), "%c%05d",
@@ -382,13 +382,13 @@ gui_color_get_custom (const char *color_name)
GUI_COLOR_BG_CHAR,
color_bg);
}
-
+
if (color_attr)
free (color_attr);
if (str_fg)
free (str_fg);
}
-
+
return color[index_color];
}
@@ -408,15 +408,15 @@ gui_color_decode (const char *string, const char *replacement)
const unsigned char *ptr_string;
unsigned char *out;
int out_length, out_pos, length;
-
+
if (!string)
return NULL;
-
+
out_length = (strlen ((char *)string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
@@ -577,7 +577,7 @@ gui_color_decode (const char *string, const char *replacement)
}
}
out[out_pos] = '\0';
-
+
return (char *)out;
}
@@ -593,10 +593,10 @@ gui_color_string_replace_colors (const char *string)
int length, length_color, index_string, index_result;
char *result, *result2, *color_name;
const char *pos_end_name, *ptr_color;
-
+
if (!string)
return NULL;
-
+
length = strlen (string) + 1;
result = malloc (length);
if (result)
@@ -642,7 +642,7 @@ gui_color_string_replace_colors (const char *string)
}
else
result[index_result++] = string[index_string++];
-
+
free (color_name);
}
else
@@ -656,7 +656,7 @@ gui_color_string_replace_colors (const char *string)
}
result[index_result] = '\0';
}
-
+
return result;
}
@@ -671,7 +671,7 @@ gui_color_free (struct t_gui_color *color)
{
if (color->string)
free (color->string);
-
+
free (color);
}
}
@@ -686,13 +686,13 @@ gui_color_palette_free_value_cb (struct t_hashtable *hashtable,
const void *key, void *value)
{
struct t_gui_color_palette *color_palette;
-
+
/* make C compiler happy */
(void) hashtable;
(void) key;
-
+
color_palette = (struct t_gui_color_palette *)value;
-
+
if (color_palette)
gui_color_palette_free (color_palette);
}
@@ -738,14 +738,14 @@ int
gui_color_palette_get_alias (const char *alias)
{
int *ptr_number;
-
+
if (gui_color_hash_palette_alias)
{
ptr_number = hashtable_get (gui_color_hash_palette_alias, alias);
if (ptr_number)
return *ptr_number;
}
-
+
/* alias not found */
return -1;
}
@@ -758,7 +758,7 @@ struct t_gui_color_palette *
gui_color_palette_get (int number)
{
char str_number[64];
-
+
snprintf (str_number, sizeof (str_number), "%d", number);
return hashtable_get (gui_color_hash_palette_color,
str_number);
@@ -773,18 +773,18 @@ gui_color_palette_add (int number, const char *value)
{
struct t_gui_color_palette *new_color_palette;
char str_number[64];
-
+
gui_color_palette_alloc_structs ();
-
+
new_color_palette = gui_color_palette_new (number, value);
if (!new_color_palette)
return;
-
+
snprintf (str_number, sizeof (str_number), "%d", number);
hashtable_set (gui_color_hash_palette_color,
str_number, new_color_palette);
gui_color_palette_build_aliases ();
-
+
if (gui_init_ok)
gui_color_buffer_display ();
}
@@ -798,9 +798,9 @@ gui_color_palette_remove (int number)
{
struct t_gui_color_palette *ptr_color_palette;
char str_number[64];
-
+
gui_color_palette_alloc_structs ();
-
+
snprintf (str_number, sizeof (str_number), "%d", number);
ptr_color_palette = hashtable_get (gui_color_hash_palette_color,
str_number);
@@ -808,7 +808,7 @@ gui_color_palette_remove (int number)
{
hashtable_remove (gui_color_hash_palette_color, str_number);
gui_color_palette_build_aliases ();
-
+
if (gui_init_ok)
gui_color_buffer_display ();
}
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 5b87e2a55..364df8d01 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -23,7 +23,7 @@
enum t_gui_color_enum
{
GUI_COLOR_SEPARATOR = 0,
-
+
GUI_COLOR_CHAT,
GUI_COLOR_CHAT_TIME,
GUI_COLOR_CHAT_TIME_DELIMITERS,
@@ -65,7 +65,7 @@ enum t_gui_color_enum
GUI_COLOR_CHAT_INACTIVE_WINDOW,
GUI_COLOR_CHAT_INACTIVE_BUFFER,
GUI_COLOR_CHAT_PREFIX_BUFFER_INACTIVE_BUFFER,
-
+
/* number of colors */
GUI_COLOR_NUM_COLORS,
};
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 6f6118b62..06211172a 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -68,15 +68,15 @@ gui_completion_buffer_init (struct t_gui_completion *completion,
completion->direction = 0;
completion->add_space = 1;
completion->force_partial_completion = 0;
-
+
completion->completion_list = weelist_new ();
-
+
completion->word_found = NULL;
completion->word_found_is_nick = 0;
completion->position_replace = 0;
completion->diff_size = 0;
completion->diff_length = 0;
-
+
completion->partial_completion_list = NULL;
completion->last_partial_completion = NULL;
}
@@ -90,13 +90,13 @@ gui_completion_partial_list_add (struct t_gui_completion *completion,
const char *word, int count)
{
struct t_gui_completion_partial *new_item;
-
+
new_item = malloc (sizeof (*new_item));
if (new_item)
{
new_item->word = strdup (word);
new_item->count = count;
-
+
new_item->prev_item = completion->last_partial_completion;
if (completion->partial_completion_list)
(completion->last_partial_completion)->next_item = new_item;
@@ -125,11 +125,11 @@ gui_completion_partial_list_free (struct t_gui_completion *completion,
completion->partial_completion_list = item->next_item;
if (completion->last_partial_completion == item)
completion->last_partial_completion = item->prev_item;
-
+
/* free data */
if (item->word)
free (item->word);
-
+
free (item);
}
@@ -157,11 +157,11 @@ gui_completion_free_data (struct t_gui_completion *completion)
if (completion->base_command)
free (completion->base_command);
completion->base_command = NULL;
-
+
if (completion->base_word)
free (completion->base_word);
completion->base_word = NULL;
-
+
if (completion->args)
free (completion->args);
completion->args = NULL;
@@ -171,7 +171,7 @@ gui_completion_free_data (struct t_gui_completion *completion)
weelist_free (completion->completion_list);
completion->completion_list = NULL;
}
-
+
if (completion->word_found)
free (completion->word_found);
completion->word_found = NULL;
@@ -218,9 +218,9 @@ gui_completion_search_command (struct t_weechat_plugin *plugin,
const char *command)
{
struct t_hook *ptr_hook, *hook_for_other_plugin;
-
+
hook_for_other_plugin = NULL;
-
+
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
@@ -232,11 +232,11 @@ gui_completion_search_command (struct t_weechat_plugin *plugin,
{
if (ptr_hook->plugin == plugin)
return ptr_hook;
-
+
hook_for_other_plugin = ptr_hook;
}
}
-
+
return hook_for_other_plugin;
}
@@ -250,17 +250,17 @@ gui_completion_nick_has_ignored_chars (const char *string)
{
int char_size;
char utf_char[16];
-
+
while (string[0])
{
char_size = utf8_char_size (string);
memcpy (utf_char, string, char_size);
utf_char[char_size] = '\0';
-
+
if (strstr (CONFIG_STRING(config_completion_nick_ignore_chars),
utf_char))
return 1;
-
+
string += char_size;
}
return 0;
@@ -276,7 +276,7 @@ gui_completion_nick_strdup_ignore_chars (const char *string)
{
int char_size;
char *result, *pos, utf_char[16];
-
+
result = malloc (strlen (string) + 1);
pos = result;
while (string[0])
@@ -284,14 +284,14 @@ gui_completion_nick_strdup_ignore_chars (const char *string)
char_size = utf8_char_size (string);
memcpy (utf_char, string, char_size);
utf_char[char_size] = '\0';
-
+
if (!strstr (CONFIG_STRING(config_completion_nick_ignore_chars),
utf_char))
{
memcpy (pos, utf_char, char_size);
pos += char_size;
}
-
+
string += char_size;
}
pos[0] = '\0';
@@ -308,22 +308,22 @@ gui_completion_nickncmp (const char *base_word, const char *nick, int max)
{
char *base_word2, *nick2;
int return_cmp;
-
+
if (!CONFIG_STRING(config_completion_nick_ignore_chars)
|| !CONFIG_STRING(config_completion_nick_ignore_chars)[0]
|| !base_word || !nick || !base_word[0] || !nick[0]
|| gui_completion_nick_has_ignored_chars (base_word))
return string_strncasecmp (base_word, nick, max);
-
+
base_word2 = gui_completion_nick_strdup_ignore_chars (base_word);
nick2 = gui_completion_nick_strdup_ignore_chars (nick);
-
+
return_cmp = string_strncasecmp (base_word2, nick2,
utf8_strlen (base_word2));
-
+
free (base_word2);
free (nick2);
-
+
return return_cmp;
}
@@ -336,10 +336,10 @@ gui_completion_list_add (struct t_gui_completion *completion, const char *word,
int nick_completion, const char *where)
{
char buffer[512];
-
+
if (!word || !word[0])
return;
-
+
if (!completion->base_word || !completion->base_word[0]
|| (nick_completion && (gui_completion_nickncmp (completion->base_word, word,
utf8_strlen (completion->base_word)) == 0))
@@ -388,7 +388,7 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
char *word, *custom_completion;
const char *pos, *pos_end;
int word_offset;
-
+
word = strdup (template);
word_offset = 0;
pos = template;
@@ -464,11 +464,11 @@ gui_completion_get_matching_template (struct t_gui_completion *completion,
struct t_hook *hook_command)
{
int i, length;
-
+
/* without at least one argument, we can't find matching template! */
if (completion->base_command_arg_index <= 1)
return -1;
-
+
for (i = 0; i < HOOK_COMMAND(hook_command, cplt_num_templates); i++)
{
length = strlen (HOOK_COMMAND(hook_command, cplt_templates_static)[i]);
@@ -479,7 +479,7 @@ gui_completion_get_matching_template (struct t_gui_completion *completion,
return i;
}
}
-
+
return -1;
}
@@ -493,7 +493,7 @@ gui_completion_get_template_for_args (struct t_gui_completion *completion,
struct t_hook *hook_command)
{
int matching_template;
-
+
/*
* if template refers to another command, search this command and use its
* template
@@ -511,11 +511,11 @@ gui_completion_get_template_for_args (struct t_gui_completion *completion,
return strdup ("");
}
}
-
+
/* if only one template available, then use it */
if (HOOK_COMMAND(hook_command, cplt_num_templates) == 1)
return strdup (HOOK_COMMAND(hook_command, cplt_templates)[0]);
-
+
/* search which template is matching arguments from user */
matching_template = gui_completion_get_matching_template (completion,
hook_command);
@@ -543,9 +543,9 @@ gui_completion_build_list (struct t_gui_completion *completion)
struct t_hook *ptr_hook;
char *template, *pos_template, *pos_space;
int repeat_last, i, length;
-
+
repeat_last = 0;
-
+
ptr_hook = gui_completion_search_command (completion->buffer->plugin,
completion->base_command);
if (!ptr_hook || !HOOK_COMMAND(ptr_hook, completion))
@@ -556,24 +556,24 @@ gui_completion_build_list (struct t_gui_completion *completion)
completion->base_command = NULL;
return;
}
-
+
if (strcmp (HOOK_COMMAND(ptr_hook, completion), "-") == 0)
{
gui_completion_stop (completion, 1);
return;
}
-
+
template = gui_completion_get_template_for_args (completion, ptr_hook);
if (!template)
return;
-
+
length = strlen (template);
if (length >= 2)
{
if (strcmp (template + length - 2, "%*") == 0)
repeat_last = 1;
}
-
+
i = 1;
pos_template = template;
while (pos_template && pos_template[0])
@@ -619,7 +619,7 @@ gui_completion_find_context (struct t_gui_completion *completion,
{
int i, command, command_arg, pos_start, pos_end;
char *prev_char;
-
+
/* look for context */
gui_completion_free_data (completion);
gui_completion_buffer_init (completion, completion->buffer);
@@ -657,11 +657,11 @@ gui_completion_find_context (struct t_gui_completion *completion,
}
else
completion->context = GUI_COMPLETION_AUTO;
-
+
/* look for word to complete (base word) */
completion->base_word_pos = 0;
completion->position_replace = pos;
-
+
if (size > 0)
{
i = pos;
@@ -699,9 +699,9 @@ gui_completion_find_context (struct t_gui_completion *completion,
if (string_is_command_char (data + pos_start))
pos_start += utf8_char_size (data + pos_start);
}
-
+
completion->base_word_pos = pos_start;
-
+
if (pos_start <= pos_end)
{
completion->position_replace = pos_start;
@@ -713,10 +713,10 @@ gui_completion_find_context (struct t_gui_completion *completion,
completion->base_word[pos_end - pos_start + 1] = '\0';
}
}
-
+
if (!completion->base_word)
completion->base_word = strdup ("");
-
+
/* find command (for command argument completion only) */
if (completion->context == GUI_COMPLETION_COMMAND_ARG)
{
@@ -740,7 +740,7 @@ gui_completion_find_context (struct t_gui_completion *completion,
prev_char = utf8_prev_char (data, data + pos_end);
pos_end -= utf8_char_size (prev_char);
}
-
+
completion->base_command = malloc (pos_end - pos_start + 2);
for (i = pos_start; i <= pos_end; i++)
{
@@ -750,7 +750,7 @@ gui_completion_find_context (struct t_gui_completion *completion,
gui_completion_build_list (completion);
}
}
-
+
/*
* auto completion with nothing as base word is disabled,
* in order to prevent completion when pasting messages with [tab] inside
@@ -780,14 +780,14 @@ gui_completion_common_prefix_size (struct t_weelist *list,
{
struct t_weelist_item *ptr_item;
char *ptr_first_item, *ptr_char, *next_char;
-
+
ptr_first_item = list->items->data;
ptr_char = ptr_first_item;
-
+
while (ptr_char && ptr_char[0])
{
next_char = utf8_next_char (ptr_char);
-
+
for (ptr_item = list->items->next_item; ptr_item;
ptr_item = ptr_item->next_item)
{
@@ -802,7 +802,7 @@ gui_completion_common_prefix_size (struct t_weelist *list,
}
}
}
-
+
ptr_char = next_char;
}
return ptr_char - ptr_first_item;
@@ -821,23 +821,23 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
char utf_char[16], *word;
struct t_weelist *weelist_temp;
struct t_weelist_item *ptr_item, *next_item;
-
+
gui_completion_partial_list_free_all (completion);
-
+
if (!completion->completion_list || !completion->completion_list->items)
return;
-
+
weelist_temp = weelist_new ();
if (!weelist_temp)
return;
-
+
for (ptr_item = completion->completion_list->items; ptr_item;
ptr_item = ptr_item->next_item)
{
weelist_add (weelist_temp, ptr_item->data + common_prefix_size,
WEECHAT_LIST_POS_END, NULL);
}
-
+
while (weelist_temp->items)
{
char_size = utf8_char_size (weelist_temp->items->data);
@@ -856,13 +856,13 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
while (ptr_item)
{
next_item = ptr_item->next_item;
-
+
if (utf8_charcasecmp (utf_char, ptr_item->data) == 0)
{
weelist_remove (weelist_temp, ptr_item);
items_count++;
}
-
+
ptr_item = next_item;
}
if (word)
@@ -874,7 +874,7 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
free (word);
}
}
-
+
weelist_free (weelist_temp);
}
@@ -888,13 +888,13 @@ gui_completion_complete (struct t_gui_completion *completion)
int length, word_found_seen, other_completion, partial_completion;
int common_prefix_size, item_is_nick;
struct t_weelist_item *ptr_item, *ptr_item2;
-
+
length = utf8_strlen (completion->base_word);
word_found_seen = 0;
other_completion = 0;
-
+
partial_completion = completion->force_partial_completion;
-
+
if (!partial_completion)
{
if (completion->context == GUI_COMPLETION_COMMAND)
@@ -908,7 +908,7 @@ gui_completion_complete (struct t_gui_completion *completion)
else
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_other);
}
-
+
common_prefix_size = 0;
if (partial_completion
&& completion->completion_list && completion->completion_list->items)
@@ -916,7 +916,7 @@ gui_completion_complete (struct t_gui_completion *completion)
common_prefix_size = gui_completion_common_prefix_size (completion->completion_list,
NULL);
}
-
+
ptr_item = NULL;
if (completion->completion_list)
{
@@ -925,14 +925,14 @@ gui_completion_complete (struct t_gui_completion *completion)
else
ptr_item = completion->completion_list->items;
}
-
+
if (partial_completion
&& completion->word_found
&& (utf8_strlen (completion->word_found) >= common_prefix_size))
{
return;
}
-
+
while (ptr_item)
{
item_is_nick = ((long)(ptr_item->user_data) == 1);
@@ -954,7 +954,7 @@ gui_completion_complete (struct t_gui_completion *completion)
{
completion->add_space = 0;
}
-
+
/* stop after first nick if user asked that */
if (item_is_nick
&& CONFIG_BOOLEAN(config_completion_nick_first_only))
@@ -962,12 +962,12 @@ gui_completion_complete (struct t_gui_completion *completion)
gui_completion_stop (completion, 1);
return;
}
-
+
if (completion->direction < 0)
ptr_item2 = ptr_item->prev_item;
else
ptr_item2 = ptr_item->next_item;
-
+
while (ptr_item2)
{
if ((item_is_nick
@@ -981,19 +981,19 @@ gui_completion_complete (struct t_gui_completion *completion)
{
other_completion++;
}
-
+
if (completion->direction < 0)
ptr_item2 = ptr_item2->prev_item;
else
ptr_item2 = ptr_item2->next_item;
}
-
+
if (other_completion == 0)
completion->position = -1;
else
if (completion->position < 0)
completion->position = 0;
-
+
/* stop after common prefix, if asked by user */
if (partial_completion
&& ((utf8_strlen (completion->word_found) >= common_prefix_size))
@@ -1004,11 +1004,11 @@ gui_completion_complete (struct t_gui_completion *completion)
completion->add_space = 0;
completion->position = -1;
string_tolower (completion->word_found);
-
+
/* alert user of partial completion */
if (CONFIG_BOOLEAN(config_completion_partial_completion_alert))
printf ("\a");
-
+
/*
* send "partial_completion" signal, to display possible
* completions in bar item
@@ -1019,9 +1019,9 @@ gui_completion_complete (struct t_gui_completion *completion)
WEECHAT_HOOK_SIGNAL_STRING, NULL);
return;
}
-
+
gui_completion_partial_list_free_all (completion);
-
+
return;
}
other_completion++;
@@ -1029,13 +1029,13 @@ gui_completion_complete (struct t_gui_completion *completion)
if (completion->word_found &&
(strcmp (ptr_item->data, completion->word_found) == 0))
word_found_seen = 1;
-
+
if (completion->direction < 0)
ptr_item = ptr_item->prev_item;
else
ptr_item = ptr_item->next_item;
}
-
+
/*
* if we was on last completion in list, then recomplete, starting from
* first matching item
@@ -1057,7 +1057,7 @@ void
gui_completion_command (struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
-
+
if (!completion->completion_list->items)
{
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
@@ -1073,7 +1073,7 @@ gui_completion_command (struct t_gui_completion *completion)
}
}
}
-
+
gui_completion_complete (completion);
}
@@ -1093,7 +1093,7 @@ gui_completion_auto (struct t_gui_completion *completion)
gui_completion_complete (completion);
return;
}
-
+
/* use default template completion */
if (!completion->completion_list->items)
{
@@ -1113,9 +1113,9 @@ gui_completion_search (struct t_gui_completion *completion, int direction,
const char *data, int size, int pos)
{
char *old_word_found;
-
+
completion->direction = direction;
-
+
/* if new completion => look for base word */
if (pos != completion->position)
{
@@ -1126,7 +1126,7 @@ gui_completion_search (struct t_gui_completion *completion, int direction,
gui_completion_find_context (completion, data, size, pos);
completion->force_partial_completion = (direction < 0);
}
-
+
/* completion */
old_word_found = (completion->word_found) ?
strdup (completion->word_found) : NULL;
@@ -1189,7 +1189,7 @@ gui_completion_get_string (struct t_gui_completion *completion,
else if (string_strcasecmp (property, "args") == 0)
return completion->args;
}
-
+
return NULL;
}
@@ -1201,10 +1201,10 @@ struct t_hdata *
gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
if (hdata)
{
@@ -1240,10 +1240,10 @@ struct t_hdata *
gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
if (hdata)
{
@@ -1263,7 +1263,7 @@ void
gui_completion_print_log (struct t_gui_completion *completion)
{
struct t_gui_completion_partial *ptr_item;
-
+
log_printf ("[completion (addr:0x%lx)]", completion);
log_printf (" buffer. . . . . . . . . : 0x%lx", completion->buffer);
log_printf (" context . . . . . . . . : %d", completion->context);
diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h
index 635d9bc47..ad2fc1927 100644
--- a/src/gui/gui-completion.h
+++ b/src/gui/gui-completion.h
@@ -47,10 +47,10 @@ struct t_gui_completion
int direction; /* +1=search next word, -1=previous word */
int add_space; /* add space after completion? */
int force_partial_completion; /* force partial completion? */
-
+
/* for command argument completion */
struct t_weelist *completion_list; /* data list for completion */
-
+
/* completion found */
char *word_found; /* word found (to replace base word) */
int word_found_is_nick; /* word found is nick? */
diff --git a/src/gui/gui-cursor.c b/src/gui/gui-cursor.c
index 78dabfd65..a33537329 100644
--- a/src/gui/gui-cursor.c
+++ b/src/gui/gui-cursor.c
@@ -55,7 +55,7 @@ void
gui_cursor_mode_toggle ()
{
gui_cursor_mode ^= 1;
-
+
if (gui_cursor_mode)
{
if (gui_cursor_debug)
@@ -82,7 +82,7 @@ void
gui_cursor_debug_set (int debug)
{
gui_cursor_debug = debug;
-
+
if (gui_cursor_debug)
{
gui_chat_printf (NULL, _("Debug enabled for cursor mode (%s)"),
@@ -101,10 +101,10 @@ gui_cursor_display_debug_info ()
{
struct t_gui_focus_info *focus_info;
char str_info[1024];
-
+
if (!gui_cursor_debug)
return;
-
+
focus_info = gui_focus_get_info (gui_cursor_x, gui_cursor_y);
if (focus_info)
{
@@ -138,20 +138,20 @@ gui_cursor_move_xy (int x, int y)
{
if (!gui_cursor_mode)
gui_cursor_mode_toggle ();
-
+
gui_cursor_x = x;
gui_cursor_y = y;
-
+
if (gui_cursor_x < 0)
gui_cursor_x = 0;
else if (gui_cursor_x > gui_window_get_width () - 1)
gui_cursor_x = gui_window_get_width () - 1;
-
+
if (gui_cursor_y < 0)
gui_cursor_y = 0;
else if (gui_cursor_y > gui_window_get_height () - 1)
gui_cursor_y = gui_window_get_height () - 1;
-
+
gui_cursor_display_debug_info ();
gui_window_move_cursor ();
}
@@ -165,20 +165,20 @@ gui_cursor_move_add_xy (int add_x, int add_y)
{
if (!gui_cursor_mode)
gui_cursor_mode_toggle ();
-
+
gui_cursor_x += add_x;
gui_cursor_y += add_y;
-
+
if (gui_cursor_x < 0)
gui_cursor_x = gui_window_get_width () - 1;
else if (gui_cursor_x > gui_window_get_width () - 1)
gui_cursor_x = 0;
-
+
if (gui_cursor_y < 0)
gui_cursor_y = gui_window_get_height () - 1;
else if (gui_cursor_y > gui_window_get_height () - 1)
gui_cursor_y = 0;
-
+
gui_cursor_display_debug_info ();
gui_window_move_cursor ();
}
@@ -193,27 +193,27 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
{
int x, y, width, height, area_found;
struct t_gui_focus_info *focus_info_old, *focus_info_new;
-
+
if (!gui_cursor_mode)
gui_cursor_mode_toggle ();
-
+
area_found = 0;
-
+
x = gui_cursor_x;
y = gui_cursor_y;
width = gui_window_get_width ();
height = gui_window_get_height ();
-
+
focus_info_old = gui_focus_get_info (x, y);
if (!focus_info_old)
return;
focus_info_new = NULL;
-
+
if (add_x != 0)
x += add_x;
else
y += add_y;
-
+
while ((x >= 0) && (x < width) && (y >= 0) && (y < height))
{
focus_info_new = gui_focus_get_info (x, y);
@@ -230,13 +230,13 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
area_found = 1;
break;
}
-
+
if (add_x != 0)
x += add_x;
else
y += add_y;
}
-
+
if (area_found)
{
if (focus_info_new->window && focus_info_new->chat)
@@ -252,7 +252,7 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
else
area_found = 0;
}
-
+
if (area_found)
{
gui_cursor_x = x;
@@ -260,7 +260,7 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
gui_cursor_display_debug_info ();
gui_window_move_cursor ();
}
-
+
gui_focus_free_info (focus_info_old);
if (focus_info_new)
gui_focus_free_info (focus_info_new);
@@ -276,11 +276,11 @@ gui_cursor_move_area (const char *area)
int area_found, x, y;
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_bar *ptr_bar;
-
+
area_found = 0;
x = 0;
y = 0;
-
+
if (strcmp (area, "chat") == 0)
{
area_found = 1;
@@ -313,7 +313,7 @@ gui_cursor_move_area (const char *area)
}
}
}
-
+
if (area_found)
{
if (!gui_cursor_mode)
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index ae2496eef..608dcc347 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -58,13 +58,13 @@ int
gui_filter_line_has_tag_no_filter (struct t_gui_line *line)
{
int i;
-
+
for (i = 0; i < line->data->tags_count; i++)
{
if (strcmp (line->data->tags_array[i], GUI_FILTER_TAG_NO_FILTER) == 0)
return 1;
}
-
+
/* tag not found, line may be filtered */
return 0;
}
@@ -79,14 +79,14 @@ gui_filter_check_line (struct t_gui_line *line, const char *buffer_full_name)
{
struct t_gui_filter *ptr_filter;
int rc;
-
+
/* line is always displayed if filters are disabled */
if (!gui_filters_enabled)
return 1;
-
+
if (gui_filter_line_has_tag_no_filter (line))
return 1;
-
+
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
@@ -120,7 +120,7 @@ gui_filter_check_line (struct t_gui_line *line, const char *buffer_full_name)
}
}
}
-
+
/* no tag or regex matching, then line is displayed */
return 1;
}
@@ -135,36 +135,36 @@ gui_filter_buffer (struct t_gui_buffer *buffer)
struct t_gui_line *ptr_line;
int line_displayed, lines_hidden;
char buffer_full_name[512];
-
+
lines_hidden = 0;
-
+
buffer->lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min);
-
+
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
gui_buffer_get_plugin_name (buffer),
buffer->name);
-
+
for (ptr_line = buffer->lines->first_line; ptr_line;
ptr_line = ptr_line->next_line)
{
line_displayed = gui_filter_check_line (ptr_line, buffer_full_name);
-
+
if (line_displayed
&& (ptr_line->data->prefix_length > buffer->lines->prefix_max_length))
{
buffer->lines->prefix_max_length = ptr_line->data->prefix_length;
}
-
+
/* force chat refresh if at least one line changed */
if (ptr_line->data->displayed != line_displayed)
gui_buffer_ask_chat_refresh (buffer, 2);
-
+
ptr_line->data->displayed = line_displayed;
-
+
if (!line_displayed)
lines_hidden = 1;
}
-
+
if (buffer->lines->lines_hidden != lines_hidden)
{
buffer->lines->lines_hidden = lines_hidden;
@@ -181,7 +181,7 @@ void
gui_filter_all_buffers ()
{
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -257,14 +257,14 @@ struct t_gui_filter *
gui_filter_search_by_name (const char *name)
{
struct t_gui_filter *ptr_filter;
-
+
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
if (strcmp (ptr_filter->name, name) == 0)
return ptr_filter;
}
-
+
/* filter not found */
return NULL;
}
@@ -281,20 +281,20 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
regex_t *regex1, *regex2;
char *pos_tab, *regex_prefix;
const char *ptr_start_regex, *pos_regex_message;
-
+
if (!name || !buffer_name || !tags || !regex)
return NULL;
-
+
if (gui_filter_search_by_name (name))
return NULL;
-
+
ptr_start_regex = regex;
if ((ptr_start_regex[0] == '!')
|| ((ptr_start_regex[0] == '\\') && (ptr_start_regex[1] == '!')))
{
ptr_start_regex++;
}
-
+
regex1 = NULL;
regex2 = NULL;
if (strcmp (ptr_start_regex, "*") != 0)
@@ -311,7 +311,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
regex_prefix = NULL;
pos_regex_message = ptr_start_regex;
}
-
+
if (regex_prefix)
{
regex1 = malloc (sizeof (*regex1));
@@ -326,7 +326,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
}
}
}
-
+
regex2 = malloc (sizeof (*regex2));
if (regex2)
{
@@ -341,11 +341,11 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
return NULL;
}
}
-
+
if (regex_prefix)
free (regex_prefix);
}
-
+
/* create new filter */
new_filter = malloc (sizeof (*new_filter));
if (new_filter)
@@ -372,7 +372,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
new_filter->regex = strdup (regex);
new_filter->regex_prefix = regex1;
new_filter->regex_message = regex2;
-
+
/* add filter to filters list */
new_filter->prev_filter = last_gui_filter;
if (gui_filters)
@@ -381,13 +381,13 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
gui_filters = new_filter;
last_gui_filter = new_filter;
new_filter->next_filter = NULL;
-
+
gui_filter_all_buffers ();
-
+
hook_signal_send ("filter_added",
WEECHAT_HOOK_SIGNAL_POINTER, new_filter);
}
-
+
return new_filter;
}
@@ -400,13 +400,13 @@ gui_filter_rename (struct t_gui_filter *filter, const char *new_name)
{
if (!filter || !new_name)
return 0;
-
+
if (gui_filter_search_by_name (new_name))
return 0;
-
+
free (filter->name);
filter->name = strdup (new_name);
-
+
return 1;
}
@@ -419,7 +419,7 @@ gui_filter_free (struct t_gui_filter *filter)
{
hook_signal_send ("filter_removing",
WEECHAT_HOOK_SIGNAL_POINTER, filter);
-
+
/* free data */
if (filter->name)
free (filter->name);
@@ -443,7 +443,7 @@ gui_filter_free (struct t_gui_filter *filter)
regfree (filter->regex_message);
free (filter->regex_message);
}
-
+
/* remove filter from filters list */
if (filter->prev_filter)
(filter->prev_filter)->next_filter = filter->next_filter;
@@ -453,11 +453,11 @@ gui_filter_free (struct t_gui_filter *filter)
gui_filters = filter->next_filter;
if (last_gui_filter == filter)
last_gui_filter = filter->prev_filter;
-
+
free (filter);
-
+
gui_filter_all_buffers ();
-
+
hook_signal_send ("filter_removed", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -482,10 +482,10 @@ struct t_hdata *
gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter");
if (hdata)
{
@@ -520,14 +520,14 @@ gui_filter_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
char option_name[64];
int i;
-
+
if (!infolist || !filter)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_integer (ptr_item, "enabled", filter->enabled))
return 0;
if (!infolist_new_var_string (ptr_item, "name", filter->name))
@@ -547,7 +547,7 @@ gui_filter_add_to_infolist (struct t_infolist *infolist,
}
if (!infolist_new_var_string (ptr_item, "regex", filter->regex))
return 0;
-
+
return 1;
}
@@ -560,10 +560,10 @@ gui_filter_print_log ()
{
struct t_gui_filter *ptr_filter;
int i;
-
+
log_printf ("");
log_printf ("gui_filters_enabled = %d", gui_filters_enabled);
-
+
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
diff --git a/src/gui/gui-focus.c b/src/gui/gui-focus.c
index 3e105d6b1..80b1bc4c7 100644
--- a/src/gui/gui-focus.c
+++ b/src/gui/gui-focus.c
@@ -72,17 +72,17 @@ struct t_gui_focus_info *
gui_focus_get_info (int x, int y)
{
struct t_gui_focus_info *focus_info;
-
+
focus_info = malloc (sizeof (*focus_info));
if (!focus_info)
return NULL;
-
+
focus_info->x = x;
focus_info->y = y;
-
+
/* search window */
focus_info->window = gui_window_search_by_xy (x, y);
-
+
/* fill info about chat area */
gui_window_get_context_at_xy (focus_info->window,
x, y,
@@ -92,7 +92,7 @@ gui_focus_get_info (int x, int y)
&focus_info->chat_word,
&focus_info->chat_bol,
&focus_info->chat_eol);
-
+
/* search bar window, item, and line/col in item */
gui_bar_window_search_by_xy (focus_info->window,
x, y,
@@ -100,7 +100,7 @@ gui_focus_get_info (int x, int y)
&focus_info->bar_item,
&focus_info->bar_item_line,
&focus_info->bar_item_col);
-
+
return focus_info;
}
@@ -117,7 +117,7 @@ gui_focus_free_info (struct t_gui_focus_info *focus_info)
free (focus_info->chat_bol);
if (focus_info->chat_eol)
free (focus_info->chat_eol);
-
+
free (focus_info);
}
@@ -131,12 +131,12 @@ gui_focus_buffer_localvar_map_cb (void *data, struct t_hashtable *hashtable,
{
struct t_hashtable *hashtable_focus;
char hash_key[512];
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hashtable_focus = (struct t_hashtable *)data;
-
+
if (hashtable_focus && key && value)
{
snprintf (hash_key, sizeof (hash_key),
@@ -155,7 +155,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
struct t_hashtable *hashtable;
char str_value[128], *str_time, *str_prefix, *str_tags, *str_message;
const char *nick;
-
+
hashtable = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -163,14 +163,14 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
NULL);
if (!hashtable)
return NULL;
-
+
/* key (key from keyboard or mouse event) */
FOCUS_STR("_key", key);
-
+
/* x,y */
FOCUS_INT("_x", focus_info->x);
FOCUS_INT("_y", focus_info->y);
-
+
/* window/buffer */
FOCUS_PTR("_window", focus_info->window);
if (focus_info->window)
@@ -191,7 +191,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
FOCUS_STR("_buffer_plugin", "");
FOCUS_STR("_buffer_name", "");
}
-
+
/* chat area */
FOCUS_INT("_chat", focus_info->chat);
str_time = NULL;
@@ -236,7 +236,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
FOCUS_STR_VAR("_chat_word", focus_info->chat_word);
FOCUS_STR_VAR("_chat_bol", focus_info->chat_bol);
FOCUS_STR_VAR("_chat_eol", focus_info->chat_eol);
-
+
/* bar/item */
if (focus_info->bar_window)
{
@@ -251,6 +251,6 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
FOCUS_STR_VAR("_bar_item_name", focus_info->bar_item);
FOCUS_INT("_bar_item_line", focus_info->bar_item_line);
FOCUS_INT("_bar_item_col", focus_info->bar_item_col);
-
+
return hashtable;
}
diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c
index 343560bf1..5287e2b9a 100644
--- a/src/gui/gui-history.c
+++ b/src/gui/gui-history.c
@@ -55,10 +55,10 @@ void
gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string)
{
struct t_gui_history *new_history, *ptr_history;
-
+
if (!string)
return;
-
+
if (!buffer->history
|| (buffer->history
&& (strcmp (buffer->history->text, string) != 0)))
@@ -75,7 +75,7 @@ gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string)
new_history->prev_history = NULL;
buffer->history = new_history;
buffer->num_history++;
-
+
/* remove one command if necessary */
if ((CONFIG_INTEGER(config_history_max_commands) > 0)
&& (buffer->num_history > CONFIG_INTEGER(config_history_max_commands)))
@@ -105,7 +105,7 @@ gui_history_global_add (const char *string)
if (!string)
return;
-
+
if (!history_global
|| (history_global
&& (strcmp (history_global->text, string) != 0)))
@@ -122,7 +122,7 @@ gui_history_global_add (const char *string)
new_history->prev_history = NULL;
history_global = new_history;
num_history_global++;
-
+
/* remove one command if necessary */
if ((CONFIG_INTEGER(config_history_max_commands) > 0)
&& (num_history_global > CONFIG_INTEGER(config_history_max_commands)))
@@ -149,11 +149,11 @@ void
gui_history_add (struct t_gui_buffer *buffer, const char *string)
{
char *string2, str_buffer[128];
-
+
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)(buffer));
string2 = hook_modifier_exec (NULL, "history_add", str_buffer, string);
-
+
/*
* if message was NOT dropped by modifier, then we add it to buffer and
* global history
@@ -163,7 +163,7 @@ gui_history_add (struct t_gui_buffer *buffer, const char *string)
gui_history_buffer_add (buffer, (string2) ? string2 : string);
gui_history_global_add ((string2) ? string2 : string);
}
-
+
if (string2)
free (string2);
}
@@ -176,7 +176,7 @@ void
gui_history_global_free ()
{
struct t_gui_history *ptr_history;
-
+
while (history_global)
{
ptr_history = history_global->next_history;
@@ -200,7 +200,7 @@ void
gui_history_buffer_free (struct t_gui_buffer *buffer)
{
struct t_gui_history *ptr_history;
-
+
while (buffer->history)
{
ptr_history = buffer->history->next_history;
@@ -223,10 +223,10 @@ struct t_hdata *
gui_history_hdata_history_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history");
if (hdata)
{
@@ -248,16 +248,16 @@ gui_history_add_to_infolist (struct t_infolist *infolist,
struct t_gui_history *history)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !history)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_string (ptr_item, "text", history->text))
return 0;
-
+
return 1;
}
diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c
index c0f41e69a..2e3d3b977 100644
--- a/src/gui/gui-hotlist.c
+++ b/src/gui/gui-hotlist.c
@@ -69,7 +69,7 @@ struct t_gui_hotlist *
gui_hotlist_search (struct t_gui_hotlist *hotlist, struct t_gui_buffer *buffer)
{
struct t_gui_hotlist *ptr_hotlist;
-
+
for (ptr_hotlist = hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
@@ -100,10 +100,10 @@ gui_hotlist_free (struct t_gui_hotlist **hotlist,
}
else
new_hotlist = ptr_hotlist->next_hotlist;
-
+
if (ptr_hotlist->next_hotlist)
(ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist;
-
+
free (ptr_hotlist);
*hotlist = new_hotlist;
}
@@ -164,7 +164,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist,
struct t_gui_hotlist *new_hotlist)
{
struct t_gui_hotlist *ptr_hotlist;
-
+
switch (CONFIG_INTEGER(config_look_hotlist_sort))
{
case CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC:
@@ -239,11 +239,11 @@ gui_hotlist_add_hotlist (struct t_gui_hotlist **hotlist,
struct t_gui_hotlist *new_hotlist)
{
struct t_gui_hotlist *pos_hotlist;
-
+
if (*hotlist)
{
pos_hotlist = gui_hotlist_find_pos (*hotlist, new_hotlist);
-
+
if (pos_hotlist)
{
/* insert hotlist into the hotlist (before hotlist found) */
@@ -288,34 +288,34 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
struct t_gui_hotlist *new_hotlist, *ptr_hotlist;
int i, count[GUI_HOTLIST_NUM_PRIORITIES];
const char *away;
-
+
if (!buffer || !gui_add_hotlist)
return NULL;
-
+
/* do not add core buffer if upgrading */
if (weechat_upgrading && (buffer == gui_buffer_search_main ()))
return NULL;
-
+
/* do not add buffer if it is displayed and away is not set */
away = hashtable_get (buffer->local_variables, "away");
if ((buffer->num_displayed > 0)
&& ((!away || !away[0])
|| !CONFIG_BOOLEAN(config_look_hotlist_add_buffer_if_away)))
return NULL;
-
+
if (priority > GUI_HOTLIST_MAX)
priority = GUI_HOTLIST_MAX;
-
+
/* check if priority is ok according to buffer notify level value */
if (!gui_hotlist_check_buffer_notify (buffer, priority))
return NULL;
-
+
/* init count */
for (i = 0; i < GUI_HOTLIST_NUM_PRIORITIES; i++)
{
count[i] = 0;
}
-
+
ptr_hotlist = gui_hotlist_search (gui_hotlist, buffer);
if (ptr_hotlist)
{
@@ -326,7 +326,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
gui_hotlist_changed_signal ();
return ptr_hotlist;
}
-
+
/*
* if buffer is present with lower priority: save counts, remove it
* and go on
@@ -334,7 +334,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
memcpy (count, ptr_hotlist->count, sizeof (ptr_hotlist->count));
gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist);
}
-
+
new_hotlist = malloc (sizeof (*new_hotlist));
if (!new_hotlist)
{
@@ -342,7 +342,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
"hotlist"));
return NULL;
}
-
+
new_hotlist->priority = priority;
if (creation_time)
memcpy (&(new_hotlist->creation_time),
@@ -354,11 +354,11 @@ gui_hotlist_add (struct t_gui_buffer *buffer,
new_hotlist->count[priority]++;
new_hotlist->next_hotlist = NULL;
new_hotlist->prev_hotlist = NULL;
-
+
gui_hotlist_add_hotlist (&gui_hotlist, &last_gui_hotlist, new_hotlist);
-
+
gui_hotlist_changed_signal ();
-
+
return new_hotlist;
}
@@ -370,7 +370,7 @@ struct t_gui_hotlist *
gui_hotlist_dup (struct t_gui_hotlist *hotlist)
{
struct t_gui_hotlist *new_hotlist;
-
+
new_hotlist = malloc (sizeof (*new_hotlist));
if (new_hotlist)
{
@@ -395,7 +395,7 @@ gui_hotlist_resort ()
{
struct t_gui_hotlist *new_hotlist, *last_new_hotlist;
struct t_gui_hotlist *ptr_hotlist, *element;
-
+
/* copy and resort hotlist in new linked list */
new_hotlist = NULL;
last_new_hotlist = NULL;
@@ -405,12 +405,12 @@ gui_hotlist_resort ()
element = gui_hotlist_dup (ptr_hotlist);
gui_hotlist_add_hotlist (&new_hotlist, &last_new_hotlist, element);
}
-
+
gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist);
-
+
gui_hotlist = new_hotlist;
last_gui_hotlist = last_new_hotlist;
-
+
gui_hotlist_changed_signal ();
}
@@ -434,26 +434,26 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer)
{
int hotlist_changed;
struct t_gui_hotlist *ptr_hotlist, *next_hotlist;
-
+
if (weechat_upgrading)
return;
-
+
hotlist_changed = 0;
-
+
ptr_hotlist = gui_hotlist;
while (ptr_hotlist)
{
next_hotlist = ptr_hotlist->next_hotlist;
-
+
if (ptr_hotlist->buffer->number == buffer->number)
{
gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist);
hotlist_changed = 1;
}
-
+
ptr_hotlist = next_hotlist;
}
-
+
if (hotlist_changed)
gui_hotlist_changed_signal ();
}
@@ -470,14 +470,14 @@ gui_hotlist_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
int i;
char option_name[64];
-
+
if (!infolist || !hotlist)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_integer (ptr_item, "priority", hotlist->priority))
return 0;
switch (hotlist->priority)
@@ -525,7 +525,7 @@ gui_hotlist_add_to_infolist (struct t_infolist *infolist,
if (!infolist_new_var_integer (ptr_item, option_name, hotlist->count[i]))
return 0;
}
-
+
return 1;
}
@@ -538,7 +538,7 @@ gui_hotlist_print_log ()
{
struct t_gui_hotlist *ptr_hotlist;
int i;
-
+
for (ptr_hotlist = gui_hotlist; ptr_hotlist;
ptr_hotlist = ptr_hotlist->next_hotlist)
{
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 62be98201..20fa7146d 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -60,7 +60,7 @@ gui_input_optimize_size (struct t_gui_buffer *buffer)
{
int optimal_size;
char *input_buffer2;
-
+
if (buffer->input)
{
optimal_size = ((buffer->input_buffer_size / GUI_BUFFER_INPUT_BLOCK_SIZE) *
@@ -93,27 +93,27 @@ gui_input_replace_input (struct t_gui_buffer *buffer, const char *new_input)
{
int size, length;
char *input_utf8;
-
+
input_utf8 = strdup (new_input);
if (input_utf8)
{
utf8_normalize (input_utf8, '?');
-
+
size = strlen (input_utf8);
length = utf8_strlen (input_utf8);
-
+
/* compute new buffer size */
buffer->input_buffer_size = size;
buffer->input_buffer_length = length;
gui_input_optimize_size (buffer);
-
+
/* copy new string to input */
strcpy (buffer->input_buffer, input_utf8);
-
+
/* move cursor to the end of new input if it is now after the end */
if (buffer->input_buffer_pos > buffer->input_buffer_length)
buffer->input_buffer_pos = buffer->input_buffer_length;
-
+
free (input_utf8);
}
}
@@ -138,12 +138,12 @@ gui_input_text_changed_modifier_and_signal (struct t_gui_buffer *buffer,
int save_undo)
{
char str_buffer[128], *new_input;
-
+
if (!gui_cursor_mode)
{
if (save_undo)
gui_buffer_undo_add (buffer);
-
+
/* send modifier, and change input if needed */
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)buffer);
@@ -163,7 +163,7 @@ gui_input_text_changed_modifier_and_signal (struct t_gui_buffer *buffer,
free (new_input);
}
}
-
+
/* send signal */
hook_signal_send ("input_text_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -217,39 +217,39 @@ gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
{
int size, length;
char *string_utf8, *ptr_start;
-
+
if (buffer->input)
{
string_utf8 = strdup (string);
if (!string_utf8)
return 0;
-
+
if (pos == -1)
pos = buffer->input_buffer_pos;
-
+
utf8_normalize (string_utf8, '?');
-
+
size = strlen (string_utf8);
length = utf8_strlen (string_utf8);
-
+
/* increase buffer size */
buffer->input_buffer_size += size;
buffer->input_buffer_length += length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
-
+
/* move end of string to the right */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
memmove (ptr_start + size, ptr_start, strlen (ptr_start));
-
+
/* insert new string */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
strncpy (ptr_start, string_utf8, size);
-
+
buffer->input_buffer_pos += length;
-
+
free (string_utf8);
-
+
return length;
}
return 0;
@@ -265,7 +265,7 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
struct t_gui_buffer *to_buffer)
{
int is_command;
-
+
/*
* move of input is allowed if:
* - 2 buffers are different
@@ -276,7 +276,7 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
|| (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_NONE)
|| !from_buffer->input_buffer || !from_buffer->input_buffer[0])
return;
-
+
/*
* if input is command and that only text is allowed,
* or if input is text and that only command is allowed,
@@ -286,7 +286,7 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
if ((is_command && (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_TEXT))
|| (!is_command && (CONFIG_INTEGER(config_look_input_share) == CONFIG_LOOK_INPUT_SHARE_COMMANDS)))
return;
-
+
/*
* if overwrite is off and that input of target buffer is not empty,
* then do nothing
@@ -294,7 +294,7 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
if ((!CONFIG_BOOLEAN(config_look_input_share_overwrite))
&& to_buffer->input_buffer && to_buffer->input_buffer[0])
return;
-
+
/* move input_buffer */
if (to_buffer->input_buffer)
free (to_buffer->input_buffer);
@@ -305,7 +305,7 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
to_buffer->input_buffer_pos = from_buffer->input_buffer_pos;
to_buffer->input_buffer_1st_display = from_buffer->input_buffer_1st_display;
gui_buffer_input_buffer_init (from_buffer);
-
+
/* move undo data */
gui_buffer_undo_free_all (to_buffer);
(to_buffer->input_undo_snap)->data = (from_buffer->input_undo_snap)->data;
@@ -331,12 +331,12 @@ gui_input_clipboard_copy (const char *buffer, int size)
{
if (size <= 0)
return;
-
+
if (gui_input_clipboard != NULL)
free (gui_input_clipboard);
-
+
gui_input_clipboard = malloc((size + 1) * sizeof(*gui_input_clipboard));
-
+
if (gui_input_clipboard)
{
memcpy (gui_input_clipboard, buffer, size);
@@ -358,7 +358,7 @@ gui_input_clipboard_paste (struct t_gui_buffer *buffer)
gui_input_insert_string (buffer,
gui_input_clipboard, -1);
gui_completion_stop (buffer->completion, 1);
-
+
gui_input_text_changed_modifier_and_signal (buffer, 1);
}
}
@@ -372,7 +372,7 @@ gui_input_return (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
char *command;
-
+
window = gui_window_search_with_buffer (buffer);
if (window && window->buffer->input
&& (window->buffer->input_buffer_size > 0))
@@ -408,10 +408,10 @@ void
gui_input_complete (struct t_gui_buffer *buffer)
{
int i;
-
+
if (!buffer->completion)
return;
-
+
if (buffer->completion->word_found)
{
/* replace word with new completed word into input buffer */
@@ -445,7 +445,7 @@ gui_input_complete (struct t_gui_buffer *buffer)
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
}
-
+
strncpy (buffer->input_buffer + buffer->completion->position_replace,
buffer->completion->word_found,
strlen (buffer->completion->word_found));
@@ -453,7 +453,7 @@ gui_input_complete (struct t_gui_buffer *buffer)
utf8_pos (buffer->input_buffer,
buffer->completion->position_replace) +
utf8_strlen (buffer->completion->word_found);
-
+
/*
* position is < 0 this means only one word was found to complete,
* so reinit to stop completion
@@ -461,7 +461,7 @@ gui_input_complete (struct t_gui_buffer *buffer)
if (buffer->completion->position >= 0)
buffer->completion->position = utf8_real_pos (buffer->input_buffer,
buffer->input_buffer_pos);
-
+
/* add space if needed after completion */
if (buffer->completion->add_space)
{
@@ -531,7 +531,7 @@ void
gui_input_search_text (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window && (window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -569,7 +569,7 @@ void
gui_input_search_next (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window && (window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED))
@@ -588,7 +588,7 @@ void
gui_input_search_switch_case (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window && (window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED))
@@ -626,7 +626,7 @@ gui_input_delete_previous_char (struct t_gui_buffer *buffer)
{
char *pos, *pos_last;
int char_size, size_to_move;
-
+
if (buffer->input && (buffer->input_buffer_pos > 0))
{
gui_buffer_undo_snap (buffer);
@@ -655,7 +655,7 @@ gui_input_delete_next_char (struct t_gui_buffer *buffer)
{
char *pos, *pos_next;
int char_size, size_to_move;
-
+
if (buffer->input
&& (buffer->input_buffer_pos < buffer->input_buffer_length))
{
@@ -684,7 +684,7 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer)
{
int length_deleted, size_deleted;
char *start, *string;
-
+
if (buffer->input && (buffer->input_buffer_pos > 0))
{
gui_buffer_undo_snap (buffer);
@@ -709,19 +709,19 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer)
}
}
}
-
+
if (string)
string = utf8_next_char (utf8_next_char (string));
else
string = buffer->input_buffer;
-
+
size_deleted = utf8_next_char (start) - string;
length_deleted = utf8_strnlen (string, size_deleted);
-
+
gui_input_clipboard_copy (string, size_deleted);
-
+
memmove (string, string + size_deleted, strlen (string + size_deleted));
-
+
buffer->input_buffer_size -= size_deleted;
buffer->input_buffer_length -= length_deleted;
buffer->input_buffer[buffer->input_buffer_size] = '\0';
@@ -741,7 +741,7 @@ gui_input_delete_next_word (struct t_gui_buffer *buffer)
{
int size_deleted, length_deleted;
char *start, *string;
-
+
if (buffer->input)
{
gui_buffer_undo_snap (buffer);
@@ -757,11 +757,11 @@ gui_input_delete_next_word (struct t_gui_buffer *buffer)
length_deleted++;
}
size_deleted = string - start;
-
+
gui_input_clipboard_copy (start, size_deleted);
-
+
memmove (start, string, strlen (string));
-
+
buffer->input_buffer_size -= size_deleted;
buffer->input_buffer_length -= length_deleted;
buffer->input_buffer[buffer->input_buffer_size] = '\0';
@@ -782,7 +782,7 @@ gui_input_delete_beginning_of_line (struct t_gui_buffer *buffer)
{
int length_deleted, size_deleted;
char *start;
-
+
if (buffer->input && (buffer->input_buffer_pos > 0))
{
gui_buffer_undo_snap (buffer);
@@ -792,9 +792,9 @@ gui_input_delete_beginning_of_line (struct t_gui_buffer *buffer)
length_deleted = utf8_strnlen (buffer->input_buffer, size_deleted);
gui_input_clipboard_copy (buffer->input_buffer,
start - buffer->input_buffer);
-
+
memmove (buffer->input_buffer, start, strlen (start));
-
+
buffer->input_buffer_size -= size_deleted;
buffer->input_buffer_length -= length_deleted;
buffer->input_buffer[buffer->input_buffer_size] = '\0';
@@ -815,7 +815,7 @@ gui_input_delete_end_of_line (struct t_gui_buffer *buffer)
{
char *start;
int size_deleted;
-
+
if (buffer->input)
{
gui_buffer_undo_snap (buffer);
@@ -862,29 +862,29 @@ gui_input_transpose_chars (struct t_gui_buffer *buffer)
{
char *start, *prev_char, saved_char[5];
int size_prev_char, size_start_char;
-
+
if (buffer->input && (buffer->input_buffer_pos > 0)
&& (buffer->input_buffer_length > 1))
{
gui_buffer_undo_snap (buffer);
-
+
if (buffer->input_buffer_pos == buffer->input_buffer_length)
buffer->input_buffer_pos--;
-
+
start = utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos);
prev_char = utf8_prev_char (buffer->input_buffer, start);
size_prev_char = start - prev_char;
size_start_char = utf8_char_size (start);
-
+
memcpy (saved_char, prev_char, size_prev_char);
memcpy (prev_char, start, size_start_char);
memcpy (prev_char + size_start_char, saved_char, size_prev_char);
-
+
buffer->input_buffer_pos++;
-
+
gui_completion_stop (buffer->completion, 1);
-
+
gui_input_text_changed_modifier_and_signal (buffer, 1);
}
}
@@ -956,7 +956,7 @@ void
gui_input_move_previous_word (struct t_gui_buffer *buffer)
{
char *pos;
-
+
if (buffer->input
&& (buffer->input_buffer_pos > 0))
{
@@ -981,7 +981,7 @@ gui_input_move_previous_word (struct t_gui_buffer *buffer)
}
else
buffer->input_buffer_pos = 0;
-
+
gui_input_text_cursor_moved_signal ();
}
}
@@ -995,7 +995,7 @@ void
gui_input_move_next_word (struct t_gui_buffer *buffer)
{
char *pos;
-
+
if (buffer->input
&& (buffer->input_buffer_pos < buffer->input_buffer_length))
{
@@ -1026,7 +1026,7 @@ gui_input_move_next_word (struct t_gui_buffer *buffer)
utf8_pos (buffer->input_buffer,
utf8_prev_char (buffer->input_buffer, pos) - buffer->input_buffer);
}
-
+
gui_input_text_cursor_moved_signal ();
}
}
@@ -1043,7 +1043,7 @@ gui_input_history_previous (struct t_gui_window *window,
{
if (!window->buffer->input)
return;
-
+
if (*ptr_history)
{
if (!(*ptr_history)->next_history)
@@ -1052,10 +1052,10 @@ gui_input_history_previous (struct t_gui_window *window,
}
if (!(*ptr_history))
*ptr_history = history;
-
+
if (!(*ptr_history))
return;
-
+
/* bash/readline like use of history */
if (window->buffer->input_buffer_size > 0)
{
@@ -1098,15 +1098,15 @@ gui_input_history_next (struct t_gui_window *window,
struct t_gui_history **ptr_history)
{
int input_changed;
-
+
/* make C compiler happy */
(void) history;
-
+
input_changed = 0;
-
+
if (!window->buffer->input)
return;
-
+
if (*ptr_history)
{
/* replace text in history with current input */
@@ -1114,7 +1114,7 @@ gui_input_history_next (struct t_gui_window *window,
if ((*ptr_history)->text)
free ((*ptr_history)->text);
(*ptr_history)->text = strdup (window->buffer->input_buffer);
-
+
*ptr_history = (*ptr_history)->prev_history;
if (*ptr_history)
{
@@ -1172,7 +1172,7 @@ void
gui_input_history_local_previous (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window)
{
@@ -1191,7 +1191,7 @@ void
gui_input_history_local_next (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window)
{
@@ -1210,7 +1210,7 @@ void
gui_input_history_global_previous (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window)
{
@@ -1229,7 +1229,7 @@ void
gui_input_history_global_next (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window)
{
@@ -1247,7 +1247,7 @@ void
gui_input_jump_smart (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -1282,7 +1282,7 @@ void
gui_input_jump_last_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
@@ -1304,7 +1304,7 @@ gui_input_jump_previously_visited_buffer (struct t_gui_buffer *buffer)
struct t_gui_window *window;
int index;
struct t_gui_buffer_visited *ptr_buffer_visited;
-
+
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -1313,7 +1313,7 @@ gui_input_jump_previously_visited_buffer (struct t_gui_buffer *buffer)
if (index >= 0)
{
gui_buffers_visited_index = index;
-
+
ptr_buffer_visited =
gui_buffer_visited_search_by_number (gui_buffers_visited_index);
if (ptr_buffer_visited)
@@ -1339,7 +1339,7 @@ gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer)
struct t_gui_window *window;
int index;
struct t_gui_buffer_visited *ptr_buffer_visited;
-
+
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -1348,7 +1348,7 @@ gui_input_jump_next_visited_buffer (struct t_gui_buffer *buffer)
if (index >= 0)
{
gui_buffers_visited_index = index;
-
+
ptr_buffer_visited = gui_buffer_visited_search_by_number (gui_buffers_visited_index);
if (ptr_buffer_visited)
{
@@ -1406,7 +1406,7 @@ void
gui_input_scroll_unread (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
-
+
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -1444,7 +1444,7 @@ void
gui_input_set_unread ()
{
struct t_gui_buffer *ptr_buffer;
-
+
/* set read marker for all standard buffers */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -1474,7 +1474,7 @@ gui_input_switch_active_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
struct t_gui_window *window;
-
+
ptr_buffer = gui_buffer_get_next_active_buffer (buffer);
if (ptr_buffer)
{
@@ -1496,7 +1496,7 @@ gui_input_switch_active_buffer_previous (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
struct t_gui_window *window;
-
+
ptr_buffer = gui_buffer_get_previous_active_buffer (buffer);
if (ptr_buffer)
{
@@ -1516,7 +1516,7 @@ void
gui_input_insert (struct t_gui_buffer *buffer, const char *args)
{
char *args2;
-
+
if (args)
{
gui_buffer_undo_snap (buffer);
@@ -1564,7 +1564,7 @@ gui_input_undo (struct t_gui_buffer *buffer)
gui_buffer_undo_snap_free (buffer);
gui_buffer_undo_add (buffer);
}
-
+
if (buffer->ptr_input_undo
&& (buffer->ptr_input_undo)->prev_undo)
{
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index 0d3c0b64e..4cc2e423f 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -96,12 +96,12 @@ void
gui_key_init ()
{
int i;
-
+
gui_key_combo_buffer[0] = '\0';
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_key_last_activity_time = time (NULL);
-
+
/* create default keys and save them in a separate list */
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
@@ -129,13 +129,13 @@ int
gui_key_search_context (const char *context)
{
int i;
-
+
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
if (string_strcasecmp (gui_key_context_string[i], context) == 0)
return i;
}
-
+
/* context not found */
return -1;
}
@@ -149,11 +149,11 @@ gui_key_get_current_context ()
{
if (gui_cursor_mode)
return GUI_KEY_CONTEXT_CURSOR;
-
+
if (gui_current_window
&& (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED))
return GUI_KEY_CONTEXT_SEARCH;
-
+
return GUI_KEY_CONTEXT_DEFAULT;
}
@@ -166,11 +166,11 @@ gui_key_grab_init (int grab_command, const char *delay)
{
long milliseconds;
char *error;
-
+
gui_key_grab = 1;
gui_key_grab_count = 0;
gui_key_grab_command = grab_command;
-
+
gui_key_grab_delay = GUI_KEY_GRAB_DELAY_DEFAULT;
if (delay != NULL)
{
@@ -194,11 +194,11 @@ gui_key_grab_end_timer_cb (void *data, int remaining_calls)
{
char *expanded_key, *expanded_key2;
struct t_gui_key *ptr_key;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
/* get expanded name (for example: \x01+U => ctrl-u) */
expanded_key = gui_key_get_expanded_name (gui_key_combo_buffer);
if (expanded_key)
@@ -244,13 +244,13 @@ gui_key_grab_end_timer_cb (void *data, int remaining_calls)
}
free (expanded_key);
}
-
+
/* end grab mode */
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_key_grab_command = 0;
gui_key_combo_buffer[0] = '\0';
-
+
return WEECHAT_RC_OK;
}
@@ -264,10 +264,10 @@ char *
gui_key_get_internal_code (const char *key)
{
char *result;
-
+
if ((key[0] == '@') && strchr (key, ':'))
return strdup (key);
-
+
if ((result = malloc (strlen (key) + 1)))
{
result[0] = '\0';
@@ -310,10 +310,10 @@ char *
gui_key_get_expanded_name (const char *key)
{
char *result;
-
+
if (!key)
return NULL;
-
+
result = malloc ((strlen (key) * 5) + 1);
if (result)
{
@@ -342,7 +342,7 @@ gui_key_get_expanded_name (const char *key)
}
}
}
-
+
return result;
}
@@ -355,17 +355,17 @@ int
gui_key_score (struct t_gui_key *key)
{
int score, bonus, area;
-
+
score = 0;
bonus = 8;
-
+
if (key->key[0] != '@')
return score;
-
+
/* basic score for key with area */
score |= 1 << bonus;
bonus--;
-
+
/* add score for each area type */
for (area = 0; area < 2; area++)
{
@@ -377,7 +377,7 @@ gui_key_score (struct t_gui_key *key)
}
bonus--;
}
-
+
/* add score for each area name */
for (area = 0; area < 2; area++)
{
@@ -389,7 +389,7 @@ gui_key_score (struct t_gui_key *key)
}
bonus--;
}
-
+
return score;
}
@@ -402,7 +402,7 @@ gui_key_find_pos (struct t_gui_key *keys, struct t_gui_key *key)
{
struct t_gui_key *ptr_key;
int score1, score2;
-
+
score1 = gui_key_score (key);
for (ptr_key = keys; ptr_key; ptr_key = ptr_key->next_key)
{
@@ -427,11 +427,11 @@ gui_key_insert_sorted (struct t_gui_key **keys,
struct t_gui_key *key)
{
struct t_gui_key *pos_key;
-
+
if (*keys)
{
pos_key = gui_key_find_pos (*keys, key);
-
+
if (pos_key)
{
/* insert key into the list (before key found) */
@@ -460,7 +460,7 @@ gui_key_insert_sorted (struct t_gui_key **keys,
*keys = key;
*last_key = key;
}
-
+
(*keys_count)++;
}
@@ -478,7 +478,7 @@ gui_key_set_area_type_name (const char *area,
{
int focus, length;
char *pos_end;
-
+
for (focus = 0; focus < GUI_KEY_NUM_FOCUS; focus++)
{
length = strlen (gui_key_focus_string[focus]);
@@ -528,20 +528,20 @@ gui_key_set_areas (struct t_gui_key *key)
key->area_name[area] = NULL;
}
key->area_key = NULL;
-
+
if (key->key[0] != '@')
return;
-
+
areas[0] = NULL;
areas[1] = NULL;
-
+
pos_colon = strchr (key->key + 1, ':');
if (!pos_colon)
return;
pos_area2 = strchr (key->key + 1, '>');
-
+
key->area_key = strdup (pos_colon + 1);
-
+
if (!pos_area2 || (pos_area2 > pos_colon))
areas[0] = string_strndup (key->key + 1, pos_colon - key->key - 1);
else
@@ -550,7 +550,7 @@ gui_key_set_areas (struct t_gui_key *key)
areas[0] = string_strndup (key->key + 1, pos_area2 - key->key - 1);
areas[1] = string_strndup (pos_area2 + 1, pos_colon - pos_area2 - 1);
}
-
+
for (area = 0; area < 2; area++)
{
if (!areas[area])
@@ -562,7 +562,7 @@ gui_key_set_areas (struct t_gui_key *key)
&(key->area_type[area]),
&(key->area_name[area]));
}
-
+
if (areas[0])
free (areas[0]);
if (areas[1])
@@ -581,10 +581,10 @@ gui_key_new (struct t_gui_buffer *buffer, int context, const char *key,
{
struct t_gui_key *new_key;
char *expanded_name;
-
+
if (!key || !command)
return NULL;
-
+
if ((new_key = malloc (sizeof (*new_key))))
{
new_key->key = gui_key_get_internal_code (key);
@@ -603,7 +603,7 @@ gui_key_new (struct t_gui_buffer *buffer, int context, const char *key,
return NULL;
}
gui_key_set_areas (new_key);
-
+
if (buffer)
{
gui_key_insert_sorted (&buffer->keys, &buffer->last_key,
@@ -615,12 +615,12 @@ gui_key_new (struct t_gui_buffer *buffer, int context, const char *key,
&last_gui_key[context],
&gui_keys_count[context], new_key);
}
-
+
expanded_name = gui_key_get_expanded_name (new_key->key);
-
+
hook_signal_send ("key_bind",
WEECHAT_HOOK_SIGNAL_STRING, expanded_name);
-
+
if (gui_key_verbose)
{
gui_chat_printf (NULL,
@@ -637,7 +637,7 @@ gui_key_new (struct t_gui_buffer *buffer, int context, const char *key,
}
else
return NULL;
-
+
return new_key;
}
@@ -649,13 +649,13 @@ struct t_gui_key *
gui_key_search (struct t_gui_key *keys, const char *key)
{
struct t_gui_key *ptr_key;
-
+
for (ptr_key = keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (strcmp (ptr_key->key, key) == 0)
return ptr_key;
}
-
+
/* key not found */
return NULL;
}
@@ -668,10 +668,10 @@ int
gui_key_cmp (const char *key, const char *search, int context)
{
int diff;
-
+
if (context == GUI_KEY_CONTEXT_MOUSE)
return (string_match (key, search, 1)) ? 0 : 1;
-
+
while (search[0])
{
diff = utf8_charcmp (key, search);
@@ -680,7 +680,7 @@ gui_key_cmp (const char *key, const char *search, int context)
key = utf8_next_char (key);
search = utf8_next_char (search);
}
-
+
return 0;
}
@@ -693,7 +693,7 @@ gui_key_search_part (struct t_gui_buffer *buffer, int context,
const char *key)
{
struct t_gui_key *ptr_key;
-
+
for (ptr_key = (buffer) ? buffer->keys : gui_keys[context]; ptr_key;
ptr_key = ptr_key->next_key)
{
@@ -706,7 +706,7 @@ gui_key_search_part (struct t_gui_buffer *buffer, int context,
return ptr_key;
}
}
-
+
/* key not found */
return NULL;
}
@@ -725,9 +725,9 @@ gui_key_bind (struct t_gui_buffer *buffer, int context, const char *key,
{
if (!key || !command)
return NULL;
-
+
gui_key_unbind (buffer, context, key);
-
+
return gui_key_new (buffer, context, key, command);
}
@@ -743,12 +743,12 @@ gui_key_bind_plugin_hashtable_map_cb (void *data,
int *user_data;
struct t_gui_key *ptr_key;
char *internal_code;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
user_data = (int *)data;
-
+
if (user_data && key && value)
{
internal_code = gui_key_get_internal_code (key);
@@ -777,16 +777,16 @@ int
gui_key_bind_plugin (const char *context, struct t_hashtable *keys)
{
int data[2];
-
+
data[0] = gui_key_search_context (context);
if (data[0] < 0)
return 0;
-
+
gui_key_verbose = 1;
data[1] = 0;
hashtable_map (keys, &gui_key_bind_plugin_hashtable_map_cb, data);
gui_key_verbose = 0;
-
+
return data[1];
}
@@ -800,11 +800,11 @@ gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key)
{
struct t_gui_key *ptr_key;
char *internal_code;
-
+
internal_code = gui_key_get_internal_code (key);
if (!internal_code)
return 0;
-
+
ptr_key = gui_key_search ((buffer) ? buffer->keys : gui_keys[context],
(internal_code) ? internal_code : key);
free (internal_code);
@@ -831,7 +831,7 @@ gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key)
WEECHAT_HOOK_SIGNAL_STRING, (char *)key);
return 1;
}
-
+
return 0;
}
@@ -847,11 +847,11 @@ gui_key_unbind_plugin (const char *context, const char *key)
int ctxt, num_keys, area_type;
char *area_name;
struct t_gui_key *ptr_key;
-
+
ctxt = gui_key_search_context (context);
if (ctxt < 0)
return 0;
-
+
if (strncmp (key, "area:", 5) == 0)
{
num_keys = 0;
@@ -883,7 +883,7 @@ gui_key_unbind_plugin (const char *context, const char *key)
num_keys = gui_key_unbind (NULL, ctxt, key);
gui_key_verbose = 0;
}
-
+
return num_keys;
}
@@ -899,7 +899,7 @@ gui_key_focus_matching (struct t_gui_key *key,
int match[2], area;
char buffer_full_name[512];
const char *chat, *buffer_plugin, *buffer_name, *bar_name, *bar_item_name;
-
+
for (area = 0; area < 2; area++)
{
match[area] = 0;
@@ -945,7 +945,7 @@ gui_key_focus_matching (struct t_gui_key *key,
break;
}
}
-
+
return match[0] && match[1];
}
@@ -964,43 +964,43 @@ gui_key_focus_command (const char *key, int context,
struct t_hashtable *hashtable;
struct t_weelist *list_keys;
struct t_weelist_item *ptr_item;
-
+
debug = 0;
if (gui_cursor_debug && (context == GUI_KEY_CONTEXT_CURSOR))
debug = gui_cursor_debug;
else if (gui_mouse_debug && (context == GUI_KEY_CONTEXT_MOUSE))
debug = gui_mouse_debug;
-
+
for (ptr_key = gui_keys[context]; ptr_key;
ptr_key = ptr_key->next_key)
{
/* ignore key if it has not area name or key for area */
if (!ptr_key->area_name[0] || !ptr_key->area_key)
continue;
-
+
/* the special command "-" is used to ignore key */
if (strcmp (ptr_key->command, "-") == 0)
continue;
-
+
/* ignore key if key for area is not matching */
if (gui_key_cmp (key, ptr_key->area_key, context) != 0)
continue;
-
+
/* check if focus is matching with key */
matching = gui_key_focus_matching (ptr_key, hashtable_focus);
if (!matching)
continue;
-
+
hashtable = hook_focus_get_data (hashtable_focus[0],
hashtable_focus[1]);
if (!hashtable)
continue;
-
+
if ((context == GUI_KEY_CONTEXT_CURSOR) && gui_cursor_debug)
{
gui_input_delete_line (gui_current_window->buffer);
}
-
+
if (debug > 1)
{
gui_chat_printf (NULL, _("Hashtable focus:"));
@@ -1062,7 +1062,7 @@ gui_key_focus_command (const char *key, int context,
hashtable_free (hashtable);
return 1;
}
-
+
return 0;
}
@@ -1078,13 +1078,13 @@ gui_key_focus (const char *key, int context)
struct t_gui_focus_info *focus_info1, *focus_info2;
struct t_hashtable *hashtable_focus[2];
int rc;
-
+
rc = 0;
focus_info1 = NULL;
focus_info2 = NULL;
hashtable_focus[0] = NULL;
hashtable_focus[1] = NULL;
-
+
if (context == GUI_KEY_CONTEXT_MOUSE)
{
focus_info1 = gui_focus_get_info (gui_mouse_event_x[0],
@@ -1122,9 +1122,9 @@ gui_key_focus (const char *key, int context)
if (!hashtable_focus[0])
goto end;
}
-
+
rc = gui_key_focus_command (key, context, hashtable_focus);
-
+
end:
if (focus_info1)
gui_focus_free_info (focus_info1);
@@ -1134,7 +1134,7 @@ end:
hashtable_free (hashtable_focus[0]);
if (hashtable_focus[1])
hashtable_free (hashtable_focus[1]);
-
+
return rc;
}
@@ -1150,14 +1150,14 @@ gui_key_pressed (const char *key_str)
int i, first_key, context, length, length_key;
struct t_gui_key *ptr_key;
char **commands, *pos;
-
+
/* add key to buffer */
first_key = (gui_key_combo_buffer[0] == '\0');
length = strlen (gui_key_combo_buffer);
length_key = strlen (key_str);
if (length + length_key + 1 <= (int)sizeof (gui_key_combo_buffer))
strcat (gui_key_combo_buffer, key_str);
-
+
/* if we are in "show mode", increase counter and return */
if (gui_key_grab)
{
@@ -1169,7 +1169,7 @@ gui_key_pressed (const char *key_str)
gui_key_grab_count++;
return 0;
}
-
+
/* mouse event pending */
if (gui_mouse_event_pending)
{
@@ -1182,16 +1182,16 @@ gui_key_pressed (const char *key_str)
}
return 0;
}
-
+
if (strcmp (gui_key_combo_buffer, "\x01[[M") == 0)
{
gui_key_combo_buffer[0] = '\0';
gui_mouse_event_init ();
return 0;
}
-
+
ptr_key = NULL;
-
+
context = gui_key_get_current_context ();
switch (context)
{
@@ -1223,7 +1223,7 @@ gui_key_pressed (const char *key_str)
gui_key_combo_buffer);
break;
}
-
+
/* if key is found, then execute action */
if (ptr_key)
{
@@ -1254,7 +1254,7 @@ gui_key_pressed (const char *key_str)
return 0;
}
}
-
+
gui_key_combo_buffer[0] = '\0';
/*
@@ -1273,7 +1273,7 @@ gui_key_free (struct t_gui_key **keys, struct t_gui_key **last_key,
int *keys_count, struct t_gui_key *key)
{
int i;
-
+
/* free memory */
if (key->key)
free (key->key);
@@ -1286,7 +1286,7 @@ gui_key_free (struct t_gui_key **keys, struct t_gui_key **last_key,
free (key->area_key);
if (key->command)
free (key->command);
-
+
/* remove key from keys list */
if (key->prev_key)
(key->prev_key)->next_key = key->next_key;
@@ -1296,9 +1296,9 @@ gui_key_free (struct t_gui_key **keys, struct t_gui_key **last_key,
*keys = key->next_key;
if (*last_key == key)
*last_key = key->prev_key;
-
+
free (key);
-
+
(*keys_count)--;
}
@@ -1324,12 +1324,12 @@ void
gui_key_buffer_optimize ()
{
int optimal_size, *gui_key_buffer2;
-
+
optimal_size = (((gui_key_buffer_size * sizeof (int)) /
GUI_KEY_BUFFER_BLOCK_SIZE) *
GUI_KEY_BUFFER_BLOCK_SIZE) +
GUI_KEY_BUFFER_BLOCK_SIZE;
-
+
if (gui_key_buffer_alloc != optimal_size)
{
gui_key_buffer_alloc = optimal_size;
@@ -1378,11 +1378,11 @@ gui_key_buffer_add (unsigned char key)
{
if (!gui_key_buffer)
gui_key_buffer_reset ();
-
+
gui_key_buffer_size++;
-
+
gui_key_buffer_optimize ();
-
+
if (gui_key_buffer)
{
gui_key_buffer[gui_key_buffer_size - 1] = key;
@@ -1417,7 +1417,7 @@ gui_key_get_paste_lines ()
{
return gui_key_paste_lines + 1;
}
-
+
return gui_key_paste_lines;
}
@@ -1452,11 +1452,11 @@ void
gui_key_end ()
{
int i;
-
+
/* free key buffer */
if (gui_key_buffer)
free (gui_key_buffer);
-
+
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
/* free keys */
@@ -1478,10 +1478,10 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
struct t_hdata *hdata;
int i;
char str_list[128];
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key");
if (hdata)
{
@@ -1529,14 +1529,14 @@ gui_key_add_to_infolist (struct t_infolist *infolist, struct t_gui_key *key)
{
struct t_infolist_item *ptr_item;
char *expanded_key;
-
+
if (!infolist || !key)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_string (ptr_item, "key_internal", key->key))
return 0;
expanded_key = gui_key_get_expanded_name (key->key);
@@ -1558,7 +1558,7 @@ gui_key_add_to_infolist (struct t_infolist *infolist, struct t_gui_key *key)
return 0;
if (!infolist_new_var_string (ptr_item, "command", key->command))
return 0;
-
+
return 1;
}
@@ -1570,7 +1570,7 @@ void
gui_key_print_log_key (struct t_gui_key *key, const char *prefix)
{
int area;
-
+
log_printf ("%s[key (addr:0x%lx)]", prefix, key);
log_printf ("%s key. . . . . . . . : '%s'", prefix, key->key);
for (area = 0; area < 2; area++)
@@ -1596,7 +1596,7 @@ gui_key_print_log (struct t_gui_buffer *buffer)
{
struct t_gui_key *ptr_key;
int i;
-
+
if (buffer)
{
log_printf (" keys . . . . . . . . : 0x%lx", buffer->keys);
@@ -1617,7 +1617,7 @@ gui_key_print_log (struct t_gui_buffer *buffer)
log_printf (" keys . . . . . . . . : 0x%lx", gui_keys[i]);
log_printf (" last_key . . . . . . : 0x%lx", last_gui_key[i]);
log_printf (" keys_count . . . . . : %d", gui_keys_count[i]);
-
+
for (ptr_key = gui_keys[i]; ptr_key; ptr_key = ptr_key->next_key)
{
log_printf ("");
diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c
index 9285a55f4..d428a8a75 100644
--- a/src/gui/gui-layout.c
+++ b/src/gui/gui-layout.c
@@ -68,7 +68,7 @@ gui_layout_buffer_remove (struct t_gui_layout_buffer **layout_buffers,
free (layout_buffer->plugin_name);
if (layout_buffer->buffer_name)
free (layout_buffer->buffer_name);
-
+
/* remove layout from list */
if (layout_buffer->prev_layout)
(layout_buffer->prev_layout)->next_layout = layout_buffer->next_layout;
@@ -78,7 +78,7 @@ gui_layout_buffer_remove (struct t_gui_layout_buffer **layout_buffers,
*layout_buffers = layout_buffer->next_layout;
if (*last_layout_buffer == layout_buffer)
*last_layout_buffer = layout_buffer->prev_layout;
-
+
free (layout_buffer);
}
@@ -106,9 +106,9 @@ gui_layout_buffer_reset (struct t_gui_layout_buffer **layout_buffers,
struct t_gui_layout_buffer **last_layout_buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
gui_layout_buffer_remove_all (layout_buffers, last_layout_buffer);
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -127,7 +127,7 @@ gui_layout_buffer_add (struct t_gui_layout_buffer **layout_buffers,
int number)
{
struct t_gui_layout_buffer *new_layout_buffer;
-
+
new_layout_buffer = malloc (sizeof (*new_layout_buffer));
if (new_layout_buffer)
{
@@ -135,7 +135,7 @@ gui_layout_buffer_add (struct t_gui_layout_buffer **layout_buffers,
new_layout_buffer->plugin_name = strdup (plugin_name);
new_layout_buffer->buffer_name = strdup (buffer_name);
new_layout_buffer->number = number;
-
+
/* add layout buffer to list */
new_layout_buffer->prev_layout = *last_layout_buffer;
if (*layout_buffers)
@@ -145,7 +145,7 @@ gui_layout_buffer_add (struct t_gui_layout_buffer **layout_buffers,
*last_layout_buffer = new_layout_buffer;
new_layout_buffer->next_layout = NULL;
}
-
+
return new_layout_buffer;
}
@@ -158,12 +158,12 @@ gui_layout_buffer_save (struct t_gui_layout_buffer **layout_buffers,
struct t_gui_layout_buffer **last_layout_buffer)
{
struct t_gui_buffer *ptr_buffer;
-
+
if (!layout_buffers || !last_layout_buffer)
return;
-
+
gui_layout_buffer_remove_all (layout_buffers, last_layout_buffer);
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -186,13 +186,13 @@ gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
{
struct t_gui_layout_buffer *ptr_layout_buffer;
int old_number, merge_order;
-
+
*layout_number = 0;
*layout_number_merge_order = 0;
-
+
old_number = -1;
merge_order = 0;
-
+
for (ptr_layout_buffer = layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
@@ -203,7 +203,7 @@ gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
}
else
merge_order++;
-
+
if ((string_strcasecmp (ptr_layout_buffer->plugin_name, plugin_name) == 0)
&& (string_strcasecmp (ptr_layout_buffer->buffer_name, buffer_name) == 0))
{
@@ -222,10 +222,10 @@ void
gui_layout_buffer_get_number_all (struct t_gui_layout_buffer *layout_buffers)
{
struct t_gui_buffer *ptr_buffer;
-
+
if (!layout_buffers)
return;
-
+
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
@@ -246,31 +246,31 @@ gui_layout_buffer_apply (struct t_gui_layout_buffer *layout_buffers)
{
struct t_gui_buffer *ptr_buffer, *ptr_next_buffer;
int number, count_merged;
-
+
/* get layout number for all buffers */
gui_layout_buffer_get_number_all (layout_buffers);
-
+
/* unmerge all buffers */
gui_buffer_unmerge_all ();
-
+
/* sort buffers by layout number (without merge) */
gui_buffer_sort_by_layout_number ();
-
+
/* merge buffers */
ptr_buffer = gui_buffers->next_buffer;
while (ptr_buffer)
{
ptr_next_buffer = ptr_buffer->next_buffer;
-
+
if ((ptr_buffer->layout_number >= 1)
&& (ptr_buffer->layout_number == (ptr_buffer->prev_buffer)->layout_number))
{
gui_buffer_merge (ptr_buffer, ptr_buffer->prev_buffer);
}
-
+
ptr_buffer = ptr_next_buffer;
}
-
+
/* set appropriate active buffers */
number = 1;
while (number <= last_gui_buffer->number)
@@ -300,13 +300,13 @@ gui_layout_window_remove (struct t_gui_layout_window *layout_window)
gui_layout_window_remove (layout_window->child1);
if (layout_window->child2)
gui_layout_window_remove (layout_window->child2);
-
+
/* free data */
if (layout_window->plugin_name)
free (layout_window->plugin_name);
if (layout_window->buffer_name)
free (layout_window->buffer_name);
-
+
free (layout_window);
}
@@ -332,9 +332,9 @@ void
gui_layout_window_reset (struct t_gui_layout_window **layout_windows)
{
struct t_gui_window *ptr_win;
-
+
gui_layout_window_remove_all (layout_windows);
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name)
@@ -360,27 +360,27 @@ gui_layout_window_search_by_id (struct t_gui_layout_window *layout_windows,
int id)
{
struct t_gui_layout_window *res;
-
+
if (!layout_windows)
return NULL;
-
+
if (layout_windows->internal_id == id)
return layout_windows;
-
+
if (layout_windows->child1)
{
res = gui_layout_window_search_by_id (layout_windows->child1, id);
if (res)
return res;
}
-
+
if (layout_windows->child2)
{
res = gui_layout_window_search_by_id (layout_windows->child2, id);
if (res)
return res;
}
-
+
return NULL;
}
@@ -396,7 +396,7 @@ gui_layout_window_add (struct t_gui_layout_window **layout_windows,
const char *plugin_name, const char *buffer_name)
{
struct t_gui_layout_window *new_layout_window;
-
+
new_layout_window = malloc (sizeof (*new_layout_window));
if (new_layout_window)
{
@@ -409,7 +409,7 @@ gui_layout_window_add (struct t_gui_layout_window **layout_windows,
new_layout_window->child2 = NULL;
new_layout_window->plugin_name = (plugin_name) ? strdup (plugin_name) : NULL;
new_layout_window->buffer_name = (buffer_name) ? strdup (buffer_name) : NULL;
-
+
if (parent)
{
/* assign this window to child1 or child2 of parent */
@@ -424,7 +424,7 @@ gui_layout_window_add (struct t_gui_layout_window **layout_windows,
*layout_windows = new_layout_window;
}
}
-
+
return new_layout_window;
}
@@ -438,12 +438,12 @@ gui_layout_window_save_tree (struct t_gui_layout_window **layout_windows,
struct t_gui_window_tree *tree)
{
struct t_gui_layout_window *layout_window;
-
+
if (tree->window)
{
if (tree->window == gui_current_window)
gui_layout_internal_id_current_window = gui_layout_internal_id;
-
+
layout_window = gui_layout_window_add (layout_windows,
gui_layout_internal_id,
parent_layout,
@@ -461,13 +461,13 @@ gui_layout_window_save_tree (struct t_gui_layout_window **layout_windows,
NULL,
NULL);
}
-
+
gui_layout_internal_id++;
-
+
if (tree->child1)
gui_layout_window_save_tree (layout_windows,
layout_window, tree->child1);
-
+
if (tree->child2)
gui_layout_window_save_tree (layout_windows,
layout_window, tree->child2);
@@ -482,12 +482,12 @@ int
gui_layout_window_save (struct t_gui_layout_window **layout_windows)
{
gui_layout_window_remove_all (layout_windows);
-
+
gui_layout_internal_id = 1;
gui_layout_internal_id_current_window = -1;
-
+
gui_layout_window_save_tree (layout_windows, NULL, gui_windows_tree);
-
+
return gui_layout_internal_id_current_window;
}
@@ -500,9 +500,9 @@ gui_layout_window_check_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_win;
const char *plugin_name;
-
+
plugin_name = gui_buffer_get_plugin_name (buffer);
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name && ptr_win->layout_buffer_name)
@@ -527,7 +527,7 @@ gui_layout_window_check_all_buffers ()
{
struct t_gui_window *ptr_win;
struct t_gui_buffer *ptr_buffer;
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name && ptr_win->layout_buffer_name)
@@ -556,12 +556,12 @@ gui_layout_window_apply_tree (struct t_gui_layout_window *layout_window,
int internal_id_current_window)
{
struct t_gui_window *old_window;
-
+
if (layout_window->split_pct != 0)
{
/* node */
old_window = gui_current_window;
-
+
if (layout_window->split_horiz)
{
gui_window_split_horizontal (gui_current_window,
@@ -572,14 +572,14 @@ gui_layout_window_apply_tree (struct t_gui_layout_window *layout_window,
gui_window_split_vertical (gui_current_window,
layout_window->split_pct);
}
-
+
if (layout_window->child2)
gui_layout_window_apply_tree (layout_window->child2,
internal_id_current_window);
-
+
if (old_window != gui_current_window)
gui_window_switch (old_window);
-
+
if (layout_window->child1)
gui_layout_window_apply_tree (layout_window->child1,
internal_id_current_window);
@@ -589,7 +589,7 @@ gui_layout_window_apply_tree (struct t_gui_layout_window *layout_window,
/* leaf */
if (layout_window->internal_id == internal_id_current_window)
gui_layout_ptr_current_window = gui_current_window;
-
+
gui_window_set_layout_plugin_name (gui_current_window,
layout_window->plugin_name);
gui_window_set_layout_buffer_name (gui_current_window,
@@ -606,20 +606,20 @@ gui_layout_window_apply (struct t_gui_layout_window *layout_windows,
int internal_id_current_window)
{
struct t_gui_window *old_window;
-
+
if (!layout_windows)
return;
-
+
gui_window_merge_all (gui_current_window);
-
+
old_window = gui_current_window;
gui_layout_ptr_current_window = NULL;
-
+
gui_layout_window_apply_tree (layout_windows,
internal_id_current_window);
-
+
gui_layout_window_check_all_buffers ();
-
+
gui_window_switch ((gui_layout_ptr_current_window) ?
gui_layout_ptr_current_window : old_window);
}
@@ -660,21 +660,21 @@ gui_layout_buffer_add_to_infolist (struct t_infolist *infolist,
struct t_gui_layout_buffer *layout_buffer)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !layout_buffer)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_string (ptr_item, "plugin_name", layout_buffer->plugin_name))
return 0;
if (!infolist_new_var_string (ptr_item, "buffer_name", layout_buffer->buffer_name))
return 0;
if (!infolist_new_var_integer (ptr_item, "number", layout_buffer->number))
return 0;
-
+
return 1;
}
@@ -688,14 +688,14 @@ gui_layout_window_add_to_infolist (struct t_infolist *infolist,
struct t_gui_layout_window *layout_window)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !layout_window)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_integer (ptr_item, "internal_id", layout_window->internal_id))
return 0;
if (!infolist_new_var_integer (ptr_item, "parent_id",
@@ -716,7 +716,7 @@ gui_layout_window_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_string (ptr_item, "buffer_name", layout_window->buffer_name))
return 0;
-
+
return 1;
}
@@ -734,7 +734,7 @@ gui_layout_print_log_window (struct t_gui_layout_window *layout_window,
layout_window,
(layout_window->plugin_name) ? "leaf" : "node",
level);
-
+
log_printf (" internal_id. . . . . . : %d", layout_window->internal_id);
log_printf (" parent_node. . . . . . : 0x%lx", layout_window->parent_node);
log_printf (" split_pct. . . . . . . : %d", layout_window->split_pct);
@@ -743,10 +743,10 @@ gui_layout_print_log_window (struct t_gui_layout_window *layout_window,
log_printf (" child2 . . . . . . . . : 0x%lx", layout_window->child2);
log_printf (" plugin_name. . . . . . : '%s'", layout_window->plugin_name);
log_printf (" buffer_name. . . . . . : '%s'", layout_window->buffer_name);
-
+
if (layout_window->child1)
gui_layout_print_log_window (layout_window->child1, level + 1);
-
+
if (layout_window->child2)
gui_layout_print_log_window (layout_window->child2, level + 1);
}
@@ -759,9 +759,9 @@ void
gui_layout_print_log ()
{
struct t_gui_layout_buffer *ptr_layout_buffer;
-
+
log_printf ("");
-
+
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
@@ -773,7 +773,7 @@ gui_layout_print_log ()
log_printf (" prev_layout. . . . . . : 0x%lx", ptr_layout_buffer->prev_layout);
log_printf (" next_layout. . . . . . : 0x%lx", ptr_layout_buffer->next_layout);
}
-
+
if (gui_layout_windows)
gui_layout_print_log_window (gui_layout_windows, 0);
}
diff --git a/src/gui/gui-layout.h b/src/gui/gui-layout.h
index e147cc5d1..a89a91071 100644
--- a/src/gui/gui-layout.h
+++ b/src/gui/gui-layout.h
@@ -36,13 +36,13 @@ struct t_gui_layout_window
int internal_id; /* used to save/read layout from */
/* config (to find parent) */
struct t_gui_layout_window *parent_node; /* pointer to parent node */
-
+
/* node info */
int split_pct; /* % of split size (child1) */
int split_horiz; /* 1 if horizontal, 0 if vertical */
struct t_gui_layout_window *child1; /* first child, NULL if a leaf */
struct t_gui_layout_window *child2; /* second child, NULL if leaf */
-
+
/* leaf info */
char *plugin_name;
char *buffer_name;
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 9fe1b6d12..20df53b53 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -68,7 +68,7 @@ gui_lines_alloc ()
new_lines->buffer_max_length = 0;
new_lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min);
}
-
+
return new_lines;
}
@@ -91,14 +91,14 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
int with_suffix, int first_line)
{
int length_time, length_buffer, length_suffix;
-
+
/* return immediately if alignment for end of lines is "time" */
if (!first_line
&& (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_TIME))
{
return 0;
}
-
+
/* length of time */
if (buffer->time_for_each_line)
{
@@ -106,14 +106,14 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
}
else
length_time = 0;
-
+
/* return immediately if alignment for end of lines is "buffer" */
if (!first_line
&& (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_BUFFER))
{
return length_time;
}
-
+
/* length of buffer name (when many buffers are merged) */
if (buffer->mixed_lines)
{
@@ -132,20 +132,20 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
}
else
length_buffer = 0;
-
+
/* return immediately if alignment for end of lines is "prefix" */
if (!first_line
&& (CONFIG_INTEGER(config_look_align_end_of_lines) == CONFIG_LOOK_ALIGN_END_OF_LINES_PREFIX))
{
return length_time + length_buffer;
}
-
+
if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE)
{
return length_time + length_buffer + line->data->prefix_length
+ ((line->data->prefix_length > 0) ? 1 : 0);
}
-
+
length_suffix = 0;
if (with_suffix)
{
@@ -153,7 +153,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
&& CONFIG_STRING(config_look_prefix_suffix)[0])
length_suffix = gui_chat_strlen_screen (CONFIG_STRING(config_look_prefix_suffix)) + 1;
}
-
+
return length_time + ((buffer->lines->prefix_max_length > 0) ? 1 : 0)
+ length_buffer
+ (((CONFIG_INTEGER(config_look_prefix_align_max) > 0)
@@ -173,7 +173,7 @@ gui_line_is_displayed (struct t_gui_line *line)
/* line is hidden if filters are enabled and flag "displayed" is not set */
if (gui_filters_enabled && !line->data->displayed)
return 0;
-
+
/* in all other cases, line is displayed */
return 1;
}
@@ -186,13 +186,13 @@ struct t_gui_line *
gui_line_get_first_displayed (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
-
+
ptr_line = buffer->lines->first_line;
while (ptr_line && !gui_line_is_displayed (ptr_line))
{
ptr_line = ptr_line->next_line;
}
-
+
return ptr_line;
}
@@ -204,13 +204,13 @@ struct t_gui_line *
gui_line_get_last_displayed (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
-
+
ptr_line = buffer->lines->last_line;
while (ptr_line && !gui_line_is_displayed (ptr_line))
{
ptr_line = ptr_line->prev_line;
}
-
+
return ptr_line;
}
@@ -260,12 +260,12 @@ gui_line_search_text (struct t_gui_line *line, const char *text,
{
char *prefix, *message;
int rc;
-
+
if (!line || !line->data->message || !text || !text[0])
return 0;
-
+
rc = 0;
-
+
if (line->data->prefix)
{
prefix = gui_color_decode (line->data->prefix, NULL);
@@ -277,7 +277,7 @@ gui_line_search_text (struct t_gui_line *line, const char *text,
free (prefix);
}
}
-
+
if (!rc)
{
message = gui_color_decode (line->data->message, NULL);
@@ -289,7 +289,7 @@ gui_line_search_text (struct t_gui_line *line, const char *text,
free (message);
}
}
-
+
return rc;
}
@@ -304,13 +304,13 @@ gui_line_match_regex (struct t_gui_line *line, regex_t *regex_prefix,
{
char *prefix, *message;
int match_prefix, match_message;
-
+
if (!line || (!regex_prefix && !regex_message))
return 0;
-
+
prefix = NULL;
message = NULL;
-
+
match_prefix = 1;
match_message = 1;
@@ -339,12 +339,12 @@ gui_line_match_regex (struct t_gui_line *line, regex_t *regex_prefix,
if (regex_message)
match_message = 0;
}
-
+
if (prefix)
free (prefix);
if (message)
free (message);
-
+
return (match_prefix && match_message);
}
@@ -358,13 +358,13 @@ gui_line_match_tags (struct t_gui_line *line, int tags_count,
char **tags_array)
{
int i, j;
-
+
if (!line)
return 0;
-
+
if (line->data->tags_count == 0)
return 0;
-
+
for (i = 0; i < tags_count; i++)
{
for (j = 0; j < line->data->tags_count; j++)
@@ -376,7 +376,7 @@ gui_line_match_tags (struct t_gui_line *line, int tags_count,
return 1;
}
}
-
+
return 0;
}
@@ -389,7 +389,7 @@ const char *
gui_line_get_nick_tag (struct t_gui_line *line)
{
int i;
-
+
for (i = 0; i < line->data->tags_count; i++)
{
if (strncmp (line->data->tags_array[i], "nick_", 5) == 0)
@@ -408,7 +408,7 @@ gui_line_has_highlight (struct t_gui_line *line)
{
int rc, i, j, no_highlight;
char *msg_no_color, *highlight_words;
-
+
/*
* highlights are disabled on this buffer? (special value "-" means that
* buffer does not want any highlight)
@@ -416,7 +416,7 @@ gui_line_has_highlight (struct t_gui_line *line)
if (line->data->buffer->highlight_words
&& (strcmp (line->data->buffer->highlight_words, "-") == 0))
return 0;
-
+
/*
* check if highlight is forced by a tag (with option highlight_tags) or
* disabled for line
@@ -438,7 +438,7 @@ gui_line_has_highlight (struct t_gui_line *line)
}
if (no_highlight)
return 0;
-
+
/*
* check that line matches highlight tags, if any (if no tag is specified,
* then any tag is allowed)
@@ -450,12 +450,12 @@ gui_line_has_highlight (struct t_gui_line *line)
line->data->buffer->highlight_tags_array))
return 0;
}
-
+
/* remove color codes from line message */
msg_no_color = gui_color_decode (line->data->message, NULL);
if (!msg_no_color)
return 0;
-
+
/*
* there is highlight on line if one of buffer highlight words matches line
* or one of global highlight words matches line
@@ -467,7 +467,7 @@ gui_line_has_highlight (struct t_gui_line *line)
highlight_words : line->data->buffer->highlight_words);
if (highlight_words)
free (highlight_words);
-
+
if (!rc)
{
highlight_words = gui_buffer_string_replace_local_var (line->data->buffer,
@@ -478,21 +478,21 @@ gui_line_has_highlight (struct t_gui_line *line)
if (highlight_words)
free (highlight_words);
}
-
+
if (!rc && config_highlight_regex)
{
rc = string_has_highlight_regex_compiled (msg_no_color,
config_highlight_regex);
}
-
+
if (!rc && line->data->buffer->highlight_regex_compiled)
{
rc = string_has_highlight_regex_compiled (msg_no_color,
line->data->buffer->highlight_regex_compiled);
}
-
+
free (msg_no_color);
-
+
return rc;
}
@@ -508,7 +508,7 @@ gui_line_compute_buffer_max_length (struct t_gui_buffer *buffer,
struct t_gui_buffer *ptr_buffer;
int length;
const char *short_name;
-
+
lines->buffer_max_length = 0;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -532,7 +532,7 @@ void
gui_line_compute_prefix_max_length (struct t_gui_lines *lines)
{
struct t_gui_line *ptr_line;
-
+
lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min);
for (ptr_line = lines->first_line; ptr_line;
ptr_line = ptr_line->next_line)
@@ -557,10 +557,10 @@ gui_line_add_to_list (struct t_gui_lines *lines,
line->prev_line = lines->last_line;
line->next_line = NULL;
lines->last_line = line;
-
+
if (line->data->prefix_length > lines->prefix_max_length)
lines->prefix_max_length = line->data->prefix_length;
-
+
lines->lines_count++;
}
@@ -577,7 +577,7 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
struct t_gui_window *ptr_win;
struct t_gui_window_scroll *ptr_scroll;
int i, update_prefix_max_length;
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
/* reset scroll for any window scroll starting with this line */
@@ -601,10 +601,10 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
}
}
}
-
+
update_prefix_max_length =
(line->data->prefix_length == lines->prefix_max_length);
-
+
/* move read marker if it was on line we are removing */
if (lines->last_read_line == line)
{
@@ -612,7 +612,7 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
lines->first_line_not_read = (lines->last_read_line) ? 0 : 1;
gui_buffer_ask_chat_refresh (buffer, 1);
}
-
+
/* free data */
if (free_data)
{
@@ -626,7 +626,7 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
free (line->data->message);
free (line->data);
}
-
+
/* remove line from list */
if (line->prev_line)
(line->prev_line)->next_line = line->next_line;
@@ -636,11 +636,11 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
lines->first_line = line->next_line;
if (lines->last_line == line)
lines->last_line = line->prev_line;
-
+
lines->lines_count--;
-
+
free (line);
-
+
/* compute "prefix_max_length" if needed */
if (update_prefix_max_length)
gui_line_compute_prefix_max_length (lines);
@@ -655,7 +655,7 @@ gui_line_mixed_add (struct t_gui_lines *lines,
struct t_gui_line_data *line_data)
{
struct t_gui_line *new_line;
-
+
new_line = malloc (sizeof (*new_line));
if (new_line)
{
@@ -672,14 +672,14 @@ void
gui_line_mixed_free_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line, *ptr_next_line;
-
+
if (buffer->mixed_lines)
{
ptr_line = buffer->mixed_lines->first_line;
while (ptr_line)
{
ptr_next_line = ptr_line->next_line;
-
+
if (ptr_line->data->buffer == buffer)
{
gui_line_remove_from_list (buffer,
@@ -687,7 +687,7 @@ gui_line_mixed_free_buffer (struct t_gui_buffer *buffer)
ptr_line,
0);
}
-
+
ptr_line = ptr_next_line;
}
}
@@ -720,7 +720,7 @@ void
gui_line_free (struct t_gui_buffer *buffer, struct t_gui_line *line)
{
struct t_gui_line *ptr_line;
-
+
/* first remove mixed line if it exists */
if (buffer->mixed_lines)
{
@@ -737,7 +737,7 @@ gui_line_free (struct t_gui_buffer *buffer, struct t_gui_line *line)
}
}
}
-
+
/* remove line from lines list */
gui_line_remove_from_list (buffer, buffer->own_lines, line, 1);
}
@@ -765,7 +765,7 @@ int
gui_line_get_notify_level (struct t_gui_line *line)
{
int i;
-
+
for (i = 0; i < line->data->tags_count; i++)
{
if (string_strcasecmp (line->data->tags_array[i], "notify_none") == 0)
@@ -795,14 +795,14 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
char *message_for_signal, buffer_full_name[512];
const char *nick;
int notify_level, *max_notify_level;
-
+
new_line = malloc (sizeof (*new_line));
if (!new_line)
{
log_printf (_("Not enough memory for new line"));
return NULL;
}
-
+
new_line_data = malloc (sizeof (*(new_line->data)));
if (!new_line_data)
{
@@ -811,7 +811,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
return NULL;
}
new_line->data = new_line_data;
-
+
/* fill data in new line */
new_line->data->buffer = buffer;
new_line->data->y = -1;
@@ -835,7 +835,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
new_line->data->prefix_length = (prefix) ?
gui_chat_strlen_screen (prefix) : 0;
new_line->data->message = (message) ? strdup (message) : strdup ("");
-
+
/* get notify level and max notify level for nick in buffer */
notify_level = gui_line_get_notify_level (new_line);
nick = gui_line_get_nick_tag (new_line);
@@ -845,17 +845,17 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
if (max_notify_level
&& (*max_notify_level < notify_level))
notify_level = *max_notify_level;
-
+
if (notify_level == GUI_HOTLIST_HIGHLIGHT)
new_line->data->highlight = 1;
else if (max_notify_level && (*max_notify_level < GUI_HOTLIST_HIGHLIGHT))
new_line->data->highlight = 0;
else
new_line->data->highlight = gui_line_has_highlight (new_line);
-
+
/* add line to lines list */
gui_line_add_to_list (buffer->own_lines, new_line);
-
+
/* check if line is filtered or not */
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
gui_buffer_get_plugin_name (buffer),
@@ -907,13 +907,13 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
}
-
+
/* add mixed line, if buffer is attched to at least one other buffer */
if (buffer->mixed_lines)
{
gui_line_mixed_add (buffer->mixed_lines, new_line->data);
}
-
+
/* remove one line if necessary */
if ((CONFIG_INTEGER(config_history_max_lines) > 0)
&& (buffer->own_lines->lines_count > CONFIG_INTEGER(config_history_max_lines)))
@@ -929,7 +929,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
}
}
}
-
+
return new_line;
}
@@ -943,7 +943,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
struct t_gui_line *ptr_line, *new_line;
struct t_gui_line_data *new_line_data;
char buffer_full_name[512];
-
+
/* search if line exists for "y" */
for (ptr_line = buffer->own_lines->first_line; ptr_line;
ptr_line = ptr_line->next_line)
@@ -951,7 +951,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
if (ptr_line->data->y >= y)
break;
}
-
+
if (!ptr_line || (ptr_line->data->y > y))
{
new_line = malloc (sizeof (*new_line));
@@ -960,7 +960,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
log_printf (_("Not enough memory for new line"));
return;
}
-
+
new_line_data = malloc (sizeof (*(new_line->data)));
if (!new_line_data)
{
@@ -969,9 +969,9 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
return;
}
new_line->data = new_line_data;
-
+
buffer->own_lines->lines_count++;
-
+
/* fill data in new line */
new_line->data->buffer = buffer;
new_line->data->y = y;
@@ -985,7 +985,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
new_line->data->prefix_length = 0;
new_line->data->message = NULL;
new_line->data->highlight = 0;
-
+
/* add line to lines list */
if (ptr_line)
{
@@ -1012,12 +1012,12 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
ptr_line = new_line;
}
-
+
/* set message for line */
if (ptr_line->data->message)
free (ptr_line->data->message);
ptr_line->data->message = (message) ? strdup (message) : strdup ("");
-
+
/* check if line is filtered or not */
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
gui_buffer_get_plugin_name (buffer),
@@ -1033,7 +1033,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
}
-
+
ptr_line->data->refresh_needed = 1;
}
@@ -1048,7 +1048,7 @@ gui_line_clear (struct t_gui_line *line)
if (line->data->prefix)
free (line->data->prefix);
line->data->prefix = strdup ("");
-
+
if (line->data->message)
free (line->data->message);
line->data->message = strdup ("");
@@ -1065,7 +1065,7 @@ gui_line_mix_buffers (struct t_gui_buffer *buffer)
struct t_gui_buffer *ptr_buffer, *ptr_buffer_found;
struct t_gui_lines *new_lines;
struct t_gui_line *ptr_line1, *ptr_line2;
-
+
/* search first other buffer with same number */
ptr_buffer_found = NULL;
for (ptr_buffer = gui_buffers; ptr_buffer;
@@ -1079,7 +1079,7 @@ gui_line_mix_buffers (struct t_gui_buffer *buffer)
}
if (!ptr_buffer_found)
return;
-
+
/* mix all lines (sorting by date) to a new structure "new_lines" */
new_lines = gui_lines_alloc ();
if (!new_lines)
@@ -1124,20 +1124,20 @@ gui_line_mix_buffers (struct t_gui_buffer *buffer)
}
}
}
-
+
/* compute "prefix_max_length" for mixed lines */
gui_line_compute_prefix_max_length (new_lines);
-
+
/* compute "buffer_max_length" for mixed lines */
gui_line_compute_buffer_max_length (buffer, new_lines);
-
+
/* free old mixed lines */
if (ptr_buffer_found->mixed_lines)
{
gui_line_mixed_free_all (ptr_buffer_found);
free (ptr_buffer_found->mixed_lines);
}
-
+
/* use new structure with mixed lines in all buffers with correct number */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -1158,10 +1158,10 @@ struct t_hdata *
gui_line_hdata_lines_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
if (hdata)
{
@@ -1185,10 +1185,10 @@ struct t_hdata *
gui_line_hdata_line_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line");
if (hdata)
{
@@ -1207,10 +1207,10 @@ struct t_hdata *
gui_line_hdata_line_data_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
if (hdata)
{
@@ -1244,14 +1244,14 @@ gui_line_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
int i, length;
char option_name[64], *tags;
-
+
if (!infolist || !line)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_integer (ptr_item, "y", line->data->y))
return 0;
if (!infolist_new_var_time (ptr_item, "date", line->data->date))
@@ -1260,7 +1260,7 @@ gui_line_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_string (ptr_item, "str_time", line->data->str_time))
return 0;
-
+
/* write tags */
if (!infolist_new_var_integer (ptr_item, "tags_count", line->data->tags_count))
return 0;
@@ -1289,7 +1289,7 @@ gui_line_add_to_infolist (struct t_infolist *infolist,
return 0;
}
free (tags);
-
+
if (!infolist_new_var_integer (ptr_item, "displayed", line->data->displayed))
return 0;
if (!infolist_new_var_integer (ptr_item, "highlight", line->data->highlight))
@@ -1301,7 +1301,7 @@ gui_line_add_to_infolist (struct t_infolist *infolist,
if (!infolist_new_var_integer (ptr_item, "last_read_line",
(lines->last_read_line == line) ? 1 : 0))
return 0;
-
+
return 1;
}
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 7f652c3ea..454f79eed 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -59,7 +59,7 @@ gui_nicklist_send_signal (const char *signal, struct t_gui_buffer *buffer,
{
char *str_args;
int length;
-
+
if (buffer)
{
length = 128 + ((arguments) ? strlen (arguments) : 0) + 1 + 1;
@@ -90,13 +90,13 @@ gui_nicklist_find_pos_group (struct t_gui_nick_group *groups,
struct t_gui_nick_group *group)
{
struct t_gui_nick_group *ptr_group;
-
+
for (ptr_group = groups; ptr_group; ptr_group = ptr_group->next_group)
{
if (string_strcasecmp (group->name, ptr_group->name) < 0)
return ptr_group;
}
-
+
/* group will be inserted at end of list */
return NULL;
}
@@ -111,11 +111,11 @@ gui_nicklist_insert_group_sorted (struct t_gui_nick_group **groups,
struct t_gui_nick_group *group)
{
struct t_gui_nick_group *pos_group;
-
+
if (*groups)
{
pos_group = gui_nicklist_find_pos_group (*groups, group);
-
+
if (pos_group)
{
/* insert group into the list (before group found) */
@@ -157,16 +157,16 @@ gui_nicklist_search_group_internal (struct t_gui_buffer *buffer,
{
struct t_gui_nick_group *ptr_group;
const char *ptr_name;
-
+
if (!buffer)
return NULL;
-
+
if (!from_group)
from_group = buffer->nicklist_root;
-
+
if (!from_group)
return NULL;
-
+
if (from_group->children)
{
ptr_group = gui_nicklist_search_group_internal (buffer,
@@ -176,7 +176,7 @@ gui_nicklist_search_group_internal (struct t_gui_buffer *buffer,
if (ptr_group)
return ptr_group;
}
-
+
ptr_group = from_group;
while (ptr_group)
{
@@ -186,7 +186,7 @@ gui_nicklist_search_group_internal (struct t_gui_buffer *buffer,
return ptr_group;
ptr_group = ptr_group->next_group;
}
-
+
/* group not found */
return NULL;
}
@@ -201,9 +201,9 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
const char *name)
{
const char *ptr_name;
-
+
ptr_name = gui_nicklist_get_group_start (name);
-
+
return gui_nicklist_search_group_internal (buffer, from_group, name,
(ptr_name == name) ? 1 : 0);
}
@@ -218,14 +218,14 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
const char *color, int visible)
{
struct t_gui_nick_group *new_group;
-
+
if (!buffer || !name || gui_nicklist_search_group (buffer, parent_group, name))
return NULL;
-
+
new_group = malloc (sizeof (*new_group));
if (!new_group)
return NULL;
-
+
new_group->name = strdup (name);
new_group->color = (color) ? strdup (color) : NULL;
new_group->visible = visible;
@@ -237,7 +237,7 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
new_group->last_nick = NULL;
new_group->prev_group = NULL;
new_group->next_group = NULL;
-
+
if (new_group->parent)
{
gui_nicklist_insert_group_sorted (&(new_group->parent->children),
@@ -248,12 +248,12 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
{
buffer->nicklist_root = new_group;
}
-
+
if (buffer->nicklist_display_groups && visible)
buffer->nicklist_visible_count++;
-
+
gui_nicklist_send_signal ("nicklist_group_added", buffer, name);
-
+
return new_group;
}
@@ -266,16 +266,16 @@ gui_nicklist_find_pos_nick (struct t_gui_nick_group *group,
struct t_gui_nick *nick)
{
struct t_gui_nick *ptr_nick;
-
+
if (!group)
return NULL;
-
+
for (ptr_nick = group->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
if (string_strcasecmp (nick->name, ptr_nick->name) < 0)
return ptr_nick;
}
-
+
/* nick will be inserted at end of list */
return NULL;
}
@@ -289,11 +289,11 @@ gui_nicklist_insert_nick_sorted (struct t_gui_nick_group *group,
struct t_gui_nick *nick)
{
struct t_gui_nick *pos_nick;
-
+
if (group->nicks)
{
pos_nick = gui_nicklist_find_pos_nick (group, nick);
-
+
if (pos_nick)
{
/* insert nick into the list (before nick found) */
@@ -334,13 +334,13 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
{
struct t_gui_nick *ptr_nick;
struct t_gui_nick_group *ptr_group;
-
+
if (!buffer && !from_group)
return NULL;
-
+
if (!from_group && !buffer->nicklist_root)
return NULL;
-
+
for (ptr_nick = (from_group) ? from_group->nicks : buffer->nicklist_root->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
{
@@ -356,7 +356,7 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
if (ptr_nick)
return ptr_nick;
}
-
+
/* nick not found */
return NULL;
}
@@ -373,28 +373,28 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer,
int visible)
{
struct t_gui_nick *new_nick;
-
+
if (!buffer || !name || gui_nicklist_search_nick (buffer, NULL, name))
return NULL;
-
+
new_nick = malloc (sizeof (*new_nick));
if (!new_nick)
return NULL;
-
+
new_nick->group = (group) ? group : buffer->nicklist_root;
new_nick->name = strdup (name);
new_nick->color = (color) ? strdup (color) : NULL;
new_nick->prefix = (prefix) ? strdup (prefix) : NULL;
new_nick->prefix_color = (prefix_color) ? strdup (prefix_color) : NULL;
new_nick->visible = visible;
-
+
gui_nicklist_insert_nick_sorted (new_nick->group, new_nick);
-
+
if (visible)
buffer->nicklist_visible_count++;
-
+
gui_nicklist_send_signal ("nicklist_nick_added", buffer, name);
-
+
return new_nick;
}
@@ -407,12 +407,12 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
struct t_gui_nick *nick)
{
char *nick_removed;
-
+
if (!buffer || !nick)
return;
-
+
nick_removed = (nick->name) ? strdup (nick->name) : NULL;
-
+
/* remove nick from list */
if (nick->prev_nick)
(nick->prev_nick)->next_nick = nick->next_nick;
@@ -422,7 +422,7 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
(nick->group)->nicks = nick->next_nick;
if ((nick->group)->last_nick == nick)
(nick->group)->last_nick = nick->prev_nick;
-
+
/* free data */
if (nick->name)
free (nick->name);
@@ -432,17 +432,17 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
free (nick->prefix);
if (nick->prefix_color)
free (nick->prefix_color);
-
+
if (nick->visible)
{
if (buffer->nicklist_visible_count > 0)
buffer->nicklist_visible_count--;
}
-
+
free (nick);
-
+
gui_nicklist_send_signal ("nicklist_nick_removed", buffer, nick_removed);
-
+
if (nick_removed)
free (nick_removed);
}
@@ -456,24 +456,24 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group)
{
char *group_removed;
-
+
if (!buffer || !group)
return;
-
+
group_removed = (group->name) ? strdup (group->name) : NULL;
-
+
/* remove children first */
while (group->children)
{
gui_nicklist_remove_group (buffer, group->children);
}
-
+
/* remove nicks from group */
while (group->nicks)
{
gui_nicklist_remove_nick (buffer, group->nicks);
}
-
+
if (group->parent)
{
/* remove group from list */
@@ -490,24 +490,24 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
{
buffer->nicklist_root = NULL;
}
-
+
/* free data */
if (group->name)
free (group->name);
if (group->color)
free (group->color);
-
+
if (group->visible)
{
if (buffer->nicklist_display_groups
&& (buffer->nicklist_visible_count > 0))
buffer->nicklist_visible_count--;
}
-
+
free (group);
-
+
gui_nicklist_send_signal ("nicklist_group_removed", buffer, group_removed);
-
+
if (group_removed)
free (group_removed);
}
@@ -539,24 +539,24 @@ gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
struct t_gui_nick **nick)
{
struct t_gui_nick_group *ptr_group;
-
+
if (!buffer)
return;
-
+
/* root group */
if (!*group && !*nick)
{
*group = buffer->nicklist_root;
return;
}
-
+
/* next nick */
if (*nick && (*nick)->next_nick)
{
*nick = (*nick)->next_nick;
return;
}
-
+
if (*group && !*nick)
{
/* first child */
@@ -577,17 +577,17 @@ gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
return;
}
}
-
+
*nick = NULL;
ptr_group = (*group) ? *group : buffer->nicklist_root;
-
+
/* next group */
if (ptr_group->next_group)
{
*group = ptr_group->next_group;
return;
}
-
+
/* find next group by parents */
while ((ptr_group = ptr_group->parent))
{
@@ -597,7 +597,7 @@ gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
return;
}
}
-
+
/* nothing found */
*group = NULL;
}
@@ -613,7 +613,7 @@ const char *
gui_nicklist_get_group_start (const char *name)
{
const char *ptr_name;
-
+
ptr_name = name;
while (isdigit ((unsigned char)ptr_name[0]))
{
@@ -638,10 +638,10 @@ gui_nicklist_get_max_length (struct t_gui_buffer *buffer,
int length, max_length;
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
-
+
if (!buffer)
return 0;
-
+
max_length = 0;
for (ptr_group = (group) ? group : buffer->nicklist_root;
ptr_group; ptr_group = ptr_group->next_group)
@@ -687,21 +687,21 @@ gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer,
{
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
-
+
if (!buffer || !group)
return;
-
+
/* count for children */
for (ptr_group = group->children; ptr_group;
ptr_group = ptr_group->next_group)
{
gui_nicklist_compute_visible_count (buffer, ptr_group);
}
-
+
/* count current group */
if (buffer->nicklist_display_groups && group->visible)
buffer->nicklist_visible_count++;
-
+
/* count nicks in group */
for (ptr_nick = group->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
@@ -720,7 +720,7 @@ gui_nicklist_group_get_integer (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (group && property)
{
if (string_strcasecmp (property, "visible") == 0)
@@ -728,7 +728,7 @@ gui_nicklist_group_get_integer (struct t_gui_buffer *buffer,
else if (string_strcasecmp (property, "level") == 0)
return group->level;
}
-
+
return 0;
}
@@ -743,7 +743,7 @@ gui_nicklist_group_get_string (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (group && property)
{
if (string_strcasecmp (property, "name") == 0)
@@ -751,7 +751,7 @@ gui_nicklist_group_get_string (struct t_gui_buffer *buffer,
else if (string_strcasecmp (property, "color") == 0)
return group->color;
}
-
+
return NULL;
}
@@ -766,13 +766,13 @@ gui_nicklist_group_get_pointer (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (group && property)
{
if (string_strcasecmp (property, "parent") == 0)
return group->parent;
}
-
+
return NULL;
}
@@ -788,12 +788,12 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
long number;
char *error;
int group_changed;
-
+
if (!buffer || !group || !property || !value)
return;
-
+
group_changed = 0;
-
+
if (string_strcasecmp (property, "color") == 0)
{
if (group->color)
@@ -809,7 +809,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
group->visible = (number) ? 1 : 0;
group_changed = 1;
}
-
+
if (group_changed)
{
gui_nicklist_send_signal ("nicklist_group_changed", buffer,
@@ -828,13 +828,13 @@ gui_nicklist_nick_get_integer (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (nick && property)
{
if (string_strcasecmp (property, "visible") == 0)
return nick->visible;
}
-
+
return 0;
}
@@ -849,7 +849,7 @@ gui_nicklist_nick_get_string (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (nick && property)
{
if (string_strcasecmp (property, "name") == 0)
@@ -861,7 +861,7 @@ gui_nicklist_nick_get_string (struct t_gui_buffer *buffer,
else if (string_strcasecmp (property, "prefix_color") == 0)
return nick->prefix_color;
}
-
+
return NULL;
}
@@ -876,13 +876,13 @@ gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) buffer;
-
+
if (nick && property)
{
if (string_strcasecmp (property, "group") == 0)
return nick->group;
}
-
+
return NULL;
}
@@ -898,12 +898,12 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
long number;
char *error;
int nick_changed;
-
+
if (!buffer || !nick || !property || !value)
return;
-
+
nick_changed = 0;
-
+
if (string_strcasecmp (property, "color") == 0)
{
if (nick->color)
@@ -933,7 +933,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
nick->visible = (number) ? 1 : 0;
nick_changed = 1;
}
-
+
if (nick_changed)
{
gui_nicklist_send_signal ("nicklist_nick_changed", buffer,
@@ -949,10 +949,10 @@ struct t_hdata *
gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group");
if (hdata)
{
@@ -979,10 +979,10 @@ struct t_hdata *
gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick");
if (hdata)
{
@@ -1008,14 +1008,14 @@ gui_nicklist_add_group_to_infolist (struct t_infolist *infolist,
struct t_gui_nick_group *group)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !group)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_string (ptr_item, "type", "group"))
return 0;
if (group->parent)
@@ -1031,7 +1031,7 @@ gui_nicklist_add_group_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "level", group->level))
return 0;
-
+
return 1;
}
@@ -1045,14 +1045,14 @@ gui_nicklist_add_nick_to_infolist (struct t_infolist *infolist,
struct t_gui_nick *nick)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !nick)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_string (ptr_item, "type", "nick"))
return 0;
if (nick->group)
@@ -1070,7 +1070,7 @@ gui_nicklist_add_nick_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "visible", nick->visible))
return 0;
-
+
return 1;
}
@@ -1086,10 +1086,10 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist,
{
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
-
+
if (!infolist || !buffer)
return 0;
-
+
/* add only one nick if asked */
if (name && (strncmp (name, "nick_", 5) == 0))
{
@@ -1098,7 +1098,7 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist,
return 0;
return gui_nicklist_add_nick_to_infolist (infolist, ptr_nick);
}
-
+
/* add only one group if asked */
if (name && (strncmp (name, "group_", 6) == 0))
{
@@ -1107,7 +1107,7 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist,
return 0;
return gui_nicklist_add_group_to_infolist (infolist, ptr_group);
}
-
+
ptr_group = NULL;
ptr_nick = NULL;
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
@@ -1117,10 +1117,10 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist,
gui_nicklist_add_nick_to_infolist (infolist, ptr_nick);
else
gui_nicklist_add_group_to_infolist (infolist, ptr_group);
-
+
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
}
-
+
return 1;
}
@@ -1134,7 +1134,7 @@ gui_nicklist_print_log (struct t_gui_nick_group *group, int indent)
char format[128];
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
-
+
snprintf (format, sizeof (format),
"%%-%ds=> group (addr:0x%%lx)",
(indent * 2) + 4);
@@ -1179,7 +1179,7 @@ gui_nicklist_print_log (struct t_gui_nick_group *group, int indent)
"%%-%dsnext_group. : 0x%%lx",
(indent * 2) + 6);
log_printf (format, " ", group->next_group);
-
+
/* display child groups first */
if (group->children)
{
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 7dd9d87a1..c14b8840d 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -84,13 +84,13 @@ struct t_gui_window *
gui_window_search_by_number (int number)
{
struct t_gui_window *ptr_win;
-
+
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->number == number)
return ptr_win;
}
-
+
/* window not found */
return NULL;
}
@@ -104,7 +104,7 @@ struct t_gui_window *
gui_window_search_by_xy (int x, int y)
{
struct t_gui_window *ptr_window;
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
@@ -115,7 +115,7 @@ gui_window_search_by_xy (int x, int y)
return ptr_window;
}
}
-
+
/* no window at this location */
return NULL;
}
@@ -143,18 +143,18 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
int win_x, win_y;
char *ptr_data, *data_next_line, *str_temp;
char *word_start, *word_end, *last_space;
-
+
*chat = 0;
*line = NULL;
*line_x = -1;
*word = NULL;
*beginning = NULL;
*end = NULL;
-
+
/* not in a window? */
if (!window)
return;
-
+
/* in window, but not in chat area? */
win_x = x - window->win_chat_x;
win_y = y - window->win_chat_y;
@@ -165,25 +165,25 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
{
return;
}
-
+
/* add horizontal scroll (buffers with free content) */
if (window->scroll->start_col > 0)
win_x += window->scroll->start_col;
-
+
*line_x = win_x;
-
+
/* we are in chat area */
*chat = 1;
-
+
/* get line */
*line = window->coords[win_y].line;
if (!*line)
return;
-
+
/* no data for line? */
if (!window->coords[win_y].data)
return;
-
+
if (win_x < window->coords_x_message)
{
/* X is before message (time/buffer/prefix) */
@@ -348,17 +348,17 @@ gui_window_scroll_search (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll;
-
+
if (!window || !buffer)
return NULL;
-
+
for (ptr_scroll = window->scroll; ptr_scroll;
ptr_scroll = ptr_scroll->next_scroll)
{
if (ptr_scroll->buffer == buffer)
return ptr_scroll;
}
-
+
/* scroll not found for buffer */
return NULL;
}
@@ -397,7 +397,7 @@ gui_window_scroll_free (struct t_gui_window *window,
(scroll->next_scroll)->prev_scroll = scroll->prev_scroll;
if (window->scroll == scroll)
window->scroll = scroll->next_scroll;
-
+
free (scroll);
}
@@ -426,14 +426,14 @@ void
gui_window_scroll_remove_not_scrolled (struct t_gui_window *window)
{
struct t_gui_window_scroll *ptr_scroll, *next_scroll;
-
+
if (window)
{
ptr_scroll = window->scroll->next_scroll;
while (ptr_scroll)
{
next_scroll = ptr_scroll->next_scroll;
-
+
if ((ptr_scroll->first_line_displayed == 0)
&& (ptr_scroll->start_line == NULL)
&& (ptr_scroll->start_line_pos == 0)
@@ -444,7 +444,7 @@ gui_window_scroll_remove_not_scrolled (struct t_gui_window *window)
{
gui_window_scroll_free (window, ptr_scroll);
}
-
+
ptr_scroll = next_scroll;
}
}
@@ -459,15 +459,15 @@ gui_window_scroll_switch (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll, *new_scroll;
-
+
if (window && buffer)
{
ptr_scroll = gui_window_scroll_search (window, buffer);
-
+
/* scroll is already selected (first in list)? */
if (ptr_scroll && (ptr_scroll == window->scroll))
return;
-
+
if (ptr_scroll)
{
/* scroll found, move it in first position */
@@ -492,7 +492,7 @@ gui_window_scroll_switch (struct t_gui_window *window,
window->scroll = new_scroll;
}
}
-
+
gui_window_scroll_remove_not_scrolled (window);
}
}
@@ -506,7 +506,7 @@ gui_window_scroll_remove_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_window_scroll *ptr_scroll;
-
+
if (window && buffer)
{
ptr_scroll = gui_window_scroll_search (window, buffer);
@@ -527,7 +527,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
struct t_gui_window *new_window;
struct t_gui_window_tree *ptr_tree, *child1, *child2, *ptr_leaf;
struct t_gui_bar *ptr_bar;
-
+
if (parent_window)
{
child1 = malloc (sizeof (*child1));
@@ -540,7 +540,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
return NULL;
}
ptr_tree = parent_window->ptr_tree;
-
+
if (width_pct == 100)
{
ptr_tree->split_horizontal = 1;
@@ -551,27 +551,27 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
ptr_tree->split_horizontal = 0;
ptr_tree->split_pct = width_pct;
}
-
+
/*
* parent window leaf becomes node and we add 2 leafs below
* (#1 is parent win, #2 is new win)
*/
-
+
parent_window->ptr_tree = child1;
child1->parent_node = ptr_tree;
child1->child1 = NULL;
child1->child2 = NULL;
child1->window = ptr_tree->window;
-
+
child2->parent_node = ptr_tree;
child2->child1 = NULL;
child2->child2 = NULL;
child2->window = NULL; /* will be assigned by new window below */
-
+
ptr_tree->child1 = child1;
ptr_tree->child2 = child2;
ptr_tree->window = NULL; /* leaf becomes node */
-
+
ptr_leaf = child2;
}
else
@@ -580,7 +580,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
return NULL;
ptr_leaf = gui_windows_tree;
}
-
+
if ((new_window = (malloc (sizeof (*new_window)))))
{
/* create scroll structure */
@@ -590,7 +590,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
free (new_window);
return NULL;
}
-
+
/* create window objects */
if (!gui_window_objects_init (new_window))
{
@@ -598,10 +598,10 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
free (new_window);
return NULL;
}
-
+
/* number */
new_window->number = (last_gui_window) ? last_gui_window->number + 1 : 1;
-
+
/* position & size */
new_window->win_x = x;
new_window->win_y = y;
@@ -609,7 +609,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
new_window->win_height = height;
new_window->win_width_pct = width_pct;
new_window->win_height_pct = height_pct;
-
+
/* chat window */
new_window->win_chat_x = 0;
new_window->win_chat_y = 0;
@@ -621,27 +621,27 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
/* bar windows */
new_window->bar_windows = NULL;
new_window->last_bar_window = NULL;
-
+
/* refresh */
new_window->refresh_needed = 0;
-
+
/* buffer and layout infos */
new_window->buffer = buffer;
new_window->layout_plugin_name = NULL;
new_window->layout_buffer_name = NULL;
-
+
/* scroll */
gui_window_scroll_init (new_window->scroll, buffer);
-
+
/* coordinates */
new_window->coords_size = 0;
new_window->coords = NULL;
new_window->coords_x_message = 0;
-
+
/* tree */
new_window->ptr_tree = ptr_leaf;
ptr_leaf->window = new_window;
-
+
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
@@ -650,7 +650,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
-
+
/* create bar windows */
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
@@ -660,7 +660,7 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
}
else
return NULL;
-
+
return new_window;
}
@@ -674,17 +674,17 @@ int
gui_window_valid (struct t_gui_window *window)
{
struct t_gui_window *ptr_window;
-
+
if (!window)
return 0;
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window == window)
return 1;
}
-
+
/* window not found */
return 0;
}
@@ -703,20 +703,20 @@ struct t_gui_window *
gui_window_search_with_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_window;
-
+
if (!buffer)
return NULL;
-
+
if (gui_current_window->buffer == buffer)
return gui_current_window;
-
+
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window->buffer == buffer)
return ptr_window;
}
-
+
/* no window displaying buffer */
return NULL;
}
@@ -759,7 +759,7 @@ gui_window_get_integer (struct t_gui_window *window, const char *property)
if (string_strcasecmp (property, "lines_after") == 0)
return window->scroll->lines_after;
}
-
+
return 0;
}
@@ -773,7 +773,7 @@ gui_window_get_string (struct t_gui_window *window, const char *property)
if (window && property)
{
}
-
+
return NULL;
}
@@ -788,14 +788,14 @@ gui_window_get_pointer (struct t_gui_window *window, const char *property)
{
if (string_strcasecmp (property, "current") == 0)
return gui_current_window;
-
+
if (window)
{
if (string_strcasecmp (property, "buffer") == 0)
return window->buffer;
}
}
-
+
return NULL;
}
@@ -812,7 +812,7 @@ gui_window_set_layout_plugin_name (struct t_gui_window *window,
free (window->layout_plugin_name);
window->layout_plugin_name = NULL;
}
-
+
if (plugin_name)
window->layout_plugin_name = strdup (plugin_name);
}
@@ -830,7 +830,7 @@ gui_window_set_layout_buffer_name (struct t_gui_window *window,
free (window->layout_buffer_name);
window->layout_buffer_name = NULL;
}
-
+
if (buffer_name)
window->layout_buffer_name = strdup (buffer_name);
}
@@ -844,7 +844,7 @@ gui_window_coords_init_line (struct t_gui_window *window, int line)
{
if (!window->coords || (line < 0) || (line >= window->coords_size))
return;
-
+
window->coords[line].line = NULL;
window->coords[line].data = NULL;
window->coords[line].time_x1 = -1;
@@ -863,7 +863,7 @@ void
gui_window_coords_alloc (struct t_gui_window *window)
{
int i;
-
+
if (window->coords && (window->coords_size != window->win_chat_height))
{
free (window->coords);
@@ -891,38 +891,38 @@ gui_window_free (struct t_gui_window *window)
{
struct t_gui_window *ptr_win;
int i;
-
+
hook_signal_send ("window_closing", WEECHAT_HOOK_SIGNAL_POINTER, window);
-
+
if (window->buffer)
gui_buffer_add_value_num_displayed (window->buffer, -1);
-
+
/* free data */
if (window->gui_objects)
{
gui_window_objects_free (window, 1);
free (window->gui_objects);
}
-
+
/* remove bar windows */
while (window->bar_windows)
{
gui_bar_window_free (window->bar_windows, window);
}
-
+
/* free other data */
if (window->layout_plugin_name)
free (window->layout_plugin_name);
if (window->layout_buffer_name)
free (window->layout_buffer_name);
-
+
/* remove scroll list */
gui_window_scroll_free_all (window);
-
+
/* free coords */
if (window->coords)
free (window->coords);
-
+
/* remove window from windows list */
if (window->prev_window)
(window->prev_window)->next_window = window->next_window;
@@ -935,16 +935,16 @@ gui_window_free (struct t_gui_window *window)
if (gui_current_window == window)
gui_current_window = gui_windows;
-
+
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
ptr_win->number = i;
i++;
}
-
+
hook_signal_send ("window_closed", WEECHAT_HOOK_SIGNAL_POINTER, window);
-
+
free (window);
}
@@ -957,7 +957,7 @@ gui_window_switch_previous (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
gui_window_switch ((window->prev_window) ?
window->prev_window : last_gui_window);
}
@@ -971,7 +971,7 @@ gui_window_switch_next (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
gui_window_switch ((window->next_window) ?
window->next_window : gui_windows);
}
@@ -984,10 +984,10 @@ void
gui_window_switch_by_number (int number)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
ptr_win = gui_window_search_by_number (number);
if (ptr_win)
gui_window_switch (ptr_win);
@@ -1001,10 +1001,10 @@ void
gui_window_switch_by_buffer (struct t_gui_window *window, int buffer_number)
{
struct t_gui_window *ptr_win;
-
+
if (!gui_ok)
return;
-
+
ptr_win = (window->next_window) ? window->next_window : gui_windows;
while (ptr_win != window)
{
@@ -1031,13 +1031,13 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
long number;
struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date;
-
+
if (window->buffer->lines->first_line)
{
direction = 1;
number = 0;
time_letter = ' ';
-
+
/* search direction */
if (scroll[0] == '-')
{
@@ -1049,7 +1049,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
direction = +1;
scroll++;
}
-
+
/* search number and letter */
pos = scroll;
while (pos && pos[0] && isdigit ((unsigned char)pos[0]))
@@ -1076,11 +1076,11 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
pos[0] = saved_char;
}
}
-
+
/* at least number or letter has to he given */
if ((number == 0) && (time_letter == ' '))
return;
-
+
/* do the scroll! */
stop = 0;
count_msg = 0;
@@ -1115,12 +1115,12 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
date_tmp = localtime (&old_date);
memcpy (&old_line_date, date_tmp, sizeof (struct tm));
}
-
+
while (ptr_line)
{
ptr_line = (direction < 0) ?
gui_line_get_prev_displayed (ptr_line) : gui_line_get_next_displayed (ptr_line);
-
+
if (ptr_line
&& ((window->buffer->type != GUI_BUFFER_TYPE_FORMATTED)
|| (ptr_line->data->date != 0)))
@@ -1258,13 +1258,13 @@ gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
int direction, percentage, start_col;
char saved_char, *pos, *error;
long number;
-
+
if (window->buffer->lines->first_line)
{
direction = 1;
number = 0;
percentage = 0;
-
+
/* search direction */
if (scroll[0] == '-')
{
@@ -1276,7 +1276,7 @@ gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
direction = +1;
scroll++;
}
-
+
/* search number and percentage */
pos = scroll;
while (pos && pos[0] && isdigit ((unsigned char)pos[0]))
@@ -1294,17 +1294,17 @@ gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
number = 0;
pos[0] = saved_char;
}
-
+
/* for percentage, compute number of columns */
if (percentage)
{
number = (window->win_chat_width * number) / 100;
}
-
+
/* number must be different from 0 */
if (number == 0)
return;
-
+
/* do the horizontal scroll! */
start_col = window->scroll->start_col + (number * direction);
if (start_col < 0)
@@ -1325,7 +1325,7 @@ void
gui_window_scroll_previous_highlight (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
-
+
if ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
{
@@ -1358,7 +1358,7 @@ void
gui_window_scroll_next_highlight (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
-
+
if ((window->buffer->type == GUI_BUFFER_TYPE_FORMATTED)
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
{
@@ -1392,7 +1392,7 @@ int
gui_window_search_text (struct t_gui_window *window)
{
struct t_gui_line *ptr_line;
-
+
if (window->buffer->text_search == GUI_TEXT_SEARCH_BACKWARD)
{
if (window->buffer->lines->first_line
@@ -1526,7 +1526,7 @@ gui_window_zoom (struct t_gui_window *window)
{
if (!gui_ok)
return;
-
+
if (gui_window_layout_before_zoom)
{
/* restore layout as it was before zooming a window */
@@ -1560,10 +1560,10 @@ struct t_hdata *
gui_window_hdata_window_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window");
if (hdata)
{
@@ -1606,10 +1606,10 @@ struct t_hdata *
gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll");
if (hdata)
{
@@ -1635,10 +1635,10 @@ struct t_hdata *
gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
if (hdata)
{
@@ -1663,14 +1663,14 @@ gui_window_add_to_infolist (struct t_infolist *infolist,
struct t_gui_window *window)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !window)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_pointer (ptr_item, "pointer", window))
return 0;
if (!infolist_new_var_integer (ptr_item, "current_window",
@@ -1705,7 +1705,7 @@ gui_window_add_to_infolist (struct t_infolist *infolist,
&& (window->scroll->start_line)) ?
window->scroll->start_line->data->y : 0))
return 0;
-
+
return 1;
}
@@ -1719,14 +1719,14 @@ gui_window_print_log ()
struct t_gui_window *ptr_window;
struct t_gui_window_scroll *ptr_scroll;
struct t_gui_bar_window *ptr_bar_win;
-
+
log_printf ("");
log_printf ("gui_windows . . . . . . . . . : 0x%lx", gui_windows);
log_printf ("last_gui_window . . . . . . . : 0x%lx", last_gui_window);
log_printf ("gui_current window. . . . . . : 0x%lx", gui_current_window);
log_printf ("gui_windows_tree. . . . . . . : 0x%lx", gui_windows_tree);
log_printf ("gui_window_layout_before_zoom : 0x%lx", gui_window_layout_before_zoom);
-
+
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
{
log_printf ("");
@@ -1757,7 +1757,7 @@ gui_window_print_log ()
log_printf (" ptr_tree. . . . . . : 0x%lx", ptr_window->ptr_tree);
log_printf (" prev_window . . . . : 0x%lx", ptr_window->prev_window);
log_printf (" next_window . . . . : 0x%lx", ptr_window->next_window);
-
+
for (ptr_scroll = ptr_window->scroll; ptr_scroll;
ptr_scroll = ptr_scroll->next_scroll)
{
@@ -1774,7 +1774,7 @@ gui_window_print_log ()
log_printf (" prev_scroll . . . . : 0x%lx", ptr_scroll->prev_scroll);
log_printf (" next_scroll . . . . : 0x%lx", ptr_scroll->next_scroll);
}
-
+
for (ptr_bar_win = ptr_window->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
{
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index f91403fdd..b66e7f90f 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -51,49 +51,49 @@ struct t_gui_window_coords
struct t_gui_window
{
int number; /* window number (first is 1) */
-
+
/* global position & size */
int win_x, win_y; /* position of window */
int win_width, win_height; /* window geometry */
int win_width_pct; /* % of width (compared to win size) */
int win_height_pct; /* % of height (compared to win size)*/
-
+
/* chat window settings */
int win_chat_x, win_chat_y; /* chat window position */
int win_chat_width; /* width of chat window */
int win_chat_height; /* height of chat window */
int win_chat_cursor_x; /* position of cursor in chat window */
int win_chat_cursor_y; /* position of cursor in chat window */
-
+
/* bar windows */
struct t_gui_bar_window *bar_windows; /* bar windows */
struct t_gui_bar_window *last_bar_window; /* last bar window */
-
+
/* refresh */
int refresh_needed; /* 1 if refresh needed for window */
-
+
/* GUI specific objects */
void *gui_objects; /* pointer to a GUI specific struct */
-
+
/* buffer and layout infos */
struct t_gui_buffer *buffer; /* buffer currently displayed */
char *layout_plugin_name; /* plugin and buffer that should be */
char *layout_buffer_name; /* displayed in this window (even if */
/* buffer does not exist yet, it will*/
/* be assigned later) */
-
+
/* scroll */
struct t_gui_window_scroll *scroll; /* scroll infos for each buffer */
/* scrolled in this window */
-
+
/* coordinates (for focus) */
int coords_size; /* size of coords (number of lines) */
struct t_gui_window_coords *coords;/* coords for window */
int coords_x_message; /* start X for messages */
-
+
/* tree */
struct t_gui_window_tree *ptr_tree;/* pointer to leaf in windows tree */
-
+
struct t_gui_window *prev_window; /* link to previous window */
struct t_gui_window *next_window; /* link to next window */
};
@@ -118,13 +118,13 @@ struct t_gui_window_scroll
struct t_gui_window_tree
{
struct t_gui_window_tree *parent_node; /* pointer to parent node */
-
+
/* node info */
int split_pct; /* % of split size (child1) */
int split_horizontal; /* 1 if horizontal, 0 if vertical */
struct t_gui_window_tree *child1; /* first child, NULL if a leaf */
struct t_gui_window_tree *child2; /* second child, NULL if a leaf */
-
+
/* leaf info */
struct t_gui_window *window; /* pointer to window, NULL if a node */
};
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c
index 500a14e03..446323c85 100644
--- a/src/plugins/alias/alias-config.c
+++ b/src/plugins/alias/alias-config.c
@@ -77,14 +77,14 @@ void
alias_config_cmd_change_cb (void *data, struct t_config_option *option)
{
struct t_config_option *ptr_option_completion;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_option_completion = weechat_config_search_option (alias_config_file,
alias_config_section_completion,
weechat_config_option_get_pointer (option, "name"));
-
+
alias_new (weechat_config_option_get_pointer (option, "name"),
weechat_config_option_get_pointer (option, "value"),
(ptr_option_completion) ?
@@ -101,18 +101,18 @@ alias_config_cmd_delete_cb (void *data, struct t_config_option *option)
{
struct t_config_option *ptr_option_completion;
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_option_completion = weechat_config_search_option (alias_config_file,
alias_config_section_completion,
weechat_config_option_get_pointer (option, "name"));
-
+
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
if (ptr_alias)
alias_free (ptr_alias);
-
+
if (ptr_option_completion)
weechat_config_option_free (ptr_option_completion);
}
@@ -126,10 +126,10 @@ void
alias_config_completion_change_cb (void *data, struct t_config_option *option)
{
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
if (ptr_alias && ptr_alias->hook)
{
@@ -147,10 +147,10 @@ void
alias_config_completion_delete_cb (void *data, struct t_config_option *option)
{
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
if (ptr_alias && ptr_alias->hook && ptr_alias->completion)
{
@@ -167,11 +167,11 @@ alias_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
weechat_config_section_free_options (alias_config_section_cmd);
weechat_config_section_free_options (alias_config_section_completion);
alias_free_all ();
-
+
return weechat_config_reload (config_file);
}
@@ -186,10 +186,10 @@ alias_config_cmd_write_default_cb (void *data,
const char *section_name)
{
int i;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
@@ -200,7 +200,7 @@ alias_config_cmd_write_default_cb (void *data,
"\"%s\"", alias_default_list[i][1]))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -232,15 +232,15 @@ alias_config_cmd_create_option_cb (void *data,
{
struct t_alias *ptr_alias;
int rc;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
/* create config option */
alias_config_cmd_new_option (option_name, value);
-
+
/* create alias */
ptr_alias = alias_search (option_name);
if (ptr_alias)
@@ -250,7 +250,7 @@ alias_config_cmd_create_option_cb (void *data,
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -258,7 +258,7 @@ alias_config_cmd_create_option_cb (void *data,
weechat_prefix ("error"), ALIAS_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -291,12 +291,12 @@ alias_config_completion_create_option_cb (void *data,
const char *value)
{
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
ptr_alias = alias_search (option_name);
if (!ptr_alias)
{
@@ -307,13 +307,13 @@ alias_config_completion_create_option_cb (void *data,
option_name);
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
-
+
/* create config option */
alias_config_completion_new_option (option_name, value);
-
+
/* create/update completion in alias */
alias_update_completion (ptr_alias, value);
-
+
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
@@ -326,12 +326,12 @@ int
alias_config_init ()
{
struct t_config_section *ptr_section;
-
+
alias_config_file = weechat_config_new (ALIAS_CONFIG_NAME,
&alias_config_reload, NULL);
if (!alias_config_file)
return 0;
-
+
/* cmd */
ptr_section = weechat_config_new_section (alias_config_file, "cmd",
1, 1,
@@ -346,7 +346,7 @@ alias_config_init ()
return 0;
}
alias_config_section_cmd = ptr_section;
-
+
/* completion */
ptr_section = weechat_config_new_section (alias_config_file, "completion",
1, 1,
@@ -361,7 +361,7 @@ alias_config_init ()
return 0;
}
alias_config_section_completion = ptr_section;
-
+
return 1;
}
diff --git a/src/plugins/alias/alias-info.c b/src/plugins/alias/alias-info.c
index 09202db3e..614fe4821 100644
--- a/src/plugins/alias/alias-info.c
+++ b/src/plugins/alias/alias-info.c
@@ -37,19 +37,19 @@ alias_info_get_infolist_cb (void *data, const char *infolist_name,
{
struct t_infolist *ptr_infolist;
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, ALIAS_PLUGIN_NAME) == 0)
{
if (pointer && !alias_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -83,7 +83,7 @@ alias_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 969745d8d..119fdcdbe 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -56,17 +56,17 @@ int
alias_valid (struct t_alias *alias)
{
struct t_alias *ptr_alias;
-
+
if (!alias)
return 0;
-
+
for (ptr_alias = alias_list; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
if (ptr_alias == alias)
return 1;
}
-
+
/* alias not found */
return 0;
}
@@ -79,7 +79,7 @@ struct t_alias *
alias_search (const char *alias_name)
{
struct t_alias *ptr_alias;
-
+
for (ptr_alias = alias_list; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
@@ -98,14 +98,14 @@ alias_string_add_word (char **alias, int *length, const char *word)
{
int length_word;
char *alias2;
-
+
if (!word)
return;
-
+
length_word = strlen (word);
if (length_word == 0)
return;
-
+
if (*alias == NULL)
{
*alias = malloc (length_word + 1);
@@ -139,7 +139,7 @@ alias_string_add_word_range (char **alias, int *length, const char *start,
const char *end)
{
char *word;
-
+
word = weechat_strndup (start, end - start);
if (word)
{
@@ -158,7 +158,7 @@ alias_string_add_arguments (char **alias, int *length, char **argv, int start,
int end)
{
int i;
-
+
for (i = start; i <= end; i++)
{
if (i != start)
@@ -185,9 +185,9 @@ alias_replace_args (const char *alias_args, const char *user_args)
char **argv, *res;
const char *start, *pos;
int n, m, argc, length_res, args_count, offset;
-
+
argv = weechat_string_split (user_args, " ", 0, 0, &argc);
-
+
res = NULL;
length_res = 0;
args_count = 0;
@@ -196,7 +196,7 @@ alias_replace_args (const char *alias_args, const char *user_args)
while (pos && pos[0])
{
offset = 0;
-
+
if ((pos[0] == '\\') && (pos[1] == '$'))
{
offset = 2;
@@ -278,7 +278,7 @@ alias_replace_args (const char *alias_args, const char *user_args)
}
}
}
-
+
if (offset != 0)
{
pos += offset;
@@ -287,13 +287,13 @@ alias_replace_args (const char *alias_args, const char *user_args)
else
pos++;
}
-
+
if (pos > start)
alias_string_add_word (&res, &length_res, start);
-
+
if (argv)
weechat_string_free_split (argv);
-
+
return res;
}
@@ -307,20 +307,20 @@ alias_run_command (struct t_gui_buffer **buffer, const char *command)
{
char *string;
struct t_gui_buffer *old_current_buffer, *new_current_buffer;
-
+
/* save current buffer pointer */
old_current_buffer = weechat_current_buffer();
-
+
/* execute command */
string = weechat_buffer_string_replace_local_var (*buffer, command);
weechat_command (*buffer,
(string) ? string : command);
if (string)
free (string);
-
+
/* get new current buffer */
new_current_buffer = weechat_current_buffer();
-
+
/*
* if current buffer was changed by command, then we'll use this one for
* next commands in alias
@@ -341,12 +341,12 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
char **commands, **ptr_cmd, **ptr_next_cmd;
char *args_replaced, *alias_command;
int some_args_replaced, length1, length2;
-
+
/* make C compiler happy */
(void) argv;
-
+
ptr_alias = (struct t_alias *)data;
-
+
if (ptr_alias->running)
{
weechat_printf (NULL,
@@ -368,12 +368,12 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
ptr_next_cmd = ptr_cmd;
ptr_next_cmd++;
-
+
args_replaced = alias_replace_args (*ptr_cmd,
(argc > 1) ? argv_eol[1] : "");
if (args_replaced && (strcmp (args_replaced, *ptr_cmd) != 0))
some_args_replaced = 1;
-
+
/*
* if alias has arguments, they are now
* arguments of the last command in the list (if no $1,$2,..$*)
@@ -383,7 +383,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
length1 = strlen (*ptr_cmd);
length2 = strlen (argv_eol[1]);
-
+
alias_command = malloc (1 + length1 + 1 + length2 + 1);
if (alias_command)
{
@@ -391,11 +391,11 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
strcpy (alias_command, "/");
else
alias_command[0] = '\0';
-
+
strcat (alias_command, *ptr_cmd);
strcat (alias_command, " ");
strcat (alias_command, argv_eol[1]);
-
+
alias_run_command (&buffer,
alias_command);
free (alias_command);
@@ -421,7 +421,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
}
}
}
-
+
if (args_replaced)
free (args_replaced);
}
@@ -440,7 +440,7 @@ void
alias_free (struct t_alias *alias)
{
struct t_alias *new_alias_list;
-
+
/* remove alias from list */
if (last_alias == alias)
last_alias = alias->prev_alias;
@@ -464,7 +464,7 @@ alias_free (struct t_alias *alias)
if (alias->completion)
free (alias->completion);
free (alias);
-
+
alias_list = new_alias_list;
}
@@ -489,13 +489,13 @@ struct t_alias *
alias_find_pos (const char *name)
{
struct t_alias *ptr_alias;
-
+
for (ptr_alias = alias_list; ptr_alias; ptr_alias = ptr_alias->next_alias)
{
if (weechat_strcasecmp (name, ptr_alias->name) < 0)
return ptr_alias;
}
-
+
/* position not found (we will add to the end of list) */
return NULL;
}
@@ -510,9 +510,9 @@ alias_hook_command (struct t_alias *alias)
{
char *str_completion;
int length;
-
+
str_completion = NULL;
-
+
if (!alias->completion)
{
/*
@@ -529,12 +529,12 @@ alias_hook_command (struct t_alias *alias)
weechat_utf8_next_char (alias->command) : alias->command);
}
}
-
+
alias->hook = weechat_hook_command (alias->name, alias->command,
NULL, NULL,
(str_completion) ? str_completion : alias->completion,
&alias_cb, alias);
-
+
if (str_completion)
free (str_completion);
}
@@ -550,7 +550,7 @@ alias_update_completion (struct t_alias *alias, const char *completion)
if (alias->completion)
free (alias->completion);
alias->completion = (completion) ? strdup (completion) : NULL;
-
+
/* unhook and hook again command, with new completion */
weechat_unhook (alias->hook);
alias->hook = NULL;
@@ -565,19 +565,19 @@ struct t_alias *
alias_new (const char *name, const char *command, const char *completion)
{
struct t_alias *new_alias, *ptr_alias, *pos_alias;
-
+
if (!name || !name[0] || !command || !command[0])
return NULL;
-
+
while (weechat_string_is_command_char (name))
{
name = weechat_utf8_next_char (name);
}
-
+
ptr_alias = alias_search (name);
if (ptr_alias)
alias_free (ptr_alias);
-
+
new_alias = malloc (sizeof (*new_alias));
if (new_alias)
{
@@ -586,9 +586,9 @@ alias_new (const char *name, const char *command, const char *completion)
new_alias->command = strdup (command);
new_alias->completion = (completion) ? strdup (completion) : NULL;
new_alias->running = 0;
-
+
alias_hook_command (new_alias);
-
+
if (alias_list)
{
pos_alias = alias_find_pos (name);
@@ -620,7 +620,7 @@ alias_new (const char *name, const char *command, const char *completion)
last_alias = new_alias;
}
}
-
+
return new_alias;
}
@@ -633,7 +633,7 @@ alias_get_final_command (struct t_alias *alias)
{
struct t_alias *ptr_alias;
char *result;
-
+
if (alias->running)
{
weechat_printf (NULL,
@@ -643,7 +643,7 @@ alias_get_final_command (struct t_alias *alias)
alias->name);
return NULL;
}
-
+
ptr_alias = alias_search ((weechat_string_is_command_char (alias->command)) ?
weechat_utf8_next_char (alias->command) : alias->command);
if (ptr_alias)
@@ -669,11 +669,11 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
struct t_alias *ptr_alias;
struct t_config_option *ptr_option;
int alias_found;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
{
if (argc > 2)
@@ -695,7 +695,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_utf8_next_char (argv[1]) : argv[1];
ptr_command = argv_eol[2];
}
-
+
/* define new alias */
if (!alias_new (ptr_alias_name, ptr_command, ptr_completion))
{
@@ -706,7 +706,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
ptr_alias_name, ptr_command);
return WEECHAT_RC_OK;
}
-
+
/* create config option for command */
ptr_option = weechat_config_search_option (alias_config_file,
alias_config_section_cmd,
@@ -714,7 +714,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (ptr_option)
weechat_config_option_free (ptr_option);
alias_config_cmd_new_option (ptr_alias_name, ptr_command);
-
+
/* create config option for completion */
ptr_option = weechat_config_search_option (alias_config_file,
alias_config_section_completion,
@@ -723,7 +723,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_config_option_free (ptr_option);
if (ptr_completion)
alias_config_completion_new_option (ptr_alias_name, ptr_completion);
-
+
/* display message */
weechat_printf (NULL,
_("Alias \"%s\" => \"%s\" created"),
@@ -734,7 +734,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
/* get pointer to alias name */
ptr_alias_name = (weechat_string_is_command_char (argv[1])) ?
weechat_utf8_next_char (argv[1]) : argv[1];
-
+
/* display list of aliases */
alias_found = 0;
for (ptr_alias = alias_list; ptr_alias;
@@ -783,7 +783,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
else
weechat_printf (NULL, _("No alias defined"));
}
-
+
return WEECHAT_RC_OK;
}
@@ -799,12 +799,12 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char *alias_name;
struct t_alias *ptr_alias;
struct t_config_option *ptr_option;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if (argc > 1)
{
for (i = 1; i < argc; i++)
@@ -823,7 +823,7 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
{
/* remove alias */
alias_free (ptr_alias);
-
+
/* remove options */
ptr_option = weechat_config_search_option (alias_config_file,
alias_config_section_cmd,
@@ -835,7 +835,7 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
alias_name);
if (ptr_option)
weechat_config_option_free (ptr_option);
-
+
weechat_printf (NULL,
_("Alias \"%s\" removed"),
alias_name);
@@ -855,19 +855,19 @@ alias_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_alias = alias_list; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
weechat_hook_completion_list_add (completion, ptr_alias->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -883,12 +883,12 @@ alias_value_completion_cb (void *data, const char *completion_item,
const char *args;
char *pos, *alias_name;
struct t_alias *ptr_alias;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
args = weechat_hook_completion_get_string (completion, "args");
if (args)
{
@@ -897,7 +897,7 @@ alias_value_completion_cb (void *data, const char *completion_item,
alias_name = weechat_strndup (args, pos - args);
else
alias_name = strdup (args);
-
+
if (alias_name)
{
ptr_alias = alias_search (alias_name);
@@ -911,7 +911,7 @@ alias_value_completion_cb (void *data, const char *completion_item,
free (alias_name);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -924,14 +924,14 @@ int
alias_add_to_infolist (struct t_infolist *infolist, struct t_alias *alias)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !alias)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "hook", alias->hook))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "name", alias->name))
@@ -942,7 +942,7 @@ alias_add_to_infolist (struct t_infolist *infolist, struct t_alias *alias)
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "running", alias->running))
return 0;
-
+
return 1;
}
@@ -956,9 +956,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
if (!alias_config_init ())
{
weechat_printf (NULL,
@@ -967,7 +967,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_OK;
}
alias_config_read ();
-
+
weechat_hook_command ("alias",
N_("create an alias for a command"),
N_("[-completion <completion>] <alias> [<command> "
@@ -1006,20 +1006,20 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" /alias -completion %%sajoin forcejoin /quote forcejoin"),
"%(alias)|-completion %(commands)|%(alias_value)",
&alias_command_cb, NULL);
-
+
weechat_hook_command ("unalias", N_("remove aliases"),
N_("<alias> [<alias>...]"),
N_("alias: name of alias to remove"),
"%(alias)|%*",
&unalias_command_cb, NULL);
-
+
weechat_hook_completion ("alias", N_("list of aliases"),
&alias_completion_cb, NULL);
weechat_hook_completion ("alias_value", N_("value of alias"),
&alias_value_completion_cb, NULL);
-
+
alias_info_init ();
-
+
return WEECHAT_RC_OK;
}
@@ -1032,10 +1032,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
alias_config_write ();
alias_free_all ();
weechat_config_free (alias_config_file);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c
index c91b28b6e..a19e6e951 100644
--- a/src/plugins/aspell/weechat-aspell-config.c
+++ b/src/plugins/aspell/weechat-aspell-config.c
@@ -64,10 +64,10 @@ weechat_aspell_config_change_commands (void *data,
{
const char *value;
int i;
-
+
/* make C compiler happy */
(void) data;
-
+
if (weechat_aspell_commands_to_check)
{
weechat_string_free_split (weechat_aspell_commands_to_check);
@@ -80,7 +80,7 @@ weechat_aspell_config_change_commands (void *data,
free (weechat_aspell_length_commands_to_check);
weechat_aspell_length_commands_to_check = NULL;
}
-
+
value = weechat_config_string (option);
if (value && value[0])
{
@@ -111,7 +111,7 @@ weechat_aspell_config_change_default_dict (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_aspell_create_spellers (weechat_current_buffer ());
}
@@ -126,7 +126,7 @@ weechat_aspell_config_dict_change (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_aspell_create_spellers (weechat_current_buffer ());
}
@@ -144,11 +144,11 @@ weechat_aspell_config_dict_delete_option (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
weechat_config_option_free (option);
-
+
weechat_aspell_create_spellers (weechat_current_buffer ());
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -165,15 +165,15 @@ weechat_aspell_config_dict_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (value && value[0])
weechat_aspell_speller_check_dictionaries (value);
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -207,7 +207,7 @@ weechat_aspell_config_dict_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -217,7 +217,7 @@ weechat_aspell_config_dict_create_option (void *data,
}
else
weechat_aspell_create_spellers (weechat_current_buffer ());
-
+
return rc;
}
@@ -232,7 +232,7 @@ weechat_aspell_config_option_change (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
}
@@ -251,12 +251,12 @@ weechat_aspell_config_option_delete_option (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
weechat_config_option_free (option);
-
+
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -273,12 +273,12 @@ weechat_aspell_config_option_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -313,7 +313,7 @@ weechat_aspell_config_option_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -326,7 +326,7 @@ weechat_aspell_config_option_create_option (void *data,
weechat_aspell_speller_free_all ();
weechat_aspell_create_spellers (weechat_current_buffer ());
}
-
+
return rc;
}
@@ -365,12 +365,12 @@ int
weechat_aspell_config_init ()
{
struct t_config_section *ptr_section;
-
+
weechat_aspell_config_file = weechat_config_new (ASPELL_CONFIG_NAME,
NULL, NULL);
if (!weechat_aspell_config_file)
return 0;
-
+
/* look */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "look",
0, 0,
@@ -382,13 +382,13 @@ weechat_aspell_config_init ()
weechat_config_free (weechat_aspell_config_file);
return 0;
}
-
+
weechat_aspell_config_look_color = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"color", "color",
N_("color used for misspelled words"),
NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* check */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
0, 0,
@@ -400,7 +400,7 @@ weechat_aspell_config_init ()
weechat_config_free (weechat_aspell_config_file);
return 0;
}
-
+
weechat_aspell_config_check_commands = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"commands", "string",
@@ -435,7 +435,7 @@ weechat_aspell_config_init ()
N_("minimum length for a word to be spell checked (use 0 to check all "
"words)"),
NULL, 0, INT_MAX, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* dict */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
1, 1,
@@ -449,9 +449,9 @@ weechat_aspell_config_init ()
weechat_config_free (weechat_aspell_config_file);
return 0;
}
-
+
weechat_aspell_config_section_dict = ptr_section;
-
+
/* option */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "option",
1, 1,
@@ -465,7 +465,7 @@ weechat_aspell_config_init ()
weechat_config_free (weechat_aspell_config_file);
return 0;
}
-
+
return 1;
}
@@ -477,14 +477,14 @@ int
weechat_aspell_config_read ()
{
int rc;
-
+
rc = weechat_config_read (weechat_aspell_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
{
weechat_aspell_config_change_commands (NULL,
weechat_aspell_config_check_commands);
}
-
+
return rc;
}
@@ -506,7 +506,7 @@ void
weechat_aspell_config_free ()
{
weechat_config_free (weechat_aspell_config_file);
-
+
if (weechat_aspell_commands_to_check)
weechat_string_free_split (weechat_aspell_commands_to_check);
if (weechat_aspell_length_commands_to_check)
diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c
index 51822c4fa..8cad6f313 100644
--- a/src/plugins/aspell/weechat-aspell-speller.c
+++ b/src/plugins/aspell/weechat-aspell-speller.c
@@ -47,13 +47,13 @@ weechat_aspell_speller_exists (const char *lang)
AspellDictInfoEnumeration *el;
const AspellDictInfo *dict;
int rc;
-
+
rc = 0;
-
+
config = new_aspell_config ();
list = get_aspell_dict_info_list (config);
el = aspell_dict_info_list_elements (list);
-
+
while ((dict = aspell_dict_info_enumeration_next (el)))
{
if (strcmp (dict->name, lang) == 0)
@@ -62,10 +62,10 @@ weechat_aspell_speller_exists (const char *lang)
break;
}
}
-
+
delete_aspell_dict_info_enumeration (el);
delete_aspell_config (config);
-
+
return rc;
}
@@ -80,7 +80,7 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list)
{
char **argv;
int argc, i;
-
+
if (dict_list)
{
argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
@@ -109,14 +109,14 @@ struct t_aspell_speller *
weechat_aspell_speller_search (const char *lang)
{
struct t_aspell_speller *ptr_speller;
-
+
for (ptr_speller = weechat_aspell_spellers; ptr_speller;
ptr_speller = ptr_speller->next_speller)
{
if (strcmp (ptr_speller->lang, lang) == 0)
return ptr_speller;
}
-
+
/* no speller found */
return NULL;
}
@@ -132,17 +132,17 @@ weechat_aspell_speller_new (const char *lang)
AspellConfig *config;
AspellCanHaveError *ret;
struct t_infolist *infolist;
-
+
if (!lang)
return NULL;
-
+
if (weechat_aspell_plugin->debug)
{
weechat_printf (NULL,
"%s: creating new speller for lang \"%s\"",
ASPELL_PLUGIN_NAME, lang);
}
-
+
/* create a speller instance for the newly created cell */
config = new_aspell_config();
aspell_config_replace (config, "lang", lang);
@@ -159,9 +159,9 @@ weechat_aspell_speller_new (const char *lang)
}
weechat_infolist_free (infolist);
}
-
+
ret = new_aspell_speller (config);
-
+
if (aspell_error (ret) != 0)
{
weechat_printf (NULL,
@@ -172,7 +172,7 @@ weechat_aspell_speller_new (const char *lang)
delete_aspell_can_have_error (ret);
return NULL;
}
-
+
/* create and add a new speller cell */
new_speller = malloc (sizeof (*new_speller));
if (!new_speller)
@@ -182,7 +182,7 @@ weechat_aspell_speller_new (const char *lang)
weechat_prefix ("error"), ASPELL_PLUGIN_NAME);
return NULL;
}
-
+
new_speller->speller = to_aspell_speller (ret);
new_speller->lang = strdup (lang);
@@ -194,10 +194,10 @@ weechat_aspell_speller_new (const char *lang)
else
weechat_aspell_spellers = new_speller;
last_weechat_aspell_speller = new_speller;
-
+
/* free config */
delete_aspell_config (config);
-
+
return new_speller;
}
@@ -210,14 +210,14 @@ weechat_aspell_speller_free (struct t_aspell_speller *speller)
{
if (!speller)
return;
-
+
if (weechat_aspell_plugin->debug)
{
weechat_printf (NULL,
"%s: removing speller for lang \"%s\"",
ASPELL_PLUGIN_NAME, speller->lang);
}
-
+
/* free data */
if (speller->speller)
{
@@ -236,7 +236,7 @@ weechat_aspell_speller_free (struct t_aspell_speller *speller)
weechat_aspell_spellers = speller->next_speller;
if (last_weechat_aspell_speller == speller)
last_weechat_aspell_speller = speller->prev_speller;
-
+
free (speller);
}
diff --git a/src/plugins/aspell/weechat-aspell-speller.h b/src/plugins/aspell/weechat-aspell-speller.h
index 06156ec8b..5dcf99a1d 100644
--- a/src/plugins/aspell/weechat-aspell-speller.h
+++ b/src/plugins/aspell/weechat-aspell-speller.h
@@ -25,7 +25,7 @@ struct t_aspell_speller
{
AspellSpeller *speller; /* aspell speller */
char *lang; /* language */
-
+
struct t_aspell_speller *prev_speller; /* pointer to next speller */
struct t_aspell_speller *next_speller; /* pointer to previous speller */
};
diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c
index cd37a86b5..d0c81d1e9 100644
--- a/src/plugins/aspell/weechat-aspell.c
+++ b/src/plugins/aspell/weechat-aspell.c
@@ -166,20 +166,20 @@ weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
const char *plugin_name, *name;
char *option_name;
int length;
-
+
if (!buffer)
return NULL;
-
+
plugin_name = weechat_buffer_get_string (buffer, "plugin");
name = weechat_buffer_get_string (buffer, "name");
-
+
length = strlen (plugin_name) + 1 + strlen (name) + 1;
option_name = malloc (length);
if (!option_name)
return NULL;
-
+
snprintf (option_name, length, "%s.%s", plugin_name, name);
-
+
return option_name;
}
@@ -194,11 +194,11 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
-
+
name = weechat_aspell_build_option_name (buffer);
if (!name)
return NULL;
-
+
option_name = strdup (name);
if (option_name)
{
@@ -221,21 +221,21 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer)
ptr_end[0] = '\0';
}
ptr_option = weechat_aspell_config_get_dict (option_name);
-
+
free (option_name);
free (name);
-
+
if (ptr_option)
return weechat_config_string (ptr_option);
}
else
free (name);
-
+
/* nothing found => return default dictionary (if set) */
if (weechat_config_string (weechat_aspell_config_check_default_dict)
&& weechat_config_string (weechat_aspell_config_check_default_dict)[0])
return weechat_config_string (weechat_aspell_config_check_default_dict);
-
+
/* no default dictionary set */
return NULL;
}
@@ -248,11 +248,11 @@ void
weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value)
{
char *name;
-
+
name = weechat_aspell_build_option_name (buffer);
if (!name)
return;
-
+
if (weechat_aspell_config_set_dict (name, value) > 0)
{
if (value && value[0])
@@ -262,7 +262,7 @@ weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value)
weechat_printf (NULL, _("%s: \"%s\" removed"),
ASPELL_PLUGIN_NAME, name);
}
-
+
free (name);
}
@@ -278,15 +278,15 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
char **argv;
int argc, rc, i;
struct t_aspell_speller *ptr_speller;
-
+
if (!dict_list && !weechat_aspell_spellers)
return 1;
-
+
if (!dict_list || !weechat_aspell_spellers)
return 0;
-
+
rc = 0;
-
+
argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
if (argv)
{
@@ -302,7 +302,7 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
}
weechat_string_free_split (argv);
}
-
+
return rc;
}
@@ -316,7 +316,7 @@ weechat_aspell_create_spellers (struct t_gui_buffer *buffer)
const char *dict_list;
char **argv;
int argc, i;
-
+
if (buffer)
{
dict_list = weechat_aspell_get_dict (buffer);
@@ -349,13 +349,13 @@ char *
weechat_aspell_iso_to_lang (const char *code)
{
int i;
-
+
for (i = 0; langs_avail[i].code; i++)
{
if (strcmp (langs_avail[i].code, code) == 0)
return strdup (langs_avail[i].name);
}
-
+
/* lang code not found */
return strdup ("Unknown");
}
@@ -370,13 +370,13 @@ char *
weechat_aspell_iso_to_country (const char *code)
{
int i;
-
+
for (i = 0; countries_avail[i].code; i++)
{
if (strcmp (countries_avail[i].code, code) == 0)
return strdup (countries_avail[i].name);
}
-
+
/* country code not found */
return strdup ("Unknown");
}
@@ -395,22 +395,22 @@ weechat_aspell_speller_list_dicts ()
AspellDictInfoList *list;
AspellDictInfoEnumeration *el;
const AspellDictInfo *dict;
-
+
config = new_aspell_config();
list = get_aspell_dict_info_list (config);
el = aspell_dict_info_list_elements (list);
-
+
weechat_printf (NULL, "");
weechat_printf (NULL,
/* TRANSLATORS: "%s" is "aspell" */
_( "%s dictionaries list:"),
ASPELL_PLUGIN_NAME);
-
+
while ((dict = aspell_dict_info_enumeration_next (el)))
{
country = NULL;
pos = strchr (dict->code, '_');
-
+
if (pos)
{
pos[0] = '\0';
@@ -420,7 +420,7 @@ weechat_aspell_speller_list_dicts ()
}
else
lang = weechat_aspell_iso_to_lang ((char*)dict->code);
-
+
if (strlen (dict->jargon) == 0)
{
if (pos)
@@ -447,15 +447,15 @@ weechat_aspell_speller_list_dicts ()
dict->name, lang, dict->jargon);
}
}
-
+
weechat_printf (NULL, " %s", buffer);
-
+
if (lang)
free (lang);
if (country)
free (country);
}
-
+
delete_aspell_dict_info_enumeration (el);
delete_aspell_config (config);
}
@@ -502,7 +502,7 @@ weechat_aspell_add_word (const char *lang, const char *word)
"dictionary"),
weechat_prefix ("error"), ASPELL_PLUGIN_NAME);
}
-
+
if (new_speller)
weechat_aspell_speller_free (new_speller);
}
@@ -516,12 +516,12 @@ int
weechat_aspell_command_authorized (const char *command)
{
int length_command, i;
-
+
if (!command)
return 1;
-
+
length_command = strlen (command);
-
+
for (i = 0; i < weechat_aspell_count_commands_to_check; i++)
{
if ((weechat_aspell_length_commands_to_check[i] == length_command)
@@ -532,7 +532,7 @@ weechat_aspell_command_authorized (const char *command)
return 1;
}
}
-
+
/* command is not authorized */
return 0;
}
@@ -565,7 +565,7 @@ weechat_aspell_string_is_url (const char *word)
|| (weechat_strncasecmp(word, "svn+ssh://", 10) == 0)
|| (weechat_strncasecmp(word, "git://", 6) == 0))
return 1;
-
+
return 0;
}
@@ -578,10 +578,10 @@ int
weechat_aspell_string_is_simili_number (const char *word)
{
int utf8_char_int;
-
+
if (!word || !word[0])
return 0;
-
+
while (word && word[0])
{
utf8_char_int = weechat_utf8_char_int (word);
@@ -589,7 +589,7 @@ weechat_aspell_string_is_simili_number (const char *word)
return 0;
word = weechat_utf8_next_char (word);
}
-
+
/* there's only digit or punctuation */
return 1;
}
@@ -604,9 +604,9 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word)
{
struct t_aspell_speller *ptr_speller;
int rc;
-
+
rc = 0;
-
+
/* word too small? then do not check word */
if ((weechat_config_integer (weechat_aspell_config_check_word_min_length) > 0)
&& ((int)strlen (word) < weechat_config_integer (weechat_aspell_config_check_word_min_length)))
@@ -642,7 +642,7 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word)
}
}
}
-
+
return rc;
}
@@ -661,18 +661,18 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
int buffer_has_changed, utf8_char_int, char_size;
int length, index_result, length_word, word_ok;
int length_color_normal, length_color_error, rc;
-
+
/* make C compiler happy */
(void) data;
(void) modifier;
-
+
if (!string || !string[0])
return NULL;
-
+
rc = sscanf (modifier_data, "%lx", &value);
if ((rc == EOF) || (rc == 0))
return NULL;
-
+
buffer = (struct t_gui_buffer *)value;
buffer_has_changed = 0;
@@ -682,15 +682,15 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
aspell_buffer_spellers = buffer;
buffer_has_changed = 1;
}
-
+
if (!weechat_aspell_spellers)
return NULL;
-
+
/* check text search only if option is enabled */
if (weechat_buffer_get_integer (buffer, "text_search")
&& !weechat_config_boolean (weechat_aspell_config_check_during_search))
return NULL;
-
+
/*
* for performance: return last stirng built if input string is the
* same (for example user just change cursor position, or input text is
@@ -703,7 +703,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
return (aspell_last_modifier_result) ?
strdup (aspell_last_modifier_result) : NULL;
}
-
+
/* free last modifier string and result */
if (aspell_last_modifier_string)
{
@@ -715,25 +715,25 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
free (aspell_last_modifier_result);
aspell_last_modifier_result = NULL;
}
-
+
/* save last modifier string received */
aspell_last_modifier_string = strdup (string);
-
+
color_normal = weechat_color ("bar_fg");
length_color_normal = strlen (color_normal);
color_error = weechat_color (weechat_config_string (weechat_aspell_config_look_color));
length_color_error = strlen (color_error);
-
+
length = strlen (string);
result = malloc (length + (length * length_color_error) + 1);
-
+
if (result)
{
result[0] = '\0';
-
+
ptr_string = aspell_last_modifier_string;
index_result = 0;
-
+
/* check if string is a command */
if (!weechat_string_input_for_buffer (ptr_string))
{
@@ -749,9 +749,9 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
free (result);
return NULL;
}
-
+
pos_space[0] = '\0';
-
+
/* exit if command is not authorized for spell checking */
if (!weechat_aspell_command_authorized (ptr_string))
{
@@ -762,11 +762,11 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
index_result += char_size;
strcpy (result + index_result, ptr_string);
index_result += strlen (ptr_string);
-
+
pos_space[0] = ' ';
ptr_string = pos_space;
}
-
+
while (ptr_string[0])
{
/* find start of word */
@@ -785,7 +785,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
}
if (!ptr_string[0])
break;
-
+
ptr_end = weechat_utf8_next_char (ptr_string);
utf8_char_int = weechat_utf8_char_int (ptr_end);
while (iswalnum (utf8_char_int) || (utf8_char_int == '\'')
@@ -799,44 +799,44 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
save_end = ptr_end[0];
ptr_end[0] = '\0';
length_word = ptr_end - ptr_string;
-
+
if ((save_end != '\0')
|| (weechat_config_integer (weechat_aspell_config_check_real_time)))
word_ok = weechat_aspell_check_word (buffer, ptr_string);
else
word_ok = 1;
-
+
/* add error color */
if (!word_ok)
{
strcpy (result + index_result, color_error);
index_result += length_color_error;
}
-
+
/* add word */
strcpy (result + index_result, ptr_string);
index_result += length_word;
-
+
/* add normal color (after misspelled word) */
if (!word_ok)
{
strcpy (result + index_result, color_normal);
index_result += length_color_normal;
}
-
+
if (save_end == '\0')
break;
ptr_end[0] = save_end;
ptr_string = ptr_end;
}
-
+
result[index_result] = '\0';
}
-
+
if (!result)
return NULL;
-
+
aspell_last_modifier_result = strdup (result);
return result;
}
@@ -850,10 +850,10 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *dicts;
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (weechat_strcasecmp (argv[1], "dictlist") == 0)
@@ -907,7 +907,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -921,18 +921,18 @@ weechat_aspell_completion_langs_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
int i;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (i = 0; langs_avail[i].code; i++)
{
weechat_hook_completion_list_add (completion, langs_avail[i].code,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -946,15 +946,15 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
if (!weechat_aspell_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (weechat_aspell_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
/* command /aspell */
weechat_hook_command ("aspell",
N_("aspell plugin configuration"),
@@ -978,7 +978,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_completion ("aspell_langs",
N_("list of supported langs for aspell"),
&weechat_aspell_completion_langs_cb, NULL);
-
+
/*
* callback for spell checking input text
* we use a low priority here, so that other modifiers "input_text_display"
@@ -986,7 +986,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
*/
weechat_hook_modifier ("500|input_text_display",
&weechat_aspell_modifier_cb, NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -999,17 +999,17 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
weechat_aspell_config_write ();
-
+
weechat_aspell_speller_free_all ();
-
+
if (aspell_last_modifier_string)
free (aspell_last_modifier_string);
if (aspell_last_modifier_result)
free (aspell_last_modifier_result);
-
+
weechat_aspell_config_free ();
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index 061dfd3a0..99f4814ca 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -65,11 +65,11 @@ charset_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
/* free all decode/encode charsets */
weechat_config_section_free_options (charset_config_section_decode);
weechat_config_section_free_options (charset_config_section_encode);
-
+
return weechat_config_reload (config_file);
}
@@ -84,12 +84,12 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -120,7 +120,7 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -128,7 +128,7 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
weechat_prefix ("error"), CHARSET_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -141,12 +141,12 @@ int
charset_config_init ()
{
struct t_config_section *ptr_section;
-
+
charset_config_file = weechat_config_new (CHARSET_CONFIG_NAME,
&charset_config_reload, NULL);
if (!charset_config_file)
return 0;
-
+
ptr_section = weechat_config_new_section (charset_config_file, "default",
0, 0,
NULL, NULL, NULL, NULL,
@@ -157,7 +157,7 @@ charset_config_init ()
weechat_config_free (charset_config_file);
return 0;
}
-
+
charset_default_decode = weechat_config_new_option (
charset_config_file, ptr_section,
"decode", "string",
@@ -174,7 +174,7 @@ charset_config_init ()
N_("global encoding charset"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (charset_config_file, "decode",
1, 1,
NULL, NULL, NULL, NULL,
@@ -186,9 +186,9 @@ charset_config_init ()
weechat_config_free (charset_config_file);
return 0;
}
-
+
charset_config_section_decode = ptr_section;
-
+
ptr_section = weechat_config_new_section (charset_config_file, "encode",
1, 1,
NULL, NULL, NULL, NULL,
@@ -200,9 +200,9 @@ charset_config_init ()
weechat_config_free (charset_config_file);
return 0;
}
-
+
charset_config_section_encode = ptr_section;
-
+
return 1;
}
@@ -235,14 +235,14 @@ int
charset_check (const char *charset)
{
iconv_t cd;
-
+
if (!charset || !charset[0])
return 0;
-
+
cd = iconv_open (charset, charset_internal);
if (cd == (iconv_t)(-1))
return 0;
-
+
iconv_close (cd);
return 1;
}
@@ -259,7 +259,7 @@ charset_get (struct t_config_section *section, const char *name,
{
char *option_name, *ptr_end;
struct t_config_option *ptr_option;
-
+
option_name = strdup (name);
if (option_name)
{
@@ -285,18 +285,18 @@ charset_get (struct t_config_section *section, const char *name,
ptr_option = weechat_config_search_option (charset_config_file,
section,
option_name);
-
+
free (option_name);
-
+
if (ptr_option)
return weechat_config_string (ptr_option);
}
-
+
/* nothing found => return default decode/encode charset (if set) */
if (weechat_config_string (default_charset)
&& weechat_config_string (default_charset)[0])
return weechat_config_string (default_charset);
-
+
/* no default charset set */
return NULL;
}
@@ -310,11 +310,11 @@ charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
const char *charset;
-
+
/* make C compiler happy */
(void) data;
(void) modifier;
-
+
charset = charset_get (charset_config_section_decode, modifier_data,
charset_default_decode);
if (weechat_charset_plugin->debug)
@@ -326,7 +326,7 @@ charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
}
if (charset && charset[0])
return weechat_iconv_to_internal (charset, string);
-
+
return NULL;
}
@@ -339,11 +339,11 @@ charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
const char *charset;
-
+
/* make C compiler happy */
(void) data;
(void) modifier;
-
+
charset = charset_get (charset_config_section_encode, modifier_data,
charset_default_encode);
if (weechat_charset_plugin->debug)
@@ -355,7 +355,7 @@ charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
}
if (charset && charset[0])
return weechat_iconv_from_internal (charset, string);
-
+
return NULL;
}
@@ -406,7 +406,7 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
int length;
char *ptr_charset, *option_name;
const char *plugin_name, *name, *charset_modifier;
-
+
/* make C compiler happy */
(void) data;
@@ -415,9 +415,9 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
charset_display_charsets ();
return WEECHAT_RC_OK;
}
-
+
ptr_section = NULL;
-
+
plugin_name = weechat_buffer_get_string (buffer, "plugin");
name = weechat_buffer_get_string (buffer, "name");
@@ -431,10 +431,10 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
option_name = malloc (length);
if (!option_name)
return WEECHAT_RC_ERROR;
-
+
snprintf (option_name, length, "%s.%s", plugin_name, name);
}
-
+
if ((argc > 1) && (weechat_strcasecmp (argv[1], "reset") == 0))
{
charset_set (charset_config_section_decode, "decode", option_name,
@@ -469,7 +469,7 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
}
else
ptr_charset = argv_eol[1];
-
+
if (!charset_check (ptr_charset))
{
weechat_printf (NULL,
@@ -492,9 +492,9 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
ptr_charset);
}
}
-
+
free (option_name);
-
+
return WEECHAT_RC_OK;
}
@@ -508,17 +508,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
/* get terminal & internal charsets */
charset_terminal = weechat_info_get ("charset_terminal", "");
charset_internal = weechat_info_get ("charset_internal", "");
-
+
/* display message */
if (weechat_charset_plugin->debug >= 1)
charset_display_charsets ();
-
+
if (!charset_config_init ())
{
weechat_printf (NULL,
@@ -527,7 +527,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_OK;
}
charset_config_read ();
-
+
/* /charset command */
weechat_hook_command ("charset",
N_("change charset for current buffer"),
@@ -539,11 +539,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" reset: reset charsets for current buffer"),
"decode|encode|reset",
&charset_command_cb, NULL);
-
+
/* modifiers hooks */
weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL);
weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -556,10 +556,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
charset_config_write ();
-
+
weechat_config_free (charset_config_file);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 86ba71082..ff711b694 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -56,7 +56,7 @@ demo_printf_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
weechat_printf (buffer,
"demo_printf: \"%s\"", argv_eol[1]);
@@ -75,7 +75,7 @@ demo_printf_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_color ("chat_server"),
weechat_color ("chat_host"));
}
-
+
return WEECHAT_RC_OK;
}
@@ -89,14 +89,14 @@ demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) data;
-
+
weechat_printf (buffer,
"buffer_input_data_cb: buffer = %lx (%s), "
"input_data = \"%s\"",
(long unsigned int)buffer,
weechat_buffer_get_string (buffer, "name"),
input_data);
-
+
return WEECHAT_RC_OK;
}
@@ -117,7 +117,7 @@ demo_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
(long unsigned int)buffer,
weechat_buffer_get_string (buffer, "name"));
}
-
+
return WEECHAT_RC_OK;
}
@@ -135,7 +135,7 @@ demo_buffer_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if (argc > 1)
{
new_buffer = weechat_buffer_new (argv[1],
@@ -148,7 +148,7 @@ demo_buffer_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -164,10 +164,10 @@ demo_infolist_print (struct t_infolist *infolist, const char *item_name)
void *pointer;
int i, j, argc, size;
time_t time;
-
+
if (!infolist)
return;
-
+
i = 1;
while (weechat_infolist_next (infolist))
{
@@ -234,11 +234,11 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_infolist *infolist;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
weechat_printf (NULL, "info \"%s\" = \"%s\"",
argv[1],
@@ -261,7 +261,7 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_infolist_free (infolist);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -274,11 +274,11 @@ demo_infolist_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_infolist *infolist;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
{
infolist = weechat_infolist_get (argv[1], NULL,
@@ -306,7 +306,7 @@ demo_infolist_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
weechat_infolist_free (infolist);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -352,7 +352,7 @@ demo_signal_cb (void *data, const char *signal, const char *type_data,
signal, type_data, (long unsigned int)signal_data);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -366,23 +366,23 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
weechat_hook_command ("demo_printf",
N_("print some messages on current buffer"),
N_("<text>"),
N_("text: write this text"),
"",
&demo_printf_command_cb, NULL);
-
+
weechat_hook_command ("demo_buffer",
N_("open a new buffer"),
N_("<name>"),
"",
"",
&demo_buffer_command_cb, NULL);
-
+
weechat_hook_command ("demo_info",
N_("get and display an info"),
N_("<info> [<arguments>]"),
@@ -392,7 +392,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"of available infos"),
"%(infos)",
&demo_info_command_cb, NULL);
-
+
weechat_hook_command ("demo_infolist",
N_("get and display an infolist"),
N_("<infolist> [<arguments>]"),
@@ -402,9 +402,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"of available infolists"),
"%(infolists)",
&demo_infolist_command_cb, NULL);
-
+
weechat_hook_signal ("*", &demo_signal_cb, NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -417,6 +417,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/fifo/fifo-info.c b/src/plugins/fifo/fifo-info.c
index 737ac7e01..d4a2b2993 100644
--- a/src/plugins/fifo/fifo-info.c
+++ b/src/plugins/fifo/fifo-info.c
@@ -38,12 +38,12 @@ fifo_info_get_info_cb (void *data, const char *info_name,
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (weechat_strcasecmp (info_name, "fifo_filename") == 0)
{
return fifo_filename;
}
-
+
return NULL;
}
diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c
index bedbae630..b71c54f3c 100644
--- a/src/plugins/fifo/fifo.c
+++ b/src/plugins/fifo/fifo.c
@@ -74,17 +74,17 @@ fifo_remove_old_pipes ()
DIR *dp;
struct dirent *entry;
struct stat statbuf;
-
+
buf_len = PATH_MAX;
buf = malloc (buf_len);
if (!buf)
return;
-
+
weechat_home = weechat_info_get ("weechat_dir", "");
dir_separator = weechat_info_get ("dir_separator", "");
-
+
prefix_len = strlen (FIFO_FILENAME_PREFIX);
-
+
dp = opendir (weechat_home);
if (dp != NULL)
{
@@ -108,7 +108,7 @@ fifo_remove_old_pipes ()
}
closedir (dp);
}
-
+
free (buf);
}
@@ -121,20 +121,20 @@ fifo_create ()
{
int filename_length;
const char *fifo_option, *weechat_home;
-
+
fifo_option = weechat_config_get_plugin ("fifo");
if (!fifo_option)
{
weechat_config_set_plugin ("fifo", "on");
fifo_option = weechat_config_get_plugin ("fifo");
}
-
+
weechat_home = weechat_info_get ("weechat_dir", "");
-
+
if (fifo_option && weechat_home)
{
fifo_remove_old_pipes ();
-
+
if (weechat_strcasecmp (fifo_option, "on") == 0)
{
/*
@@ -149,9 +149,9 @@ fifo_create ()
"%s/%s%d",
weechat_home, FIFO_FILENAME_PREFIX, (int) getpid());
}
-
+
fifo_fd = -1;
-
+
/* create FIFO pipe, writable for user only */
if (mkfifo (fifo_filename, 0600) == 0)
{
@@ -205,11 +205,11 @@ fifo_remove ()
close (fifo_fd);
fifo_fd = -1;
}
-
+
/* remove FIFO from disk */
if (fifo_filename)
unlink (fifo_filename);
-
+
/* remove any unterminated message */
if (fifo_unterminated)
{
@@ -223,7 +223,7 @@ fifo_remove ()
free (fifo_filename);
fifo_filename = NULL;
}
-
+
weechat_printf (NULL,
_("%s: pipe closed"),
FIFO_PLUGIN_NAME);
@@ -238,14 +238,14 @@ fifo_exec (const char *text)
{
char *text2, *pos_msg, *pos_buffer;
struct t_gui_buffer *ptr_buffer;
-
+
text2 = strdup (text);
if (!text2)
return;
-
+
pos_msg = NULL;
ptr_buffer = NULL;
-
+
/*
* look for plugin + buffer name at beginning of text
* text may be: "plugin.buffer *text" or "*text"
@@ -268,7 +268,7 @@ fifo_exec (const char *text)
}
pos_msg[0] = '\0';
pos_msg += 2;
-
+
pos_buffer = strchr (text2, '.');
if (!pos_buffer)
{
@@ -280,11 +280,11 @@ fifo_exec (const char *text)
}
pos_buffer[0] = '\0';
pos_buffer++;
-
+
if (text2[0] && pos_buffer[0])
ptr_buffer = weechat_buffer_search (text2, pos_buffer);
}
-
+
if (!ptr_buffer)
{
weechat_printf (NULL,
@@ -293,9 +293,9 @@ fifo_exec (const char *text)
free (text2);
return;
}
-
+
weechat_command (ptr_buffer, pos_msg);
-
+
free (text2);
}
@@ -309,12 +309,12 @@ fifo_read ()
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
int num_read;
-
+
num_read = read (fifo_fd, buffer, sizeof (buffer) - 2);
if (num_read > 0)
{
buffer[num_read] = '\0';
-
+
buf2 = NULL;
ptr_buf = buffer;
if (fifo_unterminated)
@@ -330,7 +330,7 @@ fifo_read ()
free (fifo_unterminated);
fifo_unterminated = NULL;
}
-
+
while (ptr_buf && ptr_buf[0])
{
next_ptr_buf = NULL;
@@ -355,13 +355,13 @@ fifo_read ()
next_ptr_buf = NULL;
}
}
-
+
if (ptr_buf)
fifo_exec (ptr_buf);
-
+
ptr_buf = next_ptr_buf;
}
-
+
if (buf2)
free (buf2);
}
@@ -406,7 +406,7 @@ fifo_config_cb (void *data, const char *option, const char *value)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (weechat_strcasecmp (value, "on") == 0)
{
if (fifo_fd < 0)
@@ -417,7 +417,7 @@ fifo_config_cb (void *data, const char *option, const char *value)
if (fifo_fd >= 0)
fifo_remove ();
}
-
+
return WEECHAT_RC_OK;
}
@@ -431,19 +431,19 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
fifo_quiet = 1;
-
+
fifo_create ();
-
+
weechat_hook_config ("plugins.var.fifo.fifo", &fifo_config_cb, NULL);
-
+
fifo_info_init ();
-
+
fifo_quiet = 0;
-
+
return WEECHAT_RC_OK;
}
@@ -456,8 +456,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
fifo_remove ();
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 42fc5abd3..fd166842b 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -47,22 +47,22 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
struct t_irc_server *server;
char *buf, *message;
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
buf = NULL;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
-
+
if (server && server->is_away)
{
if (weechat_config_boolean (irc_config_look_item_away_message)
@@ -88,7 +88,7 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
}
}
}
-
+
return buf;
}
@@ -103,29 +103,29 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
const char *title;
char *title_color;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
title = weechat_buffer_get_string (buffer, "title");
if (!title)
return NULL;
-
+
title_color = irc_color_decode (title,
(weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
0 : 1);
-
+
return (title_color) ? title_color : strdup (title);
}
-
+
return NULL;
}
@@ -143,16 +143,16 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
const char *name;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin");
@@ -180,7 +180,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
}
return strdup (buf);
}
-
+
return NULL;
}
@@ -198,21 +198,21 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buf_name[0] = '\0';
modes[0] = '\0';
-
+
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
@@ -282,14 +282,14 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
-
+
snprintf (buf, sizeof (buf), "%s%s%s",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
-
+
return NULL;
}
@@ -307,21 +307,21 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buf_name[0] = '\0';
modes[0] = '\0';
-
+
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
@@ -363,14 +363,14 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
-
+
snprintf (buf, sizeof (buf), "%s%s%s",
IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
-
+
return NULL;
}
@@ -385,20 +385,20 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
char buf[128];
struct t_gui_buffer *buffer;
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
-
+
if (server
&& (server->lag >= weechat_config_integer (irc_config_network_lag_min_show)))
{
@@ -430,22 +430,22 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_irc_nick *ptr_nick;
char *buf, str_prefix[64];
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (!server || !server->nick)
return NULL;
-
+
/* build prefix */
str_prefix[0] = '\0';
if (weechat_config_boolean (irc_config_look_item_nick_prefix)
@@ -463,11 +463,11 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
}
}
}
-
+
/* build bar item */
length = 64 + strlen (server->nick) + 64 +
((server->nick_modes) ? strlen (server->nick_modes) : 0) + 64 + 1;
-
+
buf = malloc (length);
if (buf)
{
@@ -491,10 +491,10 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
server->nick);
}
}
-
+
return buf;
}
-
+
return NULL;
}
@@ -511,22 +511,22 @@ irc_bar_item_focus_buffer_nicklist (void *data,
struct t_gui_buffer *buffer;
struct t_irc_nick *ptr_nick;
const char *str_buffer, *nick;
-
+
str_buffer = weechat_hashtable_get (info, "_buffer");
if (!str_buffer || !str_buffer[0])
return NULL;
-
+
rc = sscanf (str_buffer, "%lx", &value);
if ((rc == EOF) || (rc == 0))
return NULL;
-
+
buffer = (struct t_gui_buffer *)value;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (ptr_server && ptr_channel)
{
nick = weechat_hashtable_get (info, "nick");
@@ -540,7 +540,7 @@ irc_bar_item_focus_buffer_nicklist (void *data,
}
}
}
-
+
return NULL;
}
@@ -558,14 +558,14 @@ irc_bar_item_buffer_switch (void *data, const char *signal,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
weechat_bar_item_update ("away");
weechat_bar_item_update ("buffer_title");
weechat_bar_item_update ("buffer_name");
weechat_bar_item_update ("irc_channel");
weechat_bar_item_update ("lag");
weechat_bar_item_update ("input_prompt");
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index a62c6d07a..328fa6ae5 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -49,15 +49,15 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
if (server)
*server = NULL;
if (channel)
*channel = NULL;
-
+
if (!buffer)
return;
-
+
/* look for a server or channel using this buffer */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -68,7 +68,7 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
*server = ptr_server;
return;
}
-
+
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -82,7 +82,7 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
}
}
}
-
+
/* no server or channel found */
}
@@ -94,18 +94,18 @@ char *
irc_buffer_build_name (const char *server, const char *channel)
{
static char buffer[128];
-
+
buffer[0] = '\0';
-
+
if (!server && !channel)
return buffer;
-
+
if (server && channel)
snprintf (buffer, sizeof (buffer), "%s.%s", server, channel);
else
snprintf (buffer, sizeof (buffer), "%s",
(server) ? server : channel);
-
+
return buffer;
}
@@ -117,12 +117,12 @@ int
irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_irc_channel *next_channel;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (buffer == irc_raw_buffer)
{
irc_raw_buffer = NULL;
@@ -156,7 +156,7 @@ irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -172,10 +172,10 @@ irc_buffer_search_first_for_all_servers ()
struct t_gui_buffer *ptr_buffer;
struct t_irc_server *ptr_server;
int number, number_found;
-
+
ptr_buffer = NULL;
number_found = INT_MAX;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index ef89392a5..48d133d45 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -50,17 +50,17 @@ int
irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server)
return 0;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel == channel)
return 1;
}
-
+
/* channel not found */
return 0;
}
@@ -77,12 +77,12 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
int number_found;
char str_number[32];
struct t_irc_channel *ptr_channel;
-
+
number = weechat_buffer_get_integer (buffer, "number");
number_last_channel = 0;
number_last_private = 0;
number_found = 0;
-
+
if (server->channels)
{
/* search last channel/pv number for server */
@@ -106,7 +106,7 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
}
}
}
-
+
/* use last channel/pv number + 1 */
switch (channel_type)
{
@@ -130,7 +130,7 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
number_found = weechat_buffer_get_integer (server->buffer, "number") + 1;
}
}
-
+
/* switch to number found */
if ((number_found >= 1) && (number_found != number))
{
@@ -154,7 +154,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
int i, buffer_created, current_buffer_number, buffer_position, manual_join;
char *buffer_name, str_number[32], str_group[32], *channel_name_lower;
const char *prefix_modes;
-
+
/* alloc memory for new channel */
if ((new_channel = malloc (sizeof (*new_channel))) == NULL)
{
@@ -163,7 +163,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return NULL;
}
-
+
/* create buffer for channel (or use existing one) */
buffer_created = 0;
buffer_name = irc_buffer_build_name (server->name, channel_name);
@@ -206,7 +206,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
}
buffer_created = 1;
}
-
+
if (buffer_created)
{
if (!weechat_buffer_get_integer (new_buffer, "short_name_is_set"))
@@ -227,7 +227,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_buffer_set (new_buffer, "nicklist", "1");
weechat_buffer_set (new_buffer, "nicklist_display_groups", "0");
}
-
+
/* set highlights settings on channel buffer */
weechat_buffer_set(new_buffer, "highlight_words_add", "$nick");
if (weechat_config_string (irc_config_look_highlight_tags)
@@ -237,7 +237,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_config_string (irc_config_look_highlight_tags));
}
}
-
+
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -253,7 +253,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_nicklist_add_group (new_buffer, NULL, str_group,
"weechat.color.nicklist_group", 1);
}
-
+
/* initialize new channel */
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
@@ -279,7 +279,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->last_nick_speaking_time = NULL;
new_channel->buffer = new_buffer;
new_channel->buffer_as_string = NULL;
-
+
/* add new channel to channels list */
new_channel->prev_channel = server->last_channel;
new_channel->next_channel = NULL;
@@ -288,7 +288,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
else
server->channels = new_channel;
server->last_channel = new_channel;
-
+
manual_join = 0;
channel_name_lower = NULL;
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -301,7 +301,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
channel_name_lower);
}
}
-
+
if (switch_to_channel)
{
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -310,23 +310,23 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
|| (!manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin)))
switch_to_channel = 0;
}
-
+
if (switch_to_channel)
{
weechat_buffer_set (new_buffer, "display",
(auto_switch) ? "auto" : "1");
}
}
-
+
if (manual_join)
weechat_hashtable_remove (server->manual_joins, channel_name_lower);
if (channel_name_lower)
free (channel_name_lower);
-
+
weechat_hook_signal_send ((channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
"irc_channel_opened" : "irc_pv_opened",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
-
+
/* all is ok, return address of new channel */
return new_channel;
}
@@ -340,7 +340,7 @@ irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
{
if (channel->topic)
free (channel->topic);
-
+
channel->topic = (topic) ? strdup (topic) : NULL;
weechat_buffer_set (channel->buffer, "title",
(channel->topic) ? channel->topic : "");
@@ -354,10 +354,10 @@ struct t_irc_channel *
irc_channel_search (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server || !channel_name)
return NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -375,10 +375,10 @@ int
irc_channel_is_channel (const char *string)
{
char first_char[2];
-
+
if (!string)
return 0;
-
+
first_char[0] = string[0];
first_char[1] = '\0';
return (strpbrk (first_char, IRC_CHANNEL_PREFIX)) ? 1 : 0;
@@ -393,7 +393,7 @@ irc_channel_remove_away (struct t_irc_server *server,
struct t_irc_channel *channel)
{
struct t_irc_nick *ptr_nick;
-
+
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
@@ -436,7 +436,7 @@ irc_channel_set_away (struct t_irc_server *server,
int is_away)
{
struct t_irc_nick *ptr_nick;
-
+
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
ptr_nick = irc_nick_search (channel, nick_name);
@@ -456,21 +456,21 @@ irc_channel_nick_speaking_add_to_list (struct t_irc_channel *channel,
{
int size, to_remove, i;
struct t_weelist_item *ptr_item;
-
+
/* create list if it does not exist */
if (!channel->nicks_speaking[highlight])
channel->nicks_speaking[highlight] = weechat_list_new ();
-
+
/* remove item if it was already in list */
ptr_item = weechat_list_casesearch (channel->nicks_speaking[highlight],
nick_name);
if (ptr_item)
weechat_list_remove (channel->nicks_speaking[highlight], ptr_item);
-
+
/* add nick in list */
weechat_list_add (channel->nicks_speaking[highlight], nick_name,
WEECHAT_LIST_POS_END, NULL);
-
+
/* reduce list size if it's too big */
size = weechat_list_size (channel->nicks_speaking[highlight]);
if (size > IRC_CHANNEL_NICKS_SPEAKING_LIMIT)
@@ -498,7 +498,7 @@ irc_channel_nick_speaking_add (struct t_irc_channel *channel,
highlight = 1;
if (highlight)
irc_channel_nick_speaking_add_to_list (channel, nick_name, 1);
-
+
irc_channel_nick_speaking_add_to_list (channel, nick_name, 0);
}
@@ -537,10 +537,10 @@ irc_channel_nick_speaking_time_search (struct t_irc_channel *channel,
{
struct t_irc_channel_speaking *ptr_nick;
time_t time_limit;
-
+
time_limit = time (NULL) -
(weechat_config_integer (irc_config_look_smart_filter_delay) * 60);
-
+
for (ptr_nick = channel->nicks_speaking_time; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
@@ -551,7 +551,7 @@ irc_channel_nick_speaking_time_search (struct t_irc_channel *channel,
return ptr_nick;
}
}
-
+
/* nick speaking time not found */
return NULL;
}
@@ -567,7 +567,7 @@ irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
/* free data */
if (nick_speaking->nick)
free (nick_speaking->nick);
-
+
/* remove nick from list */
if (nick_speaking->prev_nick)
(nick_speaking->prev_nick)->next_nick = nick_speaking->next_nick;
@@ -577,7 +577,7 @@ irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
channel->nicks_speaking_time = nick_speaking->next_nick;
if (channel->last_nick_speaking_time == nick_speaking)
channel->last_nick_speaking_time = nick_speaking->prev_nick;
-
+
free (nick_speaking);
}
@@ -603,7 +603,7 @@ void
irc_channel_nick_speaking_time_remove_old (struct t_irc_channel *channel)
{
time_t time_limit;
-
+
time_limit = time (NULL) -
(weechat_config_integer (irc_config_look_smart_filter_delay) * 60);
@@ -611,7 +611,7 @@ irc_channel_nick_speaking_time_remove_old (struct t_irc_channel *channel)
{
if (channel->last_nick_speaking_time->time_last_message >= time_limit)
break;
-
+
irc_channel_nick_speaking_time_free (channel,
channel->last_nick_speaking_time);
}
@@ -627,17 +627,17 @@ irc_channel_nick_speaking_time_add (struct t_irc_channel *channel,
time_t time_last_message)
{
struct t_irc_channel_speaking *ptr_nick, *new_nick;
-
+
ptr_nick = irc_channel_nick_speaking_time_search (channel, nick_name, 0);
if (ptr_nick)
irc_channel_nick_speaking_time_free (channel, ptr_nick);
-
+
new_nick = malloc (sizeof (*new_nick));
if (new_nick)
{
new_nick->nick = strdup (nick_name);
new_nick->time_last_message = time_last_message;
-
+
/* insert nick at beginning of list */
new_nick->prev_nick = NULL;
new_nick->next_nick = channel->nicks_speaking_time;
@@ -660,7 +660,7 @@ irc_channel_nick_speaking_time_rename (struct t_irc_channel *channel,
const char *new_nick)
{
struct t_irc_channel_speaking *ptr_nick;
-
+
if (channel->nicks_speaking_time)
{
ptr_nick = irc_channel_nick_speaking_time_search (channel, old_nick, 0);
@@ -680,12 +680,12 @@ void
irc_channel_rejoin (struct t_irc_server *server, struct t_irc_channel *channel)
{
char join_args[256];
-
+
snprintf (join_args, sizeof (join_args), "%s%s%s",
channel->name,
(channel->key) ? " " : "",
(channel->key) ? channel->key : "");
-
+
irc_command_join_server (server, join_args, 0);
}
@@ -698,12 +698,12 @@ irc_channel_autorejoin_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server, *ptr_server_found;
struct t_irc_channel *ptr_channel_arg, *ptr_channel;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
ptr_channel_arg = (struct t_irc_channel *)data;
-
+
ptr_server_found = NULL;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -718,13 +718,13 @@ irc_channel_autorejoin_cb (void *data, int remaining_calls)
}
}
}
-
+
if (ptr_server_found && (ptr_channel_arg->hook_autorejoin))
{
irc_channel_rejoin (ptr_server_found, ptr_channel_arg);
ptr_channel_arg->hook_autorejoin = NULL;
}
-
+
return WEECHAT_RC_OK;
}
@@ -740,10 +740,10 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
const char *nickname)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server || (!nick && !nickname))
return;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -777,10 +777,10 @@ void
irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
{
struct t_irc_channel *new_channels;
-
+
if (!server || !channel)
return;
-
+
/* remove channel from channels list */
if (server->last_channel == channel)
server->last_channel = channel->prev_channel;
@@ -791,10 +791,10 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
}
else
new_channels = channel->next_channel;
-
+
if (channel->next_channel)
(channel->next_channel)->prev_channel = channel->prev_channel;
-
+
/* free data */
if (channel->name)
free (channel->name);
@@ -818,9 +818,9 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
irc_channel_nick_speaking_time_free_all (channel);
if (channel->buffer_as_string)
free (channel->buffer_as_string);
-
+
free (channel);
-
+
server->channels = new_channels;
}
@@ -845,10 +845,10 @@ struct t_hdata *
irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
if (hdata)
{
@@ -889,10 +889,10 @@ struct t_hdata *
irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
@@ -918,14 +918,14 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
struct t_irc_channel_speaking *ptr_nick;
char option_name[64];
int i, index;
-
+
if (!infolist || !channel)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", channel->buffer))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "buffer_name",
@@ -1003,7 +1003,7 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
i++;
}
}
-
+
return 1;
}
@@ -1018,7 +1018,7 @@ irc_channel_print_log (struct t_irc_channel *channel)
struct t_irc_channel_speaking *ptr_nick_speaking;
int i, index;
struct t_irc_nick *ptr_nick;
-
+
weechat_log_printf ("");
weechat_log_printf (" => channel %s (addr:0x%lx):", channel->name, channel);
weechat_log_printf (" type . . . . . . . . . . : %d", channel->type);
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index 1b9f26aee..9b019e73f 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -66,17 +66,17 @@ irc_color_decode (const char *string, int keep_colors)
int out_length, length, out_pos;
char str_fg[3], str_bg[3], str_color[128];
int fg, bg, bold, reverse, italic, underline, rc;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
bold = 0;
reverse = 0;
italic = 0;
underline = 0;
-
+
ptr_string = (unsigned char *)string;
out[0] = '\0';
while (ptr_string && ptr_string[0])
@@ -197,7 +197,7 @@ irc_color_decode (const char *string, int keep_colors)
break;
}
}
-
+
return (char *)out;
}
@@ -212,12 +212,12 @@ irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
@@ -261,9 +261,9 @@ irc_color_decode_for_user_entry (const char *string)
ptr_string += length;
}
}
-
+
out[out_pos] = '\0';
-
+
return (char *)out;
}
@@ -280,12 +280,12 @@ irc_color_encode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
@@ -356,9 +356,9 @@ irc_color_encode (const char *string, int keep_colors)
ptr_string += length;
}
}
-
+
out[out_pos] = '\0';
-
+
return (char *)out;
}
@@ -374,18 +374,18 @@ irc_color_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
int keep_colors;
-
+
/* make C compiler happy */
(void) data;
-
+
keep_colors = (modifier_data && (strcmp (modifier_data, "1") == 0)) ? 1 : 0;
-
+
if (strcmp (modifier, "irc_color_decode") == 0)
return irc_color_decode (string, keep_colors);
-
+
if (strcmp (modifier, "irc_color_encode") == 0)
return irc_color_encode (string, keep_colors);
-
+
/* unknown modifier */
return NULL;
}
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index f0417e0bf..3eacbcb4c 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -59,7 +59,7 @@ irc_command_mode_nicks (struct t_irc_server *server, const char *channel,
{
int i, length;
char *command;
-
+
length = 0;
for (i = 1; i < argc; i++)
length += strlen (argv[i]) + 1;
@@ -95,7 +95,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -106,7 +106,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"ADMIN");
}
-
+
return WEECHAT_RC_OK;
}
@@ -125,7 +125,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
struct t_irc_channel *ptr_channel;
char **channels, *str_command;
int num_channels, length, excluded, i;
-
+
if (!command || !command[0])
return;
@@ -137,13 +137,13 @@ irc_command_exec_all_channels (struct t_irc_server *server,
}
else
str_command = strdup (command);
-
+
if (!str_command)
return;
-
+
channels = (exclude_channels && exclude_channels[0]) ?
weechat_string_split (exclude_channels, ",", 0, 0, &num_channels) : NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -178,7 +178,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
}
}
}
-
+
free (str_command);
if (channels)
weechat_string_free_split (channels);
@@ -195,12 +195,12 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
{
int i, current_server;
const char *ptr_exclude_channels, *ptr_command;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
current_server = 0;
@@ -221,7 +221,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
else
break;
}
-
+
if (ptr_command && ptr_command[0])
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -244,7 +244,7 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
struct t_irc_server *ptr_server;
char **servers, *str_command;
int num_servers, length, excluded, i;
-
+
if (!command || !command[0])
return;
@@ -256,13 +256,13 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
}
else
str_command = strdup (command);
-
+
if (!str_command)
return;
-
+
servers = (exclude_servers && exclude_servers[0]) ?
weechat_string_split (exclude_servers, ",", 0, 0, &num_servers) : NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -287,7 +287,7 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
}
}
}
-
+
free (str_command);
if (servers)
weechat_string_free_split (servers);
@@ -303,11 +303,11 @@ irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc,
{
int i;
const char *ptr_exclude_servers, *ptr_command;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
{
ptr_exclude_servers = NULL;
@@ -322,7 +322,7 @@ irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc,
else
break;
}
-
+
if (ptr_command && ptr_command[0])
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -343,7 +343,7 @@ irc_command_me_channel_display (struct t_irc_server *server,
const char *arguments)
{
char *string;
-
+
string = (arguments && arguments[0]) ?
irc_color_decode (arguments,
weechat_config_boolean (irc_config_network_colors_receive)) : NULL;
@@ -374,7 +374,7 @@ irc_command_me_channel (struct t_irc_server *server,
int number;
char hash_key[32];
const char *str_args;
-
+
hashtable = irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
@@ -405,7 +405,7 @@ void
irc_command_me_all_channels (struct t_irc_server *server, const char *arguments)
{
struct t_irc_channel *ptr_channel;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -425,16 +425,16 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
char *string, buffer[4096];
time_t time_now, elapsed;
struct t_irc_channel *ptr_channel;
-
+
if (!server)
return;
-
+
if (arguments)
{
if (server->away_message)
free (server->away_message);
server->away_message = strdup (arguments);
-
+
/* if server is connected, send away command now */
if (server->is_connected)
{
@@ -459,7 +459,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
free (string);
}
irc_server_set_away (server, server->nick, 1);
-
+
/* reset "unread" indicator on server and channels/pv buffers */
if (reset_unread_marker)
{
@@ -472,7 +472,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
weechat_buffer_set (ptr_channel->buffer, "unread", "");
}
}
-
+
/* ask refresh for "away" item */
weechat_bar_item_update ("away");
}
@@ -499,7 +499,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
free (server->away_message);
server->away_message = NULL;
}
-
+
/* if server is connected, send away command now */
if (server->is_connected)
{
@@ -535,7 +535,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
}
}
irc_server_set_away (server, server->nick, 0);
-
+
/* ask refresh for "away" item */
weechat_bar_item_update ("away");
}
@@ -561,10 +561,10 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if ((argc >= 2) && (weechat_strcasecmp (argv[1], "-all") == 0))
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -589,7 +589,7 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
weechat_buffer_set (NULL, "hotlist", "+");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -603,20 +603,20 @@ irc_command_run_away (void *data, struct t_gui_buffer *buffer,
{
int argc;
char **argv, **argv_eol;
-
+
argv = weechat_string_split (command, " ", 0, 0, &argc);
argv_eol = weechat_string_split (command, " ", 1, 0, NULL);
-
+
if (argv && argv_eol)
{
irc_command_away (data, buffer, argc, argv, argv_eol);
}
-
+
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
-
+
return WEECHAT_RC_OK;
}
@@ -630,14 +630,14 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel;
int pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("ban", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -650,7 +650,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -698,7 +698,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MODE %s +b", ptr_channel->name);
}
-
+
return WEECHAT_RC_OK;
}
@@ -713,7 +713,7 @@ irc_command_connect_one_server (struct t_irc_server *server,
{
if (!server)
return 0;
-
+
if (server->is_connected)
{
weechat_printf (NULL,
@@ -732,19 +732,19 @@ irc_command_connect_one_server (struct t_irc_server *server,
server->name);
return 0;
}
-
+
if (switch_address)
irc_server_switch_address (server, 0);
-
+
server->disable_autojoin = no_join;
-
+
if (irc_server_connect (server))
{
server->reconnect_delay = 0;
server->reconnect_start = 0;
server->reconnect_join = (server->channels) ? 1 : 0;
}
-
+
/* connect ok */
return 1;
}
@@ -760,15 +760,15 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
int i, nb_connect, connect_ok, all_servers, all_opened, switch_address;
int no_join;
char *name;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
connect_ok = 1;
-
+
all_servers = 0;
all_opened = 0;
switch_address = 0;
@@ -784,7 +784,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
else if (weechat_strcasecmp (argv[i], "-nojoin") == 0)
no_join = 1;
}
-
+
if (all_opened)
{
for (ptr_server = irc_servers; ptr_server;
@@ -883,10 +883,10 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
no_join);
}
}
-
+
if (!connect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -900,10 +900,10 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
{
char *irc_cmd, str_time[512];
struct timeval tv;
-
+
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ctcp", 1);
-
+
/* make C compiler happy */
(void) data;
@@ -912,9 +912,9 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
irc_cmd = strdup (argv[2]);
if (!irc_cmd)
return WEECHAT_RC_ERROR;
-
+
weechat_string_toupper (irc_cmd);
-
+
if ((weechat_strcasecmp (argv[2], "ping") == 0) && !argv_eol[3])
{
gettimeofday (&tv, NULL);
@@ -955,13 +955,13 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
(argv_eol[3]) ? " " : "",
(argv_eol[3]) ? argv_eol[3] : "");
}
-
+
free (irc_cmd);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/*
* irc_command_cycle: leave and rejoin a channel
*/
@@ -974,14 +974,14 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
const char *version, *ptr_arg, *msg_part;
char **channels;
int i, num_channels;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("cycle", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -1014,11 +1014,11 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
"cycle");
return WEECHAT_RC_OK;
}
-
+
/* does nothing on private buffer (cycle has no sense!) */
if (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
return WEECHAT_RC_OK;
-
+
channel_name = ptr_channel->name;
pos_args = argv_eol[1];
ptr_channel->cycle = 1;
@@ -1034,21 +1034,21 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "part");
return WEECHAT_RC_OK;
}
-
+
/* does nothing on private buffer (cycle has no sense!) */
if (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
return WEECHAT_RC_OK;
-
+
channel_name = ptr_channel->name;
pos_args = NULL;
ptr_channel->cycle = 1;
}
-
+
msg_part = IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_DEFAULT_MSG_PART);
ptr_arg = (pos_args) ? pos_args :
((msg_part && msg_part[0]) ? msg_part : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -1062,7 +1062,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
else
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PART %s", channel_name);
-
+
return WEECHAT_RC_OK;
}
@@ -1080,13 +1080,13 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
struct t_infolist *infolist;
struct t_infolist_item *item;
char str_address[128], charset_modifier[256];
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("dcc", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
/* use the local interface, from the server socket */
@@ -1095,7 +1095,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
getsockname (ptr_server->sock, (struct sockaddr *) &addr, &length);
addr.sin_family = AF_INET;
address = ntohl (addr.sin_addr.s_addr);
-
+
/* DCC SEND file */
if (weechat_strcasecmp (argv[1], "send") == 0)
{
@@ -1171,7 +1171,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "dcc");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1185,11 +1185,11 @@ irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("dehalfop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1226,11 +1226,11 @@ irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("deop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1267,11 +1267,11 @@ irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("devoice", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1308,11 +1308,11 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("die", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1323,7 +1323,7 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"DIE");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1336,17 +1336,17 @@ irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
const char *ptr_arg, *version, *msg_quit;
char *buf;
-
+
if (!server)
return;
-
+
if (server->is_connected)
{
msg_quit = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_DEFAULT_MSG_QUIT);
ptr_arg = (arguments) ? arguments :
((msg_quit && msg_quit[0]) ? msg_quit : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -1373,7 +1373,7 @@ irc_command_disconnect_one_server (struct t_irc_server *server,
{
if (!server)
return 0;
-
+
if ((!server->is_connected) && (!server->hook_connect)
&& (!server->hook_fd) && (server->reconnect_start == 0))
{
@@ -1391,7 +1391,7 @@ irc_command_disconnect_one_server (struct t_irc_server *server,
}
irc_command_quit_server (server, reason);
irc_server_disconnect (server, 0, 0);
-
+
/* disconnect ok */
return 1;
}
@@ -1406,20 +1406,20 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
{
int disconnect_ok;
const char *reason;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
reason = (argc > 2) ? argv_eol[2] : NULL;
-
+
if (argc < 2)
disconnect_ok = irc_command_disconnect_one_server (ptr_server, reason);
else
{
disconnect_ok = 1;
-
+
if (weechat_strcasecmp (argv[1], "-all") == 0)
{
for (ptr_server = irc_servers; ptr_server;
@@ -1452,10 +1452,10 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
}
}
}
-
+
if (!disconnect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -1469,11 +1469,11 @@ irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("halfop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1508,9 +1508,9 @@ void
irc_command_ignore_display (struct t_irc_ignore *ignore)
{
char *mask;
-
+
mask = weechat_strndup (ignore->mask + 1, strlen (ignore->mask) - 2);
-
+
weechat_printf (NULL,
_(" %s[%s%d%s]%s mask: %s / server: %s / channel: %s"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -1521,7 +1521,7 @@ irc_command_ignore_display (struct t_irc_ignore *ignore)
(mask) ? mask : ignore->mask,
(ignore->server) ? ignore->server : "*",
(ignore->channel) ? ignore->channel : "*");
-
+
if (mask)
free (mask);
}
@@ -1537,12 +1537,12 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
struct t_irc_ignore *ptr_ignore;
char *mask, *regex, *ptr_regex, *server, *channel, *error;
long number;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if ((argc == 1)
|| ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0)))
{
@@ -1559,10 +1559,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
}
else
weechat_printf (NULL, _("%s: no ignore in list"), IRC_PLUGIN_NAME);
-
+
return WEECHAT_RC_OK;
}
-
+
/* add ignore */
if (weechat_strcasecmp (argv[1], "add") == 0)
{
@@ -1575,11 +1575,11 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
"ignore add");
return WEECHAT_RC_OK;
}
-
+
mask = argv[2];
server = (argc > 3) ? argv[3] : NULL;
channel = (argc > 4) ? argv[4] : NULL;
-
+
if (strncmp (mask, "re:", 3) == 0)
{
regex = NULL;
@@ -1590,7 +1590,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
regex = weechat_string_mask_to_regex (mask);
ptr_regex = (regex) ? regex : mask;
}
-
+
if (irc_ignore_search (ptr_regex, server, channel))
{
weechat_printf (NULL,
@@ -1598,12 +1598,12 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
ptr_ignore = irc_ignore_new (ptr_regex, server, channel);
-
+
if (regex)
free (regex);
-
+
if (ptr_ignore)
{
weechat_printf (NULL, "");
@@ -1615,10 +1615,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
weechat_printf (NULL, _("%s%s: error adding ignore"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete ignore */
if (weechat_strcasecmp (argv[1], "del") == 0)
{
@@ -1631,7 +1631,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
"ignore del");
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[2], "-all") == 0)
{
if (irc_ignore_list)
@@ -1675,10 +1675,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" "
"command"),
@@ -1696,11 +1696,11 @@ irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("info", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1711,7 +1711,7 @@ irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"INFO");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1725,11 +1725,11 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("invite", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1754,7 +1754,7 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1768,11 +1768,11 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ison", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1782,7 +1782,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "ison");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1798,7 +1798,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
int i, num_channels, length;
int time_now;
struct t_irc_channel *ptr_channel;
-
+
if (server->sock < 0)
{
weechat_printf (NULL,
@@ -1808,7 +1808,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
"join");
return;
}
-
+
/* split channels */
channels = NULL;
pos_space = strchr (arguments, ' ');
@@ -1822,7 +1822,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
&num_channels);
free (new_args);
}
-
+
/*
* add "#" in front of each channel if no prefix is given
* (exception if there is only "0", which is a special join argument to
@@ -1868,10 +1868,10 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
}
if (pos_space)
strcat (new_args, pos_space);
-
+
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"JOIN %s", new_args);
-
+
free (new_args);
}
weechat_string_free_split (channels);
@@ -1887,10 +1887,10 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if ((argc >= 4) && (weechat_strcasecmp (argv[1], "-server") == 0))
@@ -1919,7 +1919,7 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "join");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1932,13 +1932,13 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *pos_comment;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("kick", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -1974,7 +1974,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (pos_comment)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1992,7 +1992,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kick");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2006,10 +2006,10 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel, *pos_nick, *nick_only, *pos_comment, *pos, *mask;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("kickban", 1);
-
+
/* make C compiler happy */
(void) data;
@@ -2048,7 +2048,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
/* kick nick from channel */
nick_only = strdup (pos_nick);
if (nick_only)
@@ -2059,7 +2059,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
pos = strchr (nick_only, '!');
if (pos)
pos[0] = '\0';
-
+
if (strcmp (nick_only, "*") == 0)
{
weechat_printf (ptr_server->buffer,
@@ -2067,7 +2067,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
/* set ban for nick(+host) on channel */
if (strchr (pos_nick, '@'))
{
@@ -2092,7 +2092,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
"MODE %s +b %s",
pos_channel, pos_nick);
}
-
+
/* kick nick */
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"KICK %s %s%s%s",
@@ -2107,7 +2107,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kickban");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2121,10 +2121,10 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("kill", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2134,7 +2134,7 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kill");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2149,11 +2149,11 @@ irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("links", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2164,7 +2164,7 @@ irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LINKS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2178,20 +2178,20 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
{
char buf[512], *ptr_channel_name, *ptr_server_name, *ptr_regex;
int i, ret;
-
+
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("list", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (ptr_server->cmd_list_regexp)
{
regfree (ptr_server->cmd_list_regexp);
free (ptr_server->cmd_list_regexp);
ptr_server->cmd_list_regexp = NULL;
}
-
+
if (argc > 1)
{
ptr_channel_name = NULL;
@@ -2262,7 +2262,7 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LIST");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2276,11 +2276,11 @@ irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("lusers", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2291,7 +2291,7 @@ irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LUSERS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2305,11 +2305,11 @@ irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("map", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2320,7 +2320,7 @@ irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MAP");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2334,11 +2334,11 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("me", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (!ptr_channel)
{
weechat_printf (ptr_server->buffer,
@@ -2349,7 +2349,7 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
}
irc_command_me_channel (ptr_server, ptr_channel,
(argc > 1) ? argv_eol[1] : NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -2388,10 +2388,10 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("mode", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if ((argv[1][0] == '+') || (argv[1][0] == '-'))
@@ -2418,7 +2418,7 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "mode");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2432,11 +2432,11 @@ irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("motd", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2447,7 +2447,7 @@ irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MOTD");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2463,21 +2463,21 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
int num_targets, i, arg_target, arg_text;
char *msg_pwd_hidden;
char *string;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc <= 2)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"msg");
}
-
+
arg_target = 1;
arg_text = 2;
-
+
if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0))
{
ptr_server = irc_server_search (argv[2]);
@@ -2485,9 +2485,9 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
arg_target = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("msg", 1);
-
+
targets = weechat_string_split (argv[arg_target], ",", 0, 0,
&num_targets);
if (targets)
@@ -2514,7 +2514,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
(string) ? string : argv_eol[arg_text]);
if (string)
free (string);
-
+
irc_server_sendf (ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :%s",
@@ -2606,7 +2606,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
}
weechat_string_free_split (targets);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2620,11 +2620,11 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("names", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2647,7 +2647,7 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2660,7 +2660,7 @@ irc_send_nick_server (struct t_irc_server *server, const char *nickname)
{
if (!server)
return;
-
+
if (server->is_connected)
{
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2680,11 +2680,11 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("nick", 0);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 2)
{
if (weechat_strcasecmp (argv[1], "-all") != 0)
@@ -2709,7 +2709,7 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "nick");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2725,12 +2725,12 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
int arg_nick, arg_text, number;
struct t_irc_channel *ptr_channel;
struct t_hashtable *hashtable;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
arg_nick = 1;
@@ -2741,7 +2741,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
arg_nick = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("notice", 1);
ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]);
hashtable = irc_server_sendf (ptr_server,
@@ -2785,7 +2785,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"notice");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2799,21 +2799,21 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
{
struct t_irc_notify *ptr_notify;
int i, check_away;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
/* display notify status for users on server */
if (argc == 1)
{
irc_notify_display_list (ptr_server);
return WEECHAT_RC_OK;
}
-
+
/* add notify */
if (weechat_strcasecmp (argv[1], "add") == 0)
{
@@ -2826,9 +2826,9 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
"notify add");
return WEECHAT_RC_OK;
}
-
+
check_away = 0;
-
+
if (argc > 3)
{
ptr_server = irc_server_search (argv[3]);
@@ -2841,7 +2841,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (!ptr_server)
{
weechat_printf (NULL,
@@ -2850,7 +2850,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (argc > 4)
{
for (i = 4; i < argc; i++)
@@ -2868,7 +2868,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
ptr_notify = irc_notify_new (ptr_server, argv[2], check_away);
if (ptr_notify)
{
@@ -2884,10 +2884,10 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_printf (NULL, _("%s%s: error adding notification"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete notify */
if (weechat_strcasecmp (argv[1], "del") == 0)
{
@@ -2913,7 +2913,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (!ptr_server)
{
weechat_printf (NULL,
@@ -2922,7 +2922,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[2], "-all") == 0)
{
if (ptr_server->notify_list)
@@ -2956,10 +2956,10 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" "
"command"),
@@ -2977,11 +2977,11 @@ irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("op", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -3018,7 +3018,7 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("oper", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -3032,7 +3032,7 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "oper");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3046,12 +3046,12 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
{
const char *ptr_arg, *version, *msg_part;
char *buf;
-
+
msg_part = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_DEFAULT_MSG_PART);
ptr_arg = (part_message) ? part_message :
((msg_part && msg_part[0]) ? msg_part : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -3079,13 +3079,13 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *channel_name, *pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("part", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -3128,9 +3128,9 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
channel_name = ptr_channel->name;
pos_args = NULL;
}
-
+
irc_command_part_channel (ptr_server, channel_name, pos_args);
-
+
return WEECHAT_RC_OK;
}
@@ -3144,7 +3144,7 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ping", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -3158,7 +3158,7 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "ping");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3172,11 +3172,11 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("pong", 0);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3186,7 +3186,7 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "pong");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3200,12 +3200,12 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
{
char *string;
int arg_nick, arg_text;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
arg_nick = 1;
@@ -3216,9 +3216,9 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
arg_nick = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("query", 1);
-
+
/* create private window if not already opened */
ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]);
if (!ptr_channel)
@@ -3237,7 +3237,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
}
}
weechat_buffer_set (ptr_channel->buffer, "display", "1");
-
+
/* display text if given */
if (argv_eol[arg_text])
{
@@ -3257,7 +3257,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"query");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3270,7 +3270,7 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
@@ -3297,7 +3297,7 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"quote");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3311,12 +3311,12 @@ irc_command_reconnect_one_server (struct t_irc_server *server,
int switch_address, int no_join)
{
int switch_done;
-
+
if (!server)
return 0;
-
+
switch_done = 0;
-
+
if ((server->is_connected) || (server->hook_connect) || (server->hook_fd))
{
/* disconnect from server */
@@ -3324,19 +3324,19 @@ irc_command_reconnect_one_server (struct t_irc_server *server,
irc_server_disconnect (server, switch_address, 0);
switch_done = 1;
}
-
+
if (switch_address && !switch_done)
irc_server_switch_address (server, 0);
-
+
server->disable_autojoin = no_join;
-
+
if (irc_server_connect (server))
{
server->reconnect_delay = 0;
server->reconnect_start = 0;
server->reconnect_join = (server->channels) ? 1 : 0;
}
-
+
/* reconnect ok */
return 1;
}
@@ -3350,15 +3350,15 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
int i, nb_reconnect, reconnect_ok, all_servers, switch_address, no_join;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
reconnect_ok = 1;
-
+
all_servers = 0;
switch_address = 0;
no_join = 0;
@@ -3371,7 +3371,7 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
else if (weechat_strcasecmp (argv[i], "-nojoin") == 0)
no_join = 1;
}
-
+
if (all_servers)
{
for (ptr_server = irc_servers; ptr_server;
@@ -3426,10 +3426,10 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
no_join);
}
}
-
+
if (!reconnect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -3443,11 +3443,11 @@ irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("rehash", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3458,7 +3458,7 @@ irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"REHASH");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3472,11 +3472,11 @@ irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("restart", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3487,7 +3487,7 @@ irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"RESTART");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3501,10 +3501,10 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sajoin", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3514,7 +3514,7 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sajoin");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3528,10 +3528,10 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("samode", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3541,7 +3541,7 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "samode");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3555,10 +3555,10 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sanick", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3568,7 +3568,7 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sanick");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3582,10 +3582,10 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sapart", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3595,7 +3595,7 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sapart");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3609,10 +3609,10 @@ irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("saquit", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3622,7 +3622,7 @@ irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "saquit");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3637,14 +3637,14 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
int i, detailed_list, one_server_found;
struct t_irc_server *ptr_server2, *server_found, *new_server;
char *server_name;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if ((argc == 1)
|| (weechat_strcasecmp (argv[1], "list") == 0)
|| (weechat_strcasecmp (argv[1], "listfull") == 0))
@@ -3703,10 +3703,10 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
_("No server found with \"%s\""),
server_name);
}
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "add") == 0)
{
if (argc < 4)
@@ -3729,7 +3729,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
new_server = irc_server_alloc (argv[2]);
if (!new_server)
{
@@ -3738,34 +3738,34 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES],
argv[3], 1);
irc_server_apply_command_line_options (new_server, argc, argv);
-
+
weechat_printf (NULL,
_("%s: server %s%s%s created"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
new_server->name,
IRC_COLOR_RESET);
-
+
/* do not connect to server after creating it */
/*
if (IRC_SERVER_OPTION_BOOLEAN(new_server, IRC_SERVER_OPTION_AUTOCONNECT))
irc_server_connect (new_server);
*/
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "copy") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3777,7 +3777,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server copy");
return WEECHAT_RC_OK;
}
-
+
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
@@ -3788,7 +3788,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[3], "server copy");
return WEECHAT_RC_OK;
}
-
+
/* copy server */
new_server = irc_server_copy (server_found, argv[3]);
if (new_server)
@@ -3805,7 +3805,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3815,7 +3815,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3827,7 +3827,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server rename");
return WEECHAT_RC_OK;
}
-
+
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
@@ -3838,7 +3838,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[3], "server rename");
return WEECHAT_RC_OK;
}
-
+
/* rename server */
if (irc_server_rename (server_found, argv[3]))
{
@@ -3854,17 +3854,17 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_ERROR;
}
-
+
if (weechat_strcasecmp (argv[1], "keep") == 0)
{
if (argc < 3)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server keep");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3876,7 +3876,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server keep");
return WEECHAT_RC_OK;
}
-
+
/* check that is it temporary server */
if (!server_found->temp_server)
{
@@ -3886,27 +3886,27 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server keep");
return WEECHAT_RC_OK;
}
-
+
/* remove temporary flag on server */
server_found->temp_server = 0;
-
+
weechat_printf (NULL,
_("%s: server %s%s%s is not temporary any more"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_RESET);
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "del") == 0)
{
if (argc < 3)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server del");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3928,7 +3928,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], argv[2]);
return WEECHAT_RC_OK;
}
-
+
server_name = strdup (server_found->name);
irc_server_free (server_found);
weechat_printf (NULL,
@@ -3939,10 +3939,10 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
if (server_name)
free (server_name);
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "deloutq") == 0)
{
for (ptr_server2 = irc_servers; ptr_server2;
@@ -3960,24 +3960,24 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "raw") == 0)
{
irc_raw_open (1);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "jump") == 0)
{
if (ptr_server && ptr_server->buffer)
weechat_buffer_set (ptr_server->buffer, "display", "1");
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "server");
-
+
return WEECHAT_RC_OK;
}
@@ -3991,7 +3991,7 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("service", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -4005,7 +4005,7 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "service");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4019,11 +4019,11 @@ irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("servlist", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4034,7 +4034,7 @@ irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"SERVLIST");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4048,10 +4048,10 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squery", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (argc > 2)
@@ -4069,7 +4069,7 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "squery");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4083,18 +4083,18 @@ irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squit", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
irc_server_sendf (ptr_server, 0, NULL, "SQUIT %s", argv_eol[1]);
else
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "squit");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4108,11 +4108,11 @@ irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("stats", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4123,7 +4123,7 @@ irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"STATS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4138,11 +4138,11 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("summon", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4152,7 +4152,7 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "summon");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4166,11 +4166,11 @@ irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("time", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4181,7 +4181,7 @@ irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TIME");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4194,17 +4194,17 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *channel_name, *new_topic, *new_topic_color;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("topic", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
channel_name = NULL;
new_topic = NULL;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4215,7 +4215,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
else
new_topic = argv_eol[1];
}
-
+
/* look for current channel if not specified */
if (!channel_name)
{
@@ -4231,7 +4231,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (new_topic)
{
if (weechat_strcasecmp (new_topic, "-delete") == 0)
@@ -4252,7 +4252,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
else
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TOPIC %s", channel_name);
-
+
return WEECHAT_RC_OK;
}
@@ -4266,11 +4266,11 @@ irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("trace", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4281,7 +4281,7 @@ irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TRACE");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4295,14 +4295,14 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel;
int pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("unban", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4315,7 +4315,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -4331,7 +4331,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
/* loop on users */
while (argv[pos_args])
{
@@ -4348,7 +4348,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "unban");
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -4362,11 +4362,11 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("userhost", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4376,7 +4376,7 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "userhost");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4390,11 +4390,11 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("users", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4405,7 +4405,7 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"USERS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4420,11 +4420,11 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("version", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -4444,7 +4444,7 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"VERSION");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4458,11 +4458,11 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("voice", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -4484,7 +4484,7 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "voice");
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -4500,13 +4500,13 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
int pos_args;
const char *support_wallchops, *support_statusmsg;
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("wallchops", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4519,7 +4519,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -4535,7 +4535,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
ptr_channel = irc_channel_search (ptr_server, pos_channel);
if (!ptr_channel)
{
@@ -4545,7 +4545,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_channel->buffer,
"%s%s%sOp%s -> %s%s%s: %s",
weechat_prefix ("network"),
@@ -4557,7 +4557,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
ptr_channel->name,
IRC_COLOR_RESET,
argv_eol[pos_args]);
-
+
support_wallchops = irc_server_get_isupport_value (ptr_server,
"WALLCHOPS");
support_statusmsg = irc_server_get_isupport_value (ptr_server,
@@ -4597,7 +4597,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallchops");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4612,11 +4612,11 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("wallops", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4626,7 +4626,7 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallops");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4640,11 +4640,11 @@ irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("who", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4655,7 +4655,7 @@ irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"WHO");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4669,11 +4669,11 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("whois", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4692,7 +4692,7 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whois");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4706,11 +4706,11 @@ irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("whowas", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4720,7 +4720,7 @@ irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whowas");
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index d13de4638..b3e705d59 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -48,17 +48,17 @@ irc_completion_server_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
weechat_hook_completion_list_add (completion, ptr_server->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -73,17 +73,17 @@ irc_completion_server_nick_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server && ptr_server->nick)
{
weechat_hook_completion_list_add (completion, ptr_server->nick,
1, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -98,14 +98,14 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_channel *ptr_channel;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (ptr_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
@@ -118,7 +118,7 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -133,14 +133,14 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_channel *ptr_channel;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (ptr_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
@@ -153,7 +153,7 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -169,13 +169,13 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
{
struct t_irc_channel *ptr_channel2;
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
for (ptr_channel2 = ptr_server->channels; ptr_channel2;
@@ -191,12 +191,12 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
}
}
}
-
+
/* add self nick at the end */
weechat_hook_completion_list_add (completion, ptr_server->nick,
1, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -210,19 +210,19 @@ irc_completion_servers_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
weechat_hook_completion_list_add (completion, ptr_server->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -236,17 +236,17 @@ irc_completion_channel_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
weechat_hook_completion_list_add (completion, ptr_channel->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -262,7 +262,7 @@ irc_completion_channel_nicks_add_speakers (struct t_gui_completion *completion,
{
int list_size, i;
const char *nick;
-
+
if (channel->nicks_speaking[highlight])
{
list_size = weechat_list_size (channel->nicks_speaking[highlight]);
@@ -291,13 +291,13 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
switch (ptr_channel->type)
@@ -342,7 +342,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
}
ptr_channel->nick_completion_reset = 0;
}
-
+
return WEECHAT_RC_OK;
}
@@ -359,13 +359,13 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
struct t_irc_nick *ptr_nick;
char *buf;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
switch (ptr_channel->type)
@@ -404,7 +404,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -420,13 +420,13 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
{
char *topic, *topic_color;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel && ptr_channel->topic && ptr_channel->topic[0])
{
if (weechat_strncasecmp (ptr_channel->topic, ptr_channel->name,
@@ -449,7 +449,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
}
else
topic = strdup (ptr_channel->topic);
-
+
topic_color = irc_color_decode_for_user_entry ((topic) ? topic : ptr_channel->topic);
weechat_hook_completion_list_add (completion,
(topic_color) ? topic_color : ((topic) ? topic : ptr_channel->topic),
@@ -459,7 +459,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
if (topic)
free (topic);
}
-
+
return WEECHAT_RC_OK;
}
@@ -475,12 +475,12 @@ irc_completion_channels_cb (void *data, const char *completion_item,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -494,7 +494,7 @@ irc_completion_channels_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -510,12 +510,12 @@ irc_completion_privates_cb (void *data, const char *completion_item,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -529,7 +529,7 @@ irc_completion_privates_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -543,13 +543,13 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
const char *msg_part;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
msg_part = IRC_SERVER_OPTION_STRING(ptr_server,
@@ -560,7 +560,7 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
0, WEECHAT_LIST_POS_SORT);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -576,12 +576,12 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
{
struct t_irc_ignore *ptr_ignore;
char str_number[32];
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -589,7 +589,7 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
weechat_hook_completion_list_add (completion, str_number,
0, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -604,13 +604,13 @@ irc_completion_notify_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_notify *ptr_notify;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
for (ptr_notify = ptr_server->notify_list; ptr_notify;
@@ -633,7 +633,7 @@ irc_completion_notify_nicks_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 66c2c9b0a..1fede24b7 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -144,9 +144,9 @@ irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
-
+
ptr_server = NULL;
-
+
if (name)
{
pos_option = strrchr (name, '.');
@@ -160,7 +160,7 @@ irc_config_get_server_from_option_name (const char *name)
}
}
}
-
+
return ptr_server;
}
@@ -175,7 +175,7 @@ irc_config_compute_nick_colors ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -199,7 +199,7 @@ irc_config_compute_nick_colors ()
}
}
}
-
+
/* if colors are displayed for nicks in nicklist, refresh them */
if (weechat_config_boolean(irc_config_look_color_nicks_in_nicklist))
irc_nick_nicklist_set_color_all ();
@@ -219,7 +219,7 @@ irc_config_set_nick_colors ()
irc_config_nick_colors = NULL;
irc_config_num_nick_colors = 0;
}
-
+
irc_config_nick_colors =
weechat_string_split (weechat_config_string (weechat_config_get ("weechat.color.chat_nick_colors")),
",", 0, 0,
@@ -239,10 +239,10 @@ irc_config_change_nick_colors_cb (void *data, const char *option,
(void) data;
(void) option;
(void) value;
-
+
irc_config_set_nick_colors ();
irc_config_compute_nick_colors ();
-
+
return WEECHAT_RC_OK;
}
@@ -259,7 +259,7 @@ irc_config_change_look_color_nicks_in_nicklist (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_nick_nicklist_set_color_all ();
}
@@ -274,7 +274,7 @@ irc_config_change_look_server_buffer (void *data,
{
struct t_irc_server *ptr_server;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) option;
@@ -297,7 +297,7 @@ irc_config_change_look_server_buffer (void *data,
(weechat_config_integer (irc_config_look_server_buffer) ==
IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE) ?
weechat_buffer_search_main () : irc_buffer_search_first_for_all_servers ();
-
+
if (ptr_buffer)
{
for (ptr_server = irc_servers; ptr_server;
@@ -322,7 +322,7 @@ irc_config_change_look_item_away_message (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("away");
}
@@ -338,7 +338,7 @@ irc_config_change_look_item_channel_modes (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -356,7 +356,7 @@ irc_config_change_look_item_channel_modes_hide_key (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -372,7 +372,7 @@ irc_config_change_look_item_nick_modes (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -388,7 +388,7 @@ irc_config_change_look_item_nick_prefix (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -403,11 +403,11 @@ irc_config_change_look_highlight_tags (void *data,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -439,7 +439,7 @@ irc_config_change_look_nick_color_force (void *data,
{
char **items, *pos;
int num_items, i;
-
+
/* make C compiler happy */
(void) data;
(void) option;
@@ -454,7 +454,7 @@ irc_config_change_look_nick_color_force (void *data,
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_color_force);
-
+
items = weechat_string_split (weechat_config_string (irc_config_look_nick_color_force),
";", 0, 0, &num_items);
if (items)
@@ -472,7 +472,7 @@ irc_config_change_look_nick_color_force (void *data,
}
weechat_string_free_split (items);
}
-
+
irc_config_compute_nick_colors ();
}
@@ -488,7 +488,7 @@ irc_config_change_look_nick_color_stop_chars (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_config_compute_nick_colors ();
}
@@ -522,7 +522,7 @@ irc_config_change_look_topic_strip_colors (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_title");
}
@@ -538,7 +538,7 @@ irc_config_change_color_input_nick (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -554,7 +554,7 @@ irc_config_change_color_item_away (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("away");
}
@@ -570,7 +570,7 @@ irc_config_change_color_item_buffer_name (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -586,7 +586,7 @@ irc_config_change_color_item_lag (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("lag");
}
@@ -601,11 +601,11 @@ irc_config_change_color_nick_prefixes (void *data,
{
char **items, *pos;
int num_items, i;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!irc_config_hashtable_nick_prefixes)
{
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (8,
@@ -616,7 +616,7 @@ irc_config_change_color_nick_prefixes (void *data,
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_prefixes);
-
+
items = weechat_string_split (weechat_config_string (irc_config_color_nick_prefixes),
";", 0, 0, &num_items);
if (items)
@@ -634,9 +634,9 @@ irc_config_change_color_nick_prefixes (void *data,
}
weechat_string_free_split (items);
}
-
+
irc_nick_nicklist_set_prefix_color_all ();
-
+
weechat_bar_item_update ("input_prompt");
weechat_bar_item_update ("nicklist");
}
@@ -651,14 +651,14 @@ irc_config_change_network_lag_check (void *data,
{
time_t time_next_check;
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
time_next_check = (weechat_config_integer (irc_config_network_lag_check) > 0) ?
time (NULL) : 0;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -678,7 +678,7 @@ irc_config_change_network_lag_min_show (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("lag");
}
@@ -694,7 +694,7 @@ irc_config_change_network_notify_check_ison (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_notify_hook_timer_ison ();
}
@@ -710,7 +710,7 @@ irc_config_change_network_notify_check_whois (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_notify_hook_timer_whois ();
}
@@ -726,15 +726,15 @@ irc_config_change_network_send_unknown_commands (void *data,
char value[2];
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
strcpy (value,
(weechat_config_boolean (irc_config_network_send_unknown_commands)) ?
"1" : "0");
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -744,7 +744,7 @@ irc_config_change_network_send_unknown_commands (void *data,
"input_get_unknown_commands", value);
}
}
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -770,7 +770,7 @@ irc_config_server_default_change_cb (void *data, struct t_config_option *option)
{
int index_option;
struct t_irc_server *ptr_server;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -820,7 +820,7 @@ irc_config_check_gnutls_priorities (const char *priorities)
gnutls_priority_t priority_cache;
const char *pos_error;
int rc;
-
+
if (!priorities || !priorities[0])
return NULL;
@@ -850,10 +850,10 @@ irc_config_server_check_value_cb (void *data,
{
int index_option;
const char *pos_error;
-
+
/* make C compiler happy */
(void) option;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -873,7 +873,7 @@ irc_config_server_check_value_cb (void *data,
break;
}
}
-
+
return 1;
}
@@ -887,7 +887,7 @@ irc_config_server_change_cb (void *data, struct t_config_option *option)
int index_option;
char *name;
struct t_irc_server *ptr_server;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -938,10 +938,10 @@ irc_config_server_default_check_notify (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (value && value[0])
return 0;
-
+
return 1;
}
@@ -954,26 +954,26 @@ irc_config_reload (void *data, struct t_config_file *config_file)
{
int rc;
struct t_irc_server *ptr_server, *next_server;
-
+
/* make C compiler happy */
(void) data;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
ptr_server->reloading_from_config = 1;
ptr_server->reloaded_from_config = 0;
}
-
+
irc_ignore_free_all ();
-
+
rc = weechat_config_reload (config_file);
-
+
ptr_server = irc_servers;
while (ptr_server)
{
next_server = ptr_server->next_server;
-
+
if (!ptr_server->reloaded_from_config)
{
if (ptr_server->is_connected)
@@ -988,10 +988,10 @@ irc_config_reload (void *data, struct t_config_file *config_file)
else
irc_server_free (ptr_server);
}
-
+
ptr_server = next_server;
}
-
+
return rc;
}
@@ -1007,12 +1007,12 @@ irc_config_msgbuffer_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -1045,7 +1045,7 @@ irc_config_msgbuffer_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1053,7 +1053,7 @@ irc_config_msgbuffer_create_option (void *data,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -1071,12 +1071,12 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
const char *default_value;
static char empty_value[1] = { '\0' };
const char *pos_name;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -1097,11 +1097,11 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
{
pos_name = strchr (option_name, '.');
pos_name = (pos_name) ? pos_name + 1 : option_name;
-
+
default_value = irc_ctcp_get_default_reply (pos_name);
if (!default_value)
default_value = empty_value;
-
+
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
@@ -1124,7 +1124,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1132,7 +1132,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -1149,12 +1149,12 @@ irc_config_ignore_read_cb (void *data,
{
char **argv, **argv_eol;
int argc;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name)
{
if (value && value[0])
@@ -1171,7 +1171,7 @@ irc_config_ignore_read_cb (void *data,
weechat_string_free_split (argv_eol);
}
}
-
+
return 1;
}
@@ -1184,13 +1184,13 @@ irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_irc_ignore *ptr_ignore;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -1202,7 +1202,7 @@ irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
ptr_ignore->mask))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1218,13 +1218,13 @@ irc_config_server_write_default_cb (void *data,
{
int i;
char option_name[128];
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
snprintf (option_name, sizeof (option_name),
@@ -1246,7 +1246,7 @@ irc_config_server_write_default_cb (void *data,
break;
}
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1271,9 +1271,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
void *callback_change_data)
{
struct t_config_option *new_option;
-
+
new_option = NULL;
-
+
switch (index_option)
{
case IRC_SERVER_OPTION_ADDRESSES:
@@ -1701,7 +1701,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
case IRC_SERVER_NUM_OPTIONS:
break;
}
-
+
return new_option;
}
@@ -1717,14 +1717,14 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
struct t_irc_server *ptr_server;
int index_option, rc, i;
char *pos_option, *server_name;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
pos_option = strrchr (option_name, '.');
@@ -1769,7 +1769,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
}
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1777,7 +1777,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name);
}
-
+
return rc;
}
@@ -1791,13 +1791,13 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
{
struct t_irc_server *ptr_server;
int i;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -1811,7 +1811,7 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
}
}
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1825,11 +1825,11 @@ irc_config_server_create_default_options (struct t_config_section *section)
int i, length;
char *nicks, *username, *realname, *default_value;
struct passwd *my_passwd;
-
+
nicks = NULL;
username = NULL;
realname = strdup ("");
-
+
/* Get the user's name from /etc/passwd */
if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
@@ -1852,7 +1852,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
nicks = strdup (IRC_SERVER_DEFAULT_NICKS);
username = strdup ("weechat");
}
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
default_value = NULL;
@@ -1870,7 +1870,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
}
if (!default_value)
default_value = irc_server_option_default[i];
-
+
irc_config_server_default[i] = irc_config_server_new_option (
irc_config_file,
section,
@@ -1884,7 +1884,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
&irc_config_server_default_change_cb,
irc_server_option_string[i]);
}
-
+
if (nicks)
free (nicks);
if (username)
@@ -1902,7 +1902,7 @@ int
irc_config_init ()
{
struct t_config_section *ptr_section;
-
+
irc_config_hashtable_nick_color_force = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -1913,12 +1913,12 @@ irc_config_init ()
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
-
+
irc_config_file = weechat_config_new (IRC_CONFIG_NAME,
&irc_config_reload, NULL);
if (!irc_config_file)
return 0;
-
+
/* look */
ptr_section = weechat_config_new_section (irc_config_file, "look",
0, 0,
@@ -2216,7 +2216,7 @@ irc_config_init ()
N_("strip colors in topic (used only when displaying buffer title)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL,
&irc_config_change_look_topic_strip_colors, NULL, NULL, NULL);
-
+
/* color */
ptr_section = weechat_config_new_section (irc_config_file, "color",
0, 0,
@@ -2228,7 +2228,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
irc_config_color_message_join = weechat_config_new_option (
irc_config_file, ptr_section,
"message_join", "color",
@@ -2321,7 +2321,7 @@ irc_config_init ()
N_("color for new channel topic (when topic is changed)"),
NULL, -1, 0, "white", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
-
+
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
@@ -2333,7 +2333,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
irc_config_network_autoreconnect_delay_growing = weechat_config_new_option (
irc_config_file, ptr_section,
"autoreconnect_delay_growing", "integer",
@@ -2404,7 +2404,7 @@ irc_config_init ()
"(in minutes)"),
NULL, 1, 60 * 24 * 7, "5", NULL, 0, NULL, NULL,
&irc_config_change_network_notify_check_whois, NULL, NULL, NULL);
-
+
/* msgbuffer */
ptr_section = weechat_config_new_section (irc_config_file, "msgbuffer",
1, 1,
@@ -2418,7 +2418,7 @@ irc_config_init ()
return 0;
}
irc_config_section_msgbuffer = ptr_section;
-
+
/* CTCP */
ptr_section = weechat_config_new_section (irc_config_file, "ctcp",
1, 1,
@@ -2432,7 +2432,7 @@ irc_config_init ()
return 0;
}
irc_config_section_ctcp = ptr_section;
-
+
/* ignore */
ptr_section = weechat_config_new_section (irc_config_file, "ignore",
0, 0,
@@ -2445,7 +2445,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
/* server_default */
ptr_section = weechat_config_new_section (irc_config_file, "server_default",
0, 0,
@@ -2458,9 +2458,9 @@ irc_config_init ()
return 0;
}
irc_config_section_server_default = ptr_section;
-
+
irc_config_server_create_default_options (ptr_section);
-
+
/* server */
ptr_section = weechat_config_new_section (irc_config_file, "server",
0, 0,
@@ -2475,10 +2475,10 @@ irc_config_init ()
return 0;
}
irc_config_section_server = ptr_section;
-
+
irc_config_hook_config_nick_colors = weechat_hook_config ("weechat.color.chat_nick_colors",
&irc_config_change_nick_colors_cb, NULL);
-
+
return 1;
}
@@ -2490,7 +2490,7 @@ int
irc_config_read ()
{
int rc;
-
+
rc = weechat_config_read (irc_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
{
@@ -2511,7 +2511,7 @@ int
irc_config_write (int write_temp_servers)
{
irc_config_write_temp_servers = write_temp_servers;
-
+
return weechat_config_write (irc_config_file);
}
@@ -2523,7 +2523,7 @@ void
irc_config_free ()
{
weechat_config_free (irc_config_file);
-
+
if (irc_config_hook_config_nick_colors)
{
weechat_unhook (irc_config_hook_config_nick_colors);
@@ -2535,13 +2535,13 @@ irc_config_free ()
irc_config_nick_colors = NULL;
irc_config_num_nick_colors = 0;
}
-
+
if (irc_config_hashtable_nick_color_force)
{
weechat_hashtable_free (irc_config_hashtable_nick_color_force);
irc_config_hashtable_nick_color_force = NULL;
}
-
+
if (irc_config_hashtable_nick_prefixes)
{
weechat_hashtable_free (irc_config_hashtable_nick_prefixes);
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index e4202698c..d853058e3 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -59,13 +59,13 @@ const char *
irc_ctcp_get_default_reply (const char *ctcp)
{
int i;
-
+
for (i = 0; irc_ctcp_default_reply[i].name; i++)
{
if (weechat_strcasecmp (irc_ctcp_default_reply[i].name, ctcp) == 0)
return irc_ctcp_default_reply[i].reply;
}
-
+
/* unknown CTCP */
return NULL;
}
@@ -81,21 +81,21 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
char option_name[512];
snprintf (option_name, sizeof (option_name), "%s.%s", server->name, ctcp);
-
+
/* search for CTCP in config file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
option_name);
if (ptr_option)
return weechat_config_string (ptr_option);
-
+
/* search for CTCP in config file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
ctcp);
if (ptr_option)
return weechat_config_string (ptr_option);
-
+
/*
* no CTCP reply found in config, then return default reply, or NULL
* for unknown CTCP
@@ -119,7 +119,7 @@ irc_ctcp_display_request (struct t_irc_server *server,
if (reply && !reply[0]
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
-
+
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp", NULL),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
@@ -147,13 +147,13 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
char *pos_end, *pos_space, *pos_args, *pos_usec;
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
-
+
while (arguments && arguments[0])
{
pos_end = strchr (arguments + 1, '\01');
if (pos_end)
pos_end[0] = '\0';
-
+
pos_space = strchr (arguments + 1, ' ');
if (pos_space)
{
@@ -169,16 +169,16 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
if (pos_usec)
{
pos_usec[0] = '\0';
-
+
gettimeofday (&tv, NULL);
sec1 = atol (pos_args);
usec1 = atol (pos_usec + 1);
sec2 = tv.tv_sec;
usec2 = tv.tv_usec;
-
+
difftime = ((sec2 * 1000000) + usec2) -
((sec1 * 1000000) + usec1);
-
+
weechat_printf_tags (server->buffer,
irc_protocol_tags (command,
"irc_ctcp",
@@ -196,7 +196,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
(difftime % 1000000) / 1000,
(NG_("second", "seconds",
(difftime / 1000000))));
-
+
pos_usec[0] = ' ';
}
}
@@ -234,10 +234,10 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
"",
"");
}
-
+
if (pos_end)
pos_end[0] = '\01';
-
+
arguments = (pos_end) ? pos_end + 1 : NULL;
}
}
@@ -257,7 +257,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
int number;
char hash_key[32];
const char *str_args;
-
+
hashtable = irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
@@ -265,7 +265,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
nick, ctcp,
(arguments) ? " " : "",
(arguments) ? arguments : "");
-
+
if (hashtable)
{
if (weechat_config_boolean (irc_config_look_display_ctcp_reply))
@@ -311,7 +311,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
time_t now;
char buf[1024];
struct utsname *buf_uname;
-
+
/* clientinfo */
temp = weechat_string_replace (format, "$clientinfo",
"ACTION DCC CLIENTINFO FINGER PING SOURCE "
@@ -319,7 +319,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* version */
info = weechat_info_get ("version", "");
temp = weechat_string_replace (res, "$version", info);
@@ -327,7 +327,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* compilation date */
info = weechat_info_get ("date", "");
temp = weechat_string_replace (res, "$compilation", info);
@@ -335,7 +335,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* info about OS */
buf_uname = (struct utsname *)malloc (sizeof (struct utsname));
if (buf_uname && (uname (buf_uname) >= 0))
@@ -350,7 +350,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
return NULL;
res = temp;
}
-
+
/* site */
info = weechat_info_get ("weechat_site", "");
temp = weechat_string_replace (res, "$site", info);
@@ -358,7 +358,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* site (download page) */
info = weechat_info_get ("weechat_site_download", "");
temp = weechat_string_replace (res, "$download", info);
@@ -366,7 +366,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* time */
now = time (NULL);
snprintf (buf, sizeof (buf), "%s", ctime (&now));
@@ -376,7 +376,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* username */
temp = weechat_string_replace (res, "$username",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME));
@@ -384,7 +384,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* realname */
temp = weechat_string_replace (res, "$realname",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME));
@@ -392,7 +392,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* return result */
return res;
}
@@ -429,10 +429,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
struct t_infolist *infolist;
struct t_infolist_item *item;
char charset_modifier[256];
-
+
if (!arguments || !arguments[0])
return;
-
+
if (strncmp (arguments, "SEND ", 5) == 0)
{
arguments += 5;
@@ -441,7 +441,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -451,14 +451,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
IRC_PLUGIN_NAME, "privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for file size */
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
@@ -470,7 +470,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_size;
pos_size++;
while (pos[0] == ' ')
@@ -478,7 +478,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -490,7 +490,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_port;
pos_port++;
while (pos[0] == ' ')
@@ -498,7 +498,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC IP address */
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
@@ -510,7 +510,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_addr;
pos_addr++;
while (pos[0] == ' ')
@@ -518,10 +518,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* add DCC file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -548,14 +548,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "RESUME ", 7) == 0)
@@ -566,7 +566,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -576,14 +576,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
IRC_PLUGIN_NAME, "privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
@@ -602,7 +602,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -621,10 +621,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* accept resume via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -645,14 +645,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "ACCEPT ", 7) == 0)
@@ -663,7 +663,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -673,14 +673,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
@@ -699,7 +699,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -718,10 +718,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* resume file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -742,14 +742,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "CHAT ", 5) == 0)
@@ -760,7 +760,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -770,14 +770,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"privmsg");
return;
}
-
+
/* CHAT type */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* DCC IP address */
pos_addr = strchr (pos_file, ' ');
if (!pos_addr)
@@ -795,7 +795,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
{
pos_addr++;
}
-
+
/* look for DCC port */
pos_port = strchr (pos_addr, ' ');
if (!pos_port)
@@ -813,7 +813,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
{
pos_port++;
}
-
+
if (weechat_strcasecmp (pos_file, "chat") != 0)
{
weechat_printf (server->buffer,
@@ -828,7 +828,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
/* add DCC chat via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -854,11 +854,11 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
free (dcc_args);
}
}
@@ -879,13 +879,13 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
int nick_is_me;
-
+
while (arguments && arguments[0])
{
pos_end = strrchr (arguments + 1, '\01');
if (pos_end)
pos_end[0] = '\0';
-
+
pos_args = NULL;
pos_space = strchr (arguments + 1, ' ');
if (pos_space)
@@ -897,14 +897,14 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
pos_args++;
}
}
-
+
/* CTCP ACTION */
if (strcmp (arguments + 1, "ACTION") == 0)
{
if (channel)
{
ptr_nick = irc_nick_search (channel, nick);
-
+
irc_channel_nick_speaking_add (channel,
nick,
(pos_args) ?
@@ -913,7 +913,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
irc_channel_nick_speaking_time_remove_old (channel);
irc_channel_nick_speaking_time_add (channel, nick,
time (NULL));
-
+
weechat_printf_tags (channel->buffer,
irc_protocol_tags (command,
"irc_action,notify_message",
@@ -948,7 +948,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
@@ -994,7 +994,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
irc_ctcp_display_request (server, command, channel, nick,
arguments + 1, pos_args, reply);
-
+
if (reply[0])
{
decoded_reply = irc_ctcp_replace_variables (server, reply);
@@ -1028,17 +1028,17 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
}
}
}
-
+
weechat_hook_signal_send ("irc_ctcp",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (pos_space)
pos_space[0] = ' ';
-
+
if (pos_end)
pos_end[0] = '\01';
-
+
arguments = (pos_end) ? pos_end + 1 : NULL;
}
}
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index 6c48a5a21..1bf81cbff 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -44,23 +44,23 @@ irc_debug_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, IRC_PLUGIN_NAME) == 0))
{
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
irc_server_print_log ();
irc_ignore_print_log ();
irc_redirect_pattern_print_log ();
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index 6e6962593..87bfd88e9 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -46,7 +46,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
{
char *pos_nickserv, *pos, *pos_pwd, *pos_space;
int char_size;
-
+
pos = string;
while (pos)
{
@@ -110,7 +110,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
{
pos_pwd++;
}
-
+
while (pos_pwd && pos_pwd[0] && (pos_pwd[0] != ' '))
{
char_size = weechat_utf8_char_size (pos_pwd);
@@ -132,7 +132,7 @@ irc_display_away (struct t_irc_server *server, const char *string1,
const char *string2)
{
struct t_irc_channel *ptr_channel;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index ee9350c9b..4657d12f4 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -46,17 +46,17 @@ int
irc_ignore_valid (struct t_irc_ignore *ignore)
{
struct t_irc_ignore *ptr_ignore;
-
+
if (!ignore)
return 0;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
if (ptr_ignore == ignore)
return 1;
}
-
+
/* ignore not found */
return 0;
}
@@ -70,12 +70,12 @@ irc_ignore_search (const char *mask, const char *server, const char *channel)
{
struct t_irc_ignore *ptr_ignore;
char any[2] = "*";
-
+
if (!server)
server = any;
if (!channel)
channel = any;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -86,7 +86,7 @@ irc_ignore_search (const char *mask, const char *server, const char *channel)
return ptr_ignore;
}
}
-
+
/* ignore not found */
return NULL;
}
@@ -99,14 +99,14 @@ struct t_irc_ignore *
irc_ignore_search_by_number (int number)
{
struct t_irc_ignore *ptr_ignore;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
if (ptr_ignore->number == number)
return ptr_ignore;
}
-
+
/* ignore not found */
return NULL;
}
@@ -121,14 +121,14 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
struct t_irc_ignore *new_ignore;
regex_t *regex;
char *complete_mask;
-
+
if (!mask || !mask[0])
return NULL;
-
+
complete_mask = malloc (1 + strlen (mask) + 1 + 1);
if (!complete_mask)
return NULL;
-
+
if (mask[0] == '^')
strcpy (complete_mask, mask);
else
@@ -145,14 +145,14 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
free (complete_mask);
return NULL;
}
-
+
if (regcomp (regex, complete_mask, REG_NOSUB | REG_ICASE) != 0)
{
free (regex);
free (complete_mask);
return NULL;
}
-
+
new_ignore = malloc (sizeof (*new_ignore));
if (new_ignore)
{
@@ -161,7 +161,7 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
new_ignore->regex_mask = regex;
new_ignore->server = (server) ? strdup (server) : strdup ("*");
new_ignore->channel = (channel) ? strdup (channel) : strdup ("*");
-
+
/* add ignore to ignore list */
new_ignore->prev_ignore = last_irc_ignore;
if (irc_ignore_list)
@@ -171,9 +171,9 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
last_irc_ignore = new_ignore;
new_ignore->next_ignore = NULL;
}
-
+
free (complete_mask);
-
+
return new_ignore;
}
@@ -190,29 +190,29 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
{
struct t_irc_ignore *ptr_ignore;
int server_match, channel_match;
-
+
if (!server)
return 0;
-
+
/*
* if nick is the same as server, then we will not ignore
* (it is possible when connected to an irc proxy)
*/
if (nick && server->nick && (strcmp (server->nick, nick) == 0))
return 0;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
server_match = 0;
channel_match = 0;
-
+
if (!server || (strcmp (ptr_ignore->server, "*") == 0))
server_match = 1;
else
server_match = (weechat_strcasecmp (ptr_ignore->server,
server->name) == 0);
-
+
if (!channel || (strcmp (ptr_ignore->channel, "*") == 0))
channel_match = 1;
else
@@ -228,7 +228,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
nick) == 0);
}
}
-
+
if (server_match && channel_match)
{
if (nick && (regexec (ptr_ignore->regex_mask, nick, 0, NULL, 0) == 0))
@@ -237,7 +237,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
return 1;
}
}
-
+
return 0;
}
@@ -249,17 +249,17 @@ void
irc_ignore_free (struct t_irc_ignore *ignore)
{
struct t_irc_ignore *ptr_ignore;
-
+
weechat_hook_signal_send ("irc_ignore_removing",
WEECHAT_HOOK_SIGNAL_POINTER, ignore);
-
+
/* decrement number for all ignore after this one */
for (ptr_ignore = ignore->next_ignore; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
ptr_ignore->number--;
}
-
+
/* free data */
if (ignore->mask)
free (ignore->mask);
@@ -272,7 +272,7 @@ irc_ignore_free (struct t_irc_ignore *ignore)
free (ignore->server);
if (ignore->channel)
free (ignore->channel);
-
+
/* remove ignore from list */
if (ignore->prev_ignore)
(ignore->prev_ignore)->next_ignore = ignore->next_ignore;
@@ -282,9 +282,9 @@ irc_ignore_free (struct t_irc_ignore *ignore)
irc_ignore_list = ignore->next_ignore;
if (last_irc_ignore == ignore)
last_irc_ignore = ignore->prev_ignore;
-
+
free (ignore);
-
+
weechat_hook_signal_send ("irc_ignore_removed",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -310,10 +310,10 @@ struct t_hdata *
irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
if (hdata)
{
@@ -340,21 +340,21 @@ irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !ignore)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "mask", ignore->mask))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "server", ignore->server))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "channel", ignore->channel))
return 0;
-
+
return 1;
}
@@ -366,7 +366,7 @@ void
irc_ignore_print_log ()
{
struct t_irc_ignore *ptr_ignore;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
diff --git a/src/plugins/irc/irc-ignore.h b/src/plugins/irc/irc-ignore.h
index e52300e59..953c1cafa 100644
--- a/src/plugins/irc/irc-ignore.h
+++ b/src/plugins/irc/irc-ignore.h
@@ -56,5 +56,5 @@ extern struct t_hdata *irc_ignore_hdata_ignore_cb (void *data,
extern int irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore);
extern void irc_ignore_print_log ();
-
+
#endif /* __WEECHAT_IRC_IGNORE_H */
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c
index 262b9f3b8..2be3bf3e9 100644
--- a/src/plugins/irc/irc-info.c
+++ b/src/plugins/irc/irc-info.c
@@ -74,10 +74,10 @@ irc_info_get_info_cb (void *data, const char *info_name,
static char str_true[2] = "1";
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
-
+
if (weechat_strcasecmp (info_name, "irc_is_channel") == 0)
{
if (irc_channel_is_channel (arguments))
@@ -118,7 +118,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
host = NULL;
ptr_server = NULL;
ptr_channel = NULL;
-
+
pos_comma = strchr (arguments, ',');
if (pos_comma)
{
@@ -140,7 +140,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
else
server = strdup (arguments);
}
-
+
/*
* replace channel by nick in host if channel is not a channel
* (private ?)
@@ -154,10 +154,10 @@ irc_info_get_info_cb (void *data, const char *info_name,
nick = irc_message_get_nick_from_host (host);
if (nick)
channel = strdup (nick);
-
+
}
}
-
+
/* search for server or channel buffer */
if (server)
{
@@ -165,14 +165,14 @@ irc_info_get_info_cb (void *data, const char *info_name,
if (ptr_server && channel)
ptr_channel = irc_channel_search (ptr_server, channel);
}
-
+
if (server)
free (server);
if (channel)
free (channel);
if (host)
free (host);
-
+
if (ptr_channel)
{
irc_info_create_string_with_pointer (&ptr_channel->buffer_as_string,
@@ -227,7 +227,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
}
return isupport_value;
}
-
+
return NULL;
}
@@ -243,13 +243,13 @@ irc_info_get_info_hashtable_cb (void *data, const char *info_name,
const char *server, *message;
struct t_irc_server *ptr_server;
struct t_hashtable *value;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!hashtable)
return NULL;
-
+
if (weechat_strcasecmp (info_name, "irc_message_parse") == 0)
{
message = weechat_hashtable_get (hashtable, "message");
@@ -270,7 +270,7 @@ irc_info_get_info_hashtable_cb (void *data, const char *info_name,
return value;
}
}
-
+
return NULL;
}
@@ -290,18 +290,18 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
struct t_irc_notify *ptr_notify;
char **argv;
int argc;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "irc_server") == 0)
{
if (pointer && !irc_server_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -367,7 +367,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_channel_valid (ptr_server, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -441,7 +441,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_nick_valid (ptr_channel, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -480,7 +480,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_ignore_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -514,7 +514,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_notify_valid (NULL, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -553,7 +553,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
@@ -601,7 +601,7 @@ irc_info_init ()
N_("value of feature, if supported by server (from IRC message 005)"),
N_("server,feature"),
&irc_info_get_info_cb, NULL);
-
+
/* info_hashtable hooks */
weechat_hook_info_hashtable ("irc_message_parse",
N_("parse an IRC message"),
@@ -622,7 +622,7 @@ irc_info_init ()
"messages, "
"\"count\": number of messages"),
&irc_info_get_info_hashtable_cb, NULL);
-
+
/* infolist hooks */
weechat_hook_infolist ("irc_server",
N_("list of IRC servers"),
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index 0a1b7b5ec..97d40c4cb 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -46,19 +46,19 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
-
+
text_decoded = irc_color_decode (text,
weechat_config_boolean (irc_config_network_colors_send));
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick);
else
ptr_nick = NULL;
-
+
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg",
"notify_none,no_highlight",
@@ -70,7 +70,7 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
IRC_COLOR_CHAT_NICK_SELF),
(text_decoded) ? text_decoded : text);
}
-
+
if (text_decoded)
free (text_decoded);
}
@@ -89,12 +89,12 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
int number;
char hash_key[32], *str_args;
struct t_hashtable *hashtable;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (!ptr_server || !ptr_channel || !message || !message[0])
return;
-
+
if (!ptr_server->is_connected)
{
weechat_printf (buffer,
@@ -132,9 +132,9 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
{
const char *ptr_data;
char *data_with_colors, *msg;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (buffer == irc_raw_buffer)
{
if (weechat_strcasecmp (input_data, "q") == 0)
@@ -156,7 +156,7 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
}
return WEECHAT_RC_OK;
}
-
+
if (ptr_channel)
{
ptr_data = weechat_string_input_for_buffer (input_data);
@@ -164,14 +164,14 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
ptr_data = input_data;
data_with_colors = irc_color_encode (ptr_data,
weechat_config_boolean (irc_config_network_colors_send));
-
+
msg = strdup ((data_with_colors) ? data_with_colors : ptr_data);
if (msg)
{
irc_input_send_user_message (buffer, flags, NULL, msg);
free (msg);
}
-
+
if (data_with_colors)
free (data_with_colors);
}
@@ -182,7 +182,7 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -196,7 +196,7 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) data;
-
+
return irc_input_data (buffer, input_data, IRC_SERVER_SEND_OUTQ_PRIO_HIGH);
}
@@ -226,14 +226,14 @@ irc_input_send_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
ptr_string = (const char *)signal_data;
-
+
server = NULL;
channel = NULL;
flags = NULL;
@@ -241,7 +241,7 @@ irc_input_send_cb (void *data, const char *signal,
ptr_message = NULL;
ptr_server = NULL;
ptr_channel = NULL;
-
+
pos_semicol1 = strchr (ptr_string, ';');
if (pos_semicol1)
{
@@ -278,7 +278,7 @@ irc_input_send_cb (void *data, const char *signal,
}
}
}
-
+
flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH;
if (flags)
{
@@ -287,7 +287,7 @@ irc_input_send_cb (void *data, const char *signal,
if (flags_value < 0)
flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH;
}
-
+
if (server && ptr_message)
{
ptr_server = irc_server_search (server);
@@ -300,10 +300,10 @@ irc_input_send_cb (void *data, const char *signal,
if (ptr_channel)
ptr_buffer = ptr_channel->buffer;
}
-
+
/* set tags to use by default */
irc_server_set_send_default_tags (tags);
-
+
/* send text to buffer, or execute command */
if (weechat_string_input_for_buffer (ptr_message))
{
@@ -320,12 +320,12 @@ irc_input_send_cb (void *data, const char *signal,
if (data_with_colors)
free (data_with_colors);
}
-
+
/* reset tags to use by default */
irc_server_set_send_default_tags (NULL);
}
}
-
+
if (server)
free (server);
if (channel)
@@ -334,6 +334,6 @@ irc_input_send_cb (void *data, const char *signal,
free (flags);
if (tags)
free (tags);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c
index dcb7105e2..404c947b9 100644
--- a/src/plugins/irc/irc-message.c
+++ b/src/plugins/irc/irc-message.c
@@ -41,7 +41,7 @@ irc_message_parse (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
const char *pos, *pos2, *pos3, *pos4, *pos5;
-
+
if (nick)
*nick = NULL;
if (host)
@@ -52,10 +52,10 @@ irc_message_parse (const char *message, char **nick, char **host,
*channel = NULL;
if (arguments)
*arguments = NULL;
-
+
if (!message)
return;
-
+
/*
* we will use this message as example:
* :FlashCode!n=FlashCod@host.com PRIVMSG #channel :hello!
@@ -177,9 +177,9 @@ irc_message_parse_to_hashtable (const char *message)
char *nick, *host, *command, *channel, *arguments;
char empty_str[1] = { '\0' };
struct t_hashtable *hashtable;
-
+
irc_message_parse (message, &nick, &host, &command, &channel, &arguments);
-
+
hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -187,13 +187,13 @@ irc_message_parse_to_hashtable (const char *message)
NULL);
if (!hashtable)
return NULL;
-
+
weechat_hashtable_set (hashtable, "nick", (nick) ? nick : empty_str);
weechat_hashtable_set (hashtable, "host", (host) ? host : empty_str);
weechat_hashtable_set (hashtable, "command", (command) ? command : empty_str);
weechat_hashtable_set (hashtable, "channel", (channel) ? channel : empty_str);
weechat_hashtable_set (hashtable, "arguments", (arguments) ? arguments : empty_str);
-
+
if (nick)
free (nick);
if (host)
@@ -204,7 +204,7 @@ irc_message_parse_to_hashtable (const char *message)
free (channel);
if (arguments)
free (arguments);
-
+
return hashtable;
}
@@ -218,10 +218,10 @@ irc_message_get_nick_from_host (const char *host)
static char nick[128];
char host2[128], *pos_space, *pos;
const char *ptr_host;
-
+
if (!host)
return NULL;
-
+
nick[0] = '\0';
if (host)
{
@@ -238,10 +238,10 @@ irc_message_get_nick_from_host (const char *host)
snprintf (host2, sizeof (host2), "%s", host);
ptr_host = host2;
}
-
+
if (ptr_host[0] == ':')
ptr_host++;
-
+
pos = strchr (ptr_host, '!');
if (pos && (pos - ptr_host < (int)sizeof (nick)))
{
@@ -253,7 +253,7 @@ irc_message_get_nick_from_host (const char *host)
snprintf (nick, sizeof (nick), "%s", ptr_host);
}
}
-
+
return nick;
}
@@ -267,7 +267,7 @@ irc_message_get_address_from_host (const char *host)
static char address[256];
char host2[256], *pos_space, *pos;
const char *ptr_host;
-
+
address[0] = '\0';
if (host)
{
@@ -284,7 +284,7 @@ irc_message_get_address_from_host (const char *host)
snprintf (host2, sizeof (host2), "%s", host);
ptr_host = host2;
}
-
+
if (ptr_host[0] == ':')
ptr_host++;
pos = strchr (ptr_host, '!');
@@ -293,7 +293,7 @@ irc_message_get_address_from_host (const char *host)
else
snprintf (address, sizeof (address), "%s", ptr_host);
}
-
+
return address;
}
@@ -310,31 +310,31 @@ irc_message_replace_vars (struct t_irc_server *server,
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
char *res, *temp;
-
+
var_nick = (server && server->nick) ? server->nick : empty_string;
var_channel = (channel) ? channel->name : empty_string;
var_server = (server) ? server->name : empty_string;
-
+
/* replace nick */
temp = weechat_string_replace (string, "$nick", var_nick);
if (!temp)
return NULL;
res = temp;
-
+
/* replace channel */
temp = weechat_string_replace (res, "$channel", var_channel);
free (res);
if (!temp)
return NULL;
res = temp;
-
+
/* replace server */
temp = weechat_string_replace (res, "$server", var_server);
free (res);
if (!temp)
return NULL;
res = temp;
-
+
/* return result */
return res;
}
@@ -348,7 +348,7 @@ irc_message_split_add (struct t_hashtable *hashtable, int number,
const char *message, const char *arguments)
{
char key[32], value[32];
-
+
if (message)
{
snprintf (key, sizeof (key), "msg%d", number);
@@ -398,7 +398,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
const char *pos, *pos_max, *pos_next, *pos_last_delim;
char message[1024], *dup_arguments;
int max_length, number;
-
+
/*
* Examples of arguments for this function:
*
@@ -420,7 +420,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
* arguments: "is eating"
* suffix : "\01"
*/
-
+
max_length = 510;
if (max_length_host >= 0)
max_length -= max_length_host;
@@ -433,10 +433,10 @@ irc_message_split_string (struct t_hashtable *hashtable,
max_length -= strlen (prefix);
if (suffix)
max_length -= strlen (suffix);
-
+
if (max_length < 2)
return 0;
-
+
/* debug message */
if (weechat_irc_plugin->debug >= 2)
{
@@ -447,9 +447,9 @@ irc_message_split_string (struct t_hashtable *hashtable,
host, command, target, prefix, arguments, suffix,
max_length);
}
-
+
number = 1;
-
+
if (!arguments || !arguments[0])
{
snprintf (message, sizeof (message), "%s%s%s %s%s%s%s",
@@ -463,7 +463,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
irc_message_split_add (hashtable, 1, message, "");
return 1;
}
-
+
while (arguments && arguments[0])
{
pos = arguments;
@@ -498,7 +498,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
}
arguments = (pos == pos_last_delim) ? pos + 1 : pos;
}
-
+
return 1;
}
@@ -516,14 +516,14 @@ irc_message_split_join (struct t_hashtable *hashtable,
int length_to_add, index_channel;
char **channels, **keys, *pos, *str;
char msg_to_send[2048], keys_to_add[2048];
-
+
number = 1;
-
+
channels = NULL;
channels_count = 0;
keys = NULL;
keys_count = 0;
-
+
pos = strchr (arguments, ' ');
if (pos)
{
@@ -543,7 +543,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
{
channels = weechat_string_split (arguments, ",", 0, 0, &channels_count);
}
-
+
snprintf (msg_to_send, sizeof (msg_to_send), "%s%sJOIN",
(host) ? host : "",
(host) ? " " : "");
@@ -589,7 +589,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
keys_to_add[0] = '\0';
}
}
-
+
if (length > length_no_channel)
{
strcat (msg_to_send, keys_to_add);
@@ -597,12 +597,12 @@ irc_message_split_join (struct t_hashtable *hashtable,
msg_to_send,
msg_to_send + length_no_channel + 1);
}
-
+
if (channels)
weechat_string_free_split (channels);
if (keys)
weechat_string_free_split (keys);
-
+
return 1;
}
@@ -620,7 +620,7 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
{
char prefix[512], suffix[2], *pos, saved_char;
int length, rc;
-
+
/*
* message sent looks like:
* PRIVMSG #channel :hello world!
@@ -628,7 +628,7 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
* when IRC server sends message to other people, message looks like:
* :nick!user@host.com PRIVMSG #channel :hello world!
*/
-
+
/* for CTCP, prefix will be ":\01xxxx " and suffix "\01" */
prefix[0] = '\0';
suffix[0] = '\0';
@@ -652,11 +652,11 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
}
if (!prefix[0])
strcpy (prefix, ":");
-
+
rc = irc_message_split_string (hashtable, host, command, target,
prefix, arguments, suffix,
' ', max_length_host);
-
+
return rc;
}
@@ -670,7 +670,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
char *host, char *command, char *target, char *arguments)
{
char *pos, suffix[512];
-
+
/*
* 005 message looks like:
* :server 005 mynick MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10
@@ -678,7 +678,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
* CHANTYPES=# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer
* :are available on this server
*/
-
+
/* search suffix */
suffix[0] = '\0';
pos = strstr (arguments, " :");
@@ -687,7 +687,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
snprintf (suffix, sizeof (suffix), "%s", pos);
pos[0] = '\0';
}
-
+
return irc_message_split_string (hashtable, host, command, target,
NULL, arguments, suffix, ' ', -1);
}
@@ -713,7 +713,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
struct t_hashtable *hashtable;
char **argv, **argv_eol, *host, *command, *arguments, target[512];
int split_ok, argc, index_args, max_length_nick, max_length_host;
-
+
split_ok = 0;
host = NULL;
command = NULL;
@@ -721,11 +721,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
index_args = 0;
argv = NULL;
argv_eol = NULL;
-
+
/* debug message */
if (weechat_irc_plugin->debug >= 2)
weechat_printf (NULL, "irc_message_split: message='%s'", message);
-
+
hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -733,16 +733,16 @@ irc_message_split (struct t_irc_server *server, const char *message)
NULL);
if (!hashtable)
return NULL;
-
+
if (!message || !message[0])
goto end;
-
+
argv = weechat_string_split (message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (message, " ", 2, 0, NULL);
-
+
if (argc < 2)
goto end;
-
+
if (argv[0][0] == ':')
{
if (argc < 3)
@@ -758,7 +758,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
arguments = argv_eol[1];
index_args = 1;
}
-
+
max_length_nick = (server && (server->nick_max_length > 0)) ?
server->nick_max_length : 16;
max_length_host = 1 + /* ":" */
@@ -841,18 +841,18 @@ irc_message_split (struct t_irc_server *server, const char *message)
}
}
}
-
+
end:
if (!split_ok
|| (weechat_hashtable_get_integer (hashtable, "items_count") == 0))
{
irc_message_split_add (hashtable, 1, message, arguments);
}
-
+
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
-
+
return hashtable;
}
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 009a4e5e5..86fd13290 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -46,12 +46,12 @@ irc_mode_channel_set (struct t_irc_server *server,
char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg;
int modes_count, channel_modes_updated, argc, current_arg;
struct t_irc_nick *ptr_nick;
-
+
if (!server || !channel || !modes)
return 0;
-
+
channel_modes_updated = 0;
-
+
argc = 0;
argv = NULL;
pos_args = strchr (modes, ' ');
@@ -85,7 +85,7 @@ irc_mode_channel_set (struct t_irc_server *server,
pos++;
}
current_arg = argc - modes_count;
-
+
if (str_modes && str_modes[0])
{
set_flag = '+';
@@ -158,14 +158,14 @@ irc_mode_channel_set (struct t_irc_server *server,
pos++;
}
}
-
+
if (str_modes)
free (str_modes);
if (argv)
weechat_string_free_split (argv);
-
+
weechat_bar_item_update ("buffer_name");
-
+
return channel_modes_updated;
}
@@ -180,7 +180,7 @@ irc_mode_user_add (struct t_irc_server *server, char mode)
str_mode[0] = mode;
str_mode[1] = '\0';
-
+
if (server->nick_modes)
{
if (!strchr (server->nick_modes, mode))
@@ -218,7 +218,7 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
{
char *pos, *nick_modes2;
int new_size;
-
+
if (server->nick_modes)
{
pos = strchr (server->nick_modes, mode);
diff --git a/src/plugins/irc/irc-msgbuffer.c b/src/plugins/irc/irc-msgbuffer.c
index 0e5291cc0..651e41000 100644
--- a/src/plugins/irc/irc-msgbuffer.c
+++ b/src/plugins/irc/irc-msgbuffer.c
@@ -50,7 +50,7 @@ irc_msgbuffer_get_option (struct t_irc_server *server, const char *message)
{
snprintf (option_name, sizeof (option_name),
"%s.%s", server->name, message);
-
+
/* search for msgbuffer in config file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_msgbuffer,
@@ -58,14 +58,14 @@ irc_msgbuffer_get_option (struct t_irc_server *server, const char *message)
if (ptr_option)
return ptr_option;
}
-
+
/* search for msgbuffer in config file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_msgbuffer,
message);
if (ptr_option)
return ptr_option;
-
+
/* no msgbuffer found in config */
return NULL;
}
@@ -92,18 +92,18 @@ irc_msgbuffer_get_target_buffer (struct t_irc_server *server, const char *nick,
struct t_gui_buffer *ptr_buffer;
struct t_irc_channel *ptr_channel;
struct t_weechat_plugin *buffer_plugin;
-
+
ptr_option = irc_msgbuffer_get_option (server, message);
if (!ptr_option && alias && alias[0])
ptr_option = irc_msgbuffer_get_option (server, alias);
-
+
if (!ptr_option)
{
if (default_buffer)
return default_buffer;
return (server) ? server->buffer : NULL;
}
-
+
target = weechat_config_integer (ptr_option);
switch (target)
{
@@ -129,11 +129,11 @@ irc_msgbuffer_get_target_buffer (struct t_irc_server *server, const char *nick,
return (server) ? server->buffer : NULL;
break;
}
-
+
ptr_buffer = weechat_current_buffer ();
buffer_plugin = weechat_buffer_get_pointer (ptr_buffer, "plugin");
if (buffer_plugin == weechat_irc_plugin)
return ptr_buffer;
-
+
return (server) ? server->buffer : NULL;
}
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index eeb7042bf..9d94e28c3 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -47,16 +47,16 @@ int
irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick)
{
struct t_irc_nick *ptr_nick;
-
+
if (!channel)
return 0;
-
+
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
if (ptr_nick == nick)
return 1;
}
-
+
/* nick not found */
return 0;
}
@@ -71,22 +71,22 @@ int
irc_nick_is_nick (const char *string)
{
const char *ptr;
-
+
if (!string || !string[0])
return 0;
-
+
/* first char must not be a number or hyphen */
ptr = string;
if (strchr ("0123456789-", *ptr))
return 0;
-
+
while (ptr && ptr[0])
{
if (!strchr (IRC_NICK_VALID_CHARS, *ptr))
return 0;
ptr++;
}
-
+
return 1;
}
@@ -100,7 +100,7 @@ irc_nick_strdup_for_color (const char *nickname)
{
int char_size, other_char_seen;
char *result, *pos, utf_char[16];
-
+
result = malloc (strlen (nickname) + 1);
pos = result;
other_char_seen = 0;
@@ -109,7 +109,7 @@ irc_nick_strdup_for_color (const char *nickname)
char_size = weechat_utf8_char_size (nickname);
memcpy (utf_char, nickname, char_size);
utf_char[char_size] = '\0';
-
+
if (strstr (weechat_config_string (irc_config_look_nick_color_stop_chars),
utf_char))
{
@@ -125,7 +125,7 @@ irc_nick_strdup_for_color (const char *nickname)
}
memcpy (pos, utf_char, char_size);
pos += char_size;
-
+
nickname += char_size;
}
pos[0] = '\0';
@@ -141,13 +141,13 @@ irc_nick_hash_color (const char *nickname)
{
int color;
const char *ptr_nick;
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return 0;
-
+
color = 0;
ptr_nick = nickname;
while (ptr_nick && ptr_nick[0])
@@ -155,7 +155,7 @@ irc_nick_hash_color (const char *nickname)
color += weechat_utf8_char_int (ptr_nick);
ptr_nick = weechat_utf8_next_char (ptr_nick);
}
-
+
return (color % irc_config_num_nick_colors);
}
@@ -170,15 +170,15 @@ irc_nick_find_color (const char *nickname)
int color;
char *nickname2;
const char *forced_color, *str_color;
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return weechat_color ("default");
-
+
nickname2 = irc_nick_strdup_for_color (nickname);
-
+
/* look if color is forced */
forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force,
(nickname2) ? nickname2 : nickname);
@@ -192,12 +192,12 @@ irc_nick_find_color (const char *nickname)
return forced_color;
}
}
-
+
/* hash nickname to get color */
color = irc_nick_hash_color ((nickname2) ? nickname2 : nickname);
if (nickname2)
free (nickname2);
-
+
/* return color */
str_color = weechat_color (irc_config_nick_colors[color]);
return (str_color[0]) ? str_color : weechat_color("default");
@@ -215,15 +215,15 @@ irc_nick_find_color_name (const char *nickname)
char *nickname2;
const char *forced_color;
static char *default_color = "default";
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return default_color;
-
+
nickname2 = irc_nick_strdup_for_color (nickname);
-
+
/* look if color is forced */
forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force,
(nickname2) ? nickname2 : nickname);
@@ -233,12 +233,12 @@ irc_nick_find_color_name (const char *nickname)
free (nickname2);
return forced_color;
}
-
+
/* hash nickname to get color */
color = irc_nick_hash_color ((nickname2) ? nickname2 : nickname);
if (nickname2)
free (nickname2);
-
+
/* return color name */
return irc_config_nick_colors[color];
}
@@ -252,7 +252,7 @@ void
irc_nick_set_current_prefix (struct t_irc_nick *nick)
{
char *ptr_prefixes;
-
+
nick->prefix[0] = ' ';
for (ptr_prefixes = nick->prefixes; ptr_prefixes[0]; ptr_prefixes++)
{
@@ -275,7 +275,7 @@ irc_nick_set_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
int set, char prefix)
{
int index;
-
+
index = irc_server_get_prefix_char_index (server, prefix);
if (index >= 0)
{
@@ -293,10 +293,10 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
const char *prefixes)
{
const char *ptr_prefixes;
-
+
/* reset all prefixes in nick */
memset (nick->prefixes, ' ', strlen (nick->prefixes));
-
+
/* add prefixes in nick */
if (prefixes)
{
@@ -305,7 +305,7 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
irc_nick_set_prefix (server, nick, 1, ptr_prefixes[0]);
}
}
-
+
/* set current prefix */
irc_nick_set_current_prefix (nick);
}
@@ -319,14 +319,14 @@ int
irc_nick_is_op (struct t_irc_server *server, struct t_irc_nick *nick)
{
int index;
-
+
if (nick->prefix[0] == ' ')
return 0;
-
+
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
if (index < 0)
return 0;
-
+
return (index <= irc_server_get_prefix_mode_index (server, 'o')) ? 1 : 0;
}
@@ -342,11 +342,11 @@ irc_nick_has_prefix_mode (struct t_irc_server *server, struct t_irc_nick *nick,
char prefix_mode)
{
char prefix_char;
-
+
prefix_char = irc_server_get_prefix_char_for_mode (server, prefix_mode);
if (prefix_char == ' ')
return 0;
-
+
return (strchr (nick->prefixes, prefix_char)) ? 1 : 0;
}
@@ -363,10 +363,10 @@ irc_nick_get_nicklist_group (struct t_irc_server *server,
char str_group[2];
const char *prefix_modes;
struct t_gui_nick_group *ptr_group;
-
+
if (!server || !buffer || !nick)
return NULL;
-
+
ptr_group = NULL;
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
if (index < 0)
@@ -381,7 +381,7 @@ irc_nick_get_nicklist_group (struct t_irc_server *server,
str_group[1] = '\0';
ptr_group = weechat_nicklist_search_group (buffer, NULL, str_group);
}
-
+
return ptr_group;
}
@@ -397,7 +397,7 @@ irc_nick_get_prefix_color_name (struct t_irc_server *server,
const char *prefix_modes, *color;
char mode[2];
int i, index;
-
+
if (irc_config_hashtable_nick_prefixes)
{
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
@@ -425,7 +425,7 @@ irc_nick_get_prefix_color_name (struct t_irc_server *server,
return color;
}
}
-
+
/* no color by default */
return default_color;
}
@@ -441,10 +441,10 @@ irc_nick_get_color_for_nicklist (struct t_irc_server *server,
static char *nick_color_bar_fg = "bar_fg";
static char *nick_color_self = "weechat.color.chat_nick_self";
static char *nick_color_away = "weechat.color.nicklist_away";
-
+
if (nick->away)
return nick_color_away;
-
+
if (weechat_config_boolean(irc_config_look_color_nicks_in_nicklist))
{
if (weechat_strcasecmp (nick->name, server->nick) == 0)
@@ -452,7 +452,7 @@ irc_nick_get_color_for_nicklist (struct t_irc_server *server,
else
return irc_nick_find_color_name (nick->name);
}
-
+
return nick_color_bar_fg;
}
@@ -466,7 +466,7 @@ irc_nick_nicklist_add (struct t_irc_server *server,
struct t_irc_nick *nick)
{
struct t_gui_nick_group *ptr_group;
-
+
ptr_group = irc_nick_get_nicklist_group (server, channel->buffer, nick);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
nick->name,
@@ -486,7 +486,7 @@ irc_nick_nicklist_remove (struct t_irc_server *server,
struct t_irc_nick *nick)
{
struct t_gui_nick_group *ptr_group;
-
+
ptr_group = irc_nick_get_nicklist_group (server, channel->buffer, nick);
weechat_nicklist_remove_nick (channel->buffer,
weechat_nicklist_search_nick (channel->buffer,
@@ -523,7 +523,7 @@ irc_nick_nicklist_set_prefix_color_all ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -552,7 +552,7 @@ irc_nick_nicklist_set_color_all ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -580,28 +580,28 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
{
struct t_irc_nick *new_nick, *ptr_nick;
int length;
-
+
/* nick already exists on this channel? */
ptr_nick = irc_nick_search (channel, nickname);
if (ptr_nick)
{
/* remove old nick from nicklist */
irc_nick_nicklist_remove (server, channel, ptr_nick);
-
+
/* update nick */
irc_nick_set_prefixes (server, ptr_nick, prefixes);
ptr_nick->away = away;
-
+
/* add new nick in nicklist */
irc_nick_nicklist_add (server, channel, ptr_nick);
-
+
return ptr_nick;
}
-
+
/* alloc memory for new nick */
if ((new_nick = malloc (sizeof (*new_nick))) == NULL)
return NULL;
-
+
/* initialize new nick */
new_nick->name = strdup (nickname);
new_nick->host = NULL;
@@ -620,7 +620,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
new_nick->color = strdup (IRC_COLOR_CHAT_NICK_SELF);
else
new_nick->color = strdup (irc_nick_find_color (new_nick->name));
-
+
/* add nick to end of list */
new_nick->prev_nick = channel->last_nick;
if (channel->nicks)
@@ -629,14 +629,14 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
channel->nicks = new_nick;
channel->last_nick = new_nick;
new_nick->next_nick = NULL;
-
+
channel->nicks_count++;
-
+
channel->nick_completion_reset = 1;
-
+
/* add nick to buffer nicklist */
irc_nick_nicklist_add (server, channel, new_nick);
-
+
/* all is ok, return address of new nick */
return new_nick;
}
@@ -650,15 +650,15 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick, const char *new_nick)
{
int nick_is_me;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* update nicks speaking */
nick_is_me = (strcmp (nick->name, server->nick) == 0) ? 1 : 0;
if (!nick_is_me)
irc_channel_nick_speaking_rename (channel, nick->name, new_nick);
-
+
/* change nickname */
if (nick->name)
free (nick->name);
@@ -669,7 +669,7 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
nick->color = strdup (IRC_COLOR_CHAT_NICK_SELF);
else
nick->color = strdup (irc_nick_find_color (nick->name));
-
+
/* add nick in nicklist */
irc_nick_nicklist_add (server, channel, nick);
}
@@ -684,21 +684,21 @@ irc_nick_set_mode (struct t_irc_server *server, struct t_irc_channel *channel,
{
int index;
const char *prefix_chars;
-
+
index = irc_server_get_prefix_mode_index (server, mode);
if (index < 0)
return;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* set flag */
prefix_chars = irc_server_get_prefix_chars (server);
irc_nick_set_prefix (server, nick, set, prefix_chars[index]);
-
+
/* add nick in nicklist */
irc_nick_nicklist_add (server, channel, nick);
-
+
if (strcmp (nick->name, server->nick) == 0)
weechat_bar_item_update ("input_prompt");
}
@@ -712,13 +712,13 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick)
{
struct t_irc_nick *new_nicks;
-
+
if (!channel || !nick)
return;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* remove nick */
if (channel->last_nick == nick)
channel->last_nick = nick->prev_nick;
@@ -729,12 +729,12 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
}
else
new_nicks = nick->next_nick;
-
+
if (nick->next_nick)
(nick->next_nick)->prev_nick = nick->prev_nick;
-
+
channel->nicks_count--;
-
+
/* free data */
if (nick->name)
free (nick->name);
@@ -744,9 +744,9 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
free (nick->prefixes);
if (nick->color)
free (nick->color);
-
+
free (nick);
-
+
channel->nicks = new_nicks;
channel->nick_completion_reset = 1;
}
@@ -760,13 +760,13 @@ irc_nick_free_all (struct t_irc_server *server, struct t_irc_channel *channel)
{
if (!channel)
return;
-
+
/* remove all nicks for the channel */
while (channel->nicks)
{
irc_nick_free (server, channel, channel->nicks);
}
-
+
/* sould be zero, but prevent any bug :D */
channel->nicks_count = 0;
}
@@ -779,17 +779,17 @@ struct t_irc_nick *
irc_nick_search (struct t_irc_channel *channel, const char *nickname)
{
struct t_irc_nick *ptr_nick;
-
+
if (!channel || !nickname)
return NULL;
-
+
for (ptr_nick = channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
if (weechat_strcasecmp (ptr_nick->name, nickname) == 0)
return ptr_nick;
}
-
+
/* nick not found */
return NULL;
}
@@ -804,7 +804,7 @@ irc_nick_count (struct t_irc_server *server, struct t_irc_channel *channel,
int *count_normal)
{
struct t_irc_nick *ptr_nick;
-
+
(*total) = 0;
(*count_op) = 0;
(*count_halfop) = 0;
@@ -865,7 +865,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
static char result[256];
char prefix[2];
const char *str_prefix_color;
-
+
prefix[0] = (nick) ? nick->prefix[0] : '\0';
prefix[1] = '\0';
if (weechat_config_boolean (weechat_config_get ("weechat.look.nickmode")))
@@ -889,7 +889,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
prefix[0] = '\0';
str_prefix_color = IRC_COLOR_RESET;
}
-
+
snprintf (result, sizeof (result), "%s%s%s%s%s%s%s%s\t",
(weechat_config_string (irc_config_look_nick_prefix)
&& weechat_config_string (irc_config_look_nick_prefix)[0]) ?
@@ -907,7 +907,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
(weechat_config_string (irc_config_look_nick_suffix)
&& weechat_config_string (irc_config_look_nick_suffix)[0]) ?
weechat_config_string (irc_config_look_nick_suffix) : "");
-
+
return result;
}
@@ -925,7 +925,7 @@ irc_nick_color_for_pv (struct t_irc_channel *channel, const char *nickname)
if (channel->pv_remote_nick_color)
return channel->pv_remote_nick_color;
}
-
+
return IRC_COLOR_CHAT_NICK_OTHER;
}
@@ -937,10 +937,10 @@ struct t_hdata *
irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
@@ -966,14 +966,14 @@ irc_nick_add_to_infolist (struct t_infolist *infolist,
struct t_irc_nick *nick)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !nick)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", nick->name))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "host", nick->host))
@@ -986,7 +986,7 @@ irc_nick_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "color", nick->color))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 3ed15fb5b..bbdb43788 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -56,7 +56,7 @@ irc_notify_valid (struct t_irc_server *server, struct t_irc_notify *notify)
{
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify;
-
+
if (!notify)
return 0;
@@ -82,7 +82,7 @@ irc_notify_valid (struct t_irc_server *server, struct t_irc_notify *notify)
}
}
}
-
+
/* notify not found */
return 0;
}
@@ -95,17 +95,17 @@ struct t_irc_notify *
irc_notify_search (struct t_irc_server *server, const char *nick)
{
struct t_irc_notify *ptr_notify;
-
+
if (!server || !nick)
return NULL;
-
+
for (ptr_notify = server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
{
if (strcmp (ptr_notify->nick, nick) == 0)
return ptr_notify;
}
-
+
/* notify not found */
return NULL;
}
@@ -121,7 +121,7 @@ irc_notify_set_server_option (struct t_irc_server *server)
char *str, *str2;
struct t_irc_notify *ptr_notify;
int total_length, length;
-
+
if (!server)
return;
@@ -183,10 +183,10 @@ struct t_irc_notify *
irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
{
struct t_irc_notify *new_notify;
-
+
if (!server || !nick || !nick[0])
return NULL;
-
+
new_notify = malloc (sizeof (*new_notify));
if (new_notify)
{
@@ -196,7 +196,7 @@ irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
new_notify->is_on_server = 0;
new_notify->away_message = NULL;
new_notify->ison_received = 0;
-
+
/* add notify to notify list on server */
new_notify->prev_notify = server->last_notify;
if (server->notify_list)
@@ -206,7 +206,7 @@ irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
server->last_notify = new_notify;
new_notify->next_notify = NULL;
}
-
+
return new_notify;
}
@@ -221,14 +221,14 @@ irc_notify_new_for_server (struct t_irc_server *server)
const char *notify;
char **items, *pos_params, **params;
int i, j, num_items, num_params, check_away;
-
+
irc_notify_free_all (server);
-
+
notify = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NOTIFY);
-
+
if (!notify || !notify[0])
return;
-
+
items = weechat_string_split (notify, ",", 0, 0, &num_items);
if (items)
@@ -272,7 +272,7 @@ void
irc_notify_new_for_all_servers ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -289,13 +289,13 @@ irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify)
{
weechat_hook_signal_send ("irc_notify_removing",
WEECHAT_HOOK_SIGNAL_POINTER, notify);
-
+
/* free data */
if (notify->nick)
free (notify->nick);
if (notify->away_message)
free (notify->away_message);
-
+
/* remove notify from list */
if (notify->prev_notify)
(notify->prev_notify)->next_notify = notify->next_notify;
@@ -305,9 +305,9 @@ irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify)
server->notify_list = notify->next_notify;
if (server->last_notify == notify)
server->last_notify = notify->prev_notify;
-
+
free (notify);
-
+
weechat_hook_signal_send ("irc_notify_removed",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -436,13 +436,13 @@ irc_notify_get_tags (struct t_config_option *option)
{
static char string[1024];
const char *tags;
-
+
tags = weechat_config_string (option);
-
+
snprintf (string, sizeof (string), "irc_notify%s%s",
(tags && tags[0]) ? "," : "",
(tags && tags[0]) ? tags : "");
-
+
return string;
}
@@ -457,11 +457,11 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify,
{
if (!notify)
return;
-
+
/* same status, then do nothing */
if (notify->is_on_server == is_on_server)
return;
-
+
notify->is_on_server = is_on_server;
weechat_printf_tags (notify->server->buffer,
@@ -489,13 +489,13 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
{
if (!notify)
return;
-
+
/* same away message, then do nothing */
if ((!notify->away_message && !away_message)
|| (notify->away_message && away_message
&& (strcmp (notify->away_message, away_message) == 0)))
return;
-
+
if (!notify->away_message && away_message)
{
weechat_printf_tags (notify->server->buffer,
@@ -528,7 +528,7 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
IRC_COLOR_RESET,
away_message);
}
-
+
if (notify->away_message)
free (notify->away_message);
notify->away_message = (away_message) ? strdup (away_message) : NULL;
@@ -550,30 +550,30 @@ irc_notify_hsignal_cb (void *data, const char *signal,
int away_message_updated, no_such_nick;
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
error = weechat_hashtable_get (hashtable, "error");
server = weechat_hashtable_get (hashtable, "server");
pattern = weechat_hashtable_get (hashtable, "pattern");
command = weechat_hashtable_get (hashtable, "command");
output = weechat_hashtable_get (hashtable, "output");
-
+
/* if there is an error on redirection, just ignore result */
if (error && error[0])
return WEECHAT_RC_OK;
-
+
/* missing things in redirection */
if (!server || !pattern || !command || !output)
return WEECHAT_RC_OK;
-
+
/* search server */
ptr_server = irc_server_search (server);
if (!ptr_server)
return WEECHAT_RC_OK;
-
+
/* search for start of arguments in command sent to server */
ptr_args = strchr (command, ' ');
if (!ptr_args)
@@ -585,7 +585,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
}
if (!ptr_args[0])
return WEECHAT_RC_OK;
-
+
/* read output of command */
if (strcmp (pattern, "ison") == 0)
{
@@ -663,7 +663,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
irc_notify_set_is_on_server (ptr_notify, 0);
}
}
-
+
}
weechat_string_free_split (messages);
}
@@ -716,7 +716,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -733,11 +733,11 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify, *ptr_next_notify;
struct t_hashtable *hashtable;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -746,16 +746,16 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
message = malloc (7);
if (!message)
continue;
-
+
snprintf (message, 7, "ISON :");
total_length = 7;
nicks_added = 0;
-
+
ptr_notify = ptr_server->notify_list;
while (ptr_notify)
{
ptr_next_notify = ptr_notify->next_notify;
-
+
length = strlen (ptr_notify->nick);
total_length += length + 1;
message2 = realloc (message, total_length);
@@ -771,10 +771,10 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
strcat (message, " ");
strcat (message, ptr_notify->nick);
nicks_added++;
-
+
ptr_notify = ptr_next_notify;
}
-
+
if (message && (nicks_added > 0))
{
hashtable = irc_message_split (ptr_server, message);
@@ -798,12 +798,12 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
weechat_hashtable_free (hashtable);
}
}
-
+
if (message)
free (message);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -816,11 +816,11 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify, *ptr_next_notify;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -830,7 +830,7 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
while (ptr_notify)
{
ptr_next_notify = ptr_notify->next_notify;
-
+
if (ptr_notify->check_away)
{
/*
@@ -844,12 +844,12 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL,
"WHOIS :%s", ptr_notify->nick);
}
-
+
ptr_notify = ptr_next_notify;
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -861,10 +861,10 @@ struct t_hdata *
irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
if (hdata)
{
@@ -890,10 +890,10 @@ irc_notify_add_to_infolist (struct t_infolist *infolist,
struct t_irc_notify *notify)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !notify)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -910,7 +910,7 @@ irc_notify_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "away_message", notify->away_message))
return 0;
-
+
return 1;
}
@@ -922,7 +922,7 @@ void
irc_notify_print_log (struct t_irc_server *server)
{
struct t_irc_notify *ptr_notify;
-
+
for (ptr_notify = server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
{
@@ -948,7 +948,7 @@ irc_notify_hook_timer_ison ()
{
if (irc_notify_timer_ison)
weechat_unhook (irc_notify_timer_ison);
-
+
irc_notify_timer_ison = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_ison),
0, 0, &irc_notify_timer_ison_cb, NULL);
@@ -963,7 +963,7 @@ irc_notify_hook_timer_whois ()
{
if (irc_notify_timer_whois)
weechat_unhook (irc_notify_timer_whois);
-
+
irc_notify_timer_whois = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_whois),
0, 0, &irc_notify_timer_whois_cb, NULL);
@@ -978,7 +978,7 @@ irc_notify_init ()
{
irc_notify_hook_timer_ison ();
irc_notify_hook_timer_whois ();
-
+
irc_notify_hsignal = weechat_hook_hsignal ("irc_redirection_notify_*",
&irc_notify_hsignal_cb,
NULL);
diff --git a/src/plugins/irc/irc-notify.h b/src/plugins/irc/irc-notify.h
index c348c9ae3..0274d5b83 100644
--- a/src/plugins/irc/irc-notify.h
+++ b/src/plugins/irc/irc-notify.h
@@ -64,5 +64,5 @@ extern void irc_notify_hook_timer_ison ();
extern void irc_notify_hook_timer_whois ();
extern void irc_notify_init ();
extern void irc_notify_end ();
-
+
#endif /* __WEECHAT_IRC_NOTIFY_H */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index f8c5684da..65b903219 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -77,19 +77,19 @@ irc_protocol_log_level_for_command (const char *command)
{
if (!command || !command[0])
return 0;
-
+
if ((strcmp (command, "privmsg") == 0)
|| (strcmp (command, "notice") == 0))
return 1;
-
+
if (strcmp (command, "nick") == 0)
return 2;
-
+
if ((strcmp (command, "join") == 0)
|| (strcmp (command, "part") == 0)
|| (strcmp (command, "quit") == 0))
return 4;
-
+
return 3;
}
@@ -104,12 +104,12 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
static char string[1024];
int log_level;
char str_log_level[32];
-
+
str_log_level[0] = '\0';
-
+
if (!command && !tags && !nick)
return NULL;
-
+
if (command && command[0])
{
log_level = irc_protocol_log_level_for_command (command);
@@ -119,7 +119,7 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
",log%d", log_level);
}
}
-
+
snprintf (string, sizeof (string),
"%s%s%s%s%s%s%s",
(command && command[0]) ? "irc_" : "",
@@ -129,7 +129,7 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
(nick && nick[0]) ? ",nick_" : "",
(nick && nick[0]) ? nick : "",
str_log_level);
-
+
return string;
}
@@ -141,15 +141,15 @@ IRC_PROTOCOL_CALLBACK(authenticate)
{
const char *sasl_username, *sasl_password;
char *answer;
-
+
/*
* AUTHENTICATE message looks like:
* AUTHENTICATE +
* AUTHENTICATE QQDaUzXAmVffxuzFy77XWBGwABBQAgdinelBrKZaR3wE7nsIETuTVY=
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
sasl_username = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_USERNAME);
sasl_password = IRC_SERVER_OPTION_STRING(server,
@@ -186,7 +186,7 @@ IRC_PROTOCOL_CALLBACK(authenticate)
irc_server_sendf (server, 0, NULL, "CAP END");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -198,16 +198,16 @@ IRC_PROTOCOL_CALLBACK(cap)
{
char *ptr_caps, **items;
int num_items, sasl, i, timeout;
-
+
/*
* CAP message looks like:
* :server CAP * LS :identify-msg multi-prefix sasl
* :server CAP * ACK :sasl
* :server CAP * NAK :sasl
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
if (strcmp (argv[3], "LS") == 0)
{
if (argc > 4)
@@ -309,7 +309,7 @@ IRC_PROTOCOL_CALLBACK(cap)
irc_server_sendf (server, 0, NULL, "CAP END");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -320,16 +320,16 @@ IRC_PROTOCOL_CALLBACK(cap)
IRC_PROTOCOL_CALLBACK(error)
{
char *ptr_args;
-
+
/*
* ERROR message looks like:
* ERROR :Closing Link: irc.server.org (Bad Password)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
ptr_args = (argv_eol[1][0] == ':') ? argv_eol[1] + 1 : argv_eol[1];
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -337,12 +337,12 @@ IRC_PROTOCOL_CALLBACK(error)
"%s%s",
weechat_prefix ("error"),
ptr_args);
-
+
if (strncmp (ptr_args, "Closing Link", 12) == 0)
{
irc_server_disconnect (server, !server->is_connected, 1);
}
-
+
return WEECHAT_RC_OK;
}
@@ -357,16 +357,16 @@ IRC_PROTOCOL_CALLBACK(generic_error)
char *chan_nick, *args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* example of error:
* :server 404 nick #channel :Cannot send to channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
first_arg = (strcmp (argv[2], server->nick) == 0) ? 3 : 2;
-
+
if ((argv[first_arg][0] != ':') && argv[first_arg + 1])
{
chan_nick = argv[first_arg];
@@ -379,13 +379,13 @@ IRC_PROTOCOL_CALLBACK(generic_error)
}
if (args[0] == ':')
args++;
-
+
ptr_channel = NULL;
if (chan_nick)
ptr_channel = irc_channel_search (server, chan_nick);
-
+
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
ptr_buffer),
@@ -399,7 +399,7 @@ IRC_PROTOCOL_CALLBACK(generic_error)
IRC_COLOR_RESET,
(chan_nick) ? ": " : "",
args);
-
+
return WEECHAT_RC_OK;
}
@@ -413,10 +413,10 @@ IRC_PROTOCOL_CALLBACK(invite)
* INVITE message looks like:
* :nick!user@host INVITE mynick :#channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
if (!ignored)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
@@ -447,19 +447,19 @@ IRC_PROTOCOL_CALLBACK(join)
struct t_irc_channel_speaking *ptr_nick_speaking;
char *pos_channel;
int local_join, display_host;
-
+
/*
* JOIN message looks like:
* :nick!user@host JOIN :#channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
local_join = (strcmp (nick, server->nick) == 0);
-
+
pos_channel = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
-
+
ptr_channel = irc_channel_search (server, pos_channel);
if (ptr_channel)
{
@@ -473,7 +473,7 @@ IRC_PROTOCOL_CALLBACK(join)
*/
if (!local_join)
return WEECHAT_RC_OK;
-
+
ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_CHANNEL,
pos_channel, 1, 1);
if (!ptr_channel)
@@ -485,19 +485,19 @@ IRC_PROTOCOL_CALLBACK(join)
return WEECHAT_RC_ERROR;
}
}
-
+
/* remove topic and display channel creation date if joining new channel */
if (!ptr_channel->nicks)
{
irc_channel_set_topic (ptr_channel, NULL);
ptr_channel->display_creation_date = 1;
}
-
+
/* add nick in channel */
ptr_nick = irc_nick_new (server, ptr_channel, nick, NULL, 0);
if (ptr_nick)
ptr_nick->host = strdup (address);
-
+
if (!ignored)
{
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
@@ -530,12 +530,12 @@ IRC_PROTOCOL_CALLBACK(join)
IRC_COLOR_CHAT_CHANNEL,
pos_channel,
IRC_COLOR_MESSAGE_JOIN);
-
+
/* display message in private if private has flag "has_quit_server" */
if (!local_join)
irc_channel_display_nick_back_in_pv (server, ptr_nick, nick);
}
-
+
return WEECHAT_RC_OK;
}
@@ -548,25 +548,25 @@ IRC_PROTOCOL_CALLBACK(kick)
char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick, *ptr_nick_kicked;
-
+
/*
* KICK message looks like:
* :nick1!user@host KICK #channel nick2 :kick reason
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[2]);
if (!ptr_channel)
return WEECHAT_RC_OK;
-
+
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_nick_kicked = irc_nick_search (ptr_channel, argv[3]);
-
+
if (!ignored)
{
if (pos_comment)
@@ -604,7 +604,7 @@ IRC_PROTOCOL_CALLBACK(kick)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
if (strcmp (argv[3], server->nick) == 0)
{
/*
@@ -639,7 +639,7 @@ IRC_PROTOCOL_CALLBACK(kick)
if (ptr_nick_kicked)
irc_nick_free (server, ptr_channel, ptr_nick_kicked);
}
-
+
return WEECHAT_RC_OK;
}
@@ -652,24 +652,24 @@ IRC_PROTOCOL_CALLBACK(kill)
char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick, *ptr_nick_killed;
-
+
/*
* KILL message looks like:
* :nick1!user@host KILL mynick :kill reason
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_nick_killed = irc_nick_search (ptr_channel, argv[2]);
-
+
if (!ignored)
{
if (pos_comment)
@@ -703,7 +703,7 @@ IRC_PROTOCOL_CALLBACK(kill)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
if (strcmp (argv[2], server->nick) == 0)
{
/*
@@ -722,7 +722,7 @@ IRC_PROTOCOL_CALLBACK(kill)
irc_nick_free (server, ptr_channel, ptr_nick_killed);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -736,17 +736,17 @@ IRC_PROTOCOL_CALLBACK(mode)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* MODE message looks like:
* :nick!user@host MODE #test +o nick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_modes = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
-
+
if (irc_channel_is_channel (argv[2]))
{
ptr_channel = irc_channel_search (server, argv[2]);
@@ -799,7 +799,7 @@ IRC_PROTOCOL_CALLBACK(mode)
}
irc_mode_user_set (server, pos_modes, 0);
}
-
+
return WEECHAT_RC_OK;
}
@@ -814,24 +814,24 @@ IRC_PROTOCOL_CALLBACK(nick)
char *new_nick, *old_color, *buffer_name;
int local_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
-
+
/*
* NICK message looks like:
* :oldnick!user@host NICK :newnick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
new_nick = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
-
+
local_nick = (strcmp (nick, server->nick) == 0) ? 1 : 0;
-
+
if (local_nick)
irc_server_set_nick (server, new_nick);
-
+
ptr_nick_found = NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -863,14 +863,14 @@ IRC_PROTOCOL_CALLBACK(nick)
if (ptr_nick)
{
ptr_nick_found = ptr_nick;
-
+
/* temporary disable hotlist */
weechat_buffer_set (NULL, "hotlist", "-");
-
+
/* set host for nick if needed */
if (ptr_nick && !ptr_nick->host)
ptr_nick->host = strdup (address);
-
+
/* change nick and display message on all channels */
old_color = strdup (ptr_nick->color);
irc_nick_change (server, ptr_channel, ptr_nick, new_nick);
@@ -916,20 +916,20 @@ IRC_PROTOCOL_CALLBACK(nick)
irc_channel_nick_speaking_time_rename (ptr_channel,
nick, new_nick);
}
-
+
if (old_color)
free (old_color);
-
+
/* enable hotlist */
weechat_buffer_set (NULL, "hotlist", "+");
}
break;
}
}
-
+
if (!local_nick)
irc_channel_display_nick_back_in_pv (server, ptr_nick_found, new_nick);
-
+
return WEECHAT_RC_OK;
}
@@ -944,21 +944,21 @@ IRC_PROTOCOL_CALLBACK(notice)
struct t_irc_nick *ptr_nick;
int notify_private, notice_op;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* NOTICE message looks like:
* NOTICE AUTH :*** Looking up your hostname...
* :nick!user@host NOTICE mynick :notice text
* :nick!user@host NOTICE #channel :notice text
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
notice_op = 0;
-
+
if (argv[0][0] == ':')
{
if (argc < 4)
@@ -978,7 +978,7 @@ IRC_PROTOCOL_CALLBACK(notice)
pos_target = NULL;
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
-
+
if (nick && (pos_args[0] == '\01')
&& (pos_args[strlen (pos_args) - 1] == '\01'))
{
@@ -1019,7 +1019,7 @@ IRC_PROTOCOL_CALLBACK(notice)
{
notify_private = 1;
}
-
+
ptr_channel = NULL;
if (nick && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER)
{
@@ -1137,7 +1137,7 @@ IRC_PROTOCOL_CALLBACK(notice)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1152,7 +1152,7 @@ IRC_PROTOCOL_CALLBACK(part)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
-
+
/*
* PART message looks like:
* :nick!user@host PART #channel :part message
@@ -1160,13 +1160,13 @@ IRC_PROTOCOL_CALLBACK(part)
* :nick!user@host PART :#channel
* :nick!user@host PART #channel :part message
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
ptr_channel = irc_channel_search (server,
(argv[2][0] == ':') ? argv[2] + 1 : argv[2]);
if (ptr_channel)
@@ -1175,7 +1175,7 @@ IRC_PROTOCOL_CALLBACK(part)
if (ptr_nick)
{
local_part = (strcmp (nick, server->nick) == 0);
-
+
/* display part message */
if (!ignored)
{
@@ -1250,12 +1250,12 @@ IRC_PROTOCOL_CALLBACK(part)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
/* part request was issued by local client ? */
if (local_part)
{
irc_nick_free_all (server, ptr_channel);
-
+
/* cycling ? => rejoin channel immediately */
if (ptr_channel->cycle)
{
@@ -1291,7 +1291,7 @@ IRC_PROTOCOL_CALLBACK(part)
irc_nick_free (server, ptr_channel, ptr_nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1305,12 +1305,12 @@ IRC_PROTOCOL_CALLBACK(ping)
* PING message looks like:
* PING :server
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
irc_server_sendf (server, 0, NULL, "PONG :%s",
(argv[1][0] == ':') ? argv[1] + 1 : argv[1]);
-
+
return WEECHAT_RC_OK;
}
@@ -1322,9 +1322,9 @@ IRC_PROTOCOL_CALLBACK(pong)
{
struct timeval tv;
int old_lag;
-
+
IRC_PROTOCOL_MIN_ARGS(0);
-
+
if (server->lag_check_time.tv_sec != 0)
{
/* calculate lag (time diff with lag check) */
@@ -1334,14 +1334,14 @@ IRC_PROTOCOL_CALLBACK(pong)
&tv);
if (old_lag != server->lag)
weechat_bar_item_update ("lag");
-
+
/* schedule next lag check */
server->lag_check_time.tv_sec = 0;
server->lag_check_time.tv_usec = 0;
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1356,7 +1356,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
int nick_is_me;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* PRIVMSG message looks like:
* :nick!user@host PRIVMSG #channel :message for channel here
@@ -1367,15 +1367,15 @@ IRC_PROTOCOL_CALLBACK(privmsg)
* :nick!user@host PRIVMSG mynick :\01VERSION\01
* :nick!user@host PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
-
+
/* receiver is a channel ? */
if (irc_channel_is_channel (argv[2]))
{
@@ -1391,13 +1391,13 @@ IRC_PROTOCOL_CALLBACK(privmsg)
argv_eol[0]);
return WEECHAT_RC_OK;
}
-
+
/* other message */
ptr_nick = irc_nick_search (ptr_channel, nick);
-
+
if (ptr_nick && !ptr_nick->host)
ptr_nick->host = strdup (address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
"notify_message",
@@ -1407,7 +1407,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
(ptr_nick) ? NULL : nick,
NULL),
pos_args);
-
+
irc_channel_nick_speaking_add (ptr_channel,
nick,
weechat_string_has_highlight (pos_args,
@@ -1420,9 +1420,9 @@ IRC_PROTOCOL_CALLBACK(privmsg)
else
{
nick_is_me = (strcmp (server->nick, nick) == 0);
-
+
remote_nick = (nick_is_me) ? argv[2] : nick;
-
+
/* CTCP to user */
if ((pos_args[0] == '\01')
&& (pos_args[strlen (pos_args) - 1] == '\01'))
@@ -1432,10 +1432,10 @@ IRC_PROTOCOL_CALLBACK(privmsg)
argv_eol[0]);
return WEECHAT_RC_OK;
}
-
+
/* private message received => display it */
ptr_channel = irc_channel_search (server, remote_nick);
-
+
if (!ptr_channel)
{
ptr_channel = irc_channel_new (server,
@@ -1452,7 +1452,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
}
irc_channel_set_topic (ptr_channel, address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
@@ -1464,15 +1464,15 @@ IRC_PROTOCOL_CALLBACK(privmsg)
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)),
pos_args);
-
+
if (ptr_channel->has_quit_server)
ptr_channel->has_quit_server = 0;
-
+
weechat_hook_signal_send ("irc_pv",
WEECHAT_HOOK_SIGNAL_STRING,
argv_eol[0]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1487,18 +1487,18 @@ IRC_PROTOCOL_CALLBACK(quit)
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
int local_quit, display_host;
-
+
/*
* QUIT message looks like:
* :nick!user@host QUIT :quit message
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 2) ?
((argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]) : NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -1506,7 +1506,7 @@ IRC_PROTOCOL_CALLBACK(quit)
ptr_nick = NULL;
else
ptr_nick = irc_nick_search (ptr_channel, nick);
-
+
if (ptr_nick || (weechat_strcasecmp (ptr_channel->name, nick) == 0))
{
/* display quit message */
@@ -1587,7 +1587,7 @@ IRC_PROTOCOL_CALLBACK(quit)
irc_nick_free (server, ptr_channel, ptr_nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1599,9 +1599,9 @@ IRC_PROTOCOL_CALLBACK(quit)
IRC_PROTOCOL_CALLBACK(server_mode_reason)
{
char *pos_mode, *pos_args;
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
/* skip nickname if at beginning of server message */
if (strcmp (server->nick, argv[2]) == 0)
{
@@ -1613,7 +1613,7 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
pos_mode = argv[2];
pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
}
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -1622,7 +1622,7 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
weechat_prefix ("network"),
pos_mode,
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -1633,9 +1633,9 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
IRC_PROTOCOL_CALLBACK(numeric)
{
char *pos_args;
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (weechat_strcasecmp (server->nick, argv[2]) == 0)
{
pos_args = (argc > 3) ?
@@ -1645,7 +1645,7 @@ IRC_PROTOCOL_CALLBACK(numeric)
{
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -1653,7 +1653,7 @@ IRC_PROTOCOL_CALLBACK(numeric)
"%s%s",
weechat_prefix ("network"),
pos_args);
-
+
return WEECHAT_RC_OK;
}
@@ -1667,14 +1667,14 @@ IRC_PROTOCOL_CALLBACK(topic)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* TOPIC message looks like:
* :nick!user@host TOPIC #channel :new topic for channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (!irc_channel_is_channel (argv[2]))
{
weechat_printf (server->buffer,
@@ -1682,14 +1682,14 @@ IRC_PROTOCOL_CALLBACK(topic)
weechat_prefix ("error"), IRC_PLUGIN_NAME, "topic");
return WEECHAT_RC_OK;
}
-
+
pos_topic = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[2]);
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
-
+
if (!ignored)
{
if (pos_topic && pos_topic[0])
@@ -1788,10 +1788,10 @@ IRC_PROTOCOL_CALLBACK(topic)
}
}
}
-
+
if (ptr_channel)
irc_channel_set_topic (ptr_channel, pos_topic);
-
+
return WEECHAT_RC_OK;
}
@@ -1805,12 +1805,12 @@ IRC_PROTOCOL_CALLBACK(wallops)
* WALLOPS message looks like:
* :nick!user@host WALLOPS :message from admin
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
command, NULL,
NULL),
@@ -1825,7 +1825,7 @@ IRC_PROTOCOL_CALLBACK(wallops)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]);
-
+
return WEECHAT_RC_OK;
}
@@ -1843,16 +1843,16 @@ IRC_PROTOCOL_CALLBACK(001)
* 001 message looks like:
* :server 001 mynick :Welcome to the dancer-ircd Network
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (strcmp (server->nick, argv[2]) != 0)
irc_server_set_nick (server, argv[2]);
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
/* connection to IRC server is ok! */
server->is_connected = 1;
server->reconnect_delay = 0;
@@ -1864,7 +1864,7 @@ IRC_PROTOCOL_CALLBACK(001)
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
irc_server_set_buffer_title (server);
-
+
/* set away message if user was away (before disconnection for example) */
if (server->away_message && server->away_message[0])
{
@@ -1875,11 +1875,11 @@ IRC_PROTOCOL_CALLBACK(001)
free (away_msg);
}
}
-
+
/* send signal "irc_server_connected" with server name */
weechat_hook_signal_send ("irc_server_connected",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
-
+
/* execute command when connected */
ptr_command = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND);
if (ptr_command && ptr_command[0])
@@ -1907,7 +1907,7 @@ IRC_PROTOCOL_CALLBACK(001)
}
else
irc_server_autojoin_channels (server);
-
+
return WEECHAT_RC_OK;
}
@@ -1919,7 +1919,7 @@ IRC_PROTOCOL_CALLBACK(005)
{
char *pos, *pos2, *pos_start, *error, *isupport2;
int length_isupport, length, nick_max_length;
-
+
/*
* 005 message looks like:
* :server 005 mynick MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10
@@ -1927,9 +1927,9 @@ IRC_PROTOCOL_CALLBACK(005)
* CHANTYPES=# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer
* :are available on this server
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
@@ -1946,7 +1946,7 @@ IRC_PROTOCOL_CALLBACK(005)
if (pos2)
pos2[0] = ' ';
}
-
+
/* save max nick length */
pos = strstr (argv_eol[3], "NICKLEN=");
if (pos)
@@ -1962,7 +1962,7 @@ IRC_PROTOCOL_CALLBACK(005)
if (pos2)
pos2[0] = ' ';
}
-
+
/* save whole message (concatenate to existing isupport, if any) */
pos_start = NULL;
pos = strstr (argv_eol[3], " :");
@@ -1992,7 +1992,7 @@ IRC_PROTOCOL_CALLBACK(005)
memcpy (pos_start + 1, argv_eol[3], length);
pos_start[length + 1] = '\0';
}
-
+
return WEECHAT_RC_OK;
}
@@ -2006,9 +2006,9 @@ IRC_PROTOCOL_CALLBACK(221)
* 221 message looks like:
* :server 221 nick :+s
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[2],
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -2021,11 +2021,11 @@ IRC_PROTOCOL_CALLBACK(221)
IRC_COLOR_RESET,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3],
IRC_COLOR_CHAT_DELIMITERS);
-
+
irc_mode_user_set (server,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3],
1);
-
+
return WEECHAT_RC_OK;
}
@@ -2040,18 +2040,18 @@ IRC_PROTOCOL_CALLBACK(301)
char *pos_away_msg;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 301 message looks like:
* :server 301 mynick nick :away message for nick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 4)
{
pos_away_msg = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
-
+
/* look for private buffer to display message */
ptr_channel = irc_channel_search (server, argv[3]);
if (!weechat_config_boolean (irc_config_look_display_pv_away_once)
@@ -2080,7 +2080,7 @@ IRC_PROTOCOL_CALLBACK(301)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2094,9 +2094,9 @@ IRC_PROTOCOL_CALLBACK(303)
* 303 message looks like:
* :server 303 mynick :nick1 nick2
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -2104,7 +2104,7 @@ IRC_PROTOCOL_CALLBACK(303)
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
-
+
return WEECHAT_RC_OK;
}
@@ -2118,9 +2118,9 @@ IRC_PROTOCOL_CALLBACK(305)
* 305 message looks like:
* :server 305 mynick :Does this mean you're really back?
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 3)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -2131,12 +2131,12 @@ IRC_PROTOCOL_CALLBACK(305)
weechat_prefix ("network"),
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
}
-
+
server->is_away = 0;
server->away_time = 0;
-
+
weechat_bar_item_update ("away");
-
+
return WEECHAT_RC_OK;
}
@@ -2150,9 +2150,9 @@ IRC_PROTOCOL_CALLBACK(306)
* 306 message looks like:
* :server 306 mynick :We'll miss you
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 3)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -2163,12 +2163,12 @@ IRC_PROTOCOL_CALLBACK(306)
weechat_prefix ("network"),
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
}
-
+
server->is_away = 1;
server->away_time = time (NULL);
-
+
weechat_bar_item_update ("away");
-
+
return WEECHAT_RC_OK;
}
@@ -2182,9 +2182,9 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
* messages look like:
* :server 319 flashy FlashCode :some text here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2197,7 +2197,7 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -2211,9 +2211,9 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
* messages look like:
* :server 369 flashy FlashCode :some text here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whowas",
NULL),
@@ -2226,7 +2226,7 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -2240,9 +2240,9 @@ IRC_PROTOCOL_CALLBACK(311)
* 311 message looks like:
* :server 311 mynick nick user host * :realname here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(8);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2259,7 +2259,7 @@ IRC_PROTOCOL_CALLBACK(311)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]);
-
+
return WEECHAT_RC_OK;
}
@@ -2273,9 +2273,9 @@ IRC_PROTOCOL_CALLBACK(312)
* 312 message looks like:
* :server 312 mynick nick irc.freenode.net :http://freenode.net/
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2292,7 +2292,7 @@ IRC_PROTOCOL_CALLBACK(312)
IRC_COLOR_RESET,
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
IRC_COLOR_CHAT_DELIMITERS);
-
+
return WEECHAT_RC_OK;
}
@@ -2306,9 +2306,9 @@ IRC_PROTOCOL_CALLBACK(314)
* 314 message looks like:
* :server 314 mynick nick user host * :realname here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(8);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whowas",
NULL),
@@ -2325,7 +2325,7 @@ IRC_PROTOCOL_CALLBACK(314)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]);
-
+
return WEECHAT_RC_OK;
}
@@ -2336,14 +2336,14 @@ IRC_PROTOCOL_CALLBACK(314)
IRC_PROTOCOL_CALLBACK(315)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 315 message looks like:
* :server 315 mynick #channel :End of /WHO list.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && (ptr_channel->checking_away > 0))
{
@@ -2364,7 +2364,7 @@ IRC_PROTOCOL_CALLBACK(315)
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2377,25 +2377,25 @@ IRC_PROTOCOL_CALLBACK(317)
int idle_time, day, hour, min, sec;
time_t datetime;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 317 message looks like:
* :server 317 mynick nick 122877 1205327880 :seconds idle, signon time
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
idle_time = atoi (argv[4]);
day = idle_time / (60 * 60 * 24);
hour = (idle_time % (60 * 60 * 24)) / (60 * 60);
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
-
+
datetime = (time_t)(atol (argv[5]));
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois", NULL);
-
+
if (day > 0)
{
weechat_printf_tags (ptr_buffer,
@@ -2456,7 +2456,7 @@ IRC_PROTOCOL_CALLBACK(317)
IRC_COLOR_CHAT_CHANNEL,
weechat_util_get_time_string (&datetime));
}
-
+
return WEECHAT_RC_OK;
}
@@ -2467,17 +2467,17 @@ IRC_PROTOCOL_CALLBACK(317)
IRC_PROTOCOL_CALLBACK(321)
{
char *pos_args;
-
+
/*
* 321 message looks like:
* :server 321 mynick Channel :Users Name
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "list",
NULL),
@@ -2487,7 +2487,7 @@ IRC_PROTOCOL_CALLBACK(321)
argv[3],
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -2498,17 +2498,17 @@ IRC_PROTOCOL_CALLBACK(321)
IRC_PROTOCOL_CALLBACK(322)
{
char *pos_topic;
-
+
/*
* 322 message looks like:
* :server 322 mynick #channel 3 :topic of channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
pos_topic = (argc > 5) ?
((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL;
-
+
if (!server->cmd_list_regexp ||
(regexec (server->cmd_list_regexp, argv[3], 0, NULL, 0) == 0))
{
@@ -2528,7 +2528,7 @@ IRC_PROTOCOL_CALLBACK(322)
(pos_topic && pos_topic[0]) ? ": " : "",
(pos_topic && pos_topic[0]) ? pos_topic : "");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2539,17 +2539,17 @@ IRC_PROTOCOL_CALLBACK(322)
IRC_PROTOCOL_CALLBACK(323)
{
char *pos_args;
-
+
/*
* 323 message looks like:
* :server 323 mynick :End of /LIST
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
pos_args = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "list",
NULL),
@@ -2557,7 +2557,7 @@ IRC_PROTOCOL_CALLBACK(323)
"%s%s",
weechat_prefix ("network"),
(pos_args && pos_args[0]) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -2568,14 +2568,14 @@ IRC_PROTOCOL_CALLBACK(323)
IRC_PROTOCOL_CALLBACK(324)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 324 message looks like:
* :server 324 mynick #channel +nt
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel)
{
@@ -2612,7 +2612,7 @@ IRC_PROTOCOL_CALLBACK(324)
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : "",
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2624,20 +2624,20 @@ IRC_PROTOCOL_CALLBACK(327)
{
char *pos_realname;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 327 message looks like:
* :server 327 mynick nick host ip :real hostname/ip
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
pos_realname = (argc > 6) ?
((argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]) : NULL;
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois", NULL);
-
+
if (pos_realname && pos_realname[0])
{
weechat_printf_tags (ptr_buffer,
@@ -2670,7 +2670,7 @@ IRC_PROTOCOL_CALLBACK(327)
argv[4],
argv[5]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2681,14 +2681,14 @@ IRC_PROTOCOL_CALLBACK(327)
IRC_PROTOCOL_CALLBACK(328)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 328 message looks like:
* :server 328 mynick #channel :http://sample.url.com/
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel)
{
@@ -2704,7 +2704,7 @@ IRC_PROTOCOL_CALLBACK(328)
(argv_eol[4][0] == ':') ?
argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2716,19 +2716,19 @@ IRC_PROTOCOL_CALLBACK(329)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
-
+
/*
* 329 message looks like:
* :server 329 mynick #channel 1205327894
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
-
+
datetime = (time_t)(atol ((argv_eol[4][0] == ':') ?
argv_eol[4] + 1 : argv_eol[4]));
-
+
if (ptr_channel)
{
if (ptr_channel->display_creation_date)
@@ -2758,7 +2758,7 @@ IRC_PROTOCOL_CALLBACK(329)
IRC_COLOR_RESET,
weechat_util_get_time_string (&datetime));
}
-
+
return WEECHAT_RC_OK;
}
@@ -2771,7 +2771,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
{
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 330 message looks like:
* :server 330 mynick nick1 nick2 :is logged in as
@@ -2780,7 +2780,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
* 343 message looks like:
* :server 343 mynick nick1 nick2 :is opered as
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
if (argc >= 6)
@@ -2818,7 +2818,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2830,14 +2830,14 @@ IRC_PROTOCOL_CALLBACK(331)
{
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 331 message looks like:
* :server 331 mynick #channel :There isn't a topic.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
@@ -2848,7 +2848,7 @@ IRC_PROTOCOL_CALLBACK(331)
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
argv[3]);
-
+
return WEECHAT_RC_OK;
}
@@ -2861,20 +2861,20 @@ IRC_PROTOCOL_CALLBACK(332)
char *pos_topic, *topic_no_color, *topic_color;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 332 message looks like:
* :server 332 mynick #channel :topic of channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_topic = NULL;
if (argc >= 5)
pos_topic = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
-
+
ptr_channel = irc_channel_search (server, argv[3]);
-
+
if (ptr_channel && ptr_channel->nicks)
{
if (pos_topic)
@@ -2890,7 +2890,7 @@ IRC_PROTOCOL_CALLBACK(332)
}
else
ptr_buffer = server->buffer;
-
+
topic_color = NULL;
if (pos_topic)
{
@@ -2910,7 +2910,7 @@ IRC_PROTOCOL_CALLBACK(332)
IRC_COLOR_RESET);
if (topic_color)
free (topic_color);
-
+
return WEECHAT_RC_OK;
}
@@ -2925,30 +2925,30 @@ IRC_PROTOCOL_CALLBACK(333)
time_t datetime;
const char *topic_nick, *topic_address;
int arg_date;
-
+
/*
* 333 message looks like:
* :server 333 mynick #channel nick!user@host 1205428096
* or:
* :server 333 mynick #channel 1205428096
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
topic_nick = (argc > 5) ? irc_message_get_nick_from_host (argv[4]) : NULL;
topic_address = (argc > 5) ? irc_message_get_address_from_host (argv[4]) : NULL;
if (topic_nick && topic_address && strcmp (topic_nick, topic_address) == 0)
topic_address = NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_nick = (ptr_channel) ? irc_nick_search (ptr_channel, topic_nick) : NULL;
arg_date = (argc > 5) ? 5 : 4;
datetime = (time_t)(atol ((argv_eol[arg_date][0] == ':') ?
argv_eol[arg_date] + 1 : argv_eol[arg_date]));
-
+
if (!topic_nick && (datetime == 0))
return WEECHAT_RC_OK;
-
+
if (ptr_channel && ptr_channel->nicks)
{
if (topic_nick)
@@ -3023,7 +3023,7 @@ IRC_PROTOCOL_CALLBACK(333)
weechat_util_get_time_string (&datetime));
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -3037,9 +3037,9 @@ IRC_PROTOCOL_CALLBACK(338)
* 338 message looks like:
* :server 338 mynick nick host :actually using host
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -3054,7 +3054,7 @@ IRC_PROTOCOL_CALLBACK(338)
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
IRC_COLOR_CHAT_HOST,
argv[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3068,9 +3068,9 @@ IRC_PROTOCOL_CALLBACK(341)
* 341 message looks like:
* :server 341 mynick nick #channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[2],
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -3085,7 +3085,7 @@ IRC_PROTOCOL_CALLBACK(341)
IRC_COLOR_CHAT_CHANNEL,
argv[4],
IRC_COLOR_RESET);
-
+
return WEECHAT_RC_OK;
}
@@ -3099,9 +3099,9 @@ IRC_PROTOCOL_CALLBACK(344)
* 344 message looks like:
* :server 344 mynick #channel nick!user@host
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "reop",
NULL),
@@ -3113,7 +3113,7 @@ IRC_PROTOCOL_CALLBACK(344)
IRC_COLOR_RESET,
IRC_COLOR_CHAT_HOST,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3127,9 +3127,9 @@ IRC_PROTOCOL_CALLBACK(345)
* 345 message looks like:
* :server 345 mynick #channel :End of Channel Reop List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "reop",
NULL),
@@ -3140,7 +3140,7 @@ IRC_PROTOCOL_CALLBACK(345)
argv[3],
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3153,14 +3153,14 @@ IRC_PROTOCOL_CALLBACK(346)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 346 message looks like:
* :server 346 mynick #channel invitemask nick!user@host 1205590879
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3214,7 +3214,7 @@ IRC_PROTOCOL_CALLBACK(346)
irc_message_get_address_from_host (argv[5]),
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3227,17 +3227,17 @@ IRC_PROTOCOL_CALLBACK(347)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 347 message looks like:
* :server 347 mynick #channel :End of Channel Invite List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3254,7 +3254,7 @@ IRC_PROTOCOL_CALLBACK(347)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3267,15 +3267,15 @@ IRC_PROTOCOL_CALLBACK(348)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 348 message looks like:
* :server 348 mynick #channel nick1!user1@host1 nick2!user2@host2 1205585109
* (nick2 is nick who set exception on nick1)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3323,7 +3323,7 @@ IRC_PROTOCOL_CALLBACK(348)
IRC_COLOR_CHAT_HOST,
argv[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3336,17 +3336,17 @@ IRC_PROTOCOL_CALLBACK(349)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 349 message looks like:
* :server 349 mynick #channel :End of Channel Exception List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3363,7 +3363,7 @@ IRC_PROTOCOL_CALLBACK(349)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3374,17 +3374,17 @@ IRC_PROTOCOL_CALLBACK(349)
IRC_PROTOCOL_CALLBACK(351)
{
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 351 message looks like:
* :server 351 mynick dancer-ircd-1.0.36(2006/07/23_13:11:50). server :iMZ dncrTS/v4
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL, command, NULL,
NULL);
-
+
if (argc > 5)
{
weechat_printf_tags (ptr_buffer,
@@ -3404,7 +3404,7 @@ IRC_PROTOCOL_CALLBACK(351)
argv[3],
argv[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3418,16 +3418,16 @@ IRC_PROTOCOL_CALLBACK(352)
int arg_start, length;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* 352 message looks like:
* :server 352 mynick #channel user host server nick (*) (H/G) :0 flashcode
*/
-
+
arg_start = (strcmp (argv[8], "*") == 0) ? 9 : 8;
-
+
IRC_PROTOCOL_MIN_ARGS(arg_start + 1);
-
+
if (argv[arg_start][0] == ':')
{
pos_attr = NULL;
@@ -3440,10 +3440,10 @@ IRC_PROTOCOL_CALLBACK(352)
pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;
pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;
}
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_nick = (ptr_channel) ? irc_nick_search (ptr_channel, argv[7]) : NULL;
-
+
/* update host for nick */
if (ptr_nick)
{
@@ -3454,7 +3454,7 @@ IRC_PROTOCOL_CALLBACK(352)
if (ptr_nick->host)
snprintf (ptr_nick->host, length, "%s@%s", argv[4], argv[5]);
}
-
+
if (ptr_channel && (ptr_channel->checking_away > 0))
{
if (ptr_nick && pos_attr)
@@ -3492,7 +3492,7 @@ IRC_PROTOCOL_CALLBACK(352)
(pos_hopcount) ? " " : "",
(pos_realname) ? pos_realname : "");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3507,14 +3507,14 @@ IRC_PROTOCOL_CALLBACK(353)
int args, i, away;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* 353 message looks like:
* :server 353 mynick = #channel :mynick nick1 @nick2 +nick3
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
if (irc_channel_is_channel (argv[3]))
{
pos_channel = argv[3];
@@ -3525,32 +3525,32 @@ IRC_PROTOCOL_CALLBACK(353)
pos_channel = argv[4];
args = 5;
}
-
+
IRC_PROTOCOL_MIN_ARGS(args + 1);
-
+
ptr_channel = irc_channel_search (server, pos_channel);
-
+
if (ptr_channel && ptr_channel->nicks)
{
for (i = args; i < argc; i++)
{
pos_nick = (argv[i][0] == ':') ? argv[i] + 1 : argv[i];
pos_nick_orig = pos_nick;
-
+
/* skip prefix(es) */
while (pos_nick[0]
&& (irc_server_get_prefix_char_index (server, pos_nick[0]) >= 0))
{
pos_nick++;
}
-
+
/* extract nick from host */
pos_host = strchr (pos_nick, '!');
if (pos_host)
nickname = weechat_strndup (pos_nick, pos_host - pos_nick);
else
nickname = strdup (pos_nick);
-
+
/* add or update nick on channel */
if (nickname)
{
@@ -3573,7 +3573,7 @@ IRC_PROTOCOL_CALLBACK(353)
}
}
}
-
+
if (!ptr_channel)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -3591,7 +3591,7 @@ IRC_PROTOCOL_CALLBACK(353)
argv_eol[args] + 1 : argv_eol[args],
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3607,14 +3607,14 @@ IRC_PROTOCOL_CALLBACK(366)
int num_nicks, num_op, num_halfop, num_voice, num_normal, length, i;
char *string;
const char *prefix, *prefix_color, *nickname;
-
+
/*
* 366 message looks like:
* :server 366 mynick #channel :End of /NAMES list.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && ptr_channel->nicks)
{
@@ -3704,7 +3704,7 @@ IRC_PROTOCOL_CALLBACK(366)
}
weechat_infolist_free (infolist);
}
-
+
/* display number of nicks, ops, halfops & voices on the channel */
irc_nick_count (server, ptr_channel, &num_nicks, &num_op, &num_halfop,
&num_voice, &num_normal);
@@ -3740,7 +3740,7 @@ IRC_PROTOCOL_CALLBACK(366)
IRC_COLOR_RESET,
NG_("normal", "normals", num_normal),
IRC_COLOR_CHAT_DELIMITERS);
-
+
irc_command_mode_server (server, ptr_channel, NULL);
irc_channel_check_away (server, ptr_channel);
}
@@ -3757,7 +3757,7 @@ IRC_PROTOCOL_CALLBACK(366)
IRC_COLOR_RESET,
(argv[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3770,14 +3770,14 @@ IRC_PROTOCOL_CALLBACK(367)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 367 message looks like:
* :server 367 mynick #channel banmask nick!user@host 1205590879
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3831,7 +3831,7 @@ IRC_PROTOCOL_CALLBACK(367)
irc_message_get_address_from_host (argv[5]),
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3844,17 +3844,17 @@ IRC_PROTOCOL_CALLBACK(368)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 368 message looks like:
* :server 368 mynick #channel :End of Channel Ban List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3871,7 +3871,7 @@ IRC_PROTOCOL_CALLBACK(368)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3883,27 +3883,27 @@ IRC_PROTOCOL_CALLBACK(432)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 432 message looks like:
* :server 432 * mynick :Erroneous Nickname
*/
-
+
irc_protocol_cb_generic_error (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
nick_index = irc_server_get_nick_index (server);
if (nick_index < 0)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -3915,19 +3915,19 @@ IRC_PROTOCOL_CALLBACK(432)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is invalid, "
"trying nickname #%d (\"%s\")"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3939,12 +3939,12 @@ IRC_PROTOCOL_CALLBACK(433)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 433 message looks like:
* :server 433 * mynick :Nickname is already in use.
*/
-
+
if (!server->is_connected)
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
@@ -3955,7 +3955,7 @@ IRC_PROTOCOL_CALLBACK(433)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -3967,15 +3967,15 @@ IRC_PROTOCOL_CALLBACK(433)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s: nickname \"%s\" is already in use, "
"trying nickname #%d (\"%s\")"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
else
@@ -3984,7 +3984,7 @@ IRC_PROTOCOL_CALLBACK(433)
nick, address, host, command,
ignored, argc, argv, argv_eol);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3997,29 +3997,29 @@ IRC_PROTOCOL_CALLBACK(437)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 437 message looks like:
* :server 437 * mynick :Nick/channel is temporarily unavailable
*/
-
+
irc_protocol_cb_generic_error (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
{
if ((argc >= 4) && (strcmp (server->nick, argv[3]) == 0))
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
nick_index = irc_server_get_nick_index (server);
if (nick_index < 0)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -4031,20 +4031,20 @@ IRC_PROTOCOL_CALLBACK(437)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is unavailable, "
"trying nickname #%d (\"%s\")"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4056,17 +4056,17 @@ IRC_PROTOCOL_CALLBACK(437)
IRC_PROTOCOL_CALLBACK(438)
{
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 438 message looks like:
* :server 438 mynick newnick :Nick change too fast. Please wait 30 seconds.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
if (argc >= 5)
{
weechat_printf_tags (ptr_buffer,
@@ -4086,7 +4086,7 @@ IRC_PROTOCOL_CALLBACK(438)
argv[2],
argv[3]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -4100,9 +4100,9 @@ IRC_PROTOCOL_CALLBACK(900)
* 900 message looks like:
* :server 900 mynick nick!user@host mynick :You are now logged in as mynick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, NULL,
NULL),
@@ -4114,7 +4114,7 @@ IRC_PROTOCOL_CALLBACK(900)
IRC_COLOR_CHAT_HOST,
argv[3],
IRC_COLOR_CHAT_DELIMITERS);
-
+
return WEECHAT_RC_OK;
}
@@ -4128,9 +4128,9 @@ IRC_PROTOCOL_CALLBACK(901)
* 901 message looks like:
* :server 901 mynick nick user host :You are now logged in. (id nick, username user, hostname host)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
if (argc >= 7)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -4147,7 +4147,7 @@ IRC_PROTOCOL_CALLBACK(901)
nick, address, host, command,
ignored, argc, argv, argv_eol);
}
-
+
return WEECHAT_RC_OK;
}
@@ -4163,14 +4163,14 @@ IRC_PROTOCOL_CALLBACK(sasl_end)
* 904 message looks like:
* :server 904 nick :SASL authentication failed
*/
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
irc_server_sendf (server, 0, NULL, "CAP END");
-
+
return WEECHAT_RC_OK;
}
@@ -4335,14 +4335,14 @@ irc_protocol_recv_command (struct t_irc_server *server,
{ "975", /* whois (secure connection) */ 1, &irc_protocol_cb_server_mode_reason },
{ NULL, 0, NULL }
};
-
+
if (!msg_command)
return;
-
+
dup_irc_message = NULL;
argv = NULL;
argv_eol = NULL;
-
+
/* get nick/host/address from IRC message */
nick1 = NULL;
address1 = NULL;
@@ -4362,7 +4362,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
if (pos_space)
pos_space[0] = '\0';
}
-
+
/* check if message is ignored or not */
ptr_channel = NULL;
if (msg_channel)
@@ -4370,18 +4370,18 @@ irc_protocol_recv_command (struct t_irc_server *server,
message_ignored = irc_ignore_check (server,
(ptr_channel) ? ptr_channel->name : msg_channel,
nick, host);
-
+
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in", msg_command,
irc_message, NULL);
-
+
/* send signal with received command, only if message is not ignored */
if (!message_ignored)
{
irc_server_send_signal (server, "irc_in", msg_command,
irc_message, NULL);
}
-
+
/* look for IRC command */
cmd_found = -1;
for (i = 0; irc_protocol_messages[i].name; i++)
@@ -4392,7 +4392,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
break;
}
}
-
+
/* command not found */
if (cmd_found < 0)
{
@@ -4421,7 +4421,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
decode_color = irc_protocol_messages[cmd_found].decode_color;
cmd_recv_func = irc_protocol_messages[cmd_found].recv_function;
}
-
+
if (cmd_recv_func != NULL)
{
if (irc_message)
@@ -4436,12 +4436,12 @@ irc_protocol_recv_command (struct t_irc_server *server,
dup_irc_message = NULL;
argv = weechat_string_split (dup_irc_message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (dup_irc_message, " ", 1, 0, NULL);
-
+
return_code = (int) (cmd_recv_func) (server,
nick, address, host, cmd_name,
message_ignored,
argc, argv, argv_eol);
-
+
if (return_code == WEECHAT_RC_ERROR)
{
weechat_printf (server->buffer,
@@ -4453,7 +4453,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
"%s%s",
weechat_prefix ("error"), irc_message);
}
-
+
/* send signal with received command (if message is not ignored) */
if (!message_ignored)
{
@@ -4461,11 +4461,11 @@ irc_protocol_recv_command (struct t_irc_server *server,
irc_message, NULL);
}
}
-
+
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in2", msg_command,
irc_message, NULL);
-
+
end:
if (nick)
free (nick);
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 051c85667..a5f5a5117 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -67,7 +67,7 @@ void
irc_raw_open (int switch_to_buffer)
{
struct t_irc_raw_message *ptr_raw_message;
-
+
if (!irc_raw_buffer)
{
irc_raw_buffer = weechat_buffer_search (IRC_PLUGIN_NAME,
@@ -77,14 +77,14 @@ irc_raw_open (int switch_to_buffer)
irc_raw_buffer = weechat_buffer_new (IRC_RAW_BUFFER_NAME,
&irc_input_data_cb, NULL,
&irc_buffer_close_cb, NULL);
-
+
/* failed to create buffer ? then return */
if (!irc_raw_buffer)
return;
-
+
weechat_buffer_set (irc_raw_buffer,
"title", _("IRC raw messages"));
-
+
if (!weechat_buffer_get_integer (irc_raw_buffer, "short_name_is_set"))
{
weechat_buffer_set (irc_raw_buffer, "short_name",
@@ -94,7 +94,7 @@ irc_raw_open (int switch_to_buffer)
weechat_buffer_set (irc_raw_buffer, "localvar_set_server", IRC_RAW_BUFFER_NAME);
weechat_buffer_set (irc_raw_buffer, "localvar_set_channel", IRC_RAW_BUFFER_NAME);
weechat_buffer_set (irc_raw_buffer, "localvar_set_no_log", "1");
-
+
/* disable all highlights on this buffer */
weechat_buffer_set (irc_raw_buffer, "highlight_words", "-");
@@ -106,7 +106,7 @@ irc_raw_open (int switch_to_buffer)
}
}
}
-
+
if (irc_raw_buffer && switch_to_buffer)
weechat_buffer_set (irc_raw_buffer, "display", "1");
}
@@ -119,7 +119,7 @@ void
irc_raw_message_free (struct t_irc_raw_message *raw_message)
{
struct t_irc_raw_message *new_raw_messages;
-
+
/* remove message from raw messages list */
if (last_irc_raw_message == raw_message)
last_irc_raw_message = raw_message->prev_message;
@@ -130,20 +130,20 @@ irc_raw_message_free (struct t_irc_raw_message *raw_message)
}
else
new_raw_messages = raw_message->next_message;
-
+
if (raw_message->next_message)
(raw_message->next_message)->prev_message = raw_message->prev_message;
-
+
/* free data */
if (raw_message->prefix)
free (raw_message->prefix);
if (raw_message->message)
free (raw_message->message);
-
+
free (raw_message);
-
+
irc_raw_messages = new_raw_messages;
-
+
irc_raw_messages_count--;
}
@@ -168,7 +168,7 @@ void
irc_raw_message_remove_old ()
{
int max_messages;
-
+
max_messages = weechat_config_integer (irc_config_look_raw_messages);
while (irc_raw_messages && (irc_raw_messages_count >= max_messages))
{
@@ -185,19 +185,19 @@ irc_raw_message_add_to_list (time_t date, const char *prefix,
const char *message)
{
struct t_irc_raw_message *new_raw_message;
-
+
if (!prefix || !message)
return NULL;
-
+
irc_raw_message_remove_old ();
-
+
new_raw_message = malloc (sizeof (*new_raw_message));
if (new_raw_message)
{
new_raw_message->date = date;
new_raw_message->prefix = strdup (prefix);
new_raw_message->message = strdup (message);
-
+
/* add message to list */
new_raw_message->prev_message = last_irc_raw_message;
new_raw_message->next_message = NULL;
@@ -206,10 +206,10 @@ irc_raw_message_add_to_list (time_t date, const char *prefix,
else
irc_raw_messages = new_raw_message;
last_irc_raw_message = new_raw_message;
-
+
irc_raw_messages_count++;
}
-
+
return new_raw_message;
}
@@ -226,7 +226,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
const char *hexa = "0123456789ABCDEF";
int pos_buf, pos_buf2, char_size, i;
struct t_irc_raw_message *new_raw_message;
-
+
buf = weechat_iconv_to_internal (NULL, message);
buf2 = malloc ((strlen (buf) * 3) + 1);
if (buf2)
@@ -282,7 +282,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
strcpy (prefix_arrow, IRC_RAW_PREFIX_SEND);
break;
}
-
+
snprintf (prefix, sizeof (prefix), "%s%s%s%s%s",
(server) ? weechat_color ("chat_server") : "",
(server) ? server->name : "",
@@ -291,16 +291,16 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
weechat_color ("chat_prefix_quit") :
weechat_color ("chat_prefix_join"),
prefix_arrow);
-
+
new_raw_message = irc_raw_message_add_to_list (time (NULL),
prefix,
(buf2) ? buf2 : ((buf) ? buf : message));
-
+
if (buf)
free (buf);
if (buf2)
free (buf2);
-
+
return new_raw_message;
}
@@ -313,14 +313,14 @@ irc_raw_print (struct t_irc_server *server, int flags,
const char *message)
{
struct t_irc_raw_message *new_raw_message;
-
+
if (!message)
return;
/* auto-open IRC raw buffer if debug for irc plugin is >= 1 */
if (!irc_raw_buffer && (weechat_irc_plugin->debug >= 1))
irc_raw_open (0);
-
+
new_raw_message = irc_raw_message_add (server, flags, message);
if (new_raw_message)
{
@@ -341,20 +341,20 @@ irc_raw_add_to_infolist (struct t_infolist *infolist,
struct t_irc_raw_message *raw_message)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !raw_message)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_time (ptr_item, "date", raw_message->date))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "prefix", raw_message->prefix))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "message", raw_message->message))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c
index bb1ecf2aa..2b26dbcad 100644
--- a/src/plugins/irc/irc-redirect.c
+++ b/src/plugins/irc/irc-redirect.c
@@ -249,17 +249,17 @@ struct t_irc_redirect_pattern *
irc_redirect_pattern_search (const char *name)
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
-
+
if (!name)
return NULL;
-
+
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
{
if (strcmp (ptr_redirect_pattern->name, name) == 0)
return ptr_redirect_pattern;
}
-
+
/* redirect pattern not found */
return NULL;
}
@@ -274,10 +274,10 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
const char *cmd_extra)
{
struct t_irc_redirect_pattern *ptr_redirect_pattern, *new_redirect_pattern;
-
+
if (!name)
return NULL;
-
+
if (!cmd_stop || !cmd_stop[0])
{
weechat_printf (NULL,
@@ -286,7 +286,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
"cmd_stop");
return NULL;
}
-
+
/* check if redirect pattern already exists */
ptr_redirect_pattern = irc_redirect_pattern_search (name);
if (ptr_redirect_pattern)
@@ -297,11 +297,11 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
name);
return NULL;
}
-
+
new_redirect_pattern = malloc (sizeof (*new_redirect_pattern));
if (!new_redirect_pattern)
return NULL;
-
+
/* initialize new redirect */
new_redirect_pattern->name = strdup (name);
new_redirect_pattern->temp_pattern = temp_pattern;
@@ -309,7 +309,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
new_redirect_pattern->cmd_start = (cmd_start) ? strdup (cmd_start) : NULL;
new_redirect_pattern->cmd_stop = strdup (cmd_stop);
new_redirect_pattern->cmd_extra = (cmd_extra) ? strdup (cmd_extra) : NULL;
-
+
/* add redirect pattern to end of list */
new_redirect_pattern->prev_redirect = last_irc_redirect_pattern;
if (irc_redirect_patterns)
@@ -318,7 +318,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
irc_redirect_patterns = new_redirect_pattern;
last_irc_redirect_pattern = new_redirect_pattern;
new_redirect_pattern->next_redirect = NULL;
-
+
return new_redirect_pattern;
}
@@ -330,10 +330,10 @@ void
irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
{
struct t_irc_redirect_pattern *new_redirect_patterns;
-
+
if (!redirect_pattern)
return;
-
+
/* remove redirect */
if (last_irc_redirect_pattern == redirect_pattern)
last_irc_redirect_pattern = redirect_pattern->prev_redirect;
@@ -344,10 +344,10 @@ irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
}
else
new_redirect_patterns = redirect_pattern->next_redirect;
-
+
if (redirect_pattern->next_redirect)
(redirect_pattern->next_redirect)->prev_redirect = redirect_pattern->prev_redirect;
-
+
/* free data */
if (redirect_pattern->name)
free (redirect_pattern->name);
@@ -357,9 +357,9 @@ irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
free (redirect_pattern->cmd_stop);
if (redirect_pattern->cmd_extra)
free (redirect_pattern->cmd_extra);
-
+
free (redirect_pattern);
-
+
irc_redirect_patterns = new_redirect_patterns;
}
@@ -396,11 +396,11 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
int i, j, num_items[4];
long value;
struct t_hashtable *hash_cmd[4];
-
+
new_redirect = malloc (sizeof (*new_redirect));
if (!new_redirect)
return NULL;
-
+
/* create hashtables with commands */
for (i = 0; i < 4; i++)
{
@@ -448,7 +448,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
weechat_string_free_split (items[i]);
}
}
-
+
/* initialize new redirect */
new_redirect->server = server;
new_redirect->pattern = strdup (pattern);
@@ -467,7 +467,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
new_redirect->cmd_filter = hash_cmd[3];
new_redirect->output = NULL;
new_redirect->output_size = 0;
-
+
/* add redirect to end of list */
new_redirect->prev_redirect = server->last_redirect;
if (server->redirects)
@@ -476,7 +476,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
server->redirects = new_redirect;
server->last_redirect = new_redirect;
new_redirect->next_redirect = NULL;
-
+
return new_redirect;
}
@@ -492,7 +492,7 @@ irc_redirect_new (struct t_irc_server *server,
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
struct t_irc_redirect *new_redirect;
-
+
if (!server->is_connected)
{
weechat_printf (NULL,
@@ -501,7 +501,7 @@ irc_redirect_new (struct t_irc_server *server,
server->name);
return NULL;
}
-
+
if (!pattern || !pattern[0])
{
weechat_printf (NULL, _("%s%s: missing argument \"%s\" for redirect"),
@@ -514,7 +514,7 @@ irc_redirect_new (struct t_irc_server *server,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "signal");
return NULL;
}
-
+
ptr_redirect_pattern = irc_redirect_pattern_search (pattern);
if (!ptr_redirect_pattern)
{
@@ -523,7 +523,7 @@ irc_redirect_new (struct t_irc_server *server,
pattern);
return NULL;
}
-
+
new_redirect = irc_redirect_new_with_commands (server, pattern, signal,
count, string,
(timeout > 0) ? timeout : ptr_redirect_pattern->timeout,
@@ -531,14 +531,14 @@ irc_redirect_new (struct t_irc_server *server,
ptr_redirect_pattern->cmd_stop,
ptr_redirect_pattern->cmd_extra,
cmd_filter);
-
+
/*
* remove redirect pattern if it is temporary (created by external
* plugin/script)
*/
if (new_redirect && ptr_redirect_pattern->temp_pattern)
irc_redirect_pattern_free (ptr_redirect_pattern);
-
+
return new_redirect;
}
@@ -550,17 +550,17 @@ struct t_irc_redirect *
irc_redirect_search_available (struct t_irc_server *server)
{
struct t_irc_redirect *ptr_redirect;
-
+
if (!server)
return NULL;
-
+
for (ptr_redirect = server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
{
if (ptr_redirect->start_time == 0)
return ptr_redirect;
}
-
+
/* no redirect available */
return NULL;
}
@@ -575,10 +575,10 @@ irc_redirect_init_command (struct t_irc_redirect *redirect,
const char *command)
{
char *pos;
-
+
if (!redirect)
return;
-
+
if (command)
{
pos = strchr (command, '\r');
@@ -591,9 +591,9 @@ irc_redirect_init_command (struct t_irc_redirect *redirect,
}
else
redirect->command = NULL;
-
+
redirect->start_time = time (NULL);
-
+
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (redirect->server->buffer,
@@ -618,11 +618,11 @@ irc_redirect_message_match_hash (struct t_irc_redirect *redirect,
struct t_hashtable *cmd_hash)
{
int *value;
-
+
value = weechat_hashtable_get (cmd_hash, command);
if (!value)
return 0;
-
+
/*
* if string is in redirect and that this command requires string to
* be in message, then search for this string
@@ -631,11 +631,11 @@ irc_redirect_message_match_hash (struct t_irc_redirect *redirect,
{
if (!arguments_argv || (*value >= arguments_argc))
return 0;
-
+
if (weechat_strcasecmp (arguments_argv[*value], redirect->string) != 0)
return 0;
}
-
+
return 1;
}
@@ -648,7 +648,7 @@ irc_redirect_message_add (struct t_irc_redirect *redirect, const char *message,
const char *command)
{
char *output2;
-
+
/*
* if command is not for output, then don't add message
* (it is silently ignored)
@@ -656,7 +656,7 @@ irc_redirect_message_add (struct t_irc_redirect *redirect, const char *message,
if (redirect->cmd_filter
&& !weechat_hashtable_has_key (redirect->cmd_filter, command))
return;
-
+
/* add message to output */
if (redirect->output)
{
@@ -716,21 +716,21 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error)
(redirect->output) ? redirect->output : "");
snprintf (str_int, sizeof (str_int), "%d", redirect->output_size);
weechat_hashtable_set (hashtable, "output_size", str_int);
-
+
/* set some other fields with values from redirect */
weechat_hashtable_set (hashtable, "server", redirect->server->name);
weechat_hashtable_set (hashtable, "pattern", redirect->pattern);
weechat_hashtable_set (hashtable, "signal", redirect->signal);
weechat_hashtable_set (hashtable, "command", redirect->command);
}
-
+
snprintf (signal_name, sizeof (signal_name), "irc_redirection_%s_%s",
redirect->signal, redirect->pattern);
weechat_hook_hsignal_send (signal_name, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
irc_redirect_free (redirect);
}
else
@@ -760,10 +760,10 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
struct t_irc_redirect *ptr_redirect, *ptr_next_redirect;
int rc, match_stop, arguments_argc;
char **arguments_argv;
-
+
if (!server || !server->redirects || !message || !command)
return 0;
-
+
rc = 0;
if (arguments && arguments[0])
@@ -776,12 +776,12 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
arguments_argv = NULL;
arguments_argc = 0;
}
-
+
ptr_redirect = server->redirects;
while (ptr_redirect)
{
ptr_next_redirect = ptr_redirect->next_redirect;
-
+
if (ptr_redirect->start_time > 0)
{
if (ptr_redirect->cmd_stop_received)
@@ -870,14 +870,14 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
}
}
}
-
+
ptr_redirect = ptr_next_redirect;
}
-
+
end:
if (arguments_argv)
weechat_string_free_split (arguments_argv);
-
+
return rc;
}
@@ -892,12 +892,12 @@ irc_redirect_free (struct t_irc_redirect *redirect)
struct t_irc_redirect *new_redirects;
int priority;
struct t_irc_outqueue *ptr_outqueue;
-
+
if (!redirect)
return;
-
+
server = redirect->server;
-
+
/* remove redirect */
if (server->last_redirect == redirect)
server->last_redirect = redirect->prev_redirect;
@@ -908,10 +908,10 @@ irc_redirect_free (struct t_irc_redirect *redirect)
}
else
new_redirects = redirect->next_redirect;
-
+
if (redirect->next_redirect)
(redirect->next_redirect)->prev_redirect = redirect->prev_redirect;
-
+
/* remove any pointer to this redirect */
for (priority = 0; priority < IRC_SERVER_NUM_OUTQUEUES_PRIO; priority++)
{
@@ -922,7 +922,7 @@ irc_redirect_free (struct t_irc_redirect *redirect)
ptr_outqueue->redirect = NULL;
}
}
-
+
/* free data */
if (redirect->pattern)
free (redirect->pattern);
@@ -942,9 +942,9 @@ irc_redirect_free (struct t_irc_redirect *redirect)
weechat_hashtable_free (redirect->cmd_filter);
if (redirect->output)
free (redirect->output);
-
+
free (redirect);
-
+
server->redirects = new_redirects;
}
@@ -969,10 +969,10 @@ struct t_hdata *
irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
@@ -998,10 +998,10 @@ struct t_hdata *
irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
@@ -1038,14 +1038,14 @@ irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect_pattern *redirect_pattern)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !redirect_pattern)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", redirect_pattern->name))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "temp_pattern", redirect_pattern->temp_pattern))
@@ -1058,7 +1058,7 @@ irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "cmd_extra", redirect_pattern->cmd_extra))
return 0;
-
+
return 1;
}
@@ -1072,14 +1072,14 @@ irc_redirect_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect *redirect)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !redirect)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "server", redirect->server))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "server_name", redirect->server->name))
@@ -1116,7 +1116,7 @@ irc_redirect_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "output_size", redirect->output_size))
return 0;
-
+
return 1;
}
@@ -1129,7 +1129,7 @@ void
irc_redirect_pattern_print_log ()
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
-
+
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
{
@@ -1154,7 +1154,7 @@ void
irc_redirect_print_log (struct t_irc_server *server)
{
struct t_irc_redirect *ptr_redirect;
-
+
for (ptr_redirect = server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
{
@@ -1205,20 +1205,20 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra;
char *error;
int number, timeout;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (!hashtable)
return WEECHAT_RC_ERROR;
-
+
pattern = weechat_hashtable_get (hashtable, "pattern");
str_timeout = weechat_hashtable_get (hashtable, "timeout");
cmd_start = weechat_hashtable_get (hashtable, "cmd_start");
cmd_stop = weechat_hashtable_get (hashtable, "cmd_stop");
cmd_extra = weechat_hashtable_get (hashtable, "cmd_extra");
-
+
if (!pattern || !pattern[0])
{
weechat_printf (NULL,
@@ -1236,7 +1236,7 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "cmd_stop");
return WEECHAT_RC_ERROR;
}
-
+
timeout = 0;
if (str_timeout && str_timeout[0])
{
@@ -1244,14 +1244,14 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
timeout = number;
}
-
+
/*
* create a temporary redirect pattern (it will be removed when a
* redirect will use it)
*/
irc_redirect_pattern_new (pattern, 1, timeout,
cmd_start, cmd_stop, cmd_extra);
-
+
return WEECHAT_RC_OK;
}
@@ -1271,14 +1271,14 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
char *error;
struct t_irc_server *ptr_server;
int number, count, timeout;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (!hashtable)
return WEECHAT_RC_ERROR;
-
+
server = weechat_hashtable_get (hashtable, "server");
pattern = weechat_hashtable_get (hashtable, "pattern");
redirect_signal = weechat_hashtable_get (hashtable, "signal");
@@ -1286,7 +1286,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
string = weechat_hashtable_get (hashtable, "string");
str_timeout = weechat_hashtable_get (hashtable, "timeout");
cmd_filter = weechat_hashtable_get (hashtable, "cmd_filter");
-
+
if (!server || !server[0])
{
weechat_printf (NULL,
@@ -1302,7 +1302,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
weechat_prefix ("error"), IRC_PLUGIN_NAME, server);
return WEECHAT_RC_ERROR;
}
-
+
count = 1;
if (str_count && str_count[0])
{
@@ -1310,7 +1310,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
count = number;
}
-
+
timeout = 0;
if (str_timeout && str_timeout[0])
{
@@ -1318,10 +1318,10 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
timeout = number;
}
-
+
irc_redirect_new (ptr_server, pattern, redirect_signal,
count, string, timeout, cmd_filter);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c
index e54013945..5a7265140 100644
--- a/src/plugins/irc/irc-sasl.c
+++ b/src/plugins/irc/irc-sasl.c
@@ -51,7 +51,7 @@ irc_sasl_mechanism_plain (const char *sasl_username, const char *sasl_password)
{
char *string, *answer_base64;
int length_username, length;
-
+
answer_base64 = NULL;
length_username = strlen (sasl_username);
length = ((length_username + 1) * 2) + strlen (sasl_password) + 1;
@@ -62,14 +62,14 @@ irc_sasl_mechanism_plain (const char *sasl_username, const char *sasl_password)
sasl_username, sasl_username, sasl_password);
string[length_username] = '\0';
string[(length_username * 2) + 1] = '\0';
-
+
answer_base64 = malloc (length * 4);
if (answer_base64)
weechat_string_encode_base64 (string, length - 1, answer_base64);
-
+
free (string);
}
-
+
return answer_base64;
}
@@ -101,7 +101,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_t data_prime_number, data_generator_number, data_server_pub_key;
gcry_mpi_t pub_key, priv_key, secret_mpi;
gcry_cipher_hd_t gcrypt_handle;
-
+
data = NULL;
secret_bin = NULL;
public_bin = NULL;
@@ -109,12 +109,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
password_crypted = NULL;
answer = NULL;
answer_base64 = NULL;
-
+
/* decode data */
data = malloc (strlen (data_base64) + 1);
length_data = weechat_string_decode_base64 (data_base64, data);
ptr_data = (unsigned char *)data;
-
+
/* extract prime number */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -126,7 +126,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
num_bits_prime_number = gcry_mpi_get_nbits (data_prime_number);
ptr_data += size;
length_data -= size;
-
+
/* extract generator number */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -137,7 +137,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_scan (&data_generator_number, GCRYMPI_FMT_USG, ptr_data, size, NULL);
ptr_data += size;
length_data -= size;
-
+
/* extract server-generated public key */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -146,14 +146,14 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
goto end;
data_server_pub_key = gcry_mpi_new (size * 8);
gcry_mpi_scan (&data_server_pub_key, GCRYMPI_FMT_USG, ptr_data, size, NULL);
-
+
/* generate keys */
pub_key = gcry_mpi_new (num_bits_prime_number);
priv_key = gcry_mpi_new (num_bits_prime_number);
gcry_mpi_randomize (priv_key, num_bits_prime_number, GCRY_STRONG_RANDOM);
/* pub_key = (g ^ priv_key) % p */
gcry_mpi_powm (pub_key, data_generator_number, priv_key, data_prime_number);
-
+
/* compute secret_bin */
length_key = num_bits_prime_number / 8;
secret_bin = malloc (length_key);
@@ -162,12 +162,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_powm (secret_mpi, data_server_pub_key, priv_key, data_prime_number);
gcry_mpi_print (GCRYMPI_FMT_USG, secret_bin, length_key,
&num_written, secret_mpi);
-
+
/* create public_bin */
public_bin = malloc (length_key);
gcry_mpi_print (GCRYMPI_FMT_USG, public_bin, length_key,
&num_written, pub_key);
-
+
/* create password buffers (clear and crypted) */
length_password = strlen (sasl_password) +
((8 - (strlen (sasl_password) % 8)) % 8);
@@ -176,7 +176,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
memset (password_clear, 0, length_password);
memset (password_crypted, 0, length_password);
memcpy (password_clear, sasl_password, strlen (sasl_password));
-
+
/* crypt password using blowfish */
if (gcry_cipher_open (&gcrypt_handle, GCRY_CIPHER_BLOWFISH,
GCRY_CIPHER_MODE_ECB, 0) != 0)
@@ -187,7 +187,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
password_crypted, length_password,
password_clear, length_password) != 0)
goto end;
-
+
/*
* build answer for server, it is concatenation of:
* 1. key length (2 bytes)
@@ -206,12 +206,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
memcpy (ptr_answer, sasl_username, length_username + 1);
ptr_answer += length_username + 1;
memcpy (ptr_answer, password_crypted, length_password);
-
+
/* encode answer to base64 */
answer_base64 = malloc (length_answer * 4);
if (answer_base64)
weechat_string_encode_base64 (answer, length_answer, answer_base64);
-
+
end:
if (data)
free (data);
@@ -225,14 +225,14 @@ end:
free (password_crypted);
if (answer)
free (answer);
-
+
return answer_base64;
#else
/* make C compiler happy */
(void) data_base64;
(void) sasl_username;
(void) sasl_password;
-
+
return NULL;
#endif
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index b747ef940..d4ce9ae41 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -116,17 +116,17 @@ int
irc_server_valid (struct t_irc_server *server)
{
struct t_irc_server *ptr_server;
-
+
if (!server)
return 0;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server == server)
return 1;
}
-
+
/* server not found */
return 0;
}
@@ -142,17 +142,17 @@ int
irc_server_search_option (const char *option_name)
{
int i;
-
+
if (!option_name)
return -1;
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
if (weechat_strcasecmp (irc_server_option_string[i],
option_name) == 0)
return i;
}
-
+
/* server option not found */
return -1;
}
@@ -166,12 +166,12 @@ int
irc_server_sasl_enabled (struct t_irc_server *server)
{
const char *sasl_username, *sasl_password;
-
+
sasl_username = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_USERNAME);
sasl_password = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_PASSWORD);
-
+
/* SASL is enabled if username AND password are set */
return (sasl_username && sasl_username[0]
&& sasl_password && sasl_password[0]) ? 1 : 0;
@@ -186,14 +186,14 @@ char *
irc_server_get_name_without_port (const char *name)
{
char *pos;
-
+
if (!name)
return NULL;
-
+
pos = strchr (name, '/');
if (pos && (pos != name))
return weechat_strndup (name, pos - name);
-
+
return strdup (name);
}
@@ -207,7 +207,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
int i;
char *pos, *error;
long number;
-
+
/* free data */
server->addresses_count = 0;
if (server->addresses_array)
@@ -220,7 +220,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
free (server->ports_array);
server->ports_array = NULL;
}
-
+
/* set new addresses/ports */
if (addresses && addresses[0])
{
@@ -261,7 +261,7 @@ irc_server_set_index_current_address (struct t_irc_server *server, int index)
server->current_address = NULL;
}
server->current_port = 0;
-
+
if (index < server->addresses_count)
{
server->index_current_address = index;
@@ -286,7 +286,7 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
weechat_string_free_split (server->nicks_array);
server->nicks_array = NULL;
}
-
+
/* set new nicks */
server->nicks_array = weechat_string_split ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS,
",", 0, 0,
@@ -301,11 +301,11 @@ void
irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->nick)
free (server->nick);
server->nick = (nick) ? strdup (nick) : NULL;
-
+
/* set local variable "nick" for server and all channels/pv */
weechat_buffer_set (server->buffer, "localvar_set_nick", nick);
for (ptr_channel = server->channels; ptr_channel;
@@ -313,7 +313,7 @@ irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
weechat_buffer_set (ptr_channel->buffer, "localvar_set_nick", nick);
}
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -327,10 +327,10 @@ int
irc_server_get_nick_index (struct t_irc_server *server)
{
int i;
-
+
if (!server->nick)
return -1;
-
+
for (i = 0; i < server->nicks_count; i++)
{
if (strcmp (server->nick, server->nicks_array[i]) == 0)
@@ -338,7 +338,7 @@ irc_server_get_nick_index (struct t_irc_server *server)
return i;
}
}
-
+
/* nick not found */
return -1;
}
@@ -357,7 +357,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
char feature2[64], *pos_feature, *pos_equal, *pos_space;
int length;
static char value[256];
-
+
if (!server || !server->isupport || !feature)
return NULL;
@@ -380,7 +380,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
value[length] = '\0';
return value;
}
-
+
/* search feature without value */
feature2[strlen (feature2) - 1] = ' ';
pos_feature = strstr (server->isupport, feature2);
@@ -389,7 +389,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
value[0] = '\0';
return value;
}
-
+
/* feature not found in isupport */
return NULL;
}
@@ -409,10 +409,10 @@ irc_server_set_prefix_modes_chars (struct t_irc_server *server,
{
char *pos;
int i, length_modes, length_chars;
-
+
if (!server || !prefix)
return;
-
+
/* free previous values */
if (server->prefix_modes)
{
@@ -424,7 +424,7 @@ irc_server_set_prefix_modes_chars (struct t_irc_server *server,
free (server->prefix_chars);
server->prefix_chars = NULL;
}
-
+
/* assign new values */
pos = strchr (prefix, ')');
if (pos)
@@ -488,7 +488,7 @@ irc_server_get_prefix_mode_index (struct t_irc_server *server, char mode)
{
const char *prefix_modes;
char *pos;
-
+
if (server)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -496,7 +496,7 @@ irc_server_get_prefix_mode_index (struct t_irc_server *server, char mode)
if (pos)
return pos - prefix_modes;
}
-
+
return -1;
}
@@ -512,7 +512,7 @@ irc_server_get_prefix_char_index (struct t_irc_server *server,
{
const char *prefix_chars;
char *pos;
-
+
if (server)
{
prefix_chars = irc_server_get_prefix_chars (server);
@@ -520,7 +520,7 @@ irc_server_get_prefix_char_index (struct t_irc_server *server,
if (pos)
return pos - prefix_chars;
}
-
+
return -1;
}
@@ -536,7 +536,7 @@ irc_server_get_prefix_mode_for_char (struct t_irc_server *server,
{
const char *prefix_modes;
int index;
-
+
if (server)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -544,7 +544,7 @@ irc_server_get_prefix_mode_for_char (struct t_irc_server *server,
if (index >= 0)
return prefix_modes[index];
}
-
+
return ' ';
}
@@ -558,7 +558,7 @@ irc_server_get_prefix_char_for_mode (struct t_irc_server *server, char mode)
{
const char *prefix_chars;
int index;
-
+
if (server)
{
prefix_chars = irc_server_get_prefix_chars (server);
@@ -566,7 +566,7 @@ irc_server_get_prefix_char_for_mode (struct t_irc_server *server, char mode)
if (index >= 0)
return prefix_chars[index];
}
-
+
return ' ';
}
@@ -580,10 +580,10 @@ irc_server_alloc (const char *name)
struct t_irc_server *new_server;
int i, length;
char *option_name;
-
+
if (irc_server_search (name))
return NULL;
-
+
/* alloc memory for new server */
new_server = malloc (sizeof (*new_server));
if (!new_server)
@@ -593,7 +593,7 @@ irc_server_alloc (const char *name)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return NULL;
}
-
+
/* add new server to queue */
new_server->prev_server = last_irc_server;
new_server->next_server = NULL;
@@ -602,10 +602,10 @@ irc_server_alloc (const char *name)
else
irc_servers = new_server;
last_irc_server = new_server;
-
+
/* set name */
new_server->name = strdup (name);
-
+
/* internal vars */
new_server->temp_server = 0;
new_server->reloading_from_config = 0;
@@ -669,7 +669,7 @@ irc_server_alloc (const char *name)
new_server->buffer_as_string = NULL;
new_server->channels = NULL;
new_server->last_channel = NULL;
-
+
/* create options with null value */
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
@@ -698,7 +698,7 @@ irc_server_alloc (const char *name)
free (option_name);
}
}
-
+
return new_server;
}
@@ -717,21 +717,21 @@ irc_server_alloc_with_url (const char *irc_url)
char *server_address, *server_nicks, *server_autojoin;
int ipv6, ssl, length;
struct t_irc_server *ptr_server;
-
+
irc_url2 = strdup (irc_url);
if (!irc_url2)
return 0;
-
+
pos_server = NULL;
pos_nick = NULL;
pos_password = NULL;
pos_address = NULL;
pos_port = NULL;
pos_channel = NULL;
-
+
ipv6 = 0;
ssl = 0;
-
+
pos_server = strstr (irc_url2, "://");
if (!pos_server)
{
@@ -740,7 +740,7 @@ irc_server_alloc_with_url (const char *irc_url)
}
pos_server[0] = '\0';
pos_server += 3;
-
+
pos_channel = strstr (pos_server, "/");
if (pos_channel)
{
@@ -751,7 +751,7 @@ irc_server_alloc_with_url (const char *irc_url)
pos_channel++;
}
}
-
+
/* check for SSL / IPv6 */
if (weechat_strcasecmp (irc_url2, "irc6") == 0)
{
@@ -767,7 +767,7 @@ irc_server_alloc_with_url (const char *irc_url)
ipv6 = 1;
ssl = 1;
}
-
+
/* search for nick, password, address+port */
pos_address = strchr (pos_server, '@');
if (pos_address)
@@ -784,7 +784,7 @@ irc_server_alloc_with_url (const char *irc_url)
}
else
pos_address = pos_server;
-
+
/*
* search for port in address, and skip optional [ ] around address
* (can be used to indicate IPv6 port, after ']')
@@ -816,7 +816,7 @@ irc_server_alloc_with_url (const char *irc_url)
pos_port++;
}
}
-
+
ptr_server = irc_server_alloc (pos_address);
if (ptr_server)
{
@@ -897,9 +897,9 @@ irc_server_alloc_with_url (const char *irc_url)
weechat_prefix ("error"), IRC_PLUGIN_NAME,
pos_address);
}
-
+
free (irc_url2);
-
+
return (ptr_server) ? 1 : 0;
}
@@ -919,7 +919,7 @@ irc_server_apply_command_line_options (struct t_irc_server *server,
{
int i, index_option;
char *pos, *option_name, *ptr_value, *value_boolean[2] = { "off", "on" };
-
+
for (i = 0; i < argc; i++)
{
if (argv[i][0] == '-')
@@ -981,7 +981,7 @@ irc_server_outqueue_add (struct t_irc_server *server, int priority,
new_outqueue->modified = modified;
new_outqueue->tags = (tags) ? strdup (tags) : NULL;
new_outqueue->redirect = redirect;
-
+
new_outqueue->prev_outqueue = server->last_outqueue[priority];
new_outqueue->next_outqueue = NULL;
if (server->outqueue[priority])
@@ -1002,7 +1002,7 @@ irc_server_outqueue_free (struct t_irc_server *server,
struct t_irc_outqueue *outqueue)
{
struct t_irc_outqueue *new_outqueue;
-
+
/* remove outqueue message */
if (server->last_outqueue[priority] == outqueue)
server->last_outqueue[priority] = outqueue->prev_outqueue;
@@ -1013,10 +1013,10 @@ irc_server_outqueue_free (struct t_irc_server *server,
}
else
new_outqueue = outqueue->next_outqueue;
-
+
if (outqueue->next_outqueue)
(outqueue->next_outqueue)->prev_outqueue = outqueue->prev_outqueue;
-
+
/* free data */
if (outqueue->command)
free (outqueue->command);
@@ -1052,10 +1052,10 @@ void
irc_server_free_data (struct t_irc_server *server)
{
int i;
-
+
if (!server)
return;
-
+
/* free data */
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
@@ -1122,13 +1122,13 @@ void
irc_server_free (struct t_irc_server *server)
{
struct t_irc_server *new_irc_servers;
-
+
if (!server)
return;
-
+
/* close all channels/privates */
irc_channel_free_all (server);
-
+
/* remove server from queue */
if (last_irc_server == server)
last_irc_server = server->prev_server;
@@ -1139,10 +1139,10 @@ irc_server_free (struct t_irc_server *server)
}
else
new_irc_servers = server->next_server;
-
+
if (server->next_server)
(server->next_server)->prev_server = server->prev_server;
-
+
irc_server_free_data (server);
free (server);
irc_servers = new_irc_servers;
@@ -1175,11 +1175,11 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
char *mask, *pos;
const char *option_name;
int length, index_option;
-
+
/* check if another server exists with this name */
if (irc_server_search (new_name))
return NULL;
-
+
new_server = irc_server_alloc (new_name);
if (new_server)
{
@@ -1214,7 +1214,7 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
weechat_infolist_free (infolist);
}
}
-
+
return new_server;
}
@@ -1233,11 +1233,11 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
struct t_infolist *infolist;
struct t_config_option *ptr_option;
struct t_irc_channel *ptr_channel;
-
+
/* check if another server exists with this name */
if (irc_server_search (new_server_name))
return 0;
-
+
/* rename options */
length = 32 + strlen (server->name) + 1;
mask = malloc (length);
@@ -1278,12 +1278,12 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
}
weechat_infolist_free (infolist);
}
-
+
/* rename server */
if (server->name)
free (server->name);
server->name = strdup (new_server_name);
-
+
/* change name and local variables on buffers */
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -1310,7 +1310,7 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
weechat_buffer_set (server->buffer, "localvar_set_charset_modifier",
charset_modifier);
}
-
+
return 1;
}
@@ -1325,7 +1325,7 @@ irc_server_send_signal (struct t_irc_server *server, const char *signal,
{
int length;
char *str_signal, *full_message_tags;
-
+
length = strlen (server->name) + 1 + strlen (signal) + 1 + strlen (command) + 1;
str_signal = malloc (length);
if (str_signal)
@@ -1364,7 +1364,7 @@ int
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
-
+
if (!server)
{
weechat_printf (NULL,
@@ -1382,14 +1382,14 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
-
+
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf);
else
#endif
rc = send (server->sock, buffer, size_buf, 0);
-
+
if (rc < 0)
{
#ifdef HAVE_GNUTLS
@@ -1411,7 +1411,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
strerror (errno));
}
}
-
+
return rc;
}
@@ -1437,16 +1437,16 @@ irc_server_get_tags_to_send (const char *tags)
{
int length;
char *buf;
-
+
if (!tags && !irc_server_send_default_tags)
return NULL;
-
+
if (!tags)
return strdup (irc_server_send_default_tags);
-
+
if (!irc_server_send_default_tags)
return strdup (tags);
-
+
/* concatenate tags and irc_server_send_default_tags */
length = strlen (tags) + 1 + strlen (irc_server_send_default_tags) + 1;
buf = malloc (length);
@@ -1465,13 +1465,13 @@ irc_server_outqueue_send (struct t_irc_server *server)
time_t time_now;
char *pos, *tags_to_send;
int priority, anti_flood;
-
+
time_now = time (NULL);
-
+
/* detect if system clock has been changed (now lower than before) */
if (server->last_user_message > time_now)
server->last_user_message = time_now;
-
+
for (priority = 0; priority < IRC_SERVER_NUM_OUTQUEUES_PRIO; priority++)
{
switch (priority)
@@ -1508,7 +1508,7 @@ irc_server_outqueue_send (struct t_irc_server *server)
server->outqueue[priority]->message_after_mod);
if (pos)
pos[0] = '\r';
-
+
/* send signal with command that will be sent to server */
irc_server_send_signal (server, "irc_out",
server->outqueue[priority]->command,
@@ -1521,7 +1521,7 @@ irc_server_outqueue_send (struct t_irc_server *server)
(tags_to_send) ? tags_to_send : "");
if (tags_to_send)
free (tags_to_send);
-
+
/* send command */
irc_server_send (server, server->outqueue[priority]->message_after_mod,
strlen (server->outqueue[priority]->message_after_mod));
@@ -1565,9 +1565,9 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
int rc, queue_msg, add_to_queue, first_message, anti_flood;
time_t time_now;
struct t_irc_redirect *ptr_redirect;
-
+
rc = 1;
-
+
irc_message_parse (message, &nick, NULL, &command, &channel, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_out_%s",
@@ -1575,14 +1575,14 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
new_msg = weechat_hook_modifier_exec (str_modifier,
server->name,
message);
-
+
/* no changes in new message */
if (new_msg && (strcmp (message, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
}
-
+
/* message not dropped? */
if (!new_msg || new_msg[0])
{
@@ -1609,32 +1609,32 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
msg_encoded = weechat_hook_modifier_exec ("charset_encode",
modifier_data,
ptr_msg);
-
+
if (msg_encoded)
ptr_msg = msg_encoded;
-
+
while (rc && ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
-
+
snprintf (buffer, sizeof (buffer) - 1, "%s\r\n", ptr_msg);
/* anti-flood: look whether we should queue outgoing message or not */
time_now = time (NULL);
-
+
/* detect if system clock has been changed (now lower than before) */
if (server->last_user_message > time_now)
server->last_user_message = time_now;
-
+
/* get queue from flags */
queue_msg = 0;
if (flags & IRC_SERVER_SEND_OUTQ_PRIO_HIGH)
queue_msg = 1;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_LOW)
queue_msg = 2;
-
+
switch (queue_msg - 1)
{
case 0:
@@ -1644,7 +1644,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW);
break;
}
-
+
add_to_queue = 0;
if ((queue_msg > 0)
&& (server->outqueue[queue_msg - 1]
@@ -1653,11 +1653,11 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
{
add_to_queue = queue_msg;
}
-
+
tags_to_send = irc_server_get_tags_to_send (tags);
-
+
ptr_redirect = irc_redirect_search_available (server);
-
+
if (add_to_queue > 0)
{
/* queue message (do not send anything now) */
@@ -1680,7 +1680,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
IRC_RAW_FLAG_SEND | IRC_RAW_FLAG_MODIFIED,
ptr_msg);
}
-
+
/* send signal with command that will be sent to server */
irc_server_send_signal (server, "irc_out",
(command) ? command : "unknown",
@@ -1690,7 +1690,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
(command) ? command : "unknown",
ptr_msg,
(tags_to_send) ? tags_to_send : "");
-
+
if (irc_server_send (server, buffer, strlen (buffer)) <= 0)
rc = 0;
else
@@ -1701,10 +1701,10 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
if (ptr_redirect)
irc_redirect_init_command (ptr_redirect, buffer);
}
-
+
if (tags_to_send)
free (tags_to_send);
-
+
if (pos)
{
pos[0] = '\n';
@@ -1712,7 +1712,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
}
else
ptr_msg = NULL;
-
+
first_message = 0;
}
if (msg_encoded)
@@ -1723,7 +1723,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
irc_raw_print (server, IRC_RAW_FLAG_SEND | IRC_RAW_FLAG_MODIFIED,
_("(message dropped)"));
}
-
+
if (nick)
free (nick);
if (command)
@@ -1732,7 +1732,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
free (channel);
if (new_msg)
free (new_msg);
-
+
return rc;
}
@@ -1753,14 +1753,14 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
const char *str_message, *str_args;
int i, items_count, number, ret_number, rc;
struct t_hashtable *hashtable, *ret_hashtable;
-
+
if (!server)
return NULL;
-
+
weechat_va_format (format);
if (!vbuffer)
return NULL;
-
+
ret_hashtable = NULL;
ret_number = 1;
if (flags & IRC_SERVER_SEND_RETURN_HASHTABLE)
@@ -1771,7 +1771,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
NULL,
NULL);
}
-
+
rc = 1;
items = weechat_string_split (vbuffer, "\n", 0, 0, &items_count);
for (i = 0; i < items_count; i++)
@@ -1789,11 +1789,11 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
break;
snprintf (hash_key, sizeof (hash_key), "args%d", number);
str_args = weechat_hashtable_get (hashtable, hash_key);
-
+
rc = irc_server_send_one_msg (server, flags, str_message, tags);
if (!rc)
break;
-
+
if (ret_hashtable)
{
snprintf (hash_key, sizeof (hash_key), "msg%d", ret_number);
@@ -1819,9 +1819,9 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
}
if (items)
weechat_string_free_split (items);
-
+
free (vbuffer);
-
+
return ret_hashtable;
}
@@ -1833,10 +1833,10 @@ void
irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
{
struct t_irc_message *message;
-
+
if (!server->unterminated_message && !msg[0])
return;
-
+
message = malloc (sizeof (*message));
if (!message)
{
@@ -1866,9 +1866,9 @@ irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
}
else
message->data = strdup (msg);
-
+
message->next_message = NULL;
-
+
if (irc_msgq_last_msg)
{
irc_msgq_last_msg->next_message = message;
@@ -1889,10 +1889,10 @@ void
irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string)
{
char *unterminated_message2;
-
+
if (!string[0])
return;
-
+
if (server->unterminated_message)
{
unterminated_message2 =
@@ -1936,14 +1936,14 @@ irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
{
pos_cr = strchr (buffer, '\r');
pos_lf = strchr (buffer, '\n');
-
+
if (!pos_cr && !pos_lf)
{
/* no CR/LF found => add to unterminated and return */
irc_server_msgq_add_unterminated (server, buffer);
return;
}
-
+
if (pos_cr && ((!pos_lf) || (pos_lf > pos_cr)))
{
/* found '\r' first => ignore this char */
@@ -1973,7 +1973,7 @@ irc_server_msgq_flush ()
char *nick, *host, *command, *channel, *arguments;
char *msg_decoded, *msg_decoded_without_color;
char str_modifier[64], modifier_data[256];
-
+
while (irc_recv_msgq)
{
if (irc_recv_msgq->data)
@@ -1986,12 +1986,12 @@ irc_server_msgq_flush ()
{
ptr_data++;
}
-
+
if (ptr_data[0])
{
irc_raw_print (irc_recv_msgq->server, IRC_RAW_FLAG_RECV,
ptr_data);
-
+
irc_message_parse (ptr_data, NULL, NULL, &command, NULL, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_in_%s",
@@ -2001,36 +2001,36 @@ irc_server_msgq_flush ()
ptr_data);
if (command)
free (command);
-
+
/* no changes in new message */
if (new_msg && (strcmp (ptr_data, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
}
-
+
/* message not dropped? */
if (!new_msg || new_msg[0])
{
/* use new message (returned by plugin) */
ptr_msg = (new_msg) ? new_msg : ptr_data;
-
+
while (ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
-
+
if (new_msg)
{
irc_raw_print (irc_recv_msgq->server,
IRC_RAW_FLAG_RECV | IRC_RAW_FLAG_MODIFIED,
ptr_msg);
}
-
+
irc_message_parse (ptr_msg, &nick, &host, &command,
&channel, &arguments);
-
+
/* convert charset for message */
if (channel && irc_channel_is_channel (channel))
{
@@ -2061,12 +2061,12 @@ irc_server_msgq_flush ()
msg_decoded = weechat_hook_modifier_exec ("charset_decode",
modifier_data,
ptr_msg);
-
+
/* replace WeeChat internal color codes by "?" */
msg_decoded_without_color =
weechat_string_remove_color ((msg_decoded) ? msg_decoded : ptr_msg,
"?");
-
+
/* call modifier after charset */
ptr_msg2 = (msg_decoded_without_color) ?
msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg);
@@ -2081,14 +2081,14 @@ irc_server_msgq_flush ()
free (new_msg2);
new_msg2 = NULL;
}
-
+
/* message not dropped? */
if (!new_msg2 || new_msg2[0])
{
/* use new message (returned by plugin) */
if (new_msg2)
ptr_msg2 = new_msg2;
-
+
/* parse and execute command */
if (irc_redirect_message (irc_recv_msgq->server,
ptr_msg2, command,
@@ -2104,7 +2104,7 @@ irc_server_msgq_flush ()
channel);
}
}
-
+
if (new_msg2)
free (new_msg2);
if (nick)
@@ -2121,7 +2121,7 @@ irc_server_msgq_flush ()
free (msg_decoded);
if (msg_decoded_without_color)
free (msg_decoded_without_color);
-
+
if (pos)
{
pos[0] = '\n';
@@ -2143,7 +2143,7 @@ irc_server_msgq_flush ()
}
free (irc_recv_msgq->data);
}
-
+
next = irc_recv_msgq->next_message;
free (irc_recv_msgq);
irc_recv_msgq = next;
@@ -2162,15 +2162,15 @@ irc_server_recv_cb (void *data, int fd)
struct t_irc_server *server;
static char buffer[4096 + 2];
int num_read;
-
+
/* make C compiler happy */
(void) fd;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
num_read = gnutls_record_recv (server->gnutls_sess, buffer,
@@ -2178,7 +2178,7 @@ irc_server_recv_cb (void *data, int fd)
else
#endif
num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0);
-
+
if (num_read > 0)
{
buffer[num_read] = '\0';
@@ -2224,7 +2224,7 @@ irc_server_recv_cb (void *data, int fd)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2238,17 +2238,17 @@ int
irc_server_timer_connection_cb (void *data, int remaining_calls)
{
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
server->hook_timer_connection = NULL;
-
+
if (!server->is_connected)
{
weechat_printf (server->buffer,
@@ -2256,7 +2256,7 @@ irc_server_timer_connection_cb (void *data, int remaining_calls)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
irc_server_disconnect (server, !server->is_connected, 1);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2273,17 +2273,17 @@ int
irc_server_timer_sasl_cb (void *data, int remaining_calls)
{
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
server->hook_timer_sasl = NULL;
-
+
if (!server->is_connected)
{
weechat_printf (server->buffer,
@@ -2291,7 +2291,7 @@ irc_server_timer_sasl_cb (void *data, int remaining_calls)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
irc_server_sendf (server, 0, NULL, "CAP END");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2306,7 +2306,7 @@ irc_server_check_manual_joins_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_irc_server *server;
-
+
server = (struct t_irc_server *)data;
if (server)
{
@@ -2328,13 +2328,13 @@ irc_server_timer_cb (void *data, int remaining_calls)
time_t current_time;
static struct timeval tv;
int away_check;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
current_time = time (NULL);
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -2351,7 +2351,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
{
/* send queued messages */
irc_server_outqueue_send (ptr_server);
-
+
/* check for lag */
if ((weechat_config_integer (irc_config_network_lag_check) > 0)
&& (ptr_server->lag_check_time.tv_sec == 0)
@@ -2377,7 +2377,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
}
}
}
-
+
/* check if it's time to autojoin channels (after command delay) */
if ((ptr_server->command_time != 0)
&& (current_time >= ptr_server->command_time +
@@ -2386,7 +2386,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
irc_server_autojoin_channels (ptr_server);
ptr_server->command_time = 0;
}
-
+
/* compute lag */
if (ptr_server->lag_check_time.tv_sec != 0)
{
@@ -2412,22 +2412,22 @@ irc_server_timer_cb (void *data, int remaining_calls)
irc_server_disconnect (ptr_server, 0, 1);
}
}
-
+
/* remove redirects if timeout occurs */
ptr_redirect = ptr_server->redirects;
while (ptr_redirect)
{
ptr_next_redirect = ptr_redirect->next_redirect;
-
+
if ((ptr_redirect->start_time > 0)
&& (ptr_redirect->start_time + ptr_redirect->timeout < current_time))
{
irc_redirect_stop (ptr_redirect, "timeout");
}
-
+
ptr_redirect = ptr_next_redirect;
}
-
+
/* remove old channels in "manual_joins" (each 60 seconds) */
if (current_time > irc_server_last_check_manual_joins + 60)
{
@@ -2438,7 +2438,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2450,25 +2450,25 @@ void
irc_server_close_connection (struct t_irc_server *server)
{
int i;
-
+
if (server->hook_timer_connection)
{
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = NULL;
}
-
+
if (server->hook_timer_sasl)
{
weechat_unhook (server->hook_timer_sasl);
server->hook_timer_sasl = NULL;
}
-
+
if (server->hook_fd)
{
weechat_unhook (server->hook_fd);
server->hook_fd = NULL;
}
-
+
if (server->hook_connect)
{
weechat_unhook (server->hook_connect);
@@ -2496,7 +2496,7 @@ irc_server_close_connection (struct t_irc_server *server)
#endif
server->sock = -1;
}
-
+
/* free any pending message */
if (server->unterminated_message)
{
@@ -2507,13 +2507,13 @@ irc_server_close_connection (struct t_irc_server *server)
{
irc_server_outqueue_free_all (server, i);
}
-
+
/* remove all redirects */
irc_redirect_free_all (server);
-
+
/* remove all manual joins */
weechat_hashtable_remove_all (server->manual_joins);
-
+
/* server is now disconnected */
server->is_connected = 0;
server->ssl_connected = 0;
@@ -2527,7 +2527,7 @@ void
irc_server_reconnect_schedule (struct t_irc_server *server)
{
int minutes, seconds;
-
+
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))
{
/* growing reconnect delay */
@@ -2538,9 +2538,9 @@ irc_server_reconnect_schedule (struct t_irc_server *server)
if ((weechat_config_integer (irc_config_network_autoreconnect_delay_max) > 0)
&& (server->reconnect_delay > weechat_config_integer (irc_config_network_autoreconnect_delay_max)))
server->reconnect_delay = weechat_config_integer (irc_config_network_autoreconnect_delay_max);
-
+
server->reconnect_start = time (NULL);
-
+
minutes = server->reconnect_delay / 60;
seconds = server->reconnect_delay % 60;
if ((minutes > 0) && (seconds > 0))
@@ -2585,14 +2585,14 @@ void
irc_server_login (struct t_irc_server *server)
{
const char *password, *username, *realname;
-
+
password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD);
username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME);
realname = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME);
-
+
if (password && password[0])
irc_server_sendf (server, 0, NULL, "PASS %s", password);
-
+
if (!server->nick)
{
irc_server_set_nick (server,
@@ -2602,12 +2602,12 @@ irc_server_login (struct t_irc_server *server)
}
else
server->nick_first_tried = irc_server_get_nick_index (server);
-
+
if (irc_server_sasl_enabled (server))
{
irc_server_sendf (server, 0, NULL, "CAP LS");
}
-
+
irc_server_sendf (server, 0, NULL,
"NICK %s\n"
"USER %s %s %s :%s",
@@ -2616,7 +2616,7 @@ irc_server_login (struct t_irc_server *server)
(username && username[0]) ? username : "weechat",
server->current_address,
(realname && realname[0]) ? realname : ((username && username[0]) ? username : "weechat"));
-
+
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = weechat_hook_timer (
@@ -2668,13 +2668,13 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
{
struct t_irc_server *server;
const char *proxy;
-
+
server = (struct t_irc_server *)data;
-
+
proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY);
-
+
server->hook_connect = NULL;
-
+
switch (status)
{
case WEECHAT_HOOK_CONNECT_OK:
@@ -2833,7 +2833,7 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
irc_server_reconnect_schedule (server);
break;
}
-
+
return WEECHAT_RC_OK;
}
@@ -2846,7 +2846,7 @@ irc_server_set_buffer_title (struct t_irc_server *server)
{
char *title;
int length;
-
+
if (server && server->buffer)
{
if (server->is_connected)
@@ -2881,7 +2881,7 @@ irc_server_create_buffer (struct t_irc_server *server)
{
char buffer_name[256], charset_modifier[256];
struct t_gui_buffer *ptr_buffer_for_merge;
-
+
ptr_buffer_for_merge = NULL;
switch (weechat_config_integer (irc_config_look_server_buffer))
{
@@ -2894,7 +2894,7 @@ irc_server_create_buffer (struct t_irc_server *server)
ptr_buffer_for_merge = irc_buffer_search_first_for_all_servers ();
break;
}
-
+
snprintf (buffer_name, sizeof (buffer_name),
"server.%s", server->name);
server->buffer = weechat_buffer_new (buffer_name,
@@ -2912,13 +2912,13 @@ irc_server_create_buffer (struct t_irc_server *server)
"irc.%s", server->name);
weechat_buffer_set (server->buffer, "localvar_set_charset_modifier",
charset_modifier);
-
+
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, server->buffer);
-
+
if (weechat_config_boolean (irc_config_network_send_unknown_commands))
weechat_buffer_set (server->buffer, "input_get_unknown_commands", "1");
-
+
/* set highlights settings on server buffer */
weechat_buffer_set (server->buffer, "highlight_words_add", "$nick");
if (weechat_config_string (irc_config_look_highlight_tags)
@@ -2927,9 +2927,9 @@ irc_server_create_buffer (struct t_irc_server *server)
weechat_buffer_set (server->buffer, "highlight_tags",
weechat_config_string (irc_config_look_highlight_tags));
}
-
+
irc_server_set_buffer_title (server);
-
+
/*
* merge buffer if needed: if merge with(out) core set, and if no layout
* number is assigned for this buffer (if layout number is assigned, then
@@ -2940,7 +2940,7 @@ irc_server_create_buffer (struct t_irc_server *server)
{
weechat_buffer_merge (server->buffer, ptr_buffer_for_merge);
}
-
+
return server->buffer;
}
@@ -2985,16 +2985,16 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
(void) nreq;
(void) pk_algos;
(void) pk_algos_len;
-
+
rc = 0;
-
+
if (!data)
return -1;
-
+
server = (struct t_irc_server *) data;
hostname = server->current_address;
hostname_match = 0;
-
+
if (action == WEECHAT_HOOK_CONNECT_GNUTLS_CB_VERIFY_CERT)
{
weechat_printf (server->buffer,
@@ -3038,7 +3038,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
weechat_prefix ("error"));
rc = -1;
}
-
+
/* check certificates */
if (gnutls_x509_crt_init (&cert_temp) >= 0)
{
@@ -3118,7 +3118,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
cert_path1 = weechat_string_replace (cert_path0, "%h", weechat_dir);
cert_path2 = (cert_path1) ?
weechat_string_expand_home (cert_path1) : NULL;
-
+
if (cert_path2)
{
cert_str = weechat_file_get_content (cert_path2);
@@ -3126,15 +3126,15 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
{
weechat_printf (server->buffer,
_("gnutls: sending one certificate"));
-
+
filedatum.data = (unsigned char *) cert_str;
filedatum.size = strlen (cert_str);
-
+
/* certificate */
gnutls_x509_crt_init (&server->tls_cert);
gnutls_x509_crt_import (server->tls_cert, &filedatum,
GNUTLS_X509_FMT_PEM);
-
+
/* key */
gnutls_x509_privkey_init (&server->tls_cert_key);
ret = gnutls_x509_privkey_import (server->tls_cert_key,
@@ -3201,21 +3201,21 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
weechat_prefix ("error"), cert_path2);
}
}
-
+
if (cert_path1)
free (cert_path1);
if (cert_path2)
free (cert_path2);
}
}
-
+
/* an error should stop the handshake unless the user doesn't care */
if ((rc == -1)
&& (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY) == 0))
{
rc = 0;
}
-
+
return rc;
}
#endif
@@ -3233,19 +3233,19 @@ irc_server_connect (struct t_irc_server *server)
char *option_name;
struct t_config_option *proxy_type, *proxy_ipv6, *proxy_address, *proxy_port;
const char *proxy, *str_proxy_type, *str_proxy_address;
-
+
if (!server->buffer)
{
if (!irc_server_create_buffer (server))
return 0;
weechat_buffer_set (server->buffer, "display", "auto");
}
-
+
weechat_bar_item_update ("buffer_name");
-
+
irc_server_set_index_current_address (server,
server->index_current_address);
-
+
if (!server->current_address)
{
weechat_printf (server->buffer,
@@ -3255,7 +3255,7 @@ irc_server_connect (struct t_irc_server *server)
server->name);
return 0;
}
-
+
/* free some old values (from a previous connection to server) */
if (server->isupport)
{
@@ -3272,14 +3272,14 @@ irc_server_connect (struct t_irc_server *server)
free (server->prefix_chars);
server->prefix_chars = NULL;
}
-
+
proxy_type = NULL;
proxy_ipv6 = NULL;
proxy_address = NULL;
proxy_port = NULL;
str_proxy_type = NULL;
str_proxy_address = NULL;
-
+
proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY);
if (proxy && proxy[0])
{
@@ -3322,7 +3322,7 @@ irc_server_connect (struct t_irc_server *server)
return 0;
}
}
-
+
if (!server->nicks_array)
{
weechat_printf (server->buffer,
@@ -3332,7 +3332,7 @@ irc_server_connect (struct t_irc_server *server)
server->name);
return 0;
}
-
+
#ifndef HAVE_GNUTLS
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))
{
@@ -3393,10 +3393,10 @@ irc_server_connect (struct t_irc_server *server)
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
" (SSL)" : "");
}
-
+
/* close connection if opened */
irc_server_close_connection (server);
-
+
/* create socket and set options */
if (proxy_type)
{
@@ -3417,7 +3417,7 @@ irc_server_connect (struct t_irc_server *server)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
-
+
/* set SO_REUSEADDR option for socket */
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
@@ -3428,7 +3428,7 @@ irc_server_connect (struct t_irc_server *server)
"\"SO_REUSEADDR\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
/* set SO_KEEPALIVE option for socket */
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
@@ -3439,7 +3439,7 @@ irc_server_connect (struct t_irc_server *server)
"\"SO_KEEPALIVE\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
/* init SSL if asked and connect */
server->ssl_connected = 0;
#ifdef HAVE_GNUTLS
@@ -3468,11 +3468,11 @@ irc_server_connect (struct t_irc_server *server)
&irc_server_connect_cb,
server);
#endif
-
+
/* send signal "irc_server_connecting" with server name */
weechat_hook_signal_send ("irc_server_connecting",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
-
+
return 1;
}
@@ -3486,9 +3486,9 @@ irc_server_reconnect (struct t_irc_server *server)
weechat_printf (server->buffer,
_("%s: reconnecting to server..."),
IRC_PLUGIN_NAME);
-
+
server->reconnect_start = 0;
-
+
if (irc_server_connect (server))
server->reconnect_join = 1;
else
@@ -3503,7 +3503,7 @@ void
irc_server_auto_connect ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -3524,7 +3524,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
int reconnect)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
/*
@@ -3541,21 +3541,21 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
IRC_PLUGIN_NAME);
}
}
-
+
irc_server_close_connection (server);
-
+
if (server->buffer)
{
weechat_printf (server->buffer,
_("%s: disconnected from server"),
IRC_PLUGIN_NAME);
}
-
+
if (switch_address)
irc_server_switch_address (server, 0);
else
irc_server_set_index_current_address(server, 0);
-
+
if (server->nick_modes)
{
free (server->nick_modes);
@@ -3570,7 +3570,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
server->lag_last_refresh = 0;
-
+
if (reconnect
&& IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))
irc_server_reconnect_schedule (server);
@@ -3579,13 +3579,13 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
server->reconnect_delay = 0;
server->reconnect_start = 0;
}
-
+
/* discard current nick if no reconnection asked */
if (!reconnect && server->nick)
irc_server_set_nick (server, NULL);
-
+
irc_server_set_buffer_title (server);
-
+
/* send signal "irc_server_disconnected" with server name */
weechat_hook_signal_send ("irc_server_disconnected",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
@@ -3599,7 +3599,7 @@ void
irc_server_disconnect_all ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -3616,7 +3616,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
const char *autojoin;
-
+
/* auto-join after disconnection (only rejoins opened channels) */
if (!server->disable_autojoin && server->reconnect_join && server->channels)
{
@@ -3651,7 +3651,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
if (!server->disable_autojoin && autojoin && autojoin[0])
irc_command_join_server (server, autojoin, 0);
}
-
+
server->disable_autojoin = 0;
}
@@ -3663,17 +3663,17 @@ struct t_irc_server *
irc_server_search (const char *server_name)
{
struct t_irc_server *ptr_server;
-
+
if (!server_name)
return NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (strcmp (ptr_server->name, server_name) == 0)
return ptr_server;
}
-
+
/* server not found */
return NULL;
}
@@ -3687,7 +3687,7 @@ irc_server_get_number_connected ()
{
struct t_irc_server *ptr_server;
int number;
-
+
number = 0;
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
@@ -3707,7 +3707,7 @@ irc_server_get_number_buffer (struct t_irc_server *server,
int *server_pos, int *server_total)
{
struct t_irc_server *ptr_server;
-
+
*server_pos = 0;
*server_total = 0;
for (ptr_server = irc_servers; ptr_server;
@@ -3731,7 +3731,7 @@ irc_server_get_channel_count (struct t_irc_server *server)
{
int count;
struct t_irc_channel *ptr_channel;
-
+
count = 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -3751,7 +3751,7 @@ irc_server_get_pv_count (struct t_irc_server *server)
{
int count;
struct t_irc_channel *ptr_channel;
-
+
count = 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -3770,7 +3770,7 @@ void
irc_server_remove_away (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
for (ptr_channel = server->channels; ptr_channel;
@@ -3791,7 +3791,7 @@ void
irc_server_check_away (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
for (ptr_channel = server->channels; ptr_channel;
@@ -3826,13 +3826,13 @@ irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
weechat_buffer_set (server->buffer,
"localvar_del_away", "");
}
-
+
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
{
/* set away flag for nick on channel */
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
irc_channel_set_away (server, ptr_channel, nick, is_away);
-
+
/* set/del "away" local variable on channel buffer */
if (is_away)
{
@@ -3864,14 +3864,14 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *type, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -3913,9 +3913,9 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -3935,14 +3935,14 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -3966,9 +3966,9 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -3989,14 +3989,14 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -4020,9 +4020,9 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -4034,10 +4034,10 @@ struct t_hdata *
irc_server_hdata_server_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server");
if (hdata)
{
@@ -4119,14 +4119,14 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
struct t_irc_server *server)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !server)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", server->name))
return 0;
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", server->buffer))
@@ -4290,7 +4290,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_time (ptr_item, "last_away_check", server->last_away_check))
return 0;
-
+
return 1;
}
@@ -4304,7 +4304,7 @@ irc_server_print_log ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
int i;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -4599,11 +4599,11 @@ irc_server_print_log ()
weechat_log_printf (" last_channel . . . . : 0x%lx", ptr_server->last_channel);
weechat_log_printf (" prev_server. . . . . : 0x%lx", ptr_server->prev_server);
weechat_log_printf (" next_server. . . . . : 0x%lx", ptr_server->next_server);
-
+
irc_redirect_print_log (ptr_server);
-
+
irc_notify_print_log (ptr_server);
-
+
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 01ec048bd..14c58802d 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -121,7 +121,7 @@ struct t_irc_server
/* user choices */
char *name; /* internal name of server */
struct t_config_option *options[IRC_SERVER_NUM_OPTIONS];
-
+
/* internal vars */
int temp_server; /* temporary server (not saved) */
int reloading_from_config; /* 1 if reloading from config file */
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 2842a1243..231421066 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -59,7 +59,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
struct t_irc_notify *ptr_notify;
struct t_irc_raw_message *ptr_raw_message;
int rc;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -78,7 +78,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
weechat_infolist_free (infolist);
if (!rc)
return 0;
-
+
/* save server channels and nicks */
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -98,7 +98,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
weechat_infolist_free (infolist);
if (!rc)
return 0;
-
+
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
@@ -119,7 +119,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
/* save server redirects */
for (ptr_redirect = ptr_server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
@@ -139,7 +139,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save server notify list */
for (ptr_notify = ptr_server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
@@ -160,7 +160,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
/* save raw messages */
for (ptr_raw_message = irc_raw_messages; ptr_raw_message;
ptr_raw_message = ptr_raw_message->next_message)
@@ -180,7 +180,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save redirect patterns */
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
@@ -204,7 +204,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
return 1;
}
@@ -218,15 +218,15 @@ irc_upgrade_save ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 1);
if (!upgrade_file)
return 0;
-
+
rc = irc_upgrade_save_all_data (upgrade_file);
-
+
weechat_upgrade_close (upgrade_file);
-
+
return rc;
}
@@ -240,7 +240,7 @@ irc_upgrade_set_buffer_callbacks ()
{
struct t_infolist *infolist;
struct t_gui_buffer *ptr_buffer;
-
+
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
{
@@ -279,11 +279,11 @@ irc_upgrade_read_cb (void *data,
struct t_irc_redirect *ptr_redirect;
struct t_irc_notify *ptr_notify;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) upgrade_file;
-
+
weechat_infolist_reset_item_cursor (infolist);
while (weechat_infolist_next (infolist))
{
@@ -603,7 +603,7 @@ irc_upgrade_read_cb (void *data,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -619,10 +619,10 @@ irc_upgrade_load ()
struct t_upgrade_file *upgrade_file;
irc_upgrade_set_buffer_callbacks ();
-
+
upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 0);
rc = weechat_upgrade_read (upgrade_file, &irc_upgrade_read_cb, NULL);
-
+
return rc;
}
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index 4ad1fbb6e..0703273a8 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -68,11 +68,11 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
for (ptr_server = irc_servers; ptr_server;
@@ -82,7 +82,7 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
(signal_data) ? (char *)signal_data : NULL);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -96,15 +96,15 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
{
struct t_irc_server *ptr_server;
int disconnected;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
(void) signal_data;
-
+
irc_signal_upgrade_received = 1;
-
+
/*
* FIXME: it's not possible to upgrade with SSL servers connected (GnuTLS
* lib can't reload data after upgrade), so we close connection for
@@ -142,7 +142,7 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
disconnected,
NG_("server", "servers", disconnected));
}
-
+
return WEECHAT_RC_OK;
}
@@ -154,23 +154,23 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int i, auto_connect, upgrading;
-
+
weechat_plugin = plugin;
-
+
if (!irc_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (irc_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
irc_command_init ();
-
+
irc_info_init ();
-
+
irc_redirect_init ();
-
+
irc_notify_init ();
-
+
/* hook some signals */
irc_debug_init ();
weechat_hook_signal ("quit", &irc_signal_quit_cb, NULL);
@@ -179,20 +179,20 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_signal ("xfer_resume_ready", &irc_server_xfer_resume_ready_cb, NULL);
weechat_hook_signal ("xfer_send_accept_resume", &irc_server_xfer_send_accept_resume_cb, NULL);
weechat_hook_signal ("irc_input_send", &irc_input_send_cb, NULL);
-
+
/* hook hsignals for redirection */
weechat_hook_hsignal ("irc_redirect_pattern", &irc_redirect_pattern_hsignal_cb, NULL);
weechat_hook_hsignal ("irc_redirect_command", &irc_redirect_command_hsignal_cb, NULL);
-
+
/* modifiers */
weechat_hook_modifier ("irc_color_decode", &irc_color_modifier_cb, NULL);
weechat_hook_modifier ("irc_color_encode", &irc_color_modifier_cb, NULL);
-
+
/* hook completions */
irc_completion_init ();
-
+
irc_bar_item_init ();
-
+
/* look at arguments */
auto_connect = 1;
upgrading = 0;
@@ -219,7 +219,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
upgrading = 1;
}
}
-
+
if (upgrading)
{
if (!irc_upgrade_load ())
@@ -236,10 +236,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
if (auto_connect)
irc_server_auto_connect ();
}
-
+
irc_hook_timer = weechat_hook_timer (1 * 1000, 0, 0,
&irc_server_timer_cb, NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -252,10 +252,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
if (irc_hook_timer)
weechat_unhook (irc_hook_timer);
-
+
if (irc_signal_upgrade_received)
{
irc_config_write (1);
@@ -266,18 +266,18 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
irc_config_write (0);
irc_server_disconnect_all ();
}
-
+
irc_ignore_free_all ();
-
+
irc_raw_message_free_all ();
-
+
irc_server_free_all ();
-
+
irc_config_free ();
-
+
irc_notify_end ();
-
+
irc_redirect_end ();
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c
index 8f8ef0616..2344d069d 100644
--- a/src/plugins/logger/logger-buffer.c
+++ b/src/plugins/logger/logger-buffer.c
@@ -48,17 +48,17 @@ int
logger_buffer_valid (struct t_logger_buffer *logger_buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
if (!logger_buffer)
return 0;
-
+
for (ptr_logger_buffer = logger_buffers; ptr_logger_buffer;
ptr_logger_buffer = ptr_logger_buffer->next_buffer)
{
if (ptr_logger_buffer == logger_buffer)
return 1;
}
-
+
/* logger_buffer not found */
return 0;
}
@@ -71,10 +71,10 @@ struct t_logger_buffer *
logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
{
struct t_logger_buffer *new_logger_buffer;
-
+
if (!buffer)
return NULL;
-
+
if (weechat_logger_plugin->debug)
{
weechat_printf_tags (NULL,
@@ -83,7 +83,7 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"));
}
-
+
new_logger_buffer = malloc (sizeof (*new_logger_buffer));
if (new_logger_buffer)
{
@@ -94,7 +94,7 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
new_logger_buffer->log_level = log_level;
new_logger_buffer->write_start_info_line = 1;
new_logger_buffer->flush_needed = 0;
-
+
new_logger_buffer->prev_buffer = last_logger_buffer;
new_logger_buffer->next_buffer = NULL;
if (logger_buffers)
@@ -103,7 +103,7 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
logger_buffers = new_logger_buffer;
last_logger_buffer = new_logger_buffer;
}
-
+
return new_logger_buffer;
}
@@ -115,14 +115,14 @@ struct t_logger_buffer *
logger_buffer_search_buffer (struct t_gui_buffer *buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
for (ptr_logger_buffer = logger_buffers; ptr_logger_buffer;
ptr_logger_buffer = ptr_logger_buffer->next_buffer)
{
if (ptr_logger_buffer->buffer == buffer)
return ptr_logger_buffer;
}
-
+
/* logger buffer not found */
return NULL;
}
@@ -135,10 +135,10 @@ struct t_logger_buffer *
logger_buffer_search_log_filename (const char *log_filename)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
if (!log_filename)
return NULL;
-
+
for (ptr_logger_buffer = logger_buffers; ptr_logger_buffer;
ptr_logger_buffer = ptr_logger_buffer->next_buffer)
{
@@ -148,7 +148,7 @@ logger_buffer_search_log_filename (const char *log_filename)
return ptr_logger_buffer;
}
}
-
+
/* logger buffer not found */
return NULL;
}
@@ -162,9 +162,9 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer)
{
struct t_logger_buffer *new_logger_buffers;
struct t_gui_buffer *ptr_buffer;
-
+
ptr_buffer = logger_buffer->buffer;
-
+
/* remove logger buffer */
if (last_logger_buffer == logger_buffer)
last_logger_buffer = logger_buffer->prev_buffer;
@@ -175,20 +175,20 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer)
}
else
new_logger_buffers = logger_buffer->next_buffer;
-
+
if (logger_buffer->next_buffer)
(logger_buffer->next_buffer)->prev_buffer = logger_buffer->prev_buffer;
-
+
/* free data */
if (logger_buffer->log_filename)
free (logger_buffer->log_filename);
if (logger_buffer->log_file)
fclose (logger_buffer->log_file);
-
+
free (logger_buffer);
-
+
logger_buffers = new_logger_buffers;
-
+
if (weechat_logger_plugin->debug)
{
weechat_printf_tags (NULL,
@@ -209,14 +209,14 @@ logger_buffer_add_to_infolist (struct t_infolist *infolist,
struct t_logger_buffer *logger_buffer)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !logger_buffer)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", logger_buffer->buffer))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "log_filename", logger_buffer->log_filename))
@@ -231,6 +231,6 @@ logger_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "flush_needed", logger_buffer->flush_needed))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c
index f6ec61b83..a4f33cfd3 100644
--- a/src/plugins/logger/logger-config.c
+++ b/src/plugins/logger/logger-config.c
@@ -64,7 +64,7 @@ logger_config_change_file_option_restart_log (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!logger_config_loading)
logger_adjust_log_filenames ();
}
@@ -80,10 +80,10 @@ logger_config_flush_delay_change (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (logger_config_loading)
return;
-
+
if (logger_timer)
{
if (weechat_logger_plugin->debug)
@@ -95,7 +95,7 @@ logger_config_flush_delay_change (void *data,
weechat_unhook (logger_timer);
logger_timer = NULL;
}
-
+
if (weechat_config_integer (logger_config_file_flush_delay) > 0)
{
if (weechat_logger_plugin->debug)
@@ -123,7 +123,7 @@ logger_config_level_change (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!logger_config_loading)
logger_start_buffer_all (1);
}
@@ -142,11 +142,11 @@ logger_config_level_delete_option (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
weechat_config_option_free (option);
-
+
logger_start_buffer_all (1);
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -163,12 +163,12 @@ logger_config_level_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -205,7 +205,7 @@ logger_config_level_create_option (void *data,
if (!logger_config_loading)
logger_start_buffer_all (1);
-
+
return rc;
}
@@ -265,11 +265,11 @@ logger_config_mask_delete_option (void *data,
(void) data;
(void) config_file;
(void) section;
-
+
weechat_config_option_free (option);
-
+
logger_adjust_log_filenames ();
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -286,12 +286,12 @@ logger_config_mask_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -325,10 +325,10 @@ logger_config_mask_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (!logger_config_loading)
logger_adjust_log_filenames ();
-
+
return rc;
}
@@ -353,12 +353,12 @@ int
logger_config_init ()
{
struct t_config_section *ptr_section;
-
+
logger_config_file = weechat_config_new (LOGGER_CONFIG_NAME,
NULL, NULL);
if (!logger_config_file)
return 0;
-
+
/* look */
ptr_section = weechat_config_new_section (logger_config_file, "look",
0, 0,
@@ -370,14 +370,14 @@ logger_config_init ()
weechat_config_free (logger_config_file);
return 0;
}
-
+
logger_config_look_backlog = weechat_config_new_option (
logger_config_file, ptr_section,
"backlog", "integer",
N_("maximum number of lines to display from log file when creating "
"new buffer (0 = no backlog)"),
NULL, 0, INT_MAX, "20", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* file */
ptr_section = weechat_config_new_section (logger_config_file, "file",
0, 0,
@@ -389,7 +389,7 @@ logger_config_init ()
weechat_config_free (logger_config_file);
return 0;
}
-
+
logger_config_file_auto_log = weechat_config_new_option (
logger_config_file, ptr_section,
"auto_log", "boolean",
@@ -446,7 +446,7 @@ logger_config_init ()
N_("timestamp used in log files (see man strftime for date/time "
"specifiers)"),
NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* level */
ptr_section = weechat_config_new_section (logger_config_file, "level",
1, 1,
@@ -459,9 +459,9 @@ logger_config_init ()
weechat_config_free (logger_config_file);
return 0;
}
-
+
logger_config_section_level = ptr_section;
-
+
/* mask */
ptr_section = weechat_config_new_section (logger_config_file, "mask",
1, 1,
@@ -474,9 +474,9 @@ logger_config_init ()
weechat_config_free (logger_config_file);
return 0;
}
-
+
logger_config_section_mask = ptr_section;
-
+
return 1;
}
@@ -488,13 +488,13 @@ int
logger_config_read ()
{
int rc;
-
+
logger_config_loading = 1;
rc = weechat_config_read (logger_config_file);
logger_config_loading = 0;
-
+
logger_config_flush_delay_change (NULL, NULL);
-
+
return rc;
}
diff --git a/src/plugins/logger/logger-info.c b/src/plugins/logger/logger-info.c
index fe21e8e27..c92e7660d 100644
--- a/src/plugins/logger/logger-info.c
+++ b/src/plugins/logger/logger-info.c
@@ -39,19 +39,19 @@ logger_info_get_infolist_cb (void *data, const char *infolist_name,
{
struct t_infolist *ptr_infolist;
struct t_logger_buffer *ptr_logger_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "logger_buffer") == 0)
{
if (pointer && !logger_buffer_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -82,7 +82,7 @@ logger_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
diff --git a/src/plugins/logger/logger-tail.c b/src/plugins/logger/logger-tail.c
index ecf45ac22..840099d48 100644
--- a/src/plugins/logger/logger-tail.c
+++ b/src/plugins/logger/logger-tail.c
@@ -52,7 +52,7 @@ logger_tail_last_eol (const char *string_start, const char *string_ptr)
return (char *)string_ptr;
string_ptr--;
}
-
+
/* no end-of-line found in string */
return NULL;
}
@@ -71,12 +71,12 @@ logger_tail_file (const char *filename, int n_lines)
char buf[LOGGER_TAIL_BUFSIZE + 1];
char *ptr_buf, *pos_eol, *part_of_line, *new_part_of_line;
struct t_logger_line *ptr_line, *new_line;
-
+
/* open file */
fd = open (filename, O_RDONLY);
if (fd == -1)
return NULL;
-
+
/* seek to the end of file */
file_length = lseek (fd, (off_t)0, SEEK_END);
if (file_length <= 0)
@@ -91,7 +91,7 @@ logger_tail_file (const char *filename, int n_lines)
else
to_read = LOGGER_TAIL_BUFSIZE;
lseek (fd, file_pos, SEEK_SET);
-
+
/* loop until we have "n_lines" lines in list */
part_of_line = NULL;
ptr_line = NULL;
@@ -200,12 +200,12 @@ logger_tail_file (const char *filename, int n_lines)
else
to_read = LOGGER_TAIL_BUFSIZE;
}
-
+
if (part_of_line)
free (part_of_line);
-
+
close (fd);
-
+
return ptr_line;
}
@@ -217,7 +217,7 @@ void
logger_tail_free (struct t_logger_line *lines)
{
struct t_logger_line *ptr_line, *next_line;
-
+
if (!lines)
return;
@@ -225,11 +225,11 @@ logger_tail_free (struct t_logger_line *lines)
while (ptr_line)
{
next_line = ptr_line->next_line;
-
+
if (ptr_line->data)
free (ptr_line->data);
free (ptr_line);
-
+
ptr_line = next_line;
}
}
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index 1641e528d..3b960c667 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -72,20 +72,20 @@ logger_get_file_path ()
int length;
time_t seconds;
struct tm *date_tmp;
-
+
file_path = NULL;
file_path2 = NULL;
file_path3 = NULL;
-
+
weechat_dir = weechat_info_get ("weechat_dir", "");
if (!weechat_dir)
goto end;
-
+
/* replace "~" with user home */
file_path = weechat_string_expand_home (weechat_config_string (logger_config_file_path));
if (!file_path)
goto end;
-
+
/* replace "%h" with WeeChat home (at beginning of string only) */
if (strncmp (file_path, "%h", 2) == 0)
{
@@ -98,7 +98,7 @@ logger_get_file_path ()
file_path2 = strdup (file_path);
if (!file_path2)
goto end;
-
+
/* replace date/time specifiers in path */
length = strlen (file_path2) + 256 + 1;
file_path3 = malloc (length);
@@ -108,7 +108,7 @@ logger_get_file_path ()
date_tmp = localtime (&seconds);
file_path3[0] = '\0';
strftime (file_path3, length - 1, file_path2, date_tmp);
-
+
if (weechat_logger_plugin->debug)
{
weechat_printf_tags (NULL,
@@ -116,13 +116,13 @@ logger_get_file_path ()
"%s: file path = \"%s\"",
LOGGER_PLUGIN_NAME, file_path3);
}
-
+
end:
if (file_path)
free (file_path);
if (file_path2)
free (file_path2);
-
+
return file_path3;
}
@@ -137,7 +137,7 @@ logger_create_directory ()
{
int rc;
char *file_path;
-
+
rc = 1;
file_path = logger_get_file_path ();
@@ -149,7 +149,7 @@ logger_create_directory ()
}
else
rc = 0;
-
+
return rc;
}
@@ -163,20 +163,20 @@ logger_build_option_name (struct t_gui_buffer *buffer)
const char *plugin_name, *name;
char *option_name;
int length;
-
+
if (!buffer)
return NULL;
-
+
plugin_name = weechat_buffer_get_string (buffer, "plugin");
name = weechat_buffer_get_string (buffer, "name");
-
+
length = strlen (plugin_name) + 1 + strlen (name) + 1;
option_name = malloc (length);
if (!option_name)
return NULL;
-
+
snprintf (option_name, length, "%s.%s", plugin_name, name);
-
+
return option_name;
}
@@ -190,16 +190,16 @@ logger_get_level_for_buffer (struct t_gui_buffer *buffer)
const char *no_log;
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
-
+
/* no log for buffer if local variable "no_log" is defined for buffer */
no_log = weechat_buffer_get_string (buffer, "localvar_no_log");
if (no_log && no_log[0])
return 0;
-
+
name = logger_build_option_name (buffer);
if (!name)
return LOGGER_LEVEL_DEFAULT;
-
+
option_name = strdup (name);
if (option_name)
{
@@ -222,16 +222,16 @@ logger_get_level_for_buffer (struct t_gui_buffer *buffer)
ptr_end[0] = '\0';
}
ptr_option = logger_config_get_level (option_name);
-
+
free (option_name);
free (name);
-
+
if (ptr_option)
return weechat_config_integer (ptr_option);
}
else
free (name);
-
+
/* nothing found => return default level */
return LOGGER_LEVEL_DEFAULT;
}
@@ -247,11 +247,11 @@ logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
-
+
name = logger_build_option_name (buffer);
if (!name)
return NULL;
-
+
option_name = strdup (name);
if (option_name)
{
@@ -274,21 +274,21 @@ logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
ptr_end[0] = '\0';
}
ptr_option = logger_config_get_mask (option_name);
-
+
free (option_name);
free (name);
-
+
if (ptr_option)
return weechat_config_string (ptr_option);
}
else
free (name);
-
+
/* nothing found => return default mask (if set) */
if (weechat_config_string (logger_config_file_mask)
&& weechat_config_string (logger_config_file_mask)[0])
return weechat_config_string (logger_config_file_mask);
-
+
/* no default mask set */
return NULL;
}
@@ -309,7 +309,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
int length;
time_t seconds;
struct tm *date_tmp;
-
+
mask2 = NULL;
mask_decoded = NULL;
mask_decoded2 = NULL;
@@ -319,7 +319,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
dir_separator = weechat_info_get ("dir_separator", "");
if (!dir_separator)
return NULL;
-
+
/*
* we first replace directory separator (commonly '/') by \01 because
* buffer mask can contain this char, and will be replaced by replacement
@@ -328,23 +328,23 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
mask2 = weechat_string_replace (mask, dir_separator, "\01");
if (!mask2)
goto end;
-
+
mask_decoded = weechat_buffer_string_replace_local_var (buffer, mask2);
if (!mask_decoded)
goto end;
-
+
mask_decoded2 = weechat_string_replace (mask_decoded,
dir_separator,
weechat_config_string (logger_config_file_replacement_char));
if (!mask_decoded2)
goto end;
-
+
/* restore directory separator */
mask_decoded3 = weechat_string_replace (mask_decoded2,
"\01", dir_separator);
if (!mask_decoded3)
goto end;
-
+
/* replace date/time specifiers in mask */
length = strlen (mask_decoded3) + 256 + 1;
mask_decoded4 = malloc (length);
@@ -354,11 +354,11 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
date_tmp = localtime (&seconds);
mask_decoded4[0] = '\0';
strftime (mask_decoded4, length - 1, mask_decoded3, date_tmp);
-
+
/* convert to lower case? */
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (mask_decoded4);
-
+
if (weechat_logger_plugin->debug)
{
weechat_printf_tags (NULL,
@@ -369,7 +369,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
weechat_buffer_get_string (buffer, "name"),
mask, mask_decoded4);
}
-
+
end:
if (mask2)
free (mask2);
@@ -379,7 +379,7 @@ end:
free (mask_decoded2);
if (mask_decoded3)
free (mask_decoded3);
-
+
return mask_decoded4;
}
@@ -394,18 +394,18 @@ logger_get_filename (struct t_gui_buffer *buffer)
const char *mask;
const char *dir_separator, *weechat_dir;
int length;
-
+
res = NULL;
mask_expanded = NULL;
file_path = NULL;
-
+
dir_separator = weechat_info_get ("dir_separator", "");
if (!dir_separator)
return NULL;
weechat_dir = weechat_info_get ("weechat_dir", "");
if (!weechat_dir)
return NULL;
-
+
/* get filename mask for buffer */
mask = logger_get_mask_for_buffer (buffer);
if (!mask)
@@ -418,15 +418,15 @@ logger_get_filename (struct t_gui_buffer *buffer)
weechat_buffer_get_string (buffer, "name"));
return NULL;
}
-
+
mask_expanded = logger_get_mask_expanded (buffer, mask);
if (!mask_expanded)
goto end;
-
+
file_path = logger_get_file_path ();
if (!file_path)
goto end;
-
+
/* build string with path + mask */
length = strlen (file_path) + strlen (dir_separator) +
strlen (mask_expanded) + 1;
@@ -438,13 +438,13 @@ logger_get_filename (struct t_gui_buffer *buffer)
(file_path[strlen (file_path) - 1] == dir_separator[0]) ? "" : dir_separator,
mask_expanded);
}
-
+
end:
if (mask_expanded)
free (mask_expanded);
if (file_path)
free (file_path);
-
+
return res;
}
@@ -458,7 +458,7 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
char *log_filename, *pos_last_sep;
const char *dir_separator;
struct t_logger_buffer *ptr_logger_buffer;
-
+
/* get log filename for buffer */
log_filename = logger_get_filename (logger_buffer->buffer);
if (!log_filename)
@@ -470,7 +470,7 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
LOGGER_PLUGIN_NAME);
return;
}
-
+
/* log file is already used by another buffer? */
ptr_logger_buffer = logger_buffer_search_log_filename (log_filename);
if (ptr_logger_buffer)
@@ -487,7 +487,7 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
free (log_filename);
return;
}
-
+
/* create directory for path in "log_filename" */
dir_separator = weechat_info_get ("dir_separator", "");
if (dir_separator)
@@ -500,7 +500,7 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
pos_last_sep[0] = dir_separator[0];
}
}
-
+
/* set log filename */
logger_buffer->log_filename = log_filename;
}
@@ -518,9 +518,9 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
time_t seconds;
struct tm *date_tmp;
int log_level;
-
+
charset = weechat_info_get ("charset_terminal", "");
-
+
if (!logger_buffer->log_file)
{
log_level = logger_get_level_for_buffer (logger_buffer->buffer);
@@ -547,7 +547,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
logger_buffer_free (logger_buffer);
return;
}
-
+
logger_buffer->log_file =
fopen (logger_buffer->log_filename, "a");
if (!logger_buffer->log_file)
@@ -560,7 +560,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
logger_buffer_free (logger_buffer);
return;
}
-
+
if (weechat_config_boolean (logger_config_file_info_lines)
&& logger_buffer->write_start_info_line)
{
@@ -586,7 +586,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
}
logger_buffer->write_start_info_line = 0;
}
-
+
weechat_va_format (format);
if (vbuffer)
{
@@ -616,10 +616,10 @@ logger_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
time_t seconds;
struct tm *date_tmp;
char buf_time[256];
-
+
if (!logger_buffer)
return;
-
+
if (logger_buffer->log_enabled && logger_buffer->log_file)
{
if (write_info_line && weechat_config_boolean (logger_config_file_info_lines))
@@ -665,16 +665,16 @@ logger_start_buffer (struct t_gui_buffer *buffer, int write_info_line)
{
struct t_logger_buffer *ptr_logger_buffer;
int log_level, log_enabled;
-
+
if (!buffer)
return;
-
+
log_level = logger_get_level_for_buffer (buffer);
log_enabled = weechat_config_boolean (logger_config_file_auto_log)
&& (log_level > 0);
-
+
ptr_logger_buffer = logger_buffer_search_buffer (buffer);
-
+
/* logging is disabled for buffer */
if (!log_enabled)
{
@@ -690,7 +690,7 @@ logger_start_buffer (struct t_gui_buffer *buffer, int write_info_line)
else
{
ptr_logger_buffer = logger_buffer_add (buffer, log_level);
-
+
if (ptr_logger_buffer)
{
if (ptr_logger_buffer->log_filename)
@@ -716,7 +716,7 @@ void
logger_start_buffer_all (int write_info_line)
{
struct t_infolist *ptr_infolist;
-
+
ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (ptr_infolist)
{
@@ -741,10 +741,10 @@ logger_list ()
struct t_logger_buffer *ptr_logger_buffer;
struct t_gui_buffer *ptr_buffer;
char status[128];
-
+
weechat_printf (NULL, "");
weechat_printf (NULL, _("Logging on buffers:"));
-
+
ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (ptr_infolist)
{
@@ -796,11 +796,11 @@ logger_set_buffer (struct t_gui_buffer *buffer, const char *value)
{
char *name;
struct t_config_option *ptr_option;
-
+
name = logger_build_option_name (buffer);
if (!name)
return;
-
+
if (logger_config_set_level (name, value) != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
ptr_option = logger_config_get_level (name);
@@ -811,7 +811,7 @@ logger_set_buffer (struct t_gui_buffer *buffer, const char *value)
weechat_config_integer (ptr_option));
}
}
-
+
free (name);
}
@@ -826,14 +826,14 @@ logger_command_cb (void *data, struct t_gui_buffer *buffer,
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if ((argc == 1)
|| ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0)))
{
logger_list ();
return WEECHAT_RC_OK;
}
-
+
if (argc > 1)
{
if (weechat_strcasecmp (argv[1], "set") == 0)
@@ -842,13 +842,13 @@ logger_command_cb (void *data, struct t_gui_buffer *buffer,
logger_set_buffer (buffer, argv[2]);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "disable") == 0)
{
logger_set_buffer (buffer, "0");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -864,9 +864,9 @@ logger_buffer_opened_signal_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
logger_start_buffer (signal_data, 1);
-
+
return WEECHAT_RC_OK;
}
@@ -882,9 +882,9 @@ logger_buffer_closing_signal_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
logger_stop (logger_buffer_search_buffer (signal_data), 1);
-
+
return WEECHAT_RC_OK;
}
@@ -900,10 +900,10 @@ logger_buffer_renamed_signal_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
logger_stop (logger_buffer_search_buffer (signal_data), 1);
logger_start_buffer (signal_data, 1);
-
+
return WEECHAT_RC_OK;
}
@@ -919,7 +919,7 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines)
time_t datetime, time_now;
struct tm tm_line;
int num_lines;
-
+
weechat_buffer_set (buffer, "print_hooks_enabled", "0");
num_lines = 0;
last_lines = logger_tail_file (filename, lines);
@@ -990,7 +990,7 @@ logger_backlog_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
@@ -1003,20 +1003,20 @@ logger_backlog_signal_cb (void *data, const char *signal,
{
if (!ptr_logger_buffer->log_filename)
logger_set_log_filename (ptr_logger_buffer);
-
+
if (ptr_logger_buffer->log_filename)
{
ptr_logger_buffer->log_enabled = 0;
-
+
logger_backlog (signal_data,
ptr_logger_buffer->log_filename,
weechat_config_integer (logger_config_look_backlog));
-
+
ptr_logger_buffer->log_enabled = 1;
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1032,9 +1032,9 @@ logger_start_signal_cb (void *data, const char *signal, const char *type_data,
(void) data;
(void) signal;
(void) type_data;
-
+
logger_start_buffer (signal_data, 1);
-
+
return WEECHAT_RC_OK;
}
@@ -1047,16 +1047,16 @@ logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
ptr_logger_buffer = logger_buffer_search_buffer (signal_data);
if (ptr_logger_buffer)
logger_stop (ptr_logger_buffer, 0);
-
+
return WEECHAT_RC_OK;
}
@@ -1073,7 +1073,7 @@ logger_adjust_log_filenames ()
struct t_logger_buffer *ptr_logger_buffer;
struct t_gui_buffer *ptr_buffer;
char *log_filename;
-
+
ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (ptr_infolist)
{
@@ -1116,9 +1116,9 @@ logger_day_changed_signal_cb (void *data, const char *signal,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
logger_adjust_log_filenames ();
-
+
return WEECHAT_RC_OK;
}
@@ -1130,13 +1130,13 @@ int
logger_line_log_level (int tags_count, const char **tags)
{
int i;
-
+
for (i = 0; i < tags_count; i++)
{
/* log disabled on line? return -1 */
if (strcmp (tags[i], "no_log") == 0)
return -1;
-
+
/* log level for line? return it */
if (strncmp (tags[i], "log", 3) == 0)
{
@@ -1146,7 +1146,7 @@ logger_line_log_level (int tags_count, const char **tags)
}
}
}
-
+
/* return default log level for line */
return LOGGER_LEVEL_DEFAULT;
}
@@ -1165,12 +1165,12 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
struct tm *date_tmp;
char buf_time[256];
int line_log_level;
-
+
/* make C compiler happy */
(void) data;
(void) displayed;
(void) highlight;
-
+
line_log_level = logger_line_log_level (tags_count, tags);
if (line_log_level >= 0)
{
@@ -1188,7 +1188,7 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
weechat_config_string (logger_config_file_time_format),
date_tmp);
}
-
+
logger_write_line (ptr_logger_buffer,
"%s\t%s\t%s",
buf_time,
@@ -1196,7 +1196,7 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
message);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1208,11 +1208,11 @@ int
logger_timer_cb (void *data, int remaining_calls)
{
struct t_logger_buffer *ptr_logger_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
for (ptr_logger_buffer = logger_buffers; ptr_logger_buffer;
ptr_logger_buffer = ptr_logger_buffer->next_buffer)
{
@@ -1230,7 +1230,7 @@ logger_timer_cb (void *data, int remaining_calls)
ptr_logger_buffer->flush_needed = 0;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1244,15 +1244,15 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
if (!logger_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (logger_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
/* command /logger */
weechat_hook_command ("logger",
N_("logger plugin configuration"),
@@ -1291,9 +1291,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" || set 1|2|3|4|5|6|7|8|9"
" || disable",
&logger_command_cb, NULL);
-
+
logger_start_buffer_all (1);
-
+
weechat_hook_signal ("buffer_opened", &logger_buffer_opened_signal_cb, NULL);
weechat_hook_signal ("buffer_closing", &logger_buffer_closing_signal_cb, NULL);
weechat_hook_signal ("buffer_renamed", &logger_buffer_renamed_signal_cb, NULL);
@@ -1301,11 +1301,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_signal ("logger_start", &logger_start_signal_cb, NULL);
weechat_hook_signal ("logger_stop", &logger_stop_signal_cb, NULL);
weechat_hook_signal ("day_changed", &logger_day_changed_signal_cb, NULL);
-
+
weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL);
-
+
logger_info_init ();
-
+
return WEECHAT_RC_OK;
}
@@ -1318,18 +1318,18 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
if (logger_timer)
{
weechat_unhook (logger_timer);
logger_timer = NULL;
}
-
+
logger_config_write ();
-
+
logger_stop_all (1);
-
+
logger_config_free ();
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 95de05b7c..c79ae5f11 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -75,7 +75,7 @@ plugin_api_charset_set (struct t_weechat_plugin *plugin, const char *charset)
if (plugin->charset)
free (plugin->charset);
-
+
plugin->charset = (charset) ? strdup (charset) : NULL;
}
@@ -99,7 +99,7 @@ plugin_api_ngettext (const char *single, const char *plural, int count)
/* make C compiler happy */
(void) single;
(void) count;
-
+
return NG_(single, plural, count);
}
@@ -111,9 +111,9 @@ struct t_config_option *
plugin_api_config_get (const char *option_name)
{
struct t_config_option *ptr_option;
-
+
config_file_search_with_string (option_name, NULL, NULL, &ptr_option, NULL);
-
+
return ptr_option;
}
@@ -126,14 +126,14 @@ plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
const char *option_name)
{
struct t_config_option *ptr_option;
-
+
if (!plugin || !option_name)
return NULL;
-
+
ptr_option = plugin_config_search (plugin->name, option_name);
if (ptr_option)
return ptr_option->value;
-
+
/* option not found */
return NULL;
}
@@ -147,14 +147,14 @@ plugin_api_config_is_set_plugin (struct t_weechat_plugin *plugin,
const char *option_name)
{
struct t_config_option *ptr_option;
-
+
if (!plugin || !option_name)
return 0;
-
+
ptr_option = plugin_config_search (plugin->name, option_name);
if (ptr_option)
return 1;
-
+
return 0;
}
@@ -168,7 +168,7 @@ plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
{
if (!plugin || !option_name)
return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND;
-
+
return plugin_config_set (plugin->name, option_name, value);
}
@@ -194,14 +194,14 @@ plugin_api_config_unset_plugin (struct t_weechat_plugin *plugin,
const char *option_name)
{
struct t_config_option *ptr_option;
-
+
if (!plugin || !option_name)
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
-
+
ptr_option = plugin_config_search (plugin->name, option_name);
if (!ptr_option)
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
-
+
return config_file_option_unset (ptr_option);
}
@@ -214,7 +214,7 @@ plugin_api_prefix (const char *prefix)
{
if (!prefix)
return gui_chat_prefix_empty;
-
+
if (string_strcasecmp (prefix, "error") == 0)
return gui_chat_prefix[GUI_CHAT_PREFIX_ERROR];
if (string_strcasecmp (prefix, "network") == 0)
@@ -225,7 +225,7 @@ plugin_api_prefix (const char *prefix)
return gui_chat_prefix[GUI_CHAT_PREFIX_JOIN];
if (string_strcasecmp (prefix, "quit") == 0)
return gui_chat_prefix[GUI_CHAT_PREFIX_QUIT];
-
+
return gui_chat_prefix_empty;
}
@@ -237,15 +237,15 @@ const char *
plugin_api_color (const char *color_name)
{
const char *str_color;
-
+
if (!color_name)
return GUI_NO_COLOR;
-
+
/* name is a weechat color option ? => then return this color */
str_color = gui_color_search_config (color_name);
if (str_color)
return str_color;
-
+
return gui_color_get_custom (color_name);
}
@@ -258,10 +258,10 @@ plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command)
{
char *command2;
-
+
if (!plugin || !command)
return;
-
+
command2 = string_iconv_to_internal (plugin->charset, command);
if (!buffer)
buffer = gui_current_window->buffer;
@@ -281,14 +281,14 @@ plugin_api_info_get_internal (void *data, const char *info_name,
time_t inactivity;
static char value[32], version_number[32] = { '\0' };
static char weechat_dir_absolute_path[PATH_MAX] = { '\0' };
-
+
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (!info_name)
return NULL;
-
+
if (string_strcasecmp (info_name, "version") == 0)
{
return PACKAGE_VERSION;
@@ -372,7 +372,7 @@ plugin_api_info_get_internal (void *data, const char *info_name,
snprintf (value, sizeof (value), "%d", gui_cursor_mode);
return value;
}
-
+
/* info not found */
return NULL;
}
@@ -403,10 +403,10 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
char buffer_full_name[1024];
int context, number;
char *error;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
@@ -415,7 +415,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid bar pointer ? */
if (pointer && (!gui_bar_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -453,7 +453,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid bar item pointer ? */
if (pointer && (!gui_bar_item_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -492,7 +492,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid bar window pointer ? */
if (pointer && (!gui_bar_window_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -543,7 +543,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid buffer pointer ? */
if (pointer && (!gui_buffer_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -591,7 +591,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
if (!gui_buffer_valid (pointer))
return NULL;
}
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -635,7 +635,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid buffer pointer ? */
if (pointer && (!gui_buffer_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -711,7 +711,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid buffer pointer ? */
if (!pointer || (!gui_buffer_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -741,7 +741,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid plugin pointer ? */
if (pointer && (!plugin_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -780,7 +780,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
/* invalid window pointer ? */
if (pointer && (!gui_window_valid (pointer)))
return NULL;
-
+
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
@@ -849,7 +849,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
}
}
}
-
+
/* infolist not found */
return NULL;
}
@@ -865,7 +865,7 @@ plugin_api_infolist_next (struct t_infolist *infolist)
{
if (!infolist || !infolist_valid (infolist))
return 0;
-
+
return (infolist_next (infolist)) ? 1 : 0;
}
@@ -906,7 +906,7 @@ plugin_api_infolist_fields (struct t_infolist *infolist)
{
if (!infolist || !infolist_valid (infolist))
return NULL;
-
+
return infolist_fields (infolist);
}
@@ -919,7 +919,7 @@ plugin_api_infolist_integer (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
return 0;
-
+
return infolist_integer (infolist, var);
}
@@ -932,7 +932,7 @@ plugin_api_infolist_string (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
return NULL;
-
+
return infolist_string (infolist, var);
}
@@ -945,7 +945,7 @@ plugin_api_infolist_pointer (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
return NULL;
-
+
return infolist_pointer (infolist, var);
}
@@ -959,7 +959,7 @@ plugin_api_infolist_buffer (struct t_infolist *infolist, const char *var,
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
return NULL;
-
+
return infolist_buffer (infolist, var, size);
}
@@ -972,7 +972,7 @@ plugin_api_infolist_time (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
return 0;
-
+
return infolist_time (infolist, var);
}
@@ -1027,7 +1027,7 @@ plugin_api_init ()
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "cursor_mode", N_("1 if cursor mode is enabled"), NULL,
&plugin_api_info_get_internal, NULL);
-
+
/* WeeChat core infolist hooks */
hook_infolist (NULL, "bar", N_("list of bars"),
N_("bar pointer (optional)"),
@@ -1089,7 +1089,7 @@ plugin_api_init ()
N_("window pointer (optional)"),
N_("\"current\" for current window or a window number (optional)"),
&plugin_api_infolist_get_internal, NULL);
-
+
/* WeeChat core hdata */
hook_hdata (NULL, "bar", N_("bar"),
&gui_bar_hdata_bar_cb, NULL);
diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c
index 6306c35f3..1ad97fcae 100644
--- a/src/plugins/plugin-config.c
+++ b/src/plugins/plugin-config.c
@@ -56,9 +56,9 @@ plugin_config_search (const char *plugin_name, const char *option_name)
int length;
char *option_full_name;
struct t_config_option *ptr_option;
-
+
ptr_option = NULL;
-
+
length = strlen (plugin_name) + 1 + strlen (option_name) + 1;
option_full_name = malloc (length);
if (option_full_name)
@@ -70,7 +70,7 @@ plugin_config_search (const char *plugin_name, const char *option_name)
option_full_name);
free (option_full_name);
}
-
+
return ptr_option;
}
@@ -84,7 +84,7 @@ plugin_config_set_internal (const char *option, const char *value)
{
int rc;
struct t_config_option *ptr_option;
-
+
ptr_option = config_file_search_option (plugin_config_file,
plugin_config_section_var,
option);
@@ -100,7 +100,7 @@ plugin_config_set_internal (const char *option, const char *value)
NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
-
+
return rc;
}
@@ -114,9 +114,9 @@ plugin_config_set (const char *plugin_name, const char *option_name,
{
int length, rc;
char *option_full_name;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
length = strlen (plugin_name) + 1 + strlen (option_name) + 1;
option_full_name = malloc (length);
if (option_full_name)
@@ -127,7 +127,7 @@ plugin_config_set (const char *plugin_name, const char *option_name,
rc = plugin_config_set_internal (option_full_name, value);
free (option_full_name);
}
-
+
return rc;
}
@@ -140,10 +140,10 @@ void
plugin_config_desc_changed_cb (void *data, struct t_config_option *option)
{
struct t_config_option *ptr_option;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_option = config_file_search_option (plugin_config_file,
plugin_config_section_var,
option->name);
@@ -169,7 +169,7 @@ void
plugin_config_set_desc_internal (const char *option, const char *value)
{
struct t_config_option *ptr_option;
-
+
ptr_option = config_file_search_option (plugin_config_file,
plugin_config_section_desc,
option);
@@ -199,7 +199,7 @@ plugin_config_set_desc (const char *plugin_name, const char *option_name,
{
int length;
char *option_full_name;
-
+
length = strlen (plugin_name) + 1 + strlen (option_name) + 1;
option_full_name = malloc (length);
if (option_full_name)
@@ -221,11 +221,11 @@ plugin_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
/* remove all plugin options and descriptions */
config_file_section_free_options (plugin_config_section_var);
config_file_section_free_options (plugin_config_section_desc);
-
+
/* reload plugins config file */
return config_file_reload (config_file);
}
@@ -240,20 +240,20 @@ plugin_config_create_option (void *data, struct t_config_file *config_file,
const char *option_name, const char *value)
{
struct t_config_option *ptr_option_desc, *ptr_option;
-
+
/* make C compiler happy */
(void) data;
ptr_option_desc = config_file_search_option (config_file,
plugin_config_section_desc,
option_name);
-
+
ptr_option = config_file_new_option (
config_file, section,
option_name, "string",
(ptr_option_desc) ? CONFIG_STRING(ptr_option_desc) : NULL,
NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -268,10 +268,10 @@ plugin_config_create_desc (void *data, struct t_config_file *config_file,
const char *option_name, const char *value)
{
struct t_config_option *ptr_option_var, *ptr_option;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_option_var = config_file_search_option (config_file,
plugin_config_section_var,
option_name);
@@ -285,13 +285,13 @@ plugin_config_create_desc (void *data, struct t_config_file *config_file,
if (value)
ptr_option_var->description = strdup (value);
}
-
+
ptr_option = config_file_new_option (
config_file, section,
option_name, "string", _("description of plugin option"),
NULL, 0, 0, "", value, 0, NULL, NULL,
&plugin_config_desc_changed_cb, NULL, NULL, NULL);
-
+
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -306,11 +306,11 @@ plugin_config_delete_desc (void *data, struct t_config_file *config_file,
struct t_config_option *option)
{
struct t_config_option *ptr_option_var;
-
+
/* make C compiler happy */
(void) data;
(void) section;
-
+
ptr_option_var = config_file_search_option (config_file,
plugin_config_section_var,
option->name);
@@ -322,7 +322,7 @@ plugin_config_delete_desc (void *data, struct t_config_file *config_file,
ptr_option_var->description = NULL;
}
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index c8949ee4f..d2a7dd733 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -88,17 +88,17 @@ int
plugin_valid (struct t_weechat_plugin *plugin)
{
struct t_weechat_plugin *ptr_plugin;
-
+
if (!plugin)
return 0;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
if (ptr_plugin == plugin)
return 1;
}
-
+
/* plugin not found */
return 0;
}
@@ -111,17 +111,17 @@ struct t_weechat_plugin *
plugin_search (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
-
+
if (!name)
return NULL;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
if (string_strcasecmp (ptr_plugin->name, name) == 0)
return ptr_plugin;
}
-
+
/* plugin not found */
return NULL;
}
@@ -134,7 +134,7 @@ const char *
plugin_get_name (struct t_weechat_plugin *plugin)
{
static char *plugin_core = PLUGIN_CORE;
-
+
return (plugin) ? plugin->name : plugin_core;
}
@@ -151,21 +151,21 @@ plugin_check_autoload (char *plugin_full_name)
{
int i, plugin_authorized, plugin_blacklisted;
char *ptr_base_name, *base_name, *plugin_name, *pos;
-
+
/* by default we can auto load all plugins */
if (!plugin_autoload_array)
return 1;
-
+
/* get short name of plugin (filename without extension) */
plugin_name = NULL;
ptr_base_name = basename (plugin_full_name);
if (!ptr_base_name)
return 1;
-
+
base_name = strdup (ptr_base_name);
if (!base_name)
return 1;
-
+
if (CONFIG_STRING(config_plugin_extension)
&& CONFIG_STRING(config_plugin_extension)[0])
{
@@ -177,12 +177,12 @@ plugin_check_autoload (char *plugin_full_name)
}
else
plugin_name = strdup (base_name);
-
+
free (base_name);
-
+
if (!plugin_name)
return 1;
-
+
/* browse array and check if plugin is "authorized" or "blacklisted" */
plugin_authorized = 0;
plugin_blacklisted = 0;
@@ -203,12 +203,12 @@ plugin_check_autoload (char *plugin_full_name)
plugin_authorized = 1;
}
}
-
+
free (plugin_name);
-
+
if (plugin_blacklisted)
return 0;
-
+
return plugin_authorized;
}
@@ -247,15 +247,15 @@ plugin_load (const char *filename)
char **argv;
struct t_weechat_plugin *new_plugin;
struct t_config_option *ptr_option;
-
+
if (!filename)
return NULL;
-
+
full_name = util_search_full_lib_name (filename, "plugins");
-
+
if (!full_name)
return NULL;
-
+
/*
* if plugin must not be autoloaded, then return immediately
* Note: the "plugin_autoload_array" variable is set only during auto-load,
@@ -263,14 +263,14 @@ plugin_load (const char *filename)
*/
if (plugin_autoload_array && !plugin_check_autoload (full_name))
return NULL;
-
+
full_name2 = string_expand_home (full_name);
if (full_name2)
{
free (full_name);
full_name = full_name2;
}
-
+
handle = dlopen (full_name, RTLD_GLOBAL | RTLD_NOW);
if (!handle)
{
@@ -286,7 +286,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin name */
name = dlsym (handle, "weechat_plugin_name");
if (!name)
@@ -301,7 +301,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for API version */
api_version = dlsym (handle, "weechat_plugin_api_version");
if (!api_version)
@@ -339,7 +339,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* check for plugin with same name */
if (plugin_search (name))
{
@@ -352,7 +352,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin description */
description = dlsym (handle, "weechat_plugin_description");
if (!description)
@@ -367,7 +367,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin author */
author = dlsym (handle, "weechat_plugin_author");
if (!author)
@@ -382,7 +382,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin version */
version = dlsym (handle, "weechat_plugin_version");
if (!version)
@@ -397,7 +397,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin license */
license = dlsym (handle, "weechat_plugin_license");
if (!license)
@@ -412,10 +412,10 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* look for plugin charset (optional, default is UTF-8) */
charset = dlsym (handle, "weechat_plugin_charset");
-
+
/* look for plugin init function */
init_func = dlsym (handle, "weechat_plugin_init");
if (!init_func)
@@ -430,7 +430,7 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
/* create new plugin */
new_plugin = malloc (sizeof (*new_plugin));
if (new_plugin)
@@ -446,10 +446,10 @@ plugin_load (const char *filename)
new_plugin->charset = (charset) ? strdup (charset) : NULL;
ptr_option = config_weechat_debug_get (name);
new_plugin->debug = (ptr_option) ? CONFIG_INTEGER(ptr_option) : 0;
-
+
/* functions */
new_plugin->plugin_get_name = &plugin_get_name;
-
+
new_plugin->charset_set = &plugin_api_charset_set;
new_plugin->iconv_to_internal = &string_iconv_to_internal;
new_plugin->iconv_from_internal = &string_iconv_from_internal;
@@ -481,7 +481,7 @@ plugin_load (const char *filename)
new_plugin->string_decode_base64 = &string_decode_base64;
new_plugin->string_is_command_char = &string_is_command_char;
new_plugin->string_input_for_buffer = &string_input_for_buffer;
-
+
new_plugin->utf8_has_8bits = &utf8_has_8bits;
new_plugin->utf8_is_valid = &utf8_is_valid;
new_plugin->utf8_normalize = &utf8_normalize;
@@ -499,18 +499,18 @@ plugin_load (const char *filename)
new_plugin->utf8_real_pos = &utf8_real_pos;
new_plugin->utf8_pos = &utf8_pos;
new_plugin->utf8_strndup = &utf8_strndup;
-
+
new_plugin->mkdir_home = &util_mkdir_home;
new_plugin->mkdir = &util_mkdir;
new_plugin->mkdir_parents = &util_mkdir_parents;
new_plugin->exec_on_files = &util_exec_on_files;
new_plugin->file_get_content = &util_file_get_content;
-
+
new_plugin->util_timeval_cmp = &util_timeval_cmp;
new_plugin->util_timeval_diff = &util_timeval_diff;
new_plugin->util_timeval_add = &util_timeval_add;
new_plugin->util_get_time_string = &util_get_time_string;
-
+
new_plugin->list_new = &weelist_new;
new_plugin->list_add = &weelist_add;
new_plugin->list_search = &weelist_search;
@@ -526,7 +526,7 @@ plugin_load (const char *filename)
new_plugin->list_remove = &weelist_remove;
new_plugin->list_remove_all = &weelist_remove_all;
new_plugin->list_free = &weelist_free;
-
+
new_plugin->hashtable_new = &hashtable_new;
new_plugin->hashtable_set_with_size = &hashtable_set_with_size;
new_plugin->hashtable_set = &hashtable_set;
@@ -540,7 +540,7 @@ plugin_load (const char *filename)
new_plugin->hashtable_remove = &hashtable_remove;
new_plugin->hashtable_remove_all = &hashtable_remove_all;
new_plugin->hashtable_free = &hashtable_free;
-
+
new_plugin->config_new = &config_file_new;
new_plugin->config_new_section = &config_file_new_section;
new_plugin->config_search_section = &config_file_search_section;
@@ -580,16 +580,16 @@ plugin_load (const char *filename)
new_plugin->config_set_plugin = &plugin_api_config_set_plugin;
new_plugin->config_set_desc_plugin = &plugin_api_config_set_desc_plugin;
new_plugin->config_unset_plugin = &plugin_api_config_unset_plugin;
-
+
new_plugin->key_bind = &gui_key_bind_plugin;
new_plugin->key_unbind = &gui_key_unbind_plugin;
-
+
new_plugin->prefix = &plugin_api_prefix;
new_plugin->color = &plugin_api_color;
new_plugin->printf_date_tags = &gui_chat_printf_date_tags;
new_plugin->printf_y = &gui_chat_printf_y;
new_plugin->log_printf = &log_printf;
-
+
new_plugin->hook_command = &hook_command;
new_plugin->hook_command_run = &hook_command_run;
new_plugin->hook_timer = &hook_timer;
@@ -614,7 +614,7 @@ plugin_load (const char *filename)
new_plugin->hook_focus = &hook_focus;
new_plugin->unhook = &unhook;
new_plugin->unhook_all = &unhook_all_plugin;
-
+
new_plugin->buffer_new = &gui_buffer_new;
new_plugin->buffer_search = &gui_buffer_search_by_name;
new_plugin->buffer_search_main = &gui_buffer_search_main;
@@ -629,13 +629,13 @@ plugin_load (const char *filename)
new_plugin->buffer_set_pointer = &gui_buffer_set_pointer;
new_plugin->buffer_string_replace_local_var = &gui_buffer_string_replace_local_var;
new_plugin->buffer_match_list = &gui_buffer_match_list;
-
+
new_plugin->window_search_with_buffer = &gui_window_search_with_buffer;
new_plugin->window_get_integer = &gui_window_get_integer;
new_plugin->window_get_string = &gui_window_get_string;
new_plugin->window_get_pointer = &gui_window_get_pointer;
new_plugin->window_set_title = &gui_window_set_title;
-
+
new_plugin->nicklist_add_group = &gui_nicklist_add_group;
new_plugin->nicklist_search_group = &gui_nicklist_search_group;
new_plugin->nicklist_add_nick = &gui_nicklist_add_nick;
@@ -651,7 +651,7 @@ plugin_load (const char *filename)
new_plugin->nicklist_nick_get_string = &gui_nicklist_nick_get_string;
new_plugin->nicklist_nick_get_pointer = &gui_nicklist_nick_get_pointer;
new_plugin->nicklist_nick_set = &gui_nicklist_nick_set;
-
+
new_plugin->bar_item_search = &gui_bar_item_search;
new_plugin->bar_item_new = &gui_bar_item_new;
new_plugin->bar_item_update = &gui_bar_item_update;
@@ -661,15 +661,15 @@ plugin_load (const char *filename)
new_plugin->bar_set = &gui_bar_set;
new_plugin->bar_update = &gui_bar_update;
new_plugin->bar_remove = &gui_bar_free;
-
+
new_plugin->command = &plugin_api_command;
-
+
new_plugin->network_pass_proxy = &network_pass_proxy;
new_plugin->network_connect_to = &network_connect_to;
-
+
new_plugin->info_get = &hook_info_get;
new_plugin->info_get_hashtable = &hook_info_get_hashtable;
-
+
new_plugin->infolist_new = &infolist_new;
new_plugin->infolist_new_item = &infolist_new_item;
new_plugin->infolist_new_var_integer = &infolist_new_var_integer;
@@ -707,12 +707,12 @@ plugin_load (const char *filename)
new_plugin->hdata_pointer = &hdata_pointer;
new_plugin->hdata_time = &hdata_time;
new_plugin->hdata_get_string = &hdata_get_string;
-
+
new_plugin->upgrade_new = &upgrade_file_new;
new_plugin->upgrade_write_object = &upgrade_file_write_object;
new_plugin->upgrade_read = &upgrade_file_read;
new_plugin->upgrade_close = &upgrade_file_close;
-
+
/* add new plugin to list */
new_plugin->prev_plugin = last_weechat_plugin;
new_plugin->next_plugin = NULL;
@@ -721,13 +721,13 @@ plugin_load (const char *filename)
else
weechat_plugins = new_plugin;
last_weechat_plugin = new_plugin;
-
+
/*
* associate orphan buffers with this plugin (if asked during upgrade
* process)
*/
gui_buffer_set_plugin_for_upgrade (name, new_plugin);
-
+
/* build arguments for plugin */
argc = 0;
argv = NULL;
@@ -759,13 +759,13 @@ plugin_load (const char *filename)
argv[argc] = NULL;
}
}
-
+
/* init plugin */
rc = ((t_weechat_init_func *)init_func) (new_plugin, argc, argv);
-
+
if (argv)
free (argv);
-
+
if (rc != WEECHAT_RC_OK)
{
gui_chat_printf (NULL,
@@ -789,16 +789,16 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
-
+
if ((weechat_debug_core >= 1) || !plugin_quiet)
{
gui_chat_printf (NULL,
_("Plugin \"%s\" loaded"),
name);
}
-
+
free (full_name);
-
+
return new_plugin;
}
@@ -811,10 +811,10 @@ void
plugin_auto_load_file (void *plugin, const char *filename)
{
char *pos;
-
+
/* make C compiler happy */
(void) plugin;
-
+
if (CONFIG_STRING(config_plugin_extension)
&& CONFIG_STRING(config_plugin_extension)[0])
{
@@ -841,10 +841,10 @@ void
plugin_auto_load ()
{
char *dir_name, *plugin_path, *plugin_path2;
-
+
plugin_autoload_array = NULL;
plugin_autoload_count = 0;
-
+
if (CONFIG_STRING(config_plugin_autoload)
&& CONFIG_STRING(config_plugin_autoload)[0])
{
@@ -852,7 +852,7 @@ plugin_auto_load ()
",", 0, 0,
&plugin_autoload_count);
}
-
+
/* auto-load plugins in WeeChat home dir */
if (CONFIG_STRING(config_plugin_path)
&& CONFIG_STRING(config_plugin_path)[0])
@@ -872,7 +872,7 @@ plugin_auto_load ()
if (plugin_path2)
free (plugin_path2);
}
-
+
/* auto-load plugins in WeeChat global lib dir */
dir_name = malloc (strlen (WEECHAT_LIBDIR) + 16);
if (dir_name)
@@ -882,7 +882,7 @@ plugin_auto_load ()
util_exec_on_files (dir_name, 0, NULL, &plugin_auto_load_file);
free (dir_name);
}
-
+
/* free autoload array */
if (plugin_autoload_array)
{
@@ -901,19 +901,19 @@ plugin_remove (struct t_weechat_plugin *plugin)
{
struct t_weechat_plugin *new_weechat_plugins;
struct t_gui_buffer *ptr_buffer, *next_buffer;
-
+
/* close buffers created by this plugin */
ptr_buffer = gui_buffers;
while (ptr_buffer)
{
next_buffer = ptr_buffer->next_buffer;
-
+
if (ptr_buffer->plugin == plugin)
gui_buffer_close (ptr_buffer);
-
+
ptr_buffer = next_buffer;
}
-
+
/* remove plugin from list */
if (last_weechat_plugin == plugin)
last_weechat_plugin = plugin->prev_plugin;
@@ -924,25 +924,25 @@ plugin_remove (struct t_weechat_plugin *plugin)
}
else
new_weechat_plugins = plugin->next_plugin;
-
+
if (plugin->next_plugin)
(plugin->next_plugin)->prev_plugin = plugin->prev_plugin;
-
+
/* remove all config files */
config_file_free_all_plugin (plugin);
-
+
/* remove all hooks */
unhook_all_plugin (plugin);
-
+
/* remove all infolists */
infolist_free_all_plugin (plugin);
-
+
/* remove all hdata */
hdata_free_all_plugin (plugin);
-
+
/* remove all bar items */
gui_bar_item_free_all_plugin (plugin);
-
+
/* free data */
if (plugin->filename)
free (plugin->filename);
@@ -960,9 +960,9 @@ plugin_remove (struct t_weechat_plugin *plugin)
free (plugin->license);
if (plugin->charset)
free (plugin->charset);
-
+
free (plugin);
-
+
weechat_plugins = new_weechat_plugins;
}
@@ -975,15 +975,15 @@ plugin_unload (struct t_weechat_plugin *plugin)
{
t_weechat_end_func *end_func;
char *name;
-
+
name = (plugin->name) ? strdup (plugin->name) : NULL;
-
+
end_func = dlsym (plugin->handle, "weechat_plugin_end");
if (end_func)
(void) (end_func) (plugin);
-
+
plugin_remove (plugin);
-
+
if ((weechat_debug_core >= 1) || !plugin_quiet)
{
gui_chat_printf (NULL,
@@ -1002,7 +1002,7 @@ void
plugin_unload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
-
+
ptr_plugin = plugin_search (name);
if (ptr_plugin)
plugin_unload (ptr_plugin);
@@ -1023,16 +1023,16 @@ void
plugin_unload_all ()
{
int plugins_loaded;
-
+
plugins_loaded = (weechat_plugins) ? 1 : 0;
-
+
plugin_quiet = 1;
while (weechat_plugins)
{
plugin_unload (last_weechat_plugin);
}
plugin_quiet = 0;
-
+
if (plugins_loaded)
{
gui_chat_printf (NULL, _("Plugins unloaded"));
@@ -1048,7 +1048,7 @@ plugin_reload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
char *filename;
-
+
ptr_plugin = plugin_search (name);
if (ptr_plugin)
{
@@ -1082,16 +1082,16 @@ plugin_display_short_list ()
struct t_weechat_plugin *ptr_plugin;
struct t_weelist *list;
struct t_weelist_item *ptr_item;
-
+
if (weechat_plugins)
{
list = weelist_new ();
if (list)
{
plugins_loaded = _("Plugins loaded:");
-
+
length = strlen (plugins_loaded) + 1;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
@@ -1099,7 +1099,7 @@ plugin_display_short_list ()
weelist_add (list, ptr_plugin->name, WEECHAT_LIST_POS_SORT, NULL);
}
length++;
-
+
buf = malloc (length);
if (buf)
{
@@ -1132,11 +1132,11 @@ plugin_init (int auto_load, int argc, char *argv[])
/* init plugin API (create some hooks) */
plugin_api_init ();
-
+
/* read plugins options on disk */
plugin_config_init ();
plugin_config_read ();
-
+
/* auto-load plugins if asked */
if (auto_load)
{
@@ -1160,10 +1160,10 @@ plugin_end ()
{
/* write plugins config options */
plugin_config_write ();
-
+
/* unload all plugins */
plugin_unload_all ();
-
+
/* free all plugin options */
plugin_config_end ();
}
@@ -1176,10 +1176,10 @@ struct t_hdata *
plugin_hdata_plugin_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin");
if (hdata)
{
@@ -1210,14 +1210,14 @@ plugin_add_to_infolist (struct t_infolist *infolist,
struct t_weechat_plugin *plugin)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !plugin)
return 0;
-
+
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!infolist_new_var_pointer (ptr_item, "pointer", plugin))
return 0;
if (!infolist_new_var_string (ptr_item, "filename", plugin->filename))
@@ -1238,7 +1238,7 @@ plugin_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "debug", plugin->debug))
return 0;
-
+
return 1;
}
@@ -1250,7 +1250,7 @@ void
plugin_print_log ()
{
struct t_weechat_plugin *ptr_plugin;
-
+
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c
index e209f813c..f491be24b 100644
--- a/src/plugins/relay/relay-buffer.c
+++ b/src/plugins/relay/relay-buffer.c
@@ -51,7 +51,7 @@ relay_buffer_refresh (const char *hotlist)
char *str_recv, *str_sent;
int i, length, line;
struct tm *date_tmp;
-
+
if (relay_buffer)
{
weechat_buffer_clear (relay_buffer);
@@ -83,7 +83,7 @@ relay_buffer_refresh (const char *hotlist)
weechat_config_string (relay_config_color_text_selected) :
weechat_config_string (relay_config_color_text),
weechat_config_string (relay_config_color_text_bg));
-
+
snprintf (status, sizeof (status),
"%s", _(relay_client_status_string[ptr_client->status]));
length = weechat_utf8_strlen_screen (status);
@@ -94,7 +94,7 @@ relay_buffer_refresh (const char *hotlist)
strcat (status, " ");
}
}
-
+
date_tmp = localtime (&(ptr_client->start_time));
strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
@@ -105,7 +105,7 @@ relay_buffer_refresh (const char *hotlist)
strftime (date_end, sizeof (date_end),
"%a, %d %b %Y %H:%M:%S", date_tmp);
}
-
+
/* first line with status and start time */
weechat_printf_y (relay_buffer, (line * 2) + 2,
_("%s%s[%s%s%s%s] %s (started on: %s%s%s%s)"),
@@ -121,7 +121,7 @@ relay_buffer_refresh (const char *hotlist)
(ptr_client->end_time > 0) ? ", " : "",
(ptr_client->end_time > 0) ? _("ended on: ") : "",
(ptr_client->end_time > 0) ? date_end : "");
-
+
/* second line with protocol and bytes recv/sent */
str_recv = weechat_string_format_size (ptr_client->bytes_recv);
str_sent = weechat_string_format_size (ptr_client->bytes_sent);
@@ -137,7 +137,7 @@ relay_buffer_refresh (const char *hotlist)
free (str_recv);
if (str_sent)
free (str_sent);
-
+
line++;
}
if (hotlist)
@@ -155,10 +155,10 @@ relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_relay_client *client, *ptr_client, *next_client;
-
+
/* make C compiler happy */
(void) data;
-
+
if (buffer == relay_raw_buffer)
{
if (weechat_strcasecmp (input_data, "q") == 0)
@@ -167,7 +167,7 @@ relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
else if (buffer == relay_buffer)
{
client = relay_client_search_by_number (relay_buffer_selected_line);
-
+
/* disconnect client */
if (weechat_strcasecmp (input_data, "d") == 0)
{
@@ -205,7 +205,7 @@ relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -218,7 +218,7 @@ relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
/* make C compiler happy */
(void) data;
-
+
if (buffer == relay_raw_buffer)
{
relay_raw_buffer = NULL;
@@ -227,7 +227,7 @@ relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
relay_buffer = NULL;
}
-
+
return WEECHAT_RC_OK;
}
@@ -243,11 +243,11 @@ relay_buffer_open ()
relay_buffer = weechat_buffer_new (RELAY_BUFFER_NAME,
&relay_buffer_input_cb, NULL,
&relay_buffer_close_cb, NULL);
-
+
/* failed to create buffer ? then exit */
if (!relay_buffer)
return;
-
+
weechat_buffer_set (relay_buffer, "type", "free");
weechat_buffer_set (relay_buffer, "title", _("List of clients for relay"));
weechat_buffer_set (relay_buffer, "key_bind_meta2-A", "/relay up");
diff --git a/src/plugins/relay/relay-client-irc.c b/src/plugins/relay/relay-client-irc.c
index a48e298be..7076065fa 100644
--- a/src/plugins/relay/relay-client-irc.c
+++ b/src/plugins/relay/relay-client-irc.c
@@ -53,7 +53,7 @@ int
relay_client_irc_command_relayed (const char *irc_command)
{
int i;
-
+
if (irc_command)
{
for (i = 0; relay_client_irc_relay_commands[i]; i++)
@@ -62,7 +62,7 @@ relay_client_irc_command_relayed (const char *irc_command)
return 1;
}
}
-
+
/* command must NOT be relayed to client */
return 0;
}
@@ -76,7 +76,7 @@ int
relay_client_irc_command_ignored (const char *irc_command)
{
int i;
-
+
if (irc_command)
{
for (i = 0; relay_client_irc_ignore_commands[i]; i++)
@@ -85,7 +85,7 @@ relay_client_irc_command_ignored (const char *irc_command)
return 1;
}
}
-
+
/* command must NOT be relayed to client */
return 0;
}
@@ -98,10 +98,10 @@ struct t_hashtable *
relay_client_irc_message_parse (const char *message)
{
struct t_hashtable *hash_msg, *hash_parsed;
-
+
hash_msg = NULL;
hash_parsed = NULL;
-
+
hash_msg = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -124,11 +124,11 @@ relay_client_irc_message_parse (const char *message)
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
goto end;
}
-
+
end:
if (hash_msg)
weechat_hashtable_free (hash_msg);
-
+
return hash_parsed;
}
@@ -143,23 +143,23 @@ relay_client_irc_sendf (struct t_relay_client *client, const char *format, ...)
char *pos, hash_key[32], *message;
const char *str_message;
struct t_hashtable *hashtable_in, *hashtable_out;
-
+
if (!client)
return 0;
-
+
weechat_va_format (format);
if (!vbuffer)
return 0;
-
+
total_sent = 0;
-
+
pos = strchr (vbuffer, '\r');
if (pos)
pos[0] = '\0';
pos = strchr (vbuffer, '\n');
if (pos)
pos[0] = '\0';
-
+
hashtable_in = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -204,11 +204,11 @@ relay_client_irc_sendf (struct t_relay_client *client, const char *format, ...)
}
weechat_hashtable_free (hashtable_in);
}
-
+
client->bytes_sent += total_sent;
-
+
free (vbuffer);
-
+
return total_sent;
}
@@ -226,14 +226,14 @@ relay_client_irc_signal_irc_in2_cb (void *data, const char *signal,
struct t_relay_client *client;
const char *ptr_msg, *irc_nick, *irc_host, *irc_command, *irc_args;
struct t_hashtable *hash_parsed;
-
+
/* make C compiler happy */
(void) signal;
(void) type_data;
-
+
client = (struct t_relay_client *)data;
ptr_msg = (const char *)signal_data;
-
+
if (weechat_relay_plugin->debug >= 2)
{
weechat_printf (NULL, "%s: irc_in2: client: %s, data: %s",
@@ -241,7 +241,7 @@ relay_client_irc_signal_irc_in2_cb (void *data, const char *signal,
client->protocol_args,
ptr_msg);
}
-
+
hash_parsed = relay_client_irc_message_parse (ptr_msg);
if (hash_parsed)
{
@@ -261,7 +261,7 @@ relay_client_irc_signal_irc_in2_cb (void *data, const char *signal,
RELAY_IRC_DATA(client, nick) = strdup ((irc_args[0] == ':') ?
irc_args + 1 : irc_args);
}
-
+
/* relay all commands to client, but not ping/pong */
if (irc_command
&& (weechat_strcasecmp (irc_command, "ping") != 0)
@@ -272,10 +272,10 @@ relay_client_irc_signal_irc_in2_cb (void *data, const char *signal,
irc_command,
irc_args);
}
-
+
weechat_hashtable_free (hash_parsed);
}
-
+
return WEECHAT_RC_OK;
}
@@ -293,9 +293,9 @@ relay_client_irc_tag_relay_client_id (const char *tags)
char **argv, *error;
int result, argc, i;
long number;
-
+
result = -1;
-
+
if (tags && tags[0])
{
argv = weechat_string_split (tags, ",", 0, 0, &argc);
@@ -317,7 +317,7 @@ relay_client_irc_tag_relay_client_id (const char *tags)
weechat_string_free_split (argv);
}
}
-
+
return result;
}
@@ -339,24 +339,24 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
char *pos, *tags, *irc_channel, *message;
struct t_infolist *infolist_nick;
char str_infolist_args[256];
-
+
/* make C compiler happy */
(void) signal;
(void) type_data;
-
+
client = (struct t_relay_client *)data;
-
+
tags = NULL;
-
+
message = strdup ((char *)signal_data);
if (!message)
goto end;
pos = strchr (message, '\r');
if (pos)
pos[0] = '\0';
-
+
ptr_message = message;
-
+
if (weechat_relay_plugin->debug >= 2)
{
weechat_printf (NULL, "%s: irc_out: client: %s, message: %s",
@@ -364,7 +364,7 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
client->protocol_args,
message);
}
-
+
pos = strchr (ptr_message, ';');
if (pos)
{
@@ -372,7 +372,7 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
tags = weechat_strndup (ptr_message, pos - ptr_message);
ptr_message = pos + 1;
}
-
+
/*
* We check if there is a tag "relay_client_NNN" and if NNN (numeric)
* is equal to current client, then we ignore message, because message
@@ -381,17 +381,17 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
*/
if (relay_client_irc_tag_relay_client_id (tags) == client->id)
goto end;
-
+
hash_parsed = relay_client_irc_message_parse (ptr_message);
if (hash_parsed)
{
irc_command = weechat_hashtable_get (hash_parsed, "command");
irc_args = weechat_hashtable_get (hash_parsed, "arguments");
-
+
pos = strchr (irc_args, ' ');
irc_channel = (pos) ?
weechat_strndup (irc_args, pos - irc_args) : strdup (irc_args);
-
+
/* if command has to be relayed, relay it to client */
if (irc_command && irc_command[0]
&& irc_channel && irc_channel[0]
@@ -403,12 +403,12 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
client->protocol_args,
irc_channel,
RELAY_IRC_DATA(client, nick));
-
+
host = NULL;
infolist_nick = weechat_infolist_get ("irc_nick", NULL, str_infolist_args);
if (infolist_nick && weechat_infolist_next (infolist_nick))
host = weechat_infolist_string (infolist_nick, "host");
-
+
/* send message to client */
relay_client_irc_sendf (client,
":%s%s%s %s",
@@ -416,7 +416,7 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
(host && host[0]) ? "!" : "",
(host && host[0]) ? host : "",
ptr_message);
-
+
if (infolist_nick)
weechat_infolist_free (infolist_nick);
}
@@ -424,13 +424,13 @@ relay_client_irc_signal_irc_outtags_cb (void *data, const char *signal,
free (irc_channel);
weechat_hashtable_free (hash_parsed);
}
-
+
end:
if (message)
free (message);
if (tags)
free (tags);
-
+
return WEECHAT_RC_OK;
}
@@ -445,19 +445,19 @@ relay_client_irc_signal_irc_disc_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_relay_client *client;
-
+
/* make C compiler happy */
(void) signal;
(void) type_data;
(void) signal_data;
-
+
client = (struct t_relay_client *)data;
-
+
if (strcmp ((char *)signal_data, client->protocol_args) == 0)
{
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
}
-
+
return WEECHAT_RC_OK;
}
@@ -474,7 +474,7 @@ relay_client_irc_send_join (struct t_relay_client *client,
char *host;
int length, length_nicks;
struct t_infolist *infolist_nick, *infolist_channel, *infolist_nicks;
-
+
length = strlen (client->protocol_args) + 1 + strlen (channel) + 1
+ strlen (RELAY_IRC_DATA(client, nick)) + 1;
infolist_name = malloc (length);
@@ -619,11 +619,11 @@ relay_client_irc_input_send (struct t_relay_client *client,
{
char buf_beginning[1024], *buf;
int length_beginning, length_vbuffer;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
snprintf (buf_beginning, sizeof (buf_beginning),
"%s;%s;%d;relay_client_%d;",
client->protocol_args,
@@ -645,7 +645,7 @@ relay_client_irc_input_send (struct t_relay_client *client,
"%s: irc_input_send: \"%s\"",
RELAY_PLUGIN_NAME, buf);
}
-
+
weechat_hook_signal_send ("irc_input_send",
WEECHAT_HOOK_SIGNAL_STRING,
buf);
@@ -662,7 +662,7 @@ void
relay_client_irc_hook_signals (struct t_relay_client *client)
{
char str_signal_name[128];
-
+
/*
* hook signal "xxx,irc_in2_*" to catch IRC data received from
* this server
@@ -674,7 +674,7 @@ relay_client_irc_hook_signals (struct t_relay_client *client)
weechat_hook_signal (str_signal_name,
&relay_client_irc_signal_irc_in2_cb,
client);
-
+
/*
* hook signal "xxx,irc_outtags_*" to catch IRC data sent to
* this server
@@ -686,7 +686,7 @@ relay_client_irc_hook_signals (struct t_relay_client *client)
weechat_hook_signal (str_signal_name,
&relay_client_irc_signal_irc_outtags_cb,
client);
-
+
/*
* hook signal "irc_server_disconnected" to disconnect client if
* connection to server is lost
@@ -709,23 +709,23 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
const char *nick, *irc_is_channel, *isupport;
struct t_hashtable *hash_parsed;
struct t_infolist *infolist_server;
-
+
hash_parsed = NULL;
-
+
/* remove \r at the end of message */
pos = strchr (data, '\r');
if (pos)
pos[0] = '\0';
-
+
/* display debug message */
if (weechat_relay_plugin->debug >= 2)
{
weechat_printf (NULL, "%s: recv from client: \"%s\"",
RELAY_PLUGIN_NAME, data);
}
-
+
relay_raw_print (client, 0, data);
-
+
/* parse IRC message */
hash_parsed = relay_client_irc_message_parse (data);
if (!hash_parsed)
@@ -733,7 +733,7 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
irc_command = weechat_hashtable_get (hash_parsed, "command");
irc_channel = weechat_hashtable_get (hash_parsed, "channel");
irc_args = weechat_hashtable_get (hash_parsed, "arguments");
-
+
/* process the message */
if (irc_command && (weechat_strcasecmp (irc_command, "nick") == 0))
{
@@ -803,9 +803,9 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
RELAY_STATUS_DISCONNECTED);
goto end;
}
-
+
RELAY_IRC_DATA(client, connected) = 1;
-
+
/*
* send nick to client if server nick is different of nick asked
* by client with command NICK
@@ -820,7 +820,7 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
free (RELAY_IRC_DATA(client, nick));
RELAY_IRC_DATA(client, nick) = strdup (nick);
}
-
+
relay_client_irc_sendf (client,
":%s 001 %s :Welcome to the Internet "
"Relay Chat Network %s!%s@proxy",
@@ -889,10 +889,10 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
":%s 422 %s :MOTD File is missing",
RELAY_IRC_DATA(client, address),
RELAY_IRC_DATA(client, nick));
-
+
/* hook signals */
relay_client_irc_hook_signals (client);
-
+
/* send JOIN for all channels on server to client */
relay_client_irc_send_join_channels (client);
}
@@ -964,7 +964,7 @@ relay_client_irc_recv_one_msg (struct t_relay_client *client, char *data)
data);
}
}
-
+
end:
if (hash_parsed)
weechat_hashtable_free (hash_parsed);
@@ -979,7 +979,7 @@ relay_client_irc_recv (struct t_relay_client *client, const char *data)
{
char **items;
int items_count, i;
-
+
items = weechat_string_split (data, "\n", 0, 0, &items_count);
for (i = 0; i < items_count; i++)
{
@@ -1024,9 +1024,9 @@ relay_client_irc_alloc (struct t_relay_client *client)
{
struct t_relay_client_irc_data *irc_data;
const char *password;
-
+
password = weechat_config_string (relay_config_network_password);
-
+
client->protocol_data = malloc (sizeof (*irc_data));
if (client->protocol_data)
{
@@ -1051,7 +1051,7 @@ relay_client_irc_alloc_with_infolist (struct t_relay_client *client,
struct t_infolist *infolist)
{
struct t_relay_client_irc_data *irc_data;
-
+
client->protocol_data = malloc (sizeof (*irc_data));
if (client->protocol_data)
{
@@ -1095,9 +1095,9 @@ relay_client_irc_free (struct t_relay_client *client)
weechat_unhook (RELAY_IRC_DATA(client, hook_signal_irc_outtags));
if (RELAY_IRC_DATA(client, hook_signal_irc_disc))
weechat_unhook (RELAY_IRC_DATA(client, hook_signal_irc_disc));
-
+
free (client->protocol_data);
-
+
client->protocol_data = NULL;
}
}
@@ -1113,7 +1113,7 @@ relay_client_irc_add_to_infolist (struct t_infolist_item *item,
{
if (!item || !client)
return 0;
-
+
if (!weechat_infolist_new_var_string (item, "address", RELAY_IRC_DATA(client, address)))
return 0;
if (!weechat_infolist_new_var_integer (item, "password_ok", RELAY_IRC_DATA(client, password_ok)))
@@ -1130,7 +1130,7 @@ relay_client_irc_add_to_infolist (struct t_infolist_item *item,
return 0;
if (!weechat_infolist_new_var_pointer (item, "hook_signal_irc_disc", RELAY_IRC_DATA(client, hook_signal_irc_disc)))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/relay/relay-client-weechat.c b/src/plugins/relay/relay-client-weechat.c
index ccfffcdf8..1d71aee26 100644
--- a/src/plugins/relay/relay-client-weechat.c
+++ b/src/plugins/relay/relay-client-weechat.c
@@ -45,19 +45,19 @@ relay_client_weechat_sendf (struct t_relay_client *client,
{
char str_length[8];
int length_vbuffer, num_sent, total_sent;
-
+
if (!client)
return 0;
-
+
weechat_va_format (format);
if (!vbuffer)
return 0;
length_vbuffer = strlen (vbuffer);
-
+
total_sent = 0;
-
+
snprintf (str_length, sizeof (str_length), "%07d", length_vbuffer);
-
+
num_sent = send (client->sock, str_length, 7, 0);
client->bytes_sent += 7;
total_sent += num_sent;
@@ -67,7 +67,7 @@ relay_client_weechat_sendf (struct t_relay_client *client,
client->bytes_sent += length_vbuffer;
total_sent += num_sent;
}
-
+
if (num_sent < 0)
{
weechat_printf (NULL,
@@ -75,7 +75,7 @@ relay_client_weechat_sendf (struct t_relay_client *client,
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
strerror (errno));
}
-
+
return total_sent;
}
@@ -91,9 +91,9 @@ relay_client_weechat_send_infolist (struct t_relay_client *client,
const char *fields;
char **argv;
int i, argc, size;
-
+
relay_client_weechat_sendf (client, "name %s", name);
-
+
while (weechat_infolist_next (infolist))
{
fields = weechat_infolist_fields (infolist);
@@ -154,16 +154,16 @@ relay_client_weechat_recv_one_msg (struct t_relay_client *client, char *data)
{
char *pos;
struct t_infolist *infolist;
-
+
pos = strchr (data, '\r');
if (pos)
pos[0] = '\0';
-
+
if (weechat_relay_plugin->debug)
{
weechat_printf (NULL, "relay: weechat: \"%s\"", data);
}
-
+
if (weechat_strcasecmp (data, "quit") == 0)
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
else
@@ -186,7 +186,7 @@ relay_client_weechat_recv (struct t_relay_client *client, const char *data)
{
char **items;
int items_count, i;
-
+
items = weechat_string_split (data, "\n", 0, 0, &items_count);
for (i = 0; i < items_count; i++)
{
@@ -204,7 +204,7 @@ void
relay_client_weechat_alloc (struct t_relay_client *client)
{
struct t_relay_client_weechat_data *weechat_data;
-
+
client->protocol_data = malloc (sizeof (*weechat_data));
if (client->protocol_data)
{
@@ -222,10 +222,10 @@ relay_client_weechat_alloc_with_infolist (struct t_relay_client *client,
struct t_infolist *infolist)
{
struct t_relay_client_weechat_data *weechat_data;
-
+
/* make C compiler happy */
(void) infolist;
-
+
client->protocol_data = malloc (sizeof (*weechat_data));
if (client->protocol_data)
{
@@ -256,7 +256,7 @@ relay_client_weechat_add_to_infolist (struct t_infolist_item *item,
{
if (!item || !client)
return 0;
-
+
return 1;
}
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index b952ca963..f82821048 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -61,17 +61,17 @@ int
relay_client_valid (struct t_relay_client *client)
{
struct t_relay_client *ptr_client;
-
+
if (!client)
return 0;
-
+
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
{
if (ptr_client == client)
return 1;
}
-
+
/* client not found */
return 0;
}
@@ -85,7 +85,7 @@ relay_client_search_by_number (int number)
{
struct t_relay_client *ptr_client;
int i;
-
+
i = 0;
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
@@ -94,7 +94,7 @@ relay_client_search_by_number (int number)
return ptr_client;
i++;
}
-
+
/* client not found */
return NULL;
}
@@ -109,12 +109,12 @@ relay_client_recv_cb (void *arg_client, int fd)
struct t_relay_client *client;
static char buffer[4096 + 2];
int num_read;
-
+
/* make C compiler happy */
(void) fd;
-
+
client = (struct t_relay_client *)arg_client;
-
+
num_read = recv (client->sock, buffer, sizeof (buffer) - 1, 0);
if (num_read > 0)
{
@@ -137,7 +137,7 @@ relay_client_recv_cb (void *arg_client, int fd)
{
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
}
-
+
return WEECHAT_RC_OK;
}
@@ -149,7 +149,7 @@ struct t_relay_client *
relay_client_new (int sock, char *address, struct t_relay_server *server)
{
struct t_relay_client *new_client;
-
+
new_client = malloc (sizeof (*new_client));
if (new_client)
{
@@ -166,7 +166,7 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
new_client->last_activity = new_client->start_time;
new_client->bytes_recv = 0;
new_client->bytes_sent = 0;
-
+
new_client->protocol_data = NULL;
switch (new_client->protocol)
{
@@ -179,7 +179,7 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
case RELAY_NUM_PROTOCOLS:
break;
}
-
+
new_client->prev_client = NULL;
new_client->next_client = relay_clients;
if (relay_clients)
@@ -187,7 +187,7 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
else
last_relay_client = new_client;
relay_clients = new_client;
-
+
weechat_printf (NULL,
_("%s: new client from %s%s%s on port %d (id: %d, relaying: %s.%s)"),
RELAY_PLUGIN_NAME,
@@ -198,12 +198,12 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
new_client->id,
relay_protocol_string[new_client->protocol],
new_client->protocol_args);
-
+
new_client->hook_fd = weechat_hook_fd (new_client->sock,
1, 0, 0,
&relay_client_recv_cb,
new_client);
-
+
relay_client_count++;
if (!relay_buffer
@@ -211,7 +211,7 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
{
relay_buffer_open ();
}
-
+
relay_buffer_refresh (WEECHAT_HOTLIST_PRIVATE);
}
else
@@ -220,7 +220,7 @@ relay_client_new (int sock, char *address, struct t_relay_server *server)
_("%s%s: not enough memory for new client"),
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
}
-
+
return new_client;
}
@@ -233,11 +233,11 @@ relay_client_set_status (struct t_relay_client *client,
enum t_relay_status status)
{
client->status = status;
-
+
if (RELAY_CLIENT_HAS_ENDED(client->status))
{
client->end_time = time (NULL);
-
+
if (client->hook_fd)
{
weechat_unhook (client->hook_fd);
@@ -279,14 +279,14 @@ relay_client_set_status (struct t_relay_client *client,
default:
break;
}
-
+
if (client->sock >= 0)
{
close (client->sock);
client->sock = -1;
}
}
-
+
relay_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
}
@@ -298,10 +298,10 @@ void
relay_client_free (struct t_relay_client *client)
{
struct t_relay_client *new_relay_clients;
-
+
if (!client)
return;
-
+
/* remove client from list */
if (last_relay_client == client)
last_relay_client = client->prev_client;
@@ -314,7 +314,7 @@ relay_client_free (struct t_relay_client *client)
new_relay_clients = client->next_client;
if (client->next_client)
(client->next_client)->prev_client = client->prev_client;
-
+
/* free data */
if (client->address)
free (client->address);
@@ -336,11 +336,11 @@ relay_client_free (struct t_relay_client *client)
break;
}
}
-
+
free (client);
-
+
relay_clients = new_relay_clients;
-
+
relay_client_count--;
if (relay_buffer_selected_line >= relay_client_count)
{
@@ -383,7 +383,7 @@ void
relay_client_disconnect_all ()
{
struct t_relay_client *ptr_client;
-
+
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
{
@@ -402,10 +402,10 @@ relay_client_add_to_infolist (struct t_infolist *infolist,
{
struct t_infolist_item *ptr_item;
char value[128];
-
+
if (!infolist || !client)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -442,7 +442,7 @@ relay_client_add_to_infolist (struct t_infolist *infolist,
snprintf (value, sizeof (value), "%lu", client->bytes_sent);
if (!weechat_infolist_new_var_string (ptr_item, "bytes_sent", value))
return 0;
-
+
switch (client->protocol)
{
case RELAY_PROTOCOL_WEECHAT:
@@ -454,7 +454,7 @@ relay_client_add_to_infolist (struct t_infolist *infolist,
case RELAY_NUM_PROTOCOLS:
break;
}
-
+
return 1;
}
@@ -466,7 +466,7 @@ void
relay_client_print_log ()
{
struct t_relay_client *ptr_client;
-
+
for (ptr_client = relay_clients; ptr_client;
ptr_client = ptr_client->next_client)
{
diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c
index 146e31ac5..c36095d2b 100644
--- a/src/plugins/relay/relay-command.c
+++ b/src/plugins/relay/relay-command.c
@@ -45,7 +45,7 @@ relay_command_client_list (int full)
int i;
char date_start[128], date_activity[128];
struct tm *date_tmp;
-
+
if (relay_clients)
{
weechat_printf (NULL, "");
@@ -57,11 +57,11 @@ relay_command_client_list (int full)
date_tmp = localtime (&(ptr_client->start_time));
strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
-
+
date_tmp = localtime (&(ptr_client->last_activity));
strftime (date_activity, sizeof (date_activity),
"%a, %d %b %Y %H:%M:%S", date_tmp);
-
+
if (full)
{
weechat_printf (NULL,
@@ -112,7 +112,7 @@ relay_command_server_list ()
int i;
char date_start[128];
struct tm *date_tmp;
-
+
if (relay_servers)
{
weechat_printf (NULL, "");
@@ -124,7 +124,7 @@ relay_command_server_list ()
date_tmp = localtime (&(ptr_server->start_time));
strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
-
+
weechat_printf (NULL,
_(" port %s%d%s, relay: %s%s.%s%s, started on: %s"),
RELAY_COLOR_CHAT_BUFFER,
@@ -153,11 +153,11 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
struct t_relay_server *ptr_server;
struct t_config_option *ptr_option;
int port;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
{
if (weechat_strcasecmp (argv[1], "list") == 0)
@@ -165,13 +165,13 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
relay_command_client_list (0);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "listfull") == 0)
{
relay_command_client_list (1);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "listrelay") == 0)
{
relay_command_server_list ();
@@ -247,14 +247,14 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (!relay_buffer)
relay_buffer_open ();
-
+
if (relay_buffer)
{
weechat_buffer_set (relay_buffer, "display", "1");
-
+
if (argc > 1)
{
if (strcmp (argv[1], "up") == 0)
@@ -269,9 +269,9 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
}
}
}
-
+
relay_buffer_refresh (NULL);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/relay/relay-completion.c b/src/plugins/relay/relay-completion.c
index f249decdd..699e29446 100644
--- a/src/plugins/relay/relay-completion.c
+++ b/src/plugins/relay/relay-completion.c
@@ -42,12 +42,12 @@ relay_completion_protocol_name_cb (void *data, const char *completion_item,
{
struct t_infolist *infolist;
char protocol_name[256];
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) completion_item;
-
+
infolist = weechat_infolist_get("irc_server", NULL, NULL);
if (infolist)
{
@@ -60,10 +60,10 @@ relay_completion_protocol_name_cb (void *data, const char *completion_item,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_completion_list_add (completion, "weechat",
0, WEECHAT_LIST_POS_SORT);
-
+
return WEECHAT_RC_OK;
}
@@ -79,12 +79,12 @@ relay_completion_relays_cb (void *data, const char *completion_item,
{
struct t_relay_server *ptr_server;
char protocol_name[256];
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) completion_item;
-
+
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -94,7 +94,7 @@ relay_completion_relays_cb (void *data, const char *completion_item,
weechat_hook_completion_list_add (completion, protocol_name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -110,12 +110,12 @@ relay_completion_free_port_cb (void *data, const char *completion_item,
struct t_relay_server *ptr_server;
char str_port[16];
int port_max;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) completion_item;
-
+
port_max = -1;
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -125,11 +125,11 @@ relay_completion_free_port_cb (void *data, const char *completion_item,
}
if (port_max < 0)
port_max = 8000 - 1;
-
+
snprintf (str_port, sizeof (str_port), "%d", port_max + 1);
weechat_hook_completion_list_add (completion, str_port,
0, WEECHAT_LIST_POS_SORT);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c
index e056d5181..c36c3b04a 100644
--- a/src/plugins/relay/relay-config.c
+++ b/src/plugins/relay/relay-config.c
@@ -65,7 +65,7 @@ relay_config_refresh_cb (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (relay_buffer)
relay_buffer_refresh (NULL);
}
@@ -80,11 +80,11 @@ relay_config_change_network_bind_address_cb (void *data,
struct t_config_option *option)
{
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -105,11 +105,11 @@ relay_config_check_port_cb (void *data, struct t_config_option *option,
char *error;
long port;
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
error = NULL;
port = strtol (value, &error, 10);
ptr_server = relay_server_search_port ((int)port);
@@ -120,7 +120,7 @@ relay_config_check_port_cb (void *data, struct t_config_option *option,
RELAY_PLUGIN_NAME, (int)port);
return 0;
}
-
+
return 1;
}
@@ -133,10 +133,10 @@ void
relay_config_change_port_cb (void *data, struct t_config_option *option)
{
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
if (ptr_server)
{
@@ -154,10 +154,10 @@ void
relay_config_delete_port_cb (void *data, struct t_config_option *option)
{
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
if (ptr_server)
relay_server_free (ptr_server);
@@ -178,21 +178,21 @@ relay_config_create_option_port (void *data,
char *error, *protocol, *protocol_args;
long port;
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
-
+
relay_server_get_protocol_args (option_name,
&protocol, &protocol_args);
-
+
protocol_number = -1;
port = -1;
-
+
if (protocol && protocol_args)
protocol_number = relay_protocol_search (protocol);
-
+
if (protocol_number < 0)
{
weechat_printf (NULL, _("%s%s: error: unknown protocol \"%s\""),
@@ -208,7 +208,7 @@ relay_config_create_option_port (void *data,
RELAY_PLUGIN_NAME, option_name);
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
}
-
+
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
error = NULL;
@@ -222,7 +222,7 @@ relay_config_create_option_port (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
}
}
-
+
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
/* create config option */
@@ -233,18 +233,18 @@ relay_config_create_option_port (void *data,
&relay_config_check_port_cb, NULL,
&relay_config_change_port_cb, NULL,
&relay_config_delete_port_cb, NULL);
-
+
if (relay_server_new (protocol_number, protocol_args, port))
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
else
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
}
-
+
if (protocol)
free (protocol);
if (protocol_args)
free (protocol_args);
-
+
return rc;
}
@@ -257,7 +257,7 @@ relay_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
return weechat_config_reload (config_file);
}
@@ -270,12 +270,12 @@ int
relay_config_init ()
{
struct t_config_section *ptr_section;
-
+
relay_config_file = weechat_config_new (RELAY_CONFIG_NAME,
&relay_config_reload, NULL);
if (!relay_config_file)
return 0;
-
+
ptr_section = weechat_config_new_section (relay_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
@@ -286,7 +286,7 @@ relay_config_init ()
weechat_config_free (relay_config_file);
return 0;
}
-
+
relay_config_look_auto_open_buffer = weechat_config_new_option (
relay_config_file, ptr_section,
"auto_open_buffer", "boolean",
@@ -298,7 +298,7 @@ relay_config_init ()
N_("number of raw messages to save in memory when raw data buffer is "
"closed (messages will be displayed when opening raw data buffer)"),
NULL, 0, 65535, "256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (relay_config_file, "color",
0, 0,
NULL, NULL, NULL, NULL,
@@ -309,7 +309,7 @@ relay_config_init ()
weechat_config_free (relay_config_file);
return 0;
}
-
+
relay_config_color_text = weechat_config_new_option (
relay_config_file, ptr_section,
"text", "color",
@@ -358,7 +358,7 @@ relay_config_init ()
N_("text color for \"disconnected\" status"),
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (relay_config_file, "network",
0, 0,
NULL, NULL, NULL, NULL,
@@ -390,7 +390,7 @@ relay_config_init ()
N_("password required by clients to access this relay (empty value "
"means no password required)"),
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (relay_config_file, "port",
1, 1,
NULL, NULL,
@@ -403,9 +403,9 @@ relay_config_init ()
weechat_config_free (relay_config_file);
return 0;
}
-
+
relay_config_section_port = ptr_section;
-
+
return 1;
}
diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c
index 544f6bd58..e34e47133 100644
--- a/src/plugins/relay/relay-info.c
+++ b/src/plugins/relay/relay-info.c
@@ -39,19 +39,19 @@ relay_info_get_infolist_cb (void *data, const char *infolist_name,
{
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)
{
@@ -81,7 +81,7 @@ relay_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
diff --git a/src/plugins/relay/relay-raw.c b/src/plugins/relay/relay-raw.c
index 1557a0389..23f30ffcc 100644
--- a/src/plugins/relay/relay-raw.c
+++ b/src/plugins/relay/relay-raw.c
@@ -66,7 +66,7 @@ void
relay_raw_open (int switch_to_buffer)
{
struct t_relay_raw_message *ptr_raw_message;
-
+
if (!relay_raw_buffer)
{
relay_raw_buffer = weechat_buffer_search (RELAY_PLUGIN_NAME,
@@ -76,11 +76,11 @@ relay_raw_open (int switch_to_buffer)
relay_raw_buffer = weechat_buffer_new (RELAY_RAW_BUFFER_NAME,
&relay_buffer_input_cb, NULL,
&relay_buffer_close_cb, NULL);
-
+
/* failed to create buffer ? then return */
if (!relay_raw_buffer)
return;
-
+
weechat_buffer_set (relay_raw_buffer,
"title", _("Relay raw messages"));
@@ -93,10 +93,10 @@ relay_raw_open (int switch_to_buffer)
weechat_buffer_set (relay_raw_buffer, "localvar_set_server", RELAY_RAW_BUFFER_NAME);
weechat_buffer_set (relay_raw_buffer, "localvar_set_channel", RELAY_RAW_BUFFER_NAME);
weechat_buffer_set (relay_raw_buffer, "localvar_set_no_log", "1");
-
+
/* disable all highlights on this buffer */
weechat_buffer_set (relay_raw_buffer, "highlight_words", "-");
-
+
/* print messages in list */
for (ptr_raw_message = relay_raw_messages; ptr_raw_message;
ptr_raw_message = ptr_raw_message->next_message)
@@ -105,7 +105,7 @@ relay_raw_open (int switch_to_buffer)
}
}
}
-
+
if (relay_raw_buffer && switch_to_buffer)
weechat_buffer_set (relay_raw_buffer, "display", "1");
}
@@ -118,7 +118,7 @@ void
relay_raw_message_free (struct t_relay_raw_message *raw_message)
{
struct t_relay_raw_message *new_raw_messages;
-
+
/* remove message from raw messages list */
if (last_relay_raw_message == raw_message)
last_relay_raw_message = raw_message->prev_message;
@@ -129,20 +129,20 @@ relay_raw_message_free (struct t_relay_raw_message *raw_message)
}
else
new_raw_messages = raw_message->next_message;
-
+
if (raw_message->next_message)
(raw_message->next_message)->prev_message = raw_message->prev_message;
-
+
/* free data */
if (raw_message->prefix)
free (raw_message->prefix);
if (raw_message->message)
free (raw_message->message);
-
+
free (raw_message);
-
+
relay_raw_messages = new_raw_messages;
-
+
relay_raw_messages_count--;
}
@@ -168,7 +168,7 @@ void
relay_raw_message_remove_old ()
{
int max_messages;
-
+
max_messages = weechat_config_integer (relay_config_look_raw_messages);
while (relay_raw_messages && (relay_raw_messages_count >= max_messages))
{
@@ -185,19 +185,19 @@ relay_raw_message_add_to_list (time_t date, const char *prefix,
const char *message)
{
struct t_relay_raw_message *new_raw_message;
-
+
if (!prefix || !message)
return NULL;
-
+
relay_raw_message_remove_old ();
-
+
new_raw_message = malloc (sizeof (*new_raw_message));
if (new_raw_message)
{
new_raw_message->date = date;
new_raw_message->prefix = strdup (prefix);
new_raw_message->message = strdup (message);
-
+
/* add message to list */
new_raw_message->prev_message = last_relay_raw_message;
new_raw_message->next_message = NULL;
@@ -206,10 +206,10 @@ relay_raw_message_add_to_list (time_t date, const char *prefix,
else
relay_raw_messages = new_raw_message;
last_relay_raw_message = new_raw_message;
-
+
relay_raw_messages_count++;
}
-
+
return new_raw_message;
}
@@ -226,7 +226,7 @@ relay_raw_message_add (struct t_relay_client *client, int send,
const char *hexa = "0123456789ABCDEF";
int pos_buf, pos_buf2, char_size, i;
struct t_relay_raw_message *new_raw_message;
-
+
buf = weechat_iconv_to_internal (NULL, message);
buf2 = malloc ((strlen (buf) * 3) + 1);
if (buf2)
@@ -254,7 +254,7 @@ relay_raw_message_add (struct t_relay_client *client, int send,
}
buf2[pos_buf2] = '\0';
}
-
+
if (client)
{
snprintf (prefix, sizeof (prefix), "%s[%s%d%s] %s%s %s%s",
@@ -277,16 +277,16 @@ relay_raw_message_add (struct t_relay_client *client, int send,
weechat_color ("chat_prefix_join"),
(send) ? RELAY_RAW_PREFIX_SEND : RELAY_RAW_PREFIX_RECV);
}
-
+
new_raw_message = relay_raw_message_add_to_list (time (NULL),
prefix,
(buf2) ? buf2 : ((buf) ? buf : message));
-
+
if (buf)
free (buf);
if (buf2)
free (buf2);
-
+
return new_raw_message;
}
@@ -298,14 +298,14 @@ void
relay_raw_print (struct t_relay_client *client, int send, const char *message)
{
struct t_relay_raw_message *new_raw_message;
-
+
if (!message)
return;
-
+
/* auto-open Relay raw buffer if debug for irc plugin is >= 1 */
if (!relay_raw_buffer && (weechat_relay_plugin->debug >= 1))
relay_raw_open (0);
-
+
new_raw_message = relay_raw_message_add (client, send, message);
if (new_raw_message)
{
@@ -326,20 +326,20 @@ relay_raw_add_to_infolist (struct t_infolist *infolist,
struct t_relay_raw_message *raw_message)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !raw_message)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_time (ptr_item, "date", raw_message->date))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "prefix", raw_message->prefix))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "message", raw_message->message))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c
index b1a39138d..7a361b389 100644
--- a/src/plugins/relay/relay-server.c
+++ b/src/plugins/relay/relay-server.c
@@ -55,7 +55,7 @@ relay_server_get_protocol_args (const char *protocol_and_args,
char **protocol, char **protocol_args)
{
char *pos;
-
+
pos = strchr (protocol_and_args, '.');
if (pos)
{
@@ -79,12 +79,12 @@ relay_server_search (const char *protocol_and_args)
{
char *protocol, *protocol_args;
struct t_relay_server *ptr_server;
-
+
relay_server_get_protocol_args (protocol_and_args,
&protocol, &protocol_args);
-
+
ptr_server = NULL;
-
+
if (protocol && protocol_args)
{
for (ptr_server = relay_servers; ptr_server;
@@ -97,12 +97,12 @@ relay_server_search (const char *protocol_and_args)
}
}
}
-
+
if (protocol)
free (protocol);
if (protocol_args)
free (protocol_args);
-
+
return ptr_server;
}
@@ -114,14 +114,14 @@ struct t_relay_server *
relay_server_search_port (int port)
{
struct t_relay_server *ptr_server;
-
+
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server->port == port)
return ptr_server;
}
-
+
/* server not found */
return NULL;
}
@@ -167,15 +167,15 @@ relay_server_sock_cb (void *data, int fd)
socklen_t client_length;
int client_fd;
char ipv4_address[INET_ADDRSTRLEN + 1], *ptr_address;
-
+
/* make C compiler happy */
(void) fd;
-
+
server = (struct t_relay_server *)data;
-
+
client_length = sizeof (client_addr);
memset (&client_addr, 0, client_length);
-
+
client_fd = accept (server->sock, (struct sockaddr *) &client_addr,
&client_length);
if (client_fd < 0)
@@ -189,7 +189,7 @@ relay_server_sock_cb (void *data, int fd)
server->protocol_args);
return WEECHAT_RC_OK;
}
-
+
ptr_address = NULL;
if (inet_ntop (AF_INET,
&(client_addr.sin_addr),
@@ -198,9 +198,9 @@ relay_server_sock_cb (void *data, int fd)
{
ptr_address = ipv4_address;
}
-
+
relay_client_new (client_fd, ptr_address, server);
-
+
return WEECHAT_RC_OK;
}
@@ -213,7 +213,7 @@ relay_server_create_socket (struct t_relay_server *server)
{
int set, max_clients;
struct sockaddr_in server_addr;
-
+
server->sock = socket (AF_INET, SOCK_STREAM, 0);
if (server->sock < 0)
{
@@ -222,7 +222,7 @@ relay_server_create_socket (struct t_relay_server *server)
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
return 0;
}
-
+
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
(void *) &set, sizeof (set)) < 0)
@@ -235,7 +235,7 @@ relay_server_create_socket (struct t_relay_server *server)
server->sock = -1;
return 0;
}
-
+
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
(void *) &set, sizeof (set)) < 0)
@@ -248,7 +248,7 @@ relay_server_create_socket (struct t_relay_server *server)
server->sock = -1;
return 0;
}
-
+
memset(&server_addr, 0, sizeof(struct sockaddr_in));
server_addr.sin_family = AF_INET;
if (weechat_config_string (relay_config_network_bind_address)
@@ -261,7 +261,7 @@ relay_server_create_socket (struct t_relay_server *server)
server_addr.sin_addr.s_addr = INADDR_ANY;
}
server_addr.sin_port = htons (server->port);
-
+
if (bind (server->sock, (struct sockaddr *) &server_addr,
sizeof (server_addr)) < 0)
{
@@ -275,11 +275,11 @@ relay_server_create_socket (struct t_relay_server *server)
server->sock = -1;
return 0;
}
-
+
max_clients = weechat_config_integer (relay_config_network_max_clients);
-
+
listen (server->sock, max_clients);
-
+
weechat_printf (NULL,
_("%s: listening on port %d (relay: %s.%s, max %d clients)"),
RELAY_PLUGIN_NAME,
@@ -287,14 +287,14 @@ relay_server_create_socket (struct t_relay_server *server)
relay_protocol_string[server->protocol],
server->protocol_args,
max_clients);
-
+
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
&relay_server_sock_cb,
server);
server->start_time = time (NULL);
-
+
return 1;
}
@@ -316,7 +316,7 @@ relay_server_new (enum t_relay_protocol protocol,
RELAY_PLUGIN_NAME, port);
return NULL;
}
-
+
new_server = malloc (sizeof (*new_server));
if (new_server)
{
@@ -327,7 +327,7 @@ relay_server_new (enum t_relay_protocol protocol,
new_server->sock = -1;
new_server->hook_fd = NULL;
new_server->start_time = 0;
-
+
new_server->prev_server = NULL;
new_server->next_server = relay_servers;
if (relay_servers)
@@ -335,7 +335,7 @@ relay_server_new (enum t_relay_protocol protocol,
else
last_relay_server = new_server;
relay_servers = new_server;
-
+
relay_server_create_socket (new_server);
}
else
@@ -344,7 +344,7 @@ relay_server_new (enum t_relay_protocol protocol,
_("%s%s: not enough memory for listening on new port"),
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
}
-
+
return new_server;
}
@@ -371,10 +371,10 @@ void
relay_server_free (struct t_relay_server *server)
{
struct t_relay_server *new_relay_servers;
-
+
if (!server)
return;
-
+
/* remove server from list */
if (last_relay_server == server)
last_relay_server = server->prev_server;
@@ -387,14 +387,14 @@ relay_server_free (struct t_relay_server *server)
new_relay_servers = server->next_server;
if (server->next_server)
(server->next_server)->prev_server = server->prev_server;
-
+
/* free data */
relay_server_close_socket (server);
if (server->protocol_args)
free (server->protocol_args);
-
+
free (server);
-
+
relay_servers = new_relay_servers;
}
@@ -419,7 +419,7 @@ void
relay_server_print_log ()
{
struct t_relay_server *ptr_server;
-
+
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
diff --git a/src/plugins/relay/relay-upgrade.c b/src/plugins/relay/relay-upgrade.c
index b37eed9bf..ac1062209 100644
--- a/src/plugins/relay/relay-upgrade.c
+++ b/src/plugins/relay/relay-upgrade.c
@@ -66,7 +66,7 @@ relay_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save raw messages */
for (ptr_raw_message = relay_raw_messages; ptr_raw_message;
ptr_raw_message = ptr_raw_message->next_message)
@@ -86,7 +86,7 @@ relay_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
return 1;
}
@@ -100,15 +100,15 @@ relay_upgrade_save ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME, 1);
if (!upgrade_file)
return 0;
-
+
rc = relay_upgrade_save_all_data (upgrade_file);
-
+
weechat_upgrade_close (upgrade_file);
-
+
return rc;
}
@@ -122,7 +122,7 @@ relay_upgrade_set_buffer_callbacks ()
{
struct t_infolist *infolist;
struct t_gui_buffer *ptr_buffer;
-
+
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
{
@@ -160,11 +160,11 @@ relay_upgrade_read_cb (void *data,
struct t_infolist *infolist)
{
struct t_relay_client *new_client;
-
+
/* make C compiler happy */
(void) data;
(void) upgrade_file;
-
+
weechat_infolist_reset_item_cursor (infolist);
while (weechat_infolist_next (infolist))
{
@@ -197,7 +197,7 @@ relay_upgrade_read_cb (void *data,
"%lu", &(new_client->bytes_recv));
sscanf (weechat_infolist_string (infolist, "bytes_sent"),
"%lu", &(new_client->bytes_sent));
-
+
switch (new_client->protocol)
{
case RELAY_PROTOCOL_WEECHAT:
@@ -211,7 +211,7 @@ relay_upgrade_read_cb (void *data,
case RELAY_NUM_PROTOCOLS:
break;
}
-
+
new_client->prev_client = NULL;
new_client->next_client = relay_clients;
if (relay_clients)
@@ -219,7 +219,7 @@ relay_upgrade_read_cb (void *data,
else
last_relay_client = new_client;
relay_clients = new_client;
-
+
relay_client_count++;
}
break;
@@ -230,7 +230,7 @@ relay_upgrade_read_cb (void *data,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -244,11 +244,11 @@ relay_upgrade_load ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
relay_upgrade_set_buffer_callbacks ();
-
+
upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME, 0);
rc = weechat_upgrade_read (upgrade_file, &relay_upgrade_read_cb, NULL);
-
+
return rc;
}
diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c
index d89d55f00..7b9cc787a 100644
--- a/src/plugins/relay/relay.c
+++ b/src/plugins/relay/relay.c
@@ -67,7 +67,7 @@ relay_protocol_search (const char *name)
return i;
}
}
-
+
/* protocol not found */
return -1;
}
@@ -81,21 +81,21 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_relay_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
(void) signal_data;
-
+
relay_signal_upgrade_received = 1;
-
+
for (ptr_server = relay_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
relay_server_close_socket (ptr_server);
}
-
+
return WEECHAT_RC_OK;
}
@@ -111,22 +111,22 @@ relay_debug_dump_cb (void *data, const char *signal, const char *type_data,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, RELAY_PLUGIN_NAME) == 0))
{
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
relay_server_print_log ();
relay_client_print_log ();
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
}
-
+
return WEECHAT_RC_OK;
}
@@ -138,29 +138,29 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int i, upgrading;
-
+
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
if (!relay_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (relay_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
relay_command_init ();
-
+
/* hook completions */
relay_completion_init ();
-
+
weechat_hook_signal ("upgrade", &relay_signal_upgrade_cb, NULL);
weechat_hook_signal ("debug_dump", &relay_debug_dump_cb, NULL);
-
+
relay_info_init ();
-
+
/* look at arguments */
upgrading = 0;
for (i = 0; i < argc; i++)
@@ -170,10 +170,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
upgrading = 1;
}
}
-
+
if (upgrading)
relay_upgrade_load ();
-
+
return WEECHAT_RC_OK;
}
@@ -186,24 +186,24 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
relay_config_write ();
-
+
if (relay_signal_upgrade_received)
relay_upgrade_save ();
else
{
relay_raw_message_free_all ();
-
+
relay_server_free_all ();
-
+
relay_client_disconnect_all ();
-
+
if (relay_buffer)
weechat_buffer_close (relay_buffer);
-
+
relay_client_free_all ();
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/rmodifier/rmodifier-command.c b/src/plugins/rmodifier/rmodifier-command.c
index b51af0526..afeda8b98 100644
--- a/src/plugins/rmodifier/rmodifier-command.c
+++ b/src/plugins/rmodifier/rmodifier-command.c
@@ -62,7 +62,7 @@ void
rmodifier_command_list (const char *message)
{
struct t_rmodifier *ptr_rmodifier;
-
+
if (rmodifier_list)
{
weechat_printf (NULL, "");
@@ -91,11 +91,11 @@ rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
struct t_rmodifier *ptr_rmodifier;
struct t_config_option *ptr_option;
int i, count;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if ((argc == 1)
|| ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0)))
{
@@ -118,7 +118,7 @@ rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
}
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "add") == 0)
{
/* add a rmodifier */
@@ -149,13 +149,13 @@ rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
ptr_rmodifier->modifiers,
ptr_rmodifier->str_regex,
ptr_rmodifier->groups);
-
+
/* display message */
weechat_printf (NULL, _("Rmodifier \"%s\" created"),
ptr_rmodifier->name);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "del") == 0)
{
/* add a rmodifier */
@@ -200,7 +200,7 @@ rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
}
return WEECHAT_RC_OK;
}
-
+
/* restore default rmodifiers (only with "-yes", for security reason) */
if (weechat_strcasecmp (argv[1], "default") == 0)
{
@@ -221,7 +221,7 @@ rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
}
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/rmodifier/rmodifier-completion.c b/src/plugins/rmodifier/rmodifier-completion.c
index 8d8d29b1a..7efbc9266 100644
--- a/src/plugins/rmodifier/rmodifier-completion.c
+++ b/src/plugins/rmodifier/rmodifier-completion.c
@@ -38,19 +38,19 @@ rmodifier_completion_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_rmodifier *ptr_rmodifier;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_rmodifier = rmodifier_list; ptr_rmodifier;
ptr_rmodifier = ptr_rmodifier->next_rmodifier)
{
weechat_hook_completion_list_add (completion, ptr_rmodifier->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/rmodifier/rmodifier-config.c b/src/plugins/rmodifier/rmodifier-config.c
index 61ed77c82..b7be950a6 100644
--- a/src/plugins/rmodifier/rmodifier-config.c
+++ b/src/plugins/rmodifier/rmodifier-config.c
@@ -60,10 +60,10 @@ rmodifier_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
rmodifier_free_all ();
weechat_config_section_free_options (rmodifier_config_section_modifier);
-
+
return weechat_config_reload (config_file);
}
@@ -77,7 +77,7 @@ rmodifier_config_modifier_change_cb (void *data, struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
-
+
rmodifier_new_with_string (weechat_config_option_get_pointer (option, "name"),
weechat_config_option_get_pointer (option, "value"));
}
@@ -91,10 +91,10 @@ void
rmodifier_config_modifier_delete_cb (void *data, struct t_config_option *option)
{
struct t_rmodifier *ptr_rmodifier;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_rmodifier = rmodifier_search (weechat_config_option_get_pointer (option,
"name"));
if (ptr_rmodifier)
@@ -113,13 +113,13 @@ rmodifier_config_modifier_write_default_cb (void *data,
const char *section_name)
{
int i;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (i = 0; rmodifier_config_default_list[i][0]; i++)
{
if (!weechat_config_write_line (config_file,
@@ -130,7 +130,7 @@ rmodifier_config_modifier_write_default_cb (void *data,
rmodifier_config_default_list[i][3]))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -178,12 +178,12 @@ rmodifier_config_modifier_create_option_cb (void *data,
{
struct t_rmodifier *ptr_rmodifier;
int rc;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
/* create rmodifier */
ptr_rmodifier = rmodifier_search (option_name);
if (ptr_rmodifier)
@@ -205,7 +205,7 @@ rmodifier_config_modifier_create_option_cb (void *data,
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -214,7 +214,7 @@ rmodifier_config_modifier_create_option_cb (void *data,
weechat_prefix ("error"), RMODIFIER_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -227,12 +227,12 @@ int
rmodifier_config_init ()
{
struct t_config_section *ptr_section;
-
+
rmodifier_config_file = weechat_config_new (RMODIFIER_CONFIG_NAME,
&rmodifier_config_reload, NULL);
if (!rmodifier_config_file)
return 0;
-
+
/* look */
ptr_section = weechat_config_new_section (rmodifier_config_file, "look",
0, 0,
@@ -244,13 +244,13 @@ rmodifier_config_init ()
weechat_config_free (rmodifier_config_file);
return 0;
}
-
+
rmodifier_config_look_hide_char = weechat_config_new_option (
rmodifier_config_file, ptr_section,
"hide_char", "string",
N_("char used to hide part of a string"),
NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
/* modifier */
ptr_section = weechat_config_new_section (rmodifier_config_file, "modifier",
0, 0,
@@ -265,7 +265,7 @@ rmodifier_config_init ()
return 0;
}
rmodifier_config_section_modifier = ptr_section;
-
+
return 1;
}
diff --git a/src/plugins/rmodifier/rmodifier-debug.c b/src/plugins/rmodifier/rmodifier-debug.c
index a371bd264..cf07cfc7b 100644
--- a/src/plugins/rmodifier/rmodifier-debug.c
+++ b/src/plugins/rmodifier/rmodifier-debug.c
@@ -41,21 +41,21 @@ rmodifier_debug_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, RMODIFIER_PLUGIN_NAME) == 0))
{
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
rmodifier_print_log ();
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/rmodifier/rmodifier-info.c b/src/plugins/rmodifier/rmodifier-info.c
index af303dca0..213882c18 100644
--- a/src/plugins/rmodifier/rmodifier-info.c
+++ b/src/plugins/rmodifier/rmodifier-info.c
@@ -39,19 +39,19 @@ rmodifier_info_get_infolist_cb (void *data, const char *infolist_name,
{
struct t_infolist *ptr_infolist;
struct t_rmodifier *ptr_rmodifier;
-
+
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, RMODIFIER_PLUGIN_NAME) == 0)
{
if (pointer && !rmodifier_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -85,7 +85,7 @@ rmodifier_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
diff --git a/src/plugins/rmodifier/rmodifier.c b/src/plugins/rmodifier/rmodifier.c
index f79db52bd..7df1f18a3 100644
--- a/src/plugins/rmodifier/rmodifier.c
+++ b/src/plugins/rmodifier/rmodifier.c
@@ -60,17 +60,17 @@ int
rmodifier_valid (struct t_rmodifier *rmodifier)
{
struct t_rmodifier *ptr_rmodifier;
-
+
if (!rmodifier)
return 0;
-
+
for (ptr_rmodifier = rmodifier_list; ptr_rmodifier;
ptr_rmodifier = ptr_rmodifier->next_rmodifier)
{
if (ptr_rmodifier == rmodifier)
return 1;
}
-
+
/* rmodifier not found */
return 0;
}
@@ -83,7 +83,7 @@ struct t_rmodifier *
rmodifier_search (const char *name)
{
struct t_rmodifier *ptr_rmodifier;
-
+
for (ptr_rmodifier = rmodifier_list; ptr_rmodifier;
ptr_rmodifier = ptr_rmodifier->next_rmodifier)
{
@@ -103,21 +103,21 @@ rmodifier_hide_string (const char *string)
{
int length, i;
char *result;
-
+
if (!string || !string[0])
return NULL;
-
+
length = weechat_utf8_strlen (string);
result = malloc ((length * strlen (weechat_config_string (rmodifier_config_look_hide_char))) + 1);
if (!result)
return NULL;
-
+
result[0] = '\0';
for (i = 0; i < length; i++)
{
strcat (result, weechat_config_string (rmodifier_config_look_hide_char));
}
-
+
return result;
}
@@ -133,12 +133,12 @@ rmodifier_replace_groups (const char *string, regmatch_t regex_match[],
char *result, *result2, *str_group, *string_to_add;
const char *ptr_groups;
int length, num_group;
-
+
length = 1;
result = malloc (length);
if (!result)
return NULL;
-
+
result[0] = '\0';
ptr_groups = groups;
while (ptr_groups && ptr_groups[0])
@@ -157,7 +157,7 @@ rmodifier_replace_groups (const char *string, regmatch_t regex_match[],
string_to_add = rmodifier_hide_string (str_group);
else
string_to_add = strdup (str_group);
-
+
if (string_to_add)
{
length += strlen (string_to_add);
@@ -178,7 +178,7 @@ rmodifier_replace_groups (const char *string, regmatch_t regex_match[],
}
ptr_groups = weechat_utf8_next_char (ptr_groups);
}
-
+
return result;
}
@@ -193,26 +193,26 @@ rmodifier_modifier_cb (void *data, const char *modifier,
struct t_rmodifier *rmodifier;
regmatch_t regex_match[9];
int i;
-
+
/* make C compiler happy */
(void) modifier;
(void) modifier_data;
-
+
rmodifier = (struct t_rmodifier *)data;
-
+
/* reset matching groups */
for (i = 0; i < 9; i++)
{
regex_match[i].rm_so = -1;
}
-
+
/* execute regex and return modified string if matching */
if (regexec (rmodifier->regex, string, 9, regex_match, 0) == 0)
{
return rmodifier_replace_groups (string, regex_match,
rmodifier->groups);
}
-
+
/* regex not matching */
return NULL;
}
@@ -226,9 +226,9 @@ rmodifier_hook_modifiers (struct t_rmodifier *rmodifier)
{
char **argv, str_modifier[128];
int argc, i;
-
+
argv = weechat_string_split (rmodifier->modifiers, ",", 0, 0, &argc);
-
+
if (argv)
{
rmodifier->hooks = malloc (sizeof (*rmodifier->hooks) * argc);
@@ -262,15 +262,15 @@ rmodifier_new (const char *name, const char *modifiers, const char *str_regex,
{
struct t_rmodifier *new_rmodifier, *ptr_rmodifier;
regex_t *regex;
-
+
if (!name || !name[0] || !modifiers || !modifiers[0]
|| !str_regex || !str_regex[0])
return NULL;
-
+
regex = malloc (sizeof (*regex));
if (!regex)
return NULL;
-
+
if (regcomp (regex, str_regex,
REG_EXTENDED | REG_ICASE) != 0)
{
@@ -281,11 +281,11 @@ rmodifier_new (const char *name, const char *modifiers, const char *str_regex,
free (regex);
return NULL;
}
-
+
ptr_rmodifier = rmodifier_search (name);
if (ptr_rmodifier)
rmodifier_free (ptr_rmodifier);
-
+
new_rmodifier = malloc (sizeof (*new_rmodifier));
if (new_rmodifier)
{
@@ -295,10 +295,10 @@ rmodifier_new (const char *name, const char *modifiers, const char *str_regex,
new_rmodifier->str_regex = strdup (str_regex);
new_rmodifier->regex = regex;
new_rmodifier->groups = strdup ((groups) ? groups : "");
-
+
/* create modifiers */
rmodifier_hook_modifiers (new_rmodifier);
-
+
if (rmodifier_list)
{
/* add rmodifier to end of list */
@@ -314,10 +314,10 @@ rmodifier_new (const char *name, const char *modifiers, const char *str_regex,
rmodifier_list = new_rmodifier;
last_rmodifier = new_rmodifier;
}
-
+
rmodifier_count++;
}
-
+
return new_rmodifier;
}
@@ -331,9 +331,9 @@ rmodifier_new_with_string (const char *name, const char *value)
{
struct t_rmodifier *new_rmodifier;
char *pos1, *pos2, *modifiers, *str_regex;
-
+
new_rmodifier = NULL;
-
+
pos1 = strchr (value, ';');
pos2 = rindex (value, ';');
if (pos1 && pos2 && (pos2 > pos1))
@@ -350,7 +350,7 @@ rmodifier_new_with_string (const char *name, const char *value)
if (str_regex)
free (str_regex);
}
-
+
return new_rmodifier;
}
@@ -362,7 +362,7 @@ void
rmodifier_create_default ()
{
int i;
-
+
for (i = 0; rmodifier_config_default_list[i][0]; i++)
{
if (rmodifier_new (rmodifier_config_default_list[i][0],
@@ -387,7 +387,7 @@ rmodifier_free (struct t_rmodifier *rmodifier)
{
struct t_rmodifier *new_rmodifier_list;
int i;
-
+
/* remove rmodifier from list */
if (last_rmodifier == rmodifier)
last_rmodifier = rmodifier->prev_rmodifier;
@@ -424,9 +424,9 @@ rmodifier_free (struct t_rmodifier *rmodifier)
if (rmodifier->groups)
free (rmodifier->groups);
free (rmodifier);
-
+
rmodifier_count--;
-
+
rmodifier_list = new_rmodifier_list;
}
@@ -455,10 +455,10 @@ rmodifier_add_to_infolist (struct t_infolist *infolist,
struct t_infolist_item *ptr_item;
char option_name[64];
int i;
-
+
if (!infolist || !rmodifier)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -482,7 +482,7 @@ rmodifier_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "groups", rmodifier->groups))
return 0;
-
+
return 1;
}
@@ -495,7 +495,7 @@ rmodifier_print_log ()
{
struct t_rmodifier *ptr_rmodifier;
int i;
-
+
for (ptr_rmodifier = rmodifier_list; ptr_rmodifier;
ptr_rmodifier = ptr_rmodifier->next_rmodifier)
{
@@ -526,13 +526,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* make C compiler happy */
(void) argc;
(void) argv;
-
+
weechat_plugin = plugin;
-
+
rmodifier_count = 0;
-
+
rmodifier_hook_list = weechat_list_new ();
-
+
if (!rmodifier_config_init ())
{
weechat_printf (NULL,
@@ -541,14 +541,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_ERROR;
}
rmodifier_config_read ();
-
+
rmodifier_command_init ();
rmodifier_completion_init ();
-
+
rmodifier_info_init ();
-
+
rmodifier_debug_init ();
-
+
return WEECHAT_RC_OK;
}
@@ -561,11 +561,11 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
rmodifier_config_write ();
rmodifier_free_all ();
weechat_list_free (rmodifier_hook_list);
weechat_config_free (rmodifier_config_file);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c
index 8d5856976..b0211c143 100644
--- a/src/plugins/scripts/guile/weechat-guile-api.c
+++ b/src/plugins/scripts/guile/weechat-guile-api.c
@@ -86,7 +86,7 @@ weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license,
|| !scm_is_string (description) || !scm_is_string (shutdown_func)
|| !scm_is_string (charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (script_search (weechat_guile_plugin, guile_scripts,
scm_i_string_chars (name)))
{
@@ -98,7 +98,7 @@ weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license,
weechat_prefix ("error"), GUILE_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
guile_current_script = script_add (weechat_guile_plugin,
&guile_scripts, &last_guile_script,
@@ -129,7 +129,7 @@ weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license,
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -142,13 +142,13 @@ SCM
weechat_guile_api_plugin_get_name (SCM plugin)
{
const char *result;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (!scm_is_string (plugin))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_plugin_get_name (script_str2ptr (scm_i_string_chars (plugin)));
-
+
API_RETURN_STRING(result);
}
@@ -162,9 +162,9 @@ weechat_guile_api_charset_set (SCM charset)
API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (!scm_is_string (charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_charset_set (guile_current_script, scm_i_string_chars (charset));
-
+
API_RETURN_OK;
}
@@ -177,14 +177,14 @@ weechat_guile_api_iconv_to_internal (SCM charset, SCM string)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (!scm_is_string (charset) || !scm_is_string (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_to_internal (scm_i_string_chars (charset),
scm_i_string_chars (string));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -198,14 +198,14 @@ weechat_guile_api_iconv_from_internal (SCM charset, SCM string)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (!scm_is_string (charset) || !scm_is_string (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_from_internal (scm_i_string_chars (charset),
scm_i_string_chars (string));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -217,13 +217,13 @@ SCM
weechat_guile_api_gettext (SCM string)
{
const char *result;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (!scm_is_string (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_gettext (scm_i_string_chars (string));
-
+
API_RETURN_STRING(result);
}
@@ -235,16 +235,16 @@ SCM
weechat_guile_api_ngettext (SCM single, SCM plural, SCM count)
{
const char *result;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (!scm_is_string (single) || !scm_is_string (plural)
|| !scm_is_integer (count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_ngettext (scm_i_string_chars (single),
scm_i_string_chars (plural),
scm_to_int (count));
-
+
API_RETURN_STRING(result);
}
@@ -258,16 +258,16 @@ SCM
weechat_guile_api_string_match (SCM string, SCM mask, SCM case_sensitive)
{
int value;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
if (!scm_is_string (string) || !scm_is_string (mask)
|| !scm_is_integer (case_sensitive))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_match (scm_i_string_chars (string),
scm_i_string_chars (mask),
scm_to_int (case_sensitive));
-
+
API_RETURN_INT(value);
}
@@ -283,14 +283,14 @@ SCM
weechat_guile_api_string_has_highlight (SCM string, SCM highlight_words)
{
int value;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (!scm_is_string (string) || !scm_is_string (highlight_words))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight (scm_i_string_chars (string),
scm_i_string_chars (highlight_words));
-
+
API_RETURN_INT(value);
}
@@ -306,14 +306,14 @@ SCM
weechat_guile_api_string_has_highlight_regex (SCM string, SCM regex)
{
int value;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (!scm_is_string (string) || !scm_is_string (regex))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight_regex (scm_i_string_chars (string),
scm_i_string_chars (regex));
-
+
API_RETURN_INT(value);
}
@@ -329,13 +329,13 @@ weechat_guile_api_string_mask_to_regex (SCM mask)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (!scm_is_string (mask))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_mask_to_regex (scm_i_string_chars (mask));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -348,14 +348,14 @@ weechat_guile_api_string_remove_color (SCM string, SCM replacement)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (!scm_is_string (string) || !scm_is_string (replacement))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_remove_color (scm_i_string_chars (string),
scm_i_string_chars (replacement));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -368,13 +368,13 @@ SCM
weechat_guile_api_string_is_command_char (SCM string)
{
int value;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (!scm_is_string (string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_is_command_char (scm_i_string_chars (string));
-
+
API_RETURN_INT(value);
}
@@ -388,13 +388,13 @@ SCM
weechat_guile_api_string_input_for_buffer (SCM string)
{
const char *result;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (!scm_is_string (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_input_for_buffer (scm_i_string_chars (string));
-
+
API_RETURN_STRING(result);
}
@@ -408,10 +408,10 @@ weechat_guile_api_mkdir_home (SCM directory, SCM mode)
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (!scm_is_string (directory) || !scm_is_integer (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_home (scm_i_string_chars (directory), scm_to_int (mode)))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -425,10 +425,10 @@ weechat_guile_api_mkdir (SCM directory, SCM mode)
API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (!scm_is_string (directory) || !scm_is_integer (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir (scm_i_string_chars (directory), scm_to_int (mode)))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -443,10 +443,10 @@ weechat_guile_api_mkdir_parents (SCM directory, SCM mode)
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (!scm_is_string (directory) || !scm_is_integer (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_parents (scm_i_string_chars (directory), scm_to_int (mode)))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -458,11 +458,11 @@ SCM
weechat_guile_api_list_new ()
{
char *result;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING(result);
}
@@ -474,17 +474,17 @@ SCM
weechat_guile_api_list_add (SCM weelist, SCM data, SCM where, SCM user_data)
{
char *result;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (!scm_is_string (weelist) || !scm_is_string (data)
|| !scm_is_string (where) || !scm_is_string (user_data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr(scm_i_string_chars (weelist)),
scm_i_string_chars (data),
scm_i_string_chars (where),
script_str2ptr (scm_i_string_chars (user_data))));
-
+
API_RETURN_STRING(result);
}
@@ -496,14 +496,14 @@ SCM
weechat_guile_api_list_search (SCM weelist, SCM data)
{
char *result;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (!scm_is_string (weelist) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr(scm_i_string_chars (weelist)),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING(result);
}
@@ -515,14 +515,14 @@ SCM
weechat_guile_api_list_search_pos (SCM weelist, SCM data)
{
int pos;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (!scm_is_string (weelist) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_search_pos (script_str2ptr (scm_i_string_chars (weelist)),
scm_i_string_chars (data));
-
+
API_RETURN_INT(pos);
}
@@ -534,14 +534,14 @@ SCM
weechat_guile_api_list_casesearch (SCM weelist, SCM data)
{
char *result;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (!scm_is_string (weelist) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (scm_i_string_chars (weelist)),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING(result);
}
@@ -554,14 +554,14 @@ SCM
weechat_guile_api_list_casesearch_pos (SCM weelist, SCM data)
{
int pos;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (!scm_is_string (weelist) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (scm_i_string_chars (weelist)),
scm_i_string_chars (data));
-
+
API_RETURN_INT(pos);
}
@@ -573,14 +573,14 @@ SCM
weechat_guile_api_list_get (SCM weelist, SCM position)
{
char *result;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (!scm_is_string (weelist) || !scm_is_integer (position))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (scm_i_string_chars (weelist)),
scm_to_int (position)));
-
+
API_RETURN_STRING(result);
}
@@ -594,10 +594,10 @@ weechat_guile_api_list_set (SCM item, SCM new_value)
API_FUNC(1, "list_set", API_RETURN_ERROR);
if (!scm_is_string (item) || !scm_is_string (new_value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_set (script_str2ptr (scm_i_string_chars (item)),
scm_i_string_chars (new_value));
-
+
API_RETURN_OK;
}
@@ -609,13 +609,13 @@ SCM
weechat_guile_api_list_next (SCM item)
{
char *result;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (!scm_is_string (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (scm_i_string_chars (item))));
-
+
API_RETURN_STRING(result);
}
@@ -627,13 +627,13 @@ SCM
weechat_guile_api_list_prev (SCM item)
{
char *result;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (!scm_is_string (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (scm_i_string_chars (item))));
-
+
API_RETURN_STRING(result);
}
@@ -645,13 +645,13 @@ SCM
weechat_guile_api_list_string (SCM item)
{
const char *result;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (!scm_is_string (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_list_string (script_str2ptr (scm_i_string_chars (item)));
-
+
API_RETURN_STRING(result);
}
@@ -663,13 +663,13 @@ SCM
weechat_guile_api_list_size (SCM weelist)
{
int size;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
if (!scm_is_string (weelist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
size = weechat_list_size (script_str2ptr (scm_i_string_chars (weelist)));
-
+
API_RETURN_INT(size);
}
@@ -683,10 +683,10 @@ weechat_guile_api_list_remove (SCM weelist, SCM item)
API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (!scm_is_string (weelist) || !scm_is_string (item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove (script_str2ptr (scm_i_string_chars (weelist)),
script_str2ptr (scm_i_string_chars (item)));
-
+
API_RETURN_OK;
}
@@ -700,9 +700,9 @@ weechat_guile_api_list_remove_all (SCM weelist)
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (!scm_is_string (weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove_all (script_str2ptr (scm_i_string_chars (weelist)));
-
+
API_RETURN_OK;
}
@@ -716,9 +716,9 @@ weechat_guile_api_list_free (SCM weelist)
API_FUNC(1, "list_free", API_RETURN_ERROR);
if (!scm_is_string (weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_free (script_str2ptr (scm_i_string_chars (weelist)));
-
+
API_RETURN_OK;
}
@@ -734,19 +734,19 @@ weechat_guile_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -756,10 +756,10 @@ weechat_guile_api_config_reload_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -772,19 +772,19 @@ weechat_guile_api_config_new (SCM name, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (!scm_is_string (name) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (name),
&weechat_guile_api_config_reload_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -802,9 +802,9 @@ weechat_guile_api_config_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -812,12 +812,12 @@ weechat_guile_api_config_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -829,10 +829,10 @@ weechat_guile_api_config_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -849,20 +849,20 @@ weechat_guile_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -872,10 +872,10 @@ weechat_guile_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -893,20 +893,20 @@ weechat_guile_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -916,10 +916,10 @@ weechat_guile_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -939,9 +939,9 @@ weechat_guile_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -949,12 +949,12 @@ weechat_guile_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -966,10 +966,10 @@ weechat_guile_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -988,21 +988,21 @@ weechat_guile_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1016,10 +1016,10 @@ weechat_guile_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1036,11 +1036,11 @@ weechat_guile_api_config_new_section (SCM args)
SCM data_create_option, function_delete_option, data_delete_option;
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 14))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = scm_list_ref (args, scm_from_int (0));
name = scm_list_ref (args, scm_from_int (1));
user_can_add_options = scm_list_ref (args, scm_from_int (2));
@@ -1064,7 +1064,7 @@ weechat_guile_api_config_new_section (SCM args)
|| !scm_is_string (function_create_option) || !scm_is_string (data_create_option)
|| !scm_is_string (function_delete_option) || !scm_is_string (data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (config_file)),
@@ -1086,7 +1086,7 @@ weechat_guile_api_config_new_section (SCM args)
&weechat_guile_api_config_section_delete_option_cb,
scm_i_string_chars (function_delete_option),
scm_i_string_chars (data_delete_option)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1099,14 +1099,14 @@ weechat_guile_api_config_search_section (SCM config_file, SCM section_name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (!scm_is_string (config_file) || !scm_is_string (section_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (scm_i_string_chars (config_file)),
scm_i_string_chars (section_name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1124,20 +1124,20 @@ weechat_guile_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1147,10 +1147,10 @@ weechat_guile_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1166,22 +1166,22 @@ weechat_guile_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1199,22 +1199,22 @@ weechat_guile_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1233,11 +1233,11 @@ weechat_guile_api_config_new_option (SCM args)
SCM data_delete;
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 17))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = scm_list_ref (args, scm_from_int (0));
section = scm_list_ref (args, scm_from_int (1));
name = scm_list_ref (args, scm_from_int (2));
@@ -1255,7 +1255,7 @@ weechat_guile_api_config_new_option (SCM args)
data_change = scm_list_ref (args, scm_from_int (14));
function_delete = scm_list_ref (args, scm_from_int (15));
data_delete = scm_list_ref (args, scm_from_int (16));
-
+
if (!scm_is_string (config_file) || !scm_is_string (section)
|| !scm_is_string (name) || !scm_is_string (type)
|| !scm_is_string (description) || !scm_is_string (string_values)
@@ -1267,7 +1267,7 @@ weechat_guile_api_config_new_option (SCM args)
|| !scm_is_string (function_change) || !scm_is_string (data_change)
|| !scm_is_string (function_delete) || !scm_is_string (data_delete))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (config_file)),
@@ -1290,7 +1290,7 @@ weechat_guile_api_config_new_option (SCM args)
&weechat_guile_api_config_option_delete_cb,
scm_i_string_chars (function_delete),
scm_i_string_chars (data_delete)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1305,16 +1305,16 @@ weechat_guile_api_config_search_option (SCM config_file, SCM section,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (!scm_is_string (config_file) || !scm_is_string (section)
|| !scm_is_string (option_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (scm_i_string_chars (config_file)),
script_str2ptr (scm_i_string_chars (section)),
scm_i_string_chars (option_name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1326,13 +1326,13 @@ SCM
weechat_guile_api_config_string_to_boolean (SCM text)
{
int value;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (!scm_is_string (text))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_string_to_boolean (scm_i_string_chars (text));
-
+
API_RETURN_INT(value);
}
@@ -1344,14 +1344,14 @@ SCM
weechat_guile_api_config_option_reset (SCM option, SCM run_callback)
{
int rc;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (!scm_is_string (option) || !scm_is_integer (run_callback))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_config_option_reset (script_str2ptr (scm_i_string_chars (option)),
scm_to_int (run_callback));
-
+
API_RETURN_INT(rc);
}
@@ -1364,16 +1364,16 @@ weechat_guile_api_config_option_set (SCM option, SCM new_value,
SCM run_callback)
{
int rc;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (!scm_is_string (option) || !scm_is_string (new_value)
|| !scm_is_integer (run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set (script_str2ptr (scm_i_string_chars (option)),
scm_i_string_chars (new_value),
scm_to_int (run_callback));
-
+
API_RETURN_INT(rc);
}
@@ -1386,14 +1386,14 @@ SCM
weechat_guile_api_config_option_set_null (SCM option, SCM run_callback)
{
int rc;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (!scm_is_string (option) || !scm_is_integer (run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set_null (script_str2ptr (scm_i_string_chars (option)),
scm_to_int (run_callback));
-
+
API_RETURN_INT(rc);
}
@@ -1405,13 +1405,13 @@ SCM
weechat_guile_api_config_option_unset (SCM option)
{
int rc;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = weechat_config_option_unset (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(rc);
}
@@ -1425,10 +1425,10 @@ weechat_guile_api_config_option_rename (SCM option, SCM new_name)
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (!scm_is_string (option) || !scm_is_string (new_name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_option_rename (script_str2ptr (scm_i_string_chars (option)),
scm_i_string_chars (new_name));
-
+
API_RETURN_OK;
}
@@ -1440,13 +1440,13 @@ SCM
weechat_guile_api_config_option_is_null (SCM option)
{
int value;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_is_null (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1459,13 +1459,13 @@ SCM
weechat_guile_api_config_option_default_is_null (SCM option)
{
int value;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_default_is_null (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1477,13 +1477,13 @@ SCM
weechat_guile_api_config_boolean (SCM option)
{
int value;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1495,13 +1495,13 @@ SCM
weechat_guile_api_config_boolean_default (SCM option)
{
int value;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean_default (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1513,13 +1513,13 @@ SCM
weechat_guile_api_config_integer (SCM option)
{
int value;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1531,13 +1531,13 @@ SCM
weechat_guile_api_config_integer_default (SCM option)
{
int value;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer_default (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_INT(value);
}
@@ -1549,13 +1549,13 @@ SCM
weechat_guile_api_config_string (SCM option)
{
const char *result;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_STRING(result);
}
@@ -1567,13 +1567,13 @@ SCM
weechat_guile_api_config_string_default (SCM option)
{
const char *result;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string_default (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_STRING(result);
}
@@ -1585,13 +1585,13 @@ SCM
weechat_guile_api_config_color (SCM option)
{
const char *result;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_STRING(result);
}
@@ -1603,13 +1603,13 @@ SCM
weechat_guile_api_config_color_default (SCM option)
{
const char *result;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color_default (script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_STRING(result);
}
@@ -1623,10 +1623,10 @@ weechat_guile_api_config_write_option (SCM config_file, SCM option)
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (!scm_is_string (config_file) || !scm_is_string (option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_option (script_str2ptr (scm_i_string_chars (config_file)),
script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_OK;
}
@@ -1641,12 +1641,12 @@ weechat_guile_api_config_write_line (SCM config_file,
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (!scm_is_string (config_file) || !scm_is_string (option_name) || !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_line (script_str2ptr (scm_i_string_chars (config_file)),
scm_i_string_chars (option_name),
"%s",
scm_i_string_chars (value));
-
+
API_RETURN_OK;
}
@@ -1658,13 +1658,13 @@ SCM
weechat_guile_api_config_write (SCM config_file)
{
int rc;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (!scm_is_string (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_write (script_str2ptr (scm_i_string_chars (config_file)));
-
+
API_RETURN_INT(rc);
}
@@ -1676,13 +1676,13 @@ SCM
weechat_guile_api_config_read (SCM config_file)
{
int rc;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (!scm_is_string (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_read (script_str2ptr (scm_i_string_chars (config_file)));
-
+
API_RETURN_INT(rc);
}
@@ -1694,13 +1694,13 @@ SCM
weechat_guile_api_config_reload (SCM config_file)
{
int rc;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (!scm_is_string (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_reload (script_str2ptr (scm_i_string_chars (config_file)));
-
+
API_RETURN_INT(rc);
}
@@ -1714,11 +1714,11 @@ weechat_guile_api_config_option_free (SCM option)
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_option_free (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (option)));
-
+
API_RETURN_OK;
}
@@ -1733,11 +1733,11 @@ weechat_guile_api_config_section_free_options (SCM section)
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (!scm_is_string (section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free_options (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (section)));
-
+
API_RETURN_OK;
}
@@ -1751,11 +1751,11 @@ weechat_guile_api_config_section_free (SCM section)
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (!scm_is_string (section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (section)));
-
+
API_RETURN_OK;
}
@@ -1769,11 +1769,11 @@ weechat_guile_api_config_free (SCM config_file)
API_FUNC(1, "config_free", API_RETURN_ERROR);
if (!scm_is_string (config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_free (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (config_file)));
-
+
API_RETURN_OK;
}
@@ -1786,13 +1786,13 @@ weechat_guile_api_config_get (SCM option)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_get (scm_i_string_chars (option)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1804,15 +1804,15 @@ SCM
weechat_guile_api_config_get_plugin (SCM option)
{
const char *result;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_api_config_get_plugin (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option));
-
+
API_RETURN_STRING(result);
}
@@ -1824,15 +1824,15 @@ SCM
weechat_guile_api_config_is_set_plugin (SCM option)
{
int rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = script_api_config_is_set_plugin (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option));
-
+
API_RETURN_INT(rc);
}
@@ -1844,16 +1844,16 @@ SCM
weechat_guile_api_config_set_plugin (SCM option, SCM value)
{
int rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (!scm_is_string (option) || !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = script_api_config_set_plugin (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option),
scm_i_string_chars (value));
-
+
API_RETURN_INT(rc);
}
@@ -1867,12 +1867,12 @@ weechat_guile_api_config_set_desc_plugin (SCM option, SCM description)
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (!scm_is_string (option) || !scm_is_string (description))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_set_desc_plugin (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option),
scm_i_string_chars (description));
-
+
API_RETURN_OK;
}
@@ -1884,15 +1884,15 @@ SCM
weechat_guile_api_config_unset_plugin (SCM option)
{
int rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = script_api_config_unset_plugin (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option));
-
+
API_RETURN_INT(rc);
}
@@ -1905,19 +1905,19 @@ weechat_guile_api_key_bind (SCM context, SCM keys)
{
struct t_hashtable *c_keys;
int num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (!scm_is_string (context) || !scm_list_p (keys))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
c_keys = weechat_guile_alist_to_hashtable (keys,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (scm_i_string_chars (context), c_keys);
-
+
if (c_keys)
weechat_hashtable_free (c_keys);
-
+
API_RETURN_INT(num_keys);
}
@@ -1929,14 +1929,14 @@ SCM
weechat_guile_api_key_unbind (SCM context, SCM key)
{
int num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (!scm_is_string (context) || !scm_is_string (key))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
num_keys = weechat_key_unbind (scm_i_string_chars (context),
scm_i_string_chars (key));
-
+
API_RETURN_INT(num_keys);
}
@@ -1948,13 +1948,13 @@ SCM
weechat_guile_api_prefix (SCM prefix)
{
const char *result;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (!scm_is_string (prefix))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_prefix (scm_i_string_chars (prefix));
-
+
API_RETURN_STRING(result);
}
@@ -1966,13 +1966,13 @@ SCM
weechat_guile_api_color (SCM color)
{
const char *result;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
if (!scm_is_string (color))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_color (scm_i_string_chars (color));
-
+
API_RETURN_STRING(result);
}
@@ -1986,12 +1986,12 @@ weechat_guile_api_print (SCM buffer, SCM message)
API_FUNC(0, "print", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)),
"%s", scm_i_string_chars (message));
-
+
API_RETURN_OK;
}
@@ -2007,14 +2007,14 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
if (!scm_is_string (buffer) || !scm_is_integer (date)
|| !scm_is_string (tags) || !scm_is_string (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_date_tags (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)),
scm_to_int (date),
scm_i_string_chars (tags),
"%s", scm_i_string_chars (message));
-
+
API_RETURN_OK;
}
@@ -2029,13 +2029,13 @@ weechat_guile_api_print_y (SCM buffer, SCM y, SCM message)
if (!scm_is_string (buffer) || !scm_is_integer (y)
|| !scm_is_string (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_y (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)),
scm_to_int (y),
"%s", scm_i_string_chars (message));
-
+
API_RETURN_OK;
}
@@ -2049,11 +2049,11 @@ weechat_guile_api_log_print (SCM message)
API_FUNC(1, "log_print", API_RETURN_ERROR);
if (!scm_is_string (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_log_printf (weechat_guile_plugin,
guile_current_script,
"%s", scm_i_string_chars (message));
-
+
API_RETURN_OK;
}
@@ -2069,23 +2069,23 @@ weechat_guile_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2095,10 +2095,10 @@ weechat_guile_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2113,14 +2113,14 @@ weechat_guile_api_hook_command (SCM command, SCM description, SCM args,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (!scm_is_string (command) || !scm_is_string (description)
|| !scm_is_string (args) || !scm_is_string (args_description)
|| !scm_is_string (completion) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
result = script_ptr2str (script_api_hook_command (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (command),
@@ -2131,7 +2131,7 @@ weechat_guile_api_hook_command (SCM command, SCM description, SCM args,
&weechat_guile_api_hook_command_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2147,20 +2147,20 @@ weechat_guile_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2170,10 +2170,10 @@ weechat_guile_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2186,19 +2186,19 @@ weechat_guile_api_hook_command_run (SCM command, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (!scm_is_string (command) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (command),
&weechat_guile_api_hook_command_run_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2213,22 +2213,22 @@ weechat_guile_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2236,10 +2236,10 @@ weechat_guile_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2253,13 +2253,13 @@ weechat_guile_api_hook_timer (SCM interval, SCM align_second, SCM max_calls,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (!scm_is_integer (interval) || !scm_is_integer (align_second)
|| !scm_is_integer (max_calls) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_guile_plugin,
guile_current_script,
scm_to_int (interval),
@@ -2268,7 +2268,7 @@ weechat_guile_api_hook_timer (SCM interval, SCM align_second, SCM max_calls,
&weechat_guile_api_hook_timer_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2283,21 +2283,21 @@ weechat_guile_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2305,10 +2305,10 @@ weechat_guile_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2322,13 +2322,13 @@ weechat_guile_api_hook_fd (SCM fd, SCM read, SCM write, SCM exception,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (!scm_is_integer (fd) || !scm_is_integer (read)
|| !scm_is_integer (write) || !scm_is_integer (exception)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_guile_plugin,
guile_current_script,
scm_to_int (fd),
@@ -2338,7 +2338,7 @@ weechat_guile_api_hook_fd (SCM fd, SCM read, SCM write, SCM exception,
&weechat_guile_api_hook_fd_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2355,24 +2355,24 @@ weechat_guile_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2380,10 +2380,10 @@ weechat_guile_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2397,12 +2397,12 @@ weechat_guile_api_hook_process (SCM command, SCM timeout, SCM function,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (!scm_is_string (command) || !scm_is_integer (timeout)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_process (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (command),
@@ -2410,7 +2410,7 @@ weechat_guile_api_hook_process (SCM command, SCM timeout, SCM function,
&weechat_guile_api_hook_process_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2427,25 +2427,25 @@ weechat_guile_api_hook_connect_cb (void *data, int status, int gnutls_rc,
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2453,10 +2453,10 @@ weechat_guile_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2471,14 +2471,14 @@ weechat_guile_api_hook_connect (SCM proxy, SCM address, SCM port, SCM sock,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (!scm_is_string (proxy) || !scm_is_string (address)
|| !scm_is_integer (port) || !scm_is_integer (sock)
|| !scm_is_integer (ipv6) || !scm_is_string (local_hostname)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (proxy),
@@ -2494,7 +2494,7 @@ weechat_guile_api_hook_connect (SCM proxy, SCM address, SCM port, SCM sock,
&weechat_guile_api_hook_connect_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2514,16 +2514,16 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -2534,12 +2534,12 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2555,10 +2555,10 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2572,13 +2572,13 @@ weechat_guile_api_hook_print (SCM buffer, SCM tags, SCM message,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (tags)
|| !scm_is_string (message) || !scm_is_integer (strip_colors)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_print (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)),
@@ -2588,7 +2588,7 @@ weechat_guile_api_hook_print (SCM buffer, SCM tags, SCM message,
&weechat_guile_api_hook_print_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2605,9 +2605,9 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal,
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -2630,12 +2630,12 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal,
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2645,10 +2645,10 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal,
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2661,18 +2661,18 @@ weechat_guile_api_hook_signal (SCM signal, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (!scm_is_string (signal) || !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (signal),
&weechat_guile_api_hook_signal_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2685,11 +2685,11 @@ weechat_guile_api_hook_signal_send (SCM signal, SCM type_data,
SCM signal_data)
{
int number;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (!scm_is_string (signal) || !scm_is_string (type_data))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (strcmp (scm_i_string_chars (type_data), WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (!scm_is_string (signal_data))
@@ -2718,7 +2718,7 @@ weechat_guile_api_hook_signal_send (SCM signal, SCM type_data,
script_str2ptr (scm_i_string_chars (signal_data)));
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -2734,20 +2734,20 @@ weechat_guile_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssh", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2755,10 +2755,10 @@ weechat_guile_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2771,19 +2771,19 @@ weechat_guile_api_hook_hsignal (SCM signal, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (!scm_is_string (signal) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (signal),
&weechat_guile_api_hook_hsignal_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2795,19 +2795,19 @@ SCM
weechat_guile_api_hook_hsignal_send (SCM signal, SCM hashtable)
{
struct t_hashtable *c_hashtable;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (!scm_is_string (signal) || !scm_list_p (hashtable))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
c_hashtable = weechat_guile_alist_to_hashtable (hashtable,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (scm_i_string_chars (signal), c_hashtable);
-
+
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
-
+
API_RETURN_OK;
}
@@ -2822,20 +2822,20 @@ weechat_guile_api_hook_config_cb (void *data, const char *option, const char *va
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2843,10 +2843,10 @@ weechat_guile_api_hook_config_cb (void *data, const char *option, const char *va
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2859,19 +2859,19 @@ weechat_guile_api_hook_config (SCM option, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (!scm_is_string (option) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_config (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (option),
&weechat_guile_api_hook_config_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2888,7 +2888,7 @@ weechat_guile_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2897,12 +2897,12 @@ weechat_guile_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2914,10 +2914,10 @@ weechat_guile_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2931,12 +2931,12 @@ weechat_guile_api_hook_completion (SCM completion, SCM description,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (!scm_is_string (completion) || !scm_is_string (description)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (completion),
@@ -2944,7 +2944,7 @@ weechat_guile_api_hook_completion (SCM completion, SCM description,
&weechat_guile_api_hook_completion_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2960,12 +2960,12 @@ weechat_guile_api_hook_completion_list_add (SCM completion, SCM word,
if (!scm_is_string (completion) || !scm_is_string (word)
|| !scm_is_integer (nick_completion) || !scm_is_string (where))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_hook_completion_list_add (script_str2ptr (scm_i_string_chars (completion)),
scm_i_string_chars (word),
scm_to_int (nick_completion),
scm_i_string_chars (where));
-
+
API_RETURN_OK;
}
@@ -2980,7 +2980,7 @@ weechat_guile_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2989,13 +2989,13 @@ weechat_guile_api_hook_modifier_cb (void *data, const char *modifier,
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3008,19 +3008,19 @@ weechat_guile_api_hook_modifier (SCM modifier, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (!scm_is_string (modifier) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (modifier),
&weechat_guile_api_hook_modifier_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3034,16 +3034,16 @@ weechat_guile_api_hook_modifier_exec (SCM modifier, SCM modifier_data,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (!scm_is_string (modifier) || !scm_is_string (modifier_data)
|| !scm_is_string (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hook_modifier_exec (scm_i_string_chars (modifier),
scm_i_string_chars (modifier_data),
scm_i_string_chars (string));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3058,21 +3058,21 @@ weechat_guile_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3086,13 +3086,13 @@ weechat_guile_api_hook_info (SCM info_name, SCM description,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (!scm_is_string (info_name) || !scm_is_string (description)
|| !scm_is_string (args_description) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (info_name),
@@ -3101,7 +3101,7 @@ weechat_guile_api_hook_info (SCM info_name, SCM description,
&weechat_guile_api_hook_info_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3116,21 +3116,21 @@ weechat_guile_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
-
+
return (struct t_hashtable *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssh", func_argv);
}
-
+
return NULL;
}
@@ -3146,13 +3146,13 @@ weechat_guile_api_hook_info_hashtable (SCM info_name, SCM description,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (!scm_is_string (info_name) || !scm_is_string (description)
|| !scm_is_string (args_description) || !scm_is_string (output_description)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (info_name),
@@ -3162,7 +3162,7 @@ weechat_guile_api_hook_info_hashtable (SCM info_name, SCM description,
&weechat_guile_api_hook_info_hashtable_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3178,27 +3178,27 @@ weechat_guile_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3213,13 +3213,13 @@ weechat_guile_api_hook_infolist (SCM infolist_name, SCM description,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (!scm_is_string (infolist_name) || !scm_is_string (description)
|| !scm_is_string (pointer_description) || !scm_is_string (args_description)
|| !scm_is_string (function) || !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (infolist_name),
@@ -3229,7 +3229,7 @@ weechat_guile_api_hook_infolist (SCM infolist_name, SCM description,
&weechat_guile_api_hook_infolist_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3243,20 +3243,20 @@ weechat_guile_api_hook_focus_cb (void *data, struct t_hashtable *info)
struct t_script_callback *script_callback;
void *func_argv[2];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = info;
-
+
return (struct t_hashtable *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", func_argv);
}
-
+
return NULL;
}
@@ -3269,19 +3269,19 @@ weechat_guile_api_hook_focus (SCM area, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (!scm_is_string (area) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (area),
&weechat_guile_api_hook_focus_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3295,11 +3295,11 @@ weechat_guile_api_unhook (SCM hook)
API_FUNC(1, "unhook", API_RETURN_ERROR);
if (!scm_is_string (hook))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_unhook (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (hook)));
-
+
API_RETURN_OK;
}
@@ -3311,9 +3311,9 @@ SCM
weechat_guile_api_unhook_all ()
{
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (guile_current_script);
-
+
API_RETURN_OK;
}
@@ -3329,20 +3329,20 @@ weechat_guile_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3352,10 +3352,10 @@ weechat_guile_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3370,19 +3370,19 @@ weechat_guile_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3392,10 +3392,10 @@ weechat_guile_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3409,13 +3409,13 @@ weechat_guile_api_buffer_new (SCM name, SCM function_input, SCM data_input,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (!scm_is_string (name) || !scm_is_string (function_input)
|| !scm_is_string (data_input) || !scm_is_string (function_close)
|| !scm_is_string (data_close))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (name),
@@ -3425,7 +3425,7 @@ weechat_guile_api_buffer_new (SCM name, SCM function_input, SCM data_input,
&weechat_guile_api_buffer_close_cb,
scm_i_string_chars (function_close),
scm_i_string_chars (data_close)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3438,14 +3438,14 @@ weechat_guile_api_buffer_search (SCM plugin, SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (!scm_is_string (plugin) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search (scm_i_string_chars (plugin),
scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3458,11 +3458,11 @@ weechat_guile_api_buffer_search_main ()
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3475,11 +3475,11 @@ weechat_guile_api_current_buffer ()
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3493,9 +3493,9 @@ weechat_guile_api_buffer_clear (SCM buffer)
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (!scm_is_string (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_clear (script_str2ptr (scm_i_string_chars (buffer)));
-
+
API_RETURN_OK;
}
@@ -3509,11 +3509,11 @@ weechat_guile_api_buffer_close (SCM buffer)
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (!scm_is_string (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_buffer_close (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)));
-
+
API_RETURN_OK;
}
@@ -3527,10 +3527,10 @@ weechat_guile_api_buffer_merge (SCM buffer, SCM target_buffer)
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (target_buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_merge (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (target_buffer)));
-
+
API_RETURN_OK;
}
@@ -3545,10 +3545,10 @@ weechat_guile_api_buffer_unmerge (SCM buffer, SCM number)
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_integer (number))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_unmerge (script_str2ptr (scm_i_string_chars (buffer)),
scm_to_int (number));
-
+
API_RETURN_OK;
}
@@ -3560,14 +3560,14 @@ SCM
weechat_guile_api_buffer_get_integer (SCM buffer, SCM property)
{
int value;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (!scm_is_string (buffer) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_buffer_get_integer (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (property));
-
+
API_RETURN_INT(value);
}
@@ -3579,14 +3579,14 @@ SCM
weechat_guile_api_buffer_get_string (SCM buffer, SCM property)
{
const char *result;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_buffer_get_string (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (property));
-
+
API_RETURN_STRING(result);
}
@@ -3599,14 +3599,14 @@ weechat_guile_api_buffer_get_pointer (SCM buffer, SCM property)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (property)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3621,11 +3621,11 @@ weechat_guile_api_buffer_set (SCM buffer, SCM property, SCM value)
if (!scm_is_string (buffer) || !scm_is_string (property)
|| !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_set (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (property),
scm_i_string_chars (value));
-
+
API_RETURN_OK;
}
@@ -3640,14 +3640,14 @@ weechat_guile_api_buffer_string_replace_local_var (SCM buffer, SCM string)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (string))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (string));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3659,14 +3659,14 @@ SCM
weechat_guile_api_buffer_match_list (SCM buffer, SCM string)
{
int value;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (!scm_is_string (buffer) || !scm_is_string (string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_buffer_match_list (script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (string));
-
+
API_RETURN_INT(value);
}
@@ -3679,11 +3679,11 @@ weechat_guile_api_current_window ()
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3697,13 +3697,13 @@ weechat_guile_api_window_search_with_buffer (SCM buffer)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (!scm_is_string (buffer))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (scm_i_string_chars (buffer))));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3715,14 +3715,14 @@ SCM
weechat_guile_api_window_get_integer (SCM window, SCM property)
{
int value;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (!scm_is_string (window) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_window_get_integer (script_str2ptr (scm_i_string_chars (window)),
scm_i_string_chars (property));
-
+
API_RETURN_INT(value);
}
@@ -3734,14 +3734,14 @@ SCM
weechat_guile_api_window_get_string (SCM window, SCM property)
{
const char *result;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (!scm_is_string (window) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_window_get_string (script_str2ptr (scm_i_string_chars (window)),
scm_i_string_chars (property));
-
+
API_RETURN_STRING(result);
}
@@ -3754,14 +3754,14 @@ weechat_guile_api_window_get_pointer (SCM window, SCM property)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (!scm_is_string (window) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (scm_i_string_chars (window)),
scm_i_string_chars (property)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3775,9 +3775,9 @@ weechat_guile_api_window_set_title (SCM title)
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (!scm_is_string (title))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_window_set_title (scm_i_string_chars (title));
-
+
API_RETURN_OK;
}
@@ -3791,19 +3791,19 @@ weechat_guile_api_nicklist_add_group (SCM buffer, SCM parent_group, SCM name,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (parent_group)
|| !scm_is_string (name) || !scm_is_string (color)
|| !scm_is_integer (visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (parent_group)),
scm_i_string_chars (name),
scm_i_string_chars (color),
scm_to_int (visible)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3816,16 +3816,16 @@ weechat_guile_api_nicklist_search_group (SCM buffer, SCM from_group, SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (from_group)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (from_group)),
scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3840,14 +3840,14 @@ weechat_guile_api_nicklist_add_nick (SCM buffer, SCM group, SCM name,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (group)
|| !scm_is_string (name) || !scm_is_string (color)
|| !scm_is_string (prefix) || !scm_is_string (prefix_color)
|| !scm_is_integer (visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)),
scm_i_string_chars (name),
@@ -3855,7 +3855,7 @@ weechat_guile_api_nicklist_add_nick (SCM buffer, SCM group, SCM name,
scm_i_string_chars (prefix),
scm_i_string_chars (prefix_color),
scm_to_int (visible)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3868,16 +3868,16 @@ weechat_guile_api_nicklist_search_nick (SCM buffer, SCM from_group, SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (from_group)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (from_group)),
scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3891,10 +3891,10 @@ weechat_guile_api_nicklist_remove_group (SCM buffer, SCM group)
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (group))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_group (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)));
-
+
API_RETURN_OK;
}
@@ -3908,10 +3908,10 @@ weechat_guile_api_nicklist_remove_nick (SCM buffer, SCM nick)
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (nick))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_nick (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (nick)));
-
+
API_RETURN_OK;
}
@@ -3925,9 +3925,9 @@ weechat_guile_api_nicklist_remove_all (SCM buffer)
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (!scm_is_string (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_all (script_str2ptr (scm_i_string_chars (buffer)));
-
+
API_RETURN_OK;
}
@@ -3940,16 +3940,16 @@ weechat_guile_api_nicklist_group_get_integer (SCM buffer, SCM group,
SCM property)
{
int value;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (!scm_is_string (buffer) || !scm_is_string (group)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)),
scm_i_string_chars (property));
-
+
API_RETURN_INT(value);
}
@@ -3962,16 +3962,16 @@ weechat_guile_api_nicklist_group_get_string (SCM buffer, SCM group,
SCM property)
{
const char *result;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (group)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)),
scm_i_string_chars (property));
-
+
API_RETURN_STRING(result);
}
@@ -3985,16 +3985,16 @@ weechat_guile_api_nicklist_group_get_pointer (SCM buffer, SCM group,
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (group)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)),
scm_i_string_chars (property)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4009,12 +4009,12 @@ weechat_guile_api_nicklist_group_set (SCM buffer, SCM group, SCM property,
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (group) || !scm_is_string (property) || !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_group_set (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (group)),
scm_i_string_chars (property),
scm_i_string_chars (value));
-
+
API_RETURN_OK;
}
@@ -4026,16 +4026,16 @@ SCM
weechat_guile_api_nicklist_nick_get_integer (SCM buffer, SCM nick, SCM property)
{
int value;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (!scm_is_string (buffer) || !scm_is_string (nick)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (nick)),
scm_i_string_chars (property));
-
+
API_RETURN_INT(value);
}
@@ -4047,16 +4047,16 @@ SCM
weechat_guile_api_nicklist_nick_get_string (SCM buffer, SCM nick, SCM property)
{
const char *result;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (nick)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (nick)),
scm_i_string_chars (property));
-
+
API_RETURN_STRING(result);
}
@@ -4069,16 +4069,16 @@ weechat_guile_api_nicklist_nick_get_pointer (SCM buffer, SCM nick, SCM property)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (!scm_is_string (buffer) || !scm_is_string (nick)
|| !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (nick)),
scm_i_string_chars (property)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4094,12 +4094,12 @@ weechat_guile_api_nicklist_nick_set (SCM buffer, SCM nick, SCM property,
if (!scm_is_string (buffer) || !scm_is_string (nick)
|| !scm_is_string (property) || !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_nick_set (script_str2ptr (scm_i_string_chars (buffer)),
script_str2ptr (scm_i_string_chars (nick)),
scm_i_string_chars (property),
scm_i_string_chars (value));
-
+
API_RETURN_OK;
}
@@ -4112,13 +4112,13 @@ weechat_guile_api_bar_item_search (SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (!scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_item_search (scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4133,7 +4133,7 @@ weechat_guile_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4141,20 +4141,20 @@ weechat_guile_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4167,19 +4167,19 @@ weechat_guile_api_bar_item_new (SCM name, SCM function, SCM data)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (!scm_is_string (name) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_guile_plugin,
guile_current_script,
scm_i_string_chars (name),
&weechat_guile_api_bar_item_build_cb,
scm_i_string_chars (function),
scm_i_string_chars (data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4193,9 +4193,9 @@ weechat_guile_api_bar_item_update (SCM name)
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (!scm_is_string (name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_item_update (scm_i_string_chars (name));
-
+
API_RETURN_OK;
}
@@ -4209,11 +4209,11 @@ weechat_guile_api_bar_item_remove (SCM item)
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (!scm_is_string (item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_bar_item_remove (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (item)));
-
+
API_RETURN_OK;
}
@@ -4226,13 +4226,13 @@ weechat_guile_api_bar_search (SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (!scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_search (scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4248,11 +4248,11 @@ weechat_guile_api_bar_new (SCM args)
SCM separator, items;
char *result;
SCM return_value;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (!scm_list_p (args) || (scm_to_int (scm_length (args)) != 15))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = scm_list_ref (args, scm_from_int (0));
hidden = scm_list_ref (args, scm_from_int (1));
priority = scm_list_ref (args, scm_from_int (2));
@@ -4268,7 +4268,7 @@ weechat_guile_api_bar_new (SCM args)
color_bg = scm_list_ref (args, scm_from_int (12));
separator = scm_list_ref (args, scm_from_int (13));
items = scm_list_ref (args, scm_from_int (14));
-
+
if (!scm_is_string (name) || !scm_is_string (hidden)
|| !scm_is_string (priority) || !scm_is_string (type)
|| !scm_is_string (conditions) || !scm_is_string (position)
@@ -4278,7 +4278,7 @@ weechat_guile_api_bar_new (SCM args)
|| !scm_is_string (color_bg) || !scm_is_string (separator)
|| !scm_is_string (items))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_new (scm_i_string_chars (name),
scm_i_string_chars (hidden),
scm_i_string_chars (priority),
@@ -4294,7 +4294,7 @@ weechat_guile_api_bar_new (SCM args)
scm_i_string_chars (color_bg),
scm_i_string_chars (separator),
scm_i_string_chars (items)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4309,11 +4309,11 @@ weechat_guile_api_bar_set (SCM bar, SCM property, SCM value)
if (!scm_is_string (bar) || !scm_is_string (property)
|| !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_set (script_str2ptr (scm_i_string_chars (bar)),
scm_i_string_chars (property),
scm_i_string_chars (value));
-
+
API_RETURN_OK;
}
@@ -4327,9 +4327,9 @@ weechat_guile_api_bar_update (SCM name)
API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (!scm_is_string (name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_update (scm_i_string_chars (name));
-
+
API_RETURN_OK;
}
@@ -4343,9 +4343,9 @@ weechat_guile_api_bar_remove (SCM bar)
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (!scm_is_string (bar))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_remove (script_str2ptr (scm_i_string_chars (bar)));
-
+
API_RETURN_OK;
}
@@ -4359,12 +4359,12 @@ weechat_guile_api_command (SCM buffer, SCM command)
API_FUNC(1, "command", API_RETURN_ERROR);
if (!scm_is_string (buffer) || !scm_is_string (command))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_command (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (buffer)),
scm_i_string_chars (command));
-
+
API_RETURN_OK;
}
@@ -4376,14 +4376,14 @@ SCM
weechat_guile_api_info_get (SCM info_name, SCM arguments)
{
const char *result;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (!scm_is_string (info_name) || !scm_is_string (arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_info_get (scm_i_string_chars (info_name),
scm_i_string_chars (arguments));
-
+
API_RETURN_STRING(result);
}
@@ -4396,23 +4396,23 @@ weechat_guile_api_info_get_hashtable (SCM info_name, SCM hash)
{
struct t_hashtable *c_hashtable, *result_hashtable;
SCM result_hash;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (!scm_is_string (info_name) || !scm_list_p (hash))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
c_hashtable = weechat_guile_alist_to_hashtable (hash,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (scm_i_string_chars (info_name),
c_hashtable);
result_hash = weechat_guile_hashtable_to_alist (result_hashtable);
-
+
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
return result_hash;
}
@@ -4425,11 +4425,11 @@ weechat_guile_api_infolist_new ()
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4442,13 +4442,13 @@ weechat_guile_api_infolist_new_item (SCM infolist)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (scm_i_string_chars (infolist))));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4462,16 +4462,16 @@ weechat_guile_api_infolist_new_var_integer (SCM infolist, SCM name, SCM value)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (name)
|| !scm_is_integer (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (name),
scm_to_int (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4485,16 +4485,16 @@ weechat_guile_api_infolist_new_var_string (SCM infolist, SCM name, SCM value)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (name)
|| !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (name),
scm_i_string_chars (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4508,16 +4508,16 @@ weechat_guile_api_infolist_new_var_pointer (SCM infolist, SCM name, SCM value)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (name)
|| !scm_is_string (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (name),
script_str2ptr (scm_i_string_chars (value))));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4530,16 +4530,16 @@ weechat_guile_api_infolist_new_var_time (SCM infolist, SCM name, SCM value)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (name)
|| !scm_is_integer (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (name),
scm_to_int (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4552,16 +4552,16 @@ weechat_guile_api_infolist_get (SCM name, SCM pointer, SCM arguments)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (!scm_is_string (name) || !scm_is_string (pointer)
|| !scm_is_string (arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_get (scm_i_string_chars (name),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (arguments)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4573,13 +4573,13 @@ SCM
weechat_guile_api_infolist_next (SCM infolist)
{
int value;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_next (script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_INT(value);
}
@@ -4592,13 +4592,13 @@ SCM
weechat_guile_api_infolist_prev (SCM infolist)
{
int value;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_prev (script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_INT(value);
}
@@ -4613,9 +4613,9 @@ weechat_guile_api_infolist_reset_item_cursor (SCM infolist)
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_OK;
}
@@ -4627,13 +4627,13 @@ SCM
weechat_guile_api_infolist_fields (SCM infolist)
{
const char *result;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_fields (script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_STRING(result);
}
@@ -4646,14 +4646,14 @@ SCM
weechat_guile_api_infolist_integer (SCM infolist, SCM variable)
{
int value;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (!scm_is_string (infolist) || !scm_is_string (variable))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_integer (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (variable));
-
+
API_RETURN_INT(value);
}
@@ -4665,14 +4665,14 @@ SCM
weechat_guile_api_infolist_string (SCM infolist, SCM variable)
{
const char *result;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_string (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (variable));
-
+
API_RETURN_STRING(result);
}
@@ -4686,14 +4686,14 @@ weechat_guile_api_infolist_pointer (SCM infolist, SCM variable)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (variable)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4707,16 +4707,16 @@ weechat_guile_api_infolist_time (SCM infolist, SCM variable)
char timebuffer[64], *result;
time_t time;
SCM return_value;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (!scm_is_string (infolist) || !scm_is_string (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_infolist_time (script_str2ptr (scm_i_string_chars (infolist)),
scm_i_string_chars (variable));
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4730,9 +4730,9 @@ weechat_guile_api_infolist_free (SCM infolist)
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (!scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_free (script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_OK;
}
@@ -4745,13 +4745,13 @@ weechat_guile_api_hdata_get (SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (!scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get (scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4763,14 +4763,14 @@ SCM
weechat_guile_api_hdata_get_var_offset (SCM hdata, SCM name)
{
int value;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (!scm_is_string (hdata) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (scm_i_string_chars (hdata)),
scm_i_string_chars (name));
-
+
API_RETURN_INT(value);
}
@@ -4783,14 +4783,14 @@ SCM
weechat_guile_api_hdata_get_var_type_string (SCM hdata, SCM name)
{
const char *result;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (scm_i_string_chars (hdata)),
scm_i_string_chars (name));
-
+
API_RETURN_STRING(result);
}
@@ -4802,14 +4802,14 @@ SCM
weechat_guile_api_hdata_get_var_hdata (SCM hdata, SCM name)
{
const char *result;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (scm_i_string_chars (hdata)),
scm_i_string_chars (name));
-
+
API_RETURN_STRING(result);
}
@@ -4822,14 +4822,14 @@ weechat_guile_api_hdata_get_list (SCM hdata, SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (scm_i_string_chars (hdata)),
scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4842,16 +4842,16 @@ weechat_guile_api_hdata_move (SCM hdata, SCM pointer, SCM count)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (pointer)
|| !scm_is_integer (count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_move (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_to_int (count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4864,16 +4864,16 @@ SCM
weechat_guile_api_hdata_integer (SCM hdata, SCM pointer, SCM name)
{
int value;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (!scm_is_string (hdata) || !scm_is_string (pointer)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_integer (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (name));
-
+
API_RETURN_INT(value);
}
@@ -4886,16 +4886,16 @@ SCM
weechat_guile_api_hdata_long (SCM hdata, SCM pointer, SCM name)
{
long value;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (!scm_is_string (hdata) || !scm_is_string (pointer)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
value = weechat_hdata_long (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (name));
-
+
API_RETURN_LONG(value);
}
@@ -4908,16 +4908,16 @@ SCM
weechat_guile_api_hdata_string (SCM hdata, SCM pointer, SCM name)
{
const char *result;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (pointer)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_string (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (name));
-
+
API_RETURN_STRING(result);
}
@@ -4931,16 +4931,16 @@ weechat_guile_api_hdata_pointer (SCM hdata, SCM pointer, SCM name)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (pointer)
|| !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (name)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4955,17 +4955,17 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
char timebuffer[64], *result;
time_t time;
SCM return_value;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_is_string (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_hdata_time (script_str2ptr (scm_i_string_chars (hdata)),
script_str2ptr (scm_i_string_chars (pointer)),
scm_i_string_chars (name));
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4977,14 +4977,14 @@ SCM
weechat_guile_api_hdata_get_string (SCM hdata, SCM property)
{
const char *result;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (!scm_is_string (hdata) || !scm_is_string (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (scm_i_string_chars (hdata)),
scm_i_string_chars (property));
-
+
API_RETURN_STRING(result);
}
@@ -4997,14 +4997,14 @@ weechat_guile_api_upgrade_new (SCM filename, SCM write)
{
char *result;
SCM return_value;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (!scm_is_string (filename) || !scm_is_integer (write))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_upgrade_new (scm_i_string_chars (filename),
scm_to_int (write)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5017,16 +5017,16 @@ weechat_guile_api_upgrade_write_object (SCM upgrade_file, SCM object_id,
SCM infolist)
{
int rc;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (!scm_is_string (upgrade_file) || !scm_is_integer (object_id)
|| !scm_is_string (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_upgrade_write_object (script_str2ptr (scm_i_string_chars (upgrade_file)),
scm_to_int (object_id),
script_str2ptr (scm_i_string_chars (infolist)));
-
+
API_RETURN_INT(rc);
}
@@ -5045,23 +5045,23 @@ weechat_guile_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5073,10 +5073,10 @@ weechat_guile_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -5088,19 +5088,19 @@ SCM
weechat_guile_api_upgrade_read (SCM upgrade_file, SCM function, SCM data)
{
int rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
if (!scm_is_string (upgrade_file) || !scm_is_string (function)
|| !scm_is_string (data))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = script_api_upgrade_read (weechat_guile_plugin,
guile_current_script,
script_str2ptr (scm_i_string_chars (upgrade_file)),
&weechat_guile_api_upgrade_read_cb,
scm_i_string_chars (function),
scm_i_string_chars (data));
-
+
API_RETURN_INT(rc);
}
@@ -5114,9 +5114,9 @@ weechat_guile_api_upgrade_close (SCM upgrade_file)
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (!scm_is_string (upgrade_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_upgrade_close (script_str2ptr (scm_i_string_chars (upgrade_file)));
-
+
API_RETURN_OK;
}
@@ -5129,7 +5129,7 @@ weechat_guile_api_module_init (void *data)
{
scm_t_bits port_type;
scm_t_port *pt;
-
+
/* make C compiler happy */
(void) data;
@@ -5143,7 +5143,7 @@ weechat_guile_api_module_init (void *data)
pt->rw_random = 0;
scm_set_current_output_port (guile_port);
scm_set_current_error_port (guile_port);
-
+
/* interface functions */
scm_c_define_gsubr ("weechat:register", 7, 0, 0, &weechat_guile_api_register);
scm_c_define_gsubr ("weechat:plugin_get_name", 1, 0, 0, &weechat_guile_api_plugin_get_name);
@@ -5322,7 +5322,7 @@ weechat_guile_api_module_init (void *data)
scm_c_define_gsubr ("weechat:upgrade_write_object", 3, 0, 0, &weechat_guile_api_upgrade_write_object);
scm_c_define_gsubr ("weechat:upgrade_read", 3, 0, 0, &weechat_guile_api_upgrade_read);
scm_c_define_gsubr ("weechat:upgrade_close", 1, 0, 0, &weechat_guile_api_upgrade_close);
-
+
scm_c_export ("weechat:register", "weechat:plugin_get_name",
"weechat:charset_set", "weechat:iconv_to_internal",
"weechat:iconv_from_internal", "weechat:gettext",
@@ -5413,12 +5413,12 @@ weechat_guile_api_module_init (void *data)
"weechat:upgrade_write_object", "weechat:upgrade_read",
"weechat:upgrade_close",
NULL);
-
+
/* interface constants */
scm_c_define ("weechat:WEECHAT_RC_OK", scm_from_int (WEECHAT_RC_OK));
scm_c_define ("weechat:WEECHAT_RC_OK_EAT", scm_from_int (WEECHAT_RC_OK_EAT));
scm_c_define ("weechat:WEECHAT_RC_ERROR", scm_from_int (WEECHAT_RC_ERROR));
-
+
scm_c_define ("weechat:WEECHAT_CONFIG_READ_OK", scm_from_int (WEECHAT_CONFIG_READ_OK));
scm_c_define ("weechat:WEECHAT_CONFIG_READ_MEMORY_ERROR", scm_from_int (WEECHAT_CONFIG_READ_MEMORY_ERROR));
scm_c_define ("weechat:WEECHAT_CONFIG_READ_FILE_NOT_FOUND", scm_from_int (WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
@@ -5433,19 +5433,19 @@ weechat_guile_api_module_init (void *data)
scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_ERROR", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
scm_c_define ("weechat:WEECHAT_LIST_POS_SORT", scm_from_locale_string (WEECHAT_LIST_POS_SORT));
scm_c_define ("weechat:WEECHAT_LIST_POS_BEGINNING", scm_from_locale_string (WEECHAT_LIST_POS_BEGINNING));
scm_c_define ("weechat:WEECHAT_LIST_POS_END", scm_from_locale_string (WEECHAT_LIST_POS_END));
-
+
scm_c_define ("weechat:WEECHAT_HOTLIST_LOW", scm_from_locale_string (WEECHAT_HOTLIST_LOW));
scm_c_define ("weechat:WEECHAT_HOTLIST_MESSAGE", scm_from_locale_string (WEECHAT_HOTLIST_MESSAGE));
scm_c_define ("weechat:WEECHAT_HOTLIST_PRIVATE", scm_from_locale_string (WEECHAT_HOTLIST_PRIVATE));
scm_c_define ("weechat:WEECHAT_HOTLIST_HIGHLIGHT", scm_from_locale_string (WEECHAT_HOTLIST_HIGHLIGHT));
-
+
scm_c_define ("weechat:WEECHAT_HOOK_PROCESS_RUNNING", scm_from_int (WEECHAT_HOOK_PROCESS_RUNNING));
scm_c_define ("weechat:WEECHAT_HOOK_PROCESS_ERROR", scm_from_int (WEECHAT_HOOK_PROCESS_ERROR));
-
+
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_OK", scm_from_int (WEECHAT_HOOK_CONNECT_OK));
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", scm_from_int (WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", scm_from_int (WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
@@ -5455,7 +5455,7 @@ weechat_guile_api_module_init (void *data)
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_MEMORY_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
-
+
scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_STRING", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_STRING));
scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_INT", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_INT));
scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_POINTER", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_POINTER));
diff --git a/src/plugins/scripts/guile/weechat-guile.c b/src/plugins/scripts/guile/weechat-guile.c
index e698f3d0c..c62b329eb 100644
--- a/src/plugins/scripts/guile/weechat-guile.c
+++ b/src/plugins/scripts/guile/weechat-guile.c
@@ -102,7 +102,7 @@ SCM
weechat_guile_catch (void *procedure, void *data)
{
SCM value;
-
+
value = scm_internal_catch (SCM_BOOL_T,
(scm_t_catch_body)procedure,
data,
@@ -119,9 +119,9 @@ SCM
weechat_guile_scm_call_1 (void *proc)
{
struct t_guile_function *guile_function;
-
+
guile_function = (struct t_guile_function *)proc;
-
+
return scm_call_1 (guile_function->proc, guile_function->args);
}
@@ -135,7 +135,7 @@ weechat_guile_exec_function (const char *function, SCM args)
{
SCM func, func2, value;
struct t_guile_function guile_function;
-
+
func = weechat_guile_catch (scm_c_lookup, (void *)function);
func2 = weechat_guile_catch (scm_variable_ref, func);
@@ -148,8 +148,8 @@ weechat_guile_exec_function (const char *function, SCM args)
else
{
value = weechat_guile_catch (scm_call_0, func2);
- }
-
+ }
+
return value;
}
@@ -165,16 +165,16 @@ weechat_guile_hashtable_map_cb (void *data,
const void *value)
{
SCM *alist, pair, list;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
alist = (SCM *)data;
-
+
pair = scm_cons (scm_from_locale_string ((const char *)key),
scm_from_locale_string ((const char *)value));
list = scm_list_1 (pair);
-
+
*alist = scm_append (scm_list_2 (*alist, list));
}
@@ -186,13 +186,13 @@ SCM
weechat_guile_hashtable_to_alist (struct t_hashtable *hashtable)
{
SCM alist;
-
+
alist = scm_list_n (SCM_UNDEFINED);
-
+
weechat_hashtable_map (hashtable,
&weechat_guile_hashtable_map_cb,
&alist);
-
+
return alist;
}
@@ -210,7 +210,7 @@ weechat_guile_alist_to_hashtable (SCM alist, int hashtable_size)
struct t_hashtable *hashtable;
int length, i;
SCM pair;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -218,7 +218,7 @@ weechat_guile_alist_to_hashtable (SCM alist, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
length = scm_to_int (scm_length (alist));
for (i = 0; i < length; i++)
{
@@ -229,7 +229,7 @@ weechat_guile_alist_to_hashtable (SCM alist, int hashtable_size)
scm_i_string_chars (scm_list_ref (pair,
scm_from_int (1))));
}
-
+
return hashtable;
}
@@ -246,11 +246,11 @@ weechat_guile_exec (struct t_plugin_script *script,
SCM argv_list, rc;
void *argv2[17], *ret_value;
int i, argc, *ret_int;
-
+
old_guile_current_script = guile_current_script;
scm_set_current_module ((SCM)(script->interpreter));
guile_current_script = script;
-
+
if (argv && argv[0])
{
argc = strlen (format);
@@ -288,9 +288,9 @@ weechat_guile_exec (struct t_plugin_script *script,
{
rc = weechat_guile_exec_function (function, NULL);
}
-
+
ret_value = NULL;
-
+
if ((ret_type == WEECHAT_SCRIPT_EXEC_STRING) && (scm_is_string (rc)))
{
ret_value = scm_to_locale_string (rc);
@@ -314,19 +314,19 @@ weechat_guile_exec (struct t_plugin_script *script,
"a valid value"),
weechat_prefix ("error"), GUILE_PLUGIN_NAME, function);
}
-
+
if (ret_value == NULL)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: error in function \"%s\""),
weechat_prefix ("error"), GUILE_PLUGIN_NAME, function);
}
-
+
if (old_guile_current_script)
scm_set_current_module ((SCM)(old_guile_current_script->interpreter));
-
+
guile_current_script = old_guile_current_script;
-
+
return ret_value;
}
@@ -350,28 +350,28 @@ weechat_guile_load (const char *filename)
{
char *filename2, *ptr_base_name, *base_name;
SCM module;
-
+
if ((weechat_guile_plugin->debug >= 1) || !guile_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
GUILE_PLUGIN_NAME, filename);
}
-
+
guile_current_script = NULL;
guile_registered_script = NULL;
guile_current_script_filename = filename;
-
+
filename2 = strdup (filename);
if (!filename2)
return 0;
-
+
ptr_base_name = basename (filename2);
base_name = strdup (ptr_base_name);
module = scm_c_define_module (base_name,
&weechat_guile_module_init_script, filename2);
free (filename2);
-
+
if (!guile_registered_script)
{
weechat_printf (NULL,
@@ -380,12 +380,12 @@ weechat_guile_load (const char *filename)
weechat_prefix ("error"), GUILE_PLUGIN_NAME, filename);
return 0;
}
-
+
scm_gc_protect_object (module);
-
+
guile_current_script = guile_registered_script;
guile_current_script->interpreter = (void *)module;
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -395,7 +395,7 @@ weechat_guile_load (const char *filename)
guile_current_script,
&weechat_guile_api_buffer_input_data_cb,
&weechat_guile_api_buffer_close_cb);
-
+
return 1;
}
@@ -408,7 +408,7 @@ weechat_guile_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_guile_load (filename);
}
@@ -420,14 +420,14 @@ void
weechat_guile_unload (struct t_plugin_script *script)
{
int *rc;
-
+
if ((weechat_guile_plugin->debug >= 1) || !guile_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
GUILE_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *)weechat_guile_exec (script, WEECHAT_SCRIPT_EXEC_INT,
@@ -435,13 +435,13 @@ weechat_guile_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
scm_gc_unprotect_object (script->interpreter);
-
+
if (guile_current_script == script)
guile_current_script = (guile_current_script->prev_script) ?
guile_current_script->prev_script : guile_current_script->next_script;
-
+
script_remove (weechat_guile_plugin, &guile_scripts, &last_guile_script,
script);
}
@@ -454,7 +454,7 @@ void
weechat_guile_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_guile_plugin, guile_scripts, name);
if (ptr_script)
{
@@ -493,7 +493,7 @@ weechat_guile_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_guile_plugin, guile_scripts, name);
if (ptr_script)
{
@@ -526,7 +526,7 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
{
char *path_script;
SCM value;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
@@ -613,7 +613,7 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
"guile");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -630,9 +630,9 @@ weechat_guile_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_guile_plugin, completion, guile_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -646,17 +646,17 @@ weechat_guile_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "guile_script") == 0)
{
return script_infolist_list_scripts (weechat_guile_plugin,
guile_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -673,13 +673,13 @@ weechat_guile_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, GUILE_PLUGIN_NAME) == 0))
{
script_print_log (weechat_guile_plugin, guile_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -697,10 +697,10 @@ weechat_guile_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (guile_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -732,7 +732,7 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
&guile_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -748,7 +748,7 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "guile_script_install") == 0)
@@ -768,7 +768,7 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
&guile_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -781,7 +781,7 @@ weechat_guile_port_fill_input (SCM port)
{
/* make C compiler happy */
(void) port;
-
+
return ' ';
}
@@ -794,10 +794,10 @@ weechat_guile_port_write (SCM port, const void *data, size_t size)
{
char *new_stdout;
int length_stdout;
-
+
/* make C compiler happy */
(void) port;
-
+
/* concatenate str to guile_stdout */
if (guile_stdout)
{
@@ -821,7 +821,7 @@ weechat_guile_port_write (SCM port, const void *data, size_t size)
guile_stdout[size] = '\0';
}
}
-
+
/* flush stdout if at least "\n" is in string */
if (guile_stdout && (strchr (guile_stdout, '\n')))
weechat_guile_stdout_flush ();
@@ -835,17 +835,17 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_guile_plugin = plugin;
-
+
guile_stdout = NULL;
-
+
scm_init_guile ();
-
+
guile_module_weechat = scm_c_define_module ("weechat",
&weechat_guile_api_module_init,
NULL);
scm_c_use_module ("weechat");
scm_gc_protect_object (guile_module_weechat);
-
+
guile_quiet = 1;
script_init (weechat_guile_plugin,
argc,
@@ -858,10 +858,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_guile_signal_script_action_cb,
&weechat_guile_load_cb);
guile_quiet = 0;
-
+
script_display_short_list (weechat_guile_plugin,
guile_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -877,15 +877,15 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
guile_quiet = 1;
script_end (plugin, &guile_scripts, &weechat_guile_unload_all);
guile_quiet = 0;
-
+
/* unprotect module */
scm_gc_unprotect_object (guile_module_weechat);
-
+
/* free some data */
if (guile_action_install_list)
free (guile_action_install_list);
if (guile_action_remove_list)
free (guile_action_remove_list);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index ffa50e769..1f2a79db6 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -86,13 +86,13 @@ weechat_lua_api_register (lua_State *L)
{
const char *name, *author, *version, *license, *description;
const char *shutdown_func, *charset;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
lua_current_script = NULL;
lua_registered_script = NULL;
if (lua_gettop (lua_current_interpreter) < 7)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
name = lua_tostring (lua_current_interpreter, -7);
author = lua_tostring (lua_current_interpreter, -6);
version = lua_tostring (lua_current_interpreter, -5);
@@ -100,7 +100,7 @@ weechat_lua_api_register (lua_State *L)
description = lua_tostring (lua_current_interpreter, -3);
shutdown_func = lua_tostring (lua_current_interpreter, -2);
charset = lua_tostring (lua_current_interpreter, -1);
-
+
if (script_search (weechat_lua_plugin, lua_scripts, name))
{
weechat_printf (NULL,
@@ -110,7 +110,7 @@ weechat_lua_api_register (lua_State *L)
weechat_prefix ("error"), LUA_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
lua_current_script = script_add (weechat_lua_plugin,
&lua_scripts, &last_lua_script,
@@ -138,7 +138,7 @@ weechat_lua_api_register (lua_State *L)
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -151,15 +151,15 @@ static int
weechat_lua_api_plugin_get_name (lua_State *L)
{
const char *plugin, *result;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
plugin = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_plugin_get_name (script_str2ptr (plugin));
-
+
API_RETURN_STRING(result);
}
@@ -171,13 +171,13 @@ static int
weechat_lua_api_charset_set (lua_State *L)
{
const char *charset;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
charset = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_charset_set (lua_current_script,
charset);
@@ -193,16 +193,16 @@ weechat_lua_api_iconv_to_internal (lua_State *L)
{
const char *charset, *string;
char *result;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_iconv_to_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -216,16 +216,16 @@ weechat_lua_api_iconv_from_internal (lua_State *L)
{
const char *charset, *string;
char *result;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
charset = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_iconv_from_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -237,15 +237,15 @@ static int
weechat_lua_api_gettext (lua_State *L)
{
const char *string, *result;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_gettext (string);
-
+
API_RETURN_STRING(result);
}
@@ -258,17 +258,17 @@ weechat_lua_api_ngettext (lua_State *L)
{
const char *single, *plural, *result;
int count;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
single = lua_tostring (lua_current_interpreter, -3);
plural = lua_tostring (lua_current_interpreter, -2);
count = lua_tonumber (lua_current_interpreter, -1);
-
+
result = weechat_ngettext (single, plural, count);
-
+
API_RETURN_STRING(result);
}
@@ -283,17 +283,17 @@ weechat_lua_api_string_match (lua_State *L)
{
const char *string, *mask;
int case_sensitive, value;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = lua_tostring (lua_current_interpreter, -3);
mask = lua_tostring (lua_current_interpreter, -2);
case_sensitive = lua_tonumber (lua_current_interpreter, -1);
-
+
value = weechat_string_match (string, mask, case_sensitive);
-
+
API_RETURN_INT(value);
}
@@ -310,16 +310,16 @@ weechat_lua_api_string_has_highlight (lua_State *L)
{
const char *string, *highlight_words;
int value;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = lua_tostring (lua_current_interpreter, -2);
highlight_words = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_string_has_highlight (string, highlight_words);
-
+
API_RETURN_INT(value);
}
@@ -336,16 +336,16 @@ weechat_lua_api_string_has_highlight_regex (lua_State *L)
{
const char *string, *regex;
int value;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = lua_tostring (lua_current_interpreter, -2);
regex = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_string_has_highlight_regex (string, regex);
-
+
API_RETURN_INT(value);
}
@@ -361,15 +361,15 @@ weechat_lua_api_string_mask_to_regex (lua_State *L)
{
const char *mask;
char *result;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
mask = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_string_mask_to_regex (mask);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -382,16 +382,16 @@ weechat_lua_api_string_remove_color (lua_State *L)
{
const char *string, *replacement;
char *result;
-
+
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
string = lua_tostring (lua_current_interpreter, -2);
replacement = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_string_remove_color (string, replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -405,15 +405,15 @@ weechat_lua_api_string_is_command_char (lua_State *L)
{
const char *string;
int value;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_string_is_command_char (string);
-
+
API_RETURN_INT(value);
}
@@ -427,15 +427,15 @@ static int
weechat_lua_api_string_input_for_buffer (lua_State *L)
{
const char *string, *result;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_string_input_for_buffer (string);
-
+
API_RETURN_STRING(result);
}
@@ -448,17 +448,17 @@ weechat_lua_api_mkdir_home (lua_State *L)
{
const char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
-
+
if (weechat_mkdir_home (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_OK;
}
@@ -471,17 +471,17 @@ weechat_lua_api_mkdir (lua_State *L)
{
const char *directory;
int mode;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
-
+
if (weechat_mkdir (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_OK;
}
@@ -495,17 +495,17 @@ weechat_lua_api_mkdir_parents (lua_State *L)
{
const char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
-
+
if (weechat_mkdir_parents (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_OK;
}
@@ -517,11 +517,11 @@ static int
weechat_lua_api_list_new (lua_State *L)
{
char *result;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -534,21 +534,21 @@ weechat_lua_api_list_add (lua_State *L)
{
const char *weelist, *data, *where, *user_data;
char *result;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = lua_tostring (lua_current_interpreter, -4);
data = lua_tostring (lua_current_interpreter, -3);
where = lua_tostring (lua_current_interpreter, -2);
user_data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -561,17 +561,17 @@ weechat_lua_api_list_search (lua_State *L)
{
const char *weelist, *data;
char *result;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -584,16 +584,16 @@ weechat_lua_api_list_search_pos (lua_State *L)
{
const char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -606,17 +606,17 @@ weechat_lua_api_list_casesearch (lua_State *L)
{
const char *weelist, *data;
char *result;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -630,16 +630,16 @@ weechat_lua_api_list_casesearch_pos (lua_State *L)
{
const char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -653,17 +653,17 @@ weechat_lua_api_list_get (lua_State *L)
const char *weelist;
char *result;
int position;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
position = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -675,17 +675,17 @@ static int
weechat_lua_api_list_set (lua_State *L)
{
const char *item, *new_value;
-
+
API_FUNC(1, "list_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
item = lua_tostring (lua_current_interpreter, -2);
new_value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_list_set (script_str2ptr (item),
new_value);
-
+
API_RETURN_OK;
}
@@ -698,15 +698,15 @@ weechat_lua_api_list_next (lua_State *L)
{
const char *item;
char *result;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
item = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -719,15 +719,15 @@ weechat_lua_api_list_prev (lua_State *L)
{
const char *item;
char *result;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
item = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -739,15 +739,15 @@ static int
weechat_lua_api_list_string (lua_State *L)
{
const char *item, *result;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
item = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_list_string (script_str2ptr (item));
-
+
API_RETURN_STRING(result);
}
@@ -760,15 +760,15 @@ weechat_lua_api_list_size (lua_State *L)
{
const char *weelist;
int size;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
weelist = lua_tostring (lua_current_interpreter, -1);
-
+
size = weechat_list_size (script_str2ptr (weelist));
-
+
API_RETURN_INT(size);
}
@@ -780,17 +780,17 @@ static int
weechat_lua_api_list_remove (lua_State *L)
{
const char *weelist, *item;
-
+
API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weelist = lua_tostring (lua_current_interpreter, -2);
item = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -802,15 +802,15 @@ static int
weechat_lua_api_list_remove_all (lua_State *L)
{
const char *weelist;
-
+
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weelist = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_list_remove_all (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -822,15 +822,15 @@ static int
weechat_lua_api_list_free (lua_State *L)
{
const char *weelist;
-
+
API_FUNC(1, "list_free", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weelist = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_list_free (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -846,19 +846,19 @@ weechat_lua_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -868,10 +868,10 @@ weechat_lua_api_config_reload_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -884,22 +884,22 @@ weechat_lua_api_config_new (lua_State *L)
{
const char *name, *function, *data;
char *result;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_config_new (weechat_lua_plugin,
lua_current_script,
name,
&weechat_lua_api_config_reload_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -917,9 +917,9 @@ weechat_lua_api_config_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -927,12 +927,12 @@ weechat_lua_api_config_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -944,10 +944,10 @@ weechat_lua_api_config_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -964,20 +964,20 @@ weechat_lua_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -987,10 +987,10 @@ weechat_lua_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1008,20 +1008,20 @@ weechat_lua_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1031,10 +1031,10 @@ weechat_lua_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1053,9 +1053,9 @@ weechat_lua_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1063,12 +1063,12 @@ weechat_lua_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1080,10 +1080,10 @@ weechat_lua_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1101,21 +1101,21 @@ weechat_lua_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1129,10 +1129,10 @@ weechat_lua_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1150,11 +1150,11 @@ weechat_lua_api_config_new_section (lua_State *L)
const char *data_delete_option;
char *result;
int user_can_add_options, user_can_delete_options;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 14)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = lua_tostring (lua_current_interpreter, -14);
name = lua_tostring (lua_current_interpreter, -13);
user_can_add_options = lua_tonumber (lua_current_interpreter, -12);
@@ -1169,7 +1169,7 @@ weechat_lua_api_config_new_section (lua_State *L)
data_create_option = lua_tostring (lua_current_interpreter, -3);
function_delete_option = lua_tostring (lua_current_interpreter, -2);
data_delete_option = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_lua_plugin,
lua_current_script,
script_str2ptr (config_file),
@@ -1191,7 +1191,7 @@ weechat_lua_api_config_new_section (lua_State *L)
&weechat_lua_api_config_section_delete_option_cb,
function_delete_option,
data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1204,17 +1204,17 @@ weechat_lua_api_config_search_section (lua_State *L)
{
const char *config_file, *section_name;
char *result;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = lua_tostring (lua_current_interpreter, -2);
section_name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1232,20 +1232,20 @@ weechat_lua_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1255,10 +1255,10 @@ weechat_lua_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1274,22 +1274,22 @@ weechat_lua_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1307,22 +1307,22 @@ weechat_lua_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1341,11 +1341,11 @@ weechat_lua_api_config_new_option (lua_State *L)
const char *data_change, *function_delete, *data_delete;
char *result;
int min, max, null_value_allowed;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 17)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = lua_tostring (lua_current_interpreter, -17);
section = lua_tostring (lua_current_interpreter, -16);
name = lua_tostring (lua_current_interpreter, -15);
@@ -1363,7 +1363,7 @@ weechat_lua_api_config_new_option (lua_State *L)
data_change = lua_tostring (lua_current_interpreter, -3);
function_delete = lua_tostring (lua_current_interpreter, -2);
data_delete = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_lua_plugin,
lua_current_script,
script_str2ptr (config_file),
@@ -1386,7 +1386,7 @@ weechat_lua_api_config_new_option (lua_State *L)
&weechat_lua_api_config_option_delete_cb,
function_delete,
data_delete));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1399,19 +1399,19 @@ weechat_lua_api_config_search_option (lua_State *L)
{
const char *config_file, *section, *option_name;
char *result;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = lua_tostring (lua_current_interpreter, -3);
section = lua_tostring (lua_current_interpreter, -2);
option_name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1424,15 +1424,15 @@ weechat_lua_api_config_string_to_boolean (lua_State *L)
{
const char *text;
int value;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
text = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_string_to_boolean (text);
-
+
API_RETURN_INT(value);
}
@@ -1445,17 +1445,17 @@ weechat_lua_api_config_option_reset (lua_State *L)
{
const char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
-
+
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1468,19 +1468,19 @@ weechat_lua_api_config_option_set (lua_State *L)
{
const char *option, *new_value;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = lua_tostring (lua_current_interpreter, -3);
new_value = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
-
+
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1494,17 +1494,17 @@ weechat_lua_api_config_option_set_null (lua_State *L)
{
const char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = lua_tostring (lua_current_interpreter, -2);
run_callback = lua_tonumber (lua_current_interpreter, -1);
-
+
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1517,15 +1517,15 @@ weechat_lua_api_config_option_unset (lua_State *L)
{
const char *option;
int rc;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
rc = weechat_config_option_unset (script_str2ptr (option));
-
+
API_RETURN_INT(rc);
}
@@ -1537,17 +1537,17 @@ static int
weechat_lua_api_config_option_rename (lua_State *L)
{
const char *option, *new_name;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = lua_tostring (lua_current_interpreter, -2);
new_name = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_config_option_rename (script_str2ptr (option),
new_name);
-
+
API_RETURN_OK;
}
@@ -1560,15 +1560,15 @@ weechat_lua_api_config_option_is_null (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_option_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1582,15 +1582,15 @@ weechat_lua_api_config_option_default_is_null (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_option_default_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1603,15 +1603,15 @@ weechat_lua_api_config_boolean (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_boolean (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1624,15 +1624,15 @@ weechat_lua_api_config_boolean_default (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_boolean_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1645,15 +1645,15 @@ weechat_lua_api_config_integer (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_integer (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1666,15 +1666,15 @@ weechat_lua_api_config_integer_default (lua_State *L)
{
const char *option;
int value;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_config_integer_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1686,15 +1686,15 @@ static int
weechat_lua_api_config_string (lua_State *L)
{
const char *option, *result;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_config_string (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1706,15 +1706,15 @@ static int
weechat_lua_api_config_string_default (lua_State *L)
{
const char *option, *result;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_config_string_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1726,15 +1726,15 @@ static int
weechat_lua_api_config_color (lua_State *L)
{
const char *option, *result;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_config_color (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1746,15 +1746,15 @@ static int
weechat_lua_api_config_color_default (lua_State *L)
{
const char *option, *result;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_config_color_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1766,17 +1766,17 @@ static int
weechat_lua_api_config_write_option (lua_State *L)
{
const char *config_file, *option;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = lua_tostring (lua_current_interpreter, -2);
option = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1788,20 +1788,20 @@ static int
weechat_lua_api_config_write_line (lua_State *L)
{
const char *config_file, *option_name, *value;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = lua_tostring (lua_current_interpreter, -3);
option_name = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_config_write_line (script_str2ptr (config_file),
option_name,
"%s",
value);
-
+
API_RETURN_OK;
}
@@ -1814,15 +1814,15 @@ weechat_lua_api_config_write (lua_State *L)
{
const char *config_file;
int rc;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
config_file = lua_tostring (lua_current_interpreter, -1);
-
+
rc = weechat_config_write (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1835,15 +1835,15 @@ weechat_lua_api_config_read (lua_State *L)
{
const char *config_file;
int rc;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
config_file = lua_tostring (lua_current_interpreter, -1);
-
+
rc = weechat_config_read (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1856,15 +1856,15 @@ weechat_lua_api_config_reload (lua_State *L)
{
const char *config_file;
int rc;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
config_file = lua_tostring (lua_current_interpreter, -1);
-
+
rc = weechat_config_reload (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1876,17 +1876,17 @@ static int
weechat_lua_api_config_option_free (lua_State *L)
{
const char *option;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_config_option_free (weechat_lua_plugin,
lua_current_script,
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1899,17 +1899,17 @@ static int
weechat_lua_api_config_section_free_options (lua_State *L)
{
const char *section;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
section = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_config_section_free_options (weechat_lua_plugin,
lua_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1921,17 +1921,17 @@ static int
weechat_lua_api_config_section_free (lua_State *L)
{
const char *section;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
section = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_config_section_free (weechat_lua_plugin,
lua_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1943,17 +1943,17 @@ static int
weechat_lua_api_config_free (lua_State *L)
{
const char *config_file;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_config_free (weechat_lua_plugin,
lua_current_script,
script_str2ptr (config_file));
-
+
API_RETURN_OK;
}
@@ -1966,15 +1966,15 @@ weechat_lua_api_config_get (lua_State *L)
{
const char *option;
char *result;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_config_get (option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1986,17 +1986,17 @@ static int
weechat_lua_api_config_get_plugin (lua_State *L)
{
const char *option, *result;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_api_config_get_plugin (weechat_lua_plugin,
lua_current_script,
option);
-
+
API_RETURN_STRING(result);
}
@@ -2009,17 +2009,17 @@ weechat_lua_api_config_is_set_plugin (lua_State *L)
{
const char *option;
int rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
rc = script_api_config_is_set_plugin (weechat_lua_plugin,
lua_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2032,19 +2032,19 @@ weechat_lua_api_config_set_plugin (lua_State *L)
{
const char *option, *value;
int rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
rc = script_api_config_set_plugin (weechat_lua_plugin,
lua_current_script,
option,
value);
-
+
API_RETURN_INT(rc);
}
@@ -2056,19 +2056,19 @@ static int
weechat_lua_api_config_set_desc_plugin (lua_State *L)
{
const char *option, *description;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = lua_tostring (lua_current_interpreter, -2);
description = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_config_set_desc_plugin (weechat_lua_plugin,
lua_current_script,
option,
description);
-
+
API_RETURN_OK;
}
@@ -2081,17 +2081,17 @@ weechat_lua_api_config_unset_plugin (lua_State *L)
{
const char *option;
int rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = lua_tostring (lua_current_interpreter, -1);
-
+
rc = script_api_config_unset_plugin (weechat_lua_plugin,
lua_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2105,20 +2105,20 @@ weechat_lua_api_key_bind (lua_State *L)
const char *context;
struct t_hashtable *hashtable;
int num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (context, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_INT(num_keys);
}
@@ -2131,16 +2131,16 @@ weechat_lua_api_key_unbind (lua_State *L)
{
const char *context, *key;
int num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = lua_tostring (lua_current_interpreter, -2);
key = lua_tostring (lua_current_interpreter, -1);
-
+
num_keys = weechat_key_unbind (context, key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2152,15 +2152,15 @@ static int
weechat_lua_api_prefix (lua_State *L)
{
const char *prefix, *result;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
prefix = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_prefix (prefix);
-
+
API_RETURN_STRING(result);
}
@@ -2172,15 +2172,15 @@ static int
weechat_lua_api_color (lua_State *L)
{
const char *color, *result;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
color = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_color (color);
-
+
API_RETURN_STRING(result);
}
@@ -2192,19 +2192,19 @@ static int
weechat_lua_api_print (lua_State *L)
{
const char *buffer, *message;
-
+
API_FUNC(0, "print", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
message = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_printf (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2218,23 +2218,23 @@ weechat_lua_api_print_date_tags (lua_State *L)
{
const char *buffer, *tags, *message;
int date;
-
+
API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -4);
date = lua_tonumber (lua_current_interpreter, -3);
tags = lua_tostring (lua_current_interpreter, -2);
message = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_printf_date_tags (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer),
date,
tags,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2247,21 +2247,21 @@ weechat_lua_api_print_y (lua_State *L)
{
const char *buffer, *message;
int y;
-
+
API_FUNC(1, "print_y", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
y = lua_tonumber (lua_current_interpreter, -2);
message = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_printf_y (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer),
y,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2273,13 +2273,13 @@ static int
weechat_lua_api_log_print (lua_State *L)
{
const char *message;
-
+
API_FUNC(1, "log_print", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
message = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_log_printf (weechat_lua_plugin,
lua_current_script,
"%s", message);
@@ -2302,7 +2302,7 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2310,12 +2310,12 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2325,10 +2325,10 @@ weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2342,11 +2342,11 @@ weechat_lua_api_hook_command (lua_State *L)
const char *command, *description, *args, *args_description, *completion;
const char *function, *data;
char *result;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = lua_tostring (lua_current_interpreter, -7);
description = lua_tostring (lua_current_interpreter, -6);
args = lua_tostring (lua_current_interpreter, -5);
@@ -2354,7 +2354,7 @@ weechat_lua_api_hook_command (lua_State *L)
completion = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_command (weechat_lua_plugin,
lua_current_script,
command,
@@ -2365,7 +2365,7 @@ weechat_lua_api_hook_command (lua_State *L)
&weechat_lua_api_hook_command_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2381,20 +2381,20 @@ weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2404,10 +2404,10 @@ weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2420,22 +2420,22 @@ weechat_lua_api_hook_command_run (lua_State *L)
{
const char *command, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_lua_plugin,
lua_current_script,
command,
&weechat_lua_api_hook_command_run_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2450,22 +2450,22 @@ weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2473,10 +2473,10 @@ weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2490,17 +2490,17 @@ weechat_lua_api_hook_timer (lua_State *L)
int interval, align_second, max_calls;
const char *function, *data;
char *result;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
interval = lua_tonumber (lua_current_interpreter, -5);
align_second = lua_tonumber (lua_current_interpreter, -4);
max_calls = lua_tonumber (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_lua_plugin,
lua_current_script,
interval,
@@ -2509,7 +2509,7 @@ weechat_lua_api_hook_timer (lua_State *L)
&weechat_lua_api_hook_timer_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2524,21 +2524,21 @@ weechat_lua_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2546,10 +2546,10 @@ weechat_lua_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2563,18 +2563,18 @@ weechat_lua_api_hook_fd (lua_State *L)
int fd, read, write, exception;
const char *function, *data;
char *result;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
fd = lua_tonumber (lua_current_interpreter, -6);
read = lua_tonumber (lua_current_interpreter, -5);
write = lua_tonumber (lua_current_interpreter, -4);
exception = lua_tonumber (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_lua_plugin,
lua_current_script,
fd,
@@ -2584,7 +2584,7 @@ weechat_lua_api_hook_fd (lua_State *L)
&weechat_lua_api_hook_fd_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2601,24 +2601,24 @@ weechat_lua_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2626,10 +2626,10 @@ weechat_lua_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2643,16 +2643,16 @@ weechat_lua_api_hook_process (lua_State *L)
const char *command, *function, *data;
int timeout;
char *result;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = lua_tostring (lua_current_interpreter, -4);
timeout = lua_tonumber (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_process (weechat_lua_plugin,
lua_current_script,
command,
@@ -2660,7 +2660,7 @@ weechat_lua_api_hook_process (lua_State *L)
&weechat_lua_api_hook_process_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2677,25 +2677,25 @@ weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2703,10 +2703,10 @@ weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2720,11 +2720,11 @@ weechat_lua_api_hook_connect (lua_State *L)
const char *proxy, *address, *local_hostname, *function, *data;
int port, sock, ipv6;
char *result;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 8)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
proxy = lua_tostring (lua_current_interpreter, -8);
address = lua_tostring (lua_current_interpreter, -7);
port = lua_tonumber (lua_current_interpreter, -6);
@@ -2733,7 +2733,7 @@ weechat_lua_api_hook_connect (lua_State *L)
local_hostname = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_lua_plugin,
lua_current_script,
proxy,
@@ -2749,7 +2749,7 @@ weechat_lua_api_hook_connect (lua_State *L)
&weechat_lua_api_hook_connect_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2769,16 +2769,16 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -2789,12 +2789,12 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2810,10 +2810,10 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2827,18 +2827,18 @@ weechat_lua_api_hook_print (lua_State *L)
const char *buffer, *tags, *message, *function, *data;
char *result;
int strip_colors;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -6);
tags = lua_tostring (lua_current_interpreter, -5);
message = lua_tostring (lua_current_interpreter, -4);
strip_colors = lua_tonumber (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_print (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer),
@@ -2848,7 +2848,7 @@ weechat_lua_api_hook_print (lua_State *L)
&weechat_lua_api_hook_print_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2865,7 +2865,7 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2890,12 +2890,12 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2905,10 +2905,10 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2921,22 +2921,22 @@ weechat_lua_api_hook_signal (lua_State *L)
{
const char *signal, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_lua_plugin,
lua_current_script,
signal,
&weechat_lua_api_hook_signal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2949,13 +2949,13 @@ weechat_lua_api_hook_signal_send (lua_State *L)
{
const char *signal, *type_data, *signal_data;
int number;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
signal_data = NULL;
-
+
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = lua_tostring (lua_current_interpreter, -3);
type_data = lua_tostring (lua_current_interpreter, -2);
@@ -2978,7 +2978,7 @@ weechat_lua_api_hook_signal_send (lua_State *L)
script_str2ptr (signal_data));
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -2994,20 +2994,20 @@ weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssh", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3015,10 +3015,10 @@ weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3031,22 +3031,22 @@ weechat_lua_api_hook_hsignal (lua_State *L)
{
const char *signal, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_lua_plugin,
lua_current_script,
signal,
&weechat_lua_api_hook_hsignal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3059,20 +3059,20 @@ weechat_lua_api_hook_hsignal_send (lua_State *L)
{
const char *signal;
struct t_hashtable *hashtable;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (signal, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_OK;
}
@@ -3088,20 +3088,20 @@ weechat_lua_api_hook_config_cb (void *data, const char *option,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3109,10 +3109,10 @@ weechat_lua_api_hook_config_cb (void *data, const char *option,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3125,22 +3125,22 @@ weechat_lua_api_hook_config (lua_State *L)
{
const char *option, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
option = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_config (weechat_lua_plugin,
lua_current_script,
option,
&weechat_lua_api_hook_config_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3157,7 +3157,7 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3166,12 +3166,12 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3183,10 +3183,10 @@ weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3199,16 +3199,16 @@ weechat_lua_api_hook_completion (lua_State *L)
{
const char *completion, *description, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
completion = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_lua_plugin,
lua_current_script,
completion,
@@ -3216,7 +3216,7 @@ weechat_lua_api_hook_completion (lua_State *L)
&weechat_lua_api_hook_completion_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3229,21 +3229,21 @@ weechat_lua_api_hook_completion_list_add (lua_State *L)
{
const char *completion, *word, *where;
int nick_completion;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
completion = lua_tostring (lua_current_interpreter, -4);
word = lua_tostring (lua_current_interpreter, -3);
nick_completion = lua_tonumber (lua_current_interpreter, -2);
where = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion,
where);
-
+
API_RETURN_OK;
}
@@ -3259,7 +3259,7 @@ weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3268,13 +3268,13 @@ weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3287,22 +3287,22 @@ weechat_lua_api_hook_modifier (lua_State *L)
{
const char *modifier, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
modifier = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_lua_plugin,
lua_current_script,
modifier,
&weechat_lua_api_hook_modifier_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3315,17 +3315,17 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
{
const char *modifier, *modifier_data, *string;
char *result;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
modifier = lua_tostring (lua_current_interpreter, -3);
modifier_data = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3340,7 +3340,7 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3348,13 +3348,13 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3367,17 +3367,17 @@ weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *description, *args_description, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = lua_tostring (lua_current_interpreter, -5);
description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_info (weechat_lua_plugin,
lua_current_script,
info_name,
@@ -3386,7 +3386,7 @@ weechat_lua_api_hook_info (lua_State *L)
&weechat_lua_api_hook_info_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3401,21 +3401,21 @@ weechat_lua_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
-
+
return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssh", func_argv);
}
-
+
return NULL;
}
@@ -3429,18 +3429,18 @@ weechat_lua_api_hook_info_hashtable (lua_State *L)
const char *info_name, *description, *args_description;
const char *output_description, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
args_description = lua_tostring (lua_current_interpreter, -4);
output_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_lua_plugin,
lua_current_script,
info_name,
@@ -3450,7 +3450,7 @@ weechat_lua_api_hook_info_hashtable (lua_State *L)
&weechat_lua_api_hook_info_hashtable_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3466,7 +3466,7 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3475,18 +3475,18 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3500,18 +3500,18 @@ weechat_lua_api_hook_infolist (lua_State *L)
const char *infolist_name, *description, *pointer_description;
const char *args_description, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
pointer_description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_lua_plugin,
lua_current_script,
infolist_name,
@@ -3521,7 +3521,7 @@ weechat_lua_api_hook_infolist (lua_State *L)
&weechat_lua_api_hook_infolist_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3536,20 +3536,20 @@ weechat_lua_api_hook_focus_cb (void *data,
struct t_script_callback *script_callback;
void *func_argv[2];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = info;
-
+
return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", func_argv);
}
-
+
return NULL;
}
@@ -3562,22 +3562,22 @@ weechat_lua_api_hook_focus (lua_State *L)
{
const char *area, *function, *data;
char *result;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
area = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_lua_plugin,
lua_current_script,
area,
&weechat_lua_api_hook_focus_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3589,17 +3589,17 @@ static int
weechat_lua_api_unhook (lua_State *L)
{
const char *hook;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
hook = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_unhook (weechat_lua_plugin,
lua_current_script,
script_str2ptr (hook));
-
+
API_RETURN_OK;
}
@@ -3611,9 +3611,9 @@ static int
weechat_lua_api_unhook_all (lua_State *L)
{
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (lua_current_script);
-
+
API_RETURN_OK;
}
@@ -3629,20 +3629,20 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3652,10 +3652,10 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3670,19 +3670,19 @@ weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3692,10 +3692,10 @@ weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3709,17 +3709,17 @@ weechat_lua_api_buffer_new (lua_State *L)
const char *name, *function_input, *data_input, *function_close;
const char *data_close;
char *result;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -5);
function_input = lua_tostring (lua_current_interpreter, -4);
data_input = lua_tostring (lua_current_interpreter, -3);
function_close = lua_tostring (lua_current_interpreter, -2);
data_close = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_lua_plugin,
lua_current_script,
name,
@@ -3729,7 +3729,7 @@ weechat_lua_api_buffer_new (lua_State *L)
&weechat_lua_api_buffer_close_cb,
function_close,
data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3742,16 +3742,16 @@ weechat_lua_api_buffer_search (lua_State *L)
{
const char *plugin, *name;
char *result;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
plugin = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_buffer_search (plugin, name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3763,11 +3763,11 @@ static int
weechat_lua_api_buffer_search_main (lua_State *L)
{
char *result;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3779,11 +3779,11 @@ static int
weechat_lua_api_current_buffer (lua_State *L)
{
char *result;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3795,15 +3795,15 @@ static int
weechat_lua_api_buffer_clear (lua_State *L)
{
const char *buffer;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_buffer_clear (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3815,17 +3815,17 @@ static int
weechat_lua_api_buffer_close (lua_State *L)
{
const char *buffer;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_buffer_close (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3837,17 +3837,17 @@ static int
weechat_lua_api_buffer_merge (lua_State *L)
{
const char *buffer, *target_buffer;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
target_buffer = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
-
+
API_RETURN_OK;
}
@@ -3861,16 +3861,16 @@ weechat_lua_api_buffer_unmerge (lua_State *L)
{
const char *buffer;
int number;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
number = lua_tonumber (lua_current_interpreter, -1);
-
+
weechat_buffer_unmerge (script_str2ptr (buffer), number);
-
+
API_RETURN_OK;
}
@@ -3883,17 +3883,17 @@ weechat_lua_api_buffer_get_integer (lua_State *L)
{
const char *buffer, *property;
int value;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_buffer_get_integer (script_str2ptr (buffer),
property);
-
+
API_RETURN_INT(value);
}
@@ -3905,17 +3905,17 @@ static int
weechat_lua_api_buffer_get_string (lua_State *L)
{
const char *buffer, *property, *result;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_buffer_get_string (script_str2ptr (buffer),
property);
-
+
API_RETURN_STRING(result);
}
@@ -3928,17 +3928,17 @@ weechat_lua_api_buffer_get_pointer (lua_State *L)
{
const char *buffer, *property;
char *result;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3950,17 +3950,17 @@ static int
weechat_lua_api_buffer_set (lua_State *L)
{
const char *buffer, *property, *value;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_buffer_set (script_str2ptr (buffer), property, value);
-
+
API_RETURN_OK;
}
@@ -3974,16 +3974,16 @@ weechat_lua_api_buffer_string_replace_local_var (lua_State *L)
{
const char *buffer, *string;
char *result;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3996,17 +3996,17 @@ weechat_lua_api_buffer_match_list (lua_State *L)
{
const char *buffer, *string;
int value;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
string = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_buffer_match_list (script_str2ptr (buffer),
string);
-
+
API_RETURN_INT(value);
}
@@ -4018,11 +4018,11 @@ static int
weechat_lua_api_current_window (lua_State *L)
{
char *result;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4036,15 +4036,15 @@ weechat_lua_api_window_search_with_buffer (lua_State *L)
{
const char *buffer;
char *result;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4057,17 +4057,17 @@ weechat_lua_api_window_get_integer (lua_State *L)
{
const char *window, *property;
int value;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_window_get_integer (script_str2ptr (window),
property);
-
+
API_RETURN_INT(value);
}
@@ -4079,17 +4079,17 @@ static int
weechat_lua_api_window_get_string (lua_State *L)
{
const char *window, *property, *result;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_window_get_string (script_str2ptr (window),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4102,17 +4102,17 @@ weechat_lua_api_window_get_pointer (lua_State *L)
{
const char *window, *property;
char *result;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4124,15 +4124,15 @@ static int
weechat_lua_api_window_set_title (lua_State *L)
{
const char *title;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
title = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_window_set_title (title);
-
+
API_RETURN_OK;
}
@@ -4146,23 +4146,23 @@ weechat_lua_api_nicklist_add_group (lua_State *L)
const char *buffer, *parent_group, *name, *color;
char *result;
int visible;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -5);
parent_group = lua_tostring (lua_current_interpreter, -4);
name = lua_tostring (lua_current_interpreter, -3);
color = lua_tostring (lua_current_interpreter, -2);
visible = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
name,
color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4175,19 +4175,19 @@ weechat_lua_api_nicklist_search_group (lua_State *L)
{
const char *buffer, *from_group, *name;
char *result;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
from_group = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4201,11 +4201,11 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
const char *buffer, *group, *name, *color, *prefix, *prefix_color;
char *result;
int visible;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -7);
group = lua_tostring (lua_current_interpreter, -6);
name = lua_tostring (lua_current_interpreter, -5);
@@ -4213,7 +4213,7 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
prefix = lua_tostring (lua_current_interpreter, -3);
prefix_color = lua_tostring (lua_current_interpreter, -2);
visible = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
name,
@@ -4221,7 +4221,7 @@ weechat_lua_api_nicklist_add_nick (lua_State *L)
prefix,
prefix_color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4234,19 +4234,19 @@ weechat_lua_api_nicklist_search_nick (lua_State *L)
{
const char *buffer, *from_group, *name;
char *result;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
from_group = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4258,17 +4258,17 @@ static int
weechat_lua_api_nicklist_remove_group (lua_State *L)
{
const char *buffer, *group;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
-
+
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
-
+
API_RETURN_OK;
}
@@ -4280,17 +4280,17 @@ static int
weechat_lua_api_nicklist_remove_nick (lua_State *L)
{
const char *buffer, *nick;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
-
+
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
-
+
API_RETURN_OK;
}
@@ -4302,15 +4302,15 @@ static int
weechat_lua_api_nicklist_remove_all (lua_State *L)
{
const char *buffer;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
-
+
weechat_nicklist_remove_all (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -4323,19 +4323,19 @@ weechat_lua_api_nicklist_group_get_integer (lua_State *L)
{
const char *buffer, *group, *property;
int value;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_INT(value);
}
@@ -4347,19 +4347,19 @@ static int
weechat_lua_api_nicklist_group_get_string (lua_State *L)
{
const char *buffer, *group, *property, *result;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4372,19 +4372,19 @@ weechat_lua_api_nicklist_group_get_pointer (lua_State *L)
{
const char *buffer, *group, *property;
char *result;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
group = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4396,21 +4396,21 @@ static int
weechat_lua_api_nicklist_group_set (lua_State *L)
{
const char *buffer, *group, *property, *value;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -4);
group = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4423,19 +4423,19 @@ weechat_lua_api_nicklist_nick_get_integer (lua_State *L)
{
const char *buffer, *nick, *property;
int value;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_INT(value);
}
@@ -4447,19 +4447,19 @@ static int
weechat_lua_api_nicklist_nick_get_string (lua_State *L)
{
const char *buffer, *nick, *property, *result;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4472,19 +4472,19 @@ weechat_lua_api_nicklist_nick_get_pointer (lua_State *L)
{
const char *buffer, *nick, *property;
char *result;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -3);
nick = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4496,21 +4496,21 @@ static int
weechat_lua_api_nicklist_nick_set (lua_State *L)
{
const char *buffer, *nick, *property, *value;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = lua_tostring (lua_current_interpreter, -4);
nick = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4523,15 +4523,15 @@ weechat_lua_api_bar_item_search (lua_State *L)
{
const char *name;
char *result;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_bar_item_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4546,7 +4546,7 @@ weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4554,20 +4554,20 @@ weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4580,22 +4580,22 @@ weechat_lua_api_bar_item_new (lua_State *L)
{
const char *name, *function, *data;
char *result;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_lua_plugin,
lua_current_script,
name,
&weechat_lua_api_bar_item_build_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4607,15 +4607,15 @@ static int
weechat_lua_api_bar_item_update (lua_State *L)
{
const char *name;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
name = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_bar_item_update (name);
-
+
API_RETURN_OK;
}
@@ -4627,17 +4627,17 @@ static int
weechat_lua_api_bar_item_remove (lua_State *L)
{
const char *item;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
item = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_bar_item_remove (weechat_lua_plugin,
lua_current_script,
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -4650,15 +4650,15 @@ weechat_lua_api_bar_search (lua_State *L)
{
const char *name;
char *result;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_bar_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4673,11 +4673,11 @@ weechat_lua_api_bar_new (lua_State *L)
const char *filling_top_bottom, *filling_left_right, *size, *size_max;
const char *color_fg, *color_delim, *color_bg, *separator, *items;
char *result;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 15)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -15);
hidden = lua_tostring (lua_current_interpreter, -14);
priority = lua_tostring (lua_current_interpreter, -13);
@@ -4693,7 +4693,7 @@ weechat_lua_api_bar_new (lua_State *L)
color_bg = lua_tostring (lua_current_interpreter, -3);
separator = lua_tostring (lua_current_interpreter, -2);
items = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_bar_new (name,
hidden,
priority,
@@ -4709,7 +4709,7 @@ weechat_lua_api_bar_new (lua_State *L)
color_bg,
separator,
items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4721,19 +4721,19 @@ static int
weechat_lua_api_bar_set (lua_State *L)
{
const char *bar, *property, *value;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
bar = lua_tostring (lua_current_interpreter, -3);
property = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_bar_set (script_str2ptr (bar),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4745,15 +4745,15 @@ static int
weechat_lua_api_bar_update (lua_State *L)
{
const char *name;
-
+
API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
name = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_bar_update (name);
-
+
API_RETURN_OK;
}
@@ -4765,15 +4765,15 @@ static int
weechat_lua_api_bar_remove (lua_State *L)
{
const char *bar;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
bar = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_bar_remove (script_str2ptr (bar));
-
+
API_RETURN_OK;
}
@@ -4785,14 +4785,14 @@ static int
weechat_lua_api_command (lua_State *L)
{
const char *buffer, *command;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = lua_tostring (lua_current_interpreter, -2);
command = lua_tostring (lua_current_interpreter, -1);
-
+
script_api_command (weechat_lua_plugin,
lua_current_script,
script_str2ptr (buffer),
@@ -4809,16 +4809,16 @@ static int
weechat_lua_api_info_get (lua_State *L)
{
const char *info_name, *arguments, *result;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = lua_tostring (lua_current_interpreter, -2);
arguments = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_info_get (info_name, arguments);
-
+
API_RETURN_STRING(result);
}
@@ -4831,24 +4831,24 @@ weechat_lua_api_info_get_hashtable (lua_State *L)
{
const char *info_name;
struct t_hashtable *table, *result_hashtable;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = lua_tostring (lua_current_interpreter, -2);
table = weechat_lua_tohashtable (lua_current_interpreter, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (info_name, table);
-
+
weechat_lua_pushhashtable (lua_current_interpreter, result_hashtable);
-
+
if (table)
weechat_hashtable_free (table);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
return 1;
}
@@ -4860,11 +4860,11 @@ static int
weechat_lua_api_infolist_new (lua_State *L)
{
char *result;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4877,15 +4877,15 @@ weechat_lua_api_infolist_new_item (lua_State *L)
{
const char *infolist;
char *result;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4900,19 +4900,19 @@ weechat_lua_api_infolist_new_var_integer (lua_State *L)
const char *infolist, *name;
char *result;
int value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
value = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4926,19 +4926,19 @@ weechat_lua_api_infolist_new_var_string (lua_State *L)
{
const char *infolist, *name, *value;
char *result;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4952,19 +4952,19 @@ weechat_lua_api_infolist_new_var_pointer (lua_State *L)
{
const char *infolist, *name, *value;
char *result;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
value = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4978,19 +4978,19 @@ weechat_lua_api_infolist_new_var_time (lua_State *L)
const char *infolist, *name;
char *result;
int value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -2);
value = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5003,19 +5003,19 @@ weechat_lua_api_infolist_get (lua_State *L)
{
const char *name, *pointer, *arguments;
char *result;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
arguments = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5028,15 +5028,15 @@ weechat_lua_api_infolist_next (lua_State *L)
{
const char *infolist;
int value;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_infolist_next (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -5049,15 +5049,15 @@ weechat_lua_api_infolist_prev (lua_State *L)
{
const char *infolist;
int value;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_infolist_prev (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -5070,15 +5070,15 @@ static int
weechat_lua_api_infolist_reset_item_cursor (lua_State *L)
{
const char *infolist;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5090,15 +5090,15 @@ static int
weechat_lua_api_infolist_fields (lua_State *L)
{
const char *infolist, *result;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_infolist_fields (script_str2ptr (infolist));
-
+
API_RETURN_STRING(result);
}
@@ -5111,17 +5111,17 @@ weechat_lua_api_infolist_integer (lua_State *L)
{
const char *infolist, *variable;
int value;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
-
+
API_RETURN_INT(value);
}
@@ -5133,17 +5133,17 @@ static int
weechat_lua_api_infolist_string (lua_State *L)
{
const char *infolist, *variable, *result;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
-
+
API_RETURN_STRING(result);
}
@@ -5156,17 +5156,17 @@ weechat_lua_api_infolist_pointer (lua_State *L)
{
const char *infolist, *variable;
char *result;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5180,19 +5180,19 @@ weechat_lua_api_infolist_time (lua_State *L)
const char *infolist, *variable;
time_t time;
char timebuffer[64], *result;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = lua_tostring (lua_current_interpreter, -2);
variable = lua_tostring (lua_current_interpreter, -1);
-
+
time = weechat_infolist_time (script_str2ptr (infolist),
variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5204,15 +5204,15 @@ static int
weechat_lua_api_infolist_free (lua_State *L)
{
const char *infolist;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_infolist_free (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5225,15 +5225,15 @@ weechat_lua_api_hdata_get (lua_State *L)
{
const char *name;
char *result;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_hdata_get (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5246,16 +5246,16 @@ weechat_lua_api_hdata_get_var_offset (lua_State *L)
{
const char *hdata, *name;
int value;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
-
+
API_RETURN_INT(value);
}
@@ -5268,16 +5268,16 @@ static int
weechat_lua_api_hdata_get_var_type_string (lua_State *L)
{
const char *hdata, *name, *result;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5289,16 +5289,16 @@ static int
weechat_lua_api_hdata_get_var_hdata (lua_State *L)
{
const char *hdata, *name, *result;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5311,17 +5311,17 @@ weechat_lua_api_hdata_get_list (lua_State *L)
{
const char *hdata, *name;
char *result;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5335,19 +5335,19 @@ weechat_lua_api_hdata_move (lua_State *L)
const char *hdata, *pointer;
char *result;
int count;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
count = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5361,19 +5361,19 @@ weechat_lua_api_hdata_integer (lua_State *L)
{
const char *hdata, *pointer, *name;
int value;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_INT(value);
}
@@ -5387,19 +5387,19 @@ weechat_lua_api_hdata_long (lua_State *L)
{
const char *hdata, *pointer, *name;
long value;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_LONG(value);
}
@@ -5412,19 +5412,19 @@ static int
weechat_lua_api_hdata_string (lua_State *L)
{
const char *hdata, *pointer, *name, *result;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_STRING(result);
}
@@ -5438,19 +5438,19 @@ weechat_lua_api_hdata_pointer (lua_State *L)
{
const char *hdata, *pointer, *name;
char *result;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5465,21 +5465,21 @@ weechat_lua_api_hdata_time (lua_State *L)
const char *hdata, *pointer, *name;
time_t time;
char timebuffer[64], *result;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
-
+
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5491,16 +5491,16 @@ static int
weechat_lua_api_hdata_get_string (lua_State *L)
{
const char *hdata, *property, *result;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
-
+
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
-
+
API_RETURN_STRING(result);
}
@@ -5514,16 +5514,16 @@ weechat_lua_api_upgrade_new (lua_State *L)
const char *filename;
char *result;
int write;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
filename = lua_tostring (lua_current_interpreter, -2);
write = lua_tonumber (lua_current_interpreter, -1);
-
+
result = script_ptr2str (weechat_upgrade_new (filename, write));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5536,19 +5536,19 @@ weechat_lua_api_upgrade_write_object (lua_State *L)
{
const char *upgrade_file, *infolist;
int object_id, rc;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
upgrade_file = lua_tostring (lua_current_interpreter, -3);
object_id = lua_tonumber (lua_current_interpreter, -2);
infolist = lua_tostring (lua_current_interpreter, -1);
-
+
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
-
+
API_RETURN_INT(rc);
}
@@ -5566,23 +5566,23 @@ weechat_lua_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5594,10 +5594,10 @@ weechat_lua_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -5610,22 +5610,22 @@ weechat_lua_api_upgrade_read (lua_State *L)
{
const char *upgrade_file, *function, *data;
int rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_EMPTY);
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
upgrade_file = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
-
+
rc = script_api_upgrade_read (weechat_lua_plugin,
lua_current_script,
script_str2ptr (upgrade_file),
&weechat_lua_api_upgrade_read_cb,
function,
data);
-
+
API_RETURN_INT(rc);
}
@@ -5637,15 +5637,15 @@ static int
weechat_lua_api_upgrade_close (lua_State *L)
{
const char *upgrade_file;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (lua_gettop (lua_current_interpreter) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
upgrade_file = lua_tostring (lua_current_interpreter, -1);
-
+
weechat_upgrade_close (script_str2ptr (upgrade_file));
-
+
API_RETURN_OK;
}
@@ -5658,7 +5658,7 @@ weechat_lua_api_constant_weechat_rc_ok (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK);
return 1;
}
@@ -5668,7 +5668,7 @@ weechat_lua_api_constant_weechat_rc_ok_eat (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK_EAT);
return 1;
}
@@ -5678,7 +5678,7 @@ weechat_lua_api_constant_weechat_rc_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_ERROR);
return 1;
}
@@ -5688,7 +5688,7 @@ weechat_lua_api_constant_weechat_config_read_ok (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_READ_OK);
return 1;
}
@@ -5698,7 +5698,7 @@ weechat_lua_api_constant_weechat_config_read_memory_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_READ_MEMORY_ERROR);
return 1;
}
@@ -5708,7 +5708,7 @@ weechat_lua_api_constant_weechat_config_read_file_not_found (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_READ_FILE_NOT_FOUND);
return 1;
}
@@ -5718,7 +5718,7 @@ weechat_lua_api_constant_weechat_config_write_ok (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_WRITE_OK);
return 1;
}
@@ -5728,7 +5728,7 @@ weechat_lua_api_constant_weechat_config_write_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_WRITE_ERROR);
return 1;
}
@@ -5738,7 +5738,7 @@ weechat_lua_api_constant_weechat_config_write_memory_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_WRITE_MEMORY_ERROR);
return 1;
}
@@ -5748,7 +5748,7 @@ weechat_lua_api_constant_weechat_config_option_set_ok_changed (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_SET_OK_CHANGED);
return 1;
}
@@ -5758,7 +5758,7 @@ weechat_lua_api_constant_weechat_config_option_set_ok_same_value (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE);
return 1;
}
@@ -5768,7 +5768,7 @@ weechat_lua_api_constant_weechat_config_option_set_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_SET_ERROR);
return 1;
}
@@ -5778,7 +5778,7 @@ weechat_lua_api_constant_weechat_config_option_set_option_not_found (lua_State *
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND);
return 1;
}
@@ -5788,7 +5788,7 @@ weechat_lua_api_constant_weechat_config_option_unset_ok_no_reset (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET);
return 1;
}
@@ -5798,7 +5798,7 @@ weechat_lua_api_constant_weechat_config_option_unset_ok_reset (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_UNSET_OK_RESET);
return 1;
}
@@ -5808,7 +5808,7 @@ weechat_lua_api_constant_weechat_config_option_unset_ok_removed (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED);
return 1;
}
@@ -5818,7 +5818,7 @@ weechat_lua_api_constant_weechat_config_option_unset_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_CONFIG_OPTION_UNSET_ERROR);
return 1;
}
@@ -5828,7 +5828,7 @@ weechat_lua_api_constant_weechat_list_pos_sort (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_LIST_POS_SORT);
return 1;
}
@@ -5838,7 +5838,7 @@ weechat_lua_api_constant_weechat_list_pos_beginning (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_LIST_POS_BEGINNING);
return 1;
}
@@ -5848,7 +5848,7 @@ weechat_lua_api_constant_weechat_list_pos_end (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_LIST_POS_END);
return 1;
}
@@ -5858,7 +5858,7 @@ weechat_lua_api_constant_weechat_hotlist_low (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOTLIST_LOW);
return 1;
}
@@ -5868,7 +5868,7 @@ weechat_lua_api_constant_weechat_hotlist_message (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOTLIST_MESSAGE);
return 1;
}
@@ -5878,7 +5878,7 @@ weechat_lua_api_constant_weechat_hotlist_private (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOTLIST_PRIVATE);
return 1;
}
@@ -5888,7 +5888,7 @@ weechat_lua_api_constant_weechat_hotlist_highlight (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOTLIST_HIGHLIGHT);
return 1;
}
@@ -5898,7 +5898,7 @@ weechat_lua_api_constant_weechat_hook_process_running (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_PROCESS_RUNNING);
return 1;
}
@@ -5908,7 +5908,7 @@ weechat_lua_api_constant_weechat_hook_process_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_PROCESS_ERROR);
return 1;
}
@@ -5918,7 +5918,7 @@ weechat_lua_api_constant_weechat_hook_connect_ok (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_OK);
return 1;
}
@@ -5928,7 +5928,7 @@ weechat_lua_api_constant_weechat_hook_connect_address_not_found (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND);
return 1;
}
@@ -5938,7 +5938,7 @@ weechat_lua_api_constant_weechat_hook_connect_ip_address_not_found (lua_State *L
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND);
return 1;
}
@@ -5948,7 +5948,7 @@ weechat_lua_api_constant_weechat_hook_connect_connection_refused (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED);
return 1;
}
@@ -5958,7 +5958,7 @@ weechat_lua_api_constant_weechat_hook_connect_proxy_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_PROXY_ERROR);
return 1;
}
@@ -5968,7 +5968,7 @@ weechat_lua_api_constant_weechat_hook_connect_local_hostname_error (lua_State *L
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR);
return 1;
}
@@ -5978,7 +5978,7 @@ weechat_lua_api_constant_weechat_hook_connect_gnutls_init_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR);
return 1;
}
@@ -5988,7 +5988,7 @@ weechat_lua_api_constant_weechat_hook_connect_gnutls_handshake_error (lua_State
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR);
return 1;
}
@@ -5998,7 +5998,7 @@ weechat_lua_api_constant_weechat_hook_connect_memory_error (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
return 1;
}
@@ -6008,7 +6008,7 @@ weechat_lua_api_constant_weechat_hook_signal_string (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOOK_SIGNAL_STRING);
return 1;
}
@@ -6018,7 +6018,7 @@ weechat_lua_api_constant_weechat_hook_signal_int (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOOK_SIGNAL_INT);
return 1;
}
@@ -6028,7 +6028,7 @@ weechat_lua_api_constant_weechat_hook_signal_pointer (lua_State *L)
{
/* make C compiler happy */
(void) L;
-
+
lua_pushstring (lua_current_interpreter, WEECHAT_HOOK_SIGNAL_POINTER);
return 1;
}
@@ -6215,13 +6215,13 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "upgrade_write_object", &weechat_lua_api_upgrade_write_object },
{ "upgrade_read", &weechat_lua_api_upgrade_read },
{ "upgrade_close", &weechat_lua_api_upgrade_close },
-
+
/* define constants as function which returns values */
-
+
{ "WEECHAT_RC_OK", &weechat_lua_api_constant_weechat_rc_ok },
{ "WEECHAT_RC_OK_EAT", &weechat_lua_api_constant_weechat_rc_ok_eat },
{ "WEECHAT_RC_ERROR", &weechat_lua_api_constant_weechat_rc_error },
-
+
{ "WEECHAT_CONFIG_READ_OK", &weechat_lua_api_constant_weechat_config_read_ok },
{ "WEECHAT_CONFIG_READ_MEMORY_ERROR", &weechat_lua_api_constant_weechat_config_read_memory_error },
{ "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", &weechat_lua_api_constant_weechat_config_read_file_not_found },
@@ -6236,19 +6236,19 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", &weechat_lua_api_constant_weechat_config_option_unset_ok_reset },
{ "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", &weechat_lua_api_constant_weechat_config_option_unset_ok_removed },
{ "WEECHAT_CONFIG_OPTION_UNSET_ERROR", &weechat_lua_api_constant_weechat_config_option_unset_error },
-
+
{ "WEECHAT_LIST_POS_SORT", &weechat_lua_api_constant_weechat_list_pos_sort },
{ "WEECHAT_LIST_POS_BEGINNING", &weechat_lua_api_constant_weechat_list_pos_beginning },
{ "WEECHAT_LIST_POS_END", &weechat_lua_api_constant_weechat_list_pos_end },
-
+
{ "WEECHAT_HOTLIST_LOW", &weechat_lua_api_constant_weechat_hotlist_low },
{ "WEECHAT_HOTLIST_MESSAGE", &weechat_lua_api_constant_weechat_hotlist_message },
{ "WEECHAT_HOTLIST_PRIVATE", &weechat_lua_api_constant_weechat_hotlist_private },
{ "WEECHAT_HOTLIST_HIGHLIGHT", &weechat_lua_api_constant_weechat_hotlist_highlight },
-
+
{ "WEECHAT_HOOK_PROCESS_RUNNING", &weechat_lua_api_constant_weechat_hook_process_running },
{ "WEECHAT_HOOK_PROCESS_ERROR", &weechat_lua_api_constant_weechat_hook_process_error },
-
+
{ "WEECHAT_HOOK_CONNECT_OK", &weechat_lua_api_constant_weechat_hook_connect_ok },
{ "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", &weechat_lua_api_constant_weechat_hook_connect_address_not_found },
{ "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", &weechat_lua_api_constant_weechat_hook_connect_ip_address_not_found },
@@ -6258,10 +6258,10 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", &weechat_lua_api_constant_weechat_hook_connect_gnutls_init_error },
{ "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", &weechat_lua_api_constant_weechat_hook_connect_gnutls_handshake_error },
{ "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", &weechat_lua_api_constant_weechat_hook_connect_memory_error },
-
+
{ "WEECHAT_HOOK_SIGNAL_STRING", &weechat_lua_api_constant_weechat_hook_signal_string },
{ "WEECHAT_HOOK_SIGNAL_INT", &weechat_lua_api_constant_weechat_hook_signal_int },
{ "WEECHAT_HOOK_SIGNAL_POINTER", &weechat_lua_api_constant_weechat_hook_signal_pointer },
-
+
{ NULL, NULL }
};
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index a4f4227f7..a02f49c53 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -81,12 +81,12 @@ weechat_lua_hashtable_map_cb (void *data,
const void *value)
{
lua_State *interpreter;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
interpreter = (lua_State *)data;
-
+
lua_pushstring (interpreter, (char *)key);
lua_pushstring (interpreter, (char *)value);
lua_rawset (interpreter, -3);
@@ -100,7 +100,7 @@ void
weechat_lua_pushhashtable (lua_State *interpreter, struct t_hashtable *hashtable)
{
lua_newtable (interpreter);
-
+
weechat_hashtable_map (hashtable,
&weechat_lua_hashtable_map_cb,
interpreter);
@@ -118,7 +118,7 @@ struct t_hashtable *
weechat_lua_tohashtable (lua_State *interpreter, int index, int hashtable_size)
{
struct t_hashtable *hashtable;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -126,7 +126,7 @@ weechat_lua_tohashtable (lua_State *interpreter, int index, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
lua_pushnil (interpreter);
while (lua_next (interpreter, index - 1) != 0)
{
@@ -136,7 +136,7 @@ weechat_lua_tohashtable (lua_State *interpreter, int index, int hashtable_size)
/* remove value from stack (keep key for next iteration) */
lua_pop (interpreter, 1);
}
-
+
return hashtable;
}
@@ -153,10 +153,10 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
int argc, i, *ret_i;
lua_State *old_lua_current_interpreter;
struct t_plugin_script *old_lua_current_script;
-
+
old_lua_current_interpreter = lua_current_interpreter;
lua_current_interpreter = script->interpreter;
-
+
lua_getglobal (lua_current_interpreter, function);
old_lua_current_script = lua_current_script;
@@ -182,7 +182,7 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
}
}
}
-
+
if (lua_pcall (lua_current_interpreter, argc, 1, 0) != 0)
{
weechat_printf (NULL,
@@ -196,7 +196,7 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
lua_current_interpreter = old_lua_current_interpreter;
return NULL;
}
-
+
if (ret_type == WEECHAT_SCRIPT_EXEC_STRING)
ret_value = strdup ((char *) lua_tostring (lua_current_interpreter, -1));
else if (ret_type == WEECHAT_SCRIPT_EXEC_INT)
@@ -218,10 +218,10 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
lua_current_interpreter = old_lua_current_interpreter;
return NULL;
}
-
+
lua_current_script = old_lua_current_script;
lua_current_interpreter = old_lua_current_interpreter;
-
+
return ret_value;
}
@@ -242,7 +242,7 @@ weechat_lua_load (const char *filename)
"io.stdout = weechat_outputs\n"
"io.stderr = weechat_outputs\n"
};
-
+
if ((fp = fopen (filename, "r")) == NULL)
{
weechat_printf (NULL,
@@ -250,17 +250,17 @@ weechat_lua_load (const char *filename)
weechat_prefix ("error"), LUA_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
LUA_PLUGIN_NAME, filename);
}
-
+
lua_current_script = NULL;
lua_registered_script = NULL;
-
+
lua_current_interpreter = lua_open ();
if (lua_current_interpreter == NULL)
@@ -283,7 +283,7 @@ weechat_lua_load (const char *filename)
luaopen_io (lua_current_interpreter);
luaopen_debug (lua_current_interpreter);
#endif
-
+
luaL_openlib (lua_current_interpreter, "weechat", weechat_lua_api_funcs, 0);
#ifdef LUA_VERSION_NUM
@@ -297,9 +297,9 @@ weechat_lua_load (const char *filename)
"and stderr"),
weechat_prefix ("error"), LUA_PLUGIN_NAME);
}
-
+
lua_current_script_filename = filename;
-
+
if (luaL_loadfile (lua_current_interpreter, filename) != 0)
{
weechat_printf (NULL,
@@ -313,7 +313,7 @@ weechat_lua_load (const char *filename)
fclose (fp);
return 0;
}
-
+
if (lua_pcall (lua_current_interpreter, 0, 0, 0) != 0)
{
weechat_printf (NULL,
@@ -333,7 +333,7 @@ weechat_lua_load (const char *filename)
return 0;
}
fclose (fp);
-
+
if (!lua_registered_script)
{
weechat_printf (NULL,
@@ -344,9 +344,9 @@ weechat_lua_load (const char *filename)
return 0;
}
lua_current_script = lua_registered_script;
-
+
lua_current_script->interpreter = (lua_State *) lua_current_interpreter;
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -356,7 +356,7 @@ weechat_lua_load (const char *filename)
lua_current_script,
&weechat_lua_api_buffer_input_data_cb,
&weechat_lua_api_buffer_close_cb);
-
+
return 1;
}
@@ -369,7 +369,7 @@ weechat_lua_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_lua_load (filename);
}
@@ -382,14 +382,14 @@ weechat_lua_unload (struct t_plugin_script *script)
{
int *rc;
void *interpreter;
-
+
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
LUA_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *)weechat_lua_exec (script,
@@ -399,15 +399,15 @@ weechat_lua_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
interpreter = script->interpreter;
-
+
if (lua_current_script == script)
lua_current_script = (lua_current_script->prev_script) ?
lua_current_script->prev_script : lua_current_script->next_script;
-
+
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, script);
-
+
lua_close (interpreter);
}
@@ -419,7 +419,7 @@ void
weechat_lua_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_lua_plugin, lua_scripts, name);
if (ptr_script)
{
@@ -445,7 +445,7 @@ weechat_lua_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_lua_plugin, lua_scripts, name);
if (ptr_script)
{
@@ -490,11 +490,11 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc == 1)
{
script_display_list (weechat_lua_plugin, lua_scripts,
@@ -565,7 +565,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_prefix ("error"), LUA_PLUGIN_NAME, "lua");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -582,9 +582,9 @@ weechat_lua_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_lua_plugin, completion, lua_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -598,17 +598,17 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "lua_script") == 0)
{
return script_infolist_list_scripts (weechat_lua_plugin,
lua_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -624,13 +624,13 @@ weechat_lua_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, LUA_PLUGIN_NAME) == 0))
{
script_print_log (weechat_lua_plugin, lua_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -646,10 +646,10 @@ weechat_lua_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (lua_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -681,7 +681,7 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
&lua_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -697,7 +697,7 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "lua_script_install") == 0)
@@ -717,7 +717,7 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
&lua_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -729,7 +729,7 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_lua_plugin = plugin;
-
+
lua_quiet = 1;
script_init (weechat_lua_plugin,
argc,
@@ -742,10 +742,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_lua_signal_script_action_cb,
&weechat_lua_load_cb);
lua_quiet = 0;
-
+
script_display_short_list (weechat_lua_plugin,
lua_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -761,6 +761,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
lua_quiet = 1;
script_end (plugin, &lua_scripts, &weechat_lua_unload_all);
lua_quiet = 0;
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index c1fa7cbba..85f87e2d6 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -96,17 +96,17 @@ XS (XS_weechat_api_register)
char *name, *author, *version, *license, *description, *shutdown_func;
char *charset;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
perl_current_script = NULL;
perl_registered_script = NULL;
-
+
if (items < 7)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
name = SvPV_nolen (ST (0));
author = SvPV_nolen (ST (1));
version = SvPV_nolen (ST (2));
@@ -114,7 +114,7 @@ XS (XS_weechat_api_register)
description = SvPV_nolen (ST (4));
shutdown_func = SvPV_nolen (ST (5));
charset = SvPV_nolen (ST (6));
-
+
if (script_search (weechat_perl_plugin, perl_scripts, name))
{
/* error: another script already exists with this name! */
@@ -125,7 +125,7 @@ XS (XS_weechat_api_register)
weechat_prefix ("error"), PERL_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
perl_current_script = script_add (weechat_perl_plugin,
&perl_scripts, &last_perl_script,
@@ -148,7 +148,7 @@ XS (XS_weechat_api_register)
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -160,13 +160,13 @@ XS (XS_weechat_api_plugin_get_name)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_plugin_get_name (script_str2ptr (SvPV_nolen (ST (0)))); /* plugin */
-
+
API_RETURN_STRING(result);
}
@@ -177,14 +177,14 @@ XS (XS_weechat_api_plugin_get_name)
XS (XS_weechat_api_charset_set)
{
dXSARGS;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_charset_set (perl_current_script,
SvPV_nolen (ST (0))); /* charset */
-
+
API_RETURN_OK;
}
@@ -196,16 +196,16 @@ XS (XS_weechat_api_iconv_to_internal)
{
char *result, *charset, *string;
dXSARGS;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
charset = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
-
+
result = weechat_iconv_to_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -218,16 +218,16 @@ XS (XS_weechat_api_iconv_from_internal)
{
char *result, *charset, *string;
dXSARGS;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
charset = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
-
+
result = weechat_iconv_from_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -239,13 +239,13 @@ XS (XS_weechat_api_gettext)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_gettext (SvPV_nolen (ST (0))); /* string */
-
+
API_RETURN_STRING(result);
}
@@ -258,17 +258,17 @@ XS (XS_weechat_api_ngettext)
char *single, *plural;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
single = SvPV_nolen (ST (0));
plural = SvPV_nolen (ST (1));
-
+
result = weechat_ngettext (single, plural,
SvIV (ST (2))); /* count */
-
+
API_RETURN_STRING(result);
}
@@ -282,15 +282,15 @@ XS (XS_weechat_api_string_match)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_match (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1)), /* mask */
SvIV (ST (2))); /* case_sensitive */
-
+
API_RETURN_INT(value);
}
@@ -304,14 +304,14 @@ XS (XS_weechat_api_string_has_highlight)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1))); /* highlight_words */
-
+
API_RETURN_INT(value);
}
@@ -326,14 +326,14 @@ XS (XS_weechat_api_string_has_highlight_regex)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight_regex (SvPV_nolen (ST (0)), /* string */
SvPV_nolen (ST (1))); /* regex */
-
+
API_RETURN_INT(value);
}
@@ -347,13 +347,13 @@ XS (XS_weechat_api_string_mask_to_regex)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_mask_to_regex (SvPV_nolen (ST (0))); /* mask */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -365,16 +365,16 @@ XS (XS_weechat_api_string_remove_color)
{
char *result, *string, *replacement;
dXSARGS;
-
+
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
string = SvPV_nolen (ST (0));
replacement = SvPV_nolen (ST (1));
-
+
result = weechat_string_remove_color (string, replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -387,13 +387,13 @@ XS (XS_weechat_api_string_is_command_char)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_is_command_char (SvPV_nolen (ST (0))); /* string */
-
+
API_RETURN_INT(value);
}
@@ -406,13 +406,13 @@ XS (XS_weechat_api_string_input_for_buffer)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_input_for_buffer (SvPV_nolen (ST (0))); /* string */
-
+
API_RETURN_STRING(result);
}
@@ -423,15 +423,15 @@ XS (XS_weechat_api_string_input_for_buffer)
XS (XS_weechat_api_mkdir_home)
{
dXSARGS;
-
+
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_home (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -442,15 +442,15 @@ XS (XS_weechat_api_mkdir_home)
XS (XS_weechat_api_mkdir)
{
dXSARGS;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -462,15 +462,15 @@ XS (XS_weechat_api_mkdir)
XS (XS_weechat_api_mkdir_parents)
{
dXSARGS;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_parents (SvPV_nolen (ST (0)), /* directory */
SvIV (ST (1)))) /* mode */
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -482,15 +482,15 @@ XS (XS_weechat_api_list_new)
{
char *result;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
(void) cv;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -502,21 +502,21 @@ XS (XS_weechat_api_list_add)
{
char *result, *weelist, *data, *where, *user_data;
dXSARGS;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (items < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
where = SvPV_nolen (ST (2));
user_data = SvPV_nolen (ST (3));
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -528,17 +528,17 @@ XS (XS_weechat_api_list_search)
{
char *result, *weelist, *data;
dXSARGS;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -551,16 +551,16 @@ XS (XS_weechat_api_list_search_pos)
char *weelist, *data;
int pos;
dXSARGS;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
-
+
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -572,17 +572,17 @@ XS (XS_weechat_api_list_casesearch)
{
char *result, *weelist, *data;
dXSARGS;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -596,16 +596,16 @@ XS (XS_weechat_api_list_casesearch_pos)
char *weelist, *data;
int pos;
dXSARGS;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = SvPV_nolen (ST (0));
data = SvPV_nolen (ST (1));
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -617,14 +617,14 @@ XS (XS_weechat_api_list_get)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (SvPV_nolen (ST (0))), /* weelist */
SvIV (ST (1)))); /* position */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -636,16 +636,16 @@ XS (XS_weechat_api_list_set)
{
char *item, *new_value;
dXSARGS;
-
+
API_FUNC(1, "list_set", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
item = SvPV_nolen (ST (0));
new_value = SvPV_nolen (ST (1));
-
+
weechat_list_set (script_str2ptr (item), new_value);
-
+
API_RETURN_OK;
}
@@ -657,13 +657,13 @@ XS (XS_weechat_api_list_next)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (SvPV_nolen (ST (0))))); /* item */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -675,13 +675,13 @@ XS (XS_weechat_api_list_prev)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (SvPV_nolen (ST (0))))); /* item */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -693,13 +693,13 @@ XS (XS_weechat_api_list_string)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_list_string (script_str2ptr (SvPV_nolen (ST (0)))); /* item */
-
+
API_RETURN_STRING(result);
}
@@ -711,13 +711,13 @@ XS (XS_weechat_api_list_size)
{
int size;
dXSARGS;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
size = weechat_list_size (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
-
+
API_RETURN_INT(size);
}
@@ -729,16 +729,16 @@ XS (XS_weechat_api_list_remove)
{
char *weelist, *item;
dXSARGS;
-
+
API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weelist = SvPV_nolen (ST (0));
item = SvPV_nolen (ST (1));
-
+
weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -749,13 +749,13 @@ XS (XS_weechat_api_list_remove)
XS (XS_weechat_api_list_remove_all)
{
dXSARGS;
-
+
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
-
+
API_RETURN_OK;
}
@@ -766,13 +766,13 @@ XS (XS_weechat_api_list_remove_all)
XS (XS_weechat_api_list_free)
{
dXSARGS;
-
+
API_FUNC(1, "list_free", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_free (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */
-
+
API_RETURN_OK;
}
@@ -788,19 +788,19 @@ weechat_perl_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -813,7 +813,7 @@ weechat_perl_api_config_reload_cb (void *data,
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -825,22 +825,22 @@ XS (XS_weechat_api_config_new)
{
char *result, *name, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_config_new (weechat_perl_plugin,
perl_current_script,
name,
&weechat_perl_api_config_reload_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -859,7 +859,7 @@ weechat_perl_api_config_section_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -869,12 +869,12 @@ weechat_perl_api_config_section_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -886,10 +886,10 @@ weechat_perl_api_config_section_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -906,7 +906,7 @@ weechat_perl_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -914,7 +914,7 @@ weechat_perl_api_config_section_write_cb (void *data,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -929,10 +929,10 @@ weechat_perl_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -950,20 +950,20 @@ weechat_perl_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -973,10 +973,10 @@ weechat_perl_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -995,9 +995,9 @@ weechat_perl_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1005,12 +1005,12 @@ weechat_perl_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1022,10 +1022,10 @@ weechat_perl_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1043,21 +1043,21 @@ weechat_perl_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1071,10 +1071,10 @@ weechat_perl_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1088,13 +1088,13 @@ XS (XS_weechat_api_config_new_section)
char *function_write, *data_write, *function_write_default;
char *data_write_default, *function_create_option, *data_create_option;
char *function_delete_option, *data_delete_option;
-
+
dXSARGS;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (items < 14)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
cfg_file = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
function_read = SvPV_nolen (ST (4));
@@ -1107,7 +1107,7 @@ XS (XS_weechat_api_config_new_section)
data_create_option = SvPV_nolen (ST (11));
function_delete_option = SvPV_nolen (ST (12));
data_delete_option = SvPV_nolen (ST (13));
-
+
result = script_ptr2str (script_api_config_new_section (weechat_perl_plugin,
perl_current_script,
script_str2ptr (cfg_file),
@@ -1129,7 +1129,7 @@ XS (XS_weechat_api_config_new_section)
&weechat_perl_api_config_section_delete_option_cb,
function_delete_option,
data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1141,17 +1141,17 @@ XS (XS_weechat_api_config_search_section)
{
char *result, *config_file, *section_name;
dXSARGS;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = SvPV_nolen (ST (0));
section_name = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1169,20 +1169,20 @@ weechat_perl_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1192,10 +1192,10 @@ weechat_perl_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1211,22 +1211,22 @@ weechat_perl_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1244,22 +1244,22 @@ weechat_perl_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1276,11 +1276,11 @@ XS (XS_weechat_api_config_new_option)
char *function_check_value, *data_check_value, *function_change;
char *data_change, *function_delete, *data_delete;
dXSARGS;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (items < 17)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = SvPV_nolen (ST (0));
section = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
@@ -1295,7 +1295,7 @@ XS (XS_weechat_api_config_new_option)
data_change = SvPV_nolen (ST (14));
function_delete = SvPV_nolen (ST (15));
data_delete = SvPV_nolen (ST (16));
-
+
result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin,
perl_current_script,
script_str2ptr (config_file),
@@ -1318,7 +1318,7 @@ XS (XS_weechat_api_config_new_option)
&weechat_perl_api_config_option_delete_cb,
function_delete,
data_delete));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1330,19 +1330,19 @@ XS (XS_weechat_api_config_search_option)
{
char *result, *config_file, *section, *option_name;
dXSARGS;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = SvPV_nolen (ST (0));
section = SvPV_nolen (ST (1));
option_name = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1354,13 +1354,13 @@ XS (XS_weechat_api_config_string_to_boolean)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_string_to_boolean (SvPV_nolen (ST (0))); /* text */
-
+
API_RETURN_INT(value);
}
@@ -1373,16 +1373,16 @@ XS (XS_weechat_api_config_option_reset)
int rc;
char *option;
dXSARGS;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = SvPV_nolen (ST (0));
-
+
rc = weechat_config_option_reset (script_str2ptr (option),
SvIV (ST (1))); /* run_callback */
-
+
API_RETURN_INT(rc);
}
@@ -1395,18 +1395,18 @@ XS (XS_weechat_api_config_option_set)
int rc;
char *option, *new_value;
dXSARGS;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = SvPV_nolen (ST (0));
new_value = SvPV_nolen (ST (1));
-
+
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
SvIV (ST (2))); /* run_callback */
-
+
API_RETURN_INT(rc);
}
@@ -1419,16 +1419,16 @@ XS (XS_weechat_api_config_option_set_null)
int rc;
char *option;
dXSARGS;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = SvPV_nolen (ST (0));
-
+
rc = weechat_config_option_set_null (script_str2ptr (option),
SvIV (ST (1))); /* run_callback */
-
+
API_RETURN_INT(rc);
}
@@ -1441,15 +1441,15 @@ XS (XS_weechat_api_config_option_unset)
int rc;
char *option;
dXSARGS;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = SvPV_nolen (ST (0));
-
+
rc = weechat_config_option_unset (script_str2ptr (option));
-
+
API_RETURN_INT(rc);
}
@@ -1461,17 +1461,17 @@ XS (XS_weechat_api_config_option_rename)
{
char *option, *new_name;
dXSARGS;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = SvPV_nolen (ST (0));
new_name = SvPV_nolen (ST (1));
-
+
weechat_config_option_rename (script_str2ptr (option),
new_name);
-
+
API_RETURN_OK;
}
@@ -1483,13 +1483,13 @@ XS (XS_weechat_api_config_option_is_null)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1502,13 +1502,13 @@ XS (XS_weechat_api_config_option_default_is_null)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_default_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1520,13 +1520,13 @@ XS (XS_weechat_api_config_boolean)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1538,13 +1538,13 @@ XS (XS_weechat_api_config_boolean_default)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1556,13 +1556,13 @@ XS (XS_weechat_api_config_integer)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1574,13 +1574,13 @@ XS (XS_weechat_api_config_integer_default)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_INT(value);
}
@@ -1592,13 +1592,13 @@ XS (XS_weechat_api_config_string)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1610,13 +1610,13 @@ XS (XS_weechat_api_config_string_default)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1628,13 +1628,13 @@ XS (XS_weechat_api_config_color)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1646,13 +1646,13 @@ XS (XS_weechat_api_config_color_default)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1664,17 +1664,17 @@ XS (XS_weechat_api_config_write_option)
{
char *config_file, *option;
dXSARGS;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = SvPV_nolen (ST (0));
option = SvPV_nolen (ST (1));
-
+
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1686,18 +1686,18 @@ XS (XS_weechat_api_config_write_line)
{
char *config_file, *option_name, *value;
dXSARGS;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (items < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = SvPV_nolen (ST (0));
option_name = SvPV_nolen (ST (1));
value = SvPV_nolen (ST (2));
-
+
weechat_config_write_line (script_str2ptr (config_file), option_name,
"%s", value);
-
+
API_RETURN_OK;
}
@@ -1709,13 +1709,13 @@ XS (XS_weechat_api_config_write)
{
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_write (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -1727,13 +1727,13 @@ XS (XS_weechat_api_config_read)
{
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_read (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -1745,13 +1745,13 @@ XS (XS_weechat_api_config_reload)
{
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_reload (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -1762,15 +1762,15 @@ XS (XS_weechat_api_config_reload)
XS (XS_weechat_api_config_option_free)
{
dXSARGS;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_option_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* option */
-
+
API_RETURN_OK;
}
@@ -1782,15 +1782,15 @@ XS (XS_weechat_api_config_option_free)
XS (XS_weechat_api_config_section_free_options)
{
dXSARGS;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free_options (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* section */
-
+
API_RETURN_OK;
}
@@ -1801,15 +1801,15 @@ XS (XS_weechat_api_config_section_free_options)
XS (XS_weechat_api_config_section_free)
{
dXSARGS;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* section */
-
+
API_RETURN_OK;
}
@@ -1820,15 +1820,15 @@ XS (XS_weechat_api_config_section_free)
XS (XS_weechat_api_config_free)
{
dXSARGS;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_free (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */
-
+
API_RETURN_OK;
}
@@ -1840,13 +1840,13 @@ XS (XS_weechat_api_config_get)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_get (SvPV_nolen (ST (0))));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1858,15 +1858,15 @@ XS (XS_weechat_api_config_get_plugin)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_api_config_get_plugin (weechat_perl_plugin,
perl_current_script,
SvPV_nolen (ST (0)));
-
+
API_RETURN_STRING(result);
}
@@ -1879,17 +1879,17 @@ XS (XS_weechat_api_config_is_set_plugin)
char *option;
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = SvPV_nolen (ST (0));
-
+
rc = script_api_config_is_set_plugin (weechat_perl_plugin,
perl_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -1902,19 +1902,19 @@ XS (XS_weechat_api_config_set_plugin)
char *option, *value;
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = SvPV_nolen (ST (0));
value = SvPV_nolen (ST (1));
-
+
rc = script_api_config_set_plugin (weechat_perl_plugin,
perl_current_script,
option,
value);
-
+
API_RETURN_INT(rc);
}
@@ -1926,19 +1926,19 @@ XS (XS_weechat_api_config_set_desc_plugin)
{
char *option, *description;
dXSARGS;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
-
+
script_api_config_set_desc_plugin (weechat_perl_plugin,
perl_current_script,
option,
description);
-
+
API_RETURN_OK;
}
@@ -1951,13 +1951,13 @@ XS (XS_weechat_api_config_unset_plugin)
char *option;
int rc;
dXSARGS;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = SvPV_nolen (ST (0));
-
+
rc = script_api_config_unset_plugin (weechat_perl_plugin,
perl_current_script,
option);
@@ -1975,20 +1975,20 @@ XS (XS_weechat_api_key_bind)
struct t_hashtable *hashtable;
int num_keys;
dXSARGS;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (context, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_INT(num_keys);
}
@@ -2001,16 +2001,16 @@ XS (XS_weechat_api_key_unbind)
char *context, *key;
int num_keys;
dXSARGS;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = SvPV_nolen (ST (0));
key = SvPV_nolen (ST (1));
-
+
num_keys = weechat_key_unbind (context, key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2026,9 +2026,9 @@ XS (XS_weechat_api_prefix)
API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_prefix (SvPV_nolen (ST (0))); /* prefix */
-
+
API_RETURN_STRING(result);
}
@@ -2040,13 +2040,13 @@ XS (XS_weechat_api_color)
{
const char *result;
dXSARGS;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_color (SvPV_nolen (ST (0))); /* color */
-
+
API_RETURN_STRING(result);
}
@@ -2058,19 +2058,19 @@ XS (XS_weechat_api_print)
{
char *buffer, *message;
dXSARGS;
-
+
API_FUNC(0, "print", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
message = SvPV_nolen (ST (1));
-
+
script_api_printf (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2083,22 +2083,22 @@ XS (XS_weechat_api_print_date_tags)
{
char *buffer, *tags, *message;
dXSARGS;
-
+
API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (items < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
tags = SvPV_nolen (ST (2));
message = SvPV_nolen (ST (3));
-
+
script_api_printf_date_tags (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
SvIV (ST (1)),
tags,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2110,20 +2110,20 @@ XS (XS_weechat_api_print_y)
{
char *buffer, *message;
dXSARGS;
-
+
API_FUNC(1, "print_y", API_RETURN_ERROR);
if (items < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
message = SvPV_nolen (ST (2));
-
+
script_api_printf_y (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
SvIV (ST (1)),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2134,16 +2134,16 @@ XS (XS_weechat_api_print_y)
XS (XS_weechat_api_log_print)
{
dXSARGS;
-
+
API_FUNC(1, "log_print", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_log_printf (weechat_perl_plugin,
perl_current_script,
"%s", SvPV_nolen (ST (0))); /* message */
-
+
API_RETURN_OK;
}
@@ -2159,23 +2159,23 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2185,10 +2185,10 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2201,11 +2201,11 @@ XS (XS_weechat_api_hook_command)
char *result, *command, *description, *args, *args_description;
char *completion, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (items < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
args = SvPV_nolen (ST (2));
@@ -2213,7 +2213,7 @@ XS (XS_weechat_api_hook_command)
completion = SvPV_nolen (ST (4));
function = SvPV_nolen (ST (5));
data = SvPV_nolen (ST (6));
-
+
result = script_ptr2str (script_api_hook_command (weechat_perl_plugin,
perl_current_script,
command,
@@ -2224,7 +2224,7 @@ XS (XS_weechat_api_hook_command)
&weechat_perl_api_hook_command_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2240,20 +2240,20 @@ weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2263,10 +2263,10 @@ weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2278,22 +2278,22 @@ XS (XS_weechat_api_hook_command_run)
{
char *result, *command, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_perl_plugin,
perl_current_script,
command,
&weechat_perl_api_hook_command_run_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2308,22 +2308,22 @@ weechat_perl_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2331,10 +2331,10 @@ weechat_perl_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2346,11 +2346,11 @@ XS (XS_weechat_api_hook_timer)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (items < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_perl_plugin,
perl_current_script,
SvIV (ST (0)), /* interval */
@@ -2359,7 +2359,7 @@ XS (XS_weechat_api_hook_timer)
&weechat_perl_api_hook_timer_cb,
SvPV_nolen (ST (3)), /* perl function */
SvPV_nolen (ST (4)))); /* data */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2374,21 +2374,21 @@ weechat_perl_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2396,10 +2396,10 @@ weechat_perl_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2411,11 +2411,11 @@ XS (XS_weechat_api_hook_fd)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (items < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_perl_plugin,
perl_current_script,
SvIV (ST (0)), /* fd */
@@ -2425,7 +2425,7 @@ XS (XS_weechat_api_hook_fd)
&weechat_perl_api_hook_fd_cb,
SvPV_nolen (ST (4)), /* perl function */
SvPV_nolen (ST (5)))); /* data */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2442,24 +2442,24 @@ weechat_perl_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2467,10 +2467,10 @@ weechat_perl_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2482,15 +2482,15 @@ XS (XS_weechat_api_hook_process)
{
char *command, *function, *data, *result;
dXSARGS;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (items < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (2));
data = SvPV_nolen (ST (3));
-
+
result = script_ptr2str (script_api_hook_process (weechat_perl_plugin,
perl_current_script,
command,
@@ -2498,7 +2498,7 @@ XS (XS_weechat_api_hook_process)
&weechat_perl_api_hook_process_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2515,25 +2515,25 @@ weechat_perl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2541,10 +2541,10 @@ weechat_perl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2556,17 +2556,17 @@ XS (XS_weechat_api_hook_connect)
{
char *proxy, *address, *local_hostname, *function, *data, *result;
dXSARGS;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (items < 8)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
proxy = SvPV_nolen (ST (0));
address = SvPV_nolen (ST (1));
local_hostname = SvPV_nolen (ST (5));
function = SvPV_nolen (ST (6));
data = SvPV_nolen (ST (7));
-
+
result = script_ptr2str (script_api_hook_connect (weechat_perl_plugin,
perl_current_script,
proxy,
@@ -2582,7 +2582,7 @@ XS (XS_weechat_api_hook_connect)
&weechat_perl_api_hook_connect_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2602,16 +2602,16 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -2622,12 +2622,12 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2643,10 +2643,10 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2658,17 +2658,17 @@ XS (XS_weechat_api_hook_print)
{
char *result, *buffer, *tags, *message, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (items < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
tags = SvPV_nolen (ST (1));
message = SvPV_nolen (ST (2));
function = SvPV_nolen (ST (4));
data = SvPV_nolen (ST (5));
-
+
result = script_ptr2str (script_api_hook_print (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
@@ -2678,7 +2678,7 @@ XS (XS_weechat_api_hook_print)
&weechat_perl_api_hook_print_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2695,9 +2695,9 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -2720,12 +2720,12 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2735,10 +2735,10 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2750,22 +2750,22 @@ XS (XS_weechat_api_hook_signal)
{
char *result, *signal, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_signal (weechat_perl_plugin,
perl_current_script,
signal,
&weechat_perl_api_hook_signal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2778,11 +2778,11 @@ XS (XS_weechat_api_hook_signal_send)
char *signal, *type_data;
int number;
dXSARGS;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (items < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = SvPV_nolen (ST (0));
type_data = SvPV_nolen (ST (1));
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2807,7 +2807,7 @@ XS (XS_weechat_api_hook_signal_send)
script_str2ptr (SvPV_nolen (ST (2)))); /* signal_data */
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -2823,20 +2823,20 @@ weechat_perl_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssh", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2844,10 +2844,10 @@ weechat_perl_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2859,22 +2859,22 @@ XS (XS_weechat_api_hook_hsignal)
{
char *result, *signal, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_perl_plugin,
perl_current_script,
signal,
&weechat_perl_api_hook_hsignal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2887,20 +2887,20 @@ XS (XS_weechat_api_hook_hsignal_send)
char *signal;
struct t_hashtable *hashtable;
dXSARGS;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (signal, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_OK;
}
@@ -2915,20 +2915,20 @@ weechat_perl_api_hook_config_cb (void *data, const char *option, const char *val
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2936,10 +2936,10 @@ weechat_perl_api_hook_config_cb (void *data, const char *option, const char *val
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2951,22 +2951,22 @@ XS (XS_weechat_api_hook_config)
{
char *result, *option, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
option = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_config (weechat_perl_plugin,
perl_current_script,
option,
&weechat_perl_api_hook_config_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2983,21 +2983,21 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3009,10 +3009,10 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3024,16 +3024,16 @@ XS (XS_weechat_api_hook_completion)
{
char *result, *completion, *description, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (items < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
completion = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
function = SvPV_nolen (ST (2));
data = SvPV_nolen (ST (3));
-
+
result = script_ptr2str (script_api_hook_completion (weechat_perl_plugin,
perl_current_script,
completion,
@@ -3041,7 +3041,7 @@ XS (XS_weechat_api_hook_completion)
&weechat_perl_api_hook_completion_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3053,20 +3053,20 @@ XS (XS_weechat_api_hook_completion_list_add)
{
char *completion, *word, *where;
dXSARGS;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (items < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
completion = SvPV_nolen (ST (0));
word = SvPV_nolen (ST (1));
where = SvPV_nolen (ST (3));
-
+
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
SvIV (ST (2)), /* nick_completion */
where);
-
+
API_RETURN_OK;
}
@@ -3081,22 +3081,22 @@ weechat_perl_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3108,22 +3108,22 @@ XS (XS_weechat_api_hook_modifier)
{
char *result, *modifier, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
modifier = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_perl_plugin,
perl_current_script,
modifier,
&weechat_perl_api_hook_modifier_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3135,17 +3135,17 @@ XS (XS_weechat_api_hook_modifier_exec)
{
char *result, *modifier, *modifier_data, *string;
dXSARGS;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
modifier = SvPV_nolen (ST (0));
modifier_data = SvPV_nolen (ST (1));
string = SvPV_nolen (ST (2));
-
+
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3160,21 +3160,21 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3186,17 +3186,17 @@ XS (XS_weechat_api_hook_info)
{
char *result, *info_name, *description, *args_description, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (items < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
args_description = SvPV_nolen (ST (2));
function = SvPV_nolen (ST (3));
data = SvPV_nolen (ST (4));
-
+
result = script_ptr2str (script_api_hook_info (weechat_perl_plugin,
perl_current_script,
info_name,
@@ -3205,7 +3205,7 @@ XS (XS_weechat_api_hook_info)
&weechat_perl_api_hook_info_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3220,21 +3220,21 @@ weechat_perl_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
-
+
return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssh", func_argv);
}
-
+
return NULL;
}
@@ -3247,18 +3247,18 @@ XS (XS_weechat_api_hook_info_hashtable)
char *result, *info_name, *description, *args_description;
char *output_description, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (items < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
args_description = SvPV_nolen (ST (2));
output_description = SvPV_nolen (ST (3));
function = SvPV_nolen (ST (4));
data = SvPV_nolen (ST (5));
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_perl_plugin,
perl_current_script,
info_name,
@@ -3268,7 +3268,7 @@ XS (XS_weechat_api_hook_info_hashtable)
&weechat_perl_api_hook_info_hashtable_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3284,27 +3284,27 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3317,18 +3317,18 @@ XS (XS_weechat_api_hook_infolist)
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (items < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist_name = SvPV_nolen (ST (0));
description = SvPV_nolen (ST (1));
pointer_description = SvPV_nolen (ST (2));
args_description = SvPV_nolen (ST (3));
function = SvPV_nolen (ST (4));
data = SvPV_nolen (ST (5));
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_perl_plugin,
perl_current_script,
infolist_name,
@@ -3338,7 +3338,7 @@ XS (XS_weechat_api_hook_infolist)
&weechat_perl_api_hook_infolist_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3353,20 +3353,20 @@ weechat_perl_api_hook_focus_cb (void *data,
struct t_script_callback *script_callback;
void *func_argv[2];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = info;
-
+
return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", func_argv);
}
-
+
return NULL;
}
@@ -3378,22 +3378,22 @@ XS (XS_weechat_api_hook_focus)
{
char *result, *area, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
area = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_hook_focus (weechat_perl_plugin,
perl_current_script,
area,
&weechat_perl_api_hook_focus_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3404,15 +3404,15 @@ XS (XS_weechat_api_hook_focus)
XS (XS_weechat_api_unhook)
{
dXSARGS;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_unhook (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* hook */
-
+
API_RETURN_OK;
}
@@ -3423,15 +3423,15 @@ XS (XS_weechat_api_unhook)
XS (XS_weechat_api_unhook_all)
{
dXSARGS;
-
+
/* make C compiler happy */
(void) cv;
(void) items;
-
+
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (perl_current_script);
-
+
API_RETURN_OK;
}
@@ -3447,15 +3447,15 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3469,10 +3469,10 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3487,14 +3487,14 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3508,10 +3508,10 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3524,17 +3524,17 @@ XS (XS_weechat_api_buffer_new)
char *result, *name, *function_input, *data_input, *function_close;
char *data_close;
dXSARGS;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (items < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
function_input = SvPV_nolen (ST (1));
data_input = SvPV_nolen (ST (2));
function_close = SvPV_nolen (ST (3));
data_close = SvPV_nolen (ST (4));
-
+
result = script_ptr2str (script_api_buffer_new (weechat_perl_plugin,
perl_current_script,
name,
@@ -3544,7 +3544,7 @@ XS (XS_weechat_api_buffer_new)
&weechat_perl_api_buffer_close_cb,
function_close,
data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3556,16 +3556,16 @@ XS (XS_weechat_api_buffer_search)
{
char *result, *plugin, *name;
dXSARGS;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
plugin = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_buffer_search (plugin, name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3577,15 +3577,15 @@ XS (XS_weechat_api_buffer_search_main)
{
char *result;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
(void) cv;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3597,15 +3597,15 @@ XS (XS_weechat_api_current_buffer)
{
char *result;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
(void) cv;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3616,13 +3616,13 @@ XS (XS_weechat_api_current_buffer)
XS (XS_weechat_api_buffer_clear)
{
dXSARGS;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_clear (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -3633,15 +3633,15 @@ XS (XS_weechat_api_buffer_clear)
XS (XS_weechat_api_buffer_close)
{
dXSARGS;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_buffer_close (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -3652,14 +3652,14 @@ XS (XS_weechat_api_buffer_close)
XS (XS_weechat_api_buffer_merge)
{
dXSARGS;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_merge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */
script_str2ptr (SvPV_nolen (ST (1)))); /* target_buffer */
-
+
API_RETURN_OK;
}
@@ -3670,14 +3670,14 @@ XS (XS_weechat_api_buffer_merge)
XS (XS_weechat_api_buffer_unmerge)
{
dXSARGS;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_unmerge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */
SvIV (ST (1))); /* number */
-
+
API_RETURN_OK;
}
@@ -3690,16 +3690,16 @@ XS (XS_weechat_api_buffer_get_integer)
char *buffer, *property;
int value;
dXSARGS;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
-
+
API_RETURN_INT(value);
}
@@ -3712,16 +3712,16 @@ XS (XS_weechat_api_buffer_get_string)
char *buffer, *property;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
-
+
API_RETURN_STRING(result);
}
@@ -3733,17 +3733,17 @@ XS (XS_weechat_api_buffer_get_pointer)
{
char *result, *buffer, *property;
dXSARGS;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3755,17 +3755,17 @@ XS (XS_weechat_api_buffer_set)
{
char *buffer, *property, *value;
dXSARGS;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (items < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
value = SvPV_nolen (ST (2));
-
+
weechat_buffer_set (script_str2ptr (buffer), property, value);
-
+
API_RETURN_OK;
}
@@ -3778,16 +3778,16 @@ XS (XS_weechat_api_buffer_string_replace_local_var)
{
char *buffer, *string, *result;
dXSARGS;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3800,16 +3800,16 @@ XS (XS_weechat_api_buffer_match_list)
char *buffer, *string;
int value;
dXSARGS;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
buffer = SvPV_nolen (ST (0));
string = SvPV_nolen (ST (1));
-
+
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
-
+
API_RETURN_INT(value);
}
@@ -3821,15 +3821,15 @@ XS (XS_weechat_api_current_window)
{
char *result;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
(void) cv;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3841,13 +3841,13 @@ XS (XS_weechat_api_window_search_with_buffer)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (SvPV_nolen (ST (0)))));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3861,16 +3861,16 @@ XS (XS_weechat_api_window_get_integer)
char *window, *property;
int value;
dXSARGS;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
value = weechat_window_get_integer (script_str2ptr (window), property);
-
+
API_RETURN_INT(value);
}
@@ -3883,16 +3883,16 @@ XS (XS_weechat_api_window_get_string)
char *window, *property;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
result = weechat_window_get_string (script_str2ptr (window), property);
-
+
API_RETURN_STRING(result);
}
@@ -3904,17 +3904,17 @@ XS (XS_weechat_api_window_get_pointer)
{
char *result, *window, *property;
dXSARGS;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3925,13 +3925,13 @@ XS (XS_weechat_api_window_get_pointer)
XS (XS_weechat_api_window_set_title)
{
dXSARGS;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_window_set_title (SvPV_nolen (ST (0))); /* title */
-
+
API_RETURN_OK;
}
@@ -3943,22 +3943,22 @@ XS (XS_weechat_api_nicklist_add_group)
{
char *result, *buffer, *parent_group, *name, *color;
dXSARGS;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (items < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
parent_group = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
color = SvPV_nolen (ST (3));
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
name,
color,
SvIV (ST (4)))); /* visible */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3970,7 +3970,7 @@ XS (XS_weechat_api_nicklist_search_group)
{
char *result, *buffer, *from_group, *name;
dXSARGS;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
@@ -3978,11 +3978,11 @@ XS (XS_weechat_api_nicklist_search_group)
buffer = SvPV_nolen (ST (0));
from_group = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3994,18 +3994,18 @@ XS (XS_weechat_api_nicklist_add_nick)
{
char *result, *buffer, *group, *name, *color, *prefix, *prefix_color;
dXSARGS;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (items < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
color = SvPV_nolen (ST (3));
prefix = SvPV_nolen (ST (4));
prefix_color = SvPV_nolen (ST (5));
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
name,
@@ -4013,7 +4013,7 @@ XS (XS_weechat_api_nicklist_add_nick)
prefix,
prefix_color,
SvIV (ST (6)))); /* visible */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4025,19 +4025,19 @@ XS (XS_weechat_api_nicklist_search_nick)
{
char *result, *buffer, *from_group, *name;
dXSARGS;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
from_group = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4049,17 +4049,17 @@ XS (XS_weechat_api_nicklist_remove_group)
{
char *buffer, *group;
dXSARGS;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
-
+
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
-
+
API_RETURN_OK;
}
@@ -4071,17 +4071,17 @@ XS (XS_weechat_api_nicklist_remove_nick)
{
char *buffer, *nick;
dXSARGS;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
-
+
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
-
+
API_RETURN_OK;
}
@@ -4092,13 +4092,13 @@ XS (XS_weechat_api_nicklist_remove_nick)
XS (XS_weechat_api_nicklist_remove_all)
{
dXSARGS;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -4111,19 +4111,19 @@ XS (XS_weechat_api_nicklist_group_get_integer)
char *buffer, *group, *property;
int value;
dXSARGS;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_INT(value);
}
@@ -4136,19 +4136,19 @@ XS (XS_weechat_api_nicklist_group_get_string)
char *buffer, *group, *property;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4160,19 +4160,19 @@ XS (XS_weechat_api_nicklist_group_get_pointer)
{
char *result, *buffer, *group, *property;
dXSARGS;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4184,21 +4184,21 @@ XS (XS_weechat_api_nicklist_group_set)
{
char *buffer, *group, *property, *value;
dXSARGS;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (items < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
group = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
value = SvPV_nolen (ST (3));
-
+
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4211,19 +4211,19 @@ XS (XS_weechat_api_nicklist_nick_get_integer)
char *buffer, *nick, *property;
int value;
dXSARGS;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_INT(value);
}
@@ -4236,19 +4236,19 @@ XS (XS_weechat_api_nicklist_nick_get_string)
char *buffer, *nick, *property;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4260,19 +4260,19 @@ XS (XS_weechat_api_nicklist_nick_get_pointer)
{
char *result, *buffer, *nick, *property;
dXSARGS;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4284,21 +4284,21 @@ XS (XS_weechat_api_nicklist_nick_set)
{
char *buffer, *nick, *property, *value;
dXSARGS;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (items < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
nick = SvPV_nolen (ST (1));
property = SvPV_nolen (ST (2));
value = SvPV_nolen (ST (3));
-
+
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4310,13 +4310,13 @@ XS (XS_weechat_api_bar_item_search)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_item_search (SvPV_nolen (ST (0)))); /* name */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4331,7 +4331,7 @@ weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4339,20 +4339,20 @@ weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4364,22 +4364,22 @@ XS (XS_weechat_api_bar_item_new)
{
char *result, *name, *function, *data;
dXSARGS;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_perl_plugin,
perl_current_script,
name,
&weechat_perl_api_bar_item_build_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4390,13 +4390,13 @@ XS (XS_weechat_api_bar_item_new)
XS (XS_weechat_api_bar_item_update)
{
dXSARGS;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_item_update (SvPV_nolen (ST (0))); /* name */
-
+
API_RETURN_OK;
}
@@ -4407,15 +4407,15 @@ XS (XS_weechat_api_bar_item_update)
XS (XS_weechat_api_bar_item_remove)
{
dXSARGS;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_bar_item_remove (weechat_perl_plugin,
perl_current_script,
script_str2ptr (SvPV_nolen (ST (0)))); /* item */
-
+
API_RETURN_OK;
}
@@ -4427,13 +4427,13 @@ XS (XS_weechat_api_bar_search)
{
char *result;
dXSARGS;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_search (SvPV_nolen (ST (0)))); /* name */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4447,11 +4447,11 @@ XS (XS_weechat_api_bar_new)
char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg;
char *color_delim, *color_bg, *separator, *bar_items;
dXSARGS;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (items < 15)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
hidden = SvPV_nolen (ST (1));
priority = SvPV_nolen (ST (2));
@@ -4467,7 +4467,7 @@ XS (XS_weechat_api_bar_new)
color_bg = SvPV_nolen (ST (12));
separator = SvPV_nolen (ST (13));
bar_items = SvPV_nolen (ST (14));
-
+
result = script_ptr2str (weechat_bar_new (name,
hidden,
priority,
@@ -4483,7 +4483,7 @@ XS (XS_weechat_api_bar_new)
color_bg,
separator,
bar_items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4495,17 +4495,17 @@ XS (XS_weechat_api_bar_set)
{
char *bar, *property, *value;
dXSARGS;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (items < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
bar = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
value = SvPV_nolen (ST (2));
-
+
weechat_bar_set (script_str2ptr (bar), property, value);
-
+
API_RETURN_OK;
}
@@ -4516,13 +4516,13 @@ XS (XS_weechat_api_bar_set)
XS (XS_weechat_api_bar_update)
{
dXSARGS;
-
+
API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_update (SvPV_nolen (ST (0))); /* name */
-
+
API_RETURN_OK;
}
@@ -4533,13 +4533,13 @@ XS (XS_weechat_api_bar_update)
XS (XS_weechat_api_bar_remove)
{
dXSARGS;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_remove (script_str2ptr (SvPV_nolen (ST (0)))); /* bar */
-
+
API_RETURN_OK;
}
@@ -4551,19 +4551,19 @@ XS (XS_weechat_api_command)
{
char *buffer, *command;
dXSARGS;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
if (items < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = SvPV_nolen (ST (0));
command = SvPV_nolen (ST (1));
-
+
script_api_command (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
command);
-
+
API_RETURN_OK;
}
@@ -4576,16 +4576,16 @@ XS (XS_weechat_api_info_get)
char *info_name, *arguments;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = SvPV_nolen (ST (0));
arguments = SvPV_nolen (ST (1));
-
+
result = weechat_info_get (info_name, arguments);
-
+
API_RETURN_STRING(result);
}
@@ -4599,23 +4599,23 @@ XS (XS_weechat_api_info_get_hashtable)
struct t_hashtable *hashtable, *result_hashtable;
HV *result_hash;
dXSARGS;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (info_name, hashtable);
result_hash = weechat_perl_hashtable_to_hash (result_hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
API_RETURN_OBJ(result_hash);
}
@@ -4627,15 +4627,15 @@ XS (XS_weechat_api_infolist_new)
{
char *result;
dXSARGS;
-
+
/* make C compiler happy */
(void) items;
(void) cv;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4647,15 +4647,15 @@ XS (XS_weechat_api_infolist_new_item)
{
char *infolist, *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4667,18 +4667,18 @@ XS (XS_weechat_api_infolist_new_var_integer)
{
char *infolist, *name, *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
SvIV (ST (2)))); /* value */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4690,19 +4690,19 @@ XS (XS_weechat_api_infolist_new_var_string)
{
char *infolist, *name, *value, *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
value = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4714,19 +4714,19 @@ XS (XS_weechat_api_infolist_new_var_pointer)
{
char *infolist, *name, *value, *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
value = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4738,18 +4738,18 @@ XS (XS_weechat_api_infolist_new_var_time)
{
char *infolist, *name, *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
SvIV (ST (2)))); /* value */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4761,19 +4761,19 @@ XS (XS_weechat_api_infolist_get)
{
char *result, *name, *pointer, *arguments;
dXSARGS;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
arguments = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4785,13 +4785,13 @@ XS (XS_weechat_api_infolist_next)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_next (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
-
+
API_RETURN_INT(value);
}
@@ -4803,13 +4803,13 @@ XS (XS_weechat_api_infolist_prev)
{
int value;
dXSARGS;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_prev (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
-
+
API_RETURN_INT(value);
}
@@ -4821,13 +4821,13 @@ XS (XS_weechat_api_infolist_prev)
XS (XS_weechat_api_infolist_reset_item_cursor)
{
dXSARGS;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
-
+
API_RETURN_OK;
}
@@ -4839,13 +4839,13 @@ XS (XS_weechat_api_infolist_fields)
{
const char *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_fields (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
-
+
API_RETURN_STRING(result);
}
@@ -4858,16 +4858,16 @@ XS (XS_weechat_api_infolist_integer)
char *infolist, *variable;
int value;
dXSARGS;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
-
+
value = weechat_infolist_integer (script_str2ptr (infolist), variable);
-
+
API_RETURN_INT(value);
}
@@ -4880,16 +4880,16 @@ XS (XS_weechat_api_infolist_string)
char *infolist, *variable;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
-
+
result = weechat_infolist_string (script_str2ptr (infolist), variable);
-
+
API_RETURN_STRING(result);
}
@@ -4902,16 +4902,16 @@ XS (XS_weechat_api_infolist_pointer)
char *infolist, *variable;
char *result;
dXSARGS;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4924,17 +4924,17 @@ XS (XS_weechat_api_infolist_time)
time_t time;
char timebuffer[64], *result, *infolist, *variable;
dXSARGS;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = SvPV_nolen (ST (0));
variable = SvPV_nolen (ST (1));
time = weechat_infolist_time (script_str2ptr (infolist), variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4945,13 +4945,13 @@ XS (XS_weechat_api_infolist_time)
XS (XS_weechat_api_infolist_free)
{
dXSARGS;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_free (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */
-
+
API_RETURN_OK;
}
@@ -4963,15 +4963,15 @@ XS (XS_weechat_api_hdata_get)
{
char *result, *name;
dXSARGS;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (items < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = SvPV_nolen (ST (0));
-
+
result = script_ptr2str (weechat_hdata_get (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4984,16 +4984,16 @@ XS (XS_weechat_api_hdata_get_var_offset)
char *hdata, *name;
int value;
dXSARGS;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (items < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
-
+
API_RETURN_INT(value);
}
@@ -5006,16 +5006,16 @@ XS (XS_weechat_api_hdata_get_var_type_string)
const char *result;
char *hdata, *name;
dXSARGS;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5028,16 +5028,16 @@ XS (XS_weechat_api_hdata_get_var_hdata)
const char *result;
char *hdata, *name;
dXSARGS;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5050,17 +5050,17 @@ XS (XS_weechat_api_hdata_get_list)
char *hdata, *name;
char *result;
dXSARGS;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
name = SvPV_nolen (ST (1));
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5073,19 +5073,19 @@ XS (XS_weechat_api_hdata_move)
char *result, *hdata, *pointer;
int count;
dXSARGS;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
count = SvIV(ST (2));
-
+
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5099,19 +5099,19 @@ XS (XS_weechat_api_hdata_integer)
char *hdata, *pointer, *name;
int value;
dXSARGS;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_INT(value);
}
@@ -5124,19 +5124,19 @@ XS (XS_weechat_api_hdata_long)
char *hdata, *pointer, *name;
long value;
dXSARGS;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_LONG(value);
}
@@ -5150,19 +5150,19 @@ XS (XS_weechat_api_hdata_string)
char *hdata, *pointer, *name;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_STRING(result);
}
@@ -5176,19 +5176,19 @@ XS (XS_weechat_api_hdata_pointer)
char *hdata, *pointer, *name;
char *result;
dXSARGS;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5201,21 +5201,21 @@ XS (XS_weechat_api_hdata_time)
time_t time;
char timebuffer[64], *result, *hdata, *pointer, *name;
dXSARGS;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (items < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
name = SvPV_nolen (ST (2));
-
+
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5228,16 +5228,16 @@ XS (XS_weechat_api_hdata_get_string)
char *hdata, *property;
const char *result;
dXSARGS;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = SvPV_nolen (ST (0));
property = SvPV_nolen (ST (1));
-
+
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
-
+
API_RETURN_STRING(result);
}
@@ -5249,16 +5249,16 @@ XS (XS_weechat_api_upgrade_new)
{
char *result, *filename;
dXSARGS;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (items < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
filename = SvPV_nolen (ST (0));
-
+
result = script_ptr2str (weechat_upgrade_new (filename,
SvIV (ST (1)))); /* write */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5271,18 +5271,18 @@ XS (XS_weechat_api_upgrade_write_object)
char *upgrade_file, *infolist;
int rc;
dXSARGS;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = SvPV_nolen (ST (0));
infolist = SvPV_nolen (ST (2));
-
+
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
SvIV (ST (1)), /* object_id */
script_str2ptr (infolist));
-
+
API_RETURN_INT(rc);
}
@@ -5300,23 +5300,23 @@ weechat_perl_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5328,10 +5328,10 @@ weechat_perl_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -5344,22 +5344,22 @@ XS (XS_weechat_api_upgrade_read)
char *upgrade_file, *function, *data;
int rc;
dXSARGS;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
upgrade_file = SvPV_nolen (ST (0));
function = SvPV_nolen (ST (1));
data = SvPV_nolen (ST (2));
-
+
rc = script_api_upgrade_read (weechat_perl_plugin,
perl_current_script,
script_str2ptr (upgrade_file),
&weechat_perl_api_upgrade_read_cb,
function,
data);
-
+
API_RETURN_INT(rc);
}
@@ -5371,15 +5371,15 @@ XS (XS_weechat_api_upgrade_close)
{
char *upgrade_file;
dXSARGS;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
upgrade_file = SvPV_nolen (ST (0));
-
+
weechat_upgrade_close (script_str2ptr (upgrade_file));
-
+
API_RETURN_OK;
}
@@ -5391,9 +5391,9 @@ void
weechat_perl_api_init (pTHX)
{
HV *stash;
-
+
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
-
+
/* interface functions */
newXS ("weechat::register", XS_weechat_api_register, "weechat");
newXS ("weechat::plugin_get_name", XS_weechat_api_plugin_get_name, "weechat");
@@ -5572,13 +5572,13 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::upgrade_write_object", XS_weechat_api_upgrade_write_object, "weechat");
newXS ("weechat::upgrade_read", XS_weechat_api_upgrade_read, "weechat");
newXS ("weechat::upgrade_close", XS_weechat_api_upgrade_close, "weechat");
-
+
/* interface constants */
stash = gv_stashpv ("weechat", TRUE);
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK", newSViv (WEECHAT_RC_OK));
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_EAT", newSViv (WEECHAT_RC_OK_EAT));
newCONSTSUB (stash, "weechat::WEECHAT_RC_ERROR", newSViv (WEECHAT_RC_ERROR));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_OK", newSViv (WEECHAT_CONFIG_READ_OK));
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_MEMORY_ERROR", newSViv (WEECHAT_CONFIG_READ_MEMORY_ERROR));
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_FILE_NOT_FOUND", newSViv (WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
@@ -5593,19 +5593,19 @@ weechat_perl_api_init (pTHX)
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", newSViv (WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", newSViv (WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_ERROR", newSViv (WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_SORT", newSVpv (WEECHAT_LIST_POS_SORT, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_BEGINNING", newSVpv (WEECHAT_LIST_POS_BEGINNING, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_END", newSVpv (WEECHAT_LIST_POS_END, PL_na));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_LOW", newSVpv (WEECHAT_HOTLIST_LOW, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_MESSAGE", newSVpv (WEECHAT_HOTLIST_MESSAGE, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_PRIVATE", newSVpv (WEECHAT_HOTLIST_PRIVATE, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_HIGHLIGHT", newSVpv (WEECHAT_HOTLIST_HIGHLIGHT, PL_na));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_PROCESS_RUNNING", newSViv (WEECHAT_HOOK_PROCESS_RUNNING));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_PROCESS_ERROR", newSViv (WEECHAT_HOOK_PROCESS_ERROR));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_OK", newSViv (WEECHAT_HOOK_CONNECT_OK));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", newSViv (WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", newSViv (WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
@@ -5615,7 +5615,7 @@ weechat_perl_api_init (pTHX)
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", newSViv (WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", newSViv (WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_MEMORY_ERROR", newSViv (WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
-
+
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_STRING", newSVpv (WEECHAT_HOOK_SIGNAL_STRING, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_INT", newSVpv (WEECHAT_HOOK_SIGNAL_INT, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_POINTER", newSVpv (WEECHAT_HOOK_SIGNAL_POINTER, PL_na));
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 8d6b30195..82669b948 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -138,12 +138,12 @@ weechat_perl_hashtable_map_cb (void *data,
const void *value)
{
HV *hash;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hash = (HV *)data;
-
+
(void) hv_store (hash, (char *)key, strlen ((char *)key),
newSVpv ((char *)value, 0), 0);
}
@@ -156,15 +156,15 @@ HV *
weechat_perl_hashtable_to_hash (struct t_hashtable *hashtable)
{
HV *hash;
-
+
hash = (HV *)newHV ();
if (!hash)
return NULL;
-
+
weechat_hashtable_map (hashtable,
&weechat_perl_hashtable_map_cb,
hash);
-
+
return hash;
}
@@ -184,7 +184,7 @@ weechat_perl_hash_to_hashtable (SV *hash, int hashtable_size)
SV *value;
char *str_key;
I32 retlen;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -192,7 +192,7 @@ weechat_perl_hash_to_hashtable (SV *hash, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
if ((hash) && SvROK(hash) && SvRV(hash) && (SvTYPE(SvRV(hash)) == SVt_PVHV))
{
hash2 = (HV *) SvRV(hash);
@@ -202,7 +202,7 @@ weechat_perl_hash_to_hashtable (SV *hash, int hashtable_size)
weechat_hashtable_set (hashtable, str_key, SvPV (value, PL_na));
}
}
-
+
return hashtable;
}
@@ -225,10 +225,10 @@ weechat_perl_exec (struct t_plugin_script *script,
#ifdef MULTIPLICITY
void *old_context;
#endif
-
+
old_perl_current_script = perl_current_script;
perl_current_script = script;
-
+
#ifdef MULTIPLICITY
(void) length;
func = (char *) function;
@@ -245,11 +245,11 @@ weechat_perl_exec (struct t_plugin_script *script,
(char *) ((script->interpreter) ? script->interpreter : perl_main),
function);
#endif
-
+
dSP;
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
if (format && format[0])
{
@@ -273,12 +273,12 @@ weechat_perl_exec (struct t_plugin_script *script,
}
PUTBACK;
count = perl_call_pv (func, G_EVAL | G_SCALAR);
-
+
ret_value = NULL;
mem_err = 1;
-
+
SPAGAIN;
-
+
if (SvTRUE (ERRSV))
{
weechat_printf (NULL,
@@ -334,7 +334,7 @@ weechat_perl_exec (struct t_plugin_script *script,
PUTBACK;
FREETMPS;
LEAVE;
-
+
perl_current_script = old_perl_current_script;
#ifdef MULTIPLICITY
PERL_SET_CONTEXT (old_context);
@@ -350,7 +350,7 @@ weechat_perl_exec (struct t_plugin_script *script,
weechat_prefix ("error"), PERL_PLUGIN_NAME, function);
return NULL;
}
-
+
return ret_value;
}
@@ -366,13 +366,13 @@ weechat_perl_load (const char *filename)
int *eval;
struct stat buf;
void *perl_argv[2];
-
+
#ifdef MULTIPLICITY
PerlInterpreter *perl_current_interpreter;
#else
char pkgname[64];
#endif
-
+
temp_script.filename = NULL;
temp_script.interpreter = NULL;
temp_script.name = NULL;
@@ -382,7 +382,7 @@ weechat_perl_load (const char *filename)
temp_script.description = NULL;
temp_script.shutdown_func = NULL;
temp_script.charset = NULL;
-
+
if (stat (filename, &buf) != 0)
{
weechat_printf (NULL,
@@ -390,21 +390,21 @@ weechat_perl_load (const char *filename)
weechat_prefix ("error"), PERL_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PERL_PLUGIN_NAME, filename);
}
-
+
perl_current_script = NULL;
perl_current_script_filename = filename;
perl_registered_script = NULL;
-
+
#ifdef MULTIPLICITY
perl_current_interpreter = perl_alloc();
-
+
if (!perl_current_interpreter)
{
weechat_printf (NULL,
@@ -413,13 +413,13 @@ weechat_perl_load (const char *filename)
weechat_prefix ("error"), PERL_PLUGIN_NAME);
return 0;
}
-
+
PERL_SET_CONTEXT (perl_current_interpreter);
perl_construct (perl_current_interpreter);
temp_script.interpreter = (PerlInterpreter *) perl_current_interpreter;
perl_parse (perl_current_interpreter, weechat_perl_api_init,
perl_args_count, perl_args, NULL);
-
+
eval_pv (perl_weechat_code, TRUE);
perl_argv[0] = (void *)filename;
eval = weechat_perl_exec (&temp_script,
@@ -445,7 +445,7 @@ weechat_perl_load (const char *filename)
weechat_prefix ("error"), PERL_PLUGIN_NAME, filename);
return 0;
}
-
+
if (*eval != 0)
{
if (*eval == 2)
@@ -499,9 +499,9 @@ weechat_perl_load (const char *filename)
free (eval);
return 0;
}
-
+
free (eval);
-
+
if (!perl_registered_script)
{
weechat_printf (NULL,
@@ -515,13 +515,13 @@ weechat_perl_load (const char *filename)
return 0;
}
perl_current_script = perl_registered_script;
-
+
#ifdef MULTIPLICITY
perl_current_script->interpreter = (PerlInterpreter *)perl_current_interpreter;
#else
perl_current_script->interpreter = strdup (pkgname);
#endif
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -531,7 +531,7 @@ weechat_perl_load (const char *filename)
perl_current_script,
&weechat_perl_api_buffer_input_data_cb,
&weechat_perl_api_buffer_close_cb);
-
+
return 1;
}
@@ -544,7 +544,7 @@ weechat_perl_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_perl_load (filename);
}
@@ -564,13 +564,13 @@ weechat_perl_unload (struct t_plugin_script *script)
weechat_gettext ("%s: unloading script \"%s\""),
PERL_PLUGIN_NAME, script->name);
}
-
+
#ifdef MULTIPLICITY
PERL_SET_CONTEXT (script->interpreter);
#else
eval_pv (script->interpreter, TRUE);
#endif
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *)weechat_perl_exec (script,
@@ -580,16 +580,16 @@ weechat_perl_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
interpreter = script->interpreter;
-
+
if (perl_current_script == script)
perl_current_script = (perl_current_script->prev_script) ?
perl_current_script->prev_script : perl_current_script->next_script;
-
+
script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script,
script);
-
+
#ifdef MULTIPLICITY
if (interpreter)
{
@@ -610,7 +610,7 @@ void
weechat_perl_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_perl_plugin, perl_scripts, name);
if (ptr_script)
{
@@ -649,7 +649,7 @@ weechat_perl_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_perl_plugin, perl_scripts, name);
if (ptr_script)
{
@@ -681,11 +681,11 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc == 1)
{
script_display_list (weechat_perl_plugin, perl_scripts,
@@ -756,7 +756,7 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_prefix ("error"), PERL_PLUGIN_NAME, "perl");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -773,9 +773,9 @@ weechat_perl_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_perl_plugin, completion, perl_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -789,17 +789,17 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "perl_script") == 0)
{
return script_infolist_list_scripts (weechat_perl_plugin,
perl_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -815,13 +815,13 @@ weechat_perl_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, PERL_PLUGIN_NAME) == 0))
{
script_print_log (weechat_perl_plugin, perl_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -837,10 +837,10 @@ weechat_perl_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (perl_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -872,7 +872,7 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
&perl_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -888,7 +888,7 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "perl_script_install") == 0)
@@ -908,7 +908,7 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
&perl_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -927,9 +927,9 @@ weechat_perl_signal_quit_upgrade_cb (void *data, const char *signal,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
perl_quit_or_upgrade = 1;
-
+
return WEECHAT_RC_OK;
}
@@ -951,12 +951,12 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
(void) perl_env;
PERL_SYS_INIT3 (&a, (char ***)&perl_args_local, (char ***)&perl_env);
#endif
-
+
weechat_perl_plugin = plugin;
-
+
#ifndef MULTIPLICITY
perl_main = perl_alloc ();
-
+
if (!perl_main)
{
weechat_printf (NULL,
@@ -965,13 +965,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
PERL_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
-
+
perl_construct (perl_main);
perl_parse (perl_main, weechat_perl_api_init, perl_args_count,
perl_args, NULL);
eval_pv (perl_weechat_code, TRUE);
#endif
-
+
perl_quiet = 1;
script_init (weechat_perl_plugin,
argc,
@@ -984,13 +984,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_perl_signal_script_action_cb,
&weechat_perl_load_cb);
perl_quiet = 0;
-
+
script_display_short_list (weechat_perl_plugin,
perl_scripts);
-
+
weechat_hook_signal ("quit", &weechat_perl_signal_quit_upgrade_cb, NULL);
weechat_hook_signal ("upgrade", &weechat_perl_signal_quit_upgrade_cb, NULL);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -1006,7 +1006,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
perl_quiet = 1;
script_end (plugin, &perl_scripts, &weechat_perl_unload_all);
perl_quiet = 0;
-
+
#ifndef MULTIPLICITY
/* free perl intepreter */
if (perl_main)
@@ -1016,7 +1016,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
perl_main = NULL;
}
#endif
-
+
#if defined(PERL_SYS_TERM) && !defined(__FreeBSD__) && !defined(WIN32) && !defined(__CYGWIN__)
/*
* we call this function on all OS, but NOT on FreeBSD or Cygwin,
@@ -1025,6 +1025,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
if (perl_quit_or_upgrade)
PERL_SYS_TERM ();
#endif
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 78c308605..83bfde802 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -82,7 +82,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
{
char *name, *author, *version, *license, *shutdown_func, *description;
char *charset;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
python_current_script = NULL;
python_registered_script = NULL;
@@ -96,7 +96,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssssss", &name, &author, &version,
&license, &description, &shutdown_func, &charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (script_search (weechat_python_plugin, python_scripts, name))
{
/* error: another scripts already exists with this name! */
@@ -107,7 +107,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
python_current_script = script_add (weechat_python_plugin,
&python_scripts, &last_python_script,
@@ -130,7 +130,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -144,14 +144,14 @@ weechat_python_api_plugin_get_name (PyObject *self, PyObject *args)
{
char *plugin;
const char *result;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
plugin = NULL;
if (!PyArg_ParseTuple (args, "s", &plugin))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_plugin_get_name (script_str2ptr (plugin));
-
+
API_RETURN_STRING(result);
}
@@ -163,15 +163,15 @@ static PyObject *
weechat_python_api_charset_set (PyObject *self, PyObject *args)
{
char *charset;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
charset = NULL;
if (!PyArg_ParseTuple (args, "s", &charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_charset_set (python_current_script,
charset);
-
+
API_RETURN_OK;
}
@@ -184,15 +184,15 @@ weechat_python_api_iconv_to_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_to_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -206,15 +206,15 @@ weechat_python_api_iconv_from_internal (PyObject *self, PyObject *args)
{
char *charset, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
charset = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &charset, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_iconv_from_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -227,14 +227,14 @@ weechat_python_api_gettext (PyObject *self, PyObject *args)
{
char *string;
const char *result;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_gettext (string);
-
+
API_RETURN_STRING(result);
}
@@ -248,16 +248,16 @@ weechat_python_api_ngettext (PyObject *self, PyObject *args)
char *single, *plural;
const char *result;
int count;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
single = NULL;
plural = NULL;
count = 0;
if (!PyArg_ParseTuple (args, "ssi", &single, &plural, &count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_ngettext (single, plural, count);
-
+
API_RETURN_STRING(result);
}
@@ -272,16 +272,16 @@ weechat_python_api_string_match (PyObject *self, PyObject *args)
{
char *string, *mask;
int case_sensitive, value;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
string = NULL;
mask = NULL;
case_sensitive = 0;
if (!PyArg_ParseTuple (args, "ssi", &string, &mask, &case_sensitive))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_match (string, mask, case_sensitive);
-
+
API_RETURN_INT(value);
}
@@ -298,15 +298,15 @@ weechat_python_api_string_has_highlight (PyObject *self, PyObject *args)
{
char *string, *highlight_words;
int value;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
string = NULL;
highlight_words = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &highlight_words))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight (string, highlight_words);
-
+
API_RETURN_INT(value);
}
@@ -323,15 +323,15 @@ weechat_python_api_string_has_highlight_regex (PyObject *self, PyObject *args)
{
char *string, *regex;
int value;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
string = NULL;
regex = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &regex))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_has_highlight_regex (string, regex);
-
+
API_RETURN_INT(value);
}
@@ -347,14 +347,14 @@ weechat_python_api_string_mask_to_regex (PyObject *self, PyObject *args)
{
char *mask, *result;
PyObject *return_value;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
mask = NULL;
if (!PyArg_ParseTuple (args, "s", &mask))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_mask_to_regex (mask);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -368,15 +368,15 @@ weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
{
char *string, *replacement, *result;
PyObject *return_value;
-
+
API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
string = NULL;
replacement = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_remove_color (string, replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -390,14 +390,14 @@ weechat_python_api_string_is_command_char (PyObject *self, PyObject *args)
{
char *string;
int value;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_string_is_command_char (string);
-
+
API_RETURN_INT(value);
}
@@ -412,14 +412,14 @@ weechat_python_api_string_input_for_buffer (PyObject *self, PyObject *args)
{
char *string;
const char *result;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
string = NULL;
if (!PyArg_ParseTuple (args, "s", &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_input_for_buffer (string);
-
+
API_RETURN_STRING(result);
}
@@ -432,13 +432,13 @@ weechat_python_api_mkdir_home (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_home (directory, mode))
API_RETURN_OK;
@@ -454,16 +454,16 @@ weechat_python_api_mkdir (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -477,16 +477,16 @@ weechat_python_api_mkdir_parents (PyObject *self, PyObject *args)
{
char *directory;
int mode;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (weechat_mkdir_parents (directory, mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -499,14 +499,14 @@ weechat_python_api_list_new (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -519,7 +519,7 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
{
char *weelist, *data, *where, *user_data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
@@ -527,12 +527,12 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
user_data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -545,16 +545,16 @@ weechat_python_api_list_search (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -567,15 +567,15 @@ weechat_python_api_list_search_pos (PyObject *self, PyObject *args)
{
char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -588,16 +588,16 @@ weechat_python_api_list_casesearch (PyObject *self, PyObject *args)
{
char *weelist, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -611,15 +611,15 @@ weechat_python_api_list_casesearch_pos (PyObject *self, PyObject *args)
{
char *weelist, *data;
int pos;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
weelist = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -633,13 +633,13 @@ weechat_python_api_list_get (PyObject *self, PyObject *args)
char *weelist, *result;
int position;
PyObject *return_value;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
weelist = NULL;
position = 0;
if (!PyArg_ParseTuple (args, "si", &weelist, &position))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (weelist),
position));
API_RETURN_STRING_FREE(result);
@@ -653,16 +653,16 @@ static PyObject *
weechat_python_api_list_set (PyObject *self, PyObject *args)
{
char *item, *new_value;
-
+
API_FUNC(1, "list_set", API_RETURN_ERROR);
item = NULL;
new_value = NULL;
if (!PyArg_ParseTuple (args, "ss", &item, &new_value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_set (script_str2ptr (item),
new_value);
-
+
API_RETURN_OK;
}
@@ -675,14 +675,14 @@ weechat_python_api_list_next (PyObject *self, PyObject *args)
{
char *item, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -695,14 +695,14 @@ weechat_python_api_list_prev (PyObject *self, PyObject *args)
{
char *item, *result;
PyObject *return_value;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (item)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -715,14 +715,14 @@ weechat_python_api_list_string (PyObject *self, PyObject *args)
{
char *item;
const char *result;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_list_string (script_str2ptr (item));
-
+
API_RETURN_STRING(result);
}
@@ -735,14 +735,14 @@ weechat_python_api_list_size (PyObject *self, PyObject *args)
{
char *weelist;
int size;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
size = weechat_list_size (script_str2ptr (weelist));
-
+
API_RETURN_INT(size);
}
@@ -754,16 +754,16 @@ static PyObject *
weechat_python_api_list_remove (PyObject *self, PyObject *args)
{
char *weelist, *item;
-
+
API_FUNC(1, "list_remove", API_RETURN_ERROR);
weelist = NULL;
item = NULL;
if (!PyArg_ParseTuple (args, "ss", &weelist, &item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove (script_str2ptr (weelist),
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -775,14 +775,14 @@ static PyObject *
weechat_python_api_list_remove_all (PyObject *self, PyObject *args)
{
char *weelist;
-
+
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove_all (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -794,14 +794,14 @@ static PyObject *
weechat_python_api_list_free (PyObject *self, PyObject *args)
{
char *weelist;
-
+
API_FUNC(1, "list_free", API_RETURN_ERROR);
weelist = NULL;
if (!PyArg_ParseTuple (args, "s", &weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_free (script_str2ptr (weelist));
-
+
API_RETURN_OK;
}
@@ -817,19 +817,19 @@ weechat_python_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -839,10 +839,10 @@ weechat_python_api_config_reload_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -855,21 +855,21 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new (weechat_python_plugin,
python_current_script,
name,
&weechat_python_api_config_reload_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -887,9 +887,9 @@ weechat_python_api_config_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -897,12 +897,12 @@ weechat_python_api_config_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -914,10 +914,10 @@ weechat_python_api_config_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -934,7 +934,7 @@ weechat_python_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -942,12 +942,12 @@ weechat_python_api_config_section_write_cb (void *data,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -957,10 +957,10 @@ weechat_python_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -978,7 +978,7 @@ weechat_python_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -986,12 +986,12 @@ weechat_python_api_config_section_write_default_cb (void *data,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1001,10 +1001,10 @@ weechat_python_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1023,9 +1023,9 @@ weechat_python_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1033,12 +1033,12 @@ weechat_python_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1050,10 +1050,10 @@ weechat_python_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1071,21 +1071,21 @@ weechat_python_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1099,10 +1099,10 @@ weechat_python_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1119,7 +1119,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
char *data_delete_option, *result;
int user_can_add_options, user_can_delete_options;
PyObject *return_value;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
config_file = NULL;
name = NULL;
@@ -1143,7 +1143,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&data_create_option, &function_delete_option,
&data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file),
@@ -1165,7 +1165,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&weechat_python_api_config_section_delete_option_cb,
function_delete_option,
data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1178,16 +1178,16 @@ weechat_python_api_config_search_section (PyObject *self, PyObject *args)
{
char *config_file, *section_name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
config_file = NULL;
section_name = NULL;
if (!PyArg_ParseTuple (args, "ss", &config_file, &section_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1205,20 +1205,20 @@ weechat_python_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1228,10 +1228,10 @@ weechat_python_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1247,22 +1247,22 @@ weechat_python_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1280,22 +1280,22 @@ weechat_python_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1314,7 +1314,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
char *data_change, *function_delete, *data_delete;
int min, max, null_value_allowed;
PyObject *return_value;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
@@ -1337,7 +1337,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
&function_change, &data_change, &function_delete,
&data_delete))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file),
@@ -1360,7 +1360,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args)
&weechat_python_api_config_option_delete_cb,
function_delete,
data_delete));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1373,18 +1373,18 @@ weechat_python_api_config_search_option (PyObject *self, PyObject *args)
{
char *config_file, *section, *option_name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
config_file = NULL;
section = NULL;
option_name = NULL;
if (!PyArg_ParseTuple (args, "sss", &config_file, &section, &option_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1397,14 +1397,14 @@ weechat_python_api_config_string_to_boolean (PyObject *self, PyObject *args)
{
char *text;
int value;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
text = NULL;
if (!PyArg_ParseTuple (args, "s", &text))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_string_to_boolean (text);
-
+
API_RETURN_INT(value);
}
@@ -1417,16 +1417,16 @@ weechat_python_api_config_option_reset (PyObject *self, PyObject *args)
{
char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
option = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1439,18 +1439,18 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
{
char *option, *new_value;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
new_value = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1464,16 +1464,16 @@ weechat_python_api_config_option_set_null (PyObject *self, PyObject *args)
{
char *option;
int run_callback, rc;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
run_callback = 0;
if (!PyArg_ParseTuple (args, "si", &option, &run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1486,14 +1486,14 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = weechat_config_option_unset (script_str2ptr (option));
-
+
API_RETURN_INT(rc);
}
@@ -1505,16 +1505,16 @@ static PyObject *
weechat_python_api_config_option_rename (PyObject *self, PyObject *args)
{
char *option, *new_name;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
option = NULL;
new_name = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &new_name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_option_rename (script_str2ptr (option),
new_name);
-
+
API_RETURN_OK;
}
@@ -1527,14 +1527,14 @@ weechat_python_api_config_option_is_null (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1548,14 +1548,14 @@ weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args
{
char *option;
int value;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
value = weechat_config_option_default_is_null (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1568,14 +1568,14 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1588,14 +1588,14 @@ weechat_python_api_config_boolean_default (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_boolean_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1608,14 +1608,14 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1628,14 +1628,14 @@ weechat_python_api_config_integer_default (PyObject *self, PyObject *args)
{
char *option;
int value;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_config_integer_default (script_str2ptr (option));
-
+
API_RETURN_INT(value);
}
@@ -1648,14 +1648,14 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1668,14 +1668,14 @@ weechat_python_api_config_string_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1688,14 +1688,14 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1708,14 +1708,14 @@ weechat_python_api_config_color_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color_default (script_str2ptr (option));
-
+
API_RETURN_STRING(result);
}
@@ -1727,16 +1727,16 @@ static PyObject *
weechat_python_api_config_write_option (PyObject *self, PyObject *args)
{
char *config_file, *option;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
config_file = NULL;
option = NULL;
if (!PyArg_ParseTuple (args, "ss", &config_file, &option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1748,19 +1748,19 @@ static PyObject *
weechat_python_api_config_write_line (PyObject *self, PyObject *args)
{
char *config_file, *option_name, *value;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
config_file = NULL;
option_name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &config_file, &option_name, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_config_write_line (script_str2ptr (config_file),
option_name,
"%s",
value);
-
+
API_RETURN_OK;
}
@@ -1773,14 +1773,14 @@ weechat_python_api_config_write (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_write (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1793,14 +1793,14 @@ weechat_python_api_config_read (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_read (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1813,14 +1813,14 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args)
{
char *config_file;
int rc;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_reload (script_str2ptr (config_file));
-
+
API_RETURN_INT(rc);
}
@@ -1832,16 +1832,16 @@ static PyObject *
weechat_python_api_config_option_free (PyObject *self, PyObject *args)
{
char *option;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_option_free (weechat_python_plugin,
python_current_script,
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -1854,16 +1854,16 @@ static PyObject *
weechat_python_api_config_section_free_options (PyObject *self, PyObject *args)
{
char *section;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
section = NULL;
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free_options (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1875,16 +1875,16 @@ static PyObject *
weechat_python_api_config_section_free (PyObject *self, PyObject *args)
{
char *section;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
section = NULL;
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free (weechat_python_plugin,
python_current_script,
script_str2ptr (section));
-
+
API_RETURN_OK;
}
@@ -1896,16 +1896,16 @@ static PyObject *
weechat_python_api_config_free (PyObject *self, PyObject *args)
{
char *config_file;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
config_file = NULL;
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_free (weechat_python_plugin,
python_current_script,
script_str2ptr (config_file));
-
+
API_RETURN_OK;
}
@@ -1918,14 +1918,14 @@ weechat_python_api_config_get (PyObject *self, PyObject *args)
{
char *option, *result;
PyObject *return_value;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_get (option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1938,16 +1938,16 @@ weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
{
char *option;
const char *result;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_api_config_get_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_STRING(result);
}
@@ -1960,16 +1960,16 @@ weechat_python_api_config_is_set_plugin (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = script_api_config_is_set_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -1982,18 +1982,18 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
{
char *option, *value;
int rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
option = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &value))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
rc = script_api_config_set_plugin (weechat_python_plugin,
python_current_script,
option,
value);
-
+
API_RETURN_INT(rc);
}
@@ -2005,18 +2005,18 @@ static PyObject *
weechat_python_api_config_set_desc_plugin (PyObject *self, PyObject *args)
{
char *option, *description;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
option = NULL;
description = NULL;
if (!PyArg_ParseTuple (args, "ss", &option, &description))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_set_desc_plugin (weechat_python_plugin,
python_current_script,
option,
description);
-
+
API_RETURN_OK;
}
@@ -2029,16 +2029,16 @@ weechat_python_api_config_unset_plugin (PyObject *self, PyObject *args)
{
char *option;
int rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rc = script_api_config_unset_plugin (weechat_python_plugin,
python_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2053,20 +2053,20 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
struct t_hashtable *hashtable;
PyObject *dict;
int num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
context = NULL;
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (context, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_INT(num_keys);
}
@@ -2079,15 +2079,15 @@ weechat_python_api_key_unbind (PyObject *self, PyObject *args)
{
char *context, *key;
int num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
context = NULL;
key = NULL;
if (!PyArg_ParseTuple (args, "ss", &context, &key))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
num_keys = weechat_key_unbind (context, key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2100,14 +2100,14 @@ weechat_python_api_prefix (PyObject *self, PyObject *args)
{
char *prefix;
const char *result;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
prefix = NULL;
if (!PyArg_ParseTuple (args, "s", &prefix))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_prefix (prefix);
-
+
API_RETURN_STRING(result);
}
@@ -2120,14 +2120,14 @@ weechat_python_api_color (PyObject *self, PyObject *args)
{
char *color;
const char *result;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
color = NULL;
if (!PyArg_ParseTuple (args, "s", &color))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_color (color);
-
+
API_RETURN_STRING(result);
}
@@ -2139,18 +2139,18 @@ static PyObject *
weechat_python_api_prnt (PyObject *self, PyObject *args)
{
char *buffer, *message;
-
+
API_FUNC(0, "prnt", API_RETURN_ERROR);
buffer = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2164,7 +2164,7 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
{
char *buffer, *tags, *message;
int date;
-
+
API_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL;
date = 0;
@@ -2172,14 +2172,14 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args)
message = NULL;
if (!PyArg_ParseTuple (args, "siss", &buffer, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_date_tags (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
date,
tags,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2192,20 +2192,20 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args)
{
char *buffer, *message;
int y;
-
+
API_FUNC(1, "prnt_y", API_RETURN_ERROR);
buffer = NULL;
y = 0;
message = NULL;
if (!PyArg_ParseTuple (args, "sis", &buffer, &y, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_printf_y (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
y,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2217,16 +2217,16 @@ static PyObject *
weechat_python_api_log_print (PyObject *self, PyObject *args)
{
char *message;
-
+
API_FUNC(1, "log_print", API_RETURN_ERROR);
message = NULL;
if (!PyArg_ParseTuple (args, "s", &message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_log_printf (weechat_python_plugin,
python_current_script,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2245,7 +2245,7 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2253,12 +2253,12 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2268,10 +2268,10 @@ weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2285,7 +2285,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
char *command, *description, *arguments, *args_description, *completion;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
command = NULL;
description = NULL;
@@ -2297,7 +2297,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssssss", &command, &description, &arguments,
&args_description, &completion, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_command (weechat_python_plugin,
python_current_script,
command,
@@ -2308,7 +2308,7 @@ weechat_python_api_hook_command (PyObject *self, PyObject *args)
&weechat_python_api_hook_command_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2324,20 +2324,20 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2347,10 +2347,10 @@ weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2363,21 +2363,21 @@ weechat_python_api_hook_command_run (PyObject *self, PyObject *args)
{
char *command, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
command = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &command, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_python_plugin,
python_current_script,
command,
&weechat_python_api_hook_command_run_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2392,7 +2392,7 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2402,12 +2402,12 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2415,10 +2415,10 @@ weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2432,7 +2432,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
int interval, align_second, max_calls;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
interval = 10;
align_second = 0;
@@ -2442,7 +2442,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "iiiss", &interval, &align_second, &max_calls,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_python_plugin,
python_current_script,
interval,
@@ -2451,7 +2451,7 @@ weechat_python_api_hook_timer (PyObject *self, PyObject *args)
&weechat_python_api_hook_timer_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2466,21 +2466,21 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2488,10 +2488,10 @@ weechat_python_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2505,7 +2505,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
int fd, read, write, exception;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
fd = 0;
read = 0;
@@ -2516,7 +2516,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "iiiiss", &fd, &read, &write, &exception,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_python_plugin,
python_current_script,
fd,
@@ -2526,7 +2526,7 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
&weechat_python_api_hook_fd_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2543,24 +2543,24 @@ weechat_python_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2568,10 +2568,10 @@ weechat_python_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2585,7 +2585,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
char *command, *function, *data, *result;
int timeout;
PyObject *return_value;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
command = NULL;
timeout = 0;
@@ -2593,7 +2593,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
data = NULL;
if (!PyArg_ParseTuple (args, "siss", &command, &timeout, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_process (weechat_python_plugin,
python_current_script,
command,
@@ -2601,7 +2601,7 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
&weechat_python_api_hook_process_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2617,25 +2617,25 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
void *func_argv[5];
char str_status[32], str_gnutls_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2643,10 +2643,10 @@ weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2660,7 +2660,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
char *proxy, *address, *local_hostname, *function, *data, *result;
int port, sock, ipv6;
PyObject *return_value;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
proxy = NULL;
address = NULL;
@@ -2673,7 +2673,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssiiisss", &proxy, &address, &port, &sock,
&ipv6, &local_hostname, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_python_plugin,
python_current_script,
proxy,
@@ -2689,7 +2689,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
&weechat_python_api_hook_connect_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2709,16 +2709,16 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -2729,12 +2729,12 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2750,10 +2750,10 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2767,7 +2767,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
char *buffer, *tags, *message, *function, *data, *result;
int strip_colors;
PyObject *return_value;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
buffer = NULL;
tags = NULL;
@@ -2778,7 +2778,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssiss", &buffer, &tags, &message,
&strip_colors, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_print (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
@@ -2788,7 +2788,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
&weechat_python_api_hook_print_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2805,9 +2805,9 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -2830,12 +2830,12 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2845,10 +2845,10 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2861,21 +2861,21 @@ weechat_python_api_hook_signal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_python_plugin,
python_current_script,
signal,
&weechat_python_api_hook_signal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2888,14 +2888,14 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
{
char *signal, *type_data, *signal_data, *error;
int number;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
signal = NULL;
type_data = NULL;
signal_data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &type_data, &signal_data))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
weechat_hook_signal_send (signal, type_data, signal_data);
@@ -2917,7 +2917,7 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
script_str2ptr (signal_data));
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -2933,20 +2933,20 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssO", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2958,10 +2958,10 @@ weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
{
Py_XDECREF((PyObject *)func_argv[2]);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2974,21 +2974,21 @@ weechat_python_api_hook_hsignal (PyObject *self, PyObject *args)
{
char *signal, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
signal = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &signal, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_python_plugin,
python_current_script,
signal,
&weechat_python_api_hook_hsignal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3002,20 +3002,20 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
char *signal;
struct t_hashtable *hashtable;
PyObject *dict;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
signal = NULL;
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (signal, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_OK;
}
@@ -3030,7 +3030,7 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3038,12 +3038,12 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3051,10 +3051,10 @@ weechat_python_api_hook_config_cb (void *data, const char *option, const char *v
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3067,21 +3067,21 @@ weechat_python_api_hook_config (PyObject *self, PyObject *args)
{
char *option, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
option = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &option, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_config (weechat_python_plugin,
python_current_script,
option,
&weechat_python_api_hook_config_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3098,7 +3098,7 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3107,12 +3107,12 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3124,10 +3124,10 @@ weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3140,7 +3140,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
{
char *completion, *description, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
completion = NULL;
description = NULL;
@@ -3149,7 +3149,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssss", &completion, &description, &function,
&data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_python_plugin,
python_current_script,
completion,
@@ -3157,7 +3157,7 @@ weechat_python_api_hook_completion (PyObject *self, PyObject *args)
&weechat_python_api_hook_completion_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3170,7 +3170,7 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
{
char *completion, *word, *where;
int nick_completion;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
completion = NULL;
word = NULL;
@@ -3179,12 +3179,12 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssis", &completion, &word, &nick_completion,
&where))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion,
where);
-
+
API_RETURN_OK;
}
@@ -3199,22 +3199,22 @@ weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3227,21 +3227,21 @@ weechat_python_api_hook_modifier (PyObject *self, PyObject *args)
{
char *modifier, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
modifier = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &modifier, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_python_plugin,
python_current_script,
modifier,
&weechat_python_api_hook_modifier_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3254,16 +3254,16 @@ weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
{
char *modifier, *modifier_data, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
modifier = NULL;
modifier_data = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "sss", &modifier, &modifier_data, &string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3278,21 +3278,21 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3305,7 +3305,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *args_description, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
@@ -3315,7 +3315,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssss", &info_name, &description,
&args_description, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info (weechat_python_plugin,
python_current_script,
info_name,
@@ -3324,7 +3324,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
&weechat_python_api_hook_info_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3340,28 +3340,28 @@ weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
void *func_argv[3];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
-
+
ret_hashtable = weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssO", func_argv);
-
+
if (func_argv[2])
{
Py_XDECREF((PyObject *)func_argv[2]);
}
-
+
return ret_hashtable;
}
-
+
return NULL;
}
@@ -3375,7 +3375,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
char *info_name, *description, *args_description, *output_description;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
info_name = NULL;
description = NULL;
@@ -3387,7 +3387,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
&args_description, &output_description,
&function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_python_plugin,
python_current_script,
info_name,
@@ -3397,7 +3397,7 @@ weechat_python_api_hook_info_hashtable (PyObject *self, PyObject *args)
&weechat_python_api_hook_info_hashtable_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3413,27 +3413,27 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3447,7 +3447,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
infolist_name = NULL;
description = NULL;
@@ -3459,7 +3459,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
&pointer_description, &args_description, &function,
&data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_python_plugin,
python_current_script,
infolist_name,
@@ -3469,7 +3469,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
&weechat_python_api_hook_infolist_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3485,14 +3485,14 @@ weechat_python_api_hook_focus_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
struct t_hashtable *ret_hashtable;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = weechat_python_hashtable_to_dict (info);
-
+
ret_hashtable = weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
@@ -3501,10 +3501,10 @@ weechat_python_api_hook_focus_cb (void *data,
{
Py_XDECREF((PyObject *)func_argv[1]);
}
-
+
return ret_hashtable;
}
-
+
return NULL;
}
@@ -3517,21 +3517,21 @@ weechat_python_api_hook_focus (PyObject *self, PyObject *args)
{
char *area, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
area = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &area, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_python_plugin,
python_current_script,
area,
&weechat_python_api_hook_focus_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3543,16 +3543,16 @@ static PyObject *
weechat_python_api_unhook (PyObject *self, PyObject *args)
{
char *hook;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
hook = NULL;
if (!PyArg_ParseTuple (args, "s", &hook))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_unhook (weechat_python_plugin,
python_current_script,
script_str2ptr (hook));
-
+
API_RETURN_OK;
}
@@ -3565,11 +3565,11 @@ weechat_python_api_unhook_all (PyObject *self, PyObject *args)
{
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (python_current_script);
-
+
API_RETURN_OK;
}
@@ -3585,15 +3585,15 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3607,10 +3607,10 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3625,14 +3625,14 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3646,10 +3646,10 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3663,7 +3663,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
char *name, *function_input, *data_input, *function_close, *data_close;
char *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
name = NULL;
function_input = NULL;
@@ -3673,7 +3673,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sssss", &name, &function_input, &data_input,
&function_close, &data_close))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_python_plugin,
python_current_script,
name,
@@ -3683,7 +3683,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
&weechat_python_api_buffer_close_cb,
function_close,
data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3697,15 +3697,15 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args)
char *plugin, *name;
char *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
plugin = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &plugin, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search (plugin, name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3718,14 +3718,14 @@ weechat_python_api_buffer_search_main (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3738,14 +3738,14 @@ weechat_python_api_current_buffer (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3757,14 +3757,14 @@ static PyObject *
weechat_python_api_buffer_clear (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_clear (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3776,16 +3776,16 @@ static PyObject *
weechat_python_api_buffer_close (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_buffer_close (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -3797,16 +3797,16 @@ static PyObject *
weechat_python_api_buffer_merge (PyObject *self, PyObject *args)
{
char *buffer, *target_buffer;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
buffer = NULL;
target_buffer = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &target_buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_merge (script_str2ptr (buffer),
script_str2ptr (target_buffer));
-
+
API_RETURN_OK;
}
@@ -3820,15 +3820,15 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args)
{
char *buffer;
int number;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
buffer = NULL;
number = 0;
if (!PyArg_ParseTuple (args, "si", &buffer, &number))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_unmerge (script_str2ptr (buffer), number);
-
+
API_RETURN_OK;
}
@@ -3841,15 +3841,15 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *property;
int value;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_buffer_get_integer (script_str2ptr (buffer), property);
-
+
API_RETURN_INT(value);
}
@@ -3862,15 +3862,15 @@ weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
{
char *buffer, *property;
const char *result;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
-
+
API_RETURN_STRING(result);
}
@@ -3883,16 +3883,16 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3904,18 +3904,18 @@ static PyObject *
weechat_python_api_buffer_set (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
buffer = NULL;
property = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_set (script_str2ptr (buffer),
property,
value);
-
+
API_RETURN_OK;
}
@@ -3929,15 +3929,15 @@ weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *ar
{
char *buffer, *string, *result;
PyObject *return_value;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
buffer = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3951,15 +3951,15 @@ weechat_python_api_buffer_match_list (PyObject *self, PyObject *args)
{
char *buffer, *string;
int value;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
buffer = NULL;
string = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_buffer_match_list (script_str2ptr (buffer), string);
-
+
API_RETURN_INT(value);
}
@@ -3972,14 +3972,14 @@ weechat_python_api_current_window (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3993,14 +3993,14 @@ weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args)
{
char *buffer, *result;
PyObject *return_value;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4013,15 +4013,15 @@ weechat_python_api_window_get_integer (PyObject *self, PyObject *args)
{
char *window, *property;
int value;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_window_get_integer (script_str2ptr (window), property);
-
+
API_RETURN_INT(value);
}
@@ -4034,15 +4034,15 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
{
char *window, *property;
const char *result;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_window_get_string (script_str2ptr (window), property);
-
+
API_RETURN_STRING(result);
}
@@ -4055,16 +4055,16 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
{
char *window, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
window = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &window, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4076,14 +4076,14 @@ static PyObject *
weechat_python_api_window_set_title (PyObject *self, PyObject *args)
{
char *title;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
title = NULL;
if (!PyArg_ParseTuple (args, "s", &title))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_window_set_title (title);
-
+
API_RETURN_OK;
}
@@ -4097,7 +4097,7 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
char *buffer, *parent_group, *name, *color, *result;
int visible;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
buffer = NULL;
parent_group = NULL;
@@ -4107,13 +4107,13 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssssi", &buffer, &parent_group, &name,
&color, &visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
name,
color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4126,18 +4126,18 @@ weechat_python_api_nicklist_search_group (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4151,7 +4151,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
char *buffer, *group, *name, *color, *prefix, *prefix_color, *result;
int visible;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
@@ -4163,7 +4163,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ssssssi", &buffer, &group, &name, &color,
&prefix, &prefix_color, &visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
name,
@@ -4171,7 +4171,7 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args)
prefix,
prefix_color,
visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4184,18 +4184,18 @@ weechat_python_api_nicklist_search_nick (PyObject *self, PyObject *args)
{
char *buffer, *from_group, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
buffer = NULL;
from_group = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4207,16 +4207,16 @@ static PyObject *
weechat_python_api_nicklist_remove_group (PyObject *self, PyObject *args)
{
char *buffer, *group;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &group))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
-
+
API_RETURN_OK;
}
@@ -4228,16 +4228,16 @@ static PyObject *
weechat_python_api_nicklist_remove_nick (PyObject *self, PyObject *args)
{
char *buffer, *nick;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &nick))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
-
+
API_RETURN_OK;
}
@@ -4249,14 +4249,14 @@ static PyObject *
weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args)
{
char *buffer;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
buffer = NULL;
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_all (script_str2ptr (buffer));
-
+
API_RETURN_OK;
}
@@ -4269,18 +4269,18 @@ weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property;
int value;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_INT(value);
}
@@ -4293,18 +4293,18 @@ weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args)
{
char *buffer, *group, *property;
const char *result;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4317,18 +4317,18 @@ weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
group = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4340,7 +4340,7 @@ static PyObject *
weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
{
char *buffer, *group, *property, *value;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
buffer = NULL;
group = NULL;
@@ -4348,12 +4348,12 @@ weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args)
value = NULL;
if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4366,18 +4366,18 @@ weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property;
int value;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_INT(value);
}
@@ -4390,18 +4390,18 @@ weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property;
const char *result;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4414,18 +4414,18 @@ weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *result;
PyObject *return_value;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
buffer = NULL;
nick = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4437,7 +4437,7 @@ static PyObject *
weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
{
char *buffer, *nick, *property, *value;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
buffer = NULL;
nick = NULL;
@@ -4445,12 +4445,12 @@ weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args)
value = NULL;
if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4463,14 +4463,14 @@ weechat_python_api_bar_item_search (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_item_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4485,7 +4485,7 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4493,20 +4493,20 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4519,21 +4519,21 @@ weechat_python_api_bar_item_new (PyObject *self, PyObject *args)
{
char *name, *function, *data, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
name = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &function, &data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_python_plugin,
python_current_script,
name,
&weechat_python_api_bar_item_build_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4545,14 +4545,14 @@ static PyObject *
weechat_python_api_bar_item_update (PyObject *self, PyObject *args)
{
char *name;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_item_update (name);
-
+
API_RETURN_OK;
}
@@ -4564,16 +4564,16 @@ static PyObject *
weechat_python_api_bar_item_remove (PyObject *self, PyObject *args)
{
char *item;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
item = NULL;
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_bar_item_remove (weechat_python_plugin,
python_current_script,
script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -4586,14 +4586,14 @@ weechat_python_api_bar_search (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_search (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4608,7 +4608,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
char *filling_top_bottom, *filling_left_right, *size, *size_max;
char *color_fg, *color_delim, *color_bg, *separator, *items, *result;
PyObject *return_value;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
name = NULL;
hidden = NULL;
@@ -4630,7 +4630,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
&filling_left_right, &size, &size_max, &color_fg,
&color_delim, &color_bg, &separator, &items))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_new (name,
hidden,
priority,
@@ -4646,7 +4646,7 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
color_bg,
separator,
items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4658,18 +4658,18 @@ static PyObject *
weechat_python_api_bar_set (PyObject *self, PyObject *args)
{
char *bar, *property, *value;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
bar = NULL;
property = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_set (script_str2ptr (bar),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4681,14 +4681,14 @@ static PyObject *
weechat_python_api_bar_update (PyObject *self, PyObject *args)
{
char *name;
-
+
API_FUNC(1, "bar_item", API_RETURN_ERROR);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_update (name);
-
+
API_RETURN_OK;
}
@@ -4700,14 +4700,14 @@ static PyObject *
weechat_python_api_bar_remove (PyObject *self, PyObject *args)
{
char *bar;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
bar = NULL;
if (!PyArg_ParseTuple (args, "s", &bar))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_remove (script_str2ptr (bar));
-
+
API_RETURN_OK;
}
@@ -4719,18 +4719,18 @@ static PyObject *
weechat_python_api_command (PyObject *self, PyObject *args)
{
char *buffer, *command;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
buffer = NULL;
command = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &command))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_command (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
command);
-
+
API_RETURN_OK;
}
@@ -4743,15 +4743,15 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
{
char *info_name, *arguments;
const char *result;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
info_name = NULL;
arguments = NULL;
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_info_get (info_name, arguments);
-
+
API_RETURN_STRING(result);
}
@@ -4765,14 +4765,14 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
char *info_name;
struct t_hashtable *hashtable, *result_hashtable;
PyObject *dict, *result_dict;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
info_name = NULL;
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (info_name, hashtable);
result_dict = weechat_python_hashtable_to_dict (result_hashtable);
@@ -4780,7 +4780,7 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
weechat_hashtable_free (hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
return result_dict;
}
@@ -4793,13 +4793,13 @@ weechat_python_api_infolist_new (PyObject *self, PyObject *args)
{
char *result;
PyObject *return_value;
-
+
/* make C compiler happy */
(void) args;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4812,14 +4812,14 @@ weechat_python_api_infolist_new_item (PyObject *self, PyObject *args)
{
char *infolist, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4834,18 +4834,18 @@ weechat_python_api_infolist_new_var_integer (PyObject *self, PyObject *args)
char *infolist, *name, *result;
int value;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4859,18 +4859,18 @@ weechat_python_api_infolist_new_var_string (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4884,18 +4884,18 @@ weechat_python_api_infolist_new_var_pointer (PyObject *self, PyObject *args)
{
char *infolist, *name, *value, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist),
name,
script_str2ptr (value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4910,18 +4910,18 @@ weechat_python_api_infolist_new_var_time (PyObject *self, PyObject *args)
char *infolist, *name, *result;
int value;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
infolist = NULL;
name = NULL;
value = 0;
if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist),
name,
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4934,18 +4934,18 @@ weechat_python_api_infolist_get (PyObject *self, PyObject *args)
{
char *name, *pointer, *arguments, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
name = NULL;
pointer = NULL;
arguments = NULL;
if (!PyArg_ParseTuple (args, "sss", &name, &pointer, &arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4958,14 +4958,14 @@ weechat_python_api_infolist_next (PyObject *self, PyObject *args)
{
char *infolist;
int value;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_next (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -4978,14 +4978,14 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args)
{
char *infolist;
int value;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_prev (script_str2ptr (infolist));
-
+
API_RETURN_INT(value);
}
@@ -4998,14 +4998,14 @@ static PyObject *
weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args)
{
char *infolist;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5018,14 +5018,14 @@ weechat_python_api_infolist_fields (PyObject *self, PyObject *args)
{
char *infolist;
const char *result;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_fields (script_str2ptr (infolist));
-
+
API_RETURN_STRING(result);
}
@@ -5038,16 +5038,16 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args)
{
char *infolist, *variable;
int value;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_infolist_integer (script_str2ptr (infolist),
variable);
-
+
API_RETURN_INT(value);
}
@@ -5060,16 +5060,16 @@ weechat_python_api_infolist_string (PyObject *self, PyObject *args)
{
char *infolist, *variable;
const char *result;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_string (script_str2ptr (infolist),
variable);
-
+
API_RETURN_STRING(result);
}
@@ -5082,16 +5082,16 @@ weechat_python_api_infolist_pointer (PyObject *self, PyObject *args)
{
char *infolist, *variable, *result;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5105,18 +5105,18 @@ weechat_python_api_infolist_time (PyObject *self, PyObject *args)
char *infolist, *variable, timebuffer[64], *result;
time_t time;
PyObject *return_value;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
infolist = NULL;
variable = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist, &variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_infolist_time (script_str2ptr (infolist),
variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5128,14 +5128,14 @@ static PyObject *
weechat_python_api_infolist_free (PyObject *self, PyObject *args)
{
char *infolist;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
infolist = NULL;
if (!PyArg_ParseTuple (args, "s", &infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_free (script_str2ptr (infolist));
-
+
API_RETURN_OK;
}
@@ -5148,14 +5148,14 @@ weechat_python_api_hdata_get (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5168,15 +5168,15 @@ weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args)
{
char *hdata, *name;
int value;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
-
+
API_RETURN_INT(value);
}
@@ -5190,15 +5190,15 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
{
char *hdata, *name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5211,15 +5211,15 @@ weechat_python_api_hdata_get_var_hdata (PyObject *self, PyObject *args)
{
char *hdata, *name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5232,16 +5232,16 @@ weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
{
char *hdata, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5255,18 +5255,18 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args)
char *result, *hdata, *pointer;
int count;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
count = 0;
if (!PyArg_ParseTuple (args, "ssi", &hdata, &pointer, &count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5280,18 +5280,18 @@ weechat_python_api_hdata_integer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
int value;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_INT(value);
}
@@ -5305,18 +5305,18 @@ weechat_python_api_hdata_long (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
long value;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_LONG(value);
}
@@ -5330,18 +5330,18 @@ weechat_python_api_hdata_string (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
const char *result;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_STRING(result);
}
@@ -5355,18 +5355,18 @@ weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, *result;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5381,20 +5381,20 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
char *hdata, *pointer, *name, timebuffer[64], *result;
time_t time;
PyObject *return_value;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5407,15 +5407,15 @@ weechat_python_api_hdata_get_string (PyObject *self, PyObject *args)
{
char *hdata, *property;
const char *result;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
hdata = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
-
+
API_RETURN_STRING(result);
}
@@ -5429,15 +5429,15 @@ weechat_python_api_upgrade_new (PyObject *self, PyObject *args)
char *filename, *result;
int write;
PyObject *return_value;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
filename = NULL;
write = 0;
if (!PyArg_ParseTuple (args, "si", &filename, &write))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_upgrade_new (filename, write));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5450,18 +5450,18 @@ weechat_python_api_upgrade_write_object (PyObject *self, PyObject *args)
{
char *upgrade_file, *infolist;
int object_id, rc;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
upgrade_file = NULL;
object_id = 0;
infolist = NULL;
if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
-
+
API_RETURN_INT(rc);
}
@@ -5479,23 +5479,23 @@ weechat_python_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -5507,10 +5507,10 @@ weechat_python_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -5523,21 +5523,21 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args)
{
char *upgrade_file, *function, *data;
int rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
upgrade_file = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "sss", &upgrade_file, &function, &data))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
rc = script_api_upgrade_read (weechat_python_plugin,
python_current_script,
script_str2ptr (upgrade_file),
&weechat_python_api_upgrade_read_cb,
function,
data);
-
+
API_RETURN_INT(rc);
}
@@ -5549,14 +5549,14 @@ static PyObject *
weechat_python_api_upgrade_close (PyObject *self, PyObject *args)
{
char *upgrade_file;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
upgrade_file = NULL;
if (!PyArg_ParseTuple (args, "s", &upgrade_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_upgrade_close (script_str2ptr (upgrade_file));
-
+
API_RETURN_OK;
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index a6fe6f663..612c40f2c 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -83,12 +83,12 @@ weechat_python_set_python2_bin ()
char *versions[] = { "2", "2.7", "2.6", "2.5", "2.4", "2.3", "2.2", NULL };
int num_paths, i, j, rc;
struct stat stat_buf;
-
+
python2_bin = NULL;
-
+
dir_separator = weechat_info_get ("dir_separator", "");
path = getenv ("PATH");
-
+
if (dir_separator && path)
{
paths = weechat_string_split (path, ":", 0, 0, &num_paths);
@@ -114,7 +114,7 @@ weechat_python_set_python2_bin ()
weechat_string_free_split (paths);
}
}
-
+
if (!python2_bin)
python2_bin = strdup ("python");
}
@@ -134,14 +134,14 @@ weechat_python_hashtable_map_cb (void *data,
/* make C compiler happy */
(void) hashtable;
-
+
dict = (PyObject *)data;
-
+
dict_key = Py_BuildValue ("s", (const char *)key);
dict_value = Py_BuildValue ("s", (const char *)value);
-
+
PyDict_SetItem (dict, dict_key, dict_value);
-
+
Py_DECREF (dict_key);
Py_DECREF (dict_value);
}
@@ -155,18 +155,18 @@ PyObject *
weechat_python_hashtable_to_dict (struct t_hashtable *hashtable)
{
PyObject *dict;
-
+
dict = PyDict_New ();
if (!dict)
{
Py_INCREF(Py_None);
return Py_None;
}
-
+
weechat_hashtable_map (hashtable,
&weechat_python_hashtable_map_cb,
dict);
-
+
return dict;
}
@@ -186,7 +186,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
PyObject *key, *value;
Py_ssize_t pos;
char *str_key, *str_value;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -194,7 +194,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
pos = 0;
while (PyDict_Next (dict, &pos, &key, &value))
{
@@ -202,7 +202,7 @@ weechat_python_dict_to_hashtable (PyObject *dict, int hashtable_size)
str_value = PyString_AsString (value);
weechat_hashtable_set (hashtable, str_key, str_value);
}
-
+
return hashtable;
}
@@ -223,9 +223,9 @@ weechat_python_exec (struct t_plugin_script *script,
PyObject *rc;
void *argv2[16], *ret_value;
int i, argc, *ret_int;
-
+
/* PyEval_AcquireLock (); */
-
+
old_python_current_script = python_current_script;
old_interpreter = NULL;
if (script->interpreter)
@@ -233,11 +233,11 @@ weechat_python_exec (struct t_plugin_script *script,
old_interpreter = PyThreadState_Swap (NULL);
PyThreadState_Swap (script->interpreter);
}
-
+
evMain = PyImport_AddModule ((char *) "__main__");
evDict = PyModule_GetDict (evMain);
evFunc = PyDict_GetItemString (evDict, function);
-
+
if ( !(evFunc && PyCallable_Check (evFunc)) )
{
weechat_printf (NULL,
@@ -248,7 +248,7 @@ weechat_python_exec (struct t_plugin_script *script,
PyThreadState_Swap (old_interpreter);
return NULL;
}
-
+
python_current_script = script;
if (argv && argv[0])
@@ -272,16 +272,16 @@ weechat_python_exec (struct t_plugin_script *script,
{
rc = PyObject_CallFunction (evFunc, NULL);
}
-
+
ret_value = NULL;
-
+
/*
* ugly hack : rc = NULL while 'return weechat.WEECHAT_RC_OK ....
* because of '#define WEECHAT_RC_OK 0'
*/
if (rc == NULL)
rc = PyInt_FromLong (0);
-
+
if (PyErr_Occurred())
{
PyErr_Print ();
@@ -316,21 +316,21 @@ weechat_python_exec (struct t_plugin_script *script,
"a valid value"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
}
-
+
if (ret_value == NULL)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: error in function \"%s\""),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
}
-
+
/* PyEval_ReleaseThread (python_current_script->interpreter); */
-
+
python_current_script = old_python_current_script;
-
+
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
-
+
return ret_value;
}
@@ -342,10 +342,10 @@ static PyObject *
weechat_python_output (PyObject *self, PyObject *args)
{
char *msg, *m, *p;
-
+
/* make C compiler happy */
(void) self;
-
+
msg = NULL;
if (!PyArg_ParseTuple (args, "s", &msg))
@@ -385,7 +385,7 @@ weechat_python_output (PyObject *self, PyObject *args)
else
strcat (python_buffer_output, m);
}
-
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -415,7 +415,7 @@ weechat_python_load (const char *filename)
const char *weechat_home;
char *p_home;
int len;
-
+
if ((fp = fopen (filename, "r")) == NULL)
{
weechat_printf (NULL,
@@ -423,21 +423,21 @@ weechat_python_load (const char *filename)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PYTHON_PLUGIN_NAME, filename);
}
-
+
python_current_script = NULL;
python_registered_script = NULL;
-
+
/* PyEval_AcquireLock (); */
python_current_interpreter = Py_NewInterpreter ();
PySys_SetArgv(1, argv);
-
+
if (python_current_interpreter == NULL)
{
weechat_printf (NULL,
@@ -448,9 +448,9 @@ weechat_python_load (const char *filename)
/* PyEval_ReleaseLock (); */
return 0;
}
-
+
PyThreadState_Swap (python_current_interpreter);
-
+
weechat_module = Py_InitModule ("weechat", weechat_python_funcs);
if ( weechat_module == NULL)
@@ -460,7 +460,7 @@ weechat_python_load (const char *filename)
"module"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
fclose (fp);
-
+
Py_EndInterpreter (python_current_interpreter);
/* PyEval_ReleaseLock (); */
@@ -486,13 +486,13 @@ weechat_python_load (const char *filename)
free (p_home);
}
}
-
+
/* define some constants */
weechat_dict = PyModule_GetDict(weechat_module);
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK", PyInt_FromLong((long) WEECHAT_RC_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_EAT", PyInt_FromLong((long) WEECHAT_RC_OK_EAT));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_ERROR", PyInt_FromLong((long) WEECHAT_RC_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_OK", PyInt_FromLong((long) WEECHAT_CONFIG_READ_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_MEMORY_ERROR", PyInt_FromLong((long) WEECHAT_CONFIG_READ_MEMORY_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", PyInt_FromLong((long) WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
@@ -507,19 +507,19 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_ERROR", PyInt_FromLong((long) WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_SORT", PyString_FromString(WEECHAT_LIST_POS_SORT));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_BEGINNING", PyString_FromString(WEECHAT_LIST_POS_BEGINNING));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_END", PyString_FromString(WEECHAT_LIST_POS_END));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_LOW", PyString_FromString(WEECHAT_HOTLIST_LOW));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_MESSAGE", PyString_FromString(WEECHAT_HOTLIST_MESSAGE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_PRIVATE", PyString_FromString(WEECHAT_HOTLIST_PRIVATE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_HIGHLIGHT", PyString_FromString(WEECHAT_HOTLIST_HIGHLIGHT));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_PROCESS_RUNNING", PyInt_FromLong((long) WEECHAT_HOOK_PROCESS_RUNNING));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_PROCESS_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_PROCESS_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_OK", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
@@ -529,11 +529,11 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
-
+
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_STRING", PyString_FromString(WEECHAT_HOOK_SIGNAL_STRING));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyString_FromString(WEECHAT_HOOK_SIGNAL_INT));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_POINTER", PyString_FromString(WEECHAT_HOOK_SIGNAL_POINTER));
-
+
weechat_outputs = Py_InitModule("weechatOutputs",
weechat_python_output_funcs);
if (weechat_outputs == NULL)
@@ -558,9 +558,9 @@ weechat_python_load (const char *filename)
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
}
-
+
python_current_script_filename = filename;
-
+
if (PyRun_SimpleFile (fp, filename) != 0)
{
weechat_printf (NULL,
@@ -570,7 +570,7 @@ weechat_python_load (const char *filename)
if (PyErr_Occurred ())
PyErr_Print ();
-
+
/* if script was registered, removing from list */
if (python_current_script != NULL)
{
@@ -578,10 +578,10 @@ weechat_python_load (const char *filename)
&python_scripts, &last_python_script,
python_current_script);
}
-
+
Py_EndInterpreter (python_current_interpreter);
/* PyEval_ReleaseLock (); */
-
+
return 0;
}
@@ -589,14 +589,14 @@ weechat_python_load (const char *filename)
PyErr_Print ();
fclose (fp);
-
+
if (!python_registered_script)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
"found (or failed) in file \"%s\""),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
-
+
if (PyErr_Occurred ())
PyErr_Print ();
Py_EndInterpreter (python_current_interpreter);
@@ -605,10 +605,10 @@ weechat_python_load (const char *filename)
return 0;
}
python_current_script = python_registered_script;
-
+
python_current_script->interpreter = (PyThreadState *) python_current_interpreter;
/* PyEval_ReleaseThread (python_current_script->interpreter); */
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -618,7 +618,7 @@ weechat_python_load (const char *filename)
python_current_script,
&weechat_python_api_buffer_input_data_cb,
&weechat_python_api_buffer_close_cb);
-
+
return 1;
}
@@ -631,7 +631,7 @@ weechat_python_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_python_load (filename);
}
@@ -645,14 +645,14 @@ weechat_python_unload (struct t_plugin_script *script)
int *rc;
void *interpreter;
PyThreadState *old_interpreter;
-
+
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
PYTHON_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT,
@@ -660,20 +660,20 @@ weechat_python_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
old_interpreter = PyThreadState_Swap (NULL);
interpreter = script->interpreter;
-
+
if (python_current_script == script)
python_current_script = (python_current_script->prev_script) ?
python_current_script->prev_script : python_current_script->next_script;
-
+
script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
script);
-
+
PyThreadState_Swap (interpreter);
Py_EndInterpreter (interpreter);
-
+
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
}
@@ -686,7 +686,7 @@ void
weechat_python_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_python_plugin, python_scripts, name);
if (ptr_script)
{
@@ -725,7 +725,7 @@ weechat_python_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_python_plugin, python_scripts, name);
if (ptr_script)
{
@@ -757,7 +757,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
@@ -833,7 +833,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
"python");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -850,9 +850,9 @@ weechat_python_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_python_plugin, completion, python_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -867,12 +867,12 @@ weechat_python_info_cb (void *data, const char *info_name,
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (weechat_strcasecmp (info_name, "python2_bin") == 0)
{
return python2_bin;
}
-
+
return NULL;
}
@@ -886,17 +886,17 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "python_script") == 0)
{
return script_infolist_list_scripts (weechat_python_plugin,
python_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -913,13 +913,13 @@ weechat_python_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, PYTHON_PLUGIN_NAME) == 0))
{
script_print_log (weechat_python_plugin, python_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -937,10 +937,10 @@ weechat_python_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (python_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -972,7 +972,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
&python_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -988,7 +988,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "python_script_install") == 0)
@@ -1008,7 +1008,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
&python_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1020,7 +1020,7 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_python_plugin = plugin;
-
+
/*
* hook info to get path to python 2.x interpreter
* (some scripts using hook_process need that)
@@ -1030,10 +1030,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
N_("path to python 2.x interpreter"),
NULL,
&weechat_python_info_cb, NULL);
-
+
/* init stdout/stderr buffer */
python_buffer_output[0] = '\0';
-
+
Py_Initialize ();
if (Py_IsInitialized () == 0)
{
@@ -1043,7 +1043,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
-
+
PyEval_InitThreads();
/* python_mainThreadState = PyThreadState_Swap(NULL); */
python_mainThreadState = PyEval_SaveThread();
@@ -1070,10 +1070,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_python_signal_script_action_cb,
&weechat_python_load_cb);
python_quiet = 0;
-
+
script_display_short_list (weechat_python_plugin,
python_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -1089,7 +1089,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
python_quiet = 1;
script_end (plugin, &python_scripts, &weechat_python_unload_all);
python_quiet = 0;
-
+
/* free Python interpreter */
if (python_mainThreadState != NULL)
{
@@ -1098,7 +1098,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
/* PyEval_ReleaseLock (); */
python_mainThreadState = NULL;
}
-
+
Py_Finalize ();
if (Py_IsInitialized () != 0)
{
@@ -1106,7 +1106,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
weechat_gettext ("%s%s: unable to free interpreter"),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
-
+
/* free some data */
if (python2_bin)
free (python2_bin);
@@ -1114,6 +1114,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
free (python_action_install_list);
if (python_action_remove_list)
free (python_action_remove_list);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index ba743c862..970e0d3c0 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -82,7 +82,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
{
char *c_name, *c_author, *c_version, *c_license, *c_description;
char *c_shutdown_func, *c_charset;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
ruby_current_script = NULL;
ruby_registered_script = NULL;
@@ -90,7 +90,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
|| NIL_P (license) || NIL_P (description) || NIL_P (shutdown_func)
|| NIL_P (charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (name, T_STRING);
Check_Type (author, T_STRING);
Check_Type (version, T_STRING);
@@ -98,7 +98,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
Check_Type (description, T_STRING);
Check_Type (shutdown_func, T_STRING);
Check_Type (charset, T_STRING);
-
+
c_name = StringValuePtr (name);
c_author = StringValuePtr (author);
c_version = StringValuePtr (version);
@@ -106,7 +106,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
c_description = StringValuePtr (description);
c_shutdown_func = StringValuePtr (shutdown_func);
c_charset = StringValuePtr (charset);
-
+
if (script_search (weechat_ruby_plugin, ruby_scripts, c_name))
{
/* error: another scripts already exists with this name! */
@@ -117,7 +117,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
weechat_prefix ("error"), RUBY_PLUGIN_NAME, c_name);
API_RETURN_ERROR;
}
-
+
/* register script */
ruby_current_script = script_add (weechat_ruby_plugin,
&ruby_scripts, &last_ruby_script,
@@ -126,7 +126,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
c_name, c_author, c_version, c_license,
c_description, c_shutdown_func,
c_charset);
-
+
if (ruby_current_script)
{
ruby_registered_script = ruby_current_script;
@@ -142,7 +142,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -156,17 +156,17 @@ weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin)
{
char *c_plugin;
const char *result;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (NIL_P (plugin))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (plugin, T_STRING);
-
+
c_plugin = StringValuePtr (plugin);
-
+
result = weechat_plugin_get_name (script_str2ptr (c_plugin));
-
+
API_RETURN_STRING(result);
}
@@ -178,17 +178,17 @@ static VALUE
weechat_ruby_api_charset_set (VALUE class, VALUE charset)
{
char *c_charset;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (NIL_P (charset))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (charset, T_STRING);
-
+
c_charset = StringValuePtr (charset);
-
+
script_api_charset_set (ruby_current_script, c_charset);
-
+
API_RETURN_OK;
}
@@ -201,19 +201,19 @@ weechat_ruby_api_iconv_to_internal (VALUE class, VALUE charset, VALUE string)
{
char *c_charset, *c_string, *result;
VALUE return_value;
-
+
API_FUNC(1, "iconv_to_internal", API_RETURN_EMPTY);
if (NIL_P (charset) || NIL_P (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (charset, T_STRING);
Check_Type (string, T_STRING);
-
+
c_charset = StringValuePtr (charset);
c_string = StringValuePtr (string);
-
+
result = weechat_iconv_to_internal (c_charset, c_string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -227,19 +227,19 @@ weechat_ruby_api_iconv_from_internal (VALUE class, VALUE charset, VALUE string)
{
char *c_charset, *c_string, *result;
VALUE return_value;
-
+
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (NIL_P (charset) || NIL_P (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (charset, T_STRING);
Check_Type (string, T_STRING);
-
+
c_charset = StringValuePtr (charset);
c_string = StringValuePtr (string);
-
+
result = weechat_iconv_from_internal (c_charset, c_string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -252,17 +252,17 @@ weechat_ruby_api_gettext (VALUE class, VALUE string)
{
char *c_string;
const char *result;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (NIL_P (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (string, T_STRING);
-
+
c_string = StringValuePtr (string);
-
+
result = weechat_gettext (c_string);
-
+
API_RETURN_STRING(result);
}
@@ -277,21 +277,21 @@ weechat_ruby_api_ngettext (VALUE class, VALUE single, VALUE plural,
char *c_single, *c_plural;
const char *result;
int c_count;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (NIL_P (single) || NIL_P (plural) || NIL_P (count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (single, T_STRING);
Check_Type (plural, T_STRING);
Check_Type (count, T_FIXNUM);
-
+
c_single = StringValuePtr (single);
c_plural = StringValuePtr (plural);
c_count = FIX2INT (count);
-
+
result = weechat_ngettext (c_single, c_plural, c_count);
-
+
API_RETURN_STRING(result);
}
@@ -307,21 +307,21 @@ weechat_ruby_api_string_match (VALUE class, VALUE string, VALUE mask,
{
char *c_string, *c_mask;
int c_case_sensitive, value;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (mask) || NIL_P (case_sensitive))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (string, T_STRING);
Check_Type (mask, T_STRING);
Check_Type (case_sensitive, T_FIXNUM);
-
+
c_string = StringValuePtr (string);
c_mask = StringValuePtr (mask);
c_case_sensitive = FIX2INT (case_sensitive);
-
+
value = weechat_string_match (c_string, c_mask, c_case_sensitive);
-
+
API_RETURN_INT(value);
}
@@ -339,19 +339,19 @@ weechat_ruby_api_string_has_highlight (VALUE class, VALUE string,
{
char *c_string, *c_highlight_words;
int value;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (highlight_words))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (string, T_STRING);
Check_Type (highlight_words, T_STRING);
-
+
c_string = StringValuePtr (string);
c_highlight_words = StringValuePtr (highlight_words);
-
+
value = weechat_string_has_highlight (c_string, c_highlight_words);
-
+
API_RETURN_INT(value);
}
@@ -369,19 +369,19 @@ weechat_ruby_api_string_has_highlight_regex (VALUE class, VALUE string,
{
char *c_string, *c_regex;
int value;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (NIL_P (string) || NIL_P (regex))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (string, T_STRING);
Check_Type (regex, T_STRING);
-
+
c_string = StringValuePtr (string);
c_regex = StringValuePtr (regex);
-
+
value = weechat_string_has_highlight_regex (c_string, c_regex);
-
+
API_RETURN_INT(value);
}
@@ -397,17 +397,17 @@ weechat_ruby_api_string_mask_to_regex (VALUE class, VALUE mask)
{
char *c_mask, *result;
VALUE return_value;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (NIL_P (mask))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (mask, T_STRING);
-
+
c_mask = StringValuePtr (mask);
-
+
result = weechat_string_mask_to_regex (c_mask);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -421,19 +421,19 @@ weechat_ruby_api_string_remove_color (VALUE class, VALUE string,
{
char *c_string, *c_replacement, *result;
VALUE return_value;
-
+
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (NIL_P (string) || NIL_P (replacement))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (string, T_STRING);
Check_Type (replacement, T_STRING);
-
+
c_string = StringValuePtr (string);
c_replacement = StringValuePtr (replacement);
-
+
result = weechat_string_remove_color (c_string, c_replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -447,17 +447,17 @@ weechat_ruby_api_string_is_command_char (VALUE class, VALUE string)
{
char *c_string;
int value;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (NIL_P (string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (string, T_STRING);
-
+
c_string = StringValuePtr (string);
-
+
value = weechat_string_is_command_char (c_string);
-
+
API_RETURN_INT(value);
}
@@ -472,17 +472,17 @@ weechat_ruby_api_string_input_for_buffer (VALUE class, VALUE string)
{
char *c_string;
const char *result;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (NIL_P (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (string, T_STRING);
-
+
c_string = StringValuePtr (string);
-
+
result = weechat_string_input_for_buffer (c_string);
-
+
API_RETURN_STRING(result);
}
@@ -495,20 +495,20 @@ weechat_ruby_api_mkdir_home (VALUE class, VALUE directory, VALUE mode)
{
char *c_directory;
int c_mode;
-
+
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
-
+
c_directory = StringValuePtr (directory);
c_mode = FIX2INT (mode);
-
+
if (weechat_mkdir_home (c_directory, c_mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -521,20 +521,20 @@ weechat_ruby_api_mkdir (VALUE class, VALUE directory, VALUE mode)
{
char *c_directory;
int c_mode;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
-
+
c_directory = StringValuePtr (directory);
c_mode = FIX2INT (mode);
-
+
if (weechat_mkdir (c_directory, c_mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -548,20 +548,20 @@ weechat_ruby_api_mkdir_parents (VALUE class, VALUE directory, VALUE mode)
{
char *c_directory;
int c_mode;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (NIL_P (directory) || NIL_P (mode))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
-
+
c_directory = StringValuePtr (directory);
c_mode = FIX2INT (mode);
-
+
if (weechat_mkdir_parents (c_directory, c_mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -573,11 +573,11 @@ static VALUE
weechat_ruby_api_list_new (VALUE class)
{
char *result;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING(result);
}
@@ -590,26 +590,26 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where,
VALUE user_data)
{
char *c_weelist, *c_data, *c_where, *c_user_data, *result;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data) || NIL_P (where) || NIL_P (user_data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
Check_Type (where, T_STRING);
Check_Type (user_data, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
c_where = StringValuePtr (where);
c_user_data = StringValuePtr (user_data);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (c_weelist),
c_data,
c_where,
script_str2ptr (c_user_data)));
-
+
API_RETURN_STRING(result);
}
@@ -621,20 +621,20 @@ static VALUE
weechat_ruby_api_list_search (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data, *result;
-
+
API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (c_weelist),
c_data));
-
+
API_RETURN_STRING(result);
}
@@ -647,19 +647,19 @@ weechat_ruby_api_list_search_pos (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data;
int pos;
-
+
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (NIL_P (weelist) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
-
+
pos = weechat_list_search_pos (script_str2ptr (c_weelist), c_data);
-
+
API_RETURN_INT(pos);
}
@@ -671,20 +671,20 @@ static VALUE
weechat_ruby_api_list_casesearch (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data, *result;
-
+
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (c_weelist),
c_data));
-
+
API_RETURN_STRING(result);
}
@@ -698,19 +698,19 @@ weechat_ruby_api_list_casesearch_pos (VALUE class, VALUE weelist, VALUE data)
{
char *c_weelist, *c_data;
int pos;
-
+
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (NIL_P (weelist) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (weelist, T_STRING);
Check_Type (data, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_data = StringValuePtr (data);
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (c_weelist), c_data);
-
+
API_RETURN_INT(pos);
}
@@ -723,20 +723,20 @@ weechat_ruby_api_list_get (VALUE class, VALUE weelist, VALUE position)
{
char *c_weelist, *result;
int c_position;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (NIL_P (weelist) || NIL_P (position))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (weelist, T_STRING);
Check_Type (position, T_FIXNUM);
-
+
c_weelist = StringValuePtr (weelist);
c_position = FIX2INT (position);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (c_weelist),
c_position));
-
+
API_RETURN_STRING(result);
}
@@ -748,20 +748,20 @@ static VALUE
weechat_ruby_api_list_set (VALUE class, VALUE item, VALUE new_value)
{
char *c_item, *c_new_value;
-
+
API_FUNC(1, "list_set", API_RETURN_ERROR);
if (NIL_P (item) || NIL_P (new_value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (item, T_STRING);
Check_Type (new_value, T_STRING);
-
+
c_item = StringValuePtr (item);
c_new_value = StringValuePtr (new_value);
-
+
weechat_list_set (script_str2ptr (c_item),
c_new_value);
-
+
API_RETURN_OK;
}
@@ -773,17 +773,17 @@ static VALUE
weechat_ruby_api_list_next (VALUE class, VALUE item)
{
char *c_item, *result;
-
+
API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (NIL_P (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (item, T_STRING);
-
+
c_item = StringValuePtr (item);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (c_item)));
-
+
API_RETURN_STRING(result);
}
@@ -795,17 +795,17 @@ static VALUE
weechat_ruby_api_list_prev (VALUE class, VALUE item)
{
char *c_item, *result;
-
+
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (NIL_P (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (item, T_STRING);
-
+
c_item = StringValuePtr (item);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (c_item)));
-
+
API_RETURN_STRING(result);
}
@@ -818,17 +818,17 @@ weechat_ruby_api_list_string (VALUE class, VALUE item)
{
char *c_item;
const char *result;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (NIL_P (item))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (item, T_STRING);
-
+
c_item = StringValuePtr (item);
-
+
result = weechat_list_string (script_str2ptr (c_item));
-
+
API_RETURN_STRING(result);
}
@@ -841,17 +841,17 @@ weechat_ruby_api_list_size (VALUE class, VALUE weelist)
{
char *c_weelist;
int size;
-
+
API_FUNC(1, "list_size", API_RETURN_INT(0));
if (NIL_P (weelist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (weelist, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
-
+
size = weechat_list_size (script_str2ptr (c_weelist));
-
+
API_RETURN_INT(size);
}
@@ -863,20 +863,20 @@ static VALUE
weechat_ruby_api_list_remove (VALUE class, VALUE weelist, VALUE item)
{
char *c_weelist, *c_item;
-
+
API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (NIL_P (weelist) || NIL_P (item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (weelist, T_STRING);
Check_Type (item, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
c_item = StringValuePtr (item);
-
+
weechat_list_remove (script_str2ptr (c_weelist),
script_str2ptr (c_item));
-
+
API_RETURN_OK;
}
@@ -888,17 +888,17 @@ static VALUE
weechat_ruby_api_list_remove_all (VALUE class, VALUE weelist)
{
char *c_weelist;
-
+
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (NIL_P (weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (weelist, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
-
+
weechat_list_remove_all (script_str2ptr (c_weelist));
-
+
API_RETURN_OK;
}
@@ -910,17 +910,17 @@ static VALUE
weechat_ruby_api_list_free (VALUE class, VALUE weelist)
{
char *c_weelist;
-
+
API_FUNC(1, "list_free", API_RETURN_ERROR);
if (NIL_P (weelist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (weelist, T_STRING);
-
+
c_weelist = StringValuePtr (weelist);
-
+
weechat_list_free (script_str2ptr (c_weelist));
-
+
API_RETURN_OK;
}
@@ -936,19 +936,19 @@ weechat_ruby_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -958,10 +958,10 @@ weechat_ruby_api_config_reload_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -975,26 +975,26 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function,
{
char *c_name, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_name = StringValuePtr (name);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_config_new (weechat_ruby_plugin,
ruby_current_script,
c_name,
&weechat_ruby_api_config_reload_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1012,9 +1012,9 @@ weechat_ruby_api_config_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1022,12 +1022,12 @@ weechat_ruby_api_config_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1039,10 +1039,10 @@ weechat_ruby_api_config_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1059,20 +1059,20 @@ weechat_ruby_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1082,10 +1082,10 @@ weechat_ruby_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1103,20 +1103,20 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1126,10 +1126,10 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1148,9 +1148,9 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1158,12 +1158,12 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1175,10 +1175,10 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1196,21 +1196,21 @@ weechat_ruby_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1224,10 +1224,10 @@ weechat_ruby_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1257,7 +1257,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
char *c_data_delete_option, *result;
int c_user_can_add_options, c_user_can_delete_options;
VALUE return_value;
-
+
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (name) || NIL_P (user_can_add_options)
|| NIL_P (user_can_delete_options) || NIL_P (function_read)
@@ -1266,7 +1266,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
|| NIL_P (function_create_option) || NIL_P (data_create_option)
|| NIL_P (function_delete_option) || NIL_P (data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (config_file, T_STRING);
Check_Type (name, T_STRING);
Check_Type (user_can_add_options, T_FIXNUM);
@@ -1281,7 +1281,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
Check_Type (data_create_option, T_STRING);
Check_Type (function_delete_option, T_STRING);
Check_Type (data_delete_option, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_name = StringValuePtr (name);
c_user_can_add_options = FIX2INT (user_can_add_options);
@@ -1296,7 +1296,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
c_data_create_option = StringValuePtr (data_create_option);
c_function_delete_option = StringValuePtr (function_delete_option);
c_data_delete_option = StringValuePtr (data_delete_option);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_config_file),
@@ -1318,7 +1318,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
&weechat_ruby_api_config_section_delete_option_cb,
c_function_delete_option,
c_data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1332,20 +1332,20 @@ weechat_ruby_api_config_search_section (VALUE class, VALUE config_file,
{
char *c_config_file, *c_section_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (section_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (config_file, T_STRING);
Check_Type (section_name, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_section_name = StringValuePtr (section_name);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (c_config_file),
c_section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1363,20 +1363,20 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1386,10 +1386,10 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1405,22 +1405,22 @@ weechat_ruby_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1438,22 +1438,22 @@ weechat_ruby_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1482,7 +1482,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
char *c_data_change, *c_function_delete, *c_data_delete, *result;
int c_min, c_max, c_null_value_allowed;
VALUE return_value;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (section) || NIL_P (name) || NIL_P (type)
|| NIL_P (description) || NIL_P (string_values) || NIL_P (min)
@@ -1492,7 +1492,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
|| NIL_P (data_change) || NIL_P (function_delete)
|| NIL_P (data_delete))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (config_file, T_STRING);
Check_Type (section, T_STRING);
Check_Type (name, T_STRING);
@@ -1510,7 +1510,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
Check_Type (data_change, T_STRING);
Check_Type (function_delete, T_STRING);
Check_Type (data_delete, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_section = StringValuePtr (section);
c_name = StringValuePtr (name);
@@ -1528,7 +1528,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
c_data_change = StringValuePtr (data_change);
c_function_delete = StringValuePtr (function_delete);
c_data_delete = StringValuePtr (data_delete);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_config_file),
@@ -1551,7 +1551,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file,
&weechat_ruby_api_config_option_delete_cb,
c_function_delete,
c_data_delete));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1565,23 +1565,23 @@ weechat_ruby_api_config_search_option (VALUE class, VALUE config_file,
{
char *c_config_file, *c_section, *c_option_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (NIL_P (config_file) || NIL_P (section) || NIL_P (option_name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (config_file, T_STRING);
Check_Type (section, T_STRING);
Check_Type (option_name, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_section = StringValuePtr (section);
c_option_name = StringValuePtr (option_name);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (c_config_file),
script_str2ptr (c_section),
c_option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1594,17 +1594,17 @@ weechat_ruby_api_config_string_to_boolean (VALUE class, VALUE text)
{
char *c_text;
int value;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (NIL_P (text))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (text, T_STRING);
-
+
c_text = StringValuePtr (text);
-
+
value = weechat_config_string_to_boolean (c_text);
-
+
API_RETURN_INT(value);
}
@@ -1618,20 +1618,20 @@ weechat_ruby_api_config_option_reset (VALUE class, VALUE option,
{
char *c_option;
int c_run_callback, rc;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (NIL_P (option) || NIL_P (run_callback))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
Check_Type (run_callback, T_FIXNUM);
-
+
c_option = StringValuePtr (option);
c_run_callback = FIX2INT (run_callback);
-
+
rc = weechat_config_option_reset (script_str2ptr (c_option),
c_run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1645,23 +1645,23 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
{
char *c_option, *c_new_value;
int c_run_callback, rc;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (new_value) || NIL_P (run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
Check_Type (option, T_STRING);
Check_Type (new_value, T_STRING);
Check_Type (run_callback, T_FIXNUM);
-
+
c_option = StringValuePtr (option);
c_new_value = StringValuePtr (new_value);
c_run_callback = FIX2INT (run_callback);
-
+
rc = weechat_config_option_set (script_str2ptr (c_option),
c_new_value,
c_run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1676,20 +1676,20 @@ weechat_ruby_api_config_option_set_null (VALUE class, VALUE option,
{
char *c_option;
int c_run_callback, rc;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (run_callback))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
Check_Type (option, T_STRING);
Check_Type (run_callback, T_FIXNUM);
-
+
c_option = StringValuePtr (option);
c_run_callback = FIX2INT (run_callback);
-
+
rc = weechat_config_option_set_null (script_str2ptr (c_option),
c_run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1702,17 +1702,17 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
{
char *c_option;
int rc;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
rc = weechat_config_option_unset (script_str2ptr (c_option));
-
+
API_RETURN_INT(rc);
}
@@ -1725,20 +1725,20 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option,
VALUE new_name)
{
char *c_option, *c_new_name;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (NIL_P (option) || NIL_P (new_name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (option, T_STRING);
Check_Type (new_name, T_STRING);
-
+
c_option = StringValuePtr (option);
c_new_name = StringValuePtr (new_name);
-
+
weechat_config_option_rename (script_str2ptr (c_option),
c_new_name);
-
+
API_RETURN_OK;
}
@@ -1751,17 +1751,17 @@ weechat_ruby_api_config_option_is_null (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_option_is_null (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1774,17 +1774,17 @@ weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_option_default_is_null (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1797,17 +1797,17 @@ weechat_ruby_api_config_boolean (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_boolean (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1820,17 +1820,17 @@ weechat_ruby_api_config_boolean_default (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_boolean_default (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1843,17 +1843,17 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_integer (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1866,17 +1866,17 @@ weechat_ruby_api_config_integer_default (VALUE class, VALUE option)
{
char *c_option;
int value;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
value = weechat_config_integer_default (script_str2ptr (c_option));
-
+
API_RETURN_INT(value);
}
@@ -1889,17 +1889,17 @@ weechat_ruby_api_config_string (VALUE class, VALUE option)
{
char *c_option;
const char *result;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
result = weechat_config_string (script_str2ptr (c_option));
-
+
API_RETURN_STRING(result);
}
@@ -1912,17 +1912,17 @@ weechat_ruby_api_config_string_default (VALUE class, VALUE option)
{
char *c_option;
const char *result;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
result = weechat_config_string_default (script_str2ptr (c_option));
-
+
API_RETURN_STRING(result);
}
@@ -1935,17 +1935,17 @@ weechat_ruby_api_config_color (VALUE class, VALUE option)
{
char *c_option;
const char *result;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
result = weechat_config_color (script_str2ptr (c_option));
-
+
API_RETURN_STRING(result);
}
@@ -1958,17 +1958,17 @@ weechat_ruby_api_config_color_default (VALUE class, VALUE option)
{
char *c_option;
const char *result;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
result = weechat_config_color_default (script_str2ptr (c_option));
-
+
API_RETURN_STRING(result);
}
@@ -1981,20 +1981,20 @@ weechat_ruby_api_config_write_option (VALUE class, VALUE config_file,
VALUE option)
{
char *c_config_file, *c_option;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (NIL_P (config_file) || NIL_P (option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (config_file, T_STRING);
Check_Type (option, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_option = StringValuePtr (option);
-
+
weechat_config_write_option (script_str2ptr (c_config_file),
script_str2ptr (c_option));
-
+
API_RETURN_OK;
}
@@ -2007,24 +2007,24 @@ weechat_ruby_api_config_write_line (VALUE class, VALUE config_file,
VALUE option_name, VALUE value)
{
char *c_config_file, *c_option_name, *c_value;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (NIL_P (config_file) || NIL_P (option_name) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (config_file, T_STRING);
Check_Type (option_name, T_STRING);
Check_Type (value, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
c_option_name = StringValuePtr (option_name);
c_value = StringValuePtr (value);
-
+
weechat_config_write_line (script_str2ptr (c_config_file),
c_option_name,
"%s",
c_value);
-
+
API_RETURN_OK;
}
@@ -2037,17 +2037,17 @@ weechat_ruby_api_config_write (VALUE class, VALUE config_file)
{
char *c_config_file;
int rc;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (NIL_P (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (config_file, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
-
+
rc = weechat_config_write (script_str2ptr (c_config_file));
-
+
API_RETURN_INT(rc);
}
@@ -2060,17 +2060,17 @@ weechat_ruby_api_config_read (VALUE class, VALUE config_file)
{
char *c_config_file;
int rc;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (NIL_P (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (config_file, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
-
+
rc = weechat_config_read (script_str2ptr (c_config_file));
-
+
API_RETURN_INT(rc);
}
@@ -2083,17 +2083,17 @@ weechat_ruby_api_config_reload (VALUE class, VALUE config_file)
{
char *c_config_file;
int rc;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (NIL_P (config_file))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (config_file, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
-
+
rc = weechat_config_reload (script_str2ptr (c_config_file));
-
+
API_RETURN_INT(rc);
}
@@ -2105,19 +2105,19 @@ static VALUE
weechat_ruby_api_config_option_free (VALUE class, VALUE option)
{
char *c_option;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
script_api_config_option_free (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_option));
-
+
API_RETURN_OK;
}
@@ -2130,19 +2130,19 @@ static VALUE
weechat_ruby_api_config_section_free_options (VALUE class, VALUE section)
{
char *c_section;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (NIL_P (section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (section, T_STRING);
-
+
c_section = StringValuePtr (section);
-
+
script_api_config_section_free_options (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_section));
-
+
API_RETURN_OK;
}
@@ -2154,19 +2154,19 @@ static VALUE
weechat_ruby_api_config_section_free (VALUE class, VALUE section)
{
char *c_section;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (NIL_P (section))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (section, T_STRING);
-
+
c_section = StringValuePtr (section);
-
+
script_api_config_section_free (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_section));
-
+
API_RETURN_OK;
}
@@ -2178,19 +2178,19 @@ static VALUE
weechat_ruby_api_config_free (VALUE class, VALUE config_file)
{
char *c_config_file;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
if (NIL_P (config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (config_file, T_STRING);
-
+
c_config_file = StringValuePtr (config_file);
-
+
script_api_config_free (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_config_file));
-
+
API_RETURN_OK;
}
@@ -2203,17 +2203,17 @@ weechat_ruby_api_config_get (VALUE class, VALUE option)
{
char *c_option, *result;
VALUE return_value;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
result = script_ptr2str (weechat_config_get (c_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2226,19 +2226,19 @@ weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
{
char *c_option;
const char *result;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
result = script_api_config_get_plugin (weechat_ruby_plugin,
ruby_current_script,
c_option);
-
+
API_RETURN_STRING(result);
}
@@ -2251,19 +2251,19 @@ weechat_ruby_api_config_is_set_plugin (VALUE class, VALUE option)
{
char *c_option;
int rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
rc = script_api_config_is_set_plugin (weechat_ruby_plugin,
ruby_current_script,
c_option);
-
+
API_RETURN_INT(rc);
}
@@ -2276,22 +2276,22 @@ weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
{
char *c_option, *c_value;
int rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (NIL_P (option) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
Check_Type (option, T_STRING);
Check_Type (value, T_STRING);
-
+
c_option = StringValuePtr (option);
c_value = StringValuePtr (value);
-
+
rc = script_api_config_set_plugin (weechat_ruby_plugin,
ruby_current_script,
c_option,
c_value);
-
+
API_RETURN_INT(rc);
}
@@ -2304,22 +2304,22 @@ weechat_ruby_api_config_set_desc_plugin (VALUE class, VALUE option,
VALUE description)
{
char *c_option, *c_description;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (NIL_P (option) || NIL_P (description))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (option, T_STRING);
Check_Type (description, T_STRING);
-
+
c_option = StringValuePtr (option);
c_description = StringValuePtr (description);
-
+
script_api_config_set_desc_plugin (weechat_ruby_plugin,
ruby_current_script,
c_option,
c_description);
-
+
API_RETURN_OK;
}
@@ -2332,19 +2332,19 @@ weechat_ruby_api_config_unset_plugin (VALUE class, VALUE option)
{
char *c_option;
int rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
Check_Type (option, T_STRING);
-
+
c_option = StringValuePtr (option);
-
+
rc = script_api_config_unset_plugin (weechat_ruby_plugin,
ruby_current_script,
c_option);
-
+
API_RETURN_INT(rc);
}
@@ -2358,23 +2358,23 @@ weechat_ruby_api_key_bind (VALUE class, VALUE context, VALUE keys)
char *c_context;
struct t_hashtable *c_keys;
int num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (NIL_P (context) || NIL_P (keys))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (context, T_STRING);
Check_Type (keys, T_HASH);
-
+
c_context = StringValuePtr (context);
c_keys = weechat_ruby_hash_to_hashtable (keys,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (c_context, c_keys);
-
+
if (c_keys)
weechat_hashtable_free (c_keys);
-
+
API_RETURN_INT(num_keys);
}
@@ -2387,19 +2387,19 @@ weechat_ruby_api_key_unbind (VALUE class, VALUE context, VALUE key)
{
char *c_context, *c_key;
int num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (NIL_P (context) || NIL_P (key))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (context, T_STRING);
Check_Type (key, T_STRING);
-
+
c_context = StringValuePtr (context);
c_key = StringValuePtr (key);
-
+
num_keys = weechat_key_unbind (c_context, c_key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2412,17 +2412,17 @@ weechat_ruby_api_prefix (VALUE class, VALUE prefix)
{
char *c_prefix;
const char *result;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (NIL_P (prefix))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (prefix, T_STRING);
-
+
c_prefix = StringValuePtr (prefix);
-
+
result = weechat_prefix (c_prefix);
-
+
API_RETURN_STRING(result);
}
@@ -2435,17 +2435,17 @@ weechat_ruby_api_color (VALUE class, VALUE color)
{
char *c_color;
const char *result;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
if (NIL_P (color))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (color, T_STRING);
-
+
c_color = StringValuePtr (color);
-
+
result = weechat_color (c_color);
-
+
API_RETURN_STRING(result);
}
@@ -2457,22 +2457,22 @@ static VALUE
weechat_ruby_api_print (VALUE class, VALUE buffer, VALUE message)
{
char *c_buffer, *c_message;
-
+
API_FUNC(0, "print", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (message, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_message = StringValuePtr (message);
-
+
script_api_printf (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
"%s", c_message);
-
+
API_RETURN_OK;
}
@@ -2487,28 +2487,28 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
{
char *c_buffer, *c_tags, *c_message;
int c_date;
-
+
API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (date) || NIL_P (tags) || NIL_P (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (date, T_FIXNUM);
Check_Type (tags, T_STRING);
Check_Type (message, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_date = FIX2INT (date);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
-
+
script_api_printf_date_tags (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
c_date,
c_tags,
"%s", c_message);
-
+
API_RETURN_OK;
}
@@ -2521,25 +2521,25 @@ weechat_ruby_api_print_y (VALUE class, VALUE buffer, VALUE y, VALUE message)
{
char *c_buffer, *c_message;
int c_y;
-
+
API_FUNC(1, "print_y", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (y) || NIL_P (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (y, T_FIXNUM);
Check_Type (message, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_y = FIX2INT (y);
c_message = StringValuePtr (message);
-
+
script_api_printf_y (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
c_y,
"%s", c_message);
-
+
API_RETURN_OK;
}
@@ -2551,19 +2551,19 @@ static VALUE
weechat_ruby_api_log_print (VALUE class, VALUE message)
{
char *c_message;
-
+
API_FUNC(1, "log_print", API_RETURN_ERROR);
if (NIL_P (message))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (message, T_STRING);
-
+
c_message = StringValuePtr (message);
-
+
script_api_log_printf (weechat_ruby_plugin,
ruby_current_script,
"%s", c_message);
-
+
API_RETURN_OK;
}
@@ -2579,10 +2579,10 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2590,12 +2590,12 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2605,10 +2605,10 @@ weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2624,13 +2624,13 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
char *c_command, *c_description, *c_args, *c_args_description;
char *c_completion, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (description) || NIL_P (args)
|| NIL_P (args_description) || NIL_P (completion) || NIL_P (function)
|| NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (command, T_STRING);
Check_Type (description, T_STRING);
Check_Type (args, T_STRING);
@@ -2638,7 +2638,7 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
Check_Type (completion, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_command = StringValuePtr (command);
c_description = StringValuePtr (description);
c_args = StringValuePtr (args);
@@ -2646,7 +2646,7 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
c_completion = StringValuePtr (completion);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_command (weechat_ruby_plugin,
ruby_current_script,
c_command,
@@ -2657,7 +2657,7 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
&weechat_ruby_api_hook_command_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2673,7 +2673,7 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2681,12 +2681,12 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2696,10 +2696,10 @@ weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2713,26 +2713,26 @@ weechat_ruby_api_hook_command_run (VALUE class, VALUE command, VALUE function,
{
char *c_command, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (command, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_command = StringValuePtr (command);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_ruby_plugin,
ruby_current_script,
c_command,
&weechat_ruby_api_hook_command_run_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2747,22 +2747,22 @@ weechat_ruby_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2770,10 +2770,10 @@ weechat_ruby_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2788,24 +2788,24 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
int c_interval, c_align_second, c_max_calls;
char *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (NIL_P (interval) || NIL_P (align_second) || NIL_P (max_calls)
|| NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (interval, T_FIXNUM);
Check_Type (align_second, T_FIXNUM);
Check_Type (max_calls, T_FIXNUM);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_interval = FIX2INT (interval);
c_align_second = FIX2INT (align_second);
c_max_calls = FIX2INT (max_calls);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_ruby_plugin,
ruby_current_script,
c_interval,
@@ -2814,7 +2814,7 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
&weechat_ruby_api_hook_timer_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2829,21 +2829,21 @@ weechat_ruby_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2851,10 +2851,10 @@ weechat_ruby_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2869,26 +2869,26 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
int c_fd, c_read, c_write, c_exception;
char *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (NIL_P (fd) || NIL_P (read) || NIL_P (write) || NIL_P (exception)
|| NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (fd, T_FIXNUM);
Check_Type (read, T_FIXNUM);
Check_Type (write, T_FIXNUM);
Check_Type (exception, T_FIXNUM);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_fd = FIX2INT (fd);
c_read = FIX2INT (read);
c_write = FIX2INT (write);
c_exception = FIX2INT (exception);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_fd (weechat_ruby_plugin,
ruby_current_script,
c_fd,
@@ -2898,7 +2898,7 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
&weechat_ruby_api_hook_fd_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2915,24 +2915,24 @@ weechat_ruby_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2940,10 +2940,10 @@ weechat_ruby_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2958,21 +2958,21 @@ weechat_ruby_api_hook_process (VALUE class, VALUE command, VALUE timeout,
char *c_command, *c_function, *c_data, *result;
int c_timeout;
VALUE return_value;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (NIL_P (command) || NIL_P (timeout) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (command, T_STRING);
Check_Type (timeout, T_FIXNUM);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_command = StringValuePtr (command);
c_timeout = FIX2INT (timeout);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_process (weechat_ruby_plugin,
ruby_current_script,
c_command,
@@ -2980,7 +2980,7 @@ weechat_ruby_api_hook_process (VALUE class, VALUE command, VALUE timeout,
&weechat_ruby_api_hook_process_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2997,25 +2997,25 @@ weechat_ruby_api_hook_connect_cb (void *data, int status, int gnutls_rc,
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3023,10 +3023,10 @@ weechat_ruby_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3043,13 +3043,13 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
char *c_proxy, *c_address, *c_local_hostname, *c_function, *c_data, *result;
int c_port, c_sock, c_ipv6;
VALUE return_value;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (NIL_P (proxy) || NIL_P (address) || NIL_P (port) || NIL_P (sock)
|| NIL_P (ipv6) || NIL_P (local_hostname) || NIL_P (function)
|| NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (proxy, T_STRING);
Check_Type (address, T_STRING);
Check_Type (port, T_FIXNUM);
@@ -3058,7 +3058,7 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
Check_Type (local_hostname, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_proxy = StringValuePtr (proxy);
c_address = StringValuePtr (address);
c_port = FIX2INT (port);
@@ -3067,7 +3067,7 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
c_local_hostname = StringValuePtr (local_hostname);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_ruby_plugin,
ruby_current_script,
c_proxy,
@@ -3083,7 +3083,7 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
&weechat_ruby_api_hook_connect_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3103,16 +3103,16 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -3123,12 +3123,12 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3144,10 +3144,10 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3163,26 +3163,26 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
char *c_buffer, *c_tags, *c_message, *c_function, *c_data, *result;
int c_strip_colors;
VALUE return_value;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (tags) || NIL_P (message)
|| NIL_P (strip_colors) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (tags, T_STRING);
Check_Type (message, T_STRING);
Check_Type (strip_colors, T_FIXNUM);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
c_strip_colors = FIX2INT (strip_colors);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_print (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
@@ -3192,7 +3192,7 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
&weechat_ruby_api_hook_print_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3209,9 +3209,9 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -3234,12 +3234,12 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3249,10 +3249,10 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3266,26 +3266,26 @@ weechat_ruby_api_hook_signal (VALUE class, VALUE signal, VALUE function,
{
char *c_signal, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (NIL_P (signal) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (signal, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_signal = StringValuePtr (signal);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_ruby_plugin,
ruby_current_script,
c_signal,
&weechat_ruby_api_hook_signal_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3299,17 +3299,17 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
{
char *c_signal, *c_type_data, *c_signal_data;
int number;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (NIL_P (signal) || NIL_P (type_data) || NIL_P (signal_data))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (signal, T_STRING);
Check_Type (type_data, T_STRING);
-
+
c_signal = StringValuePtr (signal);
c_type_data = StringValuePtr (type_data);
-
+
if (strcmp (c_type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
Check_Type (signal_data, T_STRING);
@@ -3332,7 +3332,7 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
script_str2ptr (c_signal_data));
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -3348,20 +3348,20 @@ weechat_ruby_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssh", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3369,10 +3369,10 @@ weechat_ruby_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3386,26 +3386,26 @@ weechat_ruby_api_hook_hsignal (VALUE class, VALUE signal, VALUE function,
{
char *c_signal, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (NIL_P (signal) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (signal, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_signal = StringValuePtr (signal);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_ruby_plugin,
ruby_current_script,
c_signal,
&weechat_ruby_api_hook_hsignal_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3418,23 +3418,23 @@ weechat_ruby_api_hook_hsignal_send (VALUE class, VALUE signal, VALUE hashtable)
{
char *c_signal;
struct t_hashtable *c_hashtable;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (NIL_P (signal) || NIL_P (hashtable))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (signal, T_STRING);
Check_Type (hashtable, T_HASH);
-
+
c_signal = StringValuePtr (signal);
c_hashtable = weechat_ruby_hash_to_hashtable (hashtable,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (c_signal, c_hashtable);
-
+
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
-
+
API_RETURN_OK;
}
@@ -3449,20 +3449,20 @@ weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *val
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3470,10 +3470,10 @@ weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *val
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3487,26 +3487,26 @@ weechat_ruby_api_hook_config (VALUE class, VALUE option, VALUE function,
{
char *c_option, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (NIL_P (option) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (option, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_option = StringValuePtr (option);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_config (weechat_ruby_plugin,
ruby_current_script,
c_option,
&weechat_ruby_api_hook_config_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3523,7 +3523,7 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3532,12 +3532,12 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3549,10 +3549,10 @@ weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3567,22 +3567,22 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
{
char *c_completion, *c_description, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (NIL_P (completion) || NIL_P (description) || NIL_P (function)
|| NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (completion, T_STRING);
Check_Type (description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_completion = StringValuePtr (completion);
c_description = StringValuePtr (description);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_ruby_plugin,
ruby_current_script,
c_completion,
@@ -3590,7 +3590,7 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
&weechat_ruby_api_hook_completion_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3605,27 +3605,27 @@ weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion,
{
char *c_completion, *c_word, *c_where;
int c_nick_completion;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (NIL_P (completion) || NIL_P (word) || NIL_P (nick_completion)
|| NIL_P (where))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (completion, T_STRING);
Check_Type (word, T_STRING);
Check_Type (nick_completion, T_FIXNUM);
Check_Type (where, T_STRING);
-
+
c_completion = StringValuePtr (completion);
c_word = StringValuePtr (word);
c_nick_completion = FIX2INT (nick_completion);
c_where = StringValuePtr (where);
-
+
weechat_hook_completion_list_add (script_str2ptr (c_completion),
c_word,
c_nick_completion,
c_where);
-
+
API_RETURN_OK;
}
@@ -3640,7 +3640,7 @@ weechat_ruby_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3649,13 +3649,13 @@ weechat_ruby_api_hook_modifier_cb (void *data, const char *modifier,
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
@@ -3669,26 +3669,26 @@ weechat_ruby_api_hook_modifier (VALUE class, VALUE modifier, VALUE function,
{
char *c_modifier, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (NIL_P (modifier) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (modifier, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_modifier = StringValuePtr (modifier);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_ruby_plugin,
ruby_current_script,
c_modifier,
&weechat_ruby_api_hook_modifier_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3702,21 +3702,21 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
{
char *c_modifier, *c_modifier_data, *c_string, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (NIL_P (modifier) || NIL_P (modifier_data) || NIL_P (string))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (modifier, T_STRING);
Check_Type (modifier_data, T_STRING);
Check_Type (string, T_STRING);
-
+
c_modifier = StringValuePtr (modifier);
c_modifier_data = StringValuePtr (modifier_data);
c_string = StringValuePtr (string);
result = weechat_hook_modifier_exec (c_modifier, c_modifier_data, c_string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3731,21 +3731,21 @@ weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3760,24 +3760,24 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
char *c_info_name, *c_description, *c_args_description, *c_function;
char *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (args_description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_info_name = StringValuePtr (info_name);
c_description = StringValuePtr (description);
c_args_description = StringValuePtr (args_description);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_info (weechat_ruby_plugin,
ruby_current_script,
c_info_name,
@@ -3786,7 +3786,7 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
&weechat_ruby_api_hook_info_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3801,21 +3801,21 @@ weechat_ruby_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
-
+
return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssh", func_argv);
}
-
+
return NULL;
}
@@ -3834,26 +3834,26 @@ weechat_ruby_api_hook_info_hashtable (VALUE class, VALUE info_name,
char *c_output_description, *c_function;
char *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (description) || NIL_P (args_description)
|| NIL_P (output_description) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (args_description, T_STRING);
Check_Type (output_description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_info_name = StringValuePtr (info_name);
c_description = StringValuePtr (description);
c_args_description = StringValuePtr (args_description);
c_output_description = StringValuePtr (output_description);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_ruby_plugin,
ruby_current_script,
c_info_name,
@@ -3863,7 +3863,7 @@ weechat_ruby_api_hook_info_hashtable (VALUE class, VALUE info_name,
&weechat_ruby_api_hook_info_hashtable_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3879,27 +3879,27 @@ weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3916,27 +3916,27 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
char *c_infolist_name, *c_description, *c_pointer_description;
char *c_args_description, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (NIL_P (infolist_name) || NIL_P (description)
|| NIL_P (pointer_description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (pointer_description, T_STRING);
Check_Type (args_description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_infolist_name = StringValuePtr (infolist_name);
c_description = StringValuePtr (description);
c_pointer_description = StringValuePtr (pointer_description);
c_args_description = StringValuePtr (args_description);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_ruby_plugin,
ruby_current_script,
c_infolist_name,
@@ -3946,7 +3946,7 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
&weechat_ruby_api_hook_infolist_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3960,20 +3960,20 @@ weechat_ruby_api_hook_focus_cb (void *data, struct t_hashtable *info)
struct t_script_callback *script_callback;
void *func_argv[2];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = info;
-
+
return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", func_argv);
}
-
+
return NULL;
}
@@ -3987,26 +3987,26 @@ weechat_ruby_api_hook_focus (VALUE class, VALUE area, VALUE function,
{
char *c_area, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (NIL_P (area) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (area, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_area = StringValuePtr (area);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_ruby_plugin,
ruby_current_script,
c_area,
&weechat_ruby_api_hook_focus_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4018,19 +4018,19 @@ static VALUE
weechat_ruby_api_unhook (VALUE class, VALUE hook)
{
char *c_hook;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
if (NIL_P (hook))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (hook, T_STRING);
-
+
c_hook = StringValuePtr (hook);
-
+
script_api_unhook (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_hook));
-
+
API_RETURN_OK;
}
@@ -4042,9 +4042,9 @@ static VALUE
weechat_ruby_api_unhook_all (VALUE class)
{
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (ruby_current_script);
-
+
API_RETURN_OK;
}
@@ -4060,20 +4060,20 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4083,10 +4083,10 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -4101,19 +4101,19 @@ weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -4123,10 +4123,10 @@ weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -4142,24 +4142,24 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE name, VALUE function_input,
char *c_name, *c_function_input, *c_data_input, *c_function_close;
char *c_data_close, *result;
VALUE return_value;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function_input) || NIL_P (data_input)
|| NIL_P (function_close) || NIL_P (data_close))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
Check_Type (function_input, T_STRING);
Check_Type (data_input, T_STRING);
Check_Type (function_close, T_STRING);
Check_Type (data_close, T_STRING);
-
+
c_name = StringValuePtr (name);
c_function_input = StringValuePtr (function_input);
c_data_input = StringValuePtr (data_input);
c_function_close = StringValuePtr (function_close);
c_data_close = StringValuePtr (data_close);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_ruby_plugin,
ruby_current_script,
c_name,
@@ -4169,7 +4169,7 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE name, VALUE function_input,
&weechat_ruby_api_buffer_close_cb,
c_function_close,
c_data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4182,19 +4182,19 @@ weechat_ruby_api_buffer_search (VALUE class, VALUE plugin, VALUE name)
{
char *c_plugin, *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (NIL_P (plugin) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (plugin, T_STRING);
Check_Type (name, T_STRING);
-
+
c_plugin = StringValuePtr (plugin);
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_buffer_search (c_plugin, c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4207,11 +4207,11 @@ weechat_ruby_api_buffer_search_main (VALUE class)
{
char *result;
VALUE return_value;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4224,11 +4224,11 @@ weechat_ruby_api_current_buffer (VALUE class)
{
char *result;
VALUE return_value;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4240,17 +4240,17 @@ static VALUE
weechat_ruby_api_buffer_clear (VALUE class, VALUE buffer)
{
char *c_buffer;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (NIL_P (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
-
+
weechat_buffer_clear (script_str2ptr (c_buffer));
-
+
API_RETURN_OK;
}
@@ -4262,19 +4262,19 @@ static VALUE
weechat_ruby_api_buffer_close (VALUE class, VALUE buffer)
{
char *c_buffer;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (NIL_P (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
-
+
script_api_buffer_close (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer));
-
+
API_RETURN_OK;
}
@@ -4286,20 +4286,20 @@ static VALUE
weechat_ruby_api_buffer_merge (VALUE class, VALUE buffer, VALUE target_buffer)
{
char *c_buffer, *c_target_buffer;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (target_buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (target_buffer, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_target_buffer = StringValuePtr (target_buffer);
-
+
weechat_buffer_merge (script_str2ptr (c_buffer),
script_str2ptr (c_target_buffer));
-
+
API_RETURN_OK;
}
@@ -4313,19 +4313,19 @@ weechat_ruby_api_buffer_unmerge (VALUE class, VALUE buffer, VALUE number)
{
char *c_buffer;
int c_number;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (number))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (number, T_FIXNUM);
-
+
c_buffer = StringValuePtr (buffer);
c_number = FIX2INT (number);
-
+
weechat_buffer_unmerge (script_str2ptr (c_buffer), c_number);
-
+
API_RETURN_OK;
}
@@ -4338,20 +4338,20 @@ weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property)
{
char *c_buffer, *c_property;
int value;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_property = StringValuePtr (property);
value = weechat_buffer_get_integer (script_str2ptr (c_buffer),
c_property);
-
+
API_RETURN_INT(value);
}
@@ -4364,20 +4364,20 @@ weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property)
{
char *c_buffer, *c_property;
const char *result;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_property = StringValuePtr (property);
-
+
result = weechat_buffer_get_string (script_str2ptr (c_buffer),
c_property);
-
+
API_RETURN_STRING(result);
}
@@ -4390,20 +4390,20 @@ weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property)
{
char *c_buffer, *c_property, *result;
VALUE return_value;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_property = StringValuePtr (property);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (c_buffer),
c_property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4416,23 +4416,23 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property,
VALUE value)
{
char *c_buffer, *c_property, *c_value;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (property) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
Check_Type (value, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_property = StringValuePtr (property);
c_value = StringValuePtr (value);
-
+
weechat_buffer_set (script_str2ptr (c_buffer),
c_property,
c_value);
-
+
API_RETURN_OK;
}
@@ -4446,19 +4446,19 @@ weechat_ruby_api_buffer_string_replace_local_var (VALUE class, VALUE buffer, VAL
{
char *c_buffer, *c_string, *result;
VALUE return_value;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (string))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (string, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_string = StringValuePtr (string);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (c_buffer), c_string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4471,20 +4471,20 @@ weechat_ruby_api_buffer_match_list (VALUE class, VALUE buffer, VALUE string)
{
char *c_buffer, *c_string;
int value;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (NIL_P (buffer) || NIL_P (string))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (buffer, T_STRING);
Check_Type (string, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_string = StringValuePtr (string);
-
+
value = weechat_buffer_match_list (script_str2ptr (c_buffer),
c_string);
-
+
API_RETURN_INT(value);
}
@@ -4497,11 +4497,11 @@ weechat_ruby_api_current_window (VALUE class)
{
char *result;
VALUE return_value;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4515,17 +4515,17 @@ weechat_ruby_api_window_search_with_buffer (VALUE class, VALUE buffer)
{
char *c_buffer, *result;
VALUE return_value;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (NIL_P (buffer))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (c_buffer)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4538,20 +4538,20 @@ weechat_ruby_api_window_get_integer (VALUE class, VALUE window, VALUE property)
{
char *c_window, *c_property;
int value;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (NIL_P (window) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
-
+
c_window = StringValuePtr (window);
c_property = StringValuePtr (property);
value = weechat_window_get_integer (script_str2ptr (c_window),
c_property);
-
+
API_RETURN_INT(value);
}
@@ -4564,20 +4564,20 @@ weechat_ruby_api_window_get_string (VALUE class, VALUE window, VALUE property)
{
char *c_window, *c_property;
const char *result;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (NIL_P (window) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
-
+
c_window = StringValuePtr (window);
c_property = StringValuePtr (property);
-
+
result = weechat_window_get_string (script_str2ptr (c_window),
c_property);
-
+
API_RETURN_STRING(result);
}
@@ -4590,20 +4590,20 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property)
{
char *c_window, *c_property, *result;
VALUE return_value;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (NIL_P (window) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (window, T_STRING);
Check_Type (property, T_STRING);
-
+
c_window = StringValuePtr (window);
c_property = StringValuePtr (property);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (c_window),
c_property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4615,17 +4615,17 @@ static VALUE
weechat_ruby_api_window_set_title (VALUE class, VALUE title)
{
char *c_title;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (NIL_P (title))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (title, T_STRING);
-
+
c_title = StringValuePtr (title);
-
+
weechat_window_set_title (c_title);
-
+
API_RETURN_OK;
}
@@ -4641,30 +4641,30 @@ weechat_ruby_api_nicklist_add_group (VALUE class, VALUE buffer,
char *c_buffer, *c_parent_group, *c_name, *c_color, *result;
int c_visible;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (parent_group) || NIL_P (name) || NIL_P (color)
|| NIL_P (visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (parent_group, T_STRING);
Check_Type (name, T_STRING);
Check_Type (color, T_STRING);
Check_Type (visible, T_FIXNUM);
-
+
c_buffer = StringValuePtr (buffer);
c_parent_group = StringValuePtr (parent_group);
c_name = StringValuePtr (name);
c_color = StringValuePtr (color);
c_visible = FIX2INT (visible);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (c_buffer),
script_str2ptr (c_parent_group),
c_name,
c_color,
c_visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4678,23 +4678,23 @@ weechat_ruby_api_nicklist_search_group (VALUE class, VALUE buffer,
{
char *c_buffer, *c_from_group, *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (from_group) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (from_group, T_STRING);
Check_Type (name, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_from_group = StringValuePtr (from_group);
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (c_buffer),
script_str2ptr (c_from_group),
c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4711,12 +4711,12 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
char *result;
int c_visible;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (name) || NIL_P (color)
|| NIL_P (prefix) || NIL_P (prefix_color) || NIL_P (visible))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
Check_Type (name, T_STRING);
@@ -4724,7 +4724,7 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
Check_Type (prefix, T_STRING);
Check_Type (prefix_color, T_STRING);
Check_Type (visible, T_FIXNUM);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
c_name = StringValuePtr (name);
@@ -4732,7 +4732,7 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
c_prefix = StringValuePtr (prefix);
c_prefix_color = StringValuePtr (prefix_color);
c_visible = FIX2INT (visible);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (c_buffer),
script_str2ptr (c_group),
c_name,
@@ -4740,7 +4740,7 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group,
c_prefix,
c_prefix_color,
c_visible));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4754,23 +4754,23 @@ weechat_ruby_api_nicklist_search_nick (VALUE class, VALUE buffer,
{
char *c_buffer, *c_from_group, *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (from_group) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (from_group, T_STRING);
Check_Type (name, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_from_group = StringValuePtr (from_group);
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (c_buffer),
script_str2ptr (c_from_group),
c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4782,20 +4782,20 @@ static VALUE
weechat_ruby_api_nicklist_remove_group (VALUE class, VALUE buffer, VALUE group)
{
char *c_buffer, *c_group;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (group))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
-
+
weechat_nicklist_remove_group (script_str2ptr (c_buffer),
script_str2ptr (c_group));
-
+
API_RETURN_OK;
}
@@ -4807,20 +4807,20 @@ static VALUE
weechat_ruby_api_nicklist_remove_nick (VALUE class, VALUE buffer, VALUE nick)
{
char *c_buffer, *c_nick;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (nick))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_nick = StringValuePtr (nick);
-
+
weechat_nicklist_remove_nick (script_str2ptr (c_buffer),
script_str2ptr (c_nick));
-
+
API_RETURN_OK;
}
@@ -4832,17 +4832,17 @@ static VALUE
weechat_ruby_api_nicklist_remove_all (VALUE class, VALUE buffer)
{
char *c_buffer;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (NIL_P (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
-
+
weechat_nicklist_remove_all (script_str2ptr (c_buffer));
-
+
API_RETURN_OK;
}
@@ -4856,23 +4856,23 @@ weechat_ruby_api_nicklist_group_get_integer (VALUE class, VALUE buffer,
{
char *c_buffer, *c_group, *c_property;
int value;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
c_property = StringValuePtr (property);
-
+
value = weechat_nicklist_group_get_integer (script_str2ptr (c_buffer),
script_str2ptr (c_group),
c_property);
-
+
API_RETURN_INT(value);
}
@@ -4886,23 +4886,23 @@ weechat_ruby_api_nicklist_group_get_string (VALUE class, VALUE buffer,
{
char *c_buffer, *c_group, *c_property;
const char *result;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
c_property = StringValuePtr (property);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (c_buffer),
script_str2ptr (c_group),
c_property);
-
+
API_RETURN_STRING(result);
}
@@ -4916,23 +4916,23 @@ weechat_ruby_api_nicklist_group_get_pointer (VALUE class, VALUE buffer,
{
char *c_buffer, *c_group, *c_property, *result;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
c_property = StringValuePtr (property);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (c_buffer),
script_str2ptr (c_group),
c_property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4945,26 +4945,26 @@ weechat_ruby_api_nicklist_group_set (VALUE class, VALUE buffer, VALUE group,
VALUE property, VALUE value)
{
char *c_buffer, *c_group, *c_property, *c_value;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (group) || NIL_P (property) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (group, T_STRING);
Check_Type (property, T_STRING);
Check_Type (value, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_group = StringValuePtr (group);
c_property = StringValuePtr (property);
c_value = StringValuePtr (value);
-
+
weechat_nicklist_group_set (script_str2ptr (c_buffer),
script_str2ptr (c_group),
c_property,
c_value);
-
+
API_RETURN_OK;
}
@@ -4978,23 +4978,23 @@ weechat_ruby_api_nicklist_nick_get_integer (VALUE class, VALUE buffer,
{
char *c_buffer, *c_nick, *c_property;
int value;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_nick = StringValuePtr (nick);
c_property = StringValuePtr (property);
-
+
value = weechat_nicklist_nick_get_integer (script_str2ptr (c_buffer),
script_str2ptr (c_nick),
c_property);
-
+
API_RETURN_INT(value);
}
@@ -5008,23 +5008,23 @@ weechat_ruby_api_nicklist_nick_get_string (VALUE class, VALUE buffer,
{
char *c_buffer, *c_nick, *c_property;
const char *result;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_nick = StringValuePtr (nick);
c_property = StringValuePtr (property);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (c_buffer),
script_str2ptr (c_nick),
c_property);
-
+
API_RETURN_STRING(result);
}
@@ -5038,23 +5038,23 @@ weechat_ruby_api_nicklist_nick_get_pointer (VALUE class, VALUE buffer,
{
char *c_buffer, *c_nick, *c_property, *result;
VALUE return_value;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
Check_Type (property, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_nick = StringValuePtr (nick);
c_property = StringValuePtr (property);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (c_buffer),
script_str2ptr (c_nick),
c_property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5067,26 +5067,26 @@ weechat_ruby_api_nicklist_nick_set (VALUE class, VALUE buffer, VALUE nick,
VALUE property, VALUE value)
{
char *c_buffer, *c_nick, *c_property, *c_value;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (nick, T_STRING);
Check_Type (property, T_STRING);
Check_Type (value, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_nick = StringValuePtr (nick);
c_property = StringValuePtr (property);
c_value = StringValuePtr (value);
-
+
weechat_nicklist_nick_set (script_str2ptr (c_buffer),
script_str2ptr (c_nick),
c_property,
c_value);
-
+
API_RETURN_OK;
}
@@ -5099,17 +5099,17 @@ weechat_ruby_api_bar_item_search (VALUE class, VALUE name)
{
char *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
-
+
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_bar_item_search (c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5124,7 +5124,7 @@ weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -5132,20 +5132,20 @@ weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -5159,26 +5159,26 @@ weechat_ruby_api_bar_item_new (VALUE class, VALUE name, VALUE function,
{
char *c_name, *c_function, *c_data, *result;
VALUE return_value;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_name = StringValuePtr (name);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_ruby_plugin,
ruby_current_script,
c_name,
&weechat_ruby_api_bar_item_build_cb,
c_function,
c_data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5190,17 +5190,17 @@ static VALUE
weechat_ruby_api_bar_item_update (VALUE class, VALUE name)
{
char *c_name;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (NIL_P (name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (name, T_STRING);
-
+
c_name = StringValuePtr (name);
-
+
weechat_bar_item_update (c_name);
-
+
API_RETURN_OK;
}
@@ -5212,19 +5212,19 @@ static VALUE
weechat_ruby_api_bar_item_remove (VALUE class, VALUE item)
{
char *c_item;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (NIL_P (item))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (item, T_STRING);
-
+
c_item = StringValuePtr (item);
-
+
script_api_bar_item_remove (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_item));
-
+
API_RETURN_OK;
}
@@ -5237,17 +5237,17 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
{
char *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
-
+
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_bar_search (c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5268,7 +5268,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
char *c_color_fg, *c_color_delim, *c_color_bg, *c_separator, *c_items;
char *result;
VALUE return_value;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (hidden) || NIL_P (priority) || NIL_P (type)
|| NIL_P (conditions) || NIL_P (position) || NIL_P (filling_top_bottom)
@@ -5276,7 +5276,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
|| NIL_P (color_fg) || NIL_P (color_delim) || NIL_P (color_bg)
|| NIL_P (separator) || NIL_P (items))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
Check_Type (hidden, T_STRING);
Check_Type (priority, T_STRING);
@@ -5292,7 +5292,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
Check_Type (color_bg, T_STRING);
Check_Type (separator, T_STRING);
Check_Type (items, T_STRING);
-
+
c_name = StringValuePtr (name);
c_hidden = StringValuePtr (hidden);
c_priority = StringValuePtr (priority);
@@ -5308,7 +5308,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
c_color_bg = StringValuePtr (color_bg);
c_separator = StringValuePtr (separator);
c_items = StringValuePtr (items);
-
+
result = script_ptr2str (weechat_bar_new (c_name,
c_hidden,
c_priority,
@@ -5324,7 +5324,7 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE hidden,
c_color_bg,
c_separator,
c_items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5336,23 +5336,23 @@ static VALUE
weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value)
{
char *c_bar, *c_property, *c_value;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (NIL_P (bar) || NIL_P (property) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (bar, T_STRING);
Check_Type (property, T_STRING);
Check_Type (value, T_STRING);
-
+
c_bar = StringValuePtr (bar);
c_property = StringValuePtr (property);
c_value = StringValuePtr (value);
-
+
weechat_bar_set (script_str2ptr (c_bar),
c_property,
c_value);
-
+
API_RETURN_OK;
}
@@ -5364,17 +5364,17 @@ static VALUE
weechat_ruby_api_bar_update (VALUE class, VALUE name)
{
char *c_name;
-
+
API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (NIL_P (name))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (name, T_STRING);
-
+
c_name = StringValuePtr (name);
-
+
weechat_bar_update (c_name);
-
+
API_RETURN_OK;
}
@@ -5386,17 +5386,17 @@ static VALUE
weechat_ruby_api_bar_remove (VALUE class, VALUE bar)
{
char *c_bar;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (NIL_P (bar))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (bar, T_STRING);
-
+
c_bar = StringValuePtr (bar);
-
+
weechat_bar_remove (script_str2ptr (c_bar));
-
+
API_RETURN_OK;
}
@@ -5408,22 +5408,22 @@ static VALUE
weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
{
char *c_buffer, *c_command;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
if (NIL_P (buffer) || NIL_P (command))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (buffer, T_STRING);
Check_Type (command, T_STRING);
-
+
c_buffer = StringValuePtr (buffer);
c_command = StringValuePtr (command);
-
+
script_api_command (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
c_command);
-
+
API_RETURN_OK;
}
@@ -5436,19 +5436,19 @@ weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
{
char *c_info_name, *c_arguments;
const char *result;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (info_name, T_STRING);
Check_Type (arguments, T_STRING);
-
+
c_info_name = StringValuePtr (info_name);
c_arguments = StringValuePtr (arguments);
-
+
result = weechat_info_get (c_info_name, c_arguments);
-
+
API_RETURN_STRING(result);
}
@@ -5463,26 +5463,26 @@ weechat_ruby_api_info_get_hashtable (VALUE class, VALUE info_name,
char *c_info_name;
struct t_hashtable *c_hashtable, *result_hashtable;
VALUE result_hash;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (NIL_P (info_name) || NIL_P (hash))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (info_name, T_STRING);
Check_Type (hash, T_HASH);
-
+
c_info_name = StringValuePtr (info_name);
c_hashtable = weechat_ruby_hash_to_hashtable (hash,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (c_info_name, c_hashtable);
result_hash = weechat_ruby_hashtable_to_hash (result_hashtable);
-
+
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
return result_hash;
}
@@ -5495,11 +5495,11 @@ weechat_ruby_api_infolist_new (VALUE class)
{
char *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5512,17 +5512,17 @@ weechat_ruby_api_infolist_new_item (VALUE class, VALUE infolist)
{
char *c_infolist, *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_EMPTY);
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (c_infolist)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5538,23 +5538,23 @@ weechat_ruby_api_infolist_new_var_integer (VALUE class, VALUE infolist,
char *c_infolist, *c_name, *result;
int c_value;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
Check_Type (value, T_FIXNUM);
-
+
c_infolist = StringValuePtr (infolist);
c_name = StringValuePtr (name);
c_value = FIX2INT (value);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (c_infolist),
c_name,
c_value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5569,23 +5569,23 @@ weechat_ruby_api_infolist_new_var_string (VALUE class, VALUE infolist,
{
char *c_infolist, *c_name, *c_value, *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
Check_Type (value, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_name = StringValuePtr (name);
c_value = StringValuePtr (value);
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (c_infolist),
c_name,
c_value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5600,23 +5600,23 @@ weechat_ruby_api_infolist_new_var_pointer (VALUE class, VALUE infolist,
{
char *c_infolist, *c_name, *c_value, *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
Check_Type (value, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_name = StringValuePtr (name);
c_value = StringValuePtr (value);
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (c_infolist),
c_name,
script_str2ptr (c_value)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5631,23 +5631,23 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE infolist,
char *c_infolist, *c_name, *result;
int c_value;
VALUE return_value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (name) || NIL_P (value))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (name, T_STRING);
Check_Type (value, T_FIXNUM);
-
+
c_infolist = StringValuePtr (infolist);
c_name = StringValuePtr (name);
c_value = FIX2INT (value);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (c_infolist),
c_name,
c_value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5661,23 +5661,23 @@ weechat_ruby_api_infolist_get (VALUE class, VALUE name, VALUE pointer,
{
char *c_name, *c_pointer, *c_arguments, *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (NIL_P (name) || NIL_P (pointer) || NIL_P (arguments))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (arguments, T_STRING);
-
+
c_name = StringValuePtr (name);
c_pointer = StringValuePtr (pointer);
c_arguments = StringValuePtr (arguments);
-
+
result = script_ptr2str (weechat_infolist_get (c_name,
script_str2ptr (c_pointer),
c_arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5690,17 +5690,17 @@ weechat_ruby_api_infolist_next (VALUE class, VALUE infolist)
{
char *c_infolist;
int value;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
value = weechat_infolist_next (script_str2ptr (c_infolist));
-
+
API_RETURN_INT(value);
}
@@ -5713,17 +5713,17 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist)
{
char *c_infolist;
int value;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
value = weechat_infolist_prev (script_str2ptr (c_infolist));
-
+
API_RETURN_INT(value);
}
@@ -5736,17 +5736,17 @@ static VALUE
weechat_ruby_api_infolist_reset_item_cursor (VALUE class, VALUE infolist)
{
char *c_infolist;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (c_infolist));
-
+
API_RETURN_OK;
}
@@ -5759,17 +5759,17 @@ weechat_ruby_api_infolist_fields (VALUE class, VALUE infolist)
{
char *c_infolist;
const char *result;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
result = weechat_infolist_fields (script_str2ptr (c_infolist));
-
+
API_RETURN_STRING(result);
}
@@ -5782,19 +5782,19 @@ weechat_ruby_api_infolist_integer (VALUE class, VALUE infolist, VALUE variable)
{
char *c_infolist, *c_variable;
int value;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (NIL_P (infolist) || NIL_P (variable))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_variable = StringValuePtr (variable);
-
+
value = weechat_infolist_integer (script_str2ptr (c_infolist), c_variable);
-
+
API_RETURN_INT(value);
}
@@ -5807,19 +5807,19 @@ weechat_ruby_api_infolist_string (VALUE class, VALUE infolist, VALUE variable)
{
char *c_infolist, *c_variable;
const char *result;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_variable = StringValuePtr (variable);
-
+
result = weechat_infolist_string (script_str2ptr (c_infolist), c_variable);
-
+
API_RETURN_STRING(result);
}
@@ -5832,19 +5832,19 @@ weechat_ruby_api_infolist_pointer (VALUE class, VALUE infolist, VALUE variable)
{
char *c_infolist, *c_variable, *result;
VALUE return_value;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_variable = StringValuePtr (variable);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (c_infolist), c_variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5858,21 +5858,21 @@ weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable)
char *c_infolist, *c_variable, timebuffer[64], *result;
time_t time;
VALUE return_value;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (NIL_P (infolist) || NIL_P (variable))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (infolist, T_STRING);
Check_Type (variable, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
c_variable = StringValuePtr (variable);
-
+
time = weechat_infolist_time (script_str2ptr (c_infolist), c_variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5884,17 +5884,17 @@ static VALUE
weechat_ruby_api_infolist_free (VALUE class, VALUE infolist)
{
char *c_infolist;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (infolist, T_STRING);
-
+
c_infolist = StringValuePtr (infolist);
-
+
weechat_infolist_free (script_str2ptr (c_infolist));
-
+
API_RETURN_OK;
}
@@ -5907,17 +5907,17 @@ weechat_ruby_api_hdata_get (VALUE class, VALUE name)
{
char *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (name, T_STRING);
-
+
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_hdata_get (c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5930,19 +5930,19 @@ weechat_ruby_api_hdata_get_var_offset (VALUE class, VALUE hdata, VALUE name)
{
char *c_hdata, *c_name;
int value;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
-
+
value = weechat_hdata_get_var_offset (script_str2ptr (c_hdata), c_name);
-
+
API_RETURN_INT(value);
}
@@ -5957,19 +5957,19 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata,
{
char *c_hdata, *c_name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata), c_name);
-
+
API_RETURN_STRING(result);
}
@@ -5982,19 +5982,19 @@ weechat_ruby_api_hdata_get_var_hdata (VALUE class, VALUE hdata, VALUE name)
{
char *c_hdata, *c_name;
const char *result;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (c_hdata), c_name);
-
+
API_RETURN_STRING(result);
}
@@ -6007,20 +6007,20 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
{
char *c_hdata, *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (c_hdata),
c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6035,23 +6035,23 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *result;
int c_count;
VALUE return_value;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (count))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (count, T_FIXNUM);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_count = FIX2INT (count);
-
+
result = weechat_hdata_move (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_count);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6066,23 +6066,23 @@ weechat_ruby_api_hdata_integer (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name;
int value;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
-
+
value = weechat_hdata_integer (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
-
+
API_RETURN_INT(value);
}
@@ -6097,23 +6097,23 @@ weechat_ruby_api_hdata_long (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name;
long value;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
-
+
value = weechat_hdata_long (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
-
+
API_RETURN_LONG(value);
}
@@ -6128,23 +6128,23 @@ weechat_ruby_api_hdata_string (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name;
const char *result;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
-
+
result = weechat_hdata_string (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
-
+
API_RETURN_STRING(result);
}
@@ -6159,23 +6159,23 @@ weechat_ruby_api_hdata_pointer (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name, *result;
VALUE return_value;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6191,25 +6191,25 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
time_t time;
VALUE return_value;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
-
+
time = weechat_hdata_time (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6222,20 +6222,20 @@ weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property)
{
char *c_hdata, *c_property;
const char *result;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (NIL_P (hdata) || NIL_P (property))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (hdata, T_STRING);
Check_Type (property, T_STRING);
-
+
c_hdata = StringValuePtr (hdata);
c_property = StringValuePtr (property);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata),
c_property);
-
+
API_RETURN_STRING(result);
}
@@ -6249,20 +6249,20 @@ weechat_ruby_api_upgrade_new (VALUE class, VALUE filename, VALUE write)
char *c_filename, *result;
int c_write;
VALUE return_value;
-
+
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (NIL_P (filename) || NIL_P (write))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
Check_Type (filename, T_STRING);
Check_Type (write, T_FIXNUM);
-
+
c_filename = StringValuePtr (filename);
c_write = FIX2INT (write);
-
+
result = script_ptr2str (weechat_upgrade_new (c_filename,
c_write));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6276,23 +6276,23 @@ weechat_ruby_api_upgrade_write_object (VALUE class, VALUE upgrade_file,
{
char *c_upgrade_file, *c_infolist;
int c_object_id, rc;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (NIL_P (upgrade_file) || NIL_P (object_id) || NIL_P (infolist))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (upgrade_file, T_STRING);
Check_Type (object_id, T_FIXNUM);
Check_Type (infolist, T_STRING);
-
+
c_upgrade_file = StringValuePtr (upgrade_file);
c_object_id = FIX2INT (object_id);
c_infolist = StringValuePtr (infolist);
-
+
rc = weechat_upgrade_write_object (script_str2ptr (c_upgrade_file),
c_object_id,
script_str2ptr (c_infolist));
-
+
API_RETURN_INT(rc);
}
@@ -6310,23 +6310,23 @@ weechat_ruby_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -6338,10 +6338,10 @@ weechat_ruby_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -6355,26 +6355,26 @@ weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file,
{
char *c_upgrade_file, *c_function, *c_data;
int rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_INT(0));
if (NIL_P (upgrade_file) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
Check_Type (upgrade_file, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
-
+
c_upgrade_file = StringValuePtr (upgrade_file);
c_function = StringValuePtr (function);
c_data = StringValuePtr (data);
-
+
rc = script_api_upgrade_read (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_upgrade_file),
&weechat_ruby_api_upgrade_read_cb,
c_function,
c_data);
-
+
API_RETURN_INT(rc);
}
@@ -6386,17 +6386,17 @@ static VALUE
weechat_ruby_api_upgrade_close (VALUE class, VALUE upgrade_file)
{
char *c_upgrade_file;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (NIL_P (upgrade_file))
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
Check_Type (upgrade_file, T_STRING);
-
+
c_upgrade_file = StringValuePtr (upgrade_file);
-
+
weechat_upgrade_close (script_str2ptr (c_upgrade_file));
-
+
API_RETURN_OK;
}
@@ -6410,7 +6410,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK", INT2NUM(WEECHAT_RC_OK));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK_EAT", INT2NUM(WEECHAT_RC_OK_EAT));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_ERROR", INT2NUM(WEECHAT_RC_ERROR));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_READ_OK", INT2NUM(WEECHAT_CONFIG_READ_OK));
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_READ_MEMORY_ERROR", INT2NUM(WEECHAT_CONFIG_READ_MEMORY_ERROR));
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", INT2NUM(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
@@ -6425,19 +6425,19 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
rb_define_const(ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_ERROR", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_SORT", rb_str_new2(WEECHAT_LIST_POS_SORT));
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_BEGINNING", rb_str_new2(WEECHAT_LIST_POS_BEGINNING));
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_END", rb_str_new2(WEECHAT_LIST_POS_END));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_HOTLIST_LOW", rb_str_new2(WEECHAT_HOTLIST_LOW));
rb_define_const(ruby_mWeechat, "WEECHAT_HOTLIST_MESSAGE", rb_str_new2(WEECHAT_HOTLIST_MESSAGE));
rb_define_const(ruby_mWeechat, "WEECHAT_HOTLIST_PRIVATE", rb_str_new2(WEECHAT_HOTLIST_PRIVATE));
rb_define_const(ruby_mWeechat, "WEECHAT_HOTLIST_HIGHLIGHT", rb_str_new2(WEECHAT_HOTLIST_HIGHLIGHT));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_PROCESS_RUNNING", INT2NUM(WEECHAT_HOOK_PROCESS_RUNNING));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_PROCESS_ERROR", INT2NUM(WEECHAT_HOOK_PROCESS_ERROR));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_OK", INT2NUM(WEECHAT_HOOK_CONNECT_OK));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", INT2NUM(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", INT2NUM(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
@@ -6447,11 +6447,11 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
-
+
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_STRING", rb_str_new2(WEECHAT_HOOK_SIGNAL_STRING));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_INT", rb_str_new2(WEECHAT_HOOK_SIGNAL_INT));
rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_POINTER", rb_str_new2(WEECHAT_HOOK_SIGNAL_POINTER));
-
+
rb_define_module_function (ruby_mWeechat, "register", &weechat_ruby_api_register, 7);
rb_define_module_function (ruby_mWeechat, "plugin_get_name", &weechat_ruby_api_plugin_get_name, 1);
rb_define_module_function (ruby_mWeechat, "charset_set", &weechat_ruby_api_charset_set, 1);
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index b922de84f..8e66db21e 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -113,12 +113,12 @@ weechat_ruby_hashtable_map_cb (void *data,
const void *value)
{
VALUE *hash;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
hash = (VALUE *)data;
-
+
rb_hash_aset (hash[0], rb_str_new2 ((char *)key),
rb_str_new2 ((char *)value));
}
@@ -139,7 +139,7 @@ weechat_ruby_hashtable_to_hash (struct t_hashtable *hashtable)
weechat_hashtable_map (hashtable,
&weechat_ruby_hashtable_map_cb,
&hash);
-
+
return hash;
}
@@ -147,7 +147,7 @@ int
weechat_ruby_hash_foreach_cb (VALUE key, VALUE value, void *arg)
{
struct t_hashtable *hashtable;
-
+
hashtable = (struct t_hashtable *)arg;
if ((TYPE(key) == T_STRING) && (TYPE(value) == T_STRING))
{
@@ -169,7 +169,7 @@ struct t_hashtable *
weechat_ruby_hash_to_hashtable (VALUE hash, int hashtable_size)
{
struct t_hashtable *hashtable;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -177,10 +177,10 @@ weechat_ruby_hash_to_hashtable (VALUE hash, int hashtable_size)
NULL);
if (!hashtable)
return NULL;
-
+
rb_hash_foreach (hash, &weechat_ruby_hash_foreach_cb,
(unsigned long)hashtable);
-
+
return hashtable;
}
@@ -205,7 +205,7 @@ VALUE
rb_protect_funcall (VALUE recv, ID mid, int *state, int argc, VALUE *argv)
{
struct protect_call_arg arg;
-
+
arg.recv = recv;
arg.mid = mid;
arg.argc = argc;
@@ -227,7 +227,7 @@ weechat_ruby_print_exception (VALUE err)
char* cline;
char* err_msg;
char* err_class;
-
+
backtrace = rb_protect_funcall (err, rb_intern("backtrace"),
&ruby_error, 0, NULL);
@@ -238,7 +238,7 @@ weechat_ruby_print_exception (VALUE err)
&ruby_error, 0, NULL),
rb_intern("name"), &ruby_error, 0, NULL);
err_class = StringValuePtr(tmp2);
-
+
if (strcmp (err_class, "SyntaxError") == 0)
{
tmp3 = rb_inspect(err);
@@ -285,12 +285,12 @@ weechat_ruby_print_exception (VALUE err)
weechat_prefix ("error"), RUBY_PLUGIN_NAME,
cline);
}
-
+
if (cline)
free (cline);
}
}
-
+
return 0;
}
@@ -308,10 +308,10 @@ weechat_ruby_exec (struct t_plugin_script *script,
VALUE argv2[16];
void *ret_value;
struct t_plugin_script *old_ruby_current_script;
-
+
old_ruby_current_script = ruby_current_script;
ruby_current_script = script;
-
+
argc = 0;
if (format && format[0])
{
@@ -332,7 +332,7 @@ weechat_ruby_exec (struct t_plugin_script *script,
}
}
}
-
+
if (argc > 0)
{
rc = rb_protect_funcall ((VALUE) script->interpreter,
@@ -345,19 +345,19 @@ weechat_ruby_exec (struct t_plugin_script *script,
rb_intern(function),
&ruby_error, 0, NULL);
}
-
+
if (ruby_error)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to run function \"%s\""),
weechat_prefix ("error"), RUBY_PLUGIN_NAME, function);
-
+
err = rb_gv_get("$!");
weechat_ruby_print_exception(err);
-
+
return NULL;
}
-
+
if ((TYPE(rc) == T_STRING) && (ret_type == WEECHAT_SCRIPT_EXEC_STRING))
{
if (StringValuePtr (rc))
@@ -386,7 +386,7 @@ weechat_ruby_exec (struct t_plugin_script *script,
ruby_current_script = old_ruby_current_script;
return WEECHAT_RC_OK;
}
-
+
if (ret_value == NULL)
{
weechat_printf (NULL,
@@ -396,9 +396,9 @@ weechat_ruby_exec (struct t_plugin_script *script,
ruby_current_script = old_ruby_current_script;
return NULL;
}
-
+
ruby_current_script = old_ruby_current_script;
-
+
return ret_value;
}
@@ -410,12 +410,12 @@ static VALUE
weechat_ruby_output (VALUE self, VALUE str)
{
char *msg, *p, *m;
-
+
/* make C compiler happy */
(void) self;
-
+
msg = strdup(StringValuePtr(str));
-
+
m = msg;
while ((p = strchr (m, '\n')) != NULL)
{
@@ -431,7 +431,7 @@ weechat_ruby_output (VALUE self, VALUE str)
ruby_buffer_output[0] = '\0';
m = ++p;
}
-
+
if (strlen(m) + strlen(ruby_buffer_output) > sizeof(ruby_buffer_output))
{
weechat_printf (NULL,
@@ -445,7 +445,7 @@ weechat_ruby_output (VALUE self, VALUE str)
if (msg)
free (msg);
-
+
return Qnil;
}
@@ -458,7 +458,7 @@ weechat_ruby_output_flush (VALUE self)
{
/* make C compiler happy */
(void) self;
-
+
return Qnil;
}
@@ -473,7 +473,7 @@ weechat_ruby_load (const char *filename)
VALUE curModule, ruby_retcode, err, argv[1];
int ruby_error;
struct stat buf;
-
+
if (stat (filename, &buf) != 0)
{
weechat_printf (NULL,
@@ -481,17 +481,17 @@ weechat_ruby_load (const char *filename)
weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
RUBY_PLUGIN_NAME, filename);
}
-
+
ruby_current_script = NULL;
ruby_registered_script = NULL;
-
+
snprintf (modname, sizeof(modname), "%s%d", MOD_NAME_PREFIX, ruby_num);
ruby_num++;
@@ -502,14 +502,14 @@ weechat_ruby_load (const char *filename)
argv[0] = rb_str_new2 (filename);
ruby_retcode = rb_protect_funcall (curModule, rb_intern("load_eval_file"),
&ruby_error, 1, argv);
-
+
if (ruby_retcode == Qnil)
{
err = rb_gv_get("$!");
weechat_ruby_print_exception(err);
return 0;
}
-
+
if (NUM2INT(ruby_retcode) != 0)
{
switch (NUM2INT(ruby_retcode))
@@ -542,20 +542,20 @@ weechat_ruby_load (const char *filename)
{
weechat_ruby_print_exception(rb_iv_get(curModule, "@load_eval_file_error"));
}
-
+
return 0;
}
-
+
(void) rb_protect_funcall (curModule, rb_intern("weechat_init"),
&ruby_error, 0, NULL);
-
+
if (ruby_error)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to eval function "
"\"weechat_init\" in file \"%s\""),
weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
-
+
err = rb_gv_get("$!");
weechat_ruby_print_exception(err);
@@ -568,7 +568,7 @@ weechat_ruby_load (const char *filename)
return 0;
}
-
+
if (!ruby_registered_script)
{
weechat_printf (NULL,
@@ -578,10 +578,10 @@ weechat_ruby_load (const char *filename)
return 0;
}
ruby_current_script = ruby_registered_script;
-
+
ruby_current_script->interpreter = (VALUE *) curModule;
rb_gc_register_address (ruby_current_script->interpreter);
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -591,7 +591,7 @@ weechat_ruby_load (const char *filename)
ruby_current_script,
&weechat_ruby_api_buffer_input_data_cb,
&weechat_ruby_api_buffer_close_cb);
-
+
return 1;
}
@@ -604,7 +604,7 @@ weechat_ruby_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_ruby_load (filename);
}
@@ -617,14 +617,14 @@ weechat_ruby_unload (struct t_plugin_script *script)
{
int *rc;
void *interpreter;
-
+
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
RUBY_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *)weechat_ruby_exec (script,
@@ -634,16 +634,16 @@ weechat_ruby_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
interpreter = script->interpreter;
-
+
if (ruby_current_script == script)
ruby_current_script = (ruby_current_script->prev_script) ?
ruby_current_script->prev_script : ruby_current_script->next_script;
-
+
script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script,
script);
-
+
if (interpreter)
rb_gc_unregister_address (interpreter);
}
@@ -656,7 +656,7 @@ void
weechat_ruby_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_ruby_plugin, ruby_scripts, name);
if (ptr_script)
{
@@ -682,7 +682,7 @@ weechat_ruby_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_ruby_plugin, ruby_scripts, name);
if (ptr_script)
{
@@ -727,11 +727,11 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc == 1)
{
script_display_list (weechat_ruby_plugin, ruby_scripts,
@@ -802,7 +802,7 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_prefix ("error"), RUBY_PLUGIN_NAME, "ruby");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -819,9 +819,9 @@ weechat_ruby_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_ruby_plugin, completion, ruby_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -835,17 +835,17 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "ruby_script") == 0)
{
return script_infolist_list_scripts (weechat_ruby_plugin,
ruby_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -861,13 +861,13 @@ weechat_ruby_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, RUBY_PLUGIN_NAME) == 0))
{
script_print_log (weechat_ruby_plugin, ruby_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -883,10 +883,10 @@ weechat_ruby_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (ruby_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -918,7 +918,7 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
&ruby_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -934,7 +934,7 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "ruby_script_install") == 0)
@@ -954,7 +954,7 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
&ruby_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1023,25 +1023,25 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" end\n"
"end\n"
};
-
+
weechat_ruby_plugin = plugin;
-
+
ruby_error = 0;
-
+
/* init stdout/stderr buffer */
ruby_buffer_output[0] = '\0';
-
+
#if defined(RUBY_VERSION) && RUBY_VERSION >= 19
RUBY_INIT_STACK;
#endif
-
+
ruby_init ();
ruby_init_loadpath ();
ruby_script ("__weechat_plugin__");
-
+
ruby_mWeechat = rb_define_module("Weechat");
weechat_ruby_api_init (ruby_mWeechat);
-
+
/* redirect stdin and stdout */
ruby_mWeechatOutputs = rb_define_module("WeechatOutputs");
rb_define_singleton_method(ruby_mWeechatOutputs, "write",
@@ -1064,7 +1064,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_ruby_print_exception(err);
return WEECHAT_RC_ERROR;
}
-
+
ruby_quiet = 1;
script_init (weechat_ruby_plugin,
argc,
@@ -1077,10 +1077,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_ruby_signal_script_action_cb,
&weechat_ruby_load_cb);
ruby_quiet = 0;
-
+
script_display_short_list (weechat_ruby_plugin,
ruby_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -1096,8 +1096,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
ruby_quiet = 1;
script_end (plugin, &ruby_scripts, &weechat_ruby_unload_all);
ruby_quiet = 0;
-
+
ruby_cleanup (0);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 2c04d0b80..3c3d3607c 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -42,7 +42,7 @@ script_api_charset_set (struct t_plugin_script *script,
{
if (script->charset)
free (script->charset);
-
+
script->charset = (charset) ? strdup (charset) : NULL;
}
@@ -68,7 +68,7 @@ script_api_config_new (struct t_weechat_plugin *weechat_plugin,
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_config_file = weechat_config_new (name, callback_reload,
new_script_callback);
if (!new_config_file)
@@ -77,17 +77,17 @@ script_api_config_new (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->config_file = new_config_file;
-
+
script_callback_add (script, new_script_callback);
}
else
{
new_config_file = weechat_config_new (name, NULL, NULL);
}
-
+
return new_config_file;
}
@@ -139,7 +139,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_script_callback *new_script_callback5;
struct t_config_section *new_section;
void *callback1, *callback2, *callback3, *callback4, *callback5;
-
+
new_script_callback1 = NULL;
new_script_callback2 = NULL;
new_script_callback3 = NULL;
@@ -150,7 +150,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
callback3 = NULL;
callback4 = NULL;
callback5 = NULL;
-
+
if (function_read && function_read[0])
{
new_script_callback1 = script_callback_alloc ();
@@ -158,7 +158,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
return NULL;
callback1 = callback_read;
}
-
+
if (function_write && function_write[0])
{
new_script_callback2 = script_callback_alloc ();
@@ -193,7 +193,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
}
callback3 = callback_write_default;
}
-
+
if (function_create_option && function_create_option[0])
{
new_script_callback4 = script_callback_alloc ();
@@ -218,7 +218,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
}
callback4 = callback_create_option;
}
-
+
if (function_delete_option && function_delete_option[0])
{
new_script_callback5 = script_callback_alloc ();
@@ -248,7 +248,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
}
callback5 = callback_delete_option;
}
-
+
new_section = weechat_config_new_section (config_file,
name,
user_can_add_options,
@@ -310,7 +310,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
new_script_callback2->config_section = new_section;
script_callback_add (script, new_script_callback2);
}
-
+
if (new_script_callback3)
{
script_callback_init (new_script_callback3, script,
@@ -319,7 +319,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
new_script_callback3->config_section = new_section;
script_callback_add (script, new_script_callback3);
}
-
+
if (new_script_callback4)
{
script_callback_init (new_script_callback4, script,
@@ -328,7 +328,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
new_script_callback4->config_section = new_section;
script_callback_add (script, new_script_callback4);
}
-
+
if (new_script_callback5)
{
script_callback_init (new_script_callback5, script,
@@ -337,7 +337,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
new_script_callback5->config_section = new_section;
script_callback_add (script, new_script_callback5);
}
-
+
return new_section;
}
@@ -375,14 +375,14 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_script_callback *new_script_callback3;
void *callback1, *callback2, *callback3;
struct t_config_option *new_option;
-
+
new_script_callback1 = NULL;
new_script_callback2 = NULL;
new_script_callback3 = NULL;
callback1 = NULL;
callback2 = NULL;
callback3 = NULL;
-
+
if (function_check_value && function_check_value[0])
{
new_script_callback1 = script_callback_alloc ();
@@ -390,7 +390,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
return NULL;
callback1 = callback_check_value;
}
-
+
if (function_change && function_change[0])
{
new_script_callback2 = script_callback_alloc ();
@@ -425,7 +425,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
}
callback3 = callback_delete;
}
-
+
new_option = weechat_config_new_option (config_file, section, name, type,
description, string_values, min,
max, default_value, value,
@@ -452,7 +452,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
}
return NULL;
}
-
+
if (new_script_callback1)
{
script_callback_init (new_script_callback1, script,
@@ -462,7 +462,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
new_script_callback1->config_option = new_option;
script_callback_add (script, new_script_callback1);
}
-
+
if (new_script_callback2)
{
script_callback_init (new_script_callback2, script,
@@ -472,7 +472,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
new_script_callback2->config_option = new_option;
script_callback_add (script, new_script_callback2);
}
-
+
if (new_script_callback3)
{
script_callback_init (new_script_callback3, script,
@@ -482,7 +482,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
new_script_callback3->config_option = new_option;
script_callback_add (script, new_script_callback3);
}
-
+
return new_option;
}
@@ -496,20 +496,20 @@ script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
struct t_config_option *option)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !option)
return;
-
+
weechat_config_option_free (option);
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->config_option == option)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -525,21 +525,21 @@ script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !section)
return;
-
+
weechat_config_section_free_options (section);
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if ((ptr_script_callback->config_section == section)
&& ptr_script_callback->config_option)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -554,20 +554,20 @@ script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !section)
return;
-
+
weechat_config_section_free (section);
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->config_section == section)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -582,20 +582,20 @@ script_api_config_free (struct t_weechat_plugin *weechat_plugin,
struct t_config_file *config_file)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !config_file)
return;
-
+
weechat_config_free (config_file);
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->config_file == config_file)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -610,17 +610,17 @@ script_api_printf (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer, const char *format, ...)
{
char *buf2;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
buf2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
weechat_printf (buffer, "%s", (buf2) ? buf2 : vbuffer);
if (buf2)
free (buf2);
-
+
free (vbuffer);
}
@@ -636,18 +636,18 @@ script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
const char *format, ...)
{
char *buf2;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
buf2 = (script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
weechat_printf_date_tags (buffer, date, tags,
"%s", (buf2) ? buf2 : vbuffer);
if (buf2)
free (buf2);
-
+
free (vbuffer);
}
@@ -662,17 +662,17 @@ script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
const char *format, ...)
{
char *buf2;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
buf2 = (script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
weechat_printf_y (buffer, y, "%s", (buf2) ? buf2 : vbuffer);
if (buf2)
free (buf2);
-
+
free (vbuffer);
}
@@ -686,17 +686,17 @@ script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
const char *format, ...)
{
char *buf2;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
buf2 = (script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
weechat_log_printf ("%s", (buf2) ? buf2 : vbuffer);
if (buf2)
free (buf2);
-
+
free (vbuffer);
}
@@ -724,7 +724,7 @@ script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_command (command, description, args,
args_description, completion,
callback, new_script_callback);
@@ -737,9 +737,9 @@ script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -760,11 +760,11 @@ script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_command_run (command,
callback, new_script_callback);
if (!new_hook)
@@ -773,12 +773,12 @@ script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -798,11 +798,11 @@ script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_timer (interval, align_second, max_calls,
callback, new_script_callback);
if (!new_hook)
@@ -811,12 +811,12 @@ script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -836,11 +836,11 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_fd (fd, flag_read, flag_write, flag_exception,
callback, new_script_callback);
if (!new_hook)
@@ -849,12 +849,12 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -878,25 +878,25 @@ script_api_hook_process (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
script_callback_init (new_script_callback, script, function, data);
script_callback_add (script, new_script_callback);
-
+
new_hook = weechat_hook_process (command, timeout, callback,
new_script_callback);
-
+
if (!new_hook)
{
script_callback_remove (script, new_script_callback);
return NULL;
}
-
+
new_script_callback->hook = new_hook;
-
+
return new_hook;
}
@@ -926,7 +926,7 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_connect (proxy, address, port, sock, ipv6,
gnutls_sess, gnutls_cb, gnutls_dhkey_size,
gnutls_priorities, local_hostname,
@@ -937,12 +937,12 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -968,11 +968,11 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_print (buffer, tags, message, strip_colors,
callback, new_script_callback);
if (!new_hook)
@@ -981,12 +981,12 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1007,11 +1007,11 @@ script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_signal (signal, callback, new_script_callback);
if (!new_hook)
{
@@ -1019,12 +1019,12 @@ script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1044,11 +1044,11 @@ script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_hsignal (signal, callback, new_script_callback);
if (!new_hook)
{
@@ -1056,12 +1056,12 @@ script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1081,11 +1081,11 @@ script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_config (option, callback, new_script_callback);
if (!new_hook)
{
@@ -1093,12 +1093,12 @@ script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1121,11 +1121,11 @@ script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_completion (completion, description,
callback, new_script_callback);
if (!new_hook)
@@ -1134,12 +1134,12 @@ script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1160,11 +1160,11 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_modifier (modifier, callback, new_script_callback);
if (!new_hook)
{
@@ -1172,12 +1172,12 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1200,11 +1200,11 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_info (info_name, description, args_description,
callback, new_script_callback);
if (!new_hook)
@@ -1213,12 +1213,12 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1242,11 +1242,11 @@ script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_info_hashtable (info_name, description,
args_description,
output_description,
@@ -1257,12 +1257,12 @@ script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1287,11 +1287,11 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_infolist (infolist_name, description,
pointer_description, args_description,
callback, new_script_callback);
@@ -1301,12 +1301,12 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1326,11 +1326,11 @@ script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
new_hook = weechat_hook_focus (area, callback, new_script_callback);
if (!new_hook)
{
@@ -1338,12 +1338,12 @@ script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->hook = new_hook;
-
+
script_callback_add (script, new_script_callback);
-
+
return new_hook;
}
@@ -1357,20 +1357,20 @@ script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_hook *hook)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !hook)
return;
-
+
weechat_unhook (hook);
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->hook == hook)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -1383,14 +1383,14 @@ void
script_api_unhook_all (struct t_plugin_script *script)
{
struct t_script_callback *ptr_callback, *next_callback;
-
+
ptr_callback = script->callbacks;
while (ptr_callback)
{
next_callback = ptr_callback->next_callback;
-
+
script_callback_remove (script, ptr_callback);
-
+
ptr_callback = next_callback;
}
}
@@ -1416,21 +1416,21 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_script_callback *new_script_callback_input;
struct t_script_callback *new_script_callback_close;
struct t_gui_buffer *new_buffer;
-
+
if ((!function_input || !function_input[0])
&& (!function_close || !function_close[0]))
return weechat_buffer_new (name, NULL, NULL, NULL, NULL);
-
+
new_script_callback_input = NULL;
new_script_callback_close = NULL;
-
+
if (function_input && function_input[0])
{
new_script_callback_input = script_callback_alloc ();
if (!new_script_callback_input)
return NULL;
}
-
+
if (function_close && function_close[0])
{
new_script_callback_close = script_callback_alloc ();
@@ -1444,7 +1444,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
return NULL;
}
}
-
+
new_buffer = weechat_buffer_new (name,
(new_script_callback_input) ?
input_callback : NULL,
@@ -1468,7 +1468,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
}
return NULL;
}
-
+
if (new_script_callback_input)
{
script_callback_init (new_script_callback_input,
@@ -1476,7 +1476,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
new_script_callback_input->buffer = new_buffer;
script_callback_add (script, new_script_callback_input);
}
-
+
if (new_script_callback_close)
{
script_callback_init (new_script_callback_close,
@@ -1496,7 +1496,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
function_close);
weechat_buffer_set (new_buffer, "localvar_set_script_close_cb_data",
data_close);
-
+
return new_buffer;
}
@@ -1510,20 +1510,20 @@ script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !buffer)
return;
-
+
weechat_buffer_close (buffer);
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->buffer == buffer)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -1544,13 +1544,13 @@ script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
struct t_gui_bar_item *new_item;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
-
+
script_callback_init (new_script_callback, script, function, data);
-
+
new_item = weechat_bar_item_new (name,
(function && function[0]) ?
build_callback : NULL,
@@ -1562,10 +1562,10 @@ script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
free (new_script_callback);
return NULL;
}
-
+
new_script_callback->bar_item = new_item;
script_callback_add (script, new_script_callback);
-
+
return new_item;
}
@@ -1579,20 +1579,20 @@ script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
struct t_gui_bar_item *item)
{
struct t_script_callback *ptr_script_callback, *next_callback;
-
+
if (!weechat_plugin || !script || !item)
return;
-
+
weechat_bar_item_remove (item);
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->bar_item == item)
script_callback_remove (script, ptr_script_callback);
-
+
ptr_script_callback = next_callback;
}
}
@@ -1607,12 +1607,12 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer, const char *command)
{
char *command2;
-
+
command2 = (script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, command) : NULL;
-
+
weechat_command (buffer, (command2) ? command2 : command);
-
+
if (command2)
free (command2);
}
@@ -1629,19 +1629,19 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
{
char *option_fullname;
const char *return_value;
-
+
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
if (!option_fullname)
return NULL;
-
+
strcpy (option_fullname, script->name);
strcat (option_fullname, ".");
strcat (option_fullname, option);
-
+
return_value = weechat_config_get_plugin (option_fullname);
free (option_fullname);
-
+
return return_value;
}
@@ -1656,19 +1656,19 @@ script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
{
char *option_fullname;
int return_code;
-
+
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
if (!option_fullname)
return 0;
-
+
strcpy (option_fullname, script->name);
strcat (option_fullname, ".");
strcat (option_fullname, option);
-
+
return_code = weechat_config_is_set_plugin (option_fullname);
free (option_fullname);
-
+
return return_code;
}
@@ -1684,19 +1684,19 @@ script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
{
char *option_fullname;
int return_code;
-
+
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
if (!option_fullname)
return 0;
-
+
strcpy (option_fullname, script->name);
strcat (option_fullname, ".");
strcat (option_fullname, option);
-
+
return_code = weechat_config_set_plugin (option_fullname, value);
free (option_fullname);
-
+
return return_code;
}
@@ -1711,16 +1711,16 @@ script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugin,
const char *option, const char *description)
{
char *option_fullname;
-
+
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
if (!option_fullname)
return;
-
+
strcpy (option_fullname, script->name);
strcat (option_fullname, ".");
strcat (option_fullname, option);
-
+
weechat_config_set_desc_plugin (option_fullname, description);
free (option_fullname);
}
@@ -1737,19 +1737,19 @@ script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
{
char *option_fullname;
int return_code;
-
+
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
if (!option_fullname)
return 0;
-
+
strcpy (option_fullname, script->name);
strcat (option_fullname, ".");
strcat (option_fullname, option);
-
+
return_code = weechat_config_unset_plugin (option_fullname);
free (option_fullname);
-
+
return return_code;
}
@@ -1771,23 +1771,23 @@ script_api_upgrade_read (struct t_weechat_plugin *weechat_plugin,
{
struct t_script_callback *new_script_callback;
int rc;
-
+
if (!function || !function[0])
return 0;
-
+
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return 0;
-
+
script_callback_init (new_script_callback, script, function, data);
new_script_callback->upgrade_file = upgrade_file;
script_callback_add (script, new_script_callback);
-
+
rc = weechat_upgrade_read (upgrade_file,
callback_read,
new_script_callback);
-
+
script_callback_remove (script, new_script_callback);
-
+
return rc;
}
diff --git a/src/plugins/scripts/script-callback.c b/src/plugins/scripts/script-callback.c
index 9094f16d4..28608d040 100644
--- a/src/plugins/scripts/script-callback.c
+++ b/src/plugins/scripts/script-callback.c
@@ -38,7 +38,7 @@ struct t_script_callback *
script_callback_alloc ()
{
struct t_script_callback *new_script_callback;
-
+
new_script_callback = malloc (sizeof (*new_script_callback));
if (new_script_callback)
{
@@ -54,7 +54,7 @@ script_callback_alloc ()
new_script_callback->upgrade_file = NULL;
return new_script_callback;
}
-
+
return NULL;
}
@@ -121,9 +121,9 @@ script_callback_remove (struct t_plugin_script *script,
script_callback->prev_callback;
if (script->callbacks == script_callback)
script->callbacks = script_callback->next_callback;
-
+
script_callback_free_data (script_callback);
-
+
free (script_callback);
}
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index 44d3d1dda..3a9281203 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -50,7 +50,7 @@ void
script_config_read (struct t_weechat_plugin *weechat_plugin)
{
const char *string;
-
+
string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE);
if (!string)
{
@@ -73,9 +73,9 @@ script_config_cb (void *data, const char *option, const char *value)
/* make C compiler happy */
(void) option;
(void) value;
-
+
script_config_read (data);
-
+
return WEECHAT_RC_OK;
}
@@ -112,10 +112,10 @@ script_init (struct t_weechat_plugin *weechat_plugin,
char *string, *completion;
char signal_name[128];
int length, i, auto_load_scripts;
-
+
/* read script configuration */
script_config_read (weechat_plugin);
-
+
/* add hook for config option */
length = strlen (weechat_plugin->name) + 64;
string = malloc (length);
@@ -126,7 +126,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
weechat_hook_config (string, &script_config_cb, weechat_plugin);
free (string);
}
-
+
/* create directories in WeeChat home */
weechat_mkdir_home (weechat_plugin->name, 0755);
length = strlen (weechat_plugin->name) + strlen ("/autoload") + 1;
@@ -137,7 +137,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
weechat_mkdir_home (string, 0755);
free (string);
}
-
+
/* add command */
completion = NULL;
length = strlen (weechat_plugin->name) + 16;
@@ -182,7 +182,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
free (string);
if (completion)
free (completion);
-
+
/* add completion and infolist */
length = strlen (weechat_plugin->name) + 16;
string = malloc (length);
@@ -197,13 +197,13 @@ script_init (struct t_weechat_plugin *weechat_plugin,
callback_infolist, NULL);
free (string);
}
-
+
/* add signal for "debug_dump" */
weechat_hook_signal ("debug_dump", callback_signal_debug_dump, NULL);
-
+
/* add signal for "buffer_closed" */
weechat_hook_signal ("buffer_closed", callback_signal_buffer_closed, NULL);
-
+
/* add signal for a script action (install/remove) */
snprintf (signal_name, sizeof (signal_name), "%s_script_install",
weechat_plugin->name);
@@ -211,7 +211,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
snprintf (signal_name, sizeof (signal_name), "%s_script_remove",
weechat_plugin->name);
weechat_hook_signal (signal_name, callback_signal_script_action, NULL);
-
+
/* parse arguments */
auto_load_scripts = 1;
for (i = 0; i < argc; i++)
@@ -222,7 +222,7 @@ script_init (struct t_weechat_plugin *weechat_plugin,
auto_load_scripts = 0;
}
}
-
+
/* autoload scripts */
if (auto_load_scripts)
{
@@ -241,17 +241,17 @@ script_valid (struct t_plugin_script *scripts,
struct t_plugin_script *script)
{
struct t_plugin_script *ptr_script;
-
+
if (!script)
return 0;
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
if (ptr_script == script)
return 1;
}
-
+
/* script not found */
return 0;
}
@@ -266,13 +266,13 @@ char *
script_ptr2str (void *pointer)
{
char pointer_str[128];
-
+
if (!pointer)
return strdup ("");
-
+
snprintf (pointer_str, sizeof (pointer_str),
"0x%lx", (long unsigned int)pointer);
-
+
return strdup (pointer_str);
}
@@ -285,14 +285,14 @@ script_str2ptr (const char *pointer_str)
{
long unsigned int value;
int rc;
-
+
if (!pointer_str || (pointer_str[0] != '0') || (pointer_str[1] != 'x'))
return NULL;
-
+
rc = sscanf (pointer_str + 2, "%lx", &value);
if ((rc != EOF) && (rc >= 1))
return (void *)value;
-
+
return NULL;
}
@@ -307,7 +307,7 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
const char *dir_home;
char *dir_name;
int dir_length;
-
+
/* build directory, adding WeeChat home */
dir_home = weechat_info_get ("weechat_dir", "");
if (!dir_home)
@@ -316,11 +316,11 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
dir_name = malloc (dir_length);
if (!dir_name)
return;
-
+
snprintf (dir_name, dir_length,
"%s/%s/autoload", dir_home, weechat_plugin->name);
weechat_exec_on_files (dir_name, 0, NULL, callback);
-
+
free (dir_name);
}
@@ -333,14 +333,14 @@ script_search (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts, const char *name)
{
struct t_plugin_script *ptr_script;
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
if (weechat_strcasecmp (ptr_script->name, name) == 0)
return ptr_script;
}
-
+
/* script not found */
return NULL;
}
@@ -356,7 +356,7 @@ script_search_by_full_name (struct t_plugin_script *scripts,
{
char *base_name;
struct t_plugin_script *ptr_script;
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
@@ -364,7 +364,7 @@ script_search_by_full_name (struct t_plugin_script *scripts,
if (strcmp (base_name, full_name) == 0)
return ptr_script;
}
-
+
/* script not found */
return NULL;
}
@@ -381,10 +381,10 @@ script_search_path (struct t_weechat_plugin *weechat_plugin,
const char *dir_home, *dir_system;
int length;
struct stat st;
-
+
if (filename[0] == '~')
return weechat_string_expand_home (filename);
-
+
dir_home = weechat_info_get ("weechat_dir", "");
if (dir_home)
{
@@ -414,7 +414,7 @@ script_search_path (struct t_weechat_plugin *weechat_plugin,
return final_name;
free (final_name);
}
-
+
/* try WeeChat user's dir */
length = strlen (dir_home) + strlen (filename) + 16;
final_name = malloc (length);
@@ -427,7 +427,7 @@ script_search_path (struct t_weechat_plugin *weechat_plugin,
free (final_name);
}
}
-
+
/* try WeeChat system dir */
dir_system = weechat_info_get ("weechat_sharedir", "");
if (dir_system)
@@ -444,7 +444,7 @@ script_search_path (struct t_weechat_plugin *weechat_plugin,
free (final_name);
}
}
-
+
return strdup (filename);
}
@@ -526,7 +526,7 @@ script_add (struct t_weechat_plugin *weechat_plugin,
const char *charset)
{
struct t_plugin_script *new_script;
-
+
if (strchr (name, ' '))
{
weechat_printf (NULL,
@@ -535,7 +535,7 @@ script_add (struct t_weechat_plugin *weechat_plugin,
weechat_plugin->name, name);
return NULL;
}
-
+
if (script_option_check_license
&& (weechat_strcmp_ignore_chars (weechat_plugin->license, license,
"0123456789-.,/\\()[]{}", 0) != 0))
@@ -546,7 +546,7 @@ script_add (struct t_weechat_plugin *weechat_plugin,
weechat_prefix ("error"), weechat_plugin->name,
license, name, weechat_plugin->license);
}
-
+
new_script = malloc (sizeof (*new_script));
if (new_script)
{
@@ -561,16 +561,16 @@ script_add (struct t_weechat_plugin *weechat_plugin,
strdup (shutdown_func) : NULL;
new_script->charset = (charset) ? strdup (charset) : NULL;
new_script->callbacks = NULL;
-
+
script_insert_sorted (weechat_plugin, scripts, last_script, new_script);
-
+
return new_script;
}
-
+
weechat_printf (NULL,
_("%s: error loading script \"%s\" (not enough memory)"),
weechat_plugin->name, name);
-
+
return NULL;
}
@@ -597,7 +597,7 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *ptr_script;
struct t_script_callback *new_script_callback_input;
struct t_script_callback *new_script_callback_close;
-
+
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
{
@@ -621,7 +621,7 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
"localvar_script_close_cb");
script_close_cb_data = weechat_buffer_get_string (ptr_buffer,
"localvar_script_close_cb_data");
-
+
if (script_input_cb && script_input_cb[0])
{
new_script_callback_input = script_callback_alloc ();
@@ -681,7 +681,7 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
{
struct t_plugin_script *ptr_script;
struct t_script_callback *ptr_script_callback, *next_script_callback;
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
@@ -689,10 +689,10 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
while (ptr_script_callback)
{
next_script_callback = ptr_script_callback->next_callback;
-
+
if (ptr_script_callback->buffer == buffer)
script_callback_remove (ptr_script, ptr_script_callback);
-
+
ptr_script_callback = next_script_callback;
}
}
@@ -709,7 +709,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script)
{
struct t_script_callback *ptr_script_callback, *next_script_callback;
-
+
for (ptr_script_callback = script->callbacks; ptr_script_callback;
ptr_script_callback = ptr_script_callback->next_callback)
{
@@ -719,12 +719,12 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
weechat_unhook (ptr_script_callback->hook);
}
}
-
+
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
next_script_callback = ptr_script_callback->next_callback;
-
+
/* free config file */
if (ptr_script_callback->config_file
&& !ptr_script_callback->config_section
@@ -734,11 +734,11 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
weechat_config_write (ptr_script_callback->config_file);
weechat_config_free (ptr_script_callback->config_file);
}
-
+
/* remove bar item */
if (ptr_script_callback->bar_item)
weechat_bar_item_remove (ptr_script_callback->bar_item);
-
+
/* remove buffer */
if (ptr_script_callback->buffer)
{
@@ -751,13 +751,13 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
}
weechat_buffer_close (ptr_script_callback->buffer);
}
-
+
ptr_script_callback = next_script_callback;
}
-
+
/* remove all callbacks created by this script */
script_callback_remove_all (script);
-
+
/* free data */
if (script->filename)
free (script->filename);
@@ -775,7 +775,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
free (script->shutdown_func);
if (script->charset)
free (script->charset);
-
+
/* remove script from list */
if (script->prev_script)
(script->prev_script)->next_script = script->next_script;
@@ -785,7 +785,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
*scripts = script->next_script;
if (*last_script == script)
*last_script = script->prev_script;
-
+
/* free script */
free (script);
}
@@ -818,9 +818,9 @@ script_action_add (char **action_list, const char *name)
{
int length;
char *action_list2;
-
+
length = strlen (name);
-
+
if (!(*action_list))
{
*action_list = malloc (length + 1);
@@ -853,7 +853,7 @@ script_remove_file (struct t_weechat_plugin *weechat_plugin, const char *name,
{
int num_found, i;
char *path_script;
-
+
num_found = 0;
i = 0;
while (i < 2)
@@ -915,7 +915,7 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
const char *dir_home, *dir_separator;
int argc, i, length, rc;
struct t_plugin_script *ptr_script;
-
+
if (*list)
{
argv = weechat_string_split (*list, ",", 0, 0, &argc);
@@ -934,10 +934,10 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
ptr_script = script_search_by_full_name (scripts, base_name);
if (ptr_script)
(*script_unload) (ptr_script);
-
+
/* remove script file(s) */
script_remove_file (weechat_plugin, base_name, 0);
-
+
/* move file from install dir to language dir */
dir_home = weechat_info_get ("weechat_dir", "");
length = strlen (dir_home) + strlen (weechat_plugin->name) +
@@ -974,7 +974,7 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
}
free (autoload_path);
}
-
+
/* load script */
(*script_load) (new_path);
}
@@ -1019,7 +1019,7 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
char **argv;
int argc, i;
struct t_plugin_script *ptr_script;
-
+
if (*list)
{
argv = weechat_string_split (*list, ",", 0, 0, &argc);
@@ -1031,7 +1031,7 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
ptr_script = script_search_by_full_name (scripts, argv[i]);
if (ptr_script)
(*script_unload) (ptr_script);
-
+
/* remove script file(s) */
script_remove_file (weechat_plugin, argv[i], 1);
}
@@ -1052,7 +1052,7 @@ script_display_list (struct t_weechat_plugin *weechat_plugin,
const char *name, int full)
{
struct t_plugin_script *ptr_script;
-
+
weechat_printf (NULL, "");
weechat_printf (NULL,
/* TRANSLATORS: "%s" is language (for example "perl") */
@@ -1101,21 +1101,21 @@ script_display_short_list (struct t_weechat_plugin *weechat_plugin,
char *buf;
int length;
struct t_plugin_script *ptr_script;
-
+
if (scripts)
{
/* TRANSLATORS: "%s" is language (for example "perl") */
scripts_loaded = _("%s scripts loaded:");
-
+
length = strlen (scripts_loaded) + strlen (weechat_plugin->name) + 1;
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
length += strlen (ptr_script->name) + 2;
}
length++;
-
+
buf = malloc (length);
if (buf)
{
@@ -1145,14 +1145,14 @@ script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !script)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "pointer", script))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "filename", script->filename))
@@ -1173,7 +1173,7 @@ script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "charset", script->charset))
return 0;
-
+
return 1;
}
@@ -1189,10 +1189,10 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
{
struct t_infolist *ptr_infolist;
struct t_plugin_script *ptr_script;
-
+
if (pointer && !script_valid (scripts, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -1227,7 +1227,7 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
return ptr_infolist;
}
}
-
+
return NULL;
}
@@ -1241,11 +1241,11 @@ script_end (struct t_weechat_plugin *weechat_plugin,
void (*callback_unload_all)())
{
int scripts_loaded;
-
+
scripts_loaded = (*scripts) ? 1 : 0;
-
+
(void)(callback_unload_all) ();
-
+
if (scripts_loaded)
{
weechat_printf (NULL, _("%s: scripts unloaded"),
@@ -1263,11 +1263,11 @@ script_print_log (struct t_weechat_plugin *weechat_plugin,
{
struct t_plugin_script *ptr_script;
struct t_script_callback *ptr_script_callback;
-
+
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
@@ -1292,7 +1292,7 @@ script_print_log (struct t_weechat_plugin *weechat_plugin,
script_callback_print_log (weechat_plugin, ptr_script_callback);
}
}
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
diff --git a/src/plugins/scripts/script.h b/src/plugins/scripts/script.h
index 49b4f9520..dbfa943ab 100644
--- a/src/plugins/scripts/script.h
+++ b/src/plugins/scripts/script.h
@@ -61,9 +61,9 @@ struct t_plugin_script
char *description; /* plugin description */
char *shutdown_func; /* function when script is unloaded*/
char *charset; /* script charset */
-
+
struct t_script_callback *callbacks; /* callbacks for script */
-
+
struct t_plugin_script *prev_script; /* link to previous script */
struct t_plugin_script *next_script; /* link to next script */
};
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 949f60ed9..6f963a1ff 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -207,14 +207,14 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
char *name, *author, *version, *license, *description, *shutdown_func;
char *charset;
int i;
-
+
API_FUNC(0, "register", API_RETURN_ERROR);
tcl_current_script = NULL;
tcl_registered_script = NULL;
-
+
if (objc < 8)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
author = Tcl_GetStringFromObj (objv[2], &i);
version = Tcl_GetStringFromObj (objv[3], &i);
@@ -222,7 +222,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
description = Tcl_GetStringFromObj (objv[5], &i);
shutdown_func = Tcl_GetStringFromObj (objv[6], &i);
charset = Tcl_GetStringFromObj (objv[7], &i);
-
+
if (script_search (weechat_tcl_plugin, tcl_scripts, name))
{
/* error: another script already exists with this name! */
@@ -233,7 +233,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
weechat_prefix ("error"), TCL_PLUGIN_NAME, name);
API_RETURN_ERROR;
}
-
+
/* register script */
tcl_current_script = script_add (weechat_tcl_plugin,
&tcl_scripts, &last_tcl_script,
@@ -257,7 +257,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
{
API_RETURN_ERROR;
}
-
+
API_RETURN_OK;
}
@@ -274,15 +274,15 @@ weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp,
char *plugin;
const char *result;
int i;
-
+
API_FUNC(1, "plugin_get_name", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
plugin = Tcl_GetStringFromObj (objv[1], &i);
-
+
result = weechat_plugin_get_name (script_str2ptr (plugin));
-
+
API_RETURN_STRING(result);
}
@@ -296,14 +296,14 @@ weechat_tcl_api_charset_set (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "charset_set", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_charset_set (tcl_current_script,
Tcl_GetStringFromObj (objv[1], &i)); /* charset */
-
+
API_RETURN_OK;
}
@@ -326,9 +326,9 @@ weechat_tcl_api_iconv_to_internal (ClientData clientData, Tcl_Interp *interp,
charset = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_iconv_to_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -348,12 +348,12 @@ weechat_tcl_api_iconv_from_internal (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "iconv_from_internal", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
charset = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_iconv_from_internal (charset, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -368,13 +368,13 @@ weechat_tcl_api_gettext (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "gettext", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_gettext (Tcl_GetStringFromObj (objv[1], &i)); /* string */
-
+
API_RETURN_STRING(result);
}
@@ -390,11 +390,11 @@ weechat_tcl_api_ngettext (ClientData clientData, Tcl_Interp *interp,
char *single, *plural;
const char *result;
int i, count;
-
+
API_FUNC(1, "ngettext", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
single = Tcl_GetStringFromObj (objv[1], &i);
plural = Tcl_GetStringFromObj (objv[2], &i);
@@ -402,7 +402,7 @@ weechat_tcl_api_ngettext (ClientData clientData, Tcl_Interp *interp,
API_WRONG_ARGS(API_RETURN_EMPTY);
result = weechat_ngettext (single, plural, count);
-
+
API_RETURN_STRING(result);
}
@@ -419,19 +419,19 @@ weechat_tcl_api_string_match (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *string, *mask;
int case_sensitive, result, i;
-
+
API_FUNC(1, "string_match", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = Tcl_GetStringFromObj (objv[1], &i);
mask = Tcl_GetStringFromObj (objv[2], &i);
-
+
if (Tcl_GetIntFromObj (interp, objv[3], &case_sensitive) != TCL_OK)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_string_match (string, mask, case_sensitive);
-
+
API_RETURN_INT(result);
}
@@ -451,16 +451,16 @@ weechat_tcl_api_string_has_highlight (ClientData clientData,
Tcl_Obj *objp;
char *string, *highlight_words;
int result, i;
-
+
API_FUNC(1, "string_has_highlight", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = Tcl_GetStringFromObj (objv[1], &i);
highlight_words = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_string_has_highlight (string, highlight_words);
-
+
API_RETURN_INT(result);
}
@@ -480,16 +480,16 @@ weechat_tcl_api_string_has_highlight_regex (ClientData clientData,
Tcl_Obj *objp;
char *string, *regex;
int result, i;
-
+
API_FUNC(1, "string_has_highlight_regex", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
string = Tcl_GetStringFromObj (objv[1], &i);
regex = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_string_has_highlight_regex (string, regex);
-
+
API_RETURN_INT(result);
}
@@ -508,15 +508,15 @@ weechat_tcl_api_string_mask_to_regex (ClientData clientData,
Tcl_Obj *objp;
char *result, *mask;
int i;
-
+
API_FUNC(1, "string_mask_to_regex", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
mask = Tcl_GetStringFromObj (objv[1], &i);
-
+
result = weechat_string_mask_to_regex (mask);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -531,16 +531,16 @@ weechat_tcl_api_string_remove_color (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *replacement, *string;
int i;
-
+
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
string = Tcl_GetStringFromObj (objv[1], &i);
replacement = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_string_remove_color (string, replacement);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -555,13 +555,13 @@ weechat_tcl_api_string_is_command_char (ClientData clientData, Tcl_Interp *inter
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "string_is_command_char", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_string_is_command_char (Tcl_GetStringFromObj (objv[1], &i)); /* string */
-
+
API_RETURN_INT(result);
}
@@ -578,13 +578,13 @@ weechat_tcl_api_string_input_for_buffer (ClientData clientData, Tcl_Interp *inte
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "string_input_for_buffer", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_string_input_for_buffer (Tcl_GetStringFromObj (objv[1], &i));
-
+
API_RETURN_STRING(result);
}
@@ -602,14 +602,14 @@ weechat_tcl_api_mkdir_home (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "mkdir_home", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (weechat_mkdir_home (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -623,18 +623,18 @@ weechat_tcl_api_mkdir (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i, mode;
-
+
API_FUNC(1, "mkdir", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (weechat_mkdir (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -649,18 +649,18 @@ weechat_tcl_api_mkdir_parents (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i, mode;
-
+
API_FUNC(1, "mkdir_parents", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &mode) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (weechat_mkdir_parents (Tcl_GetStringFromObj (objv[1], &i), /* directory */
mode))
API_RETURN_OK;
-
+
API_RETURN_ERROR;
}
@@ -679,11 +679,11 @@ weechat_tcl_api_list_new (ClientData clientData, Tcl_Interp *interp,
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "list_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -699,21 +699,21 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
char *result, *weelist, *data, *where, *user_data;
int i;
-
+
API_FUNC(1, "list_add", API_RETURN_EMPTY);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
where = Tcl_GetStringFromObj (objv[3], &i);
user_data = Tcl_GetStringFromObj (objv[4], &i);
-
+
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
data,
where,
script_str2ptr (user_data)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -732,13 +732,13 @@ weechat_tcl_api_list_search (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_search", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_list_search (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -757,12 +757,12 @@ weechat_tcl_api_list_search_pos (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_search_pos", API_RETURN_INT(-1));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
-
+
pos = weechat_list_search_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -781,13 +781,13 @@ weechat_tcl_api_list_casesearch (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_casesearch", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist),
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -807,12 +807,12 @@ weechat_tcl_api_list_casesearch_pos (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_casesearch_pos", API_RETURN_INT(-1));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
data = Tcl_GetStringFromObj (objv[2], &i);
-
+
pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data);
-
+
API_RETURN_INT(pos);
}
@@ -827,17 +827,17 @@ weechat_tcl_api_list_get (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i, position;
-
+
API_FUNC(1, "list_get", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &position) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_get (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* weelist */
position));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -856,12 +856,12 @@ weechat_tcl_api_list_set (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_set", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
item = Tcl_GetStringFromObj (objv[1], &i);
new_value = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_list_set (script_str2ptr (item), new_value);
-
+
API_RETURN_OK;
}
@@ -880,9 +880,9 @@ weechat_tcl_api_list_next (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_next", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -901,9 +901,9 @@ weechat_tcl_api_list_prev (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_prev", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_list_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -918,13 +918,13 @@ weechat_tcl_api_list_string (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "list_string", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_list_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */
-
+
API_RETURN_STRING(result);
}
@@ -943,9 +943,9 @@ weechat_tcl_api_list_size (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_size", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
size = weechat_list_size (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
-
+
API_RETURN_INT(size);
}
@@ -964,12 +964,12 @@ weechat_tcl_api_list_remove (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_remove", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weelist = Tcl_GetStringFromObj (objv[1], &i);
item = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item));
-
+
API_RETURN_OK;
}
@@ -989,9 +989,9 @@ weechat_tcl_api_list_remove_all (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_remove_all", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
-
+
API_RETURN_OK;
}
@@ -1009,9 +1009,9 @@ weechat_tcl_api_list_free (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "list_free", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_list_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */
-
+
API_RETURN_OK;
}
@@ -1027,7 +1027,7 @@ weechat_tcl_api_config_reload_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
@@ -1035,12 +1035,12 @@ weechat_tcl_api_config_reload_cb (void *data,
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
else
@@ -1053,7 +1053,7 @@ weechat_tcl_api_config_reload_cb (void *data,
return ret;
}
-
+
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
}
@@ -1068,22 +1068,22 @@ weechat_tcl_api_config_new (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *name, *function, *data;
int i;
-
+
API_FUNC(1, "config_new", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_config_new (weechat_tcl_plugin,
tcl_current_script,
name,
&weechat_tcl_api_config_reload_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1102,9 +1102,9 @@ weechat_tcl_api_config_section_read_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1112,12 +1112,12 @@ weechat_tcl_api_config_section_read_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1129,10 +1129,10 @@ weechat_tcl_api_config_section_read_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1149,20 +1149,20 @@ weechat_tcl_api_config_section_write_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1172,10 +1172,10 @@ weechat_tcl_api_config_section_write_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1193,20 +1193,20 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
else
@@ -1216,10 +1216,10 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_WRITE_ERROR;
}
@@ -1239,9 +1239,9 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
void *func_argv[5];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1249,12 +1249,12 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
func_argv[2] = script_ptr2str (section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
else
@@ -1266,10 +1266,10 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -1288,21 +1288,21 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (config_file);
func_argv[2] = script_ptr2str (section);
func_argv[3] = script_ptr2str (option);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
else
@@ -1316,10 +1316,10 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
}
@@ -1338,14 +1338,14 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
char *data_write_default, *function_create_option, *data_create_option;
char *function_delete_option, *data_delete_option;
int i, can_add, can_delete;
-
+
/* make C compiler happy */
(void) clientData;
API_FUNC(1, "config_new_section", API_RETURN_EMPTY);
if (objc < 15)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[3], &can_add) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[4], &can_delete) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);
@@ -1362,7 +1362,7 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
data_create_option = Tcl_GetStringFromObj (objv[12], &i);
function_delete_option = Tcl_GetStringFromObj (objv[13], &i);
data_delete_option = Tcl_GetStringFromObj (objv[14], &i);
-
+
result = script_ptr2str (script_api_config_new_section (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (cfg_file),
@@ -1384,7 +1384,7 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_config_section_delete_option_cb,
function_delete_option,
data_delete_option));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1399,17 +1399,17 @@ weechat_tcl_api_config_search_section (ClientData clientData, Tcl_Interp *interp
Tcl_Obj *objp;
char *result, *config_file, *section_name;
int i;
-
+
API_FUNC(1, "config_search_section", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = Tcl_GetStringFromObj (objv[1], &i);
section_name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file),
section_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1428,20 +1428,20 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = 0;
else
@@ -1451,10 +1451,10 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return 0;
}
@@ -1470,22 +1470,22 @@ weechat_tcl_api_config_option_change_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1503,22 +1503,22 @@ weechat_tcl_api_config_option_delete_cb (void *data,
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (option);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
-
+
if (rc)
free (rc);
}
@@ -1538,16 +1538,16 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
char *function_check_value, *data_check_value, *function_change;
char *data_change, *function_delete, *data_delete;
int i, min, max, null_value_allowed;
-
+
API_FUNC(1, "config_new_option", API_RETURN_EMPTY);
if (objc < 18)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[7], &min) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[11], &null_value_allowed) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
@@ -1562,7 +1562,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp,
data_change = Tcl_GetStringFromObj (objv[15], &i);
function_delete = Tcl_GetStringFromObj (objv[16], &i);
data_delete = Tcl_GetStringFromObj (objv[17], &i);
-
+
result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (config_file),
@@ -1601,19 +1601,19 @@ weechat_tcl_api_config_search_option (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *config_file, *section, *option_name;
int i;
-
+
API_FUNC(1, "config_search_option", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
config_file = Tcl_GetStringFromObj (objv[1], &i);
section = Tcl_GetStringFromObj (objv[2], &i);
option_name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file),
script_str2ptr (section),
option_name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -1627,13 +1627,13 @@ weechat_tcl_api_config_string_to_boolean (ClientData clientData, Tcl_Interp *int
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_string_to_boolean", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_string_to_boolean (Tcl_GetStringFromObj (objv[1], &i)); /* text */
-
+
API_RETURN_INT(result);
}
@@ -1649,19 +1649,19 @@ weechat_tcl_api_config_option_reset (ClientData clientData, Tcl_Interp *interp,
int rc;
char *option;
int i, run_callback;
-
+
API_FUNC(1, "config_option_reset", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
-
+
rc = weechat_config_option_reset (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1677,7 +1677,7 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
int rc;
char *option, *new_value;
int i, run_callback;
-
+
API_FUNC(1, "config_option_set", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
@@ -1687,11 +1687,11 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp,
option = Tcl_GetStringFromObj (objv[1], &i);
new_value = Tcl_GetStringFromObj (objv[2], &i);
-
+
rc = weechat_config_option_set (script_str2ptr (option),
new_value,
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1707,19 +1707,19 @@ weechat_tcl_api_config_option_set_null (ClientData clientData, Tcl_Interp *inter
int rc;
char *option;
int i, run_callback;
-
+
API_FUNC(1, "config_option_set_null", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
-
+
rc = weechat_config_option_set_null (script_str2ptr (option),
run_callback);
-
+
API_RETURN_INT(rc);
}
@@ -1735,15 +1735,15 @@ weechat_tcl_api_config_option_unset (ClientData clientData, Tcl_Interp *interp,
int rc;
char *option;
int i;
-
+
API_FUNC(1, "config_option_unset", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
-
+
rc = weechat_config_option_unset (script_str2ptr (option));
-
+
API_RETURN_INT(rc);
}
@@ -1758,17 +1758,17 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *option, *new_name;
int i;
-
+
API_FUNC(1, "config_option_rename", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
new_name = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_config_option_rename (script_str2ptr (option),
new_name);
-
+
API_RETURN_OK;
}
@@ -1782,13 +1782,13 @@ weechat_tcl_api_config_option_is_null (ClientData clientData, Tcl_Interp *interp
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_option_is_null", API_RETURN_INT(1));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
result = weechat_config_option_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1804,13 +1804,13 @@ weechat_tcl_api_config_option_default_is_null (ClientData clientData,
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_option_default_is_null", API_RETURN_INT(1));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(1));
-
+
result = weechat_config_option_default_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1824,13 +1824,13 @@ weechat_tcl_api_config_boolean (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_boolean", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_boolean (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1844,13 +1844,13 @@ weechat_tcl_api_config_boolean_default (ClientData clientData, Tcl_Interp *inter
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_boolean_default", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_boolean_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1864,13 +1864,13 @@ weechat_tcl_api_config_integer (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_integer", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1884,13 +1884,13 @@ weechat_tcl_api_config_integer_default (ClientData clientData, Tcl_Interp *inter
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "config_integer_default", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_integer_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_INT(result);
}
@@ -1905,13 +1905,13 @@ weechat_tcl_api_config_string (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "config_string", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1926,13 +1926,13 @@ weechat_tcl_api_config_string_default (ClientData clientData, Tcl_Interp *interp
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "config_string_default", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_config_string_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1947,13 +1947,13 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "config_color", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1968,13 +1968,13 @@ weechat_tcl_api_config_color_default (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "config_color_default", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_config_color_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_STRING(result);
}
@@ -1989,17 +1989,17 @@ weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *config_file, *option;
int i;
-
+
API_FUNC(1, "config_write_option", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = Tcl_GetStringFromObj (objv[1], &i);
option = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_config_write_option (script_str2ptr (config_file),
script_str2ptr (option));
-
+
API_RETURN_OK;
}
@@ -2014,18 +2014,18 @@ weechat_tcl_api_config_write_line (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *config_file, *option_name, *value;
int i;
-
+
API_FUNC(1, "config_write_line", API_RETURN_ERROR);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
config_file = Tcl_GetStringFromObj (objv[1], &i);
option_name = Tcl_GetStringFromObj (objv[2], &i);
value = Tcl_GetStringFromObj (objv[3], &i);
-
+
weechat_config_write_line (script_str2ptr (config_file), option_name,
"%s", value);
-
+
API_RETURN_OK;
}
@@ -2040,13 +2040,13 @@ weechat_tcl_api_config_write (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int rc;
int i;
-
+
API_FUNC(1, "config_write", API_RETURN_INT(-1));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_write (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -2061,13 +2061,13 @@ weechat_tcl_api_config_read (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int rc;
int i;
-
+
API_FUNC(1, "config_read", API_RETURN_INT(-1));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_read (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -2082,13 +2082,13 @@ weechat_tcl_api_config_reload (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
int rc;
int i;
-
+
API_FUNC(1, "config_reload", API_RETURN_INT(-1));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
rc = weechat_config_reload (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
-
+
API_RETURN_INT(rc);
}
@@ -2102,15 +2102,15 @@ weechat_tcl_api_config_option_free (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "config_option_free", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_option_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
-
+
API_RETURN_OK;
}
@@ -2125,15 +2125,15 @@ weechat_tcl_api_config_section_free_options (ClientData clientData, Tcl_Interp *
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "config_section_free_options", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free_options (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
-
+
API_RETURN_OK;
}
@@ -2147,15 +2147,15 @@ weechat_tcl_api_config_section_free (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "config_section_free", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_section_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
-
+
API_RETURN_OK;
}
@@ -2169,15 +2169,15 @@ weechat_tcl_api_config_free (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "config_free", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_config_free (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
-
+
API_RETURN_OK;
}
@@ -2192,13 +2192,13 @@ weechat_tcl_api_config_get (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "config_get", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_config_get (Tcl_GetStringFromObj (objv[1], &i)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2213,15 +2213,15 @@ weechat_tcl_api_config_get_plugin (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "config_get_plugin", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_api_config_get_plugin (weechat_tcl_plugin,
tcl_current_script,
Tcl_GetStringFromObj (objv[1], &i));
-
+
API_RETURN_STRING(result);
}
@@ -2236,17 +2236,17 @@ weechat_tcl_api_config_is_set_plugin (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *option;
int i, rc;
-
+
API_FUNC(1, "config_is_set_plugin", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
-
+
rc = script_api_config_is_set_plugin (weechat_tcl_plugin,
tcl_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2261,19 +2261,19 @@ weechat_tcl_api_config_set_plugin (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *option, *value;
int i, rc;
-
+
API_FUNC(1, "config_set_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
value = Tcl_GetStringFromObj (objv[2], &i);
-
+
rc = script_api_config_set_plugin (weechat_tcl_plugin,
tcl_current_script,
option,
value);
-
+
API_RETURN_INT(rc);
}
@@ -2288,19 +2288,19 @@ weechat_tcl_api_config_set_desc_plugin (ClientData clientData, Tcl_Interp *inter
Tcl_Obj *objp;
char *option, *description;
int i;
-
+
API_FUNC(1, "config_set_desc_plugin", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
-
+
script_api_config_set_desc_plugin (weechat_tcl_plugin,
tcl_current_script,
option,
description);
-
+
API_RETURN_OK;
}
@@ -2315,17 +2315,17 @@ weechat_tcl_api_config_unset_plugin (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *option;
int i, rc;
-
+
API_FUNC(1, "config_unset_plugin", API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
-
+
rc = script_api_config_unset_plugin (weechat_tcl_plugin,
tcl_current_script,
option);
-
+
API_RETURN_INT(rc);
}
@@ -2341,20 +2341,20 @@ weechat_tcl_api_key_bind (ClientData clientData, Tcl_Interp *interp,
char *context;
struct t_hashtable *hashtable;
int i, num_keys;
-
+
API_FUNC(1, "key_bind", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = Tcl_GetStringFromObj (objv[1], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
num_keys = weechat_key_bind (context, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_INT(num_keys);
}
@@ -2369,16 +2369,16 @@ weechat_tcl_api_key_unbind (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *context, *key;
int i, num_keys;
-
+
API_FUNC(1, "key_unbind", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
context = Tcl_GetStringFromObj (objv[1], &i);
key = Tcl_GetStringFromObj (objv[2], &i);
-
+
num_keys = weechat_key_unbind (context, key);
-
+
API_RETURN_INT(num_keys);
}
@@ -2393,13 +2393,13 @@ weechat_tcl_api_prefix (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(0, "prefix", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_prefix (Tcl_GetStringFromObj (objv[1], &i)); /* prefix */
-
+
API_RETURN_STRING(result);
}
@@ -2414,13 +2414,13 @@ weechat_tcl_api_color (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(0, "color", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_color (Tcl_GetStringFromObj (objv[1], &i)); /* color */
-
+
API_RETURN_STRING(result);
}
@@ -2435,19 +2435,19 @@ weechat_tcl_api_print (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *message;
int i;
-
+
API_FUNC(0, "print", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
message = Tcl_GetStringFromObj (objv[2], &i);
-
+
script_api_printf (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (buffer),
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2463,7 +2463,7 @@ weechat_tcl_api_print_date_tags (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *tags, *message;
int i, tdate;
-
+
API_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_ERROR);
@@ -2474,14 +2474,14 @@ weechat_tcl_api_print_date_tags (ClientData clientData, Tcl_Interp *interp,
buffer = Tcl_GetStringFromObj (objv[1], &i);
tags = Tcl_GetStringFromObj (objv[3], &i);
message = Tcl_GetStringFromObj (objv[4], &i);
-
+
script_api_printf_date_tags (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (buffer),
tdate,
tags,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2496,23 +2496,23 @@ weechat_tcl_api_print_y (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *message;
int i, y;
-
+
API_FUNC(1, "print_y", API_RETURN_ERROR);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetStringFromObj (objv[1], &i);
message = Tcl_GetStringFromObj (objv[3], &i);
-
+
script_api_printf_y (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (buffer),
y,
"%s", message);
-
+
API_RETURN_OK;
}
@@ -2526,7 +2526,7 @@ weechat_tcl_api_log_print (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
/* make C compiler happy */
(void) clientData;
@@ -2534,11 +2534,11 @@ weechat_tcl_api_log_print (ClientData clientData, Tcl_Interp *interp,
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_log_printf (weechat_tcl_plugin,
tcl_current_script,
"%s", Tcl_GetStringFromObj (objv[1], &i)); /* message */
-
+
API_RETURN_OK;
}
@@ -2554,10 +2554,10 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
/* make C compiler happy */
(void) argv;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2565,12 +2565,12 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2580,10 +2580,10 @@ weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2599,7 +2599,7 @@ weechat_tcl_api_hook_command (ClientData clientData, Tcl_Interp *interp,
char *result, *command, *description, *args, *args_description;
char *completion, *function, *data;
int i;
-
+
API_FUNC(1, "hook_command", API_RETURN_EMPTY);
if (objc < 8)
API_WRONG_ARGS(API_RETURN_EMPTY);
@@ -2611,7 +2611,7 @@ weechat_tcl_api_hook_command (ClientData clientData, Tcl_Interp *interp,
completion = Tcl_GetStringFromObj (objv[5], &i);
function = Tcl_GetStringFromObj (objv[6], &i);
data = Tcl_GetStringFromObj (objv[7], &i);
-
+
result = script_ptr2str (script_api_hook_command (weechat_tcl_plugin,
tcl_current_script,
command,
@@ -2622,7 +2622,7 @@ weechat_tcl_api_hook_command (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_command_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2638,7 +2638,7 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -2646,12 +2646,12 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2661,10 +2661,10 @@ weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2679,22 +2679,22 @@ weechat_tcl_api_hook_command_run (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *command, *function, *data;
int i;
-
+
API_FUNC(1, "hook_command_run", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_command_run (weechat_tcl_plugin,
tcl_current_script,
command,
&weechat_tcl_api_hook_command_run_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2709,22 +2709,22 @@ weechat_tcl_api_hook_timer_cb (void *data, int remaining_calls)
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_remaining_calls;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2732,10 +2732,10 @@ weechat_tcl_api_hook_timer_cb (void *data, int remaining_calls)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2750,17 +2750,17 @@ weechat_tcl_api_hook_timer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i, interval, align_second, max_calls;
-
+
API_FUNC(1, "hook_timer", API_RETURN_EMPTY);
if (objc < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[1], &interval) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[2], &align_second) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[3], &max_calls) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (script_api_hook_timer (weechat_tcl_plugin,
tcl_current_script,
interval, /* interval */
@@ -2769,7 +2769,7 @@ weechat_tcl_api_hook_timer (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_timer_cb,
Tcl_GetStringFromObj (objv[4], &i), /* tcl function */
Tcl_GetStringFromObj (objv[5], &i))); /* data */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2784,21 +2784,21 @@ weechat_tcl_api_hook_fd_cb (void *data, int fd)
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_fd;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2806,10 +2806,10 @@ weechat_tcl_api_hook_fd_cb (void *data, int fd)
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2824,11 +2824,11 @@ weechat_tcl_api_hook_fd (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i, fd, read, write, exception;
-
+
API_FUNC(1, "hook_fd", API_RETURN_EMPTY);
if (objc < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[1], &fd) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[2], &read) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[3], &write) != TCL_OK)
@@ -2844,7 +2844,7 @@ weechat_tcl_api_hook_fd (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_fd_cb,
Tcl_GetStringFromObj (objv[5], &i), /* tcl function */
Tcl_GetStringFromObj (objv[6], &i))); /* data */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2861,24 +2861,24 @@ weechat_tcl_api_hook_process_cb (void *data,
void *func_argv[5];
char str_rc[32], empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_rc, sizeof (str_rc), "%d", return_code);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = str_rc;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2886,10 +2886,10 @@ weechat_tcl_api_hook_process_cb (void *data,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2904,18 +2904,18 @@ weechat_tcl_api_hook_process (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *command, *function, *data, *result;
int i, timeout;
-
+
API_FUNC(1, "hook_process", API_RETURN_EMPTY);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[2], &timeout) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
command = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
-
+
result = script_ptr2str (script_api_hook_process (weechat_tcl_plugin,
tcl_current_script,
command,
@@ -2923,7 +2923,7 @@ weechat_tcl_api_hook_process (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_process_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -2940,25 +2940,25 @@ weechat_tcl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
char str_status[32], str_gnutls_rc[32];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[4] = (error) ? (char *)error : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -2966,10 +2966,10 @@ weechat_tcl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -2984,22 +2984,22 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *proxy, *address, *local_hostname, *function, *data, *result;
int i, port, sock, ipv6;
-
+
API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
if (objc < 9)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if ((Tcl_GetIntFromObj (interp, objv[3], &port) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[4], &sock) != TCL_OK)
|| (Tcl_GetIntFromObj (interp, objv[5], &ipv6) != TCL_OK))
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
proxy = Tcl_GetStringFromObj (objv[1], &i);
address = Tcl_GetStringFromObj (objv[2], &i);
local_hostname = Tcl_GetStringFromObj (objv[6], &i);
function = Tcl_GetStringFromObj (objv[7], &i);
data = Tcl_GetStringFromObj (objv[8], &i);
-
+
result = script_ptr2str (script_api_hook_connect (weechat_tcl_plugin,
tcl_current_script,
proxy,
@@ -3015,7 +3015,7 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_connect_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3035,16 +3035,16 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
char empty_arg[1] = { '\0' };
static char timebuffer[64];
int *rc, ret;
-
+
/* make C compiler happy */
(void) tags_count;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", (long int)date);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = timebuffer;
@@ -3055,12 +3055,12 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[5] = (highlight) ? strdup ("1") : strdup ("0");
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssssssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3076,10 +3076,10 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
free (func_argv[4]);
if (func_argv[5])
free (func_argv[5]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3094,20 +3094,20 @@ weechat_tcl_api_hook_print (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *buffer, *tags, *message, *function, *data;
int i, strip_colors;
-
+
API_FUNC(1, "hook_print", API_RETURN_EMPTY);
if (objc < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[4], &strip_colors) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
tags = Tcl_GetStringFromObj (objv[2], &i);
message = Tcl_GetStringFromObj (objv[3], &i);
function = Tcl_GetStringFromObj (objv[5], &i);
data = Tcl_GetStringFromObj (objv[6], &i);
-
+
result = script_ptr2str (script_api_hook_print (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (buffer),
@@ -3117,7 +3117,7 @@ weechat_tcl_api_hook_print (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_print_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3134,7 +3134,7 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
char empty_arg[1] = { '\0' };
static char value_str[64];
int *rc, ret, free_needed;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3159,12 +3159,12 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
}
else
func_argv[2] = empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3174,10 +3174,10 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
}
if (free_needed && func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3192,22 +3192,22 @@ weechat_tcl_api_hook_signal (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *signal, *function, *data;
int i;
-
+
API_FUNC(1, "hook_signal", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_signal (weechat_tcl_plugin,
tcl_current_script,
signal,
&weechat_tcl_api_hook_signal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3223,11 +3223,11 @@ weechat_tcl_api_hook_signal_send (ClientData clientData, Tcl_Interp *interp,
char *signal, *type_data;
int number;
int i;
-
+
API_FUNC(1, "hook_signal_send", API_RETURN_ERROR);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = Tcl_GetStringFromObj (objv[1], &i);
type_data = Tcl_GetStringFromObj (objv[2], &i);
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -3255,7 +3255,7 @@ weechat_tcl_api_hook_signal_send (ClientData clientData, Tcl_Interp *interp,
Tcl_GetStringFromObj (objv[3], &i)); /* signal_data */
API_RETURN_OK;
}
-
+
API_RETURN_ERROR;
}
@@ -3271,20 +3271,20 @@ weechat_tcl_api_hook_hsignal_cb (void *data, const char *signal,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssh", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3292,10 +3292,10 @@ weechat_tcl_api_hook_hsignal_cb (void *data, const char *signal,
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3310,22 +3310,22 @@ weechat_tcl_api_hook_hsignal (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *signal, *function, *data;
int i;
-
+
API_FUNC(1, "hook_hsignal", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
signal = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_hsignal (weechat_tcl_plugin,
tcl_current_script,
signal,
&weechat_tcl_api_hook_hsignal_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3341,20 +3341,20 @@ weechat_tcl_api_hook_hsignal_send (ClientData clientData, Tcl_Interp *interp,
char *signal;
struct t_hashtable *hashtable;
int i;
-
+
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
signal = Tcl_GetStringFromObj (objv[1], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
weechat_hook_hsignal_send (signal, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
API_RETURN_OK;
}
@@ -3369,7 +3369,7 @@ weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *valu
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3377,12 +3377,12 @@ weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *valu
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"sss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3390,10 +3390,10 @@ weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *valu
ret = *rc;
free (rc);
}
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3408,22 +3408,22 @@ weechat_tcl_api_hook_config (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *option, *function, *data;
int i;
-
+
API_FUNC(1, "hook_config", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
option = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_config (weechat_tcl_plugin,
tcl_current_script,
option,
&weechat_tcl_api_hook_config_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3440,7 +3440,7 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
void *func_argv[4];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3449,12 +3449,12 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = script_ptr2str (buffer);
func_argv[3] = script_ptr2str (completion);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -3466,10 +3466,10 @@ weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3484,16 +3484,16 @@ weechat_tcl_api_hook_completion (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *completion, *description, *function, *data;
int i;
-
+
API_FUNC(1, "hook_completion", API_RETURN_EMPTY);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
completion = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
-
+
result = script_ptr2str (script_api_hook_completion (weechat_tcl_plugin,
tcl_current_script,
completion,
@@ -3501,7 +3501,7 @@ weechat_tcl_api_hook_completion (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_completion_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3516,23 +3516,23 @@ weechat_tcl_api_hook_completion_list_add (ClientData clientData, Tcl_Interp *int
Tcl_Obj *objp;
char *completion, *word, *where;
int i, nick_completion;
-
+
API_FUNC(1, "hook_completion_list_add", API_RETURN_ERROR);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[3], &nick_completion) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR);
completion = Tcl_GetStringFromObj (objv[1], &i);
word = Tcl_GetStringFromObj (objv[2], &i);
where = Tcl_GetStringFromObj (objv[4], &i);
-
+
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
nick_completion, /* nick_completion */
where);
-
+
API_RETURN_OK;
}
@@ -3547,7 +3547,7 @@ weechat_tcl_api_hook_modifier_cb (void *data, const char *modifier,
struct t_script_callback *script_callback;
void *func_argv[4];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3556,16 +3556,16 @@ weechat_tcl_api_hook_modifier_cb (void *data, const char *modifier,
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
-
+
return (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
}
-
+
return NULL;
}
-
+
/*
* weechat_tcl_api_hook_modifier: hook a modifier
*/
@@ -3577,22 +3577,22 @@ weechat_tcl_api_hook_modifier (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *modifier, *function, *data;
int i;
-
+
API_FUNC(1, "hook_modifier", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
modifier = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_modifier (weechat_tcl_plugin,
tcl_current_script,
modifier,
&weechat_tcl_api_hook_modifier_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3607,17 +3607,17 @@ weechat_tcl_api_hook_modifier_exec (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *modifier, *modifier_data, *string;
int i;
-
+
API_FUNC(1, "hook_modifier_exec", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
modifier = Tcl_GetStringFromObj (objv[1], &i);
modifier_data = Tcl_GetStringFromObj (objv[2], &i);
string = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_hook_modifier_exec (modifier, modifier_data, string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3632,7 +3632,7 @@ weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3640,13 +3640,13 @@ weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
-
+
return (const char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
}
-
+
return NULL;
}
@@ -3661,17 +3661,17 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *info_name, *description, *args_description, *function, *data;
int i;
-
+
API_FUNC(1, "hook_info", API_RETURN_EMPTY);
if (objc < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
args_description = Tcl_GetStringFromObj (objv[3], &i);
function = Tcl_GetStringFromObj (objv[4], &i);
data = Tcl_GetStringFromObj (objv[5], &i);
-
+
result = script_ptr2str (script_api_hook_info (weechat_tcl_plugin,
tcl_current_script,
info_name,
@@ -3680,7 +3680,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_info_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3695,21 +3695,21 @@ weechat_tcl_api_hook_info_hashtable_cb (void *data, const char *info_name,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
-
+
return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"ssh", func_argv);
}
-
+
return NULL;
}
@@ -3725,18 +3725,18 @@ weechat_tcl_api_hook_info_hashtable (ClientData clientData, Tcl_Interp *interp,
char *result, *info_name, *description, *args_description;
char *output_description, *function, *data;
int i;
-
+
API_FUNC(1, "hook_info_hashtable", API_RETURN_EMPTY);
if (objc < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
args_description = Tcl_GetStringFromObj (objv[3], &i);
output_description = Tcl_GetStringFromObj (objv[4], &i);
function = Tcl_GetStringFromObj (objv[5], &i);
data = Tcl_GetStringFromObj (objv[6], &i);
-
+
result = script_ptr2str (script_api_hook_info_hashtable (weechat_tcl_plugin,
tcl_current_script,
info_name,
@@ -3746,7 +3746,7 @@ weechat_tcl_api_hook_info_hashtable (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_info_hashtable_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3762,27 +3762,27 @@ weechat_tcl_api_hook_infolist_cb (void *data, const char *infolist_name,
void *func_argv[4];
char empty_arg[1] = { '\0' };
struct t_infolist *result;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
func_argv[2] = script_ptr2str (pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
-
+
result = (struct t_infolist *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"ssss", func_argv);
-
+
if (func_argv[2])
free (func_argv[2]);
-
+
return result;
}
-
+
return NULL;
}
@@ -3798,18 +3798,18 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
int i;
-
+
API_FUNC(1, "hook_infolist", API_RETURN_EMPTY);
if (objc < 7)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
pointer_description = Tcl_GetStringFromObj (objv[3], &i);
args_description = Tcl_GetStringFromObj (objv[4], &i);
function = Tcl_GetStringFromObj (objv[5], &i);
data = Tcl_GetStringFromObj (objv[6], &i);
-
+
result = script_ptr2str (script_api_hook_infolist (weechat_tcl_plugin,
tcl_current_script,
infolist_name,
@@ -3819,7 +3819,7 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_hook_infolist_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3834,23 +3834,23 @@ weechat_tcl_api_hook_focus_cb (void *data,
struct t_script_callback *script_callback;
void *func_argv[2];
char empty_arg[1] = { '\0' };
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = info;
-
+
return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
script_callback->function,
"sh", func_argv);
}
-
+
return NULL;
}
-
+
/*
* weechat_tcl_api_hook_focus: hook a focus
*/
@@ -3862,22 +3862,22 @@ weechat_tcl_api_hook_focus (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *area, *function, *data;
int i;
-
+
API_FUNC(1, "hook_focus", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
area = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_hook_focus (weechat_tcl_plugin,
tcl_current_script,
area,
&weechat_tcl_api_hook_focus_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -3891,15 +3891,15 @@ weechat_tcl_api_unhook (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "unhook", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_unhook (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* hook */
-
+
API_RETURN_OK;
}
@@ -3912,16 +3912,16 @@ weechat_tcl_api_unhook_all (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
-
+
/* make C compiler happy */
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "unhook_all", API_RETURN_ERROR);
-
+
script_api_unhook_all (tcl_current_script);
-
+
API_RETURN_OK;
}
@@ -3937,7 +3937,7 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
void *func_argv[3];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -3945,7 +3945,7 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3959,10 +3959,10 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3977,14 +3977,14 @@ weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void *func_argv[2];
char empty_arg[1] = { '\0' };
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (buffer);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
@@ -3998,10 +3998,10 @@ weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
if (func_argv[1])
free (func_argv[1]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -4017,17 +4017,17 @@ weechat_tcl_api_buffer_new (ClientData clientData, Tcl_Interp *interp,
char *result, *name, *function_input, *data_input, *function_close;
char *data_close;
int i;
-
+
API_FUNC(1, "buffer_new", API_RETURN_EMPTY);
if (objc < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
function_input = Tcl_GetStringFromObj (objv[2], &i);
data_input = Tcl_GetStringFromObj (objv[3], &i);
function_close = Tcl_GetStringFromObj (objv[4], &i);
data_close = Tcl_GetStringFromObj (objv[5], &i);
-
+
result = script_ptr2str (script_api_buffer_new (weechat_tcl_plugin,
tcl_current_script,
name,
@@ -4037,7 +4037,7 @@ weechat_tcl_api_buffer_new (ClientData clientData, Tcl_Interp *interp,
&weechat_tcl_api_buffer_close_cb,
function_close,
data_close));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4052,16 +4052,16 @@ weechat_tcl_api_buffer_search (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *plugin, *name;
int i;
-
+
API_FUNC(1, "buffer_search", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
plugin = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_buffer_search (plugin, name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4075,16 +4075,16 @@ weechat_tcl_api_buffer_search_main (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
char *result;
-
+
/* make C compiler happy */
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "buffer_search_main", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_buffer_search_main ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4098,16 +4098,16 @@ weechat_tcl_api_current_buffer (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
char *result;
-
+
/* make C compiler happy */
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "current_buffer", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_buffer ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4121,13 +4121,13 @@ weechat_tcl_api_buffer_clear (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "buffer_clear", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_clear (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -4141,15 +4141,15 @@ weechat_tcl_api_buffer_close (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "buffer_close", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_buffer_close (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -4163,14 +4163,14 @@ weechat_tcl_api_buffer_merge (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "buffer_merge", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_merge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* buffer */
script_str2ptr (Tcl_GetStringFromObj (objv[2], &i))); /* target_buffer */
-
+
API_RETURN_OK;
}
@@ -4185,17 +4185,17 @@ weechat_tcl_api_buffer_unmerge (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i, number;
-
+
API_FUNC(1, "buffer_unmerge", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &number) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_buffer_unmerge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)),
number);
-
+
API_RETURN_OK;
}
@@ -4211,16 +4211,16 @@ weechat_tcl_api_buffer_get_integer (ClientData clientData, Tcl_Interp *interp,
char *buffer, *property;
int result;
int i;
-
+
API_FUNC(1, "buffer_get_integer", API_RETURN_INT(-1));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_buffer_get_integer (script_str2ptr (buffer), property);
-
+
API_RETURN_INT(result);
}
@@ -4236,16 +4236,16 @@ weechat_tcl_api_buffer_get_string (ClientData clientData, Tcl_Interp *interp,
char *buffer, *property;
const char *result;
int i;
-
+
API_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_buffer_get_string (script_str2ptr (buffer), property);
-
+
API_RETURN_STRING(result);
}
@@ -4260,17 +4260,17 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *property, *result;
int i;
-
+
API_FUNC(1, "buffer_get_pointer", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4285,17 +4285,17 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *property, *value;
int i;
-
+
API_FUNC(1, "buffer_set", API_RETURN_ERROR);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
value = Tcl_GetStringFromObj (objv[3], &i);
-
+
weechat_buffer_set (script_str2ptr (buffer), property, value);
-
+
API_RETURN_OK;
}
@@ -4311,16 +4311,16 @@ weechat_tcl_api_buffer_string_replace_local_var (ClientData clientData, Tcl_Inte
Tcl_Obj *objp;
char *buffer, *string, *result;
int i;
-
+
API_FUNC(1, "buffer_string_replace_local_var", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4336,16 +4336,16 @@ weechat_tcl_api_buffer_match_list (ClientData clientData, Tcl_Interp *interp,
char *buffer, *string;
int result;
int i;
-
+
API_FUNC(1, "buffer_match_list", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
string = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_buffer_match_list (script_str2ptr (buffer), string);
-
+
API_RETURN_INT(result);
}
@@ -4359,16 +4359,16 @@ weechat_tcl_api_current_window (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
char *result;
-
+
/* make C compiler happy */
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "current_window", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_current_window ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4384,15 +4384,15 @@ weechat_tcl_api_window_search_with_buffer (ClientData clientData, Tcl_Interp *in
Tcl_Obj *objp;
char *buffer, *result;
int i;
-
+
API_FUNC(1, "window_search_with_buffer", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
-
+
result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer)));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4408,16 +4408,16 @@ weechat_tcl_api_window_get_integer (ClientData clientData, Tcl_Interp *interp,
char *window, *property;
int result;
int i;
-
+
API_FUNC(1, "window_get_integer", API_RETURN_INT(-1));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_window_get_integer (script_str2ptr (window), property);
-
+
API_RETURN_INT(result);
}
@@ -4433,16 +4433,16 @@ weechat_tcl_api_window_get_string (ClientData clientData, Tcl_Interp *interp,
char *window, *property;
const char *result;
int i;
-
+
API_FUNC(1, "window_get_string", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_window_get_string (script_str2ptr (window), property);
-
+
API_RETURN_STRING(result);
}
@@ -4457,17 +4457,17 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *window, *property, *result;
int i;
-
+
API_FUNC(1, "window_get_pointer", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
window = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4482,15 +4482,15 @@ weechat_tcl_api_window_set_title (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *title;
int i;
-
+
API_FUNC(1, "window_set_title", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
title = Tcl_GetStringFromObj (objv[1], &i);
-
+
weechat_window_set_title (title);
-
+
API_RETURN_OK;
}
@@ -4505,25 +4505,25 @@ weechat_tcl_api_nicklist_add_group (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *buffer, *parent_group, *name, *color;
int i, visible;
-
+
API_FUNC(1, "nicklist_add_group", API_RETURN_EMPTY);
if (objc < 6)
API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetIntFromObj (interp, objv[5], &visible) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
parent_group = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
color = Tcl_GetStringFromObj (objv[4], &i);
-
+
result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer),
script_str2ptr (parent_group),
name,
color,
visible)); /* visible */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4538,7 +4538,7 @@ weechat_tcl_api_nicklist_search_group (ClientData clientData, Tcl_Interp *interp
Tcl_Obj *objp;
char *result, *buffer, *from_group, *name;
int i;
-
+
API_FUNC(1, "nicklist_search_group", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
@@ -4546,11 +4546,11 @@ weechat_tcl_api_nicklist_search_group (ClientData clientData, Tcl_Interp *interp
buffer = Tcl_GetStringFromObj (objv[1], &i);
from_group = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4565,21 +4565,21 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *buffer, *group, *name, *color, *prefix, *prefix_color;
int i, visible;
-
+
API_FUNC(1, "nicklist_add_nick", API_RETURN_EMPTY);
if (objc < 8)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (Tcl_GetIntFromObj (interp, objv[7], &visible) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
color = Tcl_GetStringFromObj (objv[4], &i);
prefix = Tcl_GetStringFromObj (objv[5], &i);
prefix_color = Tcl_GetStringFromObj (objv[6], &i);
-
+
result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer),
script_str2ptr (group),
name,
@@ -4587,7 +4587,7 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp,
prefix,
prefix_color,
visible)); /* visible */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4602,19 +4602,19 @@ weechat_tcl_api_nicklist_search_nick (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *buffer, *from_group, *name;
int i;
-
+
API_FUNC(1, "nicklist_search_nick", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
from_group = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer),
script_str2ptr (from_group),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4629,17 +4629,17 @@ weechat_tcl_api_nicklist_remove_group (ClientData clientData, Tcl_Interp *interp
Tcl_Obj *objp;
char *buffer, *group;
int i;
-
+
API_FUNC(1, "nicklist_remove_group", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_nicklist_remove_group (script_str2ptr (buffer),
script_str2ptr (group));
-
+
API_RETURN_OK;
}
@@ -4654,17 +4654,17 @@ weechat_tcl_api_nicklist_remove_nick (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *nick;
int i;
-
+
API_FUNC(1, "nicklist_remove_nick", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
-
+
weechat_nicklist_remove_nick (script_str2ptr (buffer),
script_str2ptr (nick));
-
+
API_RETURN_OK;
}
@@ -4678,13 +4678,13 @@ weechat_tcl_api_nicklist_remove_all (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "nicklist_remove_all", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_nicklist_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
-
+
API_RETURN_OK;
}
@@ -4701,19 +4701,19 @@ weechat_tcl_api_nicklist_group_get_integer (ClientData clientData,
char *buffer, *group, *property;
int result;
int i;
-
+
API_FUNC(1, "nicklist_group_get_integer", API_RETURN_INT(-1));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_nicklist_group_get_integer (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_INT(result);
}
@@ -4730,19 +4730,19 @@ weechat_tcl_api_nicklist_group_get_string (ClientData clientData,
char *buffer, *group, *property;
const char *result;
int i;
-
+
API_FUNC(1, "nicklist_group_get_string", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_nicklist_group_get_string (script_str2ptr (buffer),
script_str2ptr (group),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4758,19 +4758,19 @@ weechat_tcl_api_nicklist_group_get_pointer (ClientData clientData,
Tcl_Obj *objp;
char *buffer, *group, *property, *result;
int i;
-
+
API_FUNC(1, "nicklist_group_get_pointer", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer),
script_str2ptr (group),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4785,21 +4785,21 @@ weechat_tcl_api_nicklist_group_set (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *group, *property, *value;
int i;
-
+
API_FUNC(1, "nicklist_group_set", API_RETURN_ERROR);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
group = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
value = Tcl_GetStringFromObj (objv[4], &i);
-
+
weechat_nicklist_group_set (script_str2ptr (buffer),
script_str2ptr (group),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4816,19 +4816,19 @@ weechat_tcl_api_nicklist_nick_get_integer (ClientData clientData,
char *buffer, *nick, *property;
int result;
int i;
-
+
API_FUNC(1, "nicklist_nick_get_integer", API_RETURN_INT(-1));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(-1));
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_nicklist_nick_get_integer (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_INT(result);
}
@@ -4845,19 +4845,19 @@ weechat_tcl_api_nicklist_nick_get_string (ClientData clientData,
char *buffer, *nick, *property;
const char *result;
int i;
-
+
API_FUNC(1, "nicklist_nick_get_string", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_nicklist_nick_get_string (script_str2ptr (buffer),
script_str2ptr (nick),
property);
-
+
API_RETURN_STRING(result);
}
@@ -4873,19 +4873,19 @@ weechat_tcl_api_nicklist_nick_get_pointer (ClientData clientData,
Tcl_Obj *objp;
char *buffer, *nick, *property, *result;
int i;
-
+
API_FUNC(1, "nicklist_nick_get_pointer", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer),
script_str2ptr (nick),
property));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4900,21 +4900,21 @@ weechat_tcl_api_nicklist_nick_set (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *nick, *property, *value;
int i;
-
+
API_FUNC(1, "nicklist_nick_set", API_RETURN_ERROR);
if (objc < 5)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
nick = Tcl_GetStringFromObj (objv[2], &i);
property = Tcl_GetStringFromObj (objv[3], &i);
value = Tcl_GetStringFromObj (objv[4], &i);
-
+
weechat_nicklist_nick_set (script_str2ptr (buffer),
script_str2ptr (nick),
property,
value);
-
+
API_RETURN_OK;
}
@@ -4929,13 +4929,13 @@ weechat_tcl_api_bar_item_search (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "bar_item_search", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_item_search (Tcl_GetStringFromObj (objv[1], &i))); /* name */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -4950,7 +4950,7 @@ weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_script_callback *script_callback;
void *func_argv[3];
char empty_arg[1] = { '\0' }, *ret;
-
+
script_callback = (struct t_script_callback *)data;
if (script_callback && script_callback->function && script_callback->function[0])
@@ -4958,20 +4958,20 @@ weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (item);
func_argv[2] = script_ptr2str (window);
-
+
ret = (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
-
+
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
-
+
return ret;
}
-
+
return NULL;
}
@@ -4986,22 +4986,22 @@ weechat_tcl_api_bar_item_new (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *name, *function, *data;
int i;
-
+
API_FUNC(1, "bar_item_new", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (script_api_bar_item_new (weechat_tcl_plugin,
tcl_current_script,
name,
&weechat_tcl_api_bar_item_build_cb,
function,
data));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5015,13 +5015,13 @@ weechat_tcl_api_bar_item_update (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "bar_item_update", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_item_update (Tcl_GetStringFromObj (objv[1], &i)); /* name */
-
+
API_RETURN_OK;
}
@@ -5035,15 +5035,15 @@ weechat_tcl_api_bar_item_remove (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "bar_item_remove", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
script_api_bar_item_remove (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */
-
+
API_RETURN_OK;
}
@@ -5058,13 +5058,13 @@ weechat_tcl_api_bar_search (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "bar_search", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_bar_search (Tcl_GetStringFromObj (objv[1], &i))); /* name */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5081,11 +5081,11 @@ weechat_tcl_api_bar_new (ClientData clientData, Tcl_Interp *interp,
char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg;
char *color_delim, *color_bg, *separator, *bar_items;
int i;
-
+
API_FUNC(1, "bar_new", API_RETURN_EMPTY);
if (objc < 16)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
hidden = Tcl_GetStringFromObj (objv[2], &i);
priority = Tcl_GetStringFromObj (objv[3], &i);
@@ -5101,7 +5101,7 @@ weechat_tcl_api_bar_new (ClientData clientData, Tcl_Interp *interp,
color_bg = Tcl_GetStringFromObj (objv[13], &i);
separator = Tcl_GetStringFromObj (objv[14], &i);
bar_items = Tcl_GetStringFromObj (objv[15], &i);
-
+
result = script_ptr2str (weechat_bar_new (name,
hidden,
priority,
@@ -5117,7 +5117,7 @@ weechat_tcl_api_bar_new (ClientData clientData, Tcl_Interp *interp,
color_bg,
separator,
bar_items));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5132,17 +5132,17 @@ weechat_tcl_api_bar_set (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *bar, *property, *value;
int i;
-
+
API_FUNC(1, "bar_set", API_RETURN_ERROR);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
bar = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
value = Tcl_GetStringFromObj (objv[3], &i);
-
+
weechat_bar_set (script_str2ptr (bar), property, value);
-
+
API_RETURN_OK;
}
@@ -5156,13 +5156,13 @@ weechat_tcl_api_bar_update (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "bar_update", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_update (Tcl_GetStringFromObj (objv[1], &i)); /* name */
-
+
API_RETURN_OK;
}
@@ -5176,13 +5176,13 @@ weechat_tcl_api_bar_remove (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "bar_remove", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_bar_remove (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* bar */
-
+
API_RETURN_OK;
}
@@ -5197,19 +5197,19 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *buffer, *command;
int i;
-
+
API_FUNC(1, "command", API_RETURN_ERROR);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
buffer = Tcl_GetStringFromObj (objv[1], &i);
command = Tcl_GetStringFromObj (objv[2], &i);
-
+
script_api_command (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (buffer),
command);
-
+
API_RETURN_OK;
}
@@ -5224,14 +5224,14 @@ weechat_tcl_api_info_get (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "info_get", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_info_get (Tcl_GetStringFromObj (objv[1], &i),
Tcl_GetStringFromObj (objv[2], &i));
-
+
API_RETURN_STRING(result);
}
@@ -5246,23 +5246,23 @@ weechat_tcl_api_info_get_hashtable (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp, *result_dict;
struct t_hashtable *hashtable, *result_hashtable;
int i;
-
+
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
-
+
result_hashtable = weechat_info_get_hashtable (Tcl_GetStringFromObj (objv[1], &i),
hashtable);
result_dict = weechat_tcl_hashtable_to_dict (interp, result_hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
if (result_hashtable)
weechat_hashtable_free (result_hashtable);
-
+
API_RETURN_OBJ(result_dict);
}
@@ -5276,16 +5276,16 @@ weechat_tcl_api_infolist_new (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
char *result;
-
+
/* make C compiler happy */
(void) clientData;
(void) objc;
(void) objv;
-
+
API_FUNC(1, "infolist_new", API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new ());
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5300,13 +5300,13 @@ weechat_tcl_api_infolist_new_item (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "infolist_new_item", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* infolist */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5322,18 +5322,18 @@ weechat_tcl_api_infolist_new_var_integer (ClientData clientData, Tcl_Interp *int
Tcl_Obj *objp;
char *result;
int i, value;
-
+
API_FUNC(1, "infolist_new_var_integer", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5349,15 +5349,15 @@ weechat_tcl_api_infolist_new_var_string (ClientData clientData, Tcl_Interp *inte
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "infolist_new_var_string", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
Tcl_GetStringFromObj (objv[3], &i))); /* value */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5372,15 +5372,15 @@ weechat_tcl_api_infolist_new_var_pointer (ClientData clientData, Tcl_Interp *int
Tcl_Obj *objp;
char *result;
int i;
-
+
API_FUNC(1, "infolist_new_var_pointer", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
script_str2ptr (Tcl_GetStringFromObj (objv[3], &i)))); /* value */
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5395,18 +5395,18 @@ weechat_tcl_api_infolist_new_var_time (ClientData clientData, Tcl_Interp *interp
Tcl_Obj *objp;
char *result;
int i, value;
-
+
API_FUNC(1, "infolist_new_var_time", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
Tcl_GetStringFromObj (objv[2], &i), /* name */
value));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5421,19 +5421,19 @@ weechat_tcl_api_infolist_get (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *name, *pointer, *arguments;
int i;
-
+
API_FUNC(1, "infolist_get", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
arguments = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_infolist_get (name,
script_str2ptr (pointer),
arguments));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5447,13 +5447,13 @@ weechat_tcl_api_infolist_next (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "infolist_next", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_infolist_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
-
+
API_RETURN_INT(result);
}
@@ -5468,13 +5468,13 @@ weechat_tcl_api_infolist_prev (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int result, i;
-
+
API_FUNC(1, "infolist_prev", API_RETURN_INT(0));
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
result = weechat_infolist_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
-
+
API_RETURN_INT(result);
}
@@ -5490,13 +5490,13 @@ weechat_tcl_api_infolist_reset_item_cursor (ClientData clientData,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "infolist_reset_item_cursor", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_reset_item_cursor (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
-
+
API_RETURN_OK;
}
@@ -5512,13 +5512,13 @@ weechat_tcl_api_infolist_fields (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
const char *result;
int i;
-
+
API_FUNC(1, "infolist_fields", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = weechat_infolist_fields (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
-
+
API_RETURN_STRING(result);
}
@@ -5534,16 +5534,16 @@ weechat_tcl_api_infolist_integer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *infolist, *variable;
int result, i;
-
+
API_FUNC(1, "infolist_integer", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_infolist_integer (script_str2ptr (infolist), variable);
-
+
API_RETURN_INT(result);
}
@@ -5559,16 +5559,16 @@ weechat_tcl_api_infolist_string (ClientData clientData, Tcl_Interp *interp,
char *infolist, *variable;
const char *result;
int i;
-
+
API_FUNC(1, "infolist_string", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_infolist_string (script_str2ptr (infolist), variable);
-
+
API_RETURN_STRING(result);
}
@@ -5584,16 +5584,16 @@ weechat_tcl_api_infolist_pointer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *infolist, *variable, *result;
int i;
-
+
API_FUNC(1, "infolist_pointer", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5609,18 +5609,18 @@ weechat_tcl_api_infolist_time (ClientData clientData, Tcl_Interp *interp,
time_t time;
char timebuffer[64], *result, *infolist, *variable;
int i;
-
+
API_FUNC(1, "infolist_time", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
infolist = Tcl_GetStringFromObj (objv[1], &i);
variable = Tcl_GetStringFromObj (objv[2], &i);
time = weechat_infolist_time (script_str2ptr (infolist), variable);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
-
+
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5634,13 +5634,13 @@ weechat_tcl_api_infolist_free (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
int i;
-
+
API_FUNC(1, "infolist_free", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
-
+
weechat_infolist_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */
-
+
API_RETURN_OK;
}
@@ -5655,15 +5655,15 @@ weechat_tcl_api_hdata_get (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *result, *name;
int i;
-
+
API_FUNC(1, "hdata_get", API_RETURN_EMPTY);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
name = Tcl_GetStringFromObj (objv[1], &i);
-
+
result = script_ptr2str (weechat_hdata_get (name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5678,16 +5678,16 @@ weechat_tcl_api_hdata_get_var_offset (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *name;
int result, i;
-
+
API_FUNC(1, "hdata_get_var_offset", API_RETURN_INT(0));
if (objc < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
-
+
API_RETURN_INT(result);
}
@@ -5705,16 +5705,16 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData,
char *hdata, *name;
const char *result;
int i;
-
+
API_FUNC(1, "hdata_get_var_type_string", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5730,16 +5730,16 @@ weechat_tcl_api_hdata_get_var_hdata (ClientData clientData, Tcl_Interp *interp,
char *hdata, *name;
const char *result;
int i;
-
+
API_FUNC(1, "hdata_get_var_hdata", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
-
+
API_RETURN_STRING(result);
}
@@ -5754,17 +5754,17 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *name, *result;
int i;
-
+
API_FUNC(1, "hdata_get_list", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5779,21 +5779,21 @@ weechat_tcl_api_hdata_move (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *pointer, *result;
int i, count;
-
+
API_FUNC(1, "hdata_move", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
-
+
if (Tcl_GetIntFromObj (interp, objv[3], &count) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5809,19 +5809,19 @@ weechat_tcl_api_hdata_integer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *pointer, *name;
int result, i;
-
+
API_FUNC(1, "hdata_integer", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_INT(result);
}
@@ -5837,19 +5837,19 @@ weechat_tcl_api_hdata_long (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *pointer, *name;
int result, i;
-
+
API_FUNC(1, "hdata_long", API_RETURN_LONG(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_LONG(0));
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_LONG(result);
}
@@ -5866,19 +5866,19 @@ weechat_tcl_api_hdata_string (ClientData clientData, Tcl_Interp *interp,
char *hdata, *pointer, *name;
const char *result;
int i;
-
+
API_FUNC(1, "hdata_string", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
-
+
API_RETURN_STRING(result);
}
@@ -5894,19 +5894,19 @@ weechat_tcl_api_hdata_pointer (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *hdata, *pointer, *name, *result;
int i;
-
+
API_FUNC(1, "hdata_pointer", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5923,22 +5923,22 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
time_t time;
char timebuffer[64], *result, *hdata, *pointer, *name;
int i;
-
+
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
-
+
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
-
+
result = strdup (timebuffer);
-
+
API_RETURN_STRING_FREE(result);
}
@@ -5954,16 +5954,16 @@ weechat_tcl_api_hdata_get_string (ClientData clientData, Tcl_Interp *interp,
char *hdata, *property;
const char *result;
int i;
-
+
API_FUNC(1, "hdata_get_string", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
hdata = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
-
+
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
-
+
API_RETURN_STRING(result);
}
@@ -5982,14 +5982,14 @@ weechat_tcl_api_upgrade_new (ClientData clientData, Tcl_Interp *interp,
API_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
if (objc < 3)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &write) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
filename = Tcl_GetStringFromObj (objv[1], &i);
-
+
result = script_ptr2str (weechat_upgrade_new (filename, write));
-
+
API_RETURN_STRING_FREE(result);
}
@@ -6004,21 +6004,21 @@ weechat_tcl_api_upgrade_write_object (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *upgrade_file, *infolist;
int rc, i, object_id;
-
+
API_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
if (Tcl_GetIntFromObj (interp, objv[2], &object_id) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
infolist = Tcl_GetStringFromObj (objv[3], &i);
-
+
rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file),
object_id,
script_str2ptr (infolist));
-
+
API_RETURN_INT(rc);
}
@@ -6036,23 +6036,23 @@ weechat_tcl_api_upgrade_read_cb (void *data,
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
int *rc, ret;
-
+
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
+
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = script_ptr2str (upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = script_ptr2str (infolist);
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
"ssss", func_argv);
-
+
if (!rc)
ret = WEECHAT_RC_ERROR;
else
@@ -6064,10 +6064,10 @@ weechat_tcl_api_upgrade_read_cb (void *data,
free (func_argv[1]);
if (func_argv[3])
free (func_argv[3]);
-
+
return ret;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -6082,22 +6082,22 @@ weechat_tcl_api_upgrade_read (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *upgrade_file, *function, *data;
int i, rc;
-
+
API_FUNC(1, "upgrade_read", API_RETURN_EMPTY);
if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY);
-
+
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
function = Tcl_GetStringFromObj (objv[2], &i);
data = Tcl_GetStringFromObj (objv[3], &i);
-
+
rc = script_api_upgrade_read (weechat_tcl_plugin,
tcl_current_script,
script_str2ptr (upgrade_file),
&weechat_tcl_api_upgrade_read_cb,
function,
data);
-
+
API_RETURN_INT(rc);
}
@@ -6112,15 +6112,15 @@ weechat_tcl_api_upgrade_close (ClientData clientData, Tcl_Interp *interp,
Tcl_Obj *objp;
char *upgrade_file;
int i;
-
+
API_FUNC(1, "upgrade_close", API_RETURN_ERROR);
if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
-
+
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
-
+
weechat_upgrade_close (script_str2ptr (upgrade_file));
-
+
API_RETURN_OK;
}
@@ -6135,9 +6135,9 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
/* standard initializer */
Tcl_Init (interp);
-
+
Tcl_Eval (interp,"namespace eval weechat {}");
-
+
/* interface constants */
/* set variables, TODO: make them unmodifiable (thru Tcl_TraceVar) ? */
/* NOTE: it is not good for performance to convert "defines" to Tcl_Obj */
@@ -6149,7 +6149,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
Tcl_SetVar (interp, "weechat::WEECHAT_RC_OK_EAT", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_RC_ERROR);
Tcl_SetVar (interp, "weechat::WEECHAT_RC_ERROR", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetIntObj (objp, WEECHAT_CONFIG_READ_OK);
Tcl_SetVar (interp, "weechat::WEECHAT_CONFIG_READ_OK", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_CONFIG_READ_MEMORY_ERROR);
@@ -6178,14 +6178,14 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
Tcl_SetVar (interp, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_CONFIG_OPTION_UNSET_ERROR);
Tcl_SetVar (interp, "weechat::WEECHAT_CONFIG_OPTION_UNSET_ERROR", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetStringObj (objp, WEECHAT_LIST_POS_SORT, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_LIST_POS_SORT", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetStringObj (objp, WEECHAT_LIST_POS_BEGINNING, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_LIST_POS_BEGINNING", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetStringObj (objp, WEECHAT_LIST_POS_END, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_LIST_POS_END", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetStringObj (objp, WEECHAT_HOTLIST_LOW, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_HOTLIST_LOW", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetStringObj (objp, WEECHAT_HOTLIST_MESSAGE, -1);
@@ -6194,12 +6194,12 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
Tcl_SetVar (interp, "weechat::WEECHAT_HOTLIST_PRIVATE", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetStringObj (objp, WEECHAT_HOTLIST_HIGHLIGHT, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_HOTLIST_HIGHLIGHT", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetIntObj (objp, WEECHAT_HOOK_PROCESS_RUNNING);
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_PROCESS_RUNNING", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_HOOK_PROCESS_ERROR);
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_PROCESS_ERROR", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetIntObj (objp, WEECHAT_HOOK_CONNECT_OK);
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_CONNECT_OK", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND);
@@ -6218,7 +6218,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetIntObj (objp, WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_CONNECT_MEMORY_ERROR", Tcl_GetStringFromObj (objp, &i), 0);
-
+
Tcl_SetStringObj (objp, WEECHAT_HOOK_SIGNAL_STRING, -1);
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_SIGNAL_STRING", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_SetStringObj (objp, WEECHAT_HOOK_SIGNAL_INT, -1);
@@ -6227,7 +6227,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
Tcl_SetVar (interp, "weechat::WEECHAT_HOOK_SIGNAL_POINTER", Tcl_GetStringFromObj (objp, &i), 0);
Tcl_DecrRefCount (objp);
-
+
/* interface functions */
Tcl_CreateObjCommand (interp, "weechat::register",
weechat_tcl_api_register, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c
index bb2990c82..5fa599c07 100644
--- a/src/plugins/scripts/tcl/weechat-tcl.c
+++ b/src/plugins/scripts/tcl/weechat-tcl.c
@@ -85,14 +85,14 @@ weechat_tcl_hashtable_map_cb (void *data,
void **data_array;
Tcl_Interp *interp;
Tcl_Obj *dict;
-
+
/* make C compiler happy */
(void) hashtable;
-
+
data_array = (void **)data;
interp = data_array[0];
dict = data_array[1];
-
+
Tcl_DictObjPut (interp, dict,
Tcl_NewStringObj ((char *)key, -1),
Tcl_NewStringObj ((char *)value, -1));
@@ -108,18 +108,18 @@ weechat_tcl_hashtable_to_dict (Tcl_Interp *interp,
{
Tcl_Obj *dict;
void *data[2];
-
+
dict = Tcl_NewDictObj ();
if (!dict)
return NULL;
-
+
data[0] = interp;
data[1] = dict;
-
+
weechat_hashtable_map (hashtable,
&weechat_tcl_hashtable_map_cb,
data);
-
+
return dict;
}
@@ -139,7 +139,7 @@ weechat_tcl_dict_to_hashtable (Tcl_Interp *interp, Tcl_Obj *dict,
Tcl_DictSearch search;
Tcl_Obj *key, *value;
int done;
-
+
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -147,7 +147,7 @@ weechat_tcl_dict_to_hashtable (Tcl_Interp *interp, Tcl_Obj *dict,
NULL);
if (!hashtable)
return NULL;
-
+
if (Tcl_DictObjFirst (interp, dict, &search, &key, &value, &done) == TCL_OK)
{
for (; !done ; Tcl_DictObjNext(&search, &key, &value, &done))
@@ -158,7 +158,7 @@ weechat_tcl_dict_to_hashtable (Tcl_Interp *interp, Tcl_Obj *dict,
}
}
Tcl_DictObjDone(&search);
-
+
return hashtable;
}
@@ -178,11 +178,11 @@ weechat_tcl_exec (struct t_plugin_script *script,
Tcl_Obj *cmdlist;
Tcl_Interp *interp;
struct t_plugin_script *old_tcl_script;
-
+
old_tcl_script = tcl_current_script;
tcl_current_script = script;
interp = (Tcl_Interp*)script->interpreter;
-
+
if (function && function[0])
{
cmdlist = Tcl_NewListObj (0, NULL);
@@ -194,7 +194,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
tcl_current_script = old_tcl_script;
return NULL;
}
-
+
if (format && format[0])
{
argc = strlen (format);
@@ -217,10 +217,10 @@ weechat_tcl_exec (struct t_plugin_script *script,
}
}
}
-
+
if (Tcl_ListObjLength (interp, cmdlist, &llength) != TCL_OK)
llength = 0;
-
+
if (Tcl_EvalObjEx (interp, cmdlist, TCL_EVAL_DIRECT) == TCL_OK)
{
Tcl_ListObjReplace (interp, cmdlist, 0, llength, 0, NULL); /* remove elements, decrement their ref count */
@@ -248,18 +248,18 @@ weechat_tcl_exec (struct t_plugin_script *script,
Tcl_GetObjResult (interp),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
}
-
+
tcl_current_script = old_tcl_script;
if (ret_val)
return ret_val;
-
+
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"%s\" must return a "
"valid value"),
weechat_prefix ("error"), TCL_PLUGIN_NAME, function);
return NULL;
}
-
+
Tcl_ListObjReplace (interp, cmdlist, 0, llength, 0, NULL); /* remove elements, decrement their ref count */
Tcl_DecrRefCount (cmdlist); /* -1 */
weechat_printf (NULL,
@@ -267,7 +267,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
weechat_prefix ("error"), TCL_PLUGIN_NAME, function,
Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i));
tcl_current_script = old_tcl_script;
-
+
return NULL;
}
@@ -281,7 +281,7 @@ weechat_tcl_load (const char *filename)
int i;
Tcl_Interp *interp;
struct stat buf;
-
+
if (stat (filename, &buf) != 0)
{
weechat_printf (NULL,
@@ -289,17 +289,17 @@ weechat_tcl_load (const char *filename)
weechat_prefix ("error"), TCL_PLUGIN_NAME, filename);
return 0;
}
-
+
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
TCL_PLUGIN_NAME, filename);
}
-
+
tcl_current_script = NULL;
tcl_registered_script = NULL;
-
+
if (!(interp = Tcl_CreateInterp ())) {
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to create new "
@@ -308,7 +308,7 @@ weechat_tcl_load (const char *filename)
return 0;
}
tcl_current_script_filename = filename;
-
+
weechat_tcl_api_init (interp);
if (Tcl_EvalFile (interp, filename) != TCL_OK)
@@ -332,7 +332,7 @@ weechat_tcl_load (const char *filename)
return 0;
}
tcl_current_script = tcl_registered_script;
-
+
/*
* set input/close callbacks for buffers created by this script
* (to restore callbacks after upgrade)
@@ -342,7 +342,7 @@ weechat_tcl_load (const char *filename)
tcl_current_script,
&weechat_tcl_api_buffer_input_data_cb,
&weechat_tcl_api_buffer_close_cb);
-
+
return 1;
}
@@ -355,7 +355,7 @@ weechat_tcl_load_cb (void *data, const char *filename)
{
/* make C compiler happy */
(void) data;
-
+
weechat_tcl_load (filename);
}
@@ -368,14 +368,14 @@ weechat_tcl_unload (struct t_plugin_script *script)
{
Tcl_Interp* interp;
int *rc;
-
+
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
TCL_PLUGIN_NAME, script->name);
}
-
+
if (script->shutdown_func && script->shutdown_func[0])
{
rc = (int *)weechat_tcl_exec (script,
@@ -385,27 +385,27 @@ weechat_tcl_unload (struct t_plugin_script *script)
if (rc)
free (rc);
}
-
+
interp = (Tcl_Interp*)script->interpreter;
-
+
if (tcl_current_script == script)
tcl_current_script = (tcl_current_script->prev_script) ?
tcl_current_script->prev_script : tcl_current_script->next_script;
-
+
script_remove (weechat_tcl_plugin, &tcl_scripts, &last_tcl_script, script);
-
+
Tcl_DeleteInterp(interp);
}
-
+
/*
* weechat_tcl_unload_name: unload a Tcl script by name
*/
-
+
void
weechat_tcl_unload_name (const char *name)
{
struct t_plugin_script *ptr_script;
-
+
ptr_script = script_search (weechat_tcl_plugin, tcl_scripts, name);
if (ptr_script)
{
@@ -444,7 +444,7 @@ weechat_tcl_reload_name (const char *name)
{
struct t_plugin_script *ptr_script;
char *filename;
-
+
ptr_script = script_search (weechat_tcl_plugin, tcl_scripts, name);
if (ptr_script)
{
@@ -476,11 +476,11 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *path_script;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc == 1)
{
script_display_list (weechat_tcl_plugin, tcl_scripts,
@@ -551,7 +551,7 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_prefix ("error"), TCL_PLUGIN_NAME, "tcl");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -568,9 +568,9 @@ weechat_tcl_completion_cb (void *data, const char *completion_item,
(void) data;
(void) completion_item;
(void) buffer;
-
+
script_completion (weechat_tcl_plugin, completion, tcl_scripts);
-
+
return WEECHAT_RC_OK;
}
@@ -584,17 +584,17 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
{
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "tcl_script") == 0)
{
return script_infolist_list_scripts (weechat_tcl_plugin,
tcl_scripts, pointer,
arguments);
}
-
+
return NULL;
}
@@ -610,13 +610,13 @@ weechat_tcl_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, TCL_PLUGIN_NAME) == 0))
{
script_print_log (weechat_tcl_plugin, tcl_scripts);
}
-
+
return WEECHAT_RC_OK;
}
@@ -632,10 +632,10 @@ weechat_tcl_signal_buffer_closed_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (signal_data)
script_remove_buffer_callbacks (tcl_scripts, signal_data);
-
+
return WEECHAT_RC_OK;
}
@@ -667,7 +667,7 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
&tcl_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -683,7 +683,7 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
{
/* make C compiler happy */
(void) data;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (strcmp (signal, "tcl_script_install") == 0)
@@ -703,7 +703,7 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
&tcl_action_remove_list);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -715,7 +715,7 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_tcl_plugin = plugin;
-
+
tcl_quiet = 1;
script_init (weechat_tcl_plugin,
argc,
@@ -728,10 +728,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&weechat_tcl_signal_script_action_cb,
&weechat_tcl_load_cb);
tcl_quiet = 0;
-
+
script_display_short_list (weechat_tcl_plugin,
tcl_scripts);
-
+
/* init ok */
return WEECHAT_RC_OK;
}
@@ -747,6 +747,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
tcl_quiet = 1;
script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
tcl_quiet = 0;
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 5c8837b6c..245cbcfdf 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -187,16 +187,16 @@ struct t_weechat_plugin
int debug; /* debug level for plugin (0=off) */
struct t_weechat_plugin *prev_plugin; /* link to previous plugin */
struct t_weechat_plugin *next_plugin; /* link to next plugin */
-
+
/*
* plugin functions (API)
* WeeChat developers: if you add functions in API, update value of
* constant WEECHAT_PLUGIN_API_VERSION
*/
-
+
/* plugins */
const char *(*plugin_get_name) (struct t_weechat_plugin *plugin);
-
+
/* strings */
void (*charset_set) (struct t_weechat_plugin *plugin, const char *charset);
char *(*iconv_to_internal) (const char *charset, const char *string);
@@ -236,7 +236,7 @@ struct t_weechat_plugin
int (*string_decode_base64) (const char *from, char *to);
int (*string_is_command_char) (const char *string);
const char *(*string_input_for_buffer) (const char *string);
-
+
/* UTF-8 strings */
int (*utf8_has_8bits) (const char *string);
int (*utf8_is_valid) (const char *string, char **error);
@@ -255,7 +255,7 @@ struct t_weechat_plugin
int (*utf8_real_pos) (const char *string, int pos);
int (*utf8_pos) (const char *string, int real_pos);
char *(*utf8_strndup) (const char *string, int length);
-
+
/* directories/files */
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
@@ -263,13 +263,13 @@ struct t_weechat_plugin
void (*exec_on_files) (const char *directory, int hidden_files, void *data,
void (*callback)(void *data, const char *filename));
char *(*file_get_content) (const char *filename);
-
+
/* util */
int (*util_timeval_cmp) (struct timeval *tv1, struct timeval *tv2);
long (*util_timeval_diff) (struct timeval *tv1, struct timeval *tv2);
void (*util_timeval_add) (struct timeval *tv, long interval);
char *(*util_get_time_string) (const time_t *date);
-
+
/* sorted lists */
struct t_weelist *(*list_new) ();
struct t_weelist_item *(*list_add) (struct t_weelist *weelist,
@@ -295,7 +295,7 @@ struct t_weechat_plugin
struct t_weelist_item *item);
void (*list_remove_all) (struct t_weelist *weelist);
void (*list_free) (struct t_weelist *weelist);
-
+
/* hash tables */
struct t_hashtable *(*hashtable_new) (int size,
const char *type_keys,
@@ -331,7 +331,7 @@ struct t_weechat_plugin
void (*hashtable_remove) (struct t_hashtable *hashtable, const void *key);
void (*hashtable_remove_all) (struct t_hashtable *hashtable);
void (*hashtable_free) (struct t_hashtable *hashtable);
-
+
/* config files */
struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
const char *name,
@@ -449,11 +449,11 @@ struct t_weechat_plugin
const char *description);
int (*config_unset_plugin) (struct t_weechat_plugin *plugin,
const char *option_name);
-
+
/* key bindings */
int (*key_bind) (const char *context, struct t_hashtable *keys);
int (*key_unbind) (const char *context, const char *key);
-
+
/* display */
const char *(*prefix) (const char *prefix);
const char *(*color) (const char *color_name);
@@ -462,7 +462,7 @@ struct t_weechat_plugin
void (*printf_y) (struct t_gui_buffer *buffer, int y,
const char *message, ...);
void (*log_printf) (const char *message, ...);
-
+
/* hooks */
struct t_hook *(*hook_command) (struct t_weechat_plugin *plugin,
const char *command,
@@ -623,7 +623,7 @@ struct t_weechat_plugin
void *callback_data);
void (*unhook) (struct t_hook *hook);
void (*unhook_all) (struct t_weechat_plugin *plugin);
-
+
/* buffers */
struct t_gui_buffer *(*buffer_new) (struct t_weechat_plugin *plugin,
const char *name,
@@ -654,7 +654,7 @@ struct t_weechat_plugin
char *(*buffer_string_replace_local_var) (struct t_gui_buffer *buffer,
const char *string);
int (*buffer_match_list) (struct t_gui_buffer *buffer, const char *string);
-
+
/* windows */
struct t_gui_window *(*window_search_with_buffer) (struct t_gui_buffer *buffer);
int (*window_get_integer) (struct t_gui_window *window,
@@ -664,7 +664,7 @@ struct t_weechat_plugin
void *(*window_get_pointer) (struct t_gui_window *window,
const char *property);
void (*window_set_title) (const char *title);
-
+
/* nicklist */
struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group,
@@ -713,7 +713,7 @@ struct t_weechat_plugin
void (*nicklist_nick_set) (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property, const char *value);
-
+
/* bars */
struct t_gui_bar_item *(*bar_item_search) (const char *name);
struct t_gui_bar_item *(*bar_item_new) (struct t_weechat_plugin *plugin,
@@ -744,7 +744,7 @@ struct t_weechat_plugin
const char *value);
void (*bar_update) (const char *name);
void (*bar_remove) (struct t_gui_bar *bar);
-
+
/* command */
void (*command) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command);
@@ -754,7 +754,7 @@ struct t_weechat_plugin
const char *address, int port);
int (*network_connect_to) (const char *proxy, int sock,
unsigned long address, int port);
-
+
/* infos */
const char *(*info_get) (struct t_weechat_plugin *plugin,
const char *info_name,
@@ -762,7 +762,7 @@ struct t_weechat_plugin
struct t_hashtable *(*info_get_hashtable) (struct t_weechat_plugin *plugin,
const char *info_name,
struct t_hashtable *hashtable);
-
+
/* infolists */
struct t_infolist *(*infolist_new) ();
struct t_infolist_item *(*infolist_new_item) (struct t_infolist *infolist);
@@ -797,7 +797,7 @@ struct t_weechat_plugin
int *size);
time_t (*infolist_time) (struct t_infolist *infolist, const char *var);
void (*infolist_free) (struct t_infolist *infolist);
-
+
/* hdata */
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
@@ -832,7 +832,7 @@ struct t_weechat_plugin
const char *name);
const char *(*hdata_get_string) (struct t_hdata *hdata,
const char *property);
-
+
/* upgrade */
struct t_upgrade_file *(*upgrade_new) (const char *filename,
int write);
diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c
index c936fecbe..684406970 100644
--- a/src/plugins/xfer/xfer-buffer.c
+++ b/src/plugins/xfer/xfer-buffer.c
@@ -50,7 +50,7 @@ xfer_buffer_refresh (const char *hotlist)
int i, length, line, progress_bar_size, num_bars;
unsigned long long pct_complete;
struct tm *date_tmp;
-
+
if (xfer_buffer)
{
weechat_buffer_clear (xfer_buffer);
@@ -85,14 +85,14 @@ xfer_buffer_refresh (const char *hotlist)
snprintf (suffix, sizeof (suffix),
" (.%d)", ptr_xfer->filename_suffix);
}
-
+
snprintf (str_color, sizeof (str_color),
"%s,%s",
(line == xfer_buffer_selected_line) ?
weechat_config_string (xfer_config_color_text_selected) :
weechat_config_string (xfer_config_color_text),
weechat_config_string (xfer_config_color_text_bg));
-
+
/* display first line with remote nick and filename */
weechat_printf_y (xfer_buffer, (line * 2) + 2,
"%s%s%-24s %s%s%s%s",
@@ -105,7 +105,7 @@ xfer_buffer_refresh (const char *hotlist)
ptr_xfer->filename : _("xfer chat"),
(XFER_IS_FILE(ptr_xfer->type)) ? "\"" : "",
suffix);
-
+
snprintf (status, sizeof (status),
"%s", _(xfer_status_string[ptr_xfer->status]));
length = weechat_utf8_strlen_screen (status);
@@ -116,7 +116,7 @@ xfer_buffer_refresh (const char *hotlist)
strcat (status, " ");
}
}
-
+
if (XFER_IS_CHAT(ptr_xfer->type))
{
/* display second line for chat with status and date */
@@ -166,7 +166,7 @@ xfer_buffer_refresh (const char *hotlist)
}
strcat (progress_bar, "] ");
}
-
+
/* computes percentage */
if (ptr_xfer->size == 0)
{
@@ -177,12 +177,12 @@ xfer_buffer_refresh (const char *hotlist)
}
else
pct_complete = (unsigned long long)(((float)(ptr_xfer->pos)/(float)(ptr_xfer->size)) * 100);
-
+
/* position, total and bytes per second */
str_pos = weechat_string_format_size (ptr_xfer->pos);
str_total = weechat_string_format_size (ptr_xfer->size);
str_bytes_per_sec = weechat_string_format_size (ptr_xfer->bytes_per_sec);
-
+
/* ETA */
eta[0] = '\0';
if (ptr_xfer->status == XFER_STATUS_ACTIVE)
@@ -194,7 +194,7 @@ xfer_buffer_refresh (const char *hotlist)
(ptr_xfer->eta / 60) % 60,
ptr_xfer->eta % 60);
}
-
+
/* display second line for file with status, progress bar and estimated time */
weechat_printf_y (xfer_buffer, (line * 2) + 3,
"%s%s%s %s%s%s%s%3llu%% %s / %s (%s%s/s)",
@@ -233,12 +233,12 @@ xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_xfer *xfer, *ptr_xfer, *next_xfer;
-
+
/* make C compiler happy */
(void) data;
-
+
xfer = xfer_search_by_number (xfer_buffer_selected_line);
-
+
/* accept xfer */
if (weechat_strcasecmp (input_data, "a") == 0)
{
@@ -284,7 +284,7 @@ xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -298,9 +298,9 @@ xfer_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
xfer_buffer = NULL;
-
+
return WEECHAT_RC_OK;
}
@@ -316,11 +316,11 @@ xfer_buffer_open ()
xfer_buffer = weechat_buffer_new (XFER_BUFFER_NAME,
&xfer_buffer_input_cb, NULL,
&xfer_buffer_close_cb, NULL);
-
+
/* failed to create buffer ? then exit */
if (!xfer_buffer)
return;
-
+
weechat_buffer_set (xfer_buffer, "type", "free");
weechat_buffer_set (xfer_buffer, "title", _("Xfer list"));
weechat_buffer_set (xfer_buffer, "key_bind_meta2-A", "/xfer up");
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index baf2acdb9..3d05f19ce 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -43,7 +43,7 @@ xfer_chat_send (struct t_xfer *xfer, const char *buffer, int size_buf)
{
if (!xfer)
return -1;
-
+
return send (xfer->sock, buffer, size_buf, 0);
}
@@ -55,21 +55,21 @@ void
xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
{
char *ptr_msg, *msg_encoded;
-
+
if (!xfer || (xfer->sock < 0))
return;
-
+
weechat_va_format (format);
if (!vbuffer)
return;
-
+
msg_encoded = (xfer->charset_modifier) ?
weechat_hook_modifier_exec ("charset_encode",
xfer->charset_modifier,
vbuffer) : NULL;
-
+
ptr_msg = (msg_encoded) ? msg_encoded : vbuffer;
-
+
if (xfer_chat_send (xfer, ptr_msg, strlen (ptr_msg)) <= 0)
{
weechat_printf (NULL,
@@ -78,10 +78,10 @@ xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
xfer->remote_nick);
xfer_close (xfer, XFER_STATUS_FAILED);
}
-
+
if (msg_encoded)
free (msg_encoded);
-
+
free (vbuffer);
}
@@ -98,17 +98,17 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
char *ptr_buf_decoded, *ptr_buf_without_weechat_colors, *ptr_buf_color;
char str_tags[256];
int num_read, length, ctcp_action;
-
+
/* make C compiler happy */
(void) fd;
-
+
xfer = (struct t_xfer *)arg_xfer;
-
+
num_read = recv (xfer->sock, buffer, sizeof (buffer) - 2, 0);
if (num_read > 0)
{
buffer[num_read] = '\0';
-
+
buf2 = NULL;
ptr_buf = buffer;
if (xfer->unterminated_message)
@@ -124,7 +124,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
free (xfer->unterminated_message);
xfer->unterminated_message = NULL;
}
-
+
while (ptr_buf && ptr_buf[0])
{
next_ptr_buf = NULL;
@@ -140,7 +140,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
ptr_buf = NULL;
next_ptr_buf = NULL;
}
-
+
if (ptr_buf)
{
ctcp_action = 0;
@@ -156,7 +156,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
ctcp_action = 1;
}
}
-
+
ptr_buf_decoded = (xfer->charset_modifier) ?
weechat_hook_modifier_exec ("charset_decode",
xfer->charset_modifier,
@@ -206,10 +206,10 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
if (ptr_buf_color)
free (ptr_buf_color);
}
-
+
ptr_buf = next_ptr_buf;
}
-
+
if (buf2)
free (buf2);
}
@@ -218,7 +218,7 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
xfer_close (xfer, XFER_STATUS_ABORTED);
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
}
-
+
return WEECHAT_RC_OK;
}
@@ -233,12 +233,12 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
{
struct t_xfer *ptr_xfer;
char *input_data_color;
-
+
/* make C compiler happy */
(void) data;
-
+
ptr_xfer = xfer_search_by_buffer (buffer);
-
+
if (ptr_xfer)
{
if (!XFER_HAS_ENDED(ptr_xfer->status))
@@ -260,7 +260,7 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -273,7 +273,7 @@ int
xfer_chat_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
@@ -290,7 +290,7 @@ xfer_chat_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
ptr_xfer->buffer = NULL;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -303,9 +303,9 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
{
char *name;
int length, buffer_created;
-
+
buffer_created = 0;
-
+
length = strlen (xfer->plugin_name) + 8 + strlen (xfer->plugin_id) + 1
+ strlen (xfer->remote_nick) + 1;
name = malloc (length);
@@ -320,7 +320,7 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
&xfer_chat_buffer_input_cb, NULL,
&xfer_chat_buffer_close_cb, NULL);
buffer_created = 1;
-
+
/* failed to create buffer ? then return */
if (!xfer->buffer)
return;
@@ -339,7 +339,7 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
weechat_buffer_set (xfer->buffer, "localvar_set_channel", xfer->remote_nick);
weechat_buffer_set (xfer->buffer, "highlight_words_add", "$nick");
}
-
+
weechat_printf (xfer->buffer,
_("Connected to %s (%d.%d.%d.%d) via "
"xfer chat"),
@@ -348,7 +348,7 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
(xfer->address >> 16) & 0xff,
(xfer->address >> 8) & 0xff,
xfer->address & 0xff);
-
+
free (name);
}
}
diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c
index 57e87a107..ad57a834a 100644
--- a/src/plugins/xfer/xfer-command.c
+++ b/src/plugins/xfer/xfer-command.c
@@ -41,12 +41,12 @@ xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) data;
(void) argc;
(void) argv;
-
+
ptr_xfer = xfer_search_by_buffer (buffer);
if (!ptr_xfer)
@@ -57,7 +57,7 @@ xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
weechat_buffer_get_string (buffer, "name"));
return WEECHAT_RC_OK;
}
-
+
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\n",
@@ -71,7 +71,7 @@ xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
weechat_color ("chat"),
(argv_eol[1]) ? argv_eol[1] : "");
}
-
+
return WEECHAT_RC_OK;
}
@@ -87,7 +87,7 @@ xfer_command_xfer_list (int full)
char date[128];
unsigned long long pct_complete;
struct tm *date_tmp;
-
+
if (xfer_list)
{
weechat_printf (NULL, "");
@@ -107,7 +107,7 @@ xfer_command_xfer_list (int full)
}
else
pct_complete = (unsigned long long)(((float)(ptr_xfer->pos)/(float)(ptr_xfer->size)) * 100);
-
+
weechat_printf (NULL,
_("%3d. %s (%s), file: \"%s\" (local: "
"\"%s\"), %s %s, status: %s%s%s "
@@ -146,7 +146,7 @@ xfer_command_xfer_list (int full)
xfer_config_color_status[ptr_xfer->status])),
_(xfer_status_string[ptr_xfer->status]));
}
-
+
if (full)
{
/* second line of xfer info */
@@ -202,20 +202,20 @@ xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc,
xfer_command_xfer_list (0);
return WEECHAT_RC_OK;
}
-
+
if ((argc > 1) && (weechat_strcasecmp (argv[1], "listfull") == 0))
{
xfer_command_xfer_list (1);
return WEECHAT_RC_OK;
}
-
+
if (!xfer_buffer)
xfer_buffer_open ();
-
+
if (xfer_buffer)
{
weechat_buffer_set (xfer_buffer, "display", "1");
-
+
if (argc > 1)
{
if (strcmp (argv[1], "up") == 0)
@@ -230,9 +230,9 @@ xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc,
}
}
}
-
+
xfer_buffer_refresh (NULL);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/xfer/xfer-completion.c b/src/plugins/xfer/xfer-completion.c
index 6e5aecb40..feb81ba7e 100644
--- a/src/plugins/xfer/xfer-completion.c
+++ b/src/plugins/xfer/xfer-completion.c
@@ -40,11 +40,11 @@ xfer_completion_nick_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
ptr_xfer = xfer_search_by_buffer (buffer);
if (ptr_xfer)
{
@@ -59,7 +59,7 @@ xfer_completion_nick_cb (void *data, const char *completion_item,
1,
WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c
index 2cffb1036..cc48a4fa9 100644
--- a/src/plugins/xfer/xfer-config.c
+++ b/src/plugins/xfer/xfer-config.c
@@ -77,7 +77,7 @@ xfer_config_refresh_cb (void *data, struct t_config_option *option)
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (xfer_buffer)
xfer_buffer_refresh (NULL);
}
@@ -91,7 +91,7 @@ xfer_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
-
+
return weechat_config_reload (config_file);
}
@@ -104,12 +104,12 @@ int
xfer_config_init ()
{
struct t_config_section *ptr_section;
-
+
xfer_config_file = weechat_config_new (XFER_CONFIG_NAME,
&xfer_config_reload, NULL);
if (!xfer_config_file)
return 0;
-
+
ptr_section = weechat_config_new_section (xfer_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
@@ -120,7 +120,7 @@ xfer_config_init ()
weechat_config_free (xfer_config_file);
return 0;
}
-
+
xfer_config_look_auto_open_buffer = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_open_buffer", "boolean",
@@ -133,7 +133,7 @@ xfer_config_init ()
N_("size of progress bar, in chars (if 0, progress bar is disabled)"),
NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (xfer_config_file, "color",
0, 0,
NULL, NULL, NULL, NULL,
@@ -144,7 +144,7 @@ xfer_config_init ()
weechat_config_free (xfer_config_file);
return 0;
}
-
+
xfer_config_color_text = weechat_config_new_option (
xfer_config_file, ptr_section,
"text", "color",
@@ -199,7 +199,7 @@ xfer_config_init ()
N_("text color for \"aborted\" status"),
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (xfer_config_file, "network",
0, 0,
NULL, NULL, NULL, NULL,
@@ -210,7 +210,7 @@ xfer_config_init ()
weechat_config_free (xfer_config_file);
return 0;
}
-
+
xfer_config_network_timeout = weechat_config_new_option (
xfer_config_file, ptr_section,
"timeout", "integer",
@@ -248,7 +248,7 @@ xfer_config_init ()
N_("speed limit for sending files, in kilo-bytes by second (0 means "
"no limit)"),
NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
NULL, NULL, NULL, NULL,
@@ -259,7 +259,7 @@ xfer_config_init ()
weechat_config_free (xfer_config_file);
return 0;
}
-
+
xfer_config_file_download_path = weechat_config_new_option (
xfer_config_file, ptr_section,
"download_path", "string",
@@ -304,7 +304,7 @@ xfer_config_init ()
"auto_accept_chats", "boolean",
N_("automatically accept chat requests (use carefully!)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
-
+
return 1;
}
diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c
index aba22869b..40a93205b 100644
--- a/src/plugins/xfer/xfer-dcc.c
+++ b/src/plugins/xfer/xfer-dcc.c
@@ -51,14 +51,14 @@ xfer_dcc_send_file_child (struct t_xfer *xfer)
uint32_t ack;
time_t last_sent, new_time, last_second, sent_ok;
unsigned long long sent_last_second;
-
+
blocksize = xfer->blocksize;
if (weechat_config_integer (xfer_config_network_speed_limit) > 0)
{
if (blocksize > weechat_config_integer (xfer_config_network_speed_limit) * 1024)
blocksize = weechat_config_integer (xfer_config_network_speed_limit) * 1024;
}
-
+
last_sent = time (NULL);
last_second = time (NULL);
sent_ok = 0;
@@ -83,7 +83,7 @@ xfer_dcc_send_file_child (struct t_xfer *xfer)
{
recv (xfer->sock, (char *) &ack, 4, 0);
xfer->ack = ntohl (ack);
-
+
/* DCC send ok? */
if ((xfer->pos >= xfer->size)
&& (xfer->ack >= xfer->size))
@@ -97,7 +97,7 @@ xfer_dcc_send_file_child (struct t_xfer *xfer)
break;
}
}
-
+
/* send a block to receiver */
if ((xfer->pos < xfer->size) &&
(xfer->fast_send || (xfer->pos <= xfer->ack)))
@@ -153,14 +153,14 @@ xfer_dcc_send_file_child (struct t_xfer *xfer)
}
else
usleep (1000);
-
+
new_time = time (NULL);
if (new_time > last_second)
{
last_second = new_time;
sent_last_second = 0;
}
-
+
/*
* if send if ok since 2 seconds or more, and that no ack was received,
* then consider it's ok
@@ -185,7 +185,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
static char buffer[XFER_BLOCKSIZE_MAX];
uint32_t pos;
time_t last_sent, new_time;
-
+
/* first connect to sender (blocking) */
if (!weechat_network_connect_to (xfer->proxy, xfer->sock,
xfer->address, xfer->port))
@@ -194,11 +194,11 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
XFER_ERROR_CONNECT_SENDER);
return;
}
-
+
/* connection is ok, change DCC status (inform parent process) */
xfer_network_write_pipe (xfer, XFER_STATUS_ACTIVE,
XFER_NO_ERROR);
-
+
last_sent = time (NULL);
while (1)
{
@@ -223,20 +223,20 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
XFER_ERROR_RECV_BLOCK);
return;
}
-
+
if (write (xfer->file, buffer, num_read) == -1)
{
xfer_network_write_pipe (xfer, XFER_STATUS_FAILED,
XFER_ERROR_WRITE_LOCAL);
return;
}
-
+
xfer->pos += (unsigned long long) num_read;
pos = htonl (xfer->pos);
-
+
/* we don't check return code, not a problem if an ACK send failed */
send (xfer->sock, (char *) &pos, 4, 0);
-
+
/* file received ok? */
if (xfer->pos >= xfer->size)
{
@@ -244,7 +244,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
XFER_NO_ERROR);
return;
}
-
+
new_time = time (NULL);
if (last_sent != new_time)
{
diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c
index af4760846..630e9aeec 100644
--- a/src/plugins/xfer/xfer-file.c
+++ b/src/plugins/xfer/xfer-file.c
@@ -47,10 +47,10 @@ int
xfer_file_resume (struct t_xfer *xfer, const char *filename)
{
struct stat st;
-
+
if (!weechat_config_boolean (xfer_config_file_auto_resume))
return 0;
-
+
if (access (filename, W_OK) == 0)
{
if (stat (filename, &st) != -1)
@@ -64,7 +64,7 @@ xfer_file_resume (struct t_xfer *xfer, const char *filename)
}
}
}
-
+
/* not resumable */
return 0;
}
@@ -80,14 +80,14 @@ xfer_file_find_filename (struct t_xfer *xfer)
{
const char *weechat_home, *dir_separator;
char *dir1, *dir2, *filename2;
-
+
if (!XFER_IS_FILE(xfer->type))
return;
-
+
dir1 = weechat_string_expand_home (weechat_config_string (xfer_config_file_download_path));
if (!dir1)
return;
-
+
weechat_home = weechat_info_get ("weechat_dir", "");
if (!weechat_home)
{
@@ -100,13 +100,13 @@ xfer_file_find_filename (struct t_xfer *xfer)
free (dir1);
return;
}
-
+
xfer->local_filename = malloc (strlen (dir2) +
strlen (xfer->remote_nick) +
strlen (xfer->filename) + 4);
if (!xfer->local_filename)
return;
-
+
strcpy (xfer->local_filename, dir2);
dir_separator = weechat_info_get("dir_separator", "");
if (dir_separator
@@ -118,18 +118,18 @@ xfer_file_find_filename (struct t_xfer *xfer)
strcat (xfer->local_filename, ".");
}
strcat (xfer->local_filename, xfer->filename);
-
+
if (dir1)
free (dir1);
if (dir2 )
free (dir2);
-
+
/* file already exists? */
if (access (xfer->local_filename, F_OK) == 0)
{
if (xfer_file_resume (xfer, xfer->local_filename))
return;
-
+
/* if auto rename is not set, then abort xfer */
if (!xfer_config_file_auto_rename)
{
@@ -137,7 +137,7 @@ xfer_file_find_filename (struct t_xfer *xfer)
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
return;
}
-
+
filename2 = malloc (strlen (xfer->local_filename) + 16);
if (!filename2)
{
@@ -161,7 +161,7 @@ xfer_file_find_filename (struct t_xfer *xfer)
break;
}
while (1);
-
+
free (xfer->local_filename);
xfer->local_filename = strdup (filename2);
free (filename2);
@@ -177,7 +177,7 @@ xfer_file_calculate_speed (struct t_xfer *xfer, int ended)
{
time_t local_time, elapsed;
unsigned long long bytes_per_sec_total;
-
+
local_time = time (NULL);
if (ended || local_time > xfer->last_check_time)
{
@@ -200,7 +200,7 @@ xfer_file_calculate_speed (struct t_xfer *xfer, int ended)
if (bytes_per_sec_total == 0)
bytes_per_sec_total = 1;
xfer->eta = (xfer->size - xfer->pos) / bytes_per_sec_total;
-
+
/* calculate bytes per second (since last check time) */
elapsed = local_time - xfer->last_check_time;
if (elapsed == 0)
diff --git a/src/plugins/xfer/xfer-info.c b/src/plugins/xfer/xfer-info.c
index 28d95c581..93a3ab9cc 100644
--- a/src/plugins/xfer/xfer-info.c
+++ b/src/plugins/xfer/xfer-info.c
@@ -38,19 +38,19 @@ xfer_info_get_infolist_cb (void *data, const char *infolist_name,
{
struct t_infolist *ptr_infolist;
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) data;
(void) arguments;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "xfer") == 0)
{
if (pointer && !xfer_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -80,7 +80,7 @@ xfer_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c
index f588aa022..6626aaf81 100644
--- a/src/plugins/xfer/xfer-network.c
+++ b/src/plugins/xfer/xfer-network.c
@@ -51,7 +51,7 @@ int
xfer_network_create_pipe (struct t_xfer *xfer)
{
int child_pipe[2];
-
+
if (pipe (child_pipe) < 0)
{
weechat_printf (NULL,
@@ -61,10 +61,10 @@ xfer_network_create_pipe (struct t_xfer *xfer)
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
return 0;
}
-
+
xfer->child_read = child_pipe[0];
xfer->child_write = child_pipe[1];
-
+
return 1;
}
@@ -77,7 +77,7 @@ xfer_network_write_pipe (struct t_xfer *xfer, int status, int error)
{
char buffer[1 + 1 + 32 + 1]; /* status + error + pos + \0 */
int num_written;
-
+
snprintf (buffer, sizeof (buffer), "%c%c%032llu",
status + '0', error + '0', xfer->pos);
num_written = write (xfer->child_write, buffer, sizeof (buffer));
@@ -94,19 +94,19 @@ xfer_network_child_read_cb (void *arg_xfer, int fd)
struct t_xfer *xfer;
char bufpipe[1 + 1 + 32 + 1];
int num_read;
-
+
/* make C compiler happy */
(void) fd;
-
+
xfer = (struct t_xfer *)arg_xfer;
-
+
num_read = read (xfer->child_read, bufpipe, sizeof (bufpipe));
if (num_read > 0)
{
sscanf (bufpipe + 2, "%llu", &xfer->pos);
xfer->last_activity = time (NULL);
xfer_file_calculate_speed (xfer, 0);
-
+
/* read error code */
switch (bufpipe[1] - '0')
{
@@ -143,7 +143,7 @@ xfer_network_child_read_cb (void *arg_xfer, int fd)
weechat_prefix ("error"), XFER_PLUGIN_NAME);
break;
}
-
+
/* read new DCC status */
switch (bufpipe[0] - '0')
{
@@ -169,7 +169,7 @@ xfer_network_child_read_cb (void *arg_xfer, int fd)
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -181,12 +181,12 @@ void
xfer_network_send_file_fork (struct t_xfer *xfer)
{
pid_t pid;
-
+
if (!xfer_network_create_pipe (xfer))
return;
-
+
xfer->file = open (xfer->local_filename, O_RDONLY | O_NONBLOCK, 0644);
-
+
switch (pid = fork ())
{
/* fork failed */
@@ -214,7 +214,7 @@ xfer_network_send_file_fork (struct t_xfer *xfer)
}
_exit (EXIT_SUCCESS);
}
-
+
/* parent process */
xfer->child_pid = pid;
close (xfer->child_write);
@@ -233,10 +233,10 @@ void
xfer_network_recv_file_fork (struct t_xfer *xfer)
{
pid_t pid;
-
+
if (!xfer_network_create_pipe (xfer))
return;
-
+
if (xfer->start_resume > 0)
xfer->file = open (xfer->local_filename,
O_APPEND | O_WRONLY | O_NONBLOCK);
@@ -244,7 +244,7 @@ xfer_network_recv_file_fork (struct t_xfer *xfer)
xfer->file = open (xfer->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
-
+
switch (pid = fork ())
{
/* fork failed */
@@ -272,7 +272,7 @@ xfer_network_recv_file_fork (struct t_xfer *xfer)
}
_exit (EXIT_SUCCESS);
}
-
+
/* parent process */
xfer->child_pid = pid;
close (xfer->child_write);
@@ -297,7 +297,7 @@ xfer_network_child_kill (struct t_xfer *xfer)
waitpid (xfer->child_pid, NULL, 0);
xfer->child_pid = 0;
}
-
+
/* close pipe used with child */
if (xfer->child_read != -1)
{
@@ -322,12 +322,12 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
int sock;
struct sockaddr_in addr;
socklen_t length;
-
+
/* make C compiler happy */
(void) fd;
-
+
xfer = (struct t_xfer *)arg_xfer;
-
+
if (xfer->status == XFER_STATUS_CONNECTING)
{
if (xfer->type == XFER_TYPE_FILE_SEND)
@@ -368,7 +368,7 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
xfer_network_send_file_fork (xfer);
}
}
-
+
if (xfer->status == XFER_STATUS_WAITING)
{
if (xfer->type == XFER_TYPE_CHAT_SEND)
@@ -410,7 +410,7 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
xfer_chat_open_buffer (xfer);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -423,12 +423,12 @@ int
xfer_network_timer_cb (void *arg_xfer, int remaining_calls)
{
struct t_xfer *xfer;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
xfer = (struct t_xfer *)arg_xfer;
-
+
if ((xfer->status == XFER_STATUS_WAITING)
|| (xfer->status == XFER_STATUS_CONNECTING))
{
@@ -439,7 +439,7 @@ xfer_network_timer_cb (void *arg_xfer, int remaining_calls)
xfer_close (xfer, XFER_STATUS_FAILED);
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
}
-
+
return WEECHAT_RC_OK;
}
@@ -454,14 +454,14 @@ xfer_network_connect (struct t_xfer *xfer)
xfer->status = XFER_STATUS_WAITING;
else
xfer->status = XFER_STATUS_CONNECTING;
-
+
if (xfer->sock < 0)
{
xfer->sock = socket (AF_INET, SOCK_STREAM, 0);
if (xfer->sock < 0)
return 0;
}
-
+
if (XFER_IS_SEND(xfer->type))
{
/* listen to socket */
@@ -476,7 +476,7 @@ xfer_network_connect (struct t_xfer *xfer)
1, 0, 0,
&xfer_network_fd_cb,
xfer);
-
+
/* add timeout */
if (weechat_config_integer (xfer_config_network_timeout) > 0)
{
@@ -486,7 +486,7 @@ xfer_network_connect (struct t_xfer *xfer)
xfer);
}
}
-
+
/* for chat receiving, connect to listening host */
if (xfer->type == XFER_TYPE_CHAT_RECV)
{
@@ -494,15 +494,15 @@ xfer_network_connect (struct t_xfer *xfer)
return 0;
weechat_network_connect_to (xfer->proxy, xfer->sock, xfer->address,
xfer->port);
-
+
xfer->hook_fd = weechat_hook_fd (xfer->sock,
1, 0, 0,
&xfer_chat_recv_cb,
xfer);
}
-
+
/* for file receiving, connection is made in child process (blocking) */
-
+
return 1;
}
diff --git a/src/plugins/xfer/xfer-upgrade.c b/src/plugins/xfer/xfer-upgrade.c
index 4c17a5c7d..b3c811796 100644
--- a/src/plugins/xfer/xfer-upgrade.c
+++ b/src/plugins/xfer/xfer-upgrade.c
@@ -52,15 +52,15 @@ xfer_upgrade_save ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME, 1);
if (!upgrade_file)
return 0;
-
+
rc = xfer_upgrade_save_xfers (upgrade_file);
-
+
weechat_upgrade_close (upgrade_file);
-
+
return rc;
}
@@ -74,7 +74,7 @@ xfer_upgrade_set_buffer_callbacks ()
{
struct t_infolist *infolist;
struct t_gui_buffer *ptr_buffer;
-
+
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
{
@@ -111,7 +111,7 @@ xfer_upgrade_read_cb (void *data,
(void) upgrade_file;
(void) object_id;
(void) infolist;
-
+
return WEECHAT_RC_OK;
}
@@ -125,11 +125,11 @@ xfer_upgrade_load ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
xfer_upgrade_set_buffer_callbacks ();
-
+
upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME, 0);
rc = weechat_upgrade_read (upgrade_file, &xfer_upgrade_read_cb, NULL);
-
+
return rc;
}
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index d15dc98df..7d84d0b63 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -61,7 +61,7 @@ char *xfer_type_string[] = /* strings for types */
char *xfer_protocol_string[] = /* strings for protocols */
{ "none", "dcc"
};
-
+
char *xfer_status_string[] = /* strings for status */
{ N_("waiting"), N_("connecting"),
N_("active"), N_("done"), N_("failed"),
@@ -85,17 +85,17 @@ int
xfer_valid (struct t_xfer *xfer)
{
struct t_xfer *ptr_xfer;
-
+
if (!xfer)
return 0;
-
+
for (ptr_xfer = xfer_list; ptr_xfer;
ptr_xfer = ptr_xfer->next_xfer)
{
if (ptr_xfer == xfer)
return 1;
}
-
+
/* xfer not found */
return 0;
}
@@ -113,9 +113,9 @@ xfer_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
xfer_signal_upgrade_received = 1;
-
+
return WEECHAT_RC_OK;
}
@@ -129,7 +129,7 @@ xfer_create_directories ()
{
const char *weechat_dir;
char *dir1, *dir2;
-
+
/* create download directory */
weechat_dir = weechat_info_get ("weechat_dir", "");
if (weechat_dir)
@@ -154,13 +154,13 @@ int
xfer_search_type (const char *type)
{
int i;
-
+
for (i = 0; i < XFER_NUM_TYPES; i++)
{
if (weechat_strcasecmp (xfer_type_string[i], type) == 0)
return i;
}
-
+
/* xfer type not found */
return -1;
}
@@ -174,13 +174,13 @@ int
xfer_search_protocol (const char *protocol)
{
int i;
-
+
for (i = 0; i < XFER_NUM_PROTOCOLS; i++)
{
if (weechat_strcasecmp (xfer_protocol_string[i], protocol) == 0)
return i;
}
-
+
/* xfer protocol not found */
return -1;
}
@@ -194,7 +194,7 @@ xfer_search (const char *plugin_name, const char *plugin_id, enum t_xfer_type ty
enum t_xfer_status status, int port)
{
struct t_xfer *ptr_xfer;
-
+
for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
{
if ((weechat_strcasecmp (ptr_xfer->plugin_name, plugin_name) == 0)
@@ -204,7 +204,7 @@ xfer_search (const char *plugin_name, const char *plugin_id, enum t_xfer_type ty
&& (ptr_xfer->port == port))
return ptr_xfer;
}
-
+
/* xfer not found */
return NULL;
}
@@ -218,7 +218,7 @@ xfer_search_by_number (int number)
{
struct t_xfer *ptr_xfer;
int i;
-
+
i = 0;
for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
{
@@ -226,7 +226,7 @@ xfer_search_by_number (int number)
return ptr_xfer;
i++;
}
-
+
/* xfer not found */
return NULL;
}
@@ -239,16 +239,16 @@ struct t_xfer *
xfer_search_by_buffer (struct t_gui_buffer *buffer)
{
struct t_xfer *ptr_xfer;
-
+
if (!buffer)
return NULL;
-
+
for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
{
if (ptr_xfer->buffer == buffer)
return ptr_xfer;
}
-
+
/* xfer not found */
return NULL;
}
@@ -261,13 +261,13 @@ void
xfer_close (struct t_xfer *xfer, enum t_xfer_status status)
{
struct stat st;
-
+
xfer->status = status;
-
+
if (XFER_HAS_ENDED(xfer->status))
{
xfer_send_signal (xfer, "xfer_ended");
-
+
if (xfer->hook_fd)
{
weechat_unhook (xfer->hook_fd);
@@ -309,7 +309,7 @@ xfer_close (struct t_xfer *xfer, enum t_xfer_status status)
xfer->address & 0xff);
}
}
-
+
/* remove empty file if received file failed and nothing was transfered */
if (((xfer->status == XFER_STATUS_FAILED)
|| (xfer->status == XFER_STATUS_ABORTED))
@@ -325,10 +325,10 @@ xfer_close (struct t_xfer *xfer, enum t_xfer_status status)
unlink (xfer->local_filename);
}
}
-
+
if (XFER_IS_FILE(xfer->type))
xfer_file_calculate_speed (xfer, 1);
-
+
if (xfer->sock >= 0)
{
close (xfer->sock);
@@ -350,14 +350,14 @@ int
xfer_port_in_use (int port)
{
struct t_xfer *ptr_xfer;
-
+
/* skip any currently used ports */
for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
{
if ((ptr_xfer->port == port) && (!XFER_HAS_ENDED(ptr_xfer->status)))
return 1;
}
-
+
/* port not in use */
return 0;
}
@@ -372,7 +372,7 @@ xfer_send_signal (struct t_xfer *xfer, const char *signal)
struct t_infolist *infolist;
struct t_infolist_item *item;
char str_long[128];
-
+
infolist = weechat_infolist_new ();
if (infolist)
{
@@ -406,7 +406,7 @@ xfer_send_signal (struct t_xfer *xfer, const char *signal)
str_long);
weechat_infolist_new_var_integer (item, "port",
xfer->port);
-
+
weechat_hook_signal_send (signal, WEECHAT_HOOK_SIGNAL_POINTER,
infolist);
}
@@ -423,13 +423,13 @@ xfer_alloc ()
{
struct t_xfer *new_xfer;
time_t time_now;
-
+
/* create new xfer struct */
if ((new_xfer = malloc (sizeof (*new_xfer))) == NULL)
return NULL;
time_now = time (NULL);
-
+
/* default values */
new_xfer->filename = NULL;
new_xfer->size = 0;
@@ -438,7 +438,7 @@ xfer_alloc ()
new_xfer->remote_nick = NULL;
new_xfer->local_nick = NULL;
new_xfer->charset_modifier = NULL;
-
+
new_xfer->type = 0;
new_xfer->protocol = 0;
new_xfer->status = 0;
@@ -466,7 +466,7 @@ xfer_alloc ()
new_xfer->last_activity = 0;
new_xfer->bytes_per_sec = 0;
new_xfer->eta = 0;
-
+
new_xfer->prev_xfer = NULL;
new_xfer->next_xfer = xfer_list;
if (xfer_list)
@@ -474,9 +474,9 @@ xfer_alloc ()
else
last_xfer = new_xfer;
xfer_list = new_xfer;
-
+
xfer_count++;
-
+
return new_xfer;
}
@@ -494,7 +494,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
{
struct t_xfer *new_xfer;
const char *ptr_color;
-
+
new_xfer = xfer_alloc ();
if (!new_xfer)
{
@@ -503,13 +503,13 @@ xfer_new (const char *plugin_name, const char *plugin_id,
weechat_prefix ("error"), XFER_PLUGIN_NAME);
return NULL;
}
-
+
if (!xfer_buffer
&& weechat_config_boolean (xfer_config_look_auto_open_buffer))
{
xfer_buffer_open ();
}
-
+
/* initialize new xfer */
new_xfer->plugin_name = strdup (plugin_name);
new_xfer->plugin_id = strdup (plugin_id);
@@ -528,14 +528,14 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->proxy = (proxy) ? strdup (proxy) : NULL;
new_xfer->address = address;
new_xfer->port = port;
-
+
new_xfer->status = XFER_STATUS_WAITING;
new_xfer->sock = sock;
if (local_filename)
new_xfer->local_filename = strdup (local_filename);
else
xfer_file_find_filename (new_xfer);
-
+
/* write info message on server buffer */
switch (type)
{
@@ -588,14 +588,14 @@ xfer_new (const char *plugin_name, const char *plugin_id,
case XFER_NUM_TYPES:
break;
}
-
+
if (XFER_IS_FILE(type) && (!new_xfer->local_filename))
{
xfer_close (new_xfer, XFER_STATUS_FAILED);
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
return NULL;
}
-
+
if (XFER_IS_FILE(type) && (new_xfer->start_resume > 0))
{
weechat_printf (NULL,
@@ -607,7 +607,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->start_resume);
xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE);
}
-
+
/* connect if needed and display again xfer buffer */
if (XFER_IS_SEND(type))
{
@@ -618,7 +618,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
return NULL;
}
}
-
+
if ( ( (type == XFER_TYPE_FILE_RECV)
&& (weechat_config_boolean (xfer_config_file_auto_accept_files)) )
|| ( (type == XFER_TYPE_CHAT_RECV)
@@ -626,7 +626,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
xfer_network_accept (new_xfer);
else
xfer_buffer_refresh (WEECHAT_HOTLIST_PRIVATE);
-
+
return new_xfer;
}
@@ -638,10 +638,10 @@ void
xfer_free (struct t_xfer *xfer)
{
struct t_xfer *new_xfer_list;
-
+
if (!xfer)
return;
-
+
/* remove xfer from list */
if (last_xfer == xfer)
last_xfer = xfer->prev_xfer;
@@ -654,7 +654,7 @@ xfer_free (struct t_xfer *xfer)
new_xfer_list = xfer->next_xfer;
if (xfer->next_xfer)
(xfer->next_xfer)->prev_xfer = xfer->prev_xfer;
-
+
/* free data */
if (xfer->plugin_id)
free (xfer->plugin_id);
@@ -672,11 +672,11 @@ xfer_free (struct t_xfer *xfer)
free (xfer->unterminated_message);
if (xfer->local_filename)
free (xfer->local_filename);
-
+
free (xfer);
-
+
xfer_list = new_xfer_list;
-
+
xfer_count--;
if (xfer_buffer_selected_line >= xfer_count)
xfer_buffer_selected_line = (xfer_count == 0) ? 0 : xfer_count - 1;
@@ -704,12 +704,12 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
unsigned long local_addr;
unsigned long long file_size;
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data)
{
weechat_printf (NULL,
@@ -717,9 +717,9 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME, "xfer_add");
return WEECHAT_RC_ERROR;
}
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (!weechat_infolist_next (infolist))
{
weechat_printf (NULL,
@@ -730,10 +730,10 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
filename2 = NULL;
short_filename = NULL;
-
+
sock = -1;
port = 0;
-
+
plugin_name = weechat_infolist_string (infolist, "plugin_name");
plugin_id = weechat_infolist_string (infolist, "plugin_id");
str_type = weechat_infolist_string (infolist, "type");
@@ -744,7 +744,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
filename = weechat_infolist_string (infolist, "filename");
proxy = weechat_infolist_string (infolist, "proxy");
protocol = XFER_NO_PROTOCOL;
-
+
if (!plugin_name || !plugin_id || !str_type || !remote_nick || !local_nick)
{
weechat_printf (NULL,
@@ -761,7 +761,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME, str_type);
goto error;
}
-
+
if (XFER_IS_FILE(type) && (!filename || !str_protocol))
{
weechat_printf (NULL,
@@ -769,7 +769,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME, "xfer_add");
goto error;
}
-
+
if (XFER_IS_FILE(type))
{
protocol = xfer_search_protocol (str_protocol);
@@ -782,17 +782,17 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
goto error;
}
}
-
+
filename2 = NULL;
file_size = 0;
port = 0;
-
+
if (type == XFER_TYPE_FILE_RECV)
{
filename2 = strdup (filename);
sscanf (weechat_infolist_string (infolist, "size"), "%llu", &file_size);
}
-
+
if (type == XFER_TYPE_FILE_SEND)
{
/* add home if filename not beginning with '/' or '~' (not for Win32) */
@@ -813,7 +813,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME);
goto error;
}
-
+
weechat_dir = weechat_info_get ("weechat_dir", "");
dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
if (!dir2)
@@ -857,7 +857,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
}
file_size = st.st_size;
}
-
+
if (XFER_IS_RECV(type))
{
sscanf (weechat_infolist_string (infolist, "address"), "%lu", &local_addr);
@@ -867,11 +867,11 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
{
/* get local IP address */
sscanf (weechat_infolist_string (infolist, "address"), "%lu", &local_addr);
-
+
memset (&addr, 0, sizeof (struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl (local_addr);
-
+
/* look up the IP address from network_own_ip, if set */
if (weechat_config_string(xfer_config_network_own_ip)
&& weechat_config_string(xfer_config_network_own_ip)[0])
@@ -900,7 +900,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
weechat_config_string (xfer_config_network_own_ip));
}
}
-
+
/* open socket for xfer */
sock = socket (AF_INET, SOCK_STREAM, 0);
if (sock < 0)
@@ -912,10 +912,10 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
free (filename2);
goto error;
}
-
+
/* look for port */
port = 0;
-
+
if (weechat_config_string (xfer_config_network_port_range)
&& weechat_config_string (xfer_config_network_port_range)[0])
{
@@ -927,7 +927,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
port = port_start;
if (args == 1)
port_end = port_start;
-
+
/* loop through the entire allowed port range */
while (port <= port_end)
{
@@ -940,12 +940,12 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
}
port++;
}
-
+
if (port > port_end)
port = -1;
}
}
-
+
if (port == 0)
{
/* find port automatically */
@@ -959,7 +959,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
else
port = -1;
}
-
+
if (port == -1)
{
/* Could not find any port to bind */
@@ -972,7 +972,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
goto error;
}
}
-
+
if (XFER_IS_FILE(type))
{
/* extract short filename (without path) */
@@ -981,7 +981,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
short_filename = strdup (pos + 1);
else
short_filename = strdup (filename2);
-
+
/* convert spaces to underscore if asked and needed */
pos = short_filename;
while (pos[0])
@@ -1003,7 +1003,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
filename2 = NULL;
}
}
-
+
/* add xfer entry and listen to socket if type is file or chat "send" */
if (XFER_IS_FILE(type))
ptr_xfer = xfer_new (plugin_name, plugin_id, type, protocol,
@@ -1014,7 +1014,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
ptr_xfer = xfer_new (plugin_name, plugin_id, type, protocol,
remote_nick, local_nick, charset_modifier, NULL,
0, proxy, local_addr, port, sock, NULL);
-
+
if (!ptr_xfer)
{
weechat_printf (NULL,
@@ -1027,19 +1027,19 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
free (filename2);
goto error;
}
-
+
/* send signal if type is file or chat "send" */
if (XFER_IS_SEND(ptr_xfer->type) && !XFER_HAS_ENDED(ptr_xfer->status))
xfer_send_signal (ptr_xfer, "xfer_send_ready");
-
+
if (short_filename)
free (short_filename);
if (filename2)
free (filename2);
-
+
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_OK;
-
+
error:
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_ERROR;
@@ -1058,12 +1058,12 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long long start_resume;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data)
{
weechat_printf (NULL,
@@ -1072,9 +1072,9 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
"xfer_start_resume");
return WEECHAT_RC_ERROR;
}
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (!weechat_infolist_next (infolist))
{
weechat_printf (NULL,
@@ -1098,9 +1098,9 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
"xfer_start_resume");
goto error;
}
-
+
sscanf (str_start_resume, "%llu", &start_resume);
-
+
ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_RECV,
XFER_STATUS_CONNECTING, port);
if (ptr_xfer)
@@ -1120,10 +1120,10 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME, filename,
port, start_resume);
}
-
+
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_OK;
-
+
error:
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_ERROR;
@@ -1143,12 +1143,12 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long long start_resume;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data)
{
weechat_printf (NULL,
@@ -1157,9 +1157,9 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
"xfer_accept_resume");
return WEECHAT_RC_ERROR;
}
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (!weechat_infolist_next (infolist))
{
weechat_printf (NULL,
@@ -1183,9 +1183,9 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
"xfer_accept_resume");
goto error;
}
-
+
sscanf (str_start_resume, "%llu", &start_resume);
-
+
ptr_xfer = xfer_search (plugin_name, plugin_id, XFER_TYPE_FILE_SEND,
XFER_STATUS_CONNECTING, port);
if (ptr_xfer)
@@ -1195,7 +1195,7 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
ptr_xfer->start_resume = start_resume;
ptr_xfer->last_check_pos = start_resume;
xfer_send_signal (ptr_xfer, "xfer_send_accept_resume");
-
+
weechat_printf (NULL,
_("%s: file %s resumed at position %llu"),
XFER_PLUGIN_NAME,
@@ -1212,10 +1212,10 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
weechat_prefix ("error"), XFER_PLUGIN_NAME, filename,
port, start_resume);
}
-
+
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_OK;
-
+
error:
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_ERROR;
@@ -1231,14 +1231,14 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer)
{
struct t_infolist_item *ptr_item;
char value[128];
-
+
if (!infolist || !xfer)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "plugin_name", xfer->plugin_name))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "plugin_id", xfer->plugin_id))
@@ -1328,7 +1328,7 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer)
snprintf (value, sizeof (value), "%llu", xfer->eta);
if (!weechat_infolist_new_var_string (ptr_item, "eta", value))
return 0;
-
+
return 1;
}
@@ -1340,7 +1340,7 @@ void
xfer_print_log ()
{
struct t_xfer *ptr_xfer;
-
+
for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
{
weechat_log_printf ("");
@@ -1361,7 +1361,7 @@ xfer_print_log ()
weechat_log_printf (" proxy . . . . . . . : '%s'", ptr_xfer->proxy);
weechat_log_printf (" address . . . . . . : %lu", ptr_xfer->address);
weechat_log_printf (" port. . . . . . . . : %d", ptr_xfer->port);
-
+
weechat_log_printf (" status. . . . . . . : %d (%s)",
ptr_xfer->status,
xfer_status_string[ptr_xfer->status]);
@@ -1406,21 +1406,21 @@ xfer_debug_dump_cb (void *data, const char *signal, const char *type_data,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, XFER_PLUGIN_NAME) == 0))
{
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
xfer_print_log ();
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1432,29 +1432,29 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int i, upgrading;
-
+
weechat_plugin = plugin;
-
+
if (!xfer_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (xfer_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
xfer_create_directories ();
-
+
xfer_command_init ();
-
+
/* hook some signals */
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);
weechat_hook_signal ("debug_dump", &xfer_debug_dump_cb, NULL);
-
+
/* hook completions */
xfer_completion_init ();
-
+
xfer_info_init ();
/* look at arguments */
@@ -1464,10 +1464,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
if (weechat_strcasecmp (argv[i], "--upgrade") == 0)
upgrading = 1;
}
-
+
if (upgrading)
xfer_upgrade_load ();
-
+
return WEECHAT_RC_OK;
}
@@ -1479,12 +1479,12 @@ int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
struct t_xfer *ptr_xfer;
-
+
/* make C compiler happy */
(void) plugin;
-
+
xfer_config_write ();
-
+
if (xfer_signal_upgrade_received)
xfer_upgrade_save ();
else
@@ -1508,6 +1508,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
}
}
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/xfer/xfer.h b/src/plugins/xfer/xfer.h
index 8525c8d35..d5694f949 100644
--- a/src/plugins/xfer/xfer.h
+++ b/src/plugins/xfer/xfer.h
@@ -60,7 +60,7 @@ enum t_xfer_status
/* number of xfer status */
XFER_NUM_STATUS,
};
-
+
/* xfer errors */
enum t_xfer_error
@@ -121,7 +121,7 @@ struct t_xfer
char *proxy; /* proxy to use (optional) */
unsigned long address; /* local or remote IP address */
int port; /* remote port */
-
+
/* internal data */
enum t_xfer_status status; /* xfer status (waiting, sending,..) */
struct t_gui_buffer *buffer; /* buffer (for chat only) */