mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-25 04:16:58 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
42 lines
1.7 KiB
Objective-C
42 lines
1.7 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
#import "XPC_Service.h"
|
|
|
|
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
|
|
@end
|
|
|
|
@implementation ServiceDelegate
|
|
|
|
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
|
|
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
|
|
|
|
// Configure the connection.
|
|
// First, set the interface that the exported object implements.
|
|
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPC_ServiceProtocol)];
|
|
|
|
// Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object.
|
|
XPC_Service *exportedObject = [XPC_Service new];
|
|
newConnection.exportedObject = exportedObject;
|
|
|
|
// Resuming the connection allows the system to deliver more incoming messages.
|
|
[newConnection resume];
|
|
|
|
// Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO.
|
|
return YES;
|
|
}
|
|
|
|
@end
|
|
|
|
int main(int argc, const char *argv[])
|
|
{
|
|
// Create the delegate for the service.
|
|
ServiceDelegate *delegate = [ServiceDelegate new];
|
|
|
|
// Set up the one NSXPCListener for this service. It will handle all incoming connections.
|
|
NSXPCListener *listener = [NSXPCListener serviceListener];
|
|
listener.delegate = delegate;
|
|
|
|
// Resuming the serviceListener starts this service. This method does not return.
|
|
[listener resume];
|
|
return 0;
|
|
}
|