all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ERC: Hide identification password sent to Nickserv
@ 2015-03-15  9:53 vibhavp
  2015-03-15 10:09 ` Vibhav Pant
  2015-03-17  1:10 ` vibhavp
  0 siblings, 2 replies; 5+ messages in thread
From: vibhavp @ 2015-03-15  9:53 UTC (permalink / raw)
  To: emacs-devel

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

Hello,
I've added a feature to Emacs which hides the password sent to nickserv
for nick identification by changing the password's "display" test
property with a dotted string. Here's an example:
ERC> /msg nickserv identify foobar
When sent to ERC, the ERC buffer displays this as:
ERC> /msg nickserv identify .....
I've also added this to the default list of modules, so passwords are
hidden by default. Feel free to point out anything wrong in the
attached patch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: erc-passwd-hide.patch --]
[-- Type: text/x-diff, Size: 2491 bytes --]

diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 4f5fced..bbdb74e 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-15  Vibhav Pant  <vibhavp@gmail.com>
+
+	* erc-goodies.el (erc-hide-ident-password): New function.
+	(hide-nickserv-password): New module.
+	* erc-el: Add hide-nickserv-password to erc-modules.
+
 2015-03-03  Kelvin White  <kwhite@gnu.org>
 
 	* erc.el: Add old version string back to file header for
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index ca2d14a..84f7f1f 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -550,6 +550,27 @@ See also `unmorse-region'."
       ;; Unmorse region
       (unmorse-region (point-min) (point-max)))))
 
+;; Hide Nickserv identify password
+(define-erc-module hide-nickserv-password nil
+  "This mode hides the identify password sent to Nickserv.
+It replaces each character of the password with '.'"
+  ((add-hook 'erc-send-modify-hook 'erc-hide-ident-password))
+  ((remove-hook 'erc-send-modify-hook 'erc-hide-ident-password)))
+
+(defun erc-hide-ident-password ()
+  "Hide the identification password sent to Nickserv.
+Search the buffer for any identification requests to Nickserv, and
+sets the display text property of the password to a dotted string."
+  (save-excursion
+    (with-current-buffer (current-buffer)
+      (goto-char (point-min))
+      (when (re-search-forward "/\\(msg\\|query\\) nickserv identify "
+			       nil t nil)
+	(let ((bounds (bounds-of-thing-at-point 'word)))
+	  (put-text-property (car bounds) (cdr bounds) 'display
+			     (make-string
+			      (- (cdr bounds) (car bounds)) ?.)))))))
+
 ;;; erc-occur
 (defun erc-occur (string &optional proc)
   "Search for STRING in all buffers related to current server.
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index a84f9f0..bfbceae 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1810,7 +1810,8 @@ buffer rather than a server buffer.")
 
 (defcustom erc-modules '(netsplit fill button match track completion readonly
                                   networks ring autojoin noncommands irccontrols
-                                  move-to-prompt stamp menu list)
+                                  move-to-prompt stamp menu list
+				  hide-nickserv-password)
   "A list of modules which ERC should enable.
 If you set the value of this without using `customize' remember to call
 \(erc-update-modules) after you change it.  When using `customize', modules

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


Thanks.
-- 
Vibhav Pant
vibhavp@gmail.com

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

* Re: [PATCH] ERC: Hide identification password sent to Nickserv
  2015-03-15  9:53 [PATCH] ERC: Hide identification password sent to Nickserv vibhavp
@ 2015-03-15 10:09 ` Vibhav Pant
  2015-03-17  1:10 ` vibhavp
  1 sibling, 0 replies; 5+ messages in thread
From: Vibhav Pant @ 2015-03-15 10:09 UTC (permalink / raw)
  To: emacs-devel@gnu.org

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

On Sun, Mar 15, 2015 at 3:23 PM,  <vibhavp@gmail.com> wrote:
Attached image of the module in action.

> for nick identification by changing the password's "display" test
s/test/text/
-- 
Vibhav Pant
vibhavp@gmail.com

[-- Attachment #2: 2015-03-15-153902_1280x800_scrot.png --]
[-- Type: image/png, Size: 107494 bytes --]

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

* Re: [PATCH] ERC: Hide identification password sent to Nickserv
  2015-03-17  1:10 ` vibhavp
@ 2015-03-16 20:02   ` Kelvin White
  2015-03-17 21:56     ` Kelvin White
  0 siblings, 1 reply; 5+ messages in thread
From: Kelvin White @ 2015-03-16 20:02 UTC (permalink / raw)
  To: vibhavp; +Cc: Emacs development discussions

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

I plan to look at it this evening, Thanks
On Mar 16, 2015 3:51 PM, <vibhavp@gmail.com> wrote:

> vibhavp@gmail.com writes:
>
> > Hello,
> > I've added a feature to Emacs which hides the password sent to nickserv
> > for nick identification by changing the password's "display" test
> > property with a dotted string
> Any objections to the patch? I'd like to have it pushed into master.
>
> --
> Vibhav Pant
> vibhavp@gmail.com
>
>
>

[-- Attachment #2: Type: text/html, Size: 820 bytes --]

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

* Re: [PATCH] ERC: Hide identification password sent to Nickserv
  2015-03-15  9:53 [PATCH] ERC: Hide identification password sent to Nickserv vibhavp
  2015-03-15 10:09 ` Vibhav Pant
@ 2015-03-17  1:10 ` vibhavp
  2015-03-16 20:02   ` Kelvin White
  1 sibling, 1 reply; 5+ messages in thread
From: vibhavp @ 2015-03-17  1:10 UTC (permalink / raw)
  To: emacs-devel

vibhavp@gmail.com writes:

> Hello,
> I've added a feature to Emacs which hides the password sent to nickserv
> for nick identification by changing the password's "display" test
> property with a dotted string
Any objections to the patch? I'd like to have it pushed into master.

-- 
Vibhav Pant
vibhavp@gmail.com



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

* Re: [PATCH] ERC: Hide identification password sent to Nickserv
  2015-03-16 20:02   ` Kelvin White
@ 2015-03-17 21:56     ` Kelvin White
  0 siblings, 0 replies; 5+ messages in thread
From: Kelvin White @ 2015-03-17 21:56 UTC (permalink / raw)
  To: vibhavp; +Cc: Emacs development discussions

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

> Any objections to the patch? I'd like to have it pushed into master.

I think it's a nice idea but it's inconsistent with other commands that may
contain passwords. Also, I don't think it should be a default setting.
IRC commands aren't logged or even inserted in the buffer.

[-- Attachment #2: Type: text/html, Size: 419 bytes --]

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

end of thread, other threads:[~2015-03-17 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15  9:53 [PATCH] ERC: Hide identification password sent to Nickserv vibhavp
2015-03-15 10:09 ` Vibhav Pant
2015-03-17  1:10 ` vibhavp
2015-03-16 20:02   ` Kelvin White
2015-03-17 21:56     ` Kelvin White

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.