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

text-channel.h

    00001
    00023 #ifndef _TelepathyQt_text_channel_h_HEADER_GUARD_
    00024 #define _TelepathyQt_text_channel_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/Channel>
    00031 #include <TelepathyQt/PendingOperation>
    00032 #include <TelepathyQt/PendingSendMessage>
    00033
    00034 namespace Tp
    00035 {
    00036
    00037 class Message;
    00038 class ReceivedMessage;
    00039
    00040 class TP_QT_EXPORT TextChannel : public Channel
    00041 {
    00042     Q_OBJECT
    00043     Q_DISABLE_COPY(TextChannel)
    00044
    00045 public:
    00046     static const Feature FeatureCore;
    00047     static const Feature FeatureMessageQueue;
    00048     static const Feature FeatureMessageCapabilities;
    00049     static const Feature FeatureMessageSentSignal;
    00050     static const Feature FeatureChatState;
    00051
    00052     static TextChannelPtr create(const ConnectionPtr &connection,
    00053             const QString &objectPath, const QVariantMap &immutableProperties);
    00054
    00055     virtual ~TextChannel();
    00056
    00057     bool hasMessagesInterface() const;
    00058     bool hasChatStateInterface() const;
    00059     bool canInviteContacts() const;
    00060
    00061     // requires FeatureMessageCapabilities
    00062     bool supportsMessageType(ChannelTextMessageType messageType) const;
    00063     QList<ChannelTextMessageType> supportedMessageTypes() const;
    00064     QStringList supportedContentTypes() const;
    00065     MessagePartSupportFlags messagePartSupport() const;
    00066     DeliveryReportingSupportFlags deliveryReportingSupport() const;
    00067
    00068     // requires FeatureMessageQueue
    00069     QList<ReceivedMessage> messageQueue() const;
    00070
    00071     // requires FeatureChatState
    00072     ChannelChatState chatState(const ContactPtr &contact) const;
    00073
    00074 public Q_SLOTS:
    00075     void acknowledge(const QList<ReceivedMessage> &messages);
    00076
    00077     void forget(const QList<ReceivedMessage> &messages);
    00078
    00079     PendingSendMessage *send(const QString &text,
    00080             ChannelTextMessageType type = ChannelTextMessageTypeNormal,
    00081             MessageSendingFlags flags = 0);
    00082
    00083     PendingSendMessage *send(const MessagePartList &parts,
    00084             MessageSendingFlags flags = 0);
    00085
    00086     inline PendingOperation *inviteContacts(
    00087             const QList<ContactPtr> &contacts,
    00088             const QString &message = QString())
    00089     {
    00090         return groupAddContacts(contacts, message);
    00091     }
    00092
    00093     PendingOperation *requestChatState(ChannelChatState state);
    00094
    00095 Q_SIGNALS:
    00096     // FeatureMessageSentSignal
    00097     void messageSent(const Tp::Message &message,
    00098             Tp::MessageSendingFlags flags,
    00099             const QString &sentMessageToken);
    00100
    00101     // FeatureMessageQueue
    00102     void messageReceived(const Tp::ReceivedMessage &message);
    00103     void pendingMessageRemoved(
    00104             const Tp::ReceivedMessage &message);
    00105
    00106     // FeatureChatState
    00107     void chatStateChanged(const Tp::ContactPtr &contact,
    00108             Tp::ChannelChatState state);
    00109
    00110 protected:
    00111     TextChannel(const ConnectionPtr &connection, const QString &objectPath,
    00112             const QVariantMap &immutableProperties,
    00113             const Feature &coreFeature = TextChannel::FeatureCore);
    00114
    00115 private Q_SLOTS:
    00116     TP_QT_NO_EXPORT void onContactsFinished(Tp::PendingOperation *);
    00117     TP_QT_NO_EXPORT void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
    00118
    00119     TP_QT_NO_EXPORT void onMessageSent(const Tp::MessagePartList &, uint,
    00120             const QString &);
    00121     TP_QT_NO_EXPORT void onMessageReceived(const Tp::MessagePartList &);
    00122     TP_QT_NO_EXPORT void onPendingMessagesRemoved(const Tp::UIntList &);
    00123
    00124     TP_QT_NO_EXPORT void onTextSent(uint, uint, const QString &);
    00125     TP_QT_NO_EXPORT void onTextReceived(uint, uint, uint, uint, uint, const QString &);
    00126     TP_QT_NO_EXPORT void onTextSendError(uint, uint, uint, const QString &);
    00127
    00128     TP_QT_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *);
    00129     TP_QT_NO_EXPORT void gotPendingMessages(QDBusPendingCallWatcher *);
    00130
    00131     TP_QT_NO_EXPORT void onChatStateChanged(uint, uint);
    00132
    00133 private:
    00134     struct Private;
    00135     friend struct Private;
    00136     Private *mPriv;
    00137 };
    00138
    00139 } // Tp
    00140
    00141 #endif