about summary refs log tree commit diff stats
path: root/src/muc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/muc.c')
-rw-r--r--src/muc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/muc.c b/src/muc.c
index 11a707a4..4ba88191 100644
--- a/src/muc.c
+++ b/src/muc.c
@@ -34,6 +34,7 @@ typedef struct _muc_room_t {
     char *nick; // e.g. Some User
     char *password;
     char *subject;
+    gboolean autojoin;
     gboolean pending_nick_change;
     GHashTable *roster;
     Autocomplete nick_ac;
@@ -126,7 +127,8 @@ muc_clear_invites(void)
  * Join the chat room with the specified nickname
  */
 void
-muc_join_room(const char * const room, const char * const nick, const char * const password)
+muc_join_room(const char * const room, const char * const nick,
+    const char * const password, gboolean autojoin)
 {
     if (rooms == NULL) {
         rooms = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
@@ -149,6 +151,7 @@ muc_join_room(const char * const room, const char * const nick, const char * con
         g_free, g_free);
     new_room->roster_received = FALSE;
     new_room->pending_nick_change = FALSE;
+    new_room->autojoin = autojoin;
 
     g_hash_table_insert(rooms, strdup(room), new_room);
 }
@@ -183,6 +186,22 @@ muc_room_is_active(const char * const room)
     }
 }
 
+gboolean
+muc_room_is_autojoin(const char * const room)
+{
+    if (rooms != NULL) {
+        ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
+
+        if (chat_room != NULL) {
+            return chat_room->autojoin;
+        } else {
+            return FALSE;
+        }
+    } else {
+        return FALSE;
+    }
+}
+
 char *
 muc_get_old_nick(const char * const room, const char * const new_nick)
 {
@@ -504,4 +523,4 @@ gint _compare_participants(PContact a, PContact b)
     g_free(key_b);
 
     return result;
-}
+}
\ No newline at end of file