shared

package module
v0.0.0-...-076379b Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: GPL-3.0 Imports: 31 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MsgNewPost      ChatType = 0
	MsgUpdate       ChatType = 1
	MsgPostOrUpdate ChatType = 2
	MsgPostOrReply  ChatType = 3
	MsgNoPost       ChatType = 4
	MaxChatSize     int      = 40960
)

Variables

View Source
var Shared envLoggingShared

Functions

func ApplyTxBlock

func ApplyTxBlock(Db *sql.DB, Blocks []TxBlock) error

func DeferCloseDb

func DeferCloseDb(db *sql.DB, label string)

func DieIfNil

func DieIfNil(Result bool, Msg string)

func EnvParsePath

func EnvParsePath(Paths []string) (Ret string)

func ExitIfPidActive

func ExitIfPidActive(pidFiles ...string)

func FileExists

func FileExists(filename string) bool

func FormatMysqlTime

func FormatMysqlTime(Time time.Time) string

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

func GenerateRandomStringOrDie

func GenerateRandomStringOrDie(s int) string

func GenerateRandomUUid

func GenerateRandomUUid() (string, error)

func GetDbType

func GetDbType(db *DbHandle) string

func GetFileChecksum

func GetFileChecksum(Filename string) (string, error)

func GetGoroutineId

func GetGoroutineId() uint64

func GetLogger

func GetLogger() *slogger.Logger

func GetMtime

func GetMtime(Path string) (time.Time, error)

func GetMyChecksum

func GetMyChecksum() string

func GetParentPid

func GetParentPid() int

func InsertJsonAsDbRow

func InsertJsonAsDbRow(Table string, Data *sjson.JSON, Db *sql.DB) error

func MonitorLog

func MonitorLog(Filename string, fn logreader, polldelay int)

func MyExecBaseName

func MyExecBaseName() string

func ParseMysqlTime

func ParseMysqlTime(k string) (*time.Time, error)

func PidIsRunning

func PidIsRunning(Pid int) bool

func PrintFromFile

func PrintFromFile(Filename string, line follower.Line) bool

func ReadStdinToEofBytes

func ReadStdinToEofBytes() []byte

func RunAndGetLastInsertId

func RunAndGetLastInsertId(stmt *Stmt, Options ...interface{}) (int64, error)

func SearchPath

func SearchPath(File string, Paths []string) string

func SetLogger

func SetLogger(l *slogger.Logger) *slogger.Logger

func ValidatePreparedQueriesOrDie

func ValidatePreparedQueriesOrDie(Q interface{})

Types

type ChatConnectType

type ChatConnectType int
const (
	ChatTypeUndef       ChatConnectType = 0
	ChatTypeDb          ChatConnectType = 1
	ChatTypeSlackDirect ChatConnectType = 2
	ChatTypeXmppDirect  ChatConnectType = 3
)

func ChatTypeFromString

func ChatTypeFromString(s string) ChatConnectType

func (ChatConnectType) String

func (c ChatConnectType) String() string

type ChatHandle

type ChatHandle struct {
	Validate bool
	Sender   string

	ErrorChannel  *ChatTarget
	OutputChannel *ChatTarget
	PrintChatOnly bool
	DirectClient  *DirectClient

	DirectData          interface{}
	ChatType            ChatConnectType
	Owner               string
	UserIndex           UserIndexType
	RefuseMessagesAfter time.Duration
	ChannelLookup       map[string]*ChatTarget
	UserLookup          map[string]*UserInfo
	NativeClient        interface{}

	FpSendSimple        func(*ChatHandle, *ChatTarget, string) (*ChatUpdateHandle, error)
	FpSendMessage       func(*ChatHandle, *ChatMessage) (*ChatUpdateHandle, error)
	FpFormulateStimulus func(*ChatHandle, *MessagerEvent) *ResponseTo
	FpChatTargetChannel func(*ChatHandle, string) *ChatTarget
	FpChatTargetUser    func(*ChatHandle, string) *ChatTarget
	FpJoinChannel       func(*ChatHandle, *ChatTarget) error
	FpUserById          func(*ChatHandle, string) *UserInfo
	FpNewListener       func(*ChatHandle) (*ListenHandle, error)
	FpSendImageTarget   func(*ChatTarget, *Image) error
	FpIdentifier        func(*ChatHandle) string
	FpGetMsgRefByLabel  func(*ChatHandle, *ChatTarget, string) *ChatUpdateHandle
	FpGetMsgByLabel     func(*ChatHandle, *ChatTarget, string) *ChatMessage
	// contains filtered or unexported fields
}

