This repository has been archived on 2021-04-17. You can view files and clone it, but cannot push or open issues or pull requests.
uIRC/include/types.h

82 lines
2.1 KiB
C

/*
* 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 <https://www.gnu.org/licenses/>.
*/
/*! \file */
#include <corelibs/llist.h> // llist_t
#include <inttypes.h> // uintmax_t
#include <stdbool.h> // 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, *pass, *quitmsg;
IRC_User* user;
llist_t* buf_list;
#ifdef UIRC_FEATURE_IRCV3
llist_t* cap_list;
#endif /* UIRC_FEATURE_IRCV3 */
} IRC_Network;
#endif /* UIRC_GUARD_PUBLIC_TYPES */