BMXMessageObject Class Reference

Inherits from NSObject
Declared in BMXMessageObject.h

Properties

attachment

@property (nonatomic, strong, readonly) BMXMessageAttachment *attachment

clientMsgId

@property (nonatomic, assign, readonly) long long clientMsgId

clientTimestamp

@property (nonatomic, assign) long long clientTimestamp

content

@property (nonatomic, copy) NSString *content

contentType

@property (nonatomic, assign) BMXContentType contentType

conversationId

@property (nonatomic, assign) long long conversationId

deliverystatus

@property (nonatomic, assign) BMXDeliveryStatus deliverystatus

extensionJson

@property (nonatomic, copy) NSString *extensionJson

fromId

@property (nonatomic, assign, readonly) long long fromId

groupAckCount

@property (nonatomic, assign) int groupAckCount

isDeliveryAcked

@property (nonatomic, assign) BOOL isDeliveryAcked

isPlayed

@property (nonatomic, assign) BOOL isPlayed

isRead

@property (nonatomic, assign) BOOL isRead

isReadAcked

@property (nonatomic, assign) BOOL isReadAcked

isReceiveMsg

@property (nonatomic, assign) BOOL isReceiveMsg

messageType

@property (nonatomic, assign, readonly) BMXMessageType messageType

messageconfig

@property (nonatomic, strong) BMXMessageConfig *messageconfig

msgId

@property (nonatomic, assign, readonly) long long msgId

qos

@property (nonatomic, assign) DeliveryQosMode qos

senderName

@property (nonatomic, copy) NSString *senderName

serverTimestamp

@property (nonatomic, assign, readonly) long long serverTimestamp

toId

@property (nonatomic, assign, readonly) long long toId

Instance Methods

initWithBMXCommandMessageText:fromId:toId:type:conversationId:

Create a sent command message (command message holds command information in a content field or an extension field)

- (instancetype)initWithBMXCommandMessageText:(NSString *)*content* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId*

Parameters

content
Message content

fromId
Message sender

toId
Message receiver

mtype
Message type

conversationId
Conversation id

Discussion

Create a sent command message (command message holds command information in a content field or an extension field)

Declared In

  • BMXMessageObject.h

Example:

initWithBMXMessageAttachment:fromId:toId:type:conversationId:

Create attachment-message

- (instancetype)initWithBMXMessageAttachment:(BMXMessageAttachment *)*attachment* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId*

Parameters

attachment
BMXMessageAttachment

fromId
Send id

toId
Receive id

mtype
Message type

conversationId
Conversation id

Return Value

BMXMessageObject

Discussion

Create attachment-message

Declared In

  • BMXMessageObject.h

Example:

alertView.btnClickBlock = ^{
        
    UIImage *image = contentImg;
    NSData *imageData = UIImageJPEGRepresentation(image,1.0f);
    NSData *thumImageData =  UIImageJPEGRepresentation(image,1.0f);
    BMXImageAttachment *imageAttachment = [[BMXImageAttachment alloc] initWithData:imageData thumbnailData:thumImageData imageSize:image.size conversationId:[NSString stringWithFormat:@"%lld",group.groupId]];
    imageAttachment.pictureSize = CGSizeMake(image.size.width, image.size.height);
    IMAcount *account = [IMAcountInfoStorage loadObject];
    BMXMessageObject *messageObject = [[BMXMessageObject alloc] initWithBMXMessageAttachment:imageAttachment fromId:[account.usedId longLongValue] toId:group.groupId type:BMXMessageTypeGroup conversationId:group.groupId];
- (BMXMessageObject *)configMessage:(id)message {
    BMXMessageObject *messageObject;
    NSInteger toId = 0;
    NSInteger conversationId = self.conversationId;
    if (self.messageType == BMXMessageTypeSingle) {
        toId = self.currentRoster.rosterId;
    }else {
        toId = self.currentGroup.groupId;
    }
    
    if ([message isKindOfClass:[NSString class]]) {
        messageObject = [[BMXMessageObject alloc] initWithBMXMessageText:message
                                                                  fromId:[self.account.usedId longLongValue]
                                                                    toId:toId
                                                                    type:self.messageType
                                                          conversationId:conversationId];

    }else {
        messageObject = [[BMXMessageObject alloc] initWithBMXMessageAttachment:message
alertView.btnClickBlock = ^{
        
        UIImage *image = contentImg;
        NSData *imageData = UIImageJPEGRepresentation(image,1.0f);
        NSData *thumImageData =  UIImageJPEGRepresentation(image,1.0f);
        BMXImageAttachment *imageAttachment = [[BMXImageAttachment alloc] initWithData:imageData thumbnailData:thumImageData imageSize:image.size conversationId:[NSString stringWithFormat:@"%lld",roster.rosterId]];
        imageAttachment.pictureSize = CGSizeMake(image.size.width, image.size.height);
        IMAcount *account = [IMAcountInfoStorage loadObject];
    BMXMessageObject *messageObject = [[BMXMessageObject alloc] initWithBMXMessageAttachment:imageAttachment fromId:[account.usedId longLongValue] toId:roster.rosterId type:BMXMessageTypeSingle conversationId:roster.rosterId];

initWithBMXMessageText:fromId:toId:type:conversationId:

Create text message

- (instancetype)initWithBMXMessageText:(NSString *)*content* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId*

Parameters

content
Content

fromId
Send id

toId
Receive id

mtype
Message type

conversationId
Conversation id

Return Value

BMXMessageObject

Discussion

Create text message

Declared In

  • BMXMessageObject.h

Example:

- (void)sendTypingMessage:(NSDictionary *)configdic {
    BMXMessageObject *messageObject = [[BMXMessageObject alloc] initWithBMXMessageText:@""
- (BMXMessageObject *)configMessage:(id)message {
    BMXMessageObject *messageObject;
    NSInteger toId = 0;
    NSInteger conversationId = self.conversationId;
    if (self.messageType == BMXMessageTypeSingle) {
        toId = self.currentRoster.rosterId;
    }else {
        toId = self.currentGroup.groupId;
    }
    
    if ([message isKindOfClass:[NSString class]]) {
        messageObject = [[BMXMessageObject alloc] initWithBMXMessageText:message

initWithForwardMessage:fromId:toId:type:conversationId:

Create a forwarding message

- (instancetype)initWithForwardMessage:(BMXMessageObject *)*message* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId*

Parameters

message
BMXMessageObject

fromId
Send id

toId
Receive id

mtype
Message type

conversationId
Conversation id

Return Value

BMXMessageObject

Discussion

Create a forwarding message

Declared In

  • BMXMessageObject.h

Example:

- (void)transterSlectedGroup:(BMXGroup *)group {
    BMXMessageObject *m = [[BMXMessageObject alloc] initWithForwardMessage:self.currentMessage.messageObjc fromId:[self.account.usedId longLongValue] toId:group.groupId type:BMXMessageTypeGroup conversationId:group.groupId];
- (void)groupOwnerTransterVCdidSelect:(id)toModel {
    BMXRoster *roster = toModel;
    BMXMessageObject *m = [[BMXMessageObject alloc] initWithForwardMessage:self.currentMessage.messageObjc fromId:[self.account.usedId longLongValue] toId:roster.rosterId type:BMXMessageTypeSingle conversationId:roster.rosterId];

initWithRecieveBMXMessageAttachment:msgId:fromId:toId:type:conversationId:timeStamp:

Create receive attachment-message

- (instancetype)initWithRecieveBMXMessageAttachment:(BMXMessageAttachment *)*attachment* msgId:(long long)*msgId* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId* timeStamp:(long long)*timeStamp*

Parameters

attachment
BMXMessageAttachment

msgId
Message id

fromId
Send id

toId
Receive id

mtype
Message type

conversationId
Conversation id

timeStamp
Timestamp

Return Value

BMXMessageObject

Discussion

Create receive attachment-message

Declared In

  • BMXMessageObject.h

Example:

initWithRecieveBMXMessageCommandMessageText:msgId:fromId:toId:type:conversationId:timeStamp:

Create a received command message (command message holds command information in a content field or an extension field)

- (instancetype)initWithRecieveBMXMessageCommandMessageText:(NSString *)*content* msgId:(long long)*msgId* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId* timeStamp:(long long)*timeStamp*

Parameters

content
Message content

msgId
Message id

fromId
Message sender

toId
Message receiver

mtype
Message type

conversationId
Conversation id

timeStamp
Server timestamp

Discussion

Create a received command message (command message holds command information in a content field or an extension field)

Declared In

  • BMXMessageObject.h

Example:

initWithRecieveBMXMessageText:msgId:fromId:toId:type:conversationId:timeStamp:

Create receive text-message

- (instancetype)initWithRecieveBMXMessageText:(NSString *)*content* msgId:(long long)*msgId* fromId:(long long)*fromId* toId:(long long)*toId* type:(BMXMessageType)*mtype* conversationId:(long long)*conversationId* timeStamp:(long long)*timeStamp*

Parameters

content
Content

msgId
Message id

fromId
Send id

toId
Receive id

mtype
Message type

conversationId
Conversation id

timeStamp
Timestamp

Return Value

BMXMessageObject

Discussion

Create receive text-message

Declared In

  • BMXMessageObject.h

Example:

© 2019-2023 MaximTop | Homepage Last modified time: 2022-09-21 11:43:07

results matching ""

    No results matching ""