about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-02-14 22:28:55 +0000
committerJames Booth <boothj5@gmail.com>2016-02-14 22:28:55 +0000
commit41fe8c22b1f8c1cf666d42052cd73d59e40a2ed2 (patch)
tree3b53c1fbc2e5dc8c6daccf7fe7bb9f27d1c9d05a /src/ui
parentf887a35c0cd550a3c635630da2bd83bb7400b957 (diff)
downloadprofani-tty-41fe8c22b1f8c1cf666d42052cd73d59e40a2ed2.tar.gz
Added C plugin code from plugins branch
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/buffer.c6
-rw-r--r--src/ui/buffer.h2
-rw-r--r--src/ui/chatwin.c19
-rw-r--r--src/ui/console.c30
-rw-r--r--src/ui/core.c39
-rw-r--r--src/ui/inputwin.c6
-rw-r--r--src/ui/notifier.c35
-rw-r--r--src/ui/statusbar.c6
-rw-r--r--src/ui/titlebar.c2
-rw-r--r--src/ui/ui.h9
-rw-r--r--src/ui/win_types.h16
-rw-r--r--src/ui/window.c34
-rw-r--r--src/ui/window.h6
13 files changed, 135 insertions, 75 deletions
diff --git a/src/ui/buffer.c b/src/ui/buffer.c
index 0b9da448..c78f3390 100644
--- a/src/ui/buffer.c
+++ b/src/ui/buffer.c
@@ -32,7 +32,7 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -40,9 +40,9 @@
 #include <stdlib.h>
 
 #include <glib.h>
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
diff --git a/src/ui/buffer.h b/src/ui/buffer.h
index 0693d1ba..6e613ce6 100644
--- a/src/ui/buffer.h
+++ b/src/ui/buffer.h
@@ -35,7 +35,7 @@
 #ifndef UI_BUFFER_H
 #define UI_BUFFER_H
 
-#include "config.h"
+#include "prof_config.h"
 #include "config/theme.h"
 
 #include <glib.h>
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 1a87cbd8..45c36074 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -32,7 +32,7 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <string.h>
 #include <stdlib.h>
@@ -46,7 +46,8 @@
 #include "ui/ui.h"
 #include "ui/window.h"
 #include "ui/titlebar.h"
-#ifdef HAVE_LIBOTR
+#include "plugins/plugins.h"
+#ifdef PROF_HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
 
@@ -84,7 +85,7 @@ chatwin_receipt_received(ProfChatWin *chatwin, const char *const id)
     win_mark_received(win, id);
 }
 
-#ifdef HAVE_LIBOTR
+#ifdef PROF_HAVE_LIBOTR
 void
 chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted)
 {
@@ -234,6 +235,8 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
 {
     assert(chatwin != NULL);
 
+    char *plugin_message = plugins_pre_chat_message_display(chatwin->barejid, message);
+
     ProfWin *window = (ProfWin*)chatwin;
     int num = wins_get_num(window);
 
@@ -244,7 +247,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
 
     // currently viewing chat window with sender
     if (wins_is_current(window)) {
-        win_print_incoming_message(window, timestamp, display_name, message, enc_mode);
+        win_print_incoming_message(window, timestamp, display_name, plugin_message, enc_mode);
         title_bar_set_typing(FALSE);
         status_bar_active(num);
 
@@ -271,7 +274,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
             }
         }
 
-        win_print_incoming_message(window, timestamp, display_name, message, enc_mode);
+        win_print_incoming_message(window, timestamp, display_name, plugin_message, enc_mode);
     }
 
     if (prefs_get_boolean(PREF_BEEP)) {
@@ -279,10 +282,14 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
     }
 
     if (notify) {
-        notify_message(display_name, num, message);
+        notify_message(display_name, num, plugin_message);
     }
 
     free(display_name);
+
+    plugins_post_chat_message_display(chatwin->barejid, plugin_message);
+
+    free(plugin_message);
 }
 
 void
diff --git a/src/ui/console.c b/src/ui/console.c
index 8164ccf1..04232006 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -37,9 +37,9 @@
 #include <stdlib.h>
 #include <assert.h>
 
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
@@ -57,7 +57,7 @@
 #include "xmpp/xmpp.h"
 #include "xmpp/bookmark.h"
 
