1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

Fix crash/bug when option "addresses" for an IRC server is unset or changed when WeeChat is connected to this server (bug #31268)

This commit is contained in:
Sebastien Helleu
2010-10-07 13:15:49 +02:00
parent 55b5130a87
commit 36736564ab
13 changed files with 168 additions and 90 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.4-dev, 2010-10-06
v0.3.4-dev, 2010-10-07
Version 0.3.4 (under dev!)
@@ -21,6 +21,8 @@ Version 0.3.4 (under dev!)
info_get_hashtable
* irc: display old channel topic when topic is unset (task #9780)
* irc: add new info_hashtable "irc_parse_message"
* irc: fix crash/bug when option "addresses" for a server is unset or changed
when WeeChat is connected to this server (bug #31268)
* irc: fix bug with hostmasks in command /ignore (bug #30716)
* rmodifier: new plugin "rmodifier": alter modifier strings with regular
expressions (bug #26964)
+9 -6
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-08-07 10:46+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5331,8 +5331,8 @@ msgstr "%s: navazuji nové spojení se serverem za %d %s"
msgid "%s: switching address to %s/%d"
msgstr "%s: přepínám adresu na %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
#, fuzzy, c-format
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: připojen k %s (%s)"
#, c-format
@@ -5458,9 +5458,9 @@ msgstr " - informace o certifikátu klienta (%s):"
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: nemůžu číst certifikát \"%s\""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr "%s%s: adresa pro server \"%s\" není definována, nemohu se připojit"
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s%s: přezdívka není definovaná pro server \"%s\", nelze se spojit"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -6874,6 +6874,9 @@ msgstr ""
msgid "Pointer"
msgstr "Ukazatel"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr "%s%s: adresa pro server \"%s\" není definována, nemohu se připojit"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr "%s%s: buffer IRC serveru \"%s\", kanálu \"%s\" nenalezen"
+12 -7
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-09-28 09:34+0200\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5539,8 +5539,8 @@ msgstr "%s: Verbinde erneut zum Server in %d %s"
msgid "%s: switching address to %s/%d"
msgstr "%s: Wechsel Adresse zu %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
#, fuzzy, c-format
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: Verbindung zu %s (%s)"
#, c-format
@@ -5666,11 +5666,11 @@ msgstr " - Client Zertifikate-Information (%s):"
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: Kann das Zertifikat \"%s\" nicht lesen"
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr ""
"%s%s: Adresse für den Server \"%s\" nicht definiert, Verbindung wird nicht "
"hergestellt"
"%s%s Nicknamen für den Server \"%s\" nicht definiert, kann keine Verbindung "
"herstellen"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -7142,5 +7142,10 @@ msgstr "Hashtable (Ausgabe)"
msgid "Pointer"
msgstr "Pointer"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr ""
#~ "%s%s: Adresse für den Server \"%s\" nicht definiert, Verbindung wird "
#~ "nicht hergestellt"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr "%s%s: Keinen Buffer für IRC Server \"%s\", Channel \"%s\" gefunden"
+11 -7
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-08-07 10:46+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5390,8 +5390,8 @@ msgstr "%s: reconectando al servidor en %d %s"
msgid "%s: switching address to %s/%d"
msgstr "%s: cambiando dirección a %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
#, fuzzy, c-format
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: conectado a %s (%s)"
#, c-format
@@ -5515,11 +5515,10 @@ msgstr " - información del certificado del cliente (%s):"
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: no es posible leer el certificado \"%s\""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr ""
"%s%s: dirección sin definir para el servidor \"%s\", no es posible "
"conectarse"
"%s%s: apodos sin definir para el servidor \"%s\", no es posible conectarse"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -6965,6 +6964,11 @@ msgstr ""
msgid "Pointer"
msgstr "Puntero"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr ""
#~ "%s%s: dirección sin definir para el servidor \"%s\", no es posible "
#~ "conectarse"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr ""
#~ "%s%s: buffer no encontrado para el servidor IRC \"%s\", canal \"%s\""
+10 -7
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"PO-Revision-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-10-07 12:46+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -5441,8 +5441,8 @@ msgid "%s: switching address to %s/%d"
msgstr "%s: bascule vers l'adresse %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
msgstr "%s: connecté à %s (%s)"
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: connecté à %s/%d (%s)"
#, c-format
msgid "%s%s: proxy address \"%s\" not found"
@@ -5567,9 +5567,8 @@ msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: impossible de lire le certificat \"%s\""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr ""
"%s%s: adresses non définies pour le serveur \"%s\", connexion impossible"
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s%s: adresse inconnue pour le serveur \"%s\", connexion impossible"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -7026,5 +7025,9 @@ msgstr "Hashtable (sortie)"
msgid "Pointer"
msgstr "Pointeur"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr ""
#~ "%s%s: adresses non définies pour le serveur \"%s\", connexion impossible"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr "%s%s: tampon non trouvé pour le serveur IRC \"%s\", canal \"%s\""
+5 -5
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-08-07 10:46+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5102,7 +5102,7 @@ msgid "%s: switching address to %s/%d"
msgstr "%s IP-cím nem található\n"
#, fuzzy, c-format
msgid "%s: connected to %s (%s)"
msgid "%s: connected to %s/%d (%s)"
msgstr "%s nincs csatlakozva a \"%s\" szerverhez!\n"
#, fuzzy, c-format
@@ -5224,9 +5224,9 @@ msgstr ""
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s név \"%s\" nem található a \"%s\" parancshoz\n"
#, fuzzy, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
+10 -7
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-09-22 15:27+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5405,8 +5405,8 @@ msgstr "%s: riconnessione al server tra %d %s"
msgid "%s: switching address to %s/%d"
msgstr "%s: cambio indirizzo in %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
#, fuzzy, c-format
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: connesso a %s (%s)"
#, c-format
@@ -5531,10 +5531,9 @@ msgstr " - info sul certificato (%s) del client:"
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: impossibile leggere il certificato \"%s\""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr ""
"%s%s: indirizzo non definito per il server \"%s\", impossibile connettersi"
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s%s: nick non definiti per il server\"%s\", impossibile connettersi"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -6975,6 +6974,10 @@ msgstr "Tabella hash (output)"
msgid "Pointer"
msgstr "Puntatore"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr ""
#~ "%s%s: indirizzo non definito per il server \"%s\", impossibile connettersi"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr "%s%s: buffer non trovato per il server IRC \"%s\", canale \"%s\""
+10 -7
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-08-07 10:46+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5362,8 +5362,8 @@ msgstr "%s: ponowne połączenie za %d %s"
msgid "%s: switching address to %s/%d"
msgstr "%s: zmieniam adres na %s/%d"
#, c-format
msgid "%s: connected to %s (%s)"
#, fuzzy, c-format
msgid "%s: connected to %s/%d (%s)"
msgstr "%s: połączono z %s (%s)"
#, c-format
@@ -5488,10 +5488,9 @@ msgstr " - informacje o certyfikacie klienta (%s):"
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "%sgnutls: nie można odczytać certyfikatu \"%s\""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr ""
"%s%s: adres nie zdefiniowany dla serwera \"%s\", nie można się połączyć"
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s%s: nie zdefiniowano nicków dla serwera \"%s\", nie można połączyć"
#, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
@@ -6892,6 +6891,10 @@ msgstr ""
msgid "Pointer"
msgstr "Wskaźnik"
#~ msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
#~ msgstr ""
#~ "%s%s: adres nie zdefiniowany dla serwera \"%s\", nie można się połączyć"
#~ msgid "%s%s: buffer not found for IRC server \"%s\", channel \"%s\""
#~ msgstr "%s%s: nie znaleziono bufora dla serwera IRC \"%s\", kanał \"%s\""
+5 -5
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\n"
"PO-Revision-Date: 2010-08-07 10:46+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5116,7 +5116,7 @@ msgid "%s: switching address to %s/%d"
msgstr "%s IP адрес не найден\n"
#, fuzzy, c-format
msgid "%s: connected to %s (%s)"
msgid "%s: connected to %s/%d (%s)"
msgstr "%s не подключен к серверу \"%s\"!\n"
#, fuzzy, c-format
@@ -5239,9 +5239,9 @@ msgstr ""
msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr "Не могу записать лог-файл \"%s\"\n"
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr "%s ник \"%s\" не найден для команды \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: proxy \"%s\" not found for server \"%s\", cannot connect"
+3 -3
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-10-06 18:24+0200\n"
"POT-Creation-Date: 2010-10-07 12:45+0200\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"
@@ -4412,7 +4412,7 @@ msgid "%s: switching address to %s/%d"
msgstr ""
#, c-format
msgid "%s: connected to %s (%s)"
msgid "%s: connected to %s/%d (%s)"
msgstr ""
#, c-format
@@ -4532,7 +4532,7 @@ msgid "%sgnutls: unable to read certifcate \"%s\""
msgstr ""
#, c-format
msgid "%s%s: addresses not defined for server \"%s\", cannot connect"
msgid "%s%s: unknown address server \"%s\", cannot connect"
msgstr ""
#, c-format
+69 -34
View File
@@ -229,6 +229,30 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
}
}
/*
* irc_server_set_index_current_address: set index of current address for server
*/
void
irc_server_set_index_current_address (struct t_irc_server *server, int index)
{
if (server->current_address)
{
free (server->current_address);
server->current_address = NULL;
}
server->current_port = 0;
if (index < server->addresses_count)
{
server->index_current_address = index;
if (server->current_address)
free (server->current_address);
server->current_address = strdup (server->addresses_array[index]);
server->current_port = server->ports_array[index];
}
}
/*
* irc_server_set_nicks: set nicks for server
*/
@@ -395,7 +419,9 @@ irc_server_alloc (const char *name)
new_server->addresses_array = NULL;
new_server->ports_array = NULL;
new_server->index_current_address = 0;
new_server->current_address = NULL;
new_server->current_ip = NULL;
new_server->current_port = 0;
new_server->sock = -1;
new_server->hook_connect = NULL;
new_server->hook_fd = NULL;
@@ -832,6 +858,8 @@ irc_server_free_data (struct t_irc_server *server)
weechat_string_free_split (server->addresses_array);
if (server->ports_array)
free (server->ports_array);
if (server->current_address)
free (server->current_address);
if (server->current_ip)
free (server->current_ip);
if (server->hook_connect)
@@ -2103,7 +2131,8 @@ irc_server_timer_cb (void *data, int remaining_calls)
&& (new_time >= ptr_server->lag_next_check))
{
irc_server_sendf (ptr_server, 0, NULL, "PING %s",
ptr_server->addresses_array[ptr_server->index_current_address]);
(ptr_server->current_address) ?
ptr_server->current_address : "weechat");
gettimeofday (&(ptr_server->lag_check_time), NULL);
ptr_server->lag = 0;
ptr_server->lag_last_refresh = 0;
@@ -2237,11 +2266,6 @@ irc_server_close_connection (struct t_irc_server *server)
/* server is now disconnected */
server->is_connected = 0;
server->ssl_connected = 0;
if (server->current_ip)
{
free (server->current_ip);
server->current_ip = NULL;
}
}
/*
@@ -2253,7 +2277,7 @@ irc_server_reconnect_schedule (struct t_irc_server *server)
{
int minutes, seconds;
server->index_current_address = 0;
irc_server_set_index_current_address (server, 0);
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))
{
@@ -2341,7 +2365,7 @@ irc_server_login (struct t_irc_server *server)
server->nick,
(username && username[0]) ? username : "weechat",
(username && username[0]) ? username : "weechat",
server->addresses_array[server->index_current_address],
server->current_address,
(realname && realname[0]) ? realname : ((username && username[0]) ? username : "weechat"));
if (server->hook_timer_connection)
@@ -2363,12 +2387,12 @@ irc_server_switch_address (struct t_irc_server *server)
if ((server->addresses_count > 1)
&& (server->index_current_address < server->addresses_count - 1))
{
server->index_current_address++;
irc_server_set_index_current_address (server, server->index_current_address + 1);
weechat_printf (server->buffer,
_("%s: switching address to %s/%d"),
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address]);
server->current_address,
server->current_port);
irc_server_connect (server);
}
else
@@ -2400,9 +2424,10 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
free (server->current_ip);
server->current_ip = (ip_address) ? strdup (ip_address) : NULL;
weechat_printf (server->buffer,
_("%s: connected to %s (%s)"),
_("%s: connected to %s/%d (%s)"),
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address],
server->current_address,
server->current_port,
(server->current_ip) ? server->current_ip : "?");
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
@@ -2416,7 +2441,7 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
_("%s%s: proxy address \"%s\" not found") :
_("%s%s: address \"%s\" not found"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address]);
server->current_address);
if (error && error[0])
{
weechat_printf (server->buffer,
@@ -2567,14 +2592,15 @@ irc_server_set_buffer_title (struct t_irc_server *server)
{
if (server->is_connected)
{
length = 16 + strlen (server->addresses_array[server->index_current_address]) +
length = 16 +
((server->current_address) ? strlen (server->current_address) : 16) +
16 + ((server->current_ip) ? strlen (server->current_ip) : 16) + 1;
title = malloc (length);
if (title)
{
snprintf (title, length, "IRC: %s/%d (%s)",
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
(server->current_ip) ? server->current_ip : "");
weechat_buffer_set (server->buffer, "title", title);
free (title);
@@ -2689,7 +2715,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
return -1;
server = (struct t_irc_server *) data;
hostname = server->addresses_array[server->index_current_address];
hostname = server->current_address;
hostname_match = 0;
weechat_printf (server->buffer,
@@ -2929,10 +2955,13 @@ irc_server_connect (struct t_irc_server *server)
weechat_bar_item_update ("buffer_name");
}
if (!server->addresses_array)
irc_server_set_index_current_address (server,
server->index_current_address);
if (!server->current_address)
{
weechat_printf (server->buffer,
_("%s%s: addresses not defined for server \"%s\", "
_("%s%s: unknown address server \"%s\", "
"cannot connect"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
server->name);
@@ -3015,8 +3044,8 @@ irc_server_connect (struct t_irc_server *server)
_("%s: connecting to server %s/%d%s%s via %s "
"proxy %s/%d%s..."),
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ?
" (IPv6)" : "",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
@@ -3027,8 +3056,8 @@ irc_server_connect (struct t_irc_server *server)
(weechat_config_boolean (proxy_ipv6)) ? " (IPv6)" : "");
weechat_log_printf (_("Connecting to server %s/%d%s%s via %s proxy "
"%s/%d%s..."),
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ?
" (IPv6)" : "",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
@@ -3043,8 +3072,8 @@ irc_server_connect (struct t_irc_server *server)
weechat_printf (server->buffer,
_("%s: connecting to server %s/%d%s%s..."),
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ?
" (IPv6)" : "",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
@@ -3052,8 +3081,8 @@ irc_server_connect (struct t_irc_server *server)
weechat_log_printf (_("%s%s: connecting to server %s/%d%s%s..."),
"",
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ?
" (IPv6)" : "",
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
@@ -3112,8 +3141,8 @@ irc_server_connect (struct t_irc_server *server)
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))
server->ssl_connected = 1;
server->hook_connect = weechat_hook_connect (proxy,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
server->sock,
IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6),
(server->ssl_connected) ? &server->gnutls_sess : NULL,
@@ -3124,8 +3153,8 @@ irc_server_connect (struct t_irc_server *server)
server);
#else
server->hook_connect = weechat_hook_connect (proxy,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
server->current_address,
server->current_port,
server->sock,
IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6),
NULL, NULL, 0,
@@ -3153,7 +3182,7 @@ irc_server_reconnect (struct t_irc_server *server)
IRC_PLUGIN_NAME);
server->reconnect_start = 0;
server->index_current_address = 0;
irc_server_set_index_current_address(server, 0);
if (irc_server_connect (server))
server->reconnect_join = 1;
@@ -3216,7 +3245,7 @@ irc_server_disconnect (struct t_irc_server *server, int reconnect)
IRC_PLUGIN_NAME);
}
server->index_current_address = 0;
irc_server_set_index_current_address(server, 0);
if (server->nick_modes)
{
free (server->nick_modes);
@@ -3813,8 +3842,12 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "index_current_address", server->index_current_address))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "current_address", server->current_address))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "current_ip", server->current_ip))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "current_port", server->current_port))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "sock", server->sock))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "is_connected", server->is_connected))
@@ -4052,7 +4085,9 @@ irc_server_print_log ()
weechat_log_printf (" addresses_array. . . : 0x%lx", ptr_server->addresses_array);
weechat_log_printf (" ports_array. . . . . : 0x%lx", ptr_server->ports_array);
weechat_log_printf (" index_current_address: %d", ptr_server->index_current_address);
weechat_log_printf (" current_address. . . : '%s'", ptr_server->current_address);
weechat_log_printf (" current_ip . . . . . : '%s'", ptr_server->current_ip);
weechat_log_printf (" current_port . . . . : %d", ptr_server->current_port);
weechat_log_printf (" sock . . . . . . . . : %d", ptr_server->sock);
weechat_log_printf (" hook_connect . . . . : 0x%lx", ptr_server->hook_connect);
weechat_log_printf (" hook_fd. . . . . . . : 0x%lx", ptr_server->hook_fd);
+2
View File
@@ -119,7 +119,9 @@ struct t_irc_server
char **addresses_array; /* addresses (after split) */
int *ports_array; /* ports for addresses */
int index_current_address; /* current address index in array */
char *current_address; /* current address */
char *current_ip; /* current IP address */
int current_port; /* current port */
int sock; /* socket for server (IPv4 or IPv6) */
struct t_hook *hook_connect; /* connection hook */
struct t_hook *hook_fd; /* hook for server socket */
+19 -1
View File
@@ -232,7 +232,25 @@ irc_upgrade_read_cb (void *data,
}
irc_upgrade_current_server->index_current_address =
weechat_infolist_integer (infolist, "index_current_address");
str = weechat_infolist_string (infolist, "current_address");
if (str)
{
irc_upgrade_current_server->current_address = strdup (str);
irc_upgrade_current_server->current_port = weechat_infolist_integer (infolist, "current_port");
}
else
{
if (irc_upgrade_current_server->index_current_address < irc_upgrade_current_server->addresses_count)
{
irc_upgrade_current_server->current_address =
strdup (irc_upgrade_current_server->addresses_array[irc_upgrade_current_server->index_current_address]);
irc_upgrade_current_server->current_port =
irc_upgrade_current_server->ports_array[irc_upgrade_current_server->index_current_address];
}
}
str = weechat_infolist_string (infolist, "current_ip");
if (str)
irc_upgrade_current_server->current_ip = strdup (str);
sock = weechat_infolist_integer (infolist, "sock");
if (sock >= 0)
{