]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-netsplit.el
(erc-noncommands-list, noncommands, erc-control-characters,
[gnu-emacs] / lisp / erc / erc-netsplit.el
index 567c91cc0752df2b619418ffce38e7e13f896507..5bcb4327c18708b91083510966741a135a6eaa5c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits
 
-;; Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Keywords: comm
@@ -9,7 +9,7 @@
 
 ;; 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)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -173,18 +173,19 @@ 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 ()
   "Show who's gone."
-  (with-current-buffer (erc-server-buffer)
+  (erc-with-server-buffer
     (if (null erc-netsplit-list)
        (erc-display-message
         nil 'notice 'active