-#ifdef HAVE_GIT_VERSION
+#ifdef PROF_HAVE_GIT_VERSION
 #include "gitversion.h"
 #endif
 
@@ -82,7 +82,7 @@ void
 cons_debug(const char *const msg, ...)
 {
     ProfWin *console = wins_get_console();
-    if (strcmp(PACKAGE_STATUS, "development") == 0) {
+    if (strcmp(PROF_PACKAGE_STATUS, "development") == 0) {
         va_list arg;
         va_start(arg, msg);
         GString *fmt_msg = g_string_new(NULL);
@@ -416,18 +416,18 @@ cons_about(void)
         _cons_splash_logo();
     } else {
 
-        if (strcmp(PACKAGE_STATUS, "development") == 0) {
-#ifdef HAVE_GIT_VERSION
-            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
+        if (strcmp(PROF_PACKAGE_STATUS, "development") == 0) {
+#ifdef PROF_HAVE_GIT_VERSION
+            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev.%s.%s", PROF_PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
 #else
-            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev", PACKAGE_VERSION);
+            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev", PROF_PACKAGE_VERSION);
 #endif
         } else {
-            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %s", PACKAGE_VERSION);
+            win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %s", PROF_PACKAGE_VERSION);
         }
     }
 
-    win_vprint(console, '-', 0, NULL, 0, 0, "", "Copyright (C) 2012 - 2015 James Booth <%s>.", PACKAGE_BUGREPORT);
+    win_vprint(console, '-', 0, NULL, 0, 0, "", "Copyright (C) 2012 - 2015 James Booth <%s>.", PROF_PACKAGE_BUGREPORT);
     win_println(console, 0, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
     win_println(console, 0, "");
     win_println(console, 0, "This is free software; you are free to change and redistribute it.");
@@ -2304,14 +2304,14 @@ _cons_splash_logo(void)
     win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "|_|                                    (____/ ");
     win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "");
 
-    if (strcmp(PACKAGE_STATUS, "development") == 0) {
-#ifdef HAVE_GIT_VERSION
-        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
+    if (strcmp(PROF_PACKAGE_STATUS, "development") == 0) {
+#ifdef PROF_HAVE_GIT_VERSION
+        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev.%s.%s", PROF_PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
 #else
-        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev", PACKAGE_VERSION);
+        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev", PROF_PACKAGE_VERSION);
 #endif
     } else {
-        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %s", PACKAGE_VERSION);
+        win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %s", PROF_PACKAGE_VERSION);
     }
 }
 
diff --git a/src/ui/core.c b/src/ui/core.c
index 735dc03a..99861df0 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -32,9 +32,9 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
-#ifdef HAVE_GIT_VERSION
+#ifdef PROF_HAVE_GIT_VERSION
 #include "gitversion.h"
 #endif
 
@@ -44,13 +44,13 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#ifdef HAVE_LIBXSS
+#ifdef PROF_HAVE_LIBXSS
 #include <X11/extensions/scrnsaver.h>
 #endif
 #include <glib.h>
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
@@ -64,7 +64,7 @@
 #include "jid.h"
 #include "log.h"
 #include "muc.h"
-#ifdef HAVE_LIBOTR
+#ifdef PROF_HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
 #include "ui/ui.h"
@@ -74,13 +74,14 @@
 #include "ui/window.h"
 #include "window_list.h"
 #include "xmpp/xmpp.h"
+#include "plugins/plugins.h"
 
 static char *win_title;
 static int inp_size;
 static gboolean perform_resize = FALSE;
 static GTimer *ui_idle_time;
 
-#ifdef HAVE_LIBXSS
+#ifdef PROF_HAVE_LIBXSS
 static Display *display;
 #endif
 
@@ -104,7 +105,7 @@ ui_init(void)
     wins_init();
     notifier_initialise();
     cons_about();
-#ifdef HAVE_LIBXSS
+#ifdef PROF_HAVE_LIBXSS
     display = XOpenDisplay(0);
 #endif
     ui_idle_time = g_timer_new();
@@ -149,7 +150,7 @@ unsigned long
 ui_get_idle_time(void)
 {
 // if compiled with libxss, get the x sessions idle time
-#ifdef HAVE_LIBXSS
+#ifdef PROF_HAVE_LIBXSS
     XScreenSaverInfo *info = XScreenSaverAllocInfo();
     if (info && display) {
         XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
@@ -496,7 +497,7 @@ ui_close_connected_win(int index)
         } else if (window->type == WIN_CHAT) {
             ProfChatWin *chatwin = (ProfChatWin*) window;
             assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
-#ifdef HAVE_LIBOTR
+#ifdef PROF_HAVE_LIBOTR
             if (chatwin->is_otr) {
                 otr_end_session(chatwin->barejid);
             }
@@ -1325,3 +1326,21 @@ ui_show_software_version(const char *const jid, const char *const  presence,
         win_vprint(window, '-', 0, NULL, 0, 0, "", "OS      : %s", os);
     }
 }
+
+void
+ui_status_bar_inactive(const int win)
+{
+    status_bar_inactive(win);
+}
+
+void
+ui_status_bar_active(const int win)
+{
+    status_bar_active(win);
+}
+
+void
+ui_status_bar_new(const int win)
+{
+    status_bar_new(win);
+}
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index eef58b32..ec8a8825 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -33,7 +33,7 @@
  */
 
 #define _XOPEN_SOURCE_EXTENDED
-#include "config.h"
+#include "prof_config.h"
 
 #include <sys/select.h>
 #include <stdlib.h>
@@ -46,9 +46,9 @@
 #include <readline/readline.h>
 #include <readline/history.h>
 
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
diff --git a/src/ui/notifier.c b/src/ui/notifier.c
index 23d942fb..deec3889 100644
--- a/src/ui/notifier.c
+++ b/src/ui/notifier.c
@@ -31,14 +31,14 @@
  * source files in the program, then also delete it here.
  *
  */
-#include "config.h"
+#include "prof_config.h"
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <glib.h>
-#ifdef HAVE_LIBNOTIFY
+#ifdef PROF_HAVE_LIBNOTIFY
 #include <libnotify/notify.h>
 #endif
 #ifdef PLATFORM_CYGWIN
@@ -51,8 +51,6 @@
 #include "window_list.h"
 #include "config/preferences.h"
 
-static void _notify(const char *const message, int timeout, const char *const category);
-
 static GTimer *remind_timer;
 
 void
@@ -64,7 +62,7 @@ notifier_initialise(void)
 void
 notifier_uninit(void)
 {
-#ifdef HAVE_LIBNOTIFY
+#ifdef PROF_HAVE_LIBNOTIFY
     if (notify_is_initted()) {
         notify_uninit();
     }
@@ -78,7 +76,7 @@ notify_typing(const char *const name)
     char message[strlen(name) + 1 + 11];
     sprintf(message, "%s: typing...", name);
 
-    _notify(message, 10000, "Incoming message");
+    notify(message, 10000, "Incoming message");
 }
 
 void
@@ -92,7 +90,7 @@ notify_invite(const char *const from, const char *const room, const char *const
         g_string_append_printf(message, "\n\"%s\"", reason);
     }
 
-    _notify(message->str, 10000, "Incoming message");
+    notify(message->str, 10000, "Incoming message");
 
     g_string_free(message, TRUE);
 }
@@ -111,8 +109,7 @@ notify_message(const char *const name, int num, const char *const text)
         g_string_append_printf(message, "\n%s", text);
     }
 
-    _notify(message->str, 10000, "incoming message");
-
+    notify(message->str, 10000, "incoming message");
     g_string_free(message, TRUE);
 }
 
