Improve support for network protocols besides IPv4
This commit is contained in:
parent
bc31a8dd0c
commit
97a408b4a7
|
@ -1293,9 +1293,10 @@ static gboolean _on_watch_can_connect(GIOChannel * source,
|
||||||
char const * hostname = imap4->config[I4CV_HOSTNAME].value;
|
char const * hostname = imap4->config[I4CV_HOSTNAME].value;
|
||||||
uint16_t port = (unsigned long)imap4->config[I4CV_PORT].value;
|
uint16_t port = (unsigned long)imap4->config[I4CV_PORT].value;
|
||||||
struct addrinfo * ai;
|
struct addrinfo * ai;
|
||||||
struct sockaddr_in * sa;
|
char const * p;
|
||||||
SSL_CTX * ssl_ctx;
|
SSL_CTX * ssl_ctx;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
char buf2[128];
|
||||||
|
|
||||||
if(condition != G_IO_OUT || source != imap4->channel)
|
if(condition != G_IO_OUT || source != imap4->channel)
|
||||||
return FALSE; /* should not happen */
|
return FALSE; /* should not happen */
|
||||||
|
@ -1314,13 +1315,10 @@ static gboolean _on_watch_can_connect(GIOChannel * source,
|
||||||
/* XXX remember the address instead */
|
/* XXX remember the address instead */
|
||||||
if(_common_lookup(hostname, port, &ai) == 0)
|
if(_common_lookup(hostname, port, &ai) == 0)
|
||||||
{
|
{
|
||||||
if(ai->ai_family == AF_INET)
|
if((p = inet_ntop(ai->ai_family, ai->ai_addr, buf2,
|
||||||
{
|
sizeof(buf2))) != NULL)
|
||||||
sa = (struct sockaddr_in *)ai->ai_addr;
|
|
||||||
snprintf(buf, sizeof(buf), "Connected to %s (%s:%u)",
|
snprintf(buf, sizeof(buf), "Connected to %s (%s:%u)",
|
||||||
hostname, inet_ntoa(sa->sin_addr),
|
hostname, p, port);
|
||||||
port);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "Connected to %s", hostname);
|
snprintf(buf, sizeof(buf), "Connected to %s", hostname);
|
||||||
_imap4_event_status(imap4, AS_CONNECTED, buf);
|
_imap4_event_status(imap4, AS_CONNECTED, buf);
|
||||||
|
|
|
@ -751,9 +751,10 @@ static gboolean _on_watch_can_connect(GIOChannel * source,
|
||||||
char const * hostname = pop3->config[P3CV_HOSTNAME].value;
|
char const * hostname = pop3->config[P3CV_HOSTNAME].value;
|
||||||
uint16_t port = (unsigned long)pop3->config[P3CV_PORT].value;
|
uint16_t port = (unsigned long)pop3->config[P3CV_PORT].value;
|
||||||
struct addrinfo * ai;
|
struct addrinfo * ai;
|
||||||
struct sockaddr_in * sa;
|
|
||||||
SSL_CTX * ssl_ctx;
|
SSL_CTX * ssl_ctx;
|
||||||
|
char const * p;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
char buf2[128];
|
||||||
|
|
||||||
if(condition != G_IO_OUT || source != pop3->channel)
|
if(condition != G_IO_OUT || source != pop3->channel)
|
||||||
return FALSE; /* should not happen */
|
return FALSE; /* should not happen */
|
||||||
|
@ -772,13 +773,10 @@ static gboolean _on_watch_can_connect(GIOChannel * source,
|
||||||
/* XXX remember the address instead */
|
/* XXX remember the address instead */
|
||||||
if(_common_lookup(hostname, port, &ai) == 0)
|
if(_common_lookup(hostname, port, &ai) == 0)
|
||||||
{
|
{
|
||||||
if(ai->ai_family == AF_INET)
|
if((p = inet_ntop(ai->ai_family, ai->ai_addr, buf2,
|
||||||
{
|
sizeof(buf2))) != NULL)
|
||||||
sa = (struct sockaddr_in *)ai->ai_addr;
|
|
||||||
snprintf(buf, sizeof(buf), "Connected to %s (%s:%u)",
|
snprintf(buf, sizeof(buf), "Connected to %s (%s:%u)",
|
||||||
hostname, inet_ntoa(sa->sin_addr),
|
hostname, p, port);
|
||||||
port);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "Connected to %s", hostname);
|
snprintf(buf, sizeof(buf), "Connected to %s", hostname);
|
||||||
_pop3_event_status(pop3, AS_CONNECTED, buf);
|
_pop3_event_status(pop3, AS_CONNECTED, buf);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user