summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/mail/mail_thread.py8
-rw-r--r--addons/thunderbird/partner/partner.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index b72ef3f1635..a22e44bf351 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -297,7 +297,8 @@ class mail_thread(osv.osv):
def message_process(self, cr, uid, model, message, custom_values=None,
- save_original=False, context=None):
+ save_original=False, strip_attachments=False,
+ context=None):
"""Process an incoming RFC2822 email message related to the
given thread model, relying on ``mail.message.parse()``
for the parsing operation, and then calling ``message_new``
@@ -315,6 +316,8 @@ class mail_thread(osv.osv):
if the thread record already exists.
:param bool save_original: whether to keep a copy of the original
email source attached to the message after it is imported.
+ :param bool strip_attachments: whether to strip all attachments
+ before processing the message, in order to save some space.
"""
# extract message bytes - we are forced to pass the message as binary because
# we don't know its encoding until we parse its headers and hence can't
@@ -338,6 +341,9 @@ class mail_thread(osv.osv):
msg_txt = email.message_from_string(message)
msg = mail_message.parse_message(msg_txt, save_original=save_original)
+ if strip_attachments and 'attachments' in msg:
+ del msg['attachments']
+
# Create New Record into particular model
def create_record(msg):
if hasattr(model_pool, 'message_new'):
diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py
index da59ea99aa5..80a4bfa4d98 100644
--- a/addons/thunderbird/partner/partner.py
+++ b/addons/thunderbird/partner/partner.py
@@ -111,7 +111,7 @@ class thunderbird_partner(osv.osv_memory):
dictcreate = dict(vals)
model = str(dictcreate.get('model'))
message = dictcreate.get('message')
- return self.pool.get('mail.thread').message_process(cr, uid, model, message, attach=True, context=None)
+ return self.pool.get('mail.thread').message_process(cr, uid, model, message)
def search_message(self, cr, uid, message, context=None):
#@param message: string of mail which is read from EML File