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
590 B
Go
Raw Normal View History

2017-12-17 15:39:36 +01:00
package extension
import (
"encoding/xml"
"github.com/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils"
)
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 messages.Presence
if err := client.In.DecodeElement(&msg, element); err != nil {
return false
}
client.Messages <- &messages.Presence{
ID: msg.ID,
}
log.Debug("send")
return true
}