citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
msgbase.h
Go to the documentation of this file.
1
2#ifndef MSGBASE_H
3#define MSGBASE_H
4
5enum {
15};
16
17enum {
23};
24
25// Possible return codes from CtdlOutputMsg()
26enum {
32};
33
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
39
40
41struct ma_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?
49};
50
51
52struct repl { // Info for replication checking
54 time_t highest;
55};
56
57
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.
66
67extern struct addresses_to_be_filed *atbf;
68
69int GetFieldFromMnemonic(eMsgField *f, const char* c);
70void memfmout (char *mptr, const char *nl);
71void output_mime_parts(char *);
72long send_message (struct CtdlMessage *);
73void loadtroom (void);
74long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *);
75long quickie_message(char *from, char *fromaddr, char *to, char *room, char *text, int format_type, char *subject);
76void GetMetaData(struct MetaData *, long);
77void PutMetaData(struct MetaData *);
78void AdjRefCount(long, int);
79void TDAP_AdjRefCount(long, int);
81void simple_listing(long, void *);
82int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
83typedef void (*ForEachMsgCallback)(long MsgNumber, void *UserData);
84int CtdlForEachMessage(int mode,
85 long ref,
86 char *searchstring,
87 char *content_type,
88 struct CtdlMessage *compare,
89 ForEachMsgCallback CallBack,
90 void *userdata);
91int CtdlDeleteMessages(const char *, long *, int, char *);
92long 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
99);
100struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
102 (struct CtdlMessage *OrgMsg);
103int CM_IsEmpty (struct CtdlMessage *Msg, eMsgField which);
104void CM_SetField (struct CtdlMessage *Msg, eMsgField which, const char *buf);
105void CM_SetFieldLONG (struct CtdlMessage *Msg, eMsgField which, long lvalue);
106void CM_CopyField (struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy);
107void CM_CutFieldAt (struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen);
108void CM_FlushField (struct CtdlMessage *Msg, eMsgField which);
109void CM_Flush (struct CtdlMessage *Msg);
110void CM_SetAsField (struct CtdlMessage *Msg, eMsgField which, char **buf, long length);
111void CM_SetAsFieldSB (struct CtdlMessage *Msg, eMsgField which, StrBuf **buf);
112void CM_GetAsField (struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen);
113void CM_PrependToField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
114
115void CM_Free (struct CtdlMessage *msg);
116void CM_FreeContents (struct CtdlMessage *msg);
117int CM_IsValidMsg (struct CtdlMessage *msg);
118
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]
122
123// Serialization routines use this struct to return a pointer and a length
124struct ser_ret {
125 size_t len; // length of allocation
126 unsigned char *ser; // pointer to allocation
127 unsigned char *msgstart; // pointer to the "M" (message text) field
128};
129
131struct CtdlMessage *CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length);
132void ReplicationChecks(struct CtdlMessage *);
133int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
134 int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj
135);
136int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
137char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf);
139 char *terminator, // token signalling EOT
140 long tlen,
141 size_t maxlen, // maximum message length
142 StrBuf *exist, // if non-null, append to it; exist is ALWAYS freed
143 int crlf // CRLF newlines instead of LF
144);
145
146int CtdlOutputMsg(long msg_num, // message number (local) to fetch
147 int mode, // how would you like that message?
148 int headers_only, // eschew the message body?
149 int do_proto, // do Citadel protocol responses?
150 int crlf, // 0=LF, 1=CRLF
151 char *section, // output a message/rfc822 section
152 int flags, // should the bessage be exported clean?
153 char **Author, // if you want to know the author of the message...
154 char **Address, // if you want to know the sender address of the message...
155 char **MessageID // if you want to know the Message-ID of the message...
156);
157
158// Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg()
159#define QP_EADDR (1<<0) // quoted-printable encode email addresses
160#define CRLF (1<<1)
161#define ESC_DOT (1<<2) // output a line containing only "." as ".." instead
162#define SUPPRESS_ENV_TO (1<<3) // suppress Envelope-to: header (warning: destructive!)
163
165 int mode, // how would you like that message?
166 int headers_only, // eschew the message body?
167 int do_proto, // do Citadel protocol responses?
168 int crlf, // 0=LF, 1=CRLF
169 int flags // should the bessage be exported clean?
170);
171
172
173// values for which_set
174enum {
178
179void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
180 int target_setting, int which_set,
181 struct ctdluser *which_user, struct ctdlroom *which_room
182);
183
184void CtdlGetSeen(char *buf, int which_set);
185
186
188 struct ctdluser *author, // author's user structure
189 char *recipient, // NULL if it's not mail
190 char *recp_cc, // NULL if it's not mail
191 char *room, // room where it's going
192 int type, // see MES_ types in header file
193 int format_type, // variformat, plain text, MIME...
194 char *fake_name, // who we're masquerading as
195 char *my_email, // which of my email addresses to use (empty is ok)
196 char *subject, // Subject (optional)
197 char *supplied_euid, // ...or NULL if this is irrelevant
198 char *preformatted_text, // ...or NULL to read text from client
199 char *references // Thread references
200);
201
203 struct ctdluser *author, // author's user structure
204 char *recipient, // NULL if it's not mail
205 long rcplen,
206 char *recp_cc, // NULL if it's not mail
207 long cclen,
208 char *room, // room where it's going
209 long roomlen,
210 int type, // see MES_ types in header file
211 int format_type, // variformat, plain text, MIME...
212 char *fake_name, // who we're masquerading as
213 long fnlen,
214 char *my_email, // which of my email addresses to use (empty is ok)
215 long myelen,
216 char *subject, // Subject (optional)
217 long subjlen,
218 char *supplied_euid, // ...or NULL if this is irrelevant
219 long euidlen,
220 char *preformatted_text, // ...or NULL to read text from client
221 long textlen,
222 char *references, // Thread references
223 long reflen
224);
225
226void AdjRefCountList(long *msgnum, long nmsg, int incr);
227
228#endif
enum _MsgField eMsgField
void CM_Free(struct CtdlMessage *msg)
Definition msgbase.c:302
void PutMetaData(struct MetaData *)
Definition msgbase.c:3205
int CtdlOutputPreLoadedMsg(struct CtdlMessage *, int mode, int headers_only, int do_proto, int crlf, int flags)
Definition msgbase.c:1884
void output_mime_parts(char *)
void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy)
Definition msgbase.c:188
void TDAP_AdjRefCount(long, int)
int TDAP_ProcessAdjRefCountQueue(void)
long send_message(struct CtdlMessage *)
Definition msgbase.c:2345
int CtdlDeleteMessages(const char *, long *, int, char *)
Definition msgbase.c:3065
void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
Definition msgbase.c:167
int CtdlOutputMsg(long msg_num, int mode, int headers_only, int do_proto, int crlf, char *section, int flags, char **Author, char **Address, char **MessageID)
Definition msgbase.c:1417
void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
Definition msgbase.c:208
struct CtdlMessage * CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length)
Definition msgbase.c:1012
void loadtroom(void)
struct CtdlMessage * CtdlMakeMessage(struct ctdluser *author, char *recipient, char *recp_cc, char *room, int type, int format_type, char *fake_name, char *my_email, char *subject, char *supplied_euid, char *preformatted_text, char *references)
Definition msgbase.c:2889
void AdjRefCount(long, int)
Definition msgbase.c:3226
void CM_FreeContents(struct CtdlMessage *msg)
Definition msgbase.c:288
StrBuf * CtdlReadMessageBodyBuf(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf)
Definition msgbase.c:2801
@ ctdlsetseen_seen
Definition msgbase.h:175
@ ctdlsetseen_answered
Definition msgbase.h:176
void(* ForEachMsgCallback)(long MsgNumber, void *UserData)
Definition msgbase.h:83
struct CtdlMessage * CtdlFetchMessage(long msgnum, int with_body)
Definition msgbase.c:1078
struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
Definition msgbase.c:326
long CtdlWriteObject(char *req_room, char *content_type, char *raw_message, off_t raw_length, struct ctdluser *is_mailbox, int is_binary, unsigned int flags)
Definition msgbase.c:3261
int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template)
Definition msgbase.c:357
long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *)
Definition msgbase.c:2455
@ MSG_HDRS_BRIEFFILTER
Definition msgbase.h:21
@ MSG_HDRS_THREADS
Definition msgbase.h:22
@ MSG_HDRS_EUID
Definition msgbase.h:20
@ MSG_HDRS_ALL
Definition msgbase.h:19
@ MSG_HDRS_BRIEF
Definition msgbase.h:18
int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which)
Definition msgbase.c:133
void simple_listing(long, void *)
int CM_IsValidMsg(struct CtdlMessage *msg)
Definition msgbase.c:276
int GetFieldFromMnemonic(eMsgField *f, const char *c)
Definition msgbase.c:74
@ om_no_such_msg
Definition msgbase.h:29
@ om_access_denied
Definition msgbase.h:31
@ om_mime_error
Definition msgbase.h:30
@ om_not_logged_in
Definition msgbase.h:28
@ om_ok
Definition msgbase.h:27
void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf)
Definition msgbase.c:138
void ReplicationChecks(struct CtdlMessage *)
Definition msgbase.c:2435
char * CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf)
Definition msgbase.c:2866
void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length)
Definition msgbase.c:234
void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
Definition msgbase.c:155
int CtdlForEachMessage(int mode, long ref, char *searchstring, char *content_type, struct CtdlMessage *compare, ForEachMsgCallback CallBack, void *userdata)
Definition msgbase.c:602
void memfmout(char *mptr, const char *nl)
Definition msgbase.c:815
void CtdlSetSeen(long *target_msgnums, int num_target_msgnums, int target_setting, int which_set, struct ctdluser *which_user, struct ctdlroom *which_room)
Definition msgbase.c:401
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg)
Definition msgbase.c:2286
void CtdlGetSeen(char *buf, int which_set)
Definition msgbase.c:385
void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
Definition msgbase.c:147
struct CtdlMessage * CtdlMakeMessageLen(struct ctdluser *author, char *recipient, long rcplen, char *recp_cc, long cclen, char *room, long roomlen, int type, int format_type, char *fake_name, long fnlen, char *my_email, long myelen, char *subject, long subjlen, char *supplied_euid, long euidlen, char *preformatted_text, long textlen, char *references, long reflen)
Definition msgbase.c:2934
@ MSGS_FIRST
Definition msgbase.h:9
@ MSGS_NEW
Definition msgbase.h:8
@ MSGS_SEARCH
Definition msgbase.h:13
@ MSGS_ALL
Definition msgbase.h:6
@ MSGS_GT
Definition msgbase.h:11
@ MSGS_EQ
Definition msgbase.h:12
@ MSGS_OLD
Definition msgbase.h:7
@ MSGS_LAST
Definition msgbase.h:10
@ MSGS_LT
Definition msgbase.h:14
long quickie_message(char *from, char *fromaddr, char *to, char *room, char *text, int format_type, char *subject)
Definition msgbase.c:2748
struct ser_ret CtdlSerializeMessage(struct CtdlMessage *)
Definition msgbase.c:2380
void CM_Flush(struct CtdlMessage *Msg)
Definition msgbase.c:175
void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen)
Definition msgbase.c:260
void AdjRefCountList(long *msgnum, long nmsg, int incr)
Definition msgbase.c:3215
void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf)
Definition msgbase.c:250
void GetMetaData(struct MetaData *, long)
Definition msgbase.c:3184
struct addresses_to_be_filed * atbf
Definition msgbase.c:29
int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs, int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj)
Definition msgbase.c:2144
char * collected_addresses
Definition msgbase.h:64
struct addresses_to_be_filed * next
Definition msgbase.h:62
char chosen_part[128]
Definition msgbase.h:45
int chosen_pref
Definition msgbase.h:46
int did_print
Definition msgbase.h:44
int is_ma
Definition msgbase.h:42
int use_fo_hooks
Definition msgbase.h:47
int freeze
Definition msgbase.h:43
int dont_decode
Definition msgbase.h:48
Definition msgbase.h:52
time_t highest
Definition msgbase.h:54
char exclusive_id[SIZ]
Definition msgbase.h:53
size_t len
Definition msgbase.h:125
unsigned char * msgstart
Definition msgbase.h:127
unsigned char * ser
Definition msgbase.h:126
#define SIZ
Definition sysconfig.h:22