IMAP network mailbox. More...
#include "config.h"#include <stdbool.h>#include <stddef.h>#include <sys/types.h>#include "core/lib.h"#include "external.h"
Include dependency graph for lib.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| void | imap_init (void) |
| Setup feature commands. | |
| int | imap_access (const char *path) |
| Check permissions on an IMAP mailbox with a new connection. | |
| enum MxStatus | imap_check_mailbox (struct Mailbox *m, bool force) |
| Use the NOOP or IDLE command to poll for new mail. | |
| int | imap_delete_mailbox (struct Mailbox *m, char *path) |
| Delete a mailbox. | |
| enum MxStatus | imap_sync_mailbox (struct Mailbox *m, bool expunge, bool close) |
| Sync all the changes to the server. | |
| int | imap_path_status (const char *path, bool queue) |
| Refresh the number of total and new messages. | |
| int | imap_mailbox_status (struct Mailbox *m, bool queue) |
| Refresh the number of total and new messages. | |
| int | imap_subscribe (const char *path, bool subscribe) |
| Subscribe to a mailbox. | |
| int | imap_complete (struct Buffer *buf, const char *path) |
| Try to complete an IMAP folder path. | |
| int | imap_fast_trash (struct Mailbox *m, const char *dest) |
| Use server COPY command to copy deleted messages to trash. | |
| enum MailboxType | imap_path_probe (const char *path, const struct stat *st) |
| Is this an IMAP Mailbox? | |
| int | imap_path_canon (struct Buffer *buf) |
| Canonicalise a Mailbox path - Implements MxOps::path_canon() -. | |
| void | imap_notify_delete_email (struct Mailbox *m, struct Email *e) |
| Inform IMAP that an Email has been deleted. | |
| int | imap_browse (const char *path, struct BrowserState *state) |
| IMAP hook into the folder browser. | |
| int | imap_mailbox_create (const char *folder) |
| Create a new IMAP mailbox. | |
| int | imap_mailbox_rename (const char *path) |
| Rename a mailbox. | |
| int | imap_copy_messages (struct Mailbox *m, struct EmailArray *ea, const char *dest, enum MessageSaveOpt save_opt) |
| Server COPY messages to another folder. | |
| void | imap_logout_all (void) |
| Close all open connections. | |
| int | imap_parse_path (const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen) |
| Parse an IMAP mailbox name into ConnAccount, name. | |
| void | imap_pretty_mailbox (char *path, size_t pathlen, const char *folder) |
| Prettify an IMAP mailbox name. | |
| int | imap_mxcmp (const char *mx1, const char *mx2) |
| Compare mailbox names, giving priority to INBOX. | |
| int | imap_wait_keep_alive (pid_t pid) |
| Wait for a process to change state. | |
| void | imap_keep_alive (void) |
| Poll the current folder to keep the connection alive. | |
| void | imap_get_parent_path (const char *path, char *buf, size_t buflen) |
| Get the path of the parent folder. | |
| void | imap_clean_path (char *path, size_t plen) |
| Cleans an IMAP path using imap_fix_path. | |
| bool | imap_search (struct Mailbox *m, const struct PatternList *pat) |
| Find messages in mailbox matching a pattern. | |
Variables | |
| const struct MxOps | MxImapOps |
| IMAP Mailbox - Implements MxOps -. | |
IMAP network mailbox.
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 http://www.gnu.org/licenses/.
Definition in file lib.h.
| void imap_init | ( | void | ) |
Setup feature commands.
Definition at line 95 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_access | ( | const char * | path | ) |
Check permissions on an IMAP mailbox with a new connection.
| path | Mailbox path |
| 0 | Success |
| <0 | Failure |
TODO: ACL checks. Right now we assume if it exists we can mess with it. TODO: This method should take a Mailbox as parameter to be able to reuse the existing connection.
Definition at line 462 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:Use the NOOP or IDLE command to poll for new mail.
| m | Mailbox |
| force | Don't wait |
| num | MxStatus |
Definition at line 1034 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_delete_mailbox | ( | struct Mailbox * | m, |
| char * | path ) |
Delete a mailbox.
| m | Mailbox |
| path | name of the mailbox to delete |
| 0 | Success |
| -1 | Failure |
Definition at line 504 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:Sync all the changes to the server.
| m | Mailbox |
| expunge | if true do expunge |
| close | if true we move imap state to CLOSE |
| enum | MxStatus |
Definition at line 1473 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_path_status | ( | const char * | path, |
| bool | queue ) |
Refresh the number of total and new messages.
| path | Mailbox path |
| queue | Queue the STATUS command |
| num | Total number of messages |
Definition at line 1174 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_mailbox_status | ( | struct Mailbox * | m, |
| bool | queue ) |
Refresh the number of total and new messages.
| m | Mailbox |
| queue | Queue the STATUS command |
| num | Total number of messages |
| -1 | Error |
Definition at line 1209 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_subscribe | ( | const char * | path, |
| bool | subscribe ) |
Subscribe to a mailbox.
| path | Mailbox path |
| subscribe | True: subscribe, false: unsubscribe |
| 0 | Success |
| -1 | Failure |
Definition at line 1225 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_complete | ( | struct Buffer * | buf, |
| const char * | path ) |
Try to complete an IMAP folder path.
| buf | Buffer for result |
| path | Partial mailbox name to complete |
| 0 | Success |
| -1 | Failure |
Given a partial IMAP folder path, return a string which adds as much to the path as is unique
Definition at line 1277 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_fast_trash | ( | struct Mailbox * | m, |
| const char * | dest ) |
Use server COPY command to copy deleted messages to trash.
| -1 | Error |
| 0 | Success |
| 1 | Non-fatal error - try fetch/append |
Definition at line 1358 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:Inform IMAP that an Email has been deleted.
Definition at line 650 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_browse | ( | const char * | path, |
| struct BrowserState * | state ) |
IMAP hook into the folder browser.
| path | Current folder |
| state | BrowserState to populate |
| 0 | Success |
| -1 | Failure |
Fill out browser_state, given a current folder to browse
Definition at line 197 of file browse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_mailbox_create | ( | const char * | path | ) |
Create a new IMAP mailbox.
| path | Mailbox to create |
| 0 | Success |
| -1 | Failure |
Prompt for a new mailbox name, and try to create it
Definition at line 394 of file browse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_mailbox_rename | ( | const char * | path | ) |
Rename a mailbox.
| path | Mailbox to rename |
| 0 | Success |
| -1 | Failure |
The user will be prompted for a new name.
Definition at line 449 of file browse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_copy_messages | ( | struct Mailbox * | m, |
| struct EmailArray * | ea, | ||
| const char * | dest, | ||
| enum MessageSaveOpt | save_opt ) |
Server COPY messages to another folder.
| m | Mailbox |
| ea | Array of Emails to copy |
| dest | Destination folder |
| save_opt | Copy or move, e.g. SAVE_MOVE |
| -1 | Error |
| 0 | Success |
| 1 | Non-fatal error - try fetch/append |
Definition at line 1686 of file message.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void imap_logout_all | ( | void | ) |
Close all open connections.
Quick and dirty until we can make sure we've got all the context we need.
Definition at line 556 of file imap.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_parse_path | ( | const char * | path, |
| struct ConnAccount * | cac, | ||
| char * | mailbox, | ||
| size_t | mailboxlen ) |
Parse an IMAP mailbox name into ConnAccount, name.
| path | Mailbox path to parse |
| cac | Account credentials |
| mailbox | Buffer for mailbox name |
| mailboxlen | Length of buffer |
| 0 | Success |
| -1 | Failure |
Given an IMAP mailbox name, return host, port and a path IMAP servers will recognize.
Definition at line 476 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void imap_pretty_mailbox | ( | char * | path, |
| size_t | pathlen, | ||
| const char * | folder ) |
Prettify an IMAP mailbox name.
| path | Mailbox name to be tidied |
| pathlen | Length of path |
| folder | Path to use for '+' abbreviations |
Called by mutt_pretty_mailbox() to make IMAP paths look nice.
Definition at line 583 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_mxcmp | ( | const char * | mx1, |
| const char * | mx2 ) |
Compare mailbox names, giving priority to INBOX.
| mx1 | First mailbox name |
| mx2 | Second mailbox name |
| <0 | First mailbox precedes Second mailbox |
| 0 | Mailboxes are the same |
| >0 | Second mailbox precedes First mailbox |
Like a normal sort function except that "INBOX" will be sorted to the beginning of the list.
Definition at line 547 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int imap_wait_keep_alive | ( | pid_t | pid | ) |
Wait for a process to change state.
| pid | Process ID to listen to |
| num | 'wstatus' from waitpid() |
Definition at line 1017 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void imap_keep_alive | ( | void | ) |
Poll the current folder to keep the connection alive.
Definition at line 993 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void imap_get_parent_path | ( | const char * | path, |
| char * | buf, | ||
| size_t | buflen ) |
Get the path of the parent folder.
| path | Mailbox whose parent is to be determined |
| buf | Buffer for the result |
| buflen | Length of the buffer |
Provided an imap path, returns in buf the parent directory if existent. Else returns the same path.
Definition at line 163 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void imap_clean_path | ( | char * | path, |
| size_t | plen ) |
Cleans an IMAP path using imap_fix_path.
| path | Path to be cleaned |
| plen | Length of the buffer |
Does it in place.
Definition at line 190 of file util.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool imap_search | ( | struct Mailbox * | m, |
| const struct PatternList * | pat ) |
Find messages in mailbox matching a pattern.
| true | Success |
| false | Failure |
Definition at line 227 of file search.c.
Here is the call graph for this function:
Here is the caller graph for this function: