com.skype.api
Class Message

java.lang.Object
  extended by com.skype.ipc.SidObject
      extended by com.skype.api.Message
All Implemented Interfaces:
SidGetResponding

public final class Message
extends SidObject

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 - hereissomething is output as hereissomething - if no alt="" and no tag content, ignore the tag altogether (return nothing) Skype for Windows supports displaying many XML tags, but only a sub-set is regularly used and should be supported by the UI for a good experience. These are the ones described here. Animated emoticons Emoticons are encoded with the "ss" tag. The element content is the plain text representation. It has a "type" attribute indicating the emoticons canonical name. Example:


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 com.skype.ipc.SidObject
finalize, getOid, hasCached, invalidateCache, isCached, sidDoRequest, sidGetBoolProperty, sidGetFilenameProperty, sidGetLongProperty, sidGetObject, sidGetUintProperty, sidGetXmlProperty, sidMultiGet, sidMultiGet, sidMultiGet, sidMultiGet, sidRequestBinaryProperty, sidRequestBoolProperty, sidRequestEnumProperty, sidRequestFilenameProperty, sidRequestIntProperty, sidRequestObjectProperty, sidRequestProperty, sidRequestStringProperty, sidRequestUintProperty, sidRequestXmlProperty, sidSetProperty
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mConversation

public Conversation mConversation

mConvoGuid

public java.lang.String mConvoGuid

mAuthor

public java.lang.String mAuthor

mAuthorDisplayName

public java.lang.String mAuthorDisplayName

mGuid

public byte[] mGuid

mOriginallyMeantFor

public java.lang.String mOriginallyMeantFor

mTimestamp

public int mTimestamp

mType

public Message.Type mType

mSendingStatus

public Message.SendingStatus mSendingStatus

mConsumptionStatus

public Message.ConsumptionStatus mConsumptionStatus

mEditedBy

public java.lang.String mEditedBy

mEditTimestamp

public int mEditTimestamp

mParamKey

public int mParamKey

mParamValue

public int mParamValue

mBodyXml

public java.lang.String mBodyXml

mIdentities

public java.lang.String mIdentities

mReason

public java.lang.String mReason

mLeavereason

public Skype.LeaveReason mLeavereason

mParticipantCount

public int mParticipantCount
Constructor Detail

Message

public Message(int oid,
               SidRoot root)
Method Detail

canEdit

public boolean canEdit()
For Message types having a body, determines whether that body is editable by the user. * @return result


edit

public 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.

Parameters:
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 set

getContacts

public Contact[] getContacts()
For messages of type POSTED_CONTACTS, parses the body XML and formats the data as a list of Contact instances. * @return contacts


getTransfers

public Transfer[] getTransfers()
For messages of type POSTED_FILES, parses the body XML and creates a list of Transfer instances. * @return transfers


getVoiceMessage

public Voicemail getVoiceMessage()
For messages of type POSTED_VOICE_MESSAGE, parses the body XML and creates a Voicemail instance. * @return voicemail


getSms

public Sms getSms()
For messages of type POSTED_SMS, parses the body XML and creates an SMS instances * @return sms


deleteLocally

public void deleteLocally()
Deletes this message from the local database. These deletions do not propagate to the other Skype instances that the user may have on other computers. Nor do they affect other participants that have the same message. This method is specifically from removing Message objects from the database - not for removing Messages from conversations. To remove a Message from a conversation, use Message.Edit method to replace the existing body text with an empty string.


sidMultiGet

public SidGetResponding sidMultiGet(Message.Property[] requested)
generic multiget of a list of Property

Parameters:
requested - the list of requested properties of Message
Returns:
SidGetResponding

sidMultiGet

public static SidGetResponding[] sidMultiGet(Message.Property[] requested,
                                             Message[] objects)
generic multiget of list of Property for a list of Message

Parameters:
requested - the list of requested properties
Returns:
SidGetResponding[] can be casted to (Message[]) if all properties are cached

mgetInfo

public Message mgetInfo()
multiget the following properties - P_CONVERSATION - P_AUTHOR_DISPLAY_NAME - P_TYPE - P_BODY_XML - P_TIMESTAMP


mgetInfo

public 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

Parameters:
objects - targets of the request
Returns:
Message[] responses

getConversation

public Conversation getConversation()
DB ID of corresponding conversation


getConvoGuid

public java.lang.String getConvoGuid()
GUID of the Conversation. The GUID is a "global ID" - these values are shared accross Skype client instances and accross all the participants of the conversation.


getAuthor

public java.lang.String getAuthor()
Identity of the sender. While this is almost always the same as SKYPENAME property of the Contact, in some rare cases it can also be a phone number - for example, incoming voicemail notification Messages (message type = POSTED_VOICE_MESSAGE).


getAuthorDisplayName

public java.lang.String getAuthorDisplayName()
displayname of the sender at the time of posting


getGuid

