GetLoopServers Dbus method.
diff --git a/src/dbus.c b/src/dbus.c
index 4696442..9b16bc2 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -35,6 +35,11 @@
" <method name=\"GetVersion\">\n"
" <arg name=\"version\" direction=\"out\" type=\"s\"/>\n"
" </method>\n"
+#ifdef HAVE_LOOP
+" <method name=\"GetLoopServers\">\n"
+" <arg name=\"server\" direction=\"out\" type=\"as\"/>\n"
+" </method>\n"
+#endif
" <method name=\"SetServers\">\n"
" <arg name=\"servers\" direction=\"in\" type=\"av\"/>\n"
" </method>\n"
@@ -205,6 +210,29 @@
cleanup_servers();
}
+#ifdef HAVE_LOOP
+static DBusMessage *dbus_reply_server_loop(DBusMessage *message)
+{
+ DBusMessageIter args, args_iter;
+ struct server *serv;
+ DBusMessage *reply = dbus_message_new_method_return(message);
+
+ dbus_message_iter_init_append (reply, &args);
+ dbus_message_iter_open_container (&args, DBUS_TYPE_ARRAY,DBUS_TYPE_STRING_AS_STRING, &args_iter);
+
+ for (serv = daemon->servers; serv; serv = serv->next)
+ if (serv->flags & SERV_LOOP)
+ {
+ prettyprint_addr(&serv->addr, daemon->addrbuff);
+ dbus_message_iter_append_basic (&args_iter, DBUS_TYPE_STRING, &daemon->addrbuff);
+ }
+
+ dbus_message_iter_close_container (&args, &args_iter);
+
+ return reply;
+}
+#endif
+
static DBusMessage* dbus_read_servers_ex(DBusMessage *message, int strings)
{
DBusMessageIter iter, array_iter, string_iter;
@@ -433,6 +461,12 @@
dbus_message_append_args(reply, DBUS_TYPE_STRING, &v, DBUS_TYPE_INVALID);
}
+#ifdef HAVE_LOOP
+ else if (strcmp(method, "GetLoopServers") == 0)
+ {
+ reply = dbus_reply_server_loop(message);
+ }
+#endif
else if (strcmp(method, "SetServers") == 0)
{
dbus_read_servers(message);