[anti_spam] 1.6.7
This commit is contained in:
@@ -38,8 +38,8 @@ zeroconf = False
|
|||||||
|
|
||||||
|
|
||||||
class AntiSpam(BaseModule):
|
class AntiSpam(BaseModule):
|
||||||
def __init__(self, con: types.Client) -> None:
|
def __init__(self, client: types.Client) -> None:
|
||||||
BaseModule.__init__(self, con, plugin=True)
|
BaseModule.__init__(self, client, plugin=True)
|
||||||
|
|
||||||
self.handlers = [
|
self.handlers = [
|
||||||
StanzaHandler(name='message',
|
StanzaHandler(name='message',
|
||||||
@@ -130,7 +130,7 @@ class AntiSpam(BaseModule):
|
|||||||
if str(msg_from) in whitelist:
|
if str(msg_from) in whitelist:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
roster_item = self._con.get_module('Roster').get_item(msg_from)
|
roster_item = self._client.get_module('Roster').get_item(msg_from)
|
||||||
|
|
||||||
if is_muc_pm or roster_item is None:
|
if is_muc_pm or roster_item is None:
|
||||||
assert properties.body
|
assert properties.body
|
||||||
@@ -148,7 +148,7 @@ class AntiSpam(BaseModule):
|
|||||||
def _send_question(self, properties: MessageProperties, jid: JID) -> None:
|
def _send_question(self, properties: MessageProperties, jid: JID) -> None:
|
||||||
message = 'Anti Spam Question: %s' % self._config['msgtxt_question']
|
message = 'Anti Spam Question: %s' % self._config['msgtxt_question']
|
||||||
stanza = Message(to=jid, body=message, typ=properties.type.value)
|
stanza = Message(to=jid, body=message, typ=properties.type.value)
|
||||||
self._con.connection.send_stanza(stanza)
|
self._client.connection.send_stanza(stanza)
|
||||||
self._log.info('Anti spam question sent to %s', jid)
|
self._log.info('Anti spam question sent to %s', jid)
|
||||||
|
|
||||||
def _subscribe_received(self,
|
def _subscribe_received(self,
|
||||||
@@ -158,10 +158,10 @@ class AntiSpam(BaseModule):
|
|||||||
) -> None:
|
) -> None:
|
||||||
msg_from = properties.jid
|
msg_from = properties.jid
|
||||||
block_sub = self._config['block_subscription_requests']
|
block_sub = self._config['block_subscription_requests']
|
||||||
roster_item = self._con.get_module('Roster').get_item(msg_from)
|
roster_item = self._client.get_module('Roster').get_item(msg_from)
|
||||||
|
|
||||||
if block_sub and roster_item is None:
|
if block_sub and roster_item is None:
|
||||||
self._con.get_module('Presence').unsubscribed(msg_from)
|
self._client.get_module('Presence').unsubscribed(msg_from)
|
||||||
self._log.info('Denied subscription request from %s' % msg_from)
|
self._log.info('Denied subscription request from %s' % msg_from)
|
||||||
raise NodeProcessed
|
raise NodeProcessed
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,5 @@
|
|||||||
"gajim>=1.4.0"
|
"gajim>=1.4.0"
|
||||||
],
|
],
|
||||||
"short_name": "anti_spam",
|
"short_name": "anti_spam",
|
||||||
"version": "1.6.6"
|
"version": "1.6.7"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user