about summary refs log tree commit diff stats
path: root/src/ui/window_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/window_list.c')
-rw-r--r--src/ui/window_list.c370
1 files changed, 188 insertions, 182 deletions
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index b1ba4e02..3972fadb 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -36,9 +36,9 @@
 
 #include "config.h"
 
+#include <string.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <string.h>
 
 #include <glib.h>
 
@@ -46,26 +46,26 @@
 #include "config/preferences.h"
 #include "config/theme.h"
 #include "plugins/plugins.h"
-#include "tools/http_upload.h"
 #include "ui/ui.h"
 #include "ui/window_list.h"
-#include "xmpp/roster_list.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/roster_list.h"
+#include "tools/http_upload.h"
 
-static GHashTable* windows;
+static GHashTable *windows;
 static int current;
 static Autocomplete wins_ac;
 static Autocomplete wins_close_ac;
 
 static int _wins_cmp_num(gconstpointer a, gconstpointer b);
-static int _wins_get_next_available_num(GList* used);
+static int _wins_get_next_available_num(GList *used);
 
 void
 wins_init(void)
 {
     windows = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)win_free);
 
-    ProfWin* console = win_create_console();
+    ProfWin *console = win_create_console();
     g_hash_table_insert(windows, GINT_TO_POINTER(1), console);
 
     current = 1;
@@ -85,22 +85,22 @@ wins_get_console(void)
 }
 
 gboolean
-wins_chat_exists(const char* const barejid)
+wins_chat_exists(const char *const barejid)
 {
-    ProfChatWin* chatwin = wins_get_chat(barejid);
+    ProfChatWin *chatwin = wins_get_chat(barejid);
     return (chatwin != NULL);
 }
 
 ProfChatWin*
