aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-chat.c6
-rw-r--r--libempathy-gtk/empathy-chat.h2
-rw-r--r--src/empathy.c27
3 files changed, 10 insertions, 25 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 9c6b61d27..082f33c92 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1281,6 +1281,12 @@ empathy_chat_init (EmpathyChat *chat)
NULL);
}
+EmpathyChat *
+empathy_chat_new (EmpathyTpChat *tp_chat)
+{
+ return g_object_new (EMPATHY_TYPE_CHAT, "tp-chat", tp_chat, NULL);
+}
+
gboolean
empathy_chat_get_is_command (const gchar *str)
{
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 113c285e0..e0b16ff3b 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -64,7 +64,7 @@ struct _EmpathyChatClass {
};
GType empathy_chat_get_type (void);
-
+EmpathyChat * empathy_chat_new (EmpathyTpChat *tp_chat);
EmpathyChatView * empathy_chat_get_view (EmpathyChat *chat);
void empathy_chat_clear (EmpathyChat *chat);
void empathy_chat_scroll_down (EmpathyChat *chat);
diff --git a/src/empathy.c b/src/empathy.c
index 95c290ca7..e5d0fc387 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -45,8 +45,6 @@
#include <libempathy-gtk/empathy-conf.h>
#include <libempathy-gtk/empathy-chat.h>
-#include <libempathy-gtk/empathy-private-chat.h>
-#include <libempathy-gtk/empathy-group-chat.h>
#include "empathy-main-window.h"
#include "empathy-status-icon.h"
@@ -79,11 +77,7 @@ new_text_channel_cb (EmpathyChandler *chandler,
/* The chat already exists */
if (!empathy_chat_is_connected (chat)) {
/* The chat died, give him the new text channel */
- if (empathy_chat_is_group_chat (chat)) {
- tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
- } else {
- tp_chat = empathy_tp_chat_new (account, tp_chan);
- }
+ tp_chat = empathy_tp_chat_new (account, tp_chan, TRUE);
empathy_chat_set_tp_chat (chat, tp_chat);
g_object_unref (tp_chat);
}
@@ -93,23 +87,8 @@ new_text_channel_cb (EmpathyChandler *chandler,
return;
}
- if (tp_chan->handle_type == TP_HANDLE_TYPE_CONTACT) {
- /* We have a new private chat channel */
- tp_chat = empathy_tp_chat_new (account, tp_chan);
- chat = EMPATHY_CHAT (empathy_private_chat_new (tp_chat));
- }
- else if (tp_chan->handle_type == TP_HANDLE_TYPE_ROOM) {
- /* We have a new group chat channel */
- tp_chat = EMPATHY_TP_CHAT (empathy_tp_chatroom_new (account, tp_chan));
- chat = EMPATHY_CHAT (empathy_group_chat_new (EMPATHY_TP_CHATROOM (tp_chat)));
- } else {
- empathy_debug (DEBUG_DOMAIN,
- "Unknown handle type (%d) for Text channel",
- tp_chan->handle_type);
- g_object_unref (account);
- return;
- }
-
+ tp_chat = empathy_tp_chat_new (account, tp_chan, TRUE);
+ chat = empathy_chat_new (tp_chat);
empathy_chat_window_present_chat (chat);
g_object_unref (chat);