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