X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/06d8ace51597cd41e110560a56a1abeb6cce23d6..758c81e87ded2bad9f5a5a6683fb498965eb508c:/lisp/erc/erc-backend.el diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 2e9fa42480..cce24e67cf 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1,6 +1,6 @@ ;;; erc-backend.el --- Backend network communication for ERC -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2004-2012 Free Software Foundation, Inc. ;; Filename: erc-backend.el ;; Author: Lawrence Mitchell @@ -79,7 +79,7 @@ ;;; TODO: -;; o Generalise the display-line code so that we can use it to +;; o Generalize the display-line code so that we can use it to ;; display the stuff we send, as well as the stuff we receive. ;; Then, move all display-related code into another backend-like ;; file, erc-display.el, say. @@ -311,7 +311,7 @@ If a key is pressed while ERC is waiting, it will stop waiting." :type 'number) (defcustom erc-split-line-length 440 - "*The maximum length of a single message. + "The maximum length of a single message. If a message exceeds this size, it is broken into multiple ones. IRC allows for lines up to 512 bytes. Two of them are CR LF. @@ -329,6 +329,7 @@ Good luck." This will only be consulted if the coding system in `erc-server-coding-system' is `undecided'." :group 'erc-server + :version "24.1" :type '(repeat coding-system)) (defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p) @@ -378,27 +379,34 @@ It should take same arguments as `open-network-stream' does." :type 'function) (defcustom erc-server-prevent-duplicates '("301") - "*Either nil or a list of strings. + "Either nil or a list of strings. Each string is a IRC message type, like PRIVMSG or NOTICE. All Message types in that list of subjected to duplicate prevention." :type '(choice (const nil) (list string)) :group 'erc-server) (defcustom erc-server-duplicate-timeout 60 - "*The time allowed in seconds between duplicate messages. + "The time allowed in seconds between duplicate messages. If two identical messages arrive within this value of one another, the second isn't displayed." :type 'integer :group 'erc-server) +(defcustom erc-server-timestamp-format "%Y-%m-%d %T" + "Timestamp format used with server response messages. +This string is processed using `format-time-string'." + :version "24.2" + :type 'string + :group 'erc-server) + ;;; Flood-related ;; Most of this is courtesy of Jorgen Schaefer and Circe ;; (http://www.nongnu.org/circe) (defcustom erc-server-flood-margin 10 - "*A margin on how much excess data we send. + "A margin on how much excess data we send. The flood protection algorithm of ERC works like the one detailed in RFC 2813, section 5.8 \"Flood control of clients\". @@ -422,14 +430,14 @@ protection algorithm." ;; Ping handling (defcustom erc-server-send-ping-interval 30 - "*Interval of sending pings to the server, in seconds. + "Interval of sending pings to the server, in seconds. If this is set to nil, pinging the server is disabled." :group 'erc-server :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds"))) (defcustom erc-server-send-ping-timeout 120 - "*If the time between ping and response is greater than this, reconnect. + "If the time between ping and response is greater than this, reconnect. The time is in seconds. This must be greater than or equal to the value for @@ -991,7 +999,7 @@ Hands off to helper functions via `erc-call-hooks'." (if (member (erc-response.command parsed-response) erc-server-prevent-duplicates) (let ((m (erc-response.unparsed parsed-response))) - ;; duplicate supression + ;; duplicate suppression (if (< (or (gethash m erc-server-duplicates) 0) (- (erc-current-time) erc-server-duplicate-timeout)) (erc-call-hooks process parsed-response)) @@ -1432,7 +1440,7 @@ add things to `%s' instead." (when (string= cmd "PRIVMSG") (erc-auto-query proc parsed)))))) -;; FIXME: need clean way of specifiying extra hooks in +;; FIXME: need clean way of specifying extra hooks in ;; define-erc-response-handler. (add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query) @@ -1453,7 +1461,8 @@ add things to `%s' instead." "The channel topic has changed." nil (let* ((ch (first (erc-response.command-args parsed))) (topic (erc-trim-string (erc-response.contents parsed))) - (time (format-time-string "%T %m/%d/%y" (current-time)))) + (time (format-time-string erc-server-timestamp-format + (current-time)))) (multiple-value-bind (nick login host) (values-list (erc-parse-user (erc-response.sender parsed))) (erc-update-channel-member ch nick nick nil nil nil host login) @@ -1646,7 +1655,7 @@ See `erc-display-server-message'." nil (multiple-value-bind (nick seconds-idle on-since time) (values-list (cdr (erc-response.command-args parsed))) (setq time (when on-since - (format-time-string "%T %Y/%m/%d" + (format-time-string erc-server-timestamp-format (erc-string-to-emacs-time on-since)))) (erc-update-user-nick nick nick nil nil nil (and time (format "on since %s" time))) @@ -1723,7 +1732,8 @@ See `erc-display-server-message'." nil (third (erc-response.command-args parsed))))) (erc-display-message parsed 'notice (erc-get-buffer channel proc) - 's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time)))) + 's329 ?c channel ?t (format-time-string erc-server-timestamp-format + time)))) (define-erc-response-handler (330) "Nick is authed as (on Quakenet network)." nil @@ -1760,7 +1770,7 @@ See `erc-display-server-message'." nil "Who set the topic, and when." nil (multiple-value-bind (channel nick time) (values-list (cdr (erc-response.command-args parsed))) - (setq time (format-time-string "%T %Y/%m/%d" + (setq time (format-time-string erc-server-timestamp-format (erc-string-to-emacs-time time))) (erc-update-channel-topic channel (format "\C-o (%s, %s)" nick time) @@ -1951,6 +1961,13 @@ See `erc-display-server-message'." nil (erc-display-message parsed '(error notice) 'active 's482 ?c channel ?m message))) +(define-erc-response-handler (671) + "Secure connection response in WHOIS." nil + (let ((nick (second (erc-response.command-args parsed))) + (securemsg (erc-response.contents parsed))) + (erc-display-message parsed 'notice 'active 's671 + ?n nick ?a securemsg))) + (define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485 491 501 502) ;; 431 - No nickname given @@ -1993,4 +2010,3 @@ See `erc-display-error-notice'." nil ;; Local Variables: ;; indent-tabs-mode: nil ;; End: -