summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/groupwise/libgroupwise/gwerror.h
blob: f19d3d39516b6fd1643262389321f5c16a9bb930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
    gwerror.h - Kopete Groupwise Protocol
  
    Copyright (c) 2004-2007     Novell, Inc http://www.novell.com/linux
    
    Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
 
    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef GW_ERROR_H
#define GW_ERROR_H

#include <tqdatetime.h>
#include <tqglobal.h>
#include <tqmap.h>
#include <tqstring.h>

typedef TQ_UINT16 NMERR_T;
#define GROUPWISE_DEBUG_GLOBAL 14190
#define GROUPWISE_DEBUG_LIBGW 14191
#define GROUPWISE_DEBUG_RAW 14192

#define BLANK_GUID "[00000000-00000000-00000000-0000-0000]"
#define CONF_GUID_END 27

//#define LIBGW_DEBUG 1
#define LIBGW_USE_KDEBUG 1

namespace GroupWise
{
	enum Status {	Unknown = 0,
					Offline = 1,
					Available = 2,
					Busy = 3,
					Away = 4,
					AwayIdle = 5,
					Invalid = 6
				};
				
	enum Error {	None = 0,
					ErrorBase = 0x2000L,
					BadParm,
					TCPWrite,
					TCPRead,
					Protocol,
					ServerRedirect,
					ConferenceNotFound,
					ConferenceNotInstantiated,
					FolderExists
				};
	
	enum Event {		InvalidRecipient 		= 101,
						UndeliverableStatus 	= 102,
						StatusChange 			= 103,
						ContactAdd 				= 104,
						ConferenceClosed 		= 105,
						ConferenceJoined 		= 106,
						ConferenceLeft 			= 107,
						ReceiveMessage			= 108,
						ReceiveFile				= 109,
						UserTyping				= 112,
						UserNotTyping			= 113,
						UserDisconnect			= 114,
						ServerDisconnect		= 115,
						ConferenceRename		= 116,
						ConferenceInvite		= 117,
						ConferenceInviteNotify	= 118,
						ConferenceReject		= 119,
						ReceiveAutoReply		= 121,
						Start					= InvalidRecipient,
						/* Event codes >= 122 are new in GW7 protocol */
						ReceivedBroadcast		= 122,
						ReceivedSystemBroadcast = 123,
						ConferenceAttribUpdate 	= 128,
						ConferenceTopicChanged	= 129,
						ChatroomNameChanged		= 130,
						ConferenceRightsChanged = 131,
						ConferenceRemoved		= 132, /* you were kicked */
						ChatOwnerChanged		= 133,
						Stop					= ChatOwnerChanged
						
				};
	
	enum ConferenceFlags { 	Logging = 0x00000001,
							Secure  = 0x00000002,
							Closed  = 0x10000000
						 };
	
	TQString errorCodeToString( int errorCode );
	
	// helpful structs used to pass data between the client library and the application using it
	class ConferenceGuid : public TQString 
	{
	public:
		ConferenceGuid();
		ConferenceGuid( const TQString & string );
		~ConferenceGuid();
	};
	
	bool operator==( const ConferenceGuid & g1, const ConferenceGuid & g2 );
	bool operator==( const TQString & s, const ConferenceGuid & g );
	bool operator==( const ConferenceGuid & g, const TQString & s );
	
	struct ConferenceEvent 
	{
		Event type;
		ConferenceGuid guid;
		TQString user;
		TQDateTime timeStamp;
		TQ_UINT32 flags;
		TQString message;
	};
	
	struct FolderItem
	{
		uint id; 
		uint sequence;
		uint parentId;
		TQString name;
	};
	
	struct ContactItem
	{
		uint id;
		uint parentId;
		uint sequence;
		TQString dn;
		TQString displayName;
	};

	struct ContactDetails
	{
		TQString cn, 
				dn, 
				givenName, 
				surname, 
				fullName, 
				awayMessage, 
				authAttribute;
		int status;
		bool archive;
		TQMap< TQString, TQString > properties;
	};

	struct OutgoingMessage
	{
		ConferenceGuid guid;
		TQString message;
		TQString rtfMessage;
	};

	struct UserSearchQueryTerm
	{
		TQString field;
		TQString argument;
		int operation;
	};

	struct CustomStatus
	{
		GroupWise::Status status;
		TQString name;
		TQString autoReply;
	};
}

// temporary typedef pending implementation

// #define NMERR_BASE							0x2000L
// #define NM_OK								0L
// #define NMERR_BAD_PARM						(NMERR_BASE + 0x0001)
// #define NMERR_TCP_WRITE						(NMERR_BASE + 0x0002)
// #define NMERR_TCP_READ						(NMERR_BASE + 0x0003)
// #define NMERR_PROTOCOL						(NMERR_BASE + 0x0004)
// #define NMERR_SERVER_REDIRECT				(NMERR_BASE + 0x0005)
// #define NMERR_CONFERENCE_NOT_FOUND 			(NMERR_BASE + 0x0006)
// #define NMERR_CONFERENCE_NOT_INSTANTIATED 	(NMERR_BASE + 0x0007)
// #define NMERR_FOLDER_EXISTS					(NMERR_BASE + 0x0008)