func (*ChatHandle) ChatTarget

func (cth *ChatHandle) ChatTarget(target string) *ChatTarget

func (*ChatHandle) ChatTargetChannel

func (cth *ChatHandle) ChatTargetChannel(id string) *ChatTarget

func (*ChatHandle) ChatTargetUser

func (cth *ChatHandle) ChatTargetUser(user string) *ChatTarget

func (*ChatHandle) FormulateStimulus

func (cth *ChatHandle) FormulateStimulus(event *MessagerEvent) *ResponseTo

func (*ChatHandle) Identifier

func (cth *ChatHandle) Identifier() string

func (*ChatHandle) Join

func (cth *ChatHandle) Join(target *ChatTarget) error

func (*ChatHandle) LogErrorf

func (cth *ChatHandle) LogErrorf(format string, options ...interface{})

func (*ChatHandle) LogFatalf

func (cth *ChatHandle) LogFatalf(format string, options ...interface{})

func (*ChatHandle) NewListener

func (cth *ChatHandle) NewListener() (*ListenHandle, error)

func (*ChatHandle) NewMessage

func (cth *ChatHandle) NewMessage() *ChatMessage

func (*ChatHandle) OrDie

func (cth *ChatHandle) OrDie(msgs ...string) *ChatHandle

func (*ChatHandle) Send

func (cth *ChatHandle) Send(origmessage *ChatMessage) (*ChatUpdateHandle, error)

func (*ChatHandle) SendChannelf

func (cth *ChatHandle) SendChannelf(Channel string, format string, options ...interface{}) (*ChatUpdateHandle, error)

func (*ChatHandle) SendDefaultf

func (cth *ChatHandle) SendDefaultf(format string, options ...interface{}) (*ChatUpdateHandle, error)

func (*ChatHandle) SendError

func (cth *ChatHandle) SendError(Message string) error

func (*ChatHandle) SendErrorf

func (cth *ChatHandle) SendErrorf(format string, options ...interface{}) error

func (*ChatHandle) SendMessage

func (cth *ChatHandle) SendMessage(Chat *ChatMessage) (*ChatUpdateHandle, error)

func (*ChatHandle) SendOut

func (cth *ChatHandle) SendOut(Channel string, Message string) (*ChatUpdateHandle, error)

func (*ChatHandle) SendSimple

func (cth *ChatHandle) SendSimple(target *ChatTarget, message string) (*ChatUpdateHandle, error)

func (*ChatHandle) SendSimpleChannel

func (cth *ChatHandle) SendSimpleChannel(channel string, message string) (*ChatUpdateHandle, error)

func (*ChatHandle) SetDefaultChannel

func (cth *ChatHandle) SetDefaultChannel(Channel string) *ChatHandle

func (*ChatHandle) SetDefaultSender

func (cth *ChatHandle) SetDefaultSender(Handle string) *ChatHandle

func (*ChatHandle) SetErrorChannel

func (cth *ChatHandle) SetErrorChannel(Channel string) *ChatHandle

func (*ChatHandle) SetValidate

func (cth *ChatHandle) SetValidate()

func (*ChatHandle) ShowConfig

func (cth *ChatHandle) ShowConfig() string

func (*ChatHandle) UserById

func (cth *ChatHandle) UserById(id string) *UserInfo

func (*ChatHandle) Warnings

func (cth *ChatHandle) Warnings() []error

type ChatHandleConfigMap

type ChatHandleConfigMap map[string]*ChatTypeConfig
var ChatHandleConfigs ChatHandleConfigMap

func (ChatHandleConfigMap) Lists

func (c ChatHandleConfigMap) Lists() string

type ChatMessage

type ChatMessage struct {
	MsgType      ChatType
	Sender       string
	Target       *ChatTarget
	Label        string
	Message      string
	LabelIfReply string
	UpdateHandle *ChatUpdateHandle
	Images       []*Image
	History      struct {
		Posted *time.Time
	}
	Segments SegmentedMsg
	Table    [][]string
	Options  *sjson.JSON
	// contains filtered or unexported fields
}

