Commit e320af39 authored by Tijmen de Mes's avatar Tijmen de Mes

Handle incoming remove messages

parent b6101717
......@@ -327,7 +327,7 @@ class OTRInternalMessage(BlinkMessage):
@implementer(IObserver)
class OutgoingMessage(object):
__ignored_content_types__ = {IsComposingDocument.content_type, IMDNDocument.content_type} # Content types to ignore in notifications
__disabled_imdn_content_types__ = {'text/pgp-public-key', 'text/pgp-private-key'}.union(__ignored_content_types__) # Content types to ignore in notifications
__disabled_imdn_content_types__ = {'text/pgp-public-key', 'text/pgp-private-key', 'application/sylk-api-message-remove'}.union(__ignored_content_types__) # Content types to ignore in notifications
def __init__(self, account, contact, content, content_type='text/plain', recipients=None, courtesy_recipients=None, subject=None, timestamp=None, required=None, additional_headers=None, id=None, session=None):
self.lookup = None
......@@ -583,7 +583,7 @@ class RequestList(list):
@implementer(IObserver)
class MessageManager(object, metaclass=Singleton):
__ignored_content_types__ = {IsComposingDocument.content_type, IMDNDocument.content_type, 'text/pgp-public-key', 'text/pgp-private-key'}
__ignored_content_types__ = {IsComposingDocument.content_type, IMDNDocument.content_type, 'text/pgp-public-key', 'text/pgp-private-key', 'application/sylk-message-remove'}
def __init__(self):
self.sessions = []
......@@ -1056,6 +1056,18 @@ class MessageManager(object, metaclass=Singleton):
session_manager = SessionManager()
notification_center = NotificationCenter()
if content_type == 'application/sylk-message-remove':
payload = json.loads(body)
notification_center.post_notification('BlinkGotHistoryMessageRemove', data=payload['message_id'])
try:
blink_session = next(session for session in self.sessions if session.contact.settings is contact.settings)
except StopIteration:
pass
else:
notification_center.post_notification('BlinkMessageWillRemove', sender=blink_session, data=payload['message_id'])
return
timestamp = cpim_message.timestamp if cpim_message is not None and cpim_message.timestamp is not None else ISOTimestamp.now()
if timestamp.tzinfo is tzutc():
timestamp = timestamp.replace(tzinfo=timezone.utc).astimezone(tzlocal())
......
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