correctly format messages
This commit is contained in:
parent
cbec5380f1
commit
3ec65f7a55
2 changed files with 4 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ import email
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
|
from html2text import unescape
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
from dateutil.parser import parse as _parse_dt
|
from dateutil.parser import parse as _parse_dt
|
||||||
|
|
||||||
|
|
@ -36,7 +37,7 @@ from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
from weboob.tools.browser import BrowserUnavailable
|
from weboob.tools.browser import BrowserUnavailable
|
||||||
from weboob.tools.value import Value, ValuesDict, ValueBool, ValueBackendPassword
|
from weboob.tools.value import Value, ValuesDict, ValueBool, ValueBackendPassword
|
||||||
from weboob.tools.log import getLogger
|
from weboob.tools.log import getLogger
|
||||||
from weboob.tools.misc import html2text, local2utc
|
from weboob.tools.misc import local2utc
|
||||||
|
|
||||||
from .contact import Contact
|
from .contact import Contact
|
||||||
from .captcha import CaptchaError
|
from .captcha import CaptchaError
|
||||||
|
|
@ -184,7 +185,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
sender=my_name if int(mail['id_from']) == self.browser.my_id else mails['member']['pseudo'],
|
sender=my_name if int(mail['id_from']) == self.browser.my_id else mails['member']['pseudo'],
|
||||||
receivers=[my_name if int(mail['id_from']) != self.browser.my_id else mails['member']['pseudo']],
|
receivers=[my_name if int(mail['id_from']) != self.browser.my_id else mails['member']['pseudo']],
|
||||||
date=parse_dt(mail['date']),
|
date=parse_dt(mail['date']),
|
||||||
content=html2text(mail['message'].replace("\r", "<br>")).strip(),
|
content=unescape(mail['message']).strip(),
|
||||||
signature=contacts[mail['id_from']].get_text() if mail['id_from'] in contacts else None,
|
signature=contacts[mail['id_from']].get_text() if mail['id_from'] in contacts else None,
|
||||||
children=[],
|
children=[],
|
||||||
flags=flags)
|
flags=flags)
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ class AuMBrowser(BaseBrowser):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
new_content += c
|
new_content += c
|
||||||
|
|
||||||
content = new_content.replace('\n', '<br>').encode('Windows-1252', 'replace')
|
content = new_content.replace('\n', '\r\n').encode('Windows-1252', 'replace')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.api_request('message', 'new', data={'memberId': id, 'message': content})
|
self.api_request('message', 'new', data={'memberId': id, 'message': content})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue