From e3871c2deba375c8a03b4adf79010b59052c7e82 Mon Sep 17 00:00:00 2001 From: David Bolshoy Date: Sun, 10 Apr 2016 18:43:42 +0300 Subject: [PATCH] Xmpp ping fixed to use the obtained jid. Though a client function, ping does not use the client jid. Fixed ping to use the obtained jid and configured server domain by default. Client now exposes jid. --- xmpp.go | 4 ++++ xmpp_ping.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/xmpp.go b/xmpp.go index b0a7d2e..ed69756 100644 --- a/xmpp.go +++ b/xmpp.go @@ -64,6 +64,10 @@ type Client struct { p *xml.Decoder } +func (c *Client) JID() string { + return c.jid +} + func connect(host, user, passwd string) (net.Conn, error) { addr := host diff --git a/xmpp_ping.go b/xmpp_ping.go index 685985d..26d056e 100644 --- a/xmpp_ping.go +++ b/xmpp_ping.go @@ -5,6 +5,12 @@ import ( ) func (c *Client) PingC2S(jid, server string) error { + if jid == "" { + jid = c.jid + } + if server == "" { + server = c.domain + } _, err := fmt.Fprintf(c.conn, "\n"+ "\n"+ "",