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/iq_private_bookmarks.bak

51 lines
910 B
Plaintext

package extension
import (
"encoding/xml"
"dev.sum7.eu/genofire/yaja/xmpp"
"dev.sum7.eu/genofire/yaja/model"
"dev.sum7.eu/genofire/yaja/server/utils"
)
type IQPrivateBookmark struct {
IQExtension
}
func (ex *IQPrivateBookmark) Handle(msg *xmpp.IQClient, client *utils.Client) bool {
log := client.Log.WithField("extension", "private").WithField("id", msg.ID)
// storage encode
type storage struct {
XMLName xml.Name `xml:"storage:bookmarks storage"`
}
s := &storage{}
if err := xml.Unmarshal(q.Body, s); err != nil {
return false
}
/*
TODO full implement
*/
queryByte, err := xml.Marshal(&iqPrivateQuery{
Body: q.Body,
})
if err != nil {
log.Warn(err)
return true
}
// reply
client.Messages <- &xmpp.IQClient{
Type: xmpp.IQTypeResult,
To: client.JID,
From: xmpp.NewJID(client.JID.Domain),
ID: msg.ID,
Body: queryByte,
}
log.Debug("send")
return true
}