From 174037e63f90bf31d36183e67b645a7c56a02cc7 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Tue, 17 Jun 2025 03:04:43 -0400 Subject: [PATCH] Return 405 for non-existent room JIDs as this should be considered a room creation attempt --- xmpp/handlers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 2e11af5..7b1f41e 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -561,7 +561,7 @@ func handleMUCPresence(s xmpp.Sender, p stanza.Presence, mucExt stanza.MucPresen chatId, ok, toIsGroup := toToID(toBare) if !ok || !toIsGroup { - presenceReplySetError(reply, 404) + presenceReplySetError(reply, 405) return } @@ -579,7 +579,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, 404) + presenceReplySetError(reply, 405) return } @@ -1862,9 +1862,9 @@ func presenceReplySetError(reply *stanza.Presence, code int) { case 407: reply.Error.Type = stanza.ErrorTypeAuth reply.Error.Reason = "registration-required" - case 404: + case 405: reply.Error.Type = stanza.ErrorTypeCancel - reply.Error.Reason = "item-not-found" + reply.Error.Reason = "not-allowed" default: log.Error("Unknown error code, falling back with empty reason") reply.Error.Type = stanza.ErrorTypeCancel