/*
* 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 .
*/
#include "../include/mappings.h"
#include "../include/types.h"
#include
#include
#include
#include
#ifndef _UIRC_INCLUDED_ASSM
#define _UIRC_INCLUDED_ASSM
char* RESERVED;
void clear_assm(void);
IRC_Message* Assm_AUTO(int cmd, bool trailing, char** args, int req);
#define Assm_cmd_REHASH() Assm_AUTO(REHASH, false, (char*[]){NULL}, 0)
#define Assm_cmd_DIE() Assm_AUTO(DIE, false, (char*[]){NULL}, 0)
#define Assm_cmd_RESTART() Assm_AUTO(RESTART, false, (char*[]){NULL}, 0)
#define Assm_cmd_QUIT(message) Assm_AUTO(QUIT, true, (char*[]){message, NULL}, 0)
#define Assm_cmd_MOTD(target) Assm_AUTO(MOTD, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_VERSION(target) Assm_AUTO(VERSION, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_TIME(target) Assm_AUTO(TIME, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_TRACE(target) Assm_AUTO(TRACE, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_ADMIN(target) Assm_AUTO(ADMIN, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_INFO(target) Assm_AUTO(INFO, false, (char*[]){target, NULL}, 0)
#define Assm_cmd_AWAY(message) Assm_AUTO(AWAY, false, (char*[]){message, NULL}, 0)
#define Assm_cmd_PASS(password) Assm_AUTO(PASS, true, (char*[]){password, NULL}, 1)
#define Assm_cmd_ERROR(message) Assm_AUTO(ERROR, true, (char*[]){message, NULL}, 1)
#define Assm_cmd_WALLOPS(text) Assm_AUTO(WALLOPS, true, (char*[]){text, NULL}, 1)
#define Assm_cmd_NICK(nickname) Assm_AUTO(NICK, false, (char*[]){nickname, NULL}, 1)
#define Assm_cmd_USERS(target) Assm_AUTO(USERS, false, (char*[]){target, NULL}, 1)
#define Assm_cmd_NAMES(channels, target) Assm_AUTO(NAMES, false, (char*[]){channels, target, NULL}, 0)
#define Assm_cmd_LIST(channels, target) Assm_AUTO(LIST, false, (char*[]){channels, target, NULL}, 0)
#define Assm_cmd_LUSERS(mask, target) Assm_AUTO(LUSERS, false, (char*[]){mask, target, NULL}, 0)
#define Assm_cmd_STATS(query, target) Assm_AUTO(STATS, false, (char*[]){query, target, NULL}, 0)
#define Assm_cmd_SERVLIST(mask, type) Assm_AUTO(SERVLIST, false, (char*[]){mask, type, NULL}, 0)
/* NOTE: Use a non-NULL address (pointing at a "\0") as the topic to clear it and use a NULL address to check it
* Blame the protocol, not this >:C */
#define Assm_cmd_TOPIC(channel, topic) Assm_AUTO(TOPIC, true, (char*[]){channel, topic, NULL}, 1)
#define Assm_cmd_PONG(source, target) Assm_AUTO(PONG, true, (char*[]){source, target, NULL}, 1)
#define Assm_cmd_JOIN(channels, keys) Assm_AUTO(JOIN, false, (char*[]){channels, keys, NULL}, 1)
#define Assm_cmd_PART(channel, message) Assm_AUTO(PART, false, (char*[]){channel, message, NULL}, 1)
#define Assm_cmd_OPER(name, password) Assm_AUTO(OPER, true, (char*[]){name, password, NULL}, 2)
#define Assm_cmd_SQUIT(server, comment) Assm_AUTO(SQUIT, true, (char*[]){server, comment, NULL}, 2)
#define Assm_cmd_PRIVMSG(target, message) Assm_AUTO(PRIVMSG, true, (char*[]){target, message, NULL}, 2)
#define Assm_cmd_NOTICE(target, text) Assm_AUTO(NOTICE, true, (char*[]){target, text, NULL}, 2)
#define Assm_cmd_SQUERY(servicename, text) Assm_AUTO(SQUERY, true, (char*[]){servicename, text, NULL}, 2)
#define Assm_cmd_KILL(nick, comment) Assm_AUTO(KILL, true, (char*[]){nick, comment, NULL}, 2)
#define Assm_cmd_INVITE(nick, channel) Assm_AUTO(INVITE, false, (char*[]){nick, channel, NULL}, 2)
#define Assm_cmd_MODE(nickname, modes, modeparams) Assm_AUTO(MODE, false, (char*[]){nickname, modes, modeparams, NULL}, 1)
#define Assm_cmd_KICK(channels, users, comment) Assm_AUTO(KICK, true, (char*[]){channels, users, comment, NULL}, 2)
#define Assm_cmd_CONNECT(target, port, remote) Assm_AUTO(CONNECT, false, (char*[]){target, port, remote, NULL}, 2)
#define Assm_cmd_SERVICE(nickname, distribution, type, info) Assm_AUTO(SERVICE, true, (char*[]){nickname, RESERVED, distribution, "0", RESERVED, info, NULL}, 6)
IRC_Message* Assm_cmd_USER(char* user, char* realname, int modes);
IRC_Message* Assm_cmd_LINKS(char* remoteserv, char* servmask);
IRC_Message* Assm_cmd_WHO(char* mask, bool oper);
IRC_Message* Assm_cmd_WHOIS(char* target, char* mask);
IRC_Message* Assm_cmd_WHOWAS(char* nick, char* count, char* target);
IRC_Message* Assm_cmd_PING(char* source, char* target);
IRC_Message* Assm_cmd_SUMMON(char* user, char* target, char* channel);
IRC_Message* Assm_cmd_USERHOST(char* users[]);
IRC_Message* Assm_cmd_ISON(char* users[]);
void Tok_cmd_PING(IRC_Message* mesg, char** source, char** target);
void Tok_FArgOpt(IRC_Message* mesg, char** optarg, char** reqarg);
#endif