remove spam threads
This commit is contained in:
parent
675b3cea93
commit
d9fd433ad7
1 changed files with 11 additions and 8 deletions
|
|
@ -83,11 +83,10 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
return self.create_browser(self.config['username'].get(), self.config['password'].get())
|
return self.create_browser(self.config['username'].get(), self.config['password'].get())
|
||||||
|
|
||||||
def report_spam(self, id, suppr_id=None):
|
def report_spam(self, id):
|
||||||
if suppr_id:
|
with self.browser:
|
||||||
self.browser.delete_thread(suppr_id)
|
self.browser.delete_thread(id)
|
||||||
self.browser.report_fake(id)
|
self.browser.report_fake(id)
|
||||||
pass
|
|
||||||
|
|
||||||
# ---- ICapDating methods ---------------------
|
# ---- ICapDating methods ---------------------
|
||||||
|
|
||||||
|
|
@ -107,10 +106,12 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
|
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
if thread['member'].get('isBan', True):
|
if thread['member'].get('isBan', True):
|
||||||
|
with self.browser:
|
||||||
|
self.browser.delete_thread(thread['member']['id'])
|
||||||
continue
|
continue
|
||||||
if self.antispam and not self.antispam.check_thread(thread):
|
if self.antispam and not self.antispam.check_thread(thread):
|
||||||
self.logger.info('Skipped a spam-thread from %s' % thread['pseudo'])
|
self.logger.info('Skipped a spam-thread from %s' % thread['pseudo'])
|
||||||
self.report_spam(thread['member']['id'], thread['id'])
|
self.report_spam(thread['member']['id'])
|
||||||
continue
|
continue
|
||||||
t = Thread(int(thread['member']['id']))
|
t = Thread(int(thread['member']['id']))
|
||||||
t.flags = Thread.IS_DISCUSSION
|
t.flags = Thread.IS_DISCUSSION
|
||||||
|
|
@ -155,7 +156,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
flags = 0
|
flags = 0
|
||||||
if self.antispam and not self.antispam.check_mail(mail):
|
if self.antispam and not self.antispam.check_mail(mail):
|
||||||
self.logger.info('Skipped a spam-mail from %s' % mails['member']['pseudo'])
|
self.logger.info('Skipped a spam-mail from %s' % mails['member']['pseudo'])
|
||||||
self.report_spam(thread.id, int(mail['id']))
|
self.report_spam(thread.id)
|
||||||
break
|
break
|
||||||
|
|
||||||
if parse_dt(mail['date']) > slut['lastmsg']:
|
if parse_dt(mail['date']) > slut['lastmsg']:
|
||||||
|
|
@ -211,10 +212,12 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
threads = self.browser.get_threads_list()
|
threads = self.browser.get_threads_list()
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
if thread['member'].get('isBan', True):
|
if thread['member'].get('isBan', True):
|
||||||
|
with self.browser:
|
||||||
|
self.browser.delete_thread(int(thread['member']['id']))
|
||||||
continue
|
continue
|
||||||
if self.antispam and not self.antispam.check_thread(thread):
|
if self.antispam and not self.antispam.check_thread(thread):
|
||||||
self.logger.info('Skipped a spam-unread-thread from %s' % thread['member']['pseudo'])
|
self.logger.info('Skipped a spam-unread-thread from %s' % thread['member']['pseudo'])
|
||||||
self.report_spam(thread['member']['id'], thread['id'])
|
self.report_spam(thread['member']['id'])
|
||||||
continue
|
continue
|
||||||
slut = self._get_slut(thread['member']['id'])
|
slut = self._get_slut(thread['member']['id'])
|
||||||
if parse_dt(thread['date']) > slut['lastmsg'] or int(thread['status']) != int(slut['status']):
|
if parse_dt(thread['date']) > slut['lastmsg'] or int(thread['status']) != int(slut['status']):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue