Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.skype.api
Class Message

    java.lang.Object
      com.skype.api.SkypeObject
          com.skype.api.Message

    public class Message

extends SkypeObject

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:
@code
Hi :-)
Flag emoticons
Flag emoticons are little flags. They are encoded with the "flag" tag. The element contents is the plain text representation and it has a "country" attribute which is a 2-letter ISO-3166 country code. The user can enter a flag using "(flag:XX)", where XX is a valid ISO country code. Example:
@code
I am in CC
Links
If the library detects a URL, it will encode it using the html "a" tag, with the "href" attribute indicating the URL. The plain text representation is what the user originally typed. Example:
@code
I am in www.skype.com
Alert matches
When a conversation is configured to display only alerts if specific words are present in the message (see "/alertson [text to match]" command), if a message matches the alert, it will be marked with the tag. This allows the UI to highlight the word matching. Example:
@code
Maybe Vincent knows the answer
Bold, italic, etc
Skype for Windows also supports displaying bold and italic text, using the "b" and "i" tags.
Encoding messages
When sending a chat message via PostText(), there is the possibility to indicate if the library should do the XML encoding, or if the message has already been encoded. Usually, the UI can let library do the encoding. This is the case when the message does not contain any specific formatting. It may contain emoticons or URls, which will be detected by the library encoder and converted into XML tags.
If the message has some more complex encoding, such as a quote or some bold text, it is up to the UI to encode the message.

Nested Class Summary
`static class` | `Message.CONSUMPTION_STATUS` 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 interface` | `Message.MessageListener`
`static class` | `Message.PROPERTY` Properties of the Message class
`static class` | `Message.SENDING_STATUS`
`static class` | `Message.SET_METADATA_KEY` 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

Fields inherited from class com.skype.api.SkypeObject
`mObjectId, mPropCache, skype`

Constructor Summary
`Message(int oid, Skype skype)`

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.
`byte[]` | `GetBinProperty(Message.PROPERTY prop)`
`boolean` | `GetBooleanProperty(Message.PROPERTY prop)`
`Contact[]` | `GetContacts()` For messages of type POSTED_CONTACTS, parses the body XML and formats the data as a list of Contact instances.
`int` | `GetIntProperty(Message.PROPERTY prop)`
`java.lang.Object` | `GetPropertyAsEnum(int propid)`
`Sms` | `GetSMS()` For messages of type POSTED_SMS, parses the body XML and creates an SMS instances
`java.lang.String` | `GetStrProperty(Message.PROPERTY prop)`
`Transfer[]` | `GetTransfers()` For messages of type POSTED_FILES, parses the body XML and creates a list of Transfer instances.
`Voicemail` | `GetVoiceMessage()` For messages of type POSTED_VOICE_MESSAGE, parses the body XML and creates a Voicemail instance.
`static int` | `moduleID()`

Methods inherited from class com.skype.api.SkypeObject
`close, getOid`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Message

    public Message(int oid,
                   Skype skype)

Method Detail

### moduleID

    public static final int moduleID()

### GetPropertyAsEnum

    public java.lang.Object GetPropertyAsEnum(int propid)

  Specified by:
    `GetPropertyAsEnum` in class `SkypeObject`

### GetStrProperty

    public java.lang.String GetStrProperty(Message.PROPERTY prop)

### GetIntProperty

    public int GetIntProperty(Message.PROPERTY prop)

### GetBooleanProperty

    public boolean GetBooleanProperty(Message.PROPERTY prop)

### GetBinProperty

    public byte[] GetBinProperty(Message.PROPERTY prop)

### CanEdit

    public boolean CanEdit()

  For Message types having a body, determines whether that body is editable by the user.

  Returns:
    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.

  Returns:
    contacts

### GetTransfers

    public Transfer[] GetTransfers()

  For messages of type POSTED_FILES, parses the body XML and creates a list of Transfer instances.

  Returns:
    transfers

### GetVoiceMessage

    public Voicemail GetVoiceMessage()

  For messages of type POSTED_VOICE_MESSAGE, parses the body XML and creates a Voicemail instance.

  Returns:
    voicemail

### GetSMS

    public Sms GetSMS()

  For messages of type POSTED_SMS, parses the body XML and creates an SMS instances

  Returns:
    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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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