@@ -130,7 +127,7 @@ notify_room_message(const char *const nick, const char *const room, int num, con
         g_string_append_printf(message, "\n%s", text);
     }
 
-    _notify(message->str, 10000, "incoming message");
+    notify(message->str, 10000, "incoming message");
 
     g_string_free(message, TRUE);
 }
@@ -140,7 +137,7 @@ notify_subscription(const char *const from)
 {
     GString *message = g_string_new("Subscription request: \n");
     g_string_append(message, from);
-    _notify(message->str, 10000, "Incoming message");
+    notify(message->str, 10000, "Incomming message");
     g_string_free(message, TRUE);
 }
 
@@ -150,14 +147,14 @@ notify_remind(void)
     gdouble elapsed = g_timer_elapsed(remind_timer, NULL);
     gint remind_period = prefs_get_notify_remind();
     if (remind_period > 0 && elapsed >= remind_period) {
-        gboolean notify = wins_do_notify_remind();
+        gboolean donotify = wins_do_notify_remind();
         gint unread = wins_get_total_unread();
         gint open = muc_invites_count();
         gint subs = presence_sub_request_count();
 
         GString *text = g_string_new("");
 
-        if (notify && unread > 0) {
+        if (donotify && unread > 0) {
             if (unread == 1) {
                 g_string_append(text, "1 unread message");
             } else {
@@ -186,8 +183,8 @@ notify_remind(void)
             }
         }
 
-        if ((notify && unread > 0) || (open > 0) || (subs > 0)) {
-            _notify(text->str, 5000, "Incoming message");
+        if ((donotify && unread > 0) || (open > 0) || (subs > 0)) {
+            notify(text->str, 5000, "Incoming message");
         }
 
         g_string_free(text, TRUE);
@@ -196,10 +193,10 @@ notify_remind(void)
     }
 }
 
-static void
-_notify(const char *const message, int timeout, const char *const category)
+void
+notify(const char *const message, int timeout, const char *const category)
 {
-#ifdef HAVE_LIBNOTIFY
+#ifdef PROF_HAVE_LIBNOTIFY
     log_debug("Attempting notification: %s", message);
     if (notify_is_initted()) {
         log_debug("Reinitialising libnotify");
@@ -251,7 +248,7 @@ _notify(const char *const message, int timeout, const char *const category)
 
     Shell_NotifyIcon(NIM_MODIFY, &nid);
 #endif
-#ifdef HAVE_OSXNOTIFY
+#ifdef PROF_HAVE_OSXNOTIFY
     GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message '");
 
     char *escaped_single = str_replace(message, "'", "'\\''");
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index 5156aae2..9a690524 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -32,15 +32,15 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 5894e0ac..82d261de 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <assert.h>
 
-#include "config.h"
+#include "prof_config.h"
 
 #include "common.h"
 #include "config/theme.h"
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 8376cb90..c73eb359 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -35,12 +35,12 @@
 #ifndef UI_UI_H
 #define UI_UI_H
 
-#include "config.h"
+#include "prof_config.h"
 
 #include "command/commands.h"
 #include "ui/win_types.h"
 #include "muc.h"
-#ifdef HAVE_LIBOTR
+#ifdef PROF_HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
 
@@ -135,8 +135,7 @@ void chatwin_outgoing_carbon(ProfChatWin *chatwin, const char *const message);
 void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity);
 void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status);
 char* chatwin_get_string(ProfChatWin *chatwin);
-
-#ifdef HAVE_LIBOTR
+#ifdef PROF_HAVE_LIBOTR
 void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted);
 void chatwin_otr_unsecured(ProfChatWin *chatwin);
 void chatwin_otr_trust(ProfChatWin *chatwin);
