NeoMutt  2020-11-20
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1 
51 #ifndef MUTT_IMAP_LIB_H
52 #define MUTT_IMAP_LIB_H
53 
54 #include "config.h"
55 #include <stddef.h>
56 #include <stdbool.h>
57 #include <sys/types.h>
58 #include "core/lib.h"
59 #include "mx.h"
60 
61 struct BrowserState;
62 struct Buffer;
63 struct ConfigSet;
64 struct ConnAccount;
65 struct EmailList;
66 struct PatternList;
67 struct stat;
68 
69 // These Config Variables are used outside of libimap
70 extern short C_ImapKeepalive;
71 extern bool C_ImapListSubscribed;
72 extern bool C_ImapPassive;
73 extern bool C_ImapPeek;
74 
75 /* imap.c */
76 void imap_init(void);
77 int imap_access(const char *path);
78 int imap_check_mailbox(struct Mailbox *m, bool force);
79 int imap_delete_mailbox(struct Mailbox *m, char *path);
80 int imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close);
81 int imap_path_status(const char *path, bool queue);
82 int imap_mailbox_status(struct Mailbox *m, bool queue);
83 int imap_subscribe(char *path, bool subscribe);
84 int imap_complete(char *buf, size_t buflen, const char *path);
85 int imap_fast_trash(struct Mailbox *m, char *dest);
86 enum MailboxType imap_path_probe(const char *path, const struct stat *st);
87 int imap_path_canon(char *buf, size_t buflen);
88 void imap_notify_delete_email(struct Mailbox *m, struct Email *e);
89 
90 extern struct MxOps MxImapOps;
91 
92 /* browse.c */
93 int imap_browse(const char *path, struct BrowserState *state);
94 int imap_mailbox_create(const char *folder);
95 int imap_mailbox_rename(const char *path);
96 
97 /* config.c */
98 bool config_init_imap(struct ConfigSet *cs);
99 
100 /* message.c */
101 int imap_copy_messages(struct Mailbox *m, struct EmailList *el, const char *dest, bool delete_original);
102 
103 /* socket.c */
104 void imap_logout_all(void);
105 
106 /* util.c */
107 int imap_expand_path(struct Buffer *buf);
108 int imap_parse_path(const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen);
109 void imap_pretty_mailbox(char *path, size_t pathlen, const char *folder);
110 int imap_mxcmp(const char *mx1, const char *mx2);
111 
112 int imap_wait_keepalive(pid_t pid);
113 void imap_keepalive(void);
114 
115 void imap_get_parent_path(const char *path, char *buf, size_t buflen);
116 void imap_clean_path(char *path, size_t plen);
117 
118 /* search.c */
119 bool imap_search(struct Mailbox *m, const struct PatternList *pat);
120 
121 #endif /* MUTT_IMAP_LIB_H */
bool imap_search(struct Mailbox *m, const struct PatternList *pat)
Find messages in mailbox matching a pattern.
Definition: search.c:228
bool config_init_imap(struct ConfigSet *cs)
Register imap config variables - Implements module_init_config_t.
Definition: config.c:165
Container for lots of config items.
Definition: set.h:228
bool C_ImapPeek
Config: (imap) Don&#39;t mark messages as read when fetching them from the server.
Definition: config.c:55
The envelope/body of an email.
Definition: email.h:37
void imap_init(void)
Setup feature commands.
Definition: imap.c:79
int imap_parse_path(const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen)
Parse an IMAP mailbox name into ConnAccount, name.
Definition: util.c:618
void imap_keepalive(void)
poll the current folder to keep the connection alive
Definition: util.c:1079
static size_t plen
Length of cached packet.
Definition: pgppacket.c:39
State of the file/mailbox browser.
Definition: browser.h:95
bool C_ImapListSubscribed
Config: (imap) When browsing a mailbox, only display subscribed folders.
Definition: config.c:50
String manipulation buffer.
Definition: buffer.h:33
void imap_pretty_mailbox(char *path, size_t pathlen, const char *folder)
Prettify an IMAP mailbox name.
Definition: util.c:725
int imap_subscribe(char *path, bool subscribe)
Subscribe to a mailbox.
Definition: imap.c:1261
int imap_fast_trash(struct Mailbox *m, char *dest)
Use server COPY command to copy deleted messages to trash.
Definition: imap.c:1394
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
Definition: imap.c:2367
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
Definition: browse.c:179
int imap_expand_path(struct Buffer *buf)
Buffer wrapper around imap_path_canon()
Definition: imap.c:2407
void imap_notify_delete_email(struct Mailbox *m, struct Email *e)
Inform IMAP that an Email has been deleted.
Definition: imap.c:645
API for mailboxes.
void imap_get_parent_path(const char *path, char *buf, size_t buflen)
Get the path of the parent folder.
Definition: util.c:299
Convenience wrapper for the core headers.
int imap_check_mailbox(struct Mailbox *m, bool force)
use the NOOP or IDLE command to poll for new mail
Definition: imap.c:1091
int imap_mailbox_create(const char *folder)
Create a new IMAP mailbox.
Definition: browse.c:380
int imap_mxcmp(const char *mx1, const char *mx2)
Compare mailbox names, giving priority to INBOX.
Definition: util.c:689
void imap_logout_all(void)
close all open connections
Definition: imap.c:554
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
Definition: imap.c:1211
int imap_mailbox_status(struct Mailbox *m, bool queue)
Refresh the number of total and new messages.
Definition: imap.c:1245
short C_ImapKeepalive
Config: (imap) Time to wait before polling an open IMAP connection.
Definition: config.c:49
int imap_access(const char *path)
Check permissions on an IMAP mailbox with a new connection.
Definition: imap.c:467
int imap_mailbox_rename(const char *path)
Rename a mailbox.
Definition: browse.c:432
int imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close)
Sync all the changes to the server.
Definition: imap.c:1506
bool C_ImapPassive
Config: (imap) Reuse an existing IMAP connection to check for new mail.
Definition: config.c:54
int imap_copy_messages(struct Mailbox *m, struct EmailList *el, const char *dest, bool delete_original)
Server COPY messages to another folder.
Definition: message.c:1560
A mailbox.
Definition: mailbox.h:81
int imap_path_canon(char *buf, size_t buflen)
Canonicalise a Mailbox path - Implements MxOps::path_canon()
Definition: imap.c:2381
int imap_wait_keepalive(pid_t pid)
Wait for a process to change state.
Definition: util.c:1102
Login details for a remote server.
Definition: connaccount.h:51
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
void imap_clean_path(char *path, size_t plen)
Cleans an IMAP path using imap_fix_path.
Definition: util.c:326
struct MxOps MxImapOps
IMAP Mailbox - Implements MxOps.
Definition: imap.c:2454
int imap_complete(char *buf, size_t buflen, const char *path)
Try to complete an IMAP folder path.
Definition: imap.c:1316
The Mailbox API.
Definition: mx.h:104
int imap_delete_mailbox(struct Mailbox *m, char *path)
Delete a mailbox.
Definition: imap.c:509