flist

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRDStart  PRDType = "start"
	PRDEnd            = "end"
	PRDInfo           = "info"
	PRDSelect         = "select"
)
View Source
const (
	RoleFullDom = "Always dominant"
	RoleSomeDom = "Usually dominant"
	RoleSwitch  = "Switch"
	RoleSomeSub = "Usually submissive"
	RoleFullSub = "Always submissive"
)
View Source
const (
	StatusOnline  = "online"
	StatusLooking = "looking"
	StatusBusy    = "busy"
	StatusDND     = "dnd"
	StatusIdle    = "idle"
	StatusAway    = "away"
)

Variables

View Source
var (
	// ErrMsgTooLong is returned if there is an attempt to send a message
	// through MSG or PRI that exceeds the server's variables (chat_max and
	// priv_max respectively). The message is never send to the server. If the
	// message was sent, the server would reply with an ERR.
	ErrMsgTooLong = errors.New("message too long")
)
View Source
var ErrUnknownCmd = errors.New("unknown command")

Functions

func GetAccountCharacters added in v1.3.0

func GetAccountCharacters(account, ticket string) ([]string, error)

func GetTicket

func GetTicket(account, password string) (string, error)

func SortChannelsByTitle added in v1.1.0

func SortChannelsByTitle(channels []Channel)

Types

type CIU added in v1.5.0

type CIU struct {
	Sender string `json:"sender"`
	Title  string `json:"title"`
	Name   string `json:"name"`
}

CIU is a server command.

Invites a user to a channel.

Syntax

>> CIU { "sender":string,"title":string,"name":string }

func (*CIU) CmdDecode added in v1.5.0

func (c *CIU) CmdDecode(data []byte) error

func (CIU) CmdEncode added in v1.5.0

func (c CIU) CmdEncode() ([]byte, error)

func (CIU) CmdName added in v1.5.1

func (c CIU) CmdName() string

type Channel

type Channel struct {
	Name       string `json:"name"`
	Title      string `json:"title"`
	Characters int    `json:"characters"`
}

func FindChannel added in v1.1.0

func FindChannel(channels []Channel, title string) *Channel

type CharacterData added in v1.1.1

type CharacterData struct {
	ID           int64       `json:"id"`
	Name         string      `json:"name"`
	Description  string      `json:"description"`
	Views        int         `json:"views"`
	CustomsFirst bool        `json:"customs_first"`
	CustomTitle  string      `json:"custom_title"`
	CreatedAt    int64       `json:"created_at"`
	UpdatedAt    int64       `json:"updated_at"`
	Infotags     Infotags    `json:"infotags"`
	Kinks        Kinks       `json:"kinks"`
	CustomKinks  CustomKinks `json:"custom_kinks"`
}

func GetCharacterData added in v1.1.1

func GetCharacterData(name, account, ticket string) (*CharacterData, error)

func (CharacterData) HasFaveCustomKink added in v1.3.1

func (d CharacterData) HasFaveCustomKink(kinks ...string) bool

func (CharacterData) HasFaveKink added in v1.3.1

func (d CharacterData) HasFaveKink(kinksMap map[string]string, kink string) bool

func (CharacterData) HumanInfotags added in v1.3.0

func (d CharacterData) HumanInfotags(ml *MappingList) map[string]string

func (CharacterData) HumanKinks added in v1.3.1

func (d CharacterData) HumanKinks(kinks map[string]string) map[string]string

type Client

type Client struct {
	Name    string
	Version string
	// contains filtered or unexported fields
}

func Connect

