summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--po/cs.po6
-rw-r--r--po/de.po6
-rw-r--r--po/es.po6
-rw-r--r--po/fr.po8
-rw-r--r--po/hu.po6
-rw-r--r--po/ru.po6
-rw-r--r--po/weechat.pot6
-rw-r--r--src/core/wee-hook.h2
-rw-r--r--src/core/wee-network.c105
-rw-r--r--src/plugins/irc/irc-server.c7
-rw-r--r--src/plugins/weechat-plugin.h4
11 files changed, 142 insertions, 20 deletions
diff --git a/po/cs.po b/po/cs.po
index 8b3b4b68f..11cecaef1 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3796,6 +3796,10 @@ msgid "%s: switching address to %s/%d"
msgstr "%s IP adresa nenalezena\n"
#, fuzzy, c-format
+msgid "%s: connected to %s (%s)"
+msgstr "%s nepřipojen k serveru \"%s\"!\n"
+
+#, fuzzy, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s adresa proxy \"%s\" nenalezena\n"
diff --git a/po/de.po b/po/de.po
index 92e054464..4f224c196 100644
--- a/po/de.po
+++ b/po/de.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3706,6 +3706,10 @@ msgid "%s: switching address to %s/%d"
msgstr "%s IP-Adresse nicht gefunden\n"
#, fuzzy, c-format
+msgid "%s: connected to %s (%s)"
+msgstr "%s keine Verbindung zum Server \"%s\"!\n"
+
+#, fuzzy, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s Proxyadresse \"%s\" nicht gefunden\n"
diff --git a/po/es.po b/po/es.po
index 08d736f66..5ae9d2566 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3705,6 +3705,10 @@ msgid "%s: switching address to %s/%d"
msgstr "%s Dirección IP no encontrada\n"
#, fuzzy, c-format
+msgid "%s: connected to %s (%s)"
+msgstr "%s ¡no conectado al servidor \"%s\"!\n"
+
+#, fuzzy, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s dirección proxy \"%s\" no encontrada\n"
diff --git a/po/fr.po b/po/fr.po
index c8362705d..8765018b7 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
-"PO-Revision-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
+"PO-Revision-Date: 2008-09-22 16:27+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -3732,6 +3732,10 @@ 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)"
+
+#, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s%s: adresse du proxy \"%s\" non trouvée"
diff --git a/po/hu.po b/po/hu.po
index 49c4f753a..dc6373b3f 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3729,6 +3729,10 @@ 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)"
+msgstr "%s nincs csatlakozva a \"%s\" szerverhez!\n"
+
+#, fuzzy, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s proxy cím \"%s\" nem található\n"
diff --git a/po/ru.po b/po/ru.po
index 216322380..d7bb62b74 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3721,6 +3721,10 @@ msgid "%s: switching address to %s/%d"
msgstr "%s IP адрес не найден\n"
#, fuzzy, c-format
+msgid "%s: connected to %s (%s)"
+msgstr "%s не подключен к серверу \"%s\"!\n"
+
+#, fuzzy, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr "%s proxy \"%s\" не найден\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index d212e73f2..29a8dc7e5 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: 2008-09-21 21:30+0200\n"
+"POT-Creation-Date: 2008-09-22 16:26+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"
@@ -3181,6 +3181,10 @@ msgid "%s: switching address to %s/%d"
msgstr ""
#, c-format
+msgid "%s: connected to %s (%s)"
+msgstr ""
+
+#, c-format
msgid "%s%s: proxy address \"%s\" not found"
msgstr ""
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 566e4a119..3c0c15f2b 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -120,7 +120,7 @@ struct t_hook_fd
int flags; /* fd flags (read,write,..) */
};
-typedef int (t_hook_callback_connect)(void *data, int status);
+typedef int (t_hook_callback_connect)(void *data, int status, char *ip_address);
struct t_hook_connect
{
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 33c031cca..9f100a8ad 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -511,8 +511,10 @@ void
network_connect_child (struct t_hook *hook_connect)
{
struct addrinfo hints, *res, *res_local;
- char status_str[2];
- int rc;
+ char status_str[2], *ptr_address, *status_ok_with_address;
+ char ipv4_address[INET_ADDRSTRLEN + 1], ipv6_address[INET6_ADDRSTRLEN + 1];
+ char status_ok_without_address[1 + 5 + 1];
+ int rc, length;
res = NULL;
res_local = NULL;
@@ -663,7 +665,55 @@ network_connect_child (struct t_hook *hook_connect)
/* connection ok */
status_str[0] = '0' + WEECHAT_HOOK_CONNECT_OK;
- write (HOOK_CONNECT(hook_connect, child_write), status_str, 1);
+
+ status_ok_with_address = NULL;
+ ptr_address = NULL;
+ if (HOOK_CONNECT(hook_connect, ipv6))
+ {
+ if (inet_ntop (AF_INET6,
+ &((struct sockaddr_in6 *)(res->ai_addr))->sin6_addr,
+ ipv6_address,
+ INET6_ADDRSTRLEN))
+ {
+ ptr_address = ipv6_address;
+ }
+ }
+ else
+ {
+ //ip = inet_ntoa (((struct sockaddr_in *)(res->ai_addr))->sin_addr);
+ if (inet_ntop (AF_INET,
+ &((struct sockaddr_in *)(res->ai_addr))->sin_addr,
+ ipv4_address,
+ INET_ADDRSTRLEN))
+ {
+ ptr_address = ipv4_address;
+ }
+ }
+ if (ptr_address)
+ {
+ length = strlen (status_str) + 5 + strlen (ptr_address) + 1;
+ status_ok_with_address = malloc (length);
+ if (status_ok_with_address)
+ {
+ snprintf (status_ok_with_address, length, "%s%05d%s",
+ status_str, strlen (ptr_address), ptr_address);
+ }
+ }
+
+ if (status_ok_with_address)
+ {
+ write (HOOK_CONNECT(hook_connect, child_write),
+ status_ok_with_address, strlen (status_ok_with_address));
+ free (status_ok_with_address);
+ }
+ else
+ {
+ snprintf (status_ok_without_address, sizeof (status_ok_without_address),
+ "%s%05d", status_str, 0);
+ write (HOOK_CONNECT(hook_connect, child_write),
+ status_ok_without_address, strlen (status_ok_without_address));
+ }
+
if (res)
freeaddrinfo (res);
if (res_local)
@@ -678,20 +728,47 @@ int
network_connect_child_read_cb (void *arg_hook_connect)
{
struct t_hook *hook_connect;
- char buffer[1];
+ char buffer[1], buf_size_ip[6], *ip_address, *error;
int num_read;
+ long size_ip;
#ifdef HAVE_GNUTLS
int rc;
#endif
hook_connect = (struct t_hook *)arg_hook_connect;
+ ip_address = NULL;
+
num_read = read (HOOK_CONNECT(hook_connect, child_read),
buffer, sizeof (buffer));
if (num_read > 0)
{
if (buffer[0] - '0' == WEECHAT_HOOK_CONNECT_OK)
{
+ buf_size_ip[5] = '\0';
+ num_read = read (HOOK_CONNECT(hook_connect, child_read),
+ buf_size_ip, 5);
+ if (num_read == 5)
+ {
+ error = NULL;
+ size_ip = strtol (buf_size_ip, &error, 10);
+ if (error && !error[0])
+ {
+ ip_address = malloc (size_ip + 1);
+ if (ip_address)
+ {
+ num_read = read (HOOK_CONNECT(hook_connect, child_read),
+ ip_address, size_ip);
+ if (num_read == size_ip)
+ ip_address[size_ip] = '\0';
+ else
+ {
+ free (ip_address);
+ ip_address = NULL;
+ }
+ }
+ }
+ }
#ifdef HAVE_GNUTLS
if (HOOK_CONNECT(hook_connect, gnutls_sess))
{
@@ -708,18 +785,25 @@ network_connect_child_read_cb (void *arg_hook_connect)
if (rc != GNUTLS_E_SUCCESS)
{
(void) (HOOK_CONNECT(hook_connect, callback))
- (hook_connect->callback_data, WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR);
+ (hook_connect->callback_data,
+ WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR,
+ ip_address);
unhook (hook_connect);
+ if (ip_address)
+ free (ip_address);
return WEECHAT_RC_OK;
}
}
#endif
}
(void) (HOOK_CONNECT(hook_connect, callback))
- (hook_connect->callback_data, buffer[0] - '0');
+ (hook_connect->callback_data, buffer[0] - '0', ip_address);
unhook (hook_connect);
}
+ if (ip_address)
+ free (ip_address);
+
return WEECHAT_RC_OK;
}
@@ -743,7 +827,8 @@ network_connect_with_fork (struct t_hook *hook_connect)
{
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR);
+ '0' + WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR,
+ NULL);
unhook (hook_connect);
return;
}
@@ -765,7 +850,8 @@ network_connect_with_fork (struct t_hook *hook_connect)
{
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
+ '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
+ NULL);
unhook (hook_connect);
return;
}
@@ -786,7 +872,8 @@ network_connect_with_fork (struct t_hook *hook_connect)
case -1:
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
+ '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
+ NULL);
unhook (hook_connect);
return;
/* child process */
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 47cb2303b..a34710d34 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1956,7 +1956,7 @@ irc_server_switch_address (struct t_irc_server *server)
*/
int
-irc_server_connect_cb (void *arg_server, int status)
+irc_server_connect_cb (void *arg_server, int status, char *ip_address)
{
struct t_irc_server *server;
int config_proxy_use;
@@ -1972,6 +1972,11 @@ irc_server_connect_cb (void *arg_server, int status)
{
case WEECHAT_HOOK_CONNECT_OK:
/* login to server */
+ weechat_printf (server->buffer,
+ _("%s: connected to %s (%s)"),
+ IRC_PLUGIN_NAME,
+ server->addresses_array[server->current_address],
+ (ip_address) ? ip_address : "?");
irc_server_login (server);
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index de2c7c567..3f9dbf53f 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -326,7 +326,9 @@ struct t_weechat_plugin
const char *address, int port,
int sock, int ipv6, void *gnutls_sess,
const char *local_hostname,
- int (*callback)(void *data, int status),
+ int (*callback)(void *data,
+ int status,
+ char *ip_address),
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,