forked from jshiffer/go-xmpp
commit
8a5843171f
7
xmpp.go
7
xmpp.go
@ -45,6 +45,9 @@ const (
|
|||||||
// Default TLS configuration options
|
// Default TLS configuration options
|
||||||
var DefaultConfig tls.Config
|
var DefaultConfig tls.Config
|
||||||
|
|
||||||
|
// DebugWriter is the writer used to write debugging output to.
|
||||||
|
var DebugWriter io.Writer = os.Stderr
|
||||||
|
|
||||||
// Cookie is a unique XMPP session identifier
|
// Cookie is a unique XMPP session identifier
|
||||||
type Cookie uint64
|
type Cookie uint64
|
||||||
|
|
||||||
@ -524,7 +527,7 @@ func (c *Client) startTLSIfRequired(f *streamFeatures, o *Options, domain string
|
|||||||
// will be returned.
|
// will be returned.
|
||||||
func (c *Client) startStream(o *Options, domain string) (*streamFeatures, error) {
|
func (c *Client) startStream(o *Options, domain string) (*streamFeatures, error) {
|
||||||
if o.Debug {
|
if o.Debug {
|
||||||
c.p = xml.NewDecoder(tee{c.conn, os.Stderr})
|
c.p = xml.NewDecoder(tee{c.conn, DebugWriter})
|
||||||
} else {
|
} else {
|
||||||
c.p = xml.NewDecoder(c.conn)
|
c.p = xml.NewDecoder(c.conn)
|
||||||
}
|
}
|
||||||
@ -657,7 +660,7 @@ func (c *Client) Send(chat Chat) (n int, err error) {
|
|||||||
if chat.Thread != `` {
|
if chat.Thread != `` {
|
||||||
thdtext = `<thread>` + xmlEscape(chat.Thread) + `</thread>`
|
thdtext = `<thread>` + xmlEscape(chat.Thread) + `</thread>`
|
||||||
}
|
}
|
||||||
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>" + subtext + "<body>%s</body>" + thdtext + "</message>",
|
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>"+subtext+"<body>%s</body>"+thdtext+"</message>",
|
||||||
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
|
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user