~ubuntu-dev/ubuntu/lucid/mutt/lucid-201002101854

« back to all changes in this revision

Viewing changes to pop_lib.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg, Antonio Radici, Christoph Berg
  • Date: 2009-06-20 15:00:50 UTC
  • mfrom: (16.1.1 sid) (16.2.1 experimental)
  • mto: (2.1.6 sid)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090620150050-ta3y92wwef0m5y4t
Tags: 1.5.20-2
[ Antonio Radici ]
* debian/patches/series:
  + upstream/533209-mutt_perror.patch: better error reporting if a mailbox
    cannot be opened (Closes: 533209)
  + upstream/533459-unmailboxes.patch: fixes a segfault with the unmailboxes 
    command (Closes: 533459)
  + upstream/533439-mbox-time.patch: do not corrupt the atime/mtime of 
    mboxes when opened (Closes: 533439)
  + upstream/531430-imapuser.patch: ask the user for the right information
    while logging in on IMAP servers (Closes: 531430)
  + upstream/534543-imap-port.patch: correctly parse the port in an IMAP
    url (Closes: 534543)
  + added the right copyright misc/smime_keys-manpage.patch
  + mutt-patched/sidebar: refreshed
  + mutt-patched/sidebar-{dotted,sorted} added (Closes: 523774)
* debian/control:
  + Debian policy bumped to 3.8.2
* debian/mutt.install and debian/extra/lib/mailto-mutt: 
  + added the firefox mailto handler (Closes: 406850)

[ Christoph Berg ]
* Remove maildir-mtime patch, upstream has a different implementation
  (though with different results; Closes: 533471)
* Use elinks-lite (with an alternative Build-Dependency on elinks) for
  rendering the manual. Thanks to Ahmed El-Mahmoudy for the suggestion.
  (Closes: 533445)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <string.h>
32
32
#include <unistd.h>
33
33
#include <ctype.h>
 
34
#include <netdb.h>
34
35
 
35
36
/* given an POP mailbox name, return host, port, username and password */
36
37
int pop_parse_path (const char* path, ACCOUNT* acct)
37
38
{
38
39
  ciss_url_t url;
39
40
  char *c;
40
 
  int ret = -1;
 
41
  struct servent *service;
41
42
 
42
43
  /* Defaults */
43
44
  acct->flags = 0;
44
 
  acct->port = POP_PORT;
45
45
  acct->type = M_ACCT_TYPE_POP;
46
46
 
47
47
  c = safe_strdup (path);
48
48
  url_parse_ciss (&url, c);
49
49
 
50
 
  if (url.scheme == U_POP || url.scheme == U_POPS)
 
50
  if ((url.scheme != U_POP && url.scheme != U_POPS) ||
 
51
      mutt_account_fromurl (acct, &url) < 0)
51
52
  {
52
 
    if (url.scheme == U_POPS)
53
 
    {
54
 
      acct->flags |= M_ACCT_SSL;
55
 
      acct->port = POP_SSL_PORT;
56
 
    }
57
 
 
58
 
    if ((!url.path || !*url.path) && mutt_account_fromurl (acct, &url) == 0)
59
 
      ret = 0;
 
53
    FREE(&c);
 
54
    mutt_error(_("Invalid POP URL: %s\n"), path);
 
55
    mutt_sleep(1);
 
56
    return -1;
60
57
  }
61
58
 
 
59
  if (url.scheme == U_POPS)
 
60
    acct->flags |= M_ACCT_SSL;
 
61
 
 
62
  service = getservbyname (url.scheme == U_POP ? "pop3" : "pop3s", "tcp");
 
63
  if (service)
 
64
    acct->port = ntohs (service->s_port);
 
65
  else
 
66
    acct->port = url.scheme == U_POP ? POP_PORT : POP_SSL_PORT;;
 
67
 
62
68
  FREE (&c);
63
 
  return ret;
 
69
  return 0;
64
70
}
65
71
 
66
72
/* Copy error message to err_msg buffer */