/*
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
* Copyright (c) 2019, 2020 Alex-David Denes
*
* uIRC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* uIRC 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with uIRC. If not, see .
*/
/*! \file */
#include // llist_t
#include // uintmax_t
#include // bool
#ifndef UIRC_GUARD_PUBLIC_TYPES
#define UIRC_GUARD_PUBLIC_TYPES
enum IRC_Buffer_Types { IRC_DIRECT, IRC_CHANNEL, IRC_GLOBAL };
typedef unsigned short IRC_Modes;
typedef uintmax_t IRC_Counter;
#ifdef UIRC_FEATURE_IRCV3
typedef struct {
char *key, *value;
bool clientbound;
} IRC_Tag;
typedef struct {
char* name;
bool active;
} IRC_Capability;
#endif /* UIRC_FEATURE_IRCV3 */
typedef struct {
char * nick, *user, *host, *real;
IRC_Modes modes;
bool is_service;
} IRC_User;
#define IRC_MAXARGS 15
typedef struct {
IRC_User* source;
char* command;
char* args[IRC_MAXARGS]; /* 0-13 + trailing, ended early with a NULL */
bool trailing; /* Tells if the last argument is trailing */
#ifdef UIRC_FEATURE_IRCV3
llist_t* tag_list;
#endif /* UIRC_FEATURE_IRCV3 */
} IRC_Message;
typedef struct {
enum IRC_Buffer_Types type;
char * name, *topic, *key;
bool subscribed;
IRC_Modes modes;
llist_t * user_list, *message_list;
} IRC_Buffer;
typedef struct {
char * addr, *svc;
IRC_User* user;
IRC_Buffer* buf_list;
#ifdef UIRC_FEATURE_IRCV3
llist_t* cap_list;
#endif /* UIRC_FEATURE_IRCV3 */
} IRC_Network;
#endif /* UIRC_GUARD_PUBLIC_TYPES */