21 MSG_HDRS_BRIEFFILTER = 8,
25 // Possible return codes from CtdlOutputMsg()
34 // Values of "headers_only" when calling message output routines
35 #define HEADERS_ALL 0 // Headers and body
36 #define HEADERS_ONLY 1 // Headers only
37 #define HEADERS_NONE 2 // Body only
38 #define HEADERS_FAST 3 // Headers only with no MIME info
42 int is_ma; // Set to 1 if we are using this stuff
43 int freeze; // Freeze the replacement chain because we're digging through a subsection
44 int did_print; // One alternative has been displayed
45 char chosen_part[128]; // Which part of a m/a did we choose?
46 int chosen_pref; // Chosen part preference level (lower is better)
47 int use_fo_hooks; // Use fixed output hooks
48 int dont_decode; // should we call the decoder or not?
52 struct repl { // Info for replication checking
53 char exclusive_id[SIZ];
58 // This is a list of "harvested" email addresses that we might want to
59 // stick into someone's address book. But we defer this operaiton so
60 // it can be done asynchronously.
61 struct addresses_to_be_filed {
62 struct addresses_to_be_filed *next;
64 char *collected_addresses;
67 extern struct addresses_to_be_filed *atbf;
69 int GetFieldFromMnemonic(eMsgField *f, const char* c);
70 void memfmout (char *mptr, const char *nl);
71 void output_mime_parts(char *);
72 long send_message (struct CtdlMessage *);
73 void loadtroom (void);
74 long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *);
75 long quickie_message(char *from, char *fromaddr, char *to, char *room, char *text, int format_type, char *subject);
76 void GetMetaData(struct MetaData *, long);
77 void PutMetaData(struct MetaData *);
78 void AdjRefCount(long, int);
79 void TDAP_AdjRefCount(long, int);
80 int TDAP_ProcessAdjRefCountQueue(void);
81 void simple_listing(long, void *);
82 int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
83 typedef void (*ForEachMsgCallback)(long MsgNumber, void *UserData);
84 int CtdlForEachMessage(int mode,
88 struct CtdlMessage *compare,
89 ForEachMsgCallback CallBack,
91 int CtdlDeleteMessages(const char *, long *, int, char *);
92 long CtdlWriteObject(char *req_room, // Room to stuff it in
93 char *content_type, // MIME type of this object
94 char *raw_message, // Data to be written
95 off_t raw_length, // Size of raw_message
96 struct ctdluser *is_mailbox, // Mailbox room?
97 int is_binary, // Is encoding necessary?
98 unsigned int flags // Internal save flags
100 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
101 struct CtdlMessage * CM_Duplicate
102 (struct CtdlMessage *OrgMsg);
103 int CM_IsEmpty (struct CtdlMessage *Msg, eMsgField which);
104 void CM_SetField (struct CtdlMessage *Msg, eMsgField which, const char *buf);
105 void CM_SetFieldLONG (struct CtdlMessage *Msg, eMsgField which, long lvalue);
106 void CM_CopyField (struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy);
107 void CM_CutFieldAt (struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen);
108 void CM_FlushField (struct CtdlMessage *Msg, eMsgField which);
109 void CM_Flush (struct CtdlMessage *Msg);
110 void CM_SetAsField (struct CtdlMessage *Msg, eMsgField which, char **buf, long length);
111 void CM_SetAsFieldSB (struct CtdlMessage *Msg, eMsgField which, StrBuf **buf);
112 void CM_GetAsField (struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen);
113 void CM_PrependToField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
115 void CM_Free (struct CtdlMessage *msg);
116 void CM_FreeContents (struct CtdlMessage *msg);
117 int CM_IsValidMsg (struct CtdlMessage *msg);
119 #define CM_KEY(Message, Which) Message->cm_fields[Which], Message->cm_lengths[Which]
120 #define CM_RANGE(Message, Which) Message->cm_fields[Which], \
121 Message->cm_fields[Which] + Message->cm_lengths[Which]
123 void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *);
124 struct CtdlMessage *CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length);
125 void ReplicationChecks(struct CtdlMessage *);
126 int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
127 int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj
129 int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
130 long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply);
131 char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf);
132 StrBuf *CtdlReadMessageBodyBuf(
133 char *terminator, // token signalling EOT
135 size_t maxlen, // maximum message length
136 StrBuf *exist, // if non-null, append to it; exist is ALWAYS freed
137 int crlf // CRLF newlines instead of LF
140 int CtdlOutputMsg(long msg_num, // message number (local) to fetch
141 int mode, // how would you like that message?
142 int headers_only, // eschew the message body?
143 int do_proto, // do Citadel protocol responses?
144 int crlf, // 0=LF, 1=CRLF
145 char *section, // output a message/rfc822 section
146 int flags, // should the bessage be exported clean?
147 char **Author, // if you want to know the author of the message...
148 char **Address, // if you want to know the sender address of the message...
149 char **MessageID // if you want to know the Message-ID of the message...
152 // Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg()
153 #define QP_EADDR (1<<0) // quoted-printable encode email addresses
155 #define ESC_DOT (1<<2) // output a line containing only "." as ".." instead
156 #define SUPPRESS_ENV_TO (1<<3) // suppress Envelope-to: header (warning: destructive!)
158 int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
159 int mode, // how would you like that message?
160 int headers_only, // eschew the message body?
161 int do_proto, // do Citadel protocol responses?
162 int crlf, // 0=LF, 1=CRLF
163 int flags // should the bessage be exported clean?
167 // values for which_set
173 void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
174 int target_setting, int which_set,
175 struct ctdluser *which_user, struct ctdlroom *which_room
178 void CtdlGetSeen(char *buf, int which_set);
181 struct CtdlMessage *CtdlMakeMessage(
182 struct ctdluser *author, // author's user structure
183 char *recipient, // NULL if it's not mail
184 char *recp_cc, // NULL if it's not mail
185 char *room, // room where it's going
186 int type, // see MES_ types in header file
187 int format_type, // variformat, plain text, MIME...
188 char *fake_name, // who we're masquerading as
189 char *my_email, // which of my email addresses to use (empty is ok)
190 char *subject, // Subject (optional)
191 char *supplied_euid, // ...or NULL if this is irrelevant
192 char *preformatted_text, // ...or NULL to read text from client
193 char *references // Thread references
196 struct CtdlMessage *CtdlMakeMessageLen(
197 struct ctdluser *author, // author's user structure
198 char *recipient, // NULL if it's not mail
200 char *recp_cc, // NULL if it's not mail
202 char *room, // room where it's going
204 int type, // see MES_ types in header file
205 int format_type, // variformat, plain text, MIME...
206 char *fake_name, // who we're masquerading as
208 char *my_email, // which of my email addresses to use (empty is ok)
210 char *subject, // Subject (optional)
212 char *supplied_euid, // ...or NULL if this is irrelevant
214 char *preformatted_text, // ...or NULL to read text from client
216 char *references, // Thread references
220 void AdjRefCountList(long *msgnum, long nmsg, int incr);