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/functions.h

48 lines
1.9 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/>.
*/
#include "types.h"
#include <stdbool.h>
#include <sys/types.h>
#ifndef _UIRC_INCLUDED_FUNCT
#define _UIRC_INCLUDED_FUNCT
/* Tokenizers: They take a string in and point their struct element pointers at tokens and end tokens with '\0' */
extern signed int Tok_mesg(char* str, IRC_Message* out);
extern signed int Tok_user(char* str, IRC_User* out, bool useorig);
#ifdef UIRC_IRCV3
extern signed int Tok_tags(char* str, IRC_Tags* out);
#endif
/* Assemblers: They return the amount of bytes written and write directly at buf */
extern signed int Assm_mesg(char* buf, IRC_Message* in, size_t len);
extern signed int Assm_user(char* buf, IRC_User* in, size_t len, bool useorig);
#ifdef UIRC_IRCV3
extern signed int Assm_tags(char* buf, IRC_Tags* in, size_t len);
#endif
/* Validators: They check that the parsed message is valid and follows the standard */
extern signed int Val_mesg(IRC_Message* mesg);
extern signed int Val_channame(char* chan);
extern signed int Val_type_nocrlf(char* str);
extern signed int Val_type_nospcl(char* str);
extern signed int Val_type_noblcm(char* str);
/* Converters: They convert from one format to another */
extern signed int Ircmd_stoi(char* str);
#endif