summaryrefslogtreecommitdiffstats
path: root/network/server.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-22 15:03:34 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-22 15:03:34 +0000
commit04b559087e7a2a593822ca933e3f7aca3700fa43 (patch)
treec2f35e7073aca432a585f233f0c7b04e79aa61ff /network/server.c
parent0506dca4cd766729a580bd81fa5c69b4e45a47fa (diff)
network: Added Server.GetName()
Diffstat (limited to 'network/server.c')
-rw-r--r--network/server.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/network/server.c b/network/server.c
index 3318eecf..bf1e45fc 100644
--- a/network/server.c
+++ b/network/server.c
@@ -40,8 +40,10 @@
#include "server.h"
struct network_server {
- char *uuid;
+
+ char *name;
char *path;
+ char *uuid;
};
static DBusHandlerResult get_uuid(DBusConnection *conn,
@@ -79,10 +81,23 @@ static DBusHandlerResult set_name(DBusConnection *conn, DBusMessage *msg,
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-static DBusHandlerResult get_name(DBusConnection *conn, DBusMessage *msg,
- void *data)
+static DBusHandlerResult get_name(DBusConnection *conn,
+ DBusMessage *msg, void *data)
{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ struct network_server *ns = data;
+ char name[] = "";
+ const char *pname = (ns->name ? ns->name : name);
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &pname,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
}
static DBusHandlerResult set_address_range(DBusConnection *conn,