aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-chatroom-manager.c22
-rw-r--r--libempathy/empathy-chatroom-manager.h4
2 files changed, 26 insertions, 0 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index d5513caf1..cf3b75331 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -632,6 +632,28 @@ empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
return NULL;
}
+EmpathyChatroom *
+empathy_chatroom_manager_ensure_chatroom (EmpathyChatroomManager *manager,
+ TpAccount *account,
+ const gchar *room,
+ const gchar *name)
+{
+ EmpathyChatroom *chatroom;
+
+ chatroom = empathy_chatroom_manager_find (manager, account, room);
+
+ if (chatroom) {
+ return g_object_ref(chatroom);
+ } else {
+ chatroom = empathy_chatroom_new_full (account,
+ room,
+ name,
+ FALSE);
+ empathy_chatroom_manager_add (manager, chatroom);
+ return chatroom;
+ }
+}
+
GList *
empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
TpAccount *account)
diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h
index 8ee2a897a..9a1de1828 100644
--- a/libempathy/empathy-chatroom-manager.h
+++ b/libempathy/empathy-chatroom-manager.h
@@ -62,6 +62,10 @@ void empathy_chatroom_manager_remove (EmpathyChatroomMa
EmpathyChatroom * empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
TpAccount *account,
const gchar *room);
+EmpathyChatroom * empathy_chatroom_manager_ensure_chatroom (EmpathyChatroomManager *manager,
+ TpAccount *account,
+ const gchar *room,
+ const gchar *name);
GList * empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
TpAccount *account);
guint empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,