Files
buny-jabber-bot/vendor/github.com/xmppo/go-xmpp/xmpp_error.go
eleksir 3d85dbcb58 [WIP] Fix ban by software version, some other under-hood changes
- Use updated version of upstream go-xmpp + fixes on client-side
- Introduce golangci-lint v2 + fixes
- Move especially noisy debugging stuff to separate config handles to be able to switch them off
- Add a bit debug to ban by software path
2025-12-16 00:51:10 +03:00

58 lines
1.5 KiB
Go

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,
)
}