EXPORT int dogechat_plugin_init (struct t_dogechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; dogechat_js_plugin = plugin; init.callback_command = &dogechat_js_command_cb; init.callback_completion = &dogechat_js_completion_cb; init.callback_hdata = &dogechat_js_hdata_cb; init.callback_infolist = &dogechat_js_infolist_cb; init.callback_signal_debug_dump = &dogechat_js_signal_debug_dump_cb; init.callback_signal_debug_libs = &dogechat_js_signal_debug_libs_cb; init.callback_signal_buffer_closed = &dogechat_js_signal_buffer_closed_cb; init.callback_signal_script_action = &dogechat_js_signal_script_action_cb; init.callback_load_file = &dogechat_js_load_cb; js_quiet = 1; plugin_script_init (plugin, argc, argv, &init); js_quiet = 0; plugin_script_display_short_list (dogechat_js_plugin, js_scripts); return DOGECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; weechat_lua_plugin = plugin; init.callback_command = &weechat_lua_command_cb; init.callback_completion = &weechat_lua_completion_cb; init.callback_hdata = &weechat_lua_hdata_cb; init.callback_infolist = &weechat_lua_infolist_cb; init.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb; init.callback_signal_buffer_closed = &weechat_lua_signal_buffer_closed_cb; init.callback_signal_script_action = &weechat_lua_signal_script_action_cb; init.callback_load_file = &weechat_lua_load_cb; lua_quiet = 1; plugin_script_init (weechat_lua_plugin, argc, argv, &init); lua_quiet = 0; plugin_script_display_short_list (weechat_lua_plugin, lua_scripts); /* init ok */ return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; #ifdef PERL_SYS_INIT3 int a; char **perl_args_local; char *perl_env[] = {}; a = perl_args_count; perl_args_local = perl_args; (void) perl_env; PERL_SYS_INIT3 (&a, (char ***)&perl_args_local, (char ***)&perl_env); #endif /* PERL_SYS_INIT3 */ weechat_perl_plugin = plugin; #ifndef MULTIPLICITY perl_main = perl_alloc (); if (!perl_main) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to initialize %s"), weechat_prefix ("error"), PERL_PLUGIN_NAME, PERL_PLUGIN_NAME); return WEECHAT_RC_ERROR; } perl_construct (perl_main); perl_parse (perl_main, weechat_perl_api_init, perl_args_count, perl_args, NULL); #endif /* MULTIPLICITY */ init.callback_command = &weechat_perl_command_cb; init.callback_completion = &weechat_perl_completion_cb; init.callback_hdata = &weechat_perl_hdata_cb; init.callback_infolist = &weechat_perl_infolist_cb; init.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb; init.callback_signal_debug_libs = &weechat_perl_signal_debug_libs_cb; init.callback_signal_script_action = &weechat_perl_signal_script_action_cb; init.callback_load_file = &weechat_perl_load_cb; perl_quiet = 1; plugin_script_init (weechat_perl_plugin, argc, argv, &init); perl_quiet = 0; plugin_script_display_short_list (weechat_perl_plugin, perl_scripts); weechat_hook_signal ("quit", &weechat_perl_signal_quit_upgrade_cb, NULL, NULL); weechat_hook_signal ("upgrade", &weechat_perl_signal_quit_upgrade_cb, NULL, NULL); /* init OK */ return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; weechat_guile_plugin = plugin; guile_stdout = NULL; #ifdef HAVE_GUILE_GMP_MEMORY_FUNCTIONS /* * prevent guile to use its own gmp allocator, because it can conflict * with other plugins using GnuTLS like relay, which can crash WeeChat * on unload (or exit) */ scm_install_gmp_memory_functions = 0; #endif /* HAVE_GUILE_GMP_MEMORY_FUNCTIONS */ scm_init_guile (); guile_module_weechat = scm_c_define_module ("weechat", &weechat_guile_api_module_init, NULL); scm_c_use_module ("weechat"); weechat_guile_catch (scm_gc_protect_object, (void *)guile_module_weechat); init.callback_command = &weechat_guile_command_cb; init.callback_completion = &weechat_guile_completion_cb; init.callback_hdata = &weechat_guile_hdata_cb; init.callback_infolist = &weechat_guile_infolist_cb; init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb; init.callback_signal_debug_libs = &weechat_guile_signal_debug_libs_cb; init.callback_signal_buffer_closed = &weechat_guile_signal_buffer_closed_cb; init.callback_signal_script_action = &weechat_guile_signal_script_action_cb; init.callback_load_file = &weechat_guile_load_cb; guile_quiet = 1; plugin_script_init (weechat_guile_plugin, argc, argv, &init); guile_quiet = 0; plugin_script_display_short_list (weechat_guile_plugin, guile_scripts); /* init OK */ return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_tcl_plugin = plugin; /* set interpreter name and version */ weechat_hashtable_set (plugin->variables, "interpreter_name", plugin->name); #ifdef TCL_VERSION weechat_hashtable_set (plugin->variables, "interpreter_version", TCL_VERSION); #else weechat_hashtable_set (plugin->variables, "interpreter_version", ""); #endif /* TCL_VERSION */ tcl_data.config_file = &tcl_config_file; tcl_data.config_look_check_license = &tcl_config_look_check_license; tcl_data.config_look_eval_keep_context = &tcl_config_look_eval_keep_context; tcl_data.scripts = &tcl_scripts; tcl_data.last_script = &last_tcl_script; tcl_data.callback_command = &weechat_tcl_command_cb; tcl_data.callback_completion = &weechat_tcl_completion_cb; tcl_data.callback_hdata = &weechat_tcl_hdata_cb; tcl_data.callback_info_eval = &weechat_tcl_info_eval_cb; tcl_data.callback_infolist = &weechat_tcl_infolist_cb; tcl_data.callback_signal_debug_dump = &weechat_tcl_signal_debug_dump_cb; tcl_data.callback_signal_script_action = &weechat_tcl_signal_script_action_cb; tcl_data.callback_load_file = &weechat_tcl_load_cb; tcl_data.unload_all = &weechat_tcl_unload_all; tcl_quiet = 1; plugin_script_init (weechat_tcl_plugin, argc, argv, &tcl_data); tcl_quiet = 0; plugin_script_display_short_list (weechat_tcl_plugin, tcl_scripts); /* init OK */ return WEECHAT_RC_OK; }
EXPORT int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { char str_interpreter[64]; weechat_js_plugin = plugin; /* set interpreter name and version */ snprintf (str_interpreter, sizeof (str_interpreter), "%s (v8)", plugin->name); weechat_hashtable_set (plugin->variables, "interpreter_name", str_interpreter); weechat_hashtable_set (plugin->variables, "interpreter_version", v8::V8::GetVersion()); js_data.config_file = &js_config_file; js_data.config_look_check_license = &js_config_look_check_license; js_data.config_look_eval_keep_context = &js_config_look_eval_keep_context; js_data.scripts = &js_scripts; js_data.last_script = &last_js_script; js_data.callback_command = &weechat_js_command_cb; js_data.callback_completion = &weechat_js_completion_cb; js_data.callback_hdata = &weechat_js_hdata_cb; js_data.callback_info_eval = &weechat_js_info_eval_cb; js_data.callback_infolist = &weechat_js_infolist_cb; js_data.callback_signal_debug_dump = &weechat_js_signal_debug_dump_cb; js_data.callback_signal_script_action = &weechat_js_signal_script_action_cb; js_data.callback_load_file = &weechat_js_load_cb; js_data.unload_all = &weechat_js_unload_all; js_quiet = 1; plugin_script_init (plugin, argc, argv, &js_data); js_quiet = 0; plugin_script_display_short_list (weechat_js_plugin, js_scripts); return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; weechat_python_plugin = plugin; /* * hook info to get path to python 2.x interpreter * (some scripts using hook_process need that) */ weechat_python_set_python2_bin (); weechat_hook_info ("python2_bin", N_("path to python 2.x interpreter"), NULL, &weechat_python_info_cb, NULL); /* init stdout/stderr buffer */ python_buffer_output[0] = '\0'; PyImport_AppendInittab("weechat", &weechat_python_init_module_weechat); Py_Initialize (); if (Py_IsInitialized () == 0) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to launch global " "interpreter"), weechat_prefix ("error"), PYTHON_PLUGIN_NAME); return WEECHAT_RC_ERROR; } /* PyEval_InitThreads(); */ /* python_mainThreadState = PyThreadState_Swap(NULL); */ python_mainThreadState = PyEval_SaveThread(); /* PyEval_ReleaseLock (); */ if (!python_mainThreadState) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to get current " "interpreter state"), weechat_prefix ("error"), PYTHON_PLUGIN_NAME); return WEECHAT_RC_ERROR; } init.callback_command = &weechat_python_command_cb; init.callback_completion = &weechat_python_completion_cb; init.callback_hdata = &weechat_python_hdata_cb; init.callback_infolist = &weechat_python_infolist_cb; init.callback_signal_debug_dump = &weechat_python_signal_debug_dump_cb; init.callback_signal_debug_libs = &weechat_python_signal_debug_libs_cb; init.callback_signal_buffer_closed = &weechat_python_signal_buffer_closed_cb; init.callback_signal_script_action = &weechat_python_signal_script_action_cb; init.callback_load_file = &weechat_python_load_cb; python_quiet = 1; plugin_script_init (weechat_python_plugin, argc, argv, &init); python_quiet = 0; plugin_script_display_short_list (weechat_python_plugin, python_scripts); /* init OK */ return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; int ruby_error; char *weechat_ruby_code = { "$stdout = WeechatOutputs\n" "$stderr = WeechatOutputs\n" "begin" " if RUBY_VERSION.split('.')[0] == '1' and RUBY_VERSION.split('.')[1] <= '8'\n" " require 'rubygems'\n" " else\n" " require 'enc/encdb.so'\n" " require 'enc/trans/transdb.so'\n" "\n" " require 'thread'\n" " class ::Mutex\n" " def synchronize(*args)\n" " yield\n" " end\n" " end\n" " require 'rubygems'\n" " end\n" "rescue LoadError\n" "end\n" "\n" "class Module\n" "\n" " def load_eval_file (file)\n" " lines = ''\n" " begin\n" " lines = File.read(file)\n" " rescue => e\n" " return 1\n" " end\n" "\n" " begin\n" " module_eval(lines)\n" " rescue Exception => e\n" " @load_eval_file_error = e\n" " return 2\n" " end\n" "\n" " has_init = false\n" "\n" " instance_methods.each do |meth|\n" " if meth.to_s == 'weechat_init'\n" " has_init = true\n" " end\n" " module_eval('module_function :' + meth.to_s)\n" " end\n" "\n" " unless has_init\n" " return 3\n" " end\n" "\n" " return 0\n" " end\n" "end\n" }; weechat_ruby_plugin = plugin; ruby_error = 0; /* init stdout/stderr buffer */ ruby_buffer_output[0] = '\0'; #if (defined(RUBY_API_VERSION_MAJOR) && defined(RUBY_API_VERSION_MINOR)) && (RUBY_API_VERSION_MAJOR >= 2 || (RUBY_API_VERSION_MAJOR == 1 && RUBY_API_VERSION_MINOR >= 9)) RUBY_INIT_STACK; #endif ruby_hide_errors = 1; ruby_init (); ruby_init_loadpath (); ruby_script ("__weechat_plugin__"); ruby_mWeechat = rb_define_module("Weechat"); weechat_ruby_api_init (ruby_mWeechat); /* redirect stdin and stdout */ ruby_mWeechatOutputs = rb_define_module("WeechatOutputs"); rb_define_singleton_method(ruby_mWeechatOutputs, "write", weechat_ruby_output, 1); rb_define_singleton_method(ruby_mWeechatOutputs, "puts", weechat_ruby_output, 1); rb_define_singleton_method(ruby_mWeechatOutputs, "p", weechat_ruby_output, 1); rb_define_singleton_method(ruby_mWeechatOutputs, "flush", weechat_ruby_output_flush, 0); ruby_hide_errors = 0; rb_eval_string_protect(weechat_ruby_code, &ruby_error); if (ruby_error) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to eval WeeChat ruby " "internal code"), weechat_prefix ("error"), RUBY_PLUGIN_NAME); VALUE err = rb_gv_get("$!"); weechat_ruby_print_exception(err); return WEECHAT_RC_ERROR; } init.callback_command = &weechat_ruby_command_cb; init.callback_completion = &weechat_ruby_completion_cb; init.callback_hdata = &weechat_ruby_hdata_cb; init.callback_infolist = &weechat_ruby_infolist_cb; init.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb; init.callback_signal_debug_libs = &weechat_ruby_signal_debug_libs_cb; init.callback_signal_buffer_closed = &weechat_ruby_signal_buffer_closed_cb; init.callback_signal_script_action = &weechat_ruby_signal_script_action_cb; init.callback_load_file = &weechat_ruby_load_cb; ruby_quiet = 1; plugin_script_init (weechat_ruby_plugin, argc, argv, &init); ruby_quiet = 0; plugin_script_display_short_list (weechat_ruby_plugin, ruby_scripts); /* init OK */ return WEECHAT_RC_OK; }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { #ifdef PERL_SYS_INIT3 int a; char **perl_args_local; char *perl_env[] = {}; a = perl_args_count; perl_args_local = perl_args; (void) perl_env; PERL_SYS_INIT3 (&a, (char ***)&perl_args_local, (char ***)&perl_env); #endif /* PERL_SYS_INIT3 */ weechat_perl_plugin = plugin; /* set interpreter name and version */ weechat_hashtable_set (plugin->variables, "interpreter_name", plugin->name); #ifdef PERL_VERSION_STRING weechat_hashtable_set (plugin->variables, "interpreter_version", PERL_VERSION_STRING); #else weechat_hashtable_set (plugin->variables, "interpreter_version", ""); #endif /* PERL_VERSION_STRING */ /* init stdout/stderr buffer */ perl_buffer_output = weechat_string_dyn_alloc (256); if (!perl_buffer_output) return WEECHAT_RC_ERROR; #ifndef MULTIPLICITY perl_main = perl_alloc (); if (!perl_main) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to initialize %s"), weechat_prefix ("error"), PERL_PLUGIN_NAME, PERL_PLUGIN_NAME); return WEECHAT_RC_ERROR; } perl_construct (perl_main); perl_parse (perl_main, weechat_perl_api_init, perl_args_count, perl_args, NULL); #endif /* MULTIPLICITY */ perl_data.config_file = &perl_config_file; perl_data.config_look_check_license = &perl_config_look_check_license; perl_data.config_look_eval_keep_context = &perl_config_look_eval_keep_context; perl_data.scripts = &perl_scripts; perl_data.last_script = &last_perl_script; perl_data.callback_command = &weechat_perl_command_cb; perl_data.callback_completion = &weechat_perl_completion_cb; perl_data.callback_hdata = &weechat_perl_hdata_cb; perl_data.callback_info_eval = &weechat_perl_info_eval_cb; perl_data.callback_infolist = &weechat_perl_infolist_cb; perl_data.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb; perl_data.callback_signal_script_action = &weechat_perl_signal_script_action_cb; perl_data.callback_load_file = &weechat_perl_load_cb; perl_data.unload_all = &weechat_perl_unload_all; perl_quiet = 1; plugin_script_init (weechat_perl_plugin, argc, argv, &perl_data); perl_quiet = 0; plugin_script_display_short_list (weechat_perl_plugin, perl_scripts); weechat_hook_signal ("quit", &weechat_perl_signal_quit_upgrade_cb, NULL, NULL); weechat_hook_signal ("upgrade", &weechat_perl_signal_quit_upgrade_cb, NULL, NULL); /* init OK */ return WEECHAT_RC_OK; }