From c70cd5cccc966a35f175913f2281ce251fd62425 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 17 Jun 2019 01:46:28 +0100 Subject: Implement a per-client identifier so auto replay can replay everything a given client has missed. --- functions.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'functions.h') diff --git a/functions.h b/functions.h index c91bfdc..29ebff5 100644 --- a/functions.h +++ b/functions.h @@ -103,7 +103,7 @@ int sendtoserver(SSL *server_ssl, char *strsrc, int str_len, int clientfd, struc // it from the array of clients. // Also set its authentication and registration statuses to 0. // Also set the pending statuses to 0 -int disconnectclient(int fd, struct client *clients, struct ircdstate *ircdstate, struct settings *settings); +int disconnectclient(int fd, struct client *clients, struct ircdstate *ircdstate, struct settings *settings, struct clientcodes *clientcodes); int createchannel(struct channel *channels, char *name, char *topic, char *topicwho, char *topicwhen); @@ -166,4 +166,16 @@ int rehash(struct settings *settings, char *failuremsg); // Return 0 for password mismatch, or 1 for password match. int checkpassword(char *password, struct settings *settings); +// Adds a client code to the clientcode structure if it doesn't already exist. +// On success, copy it to the client's clientcode field. +// Returns 1 on adding a new code, 0 if the code already existed, or -1 on error. +int addclientcode(int sourcefd, char *code, struct clientcodes *clientcodes, struct client *clients); + +// Sets a given client code as last disconnecting at the current time. +// Returns 1 on success or 0 on failure. +int setclientcodetime(char *code, struct clientcodes *clientcodes); + +// Return the timestamp that a given client last disconnected, or 0 on failure. +int getclientcodetime(char *code, struct clientcodes *clientcodes); + #endif -- cgit v1.2.3