api: remove functions printf_date() and printf_tags()
This commit is contained in:
parent
b1d32b29f9
commit
20c86db0d8
@ -25,6 +25,7 @@ New features::
|
||||
Improvements::
|
||||
|
||||
* core, irc, xfer: display more information in memory allocation errors (issue #573)
|
||||
* api: remove functions printf_date() and printf_tags()
|
||||
* relay: allow escape of comma in command "init" (weechat protocol) (issue #730)
|
||||
|
||||
Bug fixes::
|
||||
|
@ -17,6 +17,20 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
|
||||
(file _ChangeLog.adoc_ in sources).
|
||||
|
||||
|
||||
[[v1.6]]
|
||||
== Version 1.6 (under dev)
|
||||
|
||||
[[v1.6_api_printf]]
|
||||
|
||||
Some "printf" functions have been removed from C API (there were not in scripting API):
|
||||
|
||||
* printf_date
|
||||
* printf_tags
|
||||
|
||||
The function "printf_date_tags" must now be used instead of these functions
|
||||
(the two functions removed were just C macros on function "printf_date_tags"
|
||||
with tags set to NULL for "printf_date" and date set to 0 for "printf_tags").
|
||||
|
||||
[[v1.5]]
|
||||
== Version 1.5 (2016-05-01)
|
||||
|
||||
|
@ -6889,63 +6889,6 @@ weechat.prnt(buffer, "\t\t") # empty line (without time)
|
||||
[NOTE]
|
||||
Function is called "print" in scripts ("prnt" in Python).
|
||||
|
||||
==== printf_date
|
||||
|
||||
Display a message on a buffer, using a custom date.
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_date (struct t_gui_buffer *buffer, time_t date,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Arguments:
|
||||
|
||||
* _buffer_: buffer pointer, if NULL, message is displayed on WeeChat buffer
|
||||
* _date_: date for message (0 means current date/time)
|
||||
* _message_: message to display
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_date (NULL, time (NULL) - 120, "Hello, 2 minutes ago");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
This function is not available in scripting API.
|
||||
|
||||
==== printf_tags
|
||||
|
||||
Display a message on a buffer, using a custom tags.
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_tags (struct t_gui_buffer *buffer, const char *tags,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Arguments:
|
||||
|
||||
* _buffer_: buffer pointer, if NULL, message is displayed on WeeChat buffer
|
||||
* _tags_: comma separated list of tags
|
||||
* _message_: message to display
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_tags (NULL, "notify_message",
|
||||
"Message with a tag 'notify_message'");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
This function is not available in scripting API.
|
||||
|
||||
==== printf_date_tags
|
||||
|
||||
Display a message on a buffer, using a custom date and tags.
|
||||
|
@ -7002,65 +7002,6 @@ weechat.prnt(buffer, "\t\t") # ligne vide (sans heure)
|
||||
[NOTE]
|
||||
La fonction s'appelle "print" dans les scripts ("prnt" en Python).
|
||||
|
||||
==== printf_date
|
||||
|
||||
Afficher un message sur un tampon, en utilisant une date personnalisée.
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_date (struct t_gui_buffer *buffer, time_t date,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Paramètres :
|
||||
|
||||
* _buffer_ : pointeur vers le tampon, si NULL, le message est affiché sur le
|
||||
tampon Weechat
|
||||
* _date_ : date pour le message (0 signifie la date/heure courante)
|
||||
* _message_ : message à afficher
|
||||
|
||||
Exemple en C :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_date (NULL, time (NULL) - 120, "Bonjour, il y a 2 minutes");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
Cette fonction n'est pas disponible dans l'API script.
|
||||
|
||||
==== printf_tags
|
||||
|
||||
Afficher un message sur un tampon, avec des étiquettes personnalisées.
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_tags (struct t_gui_buffer *buffer, const char *tags,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Paramètres :
|
||||
|
||||
* _buffer_ : pointeur vers le tampon, si NULL, le message est affiché sur le
|
||||
tampon Weechat
|
||||
* _tags_ : liste d'étiquettes séparées par des virgules
|
||||
* _message_ : message à afficher
|
||||
|
||||
Exemple en C :
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_tags (NULL, "notify_message",
|
||||
"Message avec une étiquette 'notify_message'");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
Cette fonction n'est pas disponible dans l'API script.
|
||||
|
||||
==== printf_date_tags
|
||||
|
||||
Afficher un message sur un tampon, en utilisant une date et des étiquettes
|
||||
|
@ -7064,65 +7064,6 @@ weechat.prnt(buffer, "\t\t") # empty line (without time)
|
||||
[NOTE]
|
||||
La funzione è chiamata "print" negli script ("prnt" in Python).
|
||||
|
||||
==== printf_date
|
||||
|
||||
Visualizza un messaggio sul buffer, utilizzando una data personalizzata.
|
||||
|
||||
Prototipo:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_date (struct t_gui_buffer *buffer, time_t date,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Argomenti:
|
||||
|
||||
* _buffer_: puntatore al buffer, se NULL, il messaggio viene visualizzato
|
||||
sul buffer di WeeChat
|
||||
* _date_: data per il messaggio (0 indica data/ora corrente)
|
||||
* _message_: messaggio da visualizzare
|
||||
|
||||
Esempio in C:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_date (NULL, time (NULL) - 120, "Ciao, 2 minuti fa");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
Questa funzione non è disponibile nelle API per lo scripting.
|
||||
|
||||
==== printf_tags
|
||||
|
||||
Visualizza un messaggio sul buffer, utilizzando tag personalizzati.
|
||||
|
||||
Prototipo:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_tags (struct t_gui_buffer *buffer, const char *tags,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
Argomenti:
|
||||
|
||||
* _buffer_: puntatore al buffer, se NULL il messaggio viene visualizzato
|
||||
sul buffer di WeeChat
|
||||
* _tags_: lista di tag separati da virgole
|
||||
* _message_: messaggio da visualizzare
|
||||
|
||||
Esempio in C:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_tags (NULL, "notify_message",
|
||||
"Messaggio con tag 'notify_message'");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
Questa funzione non è disponibile nelle API per lo scripting.
|
||||
|
||||
==== printf_date_tags
|
||||
|
||||
Visualizza un messaggio sul buffer, usando tag e data personalizzati.
|
||||
|
@ -6889,63 +6889,6 @@ weechat.prnt(buffer, "\t\t") # empty line (without time)
|
||||
[NOTE]
|
||||
この関数をスクリプトの中で実行するには "print" (Python の場合は "prnt") と書きます。
|
||||
|
||||
==== printf_date
|
||||
|
||||
日付を指定してバッファにメッセージを表示。
|
||||
|
||||
プロトタイプ:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_date (struct t_gui_buffer *buffer, time_t date,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
引数:
|
||||
|
||||
* _buffer_: バッファへのポインタ、NULL の場合、メッセージは WeeChat バッファに表示
|
||||
* _date_: メッセージの日付 (0 は現在の日付/時間を意味する)
|
||||
* _message_: 表示するメッセージ
|
||||
|
||||
C 言語での使用例:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_date (NULL, time (NULL) - 120, "Hello, 2 minutes ago");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
スクリプト API ではこの関数を利用できません。
|
||||
|
||||
==== printf_tags
|
||||
|
||||
タグを指定してバッファにメッセージを表示。
|
||||
|
||||
プロトタイプ:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
void weechat_printf_tags (struct t_gui_buffer *buffer, const char *tags,
|
||||
const char *message, ...);
|
||||
----
|
||||
|
||||
引数:
|
||||
|
||||
* _buffer_: バッファへのポインタ、NULL の場合、メッセージは WeeChat バッファに表示
|
||||
* _tags_: タグのコンマ区切りリスト
|
||||
* _message_: 表示するメッセージ
|
||||
|
||||
C 言語での使用例:
|
||||
|
||||
[source,C]
|
||||
----
|
||||
weechat_printf_tags (NULL, "notify_message",
|
||||
"Message with a tag 'notify_message'");
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
スクリプト API ではこの関数を利用できません。
|
||||
|
||||
==== printf_date_tags
|
||||
|
||||
日付とタグを指定してバッファにメッセージを表示。
|
||||
|
@ -333,10 +333,11 @@ exec_display_line (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer,
|
||||
{
|
||||
snprintf (str_number, sizeof (str_number),
|
||||
"%d\t", exec_cmd->output_line_nb);
|
||||
weechat_printf_tags (buffer, str_tags,
|
||||
"%s%s",
|
||||
(exec_cmd->line_numbers) ? str_number : " \t",
|
||||
line_color);
|
||||
weechat_printf_date_tags (
|
||||
buffer, 0, str_tags,
|
||||
"%s%s",
|
||||
(exec_cmd->line_numbers) ? str_number : " \t",
|
||||
line_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,11 +478,12 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (ptr_buffer, "exec_rc",
|
||||
_("%s: end of command %d (\"%s\"), "
|
||||
"return code: %d"),
|
||||
EXEC_PLUGIN_NAME, exec_cmd->number,
|
||||
exec_cmd->command, return_code);
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer, 0, "exec_rc",
|
||||
_("%s: end of command %d (\"%s\"), "
|
||||
"return code: %d"),
|
||||
EXEC_PLUGIN_NAME, exec_cmd->number,
|
||||
exec_cmd->command, return_code);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -496,11 +498,12 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (ptr_buffer, "exec_rc",
|
||||
_("%s: unexpected end of command %d "
|
||||
"(\"%s\")"),
|
||||
EXEC_PLUGIN_NAME, exec_cmd->number,
|
||||
exec_cmd->command);
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer, 0, "exec_rc",
|
||||
_("%s: unexpected end of command %d "
|
||||
"(\"%s\")"),
|
||||
EXEC_PLUGIN_NAME, exec_cmd->number,
|
||||
exec_cmd->command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1337,8 +1337,9 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
|
||||
{
|
||||
if (weechat_config_boolean (irc_config_look_display_pv_back))
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
ptr_channel->buffer,
|
||||
0,
|
||||
"irc_nick_back",
|
||||
_("%s%s%s %s(%s%s%s)%s is back on server"),
|
||||
weechat_prefix ("join"),
|
||||
|
@ -640,8 +640,9 @@ irc_command_me_channel_display (struct t_irc_server *server,
|
||||
irc_color_decode (arguments,
|
||||
weechat_config_boolean (irc_config_network_colors_send)) : NULL;
|
||||
ptr_nick = irc_nick_search (server, channel, server->nick);
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
channel->buffer,
|
||||
0,
|
||||
irc_protocol_tags ("privmsg", "irc_action,notify_none,no_highlight",
|
||||
server->nick, NULL),
|
||||
"%s%s%s%s%s%s%s",
|
||||
@ -726,16 +727,17 @@ irc_command_display_away (struct t_irc_server *server, const char *string1,
|
||||
if ((ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
|
||||
|| (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE))
|
||||
{
|
||||
weechat_printf_tags (ptr_channel->buffer,
|
||||
"away_info",
|
||||
"%s[%s%s%s %s: %s%s]",
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_CHAT_NICK_SELF,
|
||||
server->nick,
|
||||
IRC_COLOR_RESET,
|
||||
string1,
|
||||
string2,
|
||||
IRC_COLOR_CHAT_DELIMITERS);
|
||||
weechat_printf_date_tags (ptr_channel->buffer,
|
||||
0,
|
||||
"away_info",
|
||||
"%s[%s%s%s %s: %s%s]",
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
IRC_COLOR_CHAT_NICK_SELF,
|
||||
server->nick,
|
||||
IRC_COLOR_RESET,
|
||||
string1,
|
||||
string2,
|
||||
IRC_COLOR_CHAT_DELIMITERS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3163,8 +3165,9 @@ IRC_COMMAND_CALLBACK(msg)
|
||||
* message to channel ops/voiced
|
||||
* (to "@#channel" or "+#channel")
|
||||
*/
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
ptr_channel2->buffer,
|
||||
0,
|
||||
"notify_none,no_highlight",
|
||||
"%s%s%s -> %s%s%s: %s",
|
||||
weechat_prefix ("network"),
|
||||
@ -3251,8 +3254,9 @@ IRC_COMMAND_CALLBACK(msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
ptr_server->buffer,
|
||||
0,
|
||||
irc_protocol_tags (
|
||||
"privmsg", "notify_none,no_highlight",
|
||||
ptr_server->nick, NULL),
|
||||
@ -3430,10 +3434,11 @@ IRC_COMMAND_CALLBACK(notice)
|
||||
string = irc_color_decode (
|
||||
str_args,
|
||||
weechat_config_boolean (irc_config_network_colors_send));
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
ptr_server, argv[arg_target], "notice", NULL,
|
||||
(ptr_channel) ? ptr_channel->buffer : NULL),
|
||||
0,
|
||||
"notify_none,no_highlight",
|
||||
"%s%s%s%s -> %s%s%s: %s",
|
||||
weechat_prefix ("network"),
|
||||
|
@ -291,10 +291,11 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
|
||||
str_args_color = irc_color_decode (str_args, 1);
|
||||
if (!str_args_color)
|
||||
break;
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
server, nick, NULL, "ctcp",
|
||||
(channel) ? channel->buffer : NULL),
|
||||
0,
|
||||
irc_protocol_tags (
|
||||
command,
|
||||
"irc_ctcp,irc_ctcp_reply,notify_none,no_highlight",
|
||||
|
@ -98,8 +98,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
|
||||
ptr_text = (text_decoded) ? text_decoded : ((text2) ? text2 : text);
|
||||
if (action)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
buffer,
|
||||
0,
|
||||
irc_protocol_tags (
|
||||
"privmsg", str_tags,
|
||||
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
|
||||
@ -114,8 +115,9 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, int action,
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
buffer,
|
||||
0,
|
||||
irc_protocol_tags (
|
||||
"privmsg", str_tags,
|
||||
(ptr_nick) ? ptr_nick->name : ptr_server->nick,
|
||||
|
@ -672,8 +672,9 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify, const char *host,
|
||||
if (notify->is_on_server == is_on_server)
|
||||
return;
|
||||
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
notify->server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (irc_config_look_notify_tags_ison,
|
||||
(is_on_server) ? "join" : "quit",
|
||||
notify->nick),
|
||||
@ -719,8 +720,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
|
||||
|
||||
if (!notify->away_message && away_message)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
notify->server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (
|
||||
irc_config_look_notify_tags_whois, "away", notify->nick),
|
||||
_("%snotify: %s%s%s is now away: \"%s\""),
|
||||
@ -733,8 +735,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
|
||||
}
|
||||
else if (notify->away_message && !away_message)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
notify->server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (
|
||||
irc_config_look_notify_tags_whois, "back", notify->nick),
|
||||
_("%snotify: %s%s%s is back"),
|
||||
@ -746,8 +749,9 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
|
||||
}
|
||||
else if (notify->away_message && away_message)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
weechat_printf_date_tags (
|
||||
notify->server->buffer,
|
||||
0,
|
||||
irc_notify_get_tags (
|
||||
irc_config_look_notify_tags_whois, "still_away", notify->nick),
|
||||
_("%snotify: %s%s%s is still away: \"%s\""),
|
||||
|
@ -79,11 +79,10 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
|
||||
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: start logging for buffer \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"));
|
||||
weechat_printf_date_tags (NULL, 0, "no_log",
|
||||
"%s: start logging for buffer \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"));
|
||||
}
|
||||
|
||||
new_logger_buffer = malloc (sizeof (*new_logger_buffer));
|
||||
@ -197,11 +196,11 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer)
|
||||
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: stop logging for buffer \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (ptr_buffer, "name"));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
"%s: stop logging for buffer \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (ptr_buffer, "name"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,9 @@ logger_config_flush_delay_change (const void *pointer, void *data,
|
||||
{
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: stopping timer", LOGGER_PLUGIN_NAME);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
"%s: stopping timer", LOGGER_PLUGIN_NAME);
|
||||
}
|
||||
weechat_unhook (logger_timer);
|
||||
logger_timer = NULL;
|
||||
@ -106,11 +106,11 @@ logger_config_flush_delay_change (const void *pointer, void *data,
|
||||
{
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: starting timer (interval: %d seconds)",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_config_integer (logger_config_file_flush_delay));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
"%s: starting timer (interval: %d seconds)",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_config_integer (logger_config_file_flush_delay));
|
||||
}
|
||||
logger_timer = weechat_hook_timer (weechat_config_integer (logger_config_file_flush_delay) * 1000,
|
||||
0, 0,
|
||||
|
@ -97,10 +97,9 @@ logger_get_file_path ()
|
||||
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: file path = \"%s\"",
|
||||
LOGGER_PLUGIN_NAME, path2);
|
||||
weechat_printf_date_tags (NULL, 0, "no_log",
|
||||
"%s: file path = \"%s\"",
|
||||
LOGGER_PLUGIN_NAME, path2);
|
||||
}
|
||||
|
||||
end:
|
||||
@ -364,13 +363,12 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
|
||||
|
||||
if (weechat_logger_plugin->debug)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: buffer = \"%s\", mask = \"%s\", "
|
||||
"decoded mask = \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"),
|
||||
mask, mask_decoded5);
|
||||
weechat_printf_date_tags (NULL, 0, "no_log",
|
||||
"%s: buffer = \"%s\", mask = \"%s\", "
|
||||
"decoded mask = \"%s\"",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"),
|
||||
mask, mask_decoded5);
|
||||
}
|
||||
|
||||
end:
|
||||
@ -417,12 +415,12 @@ logger_get_filename (struct t_gui_buffer *buffer)
|
||||
mask = logger_get_mask_for_buffer (buffer);
|
||||
if (!mask)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
_("%s%s: unable to find filename mask for buffer "
|
||||
"\"%s\", logging is disabled for this buffer"),
|
||||
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
_("%s%s: unable to find filename mask for buffer "
|
||||
"\"%s\", logging is disabled for this buffer"),
|
||||
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (buffer, "name"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -470,11 +468,10 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
|
||||
log_filename = logger_get_filename (logger_buffer->buffer);
|
||||
if (!log_filename)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
_("%s%s: not enough memory"),
|
||||
weechat_prefix ("error"),
|
||||
LOGGER_PLUGIN_NAME);
|
||||
weechat_printf_date_tags (NULL, 0, "no_log",
|
||||
_("%s%s: not enough memory"),
|
||||
weechat_prefix ("error"),
|
||||
LOGGER_PLUGIN_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -482,15 +479,15 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
|
||||
ptr_logger_buffer = logger_buffer_search_log_filename (log_filename);
|
||||
if (ptr_logger_buffer)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
_("%s%s: unable to start logging for buffer "
|
||||
"\"%s\": filename \"%s\" is already used by "
|
||||
"another buffer (check your log settings)"),
|
||||
weechat_prefix ("error"),
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (logger_buffer->buffer, "name"),
|
||||
log_filename);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
_("%s%s: unable to start logging for buffer "
|
||||
"\"%s\": filename \"%s\" is already used by "
|
||||
"another buffer (check your log settings)"),
|
||||
weechat_prefix ("error"),
|
||||
LOGGER_PLUGIN_NAME,
|
||||
weechat_buffer_get_string (logger_buffer->buffer, "name"),
|
||||
log_filename);
|
||||
free (log_filename);
|
||||
return;
|
||||
}
|
||||
@ -538,12 +535,12 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
|
||||
}
|
||||
if (!logger_create_directory ())
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
_("%s%s: unable to create directory for logs "
|
||||
"(\"%s\")"),
|
||||
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
|
||||
weechat_config_string (logger_config_file_path));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
_("%s%s: unable to create directory for logs "
|
||||
"(\"%s\")"),
|
||||
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
|
||||
weechat_config_string (logger_config_file_path));
|
||||
logger_buffer_free (logger_buffer);
|
||||
return;
|
||||
}
|
||||
@ -559,9 +556,8 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
|
||||
fopen (logger_buffer->log_filename, "a");
|
||||
if (!logger_buffer->log_file)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
NULL,
|
||||
"no_log",
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_log",
|
||||
_("%s%s: unable to write log file \"%s\": %s"),
|
||||
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
|
||||
logger_buffer->log_filename, strerror (errno));
|
||||
@ -839,11 +835,10 @@ logger_flush ()
|
||||
{
|
||||
if (weechat_logger_plugin->debug >= 2)
|
||||
{
|
||||
weechat_printf_tags (NULL,
|
||||
"no_log",
|
||||
"%s: flush file %s",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
ptr_logger_buffer->log_filename);
|
||||
weechat_printf_date_tags (NULL, 0, "no_log",
|
||||
"%s: flush file %s",
|
||||
LOGGER_PLUGIN_NAME,
|
||||
ptr_logger_buffer->log_filename);
|
||||
}
|
||||
fflush (ptr_logger_buffer->log_file);
|
||||
ptr_logger_buffer->flush_needed = 0;
|
||||
|
@ -257,16 +257,16 @@ relay_client_handshake_timer_cb (const void *pointer, void *data,
|
||||
if (gnutls_error_is_fatal (rc))
|
||||
{
|
||||
/* handshake error, disconnect client */
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: TLS handshake failed for client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
rc,
|
||||
gnutls_strerror (rc));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: TLS handshake failed for client %s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
rc,
|
||||
gnutls_strerror (rc));
|
||||
weechat_unhook (client->hook_timer_handshake);
|
||||
client->hook_timer_handshake = NULL;
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
@ -276,13 +276,14 @@ relay_client_handshake_timer_cb (const void *pointer, void *data,
|
||||
if (remaining_calls == 0)
|
||||
{
|
||||
/* handshake timeout, disconnect client */
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: TLS handshake timeout for client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: TLS handshake timeout for client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_unhook (client->hook_timer_handshake);
|
||||
client->hook_timer_handshake = NULL;
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
@ -386,15 +387,16 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
|
||||
"400 Bad Request");
|
||||
if (weechat_relay_plugin->debug >= 1)
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: invalid websocket "
|
||||
"handshake received for "
|
||||
"client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: invalid websocket "
|
||||
"handshake received for client "
|
||||
"%s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
}
|
||||
break;
|
||||
case -2:
|
||||
@ -402,13 +404,14 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
|
||||
"403 Forbidden");
|
||||
if (weechat_relay_plugin->debug >= 1)
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: origin \"%s\" "
|
||||
"not allowed for websocket"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
weechat_hashtable_get (client->http_headers,
|
||||
"Origin"));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: origin \"%s\" "
|
||||
"not allowed for websocket"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
weechat_hashtable_get (client->http_headers,
|
||||
"Origin"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -419,8 +422,8 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
|
||||
client->http_headers, "X-Real-IP");
|
||||
if (ptr_real_ip)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
NULL, "relay_client",
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s: websocket client %s%s%s has real IP "
|
||||
"address \"%s\""),
|
||||
RELAY_PLUGIN_NAME,
|
||||
@ -610,13 +613,14 @@ relay_client_recv_cb (const void *pointer, void *data, int fd)
|
||||
if (!rc)
|
||||
{
|
||||
/* error when decoding frame: close connection */
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: error decoding websocket frame "
|
||||
"for client %s%s%s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: error decoding websocket frame for client "
|
||||
"%s%s%s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@ -645,16 +649,17 @@ relay_client_recv_cb (const void *pointer, void *data, int fd)
|
||||
if ((num_read == 0)
|
||||
|| ((num_read != GNUTLS_E_AGAIN) && (num_read != GNUTLS_E_INTERRUPTED)))
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: reading data on socket for "
|
||||
"client %s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_read,
|
||||
(num_read == 0) ? _("(connection closed by peer)") :
|
||||
gnutls_strerror (num_read));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: reading data on socket for client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_read,
|
||||
(num_read == 0) ? _("(connection closed by peer)") :
|
||||
gnutls_strerror (num_read));
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
@ -664,16 +669,17 @@ relay_client_recv_cb (const void *pointer, void *data, int fd)
|
||||
if ((num_read == 0)
|
||||
|| ((errno != EAGAIN) && (errno != EWOULDBLOCK)))
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: reading data on socket for "
|
||||
"client %s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
(num_read == 0) ? _("(connection closed by peer)") :
|
||||
strerror (errno));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: reading data on socket for client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
(num_read == 0) ? _("(connection closed by peer)") :
|
||||
strerror (errno));
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
@ -956,16 +962,16 @@ relay_client_send (struct t_relay_client *client,
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_sent,
|
||||
gnutls_strerror (num_sent));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_sent,
|
||||
gnutls_strerror (num_sent));
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
@ -981,16 +987,16 @@ relay_client_send (struct t_relay_client *client,
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
strerror (errno));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
strerror (errno));
|
||||
relay_client_set_status (client, RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
@ -1125,16 +1131,17 @@ relay_client_timer_cb (const void *pointer, void *data, int remaining_calls)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: sending data to client "
|
||||
"%s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
ptr_client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_sent,
|
||||
gnutls_strerror (num_sent));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
ptr_client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
num_sent,
|
||||
gnutls_strerror (num_sent));
|
||||
relay_client_set_status (ptr_client,
|
||||
RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
@ -1149,16 +1156,17 @@ relay_client_timer_cb (const void *pointer, void *data, int remaining_calls)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: sending data to client "
|
||||
"%s%s%s: error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
ptr_client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
strerror (errno));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: sending data to client %s%s%s: "
|
||||
"error %d %s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
ptr_client->desc,
|
||||
RELAY_COLOR_CHAT,
|
||||
errno,
|
||||
strerror (errno));
|
||||
relay_client_set_status (ptr_client,
|
||||
RELAY_STATUS_DISCONNECTED);
|
||||
}
|
||||
@ -1238,12 +1246,12 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
{
|
||||
if (!relay_network_init_ssl_cert_key_ok)
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: warning: no SSL certificate/key "
|
||||
"found (option "
|
||||
"relay.network.ssl_cert_key)"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s%s: warning: no SSL certificate/key found (option "
|
||||
"relay.network.ssl_cert_key)"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME);
|
||||
}
|
||||
new_client->status = RELAY_STATUS_CONNECTING;
|
||||
/*
|
||||
@ -1310,13 +1318,13 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
last_relay_client = new_client;
|
||||
relay_clients = new_client;
|
||||
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s: new client on port %d: %s%s%s"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
new_client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (NULL, 0, "relay_client",
|
||||
_("%s: new client on port %d: %s%s%s"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
server->port,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
new_client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
|
||||
new_client->hook_fd = weechat_hook_fd (new_client->sock,
|
||||
1, 0, 0,
|
||||
@ -1337,9 +1345,9 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: not enough memory for new client"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
weechat_printf_date_tags (NULL, 0, "relay_client",
|
||||
_("%s%s: not enough memory for new client"),
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
}
|
||||
|
||||
return new_client;
|
||||
@ -1488,22 +1496,23 @@ relay_client_set_status (struct t_relay_client *client,
|
||||
switch (client->status)
|
||||
{
|
||||
case RELAY_STATUS_AUTH_FAILED:
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s%s: authentication failed with "
|
||||
"client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (NULL, 0, "relay_client",
|
||||
_("%s%s: authentication failed with "
|
||||
"client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
break;
|
||||
case RELAY_STATUS_DISCONNECTED:
|
||||
weechat_printf_tags (NULL, "relay_client",
|
||||
_("%s: disconnected from client %s%s%s"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "relay_client",
|
||||
_("%s: disconnected from client %s%s%s"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -254,22 +254,23 @@ trigger_buffer_hashtable_map_cb (void *data,
|
||||
{
|
||||
value_no_color = (weechat_config_boolean (trigger_config_look_monitor_strip_colors)) ?
|
||||
weechat_string_remove_color ((const char *)value, NULL) : NULL;
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t %s: %s\"%s%s%s\"",
|
||||
(char *)key,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
(value_no_color) ? value_no_color : (const char *)value,
|
||||
weechat_color ("chat_delimiters"));
|
||||
weechat_printf_date_tags (
|
||||
trigger_buffer, 0, "no_trigger",
|
||||
"\t %s: %s\"%s%s%s\"",
|
||||
(char *)key,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
(value_no_color) ? value_no_color : (const char *)value,
|
||||
weechat_color ("chat_delimiters"));
|
||||
if (value_no_color)
|
||||
free (value_no_color);
|
||||
}
|
||||
else if (strcmp (value_type, "pointer") == 0)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t %s: 0x%lx",
|
||||
(char *)key,
|
||||
value);
|
||||
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
|
||||
"\t %s: 0x%lx",
|
||||
(char *)key,
|
||||
value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +285,7 @@ trigger_buffer_display_hashtable (const char *name,
|
||||
if (!trigger_buffer)
|
||||
return;
|
||||
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger", " %s:", name);
|
||||
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger", " %s:", name);
|
||||
|
||||
weechat_hashtable_map (hashtable, &trigger_buffer_hashtable_map_cb, NULL);
|
||||
}
|
||||
@ -310,21 +311,23 @@ trigger_buffer_display_trigger (struct t_trigger *trigger,
|
||||
if (!trigger_buffer_match_filters (trigger))
|
||||
return 0;
|
||||
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"%s\t%s%s %s(%s%s%s)",
|
||||
trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
weechat_color (weechat_config_string (trigger_config_color_trigger)),
|
||||
trigger->name,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
|
||||
weechat_color ("chat_delimiters"));
|
||||
weechat_printf_date_tags (
|
||||
trigger_buffer, 0, "no_trigger",
|
||||
"%s\t%s%s %s(%s%s%s)",
|
||||
trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
weechat_color (weechat_config_string (trigger_config_color_trigger)),
|
||||
trigger->name,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
|
||||
weechat_color ("chat_delimiters"));
|
||||
if (buffer)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t buffer: %s%s",
|
||||
weechat_color ("chat_buffer"),
|
||||
weechat_buffer_get_string (buffer, "full_name"));
|
||||
weechat_printf_date_tags (
|
||||
trigger_buffer, 0, "no_trigger",
|
||||
"\t buffer: %s%s",
|
||||
weechat_color ("chat_buffer"),
|
||||
weechat_buffer_get_string (buffer, "full_name"));
|
||||
}
|
||||
if (pointers)
|
||||
trigger_buffer_display_hashtable ("pointers", pointers);
|
||||
|
@ -205,9 +205,9 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
|
||||
{
|
||||
if (trigger_buffer && display_monitor)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t regex %d: %s",
|
||||
i + 1, _("no variable"));
|
||||
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
|
||||
"\t regex %d: %s",
|
||||
i + 1, _("no variable"));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -217,9 +217,9 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
|
||||
{
|
||||
if (trigger_buffer && display_monitor)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t regex %d (%s): %s",
|
||||
i + 1, ptr_key, _("empty variable"));
|
||||
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
|
||||
"\t regex %d (%s): %s",
|
||||
i + 1, ptr_key, _("empty variable"));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -240,19 +240,19 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
|
||||
/* display debug info on trigger buffer */
|
||||
if (trigger_buffer && display_monitor)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
"\t regex %d %s(%s%s%s)%s: "
|
||||
"%s\"%s%s%s\"",
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
ptr_key,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
value,
|
||||
weechat_color ("chat_delimiters"));
|
||||
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
|
||||
"\t regex %d %s(%s%s%s)%s: "
|
||||
"%s\"%s%s%s\"",
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
ptr_key,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
value,
|
||||
weechat_color ("chat_delimiters"));
|
||||
}
|
||||
weechat_hashtable_set (extra_vars, ptr_key, value);
|
||||
free (value);
|
||||
@ -299,19 +299,20 @@ trigger_callback_run_command (struct t_trigger *trigger,
|
||||
/* display debug info on trigger buffer */
|
||||
if (trigger_buffer && display_monitor)
|
||||
{
|
||||
weechat_printf_tags (trigger_buffer, "no_trigger",
|
||||
_("%s running command %s\"%s%s%s\"%s "
|
||||
"on buffer %s%s%s"),
|
||||
"\t",
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
command_eval,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_color ("chat_buffer"),
|
||||
weechat_buffer_get_string (buffer,
|
||||
"full_name"),
|
||||
weechat_color ("reset"));
|
||||
weechat_printf_date_tags (
|
||||
trigger_buffer, 0, "no_trigger",
|
||||
_("%s running command %s\"%s%s%s\"%s "
|
||||
"on buffer %s%s%s"),
|
||||
"\t",
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
command_eval,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
weechat_color ("chat_buffer"),
|
||||
weechat_buffer_get_string (buffer,
|
||||
"full_name"),
|
||||
weechat_color ("reset"));
|
||||
}
|
||||
weechat_command (buffer, command_eval);
|
||||
trigger->hook_count_cmd++;
|
||||
|
@ -36,9 +36,9 @@
|
||||
void
|
||||
trigger_command_display_status ()
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
(trigger_enabled) ?
|
||||
_("Triggers enabled") : _("Triggers disabled"));
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
(trigger_enabled) ?
|
||||
_("Triggers enabled") : _("Triggers disabled"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -67,8 +67,8 @@ trigger_command_display_trigger_internal (const char *name,
|
||||
|
||||
if (verbose >= 1)
|
||||
{
|
||||
weechat_printf_tags (
|
||||
NULL, "no_trigger",
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
" %s%s%s: %s%s%s%s%s%s%s",
|
||||
(enabled) ?
|
||||
weechat_color (weechat_config_string (trigger_config_color_trigger)) :
|
||||
@ -89,69 +89,73 @@ trigger_command_display_trigger_internal (const char *name,
|
||||
spaces[length] = '\0';
|
||||
if (verbose >= 2)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s hooks: %d", spaces, hooks_count);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s callback: %d",
|
||||
spaces, hook_count_cb);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s commands: %d",
|
||||
spaces, hook_count_cmd);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
"%s hooks: %d", spaces, hooks_count);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
"%s callback: %d",
|
||||
spaces, hook_count_cb);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
"%s commands: %d",
|
||||
spaces, hook_count_cmd);
|
||||
}
|
||||
if (conditions && conditions[0])
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s %s=? %s\"%s%s%s\"",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_conditions)),
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
conditions,
|
||||
weechat_color ("chat_delimiters"));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
"%s %s=? %s\"%s%s%s\"",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_conditions)),
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
conditions,
|
||||
weechat_color ("chat_delimiters"));
|
||||
}
|
||||
for (i = 0; i < regex_count; i++)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s %s~%d %s\"%s%s%s\" --> "
|
||||
"\"%s%s%s\"%s%s%s%s",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_regex)),
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color (weechat_config_string (trigger_config_color_regex)),
|
||||
regex[i].str_regex,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color (weechat_config_string (trigger_config_color_replace)),
|
||||
regex[i].replace,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
(regex[i].variable) ? " (" : "",
|
||||
(regex[i].variable) ? regex[i].variable : "",
|
||||
(regex[i].variable) ? ")" : "");
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
"%s %s~%d %s\"%s%s%s\" --> "
|
||||
"\"%s%s%s\"%s%s%s%s",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_regex)),
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color (weechat_config_string (trigger_config_color_regex)),
|
||||
regex[i].str_regex,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color (weechat_config_string (trigger_config_color_replace)),
|
||||
regex[i].replace,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
(regex[i].variable) ? " (" : "",
|
||||
(regex[i].variable) ? regex[i].variable : "",
|
||||
(regex[i].variable) ? ")" : "");
|
||||
}
|
||||
if (commands)
|
||||
{
|
||||
for (i = 0; commands[i]; i++)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s %s/%d %s\"%s%s%s\"",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_command)),
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
commands[i],
|
||||
weechat_color ("chat_delimiters"));
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
"%s %s/%d %s\"%s%s%s\"",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_command)),
|
||||
i + 1,
|
||||
weechat_color ("chat_delimiters"),
|
||||
weechat_color ("reset"),
|
||||
commands[i],
|
||||
weechat_color ("chat_delimiters"));
|
||||
}
|
||||
}
|
||||
if ((return_code >= 0) && (return_code != TRIGGER_RC_OK))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
"%s %s=> %s%s",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_return_code)),
|
||||
weechat_color ("reset"),
|
||||
trigger_return_code_string[return_code]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
"%s %s=> %s%s",
|
||||
spaces,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_return_code)),
|
||||
weechat_color ("reset"),
|
||||
trigger_return_code_string[return_code]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -190,8 +194,8 @@ trigger_command_display_trigger_internal (const char *name,
|
||||
weechat_color (weechat_config_string (trigger_config_color_flag_return_code)),
|
||||
weechat_color ("reset"));
|
||||
}
|
||||
weechat_printf_tags (
|
||||
NULL, "no_trigger",
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
" %s%s%s: %s%s%s%s%s%s%s%s%s%s%s%s",
|
||||
(enabled) ?
|
||||
weechat_color (weechat_config_string (trigger_config_color_trigger)) :
|
||||
@ -246,16 +250,17 @@ trigger_command_list (const char *message, int verbose)
|
||||
{
|
||||
struct t_trigger *ptr_trigger;
|
||||
|
||||
weechat_printf_tags (NULL, "no_trigger", "");
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger", "");
|
||||
trigger_command_display_status ();
|
||||
|
||||
if (!triggers)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger", _("No trigger defined"));
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("No trigger defined"));
|
||||
return;
|
||||
}
|
||||
|
||||
weechat_printf_tags (NULL, "no_trigger", message);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger", message);
|
||||
|
||||
for (ptr_trigger = triggers; ptr_trigger;
|
||||
ptr_trigger = ptr_trigger->next_trigger)
|
||||
@ -280,8 +285,9 @@ trigger_command_list_default (int verbose)
|
||||
commands_count = 0;
|
||||
commands = NULL;
|
||||
|
||||
weechat_printf_tags (NULL, "no_trigger", "");
|
||||
weechat_printf_tags (NULL, "no_trigger", _("List of default triggers:"));
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger", "");
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("List of default triggers:"));
|
||||
|
||||
for (i = 0; trigger_config_default_list[i][0]; i++)
|
||||
{
|
||||
@ -321,11 +327,12 @@ trigger_command_list_default (int verbose)
|
||||
void
|
||||
trigger_command_error_running (struct t_trigger *trigger, const char *action)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: action \"%s\" can not be executed on "
|
||||
"trigger \"%s\" because it is currently running"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
action, trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: action \"%s\" can not be executed on "
|
||||
"trigger \"%s\" because it is currently "
|
||||
"running"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
action, trigger->name);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -354,16 +361,17 @@ trigger_command_set_enabled (struct t_trigger *trigger,
|
||||
if (weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED]))
|
||||
{
|
||||
trigger_hook (trigger);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" restarted"),
|
||||
trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" restarted"),
|
||||
trigger->name);
|
||||
}
|
||||
else if (display_error)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: a disabled trigger can not be "
|
||||
"restarted"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: a disabled trigger can not be "
|
||||
"restarted"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -375,11 +383,11 @@ trigger_command_set_enabled (struct t_trigger *trigger,
|
||||
}
|
||||
weechat_config_option_set (trigger->options[TRIGGER_OPTION_ENABLED],
|
||||
(enable) ? "on" : "off", 1);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
(enable) ?
|
||||
_("Trigger \"%s\" enabled") :
|
||||
_("Trigger \"%s\" disabled"),
|
||||
trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
(enable) ?
|
||||
_("Trigger \"%s\" enabled") :
|
||||
_("Trigger \"%s\" disabled"),
|
||||
trigger->name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,36 +412,38 @@ trigger_command_rename (struct t_trigger *trigger, const char *new_name)
|
||||
/* check that new name is valid */
|
||||
if (!trigger_name_valid (name2))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
name2);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
name2);
|
||||
goto end;
|
||||
}
|
||||
/* check that no trigger already exists with the new name */
|
||||
if (trigger_search (name2))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already "
|
||||
"exists"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
name2);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already "
|
||||
"exists"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
name2);
|
||||
goto end;
|
||||
}
|
||||
/* rename the trigger */
|
||||
if (trigger_rename (trigger, name2))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" renamed to \"%s\""),
|
||||
name, trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" renamed to \"%s\""),
|
||||
name, trigger->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: failed to rename trigger "
|
||||
"\"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: failed to rename trigger "
|
||||
"\"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,19 +508,21 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
goto error;
|
||||
if (!trigger_name_valid (sargv[0]))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
goto end;
|
||||
}
|
||||
type = trigger_search_hook_type (sargv[1]);
|
||||
if (type < 0)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid hook type: \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[1]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid hook type: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
sargv[1]);
|
||||
goto end;
|
||||
}
|
||||
if ((sargc > 4) && sargv[4][0])
|
||||
@ -551,10 +563,11 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
if ((sargc > 6) && sargv[6][0]
|
||||
&& (trigger_search_return_code (sargv[6]) < 0))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid return code: \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[6]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid return code: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
sargv[6]);
|
||||
goto end;
|
||||
}
|
||||
ptr_trigger = trigger_search (sargv[0]);
|
||||
@ -574,22 +587,24 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already exists "
|
||||
"(choose another name or use option "
|
||||
"\"addreplace\" to overwrite it)"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, sargv[0]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already exists "
|
||||
"(choose another name or use option "
|
||||
"\"addreplace\" to overwrite it)"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, sargv[0]);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
ptr_trigger = trigger_alloc (sargv[0]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: failed to create trigger \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
_("%s%s: failed to create trigger \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
goto end;
|
||||
}
|
||||
ptr_trigger = trigger_new (
|
||||
@ -603,15 +618,17 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
(sargc > 6) ? sargv[6] : ""); /* return code */
|
||||
if (ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" created"), sargv[0]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" created"), sargv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: failed to create trigger \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
_("%s%s: failed to create trigger \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
sargv[0]);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
@ -625,10 +642,10 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
type = trigger_search_hook_type (argv[2]);
|
||||
if (type < 0)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid hook type: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid hook type: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, argv[2]);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
@ -664,10 +681,11 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
ptr_trigger = trigger_search (argv[2]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
add_rc = trigger_hook_default_rc[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0];
|
||||
@ -705,10 +723,11 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
ptr_trigger = trigger_search (argv[2]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
if (ptr_trigger->hook_running)
|
||||
@ -729,17 +748,17 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
{
|
||||
weechat_config_option_set (ptr_trigger->options[index_option],
|
||||
value, 1);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" updated"),
|
||||
ptr_trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" updated"),
|
||||
ptr_trigger->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger option \"%s\" not "
|
||||
"found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, argv[3]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger option \"%s\" not "
|
||||
"found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME, argv[3]);
|
||||
}
|
||||
free (value);
|
||||
}
|
||||
@ -754,10 +773,11 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
ptr_trigger = trigger_search (argv[2]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
if (ptr_trigger->hook_running)
|
||||
@ -777,46 +797,50 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
ptr_trigger = trigger_search (argv[2]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
/* check that new name is valid */
|
||||
if (!trigger_name_valid (argv[3]))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[3]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: invalid trigger name: \"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[3]);
|
||||
goto end;
|
||||
}
|
||||
/* check that no trigger already exists with the new name */
|
||||
if (trigger_search (argv[3]))
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already "
|
||||
"exists"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[3]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" already "
|
||||
"exists"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[3]);
|
||||
goto end;
|
||||
}
|
||||
/* copy the trigger */
|
||||
ptr_trigger2 = trigger_copy (ptr_trigger, argv[3]);
|
||||
if (ptr_trigger2)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" copied to \"%s\""),
|
||||
ptr_trigger->name, ptr_trigger2->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" copied to \"%s\""),
|
||||
ptr_trigger->name, ptr_trigger2->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: failed to copy trigger "
|
||||
"\"%s\""),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
ptr_trigger->name);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: failed to copy trigger "
|
||||
"\"%s\""),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
ptr_trigger->name);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
@ -869,9 +893,10 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
1);
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%sTrigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), argv[i]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%sTrigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -902,8 +927,8 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
}
|
||||
count = count - triggers_count;
|
||||
if (count > 0)
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%d triggers removed"), count);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%d triggers removed"), count);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -919,15 +944,17 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
else
|
||||
{
|
||||
trigger_free (ptr_trigger);
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" removed"), argv[i]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" removed"),
|
||||
argv[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%sTrigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), argv[i]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%sTrigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -942,14 +969,15 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
ptr_trigger = trigger_search (argv[2]);
|
||||
if (!ptr_trigger)
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("%s%s: trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"),
|
||||
TRIGGER_PLUGIN_NAME,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
weechat_printf_tags (NULL, "no_trigger", "");
|
||||
weechat_printf_tags (NULL, "no_trigger", _("Trigger:"));
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger", "");
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger", _("Trigger:"));
|
||||
trigger_command_display_trigger (ptr_trigger, 2);
|
||||
goto end;
|
||||
}
|
||||
@ -989,16 +1017,17 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
trigger_config_default_list[j][5], /* regex */
|
||||
trigger_config_default_list[j][6], /* command */
|
||||
trigger_config_default_list[j][7]); /* return code */
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("Trigger \"%s\" restored"),
|
||||
argv[i]);
|
||||
weechat_printf_date_tags (NULL, 0, "no_trigger",
|
||||
_("Trigger \"%s\" restored"),
|
||||
argv[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_tags (NULL, "no_trigger",
|
||||
_("%sDefault trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), argv[i]);
|
||||
weechat_printf_date_tags (
|
||||
NULL, 0, "no_trigger",
|
||||
_("%sDefault trigger \"%s\" not found"),
|
||||
weechat_prefix ("error"), argv[i]);
|
||||
}
|
||||
}
|
||||
goto end;
|
||||
|
@ -57,7 +57,7 @@ struct timeval;
|
||||
* please change the date with current one; for a second change at same
|
||||
* date, increment the 01, otherwise please keep 01.
|
||||
*/
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20160423-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20160618-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
@ -1495,12 +1495,6 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
#define weechat_printf(__buffer, __message, __argz...) \
|
||||
(weechat_plugin->printf_date_tags)(__buffer, 0, NULL, __message, \
|
||||
##__argz)
|
||||
#define weechat_printf_date(__buffer, __date, __message, __argz...) \
|
||||
(weechat_plugin->printf_date_tags)(__buffer, __date, NULL, \
|
||||
__message, ##__argz)
|
||||
#define weechat_printf_tags(__buffer, __tags, __message, __argz...) \
|
||||
(weechat_plugin->printf_date_tags)(__buffer, 0, __tags, __message, \
|
||||
##__argz)
|
||||
#define weechat_printf_date_tags(__buffer, __date, __tags, __message, \
|
||||
__argz...) \
|
||||
(weechat_plugin->printf_date_tags)(__buffer, __date, __tags, \
|
||||
|
@ -200,16 +200,18 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
|
||||
(pv_tags && pv_tags[0]) ? pv_tags : "",
|
||||
(pv_tags && pv_tags[0]) ? "," : "",
|
||||
xfer->remote_nick);
|
||||
weechat_printf_tags (xfer->buffer,
|
||||
str_tags,
|
||||
"%s%s%s%s%s%s",
|
||||
weechat_prefix ("action"),
|
||||
weechat_color ((xfer->remote_nick_color) ?
|
||||
xfer->remote_nick_color : "chat_nick_other"),
|
||||
xfer->remote_nick,
|
||||
weechat_color ("chat"),
|
||||
(ptr_buf2[0]) ? " " : "",
|
||||
ptr_buf2);
|
||||
weechat_printf_date_tags (
|
||||
xfer->buffer,
|
||||
0,
|
||||
str_tags,
|
||||
"%s%s%s%s%s%s",
|
||||
weechat_prefix ("action"),
|
||||
weechat_color ((xfer->remote_nick_color) ?
|
||||
xfer->remote_nick_color : "chat_nick_other"),
|
||||
xfer->remote_nick,
|
||||
weechat_color ("chat"),
|
||||
(ptr_buf2[0]) ? " " : "",
|
||||
ptr_buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -224,13 +226,16 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
|
||||
xfer->remote_nick);
|
||||
if (str_color)
|
||||
free (str_color);
|
||||
weechat_printf_tags (xfer->buffer,
|
||||
str_tags,
|
||||
"%s%s\t%s",
|
||||
weechat_color ((xfer->remote_nick_color) ?
|
||||
xfer->remote_nick_color : "chat_nick_other"),
|
||||
xfer->remote_nick,
|
||||
ptr_buf2);
|
||||
weechat_printf_date_tags (
|
||||
xfer->buffer,
|
||||
0,
|
||||
str_tags,
|
||||
"%s%s\t%s",
|
||||
weechat_color (
|
||||
(xfer->remote_nick_color) ?
|
||||
xfer->remote_nick_color : "chat_nick_other"),
|
||||
xfer->remote_nick,
|
||||
ptr_buf2);
|
||||
}
|
||||
if (ptr_buf_decoded)
|
||||
free (ptr_buf_decoded);
|
||||
@ -290,12 +295,14 @@ xfer_chat_buffer_input_cb (const void *pointer, void *data,
|
||||
input_data_color = weechat_hook_modifier_exec ("irc_color_decode",
|
||||
"1",
|
||||
input_data);
|
||||
weechat_printf_tags (buffer,
|
||||
str_tags,
|
||||
"%s%s\t%s",
|
||||
weechat_color ("chat_nick_self"),
|
||||
ptr_xfer->local_nick,
|
||||
(input_data_color) ? input_data_color : input_data);
|
||||
weechat_printf_date_tags (
|
||||
buffer,
|
||||
0,
|
||||
str_tags,
|
||||
"%s%s\t%s",
|
||||
weechat_color ("chat_nick_self"),
|
||||
ptr_xfer->local_nick,
|
||||
(input_data_color) ? input_data_color : input_data);
|
||||
if (input_data_color)
|
||||
free (input_data_color);
|
||||
}
|
||||
|
@ -62,14 +62,15 @@ xfer_command_me (const void *pointer, void *data,
|
||||
{
|
||||
xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\r\n",
|
||||
(argv_eol[1]) ? argv_eol[1] : "");
|
||||
weechat_printf_tags (buffer,
|
||||
"no_highlight",
|
||||
"%s%s%s %s%s",
|
||||
weechat_prefix ("action"),
|
||||
weechat_color ("chat_nick_self"),
|
||||
ptr_xfer->local_nick,
|
||||
weechat_color ("chat"),
|
||||
(argv_eol[1]) ? argv_eol[1] : "");
|
||||
weechat_printf_date_tags (buffer,
|
||||
0,
|
||||
"no_highlight",
|
||||
"%s%s%s %s%s",
|
||||
weechat_prefix ("action"),
|
||||
weechat_color ("chat_nick_self"),
|
||||
ptr_xfer->local_nick,
|
||||
weechat_color ("chat"),
|
||||
(argv_eol[1]) ? argv_eol[1] : "");
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user