<pre style='margin:0'>
Frank Schima (mf2k) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/514fa70ce1a9f00d4b8b8f8d4fc6f4879f815dc7">https://github.com/macports/macports-ports/commit/514fa70ce1a9f00d4b8b8f8d4fc6f4879f815dc7</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 514fa70ce1a9f00d4b8b8f8d4fc6f4879f815dc7
</span>Author: Steven Thomas Smith <s.t.smith@ieee.org>
AuthorDate: Mon Jan 20 07:56:43 2020 -0500
<span style='display:block; white-space:pre;color:#404040;'> dovecot: Rename dovecot2 to dovecot
</span>---
mail/dovecot/Portfile | 501 ++++++++++++++++---
mail/dovecot/files/dovecot-core-pushnotify.patch | 551 +++++++++++++++++++++
mail/dovecot/files/org.macports.dovecot-apns.plist | 21 +
mail/dovecot/files/org.macports.dovecot.plist | 21 +
...h-doc-example-config-conf.d-10-master.conf.diff | 15 +
.../files/patch-src-master-master-settings.c.diff | 27 +
mail/dovecot/files/pushnotify.pl | 198 ++++++++
7 files changed, 1255 insertions(+), 79 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/Portfile b/mail/dovecot/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index c0ea4e5..5b09080 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mail/dovecot/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,110 +1,453 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> PortSystem 1.0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup github 1.0
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+github.setup dovecot core 2.3.9.2
</span> name dovecot
<span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 0
</span> conflicts dovecot2
epoch 20060722
<span style='display:block; white-space:pre;background:#ffe0e0;'>-version 1.2.17
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-revision 2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set branch [join [lrange [split ${version} .] 0 1] .]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set core_version ${version}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> categories mail
<span style='display:block; white-space:pre;background:#ffe0e0;'>-license {MIT LGPL-2.1 BSD public-domain}
</span> maintainers {jberry @jdberry} openmaintainer
platforms darwin
<span style='display:block; white-space:pre;background:#e0ffe0;'>+license LGPL-2.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+homepage https://www.dovecot.org
</span>
description Secure, fast imap and pop3 server
<span style='display:block; white-space:pre;background:#ffe0e0;'>-long_description Dovecot is an IMAP and POP3 server for Linux/UNIX-like \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- systems, written with security primarily in mind. Although \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- it's written in C, it uses several coding techniques to \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description Dovecot is an IMAP and POP3 server for Linux/UNIX-like\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ systems, written with security primarily in mind. Although\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ it is written in C, it uses several coding techniques to\
</span> avoid most of the common pitfalls.
<span style='display:block; white-space:pre;background:#ffe0e0;'>-homepage http://dovecot.org/
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-master_sites ${homepage}releases/${branch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 abd637ff84bb1196f6729d767259499f2094f4b0 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 574c9fc64932f5eb52563743848f84e692eedc1f92e26a7bad680aac61dde0e0 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 3712754
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport ${name}-sieve {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ github.setup dovecot pigeonhole 0.5.9
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ revision 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description Pigeonhole sieve and managesieve plugins for dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ long_description \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Pigeonhole is the name of the project that adds\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ support for the Sieve language (RFC 5228) and the\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ManageSieve protocol (RFC 5804) to the Dovecot\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Secure IMAP Server. The Sieve language is used to\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ specify how e-mail needs to be processed. By\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writing Sieve scripts, users can customize how\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ messages are delivered, e.g. whether they are\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ forwarded or stored in special folders. Unwanted\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ messages can be discarded or rejected, and, when\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ the user is not available, the Sieve interpreter\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ can send an automated reply. Above all, the Sieve\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ language is meant to be simple, extensible and\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system independent. And, unlike most other mail\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ filtering script languages, it does not allow\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ users to execute arbitrary programs. This is\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ particularly useful to prevent virtual users from\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ having full access to the mail store. The\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ intention of the language is to make it impossible\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ for users to do anything more complex (and\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dangerous) than write simple mail filters. Using\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ the ManageSieve protocol, users can upload their\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Sieve scripts remotely, without needing direct\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ filesystem access through FTP or\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ SCP. Additionally, a ManageSieve server always\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ makes sure that uploaded scripts are valid,\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ preventing compile failures at mail delivery. The\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Pigeonhole project provides Sieve support as a\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plugin to Dovecot's Local Delivery Agent\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (LDA). The ManageSieve protocol is provided is an\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ additional service, next to Dovecot's own POP3 and\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ IMAP services.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ homepage https://pigeonhole.dovecot.org/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ distname dovecot-${core_version}-pigeonhole-${version}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ checksums rmd160 c8dee5dbf2a138a918ccc59ce0c8973e3f391bb5 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 42a4afcd8a7a0528f5f78b4224eb4ea1766cd54311c5b6fccdb825b3fe419b5c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 1043529
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:${name} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:gettext \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:mercurial
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Note: https://trac.macports.org/ticket/58544#comment:11 for this build logic
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ use_autoreconf yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ autoreconf.cmd ./autogen.sh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:autoconf \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:automake \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libtool
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.ldflags-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -L${prefix}/lib/dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args --with-managesieve=yes \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --disable-dependency-tracking
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set perl5_major_version \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 5.28
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${name} eq ${subport}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:gettext \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:pkgconfig \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:wget
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-checksums sha1 457b16791a15e739c6bc8b02bc9c78f9ad794e39 \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- rmd160 59f619dba2aadef3cccd6ceb045a2e75a11700a2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:bzip2 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libiconv \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ path:lib/libssl.dylib:openssl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:xz \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:zlib
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-depends_build port:pkgconfig
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-depends_lib port:libiconv \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- port:zlib \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- path:lib/libssl.dylib:openssl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set default_internal_user _dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set default_login_user _dovenull
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_users ${default_internal_user} group=${default_internal_user} realname=Dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_users ${default_login_user} group=${default_login_user} realname=Dovenull
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-configure.args --sysconfdir=${prefix}/etc/dovecot \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch.pre_args -p1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles patch-doc-example-config-conf.d-10-master.conf.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patch-src-master-master-settings.c.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@@default_internal_user@@|${default_internal_user}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/doc/example-config/conf.d/10-master.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@@default_login_user@@|${default_login_user}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/doc/example-config/conf.d/10-master.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Note: https://trac.macports.org/ticket/58544#comment:11 for this build logic
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ use_autoreconf yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ autoreconf.cmd ./autogen.sh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:autoconf \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:automake \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libtool
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pre-configure {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # the line `dummy < /dev/tty` breaks this; just copy the necessary file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # system -W ${worksrcpath} "gettextize -f"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -W ${worksrcpath} ${prefix}/share/gettext/config.rpath .
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args --sysconfdir=${prefix}/etc \
</span> --localstatedir=${prefix}/var \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- --with-ioloop=kqueue \
</span> --with-ssl=openssl \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- --with-ssldir=${prefix}/etc/ssl \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- --enable-header-install
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-zlib \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-bzlib \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-ssldir=${prefix}/etc/openssl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-shared-libs \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-pam \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --with-gssapi=yes
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-configure.cppflags -I${prefix}/include/openssl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cppflags -I${prefix}/include/openssl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PANDOC=false
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Create the dovecot user and group
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-add_users dovecot group=dovecot realname=Dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant ldap description {Enable LDAP support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:openldap
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-ldap=yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql80 conflicts postgresql81 postgresql82 postgresql83 postgresql84 postgresql90 postgresql91 description {Enable PostgreSQL 8.0 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql80
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql80
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql80
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant solr description {Enable apache-solr support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:clucene port:curl port:expat
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append port:apache-solr8
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-solr --with-lucene
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql81 conflicts postgresql80 postgresql82 postgresql83 postgresql84 postgresql90 postgresql91 description {Enable PostgreSQL 8.1 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql81
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql81
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql81
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant lucene description {Enable lucene support} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:clucene
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-lucene
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql82 conflicts postgresql80 postgresql81 postgresql83 postgresql84 postgresql90 postgresql91 description {Enable PostgreSQL 8.2 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql82
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql82
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql82
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant libstemmer description {Use libstemmer for full-text search} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:libstemmer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-libstemmer
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql83 conflicts postgresql80 postgresql81 postgresql82 postgresql84 postgresql90 postgresql91 description {Enable PostgreSQL 8.3 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql83
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql83
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql83
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant apns \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable Apple Push Notification Service (APNS)" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # diff -Naur core-2.3.7.1 core-2.3.7.1-pushnotify | sed -E -e 's/core-([[:digit:]]+\.?)+(-pushnotify)?\//.\//g' > dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/src/imap/cmd-x-apple-push-service.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/src/plugins/push-notify/push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:perl${perl5_major_version} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5_major_version}-net-apns-persistent \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5_major_version}-privileges-drop
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pre-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0750 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -o ${default_internal_user} -g ${default_login_user} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/db/${name}-apns/devices \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.keepdirs-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/db/${name}-apns/devices \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 ${filespath}/pushnotify.pl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/sbin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach cmd [list \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@PERL5_MAJOR_VERSION@|${perl5_major_version}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@DEFAULT_INTERNAL_USER@|${default_internal_user}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace ${cmd} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/sbin/pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql84 conflicts postgresql80 postgresql81 postgresql82 postgresql83 postgresql90 postgresql91 description {Enable PostgreSQL 8.4 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql84
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql84
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql84
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # References:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # * https://github.com/matthewpowell/pushnotify
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # * https://www.c0ffee.net/blog/dovecot-push-notifications/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notes-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "Dovecot is configured with the Apple Push Notification Service (APNS)\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plugin. APNS use requires these steps:
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql90 conflicts postgresql80 postgresql81 postgresql82 postgresql83 postgresql84 postgresql91 description {Enable PostgreSQL 9.0 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql90
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql90
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql90
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1. Acquire APNS Mail certificates from a (virtual) macOS\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ High Sierra 10.13 and Server.app version 5.6. Export\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ the certificates from the Keychain into the file\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.servermgrd.apns.mail.p12 . *Note*: APNS Mail\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ certificate creation is deprecated on Server.app version 5.7+.
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant postgresql91 conflicts postgresql80 postgresql81 postgresql82 postgresql83 postgresql84 postgresql90 description {Enable PostgreSQL 9.1 support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:postgresql91
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/postgresql91
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/postgresql91
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 2. Convert the APNS Mail certificates to PEM files:
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant mysql5 description {Enable MySQL support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append path:bin/mysql_config5:mysql5
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.ldflags-append -L${prefix}/lib/mysql5/mysql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.cppflags-append -I${prefix}/include/mysql5/mysql
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl pkcs12 -in com.apple.servermgrd.apns.mail.p12 \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -clcerts -nokeys | sed '/BEGIN CERTIFICATE/,\$!d' \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ > com.apple.mail.cert.pem
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo install -m 0644 -o ${default_internal_user} -g ${default_login_user} \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.mail.cert.pem ${prefix}/etc/dovecot-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl pkcs12 -in com.apple.servermgrd.apns.mail.p12 \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -nodes -nocerts | sed '/BEGIN PRIVATE KEY/,\$!d' \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ > com.apple.mail.key.pem
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo install -m 0640 -o ${default_internal_user} -g ${default_login_user} \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.mail.key.pem ${prefix}/etc/dovecot-apns
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-variant ldap description {Enable LDAP support} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-ldap
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_lib-append port:openldap
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 3. Configure dovecot for APNS:
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-startupitem.create yes
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-startupitem.executable ${prefix}/sbin/dovecot
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-startupitem.pidfile auto ${prefix}/var/run/dovecot/master.pid
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/${name}/conf.d/15-lda.conf:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ protocol lda { mail_plugins = \$mail_plugins push_notify }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-livecheck.type regex
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-livecheck.url ${homepage}download.html
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-livecheck.regex "${name}-(${branch}\\.\\d+(\\.\\d+)?)${extract.suffix}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/${name}/conf.d/90-apns.conf:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps_topic = com.apple.mail.XServer.<UUID>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ where the certificate's UUID is obtained from the command:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl x509 -text -noout \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -in ${prefix}/etc/dovecot-apns/com.apple.mail.cert.pem \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ | grep -E -o 'com\.apple\.mail\.XServer\.\[0-9a-f-\]+'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 4. Launch the APNS daemon:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo launchctl load -w \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /Library/LaunchDaemons/org.macports.dovecot-apns.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 postgresql91 postgresql92 postgresql93 postgresql94 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql95 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.6 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql96
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql96/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql95 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 postgresql91 postgresql92 postgresql93 postgresql94 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.5 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql95
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql95/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql94 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 postgresql91 postgresql92 postgresql93 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.4 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql94
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql94/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql93 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 postgresql91 postgresql92 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.3 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql93
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql93/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql92 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 postgresql91 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.2 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql92
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql92/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql91 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql90 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql92 postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.1 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql91
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql91/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql90 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql91 postgresql92 postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 9.0 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql90
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql90/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql83 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql91 postgresql92 postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 8.4 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql84
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql84/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql83 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql82 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql91 postgresql92 postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 8.3 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql83
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql83/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant postgresql82 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts postgresql83 postgresql84 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ postgresql91 postgresql92 postgresql93 postgresql94 postgresql95 postgresql96 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable PostgreSQL 8.2 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql82
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append PG_CONFIG=${prefix}/lib/postgresql82/bin/pg_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql5 mysql51 mysql55 mysql56 mariadb \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable Percona (MySQL) support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:percona
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/percona/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant mariadb \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql5 mysql51 mysql55 mysql56 percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable MariaDB (MySQL) support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:mariadb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/mariadb/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant mysql56 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql5 mysql51 mysql55 mariadb percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable MySQL 5.6 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:mysql56
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/mysql56/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant mysql55 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql5 mysql51 mysql56 mariadb percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable MySQL 5.5 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:mysql55
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/mysql55/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant mysql51 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql5 mysql55 mysql56 mariadb percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable MySQL 5.1 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:mysql51
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/mysql51/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant mysql5 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ conflicts mysql51 mysql55 mysql56 mariadb percona \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable MySQL 5.1 support" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:mysql5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.env-append MYSQL_CONFIG=${prefix}/lib/mysql5/bin/mysql_config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant no_startupitem description {Do not install a launchd plist} {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![variant_isset "no_startupitem"]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![variant_isset "apns"]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.create yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.executable ${prefix}/sbin/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.pidfile auto ${prefix}/var/run/${name}/master.pid
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set daemon_uniquename \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ org.macports.${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set pushnotify_uniquename \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ org.macports.${name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.type launchd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.create no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Inject our own launchd plists to include pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitems \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ name ${name} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ location LaunchDaemons \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uniquename ${daemon_uniquename} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plist ${daemon_uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ name ${name}-apns \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ location LaunchDaemons \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uniquename ${pushnotify_uniquename} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plist ${pushnotify_uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach uniquename "${daemon_uniquename} ${pushnotify_uniquename}" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 644 -W ${filespath} ${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons/${uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons/${uniquename}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ move ${destroot}/Library/LaunchDaemons/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons/${uniquename}/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${startupitem.install} && [geteuid] == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -s \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/LaunchDaemons/${uniquename}/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -s \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/LaunchDaemons/${uniquename}/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.keepdirs \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/dovecot-core-pushnotify.patch b/mail/dovecot/files/dovecot-core-pushnotify.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..6d33e9a
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,551 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./configure.ac ./configure.ac
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./configure.ac 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./configure.ac 2019-10-10 05:40:20.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -911,6 +911,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/notify/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/notify-status/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/push-notification/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++src/plugins/push-notify/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/pop3-migration/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/quota/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/quota-clone/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/auth/auth-settings.c ./src/auth/auth-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/auth/auth-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/auth/auth-settings.c 2019-10-08 18:37:33.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -269,6 +269,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEFLIST(passdbs, "passdb", &auth_passdb_setting_parser_info),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEFLIST(userdbs, "userdb", &auth_userdb_setting_parser_info),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF_NOPREFIX(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_STR, base_dir),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_BOOL, verbose_proctitle),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_UINT, first_valid_uid),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -331,6 +333,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .passdbs = ARRAY_INIT,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .userdbs = ARRAY_INIT,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .base_dir = PKG_RUNDIR,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .verbose_proctitle = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .first_valid_uid = 500,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/auth/auth-settings.h ./src/auth/auth-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/auth/auth-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/auth/auth-settings.h 2019-10-08 17:51:20.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -82,6 +82,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ARRAY(struct auth_passdb_settings *) passdbs;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ARRAY(struct auth_userdb_settings *) userdbs;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *base_dir;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *ssl_client_ca_dir;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *ssl_client_ca_file;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/Makefile.am ./src/imap/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/Makefile.am 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/Makefile.am 2019-10-08 20:40:24.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -64,6 +64,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-unselect.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-unsubscribe.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-urlfetch.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ cmd-x-apple-push-service.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-x-cancel.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-x-state.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/cmd-x-apple-push-service.c ./src/imap/cmd-x-apple-push-service.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/cmd-x-apple-push-service.c 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/cmd-x-apple-push-service.c 2019-10-10 06:22:12.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,173 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Copyright (c) 2010-2011 Apple Inc. All rights reserved.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * modification, are permitted provided that the following conditions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * are met:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 2. Redistributions in binary form must reproduce the above
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * copyright notice, this list of conditions and the following
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * disclaimer in the documentation and/or other materials provided
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * with the distribution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * contributors may be used to endorse or promote products derived
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * from this software without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * SUCH DAMAGE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-common.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-id.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "str.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "home-expand.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-user.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-quote.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <stdio.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <fcntl.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <stdlib.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <unistd.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/un.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/stat.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/socket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define APS_VERSION "1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef struct msg_data_s {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long msg;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long pid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d1[128];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d2[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d3[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d4[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} msg_data_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ tag1 XAPPLEPUSHSERVICE "aps-version" "1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-account-id" "E8CD34AD-98D3-4489-A6BB-86B1D082FECE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-device-token" "a66216ad1683d48b9933cdcc3b98a833ee1a968143f41ea494187da54715da66"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-subtopic" "com.apple.mobilemail"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++*/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void do_notify(const char *username, const char *aps_acct_id,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_dev_token, const char *aps_sub_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *push_notify_path = "@PREFIX@/var/run/dovecot/push_notify";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data_t msg_data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset(&msg_data, 0, sizeof(struct msg_data_s));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data.msg = 2;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d1, username, sizeof(msg_data.d1));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d2, aps_acct_id, sizeof(msg_data.d2));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d3, aps_dev_token, sizeof(msg_data.d3));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d4, aps_sub_topic, sizeof(msg_data.d4));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int soc = socket( AF_UNIX, SOCK_DGRAM, 0 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( soc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "open notify socket failed(%d): %m", soc );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct sockaddr_un sock_addr;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset( &sock_addr, 0, sizeof(struct sockaddr_un));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_addr.sun_family = AF_UNIX;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( sock_addr.sun_path, push_notify_path, sizeof(sock_addr.sun_path) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ socklen_t sock_len = sizeof(sock_addr.sun_family) + strlen(sock_addr.sun_path) + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int rc = connect(soc, (struct sockaddr *) &sock_addr, sock_len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning("connect to notify socket %s failed: %m",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notify_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(soc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = send(soc, (void *)&msg_data, sizeof(msg_data), 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning("send to notify socket %s failed: %m",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notify_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(soc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static const char *aps_reply_generate (struct client_command_context *cmd,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const struct imap_arg *args)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic = cmd->client->set->aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_ver=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_acct_id=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_dev_token=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_sub_topic=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *key, *value;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* must have a topic */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (aps_topic == NULL || *aps_topic == '\0')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* scarf off the aps keys/values */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ while (imap_arg_get_astring(&args[0], &key) &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_arg_get_astring(&args[1], &value)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (strcasecmp(key, "aps-version") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_ver = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-account-id") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_acct_id = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-device-token") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_dev_token = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-subtopic") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_sub_topic = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ args += 2;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* save notification settings */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( aps_ver && aps_acct_id && aps_dev_token && aps_sub_topic ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* subscribe to notification node */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ do_notify(cmd->client->user->username, aps_acct_id,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_dev_token, aps_sub_topic);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* generate aps response */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ string_t *str = t_str_new(256);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, "aps-version" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, APS_VERSION );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, "aps-topic" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, aps_topic );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return str_c(str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++bool cmd_x_apple_push_service(struct client_command_context *cmd)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const struct imap_arg *args;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!client_read_args(cmd, 0, 0, &args))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return FALSE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *reply = aps_reply_generate(cmd, args);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (reply != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ client_send_line(cmd->client,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ t_strdup_printf("* XAPPLEPUSHSERVICE %s",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ reply));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ client_send_tagline(cmd, "OK XAPPLEPUSHSERVICE completed.");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return TRUE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-client.c ./src/imap/imap-client.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-client.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-client.c 2019-10-08 20:42:59.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -182,6 +182,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ a chance of working */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client_add_capability(client, "SEARCH=FUZZY");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (set->aps_topic != NULL && *set->aps_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append(client->capability_string, " XAPPLEPUSHSERVICE");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_set = mail_user_set_get_storage_set(user);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (mail_set->mailbox_list_index) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-commands.c ./src/imap/imap-commands.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-commands.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-commands.c 2019-10-08 20:15:39.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -76,6 +76,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UID SORT", cmd_sort, COMMAND_FLAG_BREAKS_SEQS },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UID THREAD", cmd_thread, COMMAND_FLAG_BREAKS_SEQS },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UNSELECT", cmd_unselect, COMMAND_FLAG_BREAKS_MAILBOX },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ { "XAPPLEPUSHSERVICE", cmd_x_apple_push_service, 0},
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "X-CANCEL", cmd_x_cancel, 0 },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "X-STATE", cmd_x_state, COMMAND_FLAG_REQUIRES_SYNC },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "XLIST", cmd_list, 0 },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-commands.h ./src/imap/imap-commands.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-commands.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-commands.h 2019-10-08 20:16:48.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -121,6 +121,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_uid_expunge(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_move(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_unselect(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++bool cmd_x_apple_push_service(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_x_cancel(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_x_state(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-settings.c ./src/imap/imap-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-settings.c 2019-10-08 17:57:36.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -73,6 +73,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_logout_format),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_send),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_log),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_ENUM, imap_fetch_failure),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_metadata),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_literal_minus),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -101,6 +102,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "body_count=%{fetch_body_count} body_bytes=%{fetch_body_bytes}",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_send = "name *",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_log = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_fetch_failure = "disconnect-immediately:disconnect-after:no-after",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_metadata = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_literal_minus = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-settings.h ./src/imap/imap-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-settings.h 2019-10-08 17:48:14.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_logout_format;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_send;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_log;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_fetch_failure;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_metadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_literal_minus;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-client.c ./src/imap-login/imap-login-client.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-client.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-client.c 2019-10-11 08:28:49.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -117,6 +117,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ str_append(cap_str, " STARTTLS");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (is_login_cmd_disabled(client))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ str_append(cap_str, " LOGINDISABLED");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (*imap_client->set->aps_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append(cap_str, " XAPPLEPUSHSERVICE");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client_authenticate_get_capabilities(client, cap_str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return str_c(cap_str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-settings.c ./src/imap-login/imap-login-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-settings.c 2019-10-08 18:33:32.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -57,6 +57,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_capability),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_send),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_log),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_literal_minus),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_id_retain),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -67,6 +68,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_capability = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_send = "name *",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_log = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_literal_minus = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_retain = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-settings.h ./src/imap-login/imap-login-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-settings.h 2019-10-08 17:49:33.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -5,6 +5,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_capability;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_send;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_log;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_literal_minus;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_id_retain;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/lib-lda/mail-deliver.c ./src/lib-lda/mail-deliver.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/lib-lda/mail-deliver.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/lib-lda/mail-deliver.c 2019-10-11 08:16:28.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deliver_mail_func_t *deliver_mail = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++deliver_hook_func_t *deliver_hook = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct mail_deliver_cache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool filled;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -409,6 +410,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_log(ctx, "saved mail to %s", mailbox_name);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pool_unref(&changes.pool);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (deliver_hook != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_log(ctx, "save failed to %s: %s", mailbox_name,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_storage_get_last_internal_error(*storage_r, &error));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -503,6 +507,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* success. message may or may not have been saved. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!ret && deliver_hook)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook(ctx, ctx->rcpt_default_mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_duplicate_db_deinit(&ctx->dup_db);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (ret < 0 && mail_deliver_is_tempfailed(ctx, *storage_r)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ muser->deliver_ctx = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/lib-lda/mail-deliver.h ./src/lib-lda/mail-deliver.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/lib-lda/mail-deliver.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/lib-lda/mail-deliver.h 2019-10-08 20:50:00.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -82,6 +82,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct mail_storage **storage_r);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ extern deliver_mail_func_t *deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef void deliver_hook_func_t(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++extern deliver_hook_func_t *deliver_hook;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const struct var_expand_table *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_ctx_get_log_var_expand_table(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/Makefile.am ./src/plugins/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/Makefile.am 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/Makefile.am 2019-10-11 05:56:16.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notify \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notify-status \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push-notification \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail-filter \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail-log \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $(MAIL_LUA) \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/Makefile.am ./src/plugins/push-notify/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/Makefile.am 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/Makefile.am 2019-10-11 08:48:43.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,25 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++AM_CPPFLAGS = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-lda \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-mail \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-smtp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-storage
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++NOPLUGIN_LDFLAGS =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++lib20_push_notify_plugin_la_LDFLAGS = -module -avoid-version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++module_LTLIBRARIES = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ lib20_push_notify_plugin.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if DOVECOT_PLUGIN_DEPS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++notify_deps = ../notify/lib15_notify_plugin.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++lib20_push_notify_plugin_la_SOURCES = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++headers = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify-plugin.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++pkginc_libdir = $(pkgincludedir)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++pkginc_lib_HEADERS = $(headers)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/push-notify-plugin.c ./src/plugins/push-notify/push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/push-notify-plugin.c 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/push-notify-plugin.c 2019-10-11 09:06:31.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,102 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/* Copyright (c) 2008-2011 Apple, inc. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "lib.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-deliver.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-namespace.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "message-address.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "push-notify-plugin.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/un.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/stat.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/socket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/unistd.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++const char *push_notify_plugin_version = DOVECOT_ABI_VERSION;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static deliver_hook_func_t *next_deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct et_list *_et_list = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct message_info {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *from;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *subj;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// -----------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// push_notification ()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++push_notification(struct mail_deliver_context *ctx, const char *mailbox)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int debug = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int notify_sock = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *sock_path = "@PREFIX@/var/run/dovecot/push_notify";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ssize_t rc = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ socklen_t sock_len = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct sockaddr_un sock_addr;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct msg_data_s msg_data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (ctx->rcpt_user->mail_debug) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ debug = 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: push notification enabled" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( strcasecmp(mailbox, "INBOX") != 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: message saved to mailbox: %s, no notification sent", mailbox );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ notify_sock = socket( AF_UNIX, SOCK_DGRAM, 0 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( notify_sock < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* warn that connect failed but do not fail the plugin or message will not get delivered */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: open socket: \"%s\" failed", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_addr.sun_family = AF_UNIX;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( sock_addr.sun_path, "@PREFIX@/var/run/dovecot/push_notify", sizeof(sock_addr.sun_path) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_len = sizeof(sock_addr.sun_family) + strlen(sock_addr.sun_path) + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = connect(notify_sock, (struct sockaddr *) &sock_addr, sock_len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* warn that connect failed but do not fail the plugin or message will not get delivered */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: connect() to socket: \"%s\" failed: %m", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset( &msg_data, 0, sizeof( msg_data ) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data.msg = 3;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* set user/account id */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( ctx->rcpt_user->username != NULL ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( msg_data.d1, ctx->rcpt_user->username, sizeof(msg_data.d1) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (debug)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: notify: %s", msg_data.d1 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = send(notify_sock, (void *)&msg_data, sizeof(struct msg_data_s), 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: send() to socket: \"%s\" failed: %m", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (debug)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info("push-notify: data sent: %lu", rc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(notify_sock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} // push_notification
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void push_notify_deliver(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *mailbox)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notification(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (next_deliver_mail != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ next_deliver_mail(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_init (struct module *module ATTR_UNUSED)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ next_deliver_mail = deliver_hook;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook = push_notify_deliver;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_deinit (void)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook = next_deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/push-notify-plugin.h ./src/plugins/push-notify/push-notify-plugin.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/push-notify-plugin.h 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/push-notify-plugin.h 2019-10-08 20:53:46.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,20 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/* Copyright (c) 2008-2011 Apple, inc. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifndef __NOTIFY_PLUGIN_H__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define __NOTIFY_PLUGIN_H__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct module;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_init(struct module *module);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_deinit(void);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef struct msg_data_s {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long msg;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long pid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d1[128];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d2[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d3[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d4[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} msg_data_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/org.macports.dovecot-apns.plist b/mail/dovecot/files/org.macports.dovecot-apns.plist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..8c63e20
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/org.macports.dovecot-apns.plist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<?xml version='1.0' encoding='UTF-8'?>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<plist version='1.0'>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Label</key><string>org.macports.dovecot-apns</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>ProgramArguments</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/bin/daemondo</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--label=dovecot-apns</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--start-cmd</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/sbin/pushnotify.pl</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>;</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pid=exec</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pidfile</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/var/run/dovecot/pushnotify.pid</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Disabled</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>KeepAlive</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</plist>
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/org.macports.dovecot.plist b/mail/dovecot/files/org.macports.dovecot.plist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..e103d08
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/org.macports.dovecot.plist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<?xml version='1.0' encoding='UTF-8'?>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<plist version='1.0'>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Label</key><string>org.macports.dovecot</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>ProgramArguments</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/bin/daemondo</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--label=dovecot</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--start-cmd</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/sbin/dovecot</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>;</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pid=fileauto</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pidfile</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/var/run/dovecot/master.pid</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Disabled</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>KeepAlive</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</plist>
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/patch-doc-example-config-conf.d-10-master.conf.diff b/mail/dovecot/files/patch-doc-example-config-conf.d-10-master.conf.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..a078102
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/patch-doc-example-config-conf.d-10-master.conf.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,15 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/doc/example-config/conf.d/10-master.conf 2012-04-28 08:50:58.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/doc/example-config/conf.d/10-master.conf 2012-04-28 08:50:43.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -9,10 +9,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Login user is internally used by login processes. This is the most untrusted
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # user in Dovecot system. It shouldn't have access to anything at all.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #default_login_user = dovenull
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++default_login_user = @@default_login_user@@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Internal user is used by unprivileged processes. It should be separate from
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # login user, so that login processes can't disturb other processes.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #default_internal_user = dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++default_internal_user = @@default_internal_user@@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ service imap-login {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ inet_listener imap {
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/patch-src-master-master-settings.c.diff b/mail/dovecot/files/patch-src-master-master-settings.c.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..89f0282
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/patch-src-master-master-settings.c.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,27 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/master/master-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/master/master-settings.c 2019-05-26 23:25:08.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -209,9 +209,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .protocols = "imap pop3 lmtp",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .listen = "*, ::",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .ssl = "yes:no:required",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- .default_internal_user = "dovecot",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- .default_internal_group = "dovecot",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- .default_login_user = "dovenull",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .default_internal_user = "_dovecot",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .default_internal_group = "_dovenull",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .default_login_user = "_dovenull",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .default_process_limit = 100,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .default_client_limit = 1000,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .default_idle_kill = 60,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -222,7 +222,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .first_valid_uid = 500,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .last_valid_uid = 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .first_valid_gid = 1,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- .last_valid_gid = 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* macOS: `last_valid_gid = 100` to avoid the error */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* imap: Fatal: setgroups(501) failed: Too many extra groups */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* https://www.systemcodegeeks.com/mac-os/macos-dovecot-setgroups-failed/ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .last_valid_gid = 100,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifndef CONFIG_BINARY
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .services = ARRAY_INIT
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot/files/pushnotify.pl b/mail/dovecot/files/pushnotify.pl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..4b72b4d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot/files/pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,198 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!@PREFIX@/bin/perl@PERL5_MAJOR_VERSION@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use strict;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use warnings;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Privileges::Drop;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Getopt::Long;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use IO::Socket::UNIX qw( SOCK_DGRAM SOMAXCONN );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Sys::Syslog qw( openlog syslog LOG_INFO );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Net::APNS::Persistent;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Net::APNS::Feedback;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Dovecot's push notification socket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $sockpath = '@PREFIX@/var/run/dovecot/push_notify';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# user to drop privileges to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $user = '@DEFAULT_INTERNAL_USER@';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# A file containing registration information
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $devicepath = '@PREFIX@/var/db/dovecot-apns/devices';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# APNS certificate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns_cert = '@PREFIX@/etc/dovecot-apns/com.apple.mail.cert.pem';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# APNS key (might be the same as $apns_cert)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns_key = '@PREFIX@/etc/dovecot-apns/com.apple.mail.key.pem';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $help;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub usage {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<<"EOF";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+$0 [arguments]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Arguments:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --user <unprivileged_user> (default $user)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --tokendb <devices_file> (default $devicepath)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --certfile <apns_certificate> (default $apns_cert)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --keyfile <apns_privkey> (default $apns_key)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --help
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+EOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GetOptions('user=s' => \$user,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'tokendb=s' => \$devicepath,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'certfile=s' => \$apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'keyfile=s' => \$apns_key,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'help' => \$help)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+or die usage;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if ($help) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ print usage;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Read in the list of registered devices.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my %devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if (open DEVICES, $devicepath) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+while (<DEVICES>) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ chomp;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($username, $devicedata) = split /:/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @{$devices{$username}}, $devicedata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+close DEVICES;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Open the socket to Dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+unlink $sockpath;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+umask (0111);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $socket = IO::Socket::UNIX->new(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Type => SOCK_DGRAM,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Local => $sockpath,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Listen => SOMAXCONN,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+or die("Can't create server socket: $!\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+drop_privileges($user);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+openlog ('apns', 'ndelay', 'mail');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# When we last checked the feedback service (right now, never).
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $last_feedback = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# When we last reconnected to APNS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $last_connect = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# We'll defer connecting to APNS until our first notification, but define $apns here
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+syslog (LOG_INFO, 'Dovecot APNS service running');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+while(1)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+$socket->recv($data, 2048);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $pretty = join('|', split(/\0+/, $data));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my ($junk, $username, $aps_acct_id, $aps_dev_token, $aps_sub_topic) = split /\0+/, $data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if ($aps_acct_id) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token = lc($aps_dev_token);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $devicedata = join ',', $aps_acct_id, $aps_dev_token, $aps_sub_topic, time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog (LOG_INFO, "Register device $aps_dev_token for $username");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Cancel any duplicate registration
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ @{$devices{$username}} = grep {!/$aps_dev_token/} @{$devices{$username}};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Register new device
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @{$devices{$username}}, $devicedata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (defined $devices{$username}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # User has at least one device registered
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Do the push notification
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($aps_acct_id, $aps_dev_token, $aps_sub_topic, $time) = split /,/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, "Send notification to $aps_dev_token for $username");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ eval {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ die if (time - $last_connect > 600);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->queue_notification (
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps => {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'account-id' => $aps_acct_id
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->send_queue;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } or do {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Failed; connect to APNS and try again
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, 'Connect to APNS push gateway');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $last_connect = time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ eval { $apns->disconnect };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns = Net::APNS::Persistent->new({
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sandbox => 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cert => $apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ key => $apns_key
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->queue_notification (
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps => {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'account-id' => $aps_acct_id
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->send_queue;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Check for devices that don't want notifications any more
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (time - $last_feedback > 3600) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, 'Check APNS feedback service');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $last_feedback = time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $apns_feedback = Net::APNS::Feedback->new({
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sandbox => 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cert => $apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ key => $apns_key
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback = $apns_feedback->retrieve_feedback;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns_feedback->disconnect;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (defined $feedback) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Got at least one value
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@$feedback) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback_token = lc($$_{token});
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback_time = $$_{time_t};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $username (keys %devices) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my @unregister;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($aps_acct_id, $aps_dev_token, $aps_sub_topic, $time) = split /,/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ($aps_dev_token eq $feedback_token && $time < $feedback_time) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Hasn't registered since the rejection; unregister
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @unregister, $feedback_token
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $token (@unregister) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, "Unregister device $token");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ @{$devices{$username}} = grep {!/$token/} @{$devices{$username}};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub save_devices {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Save our registration data
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ umask (0077);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ open DEVICES, ">$devicepath";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $username (keys %devices) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $devicedata (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ print DEVICES "$username:$devicedata\n";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close DEVICES;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span></pre><pre style='margin:0'>
</pre>