Use Client_find_by_session() instead of a few open-coded loops.
[umurmur.git] / src / channel.h
index 61346467cec71597023a659a4ad47a88ed4222fb..d348184f8ccf9602268a49828270999779444af3 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2010, 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.
 
@@ -39,15 +39,16 @@ typedef struct channel {
        int id;
        char *name;
        char *desc;
+       char *password;
        struct channel *parent;
-       bool_t temporary, noenter;
+       bool_t temporary, noenter, silent;
+       int position;
        struct dlist node;
        struct dlist subs;
        struct dlist clients;
        struct dlist flatlist_node;
        struct dlist channel_links;
        int linkcount;
-       struct dlist link_node;
 } channel_t;
 
 typedef struct {
@@ -55,6 +56,13 @@ typedef struct {
        struct dlist node;
 } channellist_t;
 
+typedef struct {
+  bool_t CHJOIN_SILENT,
+       CHJOIN_NOENTER,
+       CHJOIN_WRONGPW,
+       CHJOIN_NOTFOUND;
+} channelJoinResult_t;
+       
 void Chan_init();
 void Chan_free();
 void Chan_addChannel(channel_t *parent, channel_t *sub);
@@ -64,7 +72,7 @@ void Chan_removeClient(channel_t *c, client_t *client);
 int Chan_userJoin(channel_t *ch, client_t *client);
 int Chan_userJoin_id(int channelid, client_t *client);
 int Chan_userLeave(client_t *client);
-bool_t Chan_userJoin_id_test(int channelid);
+channelJoinResult_t Chan_userJoin_id_test(int channelid, client_t *client);
 channel_t *Chan_iterate(channel_t **channelpptr);
 channel_t *Chan_iterate_siblings(channel_t *parent, channel_t **channelpptr);
 channel_t *Chan_createChannel(const char *name, const char *desc);