Index: libempathy-gtk/empathy-tube-window.glade
===================================================================
--- libempathy-gtk/empathy-tube-window.glade	(révision 0)
+++ libempathy-gtk/empathy-tube-window.glade	(révision 0)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
+<glade-interface>
+  <widget class="GtkWindow" id="window">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="title" translatable="yes">Call</property>
+    <child>
+      <widget class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <child>
+          <widget class="GtkLabel" id="offer_label">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="label" translatable="yes">&lt;b&gt;New tube&lt;/b&gt;</property>
+            <property name="use_markup">True</property>
+          </widget>
+        </child>
+        <child>
+          <widget class="GtkVBox" id="contact_vbox">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <child>
+              <placeholder/>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox2">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <child>
+              <widget class="GtkVBox" id="icon_vbox">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="service_label">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Service:</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <child>
+              <widget class="GtkButton" id="decline_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">_Decline</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="accept_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">_Accept</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
Index: libempathy-gtk/empathy-tube-window.c
===================================================================
--- libempathy-gtk/empathy-tube-window.c	(révision 0)
+++ libempathy-gtk/empathy-tube-window.c	(révision 0)
@@ -0,0 +1,142 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <string.h>
+
+#include <libempathy/empathy-debug.h>
+
+#include "empathy-tube-window.h"
+#include "empathy-contact-widget.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_DOMAIN "TubeWindow"
+
+typedef struct {
+  GtkWidget *window;
+  GtkWidget *accept_button;
+  GtkWidget *decline_button;
+  GtkWidget *offer_label;
+  GtkWidget *service_label;
+  GtkWidget *contact_vbox;
+  GtkWidget *icon_vbox;
+
+  EmpathyTube *tube;
+} EmpathyTubeWindow;
+
+static void
+tube_window_destroy_cb (GtkWidget *widget,
+                        EmpathyTubeWindow *window)
+{
+  g_object_unref (window->tube);
+  g_slice_free (EmpathyTubeWindow, window);
+}
+
+static void
+accept_button_clicked_cb (GtkWidget *button,
+                          EmpathyTubeWindow *window)
+{
+  empathy_tube_accept (window->tube);
+  gtk_widget_destroy (window->window);
+}
+
+static void
+decline_button_clicked_cb (GtkWidget *button,
+                           EmpathyTubeWindow *window)
+{
+  empathy_tube_decline (window->tube);
+  gtk_widget_destroy (window->window);
+}
+
+void
+empathy_tube_window_show (EmpathyTube *tube)
+{
+  EmpathyTubeWindow *window;
+  GladeXML *glade;
+  guint state;
+  gchar *service, *tmp;
+  EmpathyContact *initiator;
+  GtkWidget *initiator_widget;
+  GtkWidget *image = NULL;
+
+  window = g_slice_new0 (EmpathyTubeWindow);
+
+  glade = empathy_glade_get_file ("empathy-tube-window.glade",
+          "window",
+          NULL,
+          "window", &window->window,
+          "accept_button", &window->accept_button,
+          "decline_button", &window->decline_button,
+          "offer_label", &window->offer_label,
+          "service_label", &window->service_label,
+          "contact_vbox", &window->contact_vbox,
+          "icon_vbox", &window->icon_vbox,
+          NULL);
+
+  empathy_glade_connect (glade,
+             window,
+             "window", "destroy", tube_window_destroy_cb,
+             "accept_button", "clicked", accept_button_clicked_cb,
+             "decline_button", "clicked", decline_button_clicked_cb,
+             NULL);
+  g_object_unref (glade);
+
+  g_object_get (tube,
+      "state", &state,
+      "service", &service,
+      "initiator-contact", &initiator,
+      NULL);
+
+  window->tube = tube;
+  g_object_ref (window->tube);
+
+  /* local pending */
+  g_assert (state == 0);
+
+  tmp = g_strdup_printf ("Service: %s", service);
+  gtk_label_set_text (GTK_LABEL (window->service_label), tmp);
+  g_free (tmp);
+
+  initiator_widget = empathy_contact_widget_new (initiator,
+      EMPATHY_CONTACT_WIDGET_EDIT_NONE);
+  gtk_box_pack_start (GTK_BOX (window->contact_vbox), initiator_widget, TRUE,
+      TRUE, 0);
+
+  /* Icon */
+  if (strcmp (service, "x-tetrinet") == 0)
+    {
+      image = gtk_image_new_from_icon_name ("gtetrinet", GTK_ICON_SIZE_DIALOG);
+    }
+
+  if (image != NULL)
+    {
+      gtk_box_pack_start (GTK_BOX (window->icon_vbox), image, TRUE,
+          TRUE, 0);
+      gtk_widget_show (image);
+    }
+
+  gtk_widget_show (window->window);
+
+  g_free (service);
+  g_object_unref (initiator);
+}
Index: libempathy-gtk/empathy-tube-window.h
===================================================================
--- libempathy-gtk/empathy-tube-window.h	(révision 0)
+++ libempathy-gtk/empathy-tube-window.h	(révision 0)
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_TUBE_WINDOW_H__
+#define __EMPATHY_TUBE_WINDOW_H__
+
+#include <libempathy/empathy-tube.h>
+
+G_BEGIN_DECLS
+
+void empathy_tube_window_show (EmpathyTube *tube);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_TUBE_WINDOW_H__ */
+
Index: libempathy-gtk/Makefile.am
===================================================================
--- libempathy-gtk/Makefile.am	(révision 387)
+++ libempathy-gtk/Makefile.am	(copie de travail)
@@ -50,6 +50,7 @@
 	empathy-call-window.c			\
 	empathy-avatar-chooser.c		\
 	empathy-avatar-image.c			\
+	empathy-tube-window.c			\
 	empathy-ui-utils.c
 
 # do not distribute generated files
@@ -102,6 +103,7 @@
 	empathy-call-window.h			\
 	empathy-avatar-chooser.h		\
 	empathy-avatar-image.h			\
+	empathy-tube-window.h			\
 	empathy-ui-utils.h
 
 libempathy_gtk_includedir = $(includedir)/libempathy-gtk/
@@ -127,6 +129,7 @@
 	empathy-spell-dialog.glade		\
 	empathy-log-window.glade		\
 	empathy-call-window.glade		\
+	empathy-tube-window.glade		\
 	empathy-chat.glade
 
 empathy-gtk-enum-types.h: stamp-empathy-gtk-enum-types.h
Index: src/org.gnome.Empathy.Tubes.service.in
===================================================================
--- src/org.gnome.Empathy.Tubes.service.in	(révision 0)
+++ src/org.gnome.Empathy.Tubes.service.in	(révision 0)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Empathy.Tubes
+Exec=@bindir@/empathy-tubes-chandler
Index: src/empathy-tubes-chandler.c
===================================================================
--- src/empathy-tubes-chandler.c	(révision 0)
+++ src/empathy-tubes-chandler.c	(révision 0)
@@ -0,0 +1,97 @@
+/*
+ *  Copyright (C) 2007 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
+ *
+ *  Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include <libmissioncontrol/mission-control.h>
+
+#include <libempathy/empathy-chandler.h>
+#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-debug.h>
+#include <libempathy/empathy-tp-tubes.h>
+#include <libempathy/empathy-tube.h>
+#include <libempathy-gtk/empathy-tube-window.h>
+
+#define DEBUG_DOMAIN "EmpathyTubes"
+
+#define BUS_NAME "org.gnome.Empathy.Tubes"
+#define OBJECT_PATH "/org/freedesktop/Telepathy/ChannelHandler"
+
+static void
+tubes_chandler_new_channel_cb (EmpathyChandler *chandler,
+                               TpConn *tp_conn,
+                               TpChan *tp_chan,
+                               MissionControl  *mc)
+{
+  EmpathyTpTubes *tubes_channel;
+  McAccount *account;
+  GSList *tubes, *l;
+
+  account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
+
+  tubes_channel = empathy_tp_tubes_new (account, tp_chan);
+  g_object_unref (account);
+
+  tubes = empathy_tp_tubes_get_tubes (tubes_channel);
+  for (l = tubes; l != NULL; l = g_slist_next (l))
+    {
+      EmpathyTube *tube = EMPATHY_TUBE (l->data);
+      guint state;
+
+      g_object_get (tube, "state", &state, NULL);
+
+      /* local pending */
+      /* FIXME: Do we generate enum in liptp ? */
+      if (state == 0)
+        {
+          empathy_tube_window_show (tube);
+        }
+
+      g_object_unref (tube);
+    }
+
+  g_slist_free (tubes);
+}
+
+int
+main (int argc, char *argv[])
+{
+  EmpathyChandler *chandler;
+  MissionControl  *mc;
+
+  gtk_init (&argc, &argv);
+
+  mc = empathy_mission_control_new ();
+  chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
+  g_signal_connect (chandler, "new-channel",
+    G_CALLBACK (tubes_chandler_new_channel_cb),
+    mc);
+
+  empathy_debug (DEBUG_DOMAIN, "Ready to handle new tubes channels");
+
+  gtk_main ();
+
+  g_object_unref (chandler);
+  g_object_unref (mc);
+
+  return EXIT_SUCCESS;
+}
Index: src/empathy-tubes.chandler
===================================================================
--- src/empathy-tubes.chandler	(révision 0)
+++ src/empathy-tubes.chandler	(révision 0)
@@ -0,0 +1,4 @@
+[ChannelHandler]
+BusName = org.gnome.Empathy.Tubes
+ObjectPath = /org/freedesktop/Telepathy/ChannelHandler
+ChannelType = org.freedesktop.Telepathy.Channel.Type.Tubes
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(révision 387)
+++ src/Makefile.am	(copie de travail)
@@ -16,23 +16,27 @@
 bin_PROGRAMS =			\
 	empathy			\
 	empathy-accounts	\
