summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-12 20:34:26 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-12 20:34:26 +0000
commit787513ef129c118717d22daf735c2ed7bfacdf55 (patch)
tree5cb6db33b77cb04a87378fc34423e510b9d7010f
parent5df29686990334d699a6558d59b1e3bec102e3a7 (diff)
*** no comment ***
-rw-r--r--TODO5
-rw-r--r--chess-irc.el17
2 files changed, 16 insertions, 6 deletions
diff --git a/TODO b/TODO
index d37874b..d105a1c 100644
--- a/TODO
+++ b/TODO
@@ -87,11 +87,12 @@
- Make the mode-line much more informative, with information on who is
playing, etc.
-- Add CTCP (optional) support to chess-irc.el
-
- Turn on memory gc collection messages, and see how much of a pig
chess.el is
+- make sure, if Bxc6 and bxc6 are possible, and the user types "bc6",
+ that bxc6 is chosen
+
- Make as much of chess-game/ply/pos, etc., defsubst as possible.
- Create a series of generic functions and predicates, so that users
diff --git a/chess-irc.el b/chess-irc.el
index 9cb39bb..1934037 100644
--- a/chess-irc.el
+++ b/chess-irc.el
@@ -38,12 +38,14 @@
(defvar chess-irc-opponent)
(defvar chess-irc-working nil)
(defvar chess-irc-last-pos nil)
+(defvar chess-irc-use-ctcp nil)
(make-variable-buffer-local 'chess-irc-process)
(make-variable-buffer-local 'chess-irc-engine)
(make-variable-buffer-local 'chess-irc-opponent)
(make-variable-buffer-local 'chess-irc-working)
(make-variable-buffer-local 'chess-irc-last-pos)
+(make-variable-buffer-local 'chess-irc-use-ctcp)
(defun chess-irc-handler (event &rest args)
"This is an example of a generic transport engine."
@@ -80,8 +82,11 @@
((eq event 'send)
(process-send-string chess-irc-process
- (format "PRIVMSG %s :%s\n"
- chess-irc-opponent (car args))))
+ (if chess-irc-use-ctcp
+ (format "PRIVMSG %s :\C-aCHESS %s\C-a\n"
+ chess-irc-opponent (car args))
+ (format "PRIVMSG %s :%s\n"
+ chess-irc-opponent (car args)))))
(t
(apply 'chess-network-handler event args))))
@@ -110,16 +115,20 @@
(while (not (eobp))
(cond
((looking-at
- ":\\([^ \t\n!]+\\)!\\S-+ PRIVMSG \\(\\S-+\\) :\\(.+\\)")
+ ":\\([^ \t\n!]+\\)!\\S-+ PRIVMSG \\(\\S-+\\) :\\(\C-aCHESS \\)?\\(.+\\)\C-a?\n")
(let ((sender (match-string 1))
(target (match-string 2))
- (msg (match-string 3)))
+ (ctcp (match-string 3))
+ (msg (match-string 4)))
(with-current-buffer chess-irc-engine
(when (and (string= chess-irc-nick target)
(or (null chess-irc-opponent)
(string= chess-irc-opponent sender)))
(unless chess-irc-opponent
(setq chess-irc-opponent sender))
+ (if (and (not chess-irc-use-ctcp)
+ ctcp (> (length ctcp) 0))
+ (setq chess-irc-use-ctcp t))
(chess-engine-submit nil (concat msg "\n")))))))
(forward-line)))
(setq chess-irc-last-pos (point)