data

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package data contains the session data storage system

Package data contains the session data storage system

Package data contains the session data storage system

Package data contains the session data storage system

Package data contains the session data storage system

Package data contains the session data storage system

Index

Constants

View Source
const Version = "2.0.0"

Version of mauIRC

Variables

View Source
var (
	Networks          = make(map[string]*Network)
	GlobalScripts     = make(ScriptStore)
	MessageFormatting = true
)

Base store variables

View Source
var (
	AuthFail               = false
	Connected              = false
	MessageContainerActive = false
)

Misc variables

View Source
var (
	Socket     *websocket.WebSocket
	SocketPath string
	Messages   = make(chan messages.Container, 16)
)

Connection variables

Functions

func ChannelExists

func ChannelExists(network, channel string) bool

ChannelExists checks if a channel with the given name exists in the network with the given name

func NetworkExists

func NetworkExists(name string) bool

NetworkExists checks if the network with the given name exists

Types

type Channel

type Channel struct {
	Userlist        []string
	UserlistPlain   []string
	Topic           string
	TopicSetBy      string
	TopicSetAt      int64
	Notifications   NotificationLevel
	HistoryFetched  bool
	FetchingHistory bool
	MessageCache    chan messages.Message
}

Channel contains channel data

func CreateChannel

func CreateChannel() *Channel

CreateChannel creates a channel

func GetChannel

func GetChannel(network, channel string) *Channel

GetChannel gets the channel with the given name in the network with the given name if they both exist

func MustGetChannel

func MustGetChannel(network, channel string) *Channel

MustGetChannel gets or creates the channel with the given name in the network with the given name

func (*Channel) SetTopicData

func (ch *Channel) SetTopicData(topic, setby string, setat int64)

SetTopicData sets all topic-related variables

func (*Channel) SetUserlist

func (ch *Channel) SetUserlist(users []string)

SetUserlist sets the userlist and the plain userlist

type Highlight

type Highlight interface {
	Match(str string) *HighlightMatch
	String() string
}

Highlight is a highlight

func CreateRegexHighlight

func CreateRegexHighlight(val string) Highlight

CreateRegexHighlight creates a regex highlight

func CreateStringHighlight

func CreateStringHighlight(val string) Highlight

CreateStringHighlight creates a string highlight

type HighlightList

type HighlightList []Highlight

HighlightList is a list of highlights

func (HighlightList) Parse

func (hll HighlightList) Parse(parse string)

Parse highlights from a string

func (HighlightList) String

func (hll HighlightList) String() string

type HighlightMatch

type HighlightMatch struct {
	Index  int
	Length int
}

HighlightMatch is a match

type Network

type Network struct {
	Channels     map[string]*Channel
	ChannelNames []string
	Highlights   HighlightList
	Scripts      ScriptStore
	Nick         string
	User         string
	Realname     string
	IP           string
	Port         uint16
	SSL          bool
	Connected    bool
}

Network contains network data

func CreateNetwork

func CreateNetwork() *Network

CreateNetwork creates a network

func GetNetwork

func GetNetwork(name string) *Network

GetNetwork the network with the given name if it exists

func MustGetNetwork

func MustGetNetwork(name string) *Network

MustGetNetwork gets or creates the network with the given name

func (*Network) ChannelExists

func (net *Network) ChannelExists(name string) bool

ChannelExists checks if the channel with the given name exists

func (*Network) GetChannel

func (net *Network) GetChannel(name string) *Channel

GetChannel the channel with the given name if it exists

func (*Network) MustGetChannel

func (net *Network) MustGetChannel(name string) *Channel

MustGetChannel gets or creates the channel with the given name

func (*Network) SetNetData

func (net *Network) SetNetData(nd messages.NetData)

SetNetData ...

type NotificationLevel

type NotificationLevel int

NotificationLevel tells what messages should the user get notified about

const (
	NotificationNone       NotificationLevel = 0
	NotificationHighlights NotificationLevel = 1
	NotificationAll        NotificationLevel = 2
)

Values for NotificationLevel

func ParseNotificationLevel

func ParseNotificationLevel(str string) NotificationLevel

ParseNotificationLevel parses a notification level from a string

func (NotificationLevel) String

func (nl NotificationLevel) String() string

type RegexHighlight

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

RegexHighlight is a highlight type that checks for matches with regex

func (RegexHighlight) Match

func (hl RegexHighlight) Match(str string) *HighlightMatch

Match gets all the regex matches

func (RegexHighlight) String

func (hl RegexHighlight) String() string

String turns this into a string

type ScriptStore

type ScriptStore map[string]string

ScriptStore contains functions common to stores that have a script unit

func (ScriptStore) Delete

func (ss ScriptStore) Delete(net, name string, callback func(net string))

Delete the script with the given name

func (ScriptStore) Get

func (ss ScriptStore) Get(name string) string

Get the script with the given name

func (ScriptStore) Put

func (ss ScriptStore) Put(net, name, script string, callback func(net string))

Put the given script under the given name

func (ScriptStore) Rename

func (ss ScriptStore) Rename(net, oldName, newName string, callback func(net string))

Rename the script with the given name

func (ScriptStore) Update

func (ss ScriptStore) Update(net string, callback func(net string))

Update scripts from server

type StringHighlight

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

StringHighlight is a highlight type that checks for case-insensitive string matches

func (StringHighlight) Match

func (hl StringHighlight) Match(str string) *HighlightMatch

Match gets all the case-insensitive string matches

func (StringHighlight) String

func (hl StringHighlight) String() string

String returns the source

Jump to

Keyboard shortcuts

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