remove of threads work, so use it for fakes and report them to admins
This commit is contained in:
parent
5794973932
commit
3a1833a2f4
3 changed files with 16 additions and 22 deletions
|
|
@ -88,11 +88,10 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
else:
|
else:
|
||||||
return self.create_browser(self.config['username'], self.config['password'])
|
return self.create_browser(self.config['username'], self.config['password'])
|
||||||
|
|
||||||
def report_spam(self, id):
|
def report_spam(self, id, suppr_id=None):
|
||||||
# XXX as 'delete_thread' doesn't work (see implementation of this function),
|
if suppr_id:
|
||||||
# do not report fake because it will flood admins and we should be discovered.
|
self.browser.delete_thread(suppr_id)
|
||||||
#self.browser.delete_thread(id)
|
self.browser.report_fake(id)
|
||||||
#self.browser.report_fake(id)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
|
|
@ -115,17 +114,17 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
continue
|
continue
|
||||||
if self.antispam and not self.antispam.check(contact):
|
if self.antispam and not self.antispam.check(contact):
|
||||||
debug('Skipped a spam-thread from %s' % contact.get_name())
|
debug('Skipped a spam-thread from %s' % contact.get_name())
|
||||||
self.report_spam(contact.get_id())
|
self.report_spam(contact.get_id(), contact.get_suppr_id())
|
||||||
continue
|
continue
|
||||||
thread = Thread(contact.get_id())
|
thread = Thread(contact.get_id())
|
||||||
thread.title = 'Discussion with %s' % contact.get_name()
|
thread.title = 'Discussion with %s' % contact.get_name()
|
||||||
yield thread
|
yield thread
|
||||||
|
|
||||||
def get_thread(self, id, profiles=None):
|
def get_thread(self, id, profiles=None, contact=None):
|
||||||
"""
|
"""
|
||||||
Get a thread and its messages.
|
Get a thread and its messages.
|
||||||
|
|
||||||
The 'profiles' parameter is only used for internal calls.
|
The 'profiles' and 'contact' parameters are only used for internal calls.
|
||||||
"""
|
"""
|
||||||
thread = None
|
thread = None
|
||||||
if isinstance(id, Thread):
|
if isinstance(id, Thread):
|
||||||
|
|
@ -151,7 +150,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
flags = 0
|
flags = 0
|
||||||
if self.antispam and not self.antispam.check(mail):
|
if self.antispam and not self.antispam.check(mail):
|
||||||
debug('Skipped a spam-mail from %s' % mail.sender)
|
debug('Skipped a spam-mail from %s' % mail.sender)
|
||||||
self.report_spam(thread.id)
|
self.report_spam(thread.id, contact and contact.get_suppr_id())
|
||||||
break
|
break
|
||||||
|
|
||||||
if mail.date > slut['lastmsg']:
|
if mail.date > slut['lastmsg']:
|
||||||
|
|
@ -162,7 +161,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
profiles[mail.profile_link] = self.browser.get_profile(mail.profile_link)
|
profiles[mail.profile_link] = self.browser.get_profile(mail.profile_link)
|
||||||
if self.antispam and not self.antispam.check(profiles[mail.profile_link]):
|
if self.antispam and not self.antispam.check(profiles[mail.profile_link]):
|
||||||
debug('Skipped a spam-mail-profile from %s' % mail.sender)
|
debug('Skipped a spam-mail-profile from %s' % mail.sender)
|
||||||
self.report_spam(thread.id)
|
self.report_spam(thread.id, contact and contact.get_suppr_id())
|
||||||
break
|
break
|
||||||
mail.signature += u'\n%s' % profiles[mail.profile_link].get_profile_text()
|
mail.signature += u'\n%s' % profiles[mail.profile_link].get_profile_text()
|
||||||
|
|
||||||
|
|
@ -213,11 +212,11 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
continue
|
continue
|
||||||
if self.antispam and not self.antispam.check(contact):
|
if self.antispam and not self.antispam.check(contact):
|
||||||
debug('Skipped a spam-unread-thread from %s' % contact.get_name())
|
debug('Skipped a spam-unread-thread from %s' % contact.get_name())
|
||||||
self.report_spam(contact.get_id())
|
self.report_spam(contact.get_id(), contact.get_suppr_id())
|
||||||
continue
|
continue
|
||||||
slut = self._get_slut(contact.get_id())
|
slut = self._get_slut(contact.get_id())
|
||||||
if contact.get_lastmsg_date() > slut['lastmsg']:
|
if contact.get_lastmsg_date() > slut['lastmsg']:
|
||||||
thread = self.get_thread(contact.get_id(), profiles)
|
thread = self.get_thread(contact.get_id(), profiles, contact)
|
||||||
for m in thread.iter_all_messages():
|
for m in thread.iter_all_messages():
|
||||||
if m.flags & m.IS_UNREAD:
|
if m.flags & m.IS_UNREAD:
|
||||||
yield m
|
yield m
|
||||||
|
|
|
||||||
|
|
@ -211,18 +211,9 @@ class AuMBrowser(BaseBrowser):
|
||||||
|
|
||||||
@pageaccess
|
@pageaccess
|
||||||
def delete_thread(self, id):
|
def delete_thread(self, id):
|
||||||
"""
|
|
||||||
mail.php
|
|
||||||
delete=true&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=6671957&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=
|
|
||||||
delete=true&suppr%5B%5D=13121086&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=&suppr%5B%5D=
|
|
||||||
"""
|
|
||||||
data = 'delete=true&suppr%%5B%%5D=%s' % id
|
data = 'delete=true&suppr%%5B%%5D=%s' % id
|
||||||
for i in xrange(23):
|
|
||||||
data += '&suppr%5B%5D='
|
|
||||||
url = 'http://www.adopteunmec.com/mail.php'
|
url = 'http://www.adopteunmec.com/mail.php'
|
||||||
request = self.request_class(url, data, {'Referer': url, 'Content-Type': 'application/x-www-form-urlencoded'})
|
self.openurl(url, data).read()
|
||||||
# WTF IT DOESN'T WORK I HAVE YOU AUM I WANT TO DEFECATE IN YOUR MOUTH
|
|
||||||
self.openurl(request).read()
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ class ContactItem:
|
||||||
tag = self.__get_element('resume')
|
tag = self.__get_element('resume')
|
||||||
return tag.getElementsByTagName('b')[0].firstChild.data.strip()
|
return tag.getElementsByTagName('b')[0].firstChild.data.strip()
|
||||||
|
|
||||||
|
def get_suppr_id(self):
|
||||||
|
tag = self.__get_element('remove')
|
||||||
|
return tag.getElementsByTagName('input')[0].getAttribute('id').split('_')[-1]
|
||||||
|
|
||||||
LASTMSG_RE = re.compile('il y a (\d+) (\w+)')
|
LASTMSG_RE = re.compile('il y a (\d+) (\w+)')
|
||||||
def get_lastmsg_date(self):
|
def get_lastmsg_date(self):
|
||||||
tag = self.__get_element('resume')
|
tag = self.__get_element('resume')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue