about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c12
-rw-r--r--src/command/cmd_defs.c18
-rw-r--r--src/command/cmd_funcs.c30
-rw-r--r--src/common.c4
-rw-r--r--src/config/account.c4
-rw-r--r--src/config/accounts.c4
-rw-r--r--src/config/scripts.c2
-rw-r--r--src/config/theme.c1
-rw-r--r--src/config/tlscerts.c2
-rw-r--r--src/config/tlscerts.h2
-rw-r--r--src/event/client_events.c6
-rw-r--r--src/event/server_events.c13
-rw-r--r--src/log.c1
-rw-r--r--src/log.h2
-rw-r--r--src/otr/otr.c10
-rw-r--r--src/otr/otrlibv3.c4
-rw-r--r--src/otr/otrlibv4.c4
-rw-r--r--src/pgp/gpg.c2
-rw-r--r--src/plugins/api.c8
-rw-r--r--src/plugins/c_plugins.c2
-rw-r--r--src/plugins/callbacks.c3
-rw-r--r--src/plugins/plugins.c7
-rw-r--r--src/plugins/python_api.c2
-rw-r--r--src/plugins/python_plugins.c1
-rw-r--r--src/plugins/settings.c2
-rw-r--r--src/plugins/themes.c2
-rw-r--r--src/profanity.c30
-rw-r--r--src/profanity.h1
-rw-r--r--src/tools/http_upload.c6
-rw-r--r--src/tools/http_upload.h1
-rw-r--r--src/ui/buffer.h4
-rw-r--r--src/ui/console.c10
-rw-r--r--src/ui/core.c28
-rw-r--r--src/ui/inputwin.c14
-rw-r--r--src/ui/mucconfwin.c2
-rw-r--r--src/ui/mucwin.c6
-rw-r--r--src/ui/notifier.c8
-rw-r--r--src/ui/occupantswin.c4
-rw-r--r--src/ui/privwin.c5
-rw-r--r--src/ui/rosterwin.c6
-rw-r--r--src/ui/statusbar.c2
-rw-r--r--src/ui/titlebar.c2
-rw-r--r--src/ui/tray.c4
-rw-r--r--src/ui/ui.h5
-rw-r--r--src/ui/win_types.h3
-rw-r--r--src/ui/window.c3
-rw-r--r--src/ui/window.h14
-rw-r--r--src/ui/window_list.c8
-rw-r--r--src/ui/xmlwin.c2
-rw-r--r--src/xmpp/blocking.c1
-rw-r--r--src/xmpp/bookmark.c7
-rw-r--r--src/xmpp/capabilities.c3
-rw-r--r--src/xmpp/capabilities.h1
-rw-r--r--src/xmpp/chat_session.c4
-rw-r--r--src/xmpp/chat_state.c6
-rw-r--r--src/xmpp/connection.c1
-rw-r--r--src/xmpp/contact.c4
-rw-r--r--src/xmpp/contact.h2
-rw-r--r--src/xmpp/form.c1
-rw-r--r--src/xmpp/form.h5
-rw-r--r--src/xmpp/iq.c23
-rw-r--r--src/xmpp/jid.c3
-rw-r--r--src/xmpp/message.c17
-rw-r--r--src/xmpp/muc.c6
-rw-r--r--src/xmpp/muc.h4
-rw-r--r--src/xmpp/presence.c11
-rw-r--r--src/xmpp/roster.c10
-rw-r--r--src/xmpp/roster_list.c6
-rw-r--r--src/xmpp/session.c10
-rw-r--r--src/xmpp/session.h11
-rw-r--r--src/xmpp/stanza.c4
-rw-r--r--src/xmpp/stanza.h1
-rw-r--r--src/xmpp/xmpp.h5
73 files changed, 240 insertions, 222 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index b1273bc9..afc642e4 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -41,17 +41,17 @@
 #include <dirent.h>
 
 #include "common.h"
-#include "tools/parser.h"
-#include "ui/win_types.h"
-#include "command/cmd_funcs.h"
 #include "config/preferences.h"
 #include "config/scripts.h"
+#include "command/cmd_ac.h"
+#include "command/cmd_funcs.h"
+#include "tools/parser.h"
+#include "plugins/plugins.h"
+#include "ui/win_types.h"
+#include "ui/window_list.h"
 #include "xmpp/muc.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/roster_list.h"
-#include "ui/window_list.h"
-#include "plugins/plugins.h"
-#include "command/cmd_ac.h"
 
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index fa55ec83..14afd7c2 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -48,29 +48,29 @@
 
 #include <glib.h>
 
-#include "xmpp/chat_session.h"
+#include "profanity.h"
+#include "log.h"
+#include "common.h"
 #include "command/cmd_defs.h"
 #include "command/cmd_funcs.h"
 #include "command/cmd_ac.h"
-#include "common.h"
 #include "config/accounts.h"
 #include "config/preferences.h"
 #include "config/theme.h"
 #include "config/tlscerts.h"
 #include "config/scripts.h"
-#include "xmpp/contact.h"
-#include "xmpp/roster_list.h"
-#include "xmpp/jid.h"
-#include "log.h"
-#include "xmpp/muc.h"
 #include "plugins/plugins.h"
-#include "profanity.h"
 #include "tools/autocomplete.h"
 #include "tools/parser.h"
 #include "tools/tinyurl.h"
-#include "xmpp/xmpp.h"
 #include "ui/ui.h"
 #include "ui/window_list.h"
+#include "xmpp/xmpp.h"
+#include "xmpp/contact.h"
+#include "xmpp/roster_list.h"
+#include "xmpp/jid.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/muc.h"
 
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index f68f725d..26b22c4f 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -49,41 +49,45 @@
 #include <langinfo.h>
 #include <ctype.h>
 
