Skip to content

Commit 3c9ab79

Browse files
Auto-inititate OTR when contact comes online
1 parent fb8b900 commit 3c9ab79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ChatSecure/Classes/View Controllers/OTRMessagesViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,13 @@ - (void)updateViewWithKey:(NSString *)key colleciton:(NSString *)collection
312312
}
313313

314314
// Update Buddy Status
315+
BOOL previousState = self.state.isThreadOnline;
315316
self.state.isThreadOnline = buddy.status != OTRThreadStatusOffline;
317+
318+
// Auto-inititate OTR when contact comes online
319+
if (!previousState && self.state.isThreadOnline) {
320+
[[OTRProtocolManager sharedInstance].encryptionManager maybeRefreshOTRSessionForBuddyKey:key collection:collection];
321+
}
316322
[self didUpdateState];
317323

318324
//Update Buddy knock status

0 commit comments

Comments
 (0)