File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -585,33 +585,26 @@ -(void) connectAccountWithDictionary:(NSDictionary*) account
585585
586586-(void ) disconnectAccount : (NSNumber *) accountID withExplicitLogout : (BOOL ) explicitLogout
587587{
588- int index = 0 ;
589- int pos = -1 ;
590588 xmpp* account;
591589 @synchronized (_connectedXMPP) {
592590 for (xmpp* xmppAccount in _connectedXMPP)
593- {
594591 if (xmppAccount.accountID .intValue == accountID.intValue )
595592 {
596593 account = xmppAccount;
597- pos=index;
598594 break ;
599595 }
600- index++;
601- }
602-
603- if ((pos >= 0 ) && (pos < (int )[_connectedXMPP count ]))
604- {
605- [_connectedXMPP removeObjectAtIndex: pos];
606- DDLogVerbose (@" removed account at pos %d " , pos);
607- }
608596 }
597+
609598 if (account)
610599 {
611600 DDLogVerbose (@" got account and cleaning up.. " );
612601 [account disconnect: explicitLogout];
613- account = nil ;
614602 DDLogVerbose (@" done cleaning up account " );
603+
604+ @synchronized (_connectedXMPP) {
605+ [_connectedXMPP removeObject: account];
606+ DDLogVerbose (@" removed account from _connectedXMPP" );
607+ }
615608 }
616609}
617610
You can’t perform that action at this time.
0 commit comments