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 
00033 namespace Tp
00034 {
00035 
00036 class PendingReadyChannel;
00037 class Message;
00038 class ReceivedMessage;
00039 class TextChannel;
00040 
00041 class TELEPATHY_QT4_EXPORT PendingSendMessage : public PendingOperation
00042 {
00043     Q_OBJECT
00044     Q_DISABLE_COPY(PendingSendMessage)
00045 
00046 public:
00047     ~PendingSendMessage();
00048 
00049     TextChannelPtr channel() const;
00050 
00051     QString sentMessageToken() const;
00052     Message message() const;
00053 
00054 private Q_SLOTS:
00055     TELEPATHY_QT4_NO_EXPORT void onTextSent(QDBusPendingCallWatcher *);
00056     TELEPATHY_QT4_NO_EXPORT void onMessageSent(QDBusPendingCallWatcher *);
00057 
00058 private:
00059     friend class TextChannel;
00060 
00061     TELEPATHY_QT4_NO_EXPORT PendingSendMessage(const TextChannelPtr &channel, const Message &message);
00062 
00063     struct Private;
00064     friend struct Private;
00065     Private *mPriv;
00066 };
00067 
00068 class TELEPATHY_QT4_EXPORT TextChannel : public Channel
00069 {
00070     Q_OBJECT
00071     Q_DISABLE_COPY(TextChannel)
00072 
00073 public:
00074     static const Feature FeatureCore;
00075     static const Feature FeatureMessageQueue;
00076     static const Feature FeatureMessageCapabilities;
00077     static const Feature FeatureMessageSentSignal;
00078     static const Feature FeatureChatState;
00079 
00080     static TextChannelPtr create(const ConnectionPtr &connection,
00081             const QString &objectPath, const QVariantMap &immutableProperties);
00082 
00083     virtual ~TextChannel();
00084 
00085     bool hasMessagesInterface() const;
00086     bool hasChatStateInterface() const;
00087     bool canInviteContacts() const;
00088 
00089     // requires FeatureMessageCapabilities
00090     QStringList supportedContentTypes() const;
00091     MessagePartSupportFlags messagePartSupport() const;
00092     DeliveryReportingSupportFlags deliveryReportingSupport() const;
00093 
00094     // requires FeatureMessageQueue
00095     QList<ReceivedMessage> messageQueue() const;
00096 
00097     // requires FeatureChatState
00098     ChannelChatState chatState(const ContactPtr &contact) const;
00099 
00100 public Q_SLOTS:
00101     void acknowledge(const QList<ReceivedMessage> &messages);
00102 
00103     void forget(const QList<ReceivedMessage> &messages);
00104 
00105     PendingSendMessage *send(const QString &text,
00106             ChannelTextMessageType type = ChannelTextMessageTypeNormal,
00107             MessageSendingFlags flags = 0);
00108 
00109     PendingSendMessage *send(const MessagePartList &parts,
00110             MessageSendingFlags flags = 0);
00111 
00112     inline PendingOperation *inviteContacts(
00113             const QList<ContactPtr> &contacts,
00114             const QString &message = QString())
00115     {
00116         return groupAddContacts(contacts, message);
00117     }
00118 
00119     PendingOperation *requestChatState(ChannelChatState state);
00120 
00121 Q_SIGNALS:
00122     // FeatureMessageSentSignal
00123     void messageSent(const Tp::Message &message,
00124             Tp::MessageSendingFlags flags,
00125             const QString &sentMessageToken);
00126 
00127     // FeatureMessageQueue
00128     void messageReceived(const Tp::ReceivedMessage &message);
00129     void pendingMessageRemoved(
00130             const Tp::ReceivedMessage &message);
00131 
00132     // FeatureChatState
00133     void chatStateChanged(const Tp::ContactPtr &contact,
00134             Tp::ChannelChatState state);
00135 
00136 protected:
00137     TextChannel(const ConnectionPtr &connection, const QString &objectPath,
00138             const QVariantMap &immutableProperties,
00139             const Feature &coreFeature = TextChannel::FeatureCore);
00140 
00141 private Q_SLOTS:
00142     TELEPATHY_QT4_NO_EXPORT void onContactsFinished(Tp::PendingOperation *);
00143     TELEPATHY_QT4_NO_EXPORT void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
00144 
00145     TELEPATHY_QT4_NO_EXPORT void onMessageSent(const Tp::MessagePartList &, uint,
00146             const QString &);
00147     TELEPATHY_QT4_NO_EXPORT void onMessageReceived(const Tp::MessagePartList &);
00148     TELEPATHY_QT4_NO_EXPORT void onPendingMessagesRemoved(const Tp::UIntList &);
00149 
00150     TELEPATHY_QT4_NO_EXPORT void onTextSent(uint, uint, const QString &);
00151     TELEPATHY_QT4_NO_EXPORT void onTextReceived(uint, uint, uint, uint, uint, const QString &);
00152     TELEPATHY_QT4_NO_EXPORT void onTextSendError(uint, uint, uint, const QString &);
00153 
00154     TELEPATHY_QT4_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *);
00155     TELEPATHY_QT4_NO_EXPORT void gotPendingMessages(QDBusPendingCallWatcher *);
00156 
00157     TELEPATHY_QT4_NO_EXPORT void onChatStateChanged(uint, uint);
00158 
00159 private:
00160     struct Private;
00161     friend struct Private;
00162     Private *mPriv;
00163 };
00164 
00165 } // Tp
00166 
00167 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.5.11