.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 2024-03-18 "perl v5.38.2" "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 \fR\f(BIfh()\fR\fI\fR 4 .IX Item "fh()" returns a read-only filehandle to the raw (rfc822) representation of the full message. .ie n .IP "\fIdecode_part($Part, \fR\fI$Content\fR\fI)\fR" 4 .el .IP "\fIdecode_part($Part, \fR\f(CI$Content\fR\fI)\fR" 4 .IX Item "decode_part($Part, $Content)" Given some content, decode it from the part's content encoding and charset. .ie n .IP "\fIread_part_content($Part, \fR\fI$nbytes\fR\fI)\fR" 4 .el .IP "\fIread_part_content($Part, \fR\f(CI$nbytes\fR\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 \fR\f(BIheader()\fR\fI\fR 4 .IX Item "header()" returns a Mail::Header object containing all the headers of the message. .IP \fR\f(BIbodystructure()\fR\fI\fR 4 .IX Item "bodystructure()" returns a structure .Sp is a structure closely based on the IMAP BODYSTRUCTURE, decoded into a hash, including recursively all MIME 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 \fR\f(BIguid()\fR\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)" .ie n .IP "\fIset_shared_annotation($entry, \fR\fI$value\fR\fI)\fR" 4 .el .IP "\fIset_shared_annotation($entry, \fR\f(CI$value\fR\fI)\fR" 4 .IX Item "set_shared_annotation($entry, $value)" .ie n .IP "\fIset_private_annotation($entry, \fR\fI$value\fR\fI)\fR" 4 .el .IP "\fIset_private_annotation($entry, \fR\f(CI$value\fR\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 "get" 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 \fR\f(BIget_changed()\fR\fI\fR 4 .IX Item "get_changed()" returns two arrayrefs \- [['flagname', 'bool']] and [['entry', 'type', 'value']], e.g. .Sp [["\e\eFlagged", 1]], [['/comment', 'value.shared', 'Hello World']] .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIRFC3501\fR, \fIRFC5257\fR. .SH AUTHOR .IX Header "AUTHOR" Greg Banks . Bron Gondwana .