]> code.delx.au - gnu-emacs-elpa/blob - chess-transport.el
*** no comment ***
[gnu-emacs-elpa] / chess-transport.el
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;
3 ;; An example of a generic transport engine, based on the protocol
4 ;; used by chess-network.el. The only parts missing are send and
5 ;; receive. This could be used for transmitting chess.el protocol
6 ;; over CTCP, for example.
7 ;;
8 ;; $Revision$
9
10 (require 'chess-network)
11
12 (defvar chess-transport-regexp-alist chess-network-regexp-alist)
13
14 (defun chess-transport-handler (event &rest args)
15 "This is an example of a generic transport engine."
16 (cond
17 ((eq event 'initialize)
18 ;; Initialize the transport here, if necessary. Make sure that
19 ;; any housekeeping data you use is kept in buffer-local
20 ;; variables. Otherwise, multiple games played using the same
21 ;; kind of transport might collide. For example:
22 ;;
23 ;; (set (make-local-variable 'chess-transport-data) (car args))
24 )
25
26 ((eq event 'send)
27 ;; Transmit the string given in `(car args)' to the outbound
28 ;; transport from here
29 )
30
31 (t
32 ;; Pass all other events down to chess-network
33 (apply 'chess-network-handler event args))))
34
35 ;; Call `(chess-engine-submit engine STRING)' for text that arrives
36 ;; from the inbound transport
37
38 (provide 'chess-transport)
39
40 ;;; chess-transport.el ends here