summaryrefslogtreecommitdiffstats
path: root/extra/mail_handler
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-04-01 12:19:25 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-04-01 12:19:25 +0000
commitbe04f1dd62705bb3a70ffadad0181130ddc6e839 (patch)
treef520ee602c7e62f1a5cd21a847d37b29e419a10b /extra/mail_handler
parent0098c7b12883c08f44bbcfbc05f239f96d6f5636 (diff)
downloadredmine-be04f1dd62705bb3a70ffadad0181130ddc6e839.tar.gz
redmine-be04f1dd62705bb3a70ffadad0181130ddc6e839.zip
remove trailing white-spaces from extra/mail_handler/rdm-mailhandler.rb
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9292 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra/mail_handler')
-rw-r--r--extra/mail_handler/rdm-mailhandler.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index fbb4dd145..774eb9d9c 100644
--- a/extra/mail_handler/rdm-mailhandler.rb
+++ b/extra/mail_handler/rdm-mailhandler.rb
@@ -10,10 +10,10 @@
# rdm-mailhandler [options] --url=<Redmine URL> --key=<API key>
#
# == Arguments
-#
+#
# -u, --url URL of the Redmine server
# -k, --key Redmine API key
-#
+#
# General options:
# --unknown-user=ACTION how to handle emails from an unknown user
# ACTION can be one of the following values:
@@ -30,7 +30,7 @@
# -h, --help show this help
# -v, --verbose show extra information
# -V, --version show version information and exit
-#
+#
# Issue attributes control options:
# -p, --project=PROJECT identifier of the target project
# -s, --status=STATUS name of the target status
@@ -40,15 +40,15 @@
# -o, --allow-override=ATTRS allow email content to override attributes
# specified by previous options
# ATTRS is a comma separated list of attributes
-#
+#
# == Examples
# No project specified. Emails MUST contain the 'Project' keyword:
-#
+#
# rdm-mailhandler --url http://redmine.domain.foo --key secret
-#
+#
# Fixed project and default tracker specified, but emails can override
# both tracker and priority attributes using keywords:
-#
+#
# rdm-mailhandler --url https://domain.foo/redmine --key secret \\
# --project foo \\
# --tracker bug \\
@@ -79,12 +79,12 @@ end
class RedmineMailHandler
VERSION = '0.1'
-
+
attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :no_permission_check, :url, :key, :no_check_certificate
def initialize
self.issue_attributes = {}
-
+
opts = GetoptLong.new(
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
[ '--version', '-V', GetoptLong::NO_ARGUMENT ],
@@ -134,28 +134,28 @@ class RedmineMailHandler
self.no_check_certificate = true
end
end
-
+
RDoc.usage if url.nil?
end
-
+
def submit(email)
uri = url.gsub(%r{/*$}, '') + '/mail_handler'
-
+
headers = { 'User-Agent' => "Redmine mail handler/#{VERSION}" }
-
- data = { 'key' => key, 'email' => email,
+
+ data = { 'key' => key, 'email' => email,
'allow_override' => allow_override,
'unknown_user' => unknown_user,
'no_permission_check' => no_permission_check}
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
-
+
debug "Posting to #{uri}..."
response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate)
debug "Response received: #{response.code}"
-
+
case response.code.to_i
when 403
- warn "Request was denied by your Redmine server. " +
+ warn "Request was denied by your Redmine server. " +
"Make sure that 'WS for incoming emails' is enabled in application settings and that you provided the correct API key."
return 77
when 422
@@ -175,9 +175,9 @@ class RedmineMailHandler
return 1
end
end
-
+
private
-
+
def debug(msg)
puts msg if verbose
end