Compare commits

..

No commits in common. "0490e0a087b9d67fc9e19fa6aa5c0768ef33337f" and "eccf5059427bd59888e3d1b17d69a3fc0fdc2005" have entirely different histories.

5 changed files with 3 additions and 71 deletions

View File

@ -1,13 +0,0 @@
package xmpp
import (
"encoding/xml"
)
const (
NSPing = "urn:xmpp:ping"
)
type Ping struct {
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
}

View File

@ -1,21 +0,0 @@
package xmpp
import (
"encoding/xml"
)
const (
NSRemoteRosterManager = "urn:xmpp:tmp:roster-management:0"
RemoteRosterManagerTypeRequest = "request"
RemoteRosterManagerTypeAllowed = "allowed"
RemoteRosterManagerTypeRejected = "rejected"
)
// XEP-0321: Remote Roster Manager
type RemoteRosterManagerQuery struct {
XMLName xml.Name `xml:"urn:xmpp:tmp:roster-management:0 query"`
Reason string `xml:"reason,attr,omitempty"`
Type string `xml:"type,attr"`
}

View File

@ -1,26 +0,0 @@
package xmpp
import (
"encoding/xml"
)
const (
NSRoster = "jabber:iq:roster"
RosterSubscriptionBoth = "both"
RosterSubscriptionFrom = "from"
RosterSubscriptionTo = "to"
RosterSubscriptionRemove = "remove"
)
type RosterQuery struct {
XMLName xml.Name `xml:"jabber:iq:roster query"`
Items []RosterItem `xml:"item"`
}
type RosterItem struct {
JID string `xml:"jid,attr"`
Name string `xml:"name,attr,omitempty"`
Subscription string `xml:"subscription,attr"`
Groupes []string `xml:"group"`
}

View File

@ -189,5 +189,4 @@ var (
ErrorNotAuthorized = ErrorCondition{nsErrorStanzas, "not-authorized"} ErrorNotAuthorized = ErrorCondition{nsErrorStanzas, "not-authorized"}
ErrorConflict = ErrorCondition{nsErrorStanzas, "conflict"} ErrorConflict = ErrorCondition{nsErrorStanzas, "conflict"}
ErrorNotAcceptable = ErrorCondition{nsErrorStanzas, "not-acceptable"} ErrorNotAcceptable = ErrorCondition{nsErrorStanzas, "not-acceptable"}
ErrorForbidden = ErrorCondition{nsErrorStanzas, "forbidden"}
) )

View File

@ -170,16 +170,12 @@ func (x *XMPP) sender() {
// Close the stream. Note: relies on common element name for all types of // Close the stream. Note: relies on common element name for all types of
// XMPP connection. // XMPP connection.
log.Println("Close XMPP stream") log.Println("Close XMPP stream")
x.Close() x.stream.SendEnd(&xml.EndElement{xml.Name{"stream", "stream"}})
} }
func (x *XMPP) receiver() { func (x *XMPP) receiver() {
defer func() { defer close(x.In)
log.Println("Close XMPP receiver")
x.Close()
close(x.In)
}()
for { for {
start, err := x.stream.Next() start, err := x.stream.Next()
@ -219,11 +215,8 @@ func (x *XMPP) receiver() {
x.In <- v x.In <- v
} }
} }
}
func (x *XMPP) Close() { log.Println("Close XMPP receiver")
log.Println("Close XMPP")
x.stream.SendEnd(&xml.EndElement{xml.Name{"stream", "stream"}})
} }
// BUG(matt): Filter channels are not closed when the stream is closed. // BUG(matt): Filter channels are not closed when the stream is closed.