erc-commit
[Top][All Lists]
Advanced

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

[Erc-commit] [commit][emacs22] erc-services: Add a way of doing things t


From: mwolson
Subject: [Erc-commit] [commit][emacs22] erc-services: Add a way of doing things that is best of both worlds
Date: Sun, 14 Oct 2007 00:48:38 -0400

commit 8cecfcfb51884e9ae08f947e544bb40b2a04c30c
Author: Michael Olson <address@hidden>
Date:   Thu Dec 28 07:00:54 2006 +0000

    erc-services: Add a way of doing things that is best of both worlds
    
    * erc-networks.el (erc-server-alist): Fix definition for
      irc.arstechnica.com.  Properly escape periods in Konfido.Net and
      Kewl.Org.
      (erc-networks-alist): Add entries for Ars and LinuxChix, though the
      latter does not actually provide an announced network name.
    
    * erc-services.el (erc-nickserv-identify-mode): Add 'both method, which
      waits for a NickServ message if the network supports it, otherwise
      sends the password after connecting.
      (erc-nickserv-identify-mode): Default to 'both.
      (erc-nickserv-passwords): Add OFTC and Azzurra to custom options.
      (erc-nickserv-alist): Indentation fix.
      (erc-nickserv-identify-on-connect)
      (erc-nickserv-identify-on-nick-change): Handle 'both method.
    git-archimport-id: address@hidden/erc--main--0--patch-77

diff --git a/ChangeLog b/ChangeLog
index b02d6f9..61b05c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,18 @@
 
        * erc-networks.el (erc-server-alist): Add Ars OpenIRC and
        LinuxChix networks.  Thanks to Angelina Carlton for mentioning
-       them.
+       them.  Properly escape periods in Konfido.Net and Kewl.Org.
+       (erc-networks-alist): Add entries for Ars and LinuxChix, though
+       the latter does not actually provide an announced network name.
+
+       * erc-services.el (erc-nickserv-identify-mode): Add 'both method,
+       which waits for a NickServ message if the network supports it,
+       otherwise sends the password after connecting.
+       (erc-nickserv-identify-mode): Default to 'both.
+       (erc-nickserv-passwords): Add OFTC and Azzurra to custom options.
+       (erc-nickserv-alist): Indentation fix.
+       (erc-nickserv-identify-on-connect)
+       (erc-nickserv-identify-on-nick-change): Handle 'both method.
 
 2006-12-28  Leo  <address@hidden>
 
