Private
Public Access
1
0

sendMessage: return guid after sending. This guid is stable

This commit is contained in:
James Magahern
2023-12-05 15:41:07 -08:00
parent b92c683a0e
commit 87d65e294b

View File

@@ -19,9 +19,9 @@
return @"sendMessage";
}
- (BOOL)_sendMessage:(NSString *)messageBody toChatWithGUID:(NSString *)chatGUID attachmentGUIDs:(NSArray<NSString *> *)guids
- (IMMessage *)_sendMessage:(NSString *)messageBody toChatWithGUID:(NSString *)chatGUID attachmentGUIDs:(NSArray<NSString *> *)guids
{
__block BOOL result = YES;
__block IMMessage *result = nil;
dispatch_sync([[self class] sharedIMAccessQueue], ^{
IMChat *chat = [[IMChatRegistry sharedInstance] existingChatWithGUID:chatGUID];
@@ -44,8 +44,9 @@
if (!chat) {
MBIMLogInfo(@"Chat does not exist: %@", chatGUID);
result = NO;
} else {
result = reply;
dispatch_async(dispatch_get_main_queue(), ^{
[chat sendMessage:reply];
});
@@ -78,9 +79,11 @@
transferGUIDs = @[];
}
BOOL result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
IMMessage *result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
if (result) {
response = [[HTTPErrorResponse alloc] initWithErrorCode:200];
response = [MBIMJSONDataResponse responseWithJSONObject:@{
@"guid" : [result guid]
}];
}
self.serverCompletionBlock(response);