Compare commits
No commits in common. "eccf5059427bd59888e3d1b17d69a3fc0fdc2005" and "dacdc4ac04acc450e1d107f6e90c9ae3522ee1ff" have entirely different histories.
eccf505942
...
dacdc4ac04
|
|
@ -1,29 +0,0 @@
|
||||||
package xmpp
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/xml"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
NSRegister = "jabber:iq:register"
|
|
||||||
)
|
|
||||||
|
|
||||||
// XEP-0077: In-Band Registration
|
|
||||||
|
|
||||||
type RegisterQuery struct {
|
|
||||||
XMLName xml.Name `xml:"jabber:iq:register query"`
|
|
||||||
Instructions string `xml:"instructions"`
|
|
||||||
Username string `xml:"username"`
|
|
||||||
Password string `xml:"password"`
|
|
||||||
XForm AdHocXForm `xml:"x"`
|
|
||||||
Registered *RegisterRegistered `xmp:"registered"`
|
|
||||||
Remove *RegisterRemove `xmp:"remove"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RegisterRegistered struct {
|
|
||||||
XMLName xml.Name `xml:"registered"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RegisterRemove struct {
|
|
||||||
XMLName xml.Name `xml:"remove"`
|
|
||||||
}
|
|
||||||
|
|
@ -103,7 +103,6 @@ type Presence struct {
|
||||||
// stanza, e.g. an <iq type="error"/>.
|
// stanza, e.g. an <iq type="error"/>.
|
||||||
type Error struct {
|
type Error struct {
|
||||||
XMLName xml.Name `xml:"error"`
|
XMLName xml.Name `xml:"error"`
|
||||||
Code string `xml:"code,attr,omitempty"`
|
|
||||||
Type string `xml:"type,attr"`
|
Type string `xml:"type,attr"`
|
||||||
Payload string `xml:",innerxml"`
|
Payload string `xml:",innerxml"`
|
||||||
}
|
}
|
||||||
|
|
@ -142,12 +141,6 @@ func NewError(errorType string, condition ErrorCondition, text string) *Error {
|
||||||
return &Error{Type: errorType, Payload: string(buf.Bytes())}
|
return &Error{Type: errorType, Payload: string(buf.Bytes())}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewErrorWithCode(code, errorType string, condition ErrorCondition, text string) *Error {
|
|
||||||
err := NewError(errorType, condition, text)
|
|
||||||
err.Code = code
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the error text from the payload, or "" if not present.
|
// Return the error text from the payload, or "" if not present.
|
||||||
func (e Error) Text() string {
|
func (e Error) Text() string {
|
||||||
dec := xml.NewDecoder(bytes.NewBufferString(e.Payload))
|
dec := xml.NewDecoder(bytes.NewBufferString(e.Payload))
|
||||||
|
|
@ -183,10 +176,8 @@ type ErrorCondition xml.Name
|
||||||
|
|
||||||
// Stanza errors.
|
// Stanza errors.
|
||||||
var (
|
var (
|
||||||
ErrorFeatureNotImplemented = ErrorCondition{nsErrorStanzas, "feature-not-implemented"}
|
FeatureNotImplemented = ErrorCondition{nsErrorStanzas, "feature-not-implemented"}
|
||||||
ErrorRemoteServerNotFound = ErrorCondition{nsErrorStanzas, "remote-server-not-found"}
|
RemoteServerNotFound = ErrorCondition{nsErrorStanzas, "remote-server-not-found"}
|
||||||
ErrorServiceUnavailable = ErrorCondition{nsErrorStanzas, "service-unavailable"}
|
ServiceUnavailable = ErrorCondition{nsErrorStanzas, "service-unavailable"}
|
||||||
ErrorNotAuthorized = ErrorCondition{nsErrorStanzas, "not-authorized"}
|
NotAuthorized = ErrorCondition{nsErrorStanzas, "not-authorized"}
|
||||||
ErrorConflict = ErrorCondition{nsErrorStanzas, "conflict"}
|
|
||||||
ErrorNotAcceptable = ErrorCondition{nsErrorStanzas, "not-acceptable"}
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue