// // MBIMConversationListOperation.m // kordophoned // // Created by James Magahern on 11/13/18. // Copyright © 2018 James Magahern. All rights reserved. // #import "MBIMConversationListOperation.h" #import @implementation MBIMConversationListOperation + (void)load { [super load]; } + (NSString *)endpointName { return @"conversations"; } - (void)main { NSArray *chats = [sChatRegistry allExistingChats]; NSMutableArray *conversations = [NSMutableArray array]; for (IMChat *chat in chats) { NSMutableDictionary *chatDict = [NSMutableDictionary dictionary]; chatDict[@"guid"] = [chat guid]; chatDict[@"displayName"] = [chat displayName]; chatDict[@"date"] = GCDWebServerFormatRFC822([chat lastFinishedMessageDate]); [conversations addObject:chatDict]; } GCDWebServerResponse *response = [GCDWebServerDataResponse responseWithJSONObject:conversations]; self.serverCompletionBlock(response); } @end