Don't forget that channels have users

This commit is contained in:
Přemysl Eric Janouch 2014-07-14 00:30:46 +02:00
parent d40d34b4ca
commit 3206c86430
1 changed files with 28 additions and 3 deletions

View File

@ -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);