func NewChatMessage

func NewChatMessage() *ChatMessage

func (*ChatMessage) Add2Columns

func (Msg *ChatMessage) Add2Columns(Left string, Right string)

func (*ChatMessage) Append

func (Msg *ChatMessage) Append(str string) *ChatMessage

type ChatOptions

type ChatOptions struct {
	Mediaunfurl bool        `json:"mediaunfurl"`
	Linkunfurl  bool        `json:"linkunfurl"`
	Blocks      interface{} `json:"blocks"`
	Parse       bool
	IconUrl     string `json:"iconurl"`
	IconEmoji   string
	Attachtext  string
	SetTopic    string
	PinPost     bool       `json:"PinPost"`
	UnpinPost   bool       `json:"UnpinPost"`
	RespondTo   int64      `json:"respondto"`
	ThreadLabel string     `json:"threadlabel"`
	UpdateLabel string     `json:"updatelabel"`
	UpdateMsgId string     `json:"updatemsgid"`
	Columns     [][]string `json:"columns"`
	NoText      bool
}

type ChatTarget

type ChatTarget struct {
	Handle *ChatHandle
	Native interface{}

	Id        string
	Name      string
	IsDM      bool
	IsMpDm    bool
	IsAdmin   bool
	IsPrivate bool
	IsPublic  bool
	PrintOnly bool
	// contains filtered or unexported fields
}

func (*ChatTarget) Identifier

func (tgt *ChatTarget) Identifier() string

func (*ChatTarget) LogErrorf

func (tgt *ChatTarget) LogErrorf(format string, options ...interface{}) error

func (*ChatTarget) LogFatalf

func (tgt *ChatTarget) LogFatalf(format string, options ...interface{})

func (*ChatTarget) OrDie

func (tgt *ChatTarget) OrDie(msgs ...string) *ChatTarget

func (*ChatTarget) Send

func (tgt *ChatTarget) Send(Msg *ChatMessage) (*ChatUpdateHandle, error)

func (*ChatTarget) SendImageTarget

func (tgt *ChatTarget) SendImageTarget(Image *Image) error

func (*ChatTarget) Sendf

func (tgt *ChatTarget) Sendf(format string, options ...interface{})

func (*ChatTarget) SendfIfDef

func (tgt *ChatTarget) SendfIfDef(format string, options ...interface{})

type ChatType

type ChatType int

type ChatTypeConfig

type ChatTypeConfig struct {
	BindFunc func(*ChatHandle, *Configuration, string) error
}

type ChatUpdateHandle

type ChatUpdateHandle struct {
	NativeData interface{}
	ChannelId  string
	Timestamp  string
	RowId      int64
	MsgId      int64
	UpdateId   int64
}

type Configuration

type Configuration struct {
	IniPath  string
	IniFile  *ini.File
	Override *Configuration
	Fallback *Configuration

	//vaultClient    *api.Client
	VaultAddr string

	ChatHandles map[string]*ChatHandle
	DbHandles   map[string]*DbHandle
	AccessHit   SafeIntCache
	AccessMiss  SafeIntCache
	// contains filtered or unexported fields
}

func (*Configuration) ChatTargetFromKey

func (config *Configuration) ChatTargetFromKey(Key string) *ChatTarget

func (*Configuration) ConnectDbBySection

func (config *Configuration) ConnectDbBySection(SectionName string) *DbHandle

func (*Configuration) ConnectDbBySectionOrDie

func (config *Configuration) ConnectDbBySectionOrDie(SectionName string) *DbHandle

func (*Configuration) ConnectDbKey

func (config *Configuration) ConnectDbKey(Key string) *DbHandle

func (*Configuration) DefineDbFromKey

func (config *Configuration) DefineDbFromKey(Key string) *DbHandle

func (*Configuration) DefineDbFromSection

func (config *Configuration) DefineDbFromSection(Section string) *DbHandle

func (*Configuration) ExportAsJson

func (config *Configuration) ExportAsJson() sjson.JSON

func (*Configuration) ExportSectionAsJson

func (config *Configuration) ExportSectionAsJson(Section string) sjson.JSON

func (*Configuration) GetBool

func (config *Configuration) GetBool(Path string) (bool, bool)

func (*Configuration) GetBoolOrDefault

func (config *Configuration) GetBoolOrDefault(Path string, Default bool, DefaultMessage string, Options ...interface{}) bool

func (*Configuration) GetBoolOrDie

func (config *Configuration) GetBoolOrDie(Path string, DieMsg string) bool

func (*Configuration) GetDurationOrDie

func (config *Configuration) GetDurationOrDie(Path string, DieMsg string, options ...interface{}) time.Duration

func (*Configuration) GetFloat

func (config *Configuration) GetFloat(Path string) (bool, float64)

func (*Configuration) GetFloatOrDie

func (config *Configuration) GetFloatOrDie(Path string, DieMsg string) float64

func (*Configuration) GetInt

func (config *Configuration) GetInt(Path string) (bool, int)

func (*Configuration) GetInt64

func (config *Configuration) GetInt64(Path string) (bool, int64)

func (*Configuration) GetInt64OrDefault

func (config *Configuration) GetInt64OrDefault(Path string, Default int64, DefaultMessage string, Options ...interface{}) int64

func (*Configuration) GetIntOrDefault

func (config *Configuration) GetIntOrDefault(Path string, Default int, DefaultMessage string, Options ...interface{}) int

func (*Configuration) GetIntOrDie

func (config *Configuration) GetIntOrDie(Path string, DieMsg string) int

func (*Configuration) GetKey

func (config *Configuration) GetKey(Path string, DieMsg string) (Caw *ini.Key)

func (*Configuration) GetSecret

func (config *Configuration) GetSecret(query string) (bool, sjson.JSON)

func (*Configuration) GetSecretOrDie

func (config *Configuration) GetSecretOrDie(query string) sjson.JSON

func (*Configuration) GetSection

func (config *Configuration) GetSection(Path string) *ini.Section

func (*Configuration) GetString

func (config *Configuration) GetString(Path string) (bool, string)

func (*Configuration) GetStringOrDefault

func (config *Configuration) GetStringOrDefault(Path string, Default string, DefaultMessage string, Options ...interface{}) string

func (*Configuration) GetStringOrDie

func (config *Configuration) GetStringOrDie(Path string, DieMsg string, options ...interface{}) string

func (*Configuration) GetTimeOrDie

func (config *Configuration) GetTimeOrDie(Path string, DieMsg string, options ...interface{}) time.Time

func (*Configuration) Identifier

func (config *Configuration) Identifier() string

func (*Configuration) KeyPrefix

func (config *Configuration) KeyPrefix(Prefix string)

func (*Configuration) ListKeys

func (config *Configuration) ListKeys(Path string) []string

func (*Configuration) ListSections

func (config *Configuration) ListSections() []string

func (*Configuration) ListedKeysPresent

func (config *Configuration) ListedKeysPresent(Keys ...string) (bool, error)

func (*Configuration) LoadAnIni

func (config *Configuration) LoadAnIni(Paths ...string) *Configuration

func (*Configuration) LoadKvOverlay

func (config *Configuration) LoadKvOverlay(VaultPath string) error

func (*Configuration) LoadKvOverlayPrefix

func (config *Configuration) LoadKvOverlayPrefix(VaultPath string, DestPrefix string) error

func (*Configuration) NewChatHandle

func (config *Configuration) NewChatHandle(Section string) *ChatHandle

func (*Configuration) NewMailHandle

func (config *Configuration) NewMailHandle(Section string) *MailHandle

func (*Configuration) OrDie

func (config *Configuration) OrDie(format string, msgs ...interface{}) *Configuration

func (*Configuration) PrintWarnings

func (config *Configuration) PrintWarnings() *Configuration

func (*Configuration) Profile

func (config *Configuration) Profile() string

func (*Configuration) SectionFromKey

func (config *Configuration) SectionFromKey(Key string) *sjson.JSON

func (*Configuration) SetDefaultIni

func (config *Configuration) SetDefaultIni(Path ...string) *Configuration

func (*Configuration) SetFallback

func (config *Configuration) SetFallback(File *Configuration)

func (*Configuration) SetOverride

func (config *Configuration) SetOverride(File *Configuration)

func (*Configuration) SetVaultPrefix

func (config *Configuration) SetVaultPrefix(Prefix string)

type ConnectingEvent

type ConnectingEvent struct{}

type DbHandle

type DbHandle struct {
	*sql.DB
	Name    string
	Section string // Section that the config settings came from
	Key     string // Config key pointing to the section (i.e. scraper.dbhandle=scrapedb; that points at the section)

	Host     string
	DbName   string
	Username string
	Password string
	ReadOnly bool
	// contains filtered or unexported fields
}

func (*DbHandle) Connect

func (dbh *DbHandle) Connect() error

func (*DbHandle) DbType

func (dbh *DbHandle) DbType() DbType

func (*DbHandle) ErrorType

func (dbh *DbHandle) ErrorType(err error) string

func (*DbHandle) Identifier

func (dbh *DbHandle) Identifier() string

func (*DbHandle) IsDead

func (dbh *DbHandle) IsDead() bool

func (*DbHandle) OrDie

func (dbh *DbHandle) OrDie() *DbHandle

func (*DbHandle) Postmortem

func (dbh *DbHandle) Postmortem() []error

func (*DbHandle) Prepare

func (dbh *DbHandle) Prepare(sql string) *Stmt

func (*DbHandle) PrepareOrDie

func (dbh *DbHandle) PrepareOrDie(sql string) *Stmt

func (*DbHandle) TransPrep

func (dbh *DbHandle) TransPrep(sql string) *Stmt

func (*DbHandle) Translate

func (dbh *DbHandle) Translate(sql string) string

type DbType

type DbType int
const (
	DbTypeUndef    DbType = 0
	DbTypeMysql    DbType = 1
	DbTypePostgres DbType = 2
)

type Diagnostics

type Diagnostics struct {
	MemStats runtime.MemStats
	Rusage   syscall.Rusage
}

func NewDiags

func NewDiags() *Diagnostics

func (*Diagnostics) Html

func (this *Diagnostics) Html() string

type DirectClient

type DirectClient struct {
	ChatType            ChatConnectType
	Owner               string
	UserIndex           UserIndexType
	RefuseMessagesAfter time.Duration
	ChannelLookup       map[string]*ChatTarget
	NativeClient        interface{}
	FpSendSimple        func(*DirectClient, *ChatTarget, string) (string, string, error)
	FpSendMessage       func(*DirectClient, *ChatMessage) (*ChatUpdateHandle, error)
	FpFormulateStimulus func(*DirectClient, *MessagerEvent) *ResponseTo
	FpChatTargetChannel func(*DirectClient, string) *ChatTarget
	FpChatTargetUser    func(*DirectClient, string) *ChatTarget
	FpJoinChannel       func(*DirectClient, *ChatTarget) error
	FpUserById          func(*DirectClient, string) *UserInfo
	FpManageConnection  func(*DirectClient)
	FpIdentifier        func(*DirectClient) string
}

func (*DirectClient) ChatTargetChannel

func (dc *DirectClient) ChatTargetChannel(id string) *ChatTarget

func (*DirectClient) ChatTargetUser

func (dc *DirectClient) ChatTargetUser(id string) *ChatTarget

func (*DirectClient) FormulateStimulus

func (dc *DirectClient) FormulateStimulus(event *MessagerEvent) *ResponseTo

func (*DirectClient) Identifier

func (dc *DirectClient) Identifier() string

func (*DirectClient) Join

func (dc *DirectClient) Join(target *ChatTarget) error

func (*DirectClient) SendMessage

func (dc *DirectClient) SendMessage(Chat *ChatMessage) (*ChatUpdateHandle, error)

func (*DirectClient) SendSimple

func (dc *DirectClient) SendSimple(target *ChatTarget, message string) (string, string, error)

func (*DirectClient) SendSimpleChannel

func (dc *DirectClient) SendSimpleChannel(channel string, message string) (string, string, error)

func (*DirectClient) UserById

func (dc *DirectClient) UserById(id string) *UserInfo

type Iface

type Iface struct {
	Top interface{}
}

func (*Iface) Absorb

func (Source *Iface) Absorb(Input interface{})

func (*Iface) Bytes

func (Source *Iface) Bytes() []byte

func (*Iface) Key

func (Source *Iface) Key(Path string) Key

func (*Iface) SplitArray

func (Source *Iface) SplitArray() []Iface

func (*Iface) String

func (Source *Iface) String() string

type Image

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

func NewImageFromUrl

func NewImageFromUrl(client *http.Client, Url string) (*Image, error)

func (*Image) Content

func (img *Image) Content() ([]byte, error)

func (*Image) Identifier

