From aa458a0a13d18882354f33c07b0a4e8e82e7a424 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 9 Aug 2005 00:32:32 +0000 Subject: * Update HACKING * Change DBUS API: txt record lists are now coded as "aay" instead of "as". Unfortunately this triggers this bug: https://bugs.freedesktop.org/show_bug.cgi?id=4023 If you want to use avahi-publish-service you need to apply the included patch. * change avahi-bookmarks to listen on 127.0.0.1 only * add ftp and https browsing support to avahi-bookmarks, but disable it due to python-dbus bugs * update avahi module for python to provide functions to convert between tring lists and lists of lists of bytes * add avahi_strlst_add_anonymous() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@281 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-utils/avahi/__init__.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'avahi-utils/avahi/__init__.py') diff --git a/avahi-utils/avahi/__init__.py b/avahi-utils/avahi/__init__.py index c68e177..90d2b76 100644 --- a/avahi-utils/avahi/__init__.py +++ b/avahi-utils/avahi/__init__.py @@ -18,7 +18,7 @@ # USA. # Some definitions matching those in core.h -import socket +import socket, dbus SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION = range(-1, 3) @@ -37,3 +37,40 @@ DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup" DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser" DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser" DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser" + +def byte_array_to_string(s): + r = "" + + for c in s: + + if c >= 32 and c < 127: + r += "%c" % c + else: + r += "." + + return r + +def txt_array_to_string_array(t): + l = [] + + for s in t: + l.append(byte_array_to_string(s)) + + return l + + +def string_to_byte_array(s): + r = [] + + for c in s: + r.append(dbus.Byte(ord(c))) + + return r + +def string_array_to_txt_array(t): + l = [] + + for s in t: + l.append(string_to_byte_array(s)) + + return l -- cgit