1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
package access
import (
"bytes"
"io"
"time"
"github.com/twstrike/coyim/client"
"github.com/twstrike/coyim/config"
"github.com/twstrike/coyim/event"
"github.com/twstrike/coyim/roster"
"github.com/twstrike/coyim/tls"
"github.com/twstrike/coyim/xmpp/data"
xi "github.com/twstrike/coyim/xmpp/interfaces"
"github.com/twstrike/otr3"
)
// EventHandler represents the main notifications that the session can emit
// It's really more an observer than an even handler
type EventHandler interface {
RegisterCallback(title, instructions string, fields []interface{}) error
}
// Connector represents something that connect
type Connector interface {
Connect()
}
// Session is an interface that defines the functionality of a Session
type Session interface {
ApprovePresenceSubscription(string, string) error
AutoApprove(string)
AwaitVersionReply(<-chan data.Stanza, string)
Close()
CommandManager() client.CommandManager
Config() *config.ApplicationConfig
Conn() xi.Conn
Connect(string, tls.Verifier) error
ConversationManager() client.ConversationManager
DenyPresenceSubscription(string, string) error
DisplayName() string
EncryptAndSendTo(string, string, string) (int, bool, error)
GetConfig() *config.Account
GetInMemoryLog() *bytes.Buffer
GroupDelimiter() string
HandleConfirmOrDeny(string, bool)
IsConnected() bool
IsDisconnected() bool
ManuallyEndEncryptedChat(string, string) error
OtrEventHandler() map[string]*event.OtrEventHandler
PrivateKeys() []otr3.PrivateKey
R() *roster.List
ReloadKeys()
RemoveContact(string)
RequestPresenceSubscription(string, string) error
Send(string, string, string) error
SendPing()
SetCommandManager(client.CommandManager)
SetConnectionLogger(io.Writer)
SetConnector(Connector)
SetLastActionTime(time.Time)
SetSessionEventHandler(EventHandler)
SetWantToBeOnline(bool)
Subscribe(chan<- interface{})
Timeout(data.Cookie, time.Time)
}
// Factory is a function that can create new Sessions
type Factory func(*config.ApplicationConfig, *config.Account, func(tls.Verifier) xi.Dialer) Session
|