]> git.meshlink.io Git - catta/blobdiff - avahi-sharp/EntryGroup.cs
really allow varags this time
[catta] / avahi-sharp / EntryGroup.cs
index 74a127cfe64b0c94558beca6e2ee1b04e8bc8b9b..d69e8a635925d0dddffb531da88c35ac5aecce86 100644 (file)
@@ -1,3 +1,24 @@
+/* $Id$ */
+
+/***
+  This file is part of avahi.
+
+  avahi is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+
+  avahi is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+  Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with avahi; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -47,7 +68,7 @@ namespace Avahi
         private static extern IntPtr avahi_string_list_new (IntPtr txt);
 
         [DllImport ("avahi-common")]
-        private static extern void avahi_string_list_add (IntPtr list, IntPtr txt);
+        private static extern IntPtr avahi_string_list_add (IntPtr list, IntPtr txt);
 
         [DllImport ("avahi-common")]
         private static extern void avahi_string_list_free (IntPtr list);
@@ -97,20 +118,20 @@ namespace Avahi
         }
 
         public void AddService (string name, string type, string domain,
-                                UInt16 port, string[] txt)
+                                UInt16 port, params string[] txt)
         {
             AddService (-1, Protocol.Unspecified, name, type, domain, null, port, txt);
         }
 
         public void AddService (int iface, Protocol proto, string name, string type, string domain,
-                                string host, UInt16 port, string[] txt)
+                                string host, UInt16 port, params string[] txt)
         {
             IntPtr list = avahi_string_list_new (IntPtr.Zero);
 
             if (txt != null) {
                 foreach (string item in txt) {
                     IntPtr itemPtr = Utility.StringToPtr (item);
-                    avahi_string_list_add (list, itemPtr);
+                    list = avahi_string_list_add (list, itemPtr);
                     Utility.Free (itemPtr);
                 }
             }
@@ -124,8 +145,6 @@ namespace Avahi
             avahi_string_list_free (list);
 
             client.CheckError ();
-            
-            Console.WriteLine ("Added service: {0}, {1}, {2}, {3}, {4}", name, type, domain, host, port);
         }
 
         private void OnEntryGroupCallback (IntPtr group, EntryGroupState state, IntPtr userdata)