Merge pull request #74 from rounds/bolshoy/xmpp-ping-jid

Xmpp ping fixed to use the obtained jid.
This commit is contained in:
mattn 2016-04-11 14:49:11 +09:00
commit 0948d88dae
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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, "<iq from='%s' to='%s' id='c2s1' type='get'>\n"+
"<ping xmlns='urn:xmpp:ping'/>\n"+
"</iq>",