about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-12 01:34:09 +0000
committerJames Booth <boothj5@gmail.com>2013-01-12 01:34:09 +0000
commitbfd7362e2afe74c68ecb42eaa7cdc6a520332116 (patch)
tree0434338263488614992ebea1f37ae36faa27e57a /src
parentdad01d8f84431141eb93cba1409c2a4c01620548 (diff)
downloadprofani-tty-bfd7362e2afe74c68ecb42eaa7cdc6a520332116.tar.gz
Renamed muc functions
Diffstat (limited to 'src')
-rw-r--r--src/command.c8
-rw-r--r--src/jabber.c34
-rw-r--r--src/muc.c282
-rw-r--r--src/muc.h48
-rw-r--r--src/profanity.c10
-rw-r--r--src/windows.c10
6 files changed, 198 insertions, 194 deletions
diff --git a/src/command.c b/src/command.c
index 37b14ae1..82374b3a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -771,7 +771,7 @@ cmd_reset_autocomplete()
     p_autocomplete_reset(sub_ac);
 
     if (win_current_is_groupchat()) {
-        PAutocomplete nick_ac = room_get_nick_ac(win_current_get_recipient());
+        PAutocomplete nick_ac = muc_get_roster_ac(win_current_get_recipient());
         if (nick_ac != NULL) {
             p_autocomplete_reset(nick_ac);
         }
@@ -916,7 +916,7 @@ _cmd_complete_parameters(char *input, int *size)
         prefs_autocomplete_boolean_choice);
 
     if (win_current_is_groupchat()) {
-        PAutocomplete nick_ac = room_get_nick_ac(win_current_get_recipient());
+        PAutocomplete nick_ac = muc_get_roster_ac(win_current_get_recipient());
         if (nick_ac != NULL) {
             _parameter_autocomplete_with_ac(input, size, "/msg", nick_ac);
             _parameter_autocomplete_with_ac(input, size, "/info", nick_ac);
@@ -1534,7 +1534,7 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
 
     if (win_current_is_groupchat()) {
         char *room_name = win_current_get_recipient();
-        if (room_nick_in_roster(room_name, usr)) {
+        if (muc_nick_in_roster(room_name, usr)) {
             GString *full_jid = g_string_new(room_name);
             g_string_append(full_jid, "/");
             g_string_append(full_jid, usr);
@@ -1614,7 +1614,7 @@ _cmd_join(gchar **args, struct cmd_help_t help)
             strcpy(jid_cpy, jid);
             nick = strdup(strtok(jid_cpy, "@"));
         }
-        if (!room_is_active(room)) {
+        if (!muc_room_is_active(room)) {
             jabber_join(room, nick);
         }
         win_join_chat(room, nick);
diff --git a/src/jabber.c b/src/jabber.c
index bc67d2c1..790037f6 100644
--- a/src/jabber.c
+++ b/src/jabber.c
@@ -355,7 +355,7 @@ jabber_join(const char * const room, const char * const nick)
     xmpp_send(jabber_conn.conn, presence);
     xmpp_stanza_release(presence);
 
-    room_join(room, nick);
+    muc_join_room(room, nick);
 
     free(full_room_jid);
 }
@@ -375,7 +375,7 @@ jabber_change_room_nick(const char * const room, const char * const nick)
 void
 jabber_leave_chat_room(const char * const room_jid)
 {
-    char *nick = room_get_nick_for_room(room_jid);
+    char *nick = muc_get_room_nick(room_jid);
 
     xmpp_stanza_t *presence = stanza_create_room_leave_presence(jabber_conn.ctx,
         room_jid, nick);
@@ -454,10 +454,10 @@ jabber_update_presence(jabber_presence_t status, const char * const msg,
     xmpp_send(jabber_conn.conn, presence);
 
     // send presence for each room
-    GList *rooms = room_get_rooms();
+    GList *rooms = muc_get_active_room_list();
     while (rooms != NULL) {
         char *room = rooms->data;
-        char *nick = room_get_nick_for_room(room);
+        char *nick = muc_get_room_nick(room);
         char *full_room_jid = room_create_full_room_jid(room, nick);
 
         xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
@@ -609,7 +609,7 @@ _groupchat_message_handler(xmpp_stanza_t * const stanza)
     }
 
     // room not active in profanity
-    if (!room_is_active(room_jid)) {
+    if (!muc_room_is_active(room_jid)) {
         log_error("Message recieved for inactive groupchat: %s", room_jid);
         g_free(room);
         g_free(nick);
@@ -686,7 +686,7 @@ _chat_message_handler(xmpp_stanza_t * const stanza)
     char *jid = NULL;
 
     // private message from chat room use full jid (room/nick)
-    if (room_is_active(short_from)) {
+    if (muc_room_is_active(short_from)) {
         jid = strdup(from);
         priv = TRUE;
     // standard chat message, use jid without resource
@@ -994,18 +994,18 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza)
 
             // leave room if not self nick change
             if (nick_change) {
-                room_set_pending_nick_change(room);
+                muc_set_room_pending_nick_change(room);
             } else {
                 prof_handle_leave_room(room);
             }
 
         // handle self nick change
-        } else if (room_is_pending_nick_change(room)) {
-            room_change_nick(room, nick);
+        } else if (muc_is_room_pending_nick_change(room)) {
+            muc_complete_room_nick_change(room, nick);
             prof_handle_room_nick_change(room, nick);
 
         // handle roster complete
-        } else if (!room_get_roster_received(room)) {
+        } else if (!muc_get_roster_received(room)) {
             prof_handle_room_roster_complete(room);
 
         }
@@ -1027,7 +1027,7 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza)
             // handle nickname change
             if (stanza_is_room_nick_change(stanza)) {
                 char *new_nick = stanza_get_new_nick(stanza);
-                room_add_pending_nick_change(room, new_nick, nick);
+                muc_set_roster_pending_nick_change(room, new_nick, nick);
             } else {
                 prof_handle_room_member_offline(room, nick, "offline", status_str);
             }
@@ -1038,16 +1038,16 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza)
             } else {
                 show_str = "online";
             }
-            if (!room_get_roster_received(room)) {
-                room_add_to_roster(room, nick, show_str, status_str);
+            if (!muc_get_roster_received(room)) {
+                muc_add_to_roster(room, nick, show_str, status_str);
             } else {
-                char *old_nick = room_complete_pending_nick_change(room, nick);
+                char *old_nick = muc_complete_roster_nick_change(room, nick);
 
                 if (old_nick != NULL) {
-                    room_add_to_roster(room, nick, show_str, status_str);
+                    muc_add_to_roster(room, nick, show_str, status_str);
                     prof_handle_room_member_nick_change(room, old_nick, nick);
                 } else {
-                    if (!room_nick_in_roster(room, nick)) {
+                    if (!muc_nick_in_roster(room, nick)) {
                         prof_handle_room_member_online(room, nick, show_str, status_str);
                     } else {
                         prof_handle_room_member_presence(room, nick, show_str, status_str);
@@ -1077,7 +1077,7 @@ _presence_handler(xmpp_conn_t * const conn,
     }
 
     // handle chat room presence
-    if (room_is_active(from)) {
+    if (muc_room_is_active(from)) {
         return _room_presence_handler(from, stanza);
 
     // handle regular presence
diff --git a/src/muc.c b/src/muc.c
index da9d6522..171f4085 100644
--- a/src/muc.c
+++ b/src/muc.c
@@ -41,17 +41,17 @@ typedef struct _muc_room_t {
 
 GHashTable *rooms = NULL;
 
-static void _room_free(muc_room *room);
+static void _free_room(muc_room *room);
 
 /*
  * Join the chat room with the specified nickname
  */
 void
-room_join(const char * const room, const char * const nick)
+muc_join_room(const char * const room, const char * const nick)
 {
     if (rooms == NULL) {
         rooms = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
-            (GDestroyNotify)_room_free);
+            (GDestroyNotify)_free_room);
     }
 
     muc_room *new_room = malloc(sizeof(muc_room));
@@ -72,17 +72,39 @@ room_join(const char * const room, const char * const nick)
  * Leave the room
  */
 void
-room_leave(const char * const room)
+muc_leave_room(const char * const room)
 {
     g_hash_table_remove(rooms, room);
 }
 
 /*
+ * Returns TRUE if the user is currently in the room
+ */
+gboolean
+muc_room_is_active(const char * const full_room_jid)
+{
+    char **tokens = g_strsplit(full_room_jid, "/", 0);
+    char *room_part = tokens[0];
+
+    if (rooms != NULL) {
+        muc_room *chat_room = g_hash_table_lookup(rooms, room_part);
+
+        if (chat_room != NULL) {
+            return TRUE;
+        } else {
+            return FALSE;
+        }
+    } else {
+        return FALSE;
+    }
+}
+
+/*
  * Flag that the user has sent a nick change to the service
  * and is awaiting the response
  */
 void
-room_set_pending_nick_change(const char * const room)
+muc_set_room_pending_nick_change(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -96,7 +118,7 @@ room_set_pending_nick_change(const char * const room)
  * nick change
  */
 gboolean
-room_is_pending_nick_change(const char * const room)
+muc_is_room_pending_nick_change(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -112,7 +134,7 @@ room_is_pending_nick_change(const char * const room)
  * the service has responded
  */
 void
-room_change_nick(const char * const room, const char * const nick)
+muc_complete_room_nick_change(const char * const room, const char * const nick)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -124,34 +146,12 @@ room_change_nick(const char * const room, const char * const nick)
 }
 
 /*
- * Returns TRUE if the user is currently in the room
- */
-gboolean
-room_is_active(const char * const full_room_jid)
-{
-    char **tokens = g_strsplit(full_room_jid, "/", 0);
-    char *room_part = tokens[0];
-
-    if (rooms != NULL) {
-        muc_room *chat_room = g_hash_table_lookup(rooms, room_part);
-
-        if (chat_room != NULL) {
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else {
-        return FALSE;
-    }
-}
-
-/*
  * Return a list of room names
  * The contents of the list are owned by the chat room and should not be
  * modified or freed.
  */
 GList *
-room_get_rooms(void)
+muc_get_active_room_list(void)
 {
     if (rooms != NULL) {
         return g_hash_table_get_keys(rooms);
@@ -165,7 +165,7 @@ room_get_rooms(void)
  * The nickname is owned by the chat room and should not be modified or freed
  */
 char *
-room_get_nick_for_room(const char * const room)
+muc_get_room_nick(const char * const room)
 {
     if (rooms != NULL) {
         muc_room *chat_room = g_hash_table_lookup(rooms, room);
@@ -181,109 +181,10 @@ room_get_nick_for_room(const char * const room)
 }
 
 /*
- * Get the room name part of the full JID, e.g.
- * Full JID = "test@conference.server/person"
- * returns "test@conference.server"
- */
-char *
-room_get_room_from_full_jid(const char * const full_room_jid)
-{
-    char **tokens = g_strsplit(full_room_jid, "/", 0);
-    char *room_part;
-
-    if (tokens == NULL || tokens[0] == NULL) {
-        return NULL;
-    } else {
-        room_part = strdup(tokens[0]);
-
-        g_strfreev(tokens);
-
-        return room_part;
-    }
-}
-
-/*
- * Returns TRUE if the JID is a room JID
- * The test is that the passed JID does not contain a "/"
- */
-gboolean
-room_from_jid_is_room(const char * const room_jid)
-{
-    gchar *result = g_strrstr(room_jid, "/");
-    return (result == NULL);
-}
-
-/*
- * Get the nickname part of the full JID, e.g.
- * Full JID = "test@conference.server/person"
- * returns "person"
- */
-char *
-room_get_nick_from_full_jid(const char * const full_room_jid)
-{
-    char **tokens = g_strsplit(full_room_jid, "/", 0);
-    char *nick_part;
-
-    if (tokens == NULL || tokens[1] == NULL) {
-        return NULL;
-    } else {
-        nick_part = strdup(tokens[1]);
-
-        g_strfreev(tokens);
-
-        return nick_part;
-    }
-}
-
-/*
- * Given a room name, and a nick name create and return a full JID of the form
- * room@server/nick
- * Will return a newly created string that must be freed by the caller
- */
-char *
-room_create_full_room_jid(const char * const room, const char * const nick)
-{
-    GString *full_jid = g_string_new(room);
-    g_string_append(full_jid, "/");
-    g_string_append(full_jid, nick);
-
-    char *result = strdup(full_jid->str);
-
-    g_string_free(full_jid, TRUE);
-
-    return result;
-}
-
-/*
- * 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
-room_parse_room_jid(const char * const full_room_jid, char **room, char **nick)
-{
-    char **tokens = g_strsplit(full_room_jid, "/", 0);
-
-    if (tokens == NULL || tokens[0] == NULL || tokens[1] == NULL) {
-        return FALSE;
-    } else {
-        *room = strdup(tokens[0]);
-        *nick = strdup(tokens[1]);
-
-        g_strfreev(tokens);
-
-        return TRUE;
-    }
-}
-
-/*
  * Returns TRUE if the specified nick exists in the room's roster
  */
 gboolean
-room_nick_in_roster(const char * const room, const char * const nick)
+muc_nick_in_roster(const char * const room, const char * const nick)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -303,7 +204,7 @@ room_nick_in_roster(const char * const room, const char * const nick)
  * Add a new chat room member to the room's roster
  */
 gboolean
-room_add_to_roster(const char * const room, const char * const nick,
+muc_add_to_roster(const char * const room, const char * const nick,
     const char * const show, const char * const status)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
@@ -331,7 +232,7 @@ room_add_to_roster(const char * const room, const char * const nick,
  * Remove a room member from the room's roster
  */
 void
-room_remove_from_roster(const char * const room, const char * const nick)
+muc_remove_from_roster(const char * const room, const char * const nick)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -346,7 +247,7 @@ room_remove_from_roster(const char * const room, const char * const nick)
  * The list is owned by the room and must not be mofified or freed
  */
 GList *
-room_get_roster(const char * const room)
+muc_get_roster(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -361,7 +262,7 @@ room_get_roster(const char * const room)
  * Return a PAutocomplete representing the room member's in the roster
  */
 PAutocomplete
-room_get_nick_ac(const char * const room)
+muc_get_roster_ac(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -376,7 +277,7 @@ room_get_nick_ac(const char * const room)
  * Set to TRUE when the rooms roster has been fully recieved
  */
 void
-room_set_roster_received(const char * const room)
+muc_set_roster_received(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -389,7 +290,7 @@ room_set_roster_received(const char * const room)
  * Returns TRUE id the rooms roster has been fully recieved
  */
 gboolean
-room_get_roster_received(const char * const room)
+muc_get_roster_received(const char * const room)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
@@ -405,14 +306,14 @@ room_get_roster_received(const char * const room)
  * is in progress
  */
 void
-room_add_pending_nick_change(const char * const room,
+muc_set_roster_pending_nick_change(const char * const room,
     const char * const new_nick, const char * const old_nick)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
 
     if (chat_room != NULL) {
         g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(old_nick));
-        room_remove_from_roster(room, old_nick);
+        muc_remove_from_roster(room, old_nick);
     }
 }
 
@@ -423,7 +324,7 @@ room_add_pending_nick_change(const char * const room,
  * the caller
  */
 char *
-room_complete_pending_nick_change(const char * const room,
+muc_complete_roster_nick_change(const char * const room,
     const char * const nick)
 {
     muc_room *chat_room = g_hash_table_lookup(rooms, room);
@@ -443,8 +344,107 @@ room_complete_pending_nick_change(const char * const room,
     return NULL;
 }
 
+/*
+ * Get the room name part of the full JID, e.g.
+ * Full JID = "test@conference.server/person"
+ * returns "test@conference.server"
+ */
+char *
+room_get_room_from_full_jid(const char * const full_room_jid)
+{
+    char **tokens = g_strsplit(full_room_jid, "/", 0);
+    char *room_part;
+
+    if (tokens == NULL || tokens[0] == NULL) {
+        return NULL;
+    } else {
+        room_part = strdup(tokens[0]);
+
+        g_strfreev(tokens);
+
+        return room_part;
+    }
+}
+
+/*
+ * Returns TRUE if the JID is a room JID
+ * The test is that the passed JID does not contain a "/"
+ */
+gboolean
+room_from_jid_is_room(const char * const room_jid)
+{
+    gchar *result = g_strrstr(room_jid, "/");
+    return (result == NULL);
+}
+
+/*
+ * Get the nickname part of the full JID, e.g.
+ * Full JID = "test@conference.server/person"
+ * returns "person"
+ */
+char *
+room_get_nick_from_full_jid(const char * const full_room_jid)
+{
+    char **tokens = g_strsplit(full_room_jid, "/", 0);
+    char *nick_part;
+
+    if (tokens == NULL || tokens[1] == NULL) {
+        return NULL;
+    } else {
+        nick_part = strdup(tokens[1]);
+
+        g_strfreev(tokens);
+
+        return nick_part;
+    }
+}
+
+/*
+ * Given a room name, and a nick name create and return a full JID of the form
+ * room@server/nick
+ * Will return a newly created string that must be freed by the caller
+ */
+char *
+room_create_full_room_jid(const char * const room, const char * const nick)
+{
+    GString *full_jid = g_string_new(room);
+    g_string_append(full_jid, "/");
+    g_string_append(full_jid, nick);
+
+    char *result = strdup(full_jid->str);
+
+    g_string_free(full_jid, TRUE);
+
+    return result;
+}
+
+/*
+ * 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
+room_parse_room_jid(const char * const full_room_jid, char **room, char **nick)
+{
+    char **tokens = g_strsplit(full_room_jid, "/", 0);
+
+    if (tokens == NULL || tokens[0] == NULL || tokens[1] == NULL) {
+        return FALSE;
+    } else {
+        *room = strdup(tokens[0]);
+        *nick = strdup(tokens[1]);
+
+        g_strfreev(tokens);
+
+        return TRUE;
+    }
+}
+
 static void
-_room_free(muc_room *room)
+_free_room(muc_room *room)
 {
     if (room != NULL) {
         if (room->room != NULL) {
diff --git a/src/muc.h b/src/muc.h
index 8a557ea3..f4a15c9a 100644
--- a/src/muc.h
+++ b/src/muc.h
@@ -27,33 +27,37 @@
 
 #include "prof_autocomplete.h"
 
-void room_join(const char * const room, const char * const nick);
-void room_change_nick(const char * const room, const char * const nick);
-void room_leave(const char * const room);
-gboolean room_is_active(const char * const full_room_jid);
-char * room_get_nick_for_room(const char * const room);
-char * room_get_room_from_full_jid(const char * const full_room_jid);
-char * room_get_nick_from_full_jid(const char * const full_room_jid);
-gboolean room_parse_room_jid(const char * const full_room_jid, char **room,
-    char **nick);
-gboolean room_add_to_roster(const char * const room, const char * const nick,
+void muc_join_room(const char * const room, const char * const nick);
+void muc_leave_room(const char * const room);
+gboolean muc_room_is_active(const char * const full_room_jid);
+GList* muc_get_active_room_list(void);
+char * muc_get_room_nick(const char * const room);
+
+void muc_set_room_pending_nick_change(const char * const room);
+gboolean muc_is_room_pending_nick_change(const char * const room);
+void muc_complete_room_nick_change(const char * const room,
+    const char * const nick);
+
+gboolean muc_add_to_roster(const char * const room, const char * const nick,
     const char * const show, const char * const status);
-void room_add_pending_nick_change(const char * const room,
+void muc_remove_from_roster(const char * const room, const char * const nick);
+GList * muc_get_roster(const char * const room);
+PAutocomplete muc_get_roster_ac(const char * const room);
+gboolean muc_nick_in_roster(const char * const room, const char * const nick);
+void muc_set_roster_received(const char * const room);
+gboolean muc_get_roster_received(const char * const room);
+
+void muc_set_roster_pending_nick_change(const char * const room,
     const char * const new_nick, const char * const old_nick);
-char* room_complete_pending_nick_change(const char * const room,
+char* muc_complete_roster_nick_change(const char * const room,
     const char * const nick);
-gboolean room_nick_in_roster(const char * const room, const char * const nick);
-gboolean room_from_jid_is_room(const char * const room_jid);
-PAutocomplete room_get_nick_ac(const char * const room);
 
-GList * room_get_roster(const char * const room);
-void room_set_roster_received(const char * const room);
-gboolean room_get_roster_received(const char * const room);
-void room_remove_from_roster(const char * const room, const char * const nick);
+gboolean room_from_jid_is_room(const char * const room_jid);
 char * room_create_full_room_jid(const char * const room,
     const char * const nick);
-void room_set_pending_nick_change(const char * const room);
-gboolean room_is_pending_nick_change(const char * const room);
-GList* room_get_rooms(void);
+char * room_get_room_from_full_jid(const char * const full_room_jid);
+char * room_get_nick_from_full_jid(const char * const full_room_jid);
+gboolean room_parse_room_jid(const char * const full_room_jid, char **room,
+    char **nick);
 
 #endif
diff --git a/src/profanity.c b/src/profanity.c
index 4ca9a52a..a16ea474 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -296,7 +296,7 @@ prof_handle_room_broadcast(const char *const room_jid,
 void
 prof_handle_room_roster_complete(const char * const room)
 {
-    room_set_roster_received(room);
+    muc_set_roster_received(room);
     win_show_room_roster(room);
     win_current_page_off();
 }
@@ -306,7 +306,7 @@ prof_handle_room_member_presence(const char * const room,
     const char * const nick, const char * const show,
     const char * const status)
 {
-    gboolean updated = room_add_to_roster(room, nick, show, status);
+    gboolean updated = muc_add_to_roster(room, nick, show, status);
 
     if (updated) {
         win_show_room_member_presence(room, nick, show, status);
@@ -318,7 +318,7 @@ void
 prof_handle_room_member_online(const char * const room, const char * const nick,
     const char * const show, const char * const status)
 {
-    room_add_to_roster(room, nick, show, status);
+    muc_add_to_roster(room, nick, show, status);
     win_show_room_member_online(room, nick, show, status);
     win_current_page_off();
 }
@@ -327,7 +327,7 @@ void
 prof_handle_room_member_offline(const char * const room, const char * const nick,
     const char * const show, const char * const status)
 {
-    room_remove_from_roster(room, nick);
+    muc_remove_from_roster(room, nick);
     win_show_room_member_offline(room, nick);
     win_current_page_off();
 }
@@ -335,7 +335,7 @@ prof_handle_room_member_offline(const char * const room, const char * const nick
 void
 prof_handle_leave_room(const char * const room)
 {
-    room_leave(room);
+    muc_leave_room(room);
 }
 
 void
diff --git a/src/windows.c b/src/windows.c
index 869d6cbb..aeba6cd4 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -752,7 +752,7 @@ win_show_outgoing_msg(const char * const from, const char * const to,
     // create new window
     if (win_index == NUM_WINS) {
 
-        if (room_is_active(to)) {
+        if (muc_room_is_active(to)) {
             win_index = _new_prof_win(to, WIN_PRIVATE);
         } else {
             win_index = _new_prof_win(to, WIN_CHAT);
@@ -810,7 +810,7 @@ win_show_room_roster(const char * const room)
     int win_index = _find_prof_win_index(room);
     WINDOW *win = windows[win_index]->win;
 
-    GList *roster = room_get_roster(room);
+    GList *roster = muc_get_roster(room);
 
     if ((roster == NULL) || (g_list_length(roster) == 0)) {
         wattron(win, COLOUR_ROOMINFO);
@@ -982,7 +982,7 @@ win_show_room_message(const char * const room_jid, const char * const nick,
     WINDOW *win = windows[win_index]->win;
 
     _win_show_time(win);
-    if (strcmp(nick, room_get_nick_for_room(room_jid)) != 0) {
+    if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
         if (strncmp(message, "/me ", 4) == 0) {
             wattron(win, COLOUR_THEM);
             wprintw(win, "*%s ", nick);
@@ -1020,7 +1020,7 @@ win_show_room_message(const char * const room_jid, const char * const nick,
             dirty = TRUE;
         }
 
-        if (strcmp(nick, room_get_nick_for_room(room_jid)) != 0) {
+        if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
             if (prefs_get_flash()) {
                 flash();
             }
@@ -1029,7 +1029,7 @@ win_show_room_message(const char * const room_jid, const char * const nick,
         windows[win_index]->unread++;
     }
 
-    if (strcmp(nick, room_get_nick_for_room(room_jid)) != 0) {
+    if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
         if (prefs_get_beep()) {
             beep();
         }