diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2011-11-07 09:04:35 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2011-11-07 09:04:35 +0000 |
commit | 30f1ddf1f8459c98e8b0e2b73b0263f8173fba8a (patch) | |
tree | 89716aeb11e845183c2fbd272ff2da2c2bcabbef /testing | |
parent | dab2a3eaae74c39a1a259d944a66ea893741def0 (diff) | |
download | aports-30f1ddf1f8459c98e8b0e2b73b0263f8173fba8a.tar.bz2 aports-30f1ddf1f8459c98e8b0e2b73b0263f8173fba8a.tar.xz |
testing/dbmail: fix initd and add default config
Diffstat (limited to 'testing')
-rw-r--r-- | testing/dbmail/APKBUILD | 44 | ||||
-rw-r--r-- | testing/dbmail/dbmail-httpd.initd | 19 | ||||
-rw-r--r-- | testing/dbmail/dbmail-imapd.initd | 19 | ||||
-rw-r--r-- | testing/dbmail/dbmail-lmtpd.initd | 8 | ||||
-rw-r--r-- | testing/dbmail/dbmail-pop3d.initd | 19 | ||||
-rw-r--r-- | testing/dbmail/dbmail-timsieved.initd | 21 | ||||
-rw-r--r-- | testing/dbmail/dbmail.conf | 408 | ||||
-rw-r--r-- | testing/dbmail/dbmail.pre-install | 5 | ||||
-rw-r--r-- | testing/dbmail/post-rc3.patch | 306 |
9 files changed, 790 insertions, 59 deletions
diff --git a/testing/dbmail/APKBUILD b/testing/dbmail/APKBUILD index a160811901..bc5c0cad11 100644 --- a/testing/dbmail/APKBUILD +++ b/testing/dbmail/APKBUILD @@ -3,25 +3,28 @@ pkgname=dbmail _realpkgver=3.0.0-rc3 pkgver=${_realpkgver/-/_} -pkgrel=0 +pkgrel=1 pkgdesc="Fast and scalable sql based mail services" url="http://dbmail.org" arch="all" license="GPL" +pkgusers="dbmail" +pkggroups="dbmail" depends= depends_dev="openldap-dev libsieve-dev glib-dev gmime-dev mhash-dev libevent-dev libzdb-dev" makedepends="$depends_dev asciidoc xmlto automake autoconf" install="" -subpackages="$pkgname-doc" +subpackages="$pkgname-doc $pkgname-auth-ldap:auth_ldap" source="http://www.dbmail.org/download/3.0/dbmail-${_realpkgver}.tar.gz $pkgname-imapd.initd $pkgname-lmtpd.initd $pkgname-pop3d.initd $pkgname-httpd.initd $pkgname-timsieved.initd + $pkgname.pre-install post-rc3.patch - gmime-2.6.patch + dbmail.conf " _builddir="$srcdir/${pkgname}-${_realpkgver}" @@ -34,19 +37,21 @@ prepare() { *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done + # we need support for gmine 2.6 + sed -i 's/gmime-2.4/gmime-2.6/g' configure } build() { cd "$_builddir" - autoreconf ./configure --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --with-sieve \ - --with-ldap + --with-ldap \ + --disable-static make || return 1 - #make man pages + # make man pages cd "$_builddir/man" make || return 1 } @@ -55,7 +60,6 @@ package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 rm "$pkgdir"/usr/lib/dbmail/*.la || return 1 - install -Dm644 "$pkgname.conf" "$pkgdir/etc/$pkgname.conf.sample" mkdir -p "$pkgdir/usr/share/$pkgname" mv sql/* "$pkgdir/usr/share/$pkgname/" mv "$pkgname.schema" "$pkgdir/usr/share/$pkgname/" @@ -66,13 +70,25 @@ package() { #install man pages cd "$_builddir/man" make DESTDIR="$pkgdir" install || return 1 + install -m644 -D "$srcdir"/$pkgname.conf \ + "$pkgdir"/etc/$pkgname.conf || return 1 + install -dDo dbmail "$pkgdir"/var/run/dbmail || return 1 + install -dDo dbmail "$pkgdir"/var/lib/dbmail || return 1 +} + +auth_ldap() { + pkgdesc="$pkgname ldap authentication" + mkdir -p "$subpkgdir"/usr/lib/dbmail + mv "$pkgdir"/usr/lib/dbmail/libauth_ldap* \ + "$subpkgdir"/usr/lib/dbmail/ || return 1 } md5sums="52c3b9aad310efc90a6a2fff0552f73e dbmail-3.0.0-rc3.tar.gz -76a0f8f96ca70a4af14c81716134cc5d dbmail-imapd.initd -a6d79d7f0cf0fb80ef2ada71c25d9350 dbmail-lmtpd.initd -504dd74912daeea4268f8c25ddf6de0f dbmail-pop3d.initd -42ac86844fedf5d1afec764170e6a5de dbmail-httpd.initd -4253a7580d82e026ecbaf45ea863e9e7 dbmail-timsieved.initd -5e37f1190c8798edb450a40e97fe9a81 post-rc3.patch -5c2548b1a68393337c58856614a5f359 gmime-2.6.patch" +2f77092fade3b10123a47a5cce5b6a4a dbmail-imapd.initd +f3a84b58ba878375ca088a0b544922cc dbmail-lmtpd.initd +4273524211baefd9f32ea40ce9cb7dd1 dbmail-pop3d.initd +1bf891189a6daf14254738d28f3c654f dbmail-httpd.initd +4cd701bf1a8d292848fffe208afbe182 dbmail-timsieved.initd +f146703e0c8c9badc92de152ac6f1e5b dbmail.pre-install +f609d4cd01dbef95c6a1c498133a2065 post-rc3.patch +549f2073f1c6ac902f783b493c0667d4 dbmail.conf" diff --git a/testing/dbmail/dbmail-httpd.initd b/testing/dbmail/dbmail-httpd.initd index 832e64046d..2bda360b6d 100644 --- a/testing/dbmail/dbmail-httpd.initd +++ b/testing/dbmail/dbmail-httpd.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # -PIDFILE="/var/run/dbmail-httpd.pid" +PIDFILE="/var/run/dbmail/httpd.pid" depend() { need net @@ -11,23 +11,22 @@ depend() { } checkconfig() { - if [ ! -e "/etc/dbmail/dbmail.conf" ]; then - eerror "You need to create apropriate config" - eerror "in /etc/dbmail/ . Example can be found in /etc/dbmail/dbmail.conf.dist" - return 1 - fi - # Avoid using root's TMPDIR - unset TMPDIR + if [ ! -e "/etc/dbmail.conf" ]; then + eerror "You need to create apropriate config" + eerror "/etc/dbmail.conf" + return 1 + fi + # Avoid using root's TMPDIR + unset TMPDIR } - start() { checkconfig && \ ebegin "Starting DBMail HTTP daemon" start-stop-daemon --start --quiet \ --exec /usr/sbin/dbmail-httpd \ --name dbmail-httpd \ - -- -p ${PIDFILE} -f /etc/dbmail/dbmail.conf 2>&1 + -- -p ${PIDFILE} -f /etc/dbmail.conf 2>&1 eend $? } diff --git a/testing/dbmail/dbmail-imapd.initd b/testing/dbmail/dbmail-imapd.initd index 8f6984feb0..cd8ed89cd1 100644 --- a/testing/dbmail/dbmail-imapd.initd +++ b/testing/dbmail/dbmail-imapd.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # -PIDFILE="/var/run/dbmail-imapd.pid" +PIDFILE="/var/run/dbmail/imapd.pid" depend() { need net @@ -11,23 +11,22 @@ depend() { } checkconfig() { - if [ ! -e "/etc/dbmail/dbmail.conf" ]; then - eerror "You need to create apropriate config" - eerror "in /etc/dbmail/ . Example can be found in /etc/dbmail/dbmail.conf.dist" - return 1 - fi - # Avoid using root's TMPDIR - unset TMPDIR + if [ ! -e "/etc/dbmail.conf" ]; then + eerror "You need to create apropriate config" + eerror "/etc/dbmail.conf" + return 1 + fi + # Avoid using root's TMPDIR + unset TMPDIR } - start() { checkconfig && \ ebegin "Starting DBMail IMAP daemon" start-stop-daemon --start --quiet \ --exec /usr/sbin/dbmail-imapd \ --name dbmail-imapd \ - -- -p ${PIDFILE} -f /etc/dbmail/dbmail.conf 2>&1 + -- -p ${PIDFILE} -f /etc/dbmail.conf 2>&1 eend $? } diff --git a/testing/dbmail/dbmail-lmtpd.initd b/testing/dbmail/dbmail-lmtpd.initd index cea3da6dd8..38c0f552b2 100644 --- a/testing/dbmail/dbmail-lmtpd.initd +++ b/testing/dbmail/dbmail-lmtpd.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # -PIDFILE="/var/run/dbmail-lmtpd.pid" +PIDFILE="/var/run/dbmail/lmtpd.pid" depend() { need net @@ -11,9 +11,9 @@ depend() { } checkconfig() { - if [ ! -e "/etc/dbmail/dbmail.conf" ]; then + if [ ! -e "/etc/dbmail.conf" ]; then eerror "You need to create apropriate config" - eerror "in /etc/dbmail/ . Example can be found in /etc/dbmail/dbmail.conf.dist" + eerror "/etc/dbmail.conf" return 1 fi # Avoid using root's TMPDIR @@ -27,7 +27,7 @@ start() { start-stop-daemon --start --quiet \ --exec /usr/sbin/dbmail-lmtpd \ --name dbmail-lmtpd \ - -- -p ${PIDFILE} -f /etc/dbmail/dbmail.conf 2>&1 + -- -p ${PIDFILE} -f /etc/dbmail.conf 2>&1 eend $? } diff --git a/testing/dbmail/dbmail-pop3d.initd b/testing/dbmail/dbmail-pop3d.initd index 8c9e7b874a..3ceb12efec 100644 --- a/testing/dbmail/dbmail-pop3d.initd +++ b/testing/dbmail/dbmail-pop3d.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # -PIDFILE="/var/run/dbmail-pop3d.pid" +PIDFILE="/var/run/dbmail/pop3d.pid" depend() { need net @@ -11,23 +11,22 @@ depend() { } checkconfig() { - if [ ! -e "/etc/dbmail/dbmail.conf" ]; then - eerror "You need to create apropriate config" - eerror "in /etc/dbmail/ . Example can be found in /etc/dbmail/dbmail.conf.dist" - return 1 - fi - # Avoid using root's TMPDIR - unset TMPDIR + if [ ! -e "/etc/dbmail.conf" ]; then + eerror "You need to create apropriate config" + eerror "/etc/dbmail.conf" + return 1 + fi + # Avoid using root's TMPDIR + unset TMPDIR } - start() { checkconfig && \ ebegin "Starting DBMail POP3 daemon" start-stop-daemon --start --quiet \ --exec /usr/sbin/dbmail-pop3d \ --name dbmail-pop3d \ - -- -p ${PIDFILE} -f /etc/dbmail/dbmail.conf 2>&1 + -- -p ${PIDFILE} -f /etc/dbmail.conf 2>&1 eend $? } diff --git a/testing/dbmail/dbmail-timsieved.initd b/testing/dbmail/dbmail-timsieved.initd index 325badb29f..4c6414c2a5 100644 --- a/testing/dbmail/dbmail-timsieved.initd +++ b/testing/dbmail/dbmail-timsieved.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # -PIDFILE="/var/run/dbmail-timsieved.pid" +PIDFILE="/var/run/dbmail/timsieved.pid" depend() { need net @@ -10,23 +10,22 @@ depend() { after mta } -checkconfig() { - if [ ! -e "/etc/dbmail/dbmail.conf" ]; then - eerror "You need to create apropriate config" - eerror "in /etc/dbmail/ . Example can be found in /etc/dbmail/dbmail.conf.dist" - return 1 - fi - # Avoid using root's TMPDIR - unset TMPDIR +checkconfig() checkconfig() { + if [ ! -e "/etc/dbmail.conf" ]; then + eerror "You need to create apropriate config" + eerror "/etc/dbmail.conf" + return 1 + fi + # Avoid using root's TMPDIR + unset TMPDIR } - start() { checkconfig && \ ebegin "Starting DBMail SIEVE daemon" start-stop-daemon --start --quiet \ --exec /usr/sbin/dbmail-timsieved \ - -- -p ${PIDFILE} -f /etc/dbmail/dbmail.conf 2>&1 + -- -p ${PIDFILE} -f /etc/dbmail.conf 2>&1 eend $? } diff --git a/testing/dbmail/dbmail.conf b/testing/dbmail/dbmail.conf new file mode 100644 index 0000000000..fdcb7ac7c0 --- /dev/null +++ b/testing/dbmail/dbmail.conf @@ -0,0 +1,408 @@ + +# (c) 2000-2006 IC&S, The Netherlands +# +# Configuration file for DBMAIL + +[DBMAIL] +# +# Database settings +# + +# +# Supported drivers are mysql, postgresql, sqlite. +# +driver = sqlite + +# +# Supported drivers are sql, ldap. +# +authdriver = sql + +# +# Host for database, set to localhost if database is on +# the same host as dbmail and you want to use a local +# socket for connecting. +# +host = + +# +# If you want to use TCP/IP for connecting to the database, +# and have the database running on a non-standard port. +# +sqlport = + +# +# When using a local socket connection to the database, fill +# in the path to the socket here (e.g. /var/run/mysql.sock). +# +sqlsocket = + +# +# Database username. +# +user = dbmail + +# +# Database password. +# +pass = + +# +# Database name. +# +db = /var/lib/dbmail/dbmail.db + +# +# Number of database connections per threaded daemon +# This also determines the size of the worker threadpool +# +#max_db_connections = 10 + +# +# Table prefix. Defaults to "dbmail_" if not specified. +# +table_prefix = dbmail_ + +# +# encoding must match the database/table encoding. +# i.e. latin1, utf8 +encoding = utf8 + +# +# messages with unknown encoding will be assumed to have +# default_msg_encoding +# i.e. iso8859-1, utf8 +default_msg_encoding = utf8 + +# +# Postmaster's email address for use in bounce messages. +# +#postmaster = DBMAIL-MAILER + +# +# Sendmail executable for forwards, replies, notifies, vacations. +# You may use pipes (|) in this command, for example: +# dos2unix|/usr/sbin/sendmail works well with Qmail. +# You may use quotes (") for executables with unusual names. +# +sendmail = /usr/sbin/sendmail + +# +# +# The following items can be overridden in the service-specific sections. +# +# + +# +# Logging via stderr/log file and syslog +# +# Logging is broken up into 8 logging levels and each level can be indivually turned on or off. +# The Stderr/log file logs all entries to stderr or the log file. +# Syslog logging uses the facility mail and the logging level of the event for logging. +# Syslog can then be configured to log data according to the levels. +# +# Set the log level to the sum of the values next to the levels you want to record. +# 1 = Emergency +# 2 = Alert +# 4 = Critical +# 8 = Error +# 16 = Warning +# 32 = Notice +# 64 = Info +# 128 = Debug +# 256 = Database -> Logs at debug level +# +# Examples: 0 = Nothing +# 31 = Emergency + Alert + Critical + Error + Warning +# 511 = Everything +# +file_logging_levels = 7 +# +syslog_logging_levels = 31 + +# +# Generate a log entry for database queries for the log level at number of seconds of query execution time. +# +query_time_info = 10 +query_time_notice = 20 +query_time_warning = 30 + +# +# Throw an exception is the query takes longer than query_timeout seconds +query_timeout = 300 + +# +# Root privs are used to open a port, then privs +# are dropped down to the user/group specified here. +# +effective_user = dbmail +effective_group = dbmail + +# +# The IPv4 and/or IPv6 addresses the services will bind to. +# Use * for all local interfaces. +# Use 127.0.0.1 for localhost only. +# Separate multiple entries with spaces ( ) or commas (,). +# +bindip = 0.0.0.0 # IPv4 only - all IP's +#bindip = :: # IPv4 and IPv6 - all IP's (linux) +#bindip = :: # IPv6 only - all IP's (BSD) +#bindip = 0.0.0.0,:: # IPv4 and IPv6 - all IP's (BSD) + + +# +# Idle time allowed before a connection is shut off. +# +timeout = 300 + +# +# Idle time allowed before a connection is shut off if you have not logged in yet. +# +login_timeout = 60 + +# +# If yes, resolves IP addresses to DNS names when logging. +# +resolve_ip = no + +# +# If yes, keep statistics in the authlog table for connecting users +# +authlog = no + +# +# logfile for stdout messages +# +logfile = /var/log/dbmail.log + +# +# logfile for stderr messages +# +errorlog = /var/log/dbmail.err + +# +# directory for storing PID files +# +pid_directory = /var/run/dbmail + +# +# directory for locating libraries (normally has a sane default compiled-in) +# +library_directory = /usr/lib/dbmail + +# +# SSL/TLS certificates +# +# A file containing a list of CAs in PEM format +tls_cafile = + +# A file containing a PEM format certificate +tls_cert = + +# A file containing a PEM format RSA or DSA key +tls_key = + +# A cipher list string in the format given in ciphers(1) +tls_ciphers = + + +# hashing algorithm. You can select your favorite hash type +# for generating unique ids for message parts. +# +# for valid values check mhash(3) but minus the MHASH_ prefix. +# +# if you ever change this value run 'dbmail-util --rehash' to +# update the hash for all mimeparts. +# +# examples: MD5, SHA1, SHA256, SHA512, TIGER, WHIRLPOOL +# +hash_algorithm = SHA1 + + + +[LMTP] +port = 24 +#tls_port = + + +[POP] +port = 110 +#tls_port = 995 + +# You can set an alternate banner to display when connecting to the service +# banner = DBMAIL pop3 server ready to rock + +# +# If yes, allows SMTP access from the host IP connecting by POP3. +# This requires addition configuration of your MTA +# +pop_before_smtp = no + +[HTTP] +port = 41380 +# +# the httpd daemon provides full access to all users, mailboxes +# and messages. Be very careful with this one! +bindip = 127.0.0.1 +admin = admin:secret + +[IMAP] +# You can set an alternate banner to display when connecting to the service +# banner = imap 4r1 server (dbmail 2.3.x) + +# +# Port to bind to. +# +port = 143 +#tls_port = 993 + +# +# IMAP prefers a longer timeout than other services. +# +timeout = 4000 + +# +# If yes, allows SMTP access from the host IP connecting by IMAP. +# This requires addition configuration of your MTA +# +imap_before_smtp = no + +# +# during IDLE, how many seconds between checking the mailbox +# status (default: 30) +# +# idle_timeout = 30 + +# +# Provide a CAPABILITY to override the default +# +# capability = IMAP4 IMAP4rev1 AUTH=LOGIN ACL RIGHTS=texk NAMESPACE CHILDREN SORT QUOTA THREAD=ORDEREDSUBJECT UNSELECT IDLE + +# Send '* STATUS "mailbox" (MESSAGES x RECENT x UNSEEN x NEXTUID x)' +# for all subscribed mailboxes during IDLE (default: no) +# note: EXPERIMENTAL (and most likely disabled in the code) +# +# idle_status = yes + + +[SIEVE] +# +# Port to bind to. +# +port = 2000 +tls_port = + + +[LDAP] +port = 389 +version = 3 +hostname = ldap +base_dn = ou=People,dc=mydomain,dc=com + +# +# If your LDAP library supports ldap_initialize(), then you can use the +# alternative LDAP server DSN like following. +# +# URI = ldap://127.0.0.1:389 +# URI = ldapi://%2fvar%2frun%2fopenldap%2fldapi/ + +# +# Leave blank for anonymous bind. +# example: cn=admin,dc=mydomain,dc=com +# +bind_dn = + +# +# Leave blank for anonymous bind. +# +bind_pw = +scope = SubTree + +# AD users may want to set this to 'no' to disable +# ldap referrals if you are seeing 'Operations errors' +# in your logs +# +referrals = yes + +user_objectclass = top,account,dbmailUser +forw_objectclass = top,account,dbmailForwardingAddress +cn_string = uid +field_passwd = userPassword +field_uid = uid +field_nid = uidNumber +min_nid = 10000 +max_nid = 15000 +field_cid = gidNumber +min_cid = 10000 +max_cid = 15000 + +# a comma-separated list of attributes to match when searching +# for users or forwards that match a delivery address. A match +# on any of them is a hit. +field_mail = mail + +# field that holds the mail-quota size for a user. +field_quota = mailQuota + +# field that holds the forwarding address. +field_fwdtarget = mailForwardingAddress + +# override the query string used to search for users +# or forwards with a delivery address. +# query_string = (mail=%s) + +[DELIVERY] +# +# Run Sieve scripts as messages are delivered. +# +SIEVE = yes + +# +# Use 'user+mailbox@domain' format to deliver to a mailbox. +# +SUBADDRESS = yes + +# +# Turn on/off the Sieve Vacation extension. +# +SIEVE_VACATION = yes + +# +# Turn on/off the Sieve Notify extension +# +SIEVE_NOTIFY = yes + +# +# Turn on/off additional Sieve debugging. +# +SIEVE_DEBUG = no + + +# Use the auto_notify table to send email notifications. +# +AUTO_NOTIFY = no + +# +# Use the auto_reply table to send away messages. +# +AUTO_REPLY = no + +# +# Defaults to "NEW MAIL NOTIFICATION" +# +#AUTO_NOTIFY_SUBJECT = + +# +# Defaults to POSTMASTER from the DBMAIL section. +# +#AUTO_NOTIFY_SENDER = + + +# If you set this to 'yes' dbmail will check for duplicate +# messages in the relevant mailbox during delivery using +# the Message-ID header +# +suppress_duplicates = yes + + +# end of configuration file diff --git a/testing/dbmail/dbmail.pre-install b/testing/dbmail/dbmail.pre-install new file mode 100644 index 0000000000..1abaeb9c0a --- /dev/null +++ b/testing/dbmail/dbmail.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +adduser -s /bin/false -D -H -h /var/lib/dbmail dbmail 2>/dev/null +exit 0 + diff --git a/testing/dbmail/post-rc3.patch b/testing/dbmail/post-rc3.patch index 86726a114b..9d7e34be36 100644 --- a/testing/dbmail/post-rc3.patch +++ b/testing/dbmail/post-rc3.patch @@ -327,3 +327,309 @@ index cf8fc23..8a1a66c 100644 -- 1.7.7.1 +From e95bcfa3f470de0f385a88266bf07065e65695a2 Mon Sep 17 00:00:00 2001 +From: Paul J Stevens <paul@nfg.nl> +Date: Wed, 02 Nov 2011 04:30:45 +0000 +Subject: re-indent php code + +--- +diff --git a/contrib/dbmailclient.php b/contrib/dbmailclient.php +index ffe5cd0..0693c0a 100644 +--- a/contrib/dbmailclient.php ++++ b/contrib/dbmailclient.php +@@ -190,137 +190,137 @@ class DBMailMessage extends DBMailMailbox + + class Curl + { +- public $cookie_file; +- public $headers = array(); +- public $options = array(); +- public $referer = ''; +- public $user_agent = ''; ++ public $cookie_file; ++ public $headers = array(); ++ public $options = array(); ++ public $referer = ''; ++ public $user_agent = ''; + +- protected $error = ''; +- protected $handle; ++ protected $error = ''; ++ protected $handle; + + +- public function __construct() +- { ++ public function __construct() ++ { + $this->cookie_file = realpath('.').'/curl_cookie.txt'; +- $this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? +- $_SERVER['HTTP_USER_AGENT'] : +- 'Curl/PHP ' . PHP_VERSION . ' (http://github.com/shuber/curl/)'; +- } +- +- public function delete($url, $vars = array()) +- { +- return $this->request('DELETE', $url, $vars); +- } +- +- public function error() +- { +- return $this->error; +- } +- +- public function get($url, $vars = array()) +- { +- if (!empty($vars)) { +- $url .= (stripos($url, '?') !== false) ? '&' : '?'; +- $url .= http_build_query($vars, '', '&'); +- } +- return $this->request('GET', $url); +- } +- +- public function post($url, $vars = array()) +- { +- return $this->request('POST', $url, $vars); +- } +- +- public function put($url, $vars = array()) +- { +- return $this->request('PUT', $url, $vars); +- } +- +- protected function request($method, $url, $vars = array()) +- { +- $this->handle = curl_init(); +- +- # Set some default CURL options +- curl_setopt($this->handle, CURLOPT_COOKIEFILE, $this->cookie_file); +- curl_setopt($this->handle, CURLOPT_COOKIEJAR, $this->cookie_file); +- curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, true); +- curl_setopt($this->handle, CURLOPT_HEADER, true); +- curl_setopt($this->handle, CURLOPT_POSTFIELDS, (is_array($vars) ? http_build_query($vars, '', '&') : $vars)); +- curl_setopt($this->handle, CURLOPT_REFERER, $this->referer); +- curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true); +- curl_setopt($this->handle, CURLOPT_URL, $url); +- curl_setopt($this->handle, CURLOPT_USERAGENT, $this->user_agent); +- +- # Format custom headers for this request and set CURL option +- $headers = array(); +- foreach ($this->headers as $key => $value) { +- $headers[] = $key.': '.$value; +- } +- curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers); +- +- # Determine the request method and set the correct CURL option +- switch ($method) { +- case 'GET': +- curl_setopt($this->handle, CURLOPT_HTTPGET, true); +- break; +- case 'POST': +- curl_setopt($this->handle, CURLOPT_POST, true); +- break; +- default: +- curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $method); +- } +- +- # Set any custom CURL options +- foreach ($this->options as $option => $value) { +- curl_setopt($this->handle, constant('CURLOPT_'.str_replace('CURLOPT_', '', strtoupper($option))), $value); +- } +- +- $response = curl_exec($this->handle); +- if ($response) { +- $response = new CurlResponse($response); +- } else { +- $this->error = curl_errno($this->handle).' - '.curl_error($this->handle); +- } +- curl_close($this->handle); +- return $response; +- } ++ $this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? ++ $_SERVER['HTTP_USER_AGENT'] : ++ 'Curl/PHP ' . PHP_VERSION . ' (http://github.com/shuber/curl/)'; ++ } ++ ++ public function delete($url, $vars = array()) ++ { ++ return $this->request('DELETE', $url, $vars); ++ } ++ ++ public function error() ++ { ++ return $this->error; ++ } ++ ++ public function get($url, $vars = array()) ++ { ++ if (!empty($vars)) { ++ $url .= (stripos($url, '?') !== false) ? '&' : '?'; ++ $url .= http_build_query($vars, '', '&'); ++ } ++ return $this->request('GET', $url); ++ } ++ ++ public function post($url, $vars = array()) ++ { ++ return $this->request('POST', $url, $vars); ++ } ++ ++ public function put($url, $vars = array()) ++ { ++ return $this->request('PUT', $url, $vars); ++ } ++ ++ protected function request($method, $url, $vars = array()) ++ { ++ $this->handle = curl_init(); ++ ++ # Set some default CURL options ++ curl_setopt($this->handle, CURLOPT_COOKIEFILE, $this->cookie_file); ++ curl_setopt($this->handle, CURLOPT_COOKIEJAR, $this->cookie_file); ++ curl_setopt($this->handle, CURLOPT_FOLLOWLOCATION, true); ++ curl_setopt($this->handle, CURLOPT_HEADER, true); ++ curl_setopt($this->handle, CURLOPT_POSTFIELDS, (is_array($vars) ? http_build_query($vars, '', '&') : $vars)); ++ curl_setopt($this->handle, CURLOPT_REFERER, $this->referer); ++ curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, true); ++ curl_setopt($this->handle, CURLOPT_URL, $url); ++ curl_setopt($this->handle, CURLOPT_USERAGENT, $this->user_agent); ++ ++ # Format custom headers for this request and set CURL option ++ $headers = array(); ++ foreach ($this->headers as $key => $value) { ++ $headers[] = $key.': '.$value; ++ } ++ curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers); ++ ++ # Determine the request method and set the correct CURL option ++ switch ($method) { ++ case 'GET': ++ curl_setopt($this->handle, CURLOPT_HTTPGET, true); ++ break; ++ case 'POST': ++ curl_setopt($this->handle, CURLOPT_POST, true); ++ break; ++ default: ++ curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $method); ++ } ++ ++ # Set any custom CURL options ++ foreach ($this->options as $option => $value) { ++ curl_setopt($this->handle, constant('CURLOPT_'.str_replace('CURLOPT_', '', strtoupper($option))), $value); ++ } ++ ++ $response = curl_exec($this->handle); ++ if ($response) { ++ $response = new CurlResponse($response); ++ } else { ++ $this->error = curl_errno($this->handle).' - '.curl_error($this->handle); ++ } ++ curl_close($this->handle); ++ return $response; ++ } + + } + + class CurlResponse + { +- public $body = ''; +- public $headers = array(); +- +- public function __construct($response) +- { +- # Extract headers from response +- $pattern = '#HTTP/\d\.\d.*?$.*?\r\n\r\n#ims'; +- preg_match_all($pattern, $response, $matches); +- $headers = split("\r\n", str_replace("\r\n\r\n", '', array_pop($matches[0]))); +- +- # Extract the version and status from the first header +- $version_and_status = array_shift($headers); +- preg_match('#HTTP/(\d\.\d)\s(\d\d\d)\s(.*)#', $version_and_status, $matches); +- $this->headers['Http-Version'] = $matches[1]; +- $this->headers['Status-Code'] = $matches[2]; +- $this->headers['Status'] = $matches[2].' '.$matches[3]; +- +- # Convert headers into an associative array +- foreach ($headers as $header) { +- preg_match('#(.*?)\:\s(.*)#', $header, $matches); +- $this->headers[$matches[1]] = $matches[2]; +- } +- +- # Remove the headers from the response body +- $this->body = preg_replace($pattern, '', $response); +- } +- +- public function __toString() +- { +- return $this->body; +- } ++ public $body = ''; ++ public $headers = array(); ++ ++ public function __construct($response) ++ { ++ # Extract headers from response ++ $pattern = '#HTTP/\d\.\d.*?$.*?\r\n\r\n#ims'; ++ preg_match_all($pattern, $response, $matches); ++ $headers = split("\r\n", str_replace("\r\n\r\n", '', array_pop($matches[0]))); ++ ++ # Extract the version and status from the first header ++ $version_and_status = array_shift($headers); ++ preg_match('#HTTP/(\d\.\d)\s(\d\d\d)\s(.*)#', $version_and_status, $matches); ++ $this->headers['Http-Version'] = $matches[1]; ++ $this->headers['Status-Code'] = $matches[2]; ++ $this->headers['Status'] = $matches[2].' '.$matches[3]; ++ ++ # Convert headers into an associative array ++ foreach ($headers as $header) { ++ preg_match('#(.*?)\:\s(.*)#', $header, $matches); ++ $this->headers[$matches[1]] = $matches[2]; ++ } ++ ++ # Remove the headers from the response body ++ $this->body = preg_replace($pattern, '', $response); ++ } ++ ++ public function __toString() ++ { ++ return $this->body; ++ } + } + + +-- +cgit v0.8.3.4 +From 288b73a79fe20bae7737fb622aefff761bb34c3f Mon Sep 17 00:00:00 2001 +From: Paul J Stevens <paul@nfg.nl> +Date: Wed, 02 Nov 2011 04:31:12 +0000 +Subject: parse From_ time as localtime + +--- +diff --git a/src/dbmail-mailbox.c b/src/dbmail-mailbox.c +index 09be275..5e493ab 100644 +--- a/src/dbmail-mailbox.c ++++ b/src/dbmail-mailbox.c +@@ -100,7 +100,7 @@ static gchar * _message_get_envelope_date(const DbmailMessage *self) + + res = g_new0(char, TIMESTRING_SIZE+1); + memset(&gmt,'\0', sizeof(struct tm)); +- gmtime_r(&self->internal_date, &gmt); ++ localtime_r(&self->internal_date, &gmt); + + strftime(res, TIMESTRING_SIZE, "%a %b %d %H:%M:%S %Y", &gmt); + return res; +diff --git a/src/dbmail-message.c b/src/dbmail-message.c +index 8a1a66c..1b4d826 100644 +--- a/src/dbmail-message.c ++++ b/src/dbmail-message.c +@@ -837,7 +837,7 @@ gchar * dbmail_message_get_internal_date(const DbmailMessage *self, int thisyear + + res = g_new0(char, TIMESTRING_SIZE+1); + memset(&gmt,'\0', sizeof(struct tm)); +- gmtime_r(&self->internal_date, &gmt); ++ localtime_r(&self->internal_date, &gmt); + + /* override if the date is not sane */ + if (thisyear && gmt.tm_year + 1900 > thisyear + 1) { +-- +cgit v0.8.3.4 |