xlib

package
v0.0.0-...-0fa8041 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NEWLINE = []byte{'\n'}
View Source
var OTRWhiteSpaceTagV1 = []byte("\x20\x09\x20\x09\x20\x20\x09\x20")
View Source
var OTRWhiteSpaceTagV2 = []byte("\x20\x20\x09\x09\x20\x20\x09\x20")
View Source
var OTRWhiteSpaceTagV3 = []byte("\x20\x20\x09\x09\x20\x20\x09\x09")
View Source
var OTRWhitespaceTagStart = []byte("\x20\x09\x20\x20\x09\x09\x09\x09\x20\x09\x20\x09\x20\x09\x20\x20")

OTRWhitespaceTagStart may be appended to plaintext messages to signal to the remote client that we support OTR. It should be followed by one of the version specific tags, below. See "Tagged plaintext messages" in http://www.cypherpunks.ca/otr/Protocol-v3-4.0.0.html.

Functions

func Enroll

func Enroll(config *Config, xio XIO) bool

func EscapeNonASCII

func EscapeNonASCII(in string) string

escapeNonASCII replaces tabs and other non-printable characters with a "\x01" form of hex escaping. It works on a byte-by-byte basis.

func SetupRawLog

func SetupRawLog(filename string, xmppConfig *xmpp.Config) (err error)

func StripHTML

func StripHTML(msg []byte) (out []byte)

func UnescapeNonASCII

func UnescapeNonASCII(in string) (string, error)

UnescapeNonASCII undoes the transformation of escapeNonASCII.

func UserDom

func UserDom(account string) (user, domain string, err error)

func XIOTerm_Exit

func XIOTerm_Exit()

func XIOTerm_Init

func XIOTerm_Init()

Types

type Config

