00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _TelepathyQt4_Client_text_channel_h_HEADER_GUARD_
00022 #define _TelepathyQt4_Client_text_channel_h_HEADER_GUARD_
00023
00024 #ifndef IN_TELEPATHY_QT4_HEADER
00025 #error IN_TELEPATHY_QT4_HEADER
00026 #endif
00027
00028 #include <TelepathyQt4/Client/Channel>
00029 #include <TelepathyQt4/Client/PendingOperation>
00030
00031 namespace Telepathy
00032 {
00033 namespace Client
00034 {
00035
00036 class PendingReadyChannel;
00037 class Message;
00038 class ReceivedMessage;
00039 class TextChannel;
00040
00041 class PendingSendMessage : public PendingOperation
00042 {
00043 Q_OBJECT
00044 Q_DISABLE_COPY(PendingSendMessage)
00045
00046 public:
00047 PendingSendMessage(const Message &message, QObject *parent = 0);
00048 ~PendingSendMessage();
00049
00050 QString sentMessageToken() const;
00051 Message message() const;
00052
00053 private Q_SLOTS:
00054 void onTextSent(QDBusPendingCallWatcher *);
00055 void onMessageSent(QDBusPendingCallWatcher *);
00056
00057 private:
00058 friend class TextChannel;
00059
00060 struct Private;
00061 friend struct Private;
00062 Private *mPriv;
00063 };
00064
00065 class TextChannel : public Channel
00066 {
00067 Q_OBJECT
00068 Q_DISABLE_COPY(TextChannel)
00069
00070 public:
00071 static const Feature FeatureMessageQueue;
00072 static const Feature FeatureMessageCapabilities;
00073 static const Feature FeatureMessageSentSignal;
00074
00075 TextChannel(Connection *connection, const QString &objectPath,
00076 const QVariantMap &immutableProperties, QObject *parent = 0);
00077 ~TextChannel();
00078
00079 bool hasMessagesInterface() const;
00080 bool canInviteContacts() const;
00081
00082
00083 QStringList supportedContentTypes() const;
00084 MessagePartSupportFlags messagePartSupport() const;
00085 DeliveryReportingSupportFlags deliveryReportingSupport() const;
00086
00087
00088 QList<ReceivedMessage> messageQueue() const;
00089
00090 public Q_SLOTS:
00091 void acknowledge(const QList<ReceivedMessage> &messages);
00092
00093 void forget(const QList<ReceivedMessage> &messages);
00094
00095 PendingSendMessage *send(const QString &text,
00096 ChannelTextMessageType type = ChannelTextMessageTypeNormal);
00097
00098 PendingSendMessage *send(const MessagePartList &parts);
00099
00100 inline PendingOperation *inviteContacts(
00101 const QList<ContactPtr> &contacts,
00102 const QString &message = QString())
00103 {
00104 return groupAddContacts(contacts, message);
00105 }
00106
00107 Q_SIGNALS:
00108
00109 void messageSent(const Telepathy::Client::Message &message,
00110 Telepathy::MessageSendingFlags flags,
00111 const QString &sentMessageToken);
00112
00113
00114 void messageReceived(const Telepathy::Client::ReceivedMessage &message);
00115 void pendingMessageRemoved(
00116 const Telepathy::Client::ReceivedMessage &message);
00117
00118 private Q_SLOTS:
00119 void onContactsFinished(Telepathy::Client::PendingOperation *);
00120 void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
00121
00122 void onMessageSent(const Telepathy::MessagePartList &, uint,
00123 const QString &);
00124 void onMessageReceived(const Telepathy::MessagePartList &);
00125 void onPendingMessagesRemoved(const Telepathy::UIntList &);
00126
00127 void onTextSent(uint, uint, const QString &);
00128 void onTextReceived(uint, uint, uint, uint, uint, const QString &);
00129 void onTextSendError(uint, uint, uint, const QString &);
00130
00131 void gotProperties(QDBusPendingCallWatcher *);
00132 void gotPendingMessages(QDBusPendingCallWatcher *);
00133
00134 private:
00135 void processQueue();
00136
00137 struct Private;
00138 friend struct Private;
00139 Private *mPriv;
00140 };
00141
00142 typedef QExplicitlySharedDataPointer<TextChannel> TextChannelPtr;
00143
00144 }
00145 }
00146
00147 #endif