aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2007-05-14 04:29:46 +0800
committerxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2007-05-14 04:29:46 +0800
commit2a0b78fa2cfb81504905438d333acdde094067e5 (patch)
tree318435ee27d45751c3a8c95112e7342f1b0b5909 /src
parent7dda1dfd0bb1b2c17e973b8f1137b2559ff5d9dd (diff)
downloadgsoc2013-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 'src')
-rw-r--r--src/empathy-chat-main.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/empathy-chat-main.c b/src/empathy-chat-main.c
index 2826e4b52..5c3478435 100644
--- a/src/empathy-chat-main.c
+++ b/src/empathy-chat-main.c
@@ -37,6 +37,7 @@
#include <libempathy/empathy-chandler.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-contact-list.h>
+#include <libempathy/empathy-tp-chat.h>
#include <libempathy-gtk/gossip-private-chat.h>
#define DEBUG_DOMAIN "ChatMain"
@@ -101,17 +102,38 @@ new_channel_cb (EmpathyChandler *chandler,
TpChan *tp_chan,
gpointer user_data)
{
+ MissionControl *mc;
+ McAccount *account;
+ GossipChat *chat;
+ gchar *id;
+
+ mc = gossip_mission_control_new ();
+ account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
+ id = empathy_tp_chat_build_id (account, tp_chan);
+
+ chat = gossip_chat_window_find_chat_by_id (id);
+ if (chat) {
+ /* The chat already exists */
+ if (!gossip_chat_is_connected (chat)) {
+ EmpathyTpChat *tp_chat;
+
+ /* The chat died, give him the new text channel */
+ tp_chat = empathy_tp_chat_new (account, tp_chan);
+ gossip_chat_set_tp_chat (chat, tp_chat);
+ g_object_unref (tp_chat);
+ }
+ gossip_chat_present (chat);
+
+ goto OUT;
+ }
+
if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
- MissionControl *mc;
- McAccount *account;
EmpathyContactManager *manager;
EmpathyContactList *list;
GossipContact *contact;
GossipPrivateChat *chat;
- /* We have a private chat channel */
- mc = gossip_mission_control_new ();
- account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
+ /* We have a new private chat channel */
manager = empathy_contact_manager_new ();
list = empathy_contact_manager_get_list (manager, account);
contact = empathy_contact_list_get_from_handle (list, tp_chan->handle);
@@ -126,12 +148,15 @@ new_channel_cb (EmpathyChandler *chandler,
gossip_chat_present (GOSSIP_CHAT (chat));
- g_object_unref (mc);
- g_object_unref (account);
g_object_unref (contact);
g_object_unref (chat);
g_object_unref (manager);
}
+
+OUT:
+ g_free (id);
+ g_object_unref (account);
+ g_object_unref (mc);
}
int