mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Properly yield a 403 error when banned from a supergroup
This commit is contained in:
parent
e2c5c78882
commit
74b2dff9f5
1 changed files with 6 additions and 2 deletions
|
|
@ -601,8 +601,9 @@ func handleMUCPresence(s xmpp.Sender, p stanza.Presence, mucExt stanza.MucPresen
|
||||||
}
|
}
|
||||||
|
|
||||||
status := session.GetMyStatusInChat(chatId)
|
status := session.GetMyStatusInChat(chatId)
|
||||||
// TODO: seems to be impossible for basic groups, check back when supergroups are supported
|
log.Debugf("status in group %v: %v", chatId, status)
|
||||||
if status == telegram.ChatMemberStatusBanned {
|
switch status {
|
||||||
|
case telegram.ChatMemberStatusBanned, telegram.ChatMemberStatusIllegal:
|
||||||
presenceReplySetError(reply, 403)
|
presenceReplySetError(reply, 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -2093,6 +2094,9 @@ func presenceReplySetError(reply *stanza.Presence, code int) {
|
||||||
case 400:
|
case 400:
|
||||||
reply.Error.Type = stanza.ErrorTypeModify
|
reply.Error.Type = stanza.ErrorTypeModify
|
||||||
reply.Error.Reason = "jid-malformed"
|
reply.Error.Reason = "jid-malformed"
|
||||||
|
case 403:
|
||||||
|
reply.Error.Type = stanza.ErrorTypeAuth
|
||||||
|
reply.Error.Reason = "forbidden"
|
||||||
case 404:
|
case 404:
|
||||||
reply.Error.Type = stanza.ErrorTypeCancel
|
reply.Error.Type = stanza.ErrorTypeCancel
|
||||||
reply.Error.Reason = "item-not-found"
|
reply.Error.Reason = "item-not-found"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue