Message(3)

πŸ“¦ version 3.12.4, in nixos 26.05, nixpkgs unstable

πŸ’Œ Message(3) β€” Cyrus::Annotator::Message πŸ’Œ

okay so bestie, this page comes from the User Contributed Perl Documentation, and it's all about Message(3) a.k.a. the module Cyrus::Annotator::Message. no cap, we're keeping every single detail. ✨

πŸ“› NAME πŸ“›

Cyrus::Annotator::Message - representation of a message to annotate

🌸 SYNOPSIS 🌸

here's the vibe in code form, bestie:

use warnings;
use strict;
package MyAnnotatorDaemon;
use base Cyrus::Annotator::Daemon;

sub annotate_message
{
    my ($message) = @_;

    $message->set_flag('\Flagged');
    $message->set_shared_annotation('/comment', 'Hello!!');
}

MyAnnotatorDaemon->run();

πŸ¦‹ DESCRIPTION πŸ¦‹

This module encapsulates a message which is being processed by the annotator daemon. that's the whole plot, periodt. πŸ’…

πŸŽ€ METHODS πŸŽ€

Cyrus::Annotator::Message has the following methods.

new(%args)

Takes the following args:

# 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

fh()

returns a read-only filehandle to the raw (rfc822) representation of the full message. slay. 🫢

decode_part($Part, $Content)

Given some content, decode it from the part's content encoding and charset. literally its whole job. ✨

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.

If no 'nbytes' is passed, read the entire part.

returns a Mail::Header object containing all the headers of the message. iconic. πŸ‘‘

bodystructure()

returns a structure β€” and that structure is 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:

  • MIME-Type
  • MIME-Subtype
  • Content-Type
  • Content-Description
  • Content-Disposition
  • Content-Language

Body structures which have a MIME-Type of 'multipart' contain the following items:

  • MIME-Subparts

For body structures except those that have a MIME-Type of 'multipart', the following are defined:

  • Content-ID
  • Content-Description
  • Content-Transfer-Encoding
  • Content-MD5
  • Size
  • Lines
  • Offset
  • HeaderSize

guid()

returns the hex encoded (40 character) sha1 of the rfc822 representation. yes bestie, forty whole characters. πŸ“

has_flag($name), set_flag($name), clear_flag($name)

Check for the boolean value of a flag with $name, set the flag and remove the flag respectively.

⚠️ note that changes are not immediate. They will be applied by the annotator at the end.

For example:

$message->set_flag("\\Flagged");

get_shared_annotation($entry), get_private_annotation($entry), set_shared_annotation($entry, $value), set_private_annotation($entry, $value), clear_shared_annotation($entry), clear_private_annotation($entry)

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 $value of the empty string ('').

For example:

$message->set_shared_annotation('/comment', 'Hello World');

get_changed()

returns two arrayrefs - [['flagname', 'bool']] and [['entry', 'type', 'value']], e.g.

[["\\Flagged", 1]], [['/comment', 'value.shared', 'Hello World']]

πŸ”Ž SEE ALSO πŸ”Ž

RFC3501, RFC5257. iykyk, go read the lore. 🌈

πŸ‘‘ AUTHOR πŸ‘‘

Greg Banks <gnb@fastmail.fm>. Bron Gondwana <brong@fastmail.fm>.


okay bestie, that's the whole page. footer energy for the very end: source/version is perl v5.42.3, the date is 1980-01-01, and this iconic page is Message(3) β€” bye, love u, go annotate something legendary πŸ’–βœ¨

πŸ“¦ where this page comes from