diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | doc/en/autogen/user/irc_options.txt | 11 | ||||
-rw-r--r-- | doc/fr/autogen/user/irc_options.txt | 11 | ||||
-rw-r--r-- | doc/it/autogen/user/irc_options.txt | 11 | ||||
-rw-r--r-- | po/cs.po | 15 | ||||
-rw-r--r-- | po/de.po | 15 | ||||
-rw-r--r-- | po/es.po | 14 | ||||
-rw-r--r-- | po/fr.po | 19 | ||||
-rw-r--r-- | po/hu.po | 13 | ||||
-rw-r--r-- | po/it.po | 13 | ||||
-rw-r--r-- | po/pl.po | 15 | ||||
-rw-r--r-- | po/ru.po | 13 | ||||
-rw-r--r-- | po/weechat.pot | 11 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 72 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 19 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-input.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 146 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.h | 12 |
21 files changed, 300 insertions, 128 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= FlashCode <flashcode@flashtux.org> -v0.3.1-dev, 2010-01-11 +v0.3.1-dev, 2010-01-17 Version 0.3.1 (under dev!) @@ -27,6 +27,8 @@ Version 0.3.1 (under dev!) * irc: add new commands /allchan and /allserv with excluding option, commands /ame and /amsg are now aliases, new aliases /aaway and /anick * irc: add options to customize target buffer for messages (task #7381) +* irc: add new output queue for messages with low priority (like automatic CTCP + replies), high priority is given to user messages or commands * irc: use self-signed certificate to auto identify on IRC server (CertFP) (task #7492, debian #453348) * irc: check SSL certificates (task #7492) diff --git a/doc/en/autogen/user/irc_options.txt b/doc/en/autogen/user/irc_options.txt index 6348a38cf..bb42f71d4 100644 --- a/doc/en/autogen/user/irc_options.txt +++ b/doc/en/autogen/user/irc_options.txt @@ -153,10 +153,15 @@ ** type: boolean ** values: on, off (default value: off) -* *irc.network.anti_flood* -** description: anti-flood: # seconds between two user messages (0 = no anti-flood) +* *irc.network.anti_flood_prio_high* +** description: anti-flood for high priority queue: number of seconds between two user messages or commands sent to IRC server (0 = no anti-flood) ** type: integer -** values: 0 .. 5 (default value: 2) +** values: 0 .. 60 (default value: 2) + +* *irc.network.anti_flood_prio_low* +** description: anti-flood for low priority queue: number of seconds between two messages sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood) +** type: integer +** values: 0 .. 60 (default value: 2) * *irc.network.away_check* ** description: interval between two checks for away (in minutes, 0 = never check) diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt index ce163ddb6..19c7e8147 100644 --- a/doc/fr/autogen/user/irc_options.txt +++ b/doc/fr/autogen/user/irc_options.txt @@ -153,10 +153,15 @@ ** type: booléen ** valeurs: on, off (valeur par défaut: off) -* *irc.network.anti_flood* -** description: anti-flood: nombre de secondes entre deux messages utilisateur (0 = pas d'anti-flood) +* *irc.network.anti_flood_prio_high* +** description: anti-flood pour la file d'attente haute priorité : nombre de secondes entre deux messages utilisateur ou commandes envoyés au serveur IRC (0 = pas d'anti-flood) ** type: entier -** valeurs: 0 .. 5 (valeur par défaut: 2) +** valeurs: 0 .. 60 (valeur par défaut: 2) + +* *irc.network.anti_flood_prio_low* +** description: anti-flood pour la file d'attente basse priorité : nombre de secondes entre deux messages envoyés au serveur IRC (messages comme les réponses automatiques aux CTCP) (0 = pas d'anti-flood) +** type: entier +** valeurs: 0 .. 60 (valeur par défaut: 2) * *irc.network.away_check* ** description: intervalle entre deux vérifications des absences (en minutes, 0 = ne jamais vérifier) diff --git a/doc/it/autogen/user/irc_options.txt b/doc/it/autogen/user/irc_options.txt index f5767da1e..bc6b60eae 100644 --- a/doc/it/autogen/user/irc_options.txt +++ b/doc/it/autogen/user/irc_options.txt @@ -153,10 +153,15 @@ ** tipo: bool ** valori: on, off (valore predefinito: off) -* *irc.network.anti_flood* -** descrizione: anti-flood: # secondi tra due messaggi utente (0 = nessun anti-flood) +* *irc.network.anti_flood_prio_high* +** descrizione: anti-flood for high priority queue: number of seconds between two user messages or commands sent to IRC server (0 = no anti-flood) ** tipo: intero -** valori: 0 .. 5 (valore predefinito: 2) +** valori: 0 .. 60 (valore predefinito: 2) + +* *irc.network.anti_flood_prio_low* +** descrizione: anti-flood for low priority queue: number of seconds between two messages sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood) +** tipo: intero +** valori: 0 .. 60 (valore predefinito: 2) * *irc.network.away_check* ** descrizione: intervallo tra le due verifiche per l'assenza (in minuti, 0 = nessun check) @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-03 15:15+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4196,7 +4196,18 @@ msgstr "minimální lag, který zobrazit (v sekundách)" msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "odpojit po závažném lagu (v minutách, 0 = nikny neodpojit)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "" +"anti-flood: počet sekund mezi dvěmi uživatelovými zprávami (0 = vypnutí anti-" +"flood)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "" "anti-flood: počet sekund mezi dvěmi uživatelovými zprávami (0 = vypnutí anti-" "flood)" @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-14 15:43+0100\n" "Last-Translator: Nils G <weechatter@arcor.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4382,7 +4382,18 @@ msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" "Maximal-Lag bis zum Trennen der Verbindung (in Minuten - 0 = niemals trennen)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "" +"anti-flood: # Sekunden zwischen zwei Benutzernachrichten (0 = kein anti-" +"flood)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "" "anti-flood: # Sekunden zwischen zwei Benutzernachrichten (0 = kein anti-" "flood)" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-03 15:16+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4289,7 +4289,17 @@ msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" "desconexión tras un retraso importante (en minutos, 0 = no desconectar nunca)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "" +"anti-flood: # segundos entre 2 mensajes de un usuario (0 = sin anti-flood" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "" "anti-flood: # segundos entre 2 mensajes de un usuario (0 = sin anti-flood" @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" -"PO-Revision-Date: 2010-01-14 10:21+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" +"PO-Revision-Date: 2010-01-17 15:44+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -4317,11 +4317,22 @@ msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" "déconnexion après un lag important (en minutes, 0 = ne jamais se déconnecter)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" msgstr "" -"anti-flood: nombre de secondes entre deux messages utilisateur (0 = pas " +"anti-flood pour la file d'attente haute priorité : nombre de secondes entre " +"deux messages utilisateur ou commandes envoyés au serveur IRC (0 = pas " "d'anti-flood)" +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" +msgstr "" +"anti-flood pour la file d'attente basse priorité : nombre de secondes entre " +"deux messages envoyés au serveur IRC (messages comme les réponses " +"automatiques aux CTCP) (0 = pas d'anti-flood)" + msgid "when off, colors codes are ignored in incoming messages" msgstr "si désactivé, les codes couleurs des messages entrants sont ignorés" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-03 15:16+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4138,7 +4138,16 @@ msgstr "minimális kijelzett késés (másodpercben)" msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "lekapcsolódás túl nagy késés esetén (percben, 0 = nincs lecsatlakozás)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "anti-flood: # másodperc két üzenet között (0 = anti-flood kikapcsolva)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "anti-flood: # másodperc két üzenet között (0 = anti-flood kikapcsolva)" msgid "when off, colors codes are ignored in incoming messages" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Weechat 0.31-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-09 23:03+0100\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4290,7 +4290,16 @@ msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" "disconnetti dopo un ritardo eccessivo (in minuti, 0 = nessuna disconnessione)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "anti-flood: # secondi tra due messaggi utente (0 = nessun anti-flood)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "anti-flood: # secondi tra due messaggi utente (0 = nessun anti-flood)" msgid "when off, colors codes are ignored in incoming messages" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-17 00:15+0100\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: Polish\n" @@ -4268,7 +4268,18 @@ msgstr "minimalne opóźnienie do pokazania (w sekundach)" msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "rozłącz po dużym opóźnieniu (w minutach, 0 = nie rozłączaj nigdy)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "" +"anty-flood: # sekund pomiędzy dwoma wiadomościami użytkownika (0 - brak anty-" +"flood)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "" "anty-flood: # sekund pomiędzy dwoma wiadomościami użytkownika (0 - brak anty-" "flood)" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: 2010-01-03 15:16+0100\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4139,7 +4139,16 @@ msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" "отключаться при серьёзной задержке (в минутах, 0 = не отключаться никогда)" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +#, fuzzy +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "анти-флуд; интервал отправки сообщений в секундах (0 = без анти-флуда)" + +#, fuzzy +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "анти-флуд; интервал отправки сообщений в секундах (0 = без анти-флуда)" msgid "when off, colors codes are ignored in incoming messages" diff --git a/po/weechat.pot b/po/weechat.pot index 5ef530e54..f505a83ba 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-01-14 10:20+0100\n" +"POT-Creation-Date: 2010-01-17 15:43+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -3520,7 +3520,14 @@ msgstr "" msgid "disconnect after important lag (in minutes, 0 = never disconnect)" msgstr "" -msgid "anti-flood: # seconds between two user messages (0 = no anti-flood)" +msgid "" +"anti-flood for high priority queue: number of seconds between two user " +"messages or commands sent to IRC server (0 = no anti-flood)" +msgstr "" + +msgid "" +"anti-flood for low priority queue: number of seconds between two messages " +"sent to IRC server (messages like automatic CTCP replies) (0 = no anti-flood)" msgstr "" msgid "when off, colors codes are ignored in incoming messages" diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 533bc9f72..6acadd536 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -365,7 +365,8 @@ irc_channel_check_away (struct t_irc_server *server, || (channel->nicks_count <= weechat_config_integer (irc_config_network_away_check_max_nicks))) { channel->checking_away++; - irc_server_sendf (server, 1, "WHO %s", channel->name); + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_LOW, + "WHO %s", channel->name); } else irc_channel_remove_away (channel); diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index a28d9757a..7f0314c42 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -332,7 +332,8 @@ irc_command_me_channel (struct t_irc_server *server, { char *string; - irc_server_sendf (server, 1, "PRIVMSG %s :\01ACTION %s\01", + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :\01ACTION %s\01", channel->name, (arguments && arguments[0]) ? arguments : ""); string = (arguments && arguments[0]) ? @@ -392,7 +393,8 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments, { server->is_away = 1; server->away_time = time (NULL); - irc_server_sendf (server, 1, "AWAY :%s", arguments); + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "AWAY :%s", arguments); if (weechat_config_integer (irc_config_look_display_away) != IRC_CONFIG_DISPLAY_AWAY_OFF) { string = irc_color_decode (arguments, @@ -452,7 +454,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments, /* if server is connected, send away command now */ if (server->is_connected) { - irc_server_sendf (server, 1, "AWAY"); + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, "AWAY"); server->is_away = 0; if (server->away_time != 0) { @@ -787,7 +789,8 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, gettimeofday (&tv, NULL); snprintf (str_time, sizeof (str_time), "%ld %ld", tv.tv_sec, tv.tv_usec); - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :\01PING %s\01", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :\01PING %s\01", argv[1], str_time); weechat_printf (ptr_server->buffer, _("%sCTCP query to %s%s%s: %s%s%s%s%s"), @@ -803,7 +806,8 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, } else { - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :\01%s%s%s\01", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :\01%s%s%s\01", argv[1], irc_cmd, (argv_eol[3]) ? " " : "", @@ -2158,7 +2162,8 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, if (string) free (string); - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :%s", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :%s", ptr_channel->name, argv_eol[arg_text]); } else @@ -2180,7 +2185,9 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, if (string) free (string); } - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :%s", + irc_server_sendf (ptr_server, + IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :%s", targets[i], argv_eol[arg_text]); } else @@ -2237,7 +2244,9 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, if (string) free (string); } - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :%s", + irc_server_sendf (ptr_server, + IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :%s", targets[i], argv_eol[arg_text]); } } @@ -2386,7 +2395,8 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, (string) ? string : argv_eol[arg_text]); if (string) free (string); - irc_server_sendf (ptr_server, 1, "NOTICE %s :%s", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "NOTICE %s :%s", argv[arg_nick], argv_eol[arg_text]); } else @@ -2661,7 +2671,8 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, (string) ? string : argv_eol[arg_text]); if (string) free (string); - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :%s", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :%s", argv[arg_nick], argv_eol[arg_text]); } } @@ -2694,13 +2705,15 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc, ptr_server = irc_server_search (argv[2]); if (!ptr_server || (ptr_server->sock < 0)) return WEECHAT_RC_ERROR; - irc_server_sendf (ptr_server, 1, "%s", argv_eol[3]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "%s", argv_eol[3]); } else { if (!ptr_server || (ptr_server->sock < 0)) return WEECHAT_RC_ERROR; - irc_server_sendf (ptr_server, 1, "%s", argv_eol[1]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "%s", argv_eol[1]); } } else @@ -3307,7 +3320,10 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, for (ptr_server2 = irc_servers; ptr_server2; ptr_server2 = ptr_server2->next_server) { - irc_server_outqueue_free_all (ptr_server2); + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + irc_server_outqueue_free_all (ptr_server2, i); + } } weechat_printf (NULL, _("%s: messages outqueue DELETED for all " @@ -3402,10 +3418,12 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc, if (argc > 1) { if (argc > 2) - irc_server_sendf (ptr_server, 1, "SQUERY %s :%s", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "SQUERY %s :%s", argv[1], argv_eol[2]); else - irc_server_sendf (ptr_server, 1, "SQUERY %s", argv_eol[1]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "SQUERY %s", argv_eol[1]); } else { @@ -3562,13 +3580,14 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc, if (new_topic) { if (weechat_strcasecmp (new_topic, "-delete") == 0) - irc_server_sendf (ptr_server, 1, "TOPIC %s :", - channel_name); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "TOPIC %s :", channel_name); else { new_topic_color = irc_color_encode (new_topic, weechat_config_boolean (irc_config_network_colors_send)); - irc_server_sendf (ptr_server, 1, "TOPIC %s :%s", + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "TOPIC %s :%s", channel_name, (new_topic_color) ? new_topic_color : new_topic); if (new_topic_color) @@ -3576,7 +3595,8 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc, } } else - irc_server_sendf (ptr_server, 1, "TOPIC %s", channel_name); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "TOPIC %s", channel_name); return WEECHAT_RC_OK; } @@ -3737,14 +3757,15 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc, { if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) && irc_nick_search (ptr_channel, argv[1])) - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :\01VERSION\01", - argv[1]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :\01VERSION\01", argv[1]); else - irc_server_sendf (ptr_server, 1, "VERSION %s", - argv[1]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "VERSION %s", argv[1]); } else - irc_server_sendf (ptr_server, 1, "VERSION"); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "VERSION"); return WEECHAT_RC_OK; } @@ -3803,7 +3824,8 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc, (void) argv; if (argc > 1) - irc_server_sendf (ptr_server, 1, "WALLOPS :%s", argv_eol[1]); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "WALLOPS :%s", argv_eol[1]); else { IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallops"); diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index d411ce447..7a5ecce84 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -90,7 +90,7 @@ struct t_config_option *irc_config_network_away_check_max_nicks; struct t_config_option *irc_config_network_lag_check; struct t_config_option *irc_config_network_lag_min_show; struct t_config_option *irc_config_network_lag_disconnect; -struct t_config_option *irc_config_network_anti_flood; +struct t_config_option *irc_config_network_anti_flood[2]; struct t_config_option *irc_config_network_colors_receive; struct t_config_option *irc_config_network_colors_send; struct t_config_option *irc_config_network_send_unknown_commands; @@ -1559,12 +1559,19 @@ irc_config_init () N_("disconnect after important lag (in minutes, 0 = never " "disconnect)"), NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_anti_flood = weechat_config_new_option ( + irc_config_network_anti_flood[0] = weechat_config_new_option ( irc_config_file, ptr_section, - "anti_flood", "integer", - N_("anti-flood: # seconds between two user messages (0 = no " - "anti-flood)"), - NULL, 0, 5, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + "anti_flood_prio_high", "integer", + N_("anti-flood for high priority queue: number of seconds between two " + "user messages or commands sent to IRC server (0 = no anti-flood)"), + NULL, 0, 60, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_anti_flood[1] = weechat_config_new_option ( + irc_config_file, ptr_section, + "anti_flood_prio_low", "integer", + N_("anti-flood for low priority queue: number of seconds between two " + "messages sent to IRC server (messages like automatic CTCP replies) " + "(0 = no anti-flood)"), + NULL, 0, 60, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_colors_receive = weechat_config_new_option ( irc_config_file, ptr_section, "colors_receive", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 18900b1bc..e463928e8 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -108,7 +108,7 @@ extern struct t_config_option *irc_config_network_away_check_max_nicks; extern struct t_config_option *irc_config_network_lag_check; extern struct t_config_option *irc_config_network_lag_min_show; extern struct t_config_option *irc_config_network_lag_disconnect; -extern struct t_config_option *irc_config_network_anti_flood; +extern struct t_config_option *irc_config_network_anti_flood[2]; extern struct t_config_option *irc_config_network_colors_receive; extern struct t_config_option *irc_config_network_colors_send; extern struct t_config_option *irc_config_network_send_unknown_commands; diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index a2aeaff15..459ab2fee 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -245,7 +245,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server, const char *nick, const char *ctcp, const char *arguments) { - irc_server_sendf (server, 1, + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_LOW, "NOTICE %s :\01%s%s%s\01", nick, ctcp, (arguments) ? " " : "", diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index c7e68cb8f..2d75c1f41 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -124,8 +124,8 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text) } } - irc_server_sendf (ptr_server, 1, "PRIVMSG %s :%s", - ptr_channel->name, text); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + "PRIVMSG %s :%s", ptr_channel->name, text); irc_input_user_message_display (buffer, text); if (next) @@ -157,7 +157,8 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, && (input_data[0] == '/') && (input_data[1] != '/')) { if (ptr_server) - irc_server_sendf (ptr_server, 1, input_data + 1); + irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, + input_data + 1); return WEECHAT_RC_OK; } diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 087cc4735..eee8b4684 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -317,8 +317,11 @@ irc_server_alloc (const char *name) weechat_config_integer (irc_config_network_lag_check); new_server->cmd_list_regexp = NULL; new_server->last_user_message = 0; - new_server->outqueue = NULL; - new_server->last_outqueue = NULL; + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + new_server->outqueue[i] = NULL; + new_server->last_outqueue[i] = NULL; + } new_server->buffer = NULL; new_server->buffer_as_string = NULL; new_server->channels = NULL; @@ -581,8 +584,9 @@ irc_server_apply_command_line_options (struct t_irc_server *server, */ void -irc_server_outqueue_add (struct t_irc_server *server, const char *command, - const char *msg1, const char *msg2, int modified) +irc_server_outqueue_add (struct t_irc_server *server, int priority, + const char *command, const char *msg1, + const char *msg2, int modified) { struct t_irc_outqueue *new_outqueue; @@ -594,13 +598,13 @@ irc_server_outqueue_add (struct t_irc_server *server, const char *command, new_outqueue->message_after_mod = (msg2) ? strdup (msg2) : NULL; new_outqueue->modified = modified; - new_outqueue->prev_outqueue = server->last_outqueue; + new_outqueue->prev_outqueue = server->last_outqueue[priority]; new_outqueue->next_outqueue = NULL; - if (server->outqueue) - server->last_outqueue->next_outqueue = new_outqueue; + if (server->outqueue[priority]) + server->last_outqueue[priority]->next_outqueue = new_outqueue; else - server->outqueue = new_outqueue; - server->last_outqueue = new_outqueue; + server->outqueue[priority] = new_outqueue; + server->last_outqueue[priority] = new_outqueue; } } @@ -610,17 +614,18 @@ irc_server_outqueue_add (struct t_irc_server *server, const char *command, void irc_server_outqueue_free (struct t_irc_server *server, + int priority, struct t_irc_outqueue *outqueue) { struct t_irc_outqueue *new_outqueue; /* remove outqueue message */ - if (server->last_outqueue == outqueue) - server->last_outqueue = outqueue->prev_outqueue; + if (server->last_outqueue[priority] == outqueue) + server->last_outqueue[priority] = outqueue->prev_outqueue; if (outqueue->prev_outqueue) { (outqueue->prev_outqueue)->next_outqueue = outqueue->next_outqueue; - new_outqueue = server->outqueue; + new_outqueue = server->outqueue[priority]; } else new_outqueue = outqueue->next_outqueue; @@ -636,7 +641,7 @@ irc_server_outqueue_free (struct t_irc_server *server, if (outqueue->message_after_mod) free (outqueue->message_after_mod); free (outqueue); - server->outqueue = new_outqueue; + server->outqueue[priority] = new_outqueue; } /* @@ -644,11 +649,12 @@ irc_server_outqueue_free (struct t_irc_server *server, */ void -irc_server_outqueue_free_all (struct t_irc_server *server) +irc_server_outqueue_free_all (struct t_irc_server *server, int priority) { - while (server->outqueue) + while (server->outqueue[priority]) { - irc_server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, priority, + server->outqueue[priority]); } } @@ -690,8 +696,10 @@ irc_server_free_data (struct t_irc_server *server) free (server->prefix); if (server->away_message) free (server->away_message); - if (server->outqueue) - irc_server_outqueue_free_all (server); + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + irc_server_outqueue_free_all (server, i); + } if (server->channels) irc_channel_free_all (server); if (server->buffer_as_string) @@ -971,49 +979,55 @@ irc_server_outqueue_send (struct t_irc_server *server) { time_t time_now; char *pos; + int priority; - if (server->outqueue) + time_now = time (NULL); + + /* detect if system clock has been changed (now lower than before) */ + if (server->last_user_message > time_now) + server->last_user_message = time_now; + + for (priority = 0; priority < IRC_SERVER_NUM_OUTQUEUES_PRIO; priority++) { - time_now = time (NULL); - - /* detect if system clock has been changed (now lower than before) */ - if (server->last_user_message > time_now) - server->last_user_message = time_now; - - if (time_now >= server->last_user_message + - weechat_config_integer (irc_config_network_anti_flood)) + if (server->outqueue[priority] + && (time_now >= server->last_user_message + + weechat_config_integer (irc_config_network_anti_flood[priority]))) { - if (server->outqueue->message_before_mod) + if (server->outqueue[priority]->message_before_mod) { - pos = strchr (server->outqueue->message_before_mod, '\r'); + pos = strchr (server->outqueue[priority]->message_before_mod, + '\r'); if (pos) pos[0] = '\0'; irc_raw_print (server, 1, 0, - server->outqueue->message_before_mod); + server->outqueue[priority]->message_before_mod); if (pos) pos[0] = '\r'; } - if (server->outqueue->message_after_mod) + if (server->outqueue[priority]->message_after_mod) { - pos = strchr (server->outqueue->message_after_mod, '\r'); + pos = strchr (server->outqueue[priority]->message_after_mod, + '\r'); if (pos) pos[0] = '\0'; - irc_raw_print (server, 1, server->outqueue->modified, - server->outqueue->message_after_mod); + irc_raw_print (server, 1, server->outqueue[priority]->modified, + server->outqueue[priority]->message_after_mod); if (pos) pos[0] = '\r'; /* send signal with command that will be sent to server */ irc_server_send_signal (server, "irc_out", - server->outqueue->command, - server->outqueue->message_after_mod); + server->outqueue[priority]->command, + server->outqueue[priority]->message_after_mod); /* send command */ - irc_server_send (server, server->outqueue->message_after_mod, - strlen (server->outqueue->message_after_mod)); + irc_server_send (server, server->outqueue[priority]->message_after_mod, + strlen (server->outqueue[priority]->message_after_mod)); server->last_user_message = time_now; } - irc_server_outqueue_free (server, server->outqueue); + irc_server_outqueue_free (server, priority, + server->outqueue[priority]); + break; } } } @@ -1140,9 +1154,12 @@ irc_server_parse_message (const char *message, char **nick, char **host, /* * irc_server_send_one_msg: send one message to IRC server - * if queue_msg == 1, then messages are in a queue and + * if queue_msg > 0, then messages are in a queue and * sent slowly (to be sure there will not be any - * "excess flood") + * "excess flood"), value of queue_msg is priority: + * 1 = higher priority, for user messages + * 2 = lower priority, for other messages (like + * auto reply to CTCP queries) * return: 1 if ok, 0 if error */ @@ -1221,17 +1238,17 @@ irc_server_send_one_msg (struct t_irc_server *server, int queue_msg, server->last_user_message = time_now; add_to_queue = 0; - if (queue_msg - && (server->outqueue - || ((weechat_config_integer (irc_config_network_anti_flood) > 0) + if ((queue_msg > 0) + && (server->outqueue[queue_msg - 1] + || ((weechat_config_integer (irc_config_network_anti_flood[queue_msg - 1]) > 0) && (time_now - server->last_user_message < - weechat_config_integer (irc_config_network_anti_flood))))) - add_to_queue = 1; + weechat_config_integer (irc_config_network_anti_flood[queue_msg - 1]))))) + add_to_queue = queue_msg; - if (add_to_queue) + if (add_to_queue > 0) { /* queue message (do not send anything now) */ - irc_server_outqueue_add (server, command, + irc_server_outqueue_add (server, add_to_queue - 1, command, (new_msg && first_message) ? message : NULL, buffer, (new_msg) ? 1 : 0); @@ -1252,7 +1269,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int queue_msg, rc = 0; else { - if (queue_msg) + if (queue_msg > 0) server->last_user_message = time_now; } } @@ -1287,8 +1304,12 @@ irc_server_send_one_msg (struct t_irc_server *server, int queue_msg, /* * irc_server_sendf: send formatted data to IRC server * many messages may be sent, separated by '\n' - * if queue_msg == 1, then messages are in a queue and sent - * slowly (to be sure there will not be any "excess flood") + * if queue_msg > 0, then messages are in a queue and sent + * slowly (to be sure there will not be any "excess flood"), + * value of queue_msg is priority: + * 1 = higher priority, for user messages + * 2 = lower priority, for other messages (like auto reply + * to CTCP queries) */ void @@ -1773,6 +1794,8 @@ irc_server_timer_check_away_cb (void *data, int remaining_calls) void irc_server_close_connection (struct t_irc_server *server) { + int i; + if (server->hook_fd) { weechat_unhook (server->hook_fd); @@ -1813,7 +1836,10 @@ irc_server_close_connection (struct t_irc_server *server) free (server->unterminated_message); server->unterminated_message = NULL; } - irc_server_outqueue_free_all (server); + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + irc_server_outqueue_free_all (server, i); + } /* server is now disconnected */ server->is_connected = 0; @@ -3024,7 +3050,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, 1, + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, "PRIVMSG %s :\01DCC SEND %s%s%s " "%s %d %s\01", weechat_infolist_string (infolist, "remote_nick"), @@ -3037,7 +3063,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal, } else if (strcmp (type, "chat_send") == 0) { - irc_server_sendf (server, 1, + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, "PRIVMSG %s :\01DCC CHAT chat %s %d\01", weechat_infolist_string (infolist, "remote_nick"), weechat_infolist_string (infolist, "address"), @@ -3094,7 +3120,7 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, 1, + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, "PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01", weechat_infolist_string (infolist, "remote_nick"), (spaces_in_name) ? "\"" : "", @@ -3153,7 +3179,7 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal, { filename = weechat_infolist_string (infolist, "filename"); spaces_in_name = (strchr (filename, ' ') != NULL); - irc_server_sendf (server, 1, + irc_server_sendf (server, IRC_SERVER_OUTQUEUE_PRIO_HIGH, "PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01", weechat_infolist_string (infolist, "remote_nick"), (spaces_in_name) ? "\"" : "", @@ -3313,6 +3339,7 @@ irc_server_print_log () { struct t_irc_server *ptr_server; struct t_irc_channel *ptr_channel; + int i; for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) @@ -3484,8 +3511,11 @@ irc_server_print_log () weechat_log_printf (" lag_next_check . . . : %ld", ptr_server->lag_next_check); weechat_log_printf (" cmd_list_regexp. . . : 0x%lx", ptr_server->cmd_list_regexp); weechat_log_printf (" last_user_message. . : %ld", ptr_server->last_user_message); - weechat_log_printf (" outqueue . . . . . . : 0x%lx", ptr_server->outqueue); - weechat_log_printf (" last_outqueue. . . . : 0x%lx", ptr_server->last_outqueue); + for (i = 0; i < IRC_SERVER_NUM_OUTQUEUES_PRIO; i++) + { + weechat_log_printf (" outqueue[%02d] . . . . : 0x%lx", i, ptr_server->outqueue[i]); + weechat_log_printf (" last_outqueue[%02d]. . : 0x%lx", i, ptr_server->last_outqueue[i]); + } weechat_log_printf (" buffer . . . . . . . : 0x%lx", ptr_server->buffer); weechat_log_printf (" buffer_as_string . . : 0x%lx", ptr_server->buffer_as_string); weechat_log_printf (" channels . . . . . . : 0x%lx", ptr_server->channels); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index bc7123d1e..bc3a129f9 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -83,6 +83,10 @@ enum t_irc_server_option #define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3," \ "weechat4,weechat5" +#define IRC_SERVER_OUTQUEUE_PRIO_HIGH 1 +#define IRC_SERVER_OUTQUEUE_PRIO_LOW 2 +#define IRC_SERVER_NUM_OUTQUEUES_PRIO 2 + /* output queue of messages to server (for sending slowly to server) */ struct t_irc_outqueue @@ -137,8 +141,9 @@ struct t_irc_server time_t lag_next_check; /* time for next check */ regex_t *cmd_list_regexp; /* compiled Regular Expression for /list */ time_t last_user_message; /* time of last user message (anti flood)*/ - struct t_irc_outqueue *outqueue; /* queue for outgoing user msgs */ - struct t_irc_outqueue *last_outqueue; /* last outgoing user message */ + struct t_irc_outqueue *outqueue[2]; /* queue for outgoing messages */ + /* with 2 priorities (high/low) */ + struct t_irc_outqueue *last_outqueue[2]; /* last outgoing message */ struct t_gui_buffer *buffer; /* GUI buffer allocated for server */ char *buffer_as_string; /* used to return buffer info */ struct t_irc_channel *channels; /* opened channels on server */ @@ -194,7 +199,8 @@ extern void irc_server_autojoin_channels (); extern int irc_server_recv_cb (void *arg_server, int fd); extern int irc_server_timer_cb (void *data, int remaining_calls); extern int irc_server_timer_check_away_cb (void *data, int remaining_calls); -extern void irc_server_outqueue_free_all (struct t_irc_server *server); +extern void irc_server_outqueue_free_all (struct t_irc_server *server, + int priority); extern int irc_server_get_channel_count (struct t_irc_server *server); extern int irc_server_get_pv_count (struct t_irc_server *server); extern void irc_server_set_away (struct t_irc_server *server, const char *nick, |