summaryrefslogtreecommitdiff
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/ChangeLog38
-rw-r--r--lisp/erc/erc-autoaway.el3
-rw-r--r--lisp/erc/erc-backend.el56
-rw-r--r--lisp/erc/erc-log.el4
-rw-r--r--lisp/erc/erc-match.el10
-rw-r--r--lisp/erc/erc-netsplit.el15
-rw-r--r--lisp/erc/erc-notify.el3
-rw-r--r--lisp/erc/erc-track.el5
-rw-r--r--lisp/erc/erc.el21
9 files changed, 110 insertions, 45 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 929df097790..bd20dfbed45 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,41 @@
+2007-12-01 Glenn Morris <rgm@gnu.org>
+
+ * erc-backend.el (erc-server-send-ping): Move after definition of
+ erc-server-send.
+
+ * erc.el (iswitchb-temp-buflist, iswitchb-read-buffer)
+ (erc-controls-strip): Declare for compiler.
+ (erc-iswitchb): Don't require iswitchb when compiling. Test
+ iswitchb-mode is bound.
+
+2007-11-30 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * erc.el (open-ssl-stream, open-tls-stream, erc-network-name):
+ Declare as functions.
+
+2007-11-29 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change)
+
+ * erc-backend.el, erc.el:
+ Parse 307 (nick has identified) responses.
+
+2007-11-15 Juanma Barranquero <lekktu@gmail.com>
+
+ * erc.el (erc-open):
+ * erc-backend.el (define-erc-response-handler):
+ * erc-log.el (log):
+ * erc-match.el (erc-log-matches): Fix typos in docstrings.
+
+2007-11-11 Michael Olson <mwolson@gnu.org>
+
+ * erc-autoaway.el (erc-autoaway-possibly-set-away):
+ * erc-netsplit.el (erc-netsplit-timer):
+ * erc-notify.el (erc-notify-timer):
+ * erc-track.el (erc-user-is-active): Only run if we have
+ successfully established a connection to the server and have
+ logged in. I suspect that sending messages too soon may make some
+ IRC servers not respond well, particularly when the network
+ connection is iffy or subject to traffic-shaping.
+
2007-11-01 Michael Olson <mwolson@gnu.org>
* erc-compat.el (erc-set-write-file-functions): New compatibility
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index c70beb112e2..4c841387d7f 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -248,7 +248,8 @@ exceeds `erc-autoaway-idle-seconds'."
;; A test for (erc-server-process-alive) is not necessary, because
;; this function is called from `erc-timer-hook', which is called
;; whenever the server sends something to the client.
- (when (and erc-auto-set-away
+ (when (and erc-server-connected
+ erc-auto-set-away
(not erc-autoaway-caused-away)
(erc-autoaway-some-open-server-buffer))
(let ((idle-time (erc-time-diff erc-autoaway-last-sent-time
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 4e250490e9c..c0f4205c012 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -461,27 +461,6 @@ Currently this is called by `erc-send-input'."
(upcase-word 1)
(buffer-string)))
-(defun erc-server-send-ping (buf)
- "Send a ping to the IRC server buffer in BUF.
-Additionally, detect whether the IRC process has hung."
- (if (buffer-live-p buf)
- (with-current-buffer buf
- (if (and erc-server-send-ping-timeout
- (>
- (erc-time-diff (erc-current-time)
- erc-server-last-received-time)
- erc-server-send-ping-timeout))
- (progn
- ;; if the process is hung, kill it
- (setq erc-server-timed-out t)
- (delete-process erc-server-process))
- (erc-server-send (format "PING %.0f" (erc-current-time)))))
- ;; remove timer if the server buffer has been killed
- (let ((timer (assq buf erc-server-ping-timer-alist)))
- (when timer
- (erc-cancel-timer (cdr timer))
- (setcdr timer nil)))))
-
(defun erc-server-setup-periodical-ping (buffer)
"Set up a timer to periodically ping the current server.
The current buffer is given by BUFFER."
@@ -775,6 +754,27 @@ protection algorithm."
(message "ERC: No process running")
nil)))
+(defun erc-server-send-ping (buf)
+ "Send a ping to the IRC server buffer in BUF.
+Additionally, detect whether the IRC process has hung."
+ (if (buffer-live-p buf)
+ (with-current-buffer buf
+ (if (and erc-server-send-ping-timeout
+ (>
+ (erc-time-diff (erc-current-time)
+ erc-server-last-received-time)
+ erc-server-send-ping-timeout))
+ (progn
+ ;; if the process is hung, kill it
+ (setq erc-server-timed-out t)
+ (delete-process erc-server-process))
+ (erc-server-send (format "PING %.0f" (erc-current-time)))))
+ ;; remove timer if the server buffer has been killed
+ (let ((timer (assq buf erc-server-ping-timer-alist)))
+ (when timer
+ (erc-cancel-timer (cdr timer))
+ (setcdr timer nil)))))
+
;; From Circe
(defun erc-server-send-queue (buffer)
"Send messages in `erc-server-flood-queue'.
@@ -1018,13 +1018,13 @@ NAME is the response name as sent by the server (see the IRC RFC for
meanings).
This creates:
- - a hook variable `erc-server-NAME-functions' initialised to `erc-server-NAME'.
+ - a hook variable `erc-server-NAME-functions' initialized to `erc-server-NAME'.
- a function `erc-server-NAME' with body FN-BODY.
If ALIASES is non-nil, each alias in ALIASES is `defalias'ed to
`erc-server-NAME'.
Alias hook variables are created as `erc-server-ALIAS-functions' and
-initialised to the same default value as `erc-server-NAME-functions'.
+initialized to the same default value as `erc-server-NAME-functions'.
FN-BODY is the body of `erc-server-NAME' it may refer to the two
function arguments PROC and PARSED.
@@ -1564,6 +1564,16 @@ See `erc-display-server-message'." nil
(erc-display-message parsed 'notice 'active
's306 ?m (erc-response.contents parsed)))
+(define-erc-response-handler (307)
+ "Display nick-identified message." nil
+ (multiple-value-bind (nick user message)
+ (cdr (erc-response.command-args parsed))
+ (erc-display-message
+ parsed 'notice 'active 's307
+ ?n nick
+ ?m (mapconcat 'identity (cddr (erc-response.command-args parsed))
+ " "))))
+
(define-erc-response-handler (311 314)
"WHOIS/WHOWAS notices." nil
(let ((fname (erc-response.contents parsed))
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 8b5e07a383e..fe3e703f554 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -224,8 +224,8 @@ format is defined through a formatting function on
Since automatic logging is not always a Good Thing (especially if
people say things in different coding systems), you can turn logging
-behaviour on and off with the variable `erc-enable-logging', which can
-also be a predicate function. To only log when you are not set away, use:
+behavior on and off with the variable `erc-enable-logging', which can
+also be a predicate function. To only log when you are not set away, use:
\(setq erc-enable-logging
(lambda (buffer)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index c147b6566f8..a4752588ebd 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -530,11 +530,11 @@ Use this defun with `erc-insert-modify-hook'."
(defun erc-log-matches (match-type nickuserhost message)
"Log matches in a separate buffer, determined by MATCH-TYPE.
-The behaviour of this function is controlled by the variables
-`erc-log-matches-types-alist' and `erc-log-matches-flag'. Specify the
-match types which should be logged in the former, and
-deactivate/activate match logging in the latter. See
-`erc-log-match-format'."
+The behavior of this function is controlled by the variables
+`erc-log-matches-types-alist' and `erc-log-matches-flag'.
+Specify the match types which should be logged in the former,
+and deactivate/activate match logging in the latter.
+See `erc-log-match-format'."
(let ((match-buffer-name (cdr (assq match-type
erc-log-matches-types-alist)))
(nick (nth 0 (erc-parse-user nickuserhost))))
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 83bc0dffc0c..b20b7ad738b 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -173,13 +173,14 @@ join from that split has been detected or not.")
(defun erc-netsplit-timer (now)
"Clean cruft from `erc-netsplit-list' older than 10 minutes."
- (dolist (elt erc-netsplit-list)
- (when (> (erc-time-diff (cadr elt) now) 600)
- (when erc-netsplit-debug
- (erc-display-message
- nil 'notice (current-buffer)
- (concat "Netsplit: Removing " (car elt))))
- (setq erc-netsplit-list (delq elt erc-netsplit-list)))))
+ (when erc-server-connected
+ (dolist (elt erc-netsplit-list)
+ (when (> (erc-time-diff (cadr elt) now) 600)
+ (when erc-netsplit-debug
+ (erc-display-message
+ nil 'notice (current-buffer)
+ (concat "Netsplit: Removing " (car elt))))
+ (setq erc-netsplit-list (delq elt erc-netsplit-list))))))
;;;###autoload
(defun erc-cmd-WHOLEFT ()
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index 9216631a9b4..34556a00d6c 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -111,7 +111,8 @@ changes."
;;;; Timer handler
(defun erc-notify-timer (now)
- (when (and erc-notify-list
+ (when (and erc-server-connected
+ erc-notify-list
(> (erc-time-diff
erc-last-ison-time now)
erc-notify-interval))
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index ad3eaf73a4b..15de2094214 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -665,8 +665,9 @@ only consider active buffers visible.")
(defun erc-user-is-active (&rest ignore)
"Set `erc-buffer-activity'."
- (setq erc-buffer-activity (erc-current-time))
- (erc-track-modified-channels))
+ (when erc-server-connected
+ (setq erc-buffer-activity (erc-current-time))
+ (erc-track-modified-channels)))
(defun erc-track-get-buffer-window (buffer frame-param)
(if (eq frame-param 'selected-visible)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index fab8f7ca1b9..e4e9268bfbe 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1693,6 +1693,11 @@ nil."
(put 'erc-with-all-buffers-of-server 'lisp-indent-function 1)
(put 'erc-with-all-buffers-of-server 'edebug-form-spec '(form form body))
+;; (iswitchb-mode) will autoload iswitchb.el
+(defvar iswitchb-temp-buflist)
+(declare-function iswitchb-read-buffer "iswitchb"
+ (prompt &optional default require-match start matches-set))
+
(defun erc-iswitchb (&optional arg)
"Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to.
When invoked with prefix argument, use all erc buffers. Without prefix
@@ -1703,9 +1708,7 @@ If `erc-track-mode' is in enabled, put the last element of
Due to some yet unresolved reason, global function `iswitchb-mode'
needs to be active for this function to work."
(interactive "P")
- (eval-when-compile
- (require 'iswitchb))
- (let ((enabled iswitchb-mode))
+ (let ((enabled (bound-and-true-p iswitchb-mode)))
(or enabled (iswitchb-mode 1))
(unwind-protect
(let ((iswitchb-make-buflist-hook
@@ -1924,7 +1927,7 @@ already connected and just create a separate buffer for the new
target CHANNEL.
Use PASSWD as user password on the server. If TGT-LIST is
-non-nil, use it to initialise `erc-default-recipients'.
+non-nil, use it to initialize `erc-default-recipients'.
Returns the buffer for the given server or channel."
(let ((server-announced-name (when (and (boundp 'erc-session-server)
@@ -2165,6 +2168,8 @@ Arguments are the same as for `erc'."
(defalias 'erc-select-ssl 'erc-ssl)
+(declare-function open-ssl-stream "ext:ssl" (name buffer host service))
+
(defun erc-open-ssl-stream (name buffer host port)
"Open an SSL stream to an IRC server.
The process will be given the name NAME, its target buffer will be
@@ -2189,6 +2194,8 @@ Arguments are the same as for `erc'."
(let ((erc-server-connect-function 'erc-open-tls-stream))
(apply 'erc r)))
+(declare-function open-tls-stream "tls" (name buffer host port))
+
(defun erc-open-tls-stream (name buffer host port)
"Open an TLS stream to an IRC server.
The process will be given the name NAME, its target buffer will be
@@ -2225,6 +2232,8 @@ but you won't see it.
WARNING: Do not set this variable directly! Instead, use the
function `erc-toggle-debug-irc-protocol' to toggle its value.")
+(declare-function erc-network-name "erc-networks" ())
+
(defun erc-log-irc-protocol (string &optional outbound)
"Append STRING to the buffer *erc-protocol*.
@@ -5955,6 +5964,9 @@ if `erc-away' is non-nil."
(cond (lag (format "lag:%.0f" lag))
(t ""))))
+;; erc-goodies is required at end of this file.
+(declare-function erc-controls-strip "erc-goodies" (str))
+
(defun erc-update-mode-line-buffer (buffer)
"Update the mode line in a single ERC buffer BUFFER."
(with-current-buffer buffer
@@ -6205,6 +6217,7 @@ All windows are opened in the current frame."
(s303 . "Is online: %n")
(s305 . "%m")
(s306 . "%m")
+ (s307 . "%n %m")
(s311 . "%n is %f (%u@%h)")
(s312 . "%n is/was on server %s (%c)")
(s313 . "%n is an IRC operator")