Documentation
¶
Index ¶
- func Authenticate(conn *XMPPConnection, username, password string) error
- func BindResource(conn *XMPPConnection) error
- func CreateUser(conn *XMPPConnection, username, password string) error
- func StartTLS(conn *XMPPConnection) error
- type AuthRequest
- type ChatWindow
- type IQ
- type IQItem
- type Message
- type Presence
- type RawXML
- type RegisterRequest
- type Stanza
- type XMPPConnection
- type XMPPHandler
- func (h *XMPPHandler) DispatchMessage(msg *Message)
- func (h *XMPPHandler) HandleIncomingStanzas() error
- func (h *XMPPHandler) ListenForIncomingStanzas()
- func (h *XMPPHandler) LoginAndFetchMessages(status string) error
- func (h *XMPPHandler) PromptSubscriptionRequest(from string)
- func (h *XMPPHandler) RequestOfflineMessages() error
- func (h *XMPPHandler) SendMessage(to, message string) error
- func (h *XMPPHandler) SendPresence(presenceType, status string) error
- func (h *XMPPHandler) WaitForShutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
func Authenticate(conn *XMPPConnection, username, password string) error
Authenticate performs SASL PLAIN authentication with the XMPP server.
func BindResource ¶
func BindResource(conn *XMPPConnection) error
func CreateUser ¶
func CreateUser(conn *XMPPConnection, username, password string) error
func StartTLS ¶
func StartTLS(conn *XMPPConnection) error
StartTLS sends the STARTTLS command to the server and upgrades the connection to TLS.
Types ¶
type AuthRequest ¶
type AuthRequest struct {
XMLName xml.Name `xml:"auth"`
Mechanism string `xml:"mechanism,attr"`
Text string `xml:",chardata"`
}
func (*AuthRequest) ToXML ¶
func (a *AuthRequest) ToXML() (string, error)
type ChatWindow ¶
type ChatWindow struct {
Window fyne.Window
ChatContent *fyne.Container
Handler *XMPPHandler
Recipient string
}
func (*ChatWindow) AddMessage ¶
func (cw *ChatWindow) AddMessage(msg *Message)
type IQ ¶
type Message ¶
type Message struct {
XMLName xml.Name `xml:"message"`
To string `xml:"to,attr,omitempty"`
From string `xml:"from,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
Body string `xml:"body,omitempty"`
Subject string `xml:"subject,omitempty"`
Thread string `xml:"thread,omitempty"`
}
Message represents an XMPP message stanza.
func NewMessage ¶
NewMessage creates a new message with the specified type, recipient, and body.
func ParseMessage ¶
ParseMessage parses an XML string into a Message struct.
func (*Message) IsChatMessage ¶
IsChatMessage checks if the message is of type "chat".
func (*Message) IsErrorMessage ¶
IsErrorMessage checks if the message is of type "error".
func (*Message) IsGroupChatMessage ¶
IsGroupChatMessage checks if the message is of type "groupchat".
type Presence ¶
type Presence struct {
XMLName xml.Name `xml:"presence"`
From string `xml:"from,attr,omitempty"`
To string `xml:"to,attr,omitempty"`
Type string `xml:"type,attr,omitempty"` // "available", "unavailable", "subscribe", etc.
Show string `xml:"show,omitempty"` // "chat", "away", "dnd", "xa" (extended away)
Status string `xml:"status,omitempty"` // User-defined status message
Priority int `xml:"priority,omitempty"` // Priority level (-128 to +127)
}
Presence represents an XMPP presence stanza.
func NewPresence ¶
NewPresence creates a new presence stanza with the specified parameters.
func ParsePresence ¶
ParsePresence parses an XML string into a Presence struct.
func (*Presence) IsAvailable ¶
IsAvailable checks if the presence type is "available".
func (*Presence) IsSubscriptionRequest ¶
IsSubscriptionRequest checks if the presence type is "subscribe" or "subscribed".
func (*Presence) IsUnavailable ¶
IsUnavailable checks if the presence type is "unavailable".
type RegisterRequest ¶
type Stanza ¶
func ParseStanza ¶
type XMPPConnection ¶
func NewXMPPConnection ¶
func NewXMPPConnection(domain string, port string, useTLS bool) (*XMPPConnection, error)
func (*XMPPConnection) Close ¶
func (xc *XMPPConnection) Close() error
func (*XMPPConnection) CloseStream ¶
func (xc *XMPPConnection) CloseStream() error
func (*XMPPConnection) StartStream ¶
func (xc *XMPPConnection) StartStream(domain string) error
type XMPPHandler ¶
type XMPPHandler struct {
Conn *XMPPConnection
Server string
Username string
Password string
ChatWindows map[string]*ChatWindow
MessageChan chan *Message
MessageQueue map[string][]*Message
PresenceStack map[string]*Presence
VCardStack map[string]*IQ
}
func NewXMPPHandler ¶
func NewXMPPHandler(domain, port, username, password string) (*XMPPHandler, error)
func (*XMPPHandler) DispatchMessage ¶
func (h *XMPPHandler) DispatchMessage(msg *Message)
func (*XMPPHandler) HandleIncomingStanzas ¶
func (h *XMPPHandler) HandleIncomingStanzas() error
func (*XMPPHandler) ListenForIncomingStanzas ¶
func (h *XMPPHandler) ListenForIncomingStanzas()
func (*XMPPHandler) LoginAndFetchMessages ¶
func (h *XMPPHandler) LoginAndFetchMessages(status string) error
func (*XMPPHandler) PromptSubscriptionRequest ¶
func (h *XMPPHandler) PromptSubscriptionRequest(from string)
func (*XMPPHandler) RequestOfflineMessages ¶
func (h *XMPPHandler) RequestOfflineMessages() error
func (*XMPPHandler) SendMessage ¶
func (h *XMPPHandler) SendMessage(to, message string) error
SendMessage sends a message stanza to the specified recipient.
func (*XMPPHandler) SendPresence ¶
func (h *XMPPHandler) SendPresence(presenceType, status string) error
SendPresence sends a presence stanza to update the user's availability status.
func (*XMPPHandler) WaitForShutdown ¶
func (h *XMPPHandler) WaitForShutdown()
WaitForShutdown keeps the connection alive until shutdown is requested.