* [PATCH] rcirc: Add CTCP PING handler
@ 2010-01-06 17:07 Deniz Dogan
0 siblings, 0 replies; only message in thread
From: Deniz Dogan @ 2010-01-06 17:07 UTC (permalink / raw
To: Emacs-Devel devel
[-- Attachment #1: Type: text/plain, Size: 355 bytes --]
Attached in a bzr bundle which I hope works. I'm still new to bzr so
I'm not sure what I'm doing here...
The patch adds a handler for CTCP PING which replies correctly to the
sender. This was previously unhandled for some reason. (Why?)
It also adds a special "CTCP command" which makes it possible to
properly PING other users as well.
--
Deniz Dogan
[-- Attachment #2: rcirc-ping-fix.txt --]
[-- Type: text/plain, Size: 4379 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: deniz.a.m.dogan@gmail.com-20100106170213-\
# omlnk0w1cjcztpqh
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk
# testament_sha1: 7a1f4c8fca4e2ff01fbf0c250193dcd8eb8a7bd3
# timestamp: 2010-01-06 18:03:48 +0100
# base_revision_id: dann@ics.uci.edu-20100106151152-b52s8rwsuo7ehkf0
#
# Begin patch
=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el 2010-01-02 16:13:22 +0000
+++ lisp/net/rcirc.el 2010-01-06 17:02:13 +0000
@@ -2082,15 +2082,26 @@
(rcirc-send-string process (concat "KICK " target " " argstring))))
(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))))
+ (if (string-match "^\\([^ ]+\\)\\s-+\\([^ ]+\\)\\s-*\\(.*\\)$" args)
+ (let* ((target (match-string 1 args))
+ (request (upcase (match-string 2 args)))
+ (handler (intern-soft (concat "rcirc-cmd-ctcp-" request))))
+ (if (not (fboundp handler))
+ (rcirc-send-string process
+ (format "PRIVMSG %s \C-a%s\C-a"
+ target request))
+ (funcall handler process target (match-string 3 args))))
(rcirc-print process (rcirc-nick process) "ERROR" nil
"usage: /ctcp NICK REQUEST")))
+(defun rcirc-cmd-ctcp-PING (process target args)
+ (let ((unix-timestamp (substring
+ (number-to-string
+ (ftruncate
+ (float-time))) 0 -2)))
+ (rcirc-send-string process (format "PRIVMSG %s :\C-aPING %s\C-a"
+ target unix-timestamp))))
+
(defun rcirc-cmd-me (args &optional process target)
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))
@@ -2600,6 +2611,12 @@
(rcirc-print process sender "CTCP" target
(format "%s" text) t))))))
+(defun rcirc-handler-ctcp-PING (process target sender args)
+ (rcirc-send-string process
+ (concat "NOTICE " sender
+ " :\C-aPING " args
+ "\C-a")))
+
(defun rcirc-handler-ctcp-VERSION (process target sender args)
(rcirc-send-string process
(concat "NOTICE " sender
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZpgQGwAAiL/gFVwI6he+//3
fqPdD7////BQBM0ktoMwaba2zLCSRACE8ExNRqekNoyR6SZmojyQD1DQP1RtJ+qDIiMJo00JplTT
TRhNNBoAAAAAAAkUmISnmk0ynqD0T1NMnomjT1B5NRp6gNGg2po8oaHMJoDQGjRhGgxGmJkxNBhG
gZAMmBzCaA0Bo0YRoMRpiZMTQYRoGQDJhYsqTnebpfM5v48TUeeQjYOH6HjweYG2I27Oogg2cgiC
GEo3IkY30AoADBrNm/avuRFauKK2pXrIR2396yLuEHZbZ8nszBw/kigowtZ4XwOwbGCHRKosllGb
tk4/hF8jjKVYVU04f5J7uanhRO3RUn2GnkiBo6k8f/Zj9Wrtt5Ph36oui+f4qiK7DoTYzgZJ9lrU
vTDjHyvRozcueQZ2GhrRnnQcw7yMbBmWF5ox8EJMN7HRiyQpqHj0v8k5n8sp3zZFMJiI8RZF7zYV
Of1zefXtXsFGuyPwiU6l4lHL6p96U1iViXwT8y9SV6v90NemuFK1juZhF6+LCKhDx/tFDmTksFqh
Bdj7nWmU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gql0MDeIraBA74KkBaOU7W45lAq8R5AHuQvS3KmVOqd1qRXBuFoU6yrk
UKzwLdb68YYwMGJIhf+LuSKcKEhNMCA2AA==
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-01-06 17:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 17:07 [PATCH] rcirc: Add CTCP PING handler Deniz Dogan
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.