diff --git a/erc-networks.el b/erc-networks.el
index f27a602..b5c13d8 100644
--- a/erc-networks.el
+++ b/erc-networks.el
@@ -64,7 +64,7 @@
   ("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
   ("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
   ("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
-  ("Ars OpenIRC: Random server" ArsOpenIRC "irc.arstechnica.com" 6667)
+  ("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667)
   ("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
   ("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
   ("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 
7777 ))
@@ -281,12 +281,12 @@
   ("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
   ("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
   ("Kemik: Random server" Kemik "irc.kemik.net" 6667)
-  ("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 ))
+  ("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 ))
   ("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
   ("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
   ("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 
))
   ("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" 
(6667 5555 ))
-  ("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667)
+  ("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667)
   ("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
   ("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
   ("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
@@ -459,6 +459,7 @@ PORTS is either a number, a list of numbers, or a list of 
port ranges."
     (AngelEyez "angeleyez.net")
     (Anothernet "another.net")
     (ArabChat "arabchat.org")
+    (Ars "arstechnica.com")
     (AsiaTalk "asiatalk.org")
     (AstroLink "astrolink.org")
     (Asylumnet "asylumnet.org")
@@ -588,6 +589,7 @@ PORTS is either a number, a list of numbers, or a list of 
port ranges."
     (LagNet "lagnet.org.za")
     (Librenet "librenet.net")
     (LinkNet "link-net.org")
+    (LinuxChix "cats\.meow\.at\\|linuxchix\.org")
     (Liquidized "liquidized.net")
     (M-IRC "m-sys.org")
     (MagicStar "magicstar.net")
diff --git a/erc-services.el b/erc-services.el
index c8bac7f..b93317e 100644
--- a/erc-services.el
+++ b/erc-services.el
@@ -94,7 +94,7 @@ communication with those Services."
   (interactive
    (list (intern (completing-read
                  "Choose Nickserv identify mode (RET to disable): "
-                 '(("autodetect") ("nick-change")) nil t))))
+                 '(("autodetect") ("nick-change") ("both")) nil t))))
   (cond ((eq mode 'autodetect)
         (setq erc-nickserv-identify-mode 'autodetect)
         (add-hook 'erc-server-NOTICE-functions
@@ -111,6 +111,14 @@ communication with those Services."
                   'erc-nickserv-identify-on-nick-change)
         (remove-hook 'erc-server-NOTICE-functions
                      'erc-nickserv-identify-autodetect))
+       ((eq mode 'both)
+        (setq erc-nickserv-identify-mode 'both)
+        (add-hook 'erc-server-NOTICE-functions
+                  'erc-nickserv-identify-autodetect)
+        (add-hook 'erc-after-connect
+                  'erc-nickserv-identify-on-connect)
+        (add-hook 'erc-nick-changed-functions
+                  'erc-nickserv-identify-on-nick-change))
        (t
         (setq erc-nickserv-identify-mode nil)
         (remove-hook 'erc-server-NOTICE-functions
@@ -120,22 +128,25 @@ communication with those Services."
         (remove-hook 'erc-nick-changed-functions
                      'erc-nickserv-identify-on-nick-change))))
 
-(defcustom erc-nickserv-identify-mode 'autodetect
+(defcustom erc-nickserv-identify-mode 'both
   "The mode which is used when identifying to Nickserv.
 
 Possible settings are:.
 
 'autodetect  - Identify when the real Nickserv sends an identify request.
 'nick-change - Identify when you change your nickname.
+'both        - Do the former if the network supports it, otherwise do the
+               latter.
 nil          - Disables automatic Nickserv identification.
 
 You can also use M-x erc-nickserv-identify-mode to change modes."
   :group 'erc-services
   :type '(choice (const autodetect)
                 (const nick-change)
+                (const both)
                 (const nil))
   :set (lambda (sym val)
-        (set-default sym val)
+        (set sym val)
         (erc-nickserv-identify-mode val)))
 
 (defcustom erc-prompt-for-nickserv-password t
@@ -156,12 +167,14 @@ Example of use:
          (list :tag "Network"
                (choice :tag "Network name"
                        (const freenode)
+                       (const OFTC)
                        (const DALnet)
                        (const GalaxyNet)
                        (const SlashNET)
                        (const BRASnet)
                        (const iip)
                        (const Austnet)
+                       (const Azzurra)
                        (symbol :tag "Network name"))
                (repeat :tag "Nickname and password"
                        (cons :tag "Identity"
@@ -209,24 +222,24 @@ Example of use:
      "IDENTIFY"
      nil
      "")
-     (Austnet
-      "address@hidden"
-      "/address@hidden<password>"
-      "address@hidden"
-      "identify"
-      nil)
-     (Azzurra
-      "address@hidden"
-      "/ns\\s-IDENTIFY\\s-password"
-      "NickServ"
-      "IDENTIFY"
-      nil)
-     (OFTC
-      "address@hidden"
-      "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
-      "NickServ"
-      "IDENTIFY"
-      nil))
+    (Austnet
+     "address@hidden"
+     "/address@hidden<password>"
+     "address@hidden"
+     "identify"
+     nil)
+    (Azzurra
+     "address@hidden"
+     "/ns\\s-IDENTIFY\\s-password"
+     "NickServ"
+     "IDENTIFY"
+     nil)
+    (OFTC
+     "address@hidden"
+     "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
+     "NickServ"
+     "IDENTIFY"
+     nil))
    "Alist of NickServer details, sorted by network.
 Every element in the list has the form
   \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
@@ -279,14 +292,18 @@ password for this nickname, otherwise try to send it 
automatically."
 
 (defun erc-nickserv-identify-on-connect (server nick)
   "Identify to Nickserv after the connection to the server is established."
-  (unless (and (null erc-nickserv-passwords)
-              (null erc-prompt-for-nickserv-password))
+  (unless (or (and (null erc-nickserv-passwords)
+                  (null erc-prompt-for-nickserv-password))
+             (and (eq erc-nickserv-identify-mode 'both)
+                  (nth 2 (assoc (erc-network) erc-nickserv-alist))))
     (erc-nickserv-call-identify-function nick)))
 
 (defun erc-nickserv-identify-on-nick-change (nick old-nick)
   "Identify to Nickserv whenever your nick changes."
-  (unless (and (null erc-nickserv-passwords)
-              (null erc-prompt-for-nickserv-password))
+  (unless (or (and (null erc-nickserv-passwords)
+                  (null erc-prompt-for-nickserv-password))
+             (and (eq erc-nickserv-identify-mode 'both)
+                  (nth 2 (assoc (erc-network) erc-nickserv-alist))))
     (erc-nickserv-call-identify-function nick)))
 
 (defun erc-nickserv-call-identify-function (nickname)




reply via email to

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