mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 22:06:38 +02:00
core: remove directory "src/plugins/scripts", move script plugins in "src/plugins"
This commit is contained in:
+6
-7
@@ -1108,13 +1108,12 @@ AC_OUTPUT([Makefile
|
||||
src/plugins/logger/Makefile
|
||||
src/plugins/relay/Makefile
|
||||
src/plugins/rmodifier/Makefile
|
||||
src/plugins/scripts/Makefile
|
||||
src/plugins/scripts/perl/Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/Makefile
|
||||
src/plugins/scripts/lua/Makefile
|
||||
src/plugins/scripts/tcl/Makefile
|
||||
src/plugins/scripts/guile/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/plugins/python/Makefile
|
||||
src/plugins/ruby/Makefile
|
||||
src/plugins/lua/Makefile
|
||||
src/plugins/tcl/Makefile
|
||||
src/plugins/guile/Makefile
|
||||
src/plugins/xfer/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
|
||||
+35
-38
@@ -62,13 +62,12 @@ The main WeeChat directories are:
|
||||
| logger/ | Logger plugin (write messages displayed to files)
|
||||
| relay/ | Relay plugin (irc proxy + relay for remote interfaces)
|
||||
| rmodifier/ | Rmodifier plugin (alter modifier strings with regular expressions)
|
||||
| scripts/ | Script plugins
|
||||
| python/ | Python scripting API
|
||||
| perl/ | Perl scripting API
|
||||
| ruby/ | Ruby scripting API
|
||||
| lua/ | Lua scripting API
|
||||
| tcl/ | Tcl scripting API
|
||||
| guile/ | Guile (scheme) scripting API
|
||||
| python/ | Python scripting API
|
||||
| perl/ | Perl scripting API
|
||||
| ruby/ | Ruby scripting API
|
||||
| lua/ | Lua scripting API
|
||||
| tcl/ | Tcl scripting API
|
||||
| guile/ | Guile (scheme) scripting API
|
||||
| xfer/ | Xfer (IRC DCC file/chat)
|
||||
| doc/ | Documentation
|
||||
| po/ | Translations files (gettext)
|
||||
@@ -165,6 +164,9 @@ Plugins
|
||||
| plugin.c | Plugins management (load/unload dynamic C libraries)
|
||||
| plugin-api.c | Extra functions for plugin API (wrapper around WeeChat core functions)
|
||||
| plugin-config.c | Plugin configuration options (file plugins.conf)
|
||||
| plugin-script.c | Common functions used by script plugins
|
||||
| plugin-script-api.c | Script API functions: wrappers around some plugin API functions
|
||||
| plugin-script-callback.c | Callback management for scripts
|
||||
| weechat-plugin.h | Header designed to be distributed with WeeChat plugins, in order to compile them
|
||||
| alias/ | Alias plugin
|
||||
| alias.c | Main alias functions
|
||||
@@ -181,6 +183,9 @@ Plugins
|
||||
| fifo/ | Fifo plugin
|
||||
| fifo.c | Main fifo functions
|
||||
| fifo-info.c | Info and infolists from fifo plugin
|
||||
| guile/ | Guile (scheme) plugin
|
||||
| weechat-guile.c | Main guile functions (load/unload scripts, execute guile code)
|
||||
| weechat-guile-api.c | Guile scripting API functions
|
||||
| irc/ | IRC (Internet Relay Chat) plugin
|
||||
| irc.c | Main IRC functions
|
||||
| irc-bar-item.c | IRC bar items
|
||||
@@ -213,6 +218,15 @@ Plugins
|
||||
| logger-config.c | Logger config options
|
||||
| logger-info.c | Info and infolists from logger plugin
|
||||
| logger-tail.c | Return last lines of a file
|
||||
| lua/ | Lua plugin
|
||||
| weechat-lua.c | Main lua functions (load/unload scripts, execute lua code)
|
||||
| weechat-lua-api.c | Lua scripting API functions
|
||||
| perl/ | Perl plugin
|
||||
| weechat-perl.c | Main perl functions (load/unload scripts, execute perl code)
|
||||
| weechat-perl-api.c | Perl scripting API functions
|
||||
| python/ | Python plugin
|
||||
| weechat-python.c | Main python functions (load/unload scripts, execute python code)
|
||||
| weechat-python-api.c | Python scripting API functions
|
||||
| relay/ | Relay plugin (IRC proxy and relay for remote interfaces)
|
||||
| relay.c | Main relay functions
|
||||
| relay-buffer.c | Relay buffer
|
||||
@@ -238,28 +252,12 @@ Plugins
|
||||
| rmodifier-config.c | Rmodifier config options
|
||||
| rmodifier-debug.c | Rmodifier debug functions
|
||||
| rmodifier-info.c | Info and infolists from rmodifier plugin
|
||||
| scripts/ | Scripting API
|
||||
| script.c | Common functions used by script plugins
|
||||
| script-api.c | Script API functions: wrappers around some plugin API functions
|
||||
| script-callback.c | Callback management for scripts
|
||||
| python/ | Python plugin
|
||||
| weechat-python.c | Main python functions (load/unload scripts, execute python code)
|
||||
| weechat-python-api.c | Python scripting API functions
|
||||
| perl/ | Perl plugin
|
||||
| weechat-perl.c | Main perl functions (load/unload scripts, execute perl code)
|
||||
| weechat-perl-api.c | Perl scripting API functions
|
||||
| ruby/ | Ruby plugin
|
||||
| weechat-ruby.c | Main ruby functions (load/unload scripts, execute ruby code)
|
||||
| weechat-ruby-api.c | Ruby scripting API functions
|
||||
| lua/ | Lua plugin
|
||||
| weechat-lua.c | Main lua functions (load/unload scripts, execute lua code)
|
||||
| weechat-lua-api.c | Lua scripting API functions
|
||||
| tcl/ | Tcl plugin
|
||||
| weechat-tcl.c | Main tcl functions (load/unload scripts, execute tcl code)
|
||||
| weechat-tcl-api.c | Tcl scripting API functions
|
||||
| guile/ | Guile (scheme) plugin
|
||||
| weechat-guile.c | Main guile functions (load/unload scripts, execute guile code)
|
||||
| weechat-guile-api.c | Guile scripting API functions
|
||||
| ruby/ | Ruby plugin
|
||||
| weechat-ruby.c | Main ruby functions (load/unload scripts, execute ruby code)
|
||||
| weechat-ruby-api.c | Ruby scripting API functions
|
||||
| tcl/ | Tcl plugin
|
||||
| weechat-tcl.c | Main tcl functions (load/unload scripts, execute tcl code)
|
||||
| weechat-tcl-api.c | Tcl scripting API functions
|
||||
| xfer/ | Xfer plugin (IRC DCC file/chat)
|
||||
| xfer.c | Main xfer functions
|
||||
| xfer-buffer.c | Xfer buffer
|
||||
@@ -587,14 +585,13 @@ Examples:
|
||||
|
||||
[width="100%",cols="1l,5",options="header"]
|
||||
|========================================
|
||||
| Directory | Files
|
||||
| src/core/ | weechat.c, wee-backtrace.c, wee-command.c, ...
|
||||
| src/gui/ | gui-bar.c, gui-bar-item.c, gui-bar-window.c, ...
|
||||
| src/gui/curses/ | gui-curses-bar.c, gui-curses-bar-window.c, gui-curses-chat.c, ...
|
||||
| src/plugins/ | plugin.c, plugin-api.c, plugin-config.c, ...
|
||||
| src/plugins/irc/ | irc.c, irc-bar-item.c, irc-buffer.c, ...
|
||||
| src/plugins/scripts/ | script.c, script-api.c, script-callback.c, ...
|
||||
| src/plugins/scripts/python/ | weechat-python.c, weechat-python-api.c, ...
|
||||
| Directory | Files
|
||||
| src/core/ | weechat.c, wee-backtrace.c, wee-command.c, ...
|
||||
| src/gui/ | gui-bar.c, gui-bar-item.c, gui-bar-window.c, ...
|
||||
| src/gui/curses/ | gui-curses-bar.c, gui-curses-bar-window.c, gui-curses-chat.c, ...
|
||||
| src/plugins/ | plugin.c, plugin-api.c, plugin-config.c, plugin-script.c, ...
|
||||
| src/plugins/irc/ | irc.c, irc-bar-item.c, irc-buffer.c, ...
|
||||
| src/plugins/python/ | weechat-python.c, weechat-python-api.c, ...
|
||||
|========================================
|
||||
|
||||
The headers of C files have same name as file, for example 'wee-command.h' for
|
||||
@@ -992,7 +989,7 @@ $ msg_check_lines.py xx.po
|
||||
The `msgfmt` will perform checks on message catalog and display errors, like bad
|
||||
use of format specifiers in strings.
|
||||
|
||||
The scripts msg_check_lines.py (http://www.weechat.org/files/temp/po/msg_check_lines.py)
|
||||
The script msg_check_lines.py (http://www.weechat.org/files/temp/po/msg_check_lines.py)
|
||||
will check number of lines in translated strings (which must be the same as
|
||||
string in english).
|
||||
|
||||
|
||||
+30
-30
@@ -217,36 +217,36 @@
|
||||
./src/plugins/rmodifier/rmodifier.h
|
||||
./src/plugins/rmodifier/rmodifier-info.c
|
||||
./src/plugins/rmodifier/rmodifier-info.h
|
||||
./src/plugins/scripts/guile/weechat-guile-api.c
|
||||
./src/plugins/scripts/guile/weechat-guile-api.h
|
||||
./src/plugins/scripts/guile/weechat-guile.c
|
||||
./src/plugins/scripts/guile/weechat-guile.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
./src/plugins/scripts/lua/weechat-lua-api.h
|
||||
./src/plugins/scripts/lua/weechat-lua.c
|
||||
./src/plugins/scripts/lua/weechat-lua.h
|
||||
./src/plugins/scripts/perl/weechat-perl-api.c
|
||||
./src/plugins/scripts/perl/weechat-perl-api.h
|
||||
./src/plugins/scripts/perl/weechat-perl.c
|
||||
./src/plugins/scripts/perl/weechat-perl.h
|
||||
./src/plugins/scripts/python/weechat-python-api.c
|
||||
./src/plugins/scripts/python/weechat-python-api.h
|
||||
./src/plugins/scripts/python/weechat-python.c
|
||||
./src/plugins/scripts/python/weechat-python.h
|
||||
./src/plugins/scripts/ruby/weechat-ruby-api.c
|
||||
./src/plugins/scripts/ruby/weechat-ruby-api.h
|
||||
./src/plugins/scripts/ruby/weechat-ruby.c
|
||||
./src/plugins/scripts/ruby/weechat-ruby.h
|
||||
./src/plugins/scripts/script-api.c
|
||||
./src/plugins/scripts/script-api.h
|
||||
./src/plugins/scripts/script.c
|
||||
./src/plugins/scripts/script-callback.c
|
||||
./src/plugins/scripts/script-callback.h
|
||||
./src/plugins/scripts/script.h
|
||||
./src/plugins/scripts/tcl/weechat-tcl-api.c
|
||||
./src/plugins/scripts/tcl/weechat-tcl-api.h
|
||||
./src/plugins/scripts/tcl/weechat-tcl.c
|
||||
./src/plugins/scripts/tcl/weechat-tcl.h
|
||||
./src/plugins/guile/weechat-guile-api.c
|
||||
./src/plugins/guile/weechat-guile-api.h
|
||||
./src/plugins/guile/weechat-guile.c
|
||||
./src/plugins/guile/weechat-guile.h
|
||||
./src/plugins/lua/weechat-lua-api.c
|
||||
./src/plugins/lua/weechat-lua-api.h
|
||||
./src/plugins/lua/weechat-lua.c
|
||||
./src/plugins/lua/weechat-lua.h
|
||||
./src/plugins/perl/weechat-perl-api.c
|
||||
./src/plugins/perl/weechat-perl-api.h
|
||||
./src/plugins/perl/weechat-perl.c
|
||||
./src/plugins/perl/weechat-perl.h
|
||||
./src/plugins/python/weechat-python-api.c
|
||||
./src/plugins/python/weechat-python-api.h
|
||||
./src/plugins/python/weechat-python.c
|
||||
./src/plugins/python/weechat-python.h
|
||||
./src/plugins/ruby/weechat-ruby-api.c
|
||||
./src/plugins/ruby/weechat-ruby-api.h
|
||||
./src/plugins/ruby/weechat-ruby.c
|
||||
./src/plugins/ruby/weechat-ruby.h
|
||||
./src/plugins/plugin-script-api.c
|
||||
./src/plugins/plugin-script-api.h
|
||||
./src/plugins/plugin-script.c
|
||||
./src/plugins/plugin-script-callback.c
|
||||
./src/plugins/plugin-script-callback.h
|
||||
./src/plugins/plugin-script.h
|
||||
./src/plugins/tcl/weechat-tcl-api.c
|
||||
./src/plugins/tcl/weechat-tcl-api.h
|
||||
./src/plugins/tcl/weechat-tcl.c
|
||||
./src/plugins/tcl/weechat-tcl.h
|
||||
./src/plugins/weechat-plugin.h
|
||||
./src/plugins/xfer/xfer-buffer.c
|
||||
./src/plugins/xfer/xfer-buffer.h
|
||||
|
||||
+30
-30
@@ -218,36 +218,36 @@ SET(WEECHAT_SOURCES
|
||||
./src/plugins/rmodifier/rmodifier.h
|
||||
./src/plugins/rmodifier/rmodifier-info.c
|
||||
./src/plugins/rmodifier/rmodifier-info.h
|
||||
./src/plugins/scripts/guile/weechat-guile-api.c
|
||||
./src/plugins/scripts/guile/weechat-guile-api.h
|
||||
./src/plugins/scripts/guile/weechat-guile.c
|
||||
./src/plugins/scripts/guile/weechat-guile.h
|
||||
./src/plugins/scripts/lua/weechat-lua-api.c
|
||||
./src/plugins/scripts/lua/weechat-lua-api.h
|
||||
./src/plugins/scripts/lua/weechat-lua.c
|
||||
./src/plugins/scripts/lua/weechat-lua.h
|
||||
./src/plugins/scripts/perl/weechat-perl-api.c
|
||||
./src/plugins/scripts/perl/weechat-perl-api.h
|
||||
./src/plugins/scripts/perl/weechat-perl.c
|
||||
./src/plugins/scripts/perl/weechat-perl.h
|
||||
./src/plugins/scripts/python/weechat-python-api.c
|
||||
./src/plugins/scripts/python/weechat-python-api.h
|
||||
./src/plugins/scripts/python/weechat-python.c
|
||||
./src/plugins/scripts/python/weechat-python.h
|
||||
./src/plugins/scripts/ruby/weechat-ruby-api.c
|
||||
./src/plugins/scripts/ruby/weechat-ruby-api.h
|
||||
./src/plugins/scripts/ruby/weechat-ruby.c
|
||||
./src/plugins/scripts/ruby/weechat-ruby.h
|
||||
./src/plugins/scripts/script-api.c
|
||||
./src/plugins/scripts/script-api.h
|
||||
./src/plugins/scripts/script.c
|
||||
./src/plugins/scripts/script-callback.c
|
||||
./src/plugins/scripts/script-callback.h
|
||||
./src/plugins/scripts/script.h
|
||||
./src/plugins/scripts/tcl/weechat-tcl-api.c
|
||||
./src/plugins/scripts/tcl/weechat-tcl-api.h
|
||||
./src/plugins/scripts/tcl/weechat-tcl.c
|
||||
./src/plugins/scripts/tcl/weechat-tcl.h
|
||||
./src/plugins/guile/weechat-guile-api.c
|
||||
./src/plugins/guile/weechat-guile-api.h
|
||||
./src/plugins/guile/weechat-guile.c
|
||||
./src/plugins/guile/weechat-guile.h
|
||||
./src/plugins/lua/weechat-lua-api.c
|
||||
./src/plugins/lua/weechat-lua-api.h
|
||||
./src/plugins/lua/weechat-lua.c
|
||||
./src/plugins/lua/weechat-lua.h
|
||||
./src/plugins/perl/weechat-perl-api.c
|
||||
./src/plugins/perl/weechat-perl-api.h
|
||||
./src/plugins/perl/weechat-perl.c
|
||||
./src/plugins/perl/weechat-perl.h
|
||||
./src/plugins/python/weechat-python-api.c
|
||||
./src/plugins/python/weechat-python-api.h
|
||||
./src/plugins/python/weechat-python.c
|
||||
./src/plugins/python/weechat-python.h
|
||||
./src/plugins/ruby/weechat-ruby-api.c
|
||||
./src/plugins/ruby/weechat-ruby-api.h
|
||||
./src/plugins/ruby/weechat-ruby.c
|
||||
./src/plugins/ruby/weechat-ruby.h
|
||||
./src/plugins/plugin-script-api.c
|
||||
./src/plugins/plugin-script-api.h
|
||||
./src/plugins/plugin-script.c
|
||||
./src/plugins/plugin-script-callback.c
|
||||
./src/plugins/plugin-script-callback.h
|
||||
./src/plugins/plugin-script.h
|
||||
./src/plugins/tcl/weechat-tcl-api.c
|
||||
./src/plugins/tcl/weechat-tcl-api.h
|
||||
./src/plugins/tcl/weechat-tcl.c
|
||||
./src/plugins/tcl/weechat-tcl.h
|
||||
./src/plugins/weechat-plugin.h
|
||||
./src/plugins/xfer/xfer-buffer.c
|
||||
./src/plugins/xfer/xfer-buffer.h
|
||||
|
||||
@@ -24,9 +24,17 @@ plugin.c plugin.h
|
||||
plugin-api.c plugin-api.h
|
||||
plugin-config.h plugin-config.c)
|
||||
|
||||
SET(LIB_PLUGINS_SCRIPTS_SRC
|
||||
plugin-script.c plugin-script.h
|
||||
plugin-script-api.c plugin-script-api.h
|
||||
plugin-script-callback.c plugin-script-callback.h)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_LIBRARY(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
|
||||
|
||||
ADD_DEFINITIONS(${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||
ADD_LIBRARY(weechat_plugins_scripts STATIC ${LIB_PLUGINS_SCRIPTS_SRC})
|
||||
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
@@ -74,12 +82,50 @@ IF(ENABLE_RMODIFIER)
|
||||
ADD_SUBDIRECTORY( rmodifier )
|
||||
ENDIF(ENABLE_RMODIFIER)
|
||||
|
||||
IF(ENABLE_SCRIPTS OR ENABLE_PERL OR ENABLE_PYTHON OR ENABLE_RUBY OR ENABLE_LUA OR ENABLE_TCL OR ENABLE_GUILE)
|
||||
ADD_SUBDIRECTORY( scripts )
|
||||
ENDIF(ENABLE_SCRIPTS OR ENABLE_PERL OR ENABLE_PYTHON OR ENABLE_RUBY OR ENABLE_LUA OR ENABLE_TCL OR ENABLE_GUILE)
|
||||
|
||||
IF(ENABLE_XFER)
|
||||
ADD_SUBDIRECTORY( xfer )
|
||||
ENDIF(ENABLE_XFER)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_PERL)
|
||||
FIND_PACKAGE(Perl)
|
||||
IF(PERL_FOUND)
|
||||
ADD_SUBDIRECTORY( perl )
|
||||
ENDIF(PERL_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_PERL)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_PYTHON)
|
||||
FIND_PACKAGE(Python)
|
||||
IF(PYTHON_FOUND)
|
||||
ADD_SUBDIRECTORY( python )
|
||||
ENDIF(PYTHON_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_PYTHON)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_RUBY)
|
||||
FIND_PACKAGE(Ruby)
|
||||
IF(RUBY_FOUND)
|
||||
ADD_SUBDIRECTORY( ruby )
|
||||
ENDIF(RUBY_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_RUBY)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_LUA)
|
||||
FIND_PACKAGE(Lua)
|
||||
IF(LUA_FOUND)
|
||||
ADD_SUBDIRECTORY( lua )
|
||||
ENDIF(LUA_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_LUA)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_TCL)
|
||||
FIND_PACKAGE(TCL)
|
||||
IF(TCL_FOUND)
|
||||
ADD_SUBDIRECTORY( tcl )
|
||||
ENDIF(TCL_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_TCL)
|
||||
|
||||
IF(ENABLE_SCRIPTS AND ENABLE_GUILE)
|
||||
FIND_PACKAGE(Guile)
|
||||
IF(GUILE_FOUND)
|
||||
ADD_SUBDIRECTORY( guile )
|
||||
ENDIF(GUILE_FOUND)
|
||||
ENDIF(ENABLE_SCRIPTS AND ENABLE_GUILE)
|
||||
|
||||
INSTALL(FILES weechat-plugin.h DESTINATION ${INCLUDEDIR})
|
||||
|
||||
+35
-25
@@ -30,6 +30,15 @@ lib_weechat_plugins_a_SOURCES = weechat-plugin.h \
|
||||
plugin-config.c \
|
||||
plugin-config.h
|
||||
|
||||
noinst_LTLIBRARIES = lib_weechat_plugins_scripts.la
|
||||
|
||||
lib_weechat_plugins_scripts_la_SOURCES = plugin-script.c \
|
||||
plugin-script.h \
|
||||
plugin-script-callback.c \
|
||||
plugin-script-callback.h \
|
||||
plugin-script-api.c \
|
||||
plugin-script-api.h
|
||||
|
||||
if PLUGIN_ALIAS
|
||||
alias_dir = alias
|
||||
endif
|
||||
@@ -66,37 +75,38 @@ if PLUGIN_RMODIFIER
|
||||
rmodifier_dir = rmodifier
|
||||
endif
|
||||
|
||||
if PLUGIN_PERL
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_RUBY
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_LUA
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_TCL
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_GUILE
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_XFER
|
||||
xfer_dir = xfer
|
||||
endif
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
endif
|
||||
|
||||
if PLUGIN_RUBY
|
||||
ruby_dir = ruby
|
||||
endif
|
||||
|
||||
if PLUGIN_LUA
|
||||
lua_dir = lua
|
||||
endif
|
||||
|
||||
if PLUGIN_TCL
|
||||
tcl_dir = tcl
|
||||
endif
|
||||
|
||||
if PLUGIN_GUILE
|
||||
guile_dir = guile
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(alias_dir) $(aspell_dir) $(charset_dir) $(demo_dir) $(fifo_dir) \
|
||||
$(irc_dir) $(logger_dir) $(relay_dir) $(rmodifier_dir) \
|
||||
$(script_dir) $(xfer_dir)
|
||||
$(xfer_dir) $(perl_dir) $(python_dir) $(ruby_dir) $(lua_dir) \
|
||||
$(tcl_dir) $(guile_dir)
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ SET_TARGET_PROPERTIES(guile PROPERTIES PREFIX "")
|
||||
IF(GUILE_FOUND)
|
||||
INCLUDE_DIRECTORIES(${GUILE_INCLUDE_DIRS})
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GUILE_LFLAGS}")
|
||||
TARGET_LINK_LIBRARIES(guile ${GUILE_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(guile ${GUILE_LIBRARY} weechat_plugins_scripts)
|
||||
ENDIF(GUILE_FOUND)
|
||||
|
||||
INSTALL(TARGETS guile LIBRARY DESTINATION ${LIBDIR}/plugins)
|
||||
+412
-409
File diff suppressed because it is too large
Load Diff
@@ -29,8 +29,8 @@
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-guile.h"
|
||||
#include "weechat-guile-api.h"
|
||||
|
||||
@@ -348,9 +348,9 @@ weechat_guile_module_init_script (void *data)
|
||||
/* if script was registered, remove it from list */
|
||||
if (guile_current_script)
|
||||
{
|
||||
script_remove (weechat_guile_plugin,
|
||||
&guile_scripts, &last_guile_script,
|
||||
guile_current_script);
|
||||
plugin_script_remove (weechat_guile_plugin,
|
||||
&guile_scripts, &last_guile_script,
|
||||
guile_current_script);
|
||||
}
|
||||
guile_current_script = NULL;
|
||||
guile_registered_script = NULL;
|
||||
@@ -406,11 +406,11 @@ weechat_guile_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
guile_current_script,
|
||||
&weechat_guile_api_buffer_input_data_cb,
|
||||
&weechat_guile_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
guile_current_script,
|
||||
&weechat_guile_api_buffer_input_data_cb,
|
||||
&weechat_guile_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -459,8 +459,8 @@ weechat_guile_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_guile_plugin, &guile_scripts, &last_guile_script,
|
||||
script);
|
||||
|
||||
if (interpreter)
|
||||
weechat_guile_catch (scm_gc_unprotect_object, interpreter);
|
||||
@@ -475,7 +475,7 @@ weechat_guile_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_guile_plugin, guile_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_guile_plugin, guile_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_guile_unload (ptr_script);
|
||||
@@ -514,7 +514,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);
|
||||
ptr_script = plugin_script_search (weechat_guile_plugin, guile_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -553,29 +553,29 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_guile_plugin, &weechat_guile_load_cb);
|
||||
plugin_script_auto_load (weechat_guile_plugin, &weechat_guile_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_guile_unload_all ();
|
||||
script_auto_load (weechat_guile_plugin, &weechat_guile_load_cb);
|
||||
plugin_script_auto_load (weechat_guile_plugin, &weechat_guile_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -586,19 +586,19 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_guile_plugin, guile_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Guile script */
|
||||
path_script = script_search_path (weechat_guile_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_guile_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_guile_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -651,7 +651,7 @@ weechat_guile_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_guile_plugin, completion, guile_scripts);
|
||||
plugin_script_completion (weechat_guile_plugin, completion, guile_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -672,9 +672,9 @@ weechat_guile_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "guile_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_guile_plugin,
|
||||
guile_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_guile_plugin,
|
||||
guile_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -697,7 +697,7 @@ weechat_guile_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, GUILE_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_guile_plugin, guile_scripts);
|
||||
plugin_script_print_log (weechat_guile_plugin, guile_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -719,7 +719,7 @@ weechat_guile_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (guile_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (guile_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -738,18 +738,18 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &guile_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
&weechat_guile_unload,
|
||||
&weechat_guile_load,
|
||||
&guile_action_install_list);
|
||||
plugin_script_action_install (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
&weechat_guile_unload,
|
||||
&weechat_guile_load,
|
||||
&guile_action_install_list);
|
||||
}
|
||||
else if (data == &guile_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
&weechat_guile_unload,
|
||||
&guile_action_remove_list);
|
||||
plugin_script_action_remove (weechat_guile_plugin,
|
||||
guile_scripts,
|
||||
&weechat_guile_unload,
|
||||
&guile_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,16 +773,16 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "guile_script_install") == 0)
|
||||
{
|
||||
script_action_add (&guile_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&guile_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_guile_timer_action_cb,
|
||||
&guile_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "guile_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&guile_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&guile_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_guile_timer_action_cb,
|
||||
&guile_action_remove_list);
|
||||
@@ -877,11 +877,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_guile_load_cb;
|
||||
|
||||
guile_quiet = 1;
|
||||
script_init (weechat_guile_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_guile_plugin, argc, argv, &init);
|
||||
guile_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_guile_plugin,
|
||||
guile_scripts);
|
||||
plugin_script_display_short_list (weechat_guile_plugin,
|
||||
guile_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -896,7 +896,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
guile_quiet = 1;
|
||||
script_end (plugin, &guile_scripts, &weechat_guile_unload_all);
|
||||
plugin_script_end (plugin, &guile_scripts, &weechat_guile_unload_all);
|
||||
guile_quiet = 0;
|
||||
|
||||
/* unprotect module */
|
||||
@@ -26,9 +26,9 @@ SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "")
|
||||
IF(LUA_FOUND)
|
||||
INCLUDE_DIRECTORIES(${LUA_INCLUDE_PATH} )
|
||||
IF(LUA_LIBRARY AND LUALIB_LIBRARY)
|
||||
TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} ${LUALIB_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} ${LUALIB_LIBRARY} weechat_plugins_scripts)
|
||||
ELSE(LUA_LIBRARY AND LUALIB_LIBRARY)
|
||||
TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} weechat_plugins_scripts)
|
||||
ENDIF(LUA_LIBRARY AND LUALIB_LIBRARY)
|
||||
ENDIF(LUA_FOUND)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-lua.h"
|
||||
#include "weechat-lua-api.h"
|
||||
|
||||
@@ -351,8 +351,10 @@ weechat_lua_load (const char *filename)
|
||||
|
||||
/* if script was registered, remove it from list */
|
||||
if (lua_current_script)
|
||||
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script,
|
||||
lua_current_script);
|
||||
{
|
||||
plugin_script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script,
|
||||
lua_current_script);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -375,11 +377,11 @@ weechat_lua_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
lua_current_script,
|
||||
&weechat_lua_api_buffer_input_data_cb,
|
||||
&weechat_lua_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
lua_current_script,
|
||||
&weechat_lua_api_buffer_input_data_cb,
|
||||
&weechat_lua_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -430,7 +432,7 @@ weechat_lua_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, script);
|
||||
|
||||
if (interpreter)
|
||||
lua_close (interpreter);
|
||||
@@ -445,7 +447,7 @@ weechat_lua_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_lua_plugin, lua_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_lua_plugin, lua_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_lua_unload (ptr_script);
|
||||
@@ -471,7 +473,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);
|
||||
ptr_script = plugin_script_search (weechat_lua_plugin, lua_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -522,29 +524,29 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_lua_plugin, &weechat_lua_load_cb);
|
||||
plugin_script_auto_load (weechat_lua_plugin, &weechat_lua_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_lua_unload_all ();
|
||||
script_auto_load (weechat_lua_plugin, &weechat_lua_load_cb);
|
||||
plugin_script_auto_load (weechat_lua_plugin, &weechat_lua_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -555,19 +557,19 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Lua script */
|
||||
path_script = script_search_path (weechat_lua_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_lua_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_lua_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -608,7 +610,7 @@ weechat_lua_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_lua_plugin, completion, lua_scripts);
|
||||
plugin_script_completion (weechat_lua_plugin, completion, lua_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -629,9 +631,9 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "lua_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_lua_plugin,
|
||||
lua_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_lua_plugin,
|
||||
lua_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -653,7 +655,7 @@ weechat_lua_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, LUA_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_lua_plugin, lua_scripts);
|
||||
plugin_script_print_log (weechat_lua_plugin, lua_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -673,7 +675,7 @@ weechat_lua_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (lua_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (lua_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -692,18 +694,18 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &lua_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
&weechat_lua_unload,
|
||||
&weechat_lua_load,
|
||||
&lua_action_install_list);
|
||||
plugin_script_action_install (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
&weechat_lua_unload,
|
||||
&weechat_lua_load,
|
||||
&lua_action_install_list);
|
||||
}
|
||||
else if (data == &lua_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
&weechat_lua_unload,
|
||||
&lua_action_remove_list);
|
||||
plugin_script_action_remove (weechat_lua_plugin,
|
||||
lua_scripts,
|
||||
&weechat_lua_unload,
|
||||
&lua_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,16 +729,16 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "lua_script_install") == 0)
|
||||
{
|
||||
script_action_add (&lua_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&lua_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_lua_timer_action_cb,
|
||||
&lua_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "lua_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&lua_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&lua_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_lua_timer_action_cb,
|
||||
&lua_action_remove_list);
|
||||
@@ -766,11 +768,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_lua_load_cb;
|
||||
|
||||
lua_quiet = 1;
|
||||
script_init (weechat_lua_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_lua_plugin, argc, argv, &init);
|
||||
lua_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_lua_plugin,
|
||||
lua_scripts);
|
||||
plugin_script_display_short_list (weechat_lua_plugin,
|
||||
lua_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -785,7 +787,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
lua_quiet = 1;
|
||||
script_end (plugin, &lua_scripts, &weechat_lua_unload_all);
|
||||
plugin_script_end (plugin, &lua_scripts, &weechat_lua_unload_all);
|
||||
lua_quiet = 0;
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -36,10 +36,10 @@ IF(PERL_FOUND)
|
||||
STRING(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
|
||||
TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
|
||||
TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_plugins_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
|
||||
ELSE(PERL_DYNALOADER)
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
|
||||
TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_plugins_scripts)
|
||||
ENDIF(PERL_DYNALOADER)
|
||||
ENDIF(PERL_FOUND)
|
||||
|
||||
+408
-405
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,8 @@
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-perl.h"
|
||||
#include "weechat-perl-api.h"
|
||||
|
||||
@@ -490,9 +490,9 @@ weechat_perl_load (const char *filename)
|
||||
#endif
|
||||
if (perl_current_script && (perl_current_script != &temp_script))
|
||||
{
|
||||
script_remove (weechat_perl_plugin,
|
||||
&perl_scripts, &last_perl_script,
|
||||
perl_current_script);
|
||||
plugin_script_remove (weechat_perl_plugin,
|
||||
&perl_scripts, &last_perl_script,
|
||||
perl_current_script);
|
||||
}
|
||||
|
||||
free (eval);
|
||||
@@ -525,11 +525,11 @@ weechat_perl_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
perl_current_script,
|
||||
&weechat_perl_api_buffer_input_data_cb,
|
||||
&weechat_perl_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
perl_current_script,
|
||||
&weechat_perl_api_buffer_input_data_cb,
|
||||
&weechat_perl_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -586,8 +586,8 @@ weechat_perl_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script,
|
||||
script);
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
if (interpreter)
|
||||
@@ -610,7 +610,7 @@ weechat_perl_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_perl_plugin, perl_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_perl_plugin, perl_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_perl_unload (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);
|
||||
ptr_script = plugin_script_search (weechat_perl_plugin, perl_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -687,29 +687,29 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_perl_plugin, &weechat_perl_load_cb);
|
||||
plugin_script_auto_load (weechat_perl_plugin, &weechat_perl_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_perl_unload_all ();
|
||||
script_auto_load (weechat_perl_plugin, &weechat_perl_load_cb);
|
||||
plugin_script_auto_load (weechat_perl_plugin, &weechat_perl_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -720,19 +720,19 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_perl_plugin, perl_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Perl script */
|
||||
path_script = script_search_path (weechat_perl_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_perl_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_perl_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -773,7 +773,7 @@ weechat_perl_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_perl_plugin, completion, perl_scripts);
|
||||
plugin_script_completion (weechat_perl_plugin, completion, perl_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -794,9 +794,9 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "perl_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_perl_plugin,
|
||||
perl_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_perl_plugin,
|
||||
perl_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -818,7 +818,7 @@ weechat_perl_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, PERL_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_perl_plugin, perl_scripts);
|
||||
plugin_script_print_log (weechat_perl_plugin, perl_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -838,7 +838,7 @@ weechat_perl_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (perl_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (perl_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -857,18 +857,18 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &perl_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
&weechat_perl_unload,
|
||||
&weechat_perl_load,
|
||||
&perl_action_install_list);
|
||||
plugin_script_action_install (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
&weechat_perl_unload,
|
||||
&weechat_perl_load,
|
||||
&perl_action_install_list);
|
||||
}
|
||||
else if (data == &perl_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
&weechat_perl_unload,
|
||||
&perl_action_remove_list);
|
||||
plugin_script_action_remove (weechat_perl_plugin,
|
||||
perl_scripts,
|
||||
&weechat_perl_unload,
|
||||
&perl_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,16 +892,16 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "perl_script_install") == 0)
|
||||
{
|
||||
script_action_add (&perl_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&perl_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_perl_timer_action_cb,
|
||||
&perl_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "perl_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&perl_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&perl_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_perl_timer_action_cb,
|
||||
&perl_action_remove_list);
|
||||
@@ -981,11 +981,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_perl_load_cb;
|
||||
|
||||
perl_quiet = 1;
|
||||
script_init (weechat_perl_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_perl_plugin, argc, argv, &init);
|
||||
perl_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_perl_plugin,
|
||||
perl_scripts);
|
||||
plugin_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);
|
||||
@@ -1003,7 +1003,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
perl_quiet = 1;
|
||||
script_end (plugin, &perl_scripts, &weechat_perl_unload_all);
|
||||
plugin_script_end (plugin, &perl_scripts, &weechat_perl_unload_all);
|
||||
perl_quiet = 0;
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WEECHAT_PLUGIN_SCRIPT_API_H
|
||||
#define __WEECHAT_PLUGIN_SCRIPT_API_H 1
|
||||
|
||||
extern void plugin_script_api_charset_set (struct t_plugin_script *script,
|
||||
const char *charset);
|
||||
extern struct t_config_file *plugin_script_api_config_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
int (*callback_reload)(void *data,
|
||||
struct t_config_file *config_file),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_config_section *plugin_script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file,
|
||||
const char *name,
|
||||
int user_can_add_options,
|
||||
int user_can_delete_options,
|
||||
int (*callback_read)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
const char *function_read,
|
||||
const char *data_read,
|
||||
int (*callback_write)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *section_name),
|
||||
const char *function_write,
|
||||
const char *data_write,
|
||||
int (*callback_write_default)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *section_name),
|
||||
const char *function_write_default,
|
||||
const char *data_write_default,
|
||||
int (*callback_create_option)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
const char *function_create_option,
|
||||
const char *data_create_option,
|
||||
int (*callback_delete_option)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
struct t_config_option *option),
|
||||
const char *function_delete_option,
|
||||
const char *data_delete_option);
|
||||
extern struct t_config_option *plugin_script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *name,
|
||||
const char *type,
|
||||
const char *description,
|
||||
const char *string_values,
|
||||
int min, int max,
|
||||
const char *default_value,
|
||||
const char *value,
|
||||
int null_value_allowed,
|
||||
int (*callback_check_value)(void *data,
|
||||
struct t_config_option *option,
|
||||
const char *value),
|
||||
const char *function_check_value,
|
||||
const char *data_check_value,
|
||||
void (*callback_change)(void *data,
|
||||
struct t_config_option *option),
|
||||
const char *function_change,
|
||||
const char *data_change,
|
||||
void (*callback_delete)(void *data,
|
||||
struct t_config_option *option),
|
||||
const char *function_delete,
|
||||
const char *data_delete);
|
||||
extern void plugin_script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_option *option);
|
||||
extern void plugin_script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void plugin_script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void plugin_script_api_config_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file);
|
||||
extern void plugin_script_api_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *format, ...);
|
||||
extern void plugin_script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
time_t date, const char *tags,
|
||||
const char *format, ...);
|
||||
extern void plugin_script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
int y, const char *format, ...);
|
||||
extern void plugin_script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *format, ...);
|
||||
extern struct t_hook *plugin_script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command, const char *description,
|
||||
const char *args, const char *args_description,
|
||||
const char *completion,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
int argc, char **argv,
|
||||
char **argv_eol),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *command),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int interval, int align_second,
|
||||
int max_calls,
|
||||
int (*callback)(void *data,
|
||||
int remaining_calls),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int fd, int flag_read,
|
||||
int flag_write, int flag_exception,
|
||||
int (*callback)(void *data, int fd),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
struct t_hashtable *options,
|
||||
int timeout,
|
||||
int (*callback)(void *data,
|
||||
const char *command,
|
||||
int return_code,
|
||||
const char *out,
|
||||
const char *err),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_process (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
int timeout,
|
||||
int (*callback)(void *data,
|
||||
const char *command,
|
||||
int return_code,
|
||||
const char *out,
|
||||
const char *err),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *proxy,
|
||||
const char *address,
|
||||
int port,
|
||||
int sock,
|
||||
int ipv6,
|
||||
void *gnutls_sess,
|
||||
void *gnutls_cb,
|
||||
int gnutls_dhkey_size,
|
||||
const char *gnutls_priorities,
|
||||
const char *local_hostname,
|
||||
int (*callback)(void *data,
|
||||
int status,
|
||||
int gnutls_rc,
|
||||
const char *error,
|
||||
const char *ip_address),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *tags,
|
||||
const char *message,
|
||||
int strip_colors,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
time_t date,
|
||||
int tags_count,
|
||||
const char **tags,
|
||||
int displayed,
|
||||
int highlight,
|
||||
const char *prefix,
|
||||
const char *message),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data,
|
||||
const char *signal,
|
||||
const char *type_data,
|
||||
void *signal_data),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data,
|
||||
const char *signal,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option,
|
||||
int (*callback)(void *data,
|
||||
const char *option,
|
||||
const char *value),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *completion,
|
||||
const char *description,
|
||||
int (*callback)(void *data,
|
||||
const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *modifier,
|
||||
char *(*callback)(void *data,
|
||||
const char *modifier,
|
||||
const char *modifier_data,
|
||||
const char *string),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *info_name,
|
||||
const char *description,
|
||||
const char *args_description,
|
||||
const char *(*callback)(void *data,
|
||||
const char *info_name,
|
||||
const char *arguments),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *info_name,
|
||||
const char *description,
|
||||
const char *args_description,
|
||||
const char *output_description,
|
||||
struct t_hashtable *(*callback)(void *data,
|
||||
const char *info_name,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *infolist_name,
|
||||
const char *description,
|
||||
const char *pointer_description,
|
||||
const char *args_description,
|
||||
struct t_infolist *(*callback)(void *data,
|
||||
const char *infolist_name,
|
||||
void *pointer,
|
||||
const char *arguments),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *plugin_script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *area,
|
||||
struct t_hashtable *(*callback)(void *data,
|
||||
struct t_hashtable *info),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void plugin_script_api_unhook (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_hook *hook);
|
||||
extern void plugin_script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script);
|
||||
extern struct t_gui_buffer *plugin_script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
int (*input_callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
const char *function_input,
|
||||
const char *data_input,
|
||||
int (*close_callback)(void *data,
|
||||
struct t_gui_buffer *buffer),
|
||||
const char *function_close,
|
||||
const char *data_close);
|
||||
extern void plugin_script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
char *(*build_callback)(void *data,
|
||||
struct t_gui_bar_item *item,
|
||||
struct t_gui_window *window),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_bar_item *item);
|
||||
extern void plugin_script_api_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *command);
|
||||
extern const char *plugin_script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int plugin_script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int plugin_script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option, const char *value);
|
||||
extern void plugin_script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option,
|
||||
const char *description);
|
||||
extern int plugin_script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int plugin_script_api_upgrade_read (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_upgrade_file *upgrade_file,
|
||||
int (*callback_read)(void *data,
|
||||
struct t_upgrade_file *upgrade_file,
|
||||
int object_id,
|
||||
struct t_infolist *infolist),
|
||||
const char *function,
|
||||
const char *data);
|
||||
|
||||
#endif /* __WEECHAT_PLUGIN_SCRIPT_API_H */
|
||||
@@ -25,17 +25,17 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "script.h"
|
||||
#include "script-callback.h"
|
||||
#include "weechat-plugin.h"
|
||||
#include "plugin-script.h"
|
||||
#include "plugin-script-callback.h"
|
||||
|
||||
|
||||
/*
|
||||
* script_callback_alloc: allocate a new callback and initializes it
|
||||
* plugin_script_callback_alloc: allocate a new callback and initializes it
|
||||
*/
|
||||
|
||||
struct t_script_callback *
|
||||
script_callback_alloc ()
|
||||
plugin_script_callback_alloc ()
|
||||
{
|
||||
struct t_script_callback *new_script_callback;
|
||||
|
||||
@@ -59,21 +59,21 @@ script_callback_alloc ()
|
||||
}
|
||||
|
||||
/*
|
||||
* script_callback_add: allocate a new callback, initialize it
|
||||
* (script/function/data) and add it to list
|
||||
* return pointer to new callback or NULL if error
|
||||
* plugin_script_callback_add: allocate a new callback, initialize it
|
||||
* (script/function/data) and add it to list
|
||||
* return pointer to new callback or NULL if error
|
||||
*/
|
||||
|
||||
struct t_script_callback *
|
||||
script_callback_add (struct t_plugin_script *script,
|
||||
const char *function,
|
||||
const char *data)
|
||||
plugin_script_callback_add (struct t_plugin_script *script,
|
||||
const char *function,
|
||||
const char *data)
|
||||
{
|
||||
struct t_script_callback *script_cb;
|
||||
if (!script)
|
||||
return NULL;
|
||||
|
||||
script_cb = script_callback_alloc ();
|
||||
script_cb = plugin_script_callback_alloc ();
|
||||
if (!script_cb)
|
||||
return NULL;
|
||||
|
||||
@@ -93,11 +93,11 @@ script_callback_add (struct t_plugin_script *script,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_callback_free_data: free data of a script callback
|
||||
* plugin_script_callback_free_data: free data of a script callback
|
||||
*/
|
||||
|
||||
void
|
||||
script_callback_free_data (struct t_script_callback *script_callback)
|
||||
plugin_script_callback_free_data (struct t_script_callback *script_callback)
|
||||
{
|
||||
if (script_callback->function)
|
||||
free (script_callback->function);
|
||||
@@ -106,12 +106,12 @@ script_callback_free_data (struct t_script_callback *script_callback)
|
||||
}
|
||||
|
||||
/*
|
||||
* script_callback_remove: remove a callback from a script
|
||||
* plugin_script_callback_remove: remove a callback from a script
|
||||
*/
|
||||
|
||||
void
|
||||
script_callback_remove (struct t_plugin_script *script,
|
||||
struct t_script_callback *script_callback)
|
||||
plugin_script_callback_remove (struct t_plugin_script *script,
|
||||
struct t_script_callback *script_callback)
|
||||
{
|
||||
/* remove callback from list */
|
||||
if (script_callback->prev_callback)
|
||||
@@ -123,31 +123,31 @@ script_callback_remove (struct t_plugin_script *script,
|
||||
if (script->callbacks == script_callback)
|
||||
script->callbacks = script_callback->next_callback;
|
||||
|
||||
script_callback_free_data (script_callback);
|
||||
plugin_script_callback_free_data (script_callback);
|
||||
|
||||
free (script_callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* script_callback_remove_all: remove all callbacks from a script
|
||||
* plugin_script_callback_remove_all: remove all callbacks from a script
|
||||
*/
|
||||
|
||||
void
|
||||
script_callback_remove_all (struct t_plugin_script *script)
|
||||
plugin_script_callback_remove_all (struct t_plugin_script *script)
|
||||
{
|
||||
while (script->callbacks)
|
||||
{
|
||||
script_callback_remove (script, script->callbacks);
|
||||
plugin_script_callback_remove (script, script->callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_callback_print_log: print callback infos in log (usually for crash dump)
|
||||
* plugin_script_callback_print_log: print callback infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_script_callback *script_callback)
|
||||
plugin_script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_script_callback *script_callback)
|
||||
{
|
||||
weechat_log_printf ("");
|
||||
weechat_log_printf (" [callback (addr:0x%lx)]", script_callback);
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WEECHAT_SCRIPT_CALLBACK_H
|
||||
#define __WEECHAT_SCRIPT_CALLBACK_H 1
|
||||
#ifndef __WEECHAT_PLUGIN_SCRIPT_CALLBACK_H
|
||||
#define __WEECHAT_PLUGIN_SCRIPT_CALLBACK_H 1
|
||||
|
||||
struct t_script_callback
|
||||
{
|
||||
@@ -36,13 +36,13 @@ struct t_script_callback
|
||||
struct t_script_callback *next_callback; /* link to previous callback */
|
||||
};
|
||||
|
||||
extern struct t_script_callback *script_callback_add (struct t_plugin_script *script,
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void script_callback_remove (struct t_plugin_script *script,
|
||||
struct t_script_callback *script_callback);
|
||||
extern void script_callback_remove_all (struct t_plugin_script *script);
|
||||
extern void script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_script_callback *script_callback);
|
||||
extern struct t_script_callback *plugin_script_callback_add (struct t_plugin_script *script,
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void plugin_script_callback_remove (struct t_plugin_script *script,
|
||||
struct t_script_callback *script_callback);
|
||||
extern void plugin_script_callback_remove_all (struct t_plugin_script *script);
|
||||
extern void plugin_script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_script_callback *script_callback);
|
||||
|
||||
#endif /* __WEECHAT_SCRIPT_CALLBACK_H */
|
||||
#endif /* __WEECHAT_PLUGIN_SCRIPT_CALLBACK_H */
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* script.c: common functions used by script plugins (perl/python/..)
|
||||
* plugin-script.c: common functions used by script plugins (perl/python/..)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -32,9 +32,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "script.h"
|
||||
#include "script-callback.h"
|
||||
#include "weechat-plugin.h"
|
||||
#include "plugin-script.h"
|
||||
#include "plugin-script-callback.h"
|
||||
|
||||
|
||||
#define SCRIPT_OPTION_CHECK_LICENSE "check_license"
|
||||
@@ -43,11 +43,11 @@ int script_option_check_license = 0;
|
||||
|
||||
|
||||
/*
|
||||
* script_config_read: read script configuration
|
||||
* plugin_script_config_read: read script configuration
|
||||
*/
|
||||
|
||||
void
|
||||
script_config_read (struct t_weechat_plugin *weechat_plugin)
|
||||
plugin_script_config_read (struct t_weechat_plugin *weechat_plugin)
|
||||
{
|
||||
const char *string;
|
||||
|
||||
@@ -64,35 +64,36 @@ script_config_read (struct t_weechat_plugin *weechat_plugin)
|
||||
}
|
||||
|
||||
/*
|
||||
* script_config_cb: callback called when config option is changed
|
||||
* plugin_script_config_cb: callback called when config option is changed
|
||||
*/
|
||||
|
||||
int
|
||||
script_config_cb (void *data, const char *option, const char *value)
|
||||
plugin_script_config_cb (void *data, const char *option, const char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) option;
|
||||
(void) value;
|
||||
|
||||
script_config_read (data);
|
||||
plugin_script_config_read (data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_init: initialize script plugin
|
||||
* plugin_script_init: initialize script plugin
|
||||
*/
|
||||
|
||||
void
|
||||
script_init (struct t_weechat_plugin *weechat_plugin, int argc, char *argv[],
|
||||
struct t_plugin_script_init *init)
|
||||
plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
int argc, char *argv[],
|
||||
struct t_plugin_script_init *init)
|
||||
{
|
||||
char *string, *completion;
|
||||
char signal_name[128];
|
||||
int length, i, auto_load_scripts;
|
||||
|
||||
/* read script configuration */
|
||||
script_config_read (weechat_plugin);
|
||||
plugin_script_config_read (weechat_plugin);
|
||||
|
||||
/* add hook for config option */
|
||||
length = strlen (weechat_plugin->name) + 64;
|
||||
@@ -101,7 +102,7 @@ script_init (struct t_weechat_plugin *weechat_plugin, int argc, char *argv[],
|
||||
{
|
||||
snprintf (string, length, "plugins.var.%s.%s",
|
||||
weechat_plugin->name, SCRIPT_OPTION_CHECK_LICENSE);
|
||||
weechat_hook_config (string, &script_config_cb, weechat_plugin);
|
||||
weechat_hook_config (string, &plugin_script_config_cb, weechat_plugin);
|
||||
free (string);
|
||||
}
|
||||
|
||||
@@ -207,19 +208,19 @@ script_init (struct t_weechat_plugin *weechat_plugin, int argc, char *argv[],
|
||||
/* autoload scripts */
|
||||
if (auto_load_scripts)
|
||||
{
|
||||
script_auto_load (weechat_plugin, init->callback_load_file);
|
||||
plugin_script_auto_load (weechat_plugin, init->callback_load_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_valid: check if a script pointer exists
|
||||
* return 1 if script exists
|
||||
* 0 if script is not found
|
||||
* plugin_script_valid: check if a script pointer exists
|
||||
* return 1 if script exists
|
||||
* 0 if script is not found
|
||||
*/
|
||||
|
||||
int
|
||||
script_valid (struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script)
|
||||
plugin_script_valid (struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -238,13 +239,13 @@ script_valid (struct t_plugin_script *scripts,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_ptr2str: convert pointer to string for usage in a script
|
||||
* (any language)
|
||||
* WARNING: result has to be free() after use
|
||||
* plugin_script_ptr2str: convert pointer to string for usage in a script
|
||||
* (any language)
|
||||
* WARNING: result has to be free() after use
|
||||
*/
|
||||
|
||||
char *
|
||||
script_ptr2str (void *pointer)
|
||||
plugin_script_ptr2str (void *pointer)
|
||||
{
|
||||
char pointer_str[128];
|
||||
|
||||
@@ -258,13 +259,13 @@ script_ptr2str (void *pointer)
|
||||
}
|
||||
|
||||
/*
|
||||
* script_str2ptr: convert string to pointer for usage outside script
|
||||
* plugin_script_str2ptr: convert string to pointer for usage outside script
|
||||
*/
|
||||
|
||||
void *
|
||||
script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name, const char *function_name,
|
||||
const char *str_pointer)
|
||||
plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name, const char *function_name,
|
||||
const char *str_pointer)
|
||||
{
|
||||
long unsigned int value;
|
||||
int rc;
|
||||
@@ -299,12 +300,12 @@ invalid:
|
||||
}
|
||||
|
||||
/*
|
||||
* script_auto_load: auto-load all scripts in a directory
|
||||
* plugin_script_auto_load: auto-load all scripts in a directory
|
||||
*/
|
||||
|
||||
void
|
||||
script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
void (*callback)(void *data, const char *filename))
|
||||
plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
void (*callback)(void *data, const char *filename))
|
||||
{
|
||||
const char *dir_home;
|
||||
char *dir_name;
|
||||
@@ -327,12 +328,12 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_search: search a script in list (by registered name)
|
||||
* plugin_script_search: search a script in list (by registered name)
|
||||
*/
|
||||
|
||||
struct t_plugin_script *
|
||||
script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts, const char *name)
|
||||
plugin_script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts, const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -348,13 +349,13 @@ script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_search_by_full_name: search a script in list (by full name, for
|
||||
* example "weeget.py")
|
||||
* plugin_script_search_by_full_name: search a script in list (by full name,
|
||||
* for example "weeget.py")
|
||||
*/
|
||||
|
||||
struct t_plugin_script *
|
||||
script_search_by_full_name (struct t_plugin_script *scripts,
|
||||
const char *full_name)
|
||||
plugin_script_search_by_full_name (struct t_plugin_script *scripts,
|
||||
const char *full_name)
|
||||
{
|
||||
char *base_name;
|
||||
struct t_plugin_script *ptr_script;
|
||||
@@ -372,12 +373,12 @@ script_search_by_full_name (struct t_plugin_script *scripts,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_search_path: search path name of a script
|
||||
* plugin_script_search_path: search path name of a script
|
||||
*/
|
||||
|
||||
char *
|
||||
script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename)
|
||||
plugin_script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename)
|
||||
{
|
||||
char *final_name;
|
||||
const char *dir_home, *dir_system;
|
||||
@@ -451,13 +452,13 @@ script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_find_pos: find position for a script (for sorting scripts list)
|
||||
* plugin_script_find_pos: find position for a script (for sorting scripts list)
|
||||
*/
|
||||
|
||||
struct t_plugin_script *
|
||||
script_find_pos (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script)
|
||||
plugin_script_find_pos (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -470,20 +471,20 @@ script_find_pos (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_insert_sorted: insert a script in list, keeping sort on name
|
||||
* plugin_script_insert_sorted: insert a script in list, keeping sort on name
|
||||
*/
|
||||
|
||||
void
|
||||
script_insert_sorted (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
plugin_script_insert_sorted (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_plugin_script *pos_script;
|
||||
|
||||
if (*scripts)
|
||||
{
|
||||
pos_script = script_find_pos (weechat_plugin, *scripts, script);
|
||||
pos_script = plugin_script_find_pos (weechat_plugin, *scripts, script);
|
||||
|
||||
if (pos_script)
|
||||
{
|
||||
@@ -516,16 +517,17 @@ script_insert_sorted (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_add: add a script to list of scripts
|
||||
* plugin_script_add: add a script to list of scripts
|
||||
*/
|
||||
|
||||
struct t_plugin_script *
|
||||
script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name, const char *author, const char *version,
|
||||
const char *license, const char *description, const char *shutdown_func,
|
||||
const char *charset)
|
||||
plugin_script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name, const char *author,
|
||||
const char *version, const char *license,
|
||||
const char *description, const char *shutdown_func,
|
||||
const char *charset)
|
||||
{
|
||||
struct t_plugin_script *new_script;
|
||||
|
||||
@@ -565,7 +567,8 @@ script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
new_script->callbacks = NULL;
|
||||
new_script->unloading = 0;
|
||||
|
||||
script_insert_sorted (weechat_plugin, scripts, last_script, new_script);
|
||||
plugin_script_insert_sorted (weechat_plugin, scripts, last_script,
|
||||
new_script);
|
||||
|
||||
return new_script;
|
||||
}
|
||||
@@ -578,20 +581,20 @@ script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_set_buffer_callbacks: restore buffers callbacks (input and
|
||||
* close) for buffers created by script
|
||||
* plugin
|
||||
* plugin_script_set_buffer_callbacks: restore buffers callbacks (input and
|
||||
* close) for buffers created by script
|
||||
* plugin
|
||||
*/
|
||||
|
||||
void
|
||||
script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script,
|
||||
int (*callback_buffer_input) (void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
int (*callback_buffer_close) (void *data,
|
||||
struct t_gui_buffer *buffer))
|
||||
plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script,
|
||||
int (*callback_buffer_input) (void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
int (*callback_buffer_close) (void *data,
|
||||
struct t_gui_buffer *buffer))
|
||||
{
|
||||
struct t_infolist *infolist;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
@@ -612,8 +615,8 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
script_name = weechat_buffer_get_string (ptr_buffer, "localvar_script_name");
|
||||
if (script_name && script_name[0])
|
||||
{
|
||||
ptr_script = script_search (weechat_plugin, scripts,
|
||||
script_name);
|
||||
ptr_script = plugin_script_search (weechat_plugin, scripts,
|
||||
script_name);
|
||||
if (ptr_script && (ptr_script == script))
|
||||
{
|
||||
str_script_input_cb = weechat_buffer_get_string (ptr_buffer,
|
||||
@@ -627,9 +630,9 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
if (str_script_input_cb && str_script_input_cb[0])
|
||||
{
|
||||
script_cb_input = script_callback_add (ptr_script,
|
||||
str_script_input_cb,
|
||||
str_script_input_cb_data);
|
||||
script_cb_input = plugin_script_callback_add (ptr_script,
|
||||
str_script_input_cb,
|
||||
str_script_input_cb_data);
|
||||
if (script_cb_input)
|
||||
{
|
||||
script_cb_input->buffer = ptr_buffer;
|
||||
@@ -643,9 +646,9 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
if (str_script_close_cb && str_script_close_cb[0])
|
||||
{
|
||||
script_cb_close = script_callback_add (ptr_script,
|
||||
str_script_close_cb,
|
||||
str_script_close_cb_data);
|
||||
script_cb_close = plugin_script_callback_add (ptr_script,
|
||||
str_script_close_cb,
|
||||
str_script_close_cb_data);
|
||||
if (script_cb_close)
|
||||
{
|
||||
script_cb_close->buffer = ptr_buffer;
|
||||
@@ -666,13 +669,13 @@ script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_remove_buffer_callbacks: remove callbacks for a buffer (called when a
|
||||
* buffer is closed by user)
|
||||
* plugin_script_remove_buffer_callbacks: remove callbacks for a buffer (called
|
||||
* when a buffer is closed by user)
|
||||
*/
|
||||
|
||||
void
|
||||
script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
struct t_gui_buffer *buffer)
|
||||
plugin_script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
struct t_script_callback *ptr_script_cb, *next_script_cb;
|
||||
@@ -692,7 +695,7 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
next_script_cb = ptr_script_cb->next_callback;
|
||||
|
||||
if (ptr_script_cb->buffer == buffer)
|
||||
script_callback_remove (ptr_script, ptr_script_cb);
|
||||
plugin_script_callback_remove (ptr_script, ptr_script_cb);
|
||||
|
||||
ptr_script_cb = next_script_cb;
|
||||
}
|
||||
@@ -701,14 +704,14 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_remove: remove a script from list of scripts
|
||||
* plugin_script_remove: remove a script from list of scripts
|
||||
*/
|
||||
|
||||
void
|
||||
script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
plugin_script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_script_callback *ptr_script_cb, *ptr_script_cb2;
|
||||
|
||||
@@ -762,7 +765,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/* remove all callbacks created by this script */
|
||||
script_callback_remove_all (script);
|
||||
plugin_script_callback_remove_all (script);
|
||||
|
||||
/* free data */
|
||||
if (script->filename)
|
||||
@@ -797,13 +800,13 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_completion: complete with list of scripts
|
||||
* plugin_script_completion: complete with list of scripts
|
||||
*/
|
||||
|
||||
void
|
||||
script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_gui_completion *completion,
|
||||
struct t_plugin_script *scripts)
|
||||
plugin_script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_gui_completion *completion,
|
||||
struct t_plugin_script *scripts)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -816,11 +819,11 @@ script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_action_add: add script name for a plugin action
|
||||
* plugin_script_action_add: add script name for a plugin action
|
||||
*/
|
||||
|
||||
void
|
||||
script_action_add (char **action_list, const char *name)
|
||||
plugin_script_action_add (char **action_list, const char *name)
|
||||
{
|
||||
int length;
|
||||
char *action_list2;
|
||||
@@ -850,12 +853,13 @@ script_action_add (char **action_list, const char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
* script_remove_file: remove script file(s) from disk
|
||||
* plugin_script_remove_file: remove script file(s) from disk
|
||||
*/
|
||||
|
||||
void
|
||||
script_remove_file (struct t_weechat_plugin *weechat_plugin, const char *name,
|
||||
int display_error_if_no_script_removed)
|
||||
plugin_script_remove_file (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *name,
|
||||
int display_error_if_no_script_removed)
|
||||
{
|
||||
int num_found, i;
|
||||
char *path_script;
|
||||
@@ -864,7 +868,7 @@ script_remove_file (struct t_weechat_plugin *weechat_plugin, const char *name,
|
||||
i = 0;
|
||||
while (i < 2)
|
||||
{
|
||||
path_script = script_search_path (weechat_plugin, name);
|
||||
path_script = plugin_script_search_path (weechat_plugin, name);
|
||||
/* script not found? */
|
||||
if (!path_script || (strcmp (path_script, name) == 0))
|
||||
break;
|
||||
@@ -900,21 +904,23 @@ script_remove_file (struct t_weechat_plugin *weechat_plugin, const char *name,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_action_install: install some scripts (using comma separated list)
|
||||
* this function does following tasks:
|
||||
* 1. unload script (if script is loaded)
|
||||
* 2. remove script file(s)
|
||||
* 3. move script file from "install" dir to language dir
|
||||
* 4. make link in autoload dir
|
||||
* 5. load script
|
||||
* plugin_script_action_install: install some scripts (using comma separated
|
||||
* list)
|
||||
* this function does following tasks:
|
||||
* 1. unload script (if script is loaded)
|
||||
* 2. remove script file(s)
|
||||
* 3. move script file from "install" dir to
|
||||
* language dir
|
||||
* 4. make link in autoload dir
|
||||
* 5. load script
|
||||
*/
|
||||
|
||||
void
|
||||
script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
int (*script_load)(const char *filename),
|
||||
char **list)
|
||||
plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
int (*script_load)(const char *filename),
|
||||
char **list)
|
||||
{
|
||||
char **argv, *name, *ptr_base_name, *base_name, *new_path, *autoload_path;
|
||||
char *symlink_path;
|
||||
@@ -937,12 +943,13 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
if (base_name)
|
||||
{
|
||||
/* unload script, if script is loaded */
|
||||
ptr_script = script_search_by_full_name (scripts, base_name);
|
||||
ptr_script = plugin_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);
|
||||
plugin_script_remove_file (weechat_plugin, base_name, 0);
|
||||
|
||||
/* move file from install dir to language dir */
|
||||
dir_home = weechat_info_get ("weechat_dir", "");
|
||||
@@ -1010,17 +1017,17 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_action_remove: remove some scripts (using comma separated list)
|
||||
* this function does following tasks:
|
||||
* 1. unload script (if script is loaded)
|
||||
* 2. remove script file(s)
|
||||
* plugin_script_action_remove: remove some scripts (using comma separated list)
|
||||
* this function does following tasks:
|
||||
* 1. unload script (if script is loaded)
|
||||
* 2. remove script file(s)
|
||||
*/
|
||||
|
||||
void
|
||||
script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
char **list)
|
||||
plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
char **list)
|
||||
{
|
||||
char **argv;
|
||||
int argc, i;
|
||||
@@ -1034,12 +1041,12 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
/* unload script, if script is loaded */
|
||||
ptr_script = script_search_by_full_name (scripts, argv[i]);
|
||||
ptr_script = plugin_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);
|
||||
plugin_script_remove_file (weechat_plugin, argv[i], 1);
|
||||
}
|
||||
weechat_string_free_split (argv);
|
||||
}
|
||||
@@ -1049,13 +1056,13 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_display_list: print list of scripts
|
||||
* plugin_script_display_list: print list of scripts
|
||||
*/
|
||||
|
||||
void
|
||||
script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full)
|
||||
plugin_script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -1096,12 +1103,12 @@ script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_display_short_list: print list of scripts on one line
|
||||
* plugin_script_display_short_list: print list of scripts on one line
|
||||
*/
|
||||
|
||||
void
|
||||
script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts)
|
||||
plugin_script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts)
|
||||
{
|
||||
const char *scripts_loaded;
|
||||
char *buf;
|
||||
@@ -1141,14 +1148,14 @@ script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_add_to_infolist: add a script in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
* plugin_script_add_to_infolist: add a script in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_infolist *infolist,
|
||||
struct t_plugin_script *script)
|
||||
plugin_script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_infolist *infolist,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_infolist_item *ptr_item;
|
||||
|
||||
@@ -1186,19 +1193,19 @@ script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_infolist_list_scripts: build infolist with list of scripts
|
||||
* plugin_script_infolist_list_scripts: build infolist with list of scripts
|
||||
*/
|
||||
|
||||
struct t_infolist *
|
||||
script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer,
|
||||
const char *arguments)
|
||||
plugin_script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer,
|
||||
const char *arguments)
|
||||
{
|
||||
struct t_infolist *ptr_infolist;
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
if (pointer && !script_valid (scripts, pointer))
|
||||
if (pointer && !plugin_script_valid (scripts, pointer))
|
||||
return NULL;
|
||||
|
||||
ptr_infolist = weechat_infolist_new ();
|
||||
@@ -1207,8 +1214,8 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
if (pointer)
|
||||
{
|
||||
/* build list with only one script */
|
||||
if (!script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, pointer))
|
||||
if (!plugin_script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, pointer))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
@@ -1224,8 +1231,8 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
if (!arguments || !arguments[0]
|
||||
|| weechat_string_match (ptr_script->name, arguments, 0))
|
||||
{
|
||||
if (!script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, ptr_script))
|
||||
if (!plugin_script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, ptr_script))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
@@ -1240,13 +1247,13 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_end: end script plugin
|
||||
* plugin_script_end: end script plugin
|
||||
*/
|
||||
|
||||
void
|
||||
script_end (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
void (*callback_unload_all)())
|
||||
plugin_script_end (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
void (*callback_unload_all)())
|
||||
{
|
||||
int scripts_loaded;
|
||||
|
||||
@@ -1262,12 +1269,12 @@ script_end (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
|
||||
/*
|
||||
* script_print_log: print script infos in log (usually for crash dump)
|
||||
* plugin_script_print_log: print script infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts)
|
||||
plugin_script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
struct t_script_callback *ptr_script_cb;
|
||||
@@ -1298,7 +1305,7 @@ script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
for (ptr_script_cb = ptr_script->callbacks; ptr_script_cb;
|
||||
ptr_script_cb = ptr_script_cb->next_callback)
|
||||
{
|
||||
script_callback_print_log (weechat_plugin, ptr_script_cb);
|
||||
plugin_script_callback_print_log (weechat_plugin, ptr_script_cb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WEECHAT_SCRIPT_H
|
||||
#define __WEECHAT_SCRIPT_H 1
|
||||
#ifndef __WEECHAT_PLUGIN_SCRIPT_H
|
||||
#define __WEECHAT_PLUGIN_SCRIPT_H 1
|
||||
|
||||
/* constants which defines return types for weechat_<lang>_exec functions */
|
||||
|
||||
@@ -90,72 +90,73 @@ struct t_plugin_script_init
|
||||
void (*callback_load_file)(void *data, const char *filename);
|
||||
};
|
||||
|
||||
extern void script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
int argc, char *argv[],
|
||||
struct t_plugin_script_init *init);
|
||||
extern int script_valid (struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script);
|
||||
extern char *script_ptr2str (void *pointer);
|
||||
extern void *script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name, const char *function_name,
|
||||
const char *pointer_str);
|
||||
extern void script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
void (*callback)(void *data, const char *filename));
|
||||
extern struct t_plugin_script *script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name);
|
||||
extern char *script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename);
|
||||
extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name,
|
||||
const char *author, const char *version,
|
||||
const char *license, const char *description,
|
||||
const char *shutdown_func, const char *charset);
|
||||
extern void script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
extern void plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
int argc, char *argv[],
|
||||
struct t_plugin_script_init *init);
|
||||
extern int plugin_script_valid (struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script);
|
||||
extern char *plugin_script_ptr2str (void *pointer);
|
||||
extern void *plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name,
|
||||
const char *function_name,
|
||||
const char *pointer_str);
|
||||
extern void plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
void (*callback)(void *data, const char *filename));
|
||||
extern struct t_plugin_script *plugin_script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name);
|
||||
extern char *plugin_script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename);
|
||||
extern struct t_plugin_script *plugin_script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name,
|
||||
const char *author, const char *version,
|
||||
const char *license, const char *description,
|
||||
const char *shutdown_func, const char *charset);
|
||||
extern void plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script,
|
||||
int (*callback_buffer_input) (void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
int (*callback_buffer_close) (void *data,
|
||||
struct t_gui_buffer *buffer));
|
||||
extern void plugin_script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern void plugin_script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script);
|
||||
extern void plugin_script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_gui_completion *completion,
|
||||
struct t_plugin_script *scripts);
|
||||
extern void plugin_script_action_add (char **action_list, const char *name);
|
||||
extern void plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
int (*script_load)(const char *filename),
|
||||
char **list);
|
||||
extern void plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script,
|
||||
int (*callback_buffer_input) (void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
int (*callback_buffer_close) (void *data,
|
||||
struct t_gui_buffer *buffer));
|
||||
extern void script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern void script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script);
|
||||
extern void script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_gui_completion *completion,
|
||||
struct t_plugin_script *scripts);
|
||||
extern void script_action_add (char **action_list, const char *name);
|
||||
extern void script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
int (*script_load)(const char *filename),
|
||||
char **list);
|
||||
extern void script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
char **list);
|
||||
extern void script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full);
|
||||
extern void script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
extern int script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_infolist *infolist,
|
||||
struct t_plugin_script *script);
|
||||
extern struct t_infolist *script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer,
|
||||
const char *arguments);
|
||||
extern void script_end (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
void (*callback_unload_all)());
|
||||
extern void script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
char **list);
|
||||
extern void plugin_script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full);
|
||||
extern void plugin_script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
extern int plugin_script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_infolist *infolist,
|
||||
struct t_plugin_script *script);
|
||||
extern struct t_infolist *plugin_script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer,
|
||||
const char *arguments);
|
||||
extern void plugin_script_end (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
void (*callback_unload_all)());
|
||||
extern void plugin_script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
|
||||
#endif /* __WEECHAT_SCRIPT_H */
|
||||
#endif /* __WEECHAT_PLUGIN_SCRIPT_H */
|
||||
@@ -25,7 +25,7 @@ SET_TARGET_PROPERTIES(python PROPERTIES PREFIX "")
|
||||
IF(PYTHON_FOUND)
|
||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LFLAGS}")
|
||||
TARGET_LINK_LIBRARIES(python ${PYTHON_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(python ${PYTHON_LIBRARY} weechat_plugins_scripts)
|
||||
ENDIF(PYTHON_FOUND)
|
||||
|
||||
INSTALL(TARGETS python LIBRARY DESTINATION ${LIBDIR}/plugins)
|
||||
+408
-405
File diff suppressed because it is too large
Load Diff
@@ -29,8 +29,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-python.h"
|
||||
#include "weechat-python-api.h"
|
||||
|
||||
@@ -695,9 +695,9 @@ weechat_python_load (const char *filename)
|
||||
/* if script was registered, remove it from list */
|
||||
if (python_current_script != NULL)
|
||||
{
|
||||
script_remove (weechat_python_plugin,
|
||||
&python_scripts, &last_python_script,
|
||||
python_current_script);
|
||||
plugin_script_remove (weechat_python_plugin,
|
||||
&python_scripts, &last_python_script,
|
||||
python_current_script);
|
||||
}
|
||||
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
@@ -734,11 +734,11 @@ weechat_python_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_python_plugin,
|
||||
python_scripts,
|
||||
python_current_script,
|
||||
&weechat_python_api_buffer_input_data_cb,
|
||||
&weechat_python_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_python_plugin,
|
||||
python_scripts,
|
||||
python_current_script,
|
||||
&weechat_python_api_buffer_input_data_cb,
|
||||
&weechat_python_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -789,8 +789,8 @@ weechat_python_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
|
||||
script);
|
||||
|
||||
if (interpreter)
|
||||
{
|
||||
@@ -811,7 +811,7 @@ weechat_python_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_python_plugin, python_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_python_plugin, python_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_python_unload (ptr_script);
|
||||
@@ -850,7 +850,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);
|
||||
ptr_script = plugin_script_search (weechat_python_plugin, python_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -888,29 +888,29 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_python_plugin, &weechat_python_load_cb);
|
||||
plugin_script_auto_load (weechat_python_plugin, &weechat_python_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_python_unload_all ();
|
||||
script_auto_load (weechat_python_plugin, &weechat_python_load_cb);
|
||||
plugin_script_auto_load (weechat_python_plugin, &weechat_python_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -921,19 +921,19 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_python_plugin, python_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_python_plugin, python_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Python script */
|
||||
path_script = script_search_path (weechat_python_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_python_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_python_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -975,7 +975,7 @@ weechat_python_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_python_plugin, completion, python_scripts);
|
||||
plugin_script_completion (weechat_python_plugin, completion, python_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -1028,9 +1028,9 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "python_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_python_plugin,
|
||||
python_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_python_plugin,
|
||||
python_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1053,7 +1053,7 @@ weechat_python_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, PYTHON_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_python_plugin, python_scripts);
|
||||
plugin_script_print_log (weechat_python_plugin, python_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1075,7 +1075,7 @@ weechat_python_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (python_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (python_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -1094,18 +1094,18 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &python_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_python_plugin,
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&weechat_python_load,
|
||||
&python_action_install_list);
|
||||
plugin_script_action_install (weechat_python_plugin,
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&weechat_python_load,
|
||||
&python_action_install_list);
|
||||
}
|
||||
else if (data == &python_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_python_plugin,
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&python_action_remove_list);
|
||||
plugin_script_action_remove (weechat_python_plugin,
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&python_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,16 +1129,16 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "python_script_install") == 0)
|
||||
{
|
||||
script_action_add (&python_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&python_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_python_timer_action_cb,
|
||||
&python_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "python_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&python_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&python_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_python_timer_action_cb,
|
||||
&python_action_remove_list);
|
||||
@@ -1208,11 +1208,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_python_load_cb;
|
||||
|
||||
python_quiet = 1;
|
||||
script_init (weechat_python_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_python_plugin, argc, argv, &init);
|
||||
python_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_python_plugin,
|
||||
python_scripts);
|
||||
plugin_script_display_short_list (weechat_python_plugin,
|
||||
python_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1227,7 +1227,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
python_quiet = 1;
|
||||
script_end (plugin, &python_scripts, &weechat_python_unload_all);
|
||||
plugin_script_end (plugin, &python_scripts, &weechat_python_unload_all);
|
||||
python_quiet = 0;
|
||||
|
||||
/* free Python interpreter */
|
||||
@@ -24,7 +24,7 @@ SET_TARGET_PROPERTIES(ruby PROPERTIES PREFIX "")
|
||||
|
||||
IF(RUBY_FOUND)
|
||||
INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH} ${RUBY_ARCH})
|
||||
TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_plugins_scripts)
|
||||
ENDIF(RUBY_FOUND)
|
||||
|
||||
INSTALL(TARGETS ruby LIBRARY DESTINATION ${LIBDIR}/plugins)
|
||||
+405
-402
File diff suppressed because it is too large
Load Diff
@@ -33,8 +33,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-ruby.h"
|
||||
#include "weechat-ruby-api.h"
|
||||
|
||||
@@ -564,9 +564,9 @@ weechat_ruby_load (const char *filename)
|
||||
|
||||
if (ruby_current_script != NULL)
|
||||
{
|
||||
script_remove (weechat_ruby_plugin,
|
||||
&ruby_scripts, &last_ruby_script,
|
||||
ruby_current_script);
|
||||
plugin_script_remove (weechat_ruby_plugin,
|
||||
&ruby_scripts, &last_ruby_script,
|
||||
ruby_current_script);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -589,11 +589,11 @@ weechat_ruby_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
ruby_current_script,
|
||||
&weechat_ruby_api_buffer_input_data_cb,
|
||||
&weechat_ruby_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
ruby_current_script,
|
||||
&weechat_ruby_api_buffer_input_data_cb,
|
||||
&weechat_ruby_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -644,8 +644,8 @@ weechat_ruby_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script,
|
||||
script);
|
||||
|
||||
if (interpreter)
|
||||
rb_gc_unregister_address (interpreter);
|
||||
@@ -660,7 +660,7 @@ weechat_ruby_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_ruby_plugin, ruby_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_ruby_plugin, ruby_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_ruby_unload (ptr_script);
|
||||
@@ -686,7 +686,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);
|
||||
ptr_script = plugin_script_search (weechat_ruby_plugin, ruby_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -737,29 +737,29 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_ruby_plugin, &weechat_ruby_load_cb);
|
||||
plugin_script_auto_load (weechat_ruby_plugin, &weechat_ruby_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_ruby_unload_all ();
|
||||
script_auto_load (weechat_ruby_plugin, &weechat_ruby_load_cb);
|
||||
plugin_script_auto_load (weechat_ruby_plugin, &weechat_ruby_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -770,19 +770,19 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_ruby_plugin, ruby_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Ruby script */
|
||||
path_script = script_search_path (weechat_ruby_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_ruby_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_ruby_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -823,7 +823,7 @@ weechat_ruby_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_ruby_plugin, completion, ruby_scripts);
|
||||
plugin_script_completion (weechat_ruby_plugin, completion, ruby_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -844,9 +844,9 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "ruby_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_ruby_plugin,
|
||||
ruby_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_ruby_plugin,
|
||||
ruby_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -868,7 +868,7 @@ weechat_ruby_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, RUBY_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_ruby_plugin, ruby_scripts);
|
||||
plugin_script_print_log (weechat_ruby_plugin, ruby_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -888,7 +888,7 @@ weechat_ruby_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (ruby_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (ruby_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -907,18 +907,18 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &ruby_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
&weechat_ruby_unload,
|
||||
&weechat_ruby_load,
|
||||
&ruby_action_install_list);
|
||||
plugin_script_action_install (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
&weechat_ruby_unload,
|
||||
&weechat_ruby_load,
|
||||
&ruby_action_install_list);
|
||||
}
|
||||
else if (data == &ruby_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
&weechat_ruby_unload,
|
||||
&ruby_action_remove_list);
|
||||
plugin_script_action_remove (weechat_ruby_plugin,
|
||||
ruby_scripts,
|
||||
&weechat_ruby_unload,
|
||||
&ruby_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -942,16 +942,16 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "ruby_script_install") == 0)
|
||||
{
|
||||
script_action_add (&ruby_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&ruby_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "ruby_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&ruby_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&ruby_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_remove_list);
|
||||
@@ -1079,11 +1079,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_ruby_load_cb;
|
||||
|
||||
ruby_quiet = 1;
|
||||
script_init (weechat_ruby_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_ruby_plugin, argc, argv, &init);
|
||||
ruby_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_ruby_plugin,
|
||||
ruby_scripts);
|
||||
plugin_script_display_short_list (weechat_ruby_plugin,
|
||||
ruby_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1098,7 +1098,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
ruby_quiet = 1;
|
||||
script_end (plugin, &ruby_scripts, &weechat_ruby_unload_all);
|
||||
plugin_script_end (plugin, &ruby_scripts, &weechat_ruby_unload_all);
|
||||
ruby_quiet = 0;
|
||||
|
||||
/*
|
||||
@@ -1,67 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
SET(LIB_SCRIPTS_SRC script.c script.h script-callback.c script-callback.h
|
||||
script-api.c script-api.h)
|
||||
|
||||
ADD_DEFINITIONS(${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_LIBRARY(weechat_scripts STATIC ${LIB_SCRIPTS_SRC})
|
||||
|
||||
IF(ENABLE_PERL)
|
||||
FIND_PACKAGE(Perl)
|
||||
IF(PERL_FOUND)
|
||||
ADD_SUBDIRECTORY( perl )
|
||||
ENDIF(PERL_FOUND)
|
||||
ENDIF(ENABLE_PERL)
|
||||
|
||||
IF(ENABLE_PYTHON)
|
||||
FIND_PACKAGE(Python)
|
||||
IF(PYTHON_FOUND)
|
||||
ADD_SUBDIRECTORY( python )
|
||||
ENDIF(PYTHON_FOUND)
|
||||
ENDIF(ENABLE_PYTHON)
|
||||
|
||||
IF(ENABLE_RUBY)
|
||||
FIND_PACKAGE(Ruby)
|
||||
IF(RUBY_FOUND)
|
||||
ADD_SUBDIRECTORY( ruby )
|
||||
ENDIF(RUBY_FOUND)
|
||||
ENDIF(ENABLE_RUBY)
|
||||
|
||||
IF(ENABLE_LUA)
|
||||
FIND_PACKAGE(Lua)
|
||||
IF(LUA_FOUND)
|
||||
ADD_SUBDIRECTORY( lua )
|
||||
ENDIF(LUA_FOUND)
|
||||
ENDIF(ENABLE_LUA)
|
||||
|
||||
IF(ENABLE_TCL)
|
||||
FIND_PACKAGE(TCL)
|
||||
IF(TCL_FOUND)
|
||||
ADD_SUBDIRECTORY( tcl )
|
||||
ENDIF(TCL_FOUND)
|
||||
ENDIF(ENABLE_TCL)
|
||||
|
||||
IF(ENABLE_GUILE)
|
||||
FIND_PACKAGE(Guile)
|
||||
IF(GUILE_FOUND)
|
||||
ADD_SUBDIRECTORY( guile )
|
||||
ENDIF(GUILE_FOUND)
|
||||
ENDIF(ENABLE_GUILE)
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LTLIBRARIES = lib_weechat_plugins_scripts.la
|
||||
|
||||
lib_weechat_plugins_scripts_la_SOURCES = script.c \
|
||||
script.h \
|
||||
script-callback.c \
|
||||
script-callback.h \
|
||||
script-api.c \
|
||||
script-api.h
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
endif
|
||||
|
||||
if PLUGIN_RUBY
|
||||
ruby_dir = ruby
|
||||
endif
|
||||
|
||||
if PLUGIN_LUA
|
||||
lua_dir = lua
|
||||
endif
|
||||
|
||||
if PLUGIN_TCL
|
||||
tcl_dir = tcl
|
||||
endif
|
||||
|
||||
if PLUGIN_GUILE
|
||||
guile_dir = guile
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(perl_dir) $(python_dir) $(ruby_dir) $(lua_dir) $(tcl_dir) $(guile_dir)
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WEECHAT_SCRIPT_API_H
|
||||
#define __WEECHAT_SCRIPT_API_H 1
|
||||
|
||||
extern void script_api_charset_set (struct t_plugin_script *script,
|
||||
const char *charset);
|
||||
extern struct t_config_file *script_api_config_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
int (*callback_reload)(void *data,
|
||||
struct t_config_file *config_file),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_config_section *script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file,
|
||||
const char *name,
|
||||
int user_can_add_options,
|
||||
int user_can_delete_options,
|
||||
int (*callback_read)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
const char *function_read,
|
||||
const char *data_read,
|
||||
int (*callback_write)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *section_name),
|
||||
const char *function_write,
|
||||
const char *data_write,
|
||||
int (*callback_write_default)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *section_name),
|
||||
const char *function_write_default,
|
||||
const char *data_write_default,
|
||||
int (*callback_create_option)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
const char *function_create_option,
|
||||
const char *data_create_option,
|
||||
int (*callback_delete_option)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
struct t_config_option *option),
|
||||
const char *function_delete_option,
|
||||
const char *data_delete_option);
|
||||
extern struct t_config_option *script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *name,
|
||||
const char *type,
|
||||
const char *description,
|
||||
const char *string_values,
|
||||
int min, int max,
|
||||
const char *default_value,
|
||||
const char *value,
|
||||
int null_value_allowed,
|
||||
int (*callback_check_value)(void *data,
|
||||
struct t_config_option *option,
|
||||
const char *value),
|
||||
const char *function_check_value,
|
||||
const char *data_check_value,
|
||||
void (*callback_change)(void *data,
|
||||
struct t_config_option *option),
|
||||
const char *function_change,
|
||||
const char *data_change,
|
||||
void (*callback_delete)(void *data,
|
||||
struct t_config_option *option),
|
||||
const char *function_delete,
|
||||
const char *data_delete);
|
||||
extern void script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_option *option);
|
||||
extern void script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void script_api_config_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file);
|
||||
extern void script_api_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *format, ...);
|
||||
extern void script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
time_t date, const char *tags,
|
||||
const char *format, ...);
|
||||
extern void script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
int y, const char *format, ...);
|
||||
extern void script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *format, ...);
|
||||
extern struct t_hook *script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command, const char *description,
|
||||
const char *args, const char *args_description,
|
||||
const char *completion,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
int argc, char **argv,
|
||||
char **argv_eol),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *command),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int interval, int align_second,
|
||||
int max_calls,
|
||||
int (*callback)(void *data,
|
||||
int remaining_calls),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int fd, int flag_read,
|
||||
int flag_write, int flag_exception,
|
||||
int (*callback)(void *data, int fd),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
struct t_hashtable *options,
|
||||
int timeout,
|
||||
int (*callback)(void *data,
|
||||
const char *command,
|
||||
int return_code,
|
||||
const char *out,
|
||||
const char *err),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_process (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *command,
|
||||
int timeout,
|
||||
int (*callback)(void *data,
|
||||
const char *command,
|
||||
int return_code,
|
||||
const char *out,
|
||||
const char *err),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *proxy,
|
||||
const char *address,
|
||||
int port,
|
||||
int sock,
|
||||
int ipv6,
|
||||
void *gnutls_sess,
|
||||
void *gnutls_cb,
|
||||
int gnutls_dhkey_size,
|
||||
const char *gnutls_priorities,
|
||||
const char *local_hostname,
|
||||
int (*callback)(void *data,
|
||||
int status,
|
||||
int gnutls_rc,
|
||||
const char *error,
|
||||
const char *ip_address),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *tags,
|
||||
const char *message,
|
||||
int strip_colors,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
time_t date,
|
||||
int tags_count,
|
||||
const char **tags,
|
||||
int displayed,
|
||||
int highlight,
|
||||
const char *prefix,
|
||||
const char *message),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data,
|
||||
const char *signal,
|
||||
const char *type_data,
|
||||
void *signal_data),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data,
|
||||
const char *signal,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option,
|
||||
int (*callback)(void *data,
|
||||
const char *option,
|
||||
const char *value),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *completion,
|
||||
const char *description,
|
||||
int (*callback)(void *data,
|
||||
const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *modifier,
|
||||
char *(*callback)(void *data,
|
||||
const char *modifier,
|
||||
const char *modifier_data,
|
||||
const char *string),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *info_name,
|
||||
const char *description,
|
||||
const char *args_description,
|
||||
const char *(*callback)(void *data,
|
||||
const char *info_name,
|
||||
const char *arguments),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *info_name,
|
||||
const char *description,
|
||||
const char *args_description,
|
||||
const char *output_description,
|
||||
struct t_hashtable *(*callback)(void *data,
|
||||
const char *info_name,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *infolist_name,
|
||||
const char *description,
|
||||
const char *pointer_description,
|
||||
const char *args_description,
|
||||
struct t_infolist *(*callback)(void *data,
|
||||
const char *infolist_name,
|
||||
void *pointer,
|
||||
const char *arguments),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *area,
|
||||
struct t_hashtable *(*callback)(void *data,
|
||||
struct t_hashtable *info),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_hook *hook);
|
||||
extern void script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script);
|
||||
extern struct t_gui_buffer *script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
int (*input_callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *input_data),
|
||||
const char *function_input,
|
||||
const char *data_input,
|
||||
int (*close_callback)(void *data,
|
||||
struct t_gui_buffer *buffer),
|
||||
const char *function_close,
|
||||
const char *data_close);
|
||||
extern void script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern struct t_gui_bar_item *script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *name,
|
||||
char *(*build_callback)(void *data,
|
||||
struct t_gui_bar_item *item,
|
||||
struct t_gui_window *window),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern void script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_bar_item *item);
|
||||
extern void script_api_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *command);
|
||||
extern const char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option, const char *value);
|
||||
extern void script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option,
|
||||
const char *description);
|
||||
extern int script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int script_api_upgrade_read (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_upgrade_file *upgrade_file,
|
||||
int (*callback_read)(void *data,
|
||||
struct t_upgrade_file *upgrade_file,
|
||||
int object_id,
|
||||
struct t_infolist *infolist),
|
||||
const char *function,
|
||||
const char *data);
|
||||
|
||||
#endif /* __WEECHAT_SCRIPT_API_H */
|
||||
@@ -30,7 +30,7 @@ IF(TCL_FOUND)
|
||||
|
||||
INCLUDE_DIRECTORIES(${TCL_INCLUDE_PATH})
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TCL_LFLAGS}")
|
||||
TARGET_LINK_LIBRARIES(tcl ${TCL_LIBRARY} weechat_scripts)
|
||||
TARGET_LINK_LIBRARIES(tcl ${TCL_LIBRARY} weechat_plugins_scripts)
|
||||
|
||||
ENDIF(TCL_FOUND)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,8 +31,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../script.h"
|
||||
#include "../weechat-plugin.h"
|
||||
#include "../plugin-script.h"
|
||||
#include "weechat-tcl.h"
|
||||
#include "weechat-tcl-api.h"
|
||||
|
||||
@@ -337,11 +337,11 @@ weechat_tcl_load (const char *filename)
|
||||
* set input/close callbacks for buffers created by this script
|
||||
* (to restore callbacks after upgrade)
|
||||
*/
|
||||
script_set_buffer_callbacks (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
tcl_current_script,
|
||||
&weechat_tcl_api_buffer_input_data_cb,
|
||||
&weechat_tcl_api_buffer_close_cb);
|
||||
plugin_script_set_buffer_callbacks (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
tcl_current_script,
|
||||
&weechat_tcl_api_buffer_input_data_cb,
|
||||
&weechat_tcl_api_buffer_close_cb);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -392,7 +392,7 @@ weechat_tcl_unload (struct t_plugin_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);
|
||||
plugin_script_remove (weechat_tcl_plugin, &tcl_scripts, &last_tcl_script, script);
|
||||
|
||||
Tcl_DeleteInterp(interp);
|
||||
}
|
||||
@@ -406,7 +406,7 @@ weechat_tcl_unload_name (const char *name)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
ptr_script = script_search (weechat_tcl_plugin, tcl_scripts, name);
|
||||
ptr_script = plugin_script_search (weechat_tcl_plugin, tcl_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_tcl_unload (ptr_script);
|
||||
@@ -445,7 +445,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);
|
||||
ptr_script = plugin_script_search (weechat_tcl_plugin, tcl_scripts, name);
|
||||
if (ptr_script)
|
||||
{
|
||||
filename = strdup (ptr_script->filename);
|
||||
@@ -483,29 +483,29 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 0);
|
||||
plugin_script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 1);
|
||||
plugin_script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
NULL, 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
{
|
||||
script_auto_load (weechat_tcl_plugin, &weechat_tcl_load_cb);
|
||||
plugin_script_auto_load (weechat_tcl_plugin, &weechat_tcl_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
weechat_tcl_unload_all ();
|
||||
script_auto_load (weechat_tcl_plugin, &weechat_tcl_load_cb);
|
||||
plugin_script_auto_load (weechat_tcl_plugin, &weechat_tcl_load_cb);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
@@ -516,19 +516,19 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
{
|
||||
if (weechat_strcasecmp (argv[1], "list") == 0)
|
||||
{
|
||||
script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
argv_eol[2], 0);
|
||||
plugin_script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
argv_eol[2], 0);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "listfull") == 0)
|
||||
{
|
||||
script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
argv_eol[2], 1);
|
||||
plugin_script_display_list (weechat_tcl_plugin, tcl_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Tcl script */
|
||||
path_script = script_search_path (weechat_tcl_plugin,
|
||||
argv_eol[2]);
|
||||
path_script = plugin_script_search_path (weechat_tcl_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_tcl_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
@@ -569,7 +569,7 @@ weechat_tcl_completion_cb (void *data, const char *completion_item,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
script_completion (weechat_tcl_plugin, completion, tcl_scripts);
|
||||
plugin_script_completion (weechat_tcl_plugin, completion, tcl_scripts);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -590,9 +590,9 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
|
||||
|
||||
if (weechat_strcasecmp (infolist_name, "tcl_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_tcl_plugin,
|
||||
tcl_scripts, pointer,
|
||||
arguments);
|
||||
return plugin_script_infolist_list_scripts (weechat_tcl_plugin,
|
||||
tcl_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -614,7 +614,7 @@ weechat_tcl_signal_debug_dump_cb (void *data, const char *signal,
|
||||
if (!signal_data
|
||||
|| (weechat_strcasecmp ((char *)signal_data, TCL_PLUGIN_NAME) == 0))
|
||||
{
|
||||
script_print_log (weechat_tcl_plugin, tcl_scripts);
|
||||
plugin_script_print_log (weechat_tcl_plugin, tcl_scripts);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -634,7 +634,7 @@ weechat_tcl_signal_buffer_closed_cb (void *data, const char *signal,
|
||||
(void) type_data;
|
||||
|
||||
if (signal_data)
|
||||
script_remove_buffer_callbacks (tcl_scripts, signal_data);
|
||||
plugin_script_remove_buffer_callbacks (tcl_scripts, signal_data);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -653,18 +653,18 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
|
||||
{
|
||||
if (data == &tcl_action_install_list)
|
||||
{
|
||||
script_action_install (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
&weechat_tcl_unload,
|
||||
&weechat_tcl_load,
|
||||
&tcl_action_install_list);
|
||||
plugin_script_action_install (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
&weechat_tcl_unload,
|
||||
&weechat_tcl_load,
|
||||
&tcl_action_install_list);
|
||||
}
|
||||
else if (data == &tcl_action_remove_list)
|
||||
{
|
||||
script_action_remove (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
&weechat_tcl_unload,
|
||||
&tcl_action_remove_list);
|
||||
plugin_script_action_remove (weechat_tcl_plugin,
|
||||
tcl_scripts,
|
||||
&weechat_tcl_unload,
|
||||
&tcl_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,16 +688,16 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
|
||||
{
|
||||
if (strcmp (signal, "tcl_script_install") == 0)
|
||||
{
|
||||
script_action_add (&tcl_action_install_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&tcl_action_install_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_tcl_timer_action_cb,
|
||||
&tcl_action_install_list);
|
||||
}
|
||||
else if (strcmp (signal, "tcl_script_remove") == 0)
|
||||
{
|
||||
script_action_add (&tcl_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
plugin_script_action_add (&tcl_action_remove_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_tcl_timer_action_cb,
|
||||
&tcl_action_remove_list);
|
||||
@@ -727,11 +727,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_load_file = &weechat_tcl_load_cb;
|
||||
|
||||
tcl_quiet = 1;
|
||||
script_init (weechat_tcl_plugin, argc, argv, &init);
|
||||
plugin_script_init (weechat_tcl_plugin, argc, argv, &init);
|
||||
tcl_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_tcl_plugin,
|
||||
tcl_scripts);
|
||||
plugin_script_display_short_list (weechat_tcl_plugin,
|
||||
tcl_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -746,7 +746,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
tcl_quiet = 1;
|
||||
script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
|
||||
plugin_script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
|
||||
tcl_quiet = 0;
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
Reference in New Issue
Block a user