func Connect(url string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Disconnect

func (c *Client) Disconnect() error

func (*Client) Identify

func (c *Client) Identify(account, password, character string) error

func (*Client) NewIDN

func (c *Client) NewIDN(account, ticket, character string) *IDN

func (*Client) ReadMessage

func (c *Client) ReadMessage() ([]byte, error)

func (*Client) SendCmd added in v1.5.1

func (c *Client) SendCmd(cmd CmdEncoder) error

func (*Client) SendMSG

func (c *Client) SendMSG(msg *MSG) error

func (*Client) SendORS

func (c *Client) SendORS() error

func (*Client) SendPRI

func (c *Client) SendPRI(pri *PRI) error

func (*Client) SetChatMax added in v1.3.0

func (c *Client) SetChatMax(max int)

func (*Client) SetPrivMax added in v1.3.0

func (c *Client) SetPrivMax(max int)

type CmdDecoder

type CmdDecoder interface {
	CmdDecode([]byte) error
}

type CmdEncoder

type CmdEncoder interface {
	CmdName() string
	CmdEncode() ([]byte, error)
}

type Command

type Command interface {
	CmdDecoder
	CmdEncoder
}

func DecodeCommand

func DecodeCommand(data []byte) (Command, error)

type CustomKink added in v1.3.1

type CustomKink struct {
	ID          string
	Name        string `json:"name"`
	Description string `json:"description"`
	Choice      string `json:"choice"`
}

type CustomKinks added in v1.3.1

type CustomKinks []*CustomKink

func (CustomKinks) MarshalJSON added in v1.3.1

func (kn CustomKinks) MarshalJSON() ([]byte, error)

func (*CustomKinks) UnmarshalJSON added in v1.3.1

func (kn *CustomKinks) UnmarshalJSON(data []byte) error

type ERR added in v1.3.0

type ERR struct {
	Number  int    `json:"number"`
	Message string `json:"message"`
}

ERR is a server command.

Indicates that the given error has occurred.

Syntax

>> ERR { "number": int, "message": string }

Raw sample

ERR {"message": "You have already joined this channel.", "number": 28}

func (*ERR) CmdDecode added in v1.3.0

func (c *ERR) CmdDecode(data []byte) error

func (ERR) CmdEncode added in v1.3.0

func (c ERR) CmdEncode() ([]byte, error)

func (ERR) CmdName added in v1.5.1

func (c ERR) CmdName() string

type ErrorResponse added in v1.3.0

type ErrorResponse struct {
	Message string
	Cause   error
	// contains filtered or unexported fields
}

func (ErrorResponse) Body added in v1.3.0

func (e ErrorResponse) Body() []byte

func (ErrorResponse) Error added in v1.3.0

func (e ErrorResponse) Error() string

type FLN added in v1.3.0

type FLN struct {
	Character string `json:"character"`
}

FLN is a server command.

Sent by the server to inform the client a given character went offline.

Syntax

>> FLN { "character": string }

Raw sample

FLN {"character":"Hexxy"}

Notes/Warnings

Should be treated as a global LCH for this character.

func (*FLN) CmdDecode added in v1.3.0

func (c *FLN) CmdDecode(data []byte) error

func (FLN) CmdEncode added in v1.3.0

func (c FLN) CmdEncode() ([]byte, error)

func (FLN) CmdName added in v1.5.1

func (c FLN) CmdName() string

type ICH added in v1.3.0

type ICH struct {
	Channel string `json:"channel"`
	Mode    string `json:"mode"` // enum, can be "ads", "chat", or "both".
	Users   []struct {
		Identity string `json:"identity"`
	} `json:"users"`
}

func (*ICH) CmdDecode added in v1.3.0

func (c *ICH) CmdDecode(data []byte) error

func (ICH) CmdEncode added in v1.3.0

func (c ICH) CmdEncode() ([]byte, error)

func (ICH) CmdName added in v1.5.1

func (c ICH) CmdName() string

type IDN

type IDN struct {
	Method        string `json:"method,omitempty"`
	Account       string `json:"account,omitempty"`
	Ticket        string `json:"ticket,omitempty"`
	Character     string `json:"character"`
	ClientName    string `json:"cname,omitempty"`
	ClientVersion string `json:"cversion,omitempty"`
}

func (*IDN) CmdDecode

func (c *IDN) CmdDecode(data []byte) error

func (IDN) CmdEncode

func (c IDN) CmdEncode() ([]byte, error)

func (IDN) CmdName added in v1.5.1

func (c IDN) CmdName() string

type Infotags added in v1.3.0

type Infotags map[string]string

func (Infotags) MarshalJSON added in v1.3.0

func (it Infotags) MarshalJSON() ([]byte, error)

func (*Infotags) UnmarshalJSON added in v1.3.0

func (it *Infotags) UnmarshalJSON(data []byte) error

type JCH

type JCH struct {
	Channel   string `json:"channel"`
	Title     string `json:"title,omitempty"`
	Character struct {
		Identity string `json:"identity"`
	} `json:"character,omitempty"`
}

JCH is a server and client command.

Server

Indicates the given user has joined the given channel. This may also be the client's character.

Syntax

>> JCH { "channel": string, "character": object, "title": string }

Raw sample

JCH {"character": {"identity": "Hexxy"}, "channel": "Frontpage",
"title": "Frontpage"}

Notes/Warnings

As with all commands that refer to a specific channel, official/public channels use the name, but unofficial/private/open private rooms use the channel ID, which can be gotten from ORS.

Client

Send a channel join request.

Syntax

<< JCH { "channel": string }

Raw sample

JCH {"channel": "Frontpage"}

Notes/Warnings

As with all commands that refer to a specific channel, official/public channels use the name, but unofficial/private/open private rooms use the channel ID, which can be gotten from ORS.

func (*JCH) CmdDecode

func (c *JCH) CmdDecode(data []byte) error

func (JCH) CmdEncode

func (c JCH) CmdEncode() ([]byte, error)

func (JCH) CmdName added in v1.5.1

func (c JCH) CmdName() string

type Kinks added in v1.3.1

type Kinks map[string]string

func (Kinks) MarshalJSON added in v1.3.1

func (kn Kinks) MarshalJSON() ([]byte, error)

func (*Kinks) UnmarshalJSON added in v1.3.1

func (kn *Kinks) UnmarshalJSON(data []byte) error

type LCH added in v1.3.0

type LCH struct {
	Channel   string `json:"channel"`
	Character string `json:"character"`
}

LCH is a server command.

An indicator that the given character has left the channel. This may also be the client's character.

Syntax

>> LCH { "channel": string, "character": character }

func (*LCH) CmdDecode added in v1.3.0

func (c *LCH) CmdDecode(data []byte) error

func (LCH) CmdEncode added in v1.3.0

func (c LCH) CmdEncode() ([]byte, error)

func (LCH) CmdName added in v1.5.1

func (c LCH) CmdName() string

type LIS added in v1.3.0

type LIS struct {
	Characters [][]string `json:"characters"`
}

LIS is a server command.

Sends an array of all the online characters and their gender, status, and status message.

Syntax

>> LIS { characters: [object] }

Raw sample

LIS {"characters": [["Alexandrea", "Female", "online", ""], ["Fa Mulan",
"Female", "busy", "Away, check out my new alt Aya Kinjou!"], ["Adorkable
Lexi", "Female", "online", ""], ["Melfice Cyrum", "Male", "online", ""],
["Jenasys Stryphe", "Female", "online", ""], ["Cassie Hazel", "Herm",
"looking", ""], ["Jun Watarase", "Male", "looking", "cute femmy boi
looking for a dominate partner"],["Motley Ferret", "Male", "online",
""], ["Tashi", "Male", "online", ""], ["Viol", "Cunt-boy", "looking",
""], ["Dorjan Kazyanenko", "Male", "looking", ""], ["Asaki", "Female",
"online", ""]]}

Because of the large amount of data, this command is often sent out in batches of several LIS commands. Since you got a CON before LIS, you'll know when it has sent them all.

The characters object has a syntax of ["Name", "Gender", "Status", "Status Message"].

func (*LIS) CmdDecode added in v1.3.0

func (c *LIS) CmdDecode(data []byte) error

func (LIS) CmdEncode added in v1.3.0

func (c LIS) CmdEncode() ([]byte, error)

func (LIS) CmdName added in v1.5.1

func (c LIS) CmdName() string

type MSG

type MSG struct {
	Character string `json:"character,omitempty"`
	Message   string `json:"message"`
	Channel   string `json:"channel"`
}

func (*MSG) CmdDecode

func (c *MSG) CmdDecode(data []byte) error

func (MSG) CmdEncode

func (c MSG) CmdEncode() ([]byte, error)

func (MSG) CmdName added in v1.5.1

func (c MSG) CmdName() string

type MappingList added in v1.3.0

type MappingList struct {
	Kinks []struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		GroupID     string `json:"group_id"`
	} `json:"kinks"`
	KinkGroups []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"kink_groups"`
	Infotags []struct {
		ID      string `json:"id"`
		Name    string `json:"name"`
		Type    string `json:"type"`
		List    string `json:"list"`
		GroupID string `json:"group_id"`
	} `json:"infotags"`
	InfotagGroups []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"infotag_groups"`
	Listitems []struct {
		ID    string `json:"id"`
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"listitems"`
	Error string `json:"error"`
}

func GetMappingList added in v1.3.0

func GetMappingList() (*MappingList, error)

func (MappingList) InfotagsMap added in v1.3.0

func (ml MappingList) InfotagsMap() map[string]string

func (MappingList) KinksMap added in v1.3.1

func (ml MappingList) KinksMap() map[string]string

func (MappingList) ListitemsMap added in v1.3.0

func (ml MappingList) ListitemsMap() map[string]string

type NLN added in v1.3.0

type NLN struct {
	Identity string `json:"identity"`
	Gender   string `json:"gender"`
	Status   Status `json:"status"`
}

NLN is a server command.

A user connected.

Syntax

>> NLN { "identity": string, "gender": enum, "status": enum }

Raw sample

NLN {"status": "online", "gender": "Male", "identity": "Hexxy"}

Parameters

Identity: character name of the user connecting.

Gender: a valid gender string.

Status: a valid status, though since it is when signing on, the only possibility is online.

func (*NLN) CmdDecode added in v1.3.0

func (c *NLN) CmdDecode(data []byte) error

func (NLN) CmdEncode added in v1.3.0

func (c NLN) CmdEncode() ([]byte, error)

func (NLN) CmdName added in v1.5.1

func (c NLN) CmdName() string

type ORS

type ORS struct {
	Channels []Channel `json:"channels,omitempty"`
}

func (*ORS) CmdDecode

func (c *ORS) CmdDecode(data []byte) error

func (ORS) CmdEncode

func (c ORS) CmdEncode() ([]byte, error)

func (ORS) CmdName added in v1.5.1

func (c ORS) CmdName() string

type PIN

type PIN struct{}

func (*PIN) CmdDecode

func (c *PIN) CmdDecode(data []byte) error

func (PIN) CmdEncode

func (c PIN) CmdEncode() ([]byte, error)

func (PIN) CmdName added in v1.5.1

func (c PIN) CmdName() string

type PRD added in v1.3.0

type PRD struct {
	Type    PRDType `json:"type"`
	Message string  `json:"message,omitempty"`
	Key     string  `json:"key"`
	Value   string  `json:"value"`
}

func (*PRD) CmdDecode added in v1.3.0

func (c *PRD) CmdDecode(data []byte) error

func (PRD) CmdEncode added in v1.3.0

func (c PRD) CmdEncode() ([]byte, error)

func (PRD) CmdName added in v1.5.1

func (c PRD) CmdName() string

type PRDType added in v1.3.0

type PRDType string

type PRI

type PRI struct {
	Character string `json:"character,omitempty"`
	Message   string `json:"message"`
	Recipient string `json:"recipient,omitempty"`
}

func (*PRI) CmdDecode

func (c *PRI) CmdDecode(data []byte) error

func (PRI) CmdEncode

func (c PRI) CmdEncode() ([]byte, error)

func (PRI) CmdName added in v1.5.1

func (c PRI) CmdName() string

type PRO added in v1.3.0

type PRO struct {
	Character string `json:"character"`
}

func (*PRO) CmdDecode added in v1.3.0

func (c *PRO) CmdDecode(data []byte) error

func (PRO) CmdEncode added in v1.3.0

func (c PRO) CmdEncode() ([]byte, error)

func (PRO) CmdName added in v1.5.1

func (c PRO) CmdName() string

type RawMessage

type RawMessage struct {
	Data []byte
	Err  error
}

type Role added in v1.3.0

type Role string

func (*Role) Scan added in v1.3.0

func (r *Role) Scan(value interface{}) error

func (Role) Value added in v1.3.0

func (r Role) Value() (driver.Value, error)

type STA added in v1.1.1

type STA struct {
	Status    Status `json:"status"`
	StatusMsg string `json:"statusmsg"`
	Character string `json:"character,omitempty"`
}

func (*STA) CmdDecode added in v1.1.1

func (c *STA) CmdDecode(data []byte) error

func (STA) CmdEncode added in v1.1.1

func (c STA) CmdEncode() ([]byte, error)

func (STA) CmdName added in v1.5.1

func (c STA) CmdName() string

type Status added in v1.1.1

type Status string

func (Status) IsActive added in v1.3.0

func (s Status) IsActive() bool

func (*Status) Scan added in v1.3.0

func (s *Status) Scan(value interface{}) error

func (Status) Value added in v1.3.0

func (s Status) Value() (driver.Value, error)

type VAR added in v1.3.0

type VAR struct {
	Variable string          `json:"variable"`
	Value    json.RawMessage `json:"value"`
	ChatMax  int
	PrivMax  int
}

func (*VAR) CmdDecode added in v1.3.0

func (c *VAR) CmdDecode(data []byte) error

func (VAR) CmdEncode added in v1.3.0

func (c VAR) CmdEncode() ([]byte, error)

func (VAR) CmdName added in v1.5.1

func (c VAR) CmdName() string

Jump to

Keyboard shortcuts

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