]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-autoaway.el
Merge from emacs-23; up to 2010-06-12T08:59:37Z!albinus@detlef.
[gnu-emacs] / lisp / erc / erc-autoaway.el
index cbfdd0786aabc07de16ae99d8a3e90c49e100e59..a15e038dddc1839cae20ea6c4bfeef1d95079e7f 100644 (file)
@@ -1,16 +1,16 @@
 ;;; erc-autoaway.el --- Provides autoaway for ERC
 
-;; Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2011  Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <forcer@forcix.cx>
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoAway
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, 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
@@ -18,9 +18,7 @@
 ;; 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.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -47,7 +45,7 @@ This is only used when `erc-autoaway-idle-method' is set to 'emacs.")
   "Indicates whether this module was responsible for setting the
 user's away status.")
 
-(eval-when-compile (defvar erc-autoaway-idle-seconds))
+(defvar erc-autoaway-idle-seconds)
 
 (defun erc-autoaway-reestablish-idletimer ()
   "Reestablish the Emacs idletimer.
@@ -248,7 +246,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
@@ -286,4 +285,3 @@ activer server buffer available."
 ;; tab-width: 8
 ;; End:
 
-;; arch-tag: 16fc241e-8358-4b56-9fe2-116bdd0ba3bc