File indexing completed on 2023-12-03 08:28:37
0001 /* 0002 Copyright (C) 2014 Marcin ZiemiĆski <zieminn@gmail.com> 0003 0004 This program is free software: you can redistribute it and/or modify 0005 it under the terms of the GNU General Public License as published by 0006 the Free Software Foundation, either version 2 of the License, or 0007 (at your option) any later version. 0008 0009 This program 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 0012 GNU General Public License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef OTR_UTILS_HEADER 0019 #define OTR_UTILS_HEADER 0020 0021 #include "ktpotr_export.h" 0022 0023 #include <TelepathyQt/PendingVariant> 0024 #include <TelepathyQt/Types> 0025 #include <TelepathyQt/ReceivedMessage> 0026 #include <TelepathyQt/TextChannel> 0027 0028 namespace KTp { 0029 namespace Utils { 0030 0031 /** Extracts pending-messages-ids from message list */ 0032 KTPOTR_EXPORT Tp::UIntList getPendingMessagesIDs(const QList<Tp::ReceivedMessage> &messageQueue); 0033 0034 /** Extracts pending-mesage-id from message */ 0035 KTPOTR_EXPORT uint getId(const Tp::MessagePartList &message); 0036 0037 /** Returns an object path for the otr proxy channel given a text channel it corresponds to */ 0038 KTPOTR_EXPORT QString getOtrProxyObjectPathFor(const Tp::TextChannelPtr &textChannel); 0039 0040 /** Returns true if message is generated internally by OTR implementation */ 0041 KTPOTR_EXPORT bool isOtrEvent(const Tp::ReceivedMessage &message); 0042 0043 /** Returns true if text is an OTR protocol message */ 0044 KTPOTR_EXPORT bool isOtrMessage(const QString &text); 0045 0046 /** Returns notification for a user assuming that the message is an otr event */ 0047 KTPOTR_EXPORT QString processOtrMessage(const Tp::ReceivedMessage &message); 0048 } 0049 } 0050 0051 #endif