diff --git a/xmpp.go b/xmpp.go index 9af89a2..2073b9b 100644 --- a/xmpp.go +++ b/xmpp.go @@ -1084,8 +1084,48 @@ func (c *Client) SendOrg(org string) (n int, err error) { return fmt.Fprint(StanzaWriter, org) } +// SendPresence sends Presence wrapped inside XMPP presence stanza. func (c *Client) SendPresence(presence Presence) (n int, err error) { - return fmt.Fprintf(StanzaWriter, "", xmlEscape(presence.From), xmlEscape(presence.To)) + // Forge opening presence tag + var buf string = "%s", xmlEscape(presence.Show)) + } + } + + if presence.Status != "" { + buf = buf + fmt.Sprintf("%s", xmlEscape(presence.Status)) + } + + buf = buf + "" + + return fmt.Fprint(StanzaWriter, buf) } // SendKeepAlive sends a "whitespace keepalive" as described in chapter 4.6.1 of RFC6120.