sendMessage: return guid after sending. This guid is stable
This commit is contained in:
@@ -19,9 +19,9 @@
|
|||||||
return @"sendMessage";
|
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], ^{
|
dispatch_sync([[self class] sharedIMAccessQueue], ^{
|
||||||
IMChat *chat = [[IMChatRegistry sharedInstance] existingChatWithGUID:chatGUID];
|
IMChat *chat = [[IMChatRegistry sharedInstance] existingChatWithGUID:chatGUID];
|
||||||
@@ -44,8 +44,9 @@
|
|||||||
|
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
MBIMLogInfo(@"Chat does not exist: %@", chatGUID);
|
MBIMLogInfo(@"Chat does not exist: %@", chatGUID);
|
||||||
result = NO;
|
|
||||||
} else {
|
} else {
|
||||||
|
result = reply;
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[chat sendMessage:reply];
|
[chat sendMessage:reply];
|
||||||
});
|
});
|
||||||
@@ -78,9 +79,11 @@
|
|||||||
transferGUIDs = @[];
|
transferGUIDs = @[];
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
|
IMMessage *result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
|
||||||
if (result) {
|
if (result) {
|
||||||
response = [[HTTPErrorResponse alloc] initWithErrorCode:200];
|
response = [MBIMJSONDataResponse responseWithJSONObject:@{
|
||||||
|
@"guid" : [result guid]
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.serverCompletionBlock(response);
|
self.serverCompletionBlock(response);
|
||||||
|
|||||||
Reference in New Issue
Block a user