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

text-channel.h

    00001
    00023 #ifndef _TelepathyQt4_text_channel_h_HEADER_GUARD_
    00024 #define _TelepathyQt4_text_channel_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TELEPATHY_QT4_HEADER
    00027 #error IN_TELEPATHY_QT4_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt4/Channel>
    00031 #include <TelepathyQt4/PendingOperation>
    00032 #include <TelepathyQt4/PendingSendMessage>
    00033
    00034 namespace Tp
    00035 {
    00036
    00037 class Message;
    00038 class ReceivedMessage;
    00039
    00040 class TELEPATHY_QT4_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     QStringList supportedContentTypes() const;
    00063     MessagePartSupportFlags messagePartSupport() const;
    00064     DeliveryReportingSupportFlags deliveryReportingSupport() const;
    00065
    00066     // requires FeatureMessageQueue
    00067     QList<ReceivedMessage> messageQueue() const;
    00068
    00069     // requires FeatureChatState
    00070     ChannelChatState chatState(const ContactPtr &contact) const;
    00071
    00072 public Q_SLOTS:
    00073     void acknowledge(const QList<ReceivedMessage> &messages);
    00074
    00075     void forget(const QList<ReceivedMessage> &messages);
    00076
    00077     PendingSendMessage *send(const QString &text,
    00078             ChannelTextMessageType type = ChannelTextMessageTypeNormal,
    00079             MessageSendingFlags flags = 0);
    00080
    00081     PendingSendMessage *send(const MessagePartList &parts,
    00082             MessageSendingFlags flags = 0);
    00083
    00084     inline PendingOperation *inviteContacts(
    00085             const QList<ContactPtr> &contacts,
    00086             const QString &message = QString())
    00087     {
    00088         return groupAddContacts(contacts, message);
    00089     }
    00090
    00091     PendingOperation *requestChatState(ChannelChatState state);
    00092
    00093 Q_SIGNALS:
    00094     // FeatureMessageSentSignal
    00095     void messageSent(const Tp::Message &message,
    00096             Tp::MessageSendingFlags flags,
    00097             const QString &sentMessageToken);
    00098
    00099     // FeatureMessageQueue
    00100     void messageReceived(const Tp::ReceivedMessage &message);
    00101     void pendingMessageRemoved(
    00102             const Tp::ReceivedMessage &message);
    00103
    00104     // FeatureChatState
    00105     void chatStateChanged(const Tp::ContactPtr &contact,
    00106             Tp::ChannelChatState state);
    00107
    00108 protected:
    00109     TextChannel(const ConnectionPtr &connection, const QString &objectPath,
    00110             const QVariantMap &immutableProperties,
    00111             const Feature &coreFeature = TextChannel::FeatureCore);
    00112
    00113 private Q_SLOTS:
    00114     TELEPATHY_QT4_NO_EXPORT void onContactsFinished(Tp::PendingOperation *);
    00115     TELEPATHY_QT4_NO_EXPORT void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
    00116
    00117     TELEPATHY_QT4_NO_EXPORT void onMessageSent(const Tp::MessagePartList &, uint,
    00118             const QString &);
    00119     TELEPATHY_QT4_NO_EXPORT void onMessageReceived(const Tp::MessagePartList &);
    00120     TELEPATHY_QT4_NO_EXPORT void onPendingMessagesRemoved(const Tp::UIntList &);
    00121
    00122     TELEPATHY_QT4_NO_EXPORT void onTextSent(uint, uint, const QString &);
    00123     TELEPATHY_QT4_NO_EXPORT void onTextReceived(uint, uint, uint, uint, uint, const QString &);
    00124     TELEPATHY_QT4_NO_EXPORT void onTextSendError(uint, uint, uint, const QString &);
    00125
    00126     TELEPATHY_QT4_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *);
    00127     TELEPATHY_QT4_NO_EXPORT void gotPendingMessages(QDBusPendingCallWatcher *);
    00128
    00129     TELEPATHY_QT4_NO_EXPORT void onChatStateChanged(uint, uint);
    00130
    00131 private:
    00132     struct Private;
    00133     friend struct Private;
    00134     Private *mPriv;
    00135 };
    00136
    00137 } // Tp
    00138
    00139 #endif