From a93537c80293303d4e266b2d1d2489da93d3dad3 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 23 Feb 2018 10:10:59 +0100 Subject: [PATCH] fix incoming imdn message mgt --- Classes/ChatConversationView.m | 5 ++++- Classes/LinphoneManager.m | 8 ++++---- Classes/Utils/Utils.h | 1 + Classes/Utils/Utils.m | 7 +++++++ submodules/linphone | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 68d338220..8bfc855fc 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -751,7 +751,10 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event_log); if (!chat) return; - + + if (!linphone_chat_message_is_file_transfer(chat) && !linphone_chat_message_is_text(chat)) /*probably an imdn*/ + return; + const LinphoneAddress *from = linphone_chat_message_get_from_address(chat); if (!from) return; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 92a8c5b69..4f290fd18 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2143,8 +2143,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { LOGW(@"Call cannot be paused any more, too late"); [[UIApplication sharedApplication] endBackgroundTask:pausedCallBgTask]; }]; - LOGI(@"Long running task started, remaining [%g s] because at least one call is paused", - [[UIApplication sharedApplication] backgroundTimeRemaining]); + LOGI(@"Long running task started, remaining [%@ s] because at least one call is paused", + [LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]); } - (void)startPushLongRunningTask:(NSString *)loc_key callId:(NSString *)callId { @@ -2177,8 +2177,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { [[UIApplication sharedApplication] endBackgroundTask:pushBgTaskMsg]; pushBgTaskMsg = 0; }]; - LOGI(@"Message long running task started for call-id [%@], remaining [%g s] because a push has been received", - callId, [[UIApplication sharedApplication] backgroundTimeRemaining]); + LOGI(@"Message long running task started for call-id [%@], remaining [%@ s] because a push has been received", + callId, [LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]); } else if ([loc_key isEqualToString:@"IC_MSG"]) { [[UIApplication sharedApplication] endBackgroundTask:pushBgTaskCall]; pushBgTaskCall = 0; diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index fde7484e5..97e1bacad 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -47,6 +47,7 @@ typedef enum { + (UIImage *)selfAvatar; + (NSString *)durationToString:(int)duration; ++ (NSString *)intervalToString:(NSTimeInterval)interval ; @end diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index c5a0509e9..50399ea83 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -1,3 +1,4 @@ + /* Utils.m * * Copyright (C) 2012 Belledonne Comunications, Grenoble, France @@ -72,6 +73,12 @@ return [result stringByAppendingString:[NSString stringWithFormat:@"%02i:%02i", (duration / 60), (duration % 60)]]; } ++ (NSString *) intervalToString:(NSTimeInterval)interval { + NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init]; + formatter.allowedUnits = NSCalendarUnitSecond; + return [formatter stringFromTimeInterval:interval]; +} + + (NSString *)timeToString:(time_t)time withFormat:(LinphoneDateFormat)format { NSString *formatstr; NSDate *todayDate = [[NSDate alloc] init]; diff --git a/submodules/linphone b/submodules/linphone index fbdca469c..6da095454 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit fbdca469c73c07fe07b4129950274120ccc5979a +Subproject commit 6da095454c91f0e7bf2c67fcfda965a4f2a681cc