diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-16 19:55:35 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-16 19:55:35 +0000 |
| commit | dc75ae41eca4a8ccc04998d72a58dfdceae30552 (patch) | |
| tree | ff21b9ef74b069ebfccb32eed3a584774b175975 | |
| parent | fb6756c0260da80af6d7d6f3c4e90ee87f7ab18e (diff) | |
Only send startup commands after login has succeeded.
| -rw-r--r-- | chess-ics.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/chess-ics.el b/chess-ics.el index 6171b79..3691ade 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -28,8 +28,10 @@ The format of each entry is: :group 'chess-ics) (defvar chess-ics-handle) +(defvar chess-ics-logged-in nil) (make-variable-buffer-local 'chess-ics-handle) +(make-variable-buffer-local 'chess-ics-logged-in) ;; ICS12 format (with artificial line breaks): ;; @@ -181,7 +183,14 @@ who is black." t)) (defvar chess-ics-regexp-alist - (list (cons "\\(\\(\n*fics%\n*\\)?<12> \\(.+\\)\\)\n" + (list (cons "fics%" + (function + (lambda () + (unless chess-ics-logged-in + (chess-engine-send nil "set style 12\n") + (chess-engine-send nil "set bell 0\n") + (setq chess-ics-logged-in t))))) + (cons "\\(\\(\n*fics%\n*\\)?<12> \\(.+\\)\\)\n" 'chess-ics-handle-move) (cons "Challenge: \\(\\S-+\\) \\S-+ \\S-+ \\S-+ .+" (function @@ -236,12 +245,7 @@ who is black." (comint-send-string proc (concat pass "\n"))))) ;; jww (2002-04-13): Have to parse out the allocated Guest ;; name from the output - (comint-send-string proc "guest\n\n")) - - ;; jww (2002-04-16): This is fragile, since it assumes the - ;; login succeeded - (comint-send-string proc "set style 12\n") - (comint-send-string proc "set bell 0\n")))) + (comint-send-string proc "guest\n\n"))))) t) ((eq event 'match) |
