summaryrefslogtreecommitdiff
path: root/chess-transport.el
blob: 47fe16ad56ab66be9f7060c329ce1063b0169083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; An example of a generic transport engine, based on the protocol
;; used by chess-network.el.  The only parts missing are send and
;; receive.  This could be used for transmitting chess.el protocol
;; over CTCP, for example.
;;
;; $Revision$

(require 'chess-network)

(defalias 'chess-network-regexp-alist 'chess-transport-regexp-alist)

(defun chess-transport-handler (event &rest args)
  "This is an example of a generic transport engine."
  (cond
   ((eq event 'initialize)
    ;; Initialize the transport here, if necessary.  Make sure that
    ;; any housekeeping data you use is kept in buffer-local
    ;; variables.  Otherwise, multiple games played using the same
    ;; kind of transport might collide.  For example:
    ;;
    ;; (set (make-local-variable 'chess-transport-data) (car args))
    )

   ((eq event 'send)
    ;; Transmit the string given in `(car args)' to the outbound
    ;; transport from here
    )

   (t
    ;; Pass all other events down to chess-network
    (apply 'chess-network-handler event args))))

;; Call `(chess-engine-submit engine STRING)' for text that arrives
;; from the inbound transport

(provide 'chess-transport)

;;; chess-transport.el ends here