about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chat_session.c12
-rw-r--r--src/chat_session.h1
-rw-r--r--src/command/command.c7
-rw-r--r--src/command/commands.c6
-rw-r--r--src/common.c8
-rw-r--r--src/config/account.c1
-rw-r--r--src/config/preferences.c9
-rw-r--r--src/config/preferences.h1
-rw-r--r--src/jid.c52
-rw-r--r--src/jid.h3
-rw-r--r--src/log.c5
-rw-r--r--src/muc.c6
-rw-r--r--src/otr/otr.c3
-rw-r--r--src/tools/autocomplete.c22
-rw-r--r--src/tools/parser.c3
-rw-r--r--src/ui/console.c3
-rw-r--r--src/ui/core.c3
-rw-r--r--src/ui/inputwin.c8
-rw-r--r--src/ui/window.c1
-rw-r--r--src/xmpp/connection.c3
-rw-r--r--src/xmpp/iq.c13
-rw-r--r--src/xmpp/message.c5
-rw-r--r--src/xmpp/presence.c8
-rw-r--r--src/xmpp/presence.h1
-rw-r--r--src/xmpp/stanza.c60
-rw-r--r--src/xmpp/stanza.h3
26 files changed, 41 insertions, 206 deletions
diff --git a/src/chat_session.c b/src/chat_session.c
index b684fa84..b52c818a 100644
--- a/src/chat_session.c
+++ b/src/chat_session.c
@@ -181,18 +181,6 @@ chat_session_is_inactive(const char * const recipient)
     }
 }
 
-gboolean
-chat_session_is_active(const char * const recipient)
-{
-    ChatSession session = g_hash_table_lookup(sessions, recipient);
-
-    if (session == NULL) {
-        return FALSE;
-    } else {
-        return (session->state == CHAT_STATE_ACTIVE);
-    }
-}
-
 void
 chat_session_set_active(const char * const recipient)
 {
diff --git a/src/chat_session.h b/src/chat_session.h
index 662d61bb..0de08f45 100644
--- a/src/chat_session.h
+++ b/src/chat_session.h
@@ -38,7 +38,6 @@ void chat_session_set_recipient_supports(const char * const recipient,
 void chat_session_set_composing(const char * const recipient);
 void chat_session_no_activity(const char * const recipient);
 gboolean chat_session_is_inactive(const char * const recipient);
-gboolean chat_session_is_active(const char * const recipient);
 void chat_session_set_active(const char * const recipient);
 gboolean chat_session_is_paused(const char * const recipient);
 gboolean chat_session_is_gone(const char * const recipient);
diff --git a/src/command/command.c b/src/command/command.c
index 0e7c9357..95a6158e 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1191,12 +1191,11 @@ cmd_alias_remove(char *value)
 void
 cmd_autocomplete(char *input, int *size)
 {
-    int i = 0;
-    char *found = NULL;
-    char inp_cpy[*size];
-
     // autocomplete command
     if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, *size, ' '))) {
+        int i = 0;
+        char *found = NULL;
+        char inp_cpy[*size];
         for(i = 0; i < *size; i++) {
             inp_cpy[i] = input[i];
         }
diff --git a/src/command/commands.c b/src/command/commands.c
index 83fe4322..940a7f5a 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1300,7 +1300,6 @@ gboolean
 cmd_status(gchar **args, struct cmd_help_t help)
 {
     char *usr = args[0];
-    char *usr_jid = NULL;
 
     jabber_conn_status_t conn_status = jabber_get_connection_status();
     win_type_t win_type = ui_current_win_type();
@@ -1335,7 +1334,7 @@ cmd_status(gchar **args, struct cmd_help_t help)
             break;
         case WIN_CONSOLE:
             if (usr != NULL) {
-                usr_jid = roster_barejid_from_name(usr);
+                char *usr_jid = roster_barejid_from_name(usr);
                 if (usr_jid == NULL) {
                     usr_jid = usr;
                 }
@@ -1355,7 +1354,6 @@ gboolean
 cmd_info(gchar **args, struct cmd_help_t help)
 {
     char *usr = args[0];
-    char *usr_jid = NULL;
 
     jabber_conn_status_t conn_status = jabber_get_connection_status();
     win_type_t win_type = ui_current_win_type();
@@ -1411,7 +1409,7 @@ cmd_info(gchar **args, struct cmd_help_t help)
             break;
         case WIN_CONSOLE:
             if (usr != NULL) {
-                usr_jid = roster_barejid_from_name(usr);
+                char *usr_jid = roster_barejid_from_name(usr);
                 if (usr_jid == NULL) {
                     usr_jid = usr;
                 }
diff --git a/src/common.c b/src/common.c
index 2f811885..314e5440 100644
--- a/src/common.c
+++ b/src/common.c
@@ -116,7 +116,6 @@ str_replace(const char *string, const char *substr,
 {
     char *tok = NULL;
     char *newstr = NULL;
-    char *oldstr = NULL;
     char *head = NULL;
 
     if (string == NULL)
@@ -131,7 +130,7 @@ str_replace(const char *string, const char *substr,
     head = newstr;
 
     while ( (tok = strstr ( head, substr ))) {
-        oldstr = newstr;
+        char *oldstr = newstr;
         newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) +
             strlen ( replacement ) + 1 );
 
@@ -171,7 +170,6 @@ char *
 prof_getline(FILE *stream)
 {
     char *buf;
-    size_t buf_size;
     char *result;
     char *s = NULL;
     size_t s_size = 1;
@@ -183,7 +181,7 @@ prof_getline(FILE *stream)
         result = fgets(buf, READ_BUF_SIZE, stream);
         if (result == NULL)
             break;
-        buf_size = strlen(buf);
+        size_t buf_size = strlen(buf);
         if (buf[buf_size - 1] == '\n') {
             buf_size--;
             buf[buf_size] = '\0';
@@ -416,12 +414,12 @@ cmp_win_num(gconstpointer a, gconstpointer b)
 int
 get_next_available_win_num(GList *used)
 {
-    int result = 0;
     used = g_list_sort(used, cmp_win_num);
     // only console used
     if (g_list_length(used) == 1) {
         return 2;
     } else {
+        int result = 0;
         int last_num = 1;
         GList *curr = used;
         // skip console
diff --git a/src/config/account.c b/src/config/account.c
index a7437ad3..4f52d280 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -138,7 +138,6 @@ account_free(ProfAccount *account)
         free(account->muc_service);
         free(account->muc_nick);
         free(account);
-        account = NULL;
     }
 }
 
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 2d6aee79..5bbb36a2 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -209,13 +209,6 @@ prefs_get_priority(void)
     return g_key_file_get_integer(prefs, PREF_GROUP_PRESENCE, "priority", NULL);
 }
 
-void
-prefs_set_priority(gint value)
-{
-    g_key_file_set_integer(prefs, PREF_GROUP_PRESENCE, "priority", value);
-    _save_prefs();
-}
-
 gint
 prefs_get_reconnect(void)
 {
@@ -514,4 +507,4 @@ _get_default_string(preference_t pref)
         default:
             return NULL;
     }
-}
\ No newline at end of file
+}
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 48748883..3d2f6023 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -88,7 +88,6 @@ void prefs_set_notify_remind(gint period);
 gint prefs_get_notify_remind(void);
 void prefs_set_max_log_size(gint value);
 gint prefs_get_max_log_size(void);
-void prefs_set_priority(gint value);
 gint prefs_get_priority(void);
 void prefs_set_reconnect(gint value);
 gint prefs_get_reconnect(void);
diff --git a/src/jid.c b/src/jid.c
index 03bf5144..ab76d5d2 100644
--- a/src/jid.c
+++ b/src/jid.c
@@ -125,36 +125,6 @@ jid_is_valid_room_form(Jid *jid)
 }
 
 /*
- * Given a full room JID of the form
- * room@server/nick
- * Will create two new strings and point room and nick to them e.g.
- * *room = "room@server", *nick = "nick"
- * The strings must be freed by the caller
- * Returns TRUE if the JID was parsed successfully, FALSE otherwise
- */
-gboolean
-parse_room_jid(const char * const full_room_jid, char **room, char **nick)
-{
-    Jid *jid = jid_create(full_room_jid);
-
-    if (jid == NULL) {
-        return FALSE;
-    }
-
-    if (jid->resourcepart == NULL) {
-        jid_destroy(jid);
-        return FALSE;
-    }
-
-    *room = strdup(jid->barejid);
-    *nick = strdup(jid->resourcepart);
-
-    jid_destroy(jid);
-
-    return TRUE;
-}
-
-/*
  * Given a barejid, and resourcepart, create and return a full JID of the form
  * barejid/resourcepart
  * Will return a newly created string that must be freed by the caller
@@ -174,28 +144,6 @@ create_fulljid(const char * const barejid, const char * const resource)
 }
 
 /*
- * Get the room name part of the full JID, e.g.
- * Full JID = "test@conference.server/person"
- * returns "test@conference.server"
- */
-char *
-get_room_from_full_jid(const char * const full_room_jid)
-{
-    char **tokens = g_strsplit(full_room_jid, "/", 0);
-    char *room_part = NULL;
-
-    if (tokens != NULL) {
-        if (tokens[0] != NULL) {
-            room_part = strdup(tokens[0]);
-        }
-
-        g_strfreev(tokens);
-    }
-
-    return room_part;
-}
-
-/*
  * Get the nickname part of the full JID, e.g.
  * Full JID = "test@conference.server/person"
  * returns "person"
diff --git a/src/jid.h b/src/jid.h
index 2fb447fe..b5591a2f 100644
--- a/src/jid.h
+++ b/src/jid.h
@@ -42,9 +42,6 @@ void jid_destroy(Jid *jid);
 
 gboolean jid_is_valid_room_form(Jid *jid);
 char * create_fulljid(const char * const barejid, const char * const resource);
-char * get_room_from_full_jid(const char * const full_room_jid);
 char * get_nick_from_full_jid(const char * const full_room_jid);
-gboolean parse_room_jid(const char * const full_room_jid, char **room,
-    char **nick);
 
 #endif
diff --git a/src/log.c b/src/log.c
index b30c68cb..77ed5a6d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -158,7 +158,6 @@ void
 log_msg(log_level_t level, const char * const area, const char * const msg)
 {
     if (level >= level_filter && logp != NULL) {
-        long result;
         dt = g_date_time_new_now(tz);
 
         char *level_str = _log_string_from_level(level);
@@ -172,7 +171,7 @@ log_msg(log_level_t level, const char * const area, const char * const msg)
         g_free(date_fmt);
 
         if (prefs_get_boolean(PREF_LOG_ROTATE)) {
-            result = ftell(logp);
+            long result = ftell(logp);
             if (result != -1 && result >= prefs_get_max_log_size()) {
                 _rotate_log_file();
             }
@@ -348,7 +347,6 @@ chat_log_get_previous(const gchar * const login, const gchar * const recipient,
         char *filename = _get_log_filename(recipient, login, log_date, FALSE);
 
         FILE *logp = fopen(filename, "r");
-        char *line;
         if (logp != NULL) {
             GString *gs_header = g_string_new("");
             g_string_append_printf(gs_header, "%d/%d/%d:",
@@ -359,6 +357,7 @@ chat_log_get_previous(const gchar * const login, const gchar * const recipient,
             history = g_slist_append(history, header);
             g_string_free(gs_header, TRUE);
 
+            char *line;
             while ((line = prof_getline(logp)) != NULL) {
                 history = g_slist_append(history, line);
             }
diff --git a/src/muc.c b/src/muc.c
index 88b5e2cd..9db485c0 100644
--- a/src/muc.c
+++ b/src/muc.c
@@ -494,10 +494,8 @@ muc_complete_roster_nick_change(const char * const room,
 
     if (chat_room != NULL) {
         char *old_nick = g_hash_table_lookup(chat_room->nick_changes, nick);
-        char *old_nick_cpy;
-
         if (old_nick != NULL) {
-            old_nick_cpy = strdup(old_nick);
+            char *old_nick_cpy = strdup(old_nick);
             g_hash_table_remove(chat_room->nick_changes, nick);
 
             return old_nick_cpy;
@@ -543,4 +541,4 @@ gint _compare_participants(PContact a, PContact b)
     g_free(key_b);
 
     return result;
-}
\ No newline at end of file
+}
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 5424b09a..e80086af 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -436,13 +436,12 @@ _otr_decrypt_message(const char * const from, const char * const message, gboole
 {
     char *decrypted = NULL;
     OtrlTLV *tlvs = NULL;
-    OtrlTLV *tlv = NULL;
 
     int result = otrlib_decrypt_message(user_state, &ops, jid, from, message, &decrypted, &tlvs);
 
     // internal libotr message
     if (result == 1) {
-        tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
+        OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
         if (tlv) {
             ConnContext *context = otrlib_context_find(user_state, from, jid);
 
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c
index e82103ac..979b6c86 100644
--- a/src/tools/autocomplete.c
+++ b/src/tools/autocomplete.c
@@ -184,21 +184,21 @@ char *
 autocomplete_param_with_func(char *input, int *size, char *command,
     autocomplete_func func)
 {
-    char *found = NULL;
     GString *auto_msg = NULL;
     char *result = NULL;
-    char inp_cpy[*size];
-    int i;
     char command_cpy[strlen(command) + 2];
     sprintf(command_cpy, "%s ", command);
     int len = strlen(command_cpy);
 
     if ((strncmp(input, command_cpy, len) == 0) && (*size > len)) {
+        int i;
+        char inp_cpy[*size];
         for(i = len; i < *size; i++) {
             inp_cpy[i-len] = input[i];
         }
         inp_cpy[(*size) - len] = '\0';
-        found = func(inp_cpy);
+
+        char *found = func(inp_cpy);
         if (found != NULL) {
             auto_msg = g_string_new(command_cpy);
             g_string_append(auto_msg, found);
@@ -215,20 +215,20 @@ char *
 autocomplete_param_with_ac(char *input, int *size, char *command,
     Autocomplete ac)
 {
-    char *found = NULL;
     GString *auto_msg = NULL;
     char *result = NULL;
-    char inp_cpy[*size];
-    int i;
     char *command_cpy = malloc(strlen(command) + 2);
     sprintf(command_cpy, "%s ", command);
     int len = strlen(command_cpy);
     if ((strncmp(input, command_cpy, len) == 0) && (*size > len)) {
+        int i;
+        char inp_cpy[*size];
         for(i = len; i < *size; i++) {
             inp_cpy[i-len] = input[i];
         }
         inp_cpy[(*size) - len] = '\0';
-        found = autocomplete_complete(ac, inp_cpy);
+
+        char *found = autocomplete_complete(ac, inp_cpy);
         if (found != NULL) {
             auto_msg = g_string_new(command_cpy);
             g_string_append(auto_msg, found);
@@ -246,10 +246,8 @@ char *
 autocomplete_param_no_with_func(char *input, int *size, char *command,
     int arg_number, autocomplete_func func)
 {
-    char *result = NULL;
     if (strncmp(input, command, strlen(command)) == 0 && (*size > strlen(command))) {
         int i = 0;
-        char *found = NULL;
         GString *result_str = NULL;
 
         // copy and null terminate input
@@ -270,12 +268,12 @@ autocomplete_param_no_with_func(char *input, int *size, char *command,
 
             // autocomplete param
             if (comp_str != NULL) {
-                found = func(comp_str);
+                char *found = func(comp_str);
                 if (found != NULL) {
                     result_str = g_string_new("");
                     g_string_append(result_str, start_str);
                     g_string_append(result_str, found);
-                    result = result_str->str;
+                    char *result = result_str->str;
                     g_string_free(result_str, FALSE);
                     return result;
                 }
diff --git a/src/tools/parser.c b/src/tools/parser.c
index aafbf576..ba08416e 100644
--- a/src/tools/parser.c
+++ b/src/tools/parser.c
@@ -437,6 +437,5 @@ options_destroy(GHashTable *options)
 {
     if (options != NULL) {
         g_hash_table_destroy(options);
-        options = NULL;
     }
-}
\ No newline at end of file
+}
diff --git a/src/ui/console.c b/src/ui/console.c
index d7bb1904..2aff43a5 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -643,7 +643,6 @@ static void
 _cons_show_bookmarks(const GList *list)
 {
     ProfWin *console = wins_get_console();
-    Bookmark *item;
 
     if (list == NULL) {
         cons_show("");
@@ -654,7 +653,7 @@ _cons_show_bookmarks(const GList *list)
 
         /* TODO: show status (connected or not) and window number */
         while (list != NULL) {
-            item = list->data;
+            Bookmark *item = list->data;
 
             win_print_time(console, '-');
             wprintw(console->win, "  %s", item->jid);
diff --git a/src/ui/core.c b/src/ui/core.c
index 35865ebb..adebdadd 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1050,8 +1050,6 @@ _ui_current_page_off(void)
 static void
 _ui_print_system_msg_from_recipient(const char * const from, const char *message)
 {
-    int num = 0;
-
     if (from == NULL || message == NULL)
         return;
 
@@ -1059,6 +1057,7 @@ _ui_print_system_msg_from_recipient(const char * const from, const char *message
 
     ProfWin *window = wins_get_by_recipient(jid->barejid);
     if (window == NULL) {
+        int num = 0;
         window = wins_new(jid->barejid, WIN_CHAT);
         if (window != NULL) {
             num = wins_get_num(window);
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index d528fd49..aa587594 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -109,8 +109,6 @@ inp_block(void)
 wint_t
 inp_get_char(char *input, int *size)
 {
-    int inp_x = 0;
-    int i;
     wint_t ch;
     int display_size = 0;
 
@@ -148,7 +146,7 @@ inp_get_char(char *input, int *size)
                 return ERR;
             }
 
-            inp_x = getcurx(inp_win);
+            int inp_x = getcurx(inp_win);
 
             // handle insert if not at end of input
             if (inp_x < display_size) {
@@ -160,6 +158,7 @@ inp_get_char(char *input, int *size)
                 for (offset = &input[*size - 1]; offset >= next_ch; offset--) {
                     *(offset + utf_len) = *offset;
                 }
+                int i;
                 for (i = 0; i < utf_len; i++) {
                      *(next_ch + i) = bytes[i];
                 }
@@ -181,6 +180,7 @@ inp_get_char(char *input, int *size)
 
                 // wcrtomb can return (size_t) -1
                 if (utf_len < MB_CUR_MAX) {
+                    int i;
                     for (i = 0 ; i < utf_len; i++) {
                         input[(*size)++] = bytes[i];
                     }
@@ -709,4 +709,4 @@ _printable(const wint_t ch)
     bytes[utf_len] = '\0';
     gunichar unichar = g_utf8_get_char(bytes);
     return g_unichar_isprint(unichar) && (ch != KEY_MOUSE);
-}
\ No newline at end of file
+}
diff --git a/src/ui/window.c b/src/ui/window.c
index 63d83600..7237599a 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -64,7 +64,6 @@ win_free(ProfWin* window)
     delwin(window->win);
     free(window->from);
     free(window);
-    window = NULL;
 }
 
 void
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 95c7fd82..e32ba4ed 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -206,7 +206,6 @@ static void
 _jabber_process_events(void)
 {
     int reconnect_sec;
-    int elapsed_sec;
 
     switch (jabber_conn.conn_status)
     {
@@ -218,7 +217,7 @@ _jabber_process_events(void)
         case JABBER_DISCONNECTED:
             reconnect_sec = prefs_get_reconnect();
             if ((reconnect_sec != 0) && (reconnect_timer != NULL)) {
-                elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
+                int elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
                 if (elapsed_sec > reconnect_sec) {
                     _jabber_reconnect();
                 }
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 7bf0d2d1..1c9ad0aa 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -439,13 +439,13 @@ _disco_info_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
     const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
 
     if (g_strcmp0(id, "discoinforeq") == 0) {
-        GSList *identities = NULL;
-        GSList *features = NULL;
 
         xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
 
         if (query != NULL) {
             xmpp_stanza_t *child = xmpp_stanza_get_children(query);
+            GSList *identities = NULL;
+            GSList *features = NULL;
             while (child != NULL) {
                 const char *stanza_name = xmpp_stanza_get_name(child);
                 if (g_strcmp0(stanza_name, STANZA_NAME_FEATURE) == 0) {
@@ -606,9 +606,6 @@ _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
     log_debug("Recieved diso#items response");
     const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
     const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
-    const char *stanza_name = NULL;
-    const char *item_jid = NULL;
-    const char *item_name = NULL;
     GSList *items = NULL;
 
     if ((g_strcmp0(id, "confreq") == 0) || (g_strcmp0(id, "discoitemsreq") == 0)) {
@@ -618,13 +615,13 @@ _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
         if (query != NULL) {
             xmpp_stanza_t *child = xmpp_stanza_get_children(query);
             while (child != NULL) {
-                stanza_name = xmpp_stanza_get_name(child);
+                const char *stanza_name = xmpp_stanza_get_name(child);
                 if ((stanza_name != NULL) && (g_strcmp0(stanza_name, STANZA_NAME_ITEM) == 0)) {
-                    item_jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
+                    const char *item_jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
                     if (item_jid != NULL) {
                         DiscoItem *item = malloc(sizeof(struct disco_item_t));
                         item->jid = strdup(item_jid);
-                        item_name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
+                        const char *item_name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
                         if (item_name != NULL) {
                             item->name = strdup(item_name);
                         } else {
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 4fc71f63..f8e2e18b 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -237,8 +237,6 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER);
     char *room = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
-    char *invitor = NULL;
-    char *reason = NULL;
 
     if (room == NULL) {
         log_warning("Message received with no from attribute, ignoring");
@@ -258,8 +256,9 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         if (jidp == NULL) {
             return 1;
         }
-        invitor = jidp->barejid;
+        char *invitor = jidp->barejid;
 
+        char *reason = NULL;
         xmpp_stanza_t *reason_st = xmpp_stanza_get_child_by_name(invite, STANZA_NAME_REASON);
         if (reason_st != NULL) {
             reason = xmpp_stanza_get_text(reason_st);
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 1cb86645..19ab3c03 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -140,12 +140,6 @@ _presence_sub_request_count(void)
 }
 
 void
-presence_free_sub_requests(void)
-{
-    autocomplete_free(sub_requests_ac);
-}
-
-void
 presence_clear_sub_requests(void)
 {
     autocomplete_clear(sub_requests_ac);
@@ -625,7 +619,7 @@ _get_caps_key(xmpp_stanza_t * const stanza)
     if ((hash_type != NULL) && (strcmp(hash_type, "sha-1") == 0)) {
         log_debug("Hash type %s supported.", hash_type);
         caps_key = strdup(node);
-        char *id = generate_unique_id("caps");
+        id = generate_unique_id("caps");
 
         _send_caps_request(node, caps_key, id, from);
 
diff --git a/src/xmpp/presence.h b/src/xmpp/presence.h
index 037fb2fd..7fc85f5b 100644
--- a/src/xmpp/presence.h
+++ b/src/xmpp/presence.h
@@ -25,7 +25,6 @@
 
 void presence_sub_requests_init(void);
 void presence_add_handlers(void);
-void presence_free_sub_requests(void);
 void presence_clear_sub_requests(void);
 
 #endif
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 8000da62..3c3f47fb 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -830,62 +830,6 @@ stanza_contains_caps(xmpp_stanza_t * const stanza)
     return TRUE;
 }
 
-gboolean
-stanza_is_version_request(xmpp_stanza_t * const stanza)
-{
-    char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
-
-    if (g_strcmp0(type, STANZA_TYPE_GET) != 0) {
-        return FALSE;
-    }
-
-    xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
-
-    if (query == NULL) {
-        return FALSE;
-    }
-
-    char *ns = xmpp_stanza_get_ns(query);
-
-    if (ns == NULL) {
-        return FALSE;
-    }
-
-    if (strcmp(ns, STANZA_NS_VERSION) != 0) {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-gboolean
-stanza_is_caps_request(xmpp_stanza_t * const stanza)
-{
-    char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
-
-    if (g_strcmp0(type, STANZA_TYPE_GET) != 0) {
-        return FALSE;
-    }
-
-    xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
-
-    if (query == NULL) {
-        return FALSE;
-    }
-
-    char *ns = xmpp_stanza_get_ns(query);
-
-    if (ns == NULL) {
-        return FALSE;
-    }
-
-    if (strcmp(ns, XMPP_NS_DISCO_INFO) != 0) {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
 char *
 stanza_caps_get_hash(xmpp_stanza_t * const stanza)
 {
@@ -957,8 +901,6 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
 
         // otherwise check each defined-condition RFC-6120 8.3.3
         } else {
-            xmpp_stanza_t *cond_stanza = NULL;
-
             gchar *defined_conditions[] = {
                 STANZA_NAME_BAD_REQUEST,
                 STANZA_NAME_CONFLICT,
@@ -985,7 +927,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
 
             int i;
             for (i = 0; i < ARRAY_SIZE(defined_conditions); i++) {
-                cond_stanza = xmpp_stanza_get_child_by_name(error_stanza, defined_conditions[i]);
+                xmpp_stanza_t *cond_stanza = xmpp_stanza_get_child_by_name(error_stanza, defined_conditions[i]);
                 if (cond_stanza != NULL) {
                     char *result = strdup(xmpp_stanza_get_name(cond_stanza));
                     return result;
diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h
index 486421a2..cddc37ea 100644
--- a/src/xmpp/stanza.h
+++ b/src/xmpp/stanza.h
@@ -192,9 +192,6 @@ int stanza_get_idle_time(xmpp_stanza_t * const stanza);
 char * stanza_get_caps_str(xmpp_stanza_t * const stanza);
 gboolean stanza_contains_caps(xmpp_stanza_t * const stanza);
 char * stanza_caps_get_hash(xmpp_stanza_t * const stanza);
-gboolean stanza_is_caps_request(xmpp_stanza_t * const stanza);
-
-gboolean stanza_is_version_request(xmpp_stanza_t * const stanza);
 
 DataForm * stanza_create_form(xmpp_stanza_t * const stanza);
 void stanza_destroy_form(DataForm *form);