summaryrefslogtreecommitdiff
path: root/lisp/net/rcirc.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-02-09 23:04:56 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2011-02-09 23:04:56 -0800
commitbe6d99804b3efdecf3660c4b51da1945e955fb4d (patch)
tree99b523c445f7b95572ab668f4e878cd703ff3527 /lisp/net/rcirc.el
parentdd4638842ad1921562bc66049ec81a4530651cdf (diff)
parent67f02b82f496be403353a1dc918cc4f2278841bb (diff)
downloademacs-be6d99804b3efdecf3660c4b51da1945e955fb4d.tar.gz
emacs-be6d99804b3efdecf3660c4b51da1945e955fb4d.tar.bz2
emacs-be6d99804b3efdecf3660c4b51da1945e955fb4d.zip
Merge from mainline.
Diffstat (limited to 'lisp/net/rcirc.el')
-rw-r--r--lisp/net/rcirc.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 21934ce8b01..62fa7eb0feb 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2185,14 +2185,23 @@ With a prefix arg, prompt for new topic."
(defun rcirc-cmd-ctcp (args &optional process target)
(if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args)
- (let ((target (match-string 1 args))
- (request (match-string 2 args)))
- (rcirc-send-string process
- (format "PRIVMSG %s \C-a%s\C-a"
- target (upcase request))))
+ (let* ((target (match-string 1 args))
+ (request (upcase (match-string 2 args)))
+ (function (intern-soft (concat "rcirc-ctcp-sender-" request))))
+ (if (fboundp function) ;; use special function if available
+ (funcall function process target request)
+ (rcirc-send-string process
+ (format "PRIVMSG %s :\C-a%s\C-a"
+ target request))))
(rcirc-print process (rcirc-nick process) "ERROR" nil
"usage: /ctcp NICK REQUEST")))
+(defun rcirc-ctcp-sender-PING (process target request)
+ "Send a CTCP PING message to TARGET."
+ (let ((timestamp (format "%.0f" (float-time))))
+ (rcirc-send-string process
+ (format "PRIVMSG %s :\C-aPING %s\C-a" target timestamp))))
+
(defun rcirc-cmd-me (args &optional process target)
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))