|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.skype.ipc.SidObject
com.skype.api.Message
public final class Message
Events in a conversation context are expressed as Messages. It is therefore useful to think of Message objects as events, rather than specifically text chat messages.
Message member functions all return a Boolean indicating the success (true) or failure (false) of processing the request itself (transport, runtime availability, and so forth) - not the success or failure of its associated functionality. For example, Message.Edit returns true if it was able to make a determination, and its result parameter reflects whether this Message can be edited. Similarly, Message.Edit returns false if it was unable to make a determination, and the value of its result parameter is undefined.
Message member functions that are specific to a Message TYPE return false if this Message is not of that type. For example, Message.GetVoiceMessage will return false if this Message's type is not POSTED_VOICE_MESSAGE.
The actual meaning of a Message can be determined by its P_TYPE property. The meanings of most other Message properties depend on the value of P_TYPE. For example, let's take P_BODY_XML property.
Following messages have a text entered by the user as a body. It may contain emoticons, URLs, etc.
- POSTED_TEXT
- POSTED_EMOTE
- SET_METADATA
- REQUESTED_AUTH
Following messages have a custom XML format for the body (see the specific section on these message types for details):
- POSTED_CONTACTS
- POSTED_VOICE_MESSAGE
- POSTED_FILES
- POSTED_SMS
- STARTED_LIVESESSION and ENDED_LIVESESSION (same format)
Following messages do not use the body property:
- SPAWNED_CONFERENCE
- ADDED_CONSUMERS
- ADDED_APPLICANTS
- RETIRED_OTHERS
- RETIRED
- SET_RANK
- HAS_BIRTHDAY
- GRANTED_AUTH
- BLOCKED
Messages such as POSTED_TEXT use a small subset of a HTML-like markup to control the visual representation of the text. This markup is used by POSTED_TEXT and POSTED_EMOTE, but also for the conversation topic (CONVERSATION_META_TOPIC property and the body of the SET_METADATA message) and for authorization requests.
Having chat messages in XML format means that all formatting is indicated by XML tags. This includes emoticons and URls. The big advantage is that it makes the parsing of the message by the UI much easier. The UI does not need to do emoticons or URL detection, this is already done and it only needs to look for the XML tags.
For text messages, it is possible for the UI to simply ignore (meaning strip) the XML and the message will be understandable fine, it will only have lost some formatting.
But it is obviously nicer to display at least the most commonly used tags.
To strip the XML:
- if they have the alt="sometext" attribute set, return sometext as the output of that tag and ignore the rest of tag and all nested sub tags
- if no alt="" attribute set, use tag content as output -
| Nested Class Summary | |
|---|---|
static class |
Message.ConsumptionStatus
Indicates if a message has been consumed (meaning read) or not |
static class |
Message.Leavereason
Indicates the reason a user could not join or left a Conversation. |
static class |
Message.Property
Properties of the Message class |
static class |
Message.SendingStatus
|
static class |
Message.SetMetadataKey
For messages of type SET_METADATA that alert participants to changes to the associated Conversation's metadata, indicates which metadata property changed and its P_BODY_XML property contains the changed data. |
static class |
Message.Type
The P_TYPE property determines the actual meaning of the Message object. |
| Field Summary | |
|---|---|
java.lang.String |
mAuthor
|
java.lang.String |
mAuthorDisplayName
|
java.lang.String |
mBodyXml
|
Message.ConsumptionStatus |
mConsumptionStatus
|
Conversation |
mConversation
|
java.lang.String |
mConvoGuid
|
java.lang.String |
mEditedBy
|
int |
mEditTimestamp
|
byte[] |
mGuid
|
java.lang.String |
mIdentities
|
Skype.LeaveReason |
mLeavereason
|
java.lang.String |
mOriginallyMeantFor
|
int |
mParamKey
|
int |
mParamValue
|
int |
mParticipantCount
|
java.lang.String |
mReason
|
Message.SendingStatus |
mSendingStatus
|
int |
mTimestamp
|
Message.Type |
mType
|
| Fields inherited from class com.skype.ipc.SidObject |
|---|
mSidCached, mSidOid, mSidRoot, mSidTimestamp |
| Constructor Summary | |
|---|---|
Message(int oid,
SidRoot root)
|
|
| Method Summary | |
|---|---|
boolean |
canEdit()
For Message types having a body, determines whether that body is editable by the user. |
void |
deleteLocally()
Deletes this message from the local database. |
void |
edit(java.lang.String newText,
boolean isXml,
boolean undo)
For Message types that include a body and are editable: - alters BODY_XML of the message object - sets EDITED_BY and EDIT_TIMESTAMP properties - propagates the changes to remote users. |
java.lang.String |
getAuthor()
Identity of the sender. |
java.lang.String |
getAuthorDisplayName()
displayname of the sender at the time of posting |
java.lang.String |
getBodyXml()
Message type-specific parameter |
Message.ConsumptionStatus |
getConsumptionStatus()
|
Contact[] |
getContacts()
For messages of type POSTED_CONTACTS, parses the body XML and formats the data as a list of Contact instances. |
Conversation |
getConversation()
DB ID of corresponding conversation |
java.lang.String |
getConvoGuid()
GUID of the Conversation. |
java.lang.String |
getEditedBy()
Identity of the author that last edited this message. |
int |
getEditTimestamp()
UNIX timestamp of last edit |
byte[] |
getGuid()
Unlike the message id, the GUID is the same on all instances and for all participants. |
java.lang.String |
getIdentities()
Message type-specific parameter. |
Skype.LeaveReason |
getLeavereason()
Leave reason for message of the RETIRED type, and STARTED/ENDED_LIVESESSION. |
java.lang.String |
getOriginallyMeantFor()
This property gets set when a conference is spawned from dialog Conversation. |
int |
getParamKey()
Message type-specific parameter. |
int |
getParamValue()
Message type-specific parameter |
int |
getParticipantCount()
Number of people who received this message (including local user) |
java.lang.String |
getPropertyAsString(int prop)
|
java.lang.String |
getPropertyAsString(Message.Property prop)
|
java.lang.String |
getReason()
Message type-specific parameter. |
Message.SendingStatus |
getSendingStatus()
|
Sms |
getSms()
For messages of type POSTED_SMS, parses the body XML and creates an SMS instances * @return sms |
int |
getTimestamp()
UNIX timestamp (sent time, adjusted for local clock) |
Transfer[] |
getTransfers()
For messages of type POSTED_FILES, parses the body XML and creates a list of Transfer instances. |
Message.Type |
getType()
|
Voicemail |
getVoiceMessage()
For messages of type POSTED_VOICE_MESSAGE, parses the body XML and creates a Voicemail instance. |
Message |
mgetInfo()
multiget the following properties - P_CONVERSATION - P_AUTHOR_DISPLAY_NAME - P_TYPE - P_BODY_XML - P_TIMESTAMP |
static Message[] |
mgetInfo(Message[] objects)
multiget the following properties for a list of Message - P_CONVERSATION - P_AUTHOR_DISPLAY_NAME - P_TYPE - P_BODY_XML - P_TIMESTAMP |
int |
moduleId()
|
byte[] |
sidGetBinaryProperty(PropertyEnumConverting prop)
|
EnumConverting |
sidGetEnumProperty(PropertyEnumConverting prop)
|
int |
sidGetIntProperty(PropertyEnumConverting prop)
|
SidObject |
sidGetObjectProperty(PropertyEnumConverting prop)
|
java.lang.String |
sidGetStringProperty(PropertyEnumConverting prop)
|
SidGetResponding |
sidMultiGet(Message.Property[] requested)
generic multiget of a list of Property |
static SidGetResponding[] |
sidMultiGet(Message.Property[] requested,
Message[] objects)
generic multiget of list of Property for a list of Message |
protected void |
sidOnChangedProperty(int propertyId,
int value,
java.lang.String svalue)
|
void |
sidSetProperty(PropertyEnumConverting prop,
byte[] newValue)
|
void |
sidSetProperty(PropertyEnumConverting prop,
int newValue)
|
void |
sidSetProperty(PropertyEnumConverting prop,
SidObject newValue)
|
void |
sidSetProperty(PropertyEnumConverting prop,
java.lang.String newValue)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Conversation mConversation
public java.lang.String mConvoGuid
public java.lang.String mAuthor
public java.lang.String mAuthorDisplayName
public byte[] mGuid
public java.lang.String mOriginallyMeantFor
public int mTimestamp
public Message.Type mType
public Message.SendingStatus mSendingStatus
public Message.ConsumptionStatus mConsumptionStatus
public java.lang.String mEditedBy
public int mEditTimestamp
public int mParamKey
public int mParamValue
public java.lang.String mBodyXml
public java.lang.String mIdentities
public java.lang.String mReason
public Skype.LeaveReason mLeavereason
public int mParticipantCount
| Constructor Detail |
|---|
public Message(int oid,
SidRoot root)
| Method Detail |
|---|
public boolean canEdit()
public void edit(java.lang.String newText,
boolean isXml,
boolean undo)
newText - New value of the message BODY_XML property.isXml - Specify isXML as true if the message body is formatted as XML; omit it or specify it as false if the message body is plain text.undo - Reverts the message body to the original version. newText parameter is ignored when this is setpublic Contact[] getContacts()
public Transfer[] getTransfers()
public Voicemail getVoiceMessage()
public Sms getSms()
public void deleteLocally()
public SidGetResponding sidMultiGet(Message.Property[] requested)
requested - the list of requested properties of Message
public static SidGetResponding[] sidMultiGet(Message.Property[] requested,
Message[] objects)
requested - the list of requested properties
public Message mgetInfo()
public static Message[] mgetInfo(Message[] objects)
objects - targets of the request
public Conversation getConversation()
public java.lang.String getConvoGuid()
public java.lang.String getAuthor()
public java.lang.String getAuthorDisplayName()
public byte[] getGuid()
public java.lang.String getOriginallyMeantFor()
public int getTimestamp()
public Message.Type getType()
public Message.SendingStatus getSendingStatus()
public Message.ConsumptionStatus getConsumptionStatus()
public java.lang.String getEditedBy()
public int getEditTimestamp()
public int getParamKey()
public int getParamValue()
public java.lang.String getBodyXml()
public java.lang.String getIdentities()
public java.lang.String getReason()
public Skype.LeaveReason getLeavereason()
public int getParticipantCount()
public java.lang.String sidGetStringProperty(PropertyEnumConverting prop)
sidGetStringProperty in interface SidGetRespondingsidGetStringProperty in class SidObjectpublic SidObject sidGetObjectProperty(PropertyEnumConverting prop)
sidGetObjectProperty in interface SidGetRespondingsidGetObjectProperty in class SidObjectpublic int sidGetIntProperty(PropertyEnumConverting prop)
sidGetIntProperty in interface SidGetRespondingsidGetIntProperty in class SidObjectpublic EnumConverting sidGetEnumProperty(PropertyEnumConverting prop)
sidGetEnumProperty in interface SidGetRespondingsidGetEnumProperty in class SidObjectpublic byte[] sidGetBinaryProperty(PropertyEnumConverting prop)
sidGetBinaryProperty in interface SidGetRespondingsidGetBinaryProperty in class SidObjectpublic java.lang.String getPropertyAsString(int prop)
public java.lang.String getPropertyAsString(Message.Property prop)
protected void sidOnChangedProperty(int propertyId,
int value,
java.lang.String svalue)
sidOnChangedProperty in class SidObject
public void sidSetProperty(PropertyEnumConverting prop,
java.lang.String newValue)
sidSetProperty in interface SidGetRespondingsidSetProperty in class SidObject
public void sidSetProperty(PropertyEnumConverting prop,
SidObject newValue)
sidSetProperty in interface SidGetRespondingsidSetProperty in class SidObject
public void sidSetProperty(PropertyEnumConverting prop,
int newValue)
sidSetProperty in interface SidGetRespondingsidSetProperty in class SidObject
public void sidSetProperty(PropertyEnumConverting prop,
byte[] newValue)
sidSetProperty in interface SidGetRespondingsidSetProperty in class SidObjectpublic int moduleId()
moduleId in class SidObject
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||