NeoMutt  2024-04-25-89-g194907
Teaching an old dog new tricks
No Matches
mdata.c File Reference

Imap-specific Mailbox data. More...

#include "config.h"
#include <stdbool.h>
#include "private.h"
#include "core/lib.h"
#include "mdata.h"
#include "hcache/lib.h"
#include "adata.h"
+ Include dependency graph for mdata.c:

Go to the source code of this file.


void imap_mdata_free (void **ptr)
 Free the private Mailbox data - Implements Mailbox::mdata_free() -.
struct ImapMboxDataimap_mdata_get (struct Mailbox *m)
 Get the Mailbox data for this mailbox.
struct ImapMboxDataimap_mdata_new (struct ImapAccountData *adata, const char *name)
 Allocate and initialise a new ImapMboxData structure.

Detailed Description

Imap-specific Mailbox data.

  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Definition in file mdata.c.

Function Documentation

◆ imap_mdata_get()

struct ImapMboxData * imap_mdata_get ( struct Mailbox m)

Get the Mailbox data for this mailbox.

Return values

Definition at line 61 of file mdata.c.

63 if (!m || (m->type != MUTT_IMAP) || !m->mdata)
64 return NULL;
65 return m->mdata;
'IMAP' Mailbox type
Definition: mailbox.h:50
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
void * mdata
Driver specific data.
Definition: mailbox.h:132
+ Here is the caller graph for this function:

◆ imap_mdata_new()

struct ImapMboxData * imap_mdata_new ( struct ImapAccountData adata,
const char *  name 

Allocate and initialise a new ImapMboxData structure.

adataImap Account data
nameName for Mailbox
Return values
ptrNew ImapMboxData

Definition at line 74 of file mdata.c.

76 char buf[1024] = { 0 };
77 struct ImapMboxData *mdata = mutt_mem_calloc(1, sizeof(struct ImapMboxData));
79 mdata->real_name = mutt_str_dup(name);
81 imap_fix_path(adata->delim, name, buf, sizeof(buf));
82 if (buf[0] == '\0')
83 mutt_str_copy(buf, "INBOX", sizeof(buf));
84 mdata->name = mutt_str_dup(buf);
86 imap_munge_mbox_name(adata->unicode, buf, sizeof(buf), mdata->name);
87 mdata->munge_name = mutt_str_dup(buf);
89 mdata->reopen &= IMAP_REOPEN_ALLOW;
91 STAILQ_INIT(&mdata->flags);
93#ifdef USE_HCACHE
94 imap_hcache_open(adata, mdata, false);
95 if (mdata->hcache)
96 {
97 if (hcache_fetch_raw_obj(mdata->hcache, "UIDVALIDITY", 11, &mdata->uidvalidity))
98 {
99 hcache_fetch_raw_obj(mdata->hcache, "UIDNEXT", 7, &mdata->uid_next);
100 hcache_fetch_raw_obj(mdata->hcache, "MODSEQ", 6, &mdata->modseq);
101 mutt_debug(LL_DEBUG3, "hcache uidvalidity %u, uidnext %u, modseq %llu\n",
102 mdata->uidvalidity, mdata->uid_next, mdata->modseq);
103 }
105 }
108 return mdata;
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
#define hcache_fetch_raw_obj(hc, key, keylen, dst)
Definition: lib.h:162
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool create)
Open a header cache.
Definition: util.c:300
Allow re-opening a folder upon expunge.
Definition: private.h:64
char * imap_fix_path(char delim, const char *mailbox, char *path, size_t plen)
Fix up the imap path.
Definition: util.c:680
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
Definition: util.c:341
void imap_munge_mbox_name(bool unicode, char *dest, size_t dlen, const char *src)
Quote awkward characters in a mailbox name.
Definition: util.c:922
Log at debug level 3.
Definition: logging2.h:45
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:581
#define STAILQ_INIT(head)
Definition: queue.h:372
char delim
Path delimiter.
Definition: adata.h:75
bool unicode
If true, we can send UTF-8, and the server will use UTF8 rather than mUTF7.
Definition: adata.h:62
IMAP-specific Mailbox data -.
Definition: mdata.h:40
char * name
Mailbox name.
Definition: mdata.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function: