Fix moderator check upon chat messages (Thank you. roughnecks).
This commit is contained in:
parent
95dd1f82e4
commit
70a62d3e33
1 changed files with 5 additions and 8 deletions
|
@ -94,17 +94,15 @@ class XmppChat:
|
||||||
# FIXME Code repetition. See below.
|
# FIXME Code repetition. See below.
|
||||||
# TODO Check alias by nickname associated with conference
|
# TODO Check alias by nickname associated with conference
|
||||||
if message_type == 'groupchat':
|
if message_type == 'groupchat':
|
||||||
if (message['muc']['nick'] == self.alias):
|
alias = message['muc']['nick']
|
||||||
|
if (alias == self.alias):
|
||||||
return
|
return
|
||||||
jid_full = message_from.full
|
if not XmppUtilities.is_moderator(self, jid_bare, alias):
|
||||||
if not XmppUtilities.is_moderator(self, jid_bare, jid_full):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if message_type == 'groupchat':
|
|
||||||
# nick = message['from'][message['from'].index('/')+1:]
|
# nick = message['from'][message['from'].index('/')+1:]
|
||||||
# nick = str(message['from'])
|
# nick = str(message['from'])
|
||||||
# nick = nick[nick.index('/')+1:]
|
# nick = nick[nick.index('/')+1:]
|
||||||
if (message['muc']['nick'] == self.alias or
|
if (alias == self.alias or
|
||||||
not message['body'].startswith('!')):
|
not message['body'].startswith('!')):
|
||||||
return
|
return
|
||||||
# token = await initdb(
|
# token = await initdb(
|
||||||
|
@ -122,8 +120,7 @@ class XmppChat:
|
||||||
# if nick not in operator:
|
# if nick not in operator:
|
||||||
# return
|
# return
|
||||||
# approved = False
|
# approved = False
|
||||||
jid_full = message_from.full
|
if not XmppUtilities.is_moderator(self, jid_bare, alias):
|
||||||
if not XmppUtilities.is_moderator(self, jid_bare, jid_full):
|
|
||||||
return
|
return
|
||||||
# if role == 'moderator':
|
# if role == 'moderator':
|
||||||
# approved = True
|
# approved = True
|
||||||
|
|
Loading…
Reference in a new issue