aboutsummaryrefslogtreecommitdiff
path: root/xmpp/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r--xmpp/handlers.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index db2b6ea..4e1aea4 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -379,6 +379,11 @@ func handleGetVcardIq(s xmpp.Sender, iq *stanza.IQ, typ byte) {
}
func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ) {
+ iqDisco, ok := iq.Payload.(*stanza.DiscoInfo)
+ if !ok {
+ log.Error("Not a disco info request")
+ return
+ }
answer, err := stanza.NewIQ(stanza.Attrs{
Type: stanza.IQTypeResult,
From: iq.To,
@@ -391,13 +396,15 @@ func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ) {
return
}
- disco := answer.DiscoInfo()
_, ok := toToID(iq.To)
+ typ gateway.ContactType
if ok {
- disco.AddIdentity("", "account", "registered")
+ typ = gateway.ContactPM
} else {
- disco.AddIdentity("Telegram Gateway", "gateway", "telegram")
+ typ = gateway.ContactTransport
}
+ disco := gateway.GetDiscoInfo(typ, []string{})
+ disco.Node = iqDisco.Node
answer.Payload = disco
log.Debugf("%#v", answer)