1 /*
2  * defs.h - miscellaneous definitions
3  *
4  * Copyright (C) 2007-2009 Collabora Ltd.
5  * Copyright (C) 2007-2009 Nokia Corporation
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #if defined (TP_DISABLE_SINGLE_INCLUDE) && !defined (_TP_IN_META_HEADER) && !defined (_TP_COMPILATION)
23 #error "Only <telepathy-glib/telepathy-glib.h> and <telepathy-glib/telepathy-glib-dbus.h> can be included directly."
24 #endif
25 
26 #ifndef __TP_DEFS_H__
27 #define __TP_DEFS_H__
28 
29 #include <glib.h>
30 #include <telepathy-glib/version.h>
31 
32 G_BEGIN_DECLS
33 
34 /**
35  * TP_CM_BUS_NAME_BASE:
36  *
37  * The prefix for a connection manager's bus name, to which the CM's name
38  * (e.g. "gabble") should be appended.
39  */
40 #define TP_CM_BUS_NAME_BASE    "org.freedesktop.Telepathy.ConnectionManager."
41 
42 /**
43  * TP_CM_OBJECT_PATH_BASE:
44  *
45  * The prefix for a connection manager's object path, to which the CM's name
46  * (e.g. "gabble") should be appended.
47  */
48 #define TP_CM_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/ConnectionManager/"
49 
50 /**
51  * TP_CONN_BUS_NAME_BASE:
52  *
53  * The prefix for a connection's bus name, to which the CM's name
54  * (e.g. "gabble"), the protocol (e.g. "jabber") and an element or sequence
55  * of elements representing the account should be appended.
56  */
57 #define TP_CONN_BUS_NAME_BASE "org.freedesktop.Telepathy.Connection."
58 
59 /**
60  * TP_CONN_OBJECT_PATH_BASE:
61  *
62  * The prefix for a connection's object path, to which the CM's name
63  * (e.g. "gabble"), the protocol (e.g. "jabber") and an element or sequence
64  * of elements representing the account should be appended.
65  */
66 #define TP_CONN_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Connection/"
67 
68 /**
69  * TP_ACCOUNT_MANAGER_BUS_NAME:
70  *
71  * The account manager's well-known bus name
72  */
73 #define TP_ACCOUNT_MANAGER_BUS_NAME "org.freedesktop.Telepathy.AccountManager"
74 
75 /**
76  * TP_ACCOUNT_MANAGER_OBJECT_PATH:
77  *
78  * The account manager's standard object path
79  */
80 #define TP_ACCOUNT_MANAGER_OBJECT_PATH "/org/freedesktop/Telepathy/AccountManager"
81 
82 /**
83  * TP_ACCOUNT_OBJECT_PATH_BASE:
84  *
85  * The common prefix of the object path for all Account objects.
86  */
87 #define TP_ACCOUNT_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Account/"
88 
89 /**
90  * TP_CHANNEL_DISPATCHER_BUS_NAME:
91  *
92  * The channel dispatcher's well-known bus name
93  */
94 #define TP_CHANNEL_DISPATCHER_BUS_NAME "org.freedesktop.Telepathy.ChannelDispatcher"
95 
96 /**
97  * TP_CHANNEL_DISPATCHER_OBJECT_PATH:
98  *
99  * The channel dispatcher's standard object path
100  */
101 #define TP_CHANNEL_DISPATCHER_OBJECT_PATH "/org/freedesktop/Telepathy/ChannelDispatcher"
102 
103 /**
104  * TP_CLIENT_BUS_NAME_BASE:
105  *
106  * The common prefix of the well-known bus name for any Telepathy Client.
107  */
108 #define TP_CLIENT_BUS_NAME_BASE "org.freedesktop.Telepathy.Client."
109 
110 /**
111  * TP_CLIENT_OBJECT_PATH_BASE:
112  *
113  * The common prefix of the well-known object path for any Telepathy Client.
114  */
115 #define TP_CLIENT_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Client/"
116 
117 /**
118  * TP_DEBUG_OBJECT_PATH:
119  *
120  * The standard path for objects implementing the Telepathy Debug interface
121  * (#TpSvcDebug).
122  */
123 #define TP_DEBUG_OBJECT_PATH "/org/freedesktop/Telepathy/debug"
124 
125 /**
126  * TP_USER_ACTION_TIME_NOT_USER_ACTION:
127  *
128  * The "user action time" used by methods like
129  * tp_account_channel_request_new() to represent channel requests that are
130  * not a result of user action.
131  *
132  * See also #TpAccountChannelRequest:user-action-time,
133  * tp_user_action_time_from_x11(), tp_user_action_time_should_present() and
134  * %TP_USER_ACTION_TIME_CURRENT_TIME.
135  *
136  * Since: 0.11.13
137  */
138 #define TP_USER_ACTION_TIME_NOT_USER_ACTION (G_GINT64_CONSTANT (0))
139 
140 /**
141  * TP_USER_ACTION_TIME_CURRENT_TIME:
142  *
143  * The "user action time" used by methods like
144  * tp_account_channel_request_new() to represent channel requests that should
145  * be treated as though they happened at the current time. This is the same
146  * concept as %GDK_CURRENT_TIME in GDK (but note that the numerical value used
147  * in Telepathy is not the same).
148  *
149  * See also #TpAccountChannelRequest:user-action-time,
150  * tp_user_action_time_from_x11(), tp_user_action_time_should_present() and
151  * %TP_USER_ACTION_TIME_NOT_USER_ACTION.
152  *
153  * Since: 0.11.13
154  */
155 #define TP_USER_ACTION_TIME_CURRENT_TIME (G_MAXINT64)
156 
157 #define _TP_ENCODE_VERSION(major, minor) (((major) << 16) | ((minor) << 8))
158 
159 #define TP_VERSION_0_16 (_TP_ENCODE_VERSION (0, 16))
160 #define TP_VERSION_0_18 (_TP_ENCODE_VERSION (0, 18))
161 #define TP_VERSION_0_20 (_TP_ENCODE_VERSION (0, 20))
162 #define TP_VERSION_0_22 (_TP_ENCODE_VERSION (0, 22))
163 #define TP_VERSION_0_24 (_TP_ENCODE_VERSION (0, 24))
164 #define TP_VERSION_1_0 (_TP_ENCODE_VERSION (1, 0))
165 
166 #if (TP_MINOR_VERSION == 99)
167   /* special case for telepathy-glib 1.0 prereleases */
168 # define _TP_VERSION_CUR_STABLE (_TP_ENCODE_VERSION (TP_MAJOR_VERSION + 1, 0))
169 #elif (TP_MINOR_VERSION == 0)
170   /* special case for telepathy-glib 1.0 itself */
171 # define _TP_VERSION_CUR_STABLE (_TP_ENCODE_VERSION (TP_MAJOR_VERSION, 0))
172 #elif (TP_MICRO_VERSION >= 99 && (TP_MINOR_VERSION % 2) == 0)
173   /* development branch about to start (0.18.999.1) */
174 # define _TP_VERSION_CUR_STABLE \
175   (_TP_ENCODE_VERSION (TP_MAJOR_VERSION, TP_MINOR_VERSION + 2))
176 #elif (TP_MINOR_VERSION % 2)
177   /* development branch */
178 # define _TP_VERSION_CUR_STABLE \
179   (_TP_ENCODE_VERSION (TP_MAJOR_VERSION, TP_MINOR_VERSION + 1))
180 #else
181   /* stable branch */
182 # define _TP_VERSION_CUR_STABLE \
183   (_TP_ENCODE_VERSION (TP_MAJOR_VERSION, TP_MINOR_VERSION))
184 #endif
185 
186 #ifndef TP_VERSION_MIN_REQUIRED
187 # define TP_VERSION_MIN_REQUIRED (_TP_VERSION_CUR_STABLE)
188 #endif
189 
190 #ifndef TP_VERSION_MAX_ALLOWED
191 # define TP_VERSION_MAX_ALLOWED (_TP_VERSION_CUR_STABLE)
192 #endif
193 
194 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_MIN_REQUIRED
195 # error "TP_VERSION_MAX_ALLOWED must be >= TP_VERSION_MIN_REQUIRED"
196 #endif
197 #if TP_VERSION_MIN_REQUIRED < TP_VERSION_0_16
198 # error "TP_VERSION_MIN_REQUIRED must be >= TP_VERSION_0_16"
199 #endif
200 
201 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_0_16
202 # define _TP_DEPRECATED_IN_0_16 _TP_DEPRECATED
203 # define _TP_DEPRECATED_IN_0_16_FOR(f) _TP_DEPRECATED_FOR(f)
204 #else
205 # define _TP_DEPRECATED_IN_0_16 /* nothing */
206 # define _TP_DEPRECATED_IN_0_16_FOR(f) /* nothing */
207 #endif
208 
209 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_0_18
210 # define _TP_DEPRECATED_IN_0_18 _TP_DEPRECATED
211 # define _TP_DEPRECATED_IN_0_18_FOR(f) _TP_DEPRECATED_FOR(f)
212 #else
213 # define _TP_DEPRECATED_IN_0_18 /* nothing */
214 # define _TP_DEPRECATED_IN_0_18_FOR(f) /* nothing */
215 #endif
216 
217 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_0_20
218 # define _TP_DEPRECATED_IN_0_20 _TP_DEPRECATED
219 # define _TP_DEPRECATED_IN_0_20_FOR(f) _TP_DEPRECATED_FOR(f)
220 #else
221 # define _TP_DEPRECATED_IN_0_20 /* nothing */
222 # define _TP_DEPRECATED_IN_0_20_FOR(f) /* nothing */
223 #endif
224 
225 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_0_22
226 # define _TP_DEPRECATED_IN_0_22 _TP_DEPRECATED
227 # define _TP_DEPRECATED_IN_0_22_FOR(f) _TP_DEPRECATED_FOR(f)
228 #else
229 # define _TP_DEPRECATED_IN_0_22 /* nothing */
230 # define _TP_DEPRECATED_IN_0_22_FOR(f) /* nothing */
231 #endif
232 
233 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_0_24
234 # define _TP_DEPRECATED_IN_0_24 _TP_DEPRECATED
235 # define _TP_DEPRECATED_IN_0_24_FOR(f) _TP_DEPRECATED_FOR(f)
236 #else
237 # define _TP_DEPRECATED_IN_0_24 /* nothing */
238 # define _TP_DEPRECATED_IN_0_24_FOR(f) /* nothing */
239 #endif
240 
241 #if TP_VERSION_MIN_REQUIRED >= TP_VERSION_1_0
242 # define _TP_DEPRECATED_IN_1_0 _TP_DEPRECATED
243 # define _TP_DEPRECATED_IN_1_0_FOR(f) _TP_DEPRECATED_FOR(f)
244 #else
245 # define _TP_DEPRECATED_IN_1_0 /* nothing */
246 # define _TP_DEPRECATED_IN_1_0_FOR(f) /* nothing */
247 #endif
248 
249 #if TP_VERSION_MIN_REQUIRED >= _TP_VERSION_CUR_STABLE
250 # define _TP_DEPRECATED_IN_UNRELEASED _TP_DEPRECATED
251 # define _TP_DEPRECATED_IN_UNRELEASED_FOR(f) _TP_DEPRECATED_FOR(f)
252 #else
253 # define _TP_DEPRECATED_IN_UNRELEASED /* nothing */
254 # define _TP_DEPRECATED_IN_UNRELEASED_FOR(f) /* nothing */
255 #endif
256 
257 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_0_16
258 # define _TP_AVAILABLE_IN_0_16 _TP_UNAVAILABLE(0, 16)
259 #else
260 # define _TP_AVAILABLE_IN_0_16 /* nothing */
261 #endif
262 
263 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_0_18
264 # define _TP_AVAILABLE_IN_0_18 _TP_UNAVAILABLE(0, 18)
265 #else
266 # define _TP_AVAILABLE_IN_0_18 /* nothing */
267 #endif
268 
269 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_0_20
270 # define _TP_AVAILABLE_IN_0_20 _TP_UNAVAILABLE(0, 20)
271 #else
272 # define _TP_AVAILABLE_IN_0_20 /* nothing */
273 #endif
274 
275 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_0_22
276 # define _TP_AVAILABLE_IN_0_22 _TP_UNAVAILABLE(0, 22)
277 #else
278 # define _TP_AVAILABLE_IN_0_22 /* nothing */
279 #endif
280 
281 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_0_24
282 # define _TP_AVAILABLE_IN_0_24 _TP_UNAVAILABLE(0, 24)
283 #else
284 # define _TP_AVAILABLE_IN_0_24 /* nothing */
285 #endif
286 
287 #if TP_VERSION_MAX_ALLOWED < TP_VERSION_1_0
288 # define _TP_AVAILABLE_IN_1_0 _TP_UNAVAILABLE(1, 0)
289 #else
290 # define _TP_AVAILABLE_IN_1_0 /* nothing */
291 #endif
292 
293 #if TP_VERSION_MAX_ALLOWED < _TP_VERSION_CUR_STABLE
294 # define _TP_AVAILABLE_IN_UNRELEASED \
295   _TP_UNAVAILABLE (TP_MAJOR_VERSION, TP_MINOR_VERSION)
296 #else
297 # define _TP_AVAILABLE_IN_UNRELEASED /* nothing */
298 #endif
299 
300 /* telepathy-glib-specific macros so our regression
301  * tests can continue to test deprecated functionality, while avoiding
302  * deprecated bits of other libraries */
303 #ifdef _TP_IGNORE_DEPRECATIONS
304 #define _TP_DEPRECATED /* nothing */
305 #define _TP_DEPRECATED_FOR(f) /* nothing */
306 #define _TP_UNAVAILABLE(major, minor) /* nothing */
307 #define _TP_GNUC_DEPRECATED /* nothing */
308 #define _TP_GNUC_DEPRECATED_FOR(f) /* nothing */
309 #else
310 #define _TP_DEPRECATED G_DEPRECATED
311 #define _TP_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
312 #define _TP_UNAVAILABLE(major, minor) G_UNAVAILABLE(major, minor)
313   /* Available for typedefs etc., not just functions, but gcc-specific */
314 #define _TP_GNUC_DEPRECATED G_GNUC_DEPRECATED
315 #define _TP_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED_FOR(f)
316 #endif
317 
318 /* like G_SEAL */
319 #if (defined (TP_SEAL_ENABLE) || defined (TP_DISABLE_DEPRECATED)) \
320   && !defined (_TP_COMPILATION)
321 # define _TP_SEAL(ident) _tp_sealed__ ## ident
322 #else
323 # define _TP_SEAL(ident) ident
324 #endif
325 
326 G_END_DECLS
327 #endif
328