erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][emacs22] Update from CVS


From: mwolson
Subject: [Erc-commit] [commit][emacs22] Update from CVS
Date: Sun, 14 Oct 2007 00:47:59 -0400

commit 7d8aaa5d51b50d30c778a22df7f28c6a46f1528f
Author: Michael Olson <address@hidden>
Date:   Thu Feb 9 02:39:29 2006 +0000

    Update from CVS
    
    2006-02-09  Diane Murray  <address@hidden>
    
       * erc-capab.el: New file. Adds the new module
       `erc-capab-identify', which allows flagging of unidentified users
       on servers running an ircd based on dancer - irc.freenode.net, for
       example.
    
       * erc.el (erc-modules): Added `capab-identify' to options.
       (erc-get-parsed-vector, erc-get-parsed-vector-nick)
       (erc-get-parsed-vector-type): Moved here from erc-match.el.
    
       * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
       (erc-get-parsed-vector-type): Moved these functions to erc.el
       since they can be useful outside of the text matching module.
    
       * CREDITS: Added erc-capab.el. List both erc-nickserv.el and
       erc-services.el since the file name has changed.
    
       * NEWS: Added erc-capab.el.
    
       * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client"
       to "ERC".
    git-archimport-id: address@hidden/erc--cvs--0--patch-106

diff --git a/CREDITS b/CREDITS
index f16f6bd..c06ea5e 100644
--- a/CREDITS
+++ b/CREDITS
@@ -23,7 +23,7 @@ Tijs van Bakel <address@hidden>:
 
 Diane Murray <address@hidden>:
   * Miscellaneous development, additions, bug fixes
-  * erc-nickserv.el
+  * erc-capab.el, erc-nickserv.el/erc-services.el
 
 Gergely Nagy <address@hidden> (aka "mhp"):
   * Debian package maintainer
diff --git a/ChangeLog b/ChangeLog
index c40a478..735e8f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2006-02-09  Diane Murray  <address@hidden>
+
+       * erc-capab.el: New file.  Adds the new module
+       `erc-capab-identify', which allows flagging of unidentified users
+       on servers running an ircd based on dancer - irc.freenode.net, for
+       example.
+
+       * erc.el (erc-modules): Added `capab-identify' to options.
+       (erc-get-parsed-vector, erc-get-parsed-vector-nick)
+       (erc-get-parsed-vector-type): Moved here from erc-match.el.
+
+       * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
+       (erc-get-parsed-vector-type): Moved these functions to erc.el
+       since they can be useful outside of the text matching module.
+
+       * CREDITS: Added erc-capab.el.  List both erc-nickserv.el and
+       erc-services.el since the file name has changed.
+
+       * NEWS: Added erc-capab.el.
+
+       * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client"
+       to "ERC".
+
 2006-02-07  Michael Olson  <address@hidden>
 
        * ChangeLog.01, ChangeLog.02, ChangeLog.03, ChangeLog.04,
diff --git a/NEWS b/NEWS
index eee5589..bf60399 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
 ERC NEWS                                                       -*- outline -*-
 
+* Changes since ERC 5.1.1
+
+** New modules
+
+*** Capab identify (erc-capab.el)
+
+**** Mark unidentified users on servers supporting CAPAB IDENTIFY-MSG.
+
 * Changes in ERC 5.1.1
 
 ** Fix a requirement on cl.el.