@@ -343,6 +342,7 @@ ProfWin* win_create_chat(const char *const barejid);
 ProfWin* win_create_muc(const char *const roomjid);
 ProfWin* win_create_muc_config(const char *const title, DataForm *form);
 ProfWin* win_create_private(const char *const fulljid);
+ProfWin* win_create_plugin(const char *const tag);
 void win_update_virtual(ProfWin *window);
 void win_free(ProfWin *window);
 gboolean win_notify_remind(ProfWin *window);
@@ -372,6 +372,7 @@ void notify_message(const char *const name, int win, const char *const text);
 void notify_room_message(const char *const nick, const char *const room, int win, const char *const text);
 void notify_remind(void);
 void notify_invite(const char *const from, const char *const room, const char *const reason);
+void notify(const char *const message, int timeout, const char *const category);
 void notify_subscription(const char *const from);
 
 #endif
diff --git a/src/ui/win_types.h b/src/ui/win_types.h
index 54ded939..b71d7353 100644
--- a/src/ui/win_types.h
+++ b/src/ui/win_types.h
@@ -35,13 +35,13 @@
 #ifndef UI_WIN_TYPES_H
 #define UI_WIN_TYPES_H
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <wchar.h>
 #include <glib.h>
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
@@ -55,6 +55,7 @@
 #define PROFPRIVATEWIN_MEMCHECK     77437483
 #define PROFCONFWIN_MEMCHECK        64334685
 #define PROFXMLWIN_MEMCHECK         87333463
