1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
package xmpp
import (
"fmt"
)
// ErrorServiceUnavailable implements error response about a feature that is not available. Currently implemented for
// xep-0030.
// QueryXmlns is about incoming xmlns attribute in query tag.
// Node is about incoming node attribute in query tag (looks like it used only in disco#commands).
//
// If queried feature is not here on purpose, standards suggest to answer with this stanza.
func (c *Client) ErrorServiceUnavailable(v IQ, queryXmlns, node string) (string, error) {
query := fmt.Sprintf("<query xmlns='%s' ", queryXmlns)
if node != "" {
query += fmt.Sprintf("node='%s' />", node)
} else {
query += "/>"
}
query += "<error type='cancel'>"
query += "<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' />"
query += "</error>"
return c.RawInformation(
v.To,
v.From,
v.ID,
IQTypeError,
query,
)
}
// ErrorNotImplemented implements error response about a feature that is not (yet?) implemented.
// Xmlns is about not implemented feature.
//
// If queried feature is not here because of it under development or for similar reasons, standards suggest to answer with
// this stanza.
func (c *Client) ErrorNotImplemented(v IQ, xmlns, feature string) (string, error) {
query := "<error type='cancel'>"
query += "<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' />"
query += fmt.Sprintf(
"<unsupported xmlns='%s' feature='%s' />",
xmlns,
feature,
)
query += "</error>"
return c.RawInformation(
v.To,
v.From,
v.ID,
IQTypeError,
query,
)
}
|