chatsecureios / ChatSecure / Classes / Controllers / XMPP / OTRXMPPManager.h @ 8d76e2e3
History | View | Annotate | Download (5.01 KB)
| 1 |
//
|
|---|---|
| 2 |
// OTRXMPPManager.h
|
| 3 |
// Off the Record
|
| 4 |
//
|
| 5 |
// Created by Chris Ballinger on 9/7/11.
|
| 6 |
// Copyright (c) 2011 Chris Ballinger. All rights reserved.
|
| 7 |
//
|
| 8 |
// This file is part of ChatSecure.
|
| 9 |
//
|
| 10 |
// ChatSecure is free software: you can redistribute it and/or modify
|
| 11 |
// it under the terms of the GNU General Public License as published by
|
| 12 |
// the Free Software Foundation, either version 3 of the License, or
|
| 13 |
// (at your option) any later version.
|
| 14 |
//
|
| 15 |
// ChatSecure is distributed in the hope that it will be useful,
|
| 16 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 17 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 18 |
// GNU General Public License for more details.
|
| 19 |
//
|
| 20 |
// You should have received a copy of the GNU General Public License
|
| 21 |
// along with ChatSecure. If not, see <http://www.gnu.org/licenses/>.
|
| 22 |
|
| 23 |
@import Foundation;
|
| 24 |
@import UIKit;
|
| 25 |
@import XMPPFramework;
|
| 26 |
#import "OTRXMPPBuddy.h" |
| 27 |
#import "OTRIncomingMessage.h" |
| 28 |
#import "OTROutgoingMessage.h" |
| 29 |
#import "OTRProtocol.h" |
| 30 |
#import "OTRConstants.h" |
| 31 |
#import "OTRServerCapabilities.h" |
| 32 |
#import "OTRXMPPRoomManager.h" |
| 33 |
|
| 34 |
@class OTRXMPPAccount;
|
| 35 |
@class OTROMEMOSignalCoordinator;
|
| 36 |
@class XMPPPushModule, ServerCheck, FileTransferManager, MessageStorage;
|
| 37 |
|
| 38 |
NS_ASSUME_NONNULL_BEGIN |
| 39 |
NS_SWIFT_NAME(XMPPManager) |
| 40 |
@interface OTRXMPPManager : NSObject <XMPPRosterDelegate, XMPPStreamDelegate, NSFetchedResultsControllerDelegate, OTRProtocol>
|
| 41 |
|
| 42 |
@property (nonatomic, strong, readonly) OTRXMPPAccount *account;
|
| 43 |
|
| 44 |
@property (nonatomic, strong, readonly) XMPPRoster *xmppRoster;
|
| 45 |
@property (nonatomic, strong, readonly) XMPPCapabilities *xmppCapabilities;
|
| 46 |
@property (nonatomic, strong, readonly) OTRXMPPRoomManager *roomManager;
|
| 47 |
@property (nonatomic, strong, nullable) OTROMEMOSignalCoordinator *omemoSignalCoordinator;
|
| 48 |
@property (nonatomic, strong, readonly) OTRServerCapabilities *serverCapabilities;
|
| 49 |
@property (nonatomic, strong, readonly) XMPPPushModule *xmppPushModule;
|
| 50 |
@property (nonatomic, strong, readonly) ServerCheck *serverCheck;
|
| 51 |
@property (nonatomic, strong, readonly) FileTransferManager *fileTransferManager;
|
| 52 |
@property (nonatomic, strong, readonly) YapDatabaseConnection *databaseConnection;
|
| 53 |
@property (nonatomic, strong, readonly) MessageStorage *messageStorage;
|
| 54 |
|
| 55 |
|
| 56 |
/** Useful for showing error messages related to connection, like SSL certs. Only safe for access from main queue. */
|
| 57 |
@property (nonatomic, readonly, nullable) NSError *lastConnectionError;
|
| 58 |
|
| 59 |
/** Call this if you want to register a new account on a compatible server */
|
| 60 |
- (BOOL)startRegisteringNewAccount; |
| 61 |
|
| 62 |
|
| 63 |
//Chat State
|
| 64 |
- (void)sendChatState:(OTRChatState)chatState withBuddyID:(NSString *)buddyUniqueId;
|
| 65 |
- (void)restartPausedChatStateTimerForBuddyObjectID:(NSString *)buddyUniqueId;
|
| 66 |
- (void)restartInactiveChatStateTimerForBuddyObjectID:(NSString *)buddyUniqueId;
|
| 67 |
- (void)invalidatePausedChatStateTimerForBuddyUniqueId:(NSString *)buddyUniqueId;
|
| 68 |
- (void)sendPausedChatState:(NSTimer *)timer;
|
| 69 |
- (void)sendInactiveChatState:(NSTimer *)timer;
|
| 70 |
- (NSTimer *)inactiveChatStateTimerForBuddyObjectID:(NSString *)buddyUniqueId; |
| 71 |
- (NSTimer *)pausedChatStateTimerForBuddyObjectID:(NSString *)buddyUniqueId; |
| 72 |
|
| 73 |
// Delivery receipts
|
| 74 |
- (void) sendDeliveryReceiptForMessage:(OTRIncomingMessage*)message;
|
| 75 |
|
| 76 |
/**
|
| 77 |
This updates the avatar for this managers account. It is async and will call the completion block immediately if newImage is nil.
|
| 78 |
The best way to check for changes is to listen for Yap Database changes on the account object.
|
| 79 |
The completion block is called once the image is uploaded and the server responds.
|
| 80 |
*/
|
| 81 |
- (void)setAvatar:(UIImage *)newImage completion:(void (^ _Nullable)(BOOL success))completion; |
| 82 |
|
| 83 |
/** Force a vCard update (by manipulating pixel values in the avatar image)
|
| 84 |
*/
|
| 85 |
- (void)forcevCardUpdateWithCompletion:(void (^)(BOOL success))completion; |
| 86 |
|
| 87 |
- (void)changePassword:(NSString *)newPassword completion:(void (^)(BOOL,NSError*))completion; |
| 88 |
|
| 89 |
/** Will try to send a probe to fetch last seen. If buddy is still pendingApproval it will retry subscription request. */
|
| 90 |
- (void) sendPresenceProbeForBuddy:(OTRXMPPBuddy*)buddy;
|
| 91 |
|
| 92 |
/** Will send an away presence with your last idle timestamp */
|
| 93 |
- (void) goAway;
|
| 94 |
|
| 95 |
/** Will send an available presence */
|
| 96 |
- (void) goOnline;
|
| 97 |
|
| 98 |
/** Enqueues a message to be sent by message queue */
|
| 99 |
- (void) enqueueMessage:(id<OTRMessageProtocol>)message;
|
| 100 |
|
| 101 |
/** Enqueues an array of messages to be sent by message queue */
|
| 102 |
- (void) enqueueMessages:(NSArray<id<OTRMessageProtocol>>*)messages;
|
| 103 |
|
| 104 |
@end
|
| 105 |
|
| 106 |
|
| 107 |
/**
|
| 108 |
This notification is sent every time there is a change in the login status and if it goes 'backwards' there
|
| 109 |
should be an error or a user initiated disconnect.
|
| 110 |
|
| 111 |
@{
|
| 112 |
OTRXMPPOldLoginStatusKey : @(OTRLoginStatus)
|
| 113 |
OTRXMPPNewLoginStatusKey : @(OTRLoginStatus)
|
| 114 |
OTRXMPPLoginErrorKey : NSError*
|
| 115 |
}
|
| 116 |
*/
|
| 117 |
extern NSString *const OTRXMPPLoginStatusNotificationName; |
| 118 |
extern NSString *const OTRXMPPOldLoginStatusKey; |
| 119 |
extern NSString *const OTRXMPPNewLoginStatusKey; |
| 120 |
extern NSString *const OTRXMPPLoginErrorKey; |
| 121 |
extern NSString *const OTRXMPPRegisterSucceededNotificationName; |
| 122 |
extern NSString *const OTRXMPPRegisterFailedNotificationName; |
| 123 |
|
| 124 |
NS_ASSUME_NONNULL_END |