Try to not use private entitlements
This commit is contained in:
@@ -8,9 +8,14 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// See note in hooking.m about why this was a bad idea
|
||||
#define HOOK_IMAGENT 0
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MBIMBridge : NSObject
|
||||
@property (nonatomic, assign) const char *dylibPath;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "MBIMBridge.h"
|
||||
#import "MBIMBridgeOperation.h"
|
||||
#import "hooking.h"
|
||||
|
||||
#import <GCDWebServers/GCDWebServers.h>
|
||||
|
||||
@@ -55,14 +56,32 @@ static NSString *const MBIMBridgeToken = @"net.buzzert.kordophone";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_terminate
|
||||
{
|
||||
// *shrug*
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Connection
|
||||
|
||||
- (void)connect
|
||||
{
|
||||
#if HOOK_IMAGENT
|
||||
char *errorString = nil;
|
||||
BOOL hooked = HookIMAgent(self.dylibPath, &errorString);
|
||||
if (!hooked) {
|
||||
NSString *errorNSString = [NSString stringWithUTF8String:errorString];
|
||||
NSLog(@"Error hooking imagent: %@", errorNSString);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (![sDaemonController hasListenerForID: MBIMBridgeToken]) {
|
||||
if (![sDaemonController addListenerID:MBIMBridgeToken capabilities:(kFZListenerCapFileTransfers | kFZListenerCapManageStatus | kFZListenerCapChats | kFZListenerCapMessageHistory | kFZListenerCapIDQueries | kFZListenerCapSendMessages)]) {
|
||||
NSLog(@"Failed to connect to imagent");
|
||||
|
||||
[self _terminate];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,6 +177,7 @@ static NSString *const MBIMBridgeToken = @"net.buzzert.kordophone";
|
||||
NSLog(@"iMessage account connected: %@", iMessageAccount);
|
||||
} else {
|
||||
NSLog(@"imagent returned no accounts (not entitled?)");
|
||||
[self _terminate];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user