type Config struct {
	Account                       string
	Server                        string   `json:",omitempty"`
	Resource                      string   `json:",omitempty"`
	Proxies                       []string `json:",omitempty"`
	Password                      string   `json:",omitempty"`
	Port                          int      `json:",omitempty"`
	PrivateKey                    []byte
	KnownFingerprints             []KnownFingerprint
	RawLogFile                    string   `json:",omitempty"`
	NotifyCommand                 []string `json:",omitempty"`
	IdleSecondsBeforeNotification int      `json:",omitempty"`
	Bell                          bool
	HideStatusUpdates             bool
	UseTor                        bool
	OTRAutoTearDown               bool
	OTRAutoAppendTag              bool
	OTRAutoStartSession           bool
	ServerCertificateSHA256       string   `json:",omitempty"`
	AlwaysEncrypt                 bool     `json:",omitempty"`
	AlwaysEncryptWith             []string `json:",omitempty"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(filename string) (c *Config)

func ParseConfig

func ParseConfig(filename string) (c *Config, err error)

func (*Config) HasFingerprint

func (c *Config) HasFingerprint(uid string) bool

func (*Config) Save

func (c *Config) Save() error

func (*Config) ShouldEncryptTo

func (c *Config) ShouldEncryptTo(uid string) bool

func (*Config) UserIdForFingerprint

func (c *Config) UserIdForFingerprint(fpr []byte) string

type KnownFingerprint

type KnownFingerprint struct {
	UserId         string
	FingerprintHex string
	// contains filtered or unexported fields
}

type LineLogger

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

func NewLineLogger

func NewLineLogger(xio XIO) *LineLogger

func (*LineLogger) Write

func (l *LineLogger) Write(data []byte) (int, error)

type PriorityList

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

func (*PriorityList) Find

func (pl *PriorityList) Find(prefix string) (string, bool)

func (*PriorityList) Insert

func (pl *PriorityList) Insert(value string)

func (*PriorityList) Next

func (pl *PriorityList) Next() string

type Session

type Session struct {
	*xmpp.Conn
	Xio XIO
	// contains filtered or unexported fields
}

func Connect

func Connect(xio XIO, config *Config, logger io.Writer, formcb xmpp.FormCallback) (s *Session, err error)

func NewSession

func NewSession(config *Config, xio XIO) (s *Session, err error)

func (*Session) AddUser

func (s *Session) AddUser(uid string)

func (*Session) AuthOOBCommand

func (s *Session) AuthOOBCommand(to string, fingerprint string)

func (*Session) AuthQACommand

func (s *Session) AuthQACommand(to, question, secret string)

func (*Session) CompleteFind

func (s *Session) CompleteFind(f string) (string, bool)

func (*Session) CompleteLock

func (s *Session) CompleteLock()

func (*Session) CompleteNext

func (s *Session) CompleteNext() string

func (*Session) CompleteUnlock

func (s *Session) CompleteUnlock()

func (*Session) Dial

func (s *Session) Dial(addr, user, domain, resource, password string, cfg *xmpp.Config) (err error)

func (*Session) DoEditDoneRoster

func (s *Session) DoEditDoneRoster()

func (*Session) DoEditRoster

func (s *Session) DoEditRoster()

func (*Session) EditRoster

func (s *Session) EditRoster(roster []xmpp.RosterEntry)

editRoster runs in a goroutine and writes the roster to a file that the user can edit.

func (*Session) EndConversation

func (s *Session) EndConversation(to string)

func (*Session) FetchRoster

func (s *Session) FetchRoster() (err error)

func (*Session) GetFingerprint

func (s *Session) GetFingerprint() []byte

func (*Session) GetLastTarget

func (s *Session) GetLastTarget() string

func (*Session) GetRoster

func (s *Session) GetRoster() []xmpp.RosterEntry

func (*Session) GetState

func (s *Session) GetState(jid string) (state string, ok bool)

func (*Session) GetVersion

func (s *Session) GetVersion(user string)

func (*Session) Handle

func (s *Session) Handle()

func (*Session) HandleConfirmOrDeny

func (s *Session) HandleConfirmOrDeny(jid string, isConfirm bool)

func (*Session) IgnoreList

func (s *Session) IgnoreList()

func (*Session) IgnoreUser

func (s *Session) IgnoreUser(uid string)

func (*Session) JoinMUC

func (s *Session) JoinMUC(to, nick, password string) error

func (*Session) LastAction

func (s *Session) LastAction()

func (*Session) LeaveMUC

func (s *Session) LeaveMUC(to string) error

func (*Session) LoadEditedRoster

func (s *Session) LoadEditedRoster(edit rosterEdit)

func (*Session) Msg

func (s *Session) Msg(to string, msg string, encch chan<- bool)

func (*Session) MsgF

func (s *Session) MsgF(to string, encch chan<- bool, format string, a ...interface{})

func (*Session) MsgN

func (s *Session) MsgN(to string, msg string)

func (*Session) MsgNF

func (s *Session) MsgNF(to string, format string, a ...interface{})

func (*Session) OptLastTarget

func (s *Session) OptLastTarget(possibleName string) (ok bool)

func (*Session) PrintConversationInfo

func (s *Session) PrintConversationInfo(uid string, conversation *otr.Conversation)

func (*Session) PrintConversations

func (s *Session) PrintConversations()

func (*Session) ProcessClientMessage

func (s *Session) ProcessClientMessage(stanza *xmpp.ClientMessage)

func (*Session) ProcessIQ

func (s *Session) ProcessIQ(stanza *xmpp.ClientIQ) interface{}

func (*Session) ProcessPresence

func (s *Session) ProcessPresence(stanza *xmpp.ClientPresence)

func (*Session) Quit

func (s *Session) Quit()

func (*Session) ReadMessages

func (s *Session) ReadMessages(stanzaChan chan<- xmpp.Stanza)

func (*Session) SetLastTarget

func (s *Session) SetLastTarget(lt string)

func (*Session) SetPromptForTarget

func (s *Session) SetPromptForTarget(target string, isEncrypted bool)

func (*Session) ToggleStatusUpdates

func (s *Session) ToggleStatusUpdates()

func (*Session) UnignoreUser

func (s *Session) UnignoreUser(uid string)

type XIO

type XIO interface {
	Info(msg string)
	Warn(msg string)
	Debug(format string, a ...interface{})
	Alert(msg string)
	Critical(msg string)
	ReadPassword(msg string) (password string, err error)
	SetPrompt(prompt string)
	SetPromptEnc(target string, isEncrypted bool)
	Message(timestamp, from, fromres, to string, msg []byte, isEncrypted bool, doBell bool, delayed bool)
	StatusUpdate(timestamp, from, to, show string, status string, gone bool)
	FormStringForPrinting(s string) string
	Write(s string)
	ReadLine() (line string, err error)
	SetAutoCompleteCallback(f XIOAutoCompleteCallbackI)
	Resize()
	Destroy()
}

func NewXIOTerm

func NewXIOTerm() (x XIO)

type XIOAutoCompleteCallbackI

type XIOAutoCompleteCallbackI func(line string, pos int, key rune) (string, int, bool)

type XIOTerm

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

func (*XIOTerm) Alert

func (xio *XIOTerm) Alert(msg string)

func (*XIOTerm) Critical

func (xio *XIOTerm) Critical(msg string)

func (*XIOTerm) Debug

func (xio *XIOTerm) Debug(format string, a ...interface{})

func (*XIOTerm) Destroy

func (xio *XIOTerm) Destroy()

func (*XIOTerm) FormStringForPrinting

func (xio *XIOTerm) FormStringForPrinting(s string) string

FormStringForPrinting takes a string form the form and returns an escaped version with codes to make it show as red.

func (*XIOTerm) Info

func (xio *XIOTerm) Info(msg string)

func (*XIOTerm) Message

func (xio *XIOTerm) Message(timestamp, from, to, channel string, msg []byte, isEncrypted bool, doBell bool, delayed bool)

func (*XIOTerm) ReadLine

func (xio *XIOTerm) ReadLine() (line string, err error)

func (*XIOTerm) ReadPassword

func (xio *XIOTerm) ReadPassword(msg string) (password string, err error)

func (*XIOTerm) Resize

func (xio *XIOTerm) Resize()

func (*XIOTerm) SetAutoCompleteCallback

func (xio *XIOTerm) SetAutoCompleteCallback(f XIOAutoCompleteCallbackI)

func (*XIOTerm) SetPrompt

func (xio *XIOTerm) SetPrompt(prompt string)

func (*XIOTerm) SetPromptEnc

func (xio *XIOTerm) SetPromptEnc(target string, isEncrypted bool)

func (*XIOTerm) StatusUpdate

func (xio *XIOTerm) StatusUpdate(timestamp, from, channel, show, status string, gone bool)

func (*XIOTerm) Warn

func (xio *XIOTerm) Warn(msg string)

func (*XIOTerm) Write

func (xio *XIOTerm) Write(s string)

Jump to

Keyboard shortcuts

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