+#define PROFPLUGINWIN_MEMCHECK      43434777
 
 typedef enum {
     LAYOUT_SIMPLE,
@@ -86,7 +87,8 @@ typedef enum {
     WIN_MUC,
     WIN_MUC_CONFIG,
     WIN_PRIVATE,
-    WIN_XML
+    WIN_XML,
+    WIN_PLUGIN
 } win_type_t;
 
 typedef struct prof_win_t {
@@ -143,4 +145,10 @@ typedef struct prof_xml_win_t {
     unsigned long memcheck;
 } ProfXMLWin;
 
+typedef struct prof_plugin_win_t {
+    ProfWin super;
+    char *tag;
+    unsigned long memcheck;
+} ProfPluginWin;
+
 #endif
diff --git a/src/ui/window.c b/src/ui/window.c
index 66fcc334..50719d44 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -32,7 +32,7 @@
  *
  */
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -41,9 +41,9 @@
 #include <wchar.h>
 
 #include <glib.h>
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
@@ -237,6 +237,20 @@ win_create_xmlconsole(void)
     return &new_win->window;
 }
 
+ProfWin*
+win_create_plugin(const char *const tag)
+{
+    ProfPluginWin *new_win = malloc(sizeof(ProfPluginWin));
+    new_win->super.type = WIN_PLUGIN;
+    new_win->super.layout = _win_create_simple_layout();
+
+    new_win->tag = strdup(tag);
+
+    new_win->memcheck = PROFPLUGINWIN_MEMCHECK;
+
+    return &new_win->super;
+}
+
 char*
 win_get_title(ProfWin *window)
 {
@@ -287,6 +301,11 @@ win_get_title(ProfWin *window)
     if (window->type == WIN_XML) {
         return strdup(XML_WIN_TITLE);
     }
+    if (window->type == WIN_PLUGIN) {
+        ProfPluginWin *pluginwin = (ProfPluginWin*) window;
+        assert(pluginwin->memcheck == PROFPLUGINWIN_MEMCHECK);
+        return strdup(pluginwin->tag);
+    }
 
     return NULL;
 }
@@ -327,6 +346,15 @@ win_get_string(ProfWin *window)
             ProfXMLWin *xmlwin = (ProfXMLWin*)window;
             return xmlwin_get_string(xmlwin);
         }
+        case WIN_PLUGIN:
+        {
+            ProfPluginWin *pluginwin = (ProfPluginWin*)window;
+            GString *gstring = g_string_new("");
+            g_string_append_printf(gstring, "%s plugin", pluginwin->tag);
+            char *res = gstring->str;
+            g_string_free(gstring, FALSE);
+            return res;
+        }
         default:
             return NULL;
     }
diff --git a/src/ui/window.h b/src/ui/window.h
index f5c6aada..6f5a5e32 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -35,7 +35,7 @@
 #ifndef UI_WINDOW_H
 #define UI_WINDOW_H
 
-#include "config.h"
+#include "prof_config.h"
 
 #include <wchar.h>
 
@@ -46,9 +46,9 @@
 #include "xmpp/xmpp.h"
 #include "chat_state.h"
 
-#ifdef HAVE_NCURSESW_NCURSES_H
+#ifdef PROF_HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
-#elif HAVE_NCURSES_H
+#elif PROF_HAVE_NCURSES_H
 #include <ncurses.h>
 #endif