Show
Ignore:
Timestamp:
2005-06-28 12:26:54 (3 years ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Add $imap_login variable to specify which user to authenticate as
($imap_user controls which user's mail gets accessed). Currently
this can't be specified interactively, since I can't think of a way
to do it that wouldn't annoy users where login == user (the default
value of $imap_login).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • account.c

    r3873 r4006  
    11/* 
    2  * Copyright (C) 2000-3 Brendan Cully <brendan@kublai.com> 
     2 * Copyright (C) 2000-5 Brendan Cully <brendan@kublai.com> 
    33 *  
    44 *     This program is free software; you can redistribute it and/or modify 
     
    2727#include "url.h" 
    2828 
    29 /* mutt_account_match: compare account info (host/port/user) */ 
     29/* mutt_account_match: compare account info (host/port/user/login) */ 
    3030int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2) 
    3131{ 
    3232  const char* user = NONULL (Username); 
     33  const char* login = NONULL (Username); 
    3334 
    3435  if (a1->type != a2->type) 
     
    4041 
    4142#ifdef USE_IMAP 
    42   if (a1->type == M_ACCT_TYPE_IMAP && ImapUser) 
    43     user = ImapUser; 
     43  if (a1->type == M_ACCT_TYPE_IMAP) 
     44  { 
     45    if (ImapUser) 
     46      user = ImapUser; 
     47    if (ImapLogin) 
     48      login = ImapLogin; 
     49  } 
    4450#endif 
    4551 
     
    127133} 
    128134 
    129 /* mutt_account_getuser: retrieve username into ACCOUNT, if neccessary */ 
     135/* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */ 
    130136int mutt_account_getuser (ACCOUNT* account) 
    131137{ 
     
    157163} 
    158164 
    159 /* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */ 
     165int mutt_account_getlogin (ACCOUNT* account) 
     166{ 
     167  /* already set */ 
     168  if (account->flags & M_ACCT_LOGIN) 
     169    return 0; 
     170#ifdef USE_IMAP 
     171  else if (account->type == M_ACCT_TYPE_IMAP) 
     172  { 
     173    if (ImapLogin) 
     174      strfcpy (account->login, ImapLogin, sizeof (account->login)); 
     175    else 
     176      strfcpy (account->login, ImapUser, sizeof (account->login)); 
     177  } 
     178#endif 
     179 
     180  account->flags |= M_ACCT_LOGIN; 
     181 
     182  return 0; 
     183} 
     184 
     185/* mutt_account_getpass: fetch password into ACCOUNT, if necessary */ 
    160186int mutt_account_getpass (ACCOUNT* account) 
    161187{ 
     
    175201  { 
    176202    snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), 
    177       account->user, account->host); 
     203      account->login, account->host); 
    178204    account->pass[0] = '\0'; 
    179205    if (mutt_get_password (prompt, account->pass, sizeof (account->pass)))