diff --git a/erc-capab.el b/erc-capab.el
new file mode 100644
index 0000000..e0a9f01
--- /dev/null
+++ b/erc-capab.el
@@ -0,0 +1,191 @@
+;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB
+
+;; Copyright (C) 2006 Free Software Foundation, Inc.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file defines the ERC module `erc-capab-identify', which allows
+;; flagging of unidentified users on servers running dancer-ircd or
+;; hyperion.  freenode.net supports this capability, for example.
+
+;; With CAPAB IDENTIFY-MSG and IDENTIFY-CTCP enabled, messages from
+;; users who have identified themselves to NickServ will have a plus
+;; sign and messages from unidentified users will have a minus sign
+;; added as a prefix.  Note that it is not necessary for your nickname
+;; to be identified in order to receive these marked messages.
+
+;; The plus or minus sign is removed from the message, and a prefix,
+;; `erc-capab-identify-prefix', is inserted in the front of the user's
+;; nickname if the nickname is not identified.
+
+;; Please note that once this has been enabled on a server, there is no
+;; way to tell the server to stop sending marked messages.  If you
+;; disable this module, it will continue removing message flags, but the
+;; unidentified nickname prefix will not be added to messages.
+
+;; Visit <http://freenode.net/faq.shtml#spoofing> and
+;; <http://freenode.net/faq.shtml#registering> to find further
+;; explanations of this capability.
+
+;; From freenode.net's web site (not there anymore) on how to mark
+;; unidentified users:
+;; "We recommend that you add an asterisk before the nick, and
+;;  optionally either highlight or colourize the line in some
+;;  appropriate fashion, if the user is not identified."
+
+;;; Usage:
+
+;; Enable the module `capab-identify' (see the documentation for
+;; `erc-modules').  `erc-capab-identify-prefix' will now be added to the
+;; beginning of unidentified users' nicknames.  The default is an
+;; asterisk.  If the value of this variable is nil, no prefix will be
+;; inserted, but the flag sent by the server will still be stripped.
+
+;;; Todo:
+
+;; Somebody who knows about autoload cookies could please add them where
+;; necessary.
+
+;;; Code:
+
+(defconst erc-capab-version "$Revision: 1.2 $"
+  "ERC CAPAB revision number.")
+
+;;; Customization:
+
+(defgroup erc-capab nil
+  "Support for dancer-ircd's CAPAB settings."
+  :group 'erc)
+
+(defcustom erc-capab-identify-prefix "*"
+  "The prefix used for unidentified users."
+  :group 'erc-capab
+  :type '(choice string (const nil)))
+
+;;; Define module:
+
+(define-erc-response-handler (290)
+  "Handle dancer-ircd CAPAB messages." nil nil)
+
+(define-erc-module capab-identify nil
+  "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP."
+  ;; append so that `erc-server-parameters' is already set by `erc-server-005'
+  ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t)
+   (add-hook 'erc-server-290-functions 'erc-capab-identify-activate)
+   (add-hook 'erc-server-PRIVMSG-functions
+             'erc-capab-identify-remove/set-identified-flag)
+   (add-hook 'erc-server-NOTICE-functions
+             'erc-capab-identify-remove/set-identified-flag)
+   (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t))
+  ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup)
+   (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate)
+   ;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks
+   ;; because there doesn't seem to be a way to tell the server to turn it off
+   (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix)))
+
+;;; Variables:
+
+(defvar erc-capab-identify-activated nil
+  "CAPAB IDENTIFY-MSG has been activated.")
+(make-variable-buffer-local 'erc-capab-identify-activated)
+
+(defvar erc-capab-identify-sent nil
+  "CAPAB IDENTIFY-MSG and IDENTIFY-CTCP messages have been sent.")
+(make-variable-buffer-local 'erc-capab-identify-sent)
+
+;;; Functions:
+
+(defun erc-capab-identify-setup (proc parsed)
+  "Set up CAPAB IDENTIFY on the current server.
+
+PROC is the current server's process.
+PARSED is the current message, a response struct."
+  (unless erc-capab-identify-sent
+    (erc-capab-send-identify-messages)))
+
+(defun erc-capab-send-identify-messages ()
+  "Send CAPAB IDENTIFY messages if the server supports it."
+  (when (and (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version)
+             ;; could possibly check for IRCD=dancer in `erc-server-parameters'
+             ;; instead of looking for specific version names
+            (assoc "CAPAB" erc-server-parameters))
+    (erc-log "Sending CAPAB IDENTIFY-MSG and IDENTIFY-CTCP")
+    (erc-send-command "CAPAB IDENTIFY-MSG")
+    (erc-send-command "CAPAB IDENTIFY-CTCP")
+    (setq erc-capab-identify-sent t)))
+
+
+(defun erc-capab-identify-activate (proc parsed)
+  "Set `erc-capab-identify-activated' and display an activation message.
+
+PROC is the current server's process.
+PARSED is an `erc-parsed' response struct."
+  (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed))
+           (string= "IDENTIFY-CTCP" (erc-response.contents parsed)))
+    (setq erc-capab-identify-activated t)
+    (erc-display-message
+     parsed 'notice 'active (format "%s activated"
+                                    (erc-response.contents parsed)))))
+
+(defun erc-capab-identify-remove/set-identified-flag (proc parsed)
+  "Remove PARSED message's id flag and add the `erc-identified' text property.
+
+PROC is the current server's process.
+PARSED is an `erc-parsed' response struct."
+  (let ((msg (erc-response.contents parsed)))
+    (when (and erc-capab-identify-activated
+               (string-match "^\\([-\\+]\\)\\(.+\\)$" msg))
+      (setf (erc-response.contents parsed)
+            (if erc-capab-identify-mode
+                (erc-propertize (match-string 2 msg)
+                                'erc-identified
+                                (string= (match-string 1 msg) "+"))
+              (match-string 2 msg)))
+      nil)))
+
+(defun erc-capab-identify-add-prefix ()
+  "Add `erc-capab-identify-prefix' to nickname if user is unidentified."
+  (when (and erc-capab-identify-prefix
+             (with-current-buffer (erc-server-buffer)
+               erc-capab-identify-activated))
+    (let ((nickname (erc-capab-get-unidentified-nickname
+                     (erc-get-parsed-vector (- (point-max) 1)))))
+      (when (and nickname
+                 (goto-char (point-min))
+                 (re-search-forward
+                  ;; matches nick in channel, msg, notice, and action messages
+                  ;; this assumes the default action format is used
+                  (concat "\\(<\\|[^\\*]\\* ?\\|-\\)"
+                          "\\(" (regexp-quote nickname) "\\)")
+                  nil t))
+        (goto-char (match-beginning 2))
+        (insert erc-capab-identify-prefix)))))
+
+(defun erc-capab-get-unidentified-nickname (parsed)
+  "Return the nickname of the user if unidentified.
+PARSED is an `erc-parsed' response struct."
+  (and (erc-response-p parsed)
+       (eq nil (get-text-property 0 'erc-identified
+                                  (erc-response.contents parsed)))
+       (erc-get-parsed-vector-nick parsed)
+       (nth 0 (erc-parse-user (erc-get-parsed-vector-nick parsed)))))
+
+(provide 'erc-capab)
+
+;; arch-tag: 27b6d668-7ee5-4e47-b9f0-27d7a4362062
+;;; erc-capab.el ends here
diff --git a/erc-dcc.el b/erc-dcc.el
index ac8df65..53fc3e4 100644
--- a/erc-dcc.el
+++ b/erc-dcc.el
@@ -29,7 +29,7 @@
 
 ;;; Commentary:
 
-;; This file provides Direct Client-to-Client support for the Emacs IRC Client.
+;; This file provides Direct Client-to-Client support for ERC.
 ;;
 ;; The original code was taken from zenirc-dcc.el, heavily mangled and
 ;; rewritten to support the way how ERC operates.  Server socket support
@@ -57,7 +57,7 @@
 (eval-when-compile
  (require 'pcomplete))
 
-(defconst erc-dcc-version "$Revision: 1.96 $"
+(defconst erc-dcc-version "$Revision: 1.97 $"
   "ERC DCC revision")
 
 (defgroup erc-dcc nil
diff --git a/erc-match.el b/erc-match.el
index a1d1c5a..010432e 100644
--- a/erc-match.el
+++ b/erc-match.el
@@ -40,7 +40,7 @@
 
 ;; Customisation:
 
-(defconst erc-match-version "$Revision: 1.53 $"
+(defconst erc-match-version "$Revision: 1.54 $"
   "ERC match mode revision.")
 
 (defgroup erc-match nil
@@ -431,24 +431,6 @@ In any of the following situations, MSG is directed at an 
entry FOOL:
     (or (erc-list-match fools-beg msg)
        (erc-list-match fools-end msg))))
 
-(defun erc-get-parsed-vector (point)
-  "Return the whole parsed vector on POINT."
-  (get-text-property point 'erc-parsed))
-
-(defun erc-get-parsed-vector-nick (vect)
-  "Return nickname in the parsed vector VECT."
-  (let* ((untreated-nick (and vect (erc-response.sender vect)))
-        (maybe-nick (when untreated-nick
-                      (car (split-string untreated-nick "!")))))
-    (when (and (not (null maybe-nick))
-              (erc-is-valid-nick-p maybe-nick))
-      untreated-nick)))
-
-(defun erc-get-parsed-vector-type (vect)
-  "Return message type in the parsed vector VECT."
-  (and vect
-       (erc-response.command vect)))
-
 (defun erc-match-message ()
   "Mark certain keywords in a region.
 Use this defun with `erc-insert-modify-hook'."
diff --git a/erc-stamp.el b/erc-stamp.el
index 634005f..ea2cb78 100644
--- a/erc-stamp.el
+++ b/erc-stamp.el
@@ -1,4 +1,4 @@
-;;; erc-stamp.el --- Timestamping for Emacs IRC CLient
+;;; erc-stamp.el --- Timestamping for ERC messages
 
 ;; Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
 
@@ -38,7 +38,7 @@
 (require 'erc)
 (require 'erc-compat)
 
-(defconst erc-stamp-version "$Revision: 1.53 $"
+(defconst erc-stamp-version "$Revision: 1.54 $"
   "ERC stamp mode revision.")
 
 (defgroup erc-stamp nil
diff --git a/erc-xdcc.el b/erc-xdcc.el
index 7c8ee6f..84562e7 100644
--- a/erc-xdcc.el
+++ b/erc-xdcc.el
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; This file provides a very simple XDCC file server for the Emacs IRC Client.
+;; This file provides a very simple XDCC file server for ERC.
 
 ;;; Code:
 
diff --git a/erc.el b/erc.el
index f9adcbc..7d34dec 100644
--- a/erc.el
+++ b/erc.el
@@ -66,7 +66,7 @@
 
 ;;; Code:
 
-(defconst erc-version-string "Version 5.1.1 (CVS) $Revision: 1.803 $"
+(defconst erc-version-string "Version 5.1.1 (CVS) $Revision: 1.804 $"
   "ERC version.  This is used by function `erc-version'.")
 
 (eval-when-compile (require 'cl))
@@ -1760,6 +1760,8 @@ removed from the list will be disabled."
              (const :tag "Join channels automatically" autojoin)
              (const :tag "Integrate with Big Brother Database" bbdb)
              (const :tag "Buttonize URLs, nicknames, and other text" button)
+             (const :tag "Mark unidentified users on servers supporting CAPAB 
IDENTIFY-MSG"
+                    capab-identify)
              (const :tag "Wrap long lines" fill)
              (const :tag "Highlight or remove IRC control characters"
                     irccontrols)
@@ -6149,6 +6151,26 @@ This function should be on `erc-kill-channel-hook'."
                               (funcall erc-part-reason nil))
                       nil tgt))))
 
+;;; Dealing with `erc-parsed'
+
+(defun erc-get-parsed-vector (point)
+  "Return the whole parsed vector on POINT."
+  (get-text-property point 'erc-parsed))
+
+(defun erc-get-parsed-vector-nick (vect)
+  "Return nickname in the parsed vector VECT."
+  (let* ((untreated-nick (and vect (erc-response.sender vect)))
+        (maybe-nick (when untreated-nick
+                      (car (split-string untreated-nick "!")))))
+    (when (and (not (null maybe-nick))
+              (erc-is-valid-nick-p maybe-nick))
+      untreated-nick)))
+
+(defun erc-get-parsed-vector-type (vect)
+  "Return message type in the parsed vector VECT."
+  (and vect
+       (erc-response.command vect)))
+
 (provide 'erc)
 
 ;;; Deprecated. We might eventually stop requiring the goodies automatically.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]