From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: vibhavp@gmail.com Newsgroups: gmane.emacs.devel Subject: [PATCH] ERC: Hide identification password sent to Nickserv Date: Sun, 15 Mar 2015 15:23:45 +0530 Message-ID: <87bnjubn86.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1426413221 24738 80.91.229.3 (15 Mar 2015 09:53:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Mar 2015 09:53:41 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 15 10:53:41 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YX5Eq-0007j5-1x for ged-emacs-devel@m.gmane.org; Sun, 15 Mar 2015 10:53:40 +0100 Original-Received: from localhost ([::1]:42876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX5Ep-0007hz-EW for ged-emacs-devel@m.gmane.org; Sun, 15 Mar 2015 05:53:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX5Ek-0007hh-EN for emacs-devel@gnu.org; Sun, 15 Mar 2015 05:53:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YX5Eh-0000nk-46 for emacs-devel@gnu.org; Sun, 15 Mar 2015 05:53:34 -0400 Original-Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:34177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX5Eg-0000nT-Si for emacs-devel@gnu.org; Sun, 15 Mar 2015 05:53:31 -0400 Original-Received: by pacwe9 with SMTP id we9so33888481pac.1 for ; Sun, 15 Mar 2015 02:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=dQSqAHbCiaqD/+dx15V0yTPXNIy6ooTB4QzYjvtnMWw=; b=LGEc2wHRf9vHO3zNKVFCib566McBSC9AqbbLX36UhjhlsYJvKaAR/91ILEWvGZhWOS whTroBwiZ+f6tECg9xpam6XfC6WcGzi1BIXXrtCqBv6895Do7387FRZt48VRVzLF514I xbBdSQKGpUAc8tJ3LTOb8P8owTkPRiU9jkem12bAln5LoSGhi15kObj/NfVpe6i9XnSf T/D9HtpJzRIkwFBF4v1JVgZjGUjV/MSpP7EBHb70faXc8myyw/lISRNn1Y8NOEK+P3ch 1fkeLTaLOPTnzgPuwvVkRsduOGoH7ZH/MbMHsvFypuAkT5/VIDMmlQqIZqkSqEC39kO6 iaBg== X-Received: by 10.66.101.73 with SMTP id fe9mr124676284pab.156.1426413209230; Sun, 15 Mar 2015 02:53:29 -0700 (PDT) Original-Received: from lenovog410 ([59.89.18.177]) by mx.google.com with ESMTPSA id qz3sm11788555pab.13.2015.03.15.02.53.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Mar 2015 02:53:28 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183873 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=erc-passwd-hide.patch 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 + + * 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 * 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 --=-=-= Content-Type: text/plain Thanks. -- Vibhav Pant vibhavp@gmail.com --=-=-=--