conversation: fix incoming call
Change-Id: Id503ab366006f30e76ff718deef1fc3214e50c80
diff --git a/src/CurrentCallVC.mm b/src/CurrentCallVC.mm
index 30428d3..d0022cf 100644
--- a/src/CurrentCallVC.mm
+++ b/src/CurrentCallVC.mm
@@ -159,10 +159,7 @@
callUid_ = callUid;
convUid_ = convUid;
accountInfo_ = account;
- auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel, true);
- if (!conversationExists(convIt, *accountInfo_->conversationModel.get(), true)) {
- return;
- }
+ auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel);
confUid_ = convIt->confId;
[self.chatVC setConversationUid:convUid model:account->conversationModel.get()];
[self connectSignals];
@@ -200,7 +197,7 @@
QObject::connect(accountInfo_->contactModel.get(),
&lrc::api::ContactModel::contactAdded,
[self](const QString &contactUri) {
- auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel.get(), false);
+ auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel.get());
if (convIt == accountInfo_->conversationModel->allFilteredConversations().end()) {
return;
}
@@ -319,9 +316,8 @@
}
auto currentCall = callModel->getCall(callUid_);
- NSLog(@"\n status %@ \n",lrc::api::call::to_string(currentCall.status).toNSString());
- auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel, true);
- if (conversationExists(convIt, *accountInfo_->conversationModel, true)) {
+ auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel);
+ if (conversationExists(convIt, *accountInfo_->conversationModel)) {
NSString* bestName = bestNameForConversation(*convIt, *accountInfo_->conversationModel);
[contactNameLabel setStringValue:bestName];
NSString* ringID = bestIDForConversation(*convIt, *accountInfo_->conversationModel);
@@ -331,7 +327,6 @@
[contactIdLabel setStringValue:ringID];
}
[self setupContactInfo:contactPhoto];
-
confUid_ = convIt->confId;
[muteAudioButton setHidden:!confUid_.isEmpty()];
[muteVideoButton setHidden:!confUid_.isEmpty()];
@@ -491,7 +486,7 @@
-(NSImage *) getContactImageOfSize: (double) size withDefaultAvatar:(BOOL) shouldDrawDefault {
auto* convModel = accountInfo_->conversationModel.get();
- auto convIt = getConversationFromUid(convUid_, *convModel, false);
+ auto convIt = getConversationFromUid(convUid_, *convModel);
if (convIt == convModel->allFilteredConversations().end()) {
return nil;
}
@@ -818,12 +813,8 @@
return;
// If we accept a conversation with a non trusted contact, we first accept it
- auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel.get(), true);
- if (!conversationExists(convIt,*accountInfo_->conversationModel.get(), true)) {
- return;
- }
-
- if (convIt == accountInfo_->conversationModel->allFilteredConversations().end()) {
+ auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel.get());
+ if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) {
auto& contact = accountInfo_->contactModel->getContact(convIt->participants[0]);
if (contact.profileInfo.type == lrc::api::profile::Type::PENDING)
accountInfo_->conversationModel->makePermanent(convUid_);