all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] rcirc: support TLS/SSL and arbitrary connection method
@ 2011-05-30 21:46 Marco Pessotto
  2011-05-31  1:24 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-30 21:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: rcyeske

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]


Hello there.

I'm writing you to submit a patch for rcirc.el to give it support for
SSL connections. 

For example, the following 2 servers will connect with SSL, one using a
custom function (which can be anything, and re-implements this idea
https://github.com/nealey/rcirc/wiki ), one simply adding :use-tls t.

(setq rcirc-server-alist '(("irc.freenode.net" 
			    :nick "nick"
			    :user-name "username"
			    :port 6697
                            ;; use open-tls-stream as function to connect
			    :custom-connect-function open-tls-stream 
			    :channels ("#rcirc" "#emacs"))
			   ("irc.otherserver.org" 
			    :nick "nick"
			    :username "username"
                            ;; just say use-tls, more intuitive
                            ;; also prompted when C-u M-x rcirc
			    :use-tls t
			    :port 7000
			    :channels ("#channel1" "#channel 2"))))


The last 2 chunks of the patch are meant to strip the IRC colors. Not
really part of the "connection" patch, but IMHO useful.

In case you're interested, I signed the emacs papers some years ago.

Bests

        Marco


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch to support tls --]
[-- Type: text/x-diff, Size: 6234 bytes --]

