From 3206c864301431ea3c9024f84e50f2274e8deb0f Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Mon, 14 Jul 2014 00:30:46 +0200
Subject: Don't forget that channels have users
---
src/kike.c | 31 ++++++++++++++++++++++++++++---
1 file 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);
--
cgit v1.2.3-70-g09d2