sum7
/
yaja
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
yaja/server/extension/presence.go

33 lines
592 B
Go

package extension
import (
"encoding/xml"
"dev.sum7.eu/genofire/yaja/server/utils"
"dev.sum7.eu/genofire/yaja/xmpp"
)
type Presence struct {
Extension
}
//TODO Draft
func (p *Presence) Spaces() []string { return []string{} }
func (p *Presence) Process(element *xml.StartElement, client *utils.Client) bool {
log := client.Log.WithField("extension", "presence")
// iq encode
var msg xmpp.PresenceClient
if err := client.In.DecodeElement(&msg, element); err != nil {
return false
}
client.Messages <- &xmpp.PresenceClient{
ID: msg.ID,
}
log.Debug("send")
return true
}