From e9d4ad3c33b81ff56c4e4b2cac4aad559a303104 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 15 Sep 2019 14:47:44 +0100 Subject: Start tracking nicks in channels (upon JOIN/PART/QUIT/NICK) and use that to correctly log QUITs in the replay log and normal log(s). --- functions.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'functions.h') diff --git a/functions.h b/functions.h index 5afdca0..614137d 100644 --- a/functions.h +++ b/functions.h @@ -53,6 +53,8 @@ #define MAXCHANNELS 1024 // Let's assume 1024 is reasonable for now (it's configured per IRCd) #define MAXRFCNICKLEN 9 // From RFC 1459 +#define MAXTOKENS 100 // For strsep string splitting + #define VERSION "0.1.1" // Blabouncer version // Write debug string to file. @@ -67,6 +69,7 @@ int getstdin(char *prompt, char *buff, size_t sz); void appendcrlf(char *string); // Remove leading colon ':' which is the starting character of a prefix in an IRC message +// If no leading colon present, string is left unchanged void stripprefix(char *string); // Extract final parameter from IRC message, removing the leading colon ':' @@ -183,4 +186,26 @@ int getclientcodetime(char *code, struct clientcodes *clientcodes); // Replace any instances of "find" with "replace" in the string "str" void replacechar(char *str, char find, char replace); +// Add nick (passed as a :nick!user@host) to channel 'channel' +// Returns 1 on success or 0 on failure +int addnicktochannel(char *nickuserhost, char *channel, struct channel *channels); + +// Remove nick(passed as a :nick!user@host) from channel 'channel' +// Returns 1 on success or 0 on failure +int removenickfromchannel(char *nickuserhost, char *channel, struct channel *channels); + +// Remove nick (passed as a :nick!user@host) from all channels +// Returns 1 on success or 0 on failure +int removenickfromallchannels(char *nickuserhost, struct channel *channels); + +// Update old nick (passed as a :nick!user@host) to 'newnick' in all channels +// Returns 1 on success or 0 on failure +int updatenickinallchannels(char *nickuserhost, char *newnick, struct channel *channels); + +// Populate our channels struct with all nicks in a RPL_NAMREPLY +// Returns 1 on success or 0 on failure +int addnamereplytochannel(char *namereply, struct channel *channels); + +// Strips all leading prefixes (colons, user modes) from a nick +void stripprefixesfromnick(char *nick); #endif -- cgit v1.2.3