1 /***************************************************************************
2  *   Copyright (C) 2014 by Marcin Ziemiński <zieminn@gmail.com>            *
3  *                                                                         *
4  * This library is free software; you can redistribute it and/or           *
5  * modify it under the terms of the GNU Lesser General Public		   *
6  * License as published by the Free Software Foundation; either		   *
7  * version 2.1 of the License, or (at your option) any later version.	   *
8  * 									   *
9  * This library is distributed in the hope that it will be useful,	   *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of	   *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU	   *
12  * Lesser General Public License for more details.			   *
13  * 									   *
14  * You should have received a copy of the GNU Lesser General Public	   *
15  * License along with this library; if not, write to the Free Software	   *
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*
17  ***************************************************************************/
18 
19 #ifndef KTP_OTR_CONSTANTS_HEADER
20 #define KTP_OTR_CONSTANTS_HEADER
21 
22 namespace KTp
23 {
24 /**
25  * \enum OTRTrustLevel
26  * \ingroup enumtypeconsts
27  *
28  * Enumerated type generated from the specification.
29  *
30  * Enumeration describing trust level of this conversation. The trust level
31  * can only increase unless Initialize/Stop are called or TrustFingerprint is
32  * called with trust=false.
33  */
34 enum OTRTrustLevel
35 {
36     /**
37      * The conversation is currently unencrypted
38      */
39     OTRTrustLevelNotPrivate = 0,
40 
41     /**
42      * The conversation is currently encrypted but the remote end is not
43      * verified
44      */
45     OTRTrustLevelUnverified = 1,
46 
47     /**
48      * The conversation is currently encrypted and the remote end is verified
49      */
50     OTRTrustLevelPrivate = 2,
51 
52     /**
53      * Remote end closed the OTR session, messages cannot be sent anymore.
54      * Either call Stop to continue unencrypted or Initialize to send
55      * encrypted messages again.
56      */
57     OTRTrustLevelFinished = 3,
58 
59     _OTRTrustLevelPadding = 0xffffffffU
60 };
61 
62 /**
63  * \ingroup enumtypeconsts
64  *
65  * 1 higher than the highest valid value of OTRTrustLevel.
66  */
67 const int NUM_OTR_TRUST_LEVELS = (3+1);
68 
69 enum OTRPolicy {
70     OTRPolicyAlways = 0,
71     OTRPolicyOpportunistic = 1,
72     OTRPolicyManual = 2,
73     OTRPolicyNever = 3
74 };
75 
76 
77 /**
78  * OTR message event enum type - the same as OtrlMessageEvent in libotr
79  */
80 enum OTRMessageEvent
81 {
82     OTRL_MSGEVENT_NONE,
83     OTRL_MSGEVENT_ENCRYPTION_REQUIRED,
84     OTRL_MSGEVENT_ENCRYPTION_ERROR,
85     OTRL_MSGEVENT_CONNECTION_ENDED,
86     OTRL_MSGEVENT_SETUP_ERROR,
87     OTRL_MSGEVENT_MSG_REFLECTED,
88     OTRL_MSGEVENT_MSG_RESENT,
89     OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE,
90     OTRL_MSGEVENT_RCVDMSG_UNREADABLE,
91     OTRL_MSGEVENT_RCVDMSG_MALFORMED,
92     OTRL_MSGEVENT_LOG_HEARTBEAT_RCVD,
93     OTRL_MSGEVENT_LOG_HEARTBEAT_SENT,
94     OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR,
95     OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED,
96     OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED,
97     OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE
98 };
99 
100 }
101 
102 #define KTP_PROXY_BUS_NAME (QLatin1String("org.freedesktop.Telepathy.Client.KTp.Proxy"))
103 #define KTP_PROXY_SERVICE_OBJECT_PATH (QLatin1String("/org/freedesktop/TelepathyProxy/ProxyService"))
104 #define KTP_PROXY_CHANNEL_OBJECT_PATH_PREFIX (QLatin1String("/org/freedesktop/TelepathyProxy/OtrChannelProxy/"))
105 
106 #define KTP_IFACE_CHANNEL_PROXY_OTR (QLatin1String("org.kde.TelepathyProxy.ChannelProxy.Interface.OTR"))
107 #define KTP_IFACE_PROXY_SERVICE (QLatin1String("org.kde.TelepathyProxy.ProxyService"))
108 
109 #define KTP_PROXY_ERROR_NOT_CONNECTED (QLatin1String("org.freedesktop.TelepathyProxy.Error.NotConnected"))
110 #define KTP_PROXY_ERROR_ENCRYPTION_ERROR (QLatin1String("org.freedesktop.TelepathyProxy.Error.EncryptionError"))
111 
112 /**
113  * OTR message headers
114  */
115 #define OTR_MESSAGE_EVENT_HEADER       (QLatin1String("otr-message-event"))
116 #define OTR_REMOTE_FINGERPRINT_HEADER  (QLatin1String("otr-remote-fingerprint"))
117 #define OTR_ERROR_HEADER               (QLatin1String("otr-error"))
118 #define OTR_UNENCRYPTED_MESSAGE_HEADER (QLatin1String("otr-unencrypted-message"))
119 
120 #endif
121