From c65d87e3fc6c2a7a91d129c0958272286bd33c72 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 9 Nov 2018 15:29:52 +0100 Subject: [PATCH] add security event notification --- Classes/LinphoneUI/UIChatNotifiedEventCell.m | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Classes/LinphoneUI/UIChatNotifiedEventCell.m b/Classes/LinphoneUI/UIChatNotifiedEventCell.m index 6b093f8c2..eeb947159 100644 --- a/Classes/LinphoneUI/UIChatNotifiedEventCell.m +++ b/Classes/LinphoneUI/UIChatNotifiedEventCell.m @@ -59,6 +59,7 @@ static const CGFloat NOTIFIED_CELL_HEIGHT = 44; - (void)setEvent:(LinphoneEventLog *)event { _event = event; NSString *eventString; + UIColor *eventColor = [UIColor grayColor]; switch (linphone_event_log_get_type(event)) { case LinphoneEventLogTypeConferenceSubjectChanged: { NSString *subject = [NSString stringWithUTF8String:linphone_event_log_get_subject(event) ?: LINPHONE_DUMMY_SUBJECT]; @@ -93,6 +94,41 @@ static const CGFloat NOTIFIED_CELL_HEIGHT = 44; eventString = [NSString stringWithFormat:NSLocalizedString(@"You have joined the group", nil)]; break; } + case LinphoneEventLogTypeConferenceSecurityEvent: { + LinphoneSecurityEventType type = linphone_event_log_get_security_event_type(event); + NSString *participant = [FastAddressBook displayNameForAddress:linphone_event_log_get_security_event_faulty_device_address(event)]; + switch (type) { + case LinphoneSecurityEventTypeSecurityLevelDowngraded: + if (!participant) + eventString = [NSString stringWithFormat:NSLocalizedString(@"Degradation of security level", nil)]; + else + eventString = [NSString stringWithFormat:NSLocalizedString(@"Degradation of security level from %@", nil),participant]; + eventColor = [UIColor grayColor]; + break; + case LinphoneSecurityEventTypeParticipantMaxDeviceCountExceeded: + if (!participant) + eventString = [NSString stringWithFormat:NSLocalizedString(@"Multidevice detected", nil)]; + else + eventString = [NSString stringWithFormat:NSLocalizedString(@"Multidevice detected from %@", nil),participant]; + eventColor = [UIColor redColor]; + break; + case LinphoneSecurityEventTypeLimeIdentityKeyChanged: + case LinphoneSecurityEventTypeManInTheMiddleDetected: + if (!participant) + eventString = [NSString stringWithFormat:NSLocalizedString(@"Security alert", nil)]; + else + eventString = [NSString stringWithFormat:NSLocalizedString(@"Security alert from %@", nil),participant]; + eventColor = [UIColor redColor]; + break; + + case LinphoneSecurityEventTypeNone: + default: + break; + } + + break; + } + default: return; }