Update copyright year
[umurmur.git] / src / channel.c
index 26e21b913511f05f409f79e6e1eeae7e26615fd6..5ac6924ab3f970c06a8a528775ab4ea0ee1e72cb 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009-2011, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
+/* Copyright (C) 2009-2014, Martin Johansson <martin@fatbob.nu>
+   Copyright (C) 2005-2014, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
 
@@ -153,6 +153,7 @@ void Chan_init()
                if (i == 0) {
                        rootChan = createChannel(0, chdesc.name, chdesc.description);
                        rootChan->noenter = chdesc.noenter;
+                       rootChan->silent = chdesc.silent;
                        list_add_tail(&rootChan->flatlist_node, &channels);
                        if (strcmp(defaultChannelName, chdesc.name) == 0)
                                defaultChan = rootChan;
@@ -161,6 +162,8 @@ void Chan_init()
                        channel_t *ch, *ch_itr = NULL;
                        ch = Chan_createChannel(chdesc.name, chdesc.description);
                        ch->noenter = chdesc.noenter;
+                       ch->position = chdesc.position;
+                       ch->silent = chdesc.silent;
                        if (chdesc.password) {
                                Log_info("Setting password on channel '%s'", ch->name); 
                                ch->password = strdup(chdesc.password);
@@ -312,19 +315,23 @@ int Chan_userJoin_id(int channelid, client_t *client)
 
 channelJoinResult_t Chan_userJoin_id_test(int channelid, client_t *client)
 {
+       channelJoinResult_t result;
        channel_t *ch_itr = NULL;
        do {
                Chan_iterate(&ch_itr);
        } while (ch_itr != NULL && ch_itr->id != channelid);
        if (ch_itr == NULL) {
                Log_warn("Channel id %d not found - ignoring.", channelid);
-               return CHJOIN_NOTFOUND;
+               result.CHJOIN_NOTFOUND = true;
        }
-       else if (ch_itr->noenter)
-               return CHJOIN_NOENTER;
-       else if (ch_itr->password && !Client_token_match(client, ch_itr->password))
-               return CHJOIN_WRONGPW;
-       else return CHJOIN_OK;
+       else
+               result.CHJOIN_NOTFOUND = false;
+
+       result.CHJOIN_NOENTER = ch_itr->noenter;
+       result.CHJOIN_WRONGPW = ch_itr->password && !Client_token_match(client, ch_itr->password) && !client->isAdmin;
+       result.CHJOIN_SILENT = ch_itr->silent;
+
+       return result;
 }
 
 #if 0