summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-07-14 00:30:46 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-07-14 00:36:16 +0200
commit3206c864301431ea3c9024f84e50f2274e8deb0f (patch)
tree3a34cfacb27fc6c6e13b57749e69ba8dc9e11389
parentd40d34b4caea7510eda9a0edebde3458de4bda5b (diff)
downloadxK-3206c864301431ea3c9024f84e50f2274e8deb0f.tar.gz
xK-3206c864301431ea3c9024f84e50f2274e8deb0f.tar.xz
xK-3206c864301431ea3c9024f84e50f2274e8deb0f.zip
Don't forget that channels have users
-rw-r--r--src/kike.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/kike.c b/src/kike.c
index edf38ae..a927350 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -201,6 +201,8 @@ irc_validate_nickname (const char *nickname)
// --- Application data --------------------------------------------------------
+#define IRC_SUPPORTED_USER_MODES "aiwros"
+
enum
{
IRC_USER_MODE_INVISIBLE = (1 << 0),
@@ -266,15 +268,29 @@ connection_free (struct connection *self)
free (self->away_message);
}
+#define IRC_SUPPORTED_CHAN_MODES "ov" "imnqpst" "kl"
+
enum
{
IRC_CHAN_MODE_INVITE_ONLY = (1 << 0),
IRC_CHAN_MODE_MODERATED = (1 << 1),
IRC_CHAN_MODE_NO_OUTSIDE_MSGS = (1 << 2),
- IRC_CHAN_MODE_SECRET = (1 << 3),
+ IRC_CHAN_MODE_QUIET = (1 << 3),
IRC_CHAN_MODE_PRIVATE = (1 << 4),
- IRC_CHAN_MODE_PROTECTED_TOPIC = (1 << 5),
- IRC_CHAN_MODE_QUIET = (1 << 6)
+ IRC_CHAN_MODE_SECRET = (1 << 5),
+ IRC_CHAN_MODE_PROTECTED_TOPIC = (1 << 6),
+
+ IRC_CHAN_MODE_OPERATOR = (1 << 7),
+ IRC_CHAN_MODE_VOICE = (1 << 8)
+};
+
+struct channel_user
+{
+ struct channel_user *prev;
+ struct channel_user *next;
+
+ unsigned modes;
+ char nickname[];
};
struct channel
@@ -286,6 +302,8 @@ struct channel
char *key; ///< Channel key
long user_limit; ///< User limit or -1
+ struct channel_user *users; ///< Channel users
+
struct str_vector ban_list; ///< Ban list
struct str_vector exception_list; ///< Exceptions from bans
struct str_vector invite_list; ///< Exceptions from +I
@@ -307,6 +325,13 @@ channel_free (struct channel *self)
free (self->name);
free (self->key);
+ struct channel_user *link, *tmp;
+ for (link = self->users; link; link = tmp)
+ {
+ tmp = link->next;
+ free (link);
+ }
+
str_vector_free (&self->ban_list);
str_vector_free (&self->exception_list);
str_vector_free (&self->invite_list);