-wins_get_chat(const char* const barejid)
+wins_get_chat(const char *const barejid)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_CHAT) {
-            ProfChatWin* chatwin = (ProfChatWin*)window;
+            ProfChatWin *chatwin = (ProfChatWin*)window;
             if (g_strcmp0(chatwin->barejid, barejid) == 0) {
                 g_list_free(values);
                 return chatwin;
@@ -114,7 +114,7 @@ wins_get_chat(const char* const barejid)
 }
 
 static gint
-_cmp_unsubscribed_wins(ProfChatWin* a, ProfChatWin* b)
+_cmp_unsubscribed_wins(ProfChatWin *a, ProfChatWin *b)
 {
     return g_strcmp0(a->barejid, b->barejid);
 }
@@ -122,14 +122,14 @@ _cmp_unsubscribed_wins(ProfChatWin* a, ProfChatWin* b)
 GList*
 wins_get_chat_unsubscribed(void)
 {
-    GList* result = NULL;
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *result = NULL;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_CHAT) {
-            ProfChatWin* chatwin = (ProfChatWin*)window;
+            ProfChatWin *chatwin = (ProfChatWin*)window;
             PContact contact = roster_get_contact(chatwin->barejid);
             if (contact == NULL) {
                 result = g_list_insert_sorted(result, chatwin, (GCompareFunc)_cmp_unsubscribed_wins);
@@ -143,15 +143,15 @@ wins_get_chat_unsubscribed(void)
 }
 
 ProfConfWin*
-wins_get_conf(const char* const roomjid)
+wins_get_conf(const char *const roomjid)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_CONFIG) {
-            ProfConfWin* confwin = (ProfConfWin*)window;
+            ProfConfWin *confwin = (ProfConfWin*)window;
             if (g_strcmp0(confwin->roomjid, roomjid) == 0) {
                 g_list_free(values);
                 return confwin;
@@ -165,15 +165,15 @@ wins_get_conf(const char* const roomjid)
 }
 
 ProfMucWin*
-wins_get_muc(const char* const roomjid)
+wins_get_muc(const char *const roomjid)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_MUC) {
-            ProfMucWin* mucwin = (ProfMucWin*)window;
+            ProfMucWin *mucwin = (ProfMucWin*)window;
             if (g_strcmp0(mucwin->roomjid, roomjid) == 0) {
                 g_list_free(values);
                 return mucwin;
@@ -187,15 +187,15 @@ wins_get_muc(const char* const roomjid)
 }
 
 ProfPrivateWin*
-wins_get_private(const char* const fulljid)
+wins_get_private(const char *const fulljid)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_PRIVATE) {
-            ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+            ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
             if (g_strcmp0(privatewin->fulljid, fulljid) == 0) {
                 g_list_free(values);
                 return privatewin;
@@ -209,15 +209,15 @@ wins_get_private(const char* const fulljid)
 }
 
 ProfPluginWin*
-wins_get_plugin(const char* const tag)
+wins_get_plugin(const char *const tag)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_PLUGIN) {
-            ProfPluginWin* pluginwin = (ProfPluginWin*)window;
+            ProfPluginWin *pluginwin = (ProfPluginWin*)window;
             if (g_strcmp0(pluginwin->tag, tag) == 0) {
                 g_list_free(values);
                 return pluginwin;
@@ -231,9 +231,9 @@ wins_get_plugin(const char* const tag)
 }
 
 void
-wins_close_plugin(char* tag)
+wins_close_plugin(char *tag)
 {
-    ProfWin* toclose = wins_get_by_string(tag);
+    ProfWin *toclose = wins_get_by_string(tag);
     if (toclose == NULL) {
         return;
     }
@@ -245,18 +245,18 @@ wins_close_plugin(char* tag)
 }
 
 GList*
-wins_get_private_chats(const char* const roomjid)
+wins_get_private_chats(const char *const roomjid)
 {
-    GList* result = NULL;
-    GString* prefix = g_string_new(roomjid);
+    GList *result = NULL;
+    GString *prefix = g_string_new(roomjid);
     g_string_append(prefix, "/");
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_PRIVATE) {
-            ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+            ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
             if (roomjid == NULL || g_str_has_prefix(privatewin->fulljid, prefix->str)) {
                 result = g_list_append(result, privatewin);
             }
@@ -270,15 +270,15 @@ wins_get_private_chats(const char* const roomjid)
 }
 
 void
-wins_private_nick_change(const char* const roomjid, const char* const oldnick, const char* const newnick)
+wins_private_nick_change(const char *const roomjid, const char *const oldnick, const char *const newnick)
 {
-    Jid* oldjid = jid_create_from_bare_and_resource(roomjid, oldnick);
+    Jid *oldjid = jid_create_from_bare_and_resource(roomjid, oldnick);
 
-    ProfPrivateWin* privwin = wins_get_private(oldjid->fulljid);
+    ProfPrivateWin *privwin = wins_get_private(oldjid->fulljid);
     if (privwin) {
         free(privwin->fulljid);
 
-        Jid* newjid = jid_create_from_bare_and_resource(roomjid, newnick);
+        Jid *newjid = jid_create_from_bare_and_resource(roomjid, newnick);
         privwin->fulljid = strdup(newjid->fulljid);
         win_println((ProfWin*)privwin, THEME_THEM, "!", "** %s is now known as %s.", oldjid->resourcepart, newjid->resourcepart);
 
@@ -294,9 +294,9 @@ wins_private_nick_change(const char* const roomjid, const char* const oldnick, c
 }
 
 void
-wins_change_nick(const char* const barejid, const char* const oldnick, const char* const newnick)
+wins_change_nick(const char *const barejid, const char *const oldnick, const char *const newnick)
 {
-    ProfChatWin* chatwin = wins_get_chat(barejid);
+    ProfChatWin *chatwin = wins_get_chat(barejid);
     if (chatwin) {
         if (oldnick) {
             autocomplete_remove(wins_ac, oldnick);
@@ -308,9 +308,9 @@ wins_change_nick(const char* const barejid, const char* const oldnick, const cha
 }
 
 void
-wins_remove_nick(const char* const barejid, const char* const oldnick)
+wins_remove_nick(const char *const barejid, const char *const oldnick)
 {
-    ProfChatWin* chatwin = wins_get_chat(barejid);
+    ProfChatWin *chatwin = wins_get_chat(barejid);
     if (chatwin) {
         if (oldnick) {
             autocomplete_remove(wins_ac, oldnick);
@@ -338,23 +338,23 @@ wins_get_nums(void)
 void
 wins_set_current_by_num(int i)
 {
-    ProfWin* window = g_hash_table_lookup(windows, GINT_TO_POINTER(i));
+    ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(i));
     if (window) {
         current = i;
         if (window->type == WIN_CHAT) {
-            ProfChatWin* chatwin = (ProfChatWin*)window;
+            ProfChatWin *chatwin = (ProfChatWin*) window;
             assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
             chatwin->unread = 0;
             plugins_on_chat_win_focus(chatwin->barejid);
         } else if (window->type == WIN_MUC) {
-            ProfMucWin* mucwin = (ProfMucWin*)window;
+            ProfMucWin *mucwin = (ProfMucWin*) window;
             assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
             mucwin->unread = 0;
             mucwin->unread_mentions = FALSE;
             mucwin->unread_triggers = FALSE;
             plugins_on_room_win_focus(mucwin->roomjid);
         } else if (window->type == WIN_PRIVATE) {
-            ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+            ProfPrivateWin *privatewin = (ProfPrivateWin*) window;
             privatewin->unread = 0;
         }
     }
@@ -367,45 +367,45 @@ wins_get_by_num(int i)
 }
 
 ProfWin*
-wins_get_by_string(const char* str)
+wins_get_by_string(const char *str)
 {
     if (g_strcmp0(str, "console") == 0) {
-        ProfWin* conswin = wins_get_console();
+        ProfWin *conswin = wins_get_console();
         return conswin;
     }
 
     if (g_strcmp0(str, "xmlconsole") == 0) {
-        ProfXMLWin* xmlwin = wins_get_xmlconsole();
-        return (ProfWin*)xmlwin;
+        ProfXMLWin *xmlwin = wins_get_xmlconsole();
+            return (ProfWin*)xmlwin;
     }
 
-    ProfChatWin* chatwin = wins_get_chat(str);
+    ProfChatWin *chatwin = wins_get_chat(str);
     if (chatwin) {
         return (ProfWin*)chatwin;
     }
 
     jabber_conn_status_t conn_status = connection_get_status();
     if (conn_status == JABBER_CONNECTED) {
-        char* barejid = roster_barejid_from_name(str);
+        char *barejid = roster_barejid_from_name(str);
         if (barejid) {
-            ProfChatWin* chatwin = wins_get_chat(barejid);
+            ProfChatWin *chatwin = wins_get_chat(barejid);
             if (chatwin) {
                 return (ProfWin*)chatwin;
             }
         }
     }
 
-    ProfMucWin* mucwin = wins_get_muc(str);
+    ProfMucWin *mucwin = wins_get_muc(str);
     if (mucwin) {
         return (ProfWin*)mucwin;
     }
 
-    ProfPrivateWin* privwin = wins_get_private(str);
+    ProfPrivateWin *privwin = wins_get_private(str);
     if (privwin) {
         return (ProfWin*)privwin;
     }
 
-    ProfPluginWin* pluginwin = wins_get_plugin(str);
+    ProfPluginWin *pluginwin = wins_get_plugin(str);
     if (pluginwin) {
         return (ProfWin*)pluginwin;
     }
@@ -417,9 +417,9 @@ ProfWin*
 wins_get_next(void)
 {
     // get and sort win nums
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     keys = g_list_sort(keys, _wins_cmp_num);
-    GList* curr = keys;
+    GList *curr = keys;
 
     // find our place in the list
     while (curr) {
@@ -435,7 +435,7 @@ wins_get_next(void)
         int next = GPOINTER_TO_INT(curr->data);
         g_list_free(keys);
         return wins_get_by_num(next);
-        // otherwise return the first window (console)
+    // otherwise return the first window (console)
     } else {
         g_list_free(keys);
         return wins_get_console();
@@ -446,9 +446,9 @@ ProfWin*
 wins_get_previous(void)
 {
     // get and sort win nums
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     keys = g_list_sort(keys, _wins_cmp_num);
-    GList* curr = keys;
+    GList *curr = keys;
 
     // find our place in the list
     while (curr) {
@@ -464,7 +464,7 @@ wins_get_previous(void)
         int previous = GPOINTER_TO_INT(curr->data);
         g_list_free(keys);
         return wins_get_by_num(previous);
-        // otherwise return the last window
+    // otherwise return the last window
     } else {
         int new_num = GPOINTER_TO_INT(g_list_last(keys)->data);
         g_list_free(keys);
@@ -473,14 +473,14 @@ wins_get_previous(void)
 }
 
 int
-wins_get_num(ProfWin* window)
+wins_get_num(ProfWin *window)
 {
-    GList* keys = g_hash_table_get_keys(windows);
-    GList* curr = keys;
+    GList *keys = g_hash_table_get_keys(windows);
+    GList *curr = keys;
 
     while (curr) {
         gconstpointer num_p = curr->data;
-        ProfWin* curr_win = g_hash_table_lookup(windows, num_p);
+        ProfWin *curr_win = g_hash_table_lookup(windows, num_p);
         if (curr_win == window) {
             g_list_free(keys);
             return GPOINTER_TO_INT(num_p);
@@ -507,11 +507,11 @@ wins_close_by_num(int i)
         // go to console if closing current window
         if (i == current) {
             current = 1;
-            ProfWin* window = wins_get_current();
+            ProfWin *window = wins_get_current();
             win_update_virtual(window);
         }
 
-        ProfWin* window = wins_get_by_num(i);
+        ProfWin *window = wins_get_by_num(i);
         if (window) {
             // cancel upload proccesses of this window
             http_upload_cancel_processes(window);
@@ -519,7 +519,7 @@ wins_close_by_num(int i)
             switch (window->type) {
             case WIN_CHAT:
             {
-                ProfChatWin* chatwin = (ProfChatWin*)window;
+                ProfChatWin *chatwin = (ProfChatWin*)window;
                 autocomplete_remove(wins_ac, chatwin->barejid);
                 autocomplete_remove(wins_close_ac, chatwin->barejid);
 
@@ -539,7 +539,7 @@ wins_close_by_num(int i)
             }
             case WIN_MUC:
             {
-                ProfMucWin* mucwin = (ProfMucWin*)window;
+                ProfMucWin *mucwin = (ProfMucWin*)window;
                 autocomplete_remove(wins_ac, mucwin->roomjid);
                 autocomplete_remove(wins_close_ac, mucwin->roomjid);
 
@@ -551,7 +551,7 @@ wins_close_by_num(int i)
             }
             case WIN_PRIVATE:
             {
-                ProfPrivateWin* privwin = (ProfPrivateWin*)window;
+                ProfPrivateWin *privwin = (ProfPrivateWin*)window;
                 autocomplete_remove(wins_ac, privwin->fulljid);
                 autocomplete_remove(wins_close_ac, privwin->fulljid);
                 autocomplete_free(window->urls_ac);
@@ -565,7 +565,7 @@ wins_close_by_num(int i)
             }
             case WIN_PLUGIN:
             {
-                ProfPluginWin* pluginwin = (ProfPluginWin*)window;
+                ProfPluginWin *pluginwin = (ProfPluginWin*)window;
                 plugins_close_win(pluginwin->plugin_name, pluginwin->tag);
                 autocomplete_remove(wins_ac, pluginwin->tag);
                 autocomplete_remove(wins_close_ac, pluginwin->tag);
@@ -583,9 +583,9 @@ wins_close_by_num(int i)
 }
 
 gboolean
-wins_is_current(ProfWin* window)
+wins_is_current(ProfWin *window)
 {
-    ProfWin* current_window = wins_get_current();
+    ProfWin *current_window = wins_get_current();
 
     if (current_window == window) {
         return TRUE;
@@ -597,10 +597,10 @@ wins_is_current(ProfWin* window)
 ProfWin*
 wins_new_xmlconsole(void)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_xmlconsole();
+    ProfWin *newwin = win_create_xmlconsole();
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
     autocomplete_add(wins_ac, "xmlconsole");
     autocomplete_add(wins_close_ac, "xmlconsole");
@@ -608,12 +608,12 @@ wins_new_xmlconsole(void)
 }
 
 ProfWin*
-wins_new_chat(const char* const barejid)
+wins_new_chat(const char *const barejid)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_chat(barejid);
+    ProfWin *newwin = win_create_chat(barejid);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
 
     autocomplete_add(wins_ac, barejid);
@@ -632,12 +632,12 @@ wins_new_chat(const char* const barejid)
 }
 
 ProfWin*
-wins_new_muc(const char* const roomjid)
+wins_new_muc(const char *const roomjid)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_muc(roomjid);
+    ProfWin *newwin = win_create_muc(roomjid);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
     autocomplete_add(wins_ac, roomjid);
     autocomplete_add(wins_close_ac, roomjid);
@@ -647,24 +647,24 @@ wins_new_muc(const char* const roomjid)
 }
 
 ProfWin*
-wins_new_config(const char* const roomjid, DataForm* form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void* userdata)
+wins_new_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void *userdata)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_config(roomjid, form, submit, cancel, userdata);
+    ProfWin *newwin = win_create_config(roomjid, form, submit, cancel, userdata);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
 
     return newwin;
 }
 
 ProfWin*
-wins_new_private(const char* const fulljid)
+wins_new_private(const char *const fulljid)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_private(fulljid);
+    ProfWin *newwin = win_create_private(fulljid);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
     autocomplete_add(wins_ac, fulljid);
     autocomplete_add(wins_close_ac, fulljid);
@@ -673,13 +673,13 @@ wins_new_private(const char* const fulljid)
     return newwin;
 }
 
-ProfWin*
-wins_new_plugin(const char* const plugin_name, const char* const tag)
+ProfWin *
+wins_new_plugin(const char *const plugin_name, const char * const tag)
 {
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin* newwin = win_create_plugin(plugin_name, tag);
+    ProfWin *newwin = win_create_plugin(plugin_name, tag);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
     autocomplete_add(wins_ac, tag);
     autocomplete_add(wins_close_ac, tag);
@@ -689,11 +689,11 @@ wins_new_plugin(const char* const plugin_name, const char* const tag)
 gboolean
 wins_do_notify_remind(void)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (win_notify_remind(window)) {
             g_list_free(values);
             return TRUE;
@@ -708,11 +708,11 @@ int
 wins_get_total_unread(void)
 {
     int result = 0;
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         result += win_unread(window);
         curr = g_list_next(curr);
     }
@@ -723,30 +723,30 @@ wins_get_total_unread(void)
 void
 wins_resize_all(void)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         win_resize(window);
         curr = g_list_next(curr);
     }
     g_list_free(values);
 
-    ProfWin* current_win = wins_get_current();
+    ProfWin *current_win = wins_get_current();
     win_update_virtual(current_win);
 }
 
 void
-wins_hide_subwin(ProfWin* window)
+wins_hide_subwin(ProfWin *window)
 {
     win_hide_subwin(window);
 
-    ProfWin* current_win = wins_get_current();
+    ProfWin *current_win = wins_get_current();
     win_refresh_without_subwin(current_win);
 }
 
 void
-wins_show_subwin(ProfWin* window)
+wins_show_subwin(ProfWin *window)
 {
     win_show_subwin(window);
 
@@ -755,20 +755,20 @@ wins_show_subwin(ProfWin* window)
         return;
     }
 
-    ProfWin* current_win = wins_get_current();
+    ProfWin *current_win = wins_get_current();
     win_refresh_with_subwin(current_win);
 }
 
 ProfXMLWin*
 wins_get_xmlconsole(void)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_XML) {
-            ProfXMLWin* xmlwin = (ProfXMLWin*)window;
+            ProfXMLWin *xmlwin = (ProfXMLWin*)window;
             assert(xmlwin->memcheck == PROFXMLWIN_MEMCHECK);
             g_list_free(values);
             return xmlwin;
@@ -783,14 +783,14 @@ wins_get_xmlconsole(void)
 GSList*
 wins_get_chat_recipients(void)
 {
-    GSList* result = NULL;
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GSList *result = NULL;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type == WIN_CHAT) {
-            ProfChatWin* chatwin = (ProfChatWin*)window;
+            ProfChatWin *chatwin = (ProfChatWin*)window;
             result = g_slist_append(result, chatwin->barejid);
         }
         curr = g_list_next(curr);
@@ -802,13 +802,17 @@ wins_get_chat_recipients(void)
 GSList*
 wins_get_prune_wins(void)
 {
-    GSList* result = NULL;
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GSList *result = NULL;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
-        if (win_unread(window) == 0 && window->type != WIN_MUC && window->type != WIN_CONFIG && window->type != WIN_XML && window->type != WIN_CONSOLE) {
+        ProfWin *window = curr->data;
+        if (win_unread(window) == 0 &&
+                window->type != WIN_MUC &&
+                window->type != WIN_CONFIG &&
+                window->type != WIN_XML &&
+                window->type != WIN_CONSOLE) {
             result = g_slist_append(result, window);
         }
         curr = g_list_next(curr);
@@ -820,11 +824,11 @@ wins_get_prune_wins(void)
 void
 wins_lost_connection(void)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type != WIN_CONSOLE) {
             win_println(window, THEME_ERROR, "-", "Lost connection.");
 
@@ -841,11 +845,11 @@ wins_lost_connection(void)
 void
 wins_reestablished_connection(void)
 {
-    GList* values = g_hash_table_get_values(windows);
-    GList* curr = values;
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
 
     while (curr) {
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (window->type != WIN_CONSOLE) {
             win_println(window, THEME_TEXT, "-", "Connection re-established.");
 
@@ -862,18 +866,18 @@ wins_reestablished_connection(void)
 void
 wins_swap(int source_win, int target_win)
 {
-    ProfWin* source = g_hash_table_lookup(windows, GINT_TO_POINTER(source_win));
-    ProfWin* console = wins_get_console();
+    ProfWin *source = g_hash_table_lookup(windows, GINT_TO_POINTER(source_win));
+    ProfWin *console = wins_get_console();
 
     if (source) {
-        ProfWin* target = g_hash_table_lookup(windows, GINT_TO_POINTER(target_win));
+        ProfWin *target = g_hash_table_lookup(windows, GINT_TO_POINTER(target_win));
 
         // target window empty
         if (target == NULL) {
             g_hash_table_steal(windows, GINT_TO_POINTER(source_win));
             g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
             status_bar_inactive(source_win);
-            char* identifier = win_get_tab_identifier(source);
+            char *identifier = win_get_tab_identifier(source);
             if (win_unread(source) > 0) {
                 status_bar_new(target_win, source->type, identifier);
             } else {
@@ -885,14 +889,14 @@ wins_swap(int source_win, int target_win)
                 ui_focus_win(console);
             }
 
-            // target window occupied
+        // target window occupied
         } else {
             g_hash_table_steal(windows, GINT_TO_POINTER(source_win));
             g_hash_table_steal(windows, GINT_TO_POINTER(target_win));
             g_hash_table_insert(windows, GINT_TO_POINTER(source_win), target);
             g_hash_table_insert(windows, GINT_TO_POINTER(target_win), source);
-            char* source_identifier = win_get_tab_identifier(source);
-            char* target_identifier = win_get_tab_identifier(target);
+            char *source_identifier = win_get_tab_identifier(source);
+            char *target_identifier = win_get_tab_identifier(target);
             if (win_unread(source) > 0) {
                 status_bar_new(target_win, source->type, source_identifier);
             } else {
@@ -936,14 +940,14 @@ _wins_cmp_num(gconstpointer a, gconstpointer b)
 }
 
 static int
-_wins_get_next_available_num(GList* used)
+_wins_get_next_available_num(GList *used)
 {
     // only console used
     if (g_list_length(used) == 1) {
         return 2;
     } else {
-        GList* sorted = NULL;
-        GList* curr = used;
+        GList *sorted = NULL;
+        GList *curr = used;
         while (curr) {
             sorted = g_list_insert_sorted(sorted, curr->data, _wins_cmp_num);
             curr = g_list_next(curr);
@@ -957,7 +961,8 @@ _wins_get_next_available_num(GList* used)
         while (curr) {
             int curr_num = GPOINTER_TO_INT(curr->data);
 
-            if (((last_num != 9) && ((last_num + 1) != curr_num)) || ((last_num == 9) && (curr_num != 0))) {
+            if (((last_num != 9) && ((last_num + 1) != curr_num)) ||
+                    ((last_num == 9) && (curr_num != 0))) {
                 result = last_num + 1;
                 if (result == 10) {
                     result = 0;
@@ -988,11 +993,11 @@ wins_tidy(void)
 {
     gboolean tidy_required = FALSE;
     // check for gaps
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     keys = g_list_sort(keys, _wins_cmp_num);
 
     // get last used
-    GList* last = g_list_last(keys);
+    GList *last = g_list_last(keys);
     int last_num = GPOINTER_TO_INT(last->data);
 
     // find first free num TODO - Will sort again
@@ -1005,14 +1010,14 @@ wins_tidy(void)
 
     if (tidy_required) {
         status_bar_set_all_inactive();
-        GHashTable* new_windows = g_hash_table_new_full(g_direct_hash,
-                                                        g_direct_equal, NULL, (GDestroyNotify)win_free);
+        GHashTable *new_windows = g_hash_table_new_full(g_direct_hash,
+            g_direct_equal, NULL, (GDestroyNotify)win_free);
 
         int num = 1;
-        GList* curr = keys;
+        GList *curr = keys;
         while (curr) {
-            ProfWin* window = g_hash_table_lookup(windows, curr->data);
-            char* identifier = win_get_tab_identifier(window);
+            ProfWin *window = g_hash_table_lookup(windows, curr->data);
+            char *identifier = win_get_tab_identifier(window);
             g_hash_table_steal(windows, curr->data);
             if (num == 10) {
                 g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window);
@@ -1037,7 +1042,7 @@ wins_tidy(void)
         g_hash_table_destroy(windows);
         windows = new_windows;
         current = 1;
-        ProfWin* console = wins_get_console();
+        ProfWin *console = wins_get_console();
         ui_focus_win(console);
         g_list_free(keys);
         return TRUE;
@@ -1054,19 +1059,19 @@ wins_create_summary(gboolean unread)
         return NULL;
     }
 
-    GSList* result = NULL;
+    GSList *result = NULL;
 
-    GList* keys = g_hash_table_get_keys(windows);
+    GList *keys = g_hash_table_get_keys(windows);
     keys = g_list_sort(keys, _wins_cmp_num);
-    GList* curr = keys;
+    GList *curr = keys;
 
     while (curr) {
-        ProfWin* window = g_hash_table_lookup(windows, curr->data);
+        ProfWin *window = g_hash_table_lookup(windows, curr->data);
         if (!unread || (unread && win_unread(window) > 0)) {
-            GString* line = g_string_new("");
+            GString *line = g_string_new("");
 
             int ui_index = GPOINTER_TO_INT(curr->data);
-            char* winstring = win_to_string(window);
+            char *winstring = win_to_string(window);
             if (!winstring) {
                 g_string_free(line, TRUE);
                 continue;
@@ -1088,13 +1093,13 @@ wins_create_summary(gboolean unread)
 }
 
 char*
-win_autocomplete(const char* const search_str, gboolean previous, void* context)
+win_autocomplete(const char *const search_str, gboolean previous, void *context)
 {
     return autocomplete_complete(wins_ac, search_str, TRUE, previous);
 }
 
 char*
-win_close_autocomplete(const char* const search_str, gboolean previous, void* context)
+win_close_autocomplete(const char *const search_str, gboolean previous, void *context)
 {
     return autocomplete_complete(wins_close_ac, search_str, TRUE, previous);
 }
@@ -1123,16 +1128,16 @@ ProfWin*
 wins_get_next_unread(void)
 {
     // get and sort win nums
-    GList* values = g_hash_table_get_values(windows);
+    GList *values = g_hash_table_get_values(windows);
     values = g_list_sort(values, _wins_cmp_num);
-    GList* curr = values;
+    GList *curr = values;
 
     while (curr) {
         if (current == GPOINTER_TO_INT(curr->data)) {
             break;
         }
 
-        ProfWin* window = curr->data;
+        ProfWin *window = curr->data;
         if (win_unread(window) > 0) {
             g_list_free(values);
             return window;
@@ -1146,33 +1151,34 @@ wins_get_next_unread(void)
 }
 
 void
-wins_add_urls_ac(const ProfWin* const win, const ProfMessage* const message)
+wins_add_urls_ac(const ProfWin *const win, const ProfMessage *const message)
 {
-    GRegex* regex;
-    GMatchInfo* match_info;
+    GRegex *regex;
+    GMatchInfo *match_info;
 
     regex = g_regex_new("(https?|aesgcm)://\\S+", 0, 0, NULL);
-    g_regex_match(regex, message->plain, 0, &match_info);
+    g_regex_match (regex, message->plain, 0, &match_info);
 
-    while (g_match_info_matches(match_info)) {
-        gchar* word = g_match_info_fetch(match_info, 0);
+    while (g_match_info_matches (match_info))
+    {
+        gchar *word = g_match_info_fetch (match_info, 0);
 
         autocomplete_add_reverse(win->urls_ac, word);
         // for people who run profanity a long time, we don't want to waste a lot of memory
         autocomplete_remove_older_than_max_reverse(win->urls_ac, 20);
 
-        g_free(word);
-        g_match_info_next(match_info, NULL);
+        g_free (word);
+        g_match_info_next (match_info, NULL);
     }
 
-    g_match_info_free(match_info);
-    g_regex_unref(regex);
+    g_match_info_free (match_info);
+    g_regex_unref (regex);
 }
 
 char*
-wins_get_url(const char* const search_str, gboolean previous, void* context)
+wins_get_url(const char *const search_str, gboolean previous, void *context)
 {
-    ProfWin* win = (ProfWin*)context;
+    ProfWin *win = (ProfWin*)context;
 
     return autocomplete_complete(win->urls_ac, search_str, FALSE, previous);
 }