In WIKI rooms, clients can supply a message EUID
[citadel.git] / citadel / msgbase.h
1 /* $Id$ */
2
3 #define aide_message(text)      quickie_message("Citadel",NULL,AIDEROOM,text,0,NULL)
4
5 #define MSGS_ALL        0
6 #define MSGS_OLD        1
7 #define MSGS_NEW        2
8 #define MSGS_FIRST      3
9 #define MSGS_LAST       4
10 #define MSGS_GT         5
11 #define MSGS_EQ         6
12
13 /*
14  * Possible return codes from CtdlOutputMsg()
15  */
16 enum {
17         om_ok,
18         om_not_logged_in,
19         om_no_such_msg,
20         om_mime_error
21 };
22
23 /*
24  * Values of "headers_only" when calling message output routines
25  */
26 #define HEADERS_ALL     0       /* Headers and body */
27 #define HEADERS_ONLY    1       /* Headers only */
28 #define HEADERS_NONE    2       /* Body only */
29 #define HEADERS_FAST    3       /* Headers only with no MIME info */
30
31
32 struct ma_info {
33         int is_ma;              /* Set to 1 if we are using this stuff */
34         int freeze;             /* Freeze the replacement chain because we're
35                                  * digging through a subsection */
36         int did_print;          /* One alternative has been displayed */
37         char chosen_part[128];  /* Which part of a m/a did we choose? */
38 };
39
40
41 struct repl {                   /* Info for replication checking */
42         char exclusive_id[SIZ];
43         time_t highest;
44 };
45
46
47 /* Data structure returned by validate_recipients() */
48 struct recptypes {
49         int num_local;
50         int num_internet;
51         int num_ignet;
52         int num_room;
53         int num_error;
54         char errormsg[SIZ];
55         char recp_local[SIZ];
56         char recp_internet[SIZ];
57         char recp_ignet[SIZ];
58         char recp_room[SIZ];
59         char display_recp[SIZ];
60 };
61
62 /*
63  * This is a list of "harvested" email addresses that we might want to
64  * stick into someone's address book.  But we defer this operaiton so
65  * it can be done asynchronously.
66  */
67 struct addresses_to_be_filed {
68         struct addresses_to_be_filed *next;
69         char *roomname;
70         char *collected_addresses;
71 };
72
73 extern struct addresses_to_be_filed *atbf;
74
75 int alias (char *name);
76 void get_mm (void);
77 void cmd_msgs (char *cmdbuf);
78 void cmd_isme (char *cmdbuf);
79 void help_subst (char *strbuf, char *source, char *dest);
80 void do_help_subst (char *buffer);
81 void memfmout (int width, char *mptr, char subst, char *nl);
82 void output_mime_parts(char *);
83 void cmd_msg0 (char *cmdbuf);
84 void cmd_msg2 (char *cmdbuf);
85 void cmd_msg3 (char *cmdbuf);
86 void cmd_msg4 (char *cmdbuf);
87 void cmd_msgp (char *cmdbuf);
88 void cmd_opna (char *cmdbuf);
89 long send_message (struct CtdlMessage *);
90 void loadtroom (void);
91 long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, char *);
92 void quickie_message (char *, char *, char *, char *, int, char *);
93 void cmd_ent0 (char *entargs);
94 void cmd_dele (char *delstr);
95 void cmd_move (char *args);
96 void GetMetaData(struct MetaData *, long);
97 void PutMetaData(struct MetaData *);
98 void AdjRefCount(long, int);
99 void simple_listing(long, void *);
100 int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
101 int CtdlForEachMessage(int mode, long ref,
102                         char *content_type,
103                         struct CtdlMessage *compare,
104                         void (*CallBack) (long, void *),
105                         void *userdata);
106 int CtdlDeleteMessages(char *, long, char *, int);
107 void CtdlWriteObject(char *, char *, char *, struct ctdluser *,
108                         int, int, unsigned int);
109 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
110 void CtdlFreeMessage(struct CtdlMessage *msg);
111 void serialize_message(struct ser_ret *, struct CtdlMessage *);
112 int is_valid_message(struct CtdlMessage *);
113 void ReplicationChecks(struct CtdlMessage *);
114 int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
115 char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist, int crlf);
116 char *CtdlGetSysConfig(char *sysconfname);
117 void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
118 int CtdlOutputMsg(long msg_num,         /* message number (local) to fetch */
119                 int mode,               /* how would you like that message? */
120                 int headers_only,       /* eschew the message body? */
121                 int do_proto,           /* do Citadel protocol responses? */
122                 int crlf,               /* 0=LF, 1=CRLF */
123                 char *section           /* output a message/rfc822 section */
124 );
125 int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
126                 int mode,               /* how would you like that message? */
127                 int headers_only,       /* eschew the message body? */
128                 int do_proto,           /* do Citadel protocol responses? */
129                 int crlf                /* 0=LF, 1=CRLF */
130 );
131 int CtdlCopyMsgToRoom(long msgnum, char *dest);
132 int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void);
133 int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf, size_t n);
134
135
136 /* values for which_set */
137 enum {
138         ctdlsetseen_seen,
139         ctdlsetseen_answered
140 };
141 void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
142                  int target_setting, int which_set,
143                 struct ctdluser *which_user, struct ctdlroom *which_room);
144 void CtdlGetSeen(char *buf, int which_set);
145
146 struct recptypes *validate_recipients(char *recipients);
147 struct CtdlMessage *CtdlMakeMessage(
148         struct ctdluser *author,        /* author's user structure */
149         char *recipient,                /* NULL if it's not mail */
150         char *recp_cc,                  /* NULL if it's not mail */
151         char *room,                     /* room where it's going */
152         int type,                       /* see MES_ types in header file */
153         int format_type,                /* variformat, plain text, MIME... */
154         char *fake_name,                /* who we're masquerading as */
155         char *subject,                  /* Subject (optional) */
156         char *supplied_euid,            /* ...or NULL if this is irrelevant */
157         char *preformatted_text         /* ...or NULL to read text from client */
158 );
159 int CtdlCheckInternetMailPermission(struct ctdluser *who);
160 int CtdlIsMe(char *addr, int addr_buf_len);