|
|
@ -339,18 +339,35 @@ func handleGetDisco(dt discoType, s xmpp.Sender, iq *stanza.IQ) {
|
|
|
|
|
|
|
|
|
|
|
|
if dt == discoTypeInfo {
|
|
|
|
if dt == discoTypeInfo {
|
|
|
|
disco := answer.DiscoInfo()
|
|
|
|
disco := answer.DiscoInfo()
|
|
|
|
_, ok := toToID(iq.To)
|
|
|
|
toID, toOk := toToID(iq.To)
|
|
|
|
if ok {
|
|
|
|
if toOk {
|
|
|
|
disco.AddIdentity("", "account", "registered")
|
|
|
|
disco.AddIdentity("", "account", "registered")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
disco.AddIdentity("Telegram Gateway", "gateway", "telegram")
|
|
|
|
disco.AddIdentity("Telegram Gateway", "gateway", "telegram")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bare, _, ok := splitFrom(iq.From)
|
|
|
|
bare, _, fromOk := splitFrom(iq.From)
|
|
|
|
if ok {
|
|
|
|
if fromOk {
|
|
|
|
session, ok := sessions[bare]
|
|
|
|
session, sessionOk := sessions[bare]
|
|
|
|
if ok && session.Session.MUC {
|
|
|
|
if sessionOk && session.Session.MUC {
|
|
|
|
disco.AddFeatures(stanza.NSDiscoItems)
|
|
|
|
if toOk {
|
|
|
|
disco.AddIdentity("Telegram group chats", "conference", "text")
|
|
|
|
chat, _, err := session.GetContactByID(toID, nil)
|
|
|
|
|
|
|
|
if err == nil && session.IsGroup(chat) {
|
|
|
|
|
|
|
|
disco.AddIdentity(chat.Title, "conference", "text")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disco.AddFeatures(
|
|
|
|
|
|
|
|
"http://jabber.org/protocol/muc",
|
|
|
|
|
|
|
|
"muc_persistent",
|
|
|
|
|
|
|
|
"muc_hidden",
|
|
|
|
|
|
|
|
"muc_membersonly",
|
|
|
|
|
|
|
|
"muc_unmoderated",
|
|
|
|
|
|
|
|
"muc_nonanonymous",
|
|
|
|
|
|
|
|
"muc_unsecured",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
disco.AddFeatures(stanza.NSDiscoItems)
|
|
|
|
|
|
|
|
disco.AddIdentity("Telegram group chats", "conference", "text")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
answer.Payload = disco
|
|
|
|
answer.Payload = disco
|
|
|
|