summaryrefslogtreecommitdiff
path: root/functions.h
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-15 14:47:44 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-15 14:47:44 +0100
commite9d4ad3c33b81ff56c4e4b2cac4aad559a303104 (patch)
treec177baee475291dc1545f48c942560351aa92e4f /functions.h
parent4dea4c16313ba3d1575cfa6722d75492c907f551 (diff)
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).
Diffstat (limited to 'functions.h')
-rw-r--r--functions.h25
1 files changed, 25 insertions, 0 deletions
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