File indexing completed on 2023-12-03 05:01:56

0001 /*
0002     Copyright (C) 2012  Lasath Fernando <kde@lasath.org>
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 #ifndef KTP_ABSTRACT_MESSAGE_FILTER_H
0020 #define KTP_ABSTRACT_MESSAGE_FILTER_H
0021 
0022 #include <KTp/message.h>
0023 #include <KTp/outgoing-message.h>
0024 
0025 #include <KTp/message-context.h>
0026 #include <KTp/ktpcommoninternals_export.h>
0027 
0028 #include <TelepathyQt/Account>
0029 #include <TelepathyQt/TextChannel>
0030 
0031 namespace KTp
0032 {
0033 
0034 class KTPCOMMONINTERNALS_EXPORT AbstractMessageFilter : public QObject
0035 {
0036     Q_OBJECT
0037 
0038   public:
0039     AbstractMessageFilter(QObject* parent = nullptr);
0040     ~AbstractMessageFilter() override;
0041 
0042     /** Filter messages to show on the UI recieved by another contact*/
0043     virtual void filterMessage(KTp::Message &message, const KTp::MessageContext &context);
0044 
0045     /** Scripts that must be included in the <head> section of the html required by this message filter.*/
0046     virtual QStringList requiredScripts();
0047 
0048     /** Stylesheets that must be included in the <head> section of the html required by this message filter.*/
0049     virtual QStringList requiredStylesheets();
0050 
0051     /** Filter composed messages about to be sent to telepathy backend */
0052     virtual void filterOutgoingMessage(KTp::OutgoingMessage &message, const KTp::MessageContext &context);
0053 };
0054 
0055 }
0056 
0057 #endif // ABSTRACTPLUGIN_H
0058