summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-10-15 15:39:45 -0400
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-10-15 15:42:31 -0400
commitd8edca5135d6b9fdbec6d25441f61e1f01098f28 (patch)
tree602bd195ca4b33565f2e1688421551d9c923b9bb
parent386dd1256d47e949174a577d8046a88e9b5061a4 (diff)
remove OLPC interfaces
They have been broken when switching to next and are going to be removed in Gabble as well. They should be redesigned properly.
-rw-r--r--configure.ac16
-rw-r--r--extensions/Makefile.am2
-rw-r--r--extensions/OLPC_Activity_Properties.xml124
-rw-r--r--extensions/OLPC_Buddy_Info.xml285
-rw-r--r--extensions/connection.xml3
-rw-r--r--salut/capabilities.h1
-rw-r--r--src/Makefile.am14
-rw-r--r--src/avahi-contact.c72
-rw-r--r--src/avahi-discovery-client.c32
-rw-r--r--src/avahi-olpc-activity-manager.c376
-rw-r--r--src/avahi-olpc-activity-manager.h68
-rw-r--r--src/avahi-olpc-activity.c546
-rw-r--r--src/avahi-olpc-activity.h70
-rw-r--r--src/avahi-self.c134
-rw-r--r--src/avahi-self.h3
-rw-r--r--src/bonjour-discovery-client.c6
-rw-r--r--src/bonjour-self.c12
-rw-r--r--src/bonjour-self.h3
-rw-r--r--src/capability-set.c23
-rw-r--r--src/connection.c1361
-rw-r--r--src/connection.h10
-rw-r--r--src/contact.c255
-rw-r--r--src/contact.h43
-rw-r--r--src/debug.c1
-rw-r--r--src/debug.h5
-rw-r--r--src/discovery-client.c21
-rw-r--r--src/discovery-client.h18
-rw-r--r--src/dummy-discovery-client.c7
-rw-r--r--src/muc-channel.c14
-rw-r--r--src/muc-manager.c5
-rw-r--r--src/namespaces.h8
-rw-r--r--src/olpc-activity-manager.c349
-rw-r--r--src/olpc-activity-manager.h98
-rw-r--r--src/olpc-activity.c680
-rw-r--r--src/olpc-activity.h98
-rw-r--r--src/presence.h1
-rw-r--r--src/self.c480
-rw-r--r--src/self.h44
-rw-r--r--tests/twisted/Makefile.am8
-rw-r--r--tests/twisted/avahi/olpc-activity-announcements.py115
-rw-r--r--tests/twisted/ns.py10
41 files changed, 17 insertions, 5404 deletions
diff --git a/configure.ac b/configure.ac
index 940eda4c..3723b1ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,17 +114,6 @@ AC_MSG_RESULT([$TEST_PYTHON])
AC_SUBST(TEST_PYTHON)
AM_CONDITIONAL([WANT_TWISTED_TESTS], test false != "$TEST_PYTHON")
-dnl olpc specific code switch
-AC_ARG_ENABLE(olpc,
- AC_HELP_STRING([--enable-olpc],[compile with olpc specific code]),
- enable_olpc=$enableval, enable_olpc=no )
-
-AS_IF([test x$enable_olpc = xyes],
- [AC_DEFINE(ENABLE_OLPC, [], [Enable olpc code])])
-AM_CONDITIONAL(ENABLE_OLPC, test "x$enable_olpc" = "xyes")
-
-AC_SUBST(ENABLE_OLPC)
-
AC_HEADER_STDC([])
AC_C_INLINE
@@ -396,9 +385,4 @@ Configure summary:
Enable debug................: ${enable_debug}
Python tests................: ${tests_enabled}
Plugins.....................: ${enable_plugins}
-
-Features:
-
- OLPC support................: ${enable_olpc}
-
"
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 39f94e96..5edd07d0 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -1,8 +1,6 @@
tools_dir = $(top_srcdir)/tools
EXTRA_DIST = \
- OLPC_Buddy_Info.xml \
- OLPC_Activity_Properties.xml \
connection.xml \
Salut_Plugin_Test.xml \
Connection_Future.xml \
diff --git a/extensions/OLPC_Activity_Properties.xml b/extensions/OLPC_Activity_Properties.xml
deleted file mode 100644
index 4125cd50..00000000
--- a/extensions/OLPC_Activity_Properties.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" ?>
-<node name="/OLPC_Activity_Properties" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
- <tp:copyright> Copyright (C) 2007 Collabora Limited </tp:copyright>
- <tp:license xmlns="http://www.w3.org/1999/xhtml">
- <p>This library 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.</p>
-
-<p>This library 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.</p>
-
-<p>You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p>
- </tp:license>
- <interface name="org.laptop.Telepathy.ActivityProperties">
- <tp:requires interface="im.telepathy1.Connection"/>
-
- <method name="SetProperties" tp:name-for-bindings="Set_Properties">
- <arg direction="in" name="room" type="u">
- <tp:docstring>
- An integer handle representing the room of the activity
- </tp:docstring>
- </arg>
- <arg direction="in" name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping properties names to the desired values
- </tp:docstring>
- </arg>
- <tp:docstring>
- Set the properties of the activity associated to the given room for this connection.
- You have to be the owner of this activity.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- <tp:error name="im.telepathy1.Error.PermissionDenied"/>
- </tp:possible-errors>
- </method>
-
- <method name="GetProperties" tp:name-for-bindings="Get_Properties">
- <arg direction="in" name="room" type="u">
- <tp:docstring>
- An integer handle for the activity's room to request his properties for
- </tp:docstring>
- </arg>
- <arg direction="out" name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping properties names to their values
- </tp:docstring>
- </arg>
- <tp:docstring>
- Get the properties of a particular activity.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <method name="GetActivity" tp:name-for-bindings="Get_Activity">
- <arg direction="in" name="activity_id" type="s">
- <tp:docstring>
- An activity id
- </tp:docstring>
- </arg>
- <arg direction="out" name="room" type="u">
- <tp:docstring>
- A room handle
- </tp:docstring>
- </arg>
- <tp:docstring>
- Returns the handle of the room associated with this activity
- <tp:rationale>
- <p>When an activity starts up, it knows its activity_id but doesn't
- know yet if it's shared or not, much less the room.</p>
- </tp:rationale>
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <signal name="ActivityPropertiesChanged"
- tp:name-for-bindings="Activity_Properties_Changed">
- <arg name="room" type="u">
- <tp:docstring>
- An integer handle representing the room of the activity
- </tp:docstring>
- </arg>
- <arg name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping properties names to their new values
- </tp:docstring>
- </arg>
- <tp:docstring>
- Signal emitted when the properties of an activity are changed.
- </tp:docstring>
- </signal>
-
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- <p>An interface on connections to associate OLPC activity properties
- with rooms.</p>
-
- <p>The following types and names are used to request and set properties:</p>
- <dl>
- <dt>s:color</dt>
- <dd>The color of the activity. Format used is #RRGGBB,#RRGGBB (stroke,fill).</dd>
-
- <dt>s:name</dt>
- <dd>The name of the activity.</dd>
-
- <dt>s:type</dt>
- <dd>The type of the activity.</dd>
- </dl>
-
- </tp:docstring>
- </interface>
-</node>
-<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/extensions/OLPC_Buddy_Info.xml b/extensions/OLPC_Buddy_Info.xml
deleted file mode 100644
index 83bf916c..00000000
--- a/extensions/OLPC_Buddy_Info.xml
+++ /dev/null
@@ -1,285 +0,0 @@
-<?xml version="1.0" ?>
-<node name="/OLPC_Buddy_Info" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
- <tp:copyright> Copyright (C) 2007 Collabora Limited </tp:copyright>
- <tp:license xmlns="http://www.w3.org/1999/xhtml">
- <p>This library 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.</p>
-
-<p>This library 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.</p>
-
-<p>You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p>
- </tp:license>
- <interface name="org.laptop.Telepathy.BuddyInfo">
- <tp:requires interface="im.telepathy1.Connection"/>
-
- <method name="SetProperties" tp:name-for-bindings="Set_Properties">
- <arg direction="in" name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping information names to the desired values.
- This replaces any existing buddy properties completely: any keys
- which were previously present, but are not present in this dictionary,
- are deleted.
- </tp:docstring>
- </arg>
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- <p>Set the information of the local user for this connection.</p>
- <p>This method may be called before Connect(), in which case the given
- properties will be advertised as soon as possible after connection
- (possibly immediately).</p>
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <method name="GetProperties" tp:name-for-bindings="Get_Properties">
- <arg direction="in" name="contact" type="u">
- <tp:docstring>
- An integer handle for the contact to request his properties for
- </tp:docstring>
- </arg>
- <arg direction="out" name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping information names to their values
- </tp:docstring>
- </arg>
- <tp:docstring>
- Get the properties of a particular contact.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <signal name="PropertiesChanged" tp:name-for-bindings="Properties_Changed">
- <arg name="contact" type="u">
- <tp:docstring>
- An integer handle representing the contact
- </tp:docstring>
- </arg>
- <arg name="properties" type="a{sv}">
- <tp:docstring>
- A dictionary mapping property names to their new values. All
- properties are included, not just those that have changed.
- </tp:docstring>
- </arg>
- <tp:docstring>
- Signal emitted when the properties of a contact from your 'subscribe'
- contact list are changed.
- </tp:docstring>
- </signal>
-
-
- <tp:struct name="Activity" array-name="Activity_List">
- <tp:docstring>A struct containing:
- <ul>
- <li>the identifier of the activity</li>
- <li>the room handle of the activity channel</li>
- </ul>
- </tp:docstring>
- <tp:member type="s" name="id"/>
- <tp:member type="u" tp:type="Room_Handle" name="room"/>
- </tp:struct>
-
- <method name="SetActivities" tp:name-for-bindings="Set_Activities">
- <arg direction="in" name="activities" type="a(su)" tp:type="Activity[]">
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- An array of structs containing:
- <ul>
- <li>the identifier of the activity</li>
- <li>the room handle of the activity channel</li>
- </ul>
- </tp:docstring>
- </arg>
- <tp:docstring>
- Set the activities of the local user for this connection.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <method name="AddActivity" tp:name-for-bindings="Add_Activity">
- <arg direction="in" name="id" type="s">
- <tp:docstring>
- An activity id
- </tp:docstring>
- </arg>
- <arg direction="in" name="handle" type="u">
- <tp:docstring>
- A room handle
- </tp:docstring>
- </arg>
- <tp:docstring>
- Advertise an activity associated to a muc room
- <tp:rationale>
- <p>Once an activity shares itself, needs to be advertised if it's not
- private. SetActivities could be used for this but it would mean that
- the activity would need to call GetActivities then add itself.</p>
- </tp:rationale>
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <method name="GetActivities" tp:name-for-bindings="Get_Activities">
- <arg direction="in" name="contact" type="u">
- <tp:docstring>
- An integer handle for the contact whose activities are to be returned
- </tp:docstring>
- </arg>
- <arg direction="out" name="activities" type="a(su)" tp:type="Activity[]">
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- An array of structs containing:
- <ul>
- <li>the identifier of the activity</li>
- <li>the room handle of the activity channel</li>
- </ul>
- </tp:docstring>
- </arg>
- <tp:docstring>
- Get the activities of a particular contact.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <signal name="ActivitiesChanged" tp:name-for-bindings="Activities_Changed">
- <arg name="contact" type="u">
- <tp:docstring>
- An integer handle representing the contact
- </tp:docstring>
- </arg>
- <arg name="activities" type="a(su)" tp:type="Activity[]">
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- An array of structs containing:
- <ul>
- <li>the identifier of the activity</li>
- <li>the handle of the activity channel</li>
- </ul>
- </tp:docstring>
- </arg>
- <tp:docstring>
- Signal emitted when the activities of a contact from your 'subscribe'
- contact list are changed.
- </tp:docstring>
- </signal>
-
- <method name="SetCurrentActivity"
- tp:name-for-bindings="Set_Current_Activity">
- <arg direction="in" name="activity" type="s">
- <tp:docstring>
- The identifier of the activity, or the empty string if there is no
- current activity
- </tp:docstring>
- </arg>
- <arg direction="in" name="channel" type="u">
- <tp:docstring>
- The room handle of the activity channel, or 0 if there is no current
- activity
- </tp:docstring>
- </arg>
- <tp:docstring>
- Set the current activity of the local user for this connection.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <method name="GetCurrentActivity"
- tp:name-for-bindings="Get_Current_Activity">
- <arg direction="in" name="contact" type="u">
- <tp:docstring>
- An integer handle for the contact whose current activity is to be
- returned
- </tp:docstring>
- </arg>
- <arg direction="out" name="activity" type="s">
- <tp:docstring>
- The identifier of the activity, or "" if there is no current activity
- </tp:docstring>
- </arg>
- <arg direction="out" name="channel" type="u">
- <tp:docstring>
- The room handle of the activity, or 0 if there is no current activity
- </tp:docstring>
- </arg>
- <tp:docstring>
- Get the current activity of a particular contact.
- </tp:docstring>
- <tp:possible-errors>
- <tp:error name="im.telepathy1.Error.Disconnected"/>
- <tp:error name="im.telepathy1.Error.InvalidArgument"/>
- </tp:possible-errors>
- </method>
-
- <signal name="CurrentActivityChanged"
- tp:name-for-bindings="Current_Activity_Changed">
- <arg name="contact" type="u">
- <tp:docstring>
- An integer handle representing the contact
- </tp:docstring>
- </arg>
- <arg name="activity" type="s">
- <tp:docstring>
- The identifier of the activity, or "" if there is no current activity
- </tp:docstring>
- </arg>
- <arg name="channel" type="u">
- <tp:docstring>
- The room handle of the activity channel, or 0 if there is no current
- activity
- </tp:docstring>
- </arg>
- <tp:docstring>
- Signal emitted when the current activity of a contact from your 'subscribe'
- contact list is changed.
- </tp:docstring>
- </signal>
-
- <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
- <p>An interface on connections to associate OLPC buddy information
- with contacts, providing methods for the user to set their own
- information and retrieve information of contacts.
- The user is automatically notified when information of contacts that
- are in his 'subscribe' contact list change.</p>
-
- <p>The following types and names are used to request and set information
- (except for activities):</p>
- <dl>
- <dt>s:color</dt>
- <dd>The color name of the buddy. Format used is #RRGGBB,#RRGGBB
- (stroke,fill).
- </dd>
-
- <dt>ay:key</dt>
- <dd>The public key of the buddy.</dd>
-
- <dt>s:jid</dt>
- <dd>For link-local connections, the JID of the buddy's server account.</dd>
- </dl>
-
- <p>Activities are represented by a struct containing:</p>
- <ul>
- <li>the identifier of the activity</li>
- <li>the handle of the activity channel</li>
- </ul>
- </tp:docstring>
- </interface>
-</node>
-<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/extensions/connection.xml b/extensions/connection.xml
index 8e72821c..cfaafbbd 100644
--- a/extensions/connection.xml
+++ b/extensions/connection.xml
@@ -22,7 +22,4 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p>
</tp:license>
-<xi:include href="OLPC_Buddy_Info.xml"/>
-<xi:include href="OLPC_Activity_Properties.xml"/>
-
</tp:spec>
diff --git a/salut/capabilities.h b/salut/capabilities.h
index faecc64f..0dcbaee5 100644
--- a/salut/capabilities.h
+++ b/salut/capabilities.h
@@ -43,7 +43,6 @@ const GabbleCapabilitySet *gabble_capabilities_get_any_google_av (void);
const GabbleCapabilitySet *gabble_capabilities_get_any_jingle_av (void);
const GabbleCapabilitySet *gabble_capabilities_get_any_transport (void);
const GabbleCapabilitySet *gabble_capabilities_get_geoloc_notify (void);
-const GabbleCapabilitySet *gabble_capabilities_get_olpc_notify (void);
/* XEP-0115 version 1.3:
*
diff --git a/src/Makefile.am b/src/Makefile.am
index e1d10e0d..52fabb1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -106,20 +106,6 @@ BONJOUR_BACKEND_SOURCES = \
bonjour-discovery-client.h \
bonjour-discovery-client.c
-if ENABLE_OLPC
- CORE_SOURCES += \
- olpc-activity.h \
- olpc-activity.c \
- olpc-activity-manager.h \
- olpc-activity-manager.c
-
- AVAHI_BACKEND_SOURCES += \
- avahi-olpc-activity-manager.h \
- avahi-olpc-activity-manager.c \
- avahi-olpc-activity.h \
- avahi-olpc-activity.c
-endif
-
DUMMY_BACKEND_SOURCES = \
dummy-discovery-client.h \
dummy-discovery-client.c
diff --git a/src/avahi-contact.c b/src/avahi-contact.c
index dd15ed4e..385b8516 100644
--- a/src/avahi-contact.c
+++ b/src/avahi-contact.c
@@ -649,11 +649,6 @@ contact_resolved_cb (GaServiceResolver *resolver,
char *nick, *first, *last;
/* node, hash and ver as defined by XEP-0115 */
char *node, *hash, *ver;
-#ifdef ENABLE_OLPC
- char *activity_id, *room_id;
- char *olpc_key_part;
- gsize size;
-#endif
DEBUG_RESOLVER (self, resolver, "contact %s resolved", contact->name);
@@ -723,73 +718,6 @@ contact_resolved_cb (GaServiceResolver *resolver,
salut_contact_change_jid (contact, s);
avahi_free (s);
-#ifdef ENABLE_OLPC
- /* OLPC color */
- s = _avahi_txt_get_keyval (txt, "olpc-color");
- salut_contact_change_olpc_color (contact, s);
- avahi_free (s);
-
- /* current activity */
- activity_id = _avahi_txt_get_keyval (txt, "olpc-current-activity");
- room_id = _avahi_txt_get_keyval (txt, "olpc-current-activity-room");
-
- salut_contact_change_current_activity (contact, room_id, activity_id);
- avahi_free (activity_id);
- avahi_free (room_id);
-
- /* OLPC key */
- olpc_key_part = _avahi_txt_get_keyval_with_size (txt,
- "olpc-key-part0", &size);
-
- if (olpc_key_part != NULL)
- {
- guint i = 0;
- gchar *olpc_key_part_name = NULL;
- GArray *olpc_key;
-
- /* FIXME: how big are OLPC keys anyway? */
- olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8), 512);
-
- do
- {
- g_array_append_vals (olpc_key, olpc_key_part, size);
- avahi_free (olpc_key_part);
-
- i++;
- olpc_key_part_name = g_strdup_printf ("olpc-key-part%u", i);
- olpc_key_part = _avahi_txt_get_keyval_with_size (txt,
- olpc_key_part_name, &size);
- g_free (olpc_key_part_name);
- }
- while (olpc_key_part != NULL);
-
- salut_contact_change_olpc_key (contact, olpc_key);
- g_array_unref (olpc_key);
- }
-
- /* address */
- if (address != NULL)
- {
- gchar* saddr = g_malloc0 (AVAHI_ADDRESS_STR_MAX);
-
- if (avahi_address_snprint (saddr, AVAHI_ADDRESS_STR_MAX, address))
- {
- switch (address->proto)
- {
- case AVAHI_PROTO_INET:
- salut_contact_change_ipv4_addr (contact, saddr);
- break;
- case AVAHI_PROTO_INET6:
- salut_contact_change_ipv6_addr (contact, saddr);
- break;
- default:
- break;
- }
- }
- g_free (saddr);
- }
-#endif
-
salut_contact_found (contact);
salut_contact_thaw (contact);
}
diff --git a/src/avahi-discovery-client.c b/src/avahi-discovery-client.c
index 72cf9203..b557d331 100644
--- a/src/avahi-discovery-client.c
+++ b/src/avahi-discovery-client.c
@@ -41,9 +41,6 @@
#include "avahi-contact-manager.h"
#include "avahi-roomlist-manager.h"
#include "avahi-self.h"
-#ifdef ENABLE_OLPC
-#include "avahi-olpc-activity-manager.h"
-#endif
#include "presence.h"
@@ -305,25 +302,6 @@ salut_avahi_discovery_client_create_contact_manager (
self));
}
-#ifdef ENABLE_OLPC
-/*
- * salut_avahi_discovery_client_create_olpc_activity_manager
- *
- * Implements salut_discovery_client_create_olpc_activity_manager on
- * SalutDiscoveryClient
- */
-static SalutOlpcActivityManager *
-salut_avahi_discovery_client_create_olpc_activity_manager (
- SalutDiscoveryClient *client,
- SalutConnection *connection)
-{
- SalutAvahiDiscoveryClient *self = SALUT_AVAHI_DISCOVERY_CLIENT (client);
-
- return SALUT_OLPC_ACTIVITY_MANAGER (salut_avahi_olpc_activity_manager_new (
- connection, self));
-}
-#endif
-
/*
* salut_avahi_discovery_client_create_self
*
@@ -337,14 +315,12 @@ salut_avahi_discovery_client_create_self (SalutDiscoveryClient *client,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
SalutAvahiDiscoveryClient *self = SALUT_AVAHI_DISCOVERY_CLIENT (client);
return SALUT_SELF (salut_avahi_self_new (connection, self, nickname, first_name,
- last_name, jid, email, published_name, olpc_key, olpc_color));
+ last_name, jid, email, published_name));
}
static const gchar *
@@ -378,10 +354,6 @@ discovery_client_init (gpointer g_iface,
salut_avahi_discovery_client_create_roomlist_manager;
klass->create_contact_manager =
salut_avahi_discovery_client_create_contact_manager;
-#ifdef ENABLE_OLPC
- klass->create_olpc_activity_manager =
- salut_avahi_discovery_client_create_olpc_activity_manager;
-#endif
klass->create_self = salut_avahi_discovery_client_create_self;
klass->get_host_name_fqdn = salut_avahi_discovery_client_get_host_name_fqdn;
}
diff --git a/src/avahi-olpc-activity-manager.c b/src/avahi-olpc-activity-manager.c
deleted file mode 100644
index f7ae90fd..00000000
--- a/src/avahi-olpc-activity-manager.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * avahi-avahi_olpc-activity-manager.c - Source for
- * SalutAvahiOlpcActivityManager
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "avahi-olpc-activity-manager.h"
-
-#include <dbus/dbus-glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <avahi-gobject/ga-service-browser.h>
-
-#include "avahi-olpc-activity.h"
-#include "avahi-discovery-client.h"
-#include "olpc-activity.h"
-
-#define DEBUG_FLAG DEBUG_OLPC_ACTIVITY
-#include "debug.h"
-
-G_DEFINE_TYPE (SalutAvahiOlpcActivityManager, salut_avahi_olpc_activity_manager,
- SALUT_TYPE_OLPC_ACTIVITY_MANAGER);
-
-/* properties */
-enum {
- PROP_CLIENT = 1,
- LAST_PROP
-};
-
-/* private structure */
-typedef struct _SalutAvahiOlpcActivityManagerPrivate SalutAvahiOlpcActivityManagerPrivate;
-
-struct _SalutAvahiOlpcActivityManagerPrivate
-{
- SalutAvahiDiscoveryClient *discovery_client;
- GaServiceBrowser *browser;
-
- gboolean dispose_has_run;
-};
-
-#define SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER, SalutAvahiOlpcActivityManagerPrivate))
-
-static void
-salut_avahi_olpc_activity_manager_init (SalutAvahiOlpcActivityManager *self)
-{
- SalutAvahiOlpcActivityManagerPrivate *priv =
- SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- priv->browser = ga_service_browser_new (SALUT_DNSSD_OLPC_ACTIVITY);
-}
-
-static void
-salut_avahi_olpc_activity_manager_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- SalutAvahiOlpcActivityManager *self = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER (object);
- SalutAvahiOlpcActivityManagerPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- switch (property_id)
- {
- case PROP_CLIENT:
- g_value_set_object (value, priv->discovery_client);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-salut_avahi_olpc_activity_manager_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- SalutAvahiOlpcActivityManager *self = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER (object);
- SalutAvahiOlpcActivityManagerPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- switch (property_id)
- {
- case PROP_CLIENT:
- priv->discovery_client = g_value_get_object (value);
- g_object_ref (priv->discovery_client);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static gboolean
-split_activity_name (const gchar *name,
- gchar **room_name,
- gchar **contact_name)
-{
- gchar **tmp;
-
- tmp = g_strsplit (name, ":", 2);
- if (tmp[0] == NULL || tmp[1] == NULL)
- {
- DEBUG ("Ignoring invalid OLPC activity DNS-SD with no ':': %s", name);
- return FALSE;
- }
-
- if (room_name != NULL)
- *room_name = g_strdup (tmp[0]);
- if (contact_name != NULL)
- *contact_name = g_strdup (tmp[1]);
-
- g_strfreev (tmp);
- return TRUE;
-}
-
-static void
-browser_found (GaServiceBrowser *browser,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- GaLookupResultFlags flags,
- SalutAvahiOlpcActivityManager *self)
-{
- SalutOlpcActivityManager *mgr = SALUT_OLPC_ACTIVITY_MANAGER (self);
- SalutOlpcActivity *activity;
- gchar *room_name = NULL;
- gchar *contact_name = NULL;
- TpBaseConnection *base_conn = (TpBaseConnection *) mgr->connection;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
- base_conn, TP_HANDLE_TYPE_ROOM);
- TpHandle room;
- GError *error = NULL;
- SalutContactManager *contact_manager;
- SalutContact *contact;
-
- if (flags & AVAHI_LOOKUP_RESULT_OUR_OWN)
- return;
-
- if (tp_base_connection_is_destroyed (base_conn))
- return;
-
- if (!split_activity_name (name, &room_name, &contact_name))
- return;
-
- room = tp_handle_ensure (room_repo, room_name, NULL, &error);
- if (room == 0)
- {
- DEBUG ("invalid room name %s: %s", room_name, error->message);
- g_free (room_name);
- g_free (contact_name);
- return;
- }
-
- activity = salut_olpc_activity_manager_ensure_activity_by_room (mgr,
- room);
-
- salut_avahi_olpc_activity_add_service (SALUT_AVAHI_OLPC_ACTIVITY (activity),
- interface, protocol, name, type, domain);
-
- g_object_get (mgr->connection,
- "contact-manager", &contact_manager, NULL);
- g_assert (contact_manager != NULL);
-
- contact = salut_contact_manager_ensure_contact (contact_manager,
- contact_name);
- salut_olpc_activity_manager_contact_joined (mgr, contact, activity);
-
- g_object_unref (activity);
- g_free (contact_name);
- g_free (room_name);
- g_object_unref (contact);
- g_object_unref (contact_manager);
-}
-
-static void
-browser_removed (GaServiceBrowser *browser,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- GaLookupResultFlags flags,
- SalutAvahiOlpcActivityManager *self)
-{
- SalutOlpcActivityManager *mgr = SALUT_OLPC_ACTIVITY_MANAGER (self);
- SalutOlpcActivity *activity;
- gchar *room_name = NULL;
- gchar *contact_name = NULL;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles
- ((TpBaseConnection *) mgr->connection, TP_HANDLE_TYPE_ROOM);
- TpHandleRepoIface *contact_repo = tp_base_connection_get_handles
- ((TpBaseConnection *) mgr->connection, TP_HANDLE_TYPE_CONTACT);
- TpHandle room;
- TpHandle contact_handle;
- GError *error = NULL;
- SalutContactManager *contact_manager;
- SalutContact *contact;
-
- if (!split_activity_name (name, &room_name, &contact_name))
- return;
-
- room = tp_handle_ensure (room_repo, room_name, NULL, &error);
- g_free (room_name);
- if (room == 0)
- {
- DEBUG ("invalid room name %s: %s", room_name, error->message);
- g_free (contact_name);
- g_error_free (error);
- return;
- }
-
- contact_handle = tp_handle_ensure (contact_repo, contact_name, NULL, &error);
- if (contact_handle == 0)
- {
- DEBUG ("Invalid contact name %s: %s", contact_name, error->message);
- g_error_free (error);
- g_free (contact_name);
- return;
- }
- g_free (contact_name);
-
- activity = salut_olpc_activity_manager_get_activity_by_room (mgr, room);
- if (activity == NULL)
- return;
-
- salut_avahi_olpc_activity_remove_service (SALUT_AVAHI_OLPC_ACTIVITY (activity),
- interface, protocol, name, type, domain);
-
- g_object_get (mgr->connection,
- "contact-manager", &contact_manager, NULL);
- g_assert (contact_manager != NULL);
-
- contact = salut_contact_manager_get_contact (contact_manager,
- contact_handle);
- g_object_unref (contact_manager);
- if (contact == NULL)
- return;
-
- salut_olpc_activity_manager_contact_left (mgr, contact, activity);
- g_object_unref (contact);
-}
-
-static void
-browser_failed (GaServiceBrowser *browser,
- GError *error,
- SalutAvahiOlpcActivityManager *self)
-{
- g_warning ("browser failed -> %s", error->message);
-}
-
-static gboolean
-salut_avahi_olpc_activity_manager_start (SalutOlpcActivityManager *mgr,
- GError **error)
-{
- SalutAvahiOlpcActivityManager *self = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER (mgr);
- SalutAvahiOlpcActivityManagerPrivate *priv =
- SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- g_signal_connect (priv->browser, "new-service",
- G_CALLBACK (browser_found), self);
- g_signal_connect (priv->browser, "removed-service",
- G_CALLBACK (browser_removed), self);
- g_signal_connect (priv->browser, "failure",
- G_CALLBACK (browser_failed), self);
-
- if (!ga_service_browser_attach (priv->browser,
- priv->discovery_client->avahi_client, error))
- {
- DEBUG ("browser attach failed");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static SalutOlpcActivity *
-salut_avahi_olpc_activity_manager_create_activity (
- SalutOlpcActivityManager *mgr)
-{
- SalutAvahiOlpcActivityManager *self = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER (mgr);
- SalutAvahiOlpcActivityManagerPrivate *priv =
- SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- return SALUT_OLPC_ACTIVITY (salut_avahi_olpc_activity_new (
- mgr->connection, priv->discovery_client));
-}
-
-static void salut_avahi_olpc_activity_manager_dispose (GObject *object);
-
-static void
-salut_avahi_olpc_activity_manager_class_init (SalutAvahiOlpcActivityManagerClass *salut_avahi_olpc_activity_manager_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (salut_avahi_olpc_activity_manager_class);
- SalutOlpcActivityManagerClass *activity_manager_class = SALUT_OLPC_ACTIVITY_MANAGER_CLASS (
- salut_avahi_olpc_activity_manager_class);
-
- GParamSpec *param_spec;
-
- g_type_class_add_private (salut_avahi_olpc_activity_manager_class,
- sizeof (SalutAvahiOlpcActivityManagerPrivate));
-
- object_class->get_property = salut_avahi_olpc_activity_manager_get_property;
- object_class->set_property = salut_avahi_olpc_activity_manager_set_property;
-
- object_class->dispose = salut_avahi_olpc_activity_manager_dispose;
-
- activity_manager_class->start = salut_avahi_olpc_activity_manager_start;
- activity_manager_class->create_activity =
- salut_avahi_olpc_activity_manager_create_activity;
-
- param_spec = g_param_spec_object (
- "discovery-client",
- "SalutAvahiDiscoveryClient object",
- "The Salut Avahi Discovery client associated with this manager",
- SALUT_TYPE_AVAHI_DISCOVERY_CLIENT,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_CLIENT,
- param_spec);
-}
-
-static void
-salut_avahi_olpc_activity_manager_dispose (GObject *object)
-{
- SalutAvahiOlpcActivityManager *self = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER (object);
- SalutAvahiOlpcActivityManagerPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- if (priv->discovery_client != NULL)
- {
- g_object_unref (priv->discovery_client);
- priv->discovery_client = NULL;
- }
-
- if (priv->browser != NULL)
- {
- g_object_unref (priv->browser);
- priv->browser = NULL;
- }
-
- if (G_OBJECT_CLASS (salut_avahi_olpc_activity_manager_parent_class)->dispose)
- G_OBJECT_CLASS (salut_avahi_olpc_activity_manager_parent_class)->dispose (object);
-}
-
-SalutAvahiOlpcActivityManager *
-salut_avahi_olpc_activity_manager_new (SalutConnection *connection,
- SalutAvahiDiscoveryClient *discovery_client)
-{
- return g_object_new (SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER,
- "connection", connection,
- "discovery-client", discovery_client,
- NULL);
-}
diff --git a/src/avahi-olpc-activity-manager.h b/src/avahi-olpc-activity-manager.h
deleted file mode 100644
index 88c94db3..00000000
--- a/src/avahi-olpc-activity-manager.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * avahi-olpc-activity-managere.h - Header for
- * SalutAvahiOlpcActivityManager
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_H__
-#define __SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_H__
-
-#include <glib-object.h>
-
-#include <telepathy-glib/telepathy-glib.h>
-
-#include "olpc-activity-manager.h"
-#include "connection.h"
-#include "avahi-discovery-client.h"
-
-G_BEGIN_DECLS
-
-typedef struct _SalutAvahiOlpcActivityManager SalutAvahiOlpcActivityManager;
-typedef struct _SalutAvahiOlpcActivityManagerClass SalutAvahiOlpcActivityManagerClass;
-
-struct _SalutAvahiOlpcActivityManagerClass {
- SalutOlpcActivityManagerClass parent_class;
-};
-
-struct _SalutAvahiOlpcActivityManager {
- SalutOlpcActivityManager parent;
-};
-
-GType salut_avahi_olpc_activity_manager_get_type (void);
-
-/* TYPE MACROS */
-#define SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER \
- (salut_avahi_olpc_activity_manager_get_type ())
-#define SALUT_AVAHI_OLPC_ACTIVITY_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER, \
- SalutAvahiOlpcActivityManager))
-#define SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER, \
- SalutAvahiOlpcActivityManagerClass))
-#define SALUT_IS_AVAHI_OLPC_ACTIVITY_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER))
-#define SALUT_IS_AVAHI_OLPC_ACTIVITY_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER))
-#define SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY_MANAGER, SalutAvahiOlpcActivityManagerClass))
-
-SalutAvahiOlpcActivityManager * salut_avahi_olpc_activity_manager_new (
- SalutConnection *connection, SalutAvahiDiscoveryClient *discovery_client);
-
-G_END_DECLS
-
-#endif /* #ifndef __SALUT_AVAHI_OLPC_ACTIVITY_MANAGER_H__*/
diff --git a/src/avahi-olpc-activity.c b/src/avahi-olpc-activity.c
deleted file mode 100644
index 8dba37af..00000000
--- a/src/avahi-olpc-activity.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * avahi-olpc-activity.c - Source for SalutAvahiOlpcActivity
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "avahi-olpc-activity.h"
-
-#include <dbus/dbus-glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <avahi-gobject/ga-entry-group.h>
-#include <avahi-gobject/ga-service-resolver.h>
-#include <avahi-common/malloc.h>
-
-#define DEBUG_FLAG DEBUG_OLPC_ACTIVITY
-#include "debug.h"
-
-G_DEFINE_TYPE (SalutAvahiOlpcActivity, salut_avahi_olpc_activity,
- SALUT_TYPE_OLPC_ACTIVITY);
-
-/* properties */
-enum {
- PROP_CLIENT = 1,
- LAST_PROP
-};
-
-/* private structure */
-typedef struct _SalutAvahiOlpcActivityPrivate SalutAvahiOlpcActivityPrivate;
-
-struct _SalutAvahiOlpcActivityPrivate
-{
- SalutAvahiDiscoveryClient *discovery_client;
- GSList *resolvers;
- /* group and service can be NULL if we are not announcing this activity */
- GaEntryGroup *group;
- GaEntryGroupService *service;
-
- gboolean dispose_has_run;
-};
-
-#define SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SALUT_TYPE_AVAHI_OLPC_ACTIVITY, SalutAvahiOlpcActivityPrivate))
-
-static void
-salut_avahi_olpc_activity_init (SalutAvahiOlpcActivity *obj)
-{
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- obj);
-
- priv->resolvers = NULL;
-}
-
-static void
-salut_avahi_olpc_activity_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (object);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
-
- switch (property_id)
- {
- case PROP_CLIENT:
- g_value_set_object (value, priv->discovery_client);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-salut_avahi_olpc_activity_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (object);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
-
- switch (property_id)
- {
- case PROP_CLIENT:
- priv->discovery_client = g_value_get_object (value);
- g_object_ref (priv->discovery_client);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static gboolean
-activity_is_announced (SalutAvahiOlpcActivity *self)
-{
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
-
- return (priv->group != NULL && priv->service != NULL);
-}
-
-static gboolean
-update_activity_service (SalutAvahiOlpcActivity *self,
- GError **error)
-{
- SalutOlpcActivity *activity = SALUT_OLPC_ACTIVITY (self);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
- GError *err = NULL;
-
- if (!activity_is_announced (self))
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Trying to update an activity that's not announced");
- return FALSE;
- }
-
- ga_entry_group_service_freeze (priv->service);
-
- if (activity->name != NULL)
- ga_entry_group_service_set (priv->service, "name",
- activity->name, NULL);
-
- if (activity->color != NULL)
- ga_entry_group_service_set (priv->service, "color",
- activity->color, NULL);
-
- if (activity->type != NULL)
- ga_entry_group_service_set (priv->service, "type",
- activity->type, NULL);
-
- if (activity->tags != NULL)
- ga_entry_group_service_set (priv->service, "tags",
- activity->tags, NULL);
-
- return ga_entry_group_service_thaw (priv->service, &err);
-}
-
-static gboolean
-salut_avahi_olpc_activity_announce (SalutOlpcActivity *activity,
- GError **error)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (activity);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
- const gchar *room_name;
- gchar *name;
- AvahiStringList *txt_record;
- TpHandleRepoIface *room_repo;
- gchar *published_name;
-
- g_return_val_if_fail (!activity->is_private, FALSE);
- g_return_val_if_fail (!activity_is_announced (self), FALSE);
-
- room_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) activity->connection, TP_HANDLE_TYPE_ROOM);
-
- room_name = tp_handle_inspect (room_repo, activity->room);
- /* caller should already have validated this */
- g_return_val_if_fail (room_name != NULL, FALSE);
-
- priv->group = ga_entry_group_new ();
- if (!ga_entry_group_attach (priv->group, priv->discovery_client->avahi_client,
- error))
- return FALSE;
-
- g_object_get (activity->connection, "published-name", &published_name, NULL);
-
- name = g_strdup_printf ("%s:%s@%s", room_name, published_name,
- avahi_client_get_host_name (
- priv->discovery_client->avahi_client->avahi_client));
-
- g_free (published_name);
-
- txt_record = avahi_string_list_new ("txtvers=0", NULL);
- txt_record = avahi_string_list_add_printf (txt_record, "room=%s", room_name);
- if (activity->id != NULL)
- txt_record = avahi_string_list_add_printf (txt_record, "activity-id=%s",
- activity->id);
-
- priv->service = ga_entry_group_add_service_strlist (priv->group, name,
- SALUT_DNSSD_OLPC_ACTIVITY, 0, error, txt_record);
-
- if (priv->service == NULL)
- return FALSE;
-
- DEBUG ("announce activity %s", name);
- g_free (name);
- avahi_string_list_free (txt_record);
-
- if (!ga_entry_group_commit (priv->group, error))
- return FALSE;
-
- /* announce activities properties */
- if (!update_activity_service (self, error))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-salut_avahi_olpc_activity_stop_announce (SalutOlpcActivity *activity)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (activity);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
-
- /* Announcing the activity could have failed, so check if we're actually
- * announcing it */
- if (!activity_is_announced (self))
- return;
-
- g_object_unref (priv->group);
- priv->group = NULL;
- priv->service = NULL;
-
- DEBUG ("stop announce activity %s", activity->id);
-}
-
-static gboolean
-salut_avahi_update (SalutOlpcActivity *activity,
- GError **error)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (activity);
-
- return update_activity_service (self, error);
-}
-
-static void salut_avahi_olpc_activity_dispose (GObject *object);
-static void salut_avahi_olpc_activity_finalize (GObject *object);
-
-static void
-salut_avahi_olpc_activity_class_init (
- SalutAvahiOlpcActivityClass *salut_avahi_olpc_activity_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (salut_avahi_olpc_activity_class);
- SalutOlpcActivityClass *activity_class = SALUT_OLPC_ACTIVITY_CLASS (
- salut_avahi_olpc_activity_class);
- GParamSpec *param_spec;
-
- g_type_class_add_private (salut_avahi_olpc_activity_class,
- sizeof (SalutAvahiOlpcActivityPrivate));
-
- object_class->get_property = salut_avahi_olpc_activity_get_property;
- object_class->set_property = salut_avahi_olpc_activity_set_property;
-
- object_class->dispose = salut_avahi_olpc_activity_dispose;
- object_class->finalize = salut_avahi_olpc_activity_finalize;
-
- activity_class->announce = salut_avahi_olpc_activity_announce;
- activity_class->stop_announce = salut_avahi_olpc_activity_stop_announce;
- activity_class->update = salut_avahi_update;
-
- param_spec = g_param_spec_object (
- "discovery-client",
- "SalutAvahiDiscoveryClient object",
- "The Salut Avahi Discovery client associated with this manager",
- SALUT_TYPE_AVAHI_DISCOVERY_CLIENT,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_CLIENT,
- param_spec);
-}
-
-void
-salut_avahi_olpc_activity_dispose (GObject *object)
-{
- SalutAvahiOlpcActivity *self = SALUT_AVAHI_OLPC_ACTIVITY (object);
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- g_slist_foreach (priv->resolvers, (GFunc) g_object_unref, NULL);
- g_slist_free (priv->resolvers);
- priv->resolvers = NULL;
-
- if (priv->group != NULL)
- {
- g_object_unref (priv->group);
- priv->group = NULL;
- }
-
- if (priv->discovery_client != NULL)
- {
- g_object_unref (priv->discovery_client);
- priv->discovery_client = NULL;
- }
-
- if (G_OBJECT_CLASS (salut_avahi_olpc_activity_parent_class)->dispose)
- G_OBJECT_CLASS (salut_avahi_olpc_activity_parent_class)->dispose (object);
-}
-
-void
-salut_avahi_olpc_activity_finalize (GObject *object)
-{
- G_OBJECT_CLASS (salut_avahi_olpc_activity_parent_class)->finalize (object);
-}
-
-SalutAvahiOlpcActivity *
-salut_avahi_olpc_activity_new (SalutConnection *connection,
- SalutAvahiDiscoveryClient *discovery_client)
-{
- return g_object_new (SALUT_TYPE_AVAHI_OLPC_ACTIVITY,
- "connection", connection,
- "discovery-client", discovery_client,
- NULL);
-}
-
-struct resolverinfo
-{
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- const gchar *name;
- const gchar *type;
- const gchar *domain;
-};
-
-static gint
-compare_resolver (GaServiceResolver *resolver,
- struct resolverinfo *info)
-{
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- gchar *name;
- gchar *type;
- gchar *domain;
- gint result;
-
- g_object_get (resolver,
- "interface", &interface,
- "protocol", &protocol,
- "name", &name,
- "type", &type,
- "domain", &domain,
- NULL);
-
- if (interface == info->interface
- && protocol == info->protocol
- && !tp_strdiff (name, info->name)
- && !tp_strdiff (type, info->type)
- && !tp_strdiff (domain, info->domain))
- {
- result = 0;
- }
- else
- {
- result = 1;
- }
-
- g_free (name);
- g_free (type);
- g_free (domain);
- return result;
-}
-
-static GaServiceResolver *
-find_resolver (SalutAvahiOlpcActivity *self,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const gchar *name,
- const gchar *type,
- const gchar *domain)
-{
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
- struct resolverinfo info;
- GSList *ret;
-
- info.interface = interface;
- info.protocol = protocol;
- info.name = name;
- info.type = type;
- info.domain = domain;
- ret = g_slist_find_custom (priv->resolvers, &info,
- (GCompareFunc) compare_resolver);
-
- return ret ? GA_SERVICE_RESOLVER (ret->data) : NULL;
-}
-
-static void
-activity_resolved_cb (GaServiceResolver *resolver,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- gchar *name,
- gchar *type,
- gchar *domain,
- gchar *host_name,
- AvahiAddress *a,
- gint port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- SalutAvahiOlpcActivity *self)
-{
- SalutOlpcActivity *act = SALUT_OLPC_ACTIVITY (self);
- AvahiStringList *t;
- char *activity_id = NULL;
- char *color = NULL;
- char *activity_name = NULL;
- char *activity_type = NULL;
- char *tags = NULL;
- char *room_name = NULL;
- TpHandle room = 0;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles
- ((TpBaseConnection *) act->connection, TP_HANDLE_TYPE_ROOM);
-
- DEBUG ("called: \"%s\".%s. on %s port %u", name, domain, host_name, port);
-
- if ((t = avahi_string_list_find (txt, "txtvers")) != NULL)
- {
- char *txtvers;
-
- avahi_string_list_get_pair (t, NULL, &txtvers, NULL);
- if (tp_strdiff (txtvers, "0"))
- {
- DEBUG ("Ignoring record with txtvers not 0: %s",
- txtvers ? txtvers : "(no value)");
- avahi_free (txtvers);
- return;
- }
- avahi_free (txtvers);
- }
-
- if ((t = avahi_string_list_find (txt, "room")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &room_name, NULL);
-
- room = tp_handle_ensure (room_repo, room_name, NULL, NULL);
- avahi_free (room_name);
- if (room == 0)
- {
- DEBUG ("Ignoring record with invalid room name: %s", room_name);
- return;
- }
- }
-
- if ((t = avahi_string_list_find (txt, "activity-id")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &activity_id, NULL);
- }
-
- if ((t = avahi_string_list_find (txt, "color")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &color, NULL);
- }
-
- if ((t = avahi_string_list_find (txt, "name")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &activity_name, NULL);
- }
-
- if ((t = avahi_string_list_find (txt, "type")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &activity_type, NULL);
- }
-
- if ((t = avahi_string_list_find (txt, "tags")) != NULL)
- {
- avahi_string_list_get_pair (t, NULL, &tags, NULL);
- }
-
- salut_olpc_activity_update (SALUT_OLPC_ACTIVITY (self), room,
- activity_id, activity_name, activity_type, color, tags, FALSE);
-
- avahi_free (activity_id);
- avahi_free (activity_type);
- avahi_free (activity_name);
- avahi_free (color);
- avahi_free (tags);
-}
-
-void
-salut_avahi_olpc_activity_add_service (SalutAvahiOlpcActivity *self,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain)
-{
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
- GaServiceResolver *resolver;
- GError *error = NULL;
-
- resolver = find_resolver (self, interface, protocol, name, type, domain);
- if (resolver != NULL)
- return;
-
- resolver = ga_service_resolver_new (interface, protocol, name, type, domain,
- protocol, 0);
-
- g_signal_connect (resolver, "found", G_CALLBACK (activity_resolved_cb),
- self);
-
- if (!ga_service_resolver_attach (resolver,
- priv->discovery_client->avahi_client, &error))
- {
- g_warning ("Failed to attach resolver: %s", error->message);
- g_error_free (error);
- }
-
- /* DEBUG_RESOLVER (contact, resolver, "added"); */
- priv->resolvers = g_slist_prepend (priv->resolvers, resolver);
-}
-
-void
-salut_avahi_olpc_activity_remove_service (SalutAvahiOlpcActivity *self,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain)
-{
- SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
- self);
- GaServiceResolver *resolver;
-
- resolver = find_resolver (self, interface, protocol, name, type, domain);
-
- if (resolver == NULL)
- return;
-
- priv->resolvers = g_slist_remove (priv->resolvers, resolver);
- g_object_unref (resolver);
-}
diff --git a/src/avahi-olpc-activity.h b/src/avahi-olpc-activity.h
deleted file mode 100644
index 6343261a..00000000
--- a/src/avahi-olpc-activity.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * avahi-olpc-activity.h - Header for SalutAvahiOlpcActivity
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SALUT_AVAHI_OLPC_ACTIVITY_H__
-#define __SALUT_AVAHI_OLPC_ACTIVITY_H__
-
-#include <glib-object.h>
-
-#include "olpc-activity.h"
-#include "avahi-discovery-client.h"
-
-G_BEGIN_DECLS
-
-typedef struct _SalutAvahiOlpcActivity SalutAvahiOlpcActivity;
-typedef struct _SalutAvahiOlpcActivityClass SalutAvahiOlpcActivityClass;
-
-struct _SalutAvahiOlpcActivityClass {
- SalutOlpcActivityClass parent_class;
-};
-
-struct _SalutAvahiOlpcActivity {
- SalutOlpcActivity parent;
-};
-
-GType salut_avahi_olpc_activity_get_type (void);
-
-/* TYPE MACROS */
-#define SALUT_TYPE_AVAHI_OLPC_ACTIVITY \
- (salut_avahi_olpc_activity_get_type ())
-#define SALUT_AVAHI_OLPC_ACTIVITY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY, SalutAvahiOlpcActivity))
-#define SALUT_AVAHI_OLPC_ACTIVITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), SALUT_TYPE_AVAHI_OLPC_ACTIVITY, SalutAvahiOlpcActivityClass))
-#define SALUT_IS_AVAHI_OLPC_ACTIVITY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY))
-#define SALUT_IS_AVAHI_OLPC_ACTIVITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), SALUT_TYPE_AVAHI_OLPC_ACTIVITY))
-#define SALUT_AVAHI_OLPC_ACTIVITY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), SALUT_TYPE_AVAHI_OLPC_ACTIVITY, SalutAvahiOlpcActivityClass))
-
-SalutAvahiOlpcActivity * salut_avahi_olpc_activity_new (
- SalutConnection *connection, SalutAvahiDiscoveryClient *discovery_client);
-
-void salut_avahi_olpc_activity_add_service (SalutAvahiOlpcActivity *activity,
- AvahiIfIndex interface, AvahiProtocol protocol,
- const char *name, const char *type, const char *domain);
-
-void salut_avahi_olpc_activity_remove_service (SalutAvahiOlpcActivity *activity,
- AvahiIfIndex interface, AvahiProtocol protocol,
- const char *name, const char *type, const char *domain);
-
-G_END_DECLS
-
-#endif /* #ifndef __SALUT_AVAHI_OLPC_ACTIVITY_H__*/
diff --git a/src/avahi-self.c b/src/avahi-self.c
index 0b752868..8c6c7495 100644
--- a/src/avahi-self.c
+++ b/src/avahi-self.c
@@ -32,10 +32,6 @@
#include "sha1/sha1-util.h"
-#ifdef ENABLE_OLPC
-#define KEY_SEGMENT_SIZE 200
-#endif
-
G_DEFINE_TYPE (SalutAvahiSelf, salut_avahi_self, SALUT_TYPE_SELF);
/* properties */
@@ -144,30 +140,6 @@ create_txt_record (SalutAvahiSelf *self,
if (_self->jid != NULL)
ret = avahi_string_list_add_printf (ret, "jid=%s", _self->jid);
-#ifdef ENABLE_OLPC
- if (_self->olpc_color)
- ret = avahi_string_list_add_printf (ret, "olpc-color=%s",
- _self->olpc_color);
-
- if (_self->olpc_key != NULL)
- {
- uint8_t *key = (uint8_t *) _self->olpc_key->data;
- size_t key_len = _self->olpc_key->len;
- guint i = 0;
-
- while (key_len > 0)
- {
- size_t step = MIN (key_len, KEY_SEGMENT_SIZE);
- gchar *name = g_strdup_printf ("olpc-key-part%u", i);
-
- ret = avahi_string_list_add_pair_arbitrary (ret, name, key, step);
- key += step;
- key_len -= step;
- i++;
- }
- }
-#endif
-
ret = avahi_string_list_add_printf (ret, "status=%s",
salut_presence_status_txt_names[_self->status]);
@@ -362,99 +334,6 @@ salut_avahi_self_set_avatar (SalutSelf *_self,
_self->avatar_token, error);
}
-#ifdef ENABLE_OLPC
-static gboolean
-salut_avahi_self_update_current_activity (SalutSelf *_self,
- const gchar *room_name,
- GError **error)
-{
- SalutAvahiSelf *self = SALUT_AVAHI_SELF (_self);
- SalutAvahiSelfPrivate *priv = self->priv;
-
- ga_entry_group_service_freeze (priv->presence);
-
- ga_entry_group_service_set (priv->presence,
- "olpc-current-activity", _self->olpc_cur_act, NULL);
-
- ga_entry_group_service_set (priv->presence,
- "olpc-current-activity-room", room_name, NULL);
-
- return ga_entry_group_service_thaw (priv->presence, error);
-}
-
-static gboolean
-salut_avahi_self_set_olpc_properties (SalutSelf *_self,
- const GArray *key,
- const gchar *color,
- const gchar *jid,
- GError **error)
-{
- SalutAvahiSelf *self = SALUT_AVAHI_SELF (_self);
- SalutAvahiSelfPrivate *priv = self->priv;
-
- ga_entry_group_service_freeze (priv->presence);
-
- if (key != NULL)
- {
- size_t key_len = key->len;
- const guint8 *key_data = (const guint8 *) key->data;
- guint i;
- guint to_remove;
-
- if (_self->olpc_key == NULL)
- {
- to_remove = 0;
- }
- else
- {
- to_remove = (_self->olpc_key->len + KEY_SEGMENT_SIZE - 1) /
- KEY_SEGMENT_SIZE;
- }
-
- i = 0;
- while (key_len > 0)
- {
- size_t step = MIN (key_len, KEY_SEGMENT_SIZE);
- gchar *name = g_strdup_printf ("olpc-key-part%u", i);
-
- ga_entry_group_service_set_arbitrary (priv->presence, name,
- key_data, step, NULL);
- g_free (name);
-
- key_data += step;
- key_len -= step;
- i++;
- }
-
- /* if the new key is shorter than the old, clean up any stray segments */
- while (i < to_remove)
- {
- gchar *name = g_strdup_printf ("olpc-key-part%u", i);
-
- ga_entry_group_service_remove_key (priv->presence, name,
- NULL);
- g_free (name);
-
- i++;
- }
- }
-
- if (color != NULL)
- {
- ga_entry_group_service_set (priv->presence, "olpc-color",
- color, NULL);
- }
-
- if (jid != NULL)
- {
- ga_entry_group_service_set (priv->presence, "jid",
- jid, NULL);
- }
-
- return ga_entry_group_service_thaw (priv->presence, error);
-}
-#endif
-
static void salut_avahi_self_dispose (GObject *object);
static void
@@ -479,11 +358,6 @@ salut_avahi_self_class_init (
self_class->set_alias = salut_avahi_self_set_alias;
self_class->remove_avatar = salut_avahi_self_remove_avatar;
self_class->set_avatar = salut_avahi_self_set_avatar;
-#ifdef ENABLE_OLPC
- self_class->update_current_activity =
- salut_avahi_self_update_current_activity;
- self_class->set_olpc_properties = salut_avahi_self_set_olpc_properties;
-#endif
param_spec = g_param_spec_object (
"discovery-client",
@@ -537,9 +411,7 @@ salut_avahi_self_new (SalutConnection *connection,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
return g_object_new (SALUT_TYPE_AVAHI_SELF,
"connection", connection,
@@ -550,9 +422,5 @@ salut_avahi_self_new (SalutConnection *connection,
"jid", jid,
"email", email,
"published-name", published_name,
-#ifdef ENABLE_OLPC
- "olpc-key", olpc_key,
- "olpc-color", olpc_color,
-#endif
NULL);
}
diff --git a/src/avahi-self.h b/src/avahi-self.h
index 4ebe942c..b6785e86 100644
--- a/src/avahi-self.h
+++ b/src/avahi-self.h
@@ -63,7 +63,6 @@ GType salut_avahi_self_get_type (void);
SalutAvahiSelf * salut_avahi_self_new (SalutConnection *connection,
SalutAvahiDiscoveryClient *discovery_client, const gchar *nickname,
const gchar *first_name, const gchar *last_name, const gchar *jid,
- const gchar *email, const gchar *published_name, const GArray *olpc_key,
- const gchar *olpc_color);
+ const gchar *email, const gchar *published_name);
#endif /* #ifndef __SALUT_AVAHI_SELF_H__*/
diff --git a/src/bonjour-discovery-client.c b/src/bonjour-discovery-client.c
index 66a69669..b6dfe1d6 100644
--- a/src/bonjour-discovery-client.c
+++ b/src/bonjour-discovery-client.c
@@ -254,14 +254,12 @@ salut_bonjour_discovery_client_create_self (SalutDiscoveryClient *client,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
SalutBonjourDiscoveryClient *self = SALUT_BONJOUR_DISCOVERY_CLIENT (client);
return SALUT_SELF (salut_bonjour_self_new (connection, self, nickname,
- first_name, last_name, jid, email, published_name, olpc_key, olpc_color));
+ first_name, last_name, jid, email, published_name);
}
static const gchar *
diff --git a/src/bonjour-self.c b/src/bonjour-self.c
index 330bcae4..08d22a71 100644
--- a/src/bonjour-self.c
+++ b/src/bonjour-self.c
@@ -30,10 +30,6 @@
#include "sha1/sha1-util.h"
-#ifdef ENABLE_OLPC
-#define KEY_SEGMENT_SIZE 200
-#endif
-
#define RETURN_FALSE_IF_FAIL(error_type) \
if (error_type != kDNSServiceErr_NoError) return FALSE;
@@ -567,9 +563,7 @@ salut_bonjour_self_new (SalutConnection *connection,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
return g_object_new (SALUT_TYPE_BONJOUR_SELF,
"connection", connection,
@@ -580,9 +574,5 @@ salut_bonjour_self_new (SalutConnection *connection,
"jid", jid,
"email", email,
"published-name", published_name,
-#ifdef ENABLE_OLPC
- "olpc-key", olpc_key,
- "olpc-color", olpc_color,
-#endif
NULL);
}
diff --git a/src/bonjour-self.h b/src/bonjour-self.h
index 31010366..56b03b60 100644
--- a/src/bonjour-self.h
+++ b/src/bonjour-self.h
@@ -63,7 +63,6 @@ GType salut_bonjour_self_get_type (void);
SalutBonjourSelf * salut_bonjour_self_new (SalutConnection *connection,
SalutBonjourDiscoveryClient *discovery_client, const gchar *nickname,
const gchar *first_name, const gchar *last_name, const gchar *jid,
- const gchar *email, const gchar *published_name, const GArray *olpc_key,
- const gchar *olpc_color);
+ const gchar *email, const gchar *published_name);
#endif /* #ifndef __SALUT_BONJOUR_SELF_H__*/
diff --git a/src/capability-set.c b/src/capability-set.c
index f8632691..ffdb0f36 100644
--- a/src/capability-set.c
+++ b/src/capability-set.c
@@ -38,7 +38,6 @@ struct _Feature
enum {
FEATURE_FIXED,
FEATURE_OPTIONAL,
- FEATURE_OLPC
} feature_type;
gchar *ns;
};
@@ -70,11 +69,6 @@ static const Feature self_advertised_features[] =
{ FEATURE_OPTIONAL, NS_JINGLE_RTP_AUDIO },
{ FEATURE_OPTIONAL, NS_JINGLE_RTP_VIDEO },
- { FEATURE_OLPC, NS_OLPC_BUDDY_PROPS "+notify" },
- { FEATURE_OLPC, NS_OLPC_ACTIVITIES "+notify" },
- { FEATURE_OLPC, NS_OLPC_CURRENT_ACTIVITY "+notify" },
- { FEATURE_OLPC, NS_OLPC_ACTIVITY_PROPS "+notify" },
-
{ FEATURE_OPTIONAL, NS_GEOLOC "+notify" },
{ 0, NULL }
@@ -97,7 +91,6 @@ static GabbleCapabilitySet *any_jingle_av_caps = NULL;
static GabbleCapabilitySet *any_transport_caps = NULL;
static GabbleCapabilitySet *fixed_caps = NULL;
static GabbleCapabilitySet *geoloc_caps = NULL;
-static GabbleCapabilitySet *olpc_caps = NULL;
const GabbleCapabilitySet *
gabble_capabilities_get_legacy (void)
@@ -171,12 +164,6 @@ gabble_capabilities_get_geoloc_notify (void)
return geoloc_caps;
}
-const GabbleCapabilitySet *
-gabble_capabilities_get_olpc_notify (void)
-{
- return olpc_caps;
-}
-
static gboolean
omits_content_creators (WockyNode *identity)
{
@@ -292,14 +279,6 @@ gabble_capabilities_init (gpointer conn)
geoloc_caps = gabble_capability_set_new ();
gabble_capability_set_add (geoloc_caps, NS_GEOLOC "+notify");
-
- olpc_caps = gabble_capability_set_new ();
-
- for (feat = self_advertised_features; feat->ns != NULL; feat++)
- {
- if (feat->feature_type == FEATURE_OLPC)
- gabble_capability_set_add (olpc_caps, feat->ns);
- }
}
g_assert (feature_handles != NULL);
@@ -326,7 +305,6 @@ gabble_capabilities_finalize (gpointer conn)
gabble_capability_set_free (any_transport_caps);
gabble_capability_set_free (fixed_caps);
gabble_capability_set_free (geoloc_caps);
- gabble_capability_set_free (olpc_caps);
legacy_caps = NULL;
share_v1_caps = NULL;
@@ -340,7 +318,6 @@ gabble_capabilities_finalize (gpointer conn)
any_transport_caps = NULL;
fixed_caps = NULL;
geoloc_caps = NULL;
- olpc_caps = NULL;
tp_clear_object (&feature_handles);
}
diff --git a/src/connection.c b/src/connection.c
index d49541b4..2ab791a0 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -61,31 +61,11 @@
#include "plugin-loader.h"
-#ifdef ENABLE_OLPC
-#include "olpc-activity-manager.h"
-#endif
-
#include <extensions/extensions.h>
#define DEBUG_FLAG DEBUG_CONNECTION
#include "debug.h"
-#ifdef ENABLE_OLPC
-
-#define ACTIVITY_PAIR_TYPE \
- (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, \
- G_TYPE_INVALID))
-
-static void
-salut_connection_olpc_buddy_info_iface_init (gpointer g_iface,
- gpointer iface_data);
-
-static void
-salut_connection_olpc_activity_properties_iface_init (gpointer g_iface,
- gpointer iface_data);
-
-#endif
-
static void
salut_connection_aliasing_service_iface_init (gpointer g_iface,
gpointer iface_data);
@@ -129,19 +109,8 @@ G_DEFINE_TYPE_WITH_CODE(SalutConnection,
salut_conn_future_iface_init);
G_IMPLEMENT_INTERFACE (SALUT_TYPE_PLUGIN_CONNECTION,
salut_plugin_connection_iface_init);
-#ifdef ENABLE_OLPC
- G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_OLPC_BUDDY_INFO,
- salut_connection_olpc_buddy_info_iface_init);
- G_IMPLEMENT_INTERFACE (SALUT_TYPE_SVC_OLPC_ACTIVITY_PROPERTIES,
- salut_connection_olpc_activity_properties_iface_init);
-#endif
)
-#ifdef ENABLE_OLPC
-static gboolean uninvite_stanza_callback (WockyPorter *porter,
- WockyStanza *stanza, gpointer user_data);
-#endif
-
/* properties */
enum {
PROP_NICKNAME = 1,
@@ -158,9 +127,6 @@ enum {
PROP_SELF,
PROP_XCM,
PROP_SI_BYTESTREAM_MANAGER,
-#ifdef ENABLE_OLPC
- PROP_OLPC_ACTIVITY_MANAGER,
-#endif
PROP_BACKEND,
PROP_DNSSD_NAME,
LAST_PROP
@@ -177,10 +143,6 @@ struct _SalutConnectionPrivate
gchar *last_name;
gchar *jid;
gchar *email;
-#ifdef ENABLE_OLPC
- gchar *olpc_color;
- GArray *olpc_key;
-#endif
/* Discovery client for browsing and resolving */
SalutDiscoveryClient *discovery_client;
@@ -223,11 +185,6 @@ struct _SalutConnectionPrivate
/* gchar *interface → GList<DBusGMethodInvocation> */
GHashTable *pending_sidecars;
-#ifdef ENABLE_OLPC
- SalutOlpcActivityManager *olpc_activity_manager;
- guint uninvite_handler_id;
-#endif
-
/* timer used when trying to properly disconnect */
guint disconnect_timer;
@@ -346,10 +303,6 @@ salut_connection_init (SalutConnection *obj)
priv->last_name = NULL;
priv->jid = NULL;
priv->email = NULL;
-#ifdef ENABLE_OLPC
- priv->olpc_color = NULL;
- priv->olpc_key = NULL;
-#endif
priv->discovery_client = NULL;
priv->self = NULL;
@@ -369,10 +322,6 @@ sidecars_conn_status_changed_cb (SalutConnection *conn,
static void _contact_manager_contact_change_cb (SalutContactManager *mgr,
SalutContact *contact, int changes, gpointer data);
-#ifdef ENABLE_OLPC
-static void setup_olpc_activity_manager (SalutConnection *self);
-#endif
-
static void
salut_connection_constructed (GObject *obj)
{
@@ -384,10 +333,6 @@ salut_connection_constructed (GObject *obj)
g_signal_connect (self->presence_cache, "capabilities-update", G_CALLBACK
(connection_capabilities_update_cb), self);
-#ifdef ENABLE_OLPC
- setup_olpc_activity_manager (self);
-#endif
-
tp_contacts_mixin_init (obj,
G_STRUCT_OFFSET (SalutConnection, contacts_mixin));
@@ -476,11 +421,6 @@ salut_connection_get_property (GObject *object,
g_value_set_object (value, priv->si_bytestream_manager);
break;
#endif
-#ifdef ENABLE_OLPC
- case PROP_OLPC_ACTIVITY_MANAGER:
- g_value_set_object (value, priv->olpc_activity_manager);
- break;
-#endif
case PROP_BACKEND:
g_value_set_gtype (value, priv->backend_type);
break;
@@ -738,10 +678,6 @@ static const gchar *interfaces [] = {
TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST,
SALUT_IFACE_CONNECTION_FUTURE,
-#ifdef ENABLE_OLPC
- SALUT_IFACE_OLPC_BUDDY_INFO,
- SALUT_IFACE_OLPC_ACTIVITY_PROPERTIES,
-#endif
NULL };
static GPtrArray *
@@ -921,17 +857,6 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class)
g_object_class_install_property (object_class, PROP_SI_BYTESTREAM_MANAGER,
param_spec);
-#ifdef ENABLE_OLPC
- param_spec = g_param_spec_object (
- "olpc-activity-manager",
- "SalutOlpcActivityManager object",
- "The OLPC activity Manager associated with this Salut Connection",
- SALUT_TYPE_OLPC_ACTIVITY_MANAGER,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_OLPC_ACTIVITY_MANAGER,
- param_spec);
-#endif
-
param_spec = g_param_spec_gtype (
"backend-type",
"backend type",
@@ -996,19 +921,6 @@ salut_connection_dispose (GObject *object)
priv->self = NULL;
}
-#ifdef ENABLE_OLPC
- {
- wocky_porter_unregister_handler (self->porter, priv->uninvite_handler_id);
- priv->uninvite_handler_id = 0;
- }
-
- if (priv->olpc_activity_manager != NULL)
- {
- g_object_unref (priv->olpc_activity_manager);
- priv->olpc_activity_manager = NULL;
- }
-#endif
-
if (self->session != NULL)
{
g_object_unref (self->session);
@@ -1057,11 +969,6 @@ salut_connection_finalize (GObject *object)
g_free (priv->last_name);
g_free (priv->email);
g_free (priv->jid);
-#ifdef ENABLE_OLPC
- if (priv->olpc_key != NULL)
- g_array_unref (priv->olpc_key);
- g_free (priv->olpc_color);
-#endif
g_free (priv->dnssd_name);
tp_contacts_mixin_finalize (G_OBJECT(self));
@@ -1167,19 +1074,6 @@ _self_established_cb (SalutSelf *s, gpointer data)
}
#endif
-#ifdef ENABLE_OLPC
- if (!salut_olpc_activity_manager_start (priv->olpc_activity_manager, &error))
- {
- DEBUG ("failed to start olpc activity manager: %s", error->message);
- g_clear_error (&error);
-
- tp_base_connection_change_status ( TP_BASE_CONNECTION (base),
- TP_CONNECTION_STATUS_DISCONNECTED,
- TP_CONNECTION_STATUS_REASON_NETWORK_ERROR);
- return;
- }
-#endif
-
tp_base_connection_change_status (base, TP_CONNECTION_STATUS_CONNECTED,
TP_CONNECTION_STATUS_REASON_NONE_SPECIFIED);
}
@@ -1205,13 +1099,7 @@ discovery_client_running (SalutConnection *self)
priv->self = salut_discovery_client_create_self (priv->discovery_client,
self, priv->nickname, priv->first_name, priv->last_name, priv->jid,
- priv->email, priv->published_name,
-#ifdef ENABLE_OLPC
- priv->olpc_key, priv->olpc_color
-#else
- NULL, NULL
-#endif
- );
+ priv->email, priv->published_name);
if (priv->pre_connect_caps != NULL)
{
@@ -2075,1036 +1963,6 @@ salut_conn_contact_caps_iface_init (gpointer g_iface, gpointer iface_data)
#undef IMPLEMENT
}
-
-#ifdef ENABLE_OLPC
-static GValue *
-new_gvalue (GType type)
-{
- GValue *result = g_slice_new0 (GValue);
- g_value_init (result, type);
- return result;
-}
-
-static GHashTable *
-get_properties_hash (const GArray *key, const gchar *color, const gchar *jid,
- const gchar *ip4, const gchar *ip6)
-{
- GHashTable *properties;
- GValue *gvalue;
-
- properties = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
- if (key != NULL)
- {
- gvalue = new_gvalue (DBUS_TYPE_G_UCHAR_ARRAY);
- g_value_set_boxed (gvalue, key);
- g_hash_table_insert (properties, "key", gvalue);
- }
-
- if (color != NULL)
- {
- gvalue = new_gvalue (G_TYPE_STRING);
- g_value_set_string (gvalue, color);
- g_hash_table_insert (properties, "color", gvalue);
- }
-
- if (jid != NULL)
- {
- gvalue = new_gvalue (G_TYPE_STRING);
- g_value_set_string (gvalue, jid);
- g_hash_table_insert (properties, "jid", gvalue);
- }
-
- if (ip4 != NULL)
- {
- gvalue = new_gvalue (G_TYPE_STRING);
- g_value_set_string (gvalue, ip4);
- g_hash_table_insert (properties, "ip4-address", gvalue);
- }
-
- if (ip6 != NULL)
- {
- gvalue = new_gvalue (G_TYPE_STRING);
- g_value_set_string (gvalue, ip6);
- g_hash_table_insert (properties, "ip6-address", gvalue);
- }
-
- return properties;
-}
-
-static void
-emit_properties_changed (SalutConnection *connection,
- TpHandle handle,
- const GArray *key,
- const gchar *color,
- const gchar *jid,
- const gchar *ip4,
- const gchar *ip6)
-{
- GHashTable *properties;
- properties = get_properties_hash (key, color, jid, ip4, ip6);
-
- salut_svc_olpc_buddy_info_emit_properties_changed (connection,
- handle, properties);
-
- g_hash_table_unref (properties);
-}
-
-static void
-append_activity (SalutOlpcActivity *activity,
- gpointer user_data)
-{
- GPtrArray *arr = user_data;
- GType type = ACTIVITY_PAIR_TYPE;
- GValue gvalue = {0};
-
- g_value_init (&gvalue, type);
- g_value_take_boxed (&gvalue,
- dbus_g_type_specialized_construct (type));
-
- dbus_g_type_struct_set (&gvalue,
- 0, activity->id,
- 1, activity->room,
- G_MAXUINT);
- g_ptr_array_add (arr, g_value_get_boxed (&gvalue));
-}
-
-static void
-free_olpc_activities (GPtrArray *arr)
-{
- GType type = ACTIVITY_PAIR_TYPE;
- guint i;
-
- for (i = 0; i < arr->len; i++)
- g_boxed_free (type, arr->pdata[i]);
-
- g_ptr_array_unref (arr);
-}
-
-static void
-_contact_manager_contact_olpc_activities_changed (SalutConnection *self,
- SalutContact *contact,
- TpHandle handle)
-{
- GPtrArray *activities = g_ptr_array_new ();
-
- DEBUG ("called for %u", handle);
-
- salut_contact_foreach_olpc_activity (contact, append_activity, activities);
- salut_svc_olpc_buddy_info_emit_activities_changed (self,
- handle, activities);
- free_olpc_activities (activities);
-}
-
-static void
-_contact_manager_contact_olpc_properties_changed (SalutConnection *self,
- SalutContact *contact,
- TpHandle handle)
-{
- emit_properties_changed (self, handle, contact->olpc_key,
- contact->olpc_color, contact->jid, contact->olpc_ip4, contact->olpc_ip6);
-}
-
-static gboolean
-check_handle (TpHandleRepoIface *handle_repo,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- GError *error = NULL;
-
- if (!tp_handle_is_valid (handle_repo, handle, &error))
- {
- dbus_g_method_return_error (context, error);
- g_error_free (error);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-check_contact (TpBaseConnection *base,
- TpHandle contact,
- DBusGMethodInvocation *context)
-{
- TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
- base, TP_HANDLE_TYPE_CONTACT);
-
- return check_handle (contact_repo, contact, context);
-}
-
-static gboolean
-check_room (TpBaseConnection *base,
- TpHandle contact,
- DBusGMethodInvocation *context)
-{
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
- base, TP_HANDLE_TYPE_ROOM);
-
- return check_handle (room_repo, contact, context);
-}
-
-static void
-salut_connection_olpc_get_properties (SalutSvcOLPCBuddyInfo *iface,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = TP_BASE_CONNECTION (self);
- TpHandle self_handle = tp_base_connection_get_self_handle (base);
- GHashTable *properties = NULL;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- if (!check_contact (base, handle, context))
- return;
-
- if (handle == self_handle)
- {
- properties = get_properties_hash (priv->self->olpc_key,
- priv->self->olpc_color, priv->self->jid, NULL, NULL);
- }
- else
- {
- SalutContact *contact;
- contact = salut_contact_manager_get_contact (priv->contact_manager,
- handle);
- if (contact == NULL)
- {
- /* FIXME: should this be InvalidHandle? */
- GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Unknown contact" };
- dbus_g_method_return_error (context, &e);
- return;
- }
- properties = get_properties_hash (contact->olpc_key, contact->olpc_color,
- contact->jid, contact->olpc_ip4, contact->olpc_ip6);
- g_object_unref (contact);
- }
-
- salut_svc_olpc_buddy_info_return_from_get_properties (context, properties);
- g_hash_table_unref (properties);
-}
-
-
-static gboolean
-find_unknown_properties (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- gchar **valid_props = (gchar **) user_data;
- int i;
- for (i = 0; valid_props[i] != NULL; i++)
- {
- if (!tp_strdiff (key, valid_props[i]))
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-salut_connection_olpc_set_properties (SalutSvcOLPCBuddyInfo *iface,
- GHashTable *properties,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
-
- GError *error = NULL;
- /* Only a few known properties, so handle it quite naively */
- const gchar *known_properties[] = { "color", "key", "jid", "ip4-address",
- "ip6-address", NULL };
- const gchar *color = NULL;
- const GArray *key = NULL;
- const gchar *jid = NULL;
- const GValue *val;
-
- /* this function explicitly supports being called when DISCONNECTED
- * or CONNECTING */
-
- if (g_hash_table_find (properties, find_unknown_properties, known_properties)
- != NULL)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Unknown property given");
- goto error;
- }
-
- val = (const GValue *) g_hash_table_lookup (properties, "color");
- if (val != NULL)
- {
- if (G_VALUE_TYPE (val) != G_TYPE_STRING)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Color value should be of type s");
- goto error;
- }
- else
- {
- int len;
- gboolean correct = TRUE;
-
- color = g_value_get_string (val);
-
- /* be very anal about the color format */
- len = strlen (color);
- if (len != 15)
- {
- correct = FALSE;
- }
- else
- {
- int i;
- for (i = 0 ; i < len ; i++)
- {
- switch (i)
- {
- case 0:
- case 8:
- correct = (color[i] == '#');
- break;
- case 7:
- correct = (color[i] == ',');
- break;
- default:
- correct = isxdigit (color[i]);
- break;
- }
- }
- }
-
- if (!correct)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Color value has an incorrect format");
- goto error;
- }
- }
- }
-
- if ((val = (const GValue *) g_hash_table_lookup (properties, "key")) != NULL)
- {
- if (G_VALUE_TYPE (val) != DBUS_TYPE_G_UCHAR_ARRAY)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Key value should be of type ay");
- goto error;
- }
- else
- {
- key = g_value_get_boxed (val);
- if (key->len == 0)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Key value of length 0 not allowed");
- goto error;
- }
- }
- }
-
- val = g_hash_table_lookup (properties, "jid");
- if (val != NULL)
- {
- if (G_VALUE_TYPE (val) != G_TYPE_STRING)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "JID value should be of type s");
- goto error;
- }
-
- jid = g_value_get_string (val);
-
- if (strchr (jid, '@') == NULL)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "JID value has an incorrect format");
- goto error;
- }
- }
-
- if (priv->self)
- {
- if (!salut_self_set_olpc_properties (priv->self, key, color, jid,
- &error))
- goto error;
- }
- else
- {
- /* queue it up for later */
- if (key)
- {
- if (priv->olpc_key == NULL)
- {
- priv->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8),
- key->len);
- }
- else
- {
- g_array_remove_range (priv->olpc_key, 0, priv->olpc_key->len);
- }
- g_array_append_vals (priv->olpc_key, key->data, key->len);
- }
- if (color)
- {
- g_free (priv->olpc_color);
- priv->olpc_color = g_strdup (color);
- }
- if (jid)
- {
- g_free (priv->jid);
- priv->jid = g_strdup (jid);
- }
- }
-
- salut_svc_olpc_buddy_info_return_from_set_properties (context);
- return;
-
-error:
- dbus_g_method_return_error (context, error);
- g_error_free (error);
-}
-
-static void
-salut_connection_olpc_get_current_activity (SalutSvcOLPCBuddyInfo *iface,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- TpBaseConnection *base = (TpBaseConnection *) self;
- TpHandle self_handle = tp_base_connection_get_self_handle (base);
- SalutConnectionPrivate *priv = self->priv;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- DEBUG ("called for %u", handle);
-
- if (!check_contact (base, handle, context))
- return;
-
- if (handle == self_handle)
- {
- DEBUG ("Returning my own cur.act.: %s -> %u",
- priv->self->olpc_cur_act ? priv->self->olpc_cur_act : "",
- priv->self->olpc_cur_act_room);
- salut_svc_olpc_buddy_info_return_from_get_current_activity (context,
- priv->self->olpc_cur_act ? priv->self->olpc_cur_act : "",
- priv->self->olpc_cur_act_room);
- }
- else
- {
- SalutContact *contact = salut_contact_manager_get_contact
- (priv->contact_manager, handle);
-
- if (contact == NULL)
- {
- /* FIXME: should this be InvalidHandle? */
- GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Unknown contact" };
- DEBUG ("Returning error: unknown contact");
- dbus_g_method_return_error (context, &e);
- return;
- }
-
- DEBUG ("Returning buddy %u cur.act.: %s -> %u", handle,
- contact->olpc_cur_act ? contact->olpc_cur_act : "",
- contact->olpc_cur_act_room);
- salut_svc_olpc_buddy_info_return_from_get_current_activity (context,
- contact->olpc_cur_act ? contact->olpc_cur_act : "",
- contact->olpc_cur_act_room);
- g_object_unref (contact);
- }
-}
-
-static void
-salut_connection_olpc_set_current_activity (SalutSvcOLPCBuddyInfo *iface,
- const gchar *activity_id,
- TpHandle room_handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- GError *error = NULL;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- DEBUG ("called");
-
- if (activity_id[0] == '\0')
- {
- if (room_handle != 0)
- {
- GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "If activity ID is empty, room handle must be 0" };
-
- dbus_g_method_return_error (context, &e);
- return;
- }
- }
- else
- {
- if (!check_room (base, room_handle, context))
- return;
- }
-
- if (!salut_self_set_olpc_current_activity (priv->self, activity_id,
- room_handle, &error))
- {
- dbus_g_method_return_error (context, error);
- g_error_free (error);
- return;
- }
-
- salut_svc_olpc_buddy_info_return_from_set_current_activity (context);
-}
-
-static void
-salut_connection_olpc_get_activities (SalutSvcOLPCBuddyInfo *iface,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- TpHandle self_handle = tp_base_connection_get_self_handle (base);
- GPtrArray *arr;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- DEBUG ("called for %u", handle);
-
- if (!check_contact (base, handle, context))
- return;
-
- if (handle == self_handle)
- {
- arr = g_ptr_array_new ();
- salut_self_foreach_olpc_activity (priv->self, append_activity, arr);
- }
- else
- {
- SalutContact *contact = salut_contact_manager_get_contact
- (priv->contact_manager, handle);
-
- if (contact == NULL)
- {
- /* FIXME: should this be InvalidHandle? */
- GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Unknown contact" };
- DEBUG ("Returning error: unknown contact");
- dbus_g_method_return_error (context, &e);
- return;
- }
-
- arr = g_ptr_array_new ();
- salut_contact_foreach_olpc_activity (contact, append_activity, arr);
- g_object_unref (contact);
- }
-
- salut_svc_olpc_buddy_info_return_from_get_activities (context, arr);
- free_olpc_activities (arr);
-}
-
-static void
-salut_connection_olpc_set_activities (SalutSvcOLPCBuddyInfo *iface,
- const GPtrArray *activities,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base,
- TP_HANDLE_TYPE_ROOM);
- GHashTable *room_to_act_id = g_hash_table_new_full (g_direct_hash,
- g_direct_equal, NULL, (GDestroyNotify) g_free);
- GError *error = NULL;
- guint i;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- for (i = 0; i < activities->len; i++)
- {
- GValue pair = {0};
- gchar *activity;
- guint room_handle;
-
- g_value_init (&pair, ACTIVITY_PAIR_TYPE);
- g_value_set_static_boxed (&pair, g_ptr_array_index (activities, i));
- dbus_g_type_struct_get (&pair,
- 0, &activity,
- 1, &room_handle,
- G_MAXUINT);
-
- if (activity[0] == '\0')
- {
- GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Invalid empty activity ID" };
-
- DEBUG ("%s", e.message);
- dbus_g_method_return_error (context, &e);
- g_free (activity);
- goto finally;
- }
-
- if (!tp_handle_is_valid (room_repo, room_handle, &error))
- {
- DEBUG ("Invalid room handle %u: %s", room_handle, error->message);
- dbus_g_method_return_error (context, error);
- g_error_free (error);
- g_free (activity);
- goto finally;
- }
-
- g_hash_table_insert (room_to_act_id, GUINT_TO_POINTER (room_handle),
- activity);
- }
-
- if (!salut_self_set_olpc_activities (priv->self, room_to_act_id, &error))
- {
- dbus_g_method_return_error (context, error);
- }
- else
- {
- salut_svc_olpc_buddy_info_return_from_set_activities (context);
- }
-
-finally:
- g_hash_table_unref (room_to_act_id);
-}
-
-static void
-salut_connection_olpc_add_activity (SalutSvcOLPCBuddyInfo *iface,
- const gchar *id,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- GError *error = NULL;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- if (!salut_self_add_olpc_activity (priv->self, id, handle, &error))
- {
- dbus_g_method_return_error (context, error);
- }
- else
- {
- salut_svc_olpc_buddy_info_return_from_set_activities (context);
- }
-}
-
-static void
-salut_connection_olpc_buddy_info_iface_init (gpointer g_iface,
- gpointer iface_data)
-{
- SalutSvcOLPCBuddyInfoClass *klass =
- (SalutSvcOLPCBuddyInfoClass *) g_iface;
-#define IMPLEMENT(x) salut_svc_olpc_buddy_info_implement_##x (klass, \
- salut_connection_olpc_##x)
- IMPLEMENT(set_properties);
- IMPLEMENT(get_properties);
- IMPLEMENT(set_activities);
- IMPLEMENT(add_activity);
- IMPLEMENT(get_activities);
- IMPLEMENT(set_current_activity);
- IMPLEMENT(get_current_activity);
-#undef IMPLEMENT
-}
-
-static void
-salut_connection_act_get_properties (SalutSvcOLPCActivityProperties *iface,
- TpHandle handle,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base,
- TP_HANDLE_TYPE_ROOM);
- GHashTable *properties = NULL;
- GError *error = NULL;
- SalutOlpcActivity *activity;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- if (!tp_handle_is_valid (room_repo, handle, &error))
- goto error;
-
- activity = salut_olpc_activity_manager_get_activity_by_room (
- priv->olpc_activity_manager, handle);
- if (activity == NULL)
- {
- g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "Activity unknown: %u", handle);
- goto error;
- }
-
- properties = salut_olpc_activity_create_properties_table (activity);
-
- salut_svc_olpc_buddy_info_return_from_get_properties (context, properties);
- g_hash_table_unref (properties);
-
- return;
-
-error:
- dbus_g_method_return_error (context, error);
- g_error_free (error);
-}
-
-static gboolean
-check_color (const gchar *color)
-{
- int len, i;
-
- /* be very anal about the color format */
- len = strlen (color);
- if (len != 15)
- return FALSE;
-
- for (i = 0 ; i < len ; i++)
- {
- switch (i)
- {
- case 0:
- case 8:
- if (color[i] != '#')
- return FALSE;
- break;
- case 7:
- if (color[i] != ',')
- return FALSE;
- break;
- default:
- if (!isxdigit (color[i]))
- return FALSE;
- break;
- }
- }
-
- return TRUE;
-}
-
-/* returned strings are only valid as long as the hash table isn't modified */
-static gboolean
-extract_properties_from_hash (GHashTable *properties,
- const gchar **id,
- const gchar **color,
- const gchar **name,
- const gchar **type,
- const gchar **tags,
- gboolean *is_private,
- GError **error)
-{
- GValue *activity_id_val, *color_val, *activity_name_val, *activity_type_val,
- *tags_val, *is_private_val;
-
- /* activity ID */
- activity_id_val = g_hash_table_lookup (properties, "id");
- if (activity_id_val != NULL)
- {
- if (G_VALUE_TYPE (activity_id_val) != G_TYPE_STRING)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Activity ID value should be of type s");
- return FALSE;
- }
-
- if (id != NULL)
- *id = g_value_get_string (activity_id_val);
- }
-
- /* color */
- color_val = g_hash_table_lookup (properties, "color");
- if (color_val != NULL)
- {
- if (G_VALUE_TYPE (color_val) != G_TYPE_STRING)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Color value should be of type s");
- return FALSE;
- }
-
- if (color != NULL)
- {
- *color = g_value_get_string (color_val);
-
- if (!check_color (*color))
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Color value has an incorrect format");
- return FALSE;
- }
- }
- }
-
- /* name */
- activity_name_val = g_hash_table_lookup (properties, "name");
- if (activity_name_val != NULL)
- {
- if (G_VALUE_TYPE (activity_name_val) != G_TYPE_STRING)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "name value should be of type s");
- return FALSE;
- }
-
- if (name != NULL)
- *name = g_value_get_string (activity_name_val);
- }
-
- /* type */
- activity_type_val = g_hash_table_lookup (properties, "type");
- if (activity_type_val != NULL)
- {
- if (G_VALUE_TYPE (activity_type_val) != G_TYPE_STRING)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "type value should be of type s");
- return FALSE;
- }
-
- if (type != NULL)
- {
- *type = g_value_get_string (activity_type_val);
-
- if (*type[0] == '\0')
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "type value must be non-empty");
- return FALSE;
- }
- }
- }
-
- /* tags */
- tags_val = g_hash_table_lookup (properties, "tags");
- if (tags_val != NULL)
- {
- if (G_VALUE_TYPE (activity_type_val) != G_TYPE_STRING)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "tags value should be of type s");
- return FALSE;
- }
-
- if (type != NULL)
- *tags = g_value_get_string (tags_val);
- }
-
- /* is_private */
- is_private_val = g_hash_table_lookup (properties, "private");
- if (is_private_val != NULL)
- {
- if (G_VALUE_TYPE (is_private_val) != G_TYPE_BOOLEAN)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "private value should be of type b");
- return FALSE;
- }
-
- if (is_private != NULL)
- *is_private = g_value_get_boolean (is_private_val);
- }
-
- return TRUE;
-}
-
-static void
-salut_connection_act_set_properties (SalutSvcOLPCActivityProperties *iface,
- TpHandle handle,
- GHashTable *properties,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- GError *error = NULL;
- const gchar *known_properties[] = { "color", "name", "type", "private",
- "tags", NULL };
- const gchar *color = NULL, *name = NULL, *type = NULL, *tags = NULL;
- gboolean is_private = TRUE;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- if (!check_room (base, handle, context))
- return;
-
- if (g_hash_table_find (properties, find_unknown_properties, known_properties)
- != NULL)
- {
- error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Unknown property given");
- goto error;
- }
-
- if (!extract_properties_from_hash (properties, NULL, &color, &name, &type,
- &tags, &is_private, &error))
- goto error;
-
- if (!salut_self_set_olpc_activity_properties (priv->self, handle, color,
- name, type, tags, is_private, &error))
- goto error;
-
- salut_svc_olpc_activity_properties_return_from_set_properties (context);
- return;
-
-error:
- dbus_g_method_return_error (context, error);
- g_error_free (error);
-}
-
-typedef struct
-{
- SalutContact *inviter;
- SalutOlpcActivity *activity;
-} muc_ready_ctx;
-
-static muc_ready_ctx *
-muc_ready_ctx_new (SalutContact *inviter,
- SalutOlpcActivity *activity)
-{
- muc_ready_ctx *ctx = g_slice_new (muc_ready_ctx);
- ctx->inviter = inviter;
- g_object_ref (inviter);
- ctx->activity = activity;
- g_object_ref (activity);
- return ctx;
-}
-
-static void
-muc_ready_ctx_free (muc_ready_ctx *ctx)
-{
- if (ctx == NULL)
- return;
-
- g_object_unref (ctx->inviter);
- g_object_unref (ctx->activity);
- g_slice_free (muc_ready_ctx, ctx);
-}
-
-static void
-muc_ready_cb (SalutMucChannel *muc,
- muc_ready_ctx *ctx)
-{
- /* We joined the muc so have to forget about invites */
- salut_contact_left_activity (ctx->inviter, ctx->activity);
-
- DEBUG ("forget invite received from %s", ctx->inviter->name);
- g_signal_handlers_disconnect_matched (muc, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
- NULL, ctx);
- muc_ready_ctx_free (ctx);
-}
-
-static void
-muc_closed_cb (SalutMucChannel *muc,
- muc_ready_ctx *ctx)
-{
- /* FIXME: should we call left_private_activity here too ? */
-
- g_signal_handlers_disconnect_matched (muc, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
- NULL, ctx);
- muc_ready_ctx_free (ctx);
-}
-
-void
-salut_connection_olpc_observe_invitation (SalutConnection *self,
- TpHandle room,
- TpHandle inviter_handle,
- WockyNode *invite_node)
-{
- SalutConnectionPrivate *priv = self->priv;
- WockyNode *props_node;
- GHashTable *properties;
- const gchar *activity_id, *color = NULL, *activity_name = NULL,
- *activity_type = NULL, *tags = NULL;
- SalutContact *inviter;
- SalutOlpcActivity *activity;
- SalutMucChannel *muc;
- muc_ready_ctx *ctx;
-
- props_node = wocky_node_get_child_ns (invite_node, "properties",
- NS_OLPC_ACTIVITY_PROPS);
-
- if (props_node == NULL)
- return;
-
- inviter = salut_contact_manager_get_contact (priv->contact_manager,
- inviter_handle);
- if (inviter == NULL)
- return;
-
- properties = salut_wocky_node_extract_properties (props_node,
- "property");
-
- if (!extract_properties_from_hash (properties, &activity_id, &color,
- &activity_name, &activity_type, &tags, NULL, NULL))
- return;
-
- activity = salut_olpc_activity_manager_got_invitation (
- priv->olpc_activity_manager,
- room, inviter, activity_id, activity_name, activity_type,
- color, tags);
-#ifndef USE_BACKEND_BONJOUR
- muc = salut_muc_manager_get_text_channel (priv->muc_manager, room);
- g_assert (muc != NULL);
-
- ctx = muc_ready_ctx_new (inviter, activity);
- g_signal_connect (muc, "ready", G_CALLBACK (muc_ready_cb), ctx);
- g_signal_connect (muc, "closed", G_CALLBACK (muc_closed_cb), ctx);
-
- g_object_unref (muc);
-#endif
- g_hash_table_unref (properties);
- g_object_unref (inviter);
-}
-
-static void
-salut_connection_act_get_activity (SalutSvcOLPCActivityProperties *iface,
- const gchar *activity_id,
- DBusGMethodInvocation *context)
-{
- SalutConnection *self = SALUT_CONNECTION (iface);
- SalutConnectionPrivate *priv = self->priv;
- TpBaseConnection *base = (TpBaseConnection *) self;
- GError *error = NULL;
- SalutOlpcActivity *activity;
-
- TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
-
- activity = salut_olpc_activity_manager_get_activity_by_id (
- priv->olpc_activity_manager, activity_id);
- if (activity == NULL)
- {
- g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "Activity unknown: %s", activity_id);
- goto error;
- }
-
- salut_svc_olpc_activity_properties_return_from_get_activity (context,
- activity->room);
-
- return;
-
-error:
- dbus_g_method_return_error (context, error);
- g_error_free (error);
-}
-
-static void
-salut_connection_olpc_activity_properties_iface_init (gpointer g_iface,
- gpointer iface_data)
-{
- SalutSvcOLPCActivityPropertiesClass *klass =
- (SalutSvcOLPCActivityPropertiesClass *) g_iface;
-#define IMPLEMENT(x) salut_svc_olpc_activity_properties_implement_##x \
- (klass, salut_connection_act_##x)
- IMPLEMENT(set_properties);
- IMPLEMENT(get_properties);
- IMPLEMENT(get_activity);
-#undef IMPLEMENT
-}
-#endif
-
gchar *
salut_normalize_non_empty (const gchar *id,
GError **error)
@@ -3175,221 +2033,9 @@ _contact_manager_contact_change_cb (SalutContactManager *mgr,
{
salut_conn_contact_info_changed (self, contact, handle);
}
-
-#ifdef ENABLE_OLPC
- if (changes & SALUT_CONTACT_OLPC_PROPERTIES)
- _contact_manager_contact_olpc_properties_changed (self, contact, handle);
-
- if (changes & SALUT_CONTACT_OLPC_CURRENT_ACTIVITY)
- salut_svc_olpc_buddy_info_emit_current_activity_changed (self,
- handle, contact->olpc_cur_act, contact->olpc_cur_act_room);
-
- if (changes & SALUT_CONTACT_OLPC_ACTIVITIES)
- _contact_manager_contact_olpc_activities_changed (self, contact, handle);
-#endif
-}
-
-#ifdef ENABLE_OLPC
-static void
-_olpc_activity_manager_activity_modified_cb (SalutOlpcActivityManager *mgr,
- SalutOlpcActivity *activity, SalutConnection *self)
-{
- GHashTable *properties;
-
- properties = salut_olpc_activity_create_properties_table (activity);
- salut_svc_olpc_activity_properties_emit_activity_properties_changed (
- self, activity->room, properties);
-
- g_hash_table_unref (properties);
-}
-
-gboolean
-salut_connection_olpc_observe_muc_stanza (SalutConnection *self,
- TpHandle room, TpHandle sender, WockyStanza *stanza)
-{
- WockyNode *node = wocky_stanza_get_top_node (stanza);
- SalutConnectionPrivate *priv = self->priv;
- WockyNode *props_node;
- GHashTable *properties;
- const gchar *activity_id, *color = NULL, *activity_name = NULL,
- *activity_type = NULL, *tags = NULL;
- gboolean is_private = FALSE;
- SalutOlpcActivity *activity;
-
- props_node = wocky_node_get_child_ns (node, "properties",
- NS_OLPC_ACTIVITY_PROPS);
-
- if (props_node == NULL)
- return FALSE;
-
- activity = salut_olpc_activity_manager_get_activity_by_room (
- priv->olpc_activity_manager, room);
-
- if (activity == NULL)
- {
- DEBUG ("no activity in room %d", room);
- return FALSE;
- }
-
- properties = salut_wocky_node_extract_properties (props_node,
- "property");
-
- if (!extract_properties_from_hash (properties, &activity_id, &color,
- &activity_name, &activity_type, &tags, &is_private, NULL))
- return TRUE;
-
- salut_olpc_activity_update (activity, room, activity_id, activity_name,
- activity_type, color, tags, is_private);
-
- g_hash_table_unref (properties);
-
- return TRUE;
-}
-
-static gboolean
-uninvite_stanza_callback (WockyPorter *porter,
- WockyStanza *stanza,
- gpointer user_data)
-{
- SalutConnection *self = SALUT_CONNECTION (user_data);
- SalutConnectionPrivate *priv = self->priv;
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) self, TP_HANDLE_TYPE_ROOM);
- WockyNode *node;
- TpHandle room_handle;
- const gchar *room, *activity_id;
- SalutOlpcActivity *activity;
- WockyNode *top_node = wocky_stanza_get_top_node (stanza);
- SalutContact *contact = SALUT_CONTACT (wocky_stanza_get_from_contact (stanza));
-
- node = wocky_node_get_child_ns (top_node, "uninvite",
- NS_OLPC_ACTIVITY_PROPS);
- g_assert (node != NULL);
-
- room = wocky_node_get_attribute (node, "room");
- if (room == NULL)
- {
- DEBUG ("No room attribute");
- return FALSE;
- }
-
- room_handle = tp_handle_lookup (room_repo, room, NULL, NULL);
- if (room_handle == 0)
- {
- DEBUG ("room %s unknown", room);
- return FALSE;
- }
-
- activity_id = wocky_node_get_attribute (node, "id");
- if (activity_id == NULL)
- {
- DEBUG ("No id attribute");
- return FALSE;
- }
-
- DEBUG ("received uninvite from %s", contact->name);
-
- activity = salut_olpc_activity_manager_get_activity_by_room (
- priv->olpc_activity_manager, room_handle);
-
- if (activity == NULL)
- return FALSE;
-
- salut_contact_left_activity (contact, activity);
-
- return TRUE;
-}
-
-static void
-setup_olpc_activity_manager (SalutConnection *self)
-{
- SalutConnectionPrivate *priv = self->priv;
-
- priv->uninvite_handler_id = wocky_porter_register_handler_from_anyone (
- self->porter,
- WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE,
- WOCKY_PORTER_HANDLER_PRIORITY_NORMAL,
- uninvite_stanza_callback, self,
- '(', "uninvite",
- ':', NS_OLPC_ACTIVITY_PROPS,
- ')', NULL);
-
- /* create the OLPC activity manager */
- priv->olpc_activity_manager =
- salut_discovery_client_create_olpc_activity_manager (
- priv->discovery_client, self);
- g_signal_connect (priv->olpc_activity_manager, "activity-modified",
- G_CALLBACK (_olpc_activity_manager_activity_modified_cb), self);
-}
-
-static void
-muc_channel_closed_cb (SalutMucChannel *chan,
- SalutOlpcActivity *activity)
-{
- SalutConnection *conn;
- SalutConnectionPrivate *priv;
- TpBaseConnection *base;
- TpHandle self_handle;
- GPtrArray *activities = g_ptr_array_new ();
-
- g_signal_handlers_disconnect_by_func (chan,
- G_CALLBACK (muc_channel_closed_cb), activity);
-
- g_object_get (activity,
- "connection", &conn,
- NULL);
-
- priv = conn->priv;
- base = (TpBaseConnection *) conn;
- self_handle = tp_base_connection_get_self_handle (base);
-
- salut_self_remove_olpc_activity (priv->self, activity);
-
- salut_self_foreach_olpc_activity (priv->self, append_activity, activities);
- salut_svc_olpc_buddy_info_emit_activities_changed (conn, self_handle,
- activities);
- free_olpc_activities (activities);
-
- /* we were holding a ref since the channel was opened */
- g_object_unref (activity);
-
- g_object_unref (conn);
}
static void
-muc_manager_new_channels_cb (TpChannelManager *channel_manager,
- GHashTable *channels,
- SalutConnection *conn)
-{
- SalutConnectionPrivate *priv = conn->priv;
- GHashTableIter iter;
- gpointer chan;
-
- g_hash_table_iter_init (&iter, channels);
- while (g_hash_table_iter_next (&iter, &chan, NULL))
- {
- SalutOlpcActivity *activity;
- TpHandle room_handle;
-
- if (!SALUT_IS_MUC_CHANNEL (chan))
- return;
-
- g_object_get (chan,
- "handle", &room_handle,
- NULL);
-
- /* ref the activity as long as we have a channel open */
- activity = salut_olpc_activity_manager_ensure_activity_by_room (
- priv->olpc_activity_manager,
- room_handle);
-
- g_signal_connect (chan, "closed", G_CALLBACK (muc_channel_closed_cb),
- activity);
- }
-}
-#endif
-
-static void
add_to_array (gpointer data,
gpointer user_data)
{
@@ -3441,11 +2087,6 @@ salut_connection_create_channel_managers (TpBaseConnection *base)
g_ptr_array_add (managers, priv->tubes_manager);
#endif
-#ifdef ENABLE_OLPC
- g_signal_connect (TP_CHANNEL_MANAGER (priv->muc_manager), "new-channels",
- G_CALLBACK (muc_manager_new_channels_cb), self);
-#endif
-
/* plugin channel managers */
loader = salut_plugin_loader_dup ();
tmp = salut_plugin_loader_create_channel_managers (loader, plugin_connection);
diff --git a/src/connection.h b/src/connection.h
index dcc0128d..d965587e 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -91,16 +91,6 @@ typedef enum {
LIST_HANDLE_LAST = LIST_HANDLE_KNOWN
} SalutConnectionListHandle;
-#ifdef ENABLE_OLPC
-void
-salut_connection_olpc_observe_invitation (SalutConnection *connection,
- TpHandle room, TpHandle invitor_handle, WockyNode *invite_node);
-
-gboolean
-salut_connection_olpc_observe_muc_stanza (SalutConnection *self, TpHandle room,
- TpHandle sender, WockyStanza *stanza);
-#endif
-
const gchar * const *salut_connection_get_implemented_interfaces (void);
gchar *salut_normalize_non_empty (const gchar *id, GError **error);
diff --git a/src/contact.c b/src/contact.c
index 109c8db8..558b6ff0 100644
--- a/src/contact.c
+++ b/src/contact.c
@@ -73,10 +73,6 @@ struct _SalutContactPrivate
gboolean dispose_has_run;
gchar *alias;
GList *avatar_requests;
-#ifdef ENABLE_OLPC
- /* room handle owned by the SalutOlpcActivity -> SalutOlpcActivity */
- GHashTable *olpc_activities;
-#endif
gboolean found;
gboolean frozen;
guint pending_changes;
@@ -146,16 +142,6 @@ salut_contact_init (SalutContact *obj)
obj->status_message = NULL;
obj->avatar_token = NULL;
obj->jid = NULL;
-#ifdef ENABLE_OLPC
- obj->olpc_key = NULL;
- obj->olpc_color = NULL;
- obj->olpc_cur_act = NULL;
- obj->olpc_cur_act_room = 0;
- obj->olpc_ip4 = NULL;
- obj->olpc_ip6 = NULL;
- priv->olpc_activities = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, (GDestroyNotify) g_object_unref);
-#endif
priv->found = FALSE;
priv->alias = NULL;
}
@@ -269,17 +255,6 @@ salut_contact_class_init (SalutContactClass *salut_contact_class)
param_spec);
}
-#ifdef ENABLE_OLPC
-static void
-disconnect_activity_signal_foreach (TpHandle room,
- SalutOlpcActivity *activity,
- SalutContact *self)
-{
- g_signal_handlers_disconnect_matched (activity, G_SIGNAL_MATCH_DATA, 0, 0,
- NULL, NULL, self);
-}
-#endif
-
void
salut_contact_dispose (GObject *object)
{
@@ -293,12 +268,6 @@ salut_contact_dispose (GObject *object)
priv->dispose_has_run = TRUE;
-#ifdef ENABLE_OLPC
- g_hash_table_foreach (priv->olpc_activities,
- (GHFunc) disconnect_activity_signal_foreach, self);
- g_hash_table_unref (priv->olpc_activities);
-#endif
-
salut_contact_avatar_request_flush (self, NULL, 0);
/* release any references held by the object here */
@@ -330,17 +299,6 @@ salut_contact_finalize (GObject *object)
g_free (self->email);
g_free (self->jid);
-#ifdef ENABLE_OLPC
- if (self->olpc_key != NULL)
- {
- g_array_unref (self->olpc_key);
- }
- g_free (self->olpc_color);
- g_free (self->olpc_cur_act);
- g_free (self->olpc_ip4);
- g_free (self->olpc_ip6);
-#endif
-
G_OBJECT_CLASS (salut_contact_parent_class)->finalize (object);
}
@@ -359,45 +317,6 @@ purge_cached_avatar (SalutContact *self,
SALUT_CONTACT_GET_CLASS (self)->retrieve_avatar (self);
}
-#ifdef ENABLE_OLPC
-typedef struct
-{
- SalutContactOLPCActivityFunc foreach;
- gpointer user_data;
-} foreach_olpc_activity_ctx;
-
-static void
-foreach_olpc_activity (gpointer key, gpointer value, gpointer user_data)
-{
- foreach_olpc_activity_ctx *ctx = user_data;
- SalutOlpcActivity *activity = value;
-
- /* ignore activity without ID */
- if (activity->id == NULL)
- return;
-
- DEBUG ("%s => %u", activity->id, activity->room);
- (ctx->foreach) (activity, ctx->user_data);
-}
-
-void
-salut_contact_foreach_olpc_activity (SalutContact *self,
- SalutContactOLPCActivityFunc foreach,
- gpointer user_data)
-{
- SalutContactPrivate *priv = self->priv;
- foreach_olpc_activity_ctx ctx = { foreach, user_data };
-
- DEBUG ("called");
-
- g_hash_table_foreach (priv->olpc_activities, foreach_olpc_activity,
- &ctx);
-
- DEBUG ("end");
-}
-
-#endif
-
GArray *
salut_contact_get_addresses (SalutContact *self)
{
@@ -616,9 +535,6 @@ salut_contact_change_jid (SalutContact *self, gchar *jid)
self->jid = g_strdup (jid);
salut_contact_change (self,
SALUT_CONTACT_JID_CHANGED
-#ifdef ENABLE_OLPC
- | SALUT_CONTACT_OLPC_PROPERTIES
-#endif
);
}
}
@@ -635,115 +551,6 @@ void salut_contact_change_capabilities (SalutContact *self,
hash, node, ver);
}
-#ifdef ENABLE_OLPC
-void
-salut_contact_change_olpc_color (SalutContact *self, const gchar *olpc_color)
-{
- if (tp_strdiff (self->olpc_color, olpc_color))
- {
- g_free (self->olpc_color);
- self->olpc_color = g_strdup (olpc_color);
- salut_contact_change (self, SALUT_CONTACT_OLPC_PROPERTIES);
- }
-}
-
-void
-salut_contact_change_olpc_key (SalutContact *self, GArray *olpc_key)
-{
- if (olpc_key != NULL)
- {
- if (self->olpc_key == NULL || self->olpc_key->len != olpc_key->len ||
- memcmp (self->olpc_key->data, olpc_key->data, olpc_key->len) != 0)
- {
- if (self->olpc_key != NULL)
- {
- g_array_unref (self->olpc_key);
- }
- self->olpc_key = g_array_sized_new (FALSE, FALSE,
- sizeof (guint8), olpc_key->len);
- g_array_append_vals (self->olpc_key, olpc_key->data,
- olpc_key->len);
- salut_contact_change (self, SALUT_CONTACT_OLPC_PROPERTIES);
- }
- }
-}
-
-void
-salut_contact_change_ipv4_addr (SalutContact *self, const gchar *ipv4_addr)
-{
- if (tp_strdiff (ipv4_addr, self->olpc_ip4))
- {
- g_free (self->olpc_ip4);
- self->olpc_ip4 = g_strdup (ipv4_addr);
- salut_contact_change (self, SALUT_CONTACT_OLPC_PROPERTIES);
- }
-
-}
-
-void
-salut_contact_change_ipv6_addr (SalutContact *self, const gchar *ipv6_addr)
-{
- if (tp_strdiff (ipv6_addr, self->olpc_ip6))
- {
- g_free (self->olpc_ip6);
- self->olpc_ip6 = g_strdup (ipv6_addr);
- salut_contact_change (self, SALUT_CONTACT_OLPC_PROPERTIES);
- }
-}
-
-void
-salut_contact_change_current_activity (SalutContact *self,
- const gchar *current_activity_id,
- const gchar *current_activity_room)
-{
- TpHandleRepoIface *room_repo;
- TpHandle room_handle = 0;
-
- if (self->connection == NULL)
- return;
-
- room_repo = tp_base_connection_get_handles
- ((TpBaseConnection *) self->connection, TP_HANDLE_TYPE_ROOM);
-
- if (current_activity_room != NULL && *current_activity_room != '\0')
- {
- room_handle = tp_handle_ensure (room_repo, current_activity_room,
- NULL, NULL);
- if (room_handle == 0)
- {
- DEBUG ("Invalid room \"%s\" for current activity \"%s\": "
- "ignoring", current_activity_room, current_activity_id);
- }
- }
-
- if (current_activity_id == NULL || room_handle == 0)
- {
- DEBUG ("Unsetting current activity");
- if (self->olpc_cur_act != NULL || self->olpc_cur_act_room != 0)
- {
- g_free (self->olpc_cur_act);
- self->olpc_cur_act = NULL;
- self->olpc_cur_act_room = 0;
- salut_contact_change (self, SALUT_CONTACT_OLPC_CURRENT_ACTIVITY);
- }
- }
- else
- {
- DEBUG ("Current activity %s, room handle %d", current_activity_id,
- room_handle);
- if (tp_strdiff (self->olpc_cur_act, current_activity_id) ||
- self->olpc_cur_act_room != room_handle)
- {
- g_free (self->olpc_cur_act);
- self->olpc_cur_act_room = room_handle;
- self->olpc_cur_act = g_strdup (current_activity_id);
- salut_contact_change (self, SALUT_CONTACT_OLPC_CURRENT_ACTIVITY);
- }
- }
-}
-
-#endif
-
void
salut_contact_found (SalutContact *self)
{
@@ -799,68 +606,6 @@ salut_contact_thaw (SalutContact *self)
salut_contact_change (self, 0);
}
-#ifdef ENABLE_OLPC
-static void
-activity_valid_cb (SalutOlpcActivity *activity,
- SalutContact *self)
-{
- /* Now we can emit the ActivitiesChanged signal */
- DEBUG ("activity in room %d (%s) is now valid", activity->room, activity->id);
- g_signal_emit (self, signals[CONTACT_CHANGE], 0,
- SALUT_CONTACT_OLPC_ACTIVITIES);
-}
-
-gboolean
-salut_contact_joined_activity (SalutContact *self,
- SalutOlpcActivity *activity)
-{
- SalutContactPrivate *priv = self->priv;
-
- if (g_hash_table_lookup (priv->olpc_activities,
- GUINT_TO_POINTER (activity->room)) != NULL)
- return FALSE;
-
- DEBUG_CONTACT (self, "joined activity %s", activity->id);
- g_hash_table_insert (priv->olpc_activities, GUINT_TO_POINTER (activity->room),
- activity);
- g_object_ref (activity);
-
- if (activity->id == NULL)
- {
- /* we can't emit the ActivitiesChanged signal right now as we don't have
- * the activity ID. Thanks OLPC interface */
- DEBUG ("activity in room %d isn't valid yet", activity->room);
- g_signal_connect (activity, "valid", G_CALLBACK (activity_valid_cb),
- self);
- }
- else
- {
- g_signal_emit (self, signals[CONTACT_CHANGE], 0,
- SALUT_CONTACT_OLPC_ACTIVITIES);
- }
-
- return TRUE;
-}
-
-void
-salut_contact_left_activity (SalutContact *self,
- SalutOlpcActivity *activity)
-{
- SalutContactPrivate *priv = self->priv;
-
- g_signal_handlers_disconnect_matched (activity, G_SIGNAL_MATCH_DATA, 0, 0,
- NULL, NULL, self);
-
- DEBUG_CONTACT (self, "left activity %s", activity->id);
- if (!g_hash_table_remove (priv->olpc_activities,
- GUINT_TO_POINTER (activity->room)))
- return;
-
- g_signal_emit (self, signals[CONTACT_CHANGE], 0,
- SALUT_CONTACT_OLPC_ACTIVITIES);
-}
-#endif
-
static const GPtrArray *
salut_contact_get_data_forms (WockyXep0115Capabilities *caps)
{
diff --git a/src/contact.h b/src/contact.h
index d301e293..33244f2c 100644
--- a/src/contact.h
+++ b/src/contact.h
@@ -28,10 +28,6 @@
#include "presence.h"
#include "connection.h"
-#ifdef ENABLE_OLPC
-#include "olpc-activity.h"
-#endif
-
#include <gibber/gibber-sockets.h>
#include <wocky/wocky.h>
@@ -42,11 +38,6 @@ enum {
SALUT_CONTACT_ALIAS_CHANGED = 0x1,
SALUT_CONTACT_STATUS_CHANGED = 0x2,
SALUT_CONTACT_AVATAR_CHANGED = 0x4,
-#ifdef ENABLE_OLPC
- SALUT_CONTACT_OLPC_PROPERTIES = 0x8,
- SALUT_CONTACT_OLPC_CURRENT_ACTIVITY = 0x10,
- SALUT_CONTACT_OLPC_ACTIVITIES = 0x20,
-#endif /* ENABLE_OLPC */
SALUT_CONTACT_JID_CHANGED = 0x40,
SALUT_CONTACT_EMAIL_CHANGED = 0x80,
SALUT_CONTACT_REAL_NAME_CHANGED = 0x100,
@@ -89,14 +80,6 @@ struct _SalutContact {
GPtrArray *data_forms; /* of owned WockyDataForm*s */
TpHandle handle;
-#ifdef ENABLE_OLPC
- GArray *olpc_key;
- gchar *olpc_color;
- gchar *olpc_cur_act;
- TpHandle olpc_cur_act_room;
- gchar *olpc_ip4;
- gchar *olpc_ip6;
-#endif /* ENABLE_OLPC */
/* private */
SalutConnection *connection;
@@ -144,20 +127,6 @@ void salut_contact_set_capabilities (SalutContact *contact,
const GabbleCapabilitySet *caps,
const GPtrArray *data_forms);
-#ifdef ENABLE_OLPC
-typedef void (*SalutContactOLPCActivityFunc)
- (SalutOlpcActivity *activity, gpointer user_data);
-
-void salut_contact_foreach_olpc_activity (SalutContact *self,
- SalutContactOLPCActivityFunc foreach, gpointer user_data);
-
-gboolean salut_contact_joined_activity (SalutContact *self,
- SalutOlpcActivity *activity);
-
-void salut_contact_left_activity (SalutContact *self,
- SalutOlpcActivity *activity);
-#endif
-
/* restricted methods */
void salut_contact_change_real_name (SalutContact *self, const gchar *first,
const gchar *last);
@@ -172,18 +141,6 @@ void salut_contact_change_jid (SalutContact *self, gchar *jid);
void salut_contact_change_capabilities (SalutContact *self,
const gchar *hash, const gchar *node, const gchar *ver);
-#ifdef ENABLE_OLPC
-void salut_contact_change_olpc_color (SalutContact *self,
- const gchar *olpc_color);
-void salut_contact_change_olpc_key (SalutContact *self, GArray *olpc_key);
-void salut_contact_change_ipv4_addr (SalutContact *self,
- const gchar *ipv4_addr);
-void salut_contact_change_ipv6_addr (SalutContact *self,
- const gchar *ipv4_addr);
-void salut_contact_change_current_activity (SalutContact *self,
- const gchar *current_activity_id, const gchar *current_activity_room);
-#endif
-
void salut_contact_avatar_request_flush (SalutContact *self, guint8 *data,
gsize size);
diff --git a/src/debug.c b/src/debug.c
index 365cb7d8..53a7c60e 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -35,7 +35,6 @@ GDebugKey keys[] = {
{ "xmpp-connection-manager", DEBUG_XCM },
{ "si-bytestream-manager", DEBUG_SI_BYTESTREAM_MGR },
{ "discovery", DEBUG_DISCOVERY },
- { "olpc-activity", DEBUG_OLPC_ACTIVITY },
{ "ft", DEBUG_FT },
{ "plugin", DEBUG_PLUGIN },
{ 0, },
diff --git a/src/debug.h b/src/debug.h
index 9e97ed3d..135ec385 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -31,9 +31,8 @@ typedef enum
DEBUG_TUBES = 1 << 16,
DEBUG_XCM = 1 << 17,
DEBUG_DISCOVERY = 1 << 18,
- DEBUG_OLPC_ACTIVITY = 1 << 19,
- DEBUG_FT = 1 << 20,
- DEBUG_PLUGIN = 1 << 21,
+ DEBUG_FT = 1 << 19,
+ DEBUG_PLUGIN = 1 << 20,
} DebugFlags;
void debug_set_flags_from_env (void);
diff --git a/src/discovery-client.c b/src/discovery-client.c
index 7add6fa8..75f48248 100644
--- a/src/discovery-client.c
+++ b/src/discovery-client.c
@@ -65,19 +65,6 @@ salut_discovery_client_create_contact_manager (SalutDiscoveryClient *self,
return virtual_method (self, connection);
}
-#ifdef ENABLE_OLPC
-SalutOlpcActivityManager *
-salut_discovery_client_create_olpc_activity_manager (SalutDiscoveryClient *self,
- SalutConnection *connection)
-{
- SalutOlpcActivityManager * (*virtual_method)(SalutDiscoveryClient *,
- SalutConnection *) =
- SALUT_DISCOVERY_CLIENT_GET_CLASS (self)->create_olpc_activity_manager;
- g_assert (virtual_method != NULL);
- return virtual_method (self, connection);
-}
-#endif
-
SalutSelf *
salut_discovery_client_create_self (SalutDiscoveryClient *self,
SalutConnection *connection,
@@ -86,17 +73,15 @@ salut_discovery_client_create_self (SalutDiscoveryClient *self,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
SalutSelf * (*virtual_method)(SalutDiscoveryClient *, SalutConnection *,
const gchar *, const gchar *, const gchar *, const gchar *,
- const gchar *, const gchar *, const GArray *, const gchar *) =
+ const gchar *, const gchar *) =
SALUT_DISCOVERY_CLIENT_GET_CLASS (self)->create_self;
g_assert (virtual_method != NULL);
return virtual_method (self, connection, nickname, first_name, last_name,
- jid, email, published_name, olpc_key, olpc_color);
+ jid, email, published_name);
}
const gchar *
diff --git a/src/discovery-client.h b/src/discovery-client.h
index e741a275..60bfd63d 100644
--- a/src/discovery-client.h
+++ b/src/discovery-client.h
@@ -26,9 +26,6 @@
#include "contact-manager.h"
#include "roomlist-manager.h"
#include "self.h"
-#ifdef ENABLE_OLPC
-#include "olpc-activity-manager.h"
-#endif
G_BEGIN_DECLS
@@ -55,14 +52,9 @@ struct _SalutDiscoveryClientClass
SalutConnection *connection);
SalutContactManager * (*create_contact_manager) (SalutDiscoveryClient *clt,
SalutConnection *connection);
-#ifdef ENABLE_OLPC
- SalutOlpcActivityManager * (*create_olpc_activity_manager) (
- SalutDiscoveryClient *clt, SalutConnection *connection);
-#endif
SalutSelf * (*create_self) (SalutDiscoveryClient *clt, SalutConnection *conn,
const gchar *nickname, const gchar *first_name, const gchar *last_name,
- const gchar *jid, const gchar *email, const gchar *published_name,
- const GArray *olpc_key, const gchar *olpc_color);
+ const gchar *jid, const gchar *email, const gchar *published_name);
const gchar * (*get_host_name_fqdn) (SalutDiscoveryClient *clt);
};
@@ -93,16 +85,10 @@ SalutRoomlistManager * salut_discovery_client_create_roomlist_manager (
SalutContactManager * salut_discovery_client_create_contact_manager (
SalutDiscoveryClient *clt, SalutConnection *connection);
-#ifdef ENABLE_OLPC
-SalutOlpcActivityManager * salut_discovery_client_create_olpc_activity_manager (
- SalutDiscoveryClient *clt, SalutConnection *connection);
-#endif
-
SalutSelf * salut_discovery_client_create_self (
SalutDiscoveryClient *clt, SalutConnection *connection,
const gchar *nickname, const gchar *first_name, const gchar *last_name,
- const gchar *jid, const gchar *email, const gchar *published_name,
- const GArray *olpc_key, const gchar *olpc_color);
+ const gchar *jid, const gchar *email, const gchar *published_name);
const gchar * salut_discovery_client_get_host_name_fqdn (
SalutDiscoveryClient *clt);
diff --git a/src/dummy-discovery-client.c b/src/dummy-discovery-client.c
index 5399f260..d7d279e2 100644
--- a/src/dummy-discovery-client.c
+++ b/src/dummy-discovery-client.c
@@ -112,9 +112,7 @@ salut_dummy_discovery_client_create_self (SalutDiscoveryClient *client,
const gchar *last_name,
const gchar *jid,
const gchar *email,
- const gchar *published_name,
- const GArray *olpc_key,
- const gchar *olpc_color)
+ const gchar *published_name)
{
return NULL;
}
@@ -128,8 +126,5 @@ discovery_client_init (gpointer g_iface,
klass->start = NULL;
klass->create_muc_manager = NULL;
klass->create_contact_manager = NULL;
-#ifdef ENABLE_OLPC
- klass->create_olpc_activity_manager = NULL;
-#endif
klass->create_self = salut_dummy_discovery_client_create_self;
}
diff --git a/src/muc-channel.c b/src/muc-channel.c
index 73d7bf96..c0eb63e6 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -405,12 +405,6 @@ create_invitation (SalutMucChannel *self,
priv->muc_connection),
invitation_append_parameter, invite_node);
-#ifdef ENABLE_OLPC
- salut_self_olpc_augment_invitation (priv->self,
- tp_base_channel_get_target_handle (base_chan), contact->handle,
- invite_node);
-#endif
-
return msg;
}
@@ -1289,14 +1283,6 @@ salut_muc_channel_received_stanza (GibberMucConnection *conn,
/* let's not autoclose now */
priv->autoclose = FALSE;
-#ifdef ENABLE_OLPC
- if (salut_connection_olpc_observe_muc_stanza (
- SALUT_CONNECTION (base_connection),
- tp_base_channel_get_target_handle (base_chan),
- from_handle, stanza))
- return;
-#endif
-
tubes_node = wocky_node_get_child_ns (node, "tubes",
WOCKY_TELEPATHY_NS_TUBES);
if (tubes_node != NULL)
diff --git a/src/muc-manager.c b/src/muc-manager.c
index cdeccdd3..db4978e1 100644
--- a/src/muc-manager.c
+++ b/src/muc-manager.c
@@ -1108,11 +1108,6 @@ invite_stanza_callback (WockyPorter *porter,
/* FIXME handle properly */
g_assert (chan != NULL);
-#ifdef ENABLE_OLPC
- salut_connection_olpc_observe_invitation (priv->connection, room_handle,
- inviter_handle, invite);
-#endif
-
salut_muc_channel_invited (chan, inviter_handle, reason, NULL);
return TRUE;
diff --git a/src/namespaces.h b/src/namespaces.h
index dd634185..fdc1bdd4 100644
--- a/src/namespaces.h
+++ b/src/namespaces.h
@@ -86,12 +86,6 @@
#define NS_MUC_OWNER "http://jabber.org/protocol/muc#owner"
#define NS_NICK "http://jabber.org/protocol/nick"
#define NS_OOB "jabber:iq:oob"
-#define NS_OLPC_BUDDY_PROPS "http://laptop.org/xmpp/buddy-properties"
-#define NS_OLPC_ACTIVITIES "http://laptop.org/xmpp/activities"
-#define NS_OLPC_CURRENT_ACTIVITY "http://laptop.org/xmpp/current-activity"
-#define NS_OLPC_ACTIVITY_PROPS "http://laptop.org/xmpp/activity-properties"
-#define NS_OLPC_BUDDY "http://laptop.org/xmpp/buddy"
-#define NS_OLPC_ACTIVITY "http://laptop.org/xmpp/activity"
#define NS_PUBSUB "http://jabber.org/protocol/pubsub"
#define NS_PRESENCE_INVISIBLE "presence-invisible"
#define NS_PRIVACY "jabber:iq:privacy"
@@ -115,8 +109,6 @@
#define NS_TEMPPRES "urn:xmpp:temppres:0"
#define NS_GOOGLE_SHARED_STATUS "google:shared-status"
-#define NS_OLPC_ACTIVITY_PROPS "http://laptop.org/xmpp/activity-properties"
-
#define NS_TP_FT_METADATA_SERVICE "http://telepathy.freedesktop.org/xmpp/file-transfer-service"
#define NS_TP_FT_METADATA "http://telepathy.freedesktop.org/xmpp/file-transfer-metadata"
diff --git a/src/olpc-activity-manager.c b/src/olpc-activity-manager.c
deleted file mode 100644
index 459d4c92..00000000
--- a/src/olpc-activity-manager.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * olpc-activity-manager.c - Source for SalutOlpcActivityManager
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "olpc-activity-manager.h"
-
-#include <dbus/dbus-glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "connection.h"
-
-#define DEBUG_FLAG DEBUG_OLPC_ACTIVITY
-#include "debug.h"
-
-G_DEFINE_TYPE (SalutOlpcActivityManager, salut_olpc_activity_manager,
- G_TYPE_OBJECT);
-
-/* properties */
-enum {
- PROP_CONNECTION = 1,
- LAST_PROP
-};
-
-/* signal enum */
-enum
-{
- ACTIVITY_MODIFIED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = {0};
-
-/* private structure */
-typedef struct _SalutOlpcActivityManagerPrivate SalutOlpcActivityManagerPrivate;
-
-struct _SalutOlpcActivityManagerPrivate
-{
- /* TpHandle (owned by the activity) => SalutOlpcActivity */
- GHashTable *activities_by_room;
-
- gboolean dispose_has_run;
-};
-
-#define SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SALUT_TYPE_OLPC_ACTIVITY_MANAGER, SalutOlpcActivityManagerPrivate))
-
-static void
-salut_olpc_activity_manager_init (SalutOlpcActivityManager *self)
-{
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
- /* We just keep a weak reference on the activity object so we'll remove
- * it from the hash when no one is using anymore */
- priv->activities_by_room = g_hash_table_new_full (g_direct_hash,
- g_direct_equal, NULL, NULL);
-}
-
-static void
-salut_olpc_activity_manager_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (object);
-
- switch (property_id)
- {
- case PROP_CONNECTION:
- g_value_set_object (value, self->connection);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-salut_olpc_activity_manager_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (object);
-
- switch (property_id)
- {
- case PROP_CONNECTION:
- self->connection = g_value_get_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void salut_olpc_activity_manager_dispose (GObject *object);
-static void salut_olpc_activity_manager_finalize (GObject *object);
-
-static void
-salut_olpc_activity_manager_class_init (SalutOlpcActivityManagerClass *salut_olpc_activity_manager_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (salut_olpc_activity_manager_class);
- GParamSpec *param_spec;
-
- g_type_class_add_private (salut_olpc_activity_manager_class,
- sizeof (SalutOlpcActivityManagerPrivate));
-
- object_class->get_property = salut_olpc_activity_manager_get_property;
- object_class->set_property = salut_olpc_activity_manager_set_property;
-
- object_class->dispose = salut_olpc_activity_manager_dispose;
- object_class->finalize = salut_olpc_activity_manager_finalize;
-
- param_spec = g_param_spec_object (
- "connection",
- "SalutConnection object",
- "The Salut Connection associated with this muc manager",
- SALUT_TYPE_CONNECTION,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_CONNECTION,
- param_spec);
-
- signals[ACTIVITY_MODIFIED] = g_signal_new ("activity-modified",
- G_OBJECT_CLASS_TYPE (salut_olpc_activity_manager_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1, SALUT_TYPE_OLPC_ACTIVITY);
-}
-
-static gboolean
-remove_activity_foreach (gpointer room,
- gpointer act,
- gpointer activity)
-{
- return act == activity;
-}
-
-static void
-activity_finalized_cb (gpointer data,
- GObject *activity)
-{
- SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (data);
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- g_hash_table_foreach_remove (priv->activities_by_room,
- remove_activity_foreach, activity);
-}
-
-static gboolean
-dispose_activity_foreach (gpointer room,
- gpointer activity,
- gpointer user_data)
-{
- SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (user_data);
-
- g_object_weak_unref (G_OBJECT (activity), activity_finalized_cb, self);
- g_signal_handlers_disconnect_matched (activity, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, self);
-
- return TRUE;
-}
-
-static void
-salut_olpc_activity_manager_dispose (GObject *object)
-{
- SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (object);
- SalutOlpcActivityManagerPrivate *priv = SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- if (priv->activities_by_room != NULL)
- {
- g_hash_table_foreach_remove (priv->activities_by_room,
- dispose_activity_foreach, self);
- g_hash_table_unref (priv->activities_by_room);
- priv->activities_by_room = NULL;
- }
-
- if (G_OBJECT_CLASS (salut_olpc_activity_manager_parent_class)->dispose)
- G_OBJECT_CLASS (salut_olpc_activity_manager_parent_class)->dispose (object);
-}
-
-static void
-salut_olpc_activity_manager_finalize (GObject *object)
-{
- //SalutOlpcActivityManager *self = SALUT_OLPC_ACTIVITY_MANAGER (object);
-
- G_OBJECT_CLASS (salut_olpc_activity_manager_parent_class)->finalize (object);
-}
-
-gboolean
-salut_olpc_activity_manager_start (SalutOlpcActivityManager *self,
- GError **error)
-{
- return SALUT_OLPC_ACTIVITY_MANAGER_GET_CLASS (self)->start (self, error);
-}
-
-SalutOlpcActivity *
-salut_olpc_activity_manager_get_activity_by_room (SalutOlpcActivityManager *self,
- TpHandle room)
-{
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
- return g_hash_table_lookup (priv->activities_by_room,
- GUINT_TO_POINTER (room));
-}
-
-SalutOlpcActivity *
-salut_olpc_activity_manager_get_activity_by_id (SalutOlpcActivityManager *self,
- const gchar *activity_id)
-{
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init (&iter, priv->activities_by_room);
- while (g_hash_table_iter_next (&iter, &key, &value))
- {
- SalutOlpcActivity *activity = value;
- if (strcmp (activity->id, activity_id) == 0)
- return activity;
- }
-
- return NULL;
-}
-
-SalutOlpcActivity *
-salut_olpc_activity_manager_ensure_activity_by_room (
- SalutOlpcActivityManager *self,
- TpHandle room)
-{
- SalutOlpcActivity *activity;
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- activity = g_hash_table_lookup (priv->activities_by_room,
- GUINT_TO_POINTER (room));
-
- if (activity != NULL)
- {
- return g_object_ref (activity);
- }
- else
- {
- activity = salut_olpc_activity_manager_create_activity (self, room);
- return activity;
- }
-}
-
-static void
-activity_modified_cb (SalutOlpcActivity *activity,
- SalutOlpcActivityManager *self)
-{
- g_signal_emit (self, signals[ACTIVITY_MODIFIED], 0, activity);
-}
-
-SalutOlpcActivity *
-salut_olpc_activity_manager_create_activity (SalutOlpcActivityManager *self,
- TpHandle room)
-{
- SalutOlpcActivity *activity;
- SalutOlpcActivityManagerPrivate *priv =
- SALUT_OLPC_ACTIVITY_MANAGER_GET_PRIVATE (self);
-
- g_assert (room != 0);
- g_assert (g_hash_table_lookup (priv->activities_by_room, GUINT_TO_POINTER (
- room)) == NULL);
-
- activity = SALUT_OLPC_ACTIVITY_MANAGER_GET_CLASS (self)->create_activity (
- self);
- salut_olpc_activity_update (activity, room, NULL, NULL, NULL, NULL, NULL,
- TRUE);
-
- g_hash_table_insert (priv->activities_by_room, GUINT_TO_POINTER (room),
- activity);
-
- g_signal_connect (activity, "modified", G_CALLBACK (activity_modified_cb),
- self);
- g_object_weak_ref (G_OBJECT (activity), activity_finalized_cb , self);
-
- return activity;
-}
-
-SalutOlpcActivity *
-salut_olpc_activity_manager_got_invitation (SalutOlpcActivityManager *self,
- TpHandle room,
- SalutContact *inviter,
- const gchar *id,
- const gchar *name,
- const gchar *type,
- const gchar *color,
- const gchar *tags)
-{
- SalutOlpcActivity *activity;
-
- activity = salut_olpc_activity_manager_ensure_activity_by_room (self, room);
-
- salut_olpc_activity_update (activity, room, id, name, type, color, tags,
- activity->is_private);
-
- /* FIXME: we shouldn't add it if the local user is already in the activity
- * as, for now, we don't manage private activity membership (it's PS job) */
-
- /* add the inviter to the activity */
- salut_contact_joined_activity (inviter, activity);
-
- /* contact reffed the activity if it didn't hold a ref on it yet */
- g_object_unref (activity);
-
- return activity;
-}
-
-void
-salut_olpc_activity_manager_contact_joined (SalutOlpcActivityManager *self,
- SalutContact *contact,
- SalutOlpcActivity *activity)
-{
- salut_contact_joined_activity (contact, activity);
-}
-
-void
-salut_olpc_activity_manager_contact_left (SalutOlpcActivityManager *mgr,
- SalutContact *contact,
- SalutOlpcActivity *activity)
-{
- salut_contact_left_activity (contact, activity);
-}
diff --git a/src/olpc-activity-manager.h b/src/olpc-activity-manager.h
deleted file mode 100644
index 1814d1cf..00000000
--- a/src/olpc-activity-manager.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * olpc-activity-managere.h - Header for SalutOlpcActivityManager
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SALUT_OLPC_ACTIVITY_MANAGER_H__
-#define __SALUT_OLPC_ACTIVITY_MANAGER_H__
-
-#include <glib-object.h>
-
-#include <telepathy-glib/telepathy-glib.h>
-
-#include "connection.h"
-#include "contact.h"
-#include "olpc-activity.h"
-
-G_BEGIN_DECLS
-
-typedef struct _SalutOlpcActivityManager SalutOlpcActivityManager;
-typedef struct _SalutOlpcActivityManagerClass SalutOlpcActivityManagerClass;
-
-struct _SalutOlpcActivityManagerClass {
- GObjectClass parent_class;
-
- /* public abstract methods */
- gboolean (*start) (SalutOlpcActivityManager *self, GError **error);
-
- /* private abstract methods */
- SalutOlpcActivity * (*create_activity) (SalutOlpcActivityManager *self);
-};
-
-struct _SalutOlpcActivityManager {
- GObject parent;
-
- /* private */
- SalutConnection *connection;
-};
-
-GType salut_olpc_activity_manager_get_type (void);
-
-/* TYPE MACROS */
-#define SALUT_TYPE_OLPC_ACTIVITY_MANAGER \
- (salut_olpc_activity_manager_get_type ())
-#define SALUT_OLPC_ACTIVITY_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), SALUT_TYPE_OLPC_ACTIVITY_MANAGER, SalutOlpcActivityManager))
-#define SALUT_OLPC_ACTIVITY_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), SALUT_TYPE_OLPC_ACTIVITY_MANAGER, SalutOlpcActivityManagerClass))
-#define SALUT_IS_OLPC_ACTIVITY_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), SALUT_TYPE_OLPC_ACTIVITY_MANAGER))
-#define SALUT_IS_OLPC_ACTIVITY_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), SALUT_TYPE_OLPC_ACTIVITY_MANAGER))
-#define SALUT_OLPC_ACTIVITY_MANAGER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), SALUT_TYPE_OLPC_ACTIVITY_MANAGER, SalutOlpcActivityManagerClass))
-
-gboolean salut_olpc_activity_manager_start (SalutOlpcActivityManager *mgr,
- GError **error);
-
-SalutOlpcActivity * salut_olpc_activity_manager_get_activity_by_room (
- SalutOlpcActivityManager *mgr, TpHandle room);
-
-SalutOlpcActivity * salut_olpc_activity_manager_get_activity_by_id (
- SalutOlpcActivityManager *mgr, const gchar *activity_id);
-
-SalutOlpcActivity * salut_olpc_activity_manager_ensure_activity_by_room (
- SalutOlpcActivityManager *mgr, TpHandle room);
-
-SalutOlpcActivity * salut_olpc_activity_manager_got_invitation (
- SalutOlpcActivityManager *mgr, TpHandle room, SalutContact *inviter,
- const gchar *id, const gchar *name, const gchar *type, const gchar *color,
- const gchar *tags);
-
-/* restricted methods */
-SalutOlpcActivity * salut_olpc_activity_manager_create_activity (
- SalutOlpcActivityManager *mgr, TpHandle room);
-
-void salut_olpc_activity_manager_contact_joined (SalutOlpcActivityManager *mgr,
- SalutContact *contact, SalutOlpcActivity *activity);
-
-void salut_olpc_activity_manager_contact_left (SalutOlpcActivityManager *mgr,
- SalutContact *contact, SalutOlpcActivity *activity);
-
-G_END_DECLS
-
-#endif /* #ifndef __SALUT_OLPC_ACTIVITY_MANAGER_H__*/
diff --git a/src/olpc-activity.c b/src/olpc-activity.c
deleted file mode 100644
index b834d56f..00000000
--- a/src/olpc-activity.c
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- * olpc-activity.c - Source for SalutOlpcActivity
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "olpc-activity.h"
-
-#include <dbus/dbus-glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <wocky/wocky.h>
-
-#include "contact-manager.h"
-#include "muc-manager.h"
-#include "util.h"
-#include "namespaces.h"
-
-#define DEBUG_FLAG DEBUG_OLPC_ACTIVITY
-#include "debug.h"
-
-G_DEFINE_TYPE (SalutOlpcActivity, salut_olpc_activity, G_TYPE_OBJECT);
-
-/* properties */
-enum {
- PROP_CONNECTION = 1,
- LAST_PROP
-};
-
-/* signal enum */
-enum
-{
- MODIFIED,
- VALID,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = {0};
-
-/* private structure */
-typedef struct _SalutOlpcActivityPrivate SalutOlpcActivityPrivate;
-
-struct _SalutOlpcActivityPrivate
-{
- /* Handles of contacts we invited to join this activity */
- TpHandleSet *invited;
- /* can be NULL if we are not in the activity */
- SalutMucChannel *muc;
-
- gboolean dispose_has_run;
-};
-
-#define SALUT_OLPC_ACTIVITY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SALUT_TYPE_OLPC_ACTIVITY, SalutOlpcActivityPrivate))
-
-static void
-salut_olpc_activity_init (SalutOlpcActivity *self)
-{
- self->connection = NULL;
-
- self->is_private = TRUE;
-}
-
-static void
-salut_olpc_activity_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- SalutOlpcActivity *self = SALUT_OLPC_ACTIVITY (object);
-
- switch (property_id)
- {
- case PROP_CONNECTION:
- g_value_set_object (value, self->connection);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-salut_olpc_activity_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- SalutOlpcActivity *self = SALUT_OLPC_ACTIVITY (object);
-
- switch (property_id)
- {
- case PROP_CONNECTION:
- self->connection = g_value_get_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static GObject *
-salut_olpc_activity_constructor (GType type,
- guint n_props,
- GObjectConstructParam *props)
-{
- GObject *obj;
- SalutOlpcActivity *self;
- SalutOlpcActivityPrivate *priv;
- TpHandleRepoIface *contact_repo;
-
- obj = G_OBJECT_CLASS (salut_olpc_activity_parent_class)->
- constructor (type, n_props, props);
-
- self = SALUT_OLPC_ACTIVITY (obj);
- priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- g_assert (self->connection != NULL);
- contact_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT);
-
- priv->invited = tp_handle_set_new (contact_repo);
-
- return obj;
-}
-
-static void salut_olpc_activity_dispose (GObject *object);
-static void salut_olpc_activity_finalize (GObject *object);
-
-static void
-salut_olpc_activity_class_init (SalutOlpcActivityClass *salut_olpc_activity_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (salut_olpc_activity_class);
- GParamSpec *param_spec;
-
- g_type_class_add_private (salut_olpc_activity_class,
- sizeof (SalutOlpcActivityPrivate));
-
- object_class->get_property = salut_olpc_activity_get_property;
- object_class->set_property = salut_olpc_activity_set_property;
-
- object_class->constructor = salut_olpc_activity_constructor;
- object_class->dispose = salut_olpc_activity_dispose;
- object_class->finalize = salut_olpc_activity_finalize;
-
- param_spec = g_param_spec_object (
- "connection",
- "SalutConnection object",
- "The Salut Connection associated with this muc manager",
- SALUT_TYPE_CONNECTION,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_CONNECTION,
- param_spec);
-
- signals[MODIFIED] = g_signal_new ("modified",
- G_OBJECT_CLASS_TYPE (salut_olpc_activity_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- signals[VALID] = g_signal_new ("valid",
- G_OBJECT_CLASS_TYPE (salut_olpc_activity_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-}
-
-static void
-salut_olpc_activity_dispose (GObject *object)
-{
- SalutOlpcActivity *self = SALUT_OLPC_ACTIVITY (object);
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- if (priv->muc != NULL)
- {
- g_signal_handlers_disconnect_matched (priv->muc, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, self);
- g_object_unref (priv->muc);
- priv->muc = NULL;
- }
-
- tp_handle_set_destroy (priv->invited);
-
- if (G_OBJECT_CLASS (salut_olpc_activity_parent_class)->dispose)
- G_OBJECT_CLASS (salut_olpc_activity_parent_class)->dispose (object);
-}
-
-static void
-salut_olpc_activity_finalize (GObject *object)
-{
- SalutOlpcActivity *self = SALUT_OLPC_ACTIVITY (object);
-
- g_free (self->id);
- g_free (self->name);
- g_free (self->type);
- g_free (self->color);
- g_free (self->tags);
-
- G_OBJECT_CLASS (salut_olpc_activity_parent_class)->finalize (object);
-}
-
-GHashTable *
-salut_olpc_activity_create_properties_table (SalutOlpcActivity *self)
-{
- GHashTable *properties;
- GValue *val;
-
- properties = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) tp_g_value_slice_free);
-
- if (self->color != NULL)
- {
- val = tp_g_value_slice_new (G_TYPE_STRING);
- g_value_set_static_string (val, self->color);
- g_hash_table_insert (properties, "color", val);
- }
-
- if (self->name != NULL)
- {
- val = tp_g_value_slice_new (G_TYPE_STRING);
- g_value_set_static_string (val, self->name);
- g_hash_table_insert (properties, "name", val);
- }
-
- if (self->type != NULL)
- {
- val = tp_g_value_slice_new (G_TYPE_STRING);
- g_value_set_static_string (val, self->type);
- g_hash_table_insert (properties, "type", val);
- }
-
- if (self->tags != NULL)
- {
- val = tp_g_value_slice_new (G_TYPE_STRING);
- g_value_set_static_string (val, self->tags);
- g_hash_table_insert (properties, "tags", val);
- }
-
- val = tp_g_value_slice_new (G_TYPE_BOOLEAN);
- g_value_set_boolean (val, self->is_private);
- g_hash_table_insert (properties, "private", val);
-
- return properties;
-}
-
-static gboolean
-send_properties_change_msg (SalutOlpcActivity *self,
- GError **error)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- GHashTable *properties;
- GValue *activity_id_val;
- WockyStanza *stanza;
- WockyNode *top_node;
- WockyNode *properties_node;
- gchar *muc_name;
- GibberMucConnection *muc_connection;
- gboolean result;
- GError *err = NULL;
-
- if (priv->muc == NULL)
- /* we are not in the muc */
- return TRUE;
-
- g_object_get (priv->muc,
- "name", &muc_name,
- "muc-connection", &muc_connection,
- NULL);
-
- if (muc_connection->state != GIBBER_MUC_CONNECTION_CONNECTED)
- {
- DEBUG ("Muc connection not connected yet. Drop activity change message");
- g_object_unref (muc_connection);
- g_free (muc_name);
- return TRUE;
- }
-
- properties = salut_olpc_activity_create_properties_table (self);
-
- /* add the activity id */
- activity_id_val = g_slice_new0 (GValue);
- g_value_init (activity_id_val, G_TYPE_STRING);
- g_value_set_static_string (activity_id_val, self->id);
- g_hash_table_insert (properties, "id", activity_id_val);
-
- stanza = wocky_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
- WOCKY_STANZA_SUB_TYPE_GROUPCHAT,
- self->connection->name, muc_name,
- WOCKY_NODE_START, "properties",
- WOCKY_NODE_XMLNS, NS_OLPC_ACTIVITY_PROPS,
- WOCKY_NODE_END, NULL);
- top_node = wocky_stanza_get_top_node (stanza);
-
- properties_node = wocky_node_get_child_ns (top_node, "properties",
- NS_OLPC_ACTIVITY_PROPS);
-
- salut_wocky_node_add_children_from_properties (properties_node,
- properties, "property");
-
- result = gibber_muc_connection_send (muc_connection, stanza, &err);
- if (!result)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, "%s",
- err->message);
- g_error_free (err);
- }
-
- g_object_unref (stanza);
- g_object_unref (muc_connection);
- g_free (muc_name);
- g_hash_table_unref (properties);
-
- return result;
-}
-
-static void
-resend_invite_foreach (TpHandleSet *set,
- TpHandle handle,
- SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- GError *error = NULL;
-
- if (!salut_muc_channel_send_invitation (priv->muc, handle,
- "OLPC activity properties update", &error))
- {
- DEBUG ("failed to re-invite contact %d to activity %s", handle,
- self->id);
- }
-}
-
-static void
-resend_invite (SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- if (priv->muc == NULL)
- /* we are not in the muc */
- return;
-
- /* Resend pending invitations so contacts will know about new properties */
- tp_handle_set_foreach (priv->invited,
- (TpHandleSetMemberFunc) resend_invite_foreach, self);
-}
-
-static void
-activity_changed (SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- GError *error = NULL;
-
- if (!send_properties_change_msg (self, &error))
- {
- DEBUG ("send properties changes msg failed: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
-
- if (!self->is_private && priv->muc != NULL)
- {
- /* update announcement */
- if (!SALUT_OLPC_ACTIVITY_GET_CLASS (self)->update (self, &error))
- {
- DEBUG ("update activity failed: %s", error->message);
- g_error_free (error);
- }
- }
- else
- {
- resend_invite (self);
- }
-}
-
-static gboolean
-salut_olpc_activity_announce (SalutOlpcActivity *self,
- GError **error)
-{
- GError *err = NULL;
-
- if (!SALUT_OLPC_ACTIVITY_GET_CLASS (self)->announce (self, &err))
- {
- g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, "%s",
- err->message);
- g_error_free (err);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-salut_olpc_activity_stop_announce (SalutOlpcActivity *self)
-{
- SALUT_OLPC_ACTIVITY_GET_CLASS (self)->stop_announce (self);
-}
-
-gboolean
-salut_olpc_activity_update (SalutOlpcActivity *self,
- TpHandle room,
- const gchar *id,
- const gchar *name,
- const gchar *type,
- const gchar *color,
- const gchar *tags,
- gboolean is_private)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- gboolean changed = FALSE;
- GError *error = NULL;
- gboolean become_valid = FALSE;
-
- if (room != 0 && room != self->room)
- {
- self->room = room;
- }
-
- if (id != NULL && tp_strdiff (id, self->id))
- {
- if (self->id == NULL)
- become_valid = TRUE;
-
- g_free (self->id);
- self->id = g_strdup (id);
- changed = TRUE;
- }
-
- if (name != NULL && tp_strdiff (name, self->name))
- {
- g_free (self->name);
- self->name = g_strdup (name);
- changed = TRUE;
- }
-
- if (type != NULL && tp_strdiff (type, self->type))
- {
- g_free (self->type);
- self->type = g_strdup (type);
- changed = TRUE;
- }
-
- if (color != NULL && tp_strdiff (color, self->color))
- {
- g_free (self->color);
- self->color = g_strdup (color);
- changed = TRUE;
- }
-
- if (tp_strdiff (tags, self->tags))
- {
- g_free (self->tags);
- self->tags = g_strdup (tags);
- changed = TRUE;
- }
-
- if (is_private != self->is_private)
- {
- self->is_private = is_private;
- changed = TRUE;
-
- if (priv->muc != NULL)
- {
- if (is_private)
- {
- DEBUG ("activity is not public anymore. Stop to announce it");
- salut_olpc_activity_stop_announce (self);
- }
- else
- {
- DEBUG ("activity becomes public. Announce it");
- if (!salut_olpc_activity_announce (self, &error))
- {
- DEBUG ("activity announce failed: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
- }
- }
- }
-
- if (become_valid)
- {
- g_signal_emit (self, signals[VALID], 0);
- }
-
- if (changed)
- {
- activity_changed (self);
-
- g_signal_emit (self, signals[MODIFIED], 0);
- }
-
- return changed;
-}
-
-static void
-muc_channel_closed_cb (SalutMucChannel *chan,
- SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- g_object_unref (priv->muc);
- priv->muc = NULL;
-}
-
-gboolean
-salut_olpc_activity_joined (SalutOlpcActivity *self,
- GError **error)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- TpHandleRepoIface *room_repo;
- SalutMucManager *muc_manager;
-
- if (priv->muc != NULL)
- return TRUE;
-
- room_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_ROOM);
-
- g_object_get (self->connection,
- "muc-manager", &muc_manager,
- NULL);
-
- priv->muc = salut_muc_manager_get_text_channel (muc_manager, self->room);
- g_object_unref (muc_manager);
-
- if (priv->muc == NULL)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Can't find muc channel for room %s", tp_handle_inspect (
- room_repo, self->room));
- return FALSE;
- }
-
- if (!self->is_private)
- {
- /* This might fail but that doesn't prevent us from joining the
- * activity.. */
- salut_olpc_activity_announce (self, NULL);
- }
-
- g_signal_connect (priv->muc, "closed", G_CALLBACK (muc_channel_closed_cb),
- self);
-
- return TRUE;
-}
-
-void
-salut_olpc_activity_left (SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- if (priv->muc == NULL)
- return;
-
- if (!self->is_private)
- salut_olpc_activity_stop_announce (self);
-
- g_object_unref (priv->muc);
- g_signal_handlers_disconnect_matched (priv->muc, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, self);
- priv->muc = NULL;
-}
-
-void
-salut_olpc_activity_revoke_invitations (SalutOlpcActivity *self)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- WockyStanza *msg;
- TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT);
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
- (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT);
- TpIntsetFastIter iter;
- guint contact_handle;
- SalutContactManager *contact_mgr;
- WockyNode *top_node;
-
- if (tp_handle_set_size (priv->invited) <= 0)
- return;
-
- msg = wocky_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
- WOCKY_STANZA_SUB_TYPE_NONE,
- self->connection->name, NULL,
- WOCKY_NODE_START, "uninvite",
- WOCKY_NODE_XMLNS, NS_OLPC_ACTIVITY_PROPS,
- WOCKY_NODE_ATTRIBUTE, "room", tp_handle_inspect (room_repo,
- self->room),
- WOCKY_NODE_ATTRIBUTE, "id", self->id,
- WOCKY_NODE_END, NULL);
- top_node = wocky_stanza_get_top_node (msg);
-
- g_object_get (self->connection,
- "contact-manager", &contact_mgr,
- NULL);
- g_assert (contact_mgr != NULL);
-
- tp_intset_fast_iter_init (&iter, tp_handle_set_peek (priv->invited));
-
- DEBUG ("revoke invitations for activity %s", self->id);
- while (tp_intset_fast_iter_next (&iter, &contact_handle))
- {
- SalutContact *contact;
- const gchar *to;
-
- contact = salut_contact_manager_get_contact (contact_mgr, contact_handle);
- if (contact == NULL)
- {
- DEBUG ("Can't find contact %d", contact_handle);
- continue;
- }
-
- to = tp_handle_inspect (contact_repo, contact_handle);
- wocky_node_set_attribute (top_node, "to", to);
-
- wocky_stanza_set_to_contact (msg, WOCKY_CONTACT (contact));
- wocky_porter_send (self->connection->porter, msg);
-
- g_object_unref (contact);
- }
-
- g_object_unref (msg);
- g_object_unref (contact_mgr);
-}
-
-void
-salut_olpc_activity_augment_invitation (SalutOlpcActivity *self,
- TpHandle contact,
- WockyNode *invite_node)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
- WockyNode *properties_node;
- GHashTable *properties;
- GValue *activity_id_val;
-
- properties = salut_olpc_activity_create_properties_table (self);
-
- properties_node = wocky_node_add_child_ns (invite_node, "properties",
- NS_OLPC_ACTIVITY_PROPS);
-
- /* add the activity id */
- activity_id_val = g_slice_new0 (GValue);
- g_value_init (activity_id_val, G_TYPE_STRING);
- g_value_set_static_string (activity_id_val, self->id);
- g_hash_table_insert (properties, "id", activity_id_val);
-
- salut_wocky_node_add_children_from_properties (properties_node,
- properties, "property");
-
- tp_handle_set_add (priv->invited, contact);
-
- g_hash_table_unref (properties);
-}
-
-gboolean
-salut_olpc_activity_remove_invited (SalutOlpcActivity *self,
- TpHandle contact)
-{
- SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
-
- return tp_handle_set_remove (priv->invited, contact);
-}
diff --git a/src/olpc-activity.h b/src/olpc-activity.h
deleted file mode 100644
index 25e231af..00000000
--- a/src/olpc-activity.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * olpc-activity.h - Header for SalutOlpcActivity
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library 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.
- *
- * This library 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 this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __SALUT_OLPC_ACTIVITY_H__
-#define __SALUT_OLPC_ACTIVITY_H__
-
-#include <glib-object.h>
-
-#include <telepathy-glib/telepathy-glib.h>
-
-#include "connection.h"
-
-G_BEGIN_DECLS
-
-typedef struct _SalutOlpcActivity SalutOlpcActivity;
-typedef struct _SalutOlpcActivityClass SalutOlpcActivityClass;
-
-struct _SalutOlpcActivityClass {
- GObjectClass parent_class;
-
- /* private abstract methods */
- gboolean (*announce) (SalutOlpcActivity *activity, GError **error);
- void (*stop_announce) (SalutOlpcActivity *activity);
-
- gboolean (*update) (SalutOlpcActivity *activity, GError **error);
-};
-
-struct _SalutOlpcActivity {
- GObject parent;
-
- TpHandle room;
- gchar *id;
- gchar *name;
- gchar *type;
- gchar *color;
- gchar *tags;
- gboolean is_private;
-
- /* private */
- SalutConnection *connection;
-};
-
-GType salut_olpc_activity_get_type (void);
-
-/* TYPE MACROS */
-#define SALUT_TYPE_OLPC_ACTIVITY \
- (salut_olpc_activity_get_type ())
-#define SALUT_OLPC_ACTIVITY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), SALUT_TYPE_OLPC_ACTIVITY, SalutOlpcActivity))
-#define SALUT_OLPC_ACTIVITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), SALUT_TYPE_OLPC_ACTIVITY, SalutOlpcActivityClass))
-#define SALUT_IS_OLPC_ACTIVITY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), SALUT_TYPE_OLPC_ACTIVITY))
-#define SALUT_IS_OLPC_ACTIVITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), SALUT_TYPE_OLPC_ACTIVITY))
-#define SALUT_OLPC_ACTIVITY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), SALUT_TYPE_OLPC_ACTIVITY, SalutOlpcActivityClass))
-
-G_END_DECLS
-
-gboolean salut_olpc_activity_update (SalutOlpcActivity *activity,
- TpHandle room, const gchar *id, const gchar *name,
- const gchar *type, const gchar *color, const gchar *tags,
- gboolean is_private);
-
-gboolean salut_olpc_activity_joined (SalutOlpcActivity *activity,
- GError **error);
-
-void salut_olpc_activity_left (SalutOlpcActivity *activity);
-
-void salut_olpc_activity_revoke_invitations (SalutOlpcActivity *activity);
-
-GHashTable * salut_olpc_activity_create_properties_table (
- SalutOlpcActivity *activity);
-
-void salut_olpc_activity_augment_invitation (SalutOlpcActivity *activity,
- TpHandle contact, WockyNode *invite_node);
-
-gboolean salut_olpc_activity_remove_invited (SalutOlpcActivity *activity,
- TpHandle contact);
-
-#endif /* #ifndef __SALUT_OLPC_ACTIVITY_H__*/
diff --git a/src/presence.h b/src/presence.h
index 993fdf8a..466af9b4 100644
--- a/src/presence.h
+++ b/src/presence.h
@@ -27,7 +27,6 @@
G_BEGIN_DECLS
#define SALUT_DNSSD_CLIQUE "_clique._udp"
-#define SALUT_DNSSD_OLPC_ACTIVITY "_olpc-activity1._udp"
#define SALUT_DNSSD_PRESENCE "_presence._tcp"
/* private structure */
diff --git a/src/self.c b/src/self.c
index aeafa9bf..775d4cc5 100644
--- a/src/self.c
+++ b/src/self.c
@@ -44,11 +44,6 @@
#include "util.h"
#include "muc-manager.h"
-#ifdef ENABLE_OLPC
-#include "olpc-activity.h"
-#include "olpc-activity-manager.h"
-#endif
-
#define DEBUG_FLAG DEBUG_SELF
#include <debug.h>
@@ -69,10 +64,6 @@ enum
PROP_JID,
PROP_EMAIL,
PROP_PUBLISHED_NAME,
-#ifdef ENABLE_OLPC
- PROP_OLPC_KEY,
- PROP_OLPC_COLOR
-#endif
};
/* signal enum */
@@ -91,30 +82,16 @@ struct _SalutSelfPrivate
{
SalutContactManager *contact_manager;
TpHandleRepoIface *room_repo;
-#ifdef ENABLE_OLPC
- SalutOlpcActivityManager *olpc_activity_manager;
-#endif
GIOChannel *listener;
guint io_watch_in;
-#ifdef ENABLE_OLPC
- /* room handle owned by the SalutOlpcActivity -> SalutOlpcActivity */
- GHashTable *olpc_activities;
-#endif
-
GabbleCapabilitySet *caps;
GPtrArray *data_forms;
gboolean dispose_has_run;
};
-#ifdef ENABLE_OLPC
-void
-contact_manager_contact_change_cb (SalutContactManager *mgr,
- SalutContact *contact, int changes, gpointer user_data);
-#endif
-
static void
salut_self_init (SalutSelf *obj)
{
@@ -127,22 +104,12 @@ salut_self_init (SalutSelf *obj)
obj->status = SALUT_PRESENCE_AVAILABLE;
obj->status_message = NULL;
obj->jid = NULL;
-#ifdef ENABLE_OLPC
- obj->olpc_key = NULL;
- obj->olpc_color = NULL;
- obj->olpc_cur_act = NULL;
- obj->olpc_cur_act_room = 0;
-#endif
obj->first_name = NULL;
obj->last_name = NULL;
obj->email = NULL;
obj->published_name = NULL;
-#ifdef ENABLE_OLPC
- priv->olpc_activities = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, (GDestroyNotify) g_object_unref);
-#endif
priv->listener = NULL;
}
@@ -177,14 +144,6 @@ salut_self_get_property (GObject *object,
case PROP_PUBLISHED_NAME:
g_value_set_string (value, self->published_name);
break;
-#ifdef ENABLE_OLPC
- case PROP_OLPC_KEY:
- g_value_set_pointer (value, self->olpc_key);
- break;
- case PROP_OLPC_COLOR:
- g_value_set_string (value, self->olpc_color);
- break;
-#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -198,9 +157,6 @@ salut_self_set_property (GObject *object,
GParamSpec *pspec)
{
SalutSelf *self = SALUT_SELF (object);
-#ifdef ENABLE_OLPC
- GArray *arr;
-#endif
switch (property_id)
{
@@ -231,24 +187,6 @@ salut_self_set_property (GObject *object,
g_free (self->published_name);
self->published_name = g_value_dup_string (value);
break;
-#ifdef ENABLE_OLPC
- case PROP_OLPC_KEY:
- arr = g_value_get_pointer (value);
- if (arr != NULL)
- {
- if (self->olpc_key != NULL)
- g_array_unref (self->olpc_key);
-
- self->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8),
- arr->len);
- g_array_append_vals (self->olpc_key, arr->data, arr->len);
- }
- break;
- case PROP_OLPC_COLOR:
- g_free (self->olpc_color);
- self->olpc_color = g_value_dup_string (value);
- break;
-#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -273,14 +211,8 @@ salut_self_constructor (GType type,
g_assert (self->connection != NULL);
g_object_get (self->connection,
"contact-manager", &(priv->contact_manager),
-#ifdef ENABLE_OLPC
- "olpc-activity-manager", &(priv->olpc_activity_manager),
-#endif
NULL);
g_assert (priv->contact_manager != NULL);
-#ifdef ENABLE_OLPC
- g_assert (priv->olpc_activity_manager != NULL);
-#endif
priv->room_repo = tp_base_connection_get_handles (
(TpBaseConnection *) self->connection, TP_HANDLE_TYPE_ROOM);
@@ -306,11 +238,6 @@ salut_self_constructor (GType type,
}
}
-#ifdef ENABLE_OLPC
- g_signal_connect (priv->contact_manager, "contact-change",
- G_CALLBACK (contact_manager_contact_change_cb), self);
-#endif
-
priv->caps = salut_dup_self_advertised_caps ();
priv->data_forms = g_ptr_array_new ();
@@ -405,27 +332,6 @@ salut_self_class_init (SalutSelfClass *salut_self_class)
g_object_class_install_property (object_class, PROP_PUBLISHED_NAME,
param_spec);
-#ifdef ENABLE_OLPC
- param_spec = g_param_spec_pointer (
- "olpc-key",
- "the OLPC key",
- "A pointer to a GArray containing the OLPC key",
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_OLPC_KEY,
- param_spec);
-
- param_spec = g_param_spec_string (
- "olpc-color",
- "the OLPC color",
- "The OLPC color of the self user",
- NULL,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_OLPC_COLOR,
- param_spec);
-#endif
-
signals[ESTABLISHED] =
g_signal_new ("established",
G_OBJECT_CLASS_TYPE (salut_self_class),
@@ -466,17 +372,6 @@ salut_self_dispose (GObject *object)
priv->contact_manager = NULL;
}
-#ifdef ENABLE_OLPC
- if (priv->olpc_activity_manager != NULL)
- {
- g_object_unref (priv->olpc_activity_manager);
- priv->olpc_activity_manager = NULL;
- }
-
- if (priv->olpc_activities != NULL)
- g_hash_table_unref (priv->olpc_activities);
-#endif
-
priv->room_repo = NULL;
if (priv->listener)
@@ -512,12 +407,6 @@ salut_self_finalize (GObject *object)
g_free (self->email);
g_free (self->published_name);
g_free (self->alias);
-#ifdef ENABLE_OLPC
- if (self->olpc_key != NULL)
- g_array_unref (self->olpc_key);
- g_free (self->olpc_color);
- g_free (self->olpc_cur_act);
-#endif
g_free (self->node);
g_free (self->hash);
g_free (self->ver);
@@ -650,375 +539,6 @@ salut_self_set_avatar (SalutSelf *self, guint8 *data,
return ret;
}
-#ifdef ENABLE_OLPC
-
-gboolean
-salut_self_add_olpc_activity (SalutSelf *self, const gchar *activity_id,
- TpHandle room, GError **error)
-{
- SalutOlpcActivity *activity;
-
- g_return_val_if_fail (SALUT_IS_SELF (self), FALSE);
- g_return_val_if_fail (activity_id != NULL, FALSE);
- g_return_val_if_fail (room != 0, FALSE);
-
- if (strchr (activity_id, ':') != NULL)
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Activity IDs may not contain ':'");
- return FALSE;
- }
-
- activity = salut_olpc_activity_manager_ensure_activity_by_room (
- self->priv->olpc_activity_manager, room);
-
- if (!salut_olpc_activity_joined (activity, error))
- {
- g_object_unref (activity);
- return FALSE;
- }
-
- salut_olpc_activity_update (activity, room, activity_id, NULL, NULL, NULL,
- NULL, activity->is_private);
-
- g_hash_table_insert (self->priv->olpc_activities, GUINT_TO_POINTER (room),
- activity);
-
- return TRUE;
-}
-
-gboolean
-salut_self_remove_olpc_activity (SalutSelf *self, SalutOlpcActivity *activity)
-{
- SalutSelfPrivate *priv = self->priv;
-
- g_return_val_if_fail (activity != NULL, FALSE);
-
- g_hash_table_remove (priv->olpc_activities,
- GUINT_TO_POINTER (activity->room));
-
- salut_olpc_activity_left (activity);
- salut_olpc_activity_revoke_invitations (activity);
-
- return TRUE;
-}
-
-struct _set_olpc_activities_ctx
-{
- SalutSelf *self;
- TpHandleRepoIface *room_repo;
- GHashTable *olpc_activities;
- GHashTable *room_to_act_id;
- GError **error;
-};
-
-static void
-_set_olpc_activities_add (gpointer key, gpointer value, gpointer user_data)
-{
- struct _set_olpc_activities_ctx *data = user_data;
- SalutOlpcActivity *activity;
- const gchar *id = (const gchar *) value;
- TpHandle room = GPOINTER_TO_UINT (key);
-
- if (*(data->error) != NULL)
- {
- /* we already lost */
- return;
- }
-
- activity = g_hash_table_lookup (data->olpc_activities, key);
- if (activity == NULL)
- {
- /* add the activity service if it's not in data->olpc_activities */
- if (!salut_self_add_olpc_activity (data->self, id, room, data->error))
- return;
- }
- else
- {
- /* activity was already known */
- salut_olpc_activity_update (activity, room, id, NULL, NULL, NULL,
- NULL, activity->is_private);
- }
-}
-
-static gboolean
-_set_olpc_activities_delete (gpointer key, gpointer value, gpointer user_data)
-{
- SalutOlpcActivity *activity = (SalutOlpcActivity *) value;
- struct _set_olpc_activities_ctx *data = user_data;
- gboolean remove_activity;
-
- /* delete the activity service if it's not in data->room_to_act_id */
- remove_activity = (g_hash_table_lookup (data->room_to_act_id, key) == NULL);
-
- if (remove_activity)
- {
- salut_olpc_activity_left (activity);
- salut_olpc_activity_revoke_invitations (activity);
- }
-
- return remove_activity;
-}
-
-gboolean
-salut_self_set_olpc_activities (SalutSelf *self,
- GHashTable *room_to_act_id,
- GError **error)
-{
- GError *e = NULL;
- struct _set_olpc_activities_ctx data = { self, self->priv->room_repo,
- self->priv->olpc_activities, room_to_act_id, &e };
-
- g_return_val_if_fail (SALUT_IS_SELF (self), FALSE);
-
- /* delete any which aren't in room_to_act_id. Can't fail */
- g_hash_table_foreach_remove (self->priv->olpc_activities,
- _set_olpc_activities_delete, &data);
-
- /* add any which aren't in olpc_activities */
- g_hash_table_foreach (room_to_act_id, _set_olpc_activities_add, &data);
-
- if (error != NULL)
- *error = e;
- return (e == NULL);
-}
-
-gboolean
-salut_self_set_olpc_current_activity (SalutSelf *self,
- const gchar *id,
- TpHandle room,
- GError **error)
-{
- GError *err = NULL;
- const gchar *room_name;
-
- g_return_val_if_fail (SALUT_IS_SELF (self), FALSE);
- g_return_val_if_fail (id != NULL, FALSE);
-
- /* if one of id and room is empty, require the other to be */
- if (room == 0)
- {
- room_name = "";
-
- if (id[0] != '\0')
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "In SetCurrentActivity, activity ID must be \"\" if room handle "
- "is 0");
- return FALSE;
- }
- }
- else
- {
- room_name = tp_handle_inspect (self->priv->room_repo, room);
-
- if (id[0] == '\0')
- {
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "In SetCurrentActivity, activity ID must not be \"\" if room "
- "handle is non-zero");
- return FALSE;
- }
- }
-
- g_free (self->olpc_cur_act);
- self->olpc_cur_act = g_strdup (id);
- self->olpc_cur_act_room = room;
-
- if (!SALUT_SELF_GET_CLASS (self)->update_current_activity (self, room_name,
- &err))
- {
- g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, "%s",
- err->message);
- g_error_free (err);
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-salut_self_set_olpc_activity_properties (SalutSelf *self,
- TpHandle handle,
- const gchar *color,
- const gchar *name,
- const gchar *type,
- const gchar *tags,
- gboolean is_private,
- GError **error)
-{
- SalutSelfPrivate *priv;
- SalutOlpcActivity *activity;
-
- g_return_val_if_fail (SALUT_IS_SELF (self), FALSE);
-
- priv = self->priv;
-
- activity = g_hash_table_lookup (priv->olpc_activities,
- GUINT_TO_POINTER (handle));
-
- if (activity == NULL)
- {
- /* User have to call org.laptop.Telepathy.BuddyInfo.SetActivities
- * to create the activity */
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "No activity associated with room having handle %d", handle);
- return FALSE;
- }
-
- salut_olpc_activity_update (activity, handle, activity->id,
- name, type, color, tags, is_private);
-
- return TRUE;
-}
-
-gboolean
-salut_self_set_olpc_properties (SalutSelf *self,
- const GArray *key,
- const gchar *color,
- const gchar *jid,
- GError **error)
-{
- GError *err = NULL;
-
- if (key != NULL)
- {
- if (self->olpc_key == NULL)
- {
- self->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8),
- key->len);
- }
- else
- {
- g_array_remove_range (self->olpc_key, 0, self->olpc_key->len);
- }
-
- g_array_append_vals (self->olpc_key, key->data, key->len);
- }
-
- if (color != NULL)
- {
- g_free (self->olpc_color);
- self->olpc_color = g_strdup (color);
- }
-
- if (jid != NULL)
- {
- g_free (self->jid);
- self->jid = g_strdup (jid);
- }
-
- if (!SALUT_SELF_GET_CLASS (self)->set_olpc_properties (self, key, color, jid,
- &err))
- {
- g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, "%s",
- err->message);
- g_error_free (err);
- return FALSE;
- }
- return TRUE;
-}
-
-typedef struct
-{
- SalutSelfOLPCActivityFunc foreach;
- gpointer user_data;
-} foreach_olpc_activity_ctx;
-
-static void
-foreach_olpc_activity (gpointer key, gpointer value, gpointer user_data)
-{
- foreach_olpc_activity_ctx *ctx = user_data;
- SalutOlpcActivity *activity = value;
-
- DEBUG ("%s -> %u", activity->id, GPOINTER_TO_UINT (key));
- (ctx->foreach) (activity, ctx->user_data);
-}
-
-void
-salut_self_foreach_olpc_activity (SalutSelf *self,
- SalutSelfOLPCActivityFunc foreach,
- gpointer user_data)
-{
- foreach_olpc_activity_ctx ctx = { foreach, user_data };
-
- g_return_if_fail (SALUT_IS_SELF (self));
-
- DEBUG ("called");
-
- g_hash_table_foreach (self->priv->olpc_activities, foreach_olpc_activity,
- &ctx);
-
- DEBUG ("end");
-}
-
-void
-salut_self_olpc_augment_invitation (SalutSelf *self,
- TpHandle room,
- TpHandle contact,
- WockyNode *invite_node)
-{
- SalutOlpcActivity *activity;
-
- g_return_if_fail (SALUT_IS_SELF (self));
-
- activity = g_hash_table_lookup (self->priv->olpc_activities,
- GUINT_TO_POINTER (room));
- if (activity == NULL)
- return;
-
- salut_olpc_activity_augment_invitation (activity, contact, invite_node);
-}
-
-typedef struct
-{
- GHashTable *olpc_activities;
- TpHandle contact_handle;
-} remove_from_invited_ctx;
-
-static void
-remove_from_invited (SalutOlpcActivity *act,
- gpointer user_data)
-{
- SalutOlpcActivity *activity;
- remove_from_invited_ctx *data = (remove_from_invited_ctx *) user_data;
-
- activity = g_hash_table_lookup (data->olpc_activities,
- GUINT_TO_POINTER (act->room));
- if (activity == NULL)
- return;
-
- if (salut_olpc_activity_remove_invited (activity, data->contact_handle))
- DEBUG ("contact %d joined activity %s. Remove it from the invited list",
- data->contact_handle, activity->id);
-}
-
-/* when a buddy changes his activity list, check if we invited him
- * to this activity and remove him from the invited set */
-void
-contact_manager_contact_change_cb (SalutContactManager *mgr,
- SalutContact *contact,
- int changes,
- gpointer user_data)
-{
- SalutSelf *self = SALUT_SELF (user_data);
- SalutSelfPrivate *priv = self->priv;
- TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (
- TP_BASE_CONNECTION (self->connection), TP_HANDLE_TYPE_CONTACT);
- TpHandle handle;
- remove_from_invited_ctx data;
-
- if (!(changes & SALUT_CONTACT_OLPC_ACTIVITIES))
- return;
-
- handle = tp_handle_lookup (handle_repo, contact->name, NULL, NULL);
-
- data.olpc_activities = priv->olpc_activities;
- data.contact_handle = handle;
- salut_contact_foreach_olpc_activity (contact, remove_from_invited, &data);
-}
-#endif /* ENABLE_OLPC */
-
void
salut_self_established (SalutSelf *self)
{
diff --git a/src/self.h b/src/self.h
index 4c1b51ab..84a7eeec 100644
--- a/src/self.h
+++ b/src/self.h
@@ -32,9 +32,6 @@
#include "connection.h"
#include "presence.h"
-#ifdef ENABLE_OLPC
-#include "olpc-activity.h"
-#endif
G_BEGIN_DECLS
@@ -52,10 +49,6 @@ struct _SalutSelfClass {
gboolean (*set_alias) (SalutSelf *self, GError **error);
gboolean (*set_avatar) (SalutSelf *self, guint8 *data, gsize size,
GError **error);
-#ifdef ENABLE_OLPC
- gboolean (*set_olpc_properties) (SalutSelf *self, const GArray *key,
- const gchar *color, const gchar *jid, GError **error);
-#endif
/* private abstract methods */
void (*remove_avatar) (SalutSelf *self);
@@ -72,12 +65,6 @@ struct _SalutSelf {
guint8 *avatar;
gsize avatar_size;
gchar *jid;
-#ifdef ENABLE_OLPC
- GArray *olpc_key;
- gchar *olpc_cur_act;
- TpHandle olpc_cur_act_room;
- gchar *olpc_color;
-#endif
gchar *node;
gchar *hash;
gchar *ver;
@@ -127,37 +114,6 @@ gboolean salut_self_set_alias (SalutSelf *self, const gchar *alias,
const gchar *salut_self_get_alias (SalutSelf *self);
-#ifdef ENABLE_OLPC
-gboolean salut_self_set_olpc_properties (SalutSelf *self,
- const GArray *key, const gchar *color, const gchar *jid, GError **error);
-
-gboolean salut_self_set_olpc_activity_properties (SalutSelf *self,
- TpHandle handle,
- const gchar *color, const gchar *name, const gchar *type,
- const gchar *tags, gboolean is_private, GError **error);
-
-gboolean salut_self_set_olpc_activities (SalutSelf *self,
- GHashTable *act_id_to_room, GError **error);
-
-gboolean salut_self_add_olpc_activity (SalutSelf *self,
- const gchar *activity_id, TpHandle room, GError **error);
-
-gboolean salut_self_remove_olpc_activity (SalutSelf *self,
- SalutOlpcActivity *activity);
-
-gboolean salut_self_set_olpc_current_activity (SalutSelf *self,
- const gchar *id, TpHandle room, GError **error);
-
-typedef void (*SalutSelfOLPCActivityFunc)
- (SalutOlpcActivity *activity, gpointer user_data);
-
-void salut_self_foreach_olpc_activity (SalutSelf *self,
- SalutSelfOLPCActivityFunc foreach, gpointer user_data);
-
-void salut_self_olpc_augment_invitation (SalutSelf *self,
- TpHandle room, TpHandle contact, WockyNode *invite_node);
-#endif
-
const GabbleCapabilitySet *salut_self_get_caps (SalutSelf *self);
void salut_self_take_caps (SalutSelf *self, GabbleCapabilitySet *caps);
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index a83c1432..b3b833de 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -51,17 +51,10 @@ TWISTED_AVAHI_TESTS = \
avahi/tubes/two-muc-stream-tubes.py \
avahi/tubes/two-muc-dbus-tubes.py
-TWISTED_AVAHI_OLPC_TESTS = \
- avahi/olpc-activity-announcements.py
-
if WANT_TWISTED_TESTS
TWISTED_TESTS += $(TWISTED_BASIC_TESTS)
endif
-if ENABLE_OLPC
- TWISTED_AVAHI_TESTS += $(TWISTED_AVAHI_OLPC_TESTS)
-endif
-
if USE_BACKEND_AVAHI
TWISTED_TESTS += $(TWISTED_AVAHI_TESTS)
endif
@@ -117,7 +110,6 @@ run-test.sh: run-test.sh.in Makefile
EXTRA_DIST = \
$(TWISTED_AVAHI_TESTS) \
- $(TWISTED_AVAHI_OLPC_TESTS) \
$(TWISTED_BASIC_TESTS) \
constants.py \
run-test.sh.in \
diff --git a/tests/twisted/avahi/olpc-activity-announcements.py b/tests/twisted/avahi/olpc-activity-announcements.py
deleted file mode 100644
index 93dbd1a6..00000000
--- a/tests/twisted/avahi/olpc-activity-announcements.py
+++ /dev/null
@@ -1,115 +0,0 @@
-from saluttest import exec_test, wait_for_contact_in_publish
-from avahitest import AvahiAnnouncer, AvahiRecordAnnouncer, AvahiListener
-from avahitest import get_host_name, get_domain_name
-import avahi
-
-from xmppstream import setup_stream_listener, connect_to_stream
-from servicetest import make_channel_proxy, format_event, EventPattern
-
-from twisted.words.xish import xpath, domish
-import constants as cs
-
-import time
-import dbus
-import socket
-
-CHANNEL_TYPE_TEXT = "im.telepathy1.Channel.Type.Text"
-HT_CONTACT = 1
-HT_ROOM = 2
-HT_CONTACT_LIST = 3
-
-PUBLISHED_NAME = "acttest"
-TESTSUITE_PUBLISHED_NAME = "salutacttest"
-ACTIVITY_ID = str(time.time())
-
-def announce_address(hostname, address):
- "Announce IN A record, address is assume to be ipv4"
-
- data = reduce (lambda x, y: (x << 8) + int(y), address.split("."), 0)
- ndata = socket.htonl(data)
- rdata = [ (ndata >> (24 - x)) & 0xff for x in xrange(0, 32, 8)]
-
- AvahiRecordAnnouncer(hostname, 0x1, 0x01, rdata)
-
-def test(q, bus, conn):
- conn.Connect()
- q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L])
-
-
- activity_txt = { "type": "org.laptop.HelloMesh",
- "name": "HelloMesh",
- "color": "#7b83c1,#260993",
- "txtvers": "0",
- "activity-id": ACTIVITY_ID,
- "room": ACTIVITY_ID
- }
-
- # Listen for announcements
- l = AvahiListener(q).listen_for_service("_olpc-activity1._udp")
-
- # Assert that the testsuite doesn't announce the activity
- service_name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME + "@" + get_host_name()
- forbiden_event = EventPattern('service-added', name=service_name)
- q.forbid_events([forbiden_event])
-
- contact_name = PUBLISHED_NAME + "@" + get_host_name()
-
- activity_name = ACTIVITY_ID + ":" + PUBLISHED_NAME + "@" + get_host_name()
-
- AvahiAnnouncer(contact_name, "_presence._tcp", 1234, {})
-
- act_hostname = ACTIVITY_ID + ":" + PUBLISHED_NAME + \
- "._clique._udp." + get_domain_name()
- act_address = "239.253.70.70"
-
- announce_address(act_hostname, act_address)
-
- # FIXME, if we use the same name as the running salut will MembersChanged
- # isn't signalled later on, needs to be fixed.
- AvahiAnnouncer(ACTIVITY_ID + ":" + PUBLISHED_NAME,
- "_clique._udp", 12345, {}, hostname = act_hostname)
- AvahiAnnouncer(activity_name, "_olpc-activity1._udp",
- 0, activity_txt)
-
- # Publish a contact, now get it's handle
- handle = wait_for_contact_in_publish(q, bus, conn, contact_name)
-
- # Assert that the remote handles signals it joined the activity
- while True:
- e = q.expect('dbus-signal', signal = 'ActivitiesChanged')
- if e.args[0] == handle and e.args[1] != []:
- assert len(e.args[1]) == 1
- assert e.args[1][0][0] == ACTIVITY_ID
- activity_handle = e.args[1][0][1]
- break
-
- act_prop_iface = dbus.Interface(conn, cs.ACTIVITY_PROPERTIES)
- act_properties = act_prop_iface.GetProperties(activity_handle)
- assert act_properties['private'] == False
- assert act_properties['color'] == activity_txt['color']
- assert act_properties['name'] == activity_txt['name']
- assert act_properties['type'] == activity_txt['type']
-
- room_channel = conn.RequestChannel(CHANNEL_TYPE_TEXT,
- HT_ROOM, activity_handle, True)
-
- q.expect('dbus-signal', signal='MembersChanged', path=room_channel,
- args = [u'', [1L], [], [], [], 1L, 0L])
-
- # Make it public that we joined the activity
- q.unforbid_events([forbiden_event])
- buddy_info_iface = dbus.Interface(conn, cs.BUDDY_INFO)
- buddy_info_iface.SetActivities([(ACTIVITY_ID, activity_handle)])
-
- q.expect('service-added',
- name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME +
- "@" + get_host_name())
-
- buddy_info_iface.SetActivities([])
-
- q.expect('service-removed',
- name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME +
- "@" + get_host_name())
-
-if __name__ == '__main__':
- exec_test(test, { "published-name": TESTSUITE_PUBLISHED_NAME}, timeout=15)
diff --git a/tests/twisted/ns.py b/tests/twisted/ns.py
index b538fc4f..e9c24f80 100644
--- a/tests/twisted/ns.py
+++ b/tests/twisted/ns.py
@@ -41,16 +41,6 @@ NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl'
NS_XMPP_BIND = 'urn:ietf:params:xml:ns:xmpp-bind'
NS_XMPP_TLS = 'urn:ietf:params:xml:ns:xmpp-tls'
NS_XMPP_SESSION = 'urn:ietf:params:xml:ns:xmpp-session'
-OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities"
-OLPC_ACTIVITIES_NOTIFY = "%s+notify" % OLPC_ACTIVITIES
-OLPC_ACTIVITY = "http://laptop.org/xmpp/activity"
-OLPC_ACTIVITY_PROPS = "http://laptop.org/xmpp/activity-properties"
-OLPC_ACTIVITY_PROPS_NOTIFY = "%s+notify" % OLPC_ACTIVITY_PROPS
-OLPC_BUDDY = "http://laptop.org/xmpp/buddy"
-OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties"
-OLPC_BUDDY_PROPS_NOTIFY = "%s+notify" % OLPC_BUDDY_PROPS
-OLPC_CURRENT_ACTIVITY = "http://laptop.org/xmpp/current-activity"
-OLPC_CURRENT_ACTIVITY_NOTIFY = "%s+notify" % OLPC_CURRENT_ACTIVITY
PUBSUB = "http://jabber.org/protocol/pubsub"
PUBSUB_EVENT = "%s#event" % PUBSUB
REGISTER = "jabber:iq:register"