-	empathy-call-chandler
+	empathy-call-chandler   \
+	empathy-tubes-chandler
 
 empathy_SOURCES = empathy.c
 empathy_accounts_SOURCES = empathy-accounts.c
 empathy_call_chandler_SOURCES = empathy-call-chandler.c
+empathy_tubes_chandler_SOURCES = empathy-tubes-chandler.c
 
 # Dbus service files
 servicedir = $(datadir)/dbus-1/services
 service_DATA =							\
 	org.gnome.Empathy.Chat.service				\
-	org.gnome.Empathy.Call.service
+	org.gnome.Empathy.Call.service				\
+	org.gnome.Empathy.Tubes.service
 %.service: %.service.in Makefile
 	@sed -e "s|\@bindir\@|$(bindir)|" $< > $@
 
 chandlerdir = $(datadir)/telepathy/managers
 chandler_DATA =							\
-	empathy-chat.chandler
+	empathy-chat.chandler \
+	empathy-tubes.chandler
 
 if HAVE_VOIP
 chandler_DATA += empathy-call.chandler
@@ -40,11 +44,13 @@
 
 BUILT_SOURCES =							\
 	org.gnome.Empathy.Chat.service				\
-	org.gnome.Empathy.Call.service
+	org.gnome.Empathy.Call.service				\
+	org.gnome.Empathy.Tubes.service
 
 EXTRA_DIST =							\
 	org.gnome.Empathy.Chat.service.in			\
 	org.gnome.Empathy.Call.service.in			\
+	org.gnome.Empathy.Tubes.service.in			\
 	$(autostart_DATA)					\
 	$(chandler_DATA)
 
Index: libempathy/empathy-tp-tubes.c
===================================================================
--- libempathy/empathy-tp-tubes.c	(révision 0)
+++ libempathy/empathy-tp-tubes.c	(révision 0)
@@ -0,0 +1,357 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#include "config.h"
+
+#include <libtelepathy/tp-helpers.h>
+#include <libtelepathy/tp-conn.h>
+#include <libtelepathy/tp-chan-type-tubes-gen.h>
+#include <libtelepathy/tp-chan.h>
+
+#include <libmissioncontrol/mission-control.h>
+
+#include "empathy-tp-tubes.h"
+#include "empathy-utils.h"
+#include "empathy-debug.h"
+#include "empathy-enum-types.h"
+#include "empathy-tube.h"
+
+#define DEBUG_DOMAIN "TpTubes"
+
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_TP_TUBES, EmpathyTpTubesPriv))
+
+#define EMPATHY_CHANNEL_TUBE_TYPE \
+    (dbus_g_type_get_struct ("GValueArray", \
+        G_TYPE_UINT, \
+        G_TYPE_UINT, \
+        G_TYPE_UINT, \
+        G_TYPE_STRING, \
+        dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), \
+        G_TYPE_UINT, \
+        G_TYPE_INVALID))
+
+typedef struct _EmpathyTpTubesPriv EmpathyTpTubesPriv;
+
+struct _EmpathyTpTubesPriv
+{
+  TpChan              *tp_chan;
+  DBusGProxy          *tubes_iface;
+  McAccount           *account;
+
+  GHashTable *tubes;
+};
+
+static void empathy_tp_tubes_class_init (EmpathyTpTubesClass *klass);
+static void empathy_tp_tubes_init       (EmpathyTpTubes      *tubes);
+
+enum
+{
+  DESTROY,
+  NEW_TUBE,
+  NUM_SIGNAL
+};
+
+static guint signals[NUM_SIGNAL];
+
+/* properties */
+enum
+{
+  PROP_ACCOUNT = 1,
+  PROP_TP_CHAN
+};
+
+G_DEFINE_TYPE (EmpathyTpTubes, empathy_tp_tubes, G_TYPE_OBJECT)
+
+static void
+tp_tubes_set_property (GObject      *object,
+                       guint         prop_id,
+                       const GValue *value,
+                       GParamSpec   *pspec)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_ACCOUNT:
+        priv->account = g_object_ref (g_value_get_object (value));
+        break;
+      case PROP_TP_CHAN:
+        priv->tp_chan = g_object_ref (g_value_get_object (value));
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+  }
+}
+
+static void
+tp_tubes_get_property (GObject    *object,
+                       guint       prop_id,
+                       GValue     *value,
+                       GParamSpec *pspec)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_ACCOUNT:
+        g_value_set_object (value, priv->account);
+        break;
+      case PROP_TP_CHAN:
+        g_value_set_object (value, priv->tp_chan);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+  }
+}
+
+static void
+tp_tubes_destroy_cb (TpChan *tubes_chan,
+                     EmpathyTpTubes *tubes)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (tubes);
+
+  empathy_debug (DEBUG_DOMAIN, "Channel Closed or CM crashed");
+
+  g_object_unref (priv->tp_chan);
+  priv->tp_chan = NULL;
+  priv->tubes_iface = NULL;
+
+  g_signal_emit (tubes, signals[DESTROY], 0);
+}
+
+static void
+tp_tubes_closed_cb (TpChan *tubes_chan,
+                    EmpathyTpTubes *tubes)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (tubes);
+
+  /* The channel is closed, do just like if the proxy was destroyed */
+  g_signal_handlers_disconnect_by_func (priv->tp_chan,
+      tp_tubes_destroy_cb,
+      tubes);
+  tp_tubes_destroy_cb (tubes_chan, tubes);
+}
+
+static void
+tp_tubes_new_tube_cb (TpChan *tubes_chan,
+                      guint id,
+                      guint initiator,
+                      guint type,
+                      const gchar *service,
+                      GHashTable *parameters,
+                      guint state,
+                      EmpathyTpTubes *self)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (self);
+  EmpathyTube *tube;
+
+  tube = empathy_tube_new (priv->account, tubes_chan,
+      id, initiator, type, service, parameters, state);
+  g_hash_table_insert (priv->tubes, GUINT_TO_POINTER (id), tube);
+}
+
+static GObject *
+tp_tubes_constructor (GType type,
+                      guint n_props,
+                      GObjectConstructParam *props)
+{
+  GObject *self;
+  EmpathyTpTubesPriv *priv;
+  GPtrArray *existing_tubes = NULL;
+  guint i;
+  gboolean result;
+
+  self = G_OBJECT_CLASS (empathy_tp_tubes_parent_class)->constructor (type,
+      n_props, props);
+  priv = GET_PRIV (self);
+
+  priv->tubes_iface = tp_chan_get_interface (priv->tp_chan,
+      TELEPATHY_CHAN_IFACE_TUBES_QUARK);
+
+  /* Connect signals */
+  dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->tp_chan), "Closed",
+             G_CALLBACK (tp_tubes_closed_cb),
+             self, NULL);
+  dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->tubes_iface), "NewTube",
+             G_CALLBACK (tp_tubes_new_tube_cb),
+             self, NULL);
+  g_signal_connect (priv->tp_chan, "destroy",
+        G_CALLBACK (tp_tubes_destroy_cb),
+        self);
+
+  /* Look for existing tubes */
+  result = tp_chan_type_tubes_list_tubes (priv->tubes_iface, &existing_tubes,
+      NULL);
+  g_assert (result);
+
+  for (i = 0; i < existing_tubes->len; i++)
+    {
+      GValue tube = {0,};
+      guint id, initiator, type, state;
+      const gchar *service;
+      GHashTable *parameters;
+
+      g_print ("existing tube\n");
+      g_value_init (&tube, EMPATHY_CHANNEL_TUBE_TYPE);
+      g_value_set_boxed (&tube, g_ptr_array_index (existing_tubes, i));
+
+      dbus_g_type_struct_get (&tube,
+          0, &id,
+          1, &initiator,
+          2, &type,
+          3, &service,
+          4, &parameters,
+          5, &state,
+          G_MAXUINT);
+
+      tp_tubes_new_tube_cb (priv->tp_chan, id, initiator, type, service,
+          parameters, state, EMPATHY_TP_TUBES (self));
+    }
+
+  g_ptr_array_free (existing_tubes, TRUE);
+  return self;
+}
+
+static void
+tp_tubes_finalize (GObject *object)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (object);
+
+  empathy_debug (DEBUG_DOMAIN, "Finalizing: %p", object);
+
+  if (priv->tp_chan)
+    {
+      GError *error = NULL;
+
+      g_signal_handlers_disconnect_by_func (priv->tp_chan,
+                    tp_tubes_destroy_cb,
+                    object);
+      empathy_debug (DEBUG_DOMAIN, "Closing channel...");
+
+      if (!tp_chan_close (DBUS_G_PROXY (priv->tp_chan), &error))
+        {
+          empathy_debug (DEBUG_DOMAIN, 
+                  "Error closing text channel: %s",
+                  error ? error->message : "No error given");
+          g_clear_error (&error);
+        }
+
+      g_object_unref (priv->tp_chan);
+    }
+
+  g_object_unref (priv->account);
+
+  G_OBJECT_CLASS (empathy_tp_tubes_parent_class)->finalize (object);
+}
+
+static void
+empathy_tp_tubes_class_init (EmpathyTpTubesClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->constructor = tp_tubes_constructor;
+  object_class->finalize = tp_tubes_finalize;
+  object_class->set_property = tp_tubes_set_property;
+  object_class->get_property = tp_tubes_get_property;
+
+  /* Construct-only properties */
+  g_object_class_install_property (object_class,
+           PROP_ACCOUNT,
+           g_param_spec_object ("account",
+                    "channel Account",
+                    "The account associated with the channel",
+                    MC_TYPE_ACCOUNT,
+                    G_PARAM_READWRITE |
+                    G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+           PROP_TP_CHAN,
+           g_param_spec_object ("tp-chan",
+                    "telepathy channel",
+                    "The media channel for the tubes",
+                    TELEPATHY_CHAN_TYPE,
+                    G_PARAM_READWRITE |
+                    G_PARAM_CONSTRUCT_ONLY));
+
+  /* Signals */
+  signals[DESTROY] =
+    g_signal_new ("destroy",
+            G_TYPE_FROM_CLASS (klass),
+            G_SIGNAL_RUN_LAST,
+            0,
+            NULL, NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE,
+            0);
+
+  signals[NEW_TUBE] =
+    g_signal_new ("new-tube",
+            G_TYPE_FROM_CLASS (klass),
+            G_SIGNAL_RUN_LAST,
+            0,
+            NULL, NULL,
+            g_cclosure_marshal_VOID__OBJECT,
+            G_TYPE_NONE,
+            1, EMPATHY_TYPE_TUBE);
+
+  g_type_class_add_private (klass, sizeof (EmpathyTpTubesPriv));
+}
+
+static void
+empathy_tp_tubes_init (EmpathyTpTubes *self)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (self);
+
+  priv->tubes = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+      NULL, g_object_unref);
+}
+
+EmpathyTpTubes *
+empathy_tp_tubes_new (McAccount *account, TpChan *channel)
+{
+  return g_object_new (EMPATHY_TYPE_TP_TUBES,
+      "account", account,
+      "tp-chan", channel,
+      NULL);
+}
+
+static void
+add_tube_in_list (gpointer key,
+                  gpointer tube,
+                  gpointer user_data)
+{
+  GSList **l = (GSList **) user_data;
+
+  g_object_ref (tube);
+  *l = g_slist_prepend (*l, tube);
+}
+
+GSList *
+empathy_tp_tubes_get_tubes (EmpathyTpTubes *self)
+{
+  EmpathyTpTubesPriv *priv = GET_PRIV (self);
+  GSList *l = NULL;
+
+  g_hash_table_foreach (priv->tubes, add_tube_in_list, &l);
+
+  return l;
+}
Index: libempathy/empathy-tp-tubes.h
===================================================================
--- libempathy/empathy-tp-tubes.h	(révision 0)
+++ libempathy/empathy-tp-tubes.h	(révision 0)
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_TP_TUBES_H__
+#define __EMPATHY_TP_TUBES_H__
+
+#include <glib-object.h>
+
+#include <libtelepathy/tp-chan.h>
+#include <libtelepathy/tp-constants.h>
+
+#include <libmissioncontrol/mc-account.h>
+
+G_BEGIN_DECLS
+
+GType empathy_tp_tubes_get_type (void) G_GNUC_CONST;
+
+#define EMPATHY_TYPE_TP_TUBES              (empathy_tp_tubes_get_type ())
+#define EMPATHY_TP_TUBES(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), EMPATHY_TYPE_TP_TUBES, EmpathyTpTubes))
+#define EMPATHY_TP_TUBES_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_TP_TUBES, EmpathyTpTubesClass))
+#define EMPATHY_IS_TP_TUBES(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), EMPATHY_TYPE_TP_TUBES))
+#define EMPATHY_IS_TP_TUBES_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_TP_TUBES))
+#define EMPATHY_TP_TUBES_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), EMPATHY_TYPE_TP_TUBES, EmpathyTpTubesClass))
+
+typedef struct _EmpathyTpTubes EmpathyTpTubes;
+typedef struct _EmpathyTpTubesClass EmpathyTpTubesClass;
+
+struct _EmpathyTpTubes {
+  GObject parent;
+};
+
+struct _EmpathyTpTubesClass {
+  GObjectClass parent_class;
+};
+
+EmpathyTpTubes *empathy_tp_tubes_new (McAccount *account, TpChan *tp_chan);
+GSList *empathy_tp_tubes_get_tubes (EmpathyTpTubes *tubes);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_TP_TUBES_H__ */
Index: libempathy/empathy-tube.c
===================================================================
--- libempathy/empathy-tube.c	(révision 0)
+++ libempathy/empathy-tube.c	(révision 0)
@@ -0,0 +1,440 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <libtelepathy/tp-helpers.h>
+#include <libtelepathy/tp-conn.h>
+#include <libtelepathy/tp-chan-type-tubes-gen.h>
+#include <libtelepathy/tp-chan.h>
+
+#include <libmissioncontrol/mission-control.h>
+
+#include "empathy-tube.h"
+#include "empathy-contact.h"
+#include "empathy-contact-factory.h"
+#include "empathy-utils.h"
+#include "empathy-debug.h"
+#include "empathy-enum-types.h"
+
+#define DEBUG_DOMAIN "Tube"
+
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_TUBE, EmpathyTubePriv))
+
+typedef struct _EmpathyTubePriv EmpathyTubePriv;
+
+struct _EmpathyTubePriv
+{
+  TpChan *tp_chan;
+  DBusGProxy *tubes_iface;
+  McAccount *account;
+  guint id;
+  guint initiator;
+  guint type;
+  const gchar *service;
+  GHashTable *parameters;
+  guint state;
+  EmpathyContact *initiator_contact;
+};
+
+static void empathy_tube_class_init (EmpathyTubeClass *klass);
+static void empathy_tube_init (EmpathyTube      *tubes);
+
+enum
+{
+  NUM_SIGNAL
+};
+
+/* properties */
+enum
+{
+  PROP_ACCOUNT = 1,
+  PROP_TP_CHAN,
+  PROP_ID,
+  PROP_INITIATOR,
+  PROP_TYPE,
+  PROP_SERVICE,
+  PROP_PARAMETERS,
+  PROP_STATE,
+  PROP_INITIATOR_CONTACT,
+};
+
+G_DEFINE_TYPE (EmpathyTube, empathy_tube, G_TYPE_OBJECT)
+
+static void
+tube_set_property (GObject *object,
+                   guint prop_id,
+                   const GValue *value,
+                   GParamSpec *pspec)
+{
+  EmpathyTubePriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_ACCOUNT:
+        priv->account = g_object_ref (g_value_get_object (value));
+        break;
+      case PROP_TP_CHAN:
+        priv->tp_chan = g_object_ref (g_value_get_object (value));
+        break;
+      case PROP_ID:
+        priv->id = g_value_get_uint (value);
+        break;
+      case PROP_INITIATOR:
+        priv->initiator = g_value_get_uint (value);
+        break;
+      case PROP_TYPE:
+        priv->type = g_value_get_uint (value);
+        break;
+      case PROP_SERVICE:
+        priv->service = g_value_dup_string (value);
+        break;
+      case PROP_PARAMETERS:
+        priv->parameters = g_value_get_boxed (value);
+        break;
+      case PROP_STATE:
+        priv->state = g_value_get_uint (value);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+  }
+}
+
+static void
+tube_get_property (GObject *object,
+                   guint prop_id,
+                   GValue *value,
+                   GParamSpec *pspec)
+{
+  EmpathyTubePriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_ACCOUNT:
+        g_value_set_object (value, priv->account);
+        break;
+      case PROP_TP_CHAN:
+        g_value_set_object (value, priv->tp_chan);
+        break;
+      case PROP_ID:
+        g_value_set_uint (value, priv->id);
+        break;
+      case PROP_INITIATOR:
+        g_value_set_uint (value, priv->initiator);
+        break;
+      case PROP_TYPE:
+        g_value_set_uint (value, priv->type);
+        break;
+      case PROP_SERVICE:
+        g_value_set_string (value, priv->service);
+        break;
+      case PROP_PARAMETERS:
+        g_value_set_boxed (value, priv->parameters);
+        break;
+      case PROP_STATE:
+        g_value_set_uint (value, priv->state);
+        break;
+      case PROP_INITIATOR_CONTACT:
+        g_value_set_object (value, priv->initiator_contact);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+  }
+}
+
+static GObject *
+tube_constructor (GType type,
+                  guint n_props,
+                  GObjectConstructParam *props)
+{
+  GObject *self;
+  EmpathyTubePriv *priv;
+  EmpathyContactFactory *contact_factory;
+
+  self = G_OBJECT_CLASS (empathy_tube_parent_class)->constructor (type,
+      n_props, props);
+  priv = GET_PRIV (self);
+
+  priv->tubes_iface = tp_chan_get_interface (priv->tp_chan,
+      TELEPATHY_CHAN_IFACE_TUBES_QUARK);
+
+  g_assert (priv->initiator != 0);
+  contact_factory = empathy_contact_factory_new ();
+  priv->initiator_contact = empathy_contact_factory_get_from_handle (
+      contact_factory, priv->account, priv->initiator);
+  g_assert (priv->initiator_contact != NULL);
+
+  g_object_unref (contact_factory);
+
+  return self;
+}
+
+static void
+tube_finalize (GObject *object)
+{
+  EmpathyTubePriv *priv = GET_PRIV (object);
+
+  empathy_debug (DEBUG_DOMAIN, "Finalizing: %p", object);
+
+  if (priv->tp_chan)
+    {
+      g_object_unref (priv->tp_chan);
+    }
+
+  g_object_unref (priv->account);
+  g_object_unref (priv->initiator_contact);
+
+  G_OBJECT_CLASS (empathy_tube_parent_class)->finalize (object);
+}
+
+static void
+empathy_tube_class_init (EmpathyTubeClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->constructor = tube_constructor;
+  object_class->finalize = tube_finalize;
+  object_class->set_property = tube_set_property;
+  object_class->get_property = tube_get_property;
+
+  /* Construct-only properties */
+  g_object_class_install_property (object_class,
+           PROP_ACCOUNT,
+           g_param_spec_object ("account",
+                    "channel Account",
+                    "The account associated with the channel",
+                    MC_TYPE_ACCOUNT,
+                    G_PARAM_READWRITE |
+                    G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+           PROP_TP_CHAN,
+           g_param_spec_object ("tp-chan",
+                    "telepathy channel",
+                    "The media channel for the tubes",
+                    TELEPATHY_CHAN_TYPE,
+                    G_PARAM_READWRITE |
+                    G_PARAM_CONSTRUCT_ONLY));
+
+  g_object_class_install_property (object_class,
+      PROP_ID,
+      g_param_spec_uint (
+        "id",
+        "id",
+        "The ID of this tube",
+        0, G_MAXUINT, 0,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+      PROP_INITIATOR,
+      g_param_spec_uint (
+        "initiator",
+        "initiator",
+        "The handle of the initiator of this tube",
+        0, G_MAXUINT, 0,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+      PROP_TYPE,
+      g_param_spec_uint (
+        "type",
+        "type",
+        "The Tube_Type of this tube",
+        0, G_MAXUINT, 0,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+      PROP_SERVICE,
+      g_param_spec_string (
+        "service",
+        "service",
+        "The service of this tube",
+        NULL,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+      PROP_PARAMETERS,
+      g_param_spec_boxed (
+        "parameters",
+        "parameters",
+        "The parameters of this tube",
+        G_TYPE_HASH_TABLE,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+      PROP_STATE,
+      g_param_spec_uint (
+        "state",
+        "state",
+        "The Tube_State of this tube",
+        0, G_MAXUINT, 0,
+        G_PARAM_READWRITE |
+        G_PARAM_CONSTRUCT_ONLY |
+        G_PARAM_STATIC_NAME |
+        G_PARAM_STATIC_NICK |
+        G_PARAM_STATIC_BLURB));
+
+ g_object_class_install_property (object_class,
+     PROP_INITIATOR_CONTACT,
+     g_param_spec_object (
+       "initiator-contact",
+       "initiator channel",
+       "The EmpathyContact who initiated the tubes",
+       EMPATHY_TYPE_CONTACT,
+       G_PARAM_READABLE |
+       G_PARAM_STATIC_NAME |
+       G_PARAM_STATIC_NICK |
+       G_PARAM_STATIC_BLURB));
+
+  /* Signals */
+
+  g_type_class_add_private (klass, sizeof (EmpathyTubePriv));
+}
+
+static void
+empathy_tube_init (EmpathyTube *tubes)
+{
+}
+
+EmpathyTube * 
+empathy_tube_new (McAccount *account,
+                  TpChan *tp_chan,
+                  guint id,
+                  guint initiator,
+                  guint type,
+                  const gchar *service,
+                  GHashTable *parameters,
+                  guint state)
+{
+  return g_object_new (EMPATHY_TYPE_TUBE,
+      "account", account,
+      "tp-chan", tp_chan,
+      "id", id,
+      "initiator", initiator,
+      "type", type,
+      "service", service,
+      "parameters", parameters,
+      "state", state,
+      NULL);
+}
+
+void
+empathy_tube_accept (EmpathyTube *self)
+{
+  EmpathyTubePriv *priv = GET_PRIV (self);
+  GError *error = NULL;
+
+  g_print ("accept tube of type: %d id: %d\n", priv->type, priv->id);
+  /* TODO: use enum */
+  g_print ("tube ifaces %p\n", priv->tubes_iface);
+  if (priv->type == TP_TUBE_TYPE_DBUS)
+    {
+      gchar *addr;
+      tp_chan_type_tubes_accept_dbus_tube (priv->tubes_iface, priv->id, &addr,
+          NULL);
+      g_print ("accept d-bus tube. address: %s\n", addr);
+
+      g_free (addr);
+    }
+  else if (priv->type == TP_TUBE_TYPE_STREAM)
+    {
+      GValue unused = {0,};
+      GValue addr = {0,};
+      gchar *ip;
+      guint port;
+
+      /* dbus-glib is not happy if we don't initialize this */
+      g_value_init (&unused, G_TYPE_STRING);
+
+      if (!tp_chan_type_tubes_accept_stream_tube (priv->tubes_iface, priv->id,
+          TP_SOCKET_ADDRESS_TYPE_IPV4, TP_SOCKET_ACCESS_CONTROL_LOCALHOST,
+          &unused, &addr, &error))
+        {
+          g_error ("accept stream tubes failed: %s", error->message);
+          g_error_free (error);
+          return;
+        }
+
+      dbus_g_type_struct_get (&addr,
+          0, &ip,
+          1, &port,
+          G_MAXUINT);
+
+      g_print ("ip: %s port: %u\n", ip, port);
+
+      /* Service specific stuffs. That shouldn't be hardcoded */
+      if (strcmp (priv->service, "x-tetrinet") == 0)
+        {
+          gchar *argv[6];
+          gchar *port_str;
+
+          port_str = g_strdup_printf ("%u", port);
+
+          /* FIXME: crack path */
+          argv[0] = "/home/cassidy/gnome/gtetrinet-tubes/src/gtetrinet";
+          argv[1] = "-c";
+          argv[2] = ip;
+          argv[3] = "-P";
+          argv[4] = port_str;
+          argv[5] = NULL;
+
+          g_print ("launch tetrinet\n");
+          if (!g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, &error))
+            {
+              g_error ("Can't launch gtetrinet: %s\n", error->message);
+              g_error_free (error);
+            }
+
+          g_free (port_str);
+        }
+
+      g_free (ip);
+    }
+}
+
+void empathy_tube_decline (EmpathyTube *self)
+{
+  g_print ("decine tube\n");
+  /* TODO */
+}
Index: libempathy/empathy-tube.h
===================================================================
--- libempathy/empathy-tube.h	(révision 0)
+++ libempathy/empathy-tube.h	(révision 0)
@@ -0,0 +1,64 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ *
+ * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_TUBE_H__
+#define __EMPATHY_TUBE_H__
+
+#include <glib-object.h>
+
+#include <libtelepathy/tp-chan.h>
+#include <libtelepathy/tp-constants.h>
+
+#include <libmissioncontrol/mc-account.h>
+
+G_BEGIN_DECLS
+
+GType empathy_tube_get_type (void) G_GNUC_CONST;
+
+#define EMPATHY_TYPE_TUBE              (empathy_tube_get_type ())
+#define EMPATHY_TUBE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), EMPATHY_TYPE_TUBE, EmpathyTube))
+#define EMPATHY_TUBE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_TUBE, EmpathyTubeClass))
+#define EMPATHY_IS_TUBE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), EMPATHY_TYPE_TUBE))
+#define EMPATHY_IS_TUBE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_TUBE))
+#define EMPATHY_TUBE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), EMPATHY_TYPE_TUBE, EmpathyTubeClass))
+
+typedef struct _EmpathyTube EmpathyTube;
+typedef struct _EmpathyTubeClass EmpathyTubeClass;
+
+struct _EmpathyTube {
+  GObject parent;
+};
+
+struct _EmpathyTubeClass {
+  GObjectClass parent_class;
+};
+
+EmpathyTube *empathy_tube_new (McAccount *account, TpChan *tp_chan,
+    guint id, guint initiator, guint type, const gchar *service,
+    GHashTable *parameters, guint state);
+
+void empathy_tube_accept (EmpathyTube *tube);
+
+void empathy_tube_decline (EmpathyTube *tube);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_TUBE_H__ */
Index: libempathy/Makefile.am
===================================================================
--- libempathy/Makefile.am	(révision 387)
+++ libempathy/Makefile.am	(copie de travail)
@@ -35,6 +35,8 @@
 	empathy-tp-chatroom.c				\
 	empathy-tp-roomlist.c				\
 	empathy-tp-call.c				\
+	empathy-tp-tubes.c				\
+	empathy-tube.c				\
 	empathy-chandler.c				\
 	empathy-filter.c				\
 	empathy-idle.c					\
@@ -70,6 +72,8 @@
 	empathy-tp-chatroom.h			\
 	empathy-tp-roomlist.h			\
 	empathy-tp-call.h			\
+	empathy-tp-tubes.h			\
+	empathy-tube.h			\
 	empathy-chandler.h			\
 	empathy-filter.h			\
 	empathy-idle.h				\
