;;; erc-backend.el --- Backend network communication for ERC
-;; Copyright (C) 2004-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2012 Free Software Foundation, Inc.
;; Filename: erc-backend.el
;; Author: Lawrence Mitchell <wence@gmx.li>
;;; 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.
: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.
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)
: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\".
;; 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
(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))
(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)
"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)
(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)))
(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
"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)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
-