Added plugin prefix ("=P=") in front of scripts messages
This commit is contained in:
parent
4f23a3c621
commit
507a5c17c0
@ -999,12 +999,14 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Perl scripts */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Registered Perl scripts:\n"));
|
||||
if (perl_scripts)
|
||||
{
|
||||
for (ptr_plugin_script = perl_scripts; ptr_plugin_script;
|
||||
ptr_plugin_script = ptr_plugin_script->next_script)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " %s v%s%s%s\n",
|
||||
ptr_plugin_script->name,
|
||||
ptr_plugin_script->version,
|
||||
@ -1013,9 +1015,13 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
/* list Perl message handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Perl message handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
@ -1024,15 +1030,20 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
handler_found = 1;
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " IRC(%s) => Perl(%s)\n",
|
||||
ptr_plugin_handler->name,
|
||||
ptr_plugin_handler->function_name);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
/* list Perl command handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Perl command handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
@ -1041,13 +1052,17 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
handler_found = 1;
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " Command /%s => Perl(%s)\n",
|
||||
ptr_plugin_handler->name,
|
||||
ptr_plugin_handler->function_name);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define PREFIX_PART "<--"
|
||||
#define PREFIX_QUIT "<--"
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "=P="
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "../../gui/gui.h"
|
||||
|
||||
|
||||
@ -75,6 +76,7 @@ static XS (XS_IRC_register)
|
||||
if (perl_script_found)
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: unable to register Perl script \"%s\" (another script "
|
||||
"already exists with this name)\n"),
|
||||
@ -104,9 +106,12 @@ static XS (XS_IRC_register)
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to load Perl script \"%s\" (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
XST_mPV (0, VERSION);
|
||||
XSRETURN (1);
|
||||
@ -125,6 +130,7 @@ static XS (XS_IRC_print)
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window, "%s", message);
|
||||
}
|
||||
|
||||
@ -283,6 +289,7 @@ wee_perl_exec (char *function, char *arguments)
|
||||
return_code = 1;
|
||||
if (SvTRUE (sv))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: %s\n"),
|
||||
SvPV (sv, count));
|
||||
@ -292,6 +299,7 @@ wee_perl_exec (char *function, char *arguments)
|
||||
{
|
||||
if (count != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
|
||||
function, count);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
@ -129,9 +130,12 @@ plugin_handler_add (t_plugin_handler **plugin_handlers,
|
||||
*last_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to add handler for \"%s\" message (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -999,12 +999,14 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Perl scripts */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Registered Perl scripts:\n"));
|
||||
if (perl_scripts)
|
||||
{
|
||||
for (ptr_plugin_script = perl_scripts; ptr_plugin_script;
|
||||
ptr_plugin_script = ptr_plugin_script->next_script)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " %s v%s%s%s\n",
|
||||
ptr_plugin_script->name,
|
||||
ptr_plugin_script->version,
|
||||
@ -1013,9 +1015,13 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
/* list Perl message handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Perl message handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
@ -1024,15 +1030,20 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
handler_found = 1;
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " IRC(%s) => Perl(%s)\n",
|
||||
ptr_plugin_handler->name,
|
||||
ptr_plugin_handler->function_name);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
/* list Perl command handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Perl command handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
@ -1041,13 +1052,17 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
{
|
||||
handler_found = 1;
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, " Command /%s => Perl(%s)\n",
|
||||
ptr_plugin_handler->name,
|
||||
ptr_plugin_handler->function_name);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" (none)\n"));
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define PREFIX_PART "<--"
|
||||
#define PREFIX_QUIT "<--"
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "=P="
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "../../gui/gui.h"
|
||||
|
||||
|
||||
@ -75,6 +76,7 @@ static XS (XS_IRC_register)
|
||||
if (perl_script_found)
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: unable to register Perl script \"%s\" (another script "
|
||||
"already exists with this name)\n"),
|
||||
@ -104,9 +106,12 @@ static XS (XS_IRC_register)
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to load Perl script \"%s\" (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
XST_mPV (0, VERSION);
|
||||
XSRETURN (1);
|
||||
@ -125,6 +130,7 @@ static XS (XS_IRC_print)
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window, "%s", message);
|
||||
}
|
||||
|
||||
@ -283,6 +289,7 @@ wee_perl_exec (char *function, char *arguments)
|
||||
return_code = 1;
|
||||
if (SvTRUE (sv))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: %s\n"),
|
||||
SvPV (sv, count));
|
||||
@ -292,6 +299,7 @@ wee_perl_exec (char *function, char *arguments)
|
||||
{
|
||||
if (count != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
|
||||
function, count);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
@ -129,9 +130,12 @@ plugin_handler_add (t_plugin_handler **plugin_handlers,
|
||||
*last_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to add handler for \"%s\" message (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user