AmendHub

Download

jcs

/

subtext

/

mail.h

 

(View History)

jcs   mail: Add mail_to_sysop() Latest amendment: 563 on 2023-11-27

1 /*
2 * Copyright (c) 2022 joshua stein <jcs@jcs.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __MAIL_H__
18 #define __MAIL_H__
19
20 #include "bile.h"
21 #include "fidopkt.h"
22 #include "session.h"
23
24 struct mail_message {
25 /* key */
26 unsigned long recipient_user_id;
27
28 unsigned long id;
29 time_t time;
30 time_t read;
31 /* mail_find_ids_for_user has to be able to read this far without alloc */
32
33 unsigned long sender_user_id;
34 size_t subject_size;
35 char *subject;
36 size_t body_size;
37 char *body;
38 unsigned long parent_message_id;
39
40 struct fidopkt_msgid ftn_msgid;
41 struct fidopkt_address ftn_orig;
42 struct fidopkt_address ftn_dest;
43 char ftn_from[32];
44 char ftn_to[32];
45 char ftn_msgid_orig[64];
46 char ftn_reply[32];
47 };
48
49 void mail_menu(struct session *s);
50 void mail_compose(struct session *s, char *to, char *subject, char *body,
51 char *ftn_reply_msgid);
52 short mail_save(struct mail_message *msg);
53 size_t mail_find_ids_for_user(struct user *user, size_t *nmail_ids,
54 unsigned long **mail_ids, size_t offset, size_t limit, bool only_unread);
55 short mail_toss_ftn_message(struct fidopkt_message *fidomsg);
56 size_t mail_encode_as_fidopkt(unsigned long id,
57 struct fidopkt_address *orig_node, char **pkt_buf);
58 void mail_to_sysop(char *subject, char *body);
59 void mail_prune(short days);
60
61 #endif