Skip to content

Commit

Permalink
Give priority to `twittering-proxy-*' over other variables for proxy.
Browse files Browse the repository at this point in the history
* twittering-mode.el: Give priority to the variable
`twittering-proxy-*' over `twittering-http-proxy-*' and
`twittering-https-proxy-*'.
(twittering-proxy-server): defined as a variable.
(twittering-proxy-port): likewise.
(twittering-proxy-keep-alive): likewise.
(twittering-proxy-user): likewise.
(twittering-proxy-password): likewise.
(twittering-normalize-proxy-vars): normalize
`twittering-proxy-port'.
(twittering-proxy-info): return configuration generated from
`twittering-proxy-*' regardless of the scheme (HTTP or HTTPS) if
`twittering-proxy-server' and  `twittering-proxy-port' are
non-nil.
  • Loading branch information
cvmat committed May 19, 2010
1 parent d59b1a2 commit a693ad7
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 30 deletions.
15 changes: 15 additions & 0 deletions ChangeLog
Expand Up @@ -5,6 +5,21 @@
(twittering-proxy-info): return all configuration of the proxy for
the scheme.

* twittering-mode.el: Give priority to the variable
`twittering-proxy-*' over `twittering-http-proxy-*' and
`twittering-https-proxy-*'.
(twittering-proxy-server): defined as a variable.
(twittering-proxy-port): likewise.
(twittering-proxy-keep-alive): likewise.
(twittering-proxy-user): likewise.
(twittering-proxy-password): likewise.
(twittering-normalize-proxy-vars): normalize
`twittering-proxy-port'.
(twittering-proxy-info): return configuration generated from
`twittering-proxy-*' regardless of the scheme (HTTP or HTTPS) if
`twittering-proxy-server' and `twittering-proxy-port' are
non-nil.

