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:

创建发送命令消息(命令消息通过content字段或者extension字段存放命令信息)

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

Parameters

content
消息内容

fromId
消息发送者

toId
消息接收者

mtype
消息类型

conversationId
会话id

Discussion

创建发送命令消息(命令消息通过content字段或者extension字段存放命令信息)

Declared In

  • BMXMessageObject.h

Example:

initWithBMXMessageAttachment:fromId:toId:type:conversationId:

创建附件消息

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

Parameters

attachment
BMXMessageAttachment

fromId
发送id

toId
接收id

mtype
消息类型

conversationId
会话id

Return Value

BMXMessageObject

Discussion

创建附件消息

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:

创建文本消息

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

Parameters

content
内容

fromId
发送id

toId
接收id

mtype
消息类型

conversationId
会话id

Return Value

BMXMessageObject

Discussion

创建文本消息

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:

创建转发消息

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

Parameters

message
BMXMessageObject

fromId
发送id

toId
接收id

mtype
消息类型

conversationId
会话id

Return Value

BMXMessageObject

Discussion

创建转发消息

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:

创建接收附件消息

- (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
消息id

fromId
发送id

toId
接收id

mtype
消息类型

conversationId
会话id

timeStamp
时间戳

Return Value

BMXMessageObject

Discussion

创建接收附件消息

Declared In

  • BMXMessageObject.h

Example:

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

创建收到的命令消息(命令消息通过content字段或者extension字段存放命令信息)

- (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
消息内容

msgId
消息id

fromId
消息发送者

toId
消息接收者

mtype
消息类型

conversationId
会话id

timeStamp
服务器时间戳

Discussion

创建收到的命令消息(命令消息通过content字段或者extension字段存放命令信息)

Declared In

  • BMXMessageObject.h

Example:

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

创建接收文本消息

- (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
内容

msgId
消息id

fromId
发送id

toId
接收id

mtype
消息类型

conversationId
会话id

timeStamp
时间戳

Return Value

BMXMessageObject

Discussion

创建接收文本消息

Declared In

  • BMXMessageObject.h

Example:

© 2019-2023 美信拓扑 | 官网 该文件修订时间: 2022-09-21 11:43:07

results matching ""

    No results matching ""