func (img *Image) Identifier() string

type InvalidAuthEvent

type InvalidAuthEvent struct{}

type Key

type Key struct {
	Parent *Iface
	Path   string
}

func (Key) Float

func (Target Key) Float() float64

func (Key) Raw

func (Target Key) Raw() interface{}

func (Key) String

func (Target Key) String() string

type ListenHandle

type ListenHandle struct {
	Dapi     *ChatHandle
	Native   interface{}
	Incoming chan interface{}

	FpManageConnection func(handle *ListenHandle)
	// contains filtered or unexported fields
}

func (*ListenHandle) ManageConnection

func (lh *ListenHandle) ManageConnection()

type LiveConfig

type LiveConfig struct {
	Pulse int
	// contains filtered or unexported fields
}

func NewLiveConfig

func NewLiveConfig() *LiveConfig

func (*LiveConfig) Bind

func (Lc *LiveConfig) Bind(Label string, Addr interface{}) *LiveConfigKey

func (*LiveConfig) BindDb

func (Lc *LiveConfig) BindDb(db *DbHandle) *LiveConfig

func (*LiveConfig) FinishLoad

func (Lc *LiveConfig) FinishLoad()

func (*LiveConfig) KeyList

func (Lc *LiveConfig) KeyList() sjson.JSONarray

func (*LiveConfig) KeyRef

func (Lc *LiveConfig) KeyRef(Label string) *LiveConfigKey

func (*LiveConfig) Update

func (Lc *LiveConfig) Update(Label string, Value interface{}) *LiveConfigKey

func (*LiveConfig) WatchConfigs

func (Lc *LiveConfig) WatchConfigs(delay time.Duration)

type LiveConfigKey

type LiveConfigKey struct {
	Parent  *LiveConfig
	Label   string
	Addr    interface{}
	Type    string
	Version int
	Updated string
}

func (*LiveConfigKey) Replicate

func (Lck *LiveConfigKey) Replicate() error

func (*LiveConfigKey) String

func (Lck *LiveConfigKey) String() string

func (*LiveConfigKey) Update

func (Lck *LiveConfigKey) Update(Value interface{}) *LiveConfigKey

type LookupItem

type LookupItem interface {
	Name() string
	Id() int
	Table() LookupTable
	IsNil() bool
}

type LookupTable

type LookupTable interface {
	ByIdOrDie(int) LookupItem
	ById(int) LookupItem
	LabelToId(string, bool) LookupItem
	ByNameOrAdd(string) LookupItem
	ByName(string) LookupItem
}

func NewLookup

func NewLookup(tablename string, Db *DbHandle) LookupTable

type MailHandle

type MailHandle struct {
	DefaultSender    string
	DefaultRecipient string
	SubjectPrefix    string
	SendmailPath     string
	ActuallySend     bool
}

func (*MailHandle) NewMailMessage

func (Caw *MailHandle) NewMailMessage() *MailMessage

type MailMessage

type MailMessage struct {
	From    string
	To      string
	Subject string
	Body    string
	// contains filtered or unexported fields
}

func (*MailMessage) SendViaSendmail

func (Msg *MailMessage) SendViaSendmail() string

type MessagerEvent

type MessagerEvent struct {
	MsgId        string
	ParentMsgId  string
	ChannelId    string
	SenderUserId string // Account level, not connection level
	Text         string
	MsgType      MsgType
	Connection   interface{}
	NativeMsg    interface{}
	Timestamp    *time.Time
	FpToStimulus func(*MessagerEvent) *ResponseTo
}

func (*MessagerEvent) Channel

func (ev *MessagerEvent) Channel() *ChatTarget

func (*MessagerEvent) ToStimulus

func (ev *MessagerEvent) ToStimulus() *ResponseTo

type MsgSegment

type MsgSegment struct {
	Text     string
	Itemtype MsgSegmentType
}

func (MsgSegment) String

func (Seg MsgSegment) String() string

func (MsgSegment) Type

func (Seg MsgSegment) Type() string

type MsgSegmentType

type MsgSegmentType int
const (
	SEGTYPE_UNDEF  MsgSegmentType = 0
	SEGTYPE_TEXT   MsgSegmentType = 1
	SEGTYPE_IMGURL MsgSegmentType = 2
	SEGTYPE_LABEL  MsgSegmentType = 3
)

