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.

messages.go 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2016- Daniel Oaks <daniel@danieloaks.net>
  2. // released under the MIT license
  3. package irc
  4. // Message represents an internal message passed by oragono.
  5. type Message struct {
  6. Type MessageType
  7. Verb MessageVerb
  8. Info map[MessageInfoKey]interface{}
  9. }
  10. // NewMessage returns a new Message.
  11. // This is purely a convenience function.
  12. func NewMessage(mt MessageType, mv MessageVerb) Message {
  13. var message Message
  14. message.Type = mt
  15. message.Verb = mv
  16. message.Info = make(map[MessageInfoKey]interface{})
  17. return message
  18. }
  19. // MessageType represents the type of message it is.
  20. type MessageType int
  21. const (
  22. // LineMT represents an IRC line Message Type
  23. LineMT MessageType = iota
  24. )
  25. // MessageVerb represents the verb (i.e. the specific command, etc) of a message.
  26. type MessageVerb int
  27. const (
  28. // NoMV represents no Message Verb
  29. NoMV MessageVerb = iota
  30. )
  31. // MessageInfoKey represents a key in the Info attribute of a Message.
  32. type MessageInfoKey int
  33. const (
  34. // LineIK represents an IRC line message info key
  35. LineIK MessageInfoKey = iota
  36. )