1Daemon(3) User Contributed Perl Documentation Daemon(3)
2
3
4
6 Cyrus::Annotator::Daemon - framework for writing annotator daemons for
7 Cyrus
8
10 use warnings;
11 use strict;
12 package MyAnnotatorDaemon;
13 use Cyrus::Annotator::Daemon;
14 our @ISA = qw(Cyrus::Annotator::Daemon);
15
16 sub annotate_message
17 {
18 my ($self, $message) = @_;
19
20 $message->set_flag('\Flagged');
21 $message->set_shared_annotation('/comment', 'Hello!!');
22 }
23
24 MyAnnotatorDaemon->run();
25
27 This module provides a framework for writing daemons which can be used
28 to add annotations or flags to messages which are delivered into the
29 Cyrus mail server.
30
31 To use Cyrus::Annotator::Daemon, write a Perl script which creates an
32 object derived from it; see the Synopsis above. Run this script as
33 root, and it will daemonize itself. Then add this line to the
34 imapd.conf file
35
36 annotation_callout: /var/run/annotatord.socket
37
38 and restart Cyrus.
39
41 Cyrus::Annotator::Daemon has the following methods.
42
43 run(...options...)
44 This class method can be used to create an instance of
45 Cyrus::Annotator::Daemon and to run it's main loop. Note that
46 Cyrus::Annotator::Daemon derives from Net::Server, and any of that
47 module's options can be used.
48
49 For example:
50
51 MyAnnotatorDaemon->run(personality => 'Fork');
52
53 Cyrus::Annotator::Daemon changes some of the Net::Server defaults,
54 including:
55
56 • Logging is to syslog using facility local6.
57
58 • The network socket is a SOCK_STREAM UNIX domain socket bound to
59 /var/run/annotatord.socket.
60
61 • A PID file is written to /var/run/annotatord.pid.
62
63 • The daemon runs in the background, as user cyrus and group
64 mail.
65
66 annotate_message($message)
67 You need to provide a method of this name. It will be called
68 whenever Cyrus notifies the annotator daemon that a new message is
69 available, and may set or clear any flags (system or user flags) or
70 annotations. Note that to set any annotations which aren't builtin
71 to Cyrus, you will first need to configure them using
72 annotation_definitions option in the imapd.conf file.
73
74 The $message object is a Cyrus::Annotator::Message which can be
75 examined, and on which flags and annotations can be set.
76
78 Net::Server, imapd.conf(5), RFC3501, RFC5257.
79
81 Greg Banks <gnb@fastmail.fm>.
82
83
84
85perl v5.36.0 2023-01-22 Daemon(3)