| Home · All Classes · All Namespaces · Modules · Functions · Files

# Tp::TextChannel Class Reference
[Channel proxies]

The TextChannel class provides an object representing a Telepathy channel of type Text. More...

`#include <TelepathyQt4/TextChannel>`

Inherits Tp::Channel.

List of all members.

## Public Slots

- void acknowledge (const QList< ReceivedMessage > &messages)
- void forget (const QList< ReceivedMessage > &messages)
- PendingSendMessage * send (const QString &text, ChannelTextMessageType type=ChannelTextMessageTypeNormal, MessageSendingFlags flags=0)
- PendingSendMessage * send (const MessagePartList &parts, MessageSendingFlags flags=0)
- PendingOperation * inviteContacts (const QList< ContactPtr > &contacts, const QString &message=QString())
- PendingOperation * requestChatState (ChannelChatState state)

## Signals

- void messageSent (const Tp::Message &message, Tp::MessageSendingFlags flags, const QString &sentMessageToken)
- void messageReceived (const Tp::ReceivedMessage &message)
- void pendingMessageRemoved (const Tp::ReceivedMessage &message)
- void chatStateChanged (const Tp::ContactPtr &contact, ChannelChatState state)

## Public Member Functions

- virtual ~TextChannel ()
- bool hasMessagesInterface () const
- bool hasChatStateInterface () const
- bool canInviteContacts () const
- QStringList supportedContentTypes () const
- MessagePartSupportFlags messagePartSupport () const
- DeliveryReportingSupportFlags deliveryReportingSupport () const
- QList< ReceivedMessage > messageQueue () const
- ChannelChatState chatState (const ContactPtr &contact) const

## Static Public Member Functions

- static TextChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)

## Static Public Attributes

- static const Feature FeatureMessageQueue
- static const Feature FeatureMessageCapabilities
- static const Feature FeatureMessageSentSignal
- static const Feature FeatureChatState

## Protected Member Functions

- TextChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)

## Detailed Description

The TextChannel class provides an object representing a Telepathy channel of type Text.

## Constructor & Destructor Documentation

Tp::TextChannel::~TextChannel | ( |  | ) | `[virtual]`

Class destructor.

Tp::TextChannel::TextChannel | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties |
| ) |  |  | `[protected]`

Construct a new TextChannel object.

Parameters:

  | connection | Connection owning this channel, and specifying the service.
  | objectPath | The object path of this channel.
  | immutableProperties | The immutable properties of this channel.

## Member Function Documentation

TextChannelPtr Tp::TextChannel::create | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties |
| ) |  |  | `[static]`

Create a new IncomingFileTransfer channel.

Parameters:

  | connection | Connection owning this channel, and specifying the service.
  | objectPath | The object path of this channel.
  | immutableProperties | The immutable properties of this channel.

Returns:
  A TextChannelPtr object pointing to the newly created TextChannel object.

Reimplemented from Tp::Channel.

bool Tp::TextChannel::hasMessagesInterface | ( |  | ) | const

Return whether this channel supports the Telepathy Messages interface. if it does not, requestChatState() will fail and all contacts' chat states will appear to be TpChannelChatStateInactive.

The result of calling this method is undefined until basic Channel functionality has been enabled by calling becomeReady and waiting for the pending operation to complete.

Returns:
  true if the Messages interface is supported

bool Tp::TextChannel::hasChatStateInterface | ( |  | ) | const

Return whether this channel supports the Telepathy ChatState interface. If it does not, some advanced functionality will be unavailable.

The result of calling this method is undefined until basic Channel functionality has been enabled by calling becomeReady and waiting for the pending operation to complete.

Returns:
  true if the ChatState interface is supported

bool Tp::TextChannel::canInviteContacts | ( |  | ) | const

Return whether contacts can be invited into this channel using inviteContacts (which is equivalent to groupAddContacts). Whether this is the case depends on the underlying protocol, the type of channel, and the user's privileges (in some chatrooms, only a privileged user can invite other contacts).

This is an alias for groupCanAddContacts, to indicate its meaning more clearly for Text channels.

The result of calling this method is undefined until basic Group functionality has been enabled by calling becomeReady and waiting for the pending operation to complete.

Returns:
  The same thing as groupCanAddContacts

QStringList Tp::TextChannel::supportedContentTypes | ( |  | ) | const

Return a list of supported MIME content types for messages on this channel. For a simple text channel this will be a list containing one item, "text/plain".

This list may contain the special value "*<!--x-->/<!--x-->*", which indicates that any content type is supported.

The result of calling this method is undefined until the FeatureMessageCapabilities Feature has been enabled, by calling becomeReady and waiting for the pending operation to complete

Returns:
  A list of MIME content types

MessagePartSupportFlags Tp::TextChannel::messagePartSupport | ( |  | ) | const

Return a set of flags indicating support for multi-part messages on this channel. This is zero on simple text channels, or greater than zero if there is partial or full support for multi-part messages.

The result of calling this method is undefined until the FeatureMessageCapabilities Feature has been enabled, by calling becomeReady and waiting for the pending operation to complete.

Returns:
  A set of MessagePartSupportFlags

DeliveryReportingSupportFlags Tp::TextChannel::deliveryReportingSupport | ( |  | ) | const

Return a set of flags indicating support for delivery reporting on this channel. This is zero if there are no particular guarantees, or greater than zero if delivery reports can be expected under certain circumstances.

The result of calling this method is undefined until the FeatureMessageCapabilities Feature has been enabled, by calling becomeReady and waiting for the pending operation to complete.

Returns:
  A set of DeliveryReportingSupportFlags

QList< ReceivedMessage > Tp::TextChannel::messageQueue | ( |  | ) | const

Return a list of messages received in this channel. This list is empty unless the FeatureMessageQueue Feature has been enabled.

Messages are added to this list when they are received from the instant messaging service; the messageReceived signal is emitted.

There is a small delay between the message being received over D-Bus and becoming available to users of this C++ API, since a small amount of additional information needs to be fetched. However, the relative ordering of all the messages in a channel is preserved.

Messages are removed from this list when they are acknowledged with the acknowledge() or forget() methods. On channels where hasMessagesInterface() returns true, they will also be removed when acknowledged by a different client. In either case, the pendingMessageRemoved signal is emitted.

Returns:
  The unacknowledged messages in this channel, excluding any that have been forgotten with forget().

ChannelChatState Tp::TextChannel::chatState | ( | const ContactPtr & | contact | ) | const

Return the current chat state for contact.

If hasChatStateInterface() returns false, this method will always return ChannelChatStateInactive.

This method requires TextChannel::FeatureChatState to be enabled.

Returns:
  A contact current chat state.

void Tp::TextChannel::acknowledge | ( | const QList< ReceivedMessage > & | messages | ) | `[slot]`

Acknowledge that received messages have been displayed to the user.

This method should only be called by the main handler of a Channel, usually meaning the user interface process that displays the Channel to the user (when a ChannelDispatcher is used, the Handler must acknowledge messages, and other Approvers or Observers must not acknowledge messages).

Processes other than the main handler of a Channel can free memory used in Telepathy-Qt4 by calling forget() instead.

The messages must have come from this channel, therefore this method does not make sense if FeatureMessageQueue has not been enabled.

Parameters:

  | messages | A list of received messages that have now been displayed.

void Tp::TextChannel::forget | ( | const QList< ReceivedMessage > & | messages | ) | `[slot]`

Remove messages from messageQueue without acknowledging them.

This method frees memory inside the Telepathy-Qt4 TextChannel proxy, but does not free the corresponding memory in the Connection Manager process. It should be used by clients that are not the main handler for a Channel; the main handler for a Channel should use acknowledge instead.

The messages must have come from this channel, therefore this method does not make sense if FeatureMessageQueue has not been enabled.

Parameters:

  | messages | A list of received messages that have now been processed.

PendingSendMessage * Tp::TextChannel::send | ( | const QString & | text,
|  | ChannelTextMessageType | type = `ChannelTextMessageTypeNormal`,
|  | MessageSendingFlags | flags = `0` |
| ) |  |  | `[slot]`

PendingSendMessage * Tp::TextChannel::send | ( | const MessagePartList & | parts,
|  | MessageSendingFlags | flags = `0` |
| ) |  |  | `[slot]`

PendingOperation* Tp::TextChannel::inviteContacts | ( | const QList< ContactPtr > & | contacts,
|  | const QString & | message = `QString()` |
| ) |  |  | `[inline, slot]`

PendingOperation * Tp::TextChannel::requestChatState | ( | ChannelChatState | state | ) | `[slot]`

Set the local chat state and notify other members of the channel that it has changed.

Note that only the primary handler of the channel should set its chat state.

Parameters:

  | state | The new state.

See also:
  chatStateChanged()

void Tp::TextChannel::messageSent | ( | const Tp::Message & | message,
|  | Tp::MessageSendingFlags | flags,
|  | const QString & | sentMessageToken |
| ) |  |  | `[signal]`

Emitted when a message is sent, if the FeatureMessageSentSignal Feature has been enabled.

This signal is emitted regardless of whether the message is sent by this client, or another client using the same Channel via D-Bus.

Parameters:

  | message | A message. This may differ slightly from what the client requested to send, for instance if it has been altered due to limitations of the instant messaging protocol used.
  | flags | MessageSendingFlags that were in effect when the message was sent. Clients can use these in conjunction with deliveryReportingSupport to determine whether delivery reporting can be expected.
  | sentMessageToken | Either an empty QString, or an opaque token used to match the message to any delivery reports.

void Tp::TextChannel::messageReceived | ( | const Tp::ReceivedMessage & | message | ) | `[signal]`

Emitted when a message is added to messageQueue(), if the FeatureMessageQueue Feature has been enabled.

This occurs slightly later than the message being received over D-Bus; see messageQueue() for details.

void Tp::TextChannel::pendingMessageRemoved | ( | const Tp::ReceivedMessage & | message | ) | `[signal]`

Emitted when a message is removed from messageQueue(), if the FeatureMessageQueue Feature has been enabled. See messageQueue() for the circumstances in which this happens.

void Tp::TextChannel::chatStateChanged | ( | const Tp::ContactPtr & | contact,
|  | ChannelChatState | state |
| ) |  |  | `[signal]`

Emitted when the state of a member of the channel has changed, if the FeatureChatState feature has been enabled. This includes local state.

## Member Data Documentation

const Feature Tp::TextChannel::FeatureMessageQueue`[static]`

Feature used in order to access the message queue info.

Se message queue methods' documentation for more details.

const Feature Tp::TextChannel::FeatureMessageCapabilities`[static]`

Feature used in order to access message capabilities info.

Se message capabilities methods' documentation for more details.

const Feature Tp::TextChannel::FeatureMessageSentSignal`[static]`

Feature used in order to receive notification when a message is sent.

const Feature Tp::TextChannel::FeatureChatState`[static]`

Feature used in order to keep track of chat state changes.

The chatStateChanged() signal will be emitted when a remote contact chat state changes.