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 TextChannel(Connection *connection, const QString &objectPath,
00072 const QVariantMap &immutableProperties, QObject *parent = 0);
00073 ~TextChannel();
00074
00075 enum Feature {
00076
00077
00078
00079
00080 FeatureMessageQueue = 1,
00081 FeatureMessageCapabilities = 2,
00082 FeatureMessageSentSignal = 4,
00083 _Padding = 0xFFFFFFFF
00084 };
00085 Q_DECLARE_FLAGS(Features, Feature)
00086
00087 bool hasMessagesInterface() const;
00088 bool canInviteContacts() const;
00089
00090 bool isReady(Channel::Features channelFeatures = 0,
00091 Features textFeatures = 0) const;
00092 PendingReadyChannel *becomeReady(Channel::Features channelFeatures = 0,
00093 Features textFeatures = 0);
00094
00095
00096 QStringList supportedContentTypes() const;
00097 MessagePartSupportFlags messagePartSupport() const;
00098 DeliveryReportingSupportFlags deliveryReportingSupport() const;
00099
00100
00101 QList<ReceivedMessage> messageQueue() const;
00102
00103 public Q_SLOTS:
00104
00105 void acknowledge(const QList<ReceivedMessage> &messages);
00106
00107 void forget(const QList<ReceivedMessage> &messages);
00108
00109 PendingSendMessage *send(const QString &text,
00110 ChannelTextMessageType type = ChannelTextMessageTypeNormal);
00111
00112 PendingSendMessage *send(const MessagePartList &parts);
00113
00114 inline PendingOperation *inviteContacts(
00115 const QList<QSharedPointer<Contact> > &contacts,
00116 const QString &message = QString())
00117 {
00118 return groupAddContacts(contacts, message);
00119 }
00120
00121 Q_SIGNALS:
00122
00123
00124 void messageSent(const Telepathy::Client::Message &message,
00125 Telepathy::MessageSendingFlags flags,
00126 const QString &sentMessageToken);
00127
00128
00129 void messageReceived(const Telepathy::Client::ReceivedMessage &message);
00130 void pendingMessageRemoved(
00131 const Telepathy::Client::ReceivedMessage &message);
00132
00133 private Q_SLOTS:
00134 void onChannelReady(Telepathy::Client::PendingOperation *);
00135 void onContactsFinished(Telepathy::Client::PendingOperation *);
00136 void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
00137
00138 void onMessageSent(const Telepathy::MessagePartList &, uint,
00139 const QString &);
00140 void onMessageReceived(const Telepathy::MessagePartList &);
00141 void onPendingMessagesRemoved(const Telepathy::UIntList &);
00142 void onGetAllMessagesReply(QDBusPendingCallWatcher *);
00143
00144 void onTextSent(uint, uint, const QString &);
00145 void onTextReceived(uint, uint, uint, uint, uint, const QString &);
00146 void onTextSendError(uint, uint, uint, const QString &);
00147 void onListPendingMessagesReply(QDBusPendingCallWatcher *);
00148
00149 private:
00150 void processQueue();
00151
00152 struct Private;
00153 friend struct Private;
00154 Private *mPriv;
00155 };
00156
00157 }
00158 }
00159
00160 #endif