Changes committed gnus/lisp (ChangeLog starttls.el)

"Ted Zlatanov" <[email protected]> Mon, 03 Nov 2008 21:50:37 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog starttls.el

(starttls-any-program-available): Get the name of the available TLS
layer program.  
(starttls-open-steam-gnutls, starttls-open-stream): Put port number as
well as the host name in the "opening" message.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1927 gnus/lisp/ChangeLog:7.1928
--- ChangeLog:7.1927	Mon Nov  3 16:21:31 2008
+++ ChangeLog	Mon Nov  3 21:50:37 2008
@@ -1,5 +1,10 @@
 2008-11-03  Teodor Zlatanov  <[email protected]>
 
+	* starttls.el (starttls-any-program-available): Get the name of the
+	available TLS layer program.
+	(starttls-open-steam-gnutls, starttls-open-stream): Put port number as
+	well as the host name in the "opening" message.
+
 	* auth-source.el (auth-source-cache, auth-source-do-cache)
 	(auth-source-user-or-password): Cache passwords and logins by default,
 	allow override with `auth-source-do-cache'.
Index: starttls.el
diff -u gnus/lisp/starttls.el:7.19 gnus/lisp/starttls.el:7.20
--- starttls.el:7.19	Mon May 19 10:47:42 2008
+++ starttls.el	Mon Nov  3 21:50:37 2008
@@ -241,7 +241,7 @@
       'process-kill-without-query)))
 
 (defun starttls-open-stream-gnutls (name buffer host port)
-  (message "Opening STARTTLS connection to `%s'..." host)
+  (message "Opening STARTTLS connection to `%s:%s'..." host port)
   (let* (done
 	 (old-max (with-current-buffer buffer (point-max)))
 	 (process-connection-type starttls-process-connection-type)
@@ -266,8 +266,8 @@
 	  (delete-region old-max done))
       (delete-process process)
       (setq process nil))
-    (message "Opening STARTTLS connection to `%s'...%s"
-	     host (if done "done" "failed"))
+    (message "Opening STARTTLS connection to `%s:%s'...%s"
+	     host port (if done "done" "failed"))
     process))
 
 (defun starttls-open-stream (name buffer host port)
@@ -287,6 +287,7 @@
 GNUTLS requires a port number."
   (if starttls-use-gnutls
       (starttls-open-stream-gnutls name buffer host port)
+    (message "Opening STARTTLS connection to `%s:%s'" host (format "%s" port))
     (let* ((process-connection-type starttls-process-connection-type)
 	   (process (apply #'start-process
 			   name buffer starttls-program
@@ -295,6 +296,20 @@
       (starttls-set-process-query-on-exit-flag process nil)
       process)))
 
+(defun starttls-any-program-available ()
+  (let ((program (if starttls-use-gnutls
+		     starttls-gnutls-program
+		   starttls-program)))
+    (condition-case ()
+	(with-no-warnings
+	  (require 'starttls)
+	  (call-process program)
+	  program)
+      (error (progn
+	       (message "No STARTTLS program was available (tried '%s')" 
+			program)
+	       nil)))))
+
 (provide 'starttls)
 
 ;; arch-tag: 648b3bd8-63bd-47f5-904c-7c819aea2297