diff --git a/frappe/core/doctype/communication/communication.json b/frappe/core/doctype/communication/communication.json index 3ebdc8d840..f19df01029 100644 --- a/frappe/core/doctype/communication/communication.json +++ b/frappe/core/doctype/communication/communication.json @@ -1252,35 +1252,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "fingerprint", - "fieldtype": "Data", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Fingerprint", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -1409,7 +1380,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-03-07 06:59:01.742335", + "modified": "2017-03-08 16:41:15.546938", "modified_by": "Administrator", "module": "Core", "name": "Communication", diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index f94d1be3fd..12fb2340d5 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -233,7 +233,6 @@ class EmailAccount(Document): uid_list = [] exceptions = [] seen_status = [] - fingerprint_list = [] uid_reindexed = False if frappe.local.flags.in_test: @@ -247,7 +246,6 @@ class EmailAccount(Document): incoming_mails = emails.get("latest_messages") uid_list = emails.get("uid_list", []) seen_status = emails.get("seen_status", []) - fingerprint_list = emails.get("fingerprint_list", []) uid_reindexed = emails.get("uid_reindexed", False) for idx, msg in enumerate(incoming_mails): @@ -256,7 +254,6 @@ class EmailAccount(Document): args = { "uid": uid, "seen": None if not seen_status else get_seen(seen_status.get(uid, None)), - "fingerprint": None if not fingerprint_list else fingerprint_list.get(uid, None), "uid_reindexed": uid_reindexed } communication = self.insert_communication(msg, args=args) @@ -324,11 +321,10 @@ class EmailAccount(Document): # dont count emails sent by the system get those raise SentEmailInInbox - if args.get("fingerprint", None) or email.message_id: + if email.message_id: names = frappe.db.sql("""select distinct name from tabCommunication - where fingerprint='{fingerprint}' or message_id='{message_id}' + where message_id='{message_id}' order by creation desc limit 1""".format( - fingerprint=args.get("fingerprint", ''), message_id=email.message_id ), as_dict=True) @@ -358,8 +354,7 @@ class EmailAccount(Document): "message_id": email.message_id, "communication_date": email.date, "has_attachment": 1 if email.attachments else 0, - "seen": seen or 0, - "fingerprint": args.get("fingerprint", None) + "seen": seen or 0 }) self.set_thread(communication, email) diff --git a/frappe/email/receive.py b/frappe/email/receive.py index bf5aaf98b4..ab4dcda88d 100644 --- a/frappe/email/receive.py +++ b/frappe/email/receive.py @@ -109,7 +109,6 @@ class EmailServer: self.errors = False self.latest_messages = [] self.seen_status = {} - self.fingerprint_list = {} self.uid_reindexed = False uid_list = email_list = self.get_new_mails() @@ -159,7 +158,6 @@ class EmailServer: out.update({ "uid_list": uid_list, "seen_status": self.seen_status, - "fingerprint_list": self.fingerprint_list, "uid_reindexed": self.uid_reindexed }) @@ -232,9 +230,7 @@ class EmailServer: status, message = self.imap.uid('fetch', message_meta, '(BODY.PEEK[] BODY.PEEK[HEADER] FLAGS)') raw, header, ignore = message - self.get_email_seen_status(message_meta, header[0]) - self.get_email_headers_hash(message_meta, header[1]) - + self.get_email_seen_status(message_meta, raw[0]) self.latest_messages.append(raw[1]) else: msg = self.pop.retr(msg_num) @@ -283,27 +279,6 @@ class EmailServer: else: self.seen_status.update({ uid: "UNSEEN" }) - def get_email_headers_hash(self, uid, headers): - """ generate the email unique id from header hash - unique id can be used to update uid if UID is reindexed""" - - hash = hashlib.sha1() - for header in headers: - if header[0] == 'Content-Type': - # skip variable boundaries - continue - - try: - decoded_header = decode_header(header[1]) - decoded = ''.join([val[0].decode(val[1]).encode('ascii', 'ignore') \ - if val[1] is not None else val[0] for val in decoded_header]) - cleaned = re.sub(r"\s+", u"", decoded, flags=re.UNICODE) - hash.update(cleaned) - except: - pass - - self.fingerprint_list.update({ uid: hash.hexdigest() }) - def has_login_limit_exceeded(self, e): return "-ERR Exceeded the login limit" in strip(cstr(e.message))