Documentation ¶
Index ¶
- Constants
- func GetLocalFromJID(jid string) string
- func IsBareJid(jid string) bool
- func RemoveResourceFromJid(jid string) string
- func SeparateJidAndResource(fullJid string) (bareJid, resource string)
- type Active
- type BasicHandler
- type ClientError
- type ClientIQ
- type ClientMessage
- type ClientPresence
- type ClientText
- type Composing
- type ConferenceX
- type Config
- type Conn
- func (c *Conn) Close() (err error)
- func (c *Conn) CreateRoom(jid string)
- func (c *Conn) DestroyRoom(jid string) error
- func (c *Conn) DiscoverRooms()
- func (c *Conn) JoinMUC(jid string, nickname string) error
- func (c *Conn) Listen()
- func (c *Conn) Next(ch chan<- Stanza)
- func (c *Conn) PresenceMuc(to string, isJoined bool) (err error)
- func (c *Conn) RetrieveRoster() (err error)
- func (c *Conn) Send(to, msg string) error
- func (c *Conn) SendActive(to string) error
- func (c *Conn) SendComposing(to string) error
- func (c *Conn) SendDirectMucInvitation(to string, roomJid string, reason string) error
- func (c *Conn) SendGroupChatMessage(to, msg string) error
- func (c *Conn) SendMediatedMucInvitation(to string, roomJid string, reason string) error
- func (c *Conn) SetAffiliation(roomJid, jid string, affiliation int) error
- func (c *Conn) SetOffLine() error
- func (c *Conn) SetRole(roomJid, jid string, role int) error
- func (c *Conn) SignalPresence(state string) error
- func (c *Conn) SliencePresence() error
- type DiscoveryFeature
- type DiscoveryIdentity
- type DiscoveryReply
- type EmptyReply
- type ErrorBadRequest
- type ErrorReply
- type Handler
- type MucPresenceItem
- type Paused
- type PresenceC
- type PresenceX
- type Roster
- type RosterEntry
- type RosterRequest
- type RosterRequestItem
- type Stanza
- type VersionQuery
- type VersionReply
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func GetLocalFromJID ¶
func RemoveResourceFromJid ¶
RemoveResourceFromJid returns the user@domain portion of a JID.
func SeparateJidAndResource ¶
Types ¶
type BasicHandler ¶
type BasicHandler struct{}
func (*BasicHandler) RecvMsg ¶
func (b *BasicHandler) RecvMsg(msg *ClientMessage)
func (*BasicHandler) RecvPresence ¶
func (b *BasicHandler) RecvPresence(pres *ClientPresence)
type ClientError ¶
type ClientMessage ¶
type ClientMessage struct { XMLName xml.Name `xml:"jabber:client message"` From string `xml:"from,attr"` Id string `xml:"id,attr"` To string `xml:"to,attr"` Type string `xml:"type,attr"` // chat, error, groupchat, headline, or normal // These should technically be []clientText, // but string is much more convenient. Subject string `xml:"subject"` Body string `xml:"body"` Thread string `xml:"thread"` Active *Active Composing *Composing Paused *Paused ConferenceX *ConferenceX `xml:"x"` }
RFC 3921 B.1 jabber:client
func (*ClientMessage) IsComposing ¶
func (this *ClientMessage) IsComposing() bool
type ClientPresence ¶
type ClientPresence struct { XMLName xml.Name `xml:"jabber:client presence"` From string `xml:"from,attr"` Id string `xml:"id,attr"` To string `xml:"to,attr"` Type string `xml:"type,attr"` // error, probe, subscribe, subscribed, unavailable, unsubscribe, unsubscribed Lang string `xml:"lang,attr"` Show string `xml:"show"` // away, chat, dnd, xa Status string `xml:"status"` // sb []clientText Priority string `xml:"priority"` C PresenceC X PresenceX `xml:"x"` Error *ClientError `xml:"error"` }
func (*ClientPresence) HasNode ¶
func (this *ClientPresence) HasNode() bool
func (*ClientPresence) IsMUC ¶
func (this *ClientPresence) IsMUC() bool
func (*ClientPresence) IsOnline ¶
func (this *ClientPresence) IsOnline() bool
func (*ClientPresence) IsUnavailable ¶
func (this *ClientPresence) IsUnavailable() bool
type ClientText ¶
type ConferenceX ¶
type Config ¶
type Config struct { // InLog is an optional Writer which receives the raw contents of the // XML from the server. InLog io.Writer // OutLog is an option Writer which receives the raw XML sent to the // server. OutLog io.Writer // Log is an optional Writer which receives human readable log messages // during the connection. Log io.Writer TLSRequired bool }
Config contains options for an XMPP connection.
type Conn ¶
type Conn struct { Jid string Domain string OnlineRoster []string Handler Handler RosterIQMap map[string]chan *ClientIQ // contains filtered or unexported fields }
Conn represents a connection to an XMPP server.
func (*Conn) CreateRoom ¶
func (*Conn) DestroyRoom ¶
func (*Conn) DiscoverRooms ¶
func (c *Conn) DiscoverRooms()
<iq from='hag66@shakespeare.lit/pda'
id='zb8q41f4' to='chat.shakespeare.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
func (*Conn) JoinMUC ¶
<presence from='hag66@shakespeare.lit/pda'
to='hoho@conference.shakespeare.lit/nickname'> <x xmlns='http://jabber.org/protocol/muc'/>
</presence>
func (*Conn) Next ¶
Next reads stanzas from the server. If the stanza is a reply, it dispatches it to the correct channel and reads the next message. Otherwise it returns the stanza for processing.
func (*Conn) RetrieveRoster ¶
rfc6121 http://www.rfc-editor.org/rfc/rfc6121.txt <iq from='juliet@example.com/balcony'
id='bv1bs71f' type='get'> <query xmlns='jabber:iq:roster'/>
</iq>
func (*Conn) SendActive ¶
Send sends an IM message to the given user.
func (*Conn) SendComposing ¶
Send sends an IM message to the given user.
func (*Conn) SendDirectMucInvitation ¶
<message
from='crone1@shakespeare.lit/desktop' to='hecate@shakespeare.lit'> <x xmlns='jabber:x:conference' jid='darkcave@macbeth.shakespeare.lit' reason='Hey Hecate, this is the place for all good witches!'/>
</message>
func (*Conn) SendGroupChatMessage ¶
Send an Im message to group chat.
func (*Conn) SendMediatedMucInvitation ¶
<message
from='crone1@shakespeare.lit/desktop' id='nzd143v8' to='coven@chat.shakespeare.lit'> <x xmlns='http://jabber.org/protocol/muc#user'> <invite to='hecate@shakespeare.lit'> <reason> Hey Hecate, this is the place for all good witches! </reason> </invite> </x>
</message>
func (*Conn) SetAffiliation ¶
func (*Conn) SetOffLine ¶
func (*Conn) SignalPresence ¶
func (*Conn) SliencePresence ¶
type DiscoveryFeature ¶
type DiscoveryIdentity ¶
type DiscoveryReply ¶
type DiscoveryReply struct { XMLName xml.Name `xml:"http://jabber.org/protocol/disco#info query"` Identities []DiscoveryIdentity Features []DiscoveryFeature }
type ErrorBadRequest ¶
type ErrorBadRequest struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas bad-request"`
}
ErrorBadRequest reflects a bad-request stanza. See http://xmpp.org/rfcs/rfc6120.html#stanzas-error-conditions-bad-request
type ErrorReply ¶
type ErrorReply struct { XMLName xml.Name `xml:"error"` Type string `xml:"type,attr"` Error interface{} `xml:"error"` }
ErrorReply reflects an XMPP error stanza. See http://xmpp.org/rfcs/rfc6120.html#stanzas-error-syntax
type Handler ¶
type Handler interface { RecvMsg(msg *ClientMessage) RecvPresence(pres *ClientPresence) }
type MucPresenceItem ¶
type PresenceX ¶
type PresenceX struct { XMLName xml.Name `xml:"jabber:client x` Item MucPresenceItem `xml:"item"` }
type Roster ¶
type Roster struct { XMLName xml.Name `xml:"jabber:iq:roster query"` Item []RosterEntry `xml:"item"` }
type RosterEntry ¶
type RosterRequest ¶
type RosterRequest struct { XMLName xml.Name `xml:"jabber:iq:roster query"` Item RosterRequestItem `xml:"item"` }
RosterRequest is used to request that the server update the user's roster. See RFC 6121, section 2.3.