Add support for tab-completion when selecting by rule
[alpine.git] / pith / folder.h
blob0c71e8ca0d6c4c865e639fc3b043bf196351d136
1 /*
2 * $Id: folder.h 880 2007-12-18 00:57:56Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2022 Eduardo Chappa
6 * Copyright 2006-2007 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_FOLDER_INCLUDED
18 #define PITH_FOLDER_INCLUDED
21 #include "../pith/foldertype.h"
22 #include "../pith/conftype.h"
23 #include "../pith/context.h"
24 #include "../pith/state.h"
28 * Structs to ease c-client LIST/LSUB interaction
30 typedef struct _listargs {
31 char *reference, /* IMAP LIST "reference" arg */
32 *name, /* IMAP LIST "name" arg */
33 *tail; /* Pine "context" after "name" part */
34 } LISTARGS_S;
36 typedef struct _listresponse {
37 long count;
38 int delim;
39 unsigned isfile:1,
40 isdir:1,
41 ismarked:1,
42 unmarked:1,
43 haschildren:1,
44 hasnochildren:1;
45 } LISTRES_S;
48 typedef struct _existdata {
49 LISTARGS_S args;
50 LISTRES_S response;
51 char **fullname;
52 int is_move_folder;
53 } EXISTDATA_S;
56 #define FEX_NOENT 0x0000 /* file_exists: doesn't exist */
57 #define FEX_ISFILE 0x0001 /* file_exists: name is a file */
58 #define FEX_ISDIR 0x0002 /* file_exists: name is a dir */
59 #define FEX_ISMARKED 0x0004 /* file_exists: is interesting */
60 #define FEX_UNMARKED 0x0008 /* file_exists: known UNinteresting */
61 #define FEX_ERROR 0x1000 /* file_exists: error occurred */
63 #define BFL_NONE 0x00 /* build_folder_list: no flag */
64 #define BFL_FLDRONLY 0x01 /* ignore directories */
65 #define BFL_LSUB 0x02 /* use mail_lsub vs mail_list */
66 #define BFL_SCAN 0x04 /* use mail_scan vs mail_list */
67 #define BFL_CHILDREN 0x08 /* make sure haschildren is accurate */
69 #define FI_FOLDER 0x01 /* folder_index flags */
70 #define FI_DIR 0x02
71 #define FI_RENAME 0x04
72 #define FI_ANY (FI_FOLDER | FI_DIR)
74 #define FN_NONE 0x00 /* flags modifying folder_is_nick */
75 #define FN_WHOLE_NAME 0x01 /* return long name if #move */
77 #define FC_NONE 0 /* flags for folder_complete */
78 #define FC_FORCE_LIST 1
80 #define UFU_NONE 0x00 /* flags for update_folder_unseen */
81 #define UFU_FORCE 0x01
82 #define UFU_ANNOUNCE 0x02 /* announce increases with q_status */
85 /* exported prototypes */
86 char *folder_lister_desc(CONTEXT_S *, FDIR_S *);
87 void reset_context_folders(CONTEXT_S *);
88 FDIR_S *next_folder_dir(CONTEXT_S *, char *, int, MAILSTREAM **);
89 EditWhich config_containing_inc_fldr(FOLDER_S *);
90 char *pretty_fn(char *);
91 int get_folder_delimiter(char *);
92 int folder_exists(CONTEXT_S *, char *);
93 int folder_name_exists(CONTEXT_S *, char *, char **);
94 char *folder_as_breakout(CONTEXT_S *, char *);
95 void init_folders(struct pine *);
96 void init_inbox_mapping(char *, CONTEXT_S *);
97 void reinit_incoming_folder_list(struct pine *, CONTEXT_S *);
98 FDIR_S *new_fdir(char *, char *, int);
99 void free_fdir(FDIR_S **, int);
100 void build_folder_list(MAILSTREAM **, CONTEXT_S *, char *, char *, int);
101 void free_folder_list(CONTEXT_S *);
102 CONTEXT_S *default_save_context(CONTEXT_S *);
103 int folder_complete(CONTEXT_S *, char *, size_t, int *);
104 FOLDER_S *new_folder(char *, unsigned long);
105 FOLDER_S *folder_entry(int, FLIST *);
106 int folder_total(FLIST *);
107 int folder_index(char *, CONTEXT_S *, int);
108 char *folder_is_nick(char *, FLIST *, int);
109 char *folder_is_target_of_nick(char *, CONTEXT_S *);
110 int folder_insert(int, FOLDER_S *, FLIST *);
111 FLIST *init_folder_entries(void);
112 int compare_folders_alpha(FOLDER_S *, FOLDER_S *);
113 int compare_folders_dir_alpha(FOLDER_S *, FOLDER_S *);
114 int compare_folders_alpha_dir(FOLDER_S *, FOLDER_S *);
115 void mail_list_response(MAILSTREAM *, char *, int, long, void *, unsigned);
116 void folder_seen_count_updater(void *);
117 void folder_unseen_count_updater(unsigned long);
118 void update_folder_unseen(FOLDER_S *, CONTEXT_S *, unsigned long, MAILSTREAM *);
119 void update_folder_unseen_by_stream(MAILSTREAM *, unsigned long);
120 int get_recent_in_folder(char *, unsigned long *, unsigned long *,
121 unsigned long *, MAILSTREAM *);
122 void clear_incoming_valid_bits(void);
123 int selected_folders(CONTEXT_S *);
124 SELECTED_S *new_selected(void);
125 void free_selected(SELECTED_S **);
126 void folder_select_preserve(CONTEXT_S *);
127 int folder_select_restore(CONTEXT_S *);
128 int update_bboard_spec(char *, char *, size_t);
129 void refresh_folder_list(CONTEXT_S *, int, int, MAILSTREAM **);
130 int folder_complete_internal(CONTEXT_S *, char *, size_t, int *, int);
131 void folder_delete(int, FLIST *);
132 unsigned char *folder_name_decoded(unsigned char *);
133 unsigned char *folder_name_encoded(unsigned char *);
135 #endif /* PITH_FOLDER_INCLUDED */