From fd14f6fbf8206589d2a0ad8f0793845cb8faf1d7 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 26 Dec 2024 21:18:05 -0800 Subject: stuff --- include/protocol.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'include/protocol.h') diff --git a/include/protocol.h b/include/protocol.h index 7b5eb07..16ba818 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -1,6 +1,14 @@ #ifndef PROTOCOL_H #define PROTOCOL_H +#include +#include + +#include +#include +#include +#include + #define MAX_OP_LEN 10 #define MAX_ARG_LEN 50 #define MAX_ARGS 5 @@ -11,4 +19,50 @@ #define USERNAME_SIZE 30 #define KEYLEN 512 +typedef struct { + string_t *nick; + bool is_guest; + int fd; + + /* list of channels where user is in */ + array_t *channels; + array_t *dms; + array_t *autojoin; + unsigned char passhash[SHA256_DIGEST_LENGTH]; +} user_t; + +typedef struct { + string_t *nick; + string_t *msg; + time_t time; +} message_t; + +typedef struct { + array_t *messages; + + user_t *admin; + array_t *mods; + + bool registered_only; + + bool invite_only; + array_t *allowed_users; + + array_t *users; + + string_t *chan_name; + string_t *desc; +} channel_t; + +typedef struct { + user_t *user1; + user_t *user2; + + array_t *messages; +} dm_t; + +string_t *encode_chanstate(ht_t *chans); + +string_t *encode_usersstate(ht_t *u); + #endif -- cgit