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 IQPrivateMetacontact struct { IQExtension } func (ex *IQPrivateMetacontact) Handle(msg *xmpp.IQClient, client *utils.Client) bool { log := client.Log.WithField("extension", "private-metacontact").WithField("id", msg.ID) // storage encode type storage struct { XMLName xml.Name `xml:"storage:metacontacts storage"` } s := &storage{} if err := xml.Unmarshal(q.Body, s); err != nil { return false } /* TODO full implement XEP-0209 https://xmpp.org/extensions/xep-0209.html */ 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 }