public byte[] getGuid()
Unlike the message id, the GUID is the same on all instances and for all participants.


getOriginallyMeantFor

public java.lang.String getOriginallyMeantFor()
This property gets set when a conference is spawned from dialog Conversation. In that case recent message history from the original dialog is copied to the target conversation. For all the copied messages, the ORIGINALLY_MEANT_FOR property will be set to identity of the remote participant of the original dialog.


getTimestamp

public int getTimestamp()
UNIX timestamp (sent time, adjusted for local clock)


getType

public Message.Type getType()

getSendingStatus

public Message.SendingStatus getSendingStatus()

getConsumptionStatus

public Message.ConsumptionStatus getConsumptionStatus()

getEditedBy

public java.lang.String getEditedBy()
Identity of the author that last edited this message. NULL if message has not been edited


getEditTimestamp

public int getEditTimestamp()
UNIX timestamp of last edit


getParamKey

public int getParamKey()
Message type-specific parameter. See Message.SET_METADATA_KEY for more information.


getParamValue

public int getParamValue()
Message type-specific parameter


getBodyXml

public java.lang.String getBodyXml()
Message type-specific parameter


getIdentities

public java.lang.String getIdentities()
Message type-specific parameter. Depending of Message type, this property contains: - STARTED_LIVESESSION - list of participants in the cal; - ENDED_LIVESESSION - list of participants in the call; - POSTED_SMS - list of recipients of the message; - SPAWNED_CONFERENCE - the list of identities that were added; - ADDED_CONSUMERS - the list of identities that were added; - RETIRED_OTHERS - the skypename of the participant who was kicked; - SET_RANK - the skypename of the participant whose rank was changed; - REQUESTED_AUTH - Message.P_AUTHOR and Message.P_IDENTITIES are set to the users receiving and requesting the authorization, depending if the message was received or sent; - GRANTED_AUTH - the skypename of the user we granted authorization; * - BLOCKED - the skypename of the user who was blocked; - HAS_BIRTHDAY - skypename of current logged in user.


getReason

public java.lang.String getReason()
Message type-specific parameter. Possible values for STARTED/ENDED_LIVESESSION (only set for dialogs): - no_answer - manual - busy - connection_dropped - no_skypeout_subscription; - insufficient_funds - internet_connection_lost - skypeout_account_blocked - pstn_could_not_connect_to_skype_proxy - pstn_invalid_number - pstn_number_forbidden - pstn_call_timed_out - pstn_busy - pstn_call_terminated - pstn_network_error - number_unavailable - pstn_call_rejected - pstn_misc_error - internal_error - unable_to_connect - connection_dropped - recording_failed - playback_error - legacy_error - blocked_by_privacy_settings - error - transfer_failed - transfer_insufficient_funds - blocked_by_us - emergency_call_denied This information is now available as an enum in LEAVEREASON


getLeavereason

public Skype.LeaveReason getLeavereason()
Leave reason for message of the RETIRED type, and STARTED/ENDED_LIVESESSION. Use for STARTED/ENDED_LIVESESSION is to provide simpler, enum based handling and deprecates the reason property (only set for dialogs)


getParticipantCount

public int getParticipantCount()
Number of people who received this message (including local user)


sidGetStringProperty

public java.lang.String sidGetStringProperty(PropertyEnumConverting prop)
Specified by:
sidGetStringProperty in interface SidGetResponding
Overrides:
sidGetStringProperty in class SidObject

sidGetObjectProperty

public SidObject sidGetObjectProperty(PropertyEnumConverting prop)
Specified by:
sidGetObjectProperty in interface SidGetResponding
Overrides:
sidGetObjectProperty in class SidObject

sidGetIntProperty

public int sidGetIntProperty(PropertyEnumConverting prop)
Specified by:
sidGetIntProperty in interface SidGetResponding
Overrides:
sidGetIntProperty in class SidObject

sidGetEnumProperty

public EnumConverting sidGetEnumProperty(PropertyEnumConverting prop)
Specified by:
sidGetEnumProperty in interface SidGetResponding
Overrides:
sidGetEnumProperty in class SidObject

sidGetBinaryProperty

public byte[] sidGetBinaryProperty(PropertyEnumConverting prop)
Specified by:
sidGetBinaryProperty in interface SidGetResponding
Overrides:
sidGetBinaryProperty in class SidObject

getPropertyAsString

public java.lang.String getPropertyAsString(int prop)

getPropertyAsString

public java.lang.String getPropertyAsString(Message.Property prop)

sidOnChangedProperty

protected void sidOnChangedProperty(int propertyId,
                                    int value,
                                    java.lang.String svalue)
Specified by:
sidOnChangedProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           java.lang.String newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           SidObject newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           int newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           byte[] newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

moduleId

public int moduleId()
Specified by:
moduleId in class SidObject


Copyright © 2010, 2011 Skype Technologies. All Rights Reserved.