LuxChat  2.0
Instant messenger for iOS
Instance Methods | Class Methods | Properties | List of all members
JSQMessage Class Reference

#import <JSQMessage.h>

Inheritance diagram for JSQMessage:
<JSQMessageData>

Instance Methods

(instancetype) - initWithSenderId:senderDisplayName:date:text:
 
(instancetype) - initWithSenderId:senderDisplayName:date:media:
 
- Instance Methods inherited from <JSQMessageData>
(NSString *) - senderId
 
(NSString *) - senderDisplayName
 
(NSDate *) - date
 
(BOOL) - isMediaMessage
 
(NSUInteger) - messageHash
 
(NSString *) - text
 
(id< JSQMessageMediaData >) - media
 

Class Methods

(instancetype) + messageWithSenderId:displayName:text:
 
(instancetype) + messageWithSenderId:displayName:media:
 

Properties

NSString * senderId
 
NSString * senderDisplayName
 
NSDate * date
 
BOOL isMediaMessage
 
NSString * text
 
id< JSQMessageMediaDatamedia
 

Detailed Description

The JSQMessage class is a concrete class for message model objects that represents a single user message. The message can be a text message or media message, depending on how it is initialized. It implements the JSQMessageData protocol and it contains the senderId, senderDisplayName, and the date that the message was sent. If initialized as a media message it also contains a media attachment, otherwise it contains the message text.

Method Documentation

- (instancetype) initWithSenderId: (NSString *)  senderId
senderDisplayName: (NSString *)  senderDisplayName
date: (NSDate *)  date
media: (id<JSQMessageMediaData>)  media 

Initializes and returns a message object having the given senderId, displayName, date, and media.

Parameters
senderIdThe unique identifier for the user who sent the message. This value must not be nil.
senderDisplayNameThe display name for the user who sent the message. This value must not be nil.
dateThe date that the message was sent. This value must not be nil.
mediaThe media data for the message. This value must not be nil.

Initializing a JSQMessage with this method will set isMediaMessage to YES.

Returns
An initialized JSQMessage object if successful, nil otherwise.
- (instancetype) initWithSenderId: (NSString *)  senderId
senderDisplayName: (NSString *)  senderDisplayName
date: (NSDate *)  date
text: (NSString *)  text 

Initializes and returns a message object having the given senderId, senderDisplayName, date, and text.

Parameters
senderIdThe unique identifier for the user who sent the message. This value must not be nil.
senderDisplayNameThe display name for the user who sent the message. This value must not be nil.
dateThe date that the message was sent. This value must not be nil.
textThe body text of the message. This value must not be nil.

Initializing a JSQMessage with this method will set isMediaMessage to NO.

Returns
An initialized JSQMessage object if successful, nil otherwise.
+ (instancetype) messageWithSenderId: (NSString *)  senderId
displayName: (NSString *)  displayName
media: (id<JSQMessageMediaData>)  media 

Initializes and returns a message object having the given senderId, displayName, media, and current system date.

Parameters
senderIdThe unique identifier for the user who sent the message. This value must not be nil.
displayNameThe display name for the user who sent the message. This value must not be nil.
mediaThe media data for the message. This value must not be nil.

Initializing a JSQMessage with this method will set isMediaMessage to YES.

Returns
An initialized JSQMessage object if successful, nil otherwise.
+ (instancetype) messageWithSenderId: (NSString *)  senderId
displayName: (NSString *)  displayName
text: (NSString *)  text 

Initializes and returns a message object having the given senderId, displayName, text, and current system date.

Parameters
senderIdThe unique identifier for the user who sent the message. This value must not be nil.
displayNameThe display name for the user who sent the message. This value must not be nil.
textThe body text of the message. This value must not be nil.

Initializing a JSQMessage with this method will set isMediaMessage to NO.

Returns
An initialized JSQMessage object if successful, nil otherwise.

Property Documentation

- (NSDate*) date
readnonatomiccopy

Returns the date that the message was sent.

- (BOOL) isMediaMessage
readnonatomicassign

Returns a boolean value specifying whether or not the message contains media. If NO, the message contains text. If YES, the message contains media. The value of this property depends on how the object was initialized.

- (id<JSQMessageMediaData>) media
readnonatomiccopy

Returns the media item attachment of the message, or nil if the message is not a media message. That is, if isMediaMessage is equal to NO then this value will be nil.

- (NSString*) senderDisplayName
readnonatomiccopy

Returns the display name for the user who sent the message. This value does not have to be unique.

- (NSString*) senderId
readnonatomiccopy

Returns the string identifier that uniquely identifies the user who sent the message.

- (NSString*) text
readnonatomiccopy

Returns the body text of the message, or nil if the message is a media message. That is, if isMediaMessage is equal to YES then this value will be nil.


The documentation for this class was generated from the following files: