Commit b93b2d2b authored by Rocco Rutte's avatar Rocco Rutte

POP: Default to using getservbyname() as we do for IMAP and SMTP

parent 2f4624a9
2009-04-16 19:14 +0200 Rocco Rutte <pdmef@gmx.net> (ca73c9e8c141)
* doc/manual.xml.head: Manual: Improve docs on URL syntax, add
examples
2009-04-16 16:17 +0200 Rocco Rutte <pdmef@gmx.net> (052b17f5f7f7)
* doc/manual.xml.head: Manual: Add user-defined variables to variable
types
2009-04-11 10:35 +0200 Rocco Rutte <pdmef@gmx.net> (7d7976cd4fc4)
* ChangeLog, buffy.c, buffy.h, commands.c, sendlib.c: Don't raise new
mail flag on mbox/mmdf Fcc mailboxes. Closes #1896.
2009-04-08 16:25 +0200 Rocco Rutte <pdmef@gmx.net> (5b631ee33281)
* hdrline.c: For %F, display Bcc recipient if no other recipients
......
......@@ -31,36 +31,42 @@
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <netdb.h>
/* given an POP mailbox name, return host, port, username and password */
int pop_parse_path (const char* path, ACCOUNT* acct)
{
ciss_url_t url;
char *c;
int ret = -1;
struct servent *service;
/* Defaults */
acct->flags = 0;
acct->port = POP_PORT;
acct->type = M_ACCT_TYPE_POP;
c = safe_strdup (path);
url_parse_ciss (&url, c);
if (url.scheme == U_POP || url.scheme == U_POPS)
if ((url.scheme != U_POP && url.scheme != U_POPS) ||
mutt_account_fromurl (acct, &url) < 0)
{
if (url.scheme == U_POPS)
{
acct->flags |= M_ACCT_SSL;
acct->port = POP_SSL_PORT;
}
if ((!url.path || !*url.path) && mutt_account_fromurl (acct, &url) == 0)
ret = 0;
FREE(&c);
mutt_error(_("Invalid POP URL: %s\n"), path);
mutt_sleep(1);
return -1;
}
if (url.scheme == U_POPS)
acct->flags |= M_ACCT_SSL;
service = getservbyname (url.scheme == U_POP ? "pop3" : "pop3s", "tcp");
if (service)
acct->port = ntohs (service->s_port);
else
acct->port = url.scheme == U_POP ? POP_PORT : POP_SSL_PORT;;
FREE (&c);
return ret;
return 0;
}
/* Copy error message to err_msg buffer */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment