Example #1
0
func NewStanza(to, from jid.JID, id, sType string) Stanza {
	return Stanza{
		To:   to.String(),
		From: from.String(),
		ID:   id,
		Type: sType,
	}
}
Example #2
0
func NewBindResult(iq IQ, j jid.JID) BindResult {
	to := jid.New(iq.To)
	from := jid.New(iq.From)

	s := NewStanza(to, from, iq.ID, string(IQResult))
	s.Namespaces = map[string]string{"": namespace.Client}

	result := element.Bind.AddChild(
		element.JID.SetText(j.String()),
	)
	s = s.AddChild(result)
	iq = IQ{}.LoadStanza(s)

	return BindResult{IQ: iq}
}