12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #lang racket
- (provide (all-defined-out))
- (require (for-syntax syntax/parse racket/list)
- syntax/parse/define)
- (define-syntax (defconst-iota stx)
- (syntax-parse stx
- [(_ i:id ...)
- (let* ([ids (syntax->list #'(i ...))]
- [cmds (for/list ([i ids] [p (range 0 (length ids))])
- `(define ,i ,p))])
- (datum->syntax stx `(begin ,@cmds))
- ;;#'(~@ . cmds)
- )]))
- ;; Data types for communicating with the client
- (defconst-iota
- CdMessage ;; a normal message from the client meant to be broadcast
- CdUsers ;; get a list of users
- CdPing ;; ping the server to keep the connection alive
- CdAuth ;; get the auth levels of the user
- CdColor ;; get the users color
- CdEmote ;; get a list of emotes
- CdJoin ;; a message saying the client wants to join
- CdNotify ;; a notify message for the client to show
- )
- (defconst-iota
- DTInvalid
- DTChat ;; chat message
- DTCommand ;; non-chat function
- DTEvent ;; join/leave/kick/ban events
- DTClient ;; a message coming from the client
- DTHidden ;; a message that is purely instruction and data, not shown to user
- )
- (defconst-iota
- MsgChat ;; standard chat
- MsgAction ;; /me command
- MsgServer ;; server message
- MsgError ;; something went wrong
- MsgNotice ;; Like MsgServer, but for mods and admins only.
- MsgCommandResponse ;; The response from command
- MsgCommandError ;; The error response from command
- )
- (defconst-iota
- EvJoin
- EvLeave
- EvKick
- EvBan
- EvServerMessage
- EvNameChange
- EvNameChangeForced
- )
|