From f9302660b027f306f61caa6c23c49b7e4a17c378 Mon Sep 17 00:00:00 2001 From: Matt Goodall Date: Wed, 18 Jul 2012 10:56:23 +0100 Subject: [PATCH] Convenient method for creating an Iq response. --- src/xmpp/stanza.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xmpp/stanza.go b/src/xmpp/stanza.go index aa08bcb..f791cca 100644 --- a/src/xmpp/stanza.go +++ b/src/xmpp/stanza.go @@ -48,6 +48,12 @@ func (iq *Iq) PayloadName() (name xml.Name) { return start.Name } +// Create a response Iq. The Id is kept, To and From are reversed, Type is set +// to the given value. +func (iq *Iq) Response(type_ string) *Iq { + return &Iq{Id: iq.Id, Type: type_, From: iq.To, To: iq.From} +} + // XMPP stanza. type Message struct { XMLName xml.Name `xml:"message"`