diff --git a/include/helpers.h b/include/helpers.h index 4c578c3..9cca5e8 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -21,49 +21,63 @@ #ifndef _UIRC_INCLUDED_HELPERS #define _UIRC_INCLUDED_HELPERS -extern IRC_Message* Assm_cmd_NICK(char* nick); + +extern 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) + +#define Assm_cmd_JOIN(channels, keys) Assm_AUTO(JOIN, true, (char*[]){channels, keys, NULL}, 1) +#define Assm_cmd_PART(channel, message) Assm_AUTO(PART, true, (char*[]){channel, message, NULL}, 1) +/* 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_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) + extern IRC_Message* Assm_cmd_USER(char* user, char* realname, int modes); -extern IRC_Message* Assm_cmd_PASS(char* password); -extern IRC_Message* Assm_cmd_OPER(char* name, char* password); -extern IRC_Message* Assm_cmd_MODE(char* nick, char* modes, char* modeparams); -extern IRC_Message* Assm_cmd_SERVICE(char* nickname, char* distribution, char* type, char* info); -extern IRC_Message* Assm_cmd_QUIT(char* mesg); -extern IRC_Message* Assm_cmd_SQUIT(char* server, char* comment); -extern IRC_Message* Assm_cmd_JOIN(char* channels, char* keys); -extern IRC_Message* Assm_cmd_PART(char* channel, char* message); -extern IRC_Message* Assm_cmd_TOPIC(char* channel, char* topic); -extern IRC_Message* Assm_cmd_NAMES(char* channels, char* target); -extern IRC_Message* Assm_cmd_LIST(char* channels, char* target); -extern IRC_Message* Assm_cmd_INVITE(char* nick, char* channel); -extern IRC_Message* Assm_cmd_KICK(char* channels, char* users, char* comment); -extern IRC_Message* Assm_cmd_PRIVMSG(char* target, char* message); -extern IRC_Message* Assm_cmd_NOTICE(char* target, char* text); -extern IRC_Message* Assm_cmd_MOTD(char* target); -extern IRC_Message* Assm_cmd_LUSERS(char* mask, char* target); -extern IRC_Message* Assm_cmd_VERSION(char* target); -extern IRC_Message* Assm_cmd_STATS(char* query, char* target); extern IRC_Message* Assm_cmd_LINKS(char* remoteserv, char* servmask); -extern IRC_Message* Assm_cmd_TIME(char* target); -extern IRC_Message* Assm_cmd_CONNECT(char* target, char* port, char* remote); -extern IRC_Message* Assm_cmd_TRACE(char* target); -extern IRC_Message* Assm_cmd_ADMIN(char* target); -extern IRC_Message* Assm_cmd_INFO(char* target); -extern IRC_Message* Assm_cmd_SERVLIST(char* mask, char* type); -extern IRC_Message* Assm_cmd_SQUERY(char* servicename, char* text); extern IRC_Message* Assm_cmd_WHO(char* mask, bool oper); extern IRC_Message* Assm_cmd_WHOIS(char* target, char* mask); extern IRC_Message* Assm_cmd_WHOWAS(char* nick, char* count, char* target); -extern IRC_Message* Assm_cmd_KILL(char* nick, char* comment); extern IRC_Message* Assm_cmd_PING(char* source, char* target); -extern IRC_Message* Assm_cmd_PONG(char* source, char* target); -extern IRC_Message* Assm_cmd_ERROR(char* message); -extern IRC_Message* Assm_cmd_AWAY(char* mesg); -extern IRC_Message* Assm_cmd_REHASH(void); -extern IRC_Message* Assm_cmd_DIE(void); -extern IRC_Message* Assm_cmd_RESTART(void); extern IRC_Message* Assm_cmd_SUMMON(char* user, char* target, char* channel); -extern IRC_Message* Assm_cmd_USERS(char* target); -extern IRC_Message* Assm_cmd_WALLOPS(char* text); extern IRC_Message* Assm_cmd_USERHOST(char* users[]); extern IRC_Message* Assm_cmd_ISON(char* users[]);