Commit 6bcc860c authored by Benjamin Graillot's avatar Benjamin Graillot

Oups

parent 153ef2f3
......@@ -186,7 +186,6 @@ def idle_loop(host, user, password, ninja):
for m in msgs:
if m.endswith(' EXISTS'):
mail = yield from imap_client.uid('fetch', m[:-7], '(RFC822)')
<<<<<<< HEAD
sender = mail['From']
if sender not in UPDATES:
sender = DEFAULT_SENDER
......@@ -211,25 +210,6 @@ def idle_loop(host, user, password, ninja):
message = message(**kwargs)
page = kwargs[page]
ninja.push_update(page, message)
=======
mail = email.message_from_bytes(mail.lines[1])
body = quopri.decodestring(mail.get_payload()).decode('utf-8').replace('\r', '')
page_user = re.search(r'La page « (?P<page>.*) » a été modifiée par (?P<user>.*) :', body)
revision = re.search(r'\?action=diff&rev1=[0-9]+&rev2=(?P<rev>[0-9]+)\n', body)
comment = re.search(r'\s*Commentaire :\s*\n\s*(?P<comment>[^\n]*)\n', body)
if comment: comment = comment.group('comment')
if page_user:
ninja.push_update(page_user.group('page'), page_user.group('user'), int(revision.group('rev')), comment)
continue
page_new_user = re.search(r'La page « (?P<page>.*) » a été renommée « (?P<new>.*) » par (?P<user>.*) :', body)
if page_new_user:
ninja.push_update(page_new_user.group('page'), page_user.group('user'), page_new_user.group('new'), comment, type=Update.rename)
continue
page_user = re.search(r'vous vous êtes abonné aux notifications de changements pour la page "(?P<page>.*)"\.Une pièce jointe (?P<add>(?:vient d\'y être ajouté)|(?:de cette page vient d\'être supprimée)) par (?P<user>.*)\. Quelques détails sur la pièce jointe :', body)
piece = re.search(r'Nom\s*:\s*(?P<name>[^\n]*)\n', body)
if page_user:
ninja.push_update(page_user.group('page'), page_user.group('user'), piece.group('name'), "ajout d'une pièce jointe" if page_user.group('add').startswith('v') else 'suppression de la pièce jointe', type=Update.attachment)
>>>>>>> 27773568c8096bb8a8db180fa607d95186e23b60
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment