diff options
author | xclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4> | 2007-05-14 04:29:46 +0800 |
---|---|---|
committer | xclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4> | 2007-05-14 04:29:46 +0800 |
commit | 2a0b78fa2cfb81504905438d333acdde094067e5 (patch) | |
tree | 318435ee27d45751c3a8c95112e7342f1b0b5909 /libempathy/empathy-tp-chat.c | |
parent | 7dda1dfd0bb1b2c17e973b8f1137b2559ff5d9dd (diff) | |
download | gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar.gz gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar.bz2 gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar.lz gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar.xz gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.tar.zst gsoc2013-empathy-2a0b78fa2cfb81504905438d333acdde094067e5.zip |
2006-05-13 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/gossip-chat-window.c:
* libempathy-gtk/gossip-chat-window.h:
* src/empathy-chat-main.c:
* libempathy/empathy-tp-chat.c:
* libempathy/empathy-tp-chat.h: When a new text channel arrives,
check
if there is no existing GossipChat object for it.
git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@56 4ee84921-47dd-4033-b63a-18d7a039a3e4
Diffstat (limited to 'libempathy/empathy-tp-chat.c')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 2e5444fb1..58950f606 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -386,11 +386,7 @@ empathy_tp_chat_set_state (EmpathyTpChat *chat, const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat) { - EmpathyTpChatPriv *priv; - TpConn *tp_conn; - GArray *handles; - gchar **names; - GError *error = NULL; + EmpathyTpChatPriv *priv; g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), NULL); @@ -400,12 +396,33 @@ empathy_tp_chat_get_id (EmpathyTpChat *chat) return priv->id; } - tp_conn = mission_control_get_connection (priv->mc, priv->account, NULL); - handles = g_array_new (FALSE, FALSE, sizeof (guint)); - g_array_append_val (handles, priv->tp_chan->handle); + priv->id = empathy_tp_chat_build_id (priv->account, priv->tp_chan); + + return priv->id; +} +gchar * +empathy_tp_chat_build_id (McAccount *account, + TpChan *tp_chan) +{ + MissionControl *mc; + TpConn *tp_conn; + GArray *handles; + gchar **names; + gchar *id; + GError *error = NULL; + + g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); + g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); + + mc = gossip_mission_control_new (); + tp_conn = mission_control_get_connection (mc, account, NULL); + g_object_unref (mc); + + handles = g_array_new (FALSE, FALSE, sizeof (guint)); + g_array_append_val (handles, tp_chan->handle); if (!tp_conn_inspect_handles (DBUS_G_PROXY (tp_conn), - priv->tp_chan->handle_type, + tp_chan->handle_type, handles, &names, &error)) { @@ -420,14 +437,14 @@ empathy_tp_chat_get_id (EmpathyTpChat *chat) } /* A handle name is unique only for a specific account */ - priv->id = g_strdup_printf ("%s/%s", - mc_account_get_unique_name (priv->account), - *names); + id = g_strdup_printf ("%s/%s", + mc_account_get_unique_name (account), + *names); g_strfreev (names); g_object_unref (tp_conn); - return priv->id; + return id; } static void |