[Telepathy-commits] [telepathy-salut/master] im-channel: add a closed attribute so we can fire the Closed signal even if the channel wasn't connected

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Nov 26 06:57:31 PST 2008


---
 src/salut-im-channel.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/salut-im-channel.c b/src/salut-im-channel.c
index 30b4579..70573da 100644
--- a/src/salut-im-channel.c
+++ b/src/salut-im-channel.c
@@ -123,6 +123,7 @@ struct _SalutImChannelPrivate
   /* Outcoming and incoming message queues */
   GQueue *out_queue;
   ChannelState state;
+  gboolean closed;
 };
 
 #define SALUT_IM_CHANNEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -143,12 +144,15 @@ salut_im_channel_do_close (SalutImChannel *self)
   SalutImChannelPrivate *priv = SALUT_IM_CHANNEL_GET_PRIVATE (self);
   ChannelState oldstate = priv->state;
 
+  if (priv->closed)
+    return;
+  priv->closed = TRUE;
+
   priv->state = CHANNEL_NOT_CONNECTED;
 
   switch (oldstate)
     {
       case CHANNEL_NOT_CONNECTED:
-        /* FIXME return an error ? */
         break;
       case CHANNEL_CONNECTING:
         break;
@@ -527,8 +531,7 @@ salut_im_channel_dispose (GObject *object)
   if (priv->initiator != 0)
     tp_handle_unref (handle_repo, priv->initiator);
 
-  if (priv->state != CHANNEL_NOT_CONNECTED)
-    salut_im_channel_do_close (self);
+  salut_im_channel_do_close (self);
 
   if (priv->xmpp_connection)
     {
-- 
1.5.6.5




More information about the Telepathy-commits mailing list