File: draft.h

package info (click to toggle)
prayer 1.3.5-dfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,396 kB
  • ctags: 3,309
  • sloc: ansic: 43,161; makefile: 810; sh: 451; perl: 166
file content (107 lines) | stat: -rw-r--r-- 4,386 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* $Cambridge: hermes/src/prayer/session/draft.h,v 1.4 2008/10/29 16:03:32 dpc22 Exp $ */
/************************************************
 *    Prayer - a Webmail Interface              *
 ************************************************/

/* Copyright (c) University of Cambridge 2000 - 2008 */
/* See the file NOTICE for conditions of use and distribution. */

/* Data structures for message draft */

struct attlist {                /* List of attachments */
    struct attlist *next;       /* Linked list */
    void *hdr;                  /* Header block associated with attachment */
    unsigned long hdr_size;     /* Size of the header block */
    char *name;                 /* Filename for this attachment */
    char *type;                 /* Attachment type e.g: "application/octet-stream" */
    char *encoding;             /* Encoding for attachment e.g: "base64" */
    void *body;                 /* Attachment body */
    unsigned long size;         /* Attachment body size */
};

struct draft {
    BOOL have_draft;            /* Active draft */
    struct session *session;    /* Session associated with this draft */
    struct pool *pool;          /* Pool used for draft msg */
    struct role *role;          /* Current role */
    char *from_personal;        /* Personal component of from line */
    char *from_address;         /* Address component of from line */
    char *to;                   /* To line  */
    char *cc;                   /* Cc line  */
    char *bcc;                  /* Bcc line */
    char *fcc;                  /* Fcc line */
    char *reply_to;             /* Reply to line */
    char *subject;              /* Subject line */
    char *body;                 /* Body     */
    char *in_reply_to;          /* To make threading work */
    char *references;           /* To make threading work */
    struct attlist *attlist;    /* Linked list of attachments */
    BOOL save_copy;             /* Save copy to sent-mail folder */
    BOOL line_wrap;             /* Line wrap first component on send */
    unsigned long reply_validity;       /* UID validity for reply folder    */
    unsigned long reply_msgno;  /* Message is reply to this message */
    unsigned long reply_msguid; /* Message is reply to this message */
    char *reply_folder;         /* Message is reply to this message */
    BOOL rich_headers;          /* Show rich headers */
};

#define PREFERRED_DRAFT_BLOCK_SIZE (4096)

struct draft *draft_create(struct session *s);
void draft_free(struct draft *d);
void draft_copy(struct draft *dst, struct draft *src);

void draft_clear_hdrs(struct draft *d);
void draft_clear_body(struct draft *d);
void draft_init(struct draft *d);

void
draft_set_reply(struct draft *draft,
                MAILSTREAM * stream, char *foldername,
                unsigned long msgno);

void draft_update(struct draft *d, struct assoc *h);
void draft_update_body(struct draft *d, struct assoc *h);
void draft_add_to(struct draft *draft, char *s);
void draft_add_cc(struct draft *draft, char *s);
void draft_add_bcc(struct draft *draft, char *s);

void
draft_add_attachment(struct draft *d,
                     char *name, char *type, char *encoding,
                     char *hdr, unsigned long hdr_size,
                     char *msg, unsigned long msg_size);
void draft_delete_attachment(struct draft *d, unsigned long number);
unsigned long draft_att_count(struct draft *d);
unsigned long draft_att_size(struct draft *d);
void draft_clear_atts(struct draft *d);

void draft_line_wrap_body(struct draft *d);

void draft_role_set(struct draft *d, struct role *role);

void draft_rich_headers(struct draft *d, BOOL enable);
void draft_init_rich_headers(struct draft *d);

char *draft_make_recipients(struct draft *draft,
                            unsigned long *len,
                            unsigned long *countp);

char *draft_make_msg(struct draft *draft, BOOL postpone,
                     unsigned long *len);

/* Operations on postponed message list */

BOOL
draft_restore_postponed(struct draft *d, struct pool *pool,
                        MAILSTREAM * stream, long msgno);

BOOL draft_write(struct draft *draft);

BOOL draft_check(struct session *session);

BOOL draft_delete(struct session *session, unsigned long msgno);

BOOL draft_is_reply(struct draft *draft);

BOOL draft_flag_answered(struct draft *draft);