1Message(3) User Contributed Perl Documentation Message(3)
2
3
4
6 Cyrus::Annotator::Message - representation of a message to annotate
7
9 use warnings;
10 use strict;
11 package MyAnnotatorDaemon;
12 use base Cyrus::Annotator::Daemon;
13
14 sub annotate_message
15 {
16 my ($message) = @_;
17
18 $message->set_flag('\Flagged');
19 $message->set_shared_annotation('/comment', 'Hello!!');
20 }
21
22 MyAnnotatorDaemon->run();
23
25 This module encapsulates a message which is being processed by the
26 annotator daemon.
27
29 Cyrus::Annotator::Message has the following methods.
30
31 new(%args)
32 Takes the following args:
33
34 # required
35 * BODYSTRUCTURE => parsed bodystructure
36
37 # optional (but you need to provide SOMETHING if your code uses any
38 # of the accessors)
39 * GUID => 40 character sha1
40 * HEADER => Mail::Header object with headers pre-parsed
41 * FILENAME => path to rfc822 file
42
43 # totally optional (will be considered empty if not set)
44 * FLAGS => array of already set flags
45 * ANNOTATIONS => array of already set annotations
46
47 fh()
48 returns a read-only filehandle to the raw (rfc822) representation
49 of the full message.
50
51 decode_part($Part, $Content)
52 Given some content, decode it from the part's content encoding and
53 charset.
54
55 read_part_content($Part, $nbytes)
56 returns the first n bytes of the bodypart passed. This is a
57 section of the bodystructure (hashref). If no part is passed, it's
58 the raw message.
59
60 If no 'nbytes' is passed, read the entire part.
61
62 header()
63 returns a Mail::Header object containing all the headers of the
64 message.
65
66 bodystructure()
67 returns a structure
68
69 is a structure closely based on the IMAP BODYSTRUCTURE, decoded
70 into a hash, including recursively all MIME sections. In general,
71 the following items are defined for all body structures:
72
73 • MIME-Type
74
75 • MIME-Subtype
76
77 • Content-Type
78
79 • Content-Description
80
81 • Content-Disposition
82
83 • Content-Language
84
85 Body structures which have a MIME-Type of 'multipart' contain the
86 following items:
87
88 • MIME-Subparts
89
90 For body structures except those that have a MIME-Type of
91 'multipart', the following are defined:
92
93 • Content-ID
94
95 • Content-Description
96
97 • Content-Transfer-Encoding
98
99 • Content-MD5
100
101 • Size
102
103 • Lines
104
105 • Offset
106
107 • HeaderSize
108
109 guid()
110 returns the hex encoded (40 character) sha1 of the rfc822
111 representation.
112
113 has_flag($name)
114 set_flag($name)
115 clear_flag($name)
116 Check for the boolean value of a flag with $name, set the flag and
117 remove the flag respectively.
118
119 Note that changes are not immediate. They will be applied by the
120 annotator at the end.
121
122 For example:
123
124 $message->set_flag("\\Flagged");
125
126 get_shared_annotation($entry)
127 get_private_annotation($entry)
128 set_shared_annotation($entry, $value)
129 set_private_annotation($entry, $value)
130 clear_shared_annotation($entry)
131 clear_private_annotation($entry)
132 Get, set and clear the value of an annotation, either shared or
133 private. The "get" accessors return a string with the value.
134 Clear is the same as set with $value of the empty string ('').
135
136 For example:
137
138 $message->set_shared_annotation('/comment', 'Hello World');
139
140 get_changed()
141 returns two arrayrefs - [['flagname', 'bool']] and [['entry',
142 'type', 'value']], e.g.
143
144 [["\\Flagged", 1]], [['/comment', 'value.shared', 'Hello World']]
145
147 RFC3501, RFC5257.
148
150 Greg Banks <gnb@fastmail.fm>. Bron Gondwana <brong@fastmail.fm>.
151
152
153
154perl v5.32.1 2021-01-26 Message(3)