File indexing completed on 2023-12-10 04:56:59

0001 /*
0002     Copyright (C) 2013 David Edmundson <kde@davidedmundson.co.uk>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     Lesser General Public License for more details.
0013 
0014     You should have received a copy of the GNU Lesser General Public
0015     License along with this library; if not, write to the Free Software
0016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0017 */
0018 
0019 
0020 #include "outgoing-message.h"
0021 
0022 #include "ktp-debug.h"
0023 #include <QSharedData>
0024 
0025 #include <TelepathyQt/ContactManager>
0026 #include <TelepathyQt/Connection>
0027 
0028 using namespace KTp;
0029 
0030 class OutgoingMessage::Private : public QSharedData {
0031 
0032   public:
0033     Private() {
0034         messageType = Tp::ChannelTextMessageTypeNormal;
0035     }
0036     QString text;
0037     Tp::ChannelTextMessageType messageType;
0038 };
0039 
0040 OutgoingMessage::OutgoingMessage(const OutgoingMessage &other):
0041     d(other.d)
0042 {
0043 }
0044 
0045 OutgoingMessage& OutgoingMessage::operator=(const OutgoingMessage &other) {
0046     d = other.d;
0047     return *this;
0048 }
0049 
0050 OutgoingMessage::OutgoingMessage(const QString &messageText) :
0051     d(new Private)
0052 {
0053     setText(messageText);
0054 }
0055 
0056 OutgoingMessage::~OutgoingMessage()
0057 {
0058 }
0059 
0060 QString OutgoingMessage::text() const
0061 {
0062     return d->text;
0063 }
0064 
0065 void OutgoingMessage::setText(const QString &text)
0066 {
0067     d->text = text;
0068 }
0069 
0070 Tp::ChannelTextMessageType OutgoingMessage::type() const
0071 {
0072     return d->messageType;
0073 }
0074 
0075 void OutgoingMessage::setType(Tp::ChannelTextMessageType type)
0076 {
0077     d->messageType = type;
0078 }