[Telepathy-commits] [telepathy-haze/master] Implement respawning for IM channels
Will Thompson
will.thompson at collabora.co.uk
Sun Mar 22 03:45:46 PDT 2009
---
src/im-channel-factory.c | 25 +++++++++++++++++++------
src/im-channel.c | 2 --
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/im-channel-factory.c b/src/im-channel-factory.c
index eb5fe54..23da76e 100644
--- a/src/im-channel-factory.c
+++ b/src/im-channel-factory.c
@@ -234,18 +234,31 @@ im_channel_closed_cb (HazeIMChannel *chan, gpointer user_data)
{
HazeImChannelFactory *self = HAZE_IM_CHANNEL_FACTORY (user_data);
TpHandle contact_handle;
+ guint really_destroyed;
tp_channel_manager_emit_channel_closed_for_object (self,
TP_EXPORTABLE_CHANNEL (chan));
if (self->priv->channels)
{
- g_object_get (chan, "handle", &contact_handle, NULL);
+ g_object_get (chan,
+ "handle", &contact_handle,
+ "channel-destroyed", &really_destroyed,
+ NULL);
- DEBUG ("removing channel with handle %d", contact_handle);
-
- g_hash_table_remove (self->priv->channels,
- GUINT_TO_POINTER (contact_handle));
+ if (really_destroyed)
+ {
+ DEBUG ("removing channel with handle %u", contact_handle);
+ g_hash_table_remove (self->priv->channels,
+ GUINT_TO_POINTER (contact_handle));
+ }
+ else
+ {
+ DEBUG ("reopening channel with handle %u due to pending messages",
+ contact_handle);
+ tp_channel_manager_emit_new_channel (self,
+ (TpExportableChannel *) chan, NULL);
+ }
}
}
diff --git a/src/im-channel.c b/src/im-channel.c
index 4230445..99dde5f 100644
--- a/src/im-channel.c
+++ b/src/im-channel.c
@@ -91,7 +91,6 @@ haze_im_channel_close (TpSvcChannel *iface,
goto out;
}
-#if 0
/* requires support from TpChannelManager */
if (tp_text_mixin_has_pending_messages ((GObject *) self, NULL))
{
@@ -111,7 +110,6 @@ haze_im_channel_close (TpSvcChannel *iface,
tp_text_mixin_set_rescued ((GObject *) self);
}
else
-#endif
{
purple_conversation_destroy (priv->conv);
priv->conv = NULL;
--
1.5.6.5
More information about the telepathy-commits
mailing list