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.
2017-12-17 15:39:36 +01:00
|
|
|
package extension
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
|
2018-02-07 15:34:18 +01:00
|
|
|
"dev.sum7.eu/genofire/yaja/messages"
|
|
|
|
"dev.sum7.eu/genofire/yaja/server/utils"
|
2017-12-17 15:39:36 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2018-02-07 19:32:11 +01:00
|
|
|
var msg messages.PresenceClient
|
2017-12-17 15:39:36 +01:00
|
|
|
if err := client.In.DecodeElement(&msg, element); err != nil {
|
|
|
|
return false
|
|
|
|
}
|
2018-02-07 19:32:11 +01:00
|
|
|
client.Messages <- &messages.PresenceClient{
|
2017-12-17 15:39:36 +01:00
|
|
|
ID: msg.ID,
|
|
|
|
}
|
|
|
|
log.Debug("send")
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|