mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 00:03:12 +02:00
Updated doc, renamed functions in plugins API
This commit is contained in:
@@ -67,12 +67,12 @@ weechat_lua_exec (t_weechat_plugin *plugin,
|
||||
|
||||
if ( lua_pcall(lua_current_interpreter, 2, 1, 0) != 0)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unable to run function \"%s\"",
|
||||
function);
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unable to run function \"%s\"",
|
||||
function);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ weechat_lua_register (lua_State *L)
|
||||
|
||||
if (n != 4)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -131,11 +131,11 @@ weechat_lua_register (lua_State *L)
|
||||
if (weechat_script_search (lua_plugin, &lua_scripts, (char *) name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -151,17 +151,17 @@ weechat_lua_register (lua_State *L)
|
||||
(char *) description);
|
||||
if (lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -184,9 +184,9 @@ weechat_lua_print (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to print message, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to print message, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -212,17 +212,17 @@ weechat_lua_print (lua_State *L)
|
||||
message = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
lua_plugin->printf (lua_plugin,
|
||||
(char *) server_name,
|
||||
(char *) channel_name,
|
||||
"%s", (char *) message);
|
||||
lua_plugin->print (lua_plugin,
|
||||
(char *) server_name,
|
||||
(char *) channel_name,
|
||||
"%s", (char *) message);
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, 1);
|
||||
return 1;
|
||||
@@ -242,9 +242,9 @@ weechat_lua_print_infobar (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -256,9 +256,9 @@ weechat_lua_print_infobar (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ weechat_lua_print_infobar (lua_State *L)
|
||||
delay = lua_tonumber (lua_current_interpreter, -2);
|
||||
message = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
lua_plugin->infobar_printf (lua_plugin, delay, "%s", (char *) message);
|
||||
lua_plugin->print_infobar (lua_plugin, delay, "%s", (char *) message);
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, 1);
|
||||
return 1;
|
||||
@@ -286,9 +286,9 @@ weechat_lua_log (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to print message, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to print message, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -314,9 +314,9 @@ weechat_lua_log (lua_State *L)
|
||||
message = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -344,9 +344,9 @@ weechat_lua_command (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to run command, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to run command, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -372,9 +372,9 @@ weechat_lua_command (lua_State *L)
|
||||
command = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -402,9 +402,9 @@ weechat_lua_add_message_handler (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -416,9 +416,9 @@ weechat_lua_add_message_handler (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -453,9 +453,9 @@ weechat_lua_add_command_handler (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -484,9 +484,9 @@ weechat_lua_add_command_handler (lua_State *L)
|
||||
completion_template = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -523,9 +523,9 @@ weechat_lua_remove_handler (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -537,9 +537,9 @@ weechat_lua_remove_handler (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -569,9 +569,9 @@ weechat_lua_get_info (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get info, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get info, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -591,9 +591,9 @@ weechat_lua_get_info (lua_State *L)
|
||||
server_name = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -624,9 +624,9 @@ weechat_lua_get_dcc_info (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -738,9 +738,9 @@ weechat_lua_get_config (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get config option, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get config option, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -751,9 +751,9 @@ weechat_lua_get_config (lua_State *L)
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -783,9 +783,9 @@ weechat_lua_set_config (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to set config option, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to set config option, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -797,9 +797,9 @@ weechat_lua_set_config (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -830,9 +830,9 @@ weechat_lua_get_plugin_config (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -843,9 +843,9 @@ weechat_lua_get_plugin_config (lua_State *L)
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -877,9 +877,9 @@ weechat_lua_set_plugin_config (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -891,9 +891,9 @@ weechat_lua_set_plugin_config (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -925,9 +925,9 @@ weechat_lua_get_server_info (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -1079,9 +1079,9 @@ weechat_lua_get_channel_info (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -1092,9 +1092,9 @@ weechat_lua_get_channel_info (lua_State *L)
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -1162,9 +1162,9 @@ weechat_lua_get_nick_info (lua_State *L)
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: unable to get nick infos, "
|
||||
"script not initialized");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to get nick infos, "
|
||||
"script not initialized");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -1176,9 +1176,9 @@ weechat_lua_get_nick_info (lua_State *L)
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
lua_pushnil (lua_current_interpreter);
|
||||
return 1;
|
||||
}
|
||||
@@ -1308,13 +1308,13 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
"io.stderr = weechat_outputs\n"
|
||||
};
|
||||
|
||||
plugin->printf_server (plugin, "Loading Lua script \"%s\"", filename);
|
||||
plugin->print_server (plugin, "Loading Lua script \"%s\"", filename);
|
||||
|
||||
if ((fp = fopen (filename, "r")) == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unable to open file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unable to open file \"%s\"",
|
||||
filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1324,8 +1324,8 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (lua_current_interpreter == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unable to create new sub-interpreter");
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unable to create new sub-interpreter");
|
||||
fclose (fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -1340,19 +1340,19 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
luaL_openlib (lua_current_interpreter, "weechat", weechat_lua_funcs, 0);
|
||||
|
||||
if (lua_dostring (lua_current_interpreter, weechat_lua_code) != 0)
|
||||
plugin->printf_server (plugin,
|
||||
"Lua warning: unable to redirect stdout and stderr");
|
||||
plugin->print_server (plugin,
|
||||
"Lua warning: unable to redirect stdout and stderr");
|
||||
|
||||
lua_current_script_filename = strdup (filename);
|
||||
|
||||
if (luaL_loadfile (lua_current_interpreter, filename) != 0)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unable to load file \"%s\"",
|
||||
filename);
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unable to load file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
free (lua_current_script_filename);
|
||||
lua_close (lua_current_interpreter);
|
||||
fclose (fp);
|
||||
@@ -1361,12 +1361,12 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (lua_pcall (lua_current_interpreter, 0, 0, 0) != 0)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unable to execute file \"%s\"",
|
||||
filename);
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unable to execute file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
free (lua_current_script_filename);
|
||||
lua_close (lua_current_interpreter);
|
||||
fclose (fp);
|
||||
@@ -1381,10 +1381,10 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (lua_current_script == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
lua_close (lua_current_interpreter);
|
||||
return 0;
|
||||
}
|
||||
@@ -1401,9 +1401,9 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
void
|
||||
weechat_lua_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading Lua script \"%s\"",
|
||||
script->name);
|
||||
plugin->print_server (plugin,
|
||||
"Unloading Lua script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
weechat_lua_exec (plugin, script, script->shutdown_func, "", "");
|
||||
@@ -1426,15 +1426,15 @@ weechat_lua_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_lua_unload (plugin, ptr_script);
|
||||
plugin->printf_server (plugin,
|
||||
"Lua script \"%s\" unloaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Lua script \"%s\" unloaded",
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: script \"%s\" not loaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: script \"%s\" not loaded",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1445,13 +1445,13 @@ weechat_lua_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
void
|
||||
weechat_lua_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading all Lua scripts");
|
||||
plugin->print_server (plugin,
|
||||
"Unloading all Lua scripts");
|
||||
while (lua_scripts)
|
||||
weechat_lua_unload (plugin, lua_scripts);
|
||||
|
||||
plugin->printf_server (plugin,
|
||||
"Lua scripts unloaded");
|
||||
plugin->print_server (plugin,
|
||||
"Lua scripts unloaded");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1486,26 +1486,26 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
{
|
||||
case 0:
|
||||
/* list registered Lua scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Lua scripts:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Registered Lua scripts:");
|
||||
if (lua_scripts)
|
||||
{
|
||||
for (ptr_script = lua_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
plugin->print_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Lua message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Lua message handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Lua message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1514,17 +1514,17 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Lua(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " IRC(%s) => Lua(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Lua command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Lua command handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Lua command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1533,13 +1533,13 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Lua(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " /%s => Lua(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
@@ -1586,14 +1586,14 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: unknown option for "
|
||||
"\"lua\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: unknown option for "
|
||||
"\"lua\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Lua error: wrong argument count for \"lua\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: wrong argument count for \"lua\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
@@ -1612,7 +1612,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
|
||||
lua_plugin = plugin;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Lua module \"weechat\"");
|
||||
plugin->print_server (plugin, "Loading Lua module \"weechat\"");
|
||||
|
||||
plugin->cmd_handler_add (plugin, "lua",
|
||||
"list/load/unload Lua scripts",
|
||||
@@ -1641,6 +1641,6 @@ weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
/* unload all scripts */
|
||||
weechat_lua_unload_all (plugin);
|
||||
|
||||
lua_plugin->printf_server (lua_plugin,
|
||||
"Lua plugin ended");
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua plugin ended");
|
||||
}
|
||||
|
||||
@@ -146,16 +146,16 @@ weechat_perl_exec (t_weechat_plugin *plugin,
|
||||
return_code = PLUGIN_RC_KO;
|
||||
if (SvTRUE (sv))
|
||||
{
|
||||
plugin->printf_server (plugin, "Perl error: %s", SvPV (sv, count));
|
||||
plugin->print_server (plugin, "Perl error: %s", SvPV (sv, count));
|
||||
POPs;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count != 1)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: too much values from \"%s\" (%d). Expected: 1.",
|
||||
function, count);
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: too much values from \"%s\" (%d). Expected: 1.",
|
||||
function, count);
|
||||
}
|
||||
else
|
||||
return_code = POPi;
|
||||
@@ -204,9 +204,9 @@ static XS (XS_weechat_register)
|
||||
|
||||
if (items != 4)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,11 @@ static XS (XS_weechat_register)
|
||||
if (weechat_script_search (perl_plugin, &perl_scripts, name))
|
||||
{
|
||||
/* error: another script already exists with this name! */
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -235,17 +235,17 @@ static XS (XS_weechat_register)
|
||||
description);
|
||||
if (perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -267,17 +267,17 @@ static XS (XS_weechat_print)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to print message, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to print message, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -293,9 +293,9 @@ static XS (XS_weechat_print)
|
||||
server_name = SvPV (ST (2), integer);
|
||||
}
|
||||
|
||||
perl_plugin->printf (perl_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
perl_plugin->print (perl_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -314,24 +314,24 @@ static XS (XS_weechat_print_infobar)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
perl_plugin->infobar_printf (perl_plugin,
|
||||
SvIV (ST (0)),
|
||||
"%s",
|
||||
SvPV (ST (1), integer));
|
||||
perl_plugin->print_infobar (perl_plugin,
|
||||
SvIV (ST (0)),
|
||||
"%s",
|
||||
SvPV (ST (1), integer));
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
@@ -351,17 +351,17 @@ static XS (XS_weechat_log)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to print message, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to print message, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -399,17 +399,17 @@ static XS (XS_weechat_command)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to run command, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to run command, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -445,17 +445,17 @@ static XS (XS_weechat_add_message_handler)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -486,17 +486,17 @@ static XS (XS_weechat_add_command_handler)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -536,17 +536,17 @@ static XS (XS_weechat_remove_handler)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -574,17 +574,17 @@ static XS (XS_weechat_get_info)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get info, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get info, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -627,9 +627,9 @@ static XS (XS_weechat_get_dcc_info)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@@ -688,17 +688,17 @@ static XS (XS_weechat_get_config)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get config option, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get config option, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -735,17 +735,17 @@ static XS (XS_weechat_set_config)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to set config option, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to set config option, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -776,17 +776,17 @@ static XS (XS_weechat_get_plugin_config)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -825,17 +825,17 @@ static XS (XS_weechat_set_plugin_config)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -870,9 +870,9 @@ static XS (XS_weechat_get_server_info)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get server info, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get server info, "
|
||||
"script not initialized");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@@ -950,17 +950,17 @@ static XS (XS_weechat_get_channel_info)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get channel info, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get channel info, "
|
||||
"script not initialized");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items != 1)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@@ -1018,17 +1018,17 @@ static XS (XS_weechat_get_nick_info)
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: unable to get nick info, "
|
||||
"script not initialized");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to get nick info, "
|
||||
"script not initialized");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items != 2)
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
char *perl_args[] = { "", "-e", "0" };
|
||||
#endif
|
||||
|
||||
plugin->printf_server (plugin, "Loading Perl script \"%s\"", filename);
|
||||
plugin->print_server (plugin, "Loading Perl script \"%s\"", filename);
|
||||
perl_current_script = NULL;
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
@@ -1135,8 +1135,8 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (perl_current_interpreter == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unable to create new sub-interpreter");
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unable to create new sub-interpreter");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1158,27 +1158,27 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
if (eval == 2)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unable to parse file \"%s\"",
|
||||
filename);
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: %s",
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unable to parse file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: %s",
|
||||
#ifndef MULTIPLICITY
|
||||
SvPV(perl_get_sv("WeechatPerlScriptLoader::weechat_perl_load_eval_file_error", FALSE), len));
|
||||
SvPV(perl_get_sv("WeechatPerlScriptLoader::weechat_perl_load_eval_file_error", FALSE), len));
|
||||
#else
|
||||
SvPV(perl_get_sv("weechat_perl_load_eval_file_error", FALSE), len));
|
||||
SvPV(perl_get_sv("weechat_perl_load_eval_file_error", FALSE), len));
|
||||
#endif
|
||||
}
|
||||
else if ( eval == 1)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unable to run file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unable to run file \"%s\"",
|
||||
filename);
|
||||
}
|
||||
else {
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unknown error while loading file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unknown error while loading file \"%s\"",
|
||||
filename);
|
||||
}
|
||||
#ifdef MULTIPLICITY
|
||||
perl_destruct (perl_current_interpreter);
|
||||
@@ -1190,11 +1190,12 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (perl_current_script == NULL) {
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
if (perl_current_script == NULL)
|
||||
{
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
#ifdef MULTIPLICITY
|
||||
perl_destruct (perl_current_interpreter);
|
||||
perl_free (perl_current_interpreter);
|
||||
@@ -1218,9 +1219,9 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
void
|
||||
weechat_perl_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading Perl script \"%s\"",
|
||||
script->name);
|
||||
plugin->print_server (plugin,
|
||||
"Unloading Perl script \"%s\"",
|
||||
script->name);
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
eval_pv(script->interpreter, TRUE);
|
||||
@@ -1255,15 +1256,15 @@ weechat_perl_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_perl_unload (plugin, ptr_script);
|
||||
plugin->printf_server (plugin,
|
||||
"Perl script \"%s\" unloaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Perl script \"%s\" unloaded",
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: script \"%s\" not loaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: script \"%s\" not loaded",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1274,13 +1275,13 @@ weechat_perl_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
void
|
||||
weechat_perl_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading all Perl scripts");
|
||||
plugin->print_server (plugin,
|
||||
"Unloading all Perl scripts");
|
||||
while (perl_scripts)
|
||||
weechat_perl_unload (plugin, perl_scripts);
|
||||
|
||||
plugin->printf_server (plugin,
|
||||
"Perl scripts unloaded");
|
||||
plugin->print_server (plugin,
|
||||
"Perl scripts unloaded");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1315,26 +1316,26 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
{
|
||||
case 0:
|
||||
/* list registered Perl scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Perl scripts:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Registered Perl scripts:");
|
||||
if (perl_scripts)
|
||||
{
|
||||
for (ptr_script = perl_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
plugin->print_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Perl message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Perl message handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Perl message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1343,17 +1344,17 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Perl(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " IRC(%s) => Perl(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Perl command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Perl command handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Perl command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1362,13 +1363,13 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Perl(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " /%s => Perl(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
@@ -1415,14 +1416,14 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unknown option for "
|
||||
"\"perl\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unknown option for "
|
||||
"\"perl\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: wrong argument count for \"perl\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: wrong argument count for \"perl\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
@@ -1441,18 +1442,18 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
perl_plugin = plugin;
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
plugin->printf_server (plugin, "Loading Perl module \"weechat\"");
|
||||
plugin->print_server (plugin, "Loading Perl module \"weechat\"");
|
||||
#else
|
||||
char *perl_args[] = { "", "-e", "0" };
|
||||
|
||||
plugin->printf_server (plugin, "Loading Perl module \"weechat\" (without multiplicity)");
|
||||
plugin->print_server (plugin, "Loading Perl module \"weechat\" (without multiplicity)");
|
||||
|
||||
main_perl = perl_alloc ();
|
||||
|
||||
if (!main_perl)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Perl error: unable to initialize Perl");
|
||||
plugin->print_server (plugin,
|
||||
"Perl error: unable to initialize Perl");
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -1498,6 +1499,6 @@ weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
}
|
||||
#endif
|
||||
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl plugin ended");
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl plugin ended");
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
|
||||
if ( !(evFunc && PyCallable_Check (evFunc)) )
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to run function \"%s\"",
|
||||
function);
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to run function \"%s\"",
|
||||
function);
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -128,20 +128,20 @@ weechat_python_register (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ssss", &name, &version, &shutdown_func, &description))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
if (weechat_script_search (python_plugin, &python_scripts, name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
name);
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -154,17 +154,17 @@ weechat_python_register (PyObject *self, PyObject *args)
|
||||
description);
|
||||
if (python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
name);
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ weechat_python_print (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to print message, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to print message, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -197,15 +197,15 @@ weechat_python_print (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &message, &channel_name, &server_name))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
python_plugin->printf (python_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
python_plugin->print (python_plugin,
|
||||
server_name, channel_name,
|
||||
"%s", message);
|
||||
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
@@ -225,9 +225,9 @@ weechat_python_print_infobar (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -236,13 +236,13 @@ weechat_python_print_infobar (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "is", &delay, &message))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
python_plugin->infobar_printf (python_plugin, delay, "%s", message);
|
||||
python_plugin->print_infobar (python_plugin, delay, "%s", message);
|
||||
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
@@ -261,9 +261,9 @@ weechat_python_log (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to log message, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to log message, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -273,9 +273,9 @@ weechat_python_log (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &message, &channel_name, &server_name))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -300,9 +300,9 @@ weechat_python_command (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to run command, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to run command, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -312,9 +312,9 @@ weechat_python_command (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &command, &channel_name, &server_name))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -339,9 +339,9 @@ weechat_python_add_message_handler (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -350,9 +350,9 @@ weechat_python_add_message_handler (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &irc_command, &function))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -379,9 +379,9 @@ weechat_python_add_command_handler (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -396,9 +396,9 @@ weechat_python_add_command_handler (PyObject *self, PyObject *args)
|
||||
&description, &arguments, &arguments_description,
|
||||
completion_template))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -430,9 +430,9 @@ weechat_python_remove_handler (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -441,9 +441,9 @@ weechat_python_remove_handler (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &command, &function))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -468,9 +468,9 @@ weechat_python_get_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get info, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get info, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -479,9 +479,9 @@ weechat_python_get_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|s", &arg, &server_name))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -519,9 +519,9 @@ weechat_python_get_dcc_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
@@ -616,9 +616,9 @@ weechat_python_get_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get config option, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get config option, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -626,9 +626,9 @@ weechat_python_get_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -661,9 +661,9 @@ weechat_python_set_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to set config option, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to set config option, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -672,9 +672,9 @@ weechat_python_set_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &option, &value))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -702,9 +702,9 @@ weechat_python_get_plugin_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -712,9 +712,9 @@ weechat_python_get_plugin_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -749,9 +749,9 @@ weechat_python_set_plugin_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -760,9 +760,9 @@ weechat_python_set_plugin_config (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &option, &value))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -794,9 +794,9 @@ weechat_python_get_server_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -897,18 +897,18 @@ weechat_python_get_channel_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
server = NULL;
|
||||
if (!PyArg_ParseTuple (args, "s", &server))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -964,9 +964,9 @@ weechat_python_get_nick_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get nick infos, "
|
||||
"script not initialized");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get nick infos, "
|
||||
"script not initialized");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -974,9 +974,9 @@ weechat_python_get_nick_info (PyObject *self, PyObject *args)
|
||||
channel = NULL;
|
||||
if (!PyArg_ParseTuple (args, "ss", &server, &channel))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
@@ -1047,9 +1047,9 @@ weechat_python_output (PyObject *self, PyObject *args)
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &msg))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to get "
|
||||
"stdout/stderr message(s)");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to get "
|
||||
"stdout/stderr message(s)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1057,8 +1057,8 @@ weechat_python_output (PyObject *self, PyObject *args)
|
||||
*p = '\0';
|
||||
|
||||
if (strlen(msg) > 0)
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python stdin/stdout: %s", msg);
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python stdin/stdout: %s", msg);
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
@@ -1084,13 +1084,13 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
PyThreadState *python_current_interpreter;
|
||||
PyObject *weechat_module, *weechat_outputs, *weechat_dict;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Python script \"%s\"", filename);
|
||||
plugin->print_server (plugin, "Loading Python script \"%s\"", filename);
|
||||
|
||||
if ((fp = fopen (filename, "r")) == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to open file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to open file \"%s\"",
|
||||
filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1101,8 +1101,8 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (python_current_interpreter == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to create new sub-interpreter");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to create new sub-interpreter");
|
||||
fclose (fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -1113,8 +1113,8 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if ( weechat_module == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to initialize WeeChat module");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to initialize WeeChat module");
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
fclose (fp);
|
||||
return 0;
|
||||
@@ -1131,26 +1131,26 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs);
|
||||
if (weechat_outputs == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python warning: unable to redirect stdout and stderr");
|
||||
plugin->print_server (plugin,
|
||||
"Python warning: unable to redirect stdout and stderr");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PySys_SetObject("stdout", weechat_outputs) == -1)
|
||||
plugin->printf_server (plugin,
|
||||
"Python warning: unable to redirect stdout");
|
||||
plugin->print_server (plugin,
|
||||
"Python warning: unable to redirect stdout");
|
||||
if (PySys_SetObject("stderr", weechat_outputs) == -1)
|
||||
plugin->printf_server (plugin,
|
||||
"Python warning: unable to redirect stderr");
|
||||
plugin->print_server (plugin,
|
||||
"Python warning: unable to redirect stderr");
|
||||
}
|
||||
|
||||
python_current_script_filename = strdup (filename);
|
||||
|
||||
if (PyRun_SimpleFile (fp, filename) != 0)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to parse file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to parse file \"%s\"",
|
||||
filename);
|
||||
free (python_current_script_filename);
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
fclose (fp);
|
||||
@@ -1168,10 +1168,10 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (python_current_script == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Python error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
return 0;
|
||||
}
|
||||
@@ -1188,9 +1188,9 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
void
|
||||
weechat_python_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading Python script \"%s\"",
|
||||
script->name);
|
||||
plugin->print_server (plugin,
|
||||
"Unloading Python script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
weechat_python_exec (plugin, script, script->shutdown_func, "", "");
|
||||
@@ -1214,15 +1214,15 @@ weechat_python_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_python_unload (plugin, ptr_script);
|
||||
plugin->printf_server (plugin,
|
||||
"Python script \"%s\" unloaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Python script \"%s\" unloaded",
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: script \"%s\" not loaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Python error: script \"%s\" not loaded",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1233,13 +1233,13 @@ weechat_python_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
void
|
||||
weechat_python_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading all Python scripts");
|
||||
plugin->print_server (plugin,
|
||||
"Unloading all Python scripts");
|
||||
while (python_scripts)
|
||||
weechat_python_unload (plugin, python_scripts);
|
||||
|
||||
plugin->printf_server (plugin,
|
||||
"Python scripts unloaded");
|
||||
plugin->print_server (plugin,
|
||||
"Python scripts unloaded");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1274,26 +1274,26 @@ weechat_python_cmd (t_weechat_plugin *plugin,
|
||||
{
|
||||
case 0:
|
||||
/* list registered Python scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Python scripts:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Registered Python scripts:");
|
||||
if (python_scripts)
|
||||
{
|
||||
for (ptr_script = python_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
plugin->print_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Python message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Python message handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Python message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1302,17 +1302,17 @@ weechat_python_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Python(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " IRC(%s) => Python(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Python command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Python command handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Python command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1321,13 +1321,13 @@ weechat_python_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Python(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " /%s => Python(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
@@ -1374,14 +1374,14 @@ weechat_python_cmd (t_weechat_plugin *plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unknown option for "
|
||||
"\"python\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unknown option for "
|
||||
"\"python\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: wrong argument count for \"python\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: wrong argument count for \"python\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
@@ -1400,13 +1400,13 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
|
||||
python_plugin = plugin;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Python module \"weechat\"");
|
||||
plugin->print_server (plugin, "Loading Python module \"weechat\"");
|
||||
|
||||
Py_Initialize ();
|
||||
if (Py_IsInitialized () == 0)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to launch global interpreter");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to launch global interpreter");
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -1416,8 +1416,8 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
|
||||
if (python_mainThreadState == NULL)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Python error: unable to get current interpreter state");
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to get current interpreter state");
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -1457,9 +1457,9 @@ weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
|
||||
Py_Finalize ();
|
||||
if (Py_IsInitialized () != 0)
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: unable to free interpreter");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python error: unable to free interpreter");
|
||||
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python plugin ended");
|
||||
python_plugin->print_server (python_plugin,
|
||||
"Python plugin ended");
|
||||
}
|
||||
|
||||
@@ -119,9 +119,9 @@ weechat_ruby_exec (t_weechat_plugin *plugin,
|
||||
rb_str_new2((arguments == NULL) ? "" : arguments));
|
||||
if (ruby_error)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to run function \"%s\"",
|
||||
function);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to run function \"%s\"",
|
||||
function);
|
||||
|
||||
rb_eval_string_protect("Weechat.print(\"Ruby error: \" + $@.to_s)", NULL);
|
||||
rb_eval_string_protect("Weechat.print(\"Ruby error: \" + $!.to_s)", NULL);
|
||||
@@ -163,9 +163,9 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
|
||||
if (NIL_P (name) || NIL_P (version) || NIL_P (shutdown_func) || NIL_P (description))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -182,11 +182,11 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
if (weechat_script_search (ruby_plugin, &ruby_scripts, c_name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
c_name);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -199,17 +199,17 @@ weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
c_description);
|
||||
if (ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
c_name, c_version, c_description);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
c_name, c_version, c_description);
|
||||
}
|
||||
else
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
c_name);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -231,9 +231,9 @@ weechat_ruby_print (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print message, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to print message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -248,9 +248,9 @@ weechat_ruby_print (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -269,9 +269,9 @@ weechat_ruby_print (int argc, VALUE *argv, VALUE class)
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
}
|
||||
|
||||
ruby_plugin->printf (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
"%s", c_message);
|
||||
ruby_plugin->print (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
"%s", c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
@@ -291,9 +291,9 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -302,9 +302,9 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
|
||||
if (NIL_P (delay) || NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
c_delay = FIX2INT (delay);
|
||||
c_message = STR2CSTR (message);
|
||||
|
||||
ruby_plugin->infobar_printf (ruby_plugin, c_delay, "%s", c_message);
|
||||
ruby_plugin->print_infobar (ruby_plugin, c_delay, "%s", c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
@@ -334,9 +334,9 @@ weechat_ruby_log (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to log message, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to log message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -351,9 +351,9 @@ weechat_ruby_log (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"log\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ weechat_ruby_command (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to run command, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to run command, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -411,9 +411,9 @@ weechat_ruby_command (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (NIL_P (command))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -453,9 +453,9 @@ weechat_ruby_add_message_handler (VALUE class, VALUE message, VALUE function)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -464,9 +464,9 @@ weechat_ruby_add_message_handler (VALUE class, VALUE message, VALUE function)
|
||||
|
||||
if (NIL_P (message) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -501,9 +501,9 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
return INT2FIX (0);
|
||||
@@ -588,9 +588,9 @@ weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -599,9 +599,9 @@ weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -632,9 +632,9 @@ weechat_ruby_get_info (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get info, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -647,9 +647,9 @@ weechat_ruby_get_info (int argc, VALUE *argv, VALUE class)
|
||||
|
||||
if (NIL_P (arg))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -695,9 +695,9 @@ weechat_ruby_get_dcc_info (VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -791,9 +791,9 @@ weechat_ruby_get_config (VALUE class, VALUE option)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get config option, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -801,9 +801,9 @@ weechat_ruby_get_config (VALUE class, VALUE option)
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -839,9 +839,9 @@ weechat_ruby_set_config (VALUE class, VALUE option, VALUE value)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set config option, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to set config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -850,9 +850,9 @@ weechat_ruby_set_config (VALUE class, VALUE option, VALUE value)
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -886,9 +886,9 @@ weechat_ruby_get_plugin_config (VALUE class, VALUE option)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -896,9 +896,9 @@ weechat_ruby_get_plugin_config (VALUE class, VALUE option)
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -936,9 +936,9 @@ weechat_ruby_set_plugin_config (VALUE class, VALUE option, VALUE value)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -947,9 +947,9 @@ weechat_ruby_set_plugin_config (VALUE class, VALUE option, VALUE value)
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -986,9 +986,9 @@ weechat_ruby_get_server_info (VALUE class)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get server infos, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -1089,18 +1089,18 @@ weechat_ruby_get_channel_info (VALUE class, VALUE server)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_server = NULL;
|
||||
if (NIL_P (server))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_channel_info\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -1162,9 +1162,9 @@ weechat_ruby_get_nick_info (VALUE class, VALUE server, VALUE channel)
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to get channel infos, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -1172,9 +1172,9 @@ weechat_ruby_get_nick_info (VALUE class, VALUE server, VALUE channel)
|
||||
c_channel = NULL;
|
||||
if (NIL_P (server) || NIL_P (channel))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_nick_info\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
@@ -1230,8 +1230,8 @@ weechat_ruby_output(VALUE self, VALUE str)
|
||||
*p = '\0';
|
||||
|
||||
if (strlen(msg) > 0)
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby stdout/stderr: %s", msg);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby stdout/stderr: %s", msg);
|
||||
if (msg)
|
||||
free (msg);
|
||||
|
||||
@@ -1250,7 +1250,7 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
VALUE curModule, ruby_retcode;
|
||||
int ruby_error;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Ruby script \"%s\"", filename);
|
||||
plugin->print_server (plugin, "Loading Ruby script \"%s\"", filename);
|
||||
ruby_current_script = NULL;
|
||||
|
||||
snprintf(modname, sizeof(modname), "%s%d", MOD_NAME_PREFIX, modnum);
|
||||
@@ -1272,21 +1272,21 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
switch (NUM2INT(ruby_retcode))
|
||||
{
|
||||
case 1:
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to read file \"%s\"",
|
||||
filename);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to read file \"%s\"",
|
||||
filename);
|
||||
break;
|
||||
case 2:
|
||||
|
||||
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: error while loading file \"%s\"",
|
||||
filename);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: error while loading file \"%s\"",
|
||||
filename);
|
||||
break;
|
||||
case 3:
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to find \"weechat_init\" function in file \"%s\"",
|
||||
filename);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to find \"weechat_init\" function in file \"%s\"",
|
||||
filename);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1294,8 +1294,8 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
ruby_eval_error = rb_iv_get(curModule, "@load_eval_file_error");
|
||||
if (ruby_eval_error)
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: %s", STR2CSTR(ruby_eval_error));
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: %s", STR2CSTR(ruby_eval_error));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1305,9 +1305,9 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (ruby_error)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to eval weechat_init in file \"%s\"",
|
||||
filename);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to eval weechat_init in file \"%s\"",
|
||||
filename);
|
||||
rb_eval_string_protect("Weechat.print(\"Ruby error: \" + $@.to_s)", NULL);
|
||||
rb_eval_string_protect("Weechat.print(\"Ruby error: \" + $!.to_s)", NULL);
|
||||
|
||||
@@ -1317,10 +1317,10 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
}
|
||||
|
||||
if (ruby_current_script == NULL) {
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
plugin->print_server (plugin,
|
||||
"Ruby error: function \"register\" not found "
|
||||
"in file \"%s\"",
|
||||
filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1337,9 +1337,9 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
void
|
||||
weechat_ruby_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading Ruby script \"%s\"",
|
||||
script->name);
|
||||
plugin->print_server (plugin,
|
||||
"Unloading Ruby script \"%s\"",
|
||||
script->name);
|
||||
|
||||
if (script->shutdown_func[0])
|
||||
weechat_ruby_exec (plugin, script, script->shutdown_func, "", "");
|
||||
@@ -1363,15 +1363,15 @@ weechat_ruby_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_ruby_unload (plugin, ptr_script);
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby script \"%s\" unloaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Ruby script \"%s\" unloaded",
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: script \"%s\" not loaded",
|
||||
name);
|
||||
plugin->print_server (plugin,
|
||||
"Ruby error: script \"%s\" not loaded",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1383,13 +1383,13 @@ void
|
||||
weechat_ruby_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
|
||||
plugin->printf_server (plugin,
|
||||
"Unloading all Ruby scripts");
|
||||
plugin->print_server (plugin,
|
||||
"Unloading all Ruby scripts");
|
||||
while (ruby_scripts)
|
||||
weechat_ruby_unload (plugin, ruby_scripts);
|
||||
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby scripts unloaded");
|
||||
plugin->print_server (plugin,
|
||||
"Ruby scripts unloaded");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1424,26 +1424,26 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
{
|
||||
case 0:
|
||||
/* list registered Ruby scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Ruby scripts:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Registered Ruby scripts:");
|
||||
if (ruby_scripts)
|
||||
{
|
||||
for (ptr_script = ruby_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
plugin->print_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby message handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Ruby message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1452,17 +1452,17 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Ruby(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " IRC(%s) => Ruby(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby command handlers:");
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Ruby command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
@@ -1471,13 +1471,13 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Ruby(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
plugin->print_server (plugin, " /%s => Ruby(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
plugin->print_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
@@ -1524,14 +1524,14 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: unknown option for "
|
||||
"\"ruby\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Ruby error: unknown option for "
|
||||
"\"ruby\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: wrong argument count for \"ruby\" command");
|
||||
plugin->print_server (plugin,
|
||||
"Ruby error: wrong argument count for \"ruby\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
@@ -1593,7 +1593,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
ruby_plugin = plugin;
|
||||
ruby_error = 0;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Ruby module \"weechat\"");
|
||||
plugin->print_server (plugin, "Loading Ruby module \"weechat\"");
|
||||
|
||||
ruby_init ();
|
||||
ruby_init_loadpath ();
|
||||
@@ -1643,10 +1643,10 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
rb_eval_string_protect(weechat_ruby_code, &ruby_error);
|
||||
if (ruby_error) {
|
||||
VALUE ruby_error_info = rb_inspect(ruby_errinfo);
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to eval weechat ruby internal code");
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: %s", STR2CSTR(ruby_error_info));
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to eval weechat ruby internal code");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: %s", STR2CSTR(ruby_error_info));
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -1668,6 +1668,6 @@ weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
|
||||
ruby_finalize();
|
||||
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby plugin ended");
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby plugin ended");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user