From b5ca4e7eff88071fdc3ff30272f2d43239a2f7fd Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Sun, 7 Aug 2005 21:56:25 +0000 Subject: [PATCH] Extend IMAP host completion to complete over open connections. Next up: account and folder hooks. --- imap/imap.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/imap/imap.c b/imap/imap.c index 30ba8b68..731258c8 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1426,6 +1426,7 @@ static int imap_complete_hosts (char *dest, size_t len) { BUFFY* mailbox; + CONNECTION* conn; int rc = -1; int matchlen; @@ -1444,6 +1445,31 @@ imap_complete_hosts (char *dest, size_t len) } } + for (conn = mutt_socket_head (); conn->next; conn = conn->next) + { + ciss_url_t url; + char urlstr[LONG_STRING]; + + if (conn->account.type != M_ACCT_TYPE_IMAP) + continue; + + mutt_account_tourl (&conn->account, &url); + /* FIXME: how to handle multiple users on the same host? */ + url.user = NULL; + url.path = NULL; + url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); + if (!mutt_strncmp (dest, urlstr, matchlen)) + { + if (rc) + { + strfcpy (dest, urlstr, len); + rc = 0; + } + else + longest_common_prefix (dest, urlstr, matchlen, len); + } + } + return rc; } -- 2.40.0