Movie Night chat IRCd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

  1. #lang typed/racket
  2. (provide (all-defined-out))
  3. (require (for-syntax syntax/parse racket/list)
  4. syntax/parse/define)
  5. (define-syntax (defconst-iota stx)
  6. (syntax-parse stx
  7. [(_ i:id ...)
  8. (let* ([ids (syntax->list #'(i ...))]
  9. [cmds (for/list ([i ids] [p (range 0 (length ids))])
  10. `(define ,i ,p))])
  11. (datum->syntax stx `(begin ,@cmds))
  12. ;;#'([email protected] . cmds)
  13. )]))
  14. ;; Data types for communicating with the client
  15. (defconst-iota
  16. CdMessage ;; a normal message from the client meant to be broadcast
  17. CdUsers ;; get a list of users
  18. CdPing ;; ping the server to keep the connection alive
  19. CdAuth ;; get the auth levels of the user
  20. CdColor ;; get the users color
  21. CdEmote ;; get a list of emotes
  22. CdJoin ;; a message saying the client wants to join
  23. CdNotify ;; a notify message for the client to show
  24. )
  25. (defconst-iota
  26. DTInvalid
  27. DTChat ;; chat message
  28. DTCommand ;; non-chat function
  29. DTEvent ;; join/leave/kick/ban events
  30. DTClient ;; a message coming from the client
  31. DTHidden ;; a message that is purely instruction and data, not shown to user
  32. )
  33. (defconst-iota
  34. MsgChat ;; standard chat
  35. MsgAction ;; /me command
  36. MsgServer ;; server message
  37. MsgError ;; something went wrong
  38. MsgNotice ;; Like MsgServer, but for mods and admins only.
  39. MsgCommandResponse ;; The response from command
  40. MsgCommandError ;; The error response from command
  41. )
  42. (defconst-iota
  43. EvJoin
  44. EvLeave
  45. EvKick
  46. EvBan
  47. EvServerMessage
  48. EvNameChange
  49. EvNameChangeForced
  50. )