about summary refs log tree commit diff stats
path: root/src/window_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window_list.c')
-rw-r--r--src/window_list.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/window_list.c b/src/window_list.c
index 0dbaab85..32f9b59c 100644
--- a/src/window_list.c
+++ b/src/window_list.c
@@ -32,7 +32,7 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <string.h>
 #include <assert.h>
@@ -201,6 +201,27 @@ wins_get_private(const char *const fulljid)
     return NULL;
 }
 
+ProfPluginWin*
+wins_get_plugin(const char *const tag)
+{
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
+
+    while (curr) {
+        ProfWin *window = curr->data;
+        if (window->type == WIN_PLUGIN) {
+            ProfPluginWin *pluginwin = (ProfPluginWin*)window;
+            if (g_strcmp0(pluginwin->tag, tag) == 0) {
+                return pluginwin;
+            }
+        }
+        curr = g_list_next(curr);
+    }
+
+    g_list_free(values);
+    return NULL;
+}
+
 GList*
 wins_get_private_chats(const char *const roomjid)
 {
@@ -614,6 +635,17 @@ wins_new_private(const char *const fulljid)
     return newwin;
 }
 
+ProfWin *
+wins_new_plugin(const char * const tag)
+{
+    GList *keys = g_hash_table_get_keys(windows);
+    int result = get_next_available_win_num(keys);
+    ProfWin *new = win_create_plugin(tag);
+    g_hash_table_insert(windows, GINT_TO_POINTER(result), new);
+    g_list_free(keys);
+    return new;
+}
+
 gboolean
 wins_do_notify_remind(void)
 {