message

package
v0.0.0-...-4f83aec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2016 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMessage

type ClientMessage interface {
	String() string
	Name() string //name of the client that sent the message
}

ClientMessage is an interface for messages that can be blocked.

type JoinMessage

type JoinMessage struct {
	Subject string
	Text    string
	Type    string
}

func NewJoinMessage

func NewJoinMessage(subject string) *JoinMessage

func NewLeaveMessage

func NewLeaveMessage(subject string) *JoinMessage

func (JoinMessage) String

func (m JoinMessage) String() string

type Message

type Message interface {
	String() string
}

Message is an interface for dealing with various types of messages.

type MessageList

type MessageList struct {
	*list.List
	*sync.Mutex
}

messageList is a mutex enhanced linked list of messages.

func NewMessageList

func NewMessageList() *MessageList

newMessageList creates a new message list.

func (MessageList) PushBack

func (ml MessageList) PushBack(v Message) *list.Element

type RestMessage

type RestMessage struct {
	Name string
	Text string
	Time time.Time
}

restMessage is a message sent from the REST API.

func (*RestMessage) String

func (m *RestMessage) String() string

String returns a rest message string formated as Time [Name]: Text.

type SendMessage

type SendMessage struct {
	Text       string
	Time       time.Time
	TimeString string
	Sender     string
	Type       string
}

SendMessage includes the text of the message, the time it was sent and the client who sent it. It is used primarily for normal messages sent to the room with send.

func NewSendMessage

func NewSendMessage(text string, sender string) *SendMessage

NewSendMessage creates a new client message

func (SendMessage) Name

func (m SendMessage) Name() string

Name returns the name of the client that send the message.

func (SendMessage) String

func (m SendMessage) String() string

String formats the clientMessage as time [Sender]: text.

type ServerMessage

type ServerMessage struct {
	Text string
	Type string
}

serverMessage is a message containing only a string sent from the server.

func NewServerMessage

func NewServerMessage(text string) *ServerMessage

NewServerMessage returns a new ServerMessage.

func (ServerMessage) String

func (m ServerMessage) String() string

String returns the string representation of the serverMessage.

type TellMessage

type TellMessage struct {
	Text       string
	TimeString string
	Time       time.Time
	Sender     string
	Reciever   string
	ToReciever bool
	Type       string
}

TellMessage is a message sent by a tell.

func NewTellMessage

func NewTellMessage(text string, sender string, reciever string, toReciever bool) *TellMessage

func (TellMessage) Name

func (m TellMessage) Name() string

func (TellMessage) String

func (m TellMessage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL