diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 9e3eac8..afb5027 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -591,7 +591,7 @@ func handleMUCPresence(s xmpp.Sender, p stanza.Presence, mucExt stanza.MucPresen chat, _, err := session.GetContactByID(chatId, nil) if err != nil || !session.IsGroup(chat) { - presenceReplySetError(reply, 405) + presenceReplySetError(reply, 404) return } @@ -913,6 +913,7 @@ func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoInfo) { defer gateway.ResumableSend(component, answer) disco := answer.DiscoInfo() + answer.Payload = disco toID, toOk, toIsGroup := toToID(iq.To) if di.Node == "" { @@ -969,7 +970,12 @@ func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoInfo) { } if toOk { - if !isMuc { + if toIsGroup { + if !isMuc { + iqAnswerSetError(answer, 404) + return + } + } else { disco.AddIdentity("", "account", "registered") } disco.AddFeatures(stanza.NSMsgChatMarkers) @@ -1014,7 +1020,6 @@ func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoInfo) { } } } - answer.Payload = disco } func handleGetDiscoItems(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoItems) { @@ -2045,12 +2050,15 @@ func presenceReplySetError(reply *stanza.Presence, code int) { case 400: reply.Error.Type = stanza.ErrorTypeModify reply.Error.Reason = "jid-malformed" - case 407: - reply.Error.Type = stanza.ErrorTypeAuth - reply.Error.Reason = "registration-required" + case 404: + reply.Error.Type = stanza.ErrorTypeCancel + reply.Error.Reason = "item-not-found" case 405: reply.Error.Type = stanza.ErrorTypeCancel reply.Error.Reason = "not-allowed" + case 407: + reply.Error.Type = stanza.ErrorTypeAuth + reply.Error.Reason = "registration-required" default: log.Error("Unknown error code, falling back with empty reason") reply.Error.Type = stanza.ErrorTypeCancel