File indexing completed on 2023-12-03 08:28:36

0001 /***************************************************************************
0002  *   Copyright (C) 2014 by Marcin ZiemiƄski <zieminn@gmail.com>            *
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 St, Fifth Floor, Boston, MA 02110-1301 USA*
0017  ***************************************************************************/
0018 
0019 #ifndef KTP_OTR_CONSTANTS_HEADER
0020 #define KTP_OTR_CONSTANTS_HEADER
0021 
0022 namespace KTp
0023 {
0024 /**
0025  * \enum OTRTrustLevel
0026  * \ingroup enumtypeconsts
0027  *
0028  * Enumerated type generated from the specification.
0029  *
0030  * Enumeration describing trust level of this conversation. The trust level
0031  * can only increase unless Initialize/Stop are called or TrustFingerprint is
0032  * called with trust=false.
0033  */
0034 enum OTRTrustLevel
0035 {
0036     /**
0037      * The conversation is currently unencrypted
0038      */
0039     OTRTrustLevelNotPrivate = 0,
0040 
0041     /**
0042      * The conversation is currently encrypted but the remote end is not
0043      * verified
0044      */
0045     OTRTrustLevelUnverified = 1,
0046 
0047     /**
0048      * The conversation is currently encrypted and the remote end is verified
0049      */
0050     OTRTrustLevelPrivate = 2,
0051 
0052     /**
0053      * Remote end closed the OTR session, messages cannot be sent anymore.
0054      * Either call Stop to continue unencrypted or Initialize to send
0055      * encrypted messages again.
0056      */
0057     OTRTrustLevelFinished = 3,
0058 
0059     _OTRTrustLevelPadding = 0xffffffffU
0060 };
0061 
0062 /**
0063  * \ingroup enumtypeconsts
0064  *
0065  * 1 higher than the highest valid value of OTRTrustLevel.
0066  */
0067 const int NUM_OTR_TRUST_LEVELS = (3+1);
0068 
0069 enum OTRPolicy {
0070     OTRPolicyAlways = 0,
0071     OTRPolicyOpportunistic = 1,
0072     OTRPolicyManual = 2,
0073     OTRPolicyNever = 3
0074 };
0075 
0076 
0077 /**
0078  * OTR message event enum type - the same as OtrlMessageEvent in libotr
0079  */
0080 enum OTRMessageEvent
0081 {
0082     OTRL_MSGEVENT_NONE,
0083     OTRL_MSGEVENT_ENCRYPTION_REQUIRED,
0084     OTRL_MSGEVENT_ENCRYPTION_ERROR,
0085     OTRL_MSGEVENT_CONNECTION_ENDED,
0086     OTRL_MSGEVENT_SETUP_ERROR,
0087     OTRL_MSGEVENT_MSG_REFLECTED,
0088     OTRL_MSGEVENT_MSG_RESENT,
0089     OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE,
0090     OTRL_MSGEVENT_RCVDMSG_UNREADABLE,
0091     OTRL_MSGEVENT_RCVDMSG_MALFORMED,
0092     OTRL_MSGEVENT_LOG_HEARTBEAT_RCVD,
0093     OTRL_MSGEVENT_LOG_HEARTBEAT_SENT,
0094     OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR,
0095     OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED,
0096     OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED,
0097     OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE
0098 };
0099 
0100 }
0101 
0102 #define KTP_PROXY_BUS_NAME (QLatin1String("org.freedesktop.Telepathy.Client.KTp.Proxy"))
0103 #define KTP_PROXY_SERVICE_OBJECT_PATH (QLatin1String("/org/freedesktop/TelepathyProxy/ProxyService"))
0104 #define KTP_PROXY_CHANNEL_OBJECT_PATH_PREFIX (QLatin1String("/org/freedesktop/TelepathyProxy/OtrChannelProxy/"))
0105 
0106 #define KTP_IFACE_CHANNEL_PROXY_OTR (QLatin1String("org.kde.TelepathyProxy.ChannelProxy.Interface.OTR"))
0107 #define KTP_IFACE_PROXY_SERVICE (QLatin1String("org.kde.TelepathyProxy.ProxyService"))
0108 
0109 #define KTP_PROXY_ERROR_NOT_CONNECTED (QLatin1String("org.freedesktop.TelepathyProxy.Error.NotConnected"))
0110 #define KTP_PROXY_ERROR_ENCRYPTION_ERROR (QLatin1String("org.freedesktop.TelepathyProxy.Error.EncryptionError"))
0111 
0112 /**
0113  * OTR message headers
0114  */
0115 #define OTR_MESSAGE_EVENT_HEADER       (QLatin1String("otr-message-event"))
0116 #define OTR_REMOTE_FINGERPRINT_HEADER  (QLatin1String("otr-remote-fingerprint"))
0117 #define OTR_ERROR_HEADER               (QLatin1String("otr-error"))
0118 #define OTR_UNENCRYPTED_MESSAGE_HEADER (QLatin1String("otr-unencrypted-message"))
0119 
0120 #endif