phoxy

package
v0.0.0-...-61777e6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chatroom

type Chatroom struct {
	Members map[string]*User `json:"members"`
}

type ConnType

type ConnType int
const (
	PHOXY ConnType = iota
	BOSH
	WS
)

type Event

type Event struct {
	Type     HandlerField `json:"type" xorm:"'type'"`
	Username string       `json:"username" xorm:"'username'"`
	Body     string       `json:"body" xorm:"longtext 'body'"`
	At       int64        `json:"at" xorm:"'at'"`
	Callback chan bool    `json:"-" xorm:"-"`
}

type HandlerField

type HandlerField int
const (
	USERJOIN HandlerField = iota
	USERQUIT
	GROUPMESSAGE
	PRIVATEMESSAGE
	VERIFY
	AUTHSUCCESS
	AUTHFAIL
	JOINED
	USERCONNECT
	COMPOSING
	PAUSED
)

type HandlerFunc

type HandlerFunc func(*Event)

type MessageObject

type MessageObject struct {
	Type  string `json:"type,omitempty"`
	Body  string `json:"body,omitempty"`
	Value string `json:"value,omitempty"`
}

type OTRMessage

type OTRMessage struct {
	Body string `json:"body"`
}

type Opts

type Opts struct {
	Type               ConnType
	Username, Chatroom string
	Endpoint           string

	Proxy           string
	APIKey          string
	MpOTRPrivateKey string
	OTRPrivateKey   string

	SpamTesting bool
	BeFilter    bool
}

type Packet

type Packet struct {
	Type     string           `json:"type"`
	Chatroom string           `json:"chatroom,omitempty"`
	Nickname string           `json:"nickname,omitempty"`
	Object   *json.RawMessage `json:"object,omitempty"`
	ID       string           `jsoh:"id,omitempty"`
	Verified bool             `json:"verified"`
}

func (Packet) Encode

func (p Packet) Encode() string

type PhoxyConn

type PhoxyConn struct {
	Conn *websocket.Conn
	WS   *xmpp.Client
	Me   *multiparty.Me

	APIKey   string
	Handlers map[HandlerField]*HandlerFunc

	OTRKey *otr.PrivateKey
	Opts   *Opts
	Errc   chan error

	AlreadyJoined map[string]bool

	Closed bool
	PM     map[string]*otr.Conversation
	PML    *sync.Mutex
	Start  time.Time
	// contains filtered or unexported fields
}

func New

func New(o *Opts) (*PhoxyConn, error)

func (*PhoxyConn) APIURL

func (pc *PhoxyConn) APIURL(path string) string

func (*PhoxyConn) AccessLevel

func (pc *PhoxyConn) AccessLevel(chat, name string) int64

func (*PhoxyConn) AmIAuthorized

func (pc *PhoxyConn) AmIAuthorized() bool

func (*PhoxyConn) BackendURL

func (pc *PhoxyConn) BackendURL() string

func (*PhoxyConn) Ban

func (pc *PhoxyConn) Ban(chat, name string) error

func (*PhoxyConn) CallFunc

func (pc *PhoxyConn) CallFunc(typ HandlerField, msg *Event)

func (*PhoxyConn) Chmod

func (pc *PhoxyConn) Chmod(chat, name, level string) error

func (*PhoxyConn) Cleanup

func (pc *PhoxyConn) Cleanup(chat string, time int64) (int, error)

func (*PhoxyConn) ClearJail

func (pc *PhoxyConn) ClearJail() error

func (*PhoxyConn) Close

func (pc *PhoxyConn) Close()

func (*PhoxyConn) Connect

func (pc *PhoxyConn) Connect() error

func (*PhoxyConn) Disconnect

func (pc *PhoxyConn) Disconnect()

func (*PhoxyConn) Fingerprint

func (pc *PhoxyConn) Fingerprint(u string) string

func (*PhoxyConn) GetChatrooms

func (pc *PhoxyConn) GetChatrooms() (map[string]*Chatroom, error)

func (*PhoxyConn) GroupMessage

func (pc *PhoxyConn) GroupMessage(body string)

func (*PhoxyConn) Groupf

func (pc *PhoxyConn) Groupf(body string, args ...interface{})

func (*PhoxyConn) HandleFunc

func (pc *PhoxyConn) HandleFunc(typ HandlerField, h HandlerFunc)

func (*PhoxyConn) HandleOTRMessage

func (pc *PhoxyConn) HandleOTRMessage(from string, body string)

func (*PhoxyConn) Intercept

func (pc *PhoxyConn) Intercept(f func(*Event))

func (*PhoxyConn) Interrupt

func (pc *PhoxyConn) Interrupt(chat, name string) error

func (*PhoxyConn) IsAuthorized

func (pc *PhoxyConn) IsAuthorized(chat, name string) bool

func (*PhoxyConn) Lockdown

func (pc *PhoxyConn) Lockdown(chat, level string) error

func (*PhoxyConn) OTRFingerprint

func (pc *PhoxyConn) OTRFingerprint(user string) string

func (*PhoxyConn) Send

func (pc *PhoxyConn) Send(p Packet)

func (*PhoxyConn) SendChallenge

func (pc *PhoxyConn) SendChallenge(to string, question string, answer string)

func (*PhoxyConn) SendColor

func (pc *PhoxyConn) SendColor(color string)

func (*PhoxyConn) SendComposing

func (pc *PhoxyConn) SendComposing()

func (*PhoxyConn) SendPaused

func (pc *PhoxyConn) SendPaused()

func (*PhoxyConn) SendPrivateMessage

func (pc *PhoxyConn) SendPrivateMessage(to string, body string, errct int)

func (*PhoxyConn) SendPublicKey

func (pc *PhoxyConn) SendPublicKey(nick string)

func (*PhoxyConn) SendRawGroupMessage

func (pc *PhoxyConn) SendRawGroupMessage(body string)

func (*PhoxyConn) SendRawPrivateMessage

func (pc *PhoxyConn) SendRawPrivateMessage(to string, body string)

type User

type User struct {
	IPAddress string `json:"ip_address"`
}

Jump to

Keyboard shortcuts

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