Commit 6904f7fe authored by Miles Bader's avatar Miles Bader

Merge from erc--main--0

Highlights:

 - Display messages starting with "/" but are not commands correctly.
 - Add erc-capab.el file, with capab-identify module.
 - Fix various ERC menu bugs and add "Current channel" submenu.
 - Make header-line display look nicer.
 - Fix warning when auto-authenticating to bitlbee.
 - New option erc-system-name allows the hostname next to your nick to be
   customized.

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-599
Creator:  Michael Olson <mwolson@gnu.org>
parent c5f847b6
2007-01-13 Michael Olson <mwolson@gnu.org>
* ERC-NEWS: Mention new erc-capab.el file.
2007-01-13 Glenn Morris <rgm@gnu.org> 2007-01-13 Glenn Morris <rgm@gnu.org>
* MACHINES: Add information on compiling 32-bit Emacs on 64-bit * MACHINES: Add information on compiling 32-bit Emacs on 64-bit
......
...@@ -22,6 +22,17 @@ reconnection attempts that ERC will make per server. ...@@ -22,6 +22,17 @@ reconnection attempts that ERC will make per server.
amount of time, in seconds, that ERC will wait between successive amount of time, in seconds, that ERC will wait between successive
reconnect attempts. reconnect attempts.
** New face: `erc-my-nick-face'
This helps make it easier to distinguish messages sent by yourself
from messages sent by other users when the value of the variable
`erc-show-my-nick' is non-nil.
** New modules
*** Capab identify (erc-capab.el)
Mark users who haven't identified to NickServ on servers supporting
CAPAB IDENTIFY-MSG.
** Changes and additions to modules ** Changes and additions to modules
*** Channel lists (erc-list.el) *** Channel lists (erc-list.el)
......
2007-01-13 Michael Olson <mwolson@gnu.org>
* erc.el (erc-command-regexp): New variable that is used to match
a command.
(erc-send-input): Use it. This fixes a bug where paths --
"/usr/bin/foo", for example -- were being displayed as commands,
but still sent correctly.
(erc-extract-command-from-line): Use it.
* erc.texi (Modules): Document erc-capab-identify.
2007-01-11 Diane Murray <disumu@x3y2z1.net>
* erc.el (erc-find-parsed-property): Moved here from erc-track.el
since it can be useful in general.
* erc-track.el (erc-find-parsed-property): Removed.
* erc-capab.el (erc-capab-find-parsed): Removed.
(erc-capab-identify-add-prefix): Use `erc-find-parsed-property'.
* erc.el (erc-open): Run `erc-before-connect' hook here. This
makes sure the hook always gets called before a connection is
made, as some functions, like `erc-handle-irc-url', use `erc-open'
instead of `erc'.
(erc): Removed `erc-before-connect' hook.
* erc-menu.el (erc-menu-definition): Put items specific to
channels in a "Current channel" submenu.
* erc-backend.el (321, 323): Display channel list in server buffer
when not using the channel list module.
* erc.el: Updated copyright years.
(erc-version-string): Set to 5.2 (devel).
(erc-format-lag-time): Fixed to work when `erc-server-lag' is nil.
(erc-update-mode-line-buffer): Set the header face.
2007-01-11 Michael Olson <mwolson@gnu.org>
* erc-bbdb.el (erc-bbdb-popup-type): Fix customization type and
documentation.
* erc-services.el (erc-nickserv-identify-mode): Improve
documentation for nick-change option and move higher to fix
compiler warning. Avoid a recursive load error.
(erc-nickserv-alist): Add simple entry for BitlBee, to avoid
"NickServ is AWAY: User is offline" error. Oddly enough, bitlbee
was smart enough to recognize that as an authentication request
and log in regardless, which is why I didn't notice this earlier.
(erc-nickserv-alist-sender, erc-nickserv-alist-regexp)
(erc-nickserv-alist-nickserv, erc-nickserv-alist-ident-keyword)
(erc-nickserv-alist-use-nick-p)
(erc-nickserv-alist-ident-command): New accessors for
erc-nickserv-alist. Using nth is unwieldy.
(erc-nickserv-identify-autodetect)
(erc-nickserv-identify-on-connect)
(erc-nickserv-identify-on-nick-change, erc-nickserv-identify): Use
the new accessors.
2007-01-11 Diane Murray <disumu@x3y2z1.net>
* NEWS: Added note for `erc-my-nick-face'. Fixed capab-identify
wording.
2007-01-10 Diane Murray <disumu@x3y2z1.net>
* erc.el (erc-mode-line-format): Added %l to documentation.
(erc-header-line-format): Removed "[IRC]". Use the new %l
replacement character. Doc fix.
(erc-format-channel-modes): Removed lag code. Removed parentheses
from mode string.
(erc-format-lag-time): New function.
(erc-update-mode-line-buffer): Use it.
2007-01-09 Michael Olson <mwolson@gnu.org>
* erc.el (erc-system-name): New option that determines the system
name to use when logging in. The default is to figure this out by
calling `system-name'.
(erc-login): Use it.
2007-01-07 Michael Olson <mwolson@gnu.org>
* erc.el (erc-modules): Add the menu module. This should fix a
bug with incorrect ERC submenus being displayed.
* erc-menu.el: Turn this into a module.
(erc-menu-add, erc-menu-remove): New functions that add and remove
the ERC menu.
2006-12-28 Michael Olson <mwolson@gnu.org> 2006-12-28 Michael Olson <mwolson@gnu.org>
* erc-list.el: Change header to mention that this is part of ERC, * erc-list.el: Change header to mention that this is part of ERC,
...@@ -645,8 +736,30 @@ ...@@ -645,8 +736,30 @@
<C-tab> for `erc-button-previous' as it is a more standard key <C-tab> for `erc-button-previous' as it is a more standard key
binding for this type of function. binding for this type of function.
2006-02-28 Diane Murray <disumu@x3y2z1.net>
* erc-capab.el: Removed things that were accidentally committed on
2006-02-20. Removed Todo section.
(erc-capab-unidentified): Removed.
2006-02-26 Michael Olson <mwolson@gnu.org>
* erc-capab.el: Use (eval-when-compile (require 'cl)).
(erc-capab-unidentified): Fix compiler warning by specifying
group.
2006-02-20 Diane Murray <disumu@x3y2z1.net>
* erc-capab.el (erc-capab-send-identify-messages): Fixed comment
to explain thoughts better. `erc-server-parameters' is an
associated list when it's set, not a string.
2006-02-19 Michael Olson <mwolson@gnu.org> 2006-02-19 Michael Olson <mwolson@gnu.org>
* erc-capab.el (erc-capab-send-identify-messages): Make sure some
parameters are strings before using them. Thanks to Alejandro
Benitez for the report.
* erc.el (erc-version-string): Release ERC 5.1.2. * erc.el (erc-version-string): Release ERC 5.1.2.
2006-02-19 Diane Murray <disumu@x3y2z1.net> 2006-02-19 Diane Murray <disumu@x3y2z1.net>
...@@ -696,8 +809,13 @@ ...@@ -696,8 +809,13 @@
2006-02-11 Michael Olson <mwolson@gnu.org> 2006-02-11 Michael Olson <mwolson@gnu.org>
* erc.el (erc-update-modules): Make some requirements shorter, so * erc.el (erc-update-modules): Handle erc-capab-identify
that it's easier to see why they are needed. correctly. Make some requirements shorter, so that it's easier to
see why they are needed.
* erc-capab.el: Add autoload cookie for capab-identify.
(erc-capab-send-identify-messages, erc-capab-identify-activate):
Minor whitespace fix in code.
* erc-stamp.el (erc-timestamp-use-align-to): Renamed from * erc-stamp.el (erc-timestamp-use-align-to): Renamed from
`erc-timestamp-right-align-by-pixel'. Set the default based on `erc-timestamp-right-align-by-pixel'. Set the default based on
...@@ -721,11 +839,21 @@ ...@@ -721,11 +839,21 @@
(erc-list-channels): Was `erc-cmd-LIST', renamed. (erc-list-channels): Was `erc-cmd-LIST', renamed.
(erc-list-channels-simple): New function. (erc-list-channels-simple): New function.
* erc.el (erc-modules): Added `list' to enabled modules. Moved * erc.el (erc-modules): Added `list' to enabled modules. Changed
customization options left in source code. `capab-identify' description. Moved customization options left in
source code.
* erc-menu.el (erc-menu-definition): Use `erc-list-channels'. * erc-menu.el (erc-menu-definition): Use `erc-list-channels'.
* erc-capab.el: Put a little more detail into Usage section.
(define-erc-module): Run `erc-capab-identify-setup' in all open
server buffers when enabling.
(erc-capab-identify-setup): Make PROC and PARSED optional
arguments.
(erc-capab-identify-add-prefix): Simplified nickname regexp. This
should now also match nicknames that are formatted differently
than the default.
* erc-spelling.el (define-erc-module): Make sure there's a buffer * erc-spelling.el (define-erc-module): Make sure there's a buffer
before calling `with-current-buffer'. before calling `with-current-buffer'.
...@@ -742,12 +870,34 @@ ...@@ -742,12 +870,34 @@
2006-02-09 Diane Murray <disumu@x3y2z1.net> 2006-02-09 Diane Murray <disumu@x3y2z1.net>
* erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) * erc.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
* erc-capab.el: Require erc.
(erc-capab-send-identify-messages): Use `erc-server-send'.
(erc-capab-identify-remove/set-identified-flag): Use 1 and 0 as
the flags so we can also check whether the `erc-identified' text
property is there at all.
(erc-capab-identify-add-prefix): Use `erc-capab-find-parsed'.
This fixes a bug where the prefix wasn't inserted when timestamps
are inserted on the right. Tweaked nickname regexp.
(erc-capab-find-parsed): New function.
(erc-capab-get-unidentified-nickname): Updated to check for 0
flag. Only get nickname if there's a nickuserhost associated with
this message.
* 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-get-parsed-vector-type): Moved here from erc-match.el.
* erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick) * erc-match.el (erc-get-parsed-vector, erc-get-parsed-vector-nick)
(erc-get-parsed-vector-type): Moved these functions to erc.el (erc-get-parsed-vector-type): Moved these functions to erc.el
since they can be useful outside of the text matching module. since they can be useful outside of the text matching module.
* NEWS: Added erc-capab.el.
* erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client" * erc-dcc.el, erc-stamp.el, erc-xdcc.el: Changed "Emacs IRC Client"
to "ERC". to "ERC".
......
...@@ -1535,7 +1535,7 @@ See `erc-display-server-message'." nil ...@@ -1535,7 +1535,7 @@ See `erc-display-server-message'." nil
(define-erc-response-handler (321) (define-erc-response-handler (321)
"LIST header." nil "LIST header." nil
(setq erc-channel-list nil) (setq erc-channel-list nil)
(erc-display-message parsed 'notice 'active 's321)) (erc-display-message parsed 'notice proc 's321))
(define-erc-response-handler (322) (define-erc-response-handler (322)
"LIST notice." nil "LIST notice." nil
...@@ -1545,7 +1545,7 @@ See `erc-display-server-message'." nil ...@@ -1545,7 +1545,7 @@ See `erc-display-server-message'." nil
(add-to-list 'erc-channel-list (list channel)) (add-to-list 'erc-channel-list (list channel))
(erc-update-channel-topic channel topic) (erc-update-channel-topic channel topic)
(erc-display-message (erc-display-message
parsed 'notice 'active 's322 parsed 'notice proc 's322
?c channel ?u num-users ?t (or topic ""))))) ?c channel ?u num-users ?t (or topic "")))))
(define-erc-response-handler (324) (define-erc-response-handler (324)
......
;;; 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:
;; Put the following in your ~/.emacs file.
;; (require 'erc-capab)
;; (erc-capab-identify-mode 1)
;; `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 or you disable this module (see
;; `erc-capab-identify-disable'), no prefix will be inserted, but the
;; flag sent by the server will still be stripped.
;;; Code:
(require 'erc)
(eval-when-compile (require 'cl))
;;; 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)
;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t)
(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)
(mapc (lambda (buffer)
(when buffer
(with-current-buffer buffer (erc-capab-identify-setup))))
(erc-buffer-list 'erc-open-server-buffer-p)))
((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 (&optional proc parsed)
"Set up CAPAB IDENTIFY on the current server.
Optional argument PROC is the current server's process.
Optional argument PARSED is the current message, a response struct.
These arguments are sent to this function when called as a hook in
`erc-server-005-functions'."
(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 (stringp erc-server-version)
(string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version)
;; could possibly check for '("IRCD" . "dancer") in
;; `erc-server-parameters' instead of looking for a specific name
;; in `erc-server-version'
(assoc "CAPAB" erc-server-parameters))
(erc-log "Sending CAPAB IDENTIFY-MSG and IDENTIFY-CTCP")
(erc-server-send "CAPAB IDENTIFY-MSG")
(erc-server-send "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
(if (string= (match-string 1 msg) "+")
1
0))
(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
(erc-with-server-buffer erc-capab-identify-activated))
(goto-char (or (erc-find-parsed-property) (point-min)))
(let ((nickname (erc-capab-get-unidentified-nickname
(erc-get-parsed-vector (point)))))
(when (and nickname
(goto-char (point-min))
;; assuming the first use of `nickname' is the sender's nick
(re-search-forward (regexp-quote nickname) nil t))
(goto-char (match-beginning 0))
(insert (erc-propertize erc-capab-identify-prefix
'face (get-char-property (- (point) 1)
'face)))))))
(defun erc-capab-get-unidentified-nickname (parsed)
"Return the nickname of the user if unidentified.
PARSED is an `erc-parsed' response struct."
(when (and (erc-response-p parsed)
(equal 0 (get-text-property 0 'erc-identified
(erc-response.contents parsed))))
(let ((nickuserhost (erc-get-parsed-vector-nick parsed)))
(when nickuserhost
(nth 0 (erc-parse-user nickuserhost))))))
(provide 'erc-capab)
;; arch-tag: 27b6d668-7ee5-4e47-b9f0-27d7a4362062
;;; erc-capab.el ends here
...@@ -863,29 +863,29 @@ buffer, and sends back the replies after each block of data per the DCC ...@@ -863,29 +863,29 @@ buffer, and sends back the replies after each block of data per the DCC
protocol spec. Well not really. We write back a reply after each read, protocol spec. Well not really. We write back a reply after each read,
rather than every 1024 byte block, but nobody seems to care." rather than every 1024 byte block, but nobody seems to care."
(with-current-buffer (process-buffer proc) (with-current-buffer (process-buffer proc)
(setq buffer-read-only nil) ;; FIXME (let ((inhibit-read-only t))
(goto-char (point-max)) (goto-char (point-max))
(insert (string-make-unibyte str)) (insert (string-make-unibyte str))
(setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count)) (setq erc-dcc-byte-count (+ (length str) erc-dcc-byte-count))
(erc-assert (= erc-dcc-byte-count (1- (point-max)))) (erc-assert (= erc-dcc-byte-count (1- (point-max))))
(and erc-verbose-dcc (and erc-verbose-dcc
(erc-display-message (erc-display-message
nil 'notice erc-server-process nil 'notice erc-server-process
'dcc-get-bytes-received 'dcc-get-bytes-received
?f (file-name-nondirectory buffer-file-name) ?f (file-name-nondirectory buffer-file-name)
?b (number-to-string erc-dcc-byte-count))) ?b (number-to-string erc-dcc-byte-count)))
(cond (cond
((and (> (plist-get erc-dcc-entry-data :size) 0) ((and (> (plist-get erc-dcc-entry-data :size) 0)
(> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size))) (> erc-dcc-byte-count (plist-get erc-dcc-entry-data :size)))
(erc-display-message (erc-display-message
nil '(error notice) 'active nil '(error notice) 'active
'dcc-get-file-too-long 'dcc-get-file-too-long
?f (file-name-nondirectory buffer-file-name)) ?f (file-name-nondirectory buffer-file-name))
(delete-process proc)) (delete-process proc))
(t (t
(process-send-string (process-send-string
proc (erc-pack-int erc-dcc-byte-count 4)))))) proc (erc-pack-int erc-dcc-byte-count 4)))))))
(defun erc-dcc-get-sentinel (proc event) (defun erc-dcc-get-sentinel (proc event)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
;;; Code: ;;; Code:
;(require 'erc) (require 'erc)
(require 'easymenu) (require 'easymenu)
(defvar erc-menu-definition (defvar erc-menu-definition
...@@ -40,41 +40,43 @@ ...@@ -40,41 +40,43 @@
(and erc-server-connected (fboundp 'erc-list-channels))] (and erc-server-connected (fboundp 'erc-list-channels))]
["Join channel..." erc-join-channel erc-server-connected] ["Join channel..." erc-join-channel erc-server-connected]
["Start a query..." erc-cmd-QUERY erc-server-connected] ["Start a query..." erc-cmd-QUERY erc-server-connected]
"-"
["List users in channel" erc-channel-names erc-channel-users]
["List channel operators" erc-cmd-OPS erc-channel-users]
["Input action..." erc-input-action (erc-default-target)] ["Input action..." erc-input-action (erc-default-target)]
["Set topic..." erc-set-topic
(and (and (erc-default-target) (not (erc-query-buffer-p)))
(or (not (member "t" erc-channel-modes))
(erc-channel-user-op-p (erc-current-nick))))]
(list "Channel modes"
["Change mode..." erc-insert-mode-command
(erc-channel-user-op-p (erc-current-nick))]
["No external send" (erc-toggle-channel-mode "n")
:active (erc-channel-user-op-p (erc-current-nick))
:style toggle :selected (member "n" erc-channel-modes)]
["Topic set by channel operator" (erc-toggle-channel-mode "t")
:style toggle :selected (member "t" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Invite only" (erc-toggle-channel-mode "i")
:style toggle :selected (member "i" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Private" (erc-toggle-channel-mode "p")
:style toggle :selected (member "p" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Secret" (erc-toggle-channel-mode "s")
:style toggle :selected (member "s" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Moderated" (erc-toggle-channel-mode "m")
:style toggle :selected (member "m" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Set a limit..." erc-set-channel-limit
(erc-channel-user-op-p (erc-current-nick))]
["Set a key..." erc-set-channel-key
(erc-channel-user-op-p (erc-current-nick))])
["Leave this channel..." erc-part-from-channel erc-channel-users]
"-" "-"
(list
"Current channel"
["List users in channel" erc-channel-names erc-channel-users]
["List channel operators" erc-cmd-OPS erc-channel-users]
["Set topic..." erc-set-topic
(and (and (erc-default-target) (not (erc-query-buffer-p)))
(or (not (member "t" erc-channel-modes))
(erc-channel-user-op-p (erc-current-nick))))]
(list "Channel modes"
["Change mode..." erc-insert-mode-command
(erc-channel-user-op-p (erc-current-nick))]
["No external send" (erc-toggle-channel-mode "n")
:active (erc-channel-user-op-p (erc-current-nick))
:style toggle :selected (member "n" erc-channel-modes)]
["Topic set by channel operator" (erc-toggle-channel-mode "t")
:style toggle :selected (member "t" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Invite only" (erc-toggle-channel-mode "i")
:style toggle :selected (member "i" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Private" (erc-toggle-channel-mode "p")
:style toggle :selected (member "p" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Secret" (erc-toggle-channel-mode "s")
:style toggle :selected (member "s" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Moderated" (erc-toggle-channel-mode "m")
:style toggle :selected (member "m" erc-channel-modes)
:active (erc-channel-user-op-p (erc-current-nick))]
["Set a limit..." erc-set-channel-limit
(erc-channel-user-op-p (erc-current-nick))]
["Set a key..." erc-set-channel-key
(erc-channel-user-op-p (erc-current-nick))])
["Leave this channel..." erc-part-from-channel erc-channel-users]
"-")
(list "Pals, fools and other keywords" (list "Pals, fools and other keywords"
["Add pal..." erc-add-pal] ["Add pal..." erc-add-pal]
["Delete pal..." erc-delete-pal] ["Delete pal..." erc-delete-pal]
...@@ -98,16 +100,46 @@ ...@@ -98,16 +100,46 @@
["Show ERC version" erc-version t]) ["Show ERC version" erc-version t])
"ERC menu definition.") "ERC menu definition.")
;; `erc-mode-map' must be defined before doing this (defvar erc-menu-defined nil
(eval-after-load "erc" "Internal variable used to keep track of whether we've defined the
'(progn ERC menu yet.")
(easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
(easy-menu-add erc-menu erc-mode-map)
;; for some reason the menu isn't automatically added to the menu bar ;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t)
(when (featurep 'xemacs) (define-erc-module menu nil
(add-hook 'erc-mode-hook "Enable a menu in ERC buffers."
(lambda () (easy-menu-add erc-menu erc-mode-map)))))) ((