/*
webchat, an HTML5/websocket chat platform
Copyright (C) 2015
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
struct ban // Note: we don't bother supporting account bans because accounts are so easily remade it's not worth it
{
sa_family_t addr_family;
unsigned int addr_size;
const char* addr;
unsigned int id; // To avoid weirdness with multiple mods reviewing the mod list at the same time
const char* nickname; // For identification in banlist
// TODO: timestamps for further clarification?
};
struct channel
{
const char* name;
unsigned int usercount;
struct user** users;
char* password;
int id;
unsigned int bancount;
struct ban* bans;
// TODO: topic?
};
extern struct channel* getchannel(const char* name);
extern void joinchannel(struct user* user, struct channel* channel);
extern struct user* channel_finduser(struct channel* chan, const unsigned char* nickname);
extern void channel_write(struct channel* chan, unsigned char* msg, unsigned int msglen, unsigned char opcode, struct user* skip);
extern char channel_register(struct channel* channel, struct user* owner);
extern void channel_ban(struct channel* channel, struct user* user);
extern char channel_unban(struct channel* channel, unsigned int id);
extern char channel_checkban(struct channel* channel, struct sockaddr* useraddr);
extern void channel_free(struct channel* channel);
extern char channel_deregister(struct channel* channel);