From ab088706776ff7f136dcd94b75b02e1c7b2664c3 Mon Sep 17 00:00:00 2001 From: ylecollen Date: Tue, 27 Jan 2015 08:36:21 +0100 Subject: [PATCH] The local contacts section does not contain anymore the "unknown" matrix users --- .../matrixConsole/API/ContactManager.m | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/matrixConsole/matrixConsole/API/ContactManager.m b/matrixConsole/matrixConsole/API/ContactManager.m index 39b1660f0..1224d4d31 100644 --- a/matrixConsole/matrixConsole/API/ContactManager.m +++ b/matrixConsole/matrixConsole/API/ContactManager.m @@ -218,10 +218,7 @@ static ContactManager* sharedContactManager = nil; // update with the known dict 3PID -> matrix ID [self updateMatrixIDDeviceContactsList]; - // build a merged contacts list until the 3PIDs lookups are performed - NSMutableArray* mergedContactsList = [deviceContactsList mutableCopy]; - [self mergeMXUsers:mergedContactsList]; - tmpContacts = mergedContactsList; + tmpContacts = [deviceContactsList mutableCopy]; } lastSyncDate = [NSDate date]; @@ -232,10 +229,8 @@ static ContactManager* sharedContactManager = nil; // refresh the 3PIDS -> matrix IDs [self refreshMatrixIDs]; #else - // add the MX users - NSMutableArray* tmpContacts = [deviceContactsList mutableCopy]; - [self mergeMXUsers:tmpContacts]; - contacts = tmpContacts; + // nop + // wait that refreshContactMatrixIDs is called #endif // at least, display the known contacts @@ -277,30 +272,6 @@ static ContactManager* sharedContactManager = nil; } } -// merge the knowns MXUsers with the contacts list -// return the number of modified / added contacts -- (int) mergeMXUsers:(NSMutableArray*)contactsList { - // check if the some room users are not defined in the local contacts book - MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler]; - - // check if the user is already known - NSArray* users = [mxHandler.mxSession users]; - NSArray* knownUserIDs = [matrixIDBy3PID allValues]; - - int count = 0; - - for(MXUser* user in users) { - if (!knownUserIDs || [knownUserIDs indexOfObject:user.userId] == NSNotFound) { - MXCContact* contact = [[MXCContact alloc] initWithDisplayName:(user.displayname ? user.displayname : user.userId) matrixID:user.userId]; - [matrixContactByMatrixUserID setValue:contact forKey:user.userId]; - [contactsList addObject:contact]; - count++; - } - } - - return count; -} - #ifdef CONTACTS_3PIDS_SYNC // refresh the 3PIDs -> Matrix ID list // update the contact is required