xmppfunctions

package module
v0.0.0-...-c0a0d10 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContact

func AddContact(handler *xmpp.XMPPHandler, jid string) error

AddContact adds a new contact to the user's roster.

func CreateUser

func CreateUser(domain, port, username, password string) error

CreateUser creates a new account on the XMPP server.

func JoinGroupChat

func JoinGroupChat(handler *xmpp.XMPPHandler, roomJID, nickname string) error

JoinGroupChat allows the user to join a multi-user chat room.

func Login

func Login(domain, port, username, password string) (*xmpp.XMPPHandler, error)

Login authenticates a user and returns an XMPPHandler.

func Logout

func Logout(handler *xmpp.XMPPHandler) error

Logout closes the XMPP connection gracefully.

func ReceiveMessages

func ReceiveMessages(handler *xmpp.XMPPHandler) (string, error)

ReceiveMessages handles incoming messages and stanzas.

func RemoveAccount

func RemoveAccount(handler *xmpp.XMPPHandler) error

RemoveAccount removes a user account from the XMPP server.

func SendFile

func SendFile(handler *xmpp.XMPPHandler, to, filePath string) error

SendFile sends a file to a specific contact.

func SendMessage

func SendMessage(handler *xmpp.XMPPHandler, to, message string) error

SendMessage sends a one-to-one message to a specific user.

func SendNotification

func SendNotification(handler *xmpp.XMPPHandler, to, notification string) error

SendNotification sends a notification to a user or group.

Types

type Contact

type Contact struct {
	JID          string
	Name         string
	Subscription string
	Presence     string
	Status       string
}

func CheckContacts

func CheckContacts(handler *xmpp.XMPPHandler, contacts []Contact) []Contact

func GetContacts

func GetContacts(handler *xmpp.XMPPHandler) ([]Contact, error)

GetContacts retrieves the user's roster (contact list).

type ContactDetails

type ContactDetails struct {
	JID       string
	Name      string
	VCardInfo string
}

func GetContactDetails

func GetContactDetails(handler *xmpp.XMPPHandler, contactJID string) (ContactDetails, error)

GetContactDetails retrieves details about a specific contact.

type IQ

type IQ struct {
	XMLName xml.Name    `xml:"iq"`
	Type    string      `xml:"type,attr"`
	ID      string      `xml:"id,attr"`
	To      string      `xml:"to,attr,omitempty"`
	Query   RosterQuery `xml:"query"`
}

type RosterItem

type RosterItem struct {
	JID          string `xml:"jid,attr"`
	Subscription string `xml:"subscription,attr"`
	Name         string `xml:"name,attr,omitempty"`
}

type RosterQuery

type RosterQuery struct {
	XMLName xml.Name     `xml:"query"`
	Items   []RosterItem `xml:"item"`
}

Jump to

Keyboard shortcuts

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