type MsgType

type MsgType int
const (
	MsgTypeDM      MsgType = 1
	MsgTypeChannel MsgType = 2
)

type ResponseTo

type ResponseTo struct {
	Target        *ChatTarget
	Sender        *UserInfo
	FromAdmin     bool
	InThread      string
	IsDM          bool
	Arguments     []string
	LcArguments   []string
	OrigMessage   string
	Message       string
	MsgId         string
	NativeMessage interface{}
}

type SafeIntCache

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

func NewSafeIntCache

func NewSafeIntCache() SafeIntCache

func (*SafeIntCache) Check

func (c *SafeIntCache) Check(key string) (int, bool)

func (*SafeIntCache) Export

func (c *SafeIntCache) Export() (Bob map[string]int)

func (*SafeIntCache) Get

func (c *SafeIntCache) Get(key string) (t int)

func (*SafeIntCache) Inc

func (c *SafeIntCache) Inc(keys ...string) (val int)

func (*SafeIntCache) Set

func (c *SafeIntCache) Set(key string, val int) *SafeIntCache

func (*SafeIntCache) SetM

func (c *SafeIntCache) SetM(val int, keys ...string) *SafeIntCache

func (*SafeIntCache) SetPrefix

func (c *SafeIntCache) SetPrefix(val int, prefixes ...string) *SafeIntCache

type SegmentedMsg

type SegmentedMsg []MsgSegment

func (SegmentedMsg) CompileToMsg

func (Segs SegmentedMsg) CompileToMsg(Chat *ChatTarget) *ChatMessage

type SocketFunction

type SocketFunction struct {
	SockPath  string
	Buffer    string
	ServeFunc func() string
	Updated   time.Time
}

func NewSocketFunction

func NewSocketFunction(Path string) *SocketFunction

func (SocketFunction) ServeAsSocket

func (Sock SocketFunction) ServeAsSocket(Path string)

func (*SocketFunction) SetBuffer

func (Sock *SocketFunction) SetBuffer(Buffer string)

func (*SocketFunction) SetHandler

func (Sock *SocketFunction) SetHandler(Func func() string)

type Stmt

type Stmt struct {
	*sql.Stmt
	// contains filtered or unexported fields
}

func GetChatHandleAsUser

func GetChatHandleAsUser(db *DbHandle, user string) *Stmt

func PrepareOrDie

func PrepareOrDie(dbh *DbHandle, sql string) *Stmt

func (*Stmt) Err

func (sth *Stmt) Err() error

func (*Stmt) Exec

func (sth *Stmt) Exec(args ...interface{}) (sql.Result, error)

func (*Stmt) Identify

func (sth *Stmt) Identify() string

func (*Stmt) OrDie

func (sth *Stmt) OrDie(msgs ...string) *Stmt

type ThreadPurpose

type ThreadPurpose struct {
	Purpose map[uint64]string
	// contains filtered or unexported fields
}

func NewThreadPurpose

func NewThreadPurpose() *ThreadPurpose

func (*ThreadPurpose) DisarmDeadman

func (t *ThreadPurpose) DisarmDeadman()

func (*ThreadPurpose) Done

func (t *ThreadPurpose) Done()

func (*ThreadPurpose) Dump

func (t *ThreadPurpose) Dump() string

func (*ThreadPurpose) Set

func (t *ThreadPurpose) Set(Purpose string)

func (*ThreadPurpose) SetDeadman

func (t *ThreadPurpose) SetDeadman(Timer time.Duration)

func (*ThreadPurpose) WgAdd

func (t *ThreadPurpose) WgAdd(x int)

func (*ThreadPurpose) WgWait

func (t *ThreadPurpose) WgWait()

type TxBlock

type TxBlock struct {
	Label        string
	Stmt         *sql.Stmt
	IgnoreAllErr bool
	Args         []interface{}
}

type UserIndexType

type UserIndexType struct {
	ById       map[string]*UserInfo
	RoomUserId map[string]*UserInfo
}

type UserInfo

type UserInfo struct {
	CorpId   string
	NativeId string
	Ignore   bool
	IsAdmin  bool
	IsBot    bool
	Email    string
	Name     string
	ChatId   string
	PermVal  sjson.JSON
	TempVal  sjson.JSON
	Native   interface{}
}

Jump to

Keyboard shortcuts

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