Просмотр исходного кода

Added port attribute for imap/pop3 and smtp. See also issue#240.

Martin Edenhofer 8 лет назад
Родитель
Сommit
67381c07bd

+ 2 - 0
app/assets/javascripts/app/controllers/_channel/email.coffee

@@ -528,6 +528,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
       { name: 'options::host',      display: 'Host',     tag: 'input',  type: 'text', limit: 120, null: false, autocapitalize: false },
       { name: 'options::user',      display: 'User',     tag: 'input',  type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', },
       { name: 'options::password',  display: 'Password', tag: 'input',  type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true },
+      { name: 'options::port',      display: 'Port',     tag: 'input',  type: 'text', limit: 6,   null: true, autocapitalize: false },
       { name: 'options::folder',    display: 'Folder',   tag: 'input',  type: 'text', limit: 120, null: true, autocapitalize: false },
     ]
 
@@ -566,6 +567,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
         { name: 'options::host',     display: 'Host',     tag: 'input', type: 'text',     limit: 120, null: false, autocapitalize: false, autofocus: true },
         { name: 'options::user',     display: 'User',     tag: 'input', type: 'text',     limit: 120, null: true, autocapitalize: false, autocomplete: 'off', },
         { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true },
+        { name: 'options::port',     display: 'Port',     tag: 'input', type: 'text',     limit: 6,   null: true, autocapitalize: false },
       ]
       @form = new App.ControllerForm(
         el:    @$('.base-outbound-settings')

+ 3 - 0
app/models/channel/driver/imap.rb

@@ -66,6 +66,9 @@ example
       ssl  = false
       port = 143
     end
+    if options.key?(:port) && !options[:port].empty?
+      port = options[:port]
+    end
 
     Rails.logger.info "fetching imap (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})"
 

+ 3 - 0
app/models/channel/driver/pop3.rb

@@ -51,6 +51,9 @@ returns
       ssl  = false
       port = 110
     end
+    if options.key?(:port) && !options[:port].empty?
+      port = options[:port]
+    end
 
     Rails.logger.info "fetching pop3 (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})"
 

+ 1 - 1
app/models/channel/driver/smtp.rb

@@ -27,7 +27,7 @@ class Channel::Driver::Smtp
     return if Setting.get('import_mode')
 
     # set smtp defaults
-    if !options.key?(:port)
+    if !options.key?(:port) || options[:port].empty?
       options[:port] = 25
     end
     if !options.key?(:domain)