diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 647f0b1..9e00976 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -601,8 +601,9 @@ func handleMUCPresence(s xmpp.Sender, p stanza.Presence, mucExt stanza.MucPresen } status := session.GetMyStatusInChat(chatId) - // TODO: seems to be impossible for basic groups, check back when supergroups are supported - if status == telegram.ChatMemberStatusBanned { + log.Debugf("status in group %v: %v", chatId, status) + switch status { + case telegram.ChatMemberStatusBanned, telegram.ChatMemberStatusIllegal: presenceReplySetError(reply, 403) return } @@ -2093,6 +2094,9 @@ func presenceReplySetError(reply *stanza.Presence, code int) { case 400: reply.Error.Type = stanza.ErrorTypeModify reply.Error.Reason = "jid-malformed" + case 403: + reply.Error.Type = stanza.ErrorTypeAuth + reply.Error.Reason = "forbidden" case 404: reply.Error.Type = stanza.ErrorTypeCancel reply.Error.Reason = "item-not-found"