summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-04-26 18:19:27 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-04-26 18:19:27 +0200
commitf002c8e7deecb73fbb8d2e9a68c782335ebc5824 (patch)
treeaee1c62c14f88bf5ef7513ac68a386c8c91c31ce
parent3fd2af81847440fa221621572d6cf36eca910483 (diff)
downloadweechat-f002c8e7deecb73fbb8d2e9a68c782335ebc5824.zip
irc: add modifier "irc_in2_xxx" (called after charset decoding)
-rw-r--r--ChangeLog1
-rw-r--r--doc/en/weechat_plugin_api.en.txt7
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt7
-rw-r--r--doc/it/weechat_plugin_api.it.txt21
-rw-r--r--src/plugins/irc/irc-server.c50
5 files changed, 63 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 1da37ee9d..5b23c2d0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@ Version 0.3.5 (under dev!)
(plugins: irc, relay, xfer, scripts)
* aspell: add section "option" in aspell.conf for speller options (task #11083)
* aspell: fix spellers used after switch of window (bug #32811)
+* irc: add modifier "irc_in2_xxx" (called after charset decoding)
* irc: fix memory leak when copying or renaming server
* irc: do not rejoin channels where /part has been issued before reconnection
to server (bug #33029)
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index bfdecf907..7b60242be 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -7710,7 +7710,12 @@ Arguments:
| irc | irc_in_xxx ^(1)^ |
server name |
- content of message received from IRC server |
+ content of message received from IRC server (before charset decoding) |
+ new content of message
+
+| irc | irc_in2_xxx ^(1)^ |
+ server name |
+ content of message received from IRC server (after charset decoding) |
new content of message
| irc | irc_out_xxx ^(1)^ |
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 16aec43c5..255862bf5 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -7825,7 +7825,12 @@ Paramètres :
| irc | irc_in_xxx ^(1)^ |
nom de serveur |
- contenu du message reçu du serveur IRC |
+ contenu du message reçu du serveur IRC (avant décodage du jeu de caractères) |
+ nouveau contenu du message
+
+| irc | irc_in2_xxx ^(1)^ |
+ nom de serveur |
+ contenu du message reçu du serveur IRC (après décodage du jeu de caractères) |
nouveau contenu du message
| irc | irc_out_xxx ^(1)^ |
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt
index b3e20b420..5287da15b 100644
--- a/doc/it/weechat_plugin_api.it.txt
+++ b/doc/it/weechat_plugin_api.it.txt
@@ -6736,7 +6736,7 @@ Argomenti:
utilizzato dal plugin irc, il segnale viene inviato
anche se il messaggio è stato ignorato)
-| irc | xxx,irc_out_yyy ^1^ | string: messaggio |
+| irc | xxx,irc_out_yyy ^(1)^ | string: messaggio |
messaggio irc inviato al server
| irc | xxx,irc_outtags_yyy ^(1)^ | stringa: tag + ";" + messaggio |
@@ -7745,17 +7745,24 @@ Argomenti:
qualsiasi stringa |
stringa con i codici colori IRC, o senza colore
-| irc | irc_in_xxx ^1^ |
+// TRANSLATION MISSING
+| irc | irc_in_xxx ^(1)^ |
+ nome server |
+ contenuto del messaggio ricevuto dal server IRC (before charset decoding) |
+ nuovo contenuto del messaggio
+
+// TRANSLATION MISSING
+| irc | irc_in2_xxx ^(1)^ |
nome server |
- contenuto del messaggio ricevuto dal server IRC |
+ contenuto del messaggio ricevuto dal server IRC (after charset decoding) |
nuovo contenuto del messaggio
-| irc | irc_out_xxx ^1^ |
+| irc | irc_out_xxx ^(1)^ |
nome server |
contenuto del messaggio che sta per essere inviato al server IRC |
nuovo contenuto del messaggio
-| weechat | bar_condition_yyy ^2^ |
+| weechat | bar_condition_yyy ^(2)^ |
stringa con puntatore alla finestra ("0x123..") |
stringa vuota |
"1" per visualizzare la barra, "0" per nasconderla
@@ -7789,8 +7796,8 @@ Argomenti:
|========================================
[NOTE]
-^1^ 'xxx' è il nome del comando IRC. +
-^2^ 'yyy' è il nome della barra.
+^(1)^ 'xxx' è il nome del comando IRC. +
+^(2)^ 'yyy' è il nome della barra.
* 'callback': funzione chiamata quando viene usato il modificatore,
argomenti:
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 8ed37ee25..b642b93cd 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1902,7 +1902,7 @@ void
irc_server_msgq_flush ()
{
struct t_irc_message *next;
- char *ptr_data, *new_msg, *ptr_msg, *pos;
+ char *ptr_data, *new_msg, *new_msg2, *ptr_msg, *ptr_msg2, *pos;
char *nick, *host, *command, *channel, *arguments;
char *msg_decoded, *msg_decoded_without_color;
char str_modifier[64], modifier_data[256];
@@ -1997,24 +1997,46 @@ irc_server_msgq_flush ()
weechat_string_remove_color ((msg_decoded) ? msg_decoded : ptr_msg,
"?");
- /* parse and execute command */
- if (irc_redirect_message (irc_recv_msgq->server,
- (msg_decoded_without_color) ?
- msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg),
- command, arguments))
+ /* call modifier after charset */
+ ptr_msg2 = (msg_decoded_without_color) ?
+ msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg);
+ snprintf (str_modifier, sizeof (str_modifier),
+ "irc_in2_%s",
+ (command) ? command : "unknown");
+ new_msg2 = weechat_hook_modifier_exec (str_modifier,
+ irc_recv_msgq->server->name,
+ ptr_msg2);
+ if (new_msg2 && (strcmp (ptr_msg2, new_msg2) == 0))
{
- /* message redirected, we'll not display it! */
+ free (new_msg2);
+ new_msg2 = NULL;
}
- else
+
+ /* message not dropped? */
+ if (!new_msg2 || new_msg2[0])
{
- /* message not redirected, display it */
- irc_protocol_recv_command (irc_recv_msgq->server,
- (msg_decoded_without_color) ?
- msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg),
- command,
- channel);
+ /* use new message (returned by plugin) */
+ if (new_msg2)
+ ptr_msg2 = new_msg2;
+
+ /* parse and execute command */
+ if (irc_redirect_message (irc_recv_msgq->server,
+ ptr_msg2, command,
+ arguments))
+ {
+ /* message redirected, we'll not display it! */
+ }
+ else
+ {
+ /* message not redirected, display it */
+ irc_protocol_recv_command (irc_recv_msgq->server,
+ ptr_msg2, command,
+ channel);
+ }
}
+ if (new_msg2)
+ free (new_msg2);
if (nick)
free (nick);
if (host)