+int el_job_connect2(job_t *w, const ACCOUNT *act)
+{
+ int rc;
+ char *host = NULL;
+ struct addrinfo *res;
+ struct addrinfo hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_STREAM,
+ };
+
+# ifdef HAVE_LIBIDN
+ if (idna_to_ascii_lz(act->host, &host, 1) != IDNA_SUCCESS) {
+ mutt_error(_("Bad IDN \"%s\"."), act->host);
+ return -1;
+ }
+# else
+ host = act->host;
+# endif
+ mutt_message(_("Looking up %s..."), act->host);
+ rc = getaddrinfo(host, NULL, &hints, &res);
+# ifdef HAVE_LIBIDN
+ p_delete(&host);
+# endif
+
+ if (rc) {
+ mutt_error(_("Could not find the host \"%s\""), act->host);
+ mutt_sleep(2);
+ return -1;
+ }
+ mutt_message(_("Connecting to %s..."), act->host);
+ rc = el_job_connect(w, res->ai_addr, res->ai_addrlen,
+ res->ai_family, res->ai_socktype, res->ai_protocol);
+ freeaddrinfo (res);
+ if (rc) {
+ mutt_error(_("Could not connect to %s (%m)."), act->host);
+ mutt_sleep(2);
+ return -1;
+ }
+ return 0;
+}
+