summaryrefslogtreecommitdiff
path: root/mu/imap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mu/imap.c')
-rw-r--r--mu/imap.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/mu/imap.c b/mu/imap.c
index 85a27a343..deea939f2 100644
--- a/mu/imap.c
+++ b/mu/imap.c
@@ -115,3 +115,2 @@ static char **connect_argv;
#define host connect_argv[0]
-static int port = MU_IMAP_DEFAULT_PORT;
@@ -173,3 +172,2 @@ com_connect (int argc, char **argv)
int status;
- int n = 0;
int tls = 0;
@@ -196,12 +194,2 @@ com_connect (int argc, char **argv)
- if (argc >= 2)
- {
- if (get_port (argv[1], &n))
- return 0;
- }
- else if (tls)
- n = MU_IMAP_DEFAULT_SSL_PORT;
- else
- n = MU_IMAP_DEFAULT_PORT;
-
state = current_imap_state ();
@@ -215,2 +203,4 @@ com_connect (int argc, char **argv)
mu_stream_t tcp;
+ struct mu_sockaddr *sa;
+ struct mu_sockaddr_hints hints;
@@ -221,3 +211,11 @@ com_connect (int argc, char **argv)
}
- status = mu_tcp_stream_create (&tcp, argv[0], n, MU_STREAM_READ);
+
+ memset (&hints, 0, sizeof (hints));
+ hints.flags = MU_AH_DETECT_FAMILY;
+ hints.port = tls ? MU_IMAP_DEFAULT_SSL_PORT : MU_IMAP_DEFAULT_PORT;
+ hints.protocol = IPPROTO_TCP;
+ hints.socktype = SOCK_STREAM;
+ status = mu_sockaddr_from_node (&sa, argv[0], argv[1], &hints);
+ if (status == 0)
+ status = mu_tcp_stream_create_from_sa (&tcp, sa, NULL, 0);
if (status == 0)
@@ -265,3 +263,2 @@ com_connect (int argc, char **argv)
connect_argv[i] = NULL;
- port = n;

Return to:

Send suggestions and report system problems to the System administrator.