3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 13:59:44 +01:00
ergo/irc/messages.go

46 lines
1.0 KiB
Go
Raw Normal View History

2016-06-15 14:16:07 +02:00
// Copyright (c) 2016- Daniel Oaks <daniel@danieloaks.net>
// released under the MIT license
package irc
// Message represents an internal message passed by oragono.
type Message struct {
Type MessageType
Verb MessageVerb
Info map[MessageInfoKey]interface{}
}
// NewMessage returns a new Message.
// This is purely a convenience function.
func NewMessage(mt MessageType, mv MessageVerb) Message {
var message Message
message.Type = mt
message.Verb = mv
message.Info = make(map[MessageInfoKey]interface{})
return message
}
// MessageType represents the type of message it is.
type MessageType int
const (
// LineMT represents an IRC line Message Type
LineMT MessageType = iota
)
// MessageVerb represents the verb (i.e. the specific command, etc) of a message.
type MessageVerb int
const (
// NoMV represents no Message Verb
NoMV MessageVerb = iota
)
// MessageInfoKey represents a key in the Info attribute of a Message.
type MessageInfoKey int
const (
// LineIK represents an IRC line message info key
LineIK MessageInfoKey = iota
)