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)  

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/*
26 * Possible return codes from CtdlOutputMsg()
27 */
28enum {
34};
35
36/*
37 * Values of "headers_only" when calling message output routines
38 */
39#define HEADERS_ALL 0 /* Headers and body */
40#define HEADERS_ONLY 1 /* Headers only */
41#define HEADERS_NONE 2 /* Body only */
42#define HEADERS_FAST 3 /* Headers only with no MIME info */
43
44
45struct ma_info {
46 int is_ma; /* Set to 1 if we are using this stuff */
47 int freeze; /* Freeze the replacement chain because we're
48 * digging through a subsection */
49 int did_print; /* One alternative has been displayed */
50 char chosen_part[128]; /* Which part of a m/a did we choose? */
51 int chosen_pref; /* Chosen part preference level (lower is better) */
52 int use_fo_hooks; /* Use fixed output hooks */
53 int dont_decode; /* should we call the decoder or not? */
54};
55
56
57struct repl { /* Info for replication checking */
59 time_t highest;
60};
61
62
63/*
64 * This is a list of "harvested" email addresses that we might want to
65 * stick into someone's address book. But we defer this operaiton so
66 * it can be done asynchronously.
67 */
70 char *roomname;
72};
73
74extern struct addresses_to_be_filed *atbf;
75
76int GetFieldFromMnemonic(eMsgField *f, const char* c);
77void memfmout (char *mptr, const char *nl);
78void output_mime_parts(char *);
79long send_message (struct CtdlMessage *);
80void loadtroom (void);
81long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *);
82long quickie_message(const char *from, const char *fromaddr, const char *to, char *room, const char *text, int format_type, const char *subject);
83void GetMetaData(struct MetaData *, long);
84void PutMetaData(struct MetaData *);
85void AdjRefCount(long, int);
86void TDAP_AdjRefCount(long, int);
88void simple_listing(long, void *);
89int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
90typedef void (*ForEachMsgCallback)(long MsgNumber, void *UserData);
91int CtdlForEachMessage(int mode,
92 long ref,
93 char *searchstring,
94 char *content_type,
95 struct CtdlMessage *compare,
96 ForEachMsgCallback CallBack,
97 void *userdata);
98int CtdlDeleteMessages(const char *, long *, int, char *);
99long CtdlWriteObject(char *req_room, /* Room to stuff it in */
100 char *content_type, /* MIME type of this object */
101 char *raw_message, /* Data to be written */
102 off_t raw_length, /* Size of raw_message */
103 struct ctdluser *is_mailbox, /* Mailbox room? */
104 int is_binary, /* Is encoding necessary? */
105 unsigned int flags /* Internal save flags */
106);
107struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
109 (struct CtdlMessage *OrgMsg);
110int CM_IsEmpty (struct CtdlMessage *Msg, eMsgField which);
111void CM_SetField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
112void CM_SetFieldLONG (struct CtdlMessage *Msg, eMsgField which, long lvalue);
113void CM_CopyField (struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy);
114void CM_CutFieldAt (struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen);
115void CM_FlushField (struct CtdlMessage *Msg, eMsgField which);
116void CM_Flush (struct CtdlMessage *Msg);
117void CM_SetAsField (struct CtdlMessage *Msg, eMsgField which, char **buf, long length);
118void CM_SetAsFieldSB (struct CtdlMessage *Msg, eMsgField which, StrBuf **buf);
119void CM_GetAsField (struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen);
120void CM_PrependToField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
121
122void CM_Free (struct CtdlMessage *msg);
123void CM_FreeContents (struct CtdlMessage *msg);
124int CM_IsValidMsg (struct CtdlMessage *msg);
125
126#define CM_KEY(Message, Which) Message->cm_fields[Which], Message->cm_lengths[Which]
127#define CM_RANGE(Message, Which) Message->cm_fields[Which], \
128 Message->cm_fields[Which] + Message->cm_lengths[Which]
129
130void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *);
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);
137long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply);
138char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf);
140 char *terminator, /* token signalling EOT */
141 long tlen,
142 size_t maxlen, /* maximum message length */
143 StrBuf *exist, /* if non-null, append to it; exist is ALWAYS freed */
144 int crlf /* CRLF newlines instead of LF */
145);
146
147int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */
148 int mode, /* how would you like that message? */
149 int headers_only, /* eschew the message body? */
150 int do_proto, /* do Citadel protocol responses? */
151 int crlf, /* 0=LF, 1=CRLF */
152 char *section, /* output a message/rfc822 section */
153 int flags, /* should the bessage be exported clean? */
154 char **Author, /* if you want to know the author of the message... */
155 char **Address, /* if you want to know the sender address of the message... */
156 char **MessageID /* if you want to know the Message-ID of the message... */
157);
158
159/* Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg() */
160#define QP_EADDR (1<<0) /* quoted-printable encode email addresses */
161#define CRLF (1<<1)
162#define ESC_DOT (1<<2) /* output a line containing only "." as ".." instead */
163#define SUPPRESS_ENV_TO (1<<3) /* suppress Envelope-to: header (warning: destructive!) */
164
166 int mode, /* how would you like that message? */
167 int headers_only, /* eschew the message body? */
168 int do_proto, /* do Citadel protocol responses? */
169 int crlf, /* 0=LF, 1=CRLF */
170 int flags /* should the bessage be exported clean? */
171);
172
173
174/* values for which_set */
175enum {
179
180void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
181 int target_setting, int which_set,
182 struct ctdluser *which_user, struct ctdlroom *which_room
183);
184
185void CtdlGetSeen(char *buf, int which_set);
186
187
189 struct ctdluser *author, /* author's user structure */
190 char *recipient, /* NULL if it's not mail */
191 char *recp_cc, /* NULL if it's not mail */
192 char *room, /* room where it's going */
193 int type, /* see MES_ types in header file */
194 int format_type, /* variformat, plain text, MIME... */
195 char *fake_name, /* who we're masquerading as */
196 char *my_email, /* which of my email addresses to use (empty is ok) */
197 char *subject, /* Subject (optional) */
198 char *supplied_euid, /* ...or NULL if this is irrelevant */
199 char *preformatted_text, /* ...or NULL to read text from client */
200 char *references /* Thread references */
201);
202
204 struct ctdluser *author, /* author's user structure */
205 char *recipient, /* NULL if it's not mail */
206 long rcplen,
207 char *recp_cc, /* NULL if it's not mail */
208 long cclen,
209 char *room, /* room where it's going */
210 long roomlen,
211 int type, /* see MES_ types in header file */
212 int format_type, /* variformat, plain text, MIME... */
213 char *fake_name, /* who we're masquerading as */
214 long fnlen,
215 char *my_email, /* which of my email addresses to use (empty is ok) */
216 long myelen,
217 char *subject, /* Subject (optional) */
218 long subjlen,
219 char *supplied_euid, /* ...or NULL if this is irrelevant */
220 long euidlen,
221 char *preformatted_text, /* ...or NULL to read text from client */
222 long textlen,
223 char *references, /* Thread references */
224 long reflen
225);
226
227void AdjRefCountList(long *msgnum, long nmsg, int incr);
228
229#endif /* MSGBASE_H */
void CM_Free(struct CtdlMessage *msg)
Definition: msgbase.c:310
void PutMetaData(struct MetaData *)
Definition: msgbase.c:3411
int CtdlOutputPreLoadedMsg(struct CtdlMessage *, int mode, int headers_only, int do_proto, int crlf, int flags)
Definition: msgbase.c:1969
void output_mime_parts(char *)
long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply)
Definition: msgbase.c:2414
void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy)
Definition: msgbase.c:197
void TDAP_AdjRefCount(long, int)
int TDAP_ProcessAdjRefCountQueue(void)
long send_message(struct CtdlMessage *)
Definition: msgbase.c:2480
int CtdlDeleteMessages(const char *, long *, int, char *)
Definition: msgbase.c:3240
void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
Definition: msgbase.c:176
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:1481
@ ctdlsetseen_seen
Definition: msgbase.h:176
@ ctdlsetseen_answered
Definition: msgbase.h:177
void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
Definition: msgbase.c:217
struct CtdlMessage * CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length)
Definition: msgbase.c:1068
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:3060
void AdjRefCount(long, int)
Definition: msgbase.c:3441
void CM_FreeContents(struct CtdlMessage *msg)
Definition: msgbase.c:296
StrBuf * CtdlReadMessageBodyBuf(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf)
Definition: msgbase.c:2976
void(* ForEachMsgCallback)(long MsgNumber, void *UserData)
Definition: msgbase.h:90
struct CtdlMessage * CtdlFetchMessage(long msgnum, int with_body)
Definition: msgbase.c:1135
struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
Definition: msgbase.c:334
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:3482
int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template)
Definition: msgbase.c:365
long quickie_message(const char *from, const char *fromaddr, const char *to, char *room, const char *text, int format_type, const char *subject)
Definition: msgbase.c:2921
long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *)
Definition: msgbase.c:2603
int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which)
Definition: msgbase.c:137
void simple_listing(long, void *)
Definition: serv_messages.c:26
int CM_IsValidMsg(struct CtdlMessage *msg)
Definition: msgbase.c:284
void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
Definition: msgbase.c:142
void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *)
Definition: msgbase.c:2520
int GetFieldFromMnemonic(eMsgField *f, const char *c)
Definition: msgbase.c:78
@ om_no_such_msg
Definition: msgbase.h:31
@ om_access_denied
Definition: msgbase.h:33
@ om_mime_error
Definition: msgbase.h:32
@ om_not_logged_in
Definition: msgbase.h:30
@ om_ok
Definition: msgbase.h:29
void ReplicationChecks(struct CtdlMessage *)
Definition: msgbase.c:2578
char * CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf)
Definition: msgbase.c:3037
void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length)
Definition: msgbase.c:242
void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
Definition: msgbase.c:164
int CtdlForEachMessage(int mode, long ref, char *searchstring, char *content_type, struct CtdlMessage *compare, ForEachMsgCallback CallBack, void *userdata)
Definition: msgbase.c:626
void memfmout(char *mptr, const char *nl)
Definition: msgbase.c:861
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:409
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg)
Definition: msgbase.c:2399
void CtdlGetSeen(char *buf, int which_set)
Definition: msgbase.c:393
void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
Definition: msgbase.c:156
@ 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
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:3107
void CM_Flush(struct CtdlMessage *Msg)
Definition: msgbase.c:184
void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen)
Definition: msgbase.c:268
void AdjRefCountList(long *msgnum, long nmsg, int incr)
Definition: msgbase.c:3428
void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf)
Definition: msgbase.c:258
void GetMetaData(struct MetaData *, long)
Definition: msgbase.c:3383
struct addresses_to_be_filed * atbf
Definition: msgbase.c:33
@ 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
int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs, int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj)
Definition: msgbase.c:2236
enum _MsgField eMsgField
char * collected_addresses
Definition: msgbase.h:71
struct addresses_to_be_filed * next
Definition: msgbase.h:69
char chosen_part[128]
Definition: msgbase.h:50
int chosen_pref
Definition: msgbase.h:51
int did_print
Definition: msgbase.h:49
int is_ma
Definition: msgbase.h:46
int use_fo_hooks
Definition: msgbase.h:52
int freeze
Definition: msgbase.h:47
int dont_decode
Definition: msgbase.h:53
Definition: msgbase.h:57
time_t highest
Definition: msgbase.h:59
char exclusive_id[SIZ]
Definition: msgbase.h:58
#define SIZ
Definition: sysconfig.h:33