2 * dbus.c - awesome dbus support
4 * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include <dbus/dbus.h>
36 static DBusConnection
*dbus_connection_session
= NULL
;
37 static DBusConnection
*dbus_connection_system
= NULL
;
38 ev_io dbusio_ses
= { .fd
= -1 };
39 ev_io dbusio_sys
= { .fd
= -1 };
41 static signal_array_t dbus_signals
;
43 /** Clean up the D-Bus connection data members
44 * \param dbus_connection The D-Bus connection to clean up
45 * \param dbusio The D-Bus event watcher
48 a_dbus_cleanup_bus(DBusConnection
*dbus_connection
, ev_io
*dbusio
)
55 ev_ref(EV_DEFAULT_UC
);
56 ev_io_stop(EV_DEFAULT_UC_ dbusio
);
60 /* This is a shared connection owned by libdbus
61 * Do not close it, only unref
63 dbus_connection_unref(dbus_connection
);
66 /** Iterate through the D-Bus messages counting each or traverse each sub message.
67 * \param iter The D-Bus message iterator pointer
68 * \return The number of arguments in the iterator
71 a_dbus_message_iter(DBusMessageIter
*iter
)
77 switch(dbus_message_iter_get_arg_type(iter
))
80 lua_pushnil(globalconf
.L
);
83 case DBUS_TYPE_INVALID
:
85 case DBUS_TYPE_VARIANT
:
87 DBusMessageIter subiter
;
88 dbus_message_iter_recurse(iter
, &subiter
);
89 a_dbus_message_iter(&subiter
);
93 case DBUS_TYPE_DICT_ENTRY
:
95 DBusMessageIter subiter
;
97 /* initialize a sub iterator */
98 dbus_message_iter_recurse(iter
, &subiter
);
99 /* create a new table to store the dict */
100 a_dbus_message_iter(&subiter
);
104 case DBUS_TYPE_STRUCT
:
106 DBusMessageIter subiter
;
107 /* initialize a sub iterator */
108 dbus_message_iter_recurse(iter
, &subiter
);
110 int n
= a_dbus_message_iter(&subiter
);
112 /* create a new table to store all the value */
113 lua_createtable(globalconf
.L
, n
, 0);
114 /* move the table before array elements */
115 lua_insert(globalconf
.L
, - n
- 1);
117 for(int i
= n
; i
> 0; i
--)
118 lua_rawseti(globalconf
.L
, - i
- 1, i
);
122 case DBUS_TYPE_ARRAY
:
124 int array_type
= dbus_message_iter_get_element_type(iter
);
126 if(dbus_type_is_fixed(array_type
))
129 dbus_message_iter_recurse(iter
, &sub
);
134 #define DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(type, dbustype) \
138 dbus_message_iter_get_fixed_array(&sub, &data, &datalen); \
139 lua_createtable(globalconf.L, datalen, 0); \
140 for(int i = 0; i < datalen; i++) \
142 lua_pushnumber(globalconf.L, data[i]); \
143 lua_rawseti(globalconf.L, -2, i + 1); \
147 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16
)
148 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16
)
149 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32
)
150 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32
)
151 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64
)
152 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64
)
153 DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE
)
154 #undef DBUS_MSG_HANDLE_ARRAY_TYPE_NUMBER
158 dbus_message_iter_get_fixed_array(&sub
, &c
, &datalen
);
159 lua_pushlstring(globalconf
.L
, c
, datalen
);
162 case DBUS_TYPE_BOOLEAN
:
164 const dbus_bool_t
*b
;
165 dbus_message_iter_get_fixed_array(&sub
, &b
, &datalen
);
166 lua_createtable(globalconf
.L
, datalen
, 0);
167 for(int i
= 0; i
< datalen
; i
++)
169 lua_pushboolean(globalconf
.L
, b
[i
]);
170 lua_rawseti(globalconf
.L
, -2, i
+ 1);
176 else if(array_type
== DBUS_TYPE_DICT_ENTRY
)
178 DBusMessageIter subiter
;
179 /* initialize a sub iterator */
180 dbus_message_iter_recurse(iter
, &subiter
);
182 /* get the keys and the values
183 * n is the number of entry in dict */
184 int n
= a_dbus_message_iter(&subiter
);
186 /* create a new table to store all the value */
187 lua_createtable(globalconf
.L
, n
, 0);
188 /* move the table before array elements */
189 lua_insert(globalconf
.L
, - (n
* 2) - 1);
191 for(int i
= 0; i
< n
; i
++)
192 lua_rawset(globalconf
.L
, - (n
* 2) - 1 + i
* 2);
196 DBusMessageIter subiter
;
197 /* prepare to dig into the array*/
198 dbus_message_iter_recurse(iter
, &subiter
);
200 /* now iterate over every element of the array */
201 int n
= a_dbus_message_iter(&subiter
);
203 /* create a new table to store all the value */
204 lua_createtable(globalconf
.L
, n
, 0);
205 /* move the table before array elements */
206 lua_insert(globalconf
.L
, - n
- 1);
208 for(int i
= n
; i
> 0; i
--)
209 lua_rawseti(globalconf
.L
, - i
- 1, i
);
214 case DBUS_TYPE_BOOLEAN
:
217 dbus_message_iter_get_basic(iter
, &b
);
218 lua_pushboolean(globalconf
.L
, b
);
225 dbus_message_iter_get_basic(iter
, &c
);
226 lua_pushlstring(globalconf
.L
, &c
, 1);
230 #define DBUS_MSG_HANDLE_TYPE_NUMBER(type, dbustype) \
234 dbus_message_iter_get_basic(iter, &ui); \
235 lua_pushnumber(globalconf.L, ui); \
239 DBUS_MSG_HANDLE_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16
)
240 DBUS_MSG_HANDLE_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16
)
241 DBUS_MSG_HANDLE_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32
)
242 DBUS_MSG_HANDLE_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32
)
243 DBUS_MSG_HANDLE_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64
)
244 DBUS_MSG_HANDLE_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64
)
245 #undef DBUS_MSG_HANDLE_TYPE_NUMBER
246 case DBUS_TYPE_STRING
:
249 dbus_message_iter_get_basic(iter
, &s
);
250 lua_pushstring(globalconf
.L
, s
);
255 } while(dbus_message_iter_next(iter
));
261 a_dbus_convert_value(lua_State
*L
, int idx
, DBusMessageIter
*iter
)
263 /* i is the type name, i+1 the value */
265 const char *type
= lua_tolstring(globalconf
.L
, idx
, &len
);
272 case DBUS_TYPE_ARRAY
:
274 DBusMessageIter subiter
;
275 dbus_message_iter_open_container(iter
, DBUS_TYPE_ARRAY
,
279 int arraylen
= luaA_rawlen(L
, idx
+ 1);
281 if(arraylen
% 2 != 0)
283 luaA_warn(globalconf
.L
,
284 "your D-Bus signal handling method returned wrong number of arguments");
289 lua_pushvalue(L
, idx
+ 1);
291 for(int i
= 1; i
< arraylen
; i
+= 2)
293 lua_rawgeti(L
, -1, i
);
294 lua_rawgeti(L
, -2, i
+ 1);
295 if(!a_dbus_convert_value(L
, -2, &subiter
))
300 /* Remove the array */
303 dbus_message_iter_close_container(iter
, &subiter
);
306 case DBUS_TYPE_BOOLEAN
:
308 dbus_bool_t b
= lua_toboolean(globalconf
.L
, idx
+ 1);
309 dbus_message_iter_append_basic(iter
, DBUS_TYPE_BOOLEAN
, &b
);
312 #define DBUS_MSG_RETURN_HANDLE_TYPE_STRING(dbustype) \
315 const char *s = lua_tostring(globalconf.L, idx + 1); \
317 dbus_message_iter_append_basic(iter, dbustype, &s); \
320 DBUS_MSG_RETURN_HANDLE_TYPE_STRING(DBUS_TYPE_STRING
)
321 DBUS_MSG_RETURN_HANDLE_TYPE_STRING(DBUS_TYPE_BYTE
)
322 #undef DBUS_MSG_RETURN_HANDLE_TYPE_STRING
323 #define DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(type, dbustype) \
326 type num = lua_tonumber(globalconf.L, idx + 1); \
327 dbus_message_iter_append_basic(iter, dbustype, &num); \
330 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(int16_t, DBUS_TYPE_INT16
)
331 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(uint16_t, DBUS_TYPE_UINT16
)
332 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(int32_t, DBUS_TYPE_INT32
)
333 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(uint32_t, DBUS_TYPE_UINT32
)
334 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(int64_t, DBUS_TYPE_INT64
)
335 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(uint64_t, DBUS_TYPE_UINT64
)
336 DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER(double, DBUS_TYPE_DOUBLE
)
337 #undef DBUS_MSG_RETURN_HANDLE_TYPE_NUMBER
343 /** Process a single request from D-Bus
344 * \param dbus_connection The connection to the D-Bus server.
345 * \param msg The D-Bus message request being sent to the D-Bus connection.
348 a_dbus_process_request(DBusConnection
*dbus_connection
, DBusMessage
*msg
)
350 const char *interface
= dbus_message_get_interface(msg
);
351 int old_top
= lua_gettop(globalconf
.L
);
353 lua_createtable(globalconf
.L
, 0, 5);
355 switch(dbus_message_get_type(msg
))
357 case DBUS_MESSAGE_TYPE_SIGNAL
:
358 lua_pushliteral(globalconf
.L
, "signal");
360 case DBUS_MESSAGE_TYPE_METHOD_CALL
:
361 lua_pushliteral(globalconf
.L
, "method_call");
363 case DBUS_MESSAGE_TYPE_METHOD_RETURN
:
364 lua_pushliteral(globalconf
.L
, "method_return");
366 case DBUS_MESSAGE_TYPE_ERROR
:
367 lua_pushliteral(globalconf
.L
, "error");
370 lua_pushliteral(globalconf
.L
, "unknown");
374 lua_setfield(globalconf
.L
, -2, "type");
376 lua_pushstring(globalconf
.L
, interface
);
377 lua_setfield(globalconf
.L
, -2, "interface");
379 const char *s
= dbus_message_get_path(msg
);
380 lua_pushstring(globalconf
.L
, s
);
381 lua_setfield(globalconf
.L
, -2, "path");
383 s
= dbus_message_get_member(msg
);
384 lua_pushstring(globalconf
.L
, s
);
385 lua_setfield(globalconf
.L
, -2, "member");
387 if(dbus_connection
== dbus_connection_system
)
388 lua_pushliteral(globalconf
.L
, "system");
390 lua_pushliteral(globalconf
.L
, "session");
391 lua_setfield(globalconf
.L
, -2, "bus");
393 /* + 1 for the table above */
394 DBusMessageIter iter
;
397 if(dbus_message_iter_init(msg
, &iter
))
398 nargs
+= a_dbus_message_iter(&iter
);
400 if(dbus_message_get_no_reply(msg
))
402 signal_t
*sigfound
= signal_array_getbyid(&dbus_signals
,
403 a_strhash((const unsigned char *) NONULL(interface
)));
406 signal_object_emit(globalconf
.L
, &dbus_signals
, NONULL(interface
), nargs
);
410 signal_t
*sig
= signal_array_getbyid(&dbus_signals
,
411 a_strhash((const unsigned char *) NONULL(interface
)));
414 /* there can be only ONE handler to send reply */
415 void *func
= (void *) sig
->sigfuncs
.tab
[0];
417 int n
= lua_gettop(globalconf
.L
) - nargs
;
419 luaA_object_push(globalconf
.L
, (void *) func
);
420 luaA_dofunction(globalconf
.L
, nargs
, LUA_MULTRET
);
422 n
-= lua_gettop(globalconf
.L
);
424 DBusMessage
*reply
= dbus_message_new_method_return(msg
);
426 dbus_message_iter_init_append(reply
, &iter
);
430 luaA_warn(globalconf
.L
,
431 "your D-Bus signal handling method returned wrong number of arguments");
433 lua_settop(globalconf
.L
, old_top
);
438 for(int i
= n
; i
< 0; i
+= 2)
440 if(!a_dbus_convert_value(globalconf
.L
, i
, &iter
))
442 luaA_warn(globalconf
.L
, "your D-Bus signal handling method returned bad data");
444 lua_settop(globalconf
.L
, old_top
);
448 lua_remove(globalconf
.L
, i
);
449 lua_remove(globalconf
.L
, i
+ 1);
452 dbus_connection_send(dbus_connection
, reply
, NULL
);
453 dbus_message_unref(reply
);
457 lua_settop(globalconf
.L
, old_top
);
460 /** Attempt to process all the requests in the D-Bus connection.
461 * \param dbus_connection The D-Bus connection to process from
462 * \param dbusio The D-Bus event watcher
465 a_dbus_process_requests_on_bus(DBusConnection
*dbus_connection
, ev_io
*dbusio
)
472 dbus_connection_read_write(dbus_connection
, 0);
474 if(!(msg
= dbus_connection_pop_message(dbus_connection
)))
477 if(dbus_message_is_signal(msg
, DBUS_INTERFACE_LOCAL
, "Disconnected"))
479 a_dbus_cleanup_bus(dbus_connection
, dbusio
);
480 dbus_message_unref(msg
);
484 a_dbus_process_request(dbus_connection
, msg
);
486 dbus_message_unref(msg
);
492 dbus_connection_flush(dbus_connection
);
495 /** Foreword D-Bus process session requests on too the correct function.
496 * \param w The D-Bus event watcher
497 * \param revents (not used)
500 a_dbus_process_requests_session(EV_P_ ev_io
*w
, int revents
)
502 a_dbus_process_requests_on_bus(dbus_connection_session
, w
);
505 /** Foreword D-Bus process system requests on too the correct function.
506 * \param w The D-Bus event watcher
507 * \param revents (not used)
510 a_dbus_process_requests_system(EV_P_ ev_io
*w
, int revents
)
512 a_dbus_process_requests_on_bus(dbus_connection_system
, w
);
515 /** Attempt to request a D-Bus name
516 * \param dbus_connection The application's connection to D-Bus
517 * \param name The D-Bus connection name to be requested
518 * \return true if the name is primary owner or the name is already
519 * the owner, otherwise false.
522 a_dbus_request_name(DBusConnection
*dbus_connection
, const char *name
)
529 dbus_error_init(&err
);
531 int ret
= dbus_bus_request_name(dbus_connection
, name
, 0, &err
);
533 if(dbus_error_is_set(&err
))
535 warn("failed to request D-Bus name: %s", err
.message
);
536 dbus_error_free(&err
);
542 case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
:
544 case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER
:
545 warn("already primary D-Bus name owner for %s", name
);
551 /** Attempt to release the D-Bus name owner
552 * \param dbus_connection The application's connection to the D-Bus
553 * \param name The name to be released
554 * \return True on success. False if the name is not
555 * the owner, or does not exist.
558 a_dbus_release_name(DBusConnection
*dbus_connection
, const char *name
)
565 dbus_error_init(&err
);
567 int ret
= dbus_bus_release_name(dbus_connection
, name
, &err
);
569 if(dbus_error_is_set(&err
))
571 warn("failed to release D-Bus name: %s", err
.message
);
572 dbus_error_free(&err
);
578 case DBUS_RELEASE_NAME_REPLY_NOT_OWNER
:
579 warn("not primary D-Bus name owner for %s", name
);
581 case DBUS_RELEASE_NAME_REPLY_NON_EXISTENT
:
582 warn("non existent D-Bus name: %s", name
);
588 /** Attempt to create a new connection to D-Bus
589 * \param type The bus type to use when connecting to D-Bus
590 * \param type_name The bus type name eg: "session" or "system"
591 * \param dbusio The D-Bus event watcher
592 * \param cb Function callback to use when processing requests
593 * \return The requested D-Bus connection on success, NULL on failure.
595 static DBusConnection
*
596 a_dbus_connect(DBusBusType type
, const char *type_name
,
597 ev_io
*dbusio
, void *cb
)
600 DBusConnection
*dbus_connection
;
603 dbus_error_init(&err
);
605 dbus_connection
= dbus_bus_get(type
, &err
);
606 if(dbus_error_is_set(&err
))
608 warn("D-Bus session bus %s failed: %s", type_name
, err
.message
);
609 dbus_connection
= NULL
;
610 dbus_error_free(&err
);
614 dbus_connection_set_exit_on_disconnect(dbus_connection
, false);
615 if(dbus_connection_get_unix_fd(dbus_connection
, &fd
))
617 fcntl(fd
, F_SETFD
, FD_CLOEXEC
);
619 ev_io_init(dbusio
, cb
, fd
, EV_READ
);
620 ev_io_start(EV_DEFAULT_UC_ dbusio
);
621 ev_unref(EV_DEFAULT_UC
);
625 warn("cannot get D-Bus connection file descriptor");
626 a_dbus_cleanup_bus(dbus_connection
, dbusio
);
630 return dbus_connection
;
633 /** Initialize the D-Bus session and system
638 dbus_connection_session
= a_dbus_connect(DBUS_BUS_SESSION
, "session",
639 &dbusio_ses
, a_dbus_process_requests_session
);
640 dbus_connection_system
= a_dbus_connect(DBUS_BUS_SYSTEM
, "system",
641 &dbusio_sys
, a_dbus_process_requests_system
);
644 /** Cleanup the D-Bus session and system
649 a_dbus_cleanup_bus(dbus_connection_session
, &dbusio_ses
);
650 a_dbus_cleanup_bus(dbus_connection_system
, &dbusio_sys
);
653 /** Retrieve the D-Bus bus by it's name
654 * \param name The name of the bus
655 * \return The corresponding D-Bus connection
657 static DBusConnection
*
658 a_dbus_bus_getbyname(const char *name
)
660 if(A_STREQ(name
, "system"))
661 return dbus_connection_system
;
662 if(A_STREQ(name
, "session"))
663 return dbus_connection_session
;
667 /** Register a D-Bus name to receive message from.
668 * \param L The Lua VM state.
669 * \return The number of elements pushed on stack.
671 * \lparam A string indicating if we are using system or session bus.
672 * \lparam A string with the name of the D-Bus name to register.
673 * \lreturn True if everything worked fine, false otherwise.
676 luaA_dbus_request_name(lua_State
*L
)
678 const char *bus
= luaL_checkstring(L
, 1);
679 const char *name
= luaL_checkstring(L
, 2);
680 DBusConnection
*dbus_connection
= a_dbus_bus_getbyname(bus
);
681 lua_pushboolean(L
, a_dbus_request_name(dbus_connection
, name
));
685 /** Release a D-Bus name.
686 * \param L The Lua VM state.
687 * \return The number of elements pushed on stack.
689 * \lparam A string indicating if we are using system or session bus.
690 * \lparam A string with the name of the D-Bus name to unregister.
691 * \lreturn True if everything worked fine, false otherwise.
694 luaA_dbus_release_name(lua_State
*L
)
696 const char *bus
= luaL_checkstring(L
, 1);
697 const char *name
= luaL_checkstring(L
, 2);
698 DBusConnection
*dbus_connection
= a_dbus_bus_getbyname(bus
);
699 lua_pushboolean(L
, a_dbus_release_name(dbus_connection
, name
));
703 /** Add a match rule to match messages going through the message bus.
704 * \param L The Lua VM state.
705 * \return The number of elements pushed on stack.
707 * \lparam A string indicating if we are using system or session bus.
708 * \lparam A string with the name of the match rule.
711 luaA_dbus_add_match(lua_State
*L
)
713 const char *bus
= luaL_checkstring(L
, 1);
714 const char *name
= luaL_checkstring(L
, 2);
715 DBusConnection
*dbus_connection
= a_dbus_bus_getbyname(bus
);
719 dbus_bus_add_match(dbus_connection
, name
, NULL
);
720 dbus_connection_flush(dbus_connection
);
726 /** Remove a previously added match rule "by value"
727 * (the most recently-added identical rule gets removed).
728 * \param L The Lua VM state.
729 * \return The number of elements pushed on stack.
731 * \lparam A string indicating if we are using system or session bus.
732 * \lparam A string with the name of the match rule.
735 luaA_dbus_remove_match(lua_State
*L
)
737 const char *bus
= luaL_checkstring(L
, 1);
738 const char *name
= luaL_checkstring(L
, 2);
739 DBusConnection
*dbus_connection
= a_dbus_bus_getbyname(bus
);
743 dbus_bus_remove_match(dbus_connection
, name
, NULL
);
744 dbus_connection_flush(dbus_connection
);
750 /** Add a signal receiver on the D-Bus.
751 * \param L The Lua VM state.
752 * \return The number of elements pushed on stack.
754 * \lparam A string with the interface name.
755 * \lparam The function to call.
758 luaA_dbus_connect_signal(lua_State
*L
)
760 const char *name
= luaL_checkstring(L
, 1);
761 luaA_checkfunction(L
, 2);
762 signal_t
*sig
= signal_array_getbyid(&dbus_signals
,
763 a_strhash((const unsigned char *) name
));
765 luaA_warn(L
, "cannot add signal %s on D-Bus, already existing", name
);
768 signal_add(&dbus_signals
, name
);
769 signal_connect(&dbus_signals
, name
, luaA_object_ref(L
, 2));
774 /** Add a signal receiver on the D-Bus.
775 * \param L The Lua VM state.
776 * \return The number of elements pushed on stack.
778 * \lparam A string with the interface name.
779 * \lparam The function to call.
782 luaA_dbus_disconnect_signal(lua_State
*L
)
784 const char *name
= luaL_checkstring(L
, 1);
785 luaA_checkfunction(L
, 2);
786 const void *func
= lua_topointer(L
, 2);
787 signal_disconnect(&dbus_signals
, name
, func
);
788 luaA_object_unref(L
, (void *) func
);
792 const struct luaL_Reg awesome_dbus_lib
[] =
794 { "request_name", luaA_dbus_request_name
},
795 { "release_name", luaA_dbus_release_name
},
796 { "add_match", luaA_dbus_add_match
},
797 { "remove_match", luaA_dbus_remove_match
},
798 { "connect_signal", luaA_dbus_connect_signal
},
799 { "disconnect_signal", luaA_dbus_disconnect_signal
},
803 #else /* WITH_DBUS */
805 /** Empty stub if dbus is not enabled */
811 /** Empty stub if dbus is not enabled */
818 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80