NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
ac_owns_path()

Check whether an Account owns a Mailbox path. More...

+ Collaboration diagram for ac_owns_path():

Functions

static bool comp_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
static bool imap_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
bool maildir_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account own a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
bool mh_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account own a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
static bool mbox_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
static bool nntp_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
static bool nm_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 
static bool pop_ac_owns_path (struct Account *a, const char *path)
 Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. More...
 

Detailed Description

Check whether an Account owns a Mailbox path.

Parameters
aAccount
pathMailbox Path
Return values
trueAccount handles path
falseAccount does not handle path

Contract

Function Documentation

◆ comp_ac_owns_path()

static bool comp_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 419 of file compress.c.

420 {
421  return false;
422 }

◆ imap_ac_owns_path()

static bool imap_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 1744 of file imap.c.

1745 {
1746  struct Url *url = url_parse(path);
1747  if (!url)
1748  return false;
1749 
1750  struct ImapAccountData *adata = a->adata;
1751  struct ConnAccount *cac = &adata->conn->account;
1752 
1753  const bool ret = mutt_istr_equal(url->host, cac->host) &&
1754  (!url->user || mutt_istr_equal(url->user, cac->user));
1755  url_free(&url);
1756  return ret;
1757 }
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:40
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:68
char user[128]
Username.
Definition: connaccount.h:55
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
char host[128]
Server to login to.
Definition: connaccount.h:53
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:916
char * user
Username.
Definition: url.h:71
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
char * host
Host.
Definition: url.h:73
Login details for a remote server.
Definition: connaccount.h:51
char * path
Path.
Definition: url.h:75
IMAP-specific Account data -.
Definition: adata.h:39
struct Connection * conn
Definition: adata.h:41
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
+ Here is the call graph for this function:

◆ maildir_ac_owns_path()

bool maildir_ac_owns_path ( struct Account a,
const char *  path 
)

Check whether an Account own a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 1076 of file maildir.c.

1077 {
1078  return true;
1079 }

◆ mh_ac_owns_path()

bool mh_ac_owns_path ( struct Account a,
const char *  path 
)

Check whether an Account own a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 826 of file mh.c.

827 {
828  return true;
829 }

◆ mbox_ac_owns_path()

static bool mbox_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 872 of file mbox.c.

873 {
874  if ((a->type != MUTT_MBOX) && (a->type != MUTT_MMDF))
875  return false;
876 
877  struct MailboxNode *np = STAILQ_FIRST(&a->mailboxes);
878  if (!np)
879  return false;
880 
881  return mutt_str_equal(mailbox_path(np->mailbox), path);
882 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:904
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:215
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
'mmdf' Mailbox type
Definition: mailbox.h:49
'mbox' Mailbox type
Definition: mailbox.h:48
List of Mailboxes.
Definition: mailbox.h:156
#define STAILQ_FIRST(head)
Definition: queue.h:350
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:158
+ Here is the call graph for this function:

◆ nntp_ac_owns_path()

static bool nntp_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 2291 of file nntp.c.

2292 {
2293  return true;
2294 }

◆ nm_ac_owns_path()

static bool nm_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 2021 of file notmuch.c.

2022 {
2023  return true;
2024 }

◆ pop_ac_owns_path()

static bool pop_ac_owns_path ( struct Account a,
const char *  path 
)
static

Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.

Definition at line 699 of file pop.c.

700 {
701  struct Url *url = url_parse(path);
702  if (!url)
703  return false;
704 
705  struct PopAccountData *adata = a->adata;
706  struct ConnAccount *cac = &adata->conn->account;
707 
708  const bool ret = mutt_istr_equal(url->host, cac->host) &&
709  mutt_istr_equal(url->user, cac->user);
710  url_free(&url);
711  return ret;
712 }
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:40
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:68
char user[128]
Username.
Definition: connaccount.h:55
struct Connection * conn
Definition: adata.h:38
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
char host[128]
Server to login to.
Definition: connaccount.h:53
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:916
char * user
Username.
Definition: url.h:71
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
char * host
Host.
Definition: url.h:73
Login details for a remote server.
Definition: connaccount.h:51
char * path
Path.
Definition: url.h:75
POP-specific Account data -.
Definition: adata.h:36
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
+ Here is the call graph for this function: