* Fixed an error in the template that was causing the 'c_creataide' field to load...
[citadel.git] / citadel / msgbase.h
blob56097736107ef9174d53c6a97963c95a4a4e9e36
1 /* $Id$ */
3 #ifndef MSGBASE_H
4 #define MSGBASE_H
6 #define aide_message(text, subject) quickie_message("Citadel",NULL,NULL,AIDEROOM,text,0,subject)
8 enum {
9 MSGS_ALL,
10 MSGS_OLD,
11 MSGS_NEW,
12 MSGS_FIRST,
13 MSGS_LAST,
14 MSGS_GT,
15 MSGS_EQ,
16 MSGS_SEARCH
20 * Possible return codes from CtdlOutputMsg()
22 enum {
23 om_ok,
24 om_not_logged_in,
25 om_no_such_msg,
26 om_mime_error
30 * Values of "headers_only" when calling message output routines
32 #define HEADERS_ALL 0 /* Headers and body */
33 #define HEADERS_ONLY 1 /* Headers only */
34 #define HEADERS_NONE 2 /* Body only */
35 #define HEADERS_FAST 3 /* Headers only with no MIME info */
38 struct ma_info {
39 int is_ma; /* Set to 1 if we are using this stuff */
40 int freeze; /* Freeze the replacement chain because we're
41 * digging through a subsection */
42 int did_print; /* One alternative has been displayed */
43 char chosen_part[128]; /* Which part of a m/a did we choose? */
44 int chosen_pref; /* Chosen part preference level (lower is better) */
45 int use_fo_hooks; /* Use fixed output hooks */
49 struct repl { /* Info for replication checking */
50 char exclusive_id[SIZ];
51 time_t highest;
55 /* Data structure returned by validate_recipients() */
56 struct recptypes {
57 int recptypes_magic;
58 int num_local;
59 int num_internet;
60 int num_ignet;
61 int num_room;
62 int num_error;
63 char *errormsg;
64 char *recp_local;
65 char *recp_internet;
66 char *recp_ignet;
67 char *recp_room;
68 char *display_recp;
71 #define RECPTYPES_MAGIC 0xfeeb
74 * This is a list of "harvested" email addresses that we might want to
75 * stick into someone's address book. But we defer this operaiton so
76 * it can be done asynchronously.
78 struct addresses_to_be_filed {
79 struct addresses_to_be_filed *next;
80 char *roomname;
81 char *collected_addresses;
84 extern struct addresses_to_be_filed *atbf;
86 int alias (char *name);
87 void cmd_msgs (char *cmdbuf);
88 void cmd_isme (char *cmdbuf);
89 void help_subst (char *strbuf, char *source, char *dest);
90 void do_help_subst (char *buffer);
91 void memfmout (char *mptr, char subst, char *nl);
92 void output_mime_parts(char *);
93 void cmd_msg0 (char *cmdbuf);
94 void cmd_msg2 (char *cmdbuf);
95 void cmd_msg3 (char *cmdbuf);
96 void cmd_msg4 (char *cmdbuf);
97 void cmd_msgp (char *cmdbuf);
98 void cmd_opna (char *cmdbuf);
99 void cmd_dlat (char *cmdbuf);
100 long send_message (struct CtdlMessage *);
101 void loadtroom (void);
102 long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, char *, int);
103 void quickie_message (char *, char *, char *, char *, char *, int, char *);
104 void cmd_ent0 (char *entargs);
105 void cmd_dele (char *delstr);
106 void cmd_move (char *args);
107 void GetMetaData(struct MetaData *, long);
108 void PutMetaData(struct MetaData *);
109 void AdjRefCount(long, int);
110 void TDAP_AdjRefCount(long, int);
111 int TDAP_ProcessAdjRefCountQueue(void);
112 void simple_listing(long, void *);
113 int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
114 int CtdlForEachMessage(int mode,
115 long ref,
116 char *searchstring,
117 char *content_type,
118 struct CtdlMessage *compare,
119 void (*CallBack) (long, void *),
120 void *userdata);
121 int CtdlDeleteMessages(char *, long *, int, char *);
122 void CtdlWriteObject(char *req_room, /* Room to stuff it in */
123 char *content_type, /* MIME type of this object */
124 char *raw_message, /* Data to be written */
125 off_t raw_length, /* Size of raw_message */
126 struct ctdluser *is_mailbox, /* Mailbox room? */
127 int is_binary, /* Is encoding necessary? */
128 int is_unique, /* Del others of this type? */
129 unsigned int flags /* Internal save flags */
131 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
132 void CtdlFreeMessage(struct CtdlMessage *msg);
133 void serialize_message(struct ser_ret *, struct CtdlMessage *);
134 void dump_message(struct CtdlMessage *msg, long Siz);
135 int is_valid_message(struct CtdlMessage *);
136 void ReplicationChecks(struct CtdlMessage *);
137 int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
138 int do_repl_check, struct CtdlMessage *supplied_msg);
139 int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
140 char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist, int crlf, int sock);
141 char *CtdlGetSysConfig(char *sysconfname);
142 void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
143 int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */
144 int mode, /* how would you like that message? */
145 int headers_only, /* eschew the message body? */
146 int do_proto, /* do Citadel protocol responses? */
147 int crlf, /* 0=LF, 1=CRLF */
148 char *section, /* output a message/rfc822 section */
149 int flags /* should the bessage be exported clean? */
152 #define QP_EADDR (1<<0)
153 #define CRLF (1<<1)
154 #define ESC_DOT (1<<2)
156 int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
157 int mode, /* how would you like that message? */
158 int headers_only, /* eschew the message body? */
159 int do_proto, /* do Citadel protocol responses? */
160 int crlf, /* 0=LF, 1=CRLF */
161 int flags /* should the bessage be exported clean? */
163 int CtdlCopyMsgsToRoom(long *msgnum, int num_msgs, char *dest);
164 int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void);
166 enum {
167 POST_LOGGED_IN,
168 POST_EXTERNAL,
169 CHECK_EXISTANCE,
170 POST_LMTP
172 int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
173 size_t n,
174 const char* RemoteIdentifier,
175 int PostPublic);
178 /* values for which_set */
179 enum {
180 ctdlsetseen_seen,
181 ctdlsetseen_answered
183 void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
184 int target_setting, int which_set,
185 struct ctdluser *which_user, struct ctdlroom *which_room);
186 void CtdlGetSeen(char *buf, int which_set);
188 struct recptypes *validate_recipients(char *recipients,
189 const char *RemoteIdentifier,
190 int Flags);
192 void free_recipients(struct recptypes *);
194 struct CtdlMessage *CtdlMakeMessage(
195 struct ctdluser *author, /* author's user structure */
196 char *recipient, /* NULL if it's not mail */
197 char *recp_cc, /* NULL if it's not mail */
198 char *room, /* room where it's going */
199 int type, /* see MES_ types in header file */
200 int format_type, /* variformat, plain text, MIME... */
201 char *fake_name, /* who we're masquerading as */
202 char *my_email, /* which of my email addresses to use (empty is ok) */
203 char *subject, /* Subject (optional) */
204 char *supplied_euid, /* ...or NULL if this is irrelevant */
205 char *preformatted_text, /* ...or NULL to read text from client */
206 char *references /* Thread references */
208 int CtdlCheckInternetMailPermission(struct ctdluser *who);
209 int CtdlIsMe(char *addr, int addr_buf_len);
211 #endif /* MSGBASE_H */