Improve support for network protocols besides IPv4
This commit is contained in:
parent
0ae427a0f3
commit
52a514b20a
|
@ -1182,9 +1182,9 @@ static gboolean _on_connect(gpointer data)
|
||||||
char const * p;
|
char const * p;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
struct addrinfo * ai;
|
struct addrinfo * ai;
|
||||||
struct sockaddr_in * sa;
|
|
||||||
int res;
|
int res;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
char buf2[128];
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||||
|
@ -1218,12 +1218,10 @@ static gboolean _on_connect(gpointer data)
|
||||||
/* FIXME report properly as a warning instead */
|
/* FIXME report properly as a warning instead */
|
||||||
helper->error(NULL, strerror(errno), 1);
|
helper->error(NULL, strerror(errno), 1);
|
||||||
/* report the current status */
|
/* report the current status */
|
||||||
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), "Connecting to %s (%s:%u)", hostname,
|
snprintf(buf, sizeof(buf), "Connecting to %s (%s:%u)", hostname,
|
||||||
inet_ntoa(sa->sin_addr), port);
|
p, port);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "Connecting to %s", hostname);
|
snprintf(buf, sizeof(buf), "Connecting to %s", hostname);
|
||||||
_imap4_event_status(imap4, AS_CONNECTING, buf);
|
_imap4_event_status(imap4, AS_CONNECTING, buf);
|
||||||
|
|
|
@ -642,9 +642,9 @@ static gboolean _on_connect(gpointer data)
|
||||||
char const * p;
|
char const * p;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
struct addrinfo * ai;
|
struct addrinfo * ai;
|
||||||
struct sockaddr_in * sa;
|
|
||||||
int res;
|
int res;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
char buf2[128];
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||||
|
@ -678,12 +678,10 @@ static gboolean _on_connect(gpointer data)
|
||||||
/* FIXME report properly as a warning instead */
|
/* FIXME report properly as a warning instead */
|
||||||
helper->error(NULL, strerror(errno), 1);
|
helper->error(NULL, strerror(errno), 1);
|
||||||
/* report the current status */
|
/* report the current status */
|
||||||
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), "Connecting to %s (%s:%u)", hostname,
|
snprintf(buf, sizeof(buf), "Connecting to %s (%s:%u)", hostname,
|
||||||
inet_ntoa(sa->sin_addr), port);
|
p, port);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "Connecting to %s", hostname);
|
snprintf(buf, sizeof(buf), "Connecting to %s", hostname);
|
||||||
_pop3_event_status(pop3, AS_CONNECTING, buf);
|
_pop3_event_status(pop3, AS_CONNECTING, buf);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user