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/uirc/tokenizer.h

65 lines
2.1 KiB
C

/*
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
* Copyright (c) 2019-2021 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 "uirc/type.h" // IRC_User
#include <corelibs/llist.h> // llist_t
#include <stdbool.h> // bool
#ifndef UIRC_GUARD_PUBLIC_TOKENIZERS
#define UIRC_GUARD_PUBLIC_TOKENIZERS
#ifdef UIRC_FEATURE_IRCV3
/*!
* \brief Tokenize IRCv3 tags
*
* This function parses IRCv3 tags according to the specification at https://ircv3.net/specs/extensions/message-tags
*
* \param[in] str String containing list of tags
*/
llist_t* uirc_tokenizer_tag_list(const char* str);
/*!
* \brief Tokenize IRCv3 tag
*
* This function tokenizes a individual tag in format key=value
* \param[in] str String containing the key and optionally it's value
*/
IRC_Tag* uirc_tokenizer_tag(const char* str);
#endif /* UIRC_FEATURE_IRCV3 */
/*!
* \brief Tokenize a IRC message source.
*
* This function takes the source part of a message, pointing struct elements to parts of it.
* \param[in] str String containing a IRC source with or without the ':' prefix
*/
IRC_User* uirc_tokenizer_user(const char* str);
/*!
* \brief Tokenize a IRC message string.
*
* This function takes a IRC message and attempts to tokenize/parse it, pointing every element found to it's respective struct element
* \param[in] str String containing a IRC message without the ending '\\r\\n'
*/
IRC_Message* uirc_tokenizer_message(const char* str);
#endif /* UIRC_GUARD_PUBLIC_TOKENIZERS */