]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/gossip-chat-window.c
When a new text channel arrives, check if there is no existing GossipChat
[empathy.git] / libempathy-gtk / gossip-chat-window.c
index 62ace37b4bf49a8ac895e32ed230954f13a01ea3..fb112379be827e5b2e5dd958408ae64bb6b07625 100644 (file)
@@ -1874,3 +1874,31 @@ gossip_chat_window_has_focus (GossipChatWindow *window)
 
        return has_focus;
 }
+
+GossipChat *
+gossip_chat_window_find_chat_by_id (const gchar *id)
+{
+       GList *l;
+
+       for (l = chat_windows; l; l = l->next) {
+               GossipChatWindowPriv *priv;
+               GossipChatWindow     *window;
+               GList                *ll;
+
+               window = l->data;
+               priv = GET_PRIV (window);
+
+               for (ll = priv->chats; ll; ll = ll->next) {
+                       GossipChat *chat;
+
+                       chat = ll->data;
+
+                       if (strcmp (id, gossip_chat_get_id (chat)) == 0) {
+                               return chat;
+                       }
+               }
+       }
+
+       return NULL;
+}
+