.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Message 3pm" .TH Message 3pm "2021-06-19" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Cyrus::Annotator::Message \- representation of a message to annotate .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use warnings; \& use strict; \& package MyAnnotatorDaemon; \& use base Cyrus::Annotator::Daemon; \& \& sub annotate_message \& { \& my ($message) = @_; \& \& $message\->set_flag(\*(Aq\eFlagged\*(Aq); \& $message\->set_shared_annotation(\*(Aq/comment\*(Aq, \*(AqHello!!\*(Aq); \& } \& \& MyAnnotatorDaemon\->run(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module encapsulates a message which is being processed by the annotator daemon. .SH "METHODS" .IX Header "METHODS" Cyrus::Annotator::Message has the following methods. .IP "\fInew(%args)\fR" 4 .IX Item "new(%args)" Takes the following args: .Sp .Vb 2 \& # required \& * BODYSTRUCTURE => parsed bodystructure \& \& # optional (but you need to provide SOMETHING if your code uses any \& # of the accessors) \& * GUID => 40 character sha1 \& * HEADER => Mail::Header object with headers pre\-parsed \& * FILENAME => path to rfc822 file \& \& # totally optional (will be considered empty if not set) \& * FLAGS => array of already set flags \& * ANNOTATIONS => array of already set annotations .Ve .IP "\fI\f(BIfh()\fI\fR" 4 .IX Item "fh()" returns a read-only filehandle to the raw (rfc822) representation of the full message. .IP "\fIdecode_part($Part, \f(CI$Content\fI)\fR" 4 .IX Item "decode_part($Part, $Content)" Given some content, decode it from the part's content encoding and charset. .IP "\fIread_part_content($Part, \f(CI$nbytes\fI)\fR" 4 .IX Item "read_part_content($Part, $nbytes)" returns the first n bytes of the bodypart passed. This is a section of the bodystructure (hashref). If no part is passed, it's the raw message. .Sp If no 'nbytes' is passed, read the entire part. .IP "\fI\f(BIheader()\fI\fR" 4 .IX Item "header()" returns a Mail::Header object containing all the headers of the message. .IP "\fI\f(BIbodystructure()\fI\fR" 4 .IX Item "bodystructure()" returns a structure .Sp is a structure closely based on the \s-1IMAP BODYSTRUCTURE,\s0 decoded into a hash, including recursively all \s-1MIME\s0 sections. In general, the following items are defined for all body structures: .RS 4 .IP "\(bu" 4 MIME-Type .IP "\(bu" 4 MIME-Subtype .IP "\(bu" 4 Content-Type .IP "\(bu" 4 Content-Description .IP "\(bu" 4 Content-Disposition .IP "\(bu" 4 Content-Language .RE .RS 4 .Sp Body structures which have a MIME-Type of 'multipart' contain the following items: .IP "\(bu" 4 MIME-Subparts .RE .RS 4 .Sp For body structures \fBexcept\fR those that have a MIME-Type of \&'multipart', the following are defined: .IP "\(bu" 4 Content-ID .IP "\(bu" 4 Content-Description .IP "\(bu" 4 Content-Transfer-Encoding .IP "\(bu" 4 Content\-MD5 .IP "\(bu" 4 Size .IP "\(bu" 4 Lines .IP "\(bu" 4 Offset .IP "\(bu" 4 HeaderSize .RE .RS 4 .RE .IP "\fI\f(BIguid()\fI\fR" 4 .IX Item "guid()" returns the hex encoded (40 character) sha1 of the rfc822 representation. .IP "\fIhas_flag($name)\fR" 4 .IX Item "has_flag($name)" .PD 0 .IP "\fIset_flag($name)\fR" 4 .IX Item "set_flag($name)" .IP "\fIclear_flag($name)\fR" 4 .IX Item "clear_flag($name)" .PD Check for the boolean value of a flag with \f(CW$name\fR, set the flag and remove the flag respectively. .Sp Note that changes are not immediate. They will be applied by the annotator at the end. .Sp For example: .Sp .Vb 1 \& $message\->set_flag("\e\eFlagged"); .Ve .IP "\fIget_shared_annotation($entry)\fR" 4 .IX Item "get_shared_annotation($entry)" .PD 0 .IP "\fIget_private_annotation($entry)\fR" 4 .IX Item "get_private_annotation($entry)" .IP "\fIset_shared_annotation($entry, \f(CI$value\fI)\fR" 4 .IX Item "set_shared_annotation($entry, $value)" .IP "\fIset_private_annotation($entry, \f(CI$value\fI)\fR" 4 .IX Item "set_private_annotation($entry, $value)" .IP "\fIclear_shared_annotation($entry)\fR" 4 .IX Item "clear_shared_annotation($entry)" .IP "\fIclear_private_annotation($entry)\fR" 4 .IX Item "clear_private_annotation($entry)" .PD Get, set and clear the value of an annotation, either shared or private. The \&\*(L"get\*(R" accessors return a string with the value. Clear is the same as set with \f(CW$value\fR of the empty string (''). .Sp For example: .Sp .Vb 1 \& $message\->set_shared_annotation(\*(Aq/comment\*(Aq, \*(AqHello World\*(Aq); .Ve .IP "\fI\f(BIget_changed()\fI\fR" 4 .IX Item "get_changed()" returns two arrayrefs \- [['flagname', 'bool']] and [['entry', 'type', 'value']], e.g. .Sp [[\*(L"\e\eFlagged\*(R", 1]], [['/comment', 'value.shared', 'Hello World']] .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fI\s-1RFC3501\s0\fR, \fI\s-1RFC5257\s0\fR. .SH "AUTHOR" .IX Header "AUTHOR" Greg Banks . Bron Gondwana .