client

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: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is used to represent the client in rooms and do server actions.

func New

func New(name string, roomlist *room.RoomList, chatlog io.Writer, data clientdata.ClientData, connection connections.Connection) *Client

New returns a new client.

func (*Client) Block

func (cl *Client) Block(name string) *Response

Block adds name to this clients block list.

func (*Client) BlockList

func (cl *Client) BlockList() *Response

BlockList provides a list of the names the client is currently blocking.

func (*Client) Equals

func (cl *Client) Equals(other room.Client) bool

Equals returns true if the client name and connection match.

func (*Client) Execute

func (cl *Client) Execute(command []string) connections.Response

Execute parses and then runs commands from the client connection.

func (*Client) Friend

func (cl *Client) Friend(name string) *Response

Friend adds name to this clients friend list.

func (*Client) FriendList

func (cl *Client) FriendList() *Response

FriendList gives a list of people on the clients friendlist and the room they are in or when they were last logged in.

func (*Client) IsBlocked

func (cl *Client) IsBlocked(other string) bool

IsBlocked returns true if other's name is on clients blocklist.

func (*Client) Join

func (cl *Client) Join(rmName string) *Response

Join adds a client to a room or creates a room if it doesn't exist.

func (*Client) Leave

func (cl *Client) Leave() *Response

Leave is the client action to leave a room. Moves the client back to the Lobby room.

func (*Client) LeaveRoom

func (cl *Client) LeaveRoom()

LeaveRoom removes the client from its room. It is used for logging out.

func (*Client) List

func (cl *Client) List() *Response

List sends to the client a list of the current open rooms.

func (*Client) Name

func (cl *Client) Name() string

Name returns the clients name.

func (*Client) Quit

func (cl *Client) Quit() *Response

func (*Client) Recieve

func (cl *Client) Recieve(m message.Message)

Recieve will pass messages along to the client.

func (*Client) Send

func (cl *Client) Send(m string) *Response

Send sends the message to the clients room.

func (*Client) SetConnection

func (cl *Client) SetConnection(conn connections.Connection)

func (*Client) Tell

func (cl *Client) Tell(name, m string) *Response

func (*Client) Unblock

func (cl *Client) Unblock(name string) *Response

Unblock removes name from this clients block list.

func (*Client) Unfriend

func (cl *Client) Unfriend(name string) *Response

Unfriend removes name from this clients friend list.

func (*Client) Who

func (cl *Client) Who(rmName string) *Response

Who sends the client a list of all the people in the room specified or the clients room if none is provided.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(roomlist *room.RoomList, chatlog io.Writer, data clientdata.Factory) *Factory

func (*Factory) New

func (f *Factory) New(name string, connection connections.Connection) connections.Client

type Friend

type Friend struct {
	Name string
	Room string
}

Friend represents a person on your friends list. room will instead be the last online string if they are not online now.

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response is used to reply to commands from the clients connection.

func NewResponse

func NewResponse(success bool, code int, sresp string, data interface{}) *Response

NewResponse returns a new response.

func (*Response) Code

func (resp *Response) Code() int

func (*Response) Data

func (resp *Response) Data() interface{}

func (*Response) String

func (resp *Response) String() string

func (*Response) Success

func (resp *Response) Success() bool

type WhoData

type WhoData struct {
	Room    string
	Clients []string
}

WhoData is an object used to return the advanced format in a response from who.

Jump to

Keyboard shortcuts

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