ekiga r6908 - in trunk/lib/engine: components/avahi-publisher presence/avahi
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6908 - in trunk/lib/engine: components/avahi-publisher presence/avahi
- Date: Wed, 10 Sep 2008 13:47:37 +0000 (UTC)
Author: jpuydt
Date: Wed Sep 10 13:47:37 2008
New Revision: 6908
URL: http://svn.gnome.org/viewvc/ekiga?rev=6908&view=rev
Log:
Made the avahi code compatible with 2.0 (except presence), and fixed #551608.
Modified:
trunk/lib/engine/components/avahi-publisher/avahi-publisher.cpp
trunk/lib/engine/presence/avahi/avahi-heap.cpp
Modified: trunk/lib/engine/components/avahi-publisher/avahi-publisher.cpp
==============================================================================
--- trunk/lib/engine/components/avahi-publisher/avahi-publisher.cpp (original)
+++ trunk/lib/engine/components/avahi-publisher/avahi-publisher.cpp Wed Sep 10 13:47:37 2008
@@ -71,7 +71,7 @@
core(core_), details(details_), call_core(call_core_),
client(NULL), group(NULL)
{
- name = avahi_strdup (PACKAGE_NAME " " PACKAGE_VERSION);
+ name = avahi_strdup (details.get_display_name ().c_str ());
glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
create_client ();
}
@@ -115,11 +115,12 @@
iter->protocol.c_str ());
/* FIXME: no collision checking here */
- ret =avahi_entry_group_update_service_txt_strlst (group, AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- (AvahiPublishFlags)0,
- name, typ, NULL,
- txt_record);
+ ret =
+ avahi_entry_group_update_service_txt_strlst (group, AVAHI_IF_UNSPEC,
+ AVAHI_PROTO_UNSPEC,
+ (AvahiPublishFlags)0,
+ name, typ, NULL,
+ txt_record);
}
}
}
@@ -281,8 +282,8 @@
"status=%s",
details.get_long_status ().c_str ());
result = avahi_string_list_add_printf (result,
- "display_name=%s",
- details.get_display_name ().c_str ());
+ "software=%s %s",
+ PACKAGE_NAME, PACKAGE_VERSION);
return result;
}
Modified: trunk/lib/engine/presence/avahi/avahi-heap.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-heap.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-heap.cpp Wed Sep 10 13:47:37 2008
@@ -112,14 +112,14 @@
Avahi::Heap::~Heap ()
{
- if (browser != NULL)
- avahi_service_browser_free (browser);
+ if (browser != NULL)
+ avahi_service_browser_free (browser);
- if (client != NULL)
- avahi_client_free (client);
+ if (client != NULL)
+ avahi_client_free (client);
- if (poll != NULL)
- avahi_glib_poll_free (poll);
+ if (poll != NULL)
+ avahi_glib_poll_free (poll);
}
@@ -154,11 +154,11 @@
/* bad, bad: free the client and try to get another one... but
* won't I tax the box?
*/
- if (client != NULL)
- avahi_client_free (client);
- client = NULL;
- ; // FIXME: better error reporting
- break;
+ if (client != NULL)
+ avahi_client_free (client);
+ client = NULL;
+ ; // FIXME: better error reporting
+ break;
case AVAHI_CLIENT_S_RUNNING:
/* this may not be the final valid browser pointer...
* we'll take what our callback gets
@@ -201,40 +201,40 @@
switch (event) {
- case AVAHI_BROWSER_NEW:
- /* this may not be the final valid resolver pointer...
- * we'll take what our callback gets
- */
- resolver = avahi_service_resolver_new (client, interface, protocol,
- name, type, domain,
- AVAHI_PROTO_UNSPEC,
- (AvahiLookupFlags)0,
- avahi_resolver_callback, this);
- /* if (resolver == NULL) FIXME: better error reporting */
- break;
-
- case AVAHI_BROWSER_REMOVE:
- for (iterator iter = begin () ;
- !found && iter != end ();
- iter++)
- if ((*iter).get_name () == name) {
+ case AVAHI_BROWSER_NEW:
+ /* this may not be the final valid resolver pointer...
+ * we'll take what our callback gets
+ */
+ resolver = avahi_service_resolver_new (client, interface, protocol,
+ name, type, domain,
+ AVAHI_PROTO_UNSPEC,
+ (AvahiLookupFlags)0,
+ avahi_resolver_callback, this);
+ /* if (resolver == NULL) FIXME: better error reporting */
+ break;
+
+ case AVAHI_BROWSER_REMOVE:
+ for (iterator iter = begin () ;
+ !found && iter != end ();
+ iter++)
+ if ((*iter).get_name () == name) {
- found = true;
- (*iter).removed.emit ();
- }
- break;
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- // FIXME: do I care?
- break;
- case AVAHI_BROWSER_ALL_FOR_NOW:
- // FIXME: do I care?
- break;
- case AVAHI_BROWSER_FAILURE:
- if (browser != NULL)
- avahi_service_browser_free (browser);
- browser = NULL;
- ; // FIXME: better error reporting
- break;
+ found = true;
+ (*iter).removed.emit ();
+ }
+ break;
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ // FIXME: do I care?
+ break;
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ // FIXME: do I care?
+ break;
+ case AVAHI_BROWSER_FAILURE:
+ if (browser != NULL)
+ avahi_service_browser_free (browser);
+ browser = NULL;
+ ; // FIXME: better error reporting
+ break;
default:
/* shouldn't happen */
break;
@@ -242,11 +242,11 @@
}
void
-Avahi::Heap::ResolverCallback (AvahiServiceResolver *resolver,
+Avahi::Heap::ResolverCallback (AvahiServiceResolver */*resolver*/,
AvahiIfIndex /*interface*/,
AvahiProtocol /*protocol*/,
AvahiResolverEvent event,
- const char * /*name*/,
+ const char * name_,
const char * typ,
const char * /*domain*/,
const char* host_name,
@@ -266,72 +266,68 @@
switch (event) {
- case AVAHI_RESOLVER_FOUND:
- for (txt_tmp = txt; txt_tmp != NULL; txt_tmp = txt_tmp->next) {
-
- char *ckey = NULL;
- char *cvalue = NULL;
- size_t size;
- if (avahi_string_list_get_pair (txt_tmp, &ckey, &cvalue, &size) >= 0) {
-
- if (ckey != NULL && cvalue != NULL) {
-
- std::string key (ckey);
- std::string value (cvalue);
- if (key == "display_name")
- name = value;
- else if (key == "presence")
- presence = value;
- else if (key == "status")
- status = value;
- else if (key == "software")
- software = value;
- }
- if (ckey != NULL) free (ckey);
- if (cvalue != NULL) free (cvalue);
+ case AVAHI_RESOLVER_FOUND:
+ name = name_;
+ for (txt_tmp = txt; txt_tmp != NULL; txt_tmp = txt_tmp->next) {
+
+ char *ckey = NULL;
+ char *cvalue = NULL;
+ size_t size;
+ if (avahi_string_list_get_pair (txt_tmp, &ckey, &cvalue, &size) >= 0) {
+
+ if (ckey != NULL && cvalue != NULL) {
+
+ std::string key (ckey);
+ std::string value (cvalue);
+ if (key == "presence")
+ presence = value;
+ else if (key == "status")
+ status = value;
+ else if (key == "software")
+ software = value;
}
+ if (ckey != NULL) free (ckey);
+ if (cvalue != NULL) free (cvalue);
}
+ }
- for (iterator iter = begin ();
- iter != end ();
- iter++) {
-
- // FIXME never called
- if ((*iter).get_name () == name) {
-
- /* known contact has been updated */
- (*iter).set_status (status);
- (*iter).set_presence (presence);
- (*iter).updated.emit ();
- already_known = true;
- }
+ for (iterator iter = begin ();
+ iter != end ();
+ iter++) {
+
+ // FIXME never called
+ if ((*iter).get_name () == name) {
+
+ /* known contact has been updated */
+ (*iter).set_status (status);
+ (*iter).set_presence (presence);
+ (*iter).updated.emit ();
+ already_known = true;
}
- if (already_known == false) {
+ }
+ if (already_known == false) {
- /* ok, this is a new contact */
- gchar** broken = NULL;
- broken = g_strsplit_set (typ, "._", 0);
- if (broken != NULL && broken[0] != NULL && broken[1] != NULL) {
-
- url = g_strdup_printf ("%s:neighbour %s:%d", broken[1], host_name, port);
- presentity = new Presentity (core, name, url);
- presentity->set_status (status);
- presentity->set_presence (presence);
- add_presentity (*presentity);
- g_free (url);
- }
- g_strfreev (broken);
+ /* ok, this is a new contact */
+ gchar** broken = NULL;
+ broken = g_strsplit_set (typ, "._", 0);
+ if (broken != NULL && broken[0] != NULL && broken[1] != NULL) {
+
+ url = g_strdup_printf ("%s:neighbour %s:%d", broken[1], host_name, port);
+ presentity = new Presentity (core, name, url);
+ presentity->set_status (status);
+ presentity->set_presence (presence);
+ add_presentity (*presentity);
+ g_free (url);
}
- break;
- case AVAHI_RESOLVER_FAILURE:
+ g_strfreev (broken);
+ }
+ break;
+ case AVAHI_RESOLVER_FAILURE:
- ; /* FIXME: better error reporting */
- break;
+ /* FIXME: better error reporting */
+ break;
default:
/* shouldn't happen */
break;
}
-
- if (resolver != NULL)
- avahi_service_resolver_free (resolver);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]