diff --git a/rcirc.el b/rcirc.el
index 093892a..a0bcaf1 100644
--- a/rcirc.el
+++ b/rcirc.el
@@ -46,6 +46,7 @@
 (require 'ring)
 (require 'time-date)
 (eval-when-compile (require 'cl))
+(require 'tls)
 
 (defgroup rcirc nil
   "Simple IRC client."
@@ -76,6 +77,19 @@ for this connection.
 VALUE must be a number or string.  If absent,
 `rcirc-default-port' is used.
 
+`:use-tls'
+
+VALUE is a boolean. If true, the connection will be established
+using the tls.el library. If absent, `rcirc-default-use-tls' is
+used, which in turn default to nil (false).
+
+`:custom-connect-function'
+
+VALUE is a custom function to open the connection and must take
+the same arguments of `open-network-stream' If you set this,
+the :use-tls parameter is ignored (as you are supposed to set the
+connection by yourself)
+
 `:user-name'
 
 VALUE must be a string.  If absent, `rcirc-default-user-name' is
@@ -102,6 +116,8 @@ connected to automatically."
 					     (:user-name string)
 					     (:password string)
 					     (:full-name string)
+					     (:use-tls boolean)
+					     (:custom-connect-function function)
 					     (:channels (repeat string)))))
   :group 'rcirc)
 
@@ -110,6 +126,11 @@ connected to automatically."
   :type 'integer
   :group 'rcirc)
 
+(defcustom rcirc-default-use-tls nil
+  "Use SSL/TLS by default?"
+  :type 'boolean
+  :group 'rcirc)
+
 (defcustom rcirc-default-nick (user-login-name)
   "Your nick."
   :type 'string
@@ -409,6 +430,7 @@ If ARG is non-nil, instead prompt for connection parameters."
                                      'rcirc-user-name-history))
 	     (password (read-passwd "IRC Password: " nil
                                     (plist-get server-plist :password)))
+	     (use-tls (yes-or-no-p "Use SSL/TLS? "))
 	     (channels (split-string
 			(read-string "IRC Channels: "
 				     (mapconcat 'identity
@@ -418,7 +440,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 			"[, ]+" t)))
 	(rcirc-connect server port nick user-name
 		       rcirc-default-full-name
-		       channels password))
+		       channels password use-tls))
     ;; connect to servers in `rcirc-server-alist'
     (let (connected-servers)
       (dolist (c rcirc-server-alist)
@@ -430,6 +452,9 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (full-name (or (plist-get (cdr c) :full-name)
 			     rcirc-default-full-name))
 	      (channels (plist-get (cdr c) :channels))
+	      (use-tls (or (plist-get (cdr c) :use-tls)
+		       rcirc-default-use-tls))
+	      (custom-connect-function (plist-get (cdr c) :custom-connect-function))
               (password (plist-get (cdr c) :password)))
 	  (when server
 	    (let (connected)
@@ -439,13 +464,15 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (if (not connected)
 		  (condition-case e
 		      (rcirc-connect server port nick user-name
-				     full-name channels password)
+				     full-name channels password use-tls
+				     custom-connect-function)
 		    (quit (message "Quit connecting to %s" server)))
 		(with-current-buffer (process-buffer connected)
+		  (if (process-contact (get-buffer-process
+					(current-buffer)) :host)
 		  (setq connected-servers
-			(cons (process-contact (get-buffer-process
-						(current-buffer)) :host)
-			      connected-servers))))))))
+			(cons (process-name connected)
+			      connected-servers)))))))))
       (when connected-servers
 	(message "Already connected to %s"
 		 (if (cdr connected-servers)
@@ -471,7 +498,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
-                             full-name startup-channels password)
+                             full-name startup-channels password use-tls
+			     custom-connect-function)
   (save-excursion
     (message "Connecting to %s..." server)
     (let* ((inhibit-eol-conversion)
@@ -484,7 +512,16 @@ If ARG is non-nil, instead prompt for connection parameters."
 	   (user-name (or user-name rcirc-default-user-name))
 	   (full-name (or full-name rcirc-default-full-name))
 	   (startup-channels startup-channels)
-           (process (make-network-process :name server :host server :service port-number)))
+           (process))
+      (if (functionp custom-connect-function)
+	  (setq process (funcall custom-connect-function server nil server port-number))
+	(if use-tls
+	    (setq process (open-tls-stream server nil server port-number))
+	  (setq process (open-network-stream server nil server port-number))))
+      (unless process
+	(error (concat 
+	       (format "Couldn't connect to %s on %d " server port-number)
+	       (when use-tls "using TLS/SSL"))))
       ;; set up process
       (set-process-coding-system process 'raw-text 'raw-text)
       (switch-to-buffer (rcirc-generate-new-buffer-name process nil))
@@ -698,7 +735,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
   "Send PROCESS a STRING plus a newline."
   (let ((string (concat (encode-coding-string string rcirc-encode-coding-system)
                         "\n")))
-    (unless (eq (process-status process) 'open)
+    (unless (member (process-status process) '(open run))
       (error "Network connection to %s is not open"
              (process-name process)))
     (rcirc-debug process string)
@@ -1401,7 +1438,8 @@ Returns nil if the information is not recorded."
       (- rcirc-current-line last-activity-line))))
 
 (defvar rcirc-markup-text-functions
-  '(rcirc-markup-attributes
+  '(rcirc-markup-strip-irc-colors
+    rcirc-markup-attributes
     rcirc-markup-my-nick
     rcirc-markup-urls
     rcirc-markup-keywords
@@ -2302,6 +2340,10 @@ keywords when no KEYWORD is given."
   (insert (rcirc-facify (format-time-string rcirc-time-format)
 			'rcirc-timestamp)))
 
+(defun rcirc-markup-strip-irc-colors (sender response)
+  (while (re-search-forward "\C-c\\([0-9][0-9]?\\(,[0-9][0-9]?\\)?\\)?" nil t)
+    (delete-region (match-beginning 0) (match-end 0))))
+
 (defun rcirc-markup-attributes (sender response)
   (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
     (rcirc-add-face (match-beginning 0) (match-end 0)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-30 21:46 [PATCH] rcirc: support TLS/SSL and arbitrary connection method Marco Pessotto
@ 2011-05-31  1:24 ` Stefan Monnier
  2011-05-31 12:16   ` Julien Danjou
  2011-05-31  8:07 ` Julien Danjou
  2011-05-31  9:55 ` Ted Zlatanov
  2 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2011-05-31  1:24 UTC (permalink / raw)
  To: Marco Pessotto; +Cc: rcyeske, emacs-devel

> I'm writing you to submit a patch for rcirc.el to give it support for
> SSL connections.

Thank you.  But I'm afraid you're just a few weeks late:

   revno: 104199
   committer: Stefan Monnier <monnier@iro.umontreal.ca>
   branch nick: trunk
   timestamp: Wed 2011-05-11 23:25:58 -0300
   message:
     * lisp/net/rcirc.el: Add support for SSL/TLS connections.
     (rcirc-server-alist): New field `encryption'.
     (rcirc): Check `encryption' settings.
     (rcirc-connect): New arg `encryption'.  Use open-network-stream.
     Merge make-local-variable into `set'.
     (rcirc--connection-open-p): New function.
     (rcirc-send-string, rcirc-clean-up-buffer): Use it to handle case where
     the process is not a network process (e.g. running gnutls-cli).
     (set-rcirc-decode-coding-system, set-rcirc-encode-coding-system):
     Make rcirc-(en|de)code-coding-system local here.
     (rcirc-mode): Merge make-local-variable into `set'.
     (rcirc-parent-buffer): Make permanent buffer-local.
     (rcirc-multiline-minor-mode): Don't do it here.
     (rcirc-switch-to-server-buffer): Don't switch to a random buffer if
     there's no server buffer.

> The last 2 chunks of the patch are meant to strip the IRC colors.
> Not really part of the "connection" patch, but IMHO useful.

Could you describe a bit more what this is about (I'm not a regular IRC
user)?  I can't remember seeing those C-c escape sequences, when do they
appear, what are they expected to do?  Should we really strip them, or
would it be even better to turn them into faces?

> In case you're interested, I signed the Emacs papers some years ago.

If you could send a new patch based on the latest code to provide the
remaining features, I'd be happy to install it.


        Stefan



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-30 21:46 [PATCH] rcirc: support TLS/SSL and arbitrary connection method Marco Pessotto
  2011-05-31  1:24 ` Stefan Monnier
@ 2011-05-31  8:07 ` Julien Danjou
  2011-05-31  8:52   ` Marco Pessotto
  2011-05-31  9:55 ` Ted Zlatanov
  2 siblings, 1 reply; 18+ messages in thread
From: Julien Danjou @ 2011-05-31  8:07 UTC (permalink / raw)
  To: Marco Pessotto; +Cc: rcyeske, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

On Mon, May 30 2011, Marco Pessotto wrote:

Hi Marco,

> I'm writing you to submit a patch for rcirc.el to give it support for
> SSL connections. 

This patch really looks interesting. Would you mind submitting it to
bug-gnu-emacs rather than here. That way I'll be sure it'll get merged
and will not be forgotten. :)

Thanks,
-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#8772: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
@ 2011-05-31  8:43     ` Marco Pessotto
  2011-05-31 14:21       ` Marco Pessotto
  0 siblings, 1 reply; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31  8:43 UTC (permalink / raw)
  To: 8772

[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]


From emacs-devel:

Hello there.

I'm writing you to submit a patch for rcirc.el to give it support for
SSL connections. 

For example, the following 2 servers will connect with SSL, one using a
custom function (which can be anything, and re-implements this idea
https://github.com/nealey/rcirc/wiki ), one simply adding :use-tls t.

(setq rcirc-server-alist '(("irc.freenode.net" 
			    :nick "nick"
			    :user-name "username"
			    :port 6697
                            ;; use open-tls-stream as function to connect
			    :custom-connect-function open-tls-stream 
			    :channels ("#rcirc" "#emacs"))
			   ("irc.otherserver.org" 
			    :nick "nick"
			    :username "username"
                            ;; just say use-tls, more intuitive
                            ;; also prompted when C-u M-x rcirc
			    :use-tls t
			    :port 7000
			    :channels ("#channel1" "#channel 2"))))


The last 2 chunks of the patch are meant to strip the IRC colors. Not
really part of the "connection" patch, but IMHO useful.

The patch is meant to be applied to the latest revision published on
github by rcy:

https://github.com/rcy/rcirc

In case you're interested, I signed the emacs papers some years ago.

Bests

        Marco


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ssl patch --]
[-- Type: text/x-diff, Size: 6234 bytes --]

diff --git a/rcirc.el b/rcirc.el
index 093892a..a0bcaf1 100644
--- a/rcirc.el
+++ b/rcirc.el
@@ -46,6 +46,7 @@
 (require 'ring)
 (require 'time-date)
 (eval-when-compile (require 'cl))
+(require 'tls)
 
 (defgroup rcirc nil
   "Simple IRC client."
@@ -76,6 +77,19 @@ for this connection.
 VALUE must be a number or string.  If absent,
 `rcirc-default-port' is used.
 
+`:use-tls'
+
+VALUE is a boolean. If true, the connection will be established
+using the tls.el library. If absent, `rcirc-default-use-tls' is
+used, which in turn default to nil (false).
+
+`:custom-connect-function'
+
+VALUE is a custom function to open the connection and must take
+the same arguments of `open-network-stream' If you set this,
+the :use-tls parameter is ignored (as you are supposed to set the
+connection by yourself)
+
 `:user-name'
 
 VALUE must be a string.  If absent, `rcirc-default-user-name' is
@@ -102,6 +116,8 @@ connected to automatically."
 					     (:user-name string)
 					     (:password string)
 					     (:full-name string)
+					     (:use-tls boolean)
+					     (:custom-connect-function function)
 					     (:channels (repeat string)))))
   :group 'rcirc)
 
@@ -110,6 +126,11 @@ connected to automatically."
   :type 'integer
   :group 'rcirc)
 
+(defcustom rcirc-default-use-tls nil
+  "Use SSL/TLS by default?"
+  :type 'boolean
+  :group 'rcirc)
+
 (defcustom rcirc-default-nick (user-login-name)
   "Your nick."
   :type 'string
@@ -409,6 +430,7 @@ If ARG is non-nil, instead prompt for connection parameters."
                                      'rcirc-user-name-history))
 	     (password (read-passwd "IRC Password: " nil
                                     (plist-get server-plist :password)))
+	     (use-tls (yes-or-no-p "Use SSL/TLS? "))
 	     (channels (split-string
 			(read-string "IRC Channels: "
 				     (mapconcat 'identity
@@ -418,7 +440,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 			"[, ]+" t)))
 	(rcirc-connect server port nick user-name
 		       rcirc-default-full-name
-		       channels password))
+		       channels password use-tls))
     ;; connect to servers in `rcirc-server-alist'
     (let (connected-servers)
       (dolist (c rcirc-server-alist)
@@ -430,6 +452,9 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (full-name (or (plist-get (cdr c) :full-name)
 			     rcirc-default-full-name))
 	      (channels (plist-get (cdr c) :channels))
+	      (use-tls (or (plist-get (cdr c) :use-tls)
+		       rcirc-default-use-tls))
+	      (custom-connect-function (plist-get (cdr c) :custom-connect-function))
               (password (plist-get (cdr c) :password)))
 	  (when server
 	    (let (connected)
@@ -439,13 +464,15 @@ If ARG is non-nil, instead prompt for connection parameters."
 	      (if (not connected)
 		  (condition-case e
 		      (rcirc-connect server port nick user-name
-				     full-name channels password)
+				     full-name channels password use-tls
+				     custom-connect-function)
 		    (quit (message "Quit connecting to %s" server)))
 		(with-current-buffer (process-buffer connected)
+		  (if (process-contact (get-buffer-process
+					(current-buffer)) :host)
 		  (setq connected-servers
-			(cons (process-contact (get-buffer-process
-						(current-buffer)) :host)
-			      connected-servers))))))))
+			(cons (process-name connected)
+			      connected-servers)))))))))
       (when connected-servers
 	(message "Already connected to %s"
 		 (if (cdr connected-servers)
@@ -471,7 +498,8 @@ If ARG is non-nil, instead prompt for connection parameters."
 
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
-                             full-name startup-channels password)
+                             full-name startup-channels password use-tls
+			     custom-connect-function)
   (save-excursion
     (message "Connecting to %s..." server)
     (let* ((inhibit-eol-conversion)
@@ -484,7 +512,16 @@ If ARG is non-nil, instead prompt for connection parameters."
 	   (user-name (or user-name rcirc-default-user-name))
 	   (full-name (or full-name rcirc-default-full-name))
 	   (startup-channels startup-channels)
-           (process (make-network-process :name server :host server :service port-number)))
+           (process))
+      (if (functionp custom-connect-function)
+	  (setq process (funcall custom-connect-function server nil server port-number))
+	(if use-tls
+	    (setq process (open-tls-stream server nil server port-number))
+	  (setq process (open-network-stream server nil server port-number))))
+      (unless process
+	(error (concat 
+	       (format "Couldn't connect to %s on %d " server port-number)
+	       (when use-tls "using TLS/SSL"))))
       ;; set up process
       (set-process-coding-system process 'raw-text 'raw-text)
       (switch-to-buffer (rcirc-generate-new-buffer-name process nil))
@@ -698,7 +735,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
   "Send PROCESS a STRING plus a newline."
   (let ((string (concat (encode-coding-string string rcirc-encode-coding-system)
                         "\n")))
-    (unless (eq (process-status process) 'open)
+    (unless (member (process-status process) '(open run))
       (error "Network connection to %s is not open"
              (process-name process)))
     (rcirc-debug process string)
@@ -1401,7 +1438,8 @@ Returns nil if the information is not recorded."
       (- rcirc-current-line last-activity-line))))
 
 (defvar rcirc-markup-text-functions
-  '(rcirc-markup-attributes
+  '(rcirc-markup-strip-irc-colors
+    rcirc-markup-attributes
     rcirc-markup-my-nick
     rcirc-markup-urls
     rcirc-markup-keywords
@@ -2302,6 +2340,10 @@ keywords when no KEYWORD is given."
   (insert (rcirc-facify (format-time-string rcirc-time-format)
 			'rcirc-timestamp)))
 
+(defun rcirc-markup-strip-irc-colors (sender response)
+  (while (re-search-forward "\C-c\\([0-9][0-9]?\\(,[0-9][0-9]?\\)?\\)?" nil t)
+    (delete-region (match-beginning 0) (match-end 0))))
+
 (defun rcirc-markup-attributes (sender response)
   (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
     (rcirc-add-face (match-beginning 0) (match-end 0)

[-- Attachment #3: Type: text/plain, Size: 12 bytes --]



-- 
Marco

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31  8:07 ` Julien Danjou
@ 2011-05-31  8:52   ` Marco Pessotto
  0 siblings, 0 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31  8:52 UTC (permalink / raw)
  To: Julien Danjou; +Cc: rcyeske, emacs-devel

Julien Danjou <julien@danjou.info> writes:

> On Mon, May 30 2011, Marco Pessotto wrote:
>
> Hi Marco,
>
>> I'm writing you to submit a patch for rcirc.el to give it support for
>> SSL connections. 
>
> This patch really looks interesting. Would you mind submitting it to
> bug-gnu-emacs rather than here. That way I'll be sure it'll get merged
> and will not be forgotten. :)
>
> Thanks,

Submitted at http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8772

Cheers

-- 
Marco



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-30 21:46 [PATCH] rcirc: support TLS/SSL and arbitrary connection method Marco Pessotto
  2011-05-31  1:24 ` Stefan Monnier
  2011-05-31  8:07 ` Julien Danjou
@ 2011-05-31  9:55 ` Ted Zlatanov
  2011-05-31 11:16   ` Marco Pessotto
  2011-06-07 22:27   ` Philipp Haselwarter
  2 siblings, 2 replies; 18+ messages in thread
From: Ted Zlatanov @ 2011-05-31  9:55 UTC (permalink / raw)
  To: Emacs Development; +Cc: rcyeske, Marco Pessotto

On Mon, 30 May 2011 23:46:30 +0200 Marco Pessotto <melmothx@gmail.com> wrote: 

MP> I'm writing you to submit a patch for rcirc.el to give it support for
MP> SSL connections. 
...
MP> +(require 'tls)
...
MP> +	(if use-tls
MP> +	    (setq process (open-tls-stream server nil server port-number))
MP> +	  (setq process (open-network-stream server nil server port-number))))

Recent trunk versions of Emacs have an `open-network-stream' that
supports the built-in GnuTLS code directly.  That's much better than
`open-tls-stream'.  Could you look at that and maybe use it?

Also I sent Ryan a patch recently to add auth-source support to
rcirc.el, but haven't heard back.  I originally posted it to the
emacs-bug mailing list a few months ago and can resend it.  I haven't
applied it because I don't use rcirc.el myself.

Ted



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31  9:55 ` Ted Zlatanov
@ 2011-05-31 11:16   ` Marco Pessotto
  2011-06-07 22:27   ` Philipp Haselwarter
  1 sibling, 0 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31 11:16 UTC (permalink / raw)
  To: Emacs Development; +Cc: Ted Zlatanov, rcyeske


Ted Zlatanov <tzz@lifelogs.com> writes:

> On Mon, 30 May 2011 23:46:30 +0200 Marco Pessotto <melmothx@gmail.com> wrote: 
>
> MP> I'm writing you to submit a patch for rcirc.el to give it support for
> MP> SSL connections. 
> ...
> MP> +(require 'tls)
> ...
> MP> +	(if use-tls
> MP> +	    (setq process (open-tls-stream server nil server port-number))
> MP> +	  (setq process (open-network-stream server nil server port-number))))
>
> Recent trunk versions of Emacs have an `open-network-stream' that
> supports the built-in GnuTLS code directly.  That's much better than
> `open-tls-stream'.  Could you look at that and maybe use it?

Well, I looked at the trunk and the encryption thing is already there,
starting from rev 104199.

So you can trash the patch, which is meant for the 23.x branch, and
close the "bug".

I've updated the emacs wiki page with (hopefully) the correct
informations: http://www.emacswiki.org/emacs/rcirc#toc4

And sorry for the noise. 

Cheers

-- 
Marco



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31  1:24 ` Stefan Monnier
@ 2011-05-31 12:16   ` Julien Danjou
  2011-05-31  8:43     ` bug#8772: " Marco Pessotto
                       ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Julien Danjou @ 2011-05-31 12:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, rcyeske, Marco Pessotto

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

On Tue, May 31 2011, Stefan Monnier wrote:

>> The last 2 chunks of the patch are meant to strip the IRC colors.
>> Not really part of the "connection" patch, but IMHO useful.
>
> Could you describe a bit more what this is about (I'm not a regular IRC
> user)?  I can't remember seeing those C-c escape sequences, when do they
> appear, what are they expected to do?  Should we really strip them, or
> would it be even better to turn them into faces?

C-c are escape code for colors. I think they came with mIRC first, but
well, I don't know for sure.

See: http://www.mirc.com/colors.html

I don't think they should be stripped, but they should be rendered using
faces as you suggest. And this probably be configurable with a
defcustom.

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31 12:16   ` Julien Danjou
  2011-05-31  8:43     ` bug#8772: " Marco Pessotto
@ 2011-05-31 12:58     ` Deniz Dogan
  2011-05-31 14:21     ` Marco Pessotto
  2 siblings, 0 replies; 18+ messages in thread
From: Deniz Dogan @ 2011-05-31 12:58 UTC (permalink / raw)
  To: emacs-devel

On 2011-05-31 14:16, Julien Danjou wrote:
> On Tue, May 31 2011, Stefan Monnier wrote:
>
>>> The last 2 chunks of the patch are meant to strip the IRC colors.
>>> Not really part of the "connection" patch, but IMHO useful.
>> Could you describe a bit more what this is about (I'm not a regular IRC
>> user)?  I can't remember seeing those C-c escape sequences, when do they
>> appear, what are they expected to do?  Should we really strip them, or
>> would it be even better to turn them into faces?
> C-c are escape code for colors. I think they came with mIRC first, but
> well, I don't know for sure.
>
> See: http://www.mirc.com/colors.html
>
> I don't think they should be stripped, but they should be rendered using
> faces as you suggest. And this probably be configurable with a
> defcustom.

For what it's worth, EmacsWiki has rcirc-controls.el: 
http://www.emacswiki.org/emacs/rcirc-controls.el ...it has a few issues 
if I remember correctly, mainly poor performance. The processing will be 
very noticeable when dealing with messages with many control codes.

Another thing I'd really like to have in rcirc is the ability to use M-o 
to put some colors and other effects which are then translated to 
control codes when sent.

/Deniz




^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#8772: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31  8:43     ` bug#8772: " Marco Pessotto
@ 2011-05-31 14:21       ` Marco Pessotto
  0 siblings, 0 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31 14:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Julien Danjou, 8772, rcyeske, emacs-devel


Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I'm writing you to submit a patch for rcirc.el to give it support for
>> SSL connections.
>
> Thank you.  But I'm afraid you're just a few weeks late:
>
>    revno: 104199
>    committer: Stefan Monnier <monnier@iro.umontreal.ca>
>    branch nick: trunk
>    timestamp: Wed 2011-05-11 23:25:58 -0300

Yeah, I noticed, as you've probably seen:
http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg01016.html

There was obviously a communication problem. 

I talked on the irc channel #rcirc about a SSL patch 2 months ago, but
apparently without waking a real interest from the maintainers.
The irc channel was obviously the wrong place to talk about this.

Also, I assumed that the place where the development was happening was
the rcy's git(hub) repo, but, again, I was wrong.

So what else can I say? Sorry for the noise. I patched rcirc because
I prefer to run a stable emacs, I like rcirc and I need the SSL
connection *now*.

Julien Danjou <julien@danjou.info> writes:

> On Tue, May 31 2011, Stefan Monnier wrote:
>
>>> The last 2 chunks of the patch are meant to strip the IRC colors.
>>> Not really part of the "connection" patch, but IMHO useful.
>>
>> Could you describe a bit more what this is about (I'm not a regular IRC
>> user)?  I can't remember seeing those C-c escape sequences, when do they
>> appear, what are they expected to do?  Should we really strip them, or
>> would it be even better to turn them into faces?
>
> C-c are escape code for colors. I think they came with mIRC first, but
> well, I don't know for sure.
>
> See: http://www.mirc.com/colors.html
>
> I don't think they should be stripped, but they should be rendered using
> faces as you suggest. And this probably be configurable with a
> defcustom.

I prefer to have the colors stripped out, because [IMHO] they are just
lame.

  "rcirc is a next generation IRC client. It blends seamlessly with the
  rest of emacs, it’s tight, fast, and doesn’t light up like a christmas
  tree." -- http://www.emacswiki.org/emacs/rcirc

I believe the colors are part of the christmas tree ;-)

Best wishes

-- 
Marco





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31 12:16   ` Julien Danjou
  2011-05-31  8:43     ` bug#8772: " Marco Pessotto
  2011-05-31 12:58     ` Deniz Dogan
@ 2011-05-31 14:21     ` Marco Pessotto
  2011-05-31 14:57       ` bug#8772: " Stefan Monnier
  2011-05-31 14:57       ` Stefan Monnier
  2 siblings, 2 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31 14:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Julien Danjou, 8772, rcyeske, Deniz Dogan, emacs-devel


Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I'm writing you to submit a patch for rcirc.el to give it support for
>> SSL connections.
>
> Thank you.  But I'm afraid you're just a few weeks late:
>
>    revno: 104199
>    committer: Stefan Monnier <monnier@iro.umontreal.ca>
>    branch nick: trunk
>    timestamp: Wed 2011-05-11 23:25:58 -0300

Yeah, I noticed, as you've probably seen:
http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg01016.html

There was obviously a communication problem. 

I talked on the irc channel #rcirc about a SSL patch 2 months ago, but
apparently without waking a real interest from the maintainers.
The irc channel was obviously the wrong place to talk about this.

Also, I assumed that the place where the development was happening was
the rcy's git(hub) repo, but, again, I was wrong.

So what else can I say? Sorry for the noise. I patched rcirc because
I prefer to run a stable emacs, I like rcirc and I need the SSL
connection *now*.

Julien Danjou <julien@danjou.info> writes:

> On Tue, May 31 2011, Stefan Monnier wrote:
>
>>> The last 2 chunks of the patch are meant to strip the IRC colors.
>>> Not really part of the "connection" patch, but IMHO useful.
>>
>> Could you describe a bit more what this is about (I'm not a regular IRC
>> user)?  I can't remember seeing those C-c escape sequences, when do they
>> appear, what are they expected to do?  Should we really strip them, or
>> would it be even better to turn them into faces?
>
> C-c are escape code for colors. I think they came with mIRC first, but
> well, I don't know for sure.
>
> See: http://www.mirc.com/colors.html
>
> I don't think they should be stripped, but they should be rendered using
> faces as you suggest. And this probably be configurable with a
> defcustom.

I prefer to have the colors stripped out, because [IMHO] they are just
lame.

  "rcirc is a next generation IRC client. It blends seamlessly with the
  rest of emacs, it’s tight, fast, and doesn’t light up like a christmas
  tree." -- http://www.emacswiki.org/emacs/rcirc

I believe the colors are part of the christmas tree ;-)

Best wishes

-- 
Marco



^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#8772: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31 14:21     ` Marco Pessotto
@ 2011-05-31 14:57       ` Stefan Monnier
  2011-05-31 14:57       ` Stefan Monnier
  1 sibling, 0 replies; 18+ messages in thread
From: Stefan Monnier @ 2011-05-31 14:57 UTC (permalink / raw)
  To: Marco Pessotto; +Cc: Julien Danjou, 8772, rcyeske, emacs-devel

> I talked on the irc channel #rcirc about a SSL patch 2 months ago, but
> apparently without waking a real interest from the maintainers.
> The irc channel was obviously the wrong place to talk about this.

Not being a regular user of IRC, I'm basically never on #rcirc.

> Also, I assumed that the place where the development was happening was
> the rcy's git(hub) repo, but, again, I was wrong.

I didn't know Ryan kept a separate repository for it.  That could be
a problem if the two aren't kept in sync.  Of course, the other problem
is that I haven't heard from Ryan in a long while.

> So what else can I say? Sorry for the noise.

There's nothing to be sorry about.

> I prefer to have the colors stripped out, because [IMHO] they are just
> lame.

>   "rcirc is a next generation IRC client. It blends seamlessly with the
>   rest of emacs, it’s tight, fast, and doesn’t light up like a christmas
>   tree." -- http://www.emacswiki.org/emacs/rcirc

> I believe the colors are part of the christmas tree ;-)

I can relate to that.  Could you send a new patch relative to Emacs
trunk's version of rcirc.el?

Thanks for your contribution, in any case,


        Stefan





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31 14:21     ` Marco Pessotto
  2011-05-31 14:57       ` bug#8772: " Stefan Monnier
@ 2011-05-31 14:57       ` Stefan Monnier
  2011-05-31 15:35         ` Marco Pessotto
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2011-05-31 14:57 UTC (permalink / raw)
  To: Marco Pessotto; +Cc: Julien Danjou, 8772, rcyeske, Deniz Dogan, emacs-devel

> I talked on the irc channel #rcirc about a SSL patch 2 months ago, but
> apparently without waking a real interest from the maintainers.
> The irc channel was obviously the wrong place to talk about this.

Not being a regular user of IRC, I'm basically never on #rcirc.

> Also, I assumed that the place where the development was happening was
> the rcy's git(hub) repo, but, again, I was wrong.

I didn't know Ryan kept a separate repository for it.  That could be
a problem if the two aren't kept in sync.  Of course, the other problem
is that I haven't heard from Ryan in a long while.

> So what else can I say? Sorry for the noise.

There's nothing to be sorry about.

> I prefer to have the colors stripped out, because [IMHO] they are just
> lame.

>   "rcirc is a next generation IRC client. It blends seamlessly with the
>   rest of emacs, it’s tight, fast, and doesn’t light up like a christmas
>   tree." -- http://www.emacswiki.org/emacs/rcirc

> I believe the colors are part of the christmas tree ;-)

I can relate to that.  Could you send a new patch relative to Emacs
trunk's version of rcirc.el?

Thanks for your contribution, in any case,


        Stefan



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31 14:57       ` Stefan Monnier
@ 2011-05-31 15:35         ` Marco Pessotto
  0 siblings, 0 replies; 18+ messages in thread
From: Marco Pessotto @ 2011-05-31 15:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Julien Danjou, rcyeske, Deniz Dogan, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I prefer to have the colors stripped out, because [IMHO] they are just
>> lame.
>
>>   "rcirc is a next generation IRC client. It blends seamlessly with the
>>   rest of emacs, it’s tight, fast, and doesn’t light up like a christmas
>>   tree." -- http://www.emacswiki.org/emacs/rcirc
>
>> I believe the colors are part of the christmas tree ;-)
>
> I can relate to that.  Could you send a new patch relative to Emacs
> trunk's version of rcirc.el?
>

It's kind of trivial, but that's it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: strip irc color --]
[-- Type: text/x-diff, Size: 908 bytes --]

=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el	2011-05-30 12:23:56 +0000
+++ lisp/net/rcirc.el	2011-05-31 15:07:58 +0000
@@ -1451,7 +1451,8 @@
       (- rcirc-current-line last-activity-line))))
 
 (defvar rcirc-markup-text-functions
-  '(rcirc-markup-attributes
+  '(rcirc-markup-strip-irc-colors
+    rcirc-markup-attributes
     rcirc-markup-my-nick
     rcirc-markup-urls
     rcirc-markup-keywords
@@ -2370,6 +2371,10 @@
   (insert (rcirc-facify (format-time-string rcirc-time-format)
 			'rcirc-timestamp)))
 
+(defun rcirc-markup-strip-irc-colors (sender response)
+  (while (re-search-forward "\C-c\\([0-9][0-9]?\\(,[0-9][0-9]?\\)?\\)?" nil t)
+    (delete-region (match-beginning 0) (match-end 0))))
+
 (defun rcirc-markup-attributes (sender response)
   (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t)
     (rcirc-add-face (match-beginning 0) (match-end 0)


[-- Attachment #3: Type: text/plain, Size: 24 bytes --]


Best wishes

-- 
Marco

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-05-31  9:55 ` Ted Zlatanov
  2011-05-31 11:16   ` Marco Pessotto
@ 2011-06-07 22:27   ` Philipp Haselwarter
  2011-06-08  3:32     ` Ted Zlatanov
  1 sibling, 1 reply; 18+ messages in thread
From: Philipp Haselwarter @ 2011-06-07 22:27 UTC (permalink / raw)
  To: emacs-devel

On 2011-05-31 09:55 UT, Ted Zlatanov <tzz@lifelogs.com> wrote:

TZ> On Mon, 30 May 2011 23:46:30 +0200 Marco Pessotto <melmothx@gmail.com> wrote:

MP> I'm writing you to submit a patch for rcirc.el to give it support
MP> for SSL connections.
TZ> ...
MP> +(require 'tls)
TZ> ...
MP> + (if use-tls + (setq process (open-tls-stream server nil server
MP> port-number)) + (setq process (open-network-stream server nil server
MP> port-number))))

TZ> Recent trunk versions of Emacs have an `open-network-stream' that
TZ> supports the built-in GnuTLS code directly.That's much better than
TZ> `open-tls-stream'.Could you look at that and maybe use it?

TZ> Also I sent Ryan a patch recently to add auth-source support to
TZ> rcirc.el, but haven't heard back.I originally posted it to the
TZ> emacs-bug mailing list a few months ago and can resend it.I haven't
TZ> applied it because I don't use rcirc.el myself.

TZ> Ted

As you brought it up - are there actually plans to make erc use
auth-source?

-- 
Philipp Haselwarter




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-06-07 22:27   ` Philipp Haselwarter
@ 2011-06-08  3:32     ` Ted Zlatanov
  2011-06-08  8:52       ` Julien Danjou
  0 siblings, 1 reply; 18+ messages in thread
From: Ted Zlatanov @ 2011-06-08  3:32 UTC (permalink / raw)
  To: emacs-devel

On Wed, 08 Jun 2011 00:27:35 +0200 Philipp Haselwarter <philipp.haselwarter@gmx.de> wrote: 

PH> As you brought it up - are there actually plans to make erc use
PH> auth-source?

I'll add the support if you want it (same as any other Emacs or external
package, just ask me).

Ted




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] rcirc: support TLS/SSL and arbitrary connection method
  2011-06-08  3:32     ` Ted Zlatanov
@ 2011-06-08  8:52       ` Julien Danjou
  2011-06-08 14:22         ` auth-source for ERC (was: [PATCH] rcirc: support TLS/SSL and arbitrary connection method) Ted Zlatanov
  0 siblings, 1 reply; 18+ messages in thread
From: Julien Danjou @ 2011-06-08  8:52 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

On Wed, Jun 08 2011, Ted Zlatanov wrote:

> I'll add the support if you want it (same as any other Emacs or external
> package, just ask me).

Does it work if I ask it too? :)

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* auth-source for ERC (was: [PATCH] rcirc: support TLS/SSL and arbitrary connection method)
  2011-06-08  8:52       ` Julien Danjou
@ 2011-06-08 14:22         ` Ted Zlatanov
  0 siblings, 0 replies; 18+ messages in thread
From: Ted Zlatanov @ 2011-06-08 14:22 UTC (permalink / raw)
  To: emacs-devel

On Wed, 08 Jun 2011 10:52:29 +0200 Julien Danjou <julien@danjou.info> wrote: 

JD> On Wed, Jun 08 2011, Ted Zlatanov wrote:
>> I'll add the support if you want it (same as any other Emacs or external
>> package, just ask me).

JD> Does it work if I ask it too? :)

For you, half the price!

Can I just modify `erc-select-read-args'?  That will let me supply
credentials from lines like this:

machine xyz login joe password sikrit port irc
machine xyz:1234 login joe password sikrit port irc

(assuming "port irc" is the way to match the service)

The rcirc patch had very similar code to this, so it should be easy to
implement.

Ted




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-06-08 14:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-30 21:46 [PATCH] rcirc: support TLS/SSL and arbitrary connection method Marco Pessotto
2011-05-31  1:24 ` Stefan Monnier
2011-05-31 12:16   ` Julien Danjou
2011-05-31  8:43     ` bug#8772: " Marco Pessotto
2011-05-31 14:21       ` Marco Pessotto
2011-05-31 12:58     ` Deniz Dogan
2011-05-31 14:21     ` Marco Pessotto
2011-05-31 14:57       ` bug#8772: " Stefan Monnier
2011-05-31 14:57       ` Stefan Monnier
2011-05-31 15:35         ` Marco Pessotto
2011-05-31  8:07 ` Julien Danjou
2011-05-31  8:52   ` Marco Pessotto
2011-05-31  9:55 ` Ted Zlatanov
2011-05-31 11:16   ` Marco Pessotto
2011-06-07 22:27   ` Philipp Haselwarter
2011-06-08  3:32     ` Ted Zlatanov
2011-06-08  8:52       ` Julien Danjou
2011-06-08 14:22         ` auth-source for ERC (was: [PATCH] rcirc: support TLS/SSL and arbitrary connection method) Ted Zlatanov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.