/* Errors that are returned from the server */
#define NMERR_SERVER_BASE			 	0xD100L
#define NMERR_ACCESS_DENIED			 	(NMERR_SERVER_BASE + 0x0006)
#define NMERR_NOT_SUPPORTED          	(NMERR_SERVER_BASE + 0x000A)
#define NMERR_PASSWORD_EXPIRED       	(NMERR_SERVER_BASE + 0x000B)
#define NMERR_PASSWORD_INVALID       	(NMERR_SERVER_BASE + 0x000C)
#define NMERR_USER_NOT_FOUND         	(NMERR_SERVER_BASE + 0x000D)
#define NMERR_ATTRIBUTE_NOT_FOUND		(NMERR_SERVER_BASE + 0x000E)
#define NMERR_USER_DISABLED          	(NMERR_SERVER_BASE + 0x0010)
#define NMERR_DIRECTORY_FAILURE      	(NMERR_SERVER_BASE + 0x0011)
#define NMERR_HOST_NOT_FOUND		 	(NMERR_SERVER_BASE + 0x0019)
#define NMERR_ADMIN_LOCKED           	(NMERR_SERVER_BASE + 0x001C)
#define NMERR_DUPLICATE_PARTICIPANT  	(NMERR_SERVER_BASE + 0x001F)
#define NMERR_SERVER_BUSY            	(NMERR_SERVER_BASE + 0x0023)
#define NMERR_OBJECT_NOT_FOUND       	(NMERR_SERVER_BASE + 0x0024)
#define NMERR_DIRECTORY_UPDATE       	(NMERR_SERVER_BASE + 0x0025)
#define NMERR_DUPLICATE_FOLDER       	(NMERR_SERVER_BASE + 0x0026)
#define NMERR_DUPLICATE_CONTACT      	(NMERR_SERVER_BASE + 0x0027)
#define NMERR_USER_NOT_ALLOWED       	(NMERR_SERVER_BASE + 0x0028)
#define NMERR_TOO_MANY_CONTACTS      	(NMERR_SERVER_BASE + 0x0029)
#define NMERR_CONFERENCE_NOT_FOUND_2   	(NMERR_SERVER_BASE + 0x002B)
#define NMERR_TOO_MANY_FOLDERS       	(NMERR_SERVER_BASE + 0x002C)
#define NMERR_SERVER_PROTOCOL        	(NMERR_SERVER_BASE + 0x0030)
#define NMERR_CONVERSATION_INVITE		(NMERR_SERVER_BASE + 0x0035)
#define NMERR_USER_BLOCKED	         	(NMERR_SERVER_BASE + 0x0039)
#define NMERR_MASTER_ARCHIVE_MISSING 	(NMERR_SERVER_BASE + 0x003A)
#define NMERR_PASSWORD_EXPIRED_2     	(NMERR_SERVER_BASE + 0x0042)
#define NMERR_CREDENTIALS_MISSING   	(NMERR_SERVER_BASE + 0x0046)
#define NMERR_AUTHENTICATION_FAILED		(NMERR_SERVER_BASE + 0x0049)
#define NMERR_EVAL_CONNECTION_LIMIT		(NMERR_SERVER_BASE + 0x004A)

/* Error codes that are new in GW7 */
#define MSGPRES_ERR_UNSUPPORTED_CLIENT_VERSION  (NMERR_SERVER_BASE + 0x004B) // This version of the client is not supported.
#define MSGPRES_ERR_DUPLICATE_CHAT              (NMERR_SERVER_BASE + 0x0051) // A duplicate chat was found.
#define MSGPRES_ERR_CHAT_NOT_FOUND				(NMERR_SERVER_BASE + 0x0052) // The chat was not found.
#define MSGPRES_ERR_INVALID_NAME				(NMERR_SERVER_BASE + 0x0053) // The chat name is not valid.
#define MSGPRES_ERR_CHAT_ACTIVE					(NMERR_SERVER_BASE + 0x0054) // Cannot delete an active chat.
#define MSGPRES_ERR_INSUF_CONV_RIGHTS			(NMERR_SERVER_BASE + 0x0055) // Insufficient conversation rights to perform an action.
#define MSGPRES_ERR_CHAT_BUSY					(NMERR_SERVER_BASE + 0x0056) // Chat is busy; try again.
#define MSGPRES_ERR_REQUEST_TOO_SOON 			(NMERR_SERVER_BASE + 0x0057) // Tried a request too soon after another one; try again.
#define MSGPRES_INFO_NO_LIST_CHANGE				(NMERR_SERVER_BASE + 0x0058) // The chat list has not changed since the last search.
#define MSGPRES_ERR_CHAT_NOT_ACTIVE				(NMERR_SERVER_BASE + 0x0059) // The chat subsystem is not active!
#define MSGPRES_ERR_INVALID_CHAT_UPDATE			(NMERR_SERVER_BASE + 0x005A) // The chat update request is invalid.
#define MSGPRES_ERR_DIRECTORY_MISMATCH			(NMERR_SERVER_BASE + 0x005B) // Write failed due to directory mismatch.
#define MSGPRES_ERR_RECIPIENT_TOO_OLD			(NMERR_SERVER_BASE + 0x005C) // The recipient's client version is too old.
#define MSGPRES_ERR_CHAT_NO_LONGER_VALID		(NMERR_SERVER_BASE + 0x005D) // The chat has been removed from the server.

/* protocol version capabilities */
#define CMSGPRES_GW_6_5 2
#define CMSGPRES_SUPPORTS_NO_DETAILS_ON_LOGIN 3
#define CMSGPRES_SUPPORTS_BROADCAST 4
#define CMSGPRES_SUPPORTS_CHAT 5

#endif