Updates to sending and message sequences
This commit is contained in:
17
kordophone/Categories/IMChat+Encoded.h
Normal file
17
kordophone/Categories/IMChat+Encoded.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// IMChat+Encoded.h
|
||||
// kordophoned
|
||||
//
|
||||
// Created by James Magahern on 11/19/18.
|
||||
// Copyright © 2018 James Magahern. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IMCore/IMCore.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface IMChat (Encoded)
|
||||
- (NSDictionary *)mbim_dictionaryRepresentation;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
40
kordophone/Categories/IMChat+Encoded.m
Normal file
40
kordophone/Categories/IMChat+Encoded.m
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// IMChat+Encoded.m
|
||||
// kordophoned
|
||||
//
|
||||
// Created by James Magahern on 11/19/18.
|
||||
// Copyright © 2018 James Magahern. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IMChat+Encoded.h"
|
||||
#import "MBIMHTTPUtilities.h"
|
||||
|
||||
@implementation IMChat (Encoded)
|
||||
|
||||
- (NSDictionary *)mbim_dictionaryRepresentation
|
||||
{
|
||||
NSMutableDictionary *chatDict = [NSMutableDictionary dictionary];
|
||||
chatDict[@"guid"] = [self guid];
|
||||
chatDict[@"displayName"] = [self displayName];
|
||||
chatDict[@"date"] = MBIMWebServerFormatISO8601([self lastFinishedMessageDate]);
|
||||
chatDict[@"unreadCount"] = @([self unreadMessageCount]);
|
||||
|
||||
IMMessage *lastMessage = [self lastMessage];
|
||||
if (lastMessage) {
|
||||
chatDict[@"lastMessagePreview"] = [[lastMessage text] string];
|
||||
}
|
||||
|
||||
NSMutableArray *participantStrings = [NSMutableArray array];
|
||||
for (IMHandle *participantHandle in self.participants) {
|
||||
NSString *participantString = [participantHandle displayNameForChat:self];
|
||||
if (participantString) {
|
||||
[participantStrings addObject:participantString];
|
||||
}
|
||||
}
|
||||
|
||||
chatDict[@"participantDisplayNames"] = participantStrings;
|
||||
|
||||
return chatDict;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
NSMutableDictionary *messageDict = [NSMutableDictionary dictionary];
|
||||
messageDict[@"text"] = [[self text] string];
|
||||
messageDict[@"date"] = MBIMWebServerFormatRFC822([self time]);
|
||||
messageDict[@"date"] = MBIMWebServerFormatISO8601([self time]);
|
||||
messageDict[@"sender"] = [[self sender] displayID];
|
||||
|
||||
return messageDict;
|
||||
@@ -29,7 +29,7 @@
|
||||
{
|
||||
NSMutableDictionary *messageDict = [NSMutableDictionary dictionary];
|
||||
messageDict[@"text"] = [[self body] string];
|
||||
messageDict[@"date"] = MBIMWebServerFormatRFC822([self time]);
|
||||
messageDict[@"date"] = MBIMWebServerFormatISO8601([self time]);
|
||||
messageDict[@"sender"] = [self sender];
|
||||
|
||||
return messageDict;
|
||||
|
||||
Reference in New Issue
Block a user