]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/IMAPD.pm
imap: support IDLE
[public-inbox.git] / lib / PublicInbox / IMAPD.pm
1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # represents an IMAPD (currently a singleton),
5 # see script/public-inbox-imapd for how it is used
6 package PublicInbox::IMAPD;
7 use strict;
8 use parent qw(PublicInbox::NNTPD);
9 use PublicInbox::InboxIdle;
10
11 sub new {
12         my ($class) = @_;
13         bless {
14                 groups => {},
15                 err => \*STDERR,
16                 out => \*STDOUT,
17                 grouplist => [],
18                 # accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
19                 # idler => PublicInbox::InboxIdle
20         }, $class;
21 }
22
23 sub refresh_groups {
24         my ($self) = @_;
25         if (my $old_idler = delete $self->{idler}) {
26                 $old_idler->close; # PublicInbox::DS::close
27         }
28         my $pi_config = PublicInbox::Config->new;
29         $self->{idler} = PublicInbox::InboxIdle->new($pi_config);
30         $self->SUPER::refresh_groups($pi_config);
31 }
32
33 1;