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/dbmail/post-rc3.patch | |
parent | dab2a3eaae74c39a1a259d944a66ea893741def0 (diff) | |
download | aports-30f1ddf1f8459c98e8b0e2b73b0263f8173fba8a.tar.bz2 aports-30f1ddf1f8459c98e8b0e2b73b0263f8173fba8a.tar.xz |
testing/dbmail: fix initd and add default config
Diffstat (limited to 'testing/dbmail/post-rc3.patch')
-rw-r--r-- | testing/dbmail/post-rc3.patch | 306 |
1 files changed, 306 insertions, 0 deletions
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 |