1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Telegraph/TGContactListSearchActor.m
2014-07-10 18:11:09 +04:00

33 lines
818 B
Objective-C

#import "TGContactListSearchActor.h"
#import "ActionStage.h"
#import "SGraphObjectNode.h"
#import "TGDatabase.h"
@implementation TGContactListSearchActor
+ (NSString *)genericPath
{
return @"/tg/contacts/search/@";
}
- (void)execute:(NSDictionary *)options
{
NSString *query = [options objectForKey:@"query"];
if (query == nil)
{
[ActionStageInstance() nodeRetrieveFailed:self.path];
return;
}
int ignoreUid = [[options objectForKey:@"ignoreUid"] intValue];
[TGDatabaseInstance() searchContacts:query ignoreUid:ignoreUid searchPhonebook:[[options objectForKey:@"searchPhonebook"] boolValue] completion:^(NSDictionary *result)
{
[ActionStageInstance() nodeRetrieved:self.path node:[[SGraphObjectNode alloc] initWithObject:result]];
}];
}
@end