2010-05-17 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el (twittering-start-http-session-curl): fix
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Expand Up @@ -52,6 +52,11 @@ existing way.
* HTTPS connection using `tls' library working with an external command
`gnutls' or `openssl' instead of `curl'.
* Individual proxy configurations for HTTP and HTTPS.
If `twittering-proxy-server' and `twittering-proxy-port' are non-nil,
they have priority over the other variables `twittering-http-proxy-*' and
`twittering-https-proxy-*'. To use individual proxies for HTTP and HTTPS,
you must keep the prior variables (`twittering-proxy-server' and
`twittering-proxy-port') nil.
* Silent retrieval of icon images.
You can enable silent retrieval by "(setq twittering-url-show-status nil)".
* ...
Expand Down
129 changes: 99 additions & 30 deletions twittering-mode.el
Expand Up @@ -453,55 +453,117 @@ pop-up buffer.")
;;;

(defvar twittering-proxy-use nil)
(defvar twittering-proxy-server nil
"*Proxy server for `twittering-mode'.
If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.
To use individual proxies for HTTP and HTTPS, both `twittering-proxy-server'
and `twittering-proxy-port' must be nil.")
(defvar twittering-proxy-port nil
"*Port number for `twittering-mode'.
If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.
To use individual proxies for HTTP and HTTPS, both `twittering-proxy-server'
and `twittering-proxy-port' must be nil.")
(defvar twittering-proxy-keep-alive nil)
(defvar twittering-proxy-user nil
"*Username for `twittering-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-proxy-password nil
"*Password for `twittering-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")

(defvar twittering-http-proxy-server nil
"*The HTTP proxy server for `twittering-mode'.
"*HTTP proxy server for `twittering-mode'.
If nil, it is initialized on entering `twittering-mode'.
The port number is specified by `twittering-http-proxy-port'.
For HTTPS connection, the proxy specified by `twittering-https-proxy-server'
and `twittering-https-proxy-port' is used.")
and `twittering-https-proxy-port' is used.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-http-proxy-port nil
"*The port number of a HTTP proxy server for `twittering-mode'.
"*Port number of a HTTP proxy server for `twittering-mode'.
If nil, it is initialized on entering `twittering-mode'.
The server is specified by `twittering-http-proxy-server'.
For HTTPS connection, the proxy specified by `twittering-https-proxy-server'
and `twittering-https-proxy-port' is used.")
and `twittering-https-proxy-port' is used.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-http-proxy-keep-alive nil
"*If non-nil, the Keep-alive is enabled. This is experimental.")
(defvar twittering-http-proxy-user nil)
(defvar twittering-http-proxy-password nil)
(defvar twittering-http-proxy-user nil
"*Username for `twittering-http-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-http-proxy-password nil
"*Password for `twittering-http-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")

(defvar twittering-https-proxy-server nil
"*The HTTPS proxy server for `twittering-mode'.
"*HTTPS proxy server for `twittering-mode'.
If nil, it is initialized on entering `twittering-mode'.
The port number is specified by `twittering-https-proxy-port'.
For HTTP connection, the proxy specified by `twittering-http-proxy-server'
and `twittering-http-proxy-port' is used.")
and `twittering-http-proxy-port' is used.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-https-proxy-port nil
"*The port number of a HTTPS proxy server for `twittering-mode'.
"*Port number of a HTTPS proxy server for `twittering-mode'.
If nil, it is initialized on entering `twittering-mode'.
The server is specified by `twittering-https-proxy-server'.
For HTTP connection, the proxy specified by `twittering-http-proxy-server'
and `twittering-http-proxy-port' is used.")
and `twittering-http-proxy-port' is used.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-https-proxy-keep-alive nil
"*If non-nil, the Keep-alive is enabled. This is experimental.")
(defvar twittering-https-proxy-user nil)
(defvar twittering-https-proxy-password nil)

(cond
((> 22 emacs-major-version)
(defalias 'twittering-proxy-server 'twittering-http-proxy-server)
(defalias 'twittering-proxy-port 'twittering-http-proxy-port)
(defalias 'twittering-proxy-keep-alive 'twittering-http-proxy-keep-alive)
(defalias 'twittering-proxy-user 'twittering-http-proxy-user)
(defalias 'twittering-proxy-password 'twittering-http-proxy-password))
(t
(defvaralias 'twittering-proxy-server 'twittering-http-proxy-server
"Alias of `twittering-http-proxy-server'.")
(defvaralias 'twittering-proxy-port 'twittering-http-proxy-port
"Alias of `twittering-http-proxy-port'.")
(defvaralias 'twittering-proxy-keep-alive 'twittering-http-proxy-keep-alive)
(defvaralias 'twittering-proxy-user 'twittering-http-proxy-user)
(defvaralias 'twittering-proxy-password 'twittering-http-proxy-password)))
(defvar twittering-https-proxy-user nil
"*Username for `twittering-https-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")
(defvar twittering-https-proxy-password nil
"*Password for `twittering-https-proxy-server'.
NOTE: If both `twittering-proxy-server' and `twittering-proxy-port' are
non-nil, the variables `twittering-proxy-*' have priority over other
variables `twittering-http-proxy-*' or `twittering-https-proxy-*'
regardless of HTTP or HTTPS.")

(defun twittering-normalize-proxy-vars ()
"Normalize the type of `twittering-http-proxy-port' and
Expand All @@ -517,7 +579,8 @@ and `twittering-http-proxy-port' is used.")
(set sym (string-to-number value)))
(t
(set sym nil)))))
'(twittering-http-proxy-port
'(twittering-proxy-port
twittering-http-proxy-port
twittering-https-proxy-port)))

(defun twittering-proxy-info (scheme &optional item)
Expand All @@ -529,7 +592,13 @@ The server name is a string and the port number is an integer."
(symbol-name scheme)
scheme))
(info-list
`((("http")
`((("http" "https")
. ((server . ,twittering-proxy-server)
(port . ,twittering-proxy-port)
(keep-alive . ,twittering-proxy-keep-alive)
(user . ,twittering-proxy-user)
(password . ,twittering-proxy-password)))
(("http")
. ((server . ,twittering-http-proxy-server)
(port . ,twittering-http-proxy-port)
(keep-alive . ,twittering-http-proxy-keep-alive)
Expand Down

0 comments on commit a693ad7

Please sign in to comment.