aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/empathy-chat-window.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 94717f3c8..39711e2cd 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -828,19 +828,14 @@ chat_window_favorite_toggled_cb (GtkToggleAction *toggle_action,
account = empathy_chat_get_account (priv->current_chat);
room = empathy_chat_get_id (priv->current_chat);
- chatroom = empathy_chatroom_manager_find (priv->chatroom_manager,
- account, room);
-
- if (chatroom == NULL) {
- const gchar *name;
-
- name = empathy_chat_get_name (priv->current_chat);
- chatroom = empathy_chatroom_new_full (account, room, name, FALSE);
- empathy_chatroom_manager_add (priv->chatroom_manager, chatroom);
- g_object_unref (chatroom);
- }
+ chatroom = empathy_chatroom_manager_ensure_chatroom (
+ priv->chatroom_manager,
+ account,
+ room,
+ empathy_chat_get_name (priv->current_chat));
empathy_chatroom_set_favorite (chatroom, active);
+ g_object_unref(chatroom);
}
static void