-#include "xmpp/chat_session.h"
+#include "profanity.h"
+#include "log.h"
+#include "common.h"
 #include "command/cmd_funcs.h"
 #include "command/cmd_defs.h"
 #include "command/cmd_ac.h"
-#include "common.h"
 #include "config/accounts.h"
 #include "config/account.h"
 #include "config/preferences.h"
 #include "config/theme.h"
 #include "config/tlscerts.h"
 #include "config/scripts.h"
+#include "event/client_events.h"
+#include "tools/http_upload.h"
+#include "tools/autocomplete.h"
+#include "tools/parser.h"
+#include "tools/tinyurl.h"
+#include "plugins/plugins.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
+#include "xmpp/xmpp.h"
 #include "xmpp/contact.h"
 #include "xmpp/roster_list.h"
 #include "xmpp/jid.h"
-#include "log.h"
 #include "xmpp/muc.h"
+#include "xmpp/chat_session.h"
+
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
+
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
 #endif
-#include "profanity.h"
-#include "plugins/plugins.h"
-#include "tools/autocomplete.h"
-#include "tools/parser.h"
-#include "tools/tinyurl.h"
-#include "xmpp/xmpp.h"
-#include "ui/ui.h"
-#include "ui/window_list.h"
-#include "event/client_events.h"
+
 #ifdef HAVE_GTK
 #include "ui/tray.h"
 #endif
-#include "tools/http_upload.h"
+
 #ifdef HAVE_PYTHON
 #include "plugins/python_plugins.h"
 #endif
diff --git a/src/common.c b/src/common.c
index c12f184f..b7868c79 100644
--- a/src/common.c
+++ b/src/common.c
@@ -53,11 +53,9 @@
 #include <ncurses.h>
 #endif
 
-#include "tools/p_sha1.h"
-
 #include "log.h"
 #include "common.h"
