Initial commit
[tietoopcom] / include / defs.h
1 /** \file defs.h
2  * \brief Declarations of global typedefs and enumerators.
3  * 
4  * Tieto Open Communicator - Client for the Telepathy communications framework.
5  * Copyright (c) 2010, Tieto Corporation
6  *
7  * All rights reserved.
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted provided that the following conditions are met:
10  *
11  *      Redistributions of source code must retain the above copyright notice,
12  *      this list of conditions and the following disclaimer.
13  *      Redistributions in binary form must reproduce the above copyright notice,
14  *      this list of conditions and the following disclaimer in the documentation
15  *      and/or other materials provided with the distribution.
16  *      Neither the name of the Tieto Corporation nor the names of its contributors 
17  *      may be used to endorse or promote products derived from this software without
18  *      specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  * 
30  */
31
32 #ifndef DEFS_H
33 #define DEFS_H
34
35 #include <QVariant>
36
37
38 enum Status {
39         Connected = 0,
40         Connecting,
41         Disconnected
42 };
43
44 Q_DECLARE_METATYPE(Status);
45
46 enum Presence {
47         Unspecified = 0,
48         Offline = 1, //must be 1 to be inline with Tapioca
49         Available,
50         Away,
51         XA,
52         Hidden,
53         Busy
54 };
55
56 Q_DECLARE_METATYPE(Presence);
57
58 enum Reason {
59     NoneSpecified = 0,
60     Requested,
61     NetworkError,
62     AuthenticationFailed,
63     EncryptionError,
64     NameInUse,
65     CertificateNotProvided,
66     CertificateUntrusted,
67     CertificateExpired,
68     CertificateNotActivated,
69     CertificateHostnameMismatch,
70     CertificateFingerPrintMismatch,
71     CertificateSigned,
72     CertificateOtherError
73 };
74
75 Q_DECLARE_METATYPE(Reason);
76
77 enum Gender {
78         NotSpecified,
79         Male,
80         Female
81 };
82
83 Q_DECLARE_METATYPE(Gender);
84
85 struct TocContact
86 {
87         QString         uid;
88         QString         name;
89         QString         customIconPath;
90         int             customIconId;
91         Gender          gender;
92         Presence        presence;
93         QString         description;
94 };
95
96 typedef QList<TocContact*> TocContactList;
97
98 Q_DECLARE_METATYPE(TocContactList);
99
100 enum MessageDeliveryError {
101         Unknown = 0,
102         ContactOffline,
103         InvalidContact,
104         PermissionDenied,
105         MessageTooLong,
106         UserOffline,
107         NotOnContactList,
108         CannotCreateChannel,
109         NoError
110 };
111
112 Q_DECLARE_METATYPE(MessageDeliveryError);
113
114 struct Message
115
116         QString                                 contents;
117         uint                                    timestamp;
118         MessageDeliveryError    error;
119 };
120
121 Q_DECLARE_METATYPE(Message);
122
123 #endif // DEFS_H