/* * Copyright (c) 2022 joshua stein * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __FOLDER_H__ #define __FOLDER_H__ #include #include #include "db.h" #include "session.h" #include "settings.h" #include "sha1.h" struct folder { unsigned long id; char name[32]; char description[100]; bool restricted_posting; bool restricted_viewing; unsigned long last_upload_at; unsigned long file_count; char path[FILENAME_MAX]; struct bile *bile; }; extern const struct struct_field folder_fields[]; extern const size_t nfolder_fields; extern const struct bile_object_field folder_object_fields[]; extern const size_t nfolder_object_fields; struct folder_file { unsigned long id; time_t time; unsigned long uploader_user_id; #define FOLDER_FILE_FILENAME_LENGTH 31 char filename[FOLDER_FILE_FILENAME_LENGTH]; #define FOLDER_FILE_DESCR_LENGTH 50 char description[FOLDER_FILE_DESCR_LENGTH]; size_t size; char sha1_checksum[SHA1_DIGEST_STRING_LENGTH + 1]; /* 42 */ size_t notes_size; char *notes; }; extern const struct bile_object_field folder_file_object_fields[]; extern const size_t nfolder_file_object_fields; void folder_list(struct session *s); #endif