00001
00023 #ifndef _TelepathyQt4_contact_messenger_h_HEADER_GUARD_
00024 #define _TelepathyQt4_contact_messenger_h_HEADER_GUARD_
00025
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029
00030 #include <TelepathyQt4/Constants>
00031 #include <TelepathyQt4/Message>
00032 #include <TelepathyQt4/Types>
00033
00034 namespace Tp
00035 {
00036
00037 class PendingSendMessage;
00038 class MessageContentPartList;
00039
00040 class TELEPATHY_QT4_EXPORT ContactMessenger : public QObject, public RefCounted
00041 {
00042 Q_OBJECT
00043 Q_DISABLE_COPY(ContactMessenger)
00044
00045 public:
00046 static ContactMessengerPtr create(const AccountPtr &account, const ContactPtr &contact);
00047 static ContactMessengerPtr create(const AccountPtr &account, const QString &contactIdentifier);
00048
00049 virtual ~ContactMessenger();
00050
00051 AccountPtr account() const;
00052 QString contactIdentifier() const;
00053
00054 QList<TextChannelPtr> textChats() const;
00055
00056 PendingSendMessage *sendMessage(const QString &text,
00057 ChannelTextMessageType type = ChannelTextMessageTypeNormal,
00058 MessageSendingFlags flags = 0);
00059 PendingSendMessage *sendMessage(const MessageContentPartList &parts,
00060 MessageSendingFlags flags = 0);
00061
00062 Q_SIGNALS:
00063 void messageSent(const Tp::Message &message, Tp::MessageSendingFlags flags,
00064 const QString &sentMessageToken, const Tp::TextChannelPtr &channel);
00065 void messageReceived(const Tp::ReceivedMessage &message, const Tp::TextChannelPtr &channel);
00066
00067 private:
00068 TELEPATHY_QT4_NO_EXPORT ContactMessenger(const AccountPtr &account,
00069 const QString &contactIdentifier);
00070
00071 struct Private;
00072 friend struct Private;
00073 Private *mPriv;
00074 };
00075
00076 }
00077
00078 #endif