forked from jshiffer/go-xmpp
Merge pull request #74 from rounds/bolshoy/xmpp-ping-jid
Xmpp ping fixed to use the obtained jid.
This commit is contained in:
commit
0948d88dae
4
xmpp.go
4
xmpp.go
@ -64,6 +64,10 @@ type Client struct {
|
|||||||
p *xml.Decoder
|
p *xml.Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) JID() string {
|
||||||
|
return c.jid
|
||||||
|
}
|
||||||
|
|
||||||
func connect(host, user, passwd string) (net.Conn, error) {
|
func connect(host, user, passwd string) (net.Conn, error) {
|
||||||
addr := host
|
addr := host
|
||||||
|
|
||||||
|
@ -5,6 +5,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) PingC2S(jid, server string) error {
|
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"+
|
_, err := fmt.Fprintf(c.conn, "<iq from='%s' to='%s' id='c2s1' type='get'>\n"+
|
||||||
"<ping xmlns='urn:xmpp:ping'/>\n"+
|
"<ping xmlns='urn:xmpp:ping'/>\n"+
|
||||||
"</iq>",
|
"</iq>",
|
||||||
|
Loading…
Reference in New Issue
Block a user