Mercurial > emacs
annotate lisp/erc/erc-join.el @ 79647:f6c4e8c6c5f3
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 29 Dec 2007 12:41:44 +0000 |
parents | 85d67fae9a94 |
children | 5f92874bde07 |
rev | line source |
---|---|
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; erc-join.el --- autojoin channels on connect and reconnects |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 |
75346 | 3 ;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 ;; Author: Alex Schroeder <alex@gnu.org> |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 ;; Keywords: irc |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoJoin |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
78219
85d67fae9a94
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75346
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; any later version. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;; Boston, MA 02110-1301, USA. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;;; Commentary: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;; This allows us to customize an `erc-autojoin-channels-alist'. As |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;; we /JOIN and /PART channels, this alist is updated to reflect our |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;; current setup, so that when we reconnect, we rejoin the same |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 ;; channels. The alist can be customized, so that the customized |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 ;; value will be used when we reconnect in our next Emacs session. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 ;;; Code: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 (require 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 (eval-when-compile (require 'cl)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 (defgroup erc-autojoin nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 "Enable autojoining." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 :group 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 ;;;###autoload (autoload 'erc-autojoin-mode "erc-join" nil t) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 (define-erc-module autojoin nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 "Makes ERC autojoin on connects and reconnects." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 ((add-hook 'erc-after-connect 'erc-autojoin-channels) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
48 (add-hook 'erc-server-PART-functions 'erc-autojoin-remove)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
49 ((remove-hook 'erc-after-connect 'erc-autojoin-channels) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
50 (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
51 (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
52 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 (defcustom erc-autojoin-channels-alist nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
54 "Alist of channels to autojoin on IRC networks. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 Every element in the alist has the form (SERVER . CHANNELS). |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 SERVER is a regexp matching the server, and channels is the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
57 list of channels to join. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 Customize this variable to set the value for your first connect. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 Once you are connected and join and part channels, this alist |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 keeps track of what channels you are on, and will join them |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 again when you get disconnected. When you restart Emacs, however, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 those changes are lost, and the customization you saved the last |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
64 time is used again." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
65 :group 'erc-autojoin |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 :type '(repeat (cons :tag "Server" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
67 (regexp :tag "Name") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
68 (repeat :tag "Channels" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
69 (string :tag "Name"))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
70 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
71 (defcustom erc-autojoin-domain-only t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
72 "Truncate host name to the domain name when joining a server. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
73 If non-nil, and a channel on the server a.b.c is joined, then |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
74 only b.c is used as the server for `erc-autojoin-channels-alist'. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
75 This is important for networks that redirect you to other |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
76 servers, presumably in the same domain." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
77 :group 'erc-autojoin |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
78 :type 'boolean) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 (defun erc-autojoin-channels (server nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
81 "Autojoin channels in `erc-autojoin-channels-alist'." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
82 (dolist (l erc-autojoin-channels-alist) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
83 (when (string-match (car l) server) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
84 (dolist (chan (cdr l)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
85 (erc-server-send (concat "join " chan)))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
86 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
87 (defun erc-autojoin-add (proc parsed) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
88 "Add the channel being joined to `erc-autojoin-channels-alist'." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
89 (let* ((chnl (erc-response.contents parsed)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
90 (nick (car (erc-parse-user (erc-response.sender parsed)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 (server (with-current-buffer (process-buffer proc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 (or erc-server-announced-name erc-session-server)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
93 (when (erc-current-nick-p nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
94 (when (and erc-autojoin-domain-only |
69942
45937d0cd26d
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-208
Miles Bader <miles@gnu.org>
parents:
68822
diff
changeset
|
95 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server)) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
96 (setq server (match-string 1 server))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
97 (let ((elem (assoc server erc-autojoin-channels-alist))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
98 (if elem |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
99 (unless (member chnl (cdr elem)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
100 (setcdr elem (cons chnl (cdr elem)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
101 (setq erc-autojoin-channels-alist |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
102 (cons (list server chnl) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
103 erc-autojoin-channels-alist)))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
104 ;; We must return nil to tell ERC to continue running the other |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
105 ;; functions. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
106 nil) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
107 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
108 ;; (erc-parse-user "kensanata!~user@dclient217-162-233-228.hispeed.ch") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 (defun erc-autojoin-remove (proc parsed) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 "Remove the channel being left from `erc-autojoin-channels-alist'." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 (let* ((chnl (car (erc-response.command-args parsed))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
113 (nick (car (erc-parse-user (erc-response.sender parsed)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 (server (with-current-buffer (process-buffer proc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 (or erc-server-announced-name erc-session-server)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 (when (erc-current-nick-p nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
117 (when (and erc-autojoin-domain-only |
69942
45937d0cd26d
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-208
Miles Bader <miles@gnu.org>
parents:
68822
diff
changeset
|
118 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server)) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
119 (setq server (match-string 1 server))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
120 (let ((elem (assoc server erc-autojoin-channels-alist))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 (when elem |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 (setcdr elem (delete chnl (cdr elem))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
123 (unless (cdr elem) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
124 (setq erc-autojoin-channels-alist |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
125 (delete elem erc-autojoin-channels-alist))))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
126 ;; We must return nil to tell ERC to continue running the other |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
127 ;; functions. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 nil) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
129 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 (provide 'erc-join) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
131 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 ;;; erc-join.el ends here |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
134 ;; Local Variables: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
135 ;; indent-tabs-mode: t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
136 ;; tab-width: 8 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
137 ;; End: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
138 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
139 ;; arch-tag: d62d8b15-8e31-49d6-8a73-12f11e717414 |