-
+#include "tools/p_sha1.h"
 
 struct curl_data_t
 {
diff --git a/src/config/account.c b/src/config/account.c
index 0a2c9132..879759f5 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -38,10 +38,10 @@
 
 #include <glib.h>
 
-#include "xmpp/jid.h"
-#include "config/account.h"
 #include "common.h"
 #include "log.h"
+#include "config/account.h"
+#include "xmpp/jid.h"
 
 ProfAccount*
 account_new(const gchar *const name, const gchar *const jid,
diff --git a/src/config/accounts.c b/src/config/accounts.c
index c504b5d3..7f852e6f 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -41,12 +41,12 @@
 #include "accounts.h"
 
 #include "common.h"
+#include "log.h"
 #include "config/account.h"
 #include "config/conflists.h"
-#include "xmpp/jid.h"
-#include "log.h"
 #include "tools/autocomplete.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/jid.h"
 
 static gchar *accounts_loc;
 static GKeyFile *accounts;
diff --git a/src/config/scripts.c b/src/config/scripts.c
index 04c4c1cd..14f05f29 100644
--- a/src/config/scripts.c
+++ b/src/config/scripts.c
@@ -42,9 +42,9 @@
 
 #include "common.h"
 #include "log.h"
-#include "ui/window_list.h"
 #include "command/cmd_defs.h"
 #include "ui/ui.h"
+#include "ui/window_list.h"
 #include "xmpp/xmpp.h"
 
 void
diff --git a/src/config/theme.c b/src/config/theme.c
index 6c47b9f0..0ba9c786 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -38,6 +38,7 @@
 #include <string.h>
 
 #include <glib.h>
+
 #ifdef HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
 #elif HAVE_NCURSES_H
diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c
index ba59acfc..b51f5ff9 100644
--- a/src/config/tlscerts.c
+++ b/src/config/tlscerts.c
@@ -38,9 +38,9 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "config/tlscerts.h"
 #include "log.h"
 #include "common.h"
+#include "config/tlscerts.h"
 #include "tools/autocomplete.h"
 
 static gchar *tlscerts_loc;
diff --git a/src/config/tlscerts.h b/src/config/tlscerts.h
index 0001fc28..76b2a344 100644
--- a/src/config/tlscerts.h
+++ b/src/config/tlscerts.h
@@ -35,6 +35,8 @@
 #ifndef CONFIG_TLSCERTS_H
 #define CONFIG_TLSCERTS_H
 
+#include <glib.h>
+
 typedef struct tls_cert_t {
     int version;
     char *serialnumber;
diff --git a/src/event/client_events.c b/src/event/client_events.c
index 4829133c..dd9c4432 100644
--- a/src/event/client_events.c
+++ b/src/event/client_events.c
@@ -38,15 +38,17 @@
 #include <glib.h>
 
 #include "log.h"
-#include "ui/ui.h"
+#include "plugins/plugins.h"
 #include "ui/window_list.h"
+#include "ui/ui.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/roster_list.h"
 #include "xmpp/chat_session.h"
-#include "plugins/plugins.h"
+
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
+
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
 #endif
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 4adb3a2d..b8154b8e 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -38,22 +38,23 @@
 #include <stdlib.h>
 #include <assert.h>
 
-#include "xmpp/chat_session.h"
+#include "profanity.h"
 #include "log.h"
-#include "xmpp/muc.h"
 #include "config/preferences.h"
+#include "config/tlscerts.h"
 #include "config/account.h"
 #include "config/scripts.h"
-#include "xmpp/roster_list.h"
+#include "event/client_events.h"
 #include "plugins/plugins.h"
 #include "ui/window_list.h"
-#include "config/tlscerts.h"
-#include "profanity.h"
-#include "event/client_events.h"
+#include "xmpp/muc.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/roster_list.h"
 
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
+
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
 #endif
diff --git a/src/log.c b/src/log.c
index 5e4e86da..363c1be7 100644
--- a/src/log.c
+++ b/src/log.c
@@ -44,7 +44,6 @@
 #include "glib/gstdio.h"
 
 #include "log.h"
-
 #include "common.h"
 #include "config/preferences.h"
 #include "xmpp/xmpp.h"
diff --git a/src/log.h b/src/log.h
index 531e44da..b065a448 100644
--- a/src/log.h
+++ b/src/log.h
@@ -35,7 +35,7 @@
 #ifndef LOG_H
 #define LOG_H
 
-#include "glib.h"
+#include <glib.h>
 
 // log levels
 typedef enum {
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 27bd171b..343bdcbc 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -38,16 +38,16 @@
 #include <libotr/sm.h>
 #include <glib.h>
 
+#include "log.h"
+#include "config/preferences.h"
 #include "otr/otr.h"
 #include "otr/otrlib.h"
-#include "log.h"
-#include "xmpp/roster_list.h"
+#include "ui/ui.h"
 #include "ui/window_list.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/roster_list.h"
 #include "xmpp/contact.h"
-#include "ui/ui.h"
 #include "xmpp/xmpp.h"
-#include "config/preferences.h"
-#include "xmpp/chat_session.h"
 
 #define PRESENCE_ONLINE 1
 #define PRESENCE_OFFLINE 0
diff --git a/src/otr/otrlibv3.c b/src/otr/otrlibv3.c
index 81b9cc5b..4f7a6135 100644
--- a/src/otr/otrlibv3.c
+++ b/src/otr/otrlibv3.c
@@ -35,10 +35,10 @@
 #include <libotr/privkey.h>
 #include <libotr/message.h>
 
-#include "ui/ui.h"
-#include "window_list.h"
 #include "otr/otr.h"
 #include "otr/otrlib.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
 
 OtrlPolicy
 otrlib_policy(void)
diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c
index 74166808..ab39e81c 100644
--- a/src/otr/otrlibv4.c
+++ b/src/otr/otrlibv4.c
@@ -36,11 +36,11 @@
 #include <libotr/privkey.h>
 #include <libotr/message.h>
 
-#include "ui/ui.h"
-#include "ui/window_list.h"
 #include "log.h"
 #include "otr/otr.h"
 #include "otr/otrlib.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
 
 static GTimer *timer;
 static unsigned int current_interval;
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index b757abca..fb1f2db1 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -44,9 +44,9 @@
 #include <glib/gstdio.h>
 #include <gpgme.h>
 
-#include "pgp/gpg.h"
 #include "log.h"
 #include "common.h"
+#include "pgp/gpg.h"
 #include "tools/autocomplete.h"
 #include "ui/ui.h"
 
diff --git a/src/plugins/api.c b/src/plugins/api.c
index a0e69043..8ac4856f 100644
--- a/src/plugins/api.c
+++ b/src/plugins/api.c
@@ -38,7 +38,11 @@
 
 #include <glib.h>
 
+#include "profanity.h"
 #include "log.h"
+#include "common.h"
+#include "config/theme.h"
+#include "command/cmd_defs.h"
 #include "event/server_events.h"
 #include "event/client_events.h"
 #include "plugins/callbacks.h"
@@ -46,12 +50,8 @@
 #include "plugins/themes.h"
 #include "plugins/settings.h"
 #include "plugins/disco.h"
-#include "profanity.h"
 #include "ui/ui.h"
-#include "config/theme.h"
-#include "command/cmd_defs.h"
 #include "ui/window_list.h"
-#include "common.h"
 
 void
 api_cons_alert(void)
diff --git a/src/plugins/c_plugins.c b/src/plugins/c_plugins.c
index b9fc74e9..c7f8fcdb 100644
--- a/src/plugins/c_plugins.c
+++ b/src/plugins/c_plugins.c
@@ -39,8 +39,8 @@
 
 #include <glib.h>
 
-#include "config/preferences.h"
 #include "log.h"
+#include "config/preferences.h"
 #include "plugins/api.h"
 #include "plugins/callbacks.h"
 #include "plugins/plugins.h"
diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c
index 0bcdd34b..40a35400 100644
--- a/src/plugins/callbacks.c
+++ b/src/plugins/callbacks.c
@@ -41,9 +41,8 @@
 #include "plugins/plugins.h"
 #include "tools/autocomplete.h"
 #include "tools/parser.h"
-#include "ui/window_list.h"
-
 #include "ui/ui.h"
+#include "ui/window_list.h"
 
 static GHashTable *p_commands = NULL;
 static GHashTable *p_timed_functions = NULL;
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index a90940e0..8e9b2d37 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -35,11 +35,10 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "log.h"
 #include "config.h"
 #include "common.h"
 #include "config/preferences.h"
-#include "log.h"
-#include "xmpp/xmpp.h"
 #include "plugins/callbacks.h"
 #include "plugins/autocompleters.h"
 #include "plugins/api.h"
@@ -47,6 +46,8 @@
 #include "plugins/themes.h"
 #include "plugins/settings.h"
 #include "plugins/disco.h"
+#include "ui/ui.h"
+#include "xmpp/xmpp.h"
 
 #ifdef HAVE_PYTHON
 #include "plugins/python_plugins.h"
@@ -58,8 +59,6 @@
 #include "plugins/c_api.h"
 #endif
 
-#include "ui/ui.h"
-
 static GHashTable *plugins;
 
 void
diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c
index ef6b9ccd..13b1f665 100644
--- a/src/plugins/python_api.c
+++ b/src/plugins/python_api.c
@@ -41,12 +41,12 @@
 
 #include <glib.h>
 
+#include "log.h"
 #include "plugins/api.h"
 #include "plugins/python_api.h"
 #include "plugins/python_plugins.h"
 #include "plugins/callbacks.h"
 #include "plugins/autocompleters.h"
-#include "log.h"
 
 static char* _python_plugin_name(void);
 
diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c
index 40046200..dc1c17f9 100644
--- a/src/plugins/python_plugins.c
+++ b/src/plugins/python_plugins.c
@@ -35,7 +35,6 @@
 #include <Python.h>
 
 #include "config.h"
-
 #include "config/preferences.h"
 #include "plugins/api.h"
 #include "plugins/callbacks.h"
diff --git a/src/plugins/settings.c b/src/plugins/settings.c
index d75152a8..df32b379 100644
--- a/src/plugins/settings.c
+++ b/src/plugins/settings.c
@@ -38,8 +38,8 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "config/theme.h"
 #include "common.h"
+#include "config/theme.h"
 
 static GKeyFile *settings;
 
diff --git a/src/plugins/themes.c b/src/plugins/themes.c
index 60e1f11a..cfa718cc 100644
--- a/src/plugins/themes.c
+++ b/src/plugins/themes.c
@@ -35,8 +35,8 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "config/theme.h"
 #include "common.h"
+#include "config/theme.h"
 
 static GKeyFile *themes;
 
diff --git a/src/profanity.c b/src/profanity.c
index 68f6bbb0..7d90c1c9 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -40,6 +40,7 @@
 #ifdef HAVE_GTK
 #include "ui/tray.h"
 #endif
+
 #include <locale.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -48,32 +49,35 @@
 #include <glib.h>
 
 #include "profanity.h"
-#include "xmpp/chat_session.h"
-#include "xmpp/chat_state.h"
+#include "common.h"
+#include "log.h"
+#include "config/tlscerts.h"
 #include "config/accounts.h"
 #include "config/preferences.h"
 #include "config/theme.h"
+#include "config/tlscerts.h"
 #include "config/scripts.h"
 #include "command/cmd_defs.h"
-#include "common.h"
+#include "plugins/plugins.h"
+#include "event/client_events.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
+#include "xmpp/resource.h"
+#include "xmpp/xmpp.h"
+#include "xmpp/muc.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/chat_state.h"
 #include "xmpp/contact.h"
 #include "xmpp/roster_list.h"
-#include "config/tlscerts.h"
-#include "log.h"
-#include "xmpp/muc.h"
-#include "plugins/plugins.h"
+
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
+
 #ifdef HAVE_LIBGPGME
 #include "pgp/gpg.h"
 #endif
-#include "xmpp/resource.h"
-#include "xmpp/xmpp.h"
-#include "ui/ui.h"
-#include "ui/window_list.h"
-#include "event/client_events.h"
-#include "config/tlscerts.h"
+
 
 static void _check_autoaway(void);
 static void _init(char *log_level);
diff --git a/src/profanity.h b/src/profanity.h
index ef1f2ea1..94d7ef45 100644
--- a/src/profanity.h
+++ b/src/profanity.h
@@ -36,6 +36,7 @@
 #define PROFANITY_H
 
 #include <pthread.h>
+#include <glib.h>
 
 void prof_run(char *log_level, char *account_name);
 
diff --git a/src/tools/http_upload.c b/src/tools/http_upload.c
index 835618ca..80b46c87 100644
--- a/src/tools/http_upload.c
+++ b/src/tools/http_upload.c
@@ -45,11 +45,11 @@
 #include <assert.h>
 
 #include "profanity.h"
-#include "ui/ui.h"
-#include "ui/window.h"
-#include "tools/http_upload.h"
 #include "event/client_events.h"
+#include "tools/http_upload.h"
 #include "config/preferences.h"
+#include "ui/ui.h"
+#include "ui/window.h"
 
 #define FALLBACK_MIMETYPE "application/octet-stream"
 #define FALLBACK_CONTENTTYPE_HEADER "Content-Type: application/octet-stream"
diff --git a/src/tools/http_upload.h b/src/tools/http_upload.h
index e3d6cb8a..217c1321 100644
--- a/src/tools/http_upload.h
+++ b/src/tools/http_upload.h
@@ -41,6 +41,7 @@
 
 #include <sys/select.h>
 #include <curl/curl.h>
+
 #include "ui/win_types.h"
 
 typedef struct http_upload_t {
diff --git a/src/ui/buffer.h b/src/ui/buffer.h
index e37f58fa..19b7bfb7 100644
--- a/src/ui/buffer.h
+++ b/src/ui/buffer.h
@@ -35,11 +35,11 @@
 #ifndef UI_BUFFER_H
 #define UI_BUFFER_H
 
+#include <glib.h>
+
 #include "config.h"
 #include "config/theme.h"
 
-#include <glib.h>
-
 typedef struct delivery_receipt_t {
     char *id;
     gboolean received;
diff --git a/src/ui/console.c b/src/ui/console.c
index 3122b2d6..600bbdf3 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -43,18 +43,18 @@
 #include <ncurses.h>
 #endif
 
-#include "command/cmd_defs.h"
 #include "common.h"
 #include "log.h"
-#include "xmpp/muc.h"
-#include "xmpp/roster_list.h"
 #include "config/preferences.h"
 #include "config/theme.h"
-#include "ui/window.h"
-#include "window_list.h"
+#include "command/cmd_defs.h"
+#include "ui/window_list.h"
 #include "ui/ui.h"
+#include "ui/window.h"
 #include "ui/statusbar.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/muc.h"
+#include "xmpp/roster_list.h"
 
 #ifdef HAVE_GIT_VERSION
 #include "gitversion.h"
diff --git a/src/ui/core.c b/src/ui/core.c
index cca836f7..2dad71fb 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -44,38 +44,40 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
+#include <glib.h>
+
 #ifdef HAVE_LIBXSS
 #include <X11/extensions/scrnsaver.h>
 #endif
-#include <glib.h>
+
 #ifdef HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
 #elif HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
-#include "xmpp/chat_session.h"
+#include "log.h"
+#include "common.h"
 #include "command/cmd_defs.h"
 #include "command/cmd_ac.h"
-#include "common.h"
 #include "config/preferences.h"
 #include "config/theme.h"
-#include "xmpp/contact.h"
-#include "xmpp/roster_list.h"
-#include "xmpp/jid.h"
-#include "log.h"
-#include "xmpp/muc.h"
-#ifdef HAVE_LIBOTR
-#include "otr/otr.h"
-#endif
 #include "ui/ui.h"
 #include "ui/titlebar.h"
 #include "ui/statusbar.h"
 #include "ui/inputwin.h"
 #include "ui/window.h"
-#include "window_list.h"
+#include "ui/window_list.h"
 #include "xmpp/xmpp.h"
-#include "plugins/plugins.h"
+#include "xmpp/muc.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/contact.h"
+#include "xmpp/roster_list.h"
+#include "xmpp/jid.h"
+
+#ifdef HAVE_LIBOTR
+#include "otr/otr.h"
+#endif
 
 static char *win_title;
 static int inp_size;
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 1f5c69cc..fdfdb0ac 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -53,22 +53,22 @@
 #include <ncurses.h>
 #endif
 
-#include "command/cmd_ac.h"
-#include "xmpp/chat_state.h"
+#include "profanity.h"
+#include "log.h"
 #include "common.h"
+#include "command/cmd_ac.h"
 #include "config/accounts.h"
 #include "config/preferences.h"
 #include "config/theme.h"
-#include "log.h"
-#include "xmpp/muc.h"
-#include "profanity.h"
-#include "xmpp/roster_list.h"
 #include "ui/ui.h"
 #include "ui/statusbar.h"
 #include "ui/inputwin.h"
 #include "ui/window.h"
-#include "window_list.h"
+#include "ui/window_list.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/muc.h"
+#include "xmpp/roster_list.h"
+#include "xmpp/chat_state.h"
 
 static WINDOW *inp_win;
 static int pad_start = 0;
diff --git a/src/ui/mucconfwin.c b/src/ui/mucconfwin.c
index a52f2378..b31bb928 100644
--- a/src/ui/mucconfwin.c
+++ b/src/ui/mucconfwin.c
@@ -38,7 +38,7 @@
 #include "ui/ui.h"
 #include "ui/window.h"
 #include "ui/win_types.h"
-#include "window_list.h"
+#include "ui/window_list.h"
 
 static void _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field);
 
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index 08e9bb38..3f773431 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -38,12 +38,12 @@
 #include <assert.h>
 #include <stdlib.h>
 
-#include "ui/win_types.h"
-#include "window_list.h"
 #include "log.h"
 #include "config/preferences.h"
-#include "ui/window.h"
 #include "plugins/plugins.h"
+#include "ui/window.h"
+#include "ui/win_types.h"
+#include "ui/window_list.h"
 
 void
 mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason)
diff --git a/src/ui/notifier.c b/src/ui/notifier.c
index f992729a..4c7bc8df 100644
--- a/src/ui/notifier.c
+++ b/src/ui/notifier.c
@@ -38,19 +38,21 @@
 #include <stdlib.h>
 
 #include <glib.h>
+
 #ifdef HAVE_LIBNOTIFY
 #include <libnotify/notify.h>
 #endif
+
 #ifdef PLATFORM_CYGWIN
 #include <windows.h>
 #endif
 
 #include "log.h"
-#include "xmpp/muc.h"
-#include "ui/ui.h"
-#include "window_list.h"
 #include "config/preferences.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/muc.h"
 
 static GTimer *remind_timer;
 
diff --git a/src/ui/occupantswin.c b/src/ui/occupantswin.c
index efa8146c..716ddda7 100644
--- a/src/ui/occupantswin.c
+++ b/src/ui/occupantswin.c
@@ -34,10 +34,10 @@
 
 #include <assert.h>
 
+#include "config/preferences.h"
 #include "ui/ui.h"
 #include "ui/window.h"
-#include "window_list.h"
-#include "config/preferences.h"
+#include "ui/window_list.h"
 
 static void
 _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean showjid)
diff --git a/src/ui/privwin.c b/src/ui/privwin.c
index 716adf2d..1caf4845 100644
--- a/src/ui/privwin.c
+++ b/src/ui/privwin.c
@@ -36,12 +36,11 @@
 #include <glib.h>
 #include <stdlib.h>
 
+#include "config/preferences.h"
 #include "ui/win_types.h"
 #include "ui/window.h"
 #include "ui/titlebar.h"
-#include "window_list.h"
-#include "config/preferences.h"
-
+#include "ui/window_list.h"
 
 void
 privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDateTime *timestamp)
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index 06d34894..690677cd 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -36,12 +36,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "xmpp/contact.h"
+#include "config/preferences.h"
 #include "ui/ui.h"
 #include "ui/window.h"
-#include "window_list.h"
-#include "config/preferences.h"
+#include "ui/window_list.h"
 #include "xmpp/roster_list.h"
+#include "xmpp/contact.h"
 
 typedef enum {
     ROSTER_CONTACT,
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index 36017168..af165908 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -45,10 +45,10 @@
 #endif
 
 #include "config/theme.h"
+#include "config/preferences.h"
 #include "ui/ui.h"
 #include "ui/statusbar.h"
 #include "ui/inputwin.h"
-#include "config/preferences.h"
 
 #define TIME_CHECK 60000000
 
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 67764221..701c01c2 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -44,7 +44,7 @@
 #include "ui/ui.h"
 #include "ui/titlebar.h"
 #include "ui/inputwin.h"
-#include "window_list.h"
+#include "ui/window_list.h"
 #include "ui/window.h"
 #include "xmpp/roster_list.h"
 #include "xmpp/chat_session.h"
diff --git a/src/ui/tray.c b/src/ui/tray.c
index 9011bec9..8471f039 100644
--- a/src/ui/tray.c
+++ b/src/ui/tray.c
@@ -39,10 +39,10 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include "tray.h"
-#include "window_list.h"
 #include "log.h"
 #include "config/preferences.h"
+#include "ui/tray.h"
+#include "ui/window_list.h"
 
 static gboolean gtk_ready = FALSE;
 static GtkStatusIcon *prof_tray = NULL;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 3e4292c9..2683a32b 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -37,11 +37,12 @@
 
 #include "config.h"
 
+#include "config/tlscerts.h"
+#include "config/account.h"
 #include "command/cmd_funcs.h"
 #include "ui/win_types.h"
 #include "xmpp/muc.h"
-#include "config/tlscerts.h"
-#include "config/account.h"
+
 #ifdef HAVE_LIBOTR
 #include "otr/otr.h"
 #endif
diff --git a/src/ui/win_types.h b/src/ui/win_types.h
index b523ef2f..47bc7657 100644
--- a/src/ui/win_types.h
+++ b/src/ui/win_types.h
@@ -39,15 +39,16 @@
 
 #include <wchar.h>
 #include <glib.h>
+
 #ifdef HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
 #elif HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
+#include "tools/autocomplete.h"
 #include "ui/buffer.h"
 #include "xmpp/chat_state.h"
-#include "tools/autocomplete.h"
 
 #define LAYOUT_SPLIT_MEMCHECK       12345671
 #define PROFCHATWIN_MEMCHECK        22374522
diff --git a/src/ui/window.c b/src/ui/window.c
index 9b210972..89e5f1ac 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -41,6 +41,7 @@
 #include <wchar.h>
 
 #include <glib.h>
+
 #ifdef HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
 #elif HAVE_NCURSES_H
@@ -49,10 +50,10 @@
 
 #include "config/theme.h"
 #include "config/preferences.h"
-#include "xmpp/roster_list.h"
 #include "ui/ui.h"
 #include "ui/window.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/roster_list.h"
 
 #define CONS_WIN_TITLE "Profanity. Type /help for help information."
 #define XML_WIN_TITLE "XML Console"
diff --git a/src/ui/window.h b/src/ui/window.h
index c570e6c7..cc9ae8df 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -39,19 +39,19 @@
 
 #include <wchar.h>
 
-#include "xmpp/contact.h"
-#include "xmpp/muc.h"
-#include "ui/ui.h"
-#include "ui/buffer.h"
-#include "xmpp/xmpp.h"
-#include "xmpp/chat_state.h"
-
 #ifdef HAVE_NCURSESW_NCURSES_H
 #include <ncursesw/ncurses.h>
 #elif HAVE_NCURSES_H
 #include <ncurses.h>
 #endif
 
+#include "ui/ui.h"
+#include "ui/buffer.h"
+#include "xmpp/xmpp.h"
+#include "xmpp/chat_state.h"
+#include "xmpp/contact.h"
+#include "xmpp/muc.h"
+
 #define PAD_SIZE 1000
 
 void win_move_to_end(ProfWin *window);
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index 1e5ff426..20994e34 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -41,14 +41,14 @@
 #include <glib.h>
 
 #include "common.h"
-#include "xmpp/roster_list.h"
+#include "config/preferences.h"
 #include "config/theme.h"
+#include "plugins/plugins.h"
 #include "ui/ui.h"
 #include "ui/statusbar.h"
-#include "window_list.h"
-#include "plugins/plugins.h"
+#include "ui/window_list.h"
 #include "xmpp/xmpp.h"
-#include "config/preferences.h"
+#include "xmpp/roster_list.h"
 
 static GHashTable *windows;
 static int current;
diff --git a/src/ui/xmlwin.c b/src/ui/xmlwin.c
index 16246585..80870b46 100644
--- a/src/ui/xmlwin.c
+++ b/src/ui/xmlwin.c
@@ -36,7 +36,7 @@
 #include <string.h>
 
 #include "ui/win_types.h"
-#include "window_list.h"
+#include "ui/window_list.h"
 
 void
 xmlwin_show(ProfXMLWin *xmlwin, const char *const msg)
diff --git a/src/xmpp/blocking.c b/src/xmpp/blocking.c
index 39cfb65a..a5a920e4 100644
--- a/src/xmpp/blocking.c
+++ b/src/xmpp/blocking.c
@@ -38,6 +38,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c
index 69c74b2e..940b7982 100644
--- a/src/xmpp/bookmark.c
+++ b/src/xmpp/bookmark.c
@@ -43,21 +43,22 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
 #include "common.h"
 #include "log.h"
-#include "muc.h"
 #include "event/server_events.h"
+#include "plugins/plugins.h"
+#include "ui/ui.h"
 #include "xmpp/connection.h"
 #include "xmpp/iq.h"
 #include "xmpp/stanza.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/bookmark.h"
-#include "ui/ui.h"
-#include "plugins/plugins.h"
+#include "xmpp/muc.h"
 
 #define BOOKMARK_TIMEOUT 5000
 
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index 2a8aff0e..4d9c0a36 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -47,17 +47,18 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
 #include "common.h"
 #include "log.h"
+#include "plugins/plugins.h"
 #include "xmpp/xmpp.h"
 #include "xmpp/stanza.h"
 #include "xmpp/form.h"
 #include "xmpp/capabilities.h"
-#include "plugins/plugins.h"
 
 static gchar *cache_loc;
 static GKeyFile *cache;
diff --git a/src/xmpp/capabilities.h b/src/xmpp/capabilities.h
index d5d3d777..71fc06f1 100644
--- a/src/xmpp/capabilities.h
+++ b/src/xmpp/capabilities.h
@@ -40,6 +40,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
diff --git a/src/xmpp/chat_session.c b/src/xmpp/chat_session.c
index 7e844871..61d7018c 100644
--- a/src/xmpp/chat_session.c
+++ b/src/xmpp/chat_session.c
@@ -38,10 +38,10 @@
 
 #include <glib.h>
 
-#include "chat_session.h"
-#include "config/preferences.h"
 #include "log.h"
+#include "config/preferences.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/chat_session.h"
 
 static GHashTable *sessions;
 
diff --git a/src/xmpp/chat_state.c b/src/xmpp/chat_state.c
index 66c24265..ad78c3b9 100644
--- a/src/xmpp/chat_state.c
+++ b/src/xmpp/chat_state.c
@@ -37,12 +37,12 @@
 
 #include <glib.h>
 
-#include "chat_state.h"
-#include "xmpp/chat_session.h"
+#include "config/preferences.h"
 #include "ui/window_list.h"
 #include "ui/win_types.h"
 #include "xmpp/xmpp.h"
-#include "config/preferences.h"
+#include "xmpp/chat_state.h"
+#include "xmpp/chat_session.h"
 
 #define PAUSED_TIMEOUT 10.0
 #define INACTIVE_TIMEOUT 30.0
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index c590b7ba..8a963bb4 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -41,6 +41,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
diff --git a/src/xmpp/contact.c b/src/xmpp/contact.c
index 000d7668..d50af5cd 100644
--- a/src/xmpp/contact.c
+++ b/src/xmpp/contact.c
@@ -38,10 +38,10 @@
 
 #include <glib.h>
 
-#include "contact.h"
 #include "common.h"
-#include "resource.h"
 #include "tools/autocomplete.h"
+#include "xmpp/resource.h"
+#include "xmpp/contact.h"
 
 struct p_contact_t {
     char *barejid;
diff --git a/src/xmpp/contact.h b/src/xmpp/contact.h
index 6a13d01e..8e71faef 100644
--- a/src/xmpp/contact.h
+++ b/src/xmpp/contact.h
@@ -35,8 +35,8 @@
 #ifndef XMPP_CONTACT_H
 #define XMPP_CONTACT_H
 
-#include "resource.h"
 #include "tools/autocomplete.h"
+#include "xmpp/resource.h"
 
 typedef struct p_contact_t *PContact;
 
diff --git a/src/xmpp/form.c b/src/xmpp/form.c
index bc0c9da9..3619f95b 100644
--- a/src/xmpp/form.c
+++ b/src/xmpp/form.c
@@ -40,6 +40,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
diff --git a/src/xmpp/form.h b/src/xmpp/form.h
index f9740d68..5ce9ce31 100644
--- a/src/xmpp/form.h
+++ b/src/xmpp/form.h
@@ -35,15 +35,16 @@
 #ifndef XMPP_FORM_H
 #define XMPP_FORM_H
 
-#include "xmpp/xmpp.h"
-
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
+#include "xmpp/xmpp.h"
+
 DataForm* form_create(xmpp_stanza_t *const stanza);
 xmpp_stanza_t* form_create_submission(DataForm *form);
 char* form_get_form_type_field(DataForm *form);
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index c5f75ed0..3a29fbfc 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -46,30 +46,31 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
-#include "log.h"
-#include "muc.h"
 #include "profanity.h"
-#include "ui/ui.h"
-#include "ui/window_list.h"
+#include "log.h"
 #include "config/preferences.h"
 #include "event/server_events.h"
+#include "plugins/plugins.h"
+#include "tools/http_upload.h"
+#include "ui/ui.h"
+#include "ui/window_list.h"
+#include "xmpp/xmpp.h"
+#include "xmpp/connection.h"
+#include "xmpp/session.h"
+#include "xmpp/iq.h"
 #include "xmpp/capabilities.h"
 #include "xmpp/blocking.h"
 #include "xmpp/session.h"
 #include "xmpp/stanza.h"
 #include "xmpp/form.h"
-#include "roster_list.h"
-#include "xmpp/xmpp.h"
-#include "xmpp/connection.h"
-#include "xmpp/session.h"
-#include "xmpp/iq.h"
+#include "xmpp/roster_list.h"
 #include "xmpp/roster.h"
-#include "plugins/plugins.h"
-#include "tools/http_upload.h"
+#include "xmpp/muc.h"
 
 typedef struct p_room_info_data_t {
     char *room;
diff --git a/src/xmpp/jid.c b/src/xmpp/jid.c
index 1fe5d8f5..fb4361d7 100644
--- a/src/xmpp/jid.c
+++ b/src/xmpp/jid.c
@@ -37,9 +37,8 @@
 
 #include <glib.h>
 
-#include "jid.h"
-
 #include "common.h"
+#include "xmpp/jid.h"
 
 Jid*
 jid_create(const gchar *const str)
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 9b485954..fc314e30 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -40,26 +40,27 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
-#include "chat_session.h"
-#include "config/preferences.h"
-#include "log.h"
-#include "muc.h"
 #include "profanity.h"
-#include "ui/ui.h"
+#include "log.h"
+#include "config/preferences.h"
 #include "event/server_events.h"
+#include "pgp/gpg.h"
+#include "plugins/plugins.h"
+#include "ui/ui.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/muc.h"
 #include "xmpp/session.h"
 #include "xmpp/message.h"
 #include "xmpp/roster.h"
-#include "roster_list.h"
+#include "xmpp/roster_list.h"
 #include "xmpp/stanza.h"
 #include "xmpp/connection.h"
 #include "xmpp/xmpp.h"
-#include "pgp/gpg.h"
-#include "plugins/plugins.h"
 
 static int _message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
 
diff --git a/src/xmpp/muc.c b/src/xmpp/muc.c
index 83766c80..b7c9884e 100644
--- a/src/xmpp/muc.c
+++ b/src/xmpp/muc.c
@@ -38,13 +38,13 @@
 
 #include <glib.h>
 
-#include "xmpp/contact.h"
 #include "common.h"
-#include "xmpp/jid.h"
 #include "tools/autocomplete.h"
 #include "ui/ui.h"
 #include "ui/window_list.h"
-#include "muc.h"
+#include "xmpp/jid.h"
+#include "xmpp/muc.h"
+#include "xmpp/contact.h"
 
 typedef struct _muc_room_t {
     char *room; // e.g. test@conference.server
diff --git a/src/xmpp/muc.h b/src/xmpp/muc.h
index b5d9a38b..84be1dd2 100644
--- a/src/xmpp/muc.h
+++ b/src/xmpp/muc.h
@@ -37,10 +37,10 @@
 
 #include <glib.h>
 
-#include "xmpp/contact.h"
-#include "xmpp/jid.h"
 #include "tools/autocomplete.h"
 #include "ui/win_types.h"
+#include "xmpp/contact.h"
+#include "xmpp/jid.h"
 
 typedef enum {
     MUC_ROLE_NONE,
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index eed95fe1..84f2873e 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -44,24 +44,25 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
+#include "profanity.h"
+#include "log.h"
 #include "common.h"
 #include "config/preferences.h"
-#include "log.h"
-#include "muc.h"
-#include "profanity.h"
-#include "ui/ui.h"
 #include "event/server_events.h"
+#include "plugins/plugins.h"
+#include "ui/ui.h"
 #include "xmpp/connection.h"
 #include "xmpp/capabilities.h"
 #include "xmpp/session.h"
 #include "xmpp/stanza.h"
 #include "xmpp/iq.h"
 #include "xmpp/xmpp.h"
-#include "plugins/plugins.h"
+#include "xmpp/muc.h"
 
 static Autocomplete sub_requests_ac;
 
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 0449499b..7955aef3 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -43,26 +43,26 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
+#include "profanity.h"
 #include "log.h"
+#include "config/preferences.h"
 #include "plugins/plugins.h"
-#include "profanity.h"
-#include "ui/ui.h"
 #include "event/server_events.h"
 #include "event/client_events.h"
 #include "tools/autocomplete.h"
-#include "config/preferences.h"
+#include "ui/ui.h"
 #include "xmpp/session.h"
 #include "xmpp/iq.h"
 #include "xmpp/connection.h"
 #include "xmpp/roster.h"
-#include "roster_list.h"
+#include "xmpp/roster_list.h"
 #include "xmpp/stanza.h"
 #include "xmpp/xmpp.h"
-#include "plugins/plugins.h"
 
 // callback data for group commands
 typedef struct _group_data {
diff --git a/src/xmpp/roster_list.c b/src/xmpp/roster_list.c
index 789449c2..057146a2 100644
--- a/src/xmpp/roster_list.c
+++ b/src/xmpp/roster_list.c
@@ -39,12 +39,12 @@
 #include <glib.h>
 #include <assert.h>
 
-#include "roster_list.h"
+#include "config/preferences.h"
+#include "tools/autocomplete.h"
+#include "xmpp/roster_list.h"
 #include "xmpp/resource.h"
 #include "xmpp/contact.h"
 #include "xmpp/jid.h"
-#include "tools/autocomplete.h"
-#include "config/preferences.h"
 
 typedef struct prof_roster_t {
     // contacts, indexed on barejid
diff --git a/src/xmpp/session.c b/src/xmpp/session.c
index 6dc94aef..5c9c3b4c 100644
--- a/src/xmpp/session.c
+++ b/src/xmpp/session.c
@@ -38,14 +38,11 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "chat_session.h"
+#include "profanity.h"
+#include "log.h"
 #include "common.h"
 #include "config/preferences.h"
-#include "jid.h"
-#include "log.h"
-#include "muc.h"
 #include "plugins/plugins.h"
-#include "profanity.h"
 #include "event/server_events.h"
 #include "xmpp/bookmark.h"
 #include "xmpp/blocking.h"
@@ -58,6 +55,9 @@
 #include "xmpp/roster.h"
 #include "xmpp/stanza.h"
 #include "xmpp/xmpp.h"
+#include "xmpp/muc.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/jid.h"
 
 // for auto reconnect
 static struct {
diff --git a/src/xmpp/session.h b/src/xmpp/session.h
index dcd276b3..1bc67b63 100644
--- a/src/xmpp/session.h
+++ b/src/xmpp/session.h
@@ -35,16 +35,7 @@
 #ifndef XMPP_SESSION_H
 #define XMPP_SESSION_H
 
-#include "config.h"
-
-#ifdef HAVE_LIBMESODE
-#include <mesode.h>
-#endif
-#ifdef HAVE_LIBSTROPHE
-#include <strophe.h>
-#endif
-
-#include "resource.h"
+#include <glib.h>
 
 void session_login_success(gboolean secured);
 void session_login_failed(void);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 9174bcd2..971b7bfc 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -47,6 +47,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
@@ -58,8 +59,7 @@
 #include "xmpp/capabilities.h"
 #include "xmpp/connection.h"
 #include "xmpp/form.h"
-
-#include "muc.h"
+#include "xmpp/muc.h"
 
 #if 0
 xmpp_stanza_t*
diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h
index 49be2d56..bc649107 100644
--- a/src/xmpp/stanza.h
+++ b/src/xmpp/stanza.h
@@ -40,6 +40,7 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index b883c139..c34ee60a 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -40,16 +40,17 @@
 #ifdef HAVE_LIBMESODE
 #include <mesode.h>
 #endif
+
 #ifdef HAVE_LIBSTROPHE
 #include <strophe.h>
 #endif
 
 #include "config/accounts.h"
 #include "config/tlscerts.h"
-#include "contact.h"
-#include "jid.h"
 #include "tools/autocomplete.h"
 #include "tools/http_upload.h"
+#include "xmpp/contact.h"
+#include "xmpp/jid.h"
 
 #define JABBER_PRIORITY_MIN -128
 #define JABBER_PRIORITY_MAX 127