5 #include "event_client.h"
25 * Possible return codes from CtdlOutputMsg()
36 * Values of "headers_only" when calling message output routines
38 #define HEADERS_ALL 0 /* Headers and body */
39 #define HEADERS_ONLY 1 /* Headers only */
40 #define HEADERS_NONE 2 /* Body only */
41 #define HEADERS_FAST 3 /* Headers only with no MIME info */
45 int is_ma; /* Set to 1 if we are using this stuff */
46 int freeze; /* Freeze the replacement chain because we're
47 * digging through a subsection */
48 int did_print; /* One alternative has been displayed */
49 char chosen_part[128]; /* Which part of a m/a did we choose? */
50 int chosen_pref; /* Chosen part preference level (lower is better) */
51 int use_fo_hooks; /* Use fixed output hooks */
52 int dont_decode; /* should we call the decoder or not? */
56 struct repl { /* Info for replication checking */
57 char exclusive_id[SIZ];
62 /* Data structure returned by validate_recipients() */
82 #define RECPTYPES_MAGIC 0xfeeb
85 * This is a list of "harvested" email addresses that we might want to
86 * stick into someone's address book. But we defer this operaiton so
87 * it can be done asynchronously.
89 struct addresses_to_be_filed {
90 struct addresses_to_be_filed *next;
92 char *collected_addresses;
95 extern struct addresses_to_be_filed *atbf;
97 int alias (char *name);
98 void cmd_msgs (char *cmdbuf);
99 void cmd_isme (char *cmdbuf);
100 void help_subst (char *strbuf, char *source, char *dest);
101 void do_help_subst (char *buffer);
102 void memfmout (char *mptr, const char *nl);
103 void output_mime_parts(char *);
104 void cmd_msg0 (char *cmdbuf);
105 void cmd_msg2 (char *cmdbuf);
106 void cmd_msg3 (char *cmdbuf);
107 void cmd_msg4 (char *cmdbuf);
108 void cmd_msgp (char *cmdbuf);
109 void cmd_opna (char *cmdbuf);
110 void cmd_dlat (char *cmdbuf);
111 long send_message (struct CtdlMessage *);
112 void loadtroom (void);
113 long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *, int);
114 void quickie_message (const char *, const char *, char *, char *, const char *, int, const char *);
115 void cmd_ent0 (char *entargs);
116 void cmd_dele (char *delstr);
117 void cmd_move (char *args);
118 void GetMetaData(struct MetaData *, long);
119 void PutMetaData(struct MetaData *);
120 void AdjRefCount(long, int);
121 void TDAP_AdjRefCount(long, int);
122 int TDAP_ProcessAdjRefCountQueue(void);
123 void simple_listing(long, void *);
124 int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
125 typedef void (*ForEachMsgCallback)(long MsgNumber, void *UserData);
126 int CtdlForEachMessage(int mode,
130 struct CtdlMessage *compare,
131 ForEachMsgCallback CallBack,
133 int CtdlDeleteMessages(char *, long *, int, char *);
134 void CtdlWriteObject(char *req_room, /* Room to stuff it in */
135 char *content_type, /* MIME type of this object */
136 char *raw_message, /* Data to be written */
137 off_t raw_length, /* Size of raw_message */
138 struct ctdluser *is_mailbox, /* Mailbox room? */
139 int is_binary, /* Is encoding necessary? */
140 int is_unique, /* Del others of this type? */
141 unsigned int flags /* Internal save flags */
143 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
144 void CtdlFreeMessage(struct CtdlMessage *msg);
145 void CtdlFreeMessageContents(struct CtdlMessage *msg);
146 void serialize_message(struct ser_ret *, struct CtdlMessage *);
147 int is_valid_message(struct CtdlMessage *);
148 void ReplicationChecks(struct CtdlMessage *);
149 int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
150 int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj);
151 int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
152 char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, char *exist, int crlf, int *sock);
153 StrBuf *CtdlReadMessageBodyBuf(char *terminator, /* token signalling EOT */
155 size_t maxlen, /* maximum message length */
156 char *exist, /* if non-null, append to it;
157 exist is ALWAYS freed */
158 int crlf, /* CRLF newlines instead of LF */
159 int *sock /* socket handle or 0 for this session's client socket */
162 int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */
163 int mode, /* how would you like that message? */
164 int headers_only, /* eschew the message body? */
165 int do_proto, /* do Citadel protocol responses? */
166 int crlf, /* 0=LF, 1=CRLF */
167 char *section, /* output a message/rfc822 section */
168 int flags /* should the bessage be exported clean? */
171 /* Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg() */
172 #define QP_EADDR (1<<0) /* quoted-printable encode email addresses */
174 #define ESC_DOT (1<<2) /* output a line containing only "." as ".." instead */
175 #define SUPPRESS_ENV_TO (1<<3) /* suppress Envelope-to: header (warning: destructive!) */
177 int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
178 int mode, /* how would you like that message? */
179 int headers_only, /* eschew the message body? */
180 int do_proto, /* do Citadel protocol responses? */
181 int crlf, /* 0=LF, 1=CRLF */
182 int flags /* should the bessage be exported clean? */
184 int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void);
185 int CtdlDoIHavePermissionToReadMessagesInThisRoom(void);
194 int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
196 const char* RemoteIdentifier,
202 /* values for which_set */
207 void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
208 int target_setting, int which_set,
209 struct ctdluser *which_user, struct ctdlroom *which_room);
210 void CtdlGetSeen(char *buf, int which_set);
212 struct recptypes *validate_recipients(const char *recipients,
213 const char *RemoteIdentifier,
216 void free_recipients(struct recptypes *);
218 struct CtdlMessage *CtdlMakeMessage(
219 struct ctdluser *author, /* author's user structure */
220 char *recipient, /* NULL if it's not mail */
221 char *recp_cc, /* NULL if it's not mail */
222 char *room, /* room where it's going */
223 int type, /* see MES_ types in header file */
224 int format_type, /* variformat, plain text, MIME... */
225 char *fake_name, /* who we're masquerading as */
226 char *my_email, /* which of my email addresses to use (empty is ok) */
227 char *subject, /* Subject (optional) */
228 char *supplied_euid, /* ...or NULL if this is irrelevant */
229 char *preformatted_text, /* ...or NULL to read text from client */
230 char *references /* Thread references */
232 int CtdlCheckInternetMailPermission(struct ctdluser *who);
233 int CtdlIsMe(char *addr, int addr_buf_len);
236 * Use of aide_message is deprecated.
237 * It has been replaced with CtdlAideMessage.
238 * All parameters remain the same.
240 void aide_message(char *text, char *subject) __attribute__ ((deprecated));
244 * loading messages async via an FD:
245 * add IO->ReadMsg = NewAsyncMsg(...)
246 * and then call CtdlReadMessageBodyAsync() from your linreader handler.
249 ReadAsyncMsg *NewAsyncMsg(const char *terminator, /* token signalling EOT */
251 size_t expectlen, /* if we expect a message, how long should it be? */
252 size_t maxlen, /* maximum message length */
253 char *exist, /* if non-null, append to it;
254 exist is ALWAYS freed */
255 long eLen, /* length of exist */
256 int crlf /* CRLF newlines instead of LF */
259 eReadState CtdlReadMessageBodyAsync(AsyncIO *IO);
260 void DeleteAsyncMsg(ReadAsyncMsg **Msg);
262 extern int MessageDebugEnabled;
264 #define MSGDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (MessageDebugEnabled != 0))
265 #define CCCID CCC->cs_pid
266 #define MSG_syslog(LEVEL, FORMAT, ...) \
267 MSGDBGLOG(LEVEL) syslog(LEVEL, \
271 #define MSGM_syslog(LEVEL, FORMAT) \
272 MSGDBGLOG(LEVEL) syslog(LEVEL, \
278 #endif /* MSGBASE_H */