This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
magicka/bbs.h

211 lines
4.6 KiB
C
Raw Normal View History

2016-03-22 01:48:59 +00:00
#ifndef __BBS_H__
#define __BBS_H__
#include <time.h>
#if defined(ENABLE_WWW)
#include <microhttpd.h>
#endif
#include "lua/lua.h"
#include "lua/lauxlib.h"
2016-03-22 01:48:59 +00:00
#define VERSION_MAJOR 0
2016-08-07 07:41:00 +00:00
#define VERSION_MINOR 3
2016-04-14 01:17:06 +00:00
#define VERSION_STR "alpha"
2016-03-22 01:48:59 +00:00
2016-03-28 04:46:48 +00:00
#define NETWORK_FIDO 1
#define NETWORK_WWIV 2
2016-03-24 07:23:42 +00:00
#define TYPE_LOCAL_AREA 0
#define TYPE_NETMAIL_AREA 1
#define TYPE_ECHOMAIL_AREA 2
struct fido_addr {
unsigned short zone;
unsigned short net;
unsigned short node;
unsigned short point;
};
2016-03-23 05:21:53 +00:00
struct last10_callers {
char name[17];
char location[33];
time_t time;
}__attribute__((packed));
2016-03-27 00:33:43 +00:00
struct text_file {
char *name;
char *path;
};
struct door_config {
char *name;
char key;
char *command;
int stdio;
};
2016-03-22 03:07:42 +00:00
struct mail_area {
char *name;
char *path;
int read_sec_level;
int write_sec_level;
2016-03-24 07:23:42 +00:00
int type;
2016-03-22 03:07:42 +00:00
};
struct mail_conference {
char *name;
char *path;
2016-03-27 03:17:25 +00:00
char *tagline;
2016-03-22 08:19:06 +00:00
int networked;
2016-03-24 07:23:42 +00:00
int nettype;
int realnames;
2016-03-22 03:07:42 +00:00
int sec_level;
int mail_area_count;
struct mail_area **mail_areas;
2016-03-24 07:23:42 +00:00
struct fido_addr *fidoaddr;
2016-03-28 04:46:48 +00:00
int wwivnode;
2016-03-22 03:07:42 +00:00
};
2016-03-24 02:54:15 +00:00
struct file_sub {
char *name;
char *database;
2016-04-02 23:26:17 +00:00
char *upload_path;
2016-03-24 02:54:15 +00:00
int upload_sec_level;
int download_sec_level;
};
struct file_directory {
char *name;
char *path;
int sec_level;
int file_sub_count;
struct file_sub **file_subs;
};
2016-03-22 01:48:59 +00:00
struct bbs_config {
char *bbs_name;
char *sysop_name;
char *pid_file;
2016-03-22 01:48:59 +00:00
char *ansi_path;
char *bbs_path;
2016-04-10 04:10:18 +00:00
char *log_path;
char *script_path;
2016-04-23 04:10:42 +00:00
char *echomail_sem;
char *netmail_sem;
2016-03-27 03:17:25 +00:00
char *default_tagline;
2016-08-06 11:57:12 +00:00
int telnet_port;
int www_server;
int www_port;
char *www_path;
2016-08-06 11:57:12 +00:00
int ssh_server;
int ssh_port;
char *ssh_dsa_key;
char *ssh_rsa_key;
char *string_file;
char *irc_server;
int irc_port;
char *irc_channel;
2016-04-07 04:43:23 +00:00
char *external_editor_cmd;
int external_editor_stdio;
int fork;
2016-03-22 01:48:59 +00:00
int nodes;
int newuserlvl;
2016-04-18 10:34:07 +00:00
int automsgwritelvl;
2016-03-22 03:07:42 +00:00
int mail_conference_count;
struct mail_conference **mail_conferences;
int door_count;
struct door_config **doors;
2016-03-24 02:54:15 +00:00
int file_directory_count;
struct file_directory **file_directories;
2016-03-27 00:33:43 +00:00
int text_file_count;
struct text_file **text_files;
2016-03-22 01:48:59 +00:00
};
struct sec_level_t {
int timeperday;
};
struct user_record {
int id;
char *loginname;
char *password;
2016-08-04 11:41:37 +00:00
char *salt;
2016-03-22 01:48:59 +00:00
char *firstname;
char *lastname;
char *email;
char *location;
int sec_level;
struct sec_level_t *sec_info;
time_t laston;
int timeleft;
2016-03-22 03:07:42 +00:00
int cur_mail_conf;
int cur_mail_area;
int cur_file_dir;
int cur_file_sub;
2016-03-23 06:31:00 +00:00
int timeson;
2016-03-22 01:48:59 +00:00
};
2016-08-06 04:36:36 +00:00
extern void automessage_write(struct user_record *user);
extern void automessage_display();
2016-04-10 04:10:18 +00:00
extern void dolog(char *fmt, ...);
2016-08-07 03:56:33 +00:00
extern void runbbs_ssh(char *ipaddress);
extern void runbbs(int sock, char *ipaddress);
2016-03-24 07:23:42 +00:00
extern struct fido_addr *parse_fido_addr(const char *str);
2016-08-06 04:36:36 +00:00
extern void s_putchar(char c);
extern void s_printf(char *fmt, ...);
extern void s_putstring(char *c);
extern void s_displayansi_p(char *file);
extern void s_displayansi(char *file);
extern char s_getchar();
extern void s_readpass(char *buffer, int max);
extern void s_readstring(char *buffer, int max);
extern char s_getc();
extern void disconnect(char *calledby);
extern void display_info();
extern void display_last10_callers(struct user_record *user);
2016-03-22 01:48:59 +00:00
extern void gen_salt(char **s);
extern char *hash_sha256(char *pass, char *salt);
2016-03-22 01:48:59 +00:00
extern int save_user(struct user_record *user);
extern int check_user(char *loginname);
2016-08-06 04:36:36 +00:00
extern struct user_record *new_user();
extern struct user_record *check_user_pass(char *loginname, char *password);
extern void list_users(struct user_record *user);
2016-03-22 01:48:59 +00:00
2016-08-06 04:36:36 +00:00
extern void main_menu(struct user_record *user);
2016-03-22 03:07:42 +00:00
2016-08-06 04:36:36 +00:00
extern void mail_scan(struct user_record *user);
extern int mail_menu(struct user_record *user);
extern char *editor(struct user_record *user, char *quote, char *from, int email);
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, char *qfrom, char *subject, int email);
2016-08-06 04:36:36 +00:00
extern int door_menu(struct user_record *user);
extern void rundoor(struct user_record *user, char *cmd, int stdio);
2016-03-25 10:21:28 +00:00
2016-08-06 04:36:36 +00:00
extern void bbs_list(struct user_record *user);
2016-08-06 04:36:36 +00:00
extern void chat_system(struct user_record *user);
2016-04-01 04:33:37 +00:00
extern int mail_getemailcount(struct user_record *user);
2016-08-06 04:36:36 +00:00
extern void send_email(struct user_record *user);
extern void list_emails(struct user_record *user);
2016-04-02 23:26:17 +00:00
2016-08-06 04:36:36 +00:00
extern int file_menu(struct user_record *user);
2016-04-10 08:45:02 +00:00
2016-08-06 04:36:36 +00:00
extern void settings_menu(struct user_record *user);
extern void lua_push_cfunctions(lua_State *L);
extern void load_strings();
extern char *get_string(int offset);
2016-08-17 00:55:03 +00:00
extern void chomp(char *string);
#if defined(ENABLE_WWW)
2016-08-17 00:55:03 +00:00
extern void www_init();
extern int www_handler(void * cls, struct MHD_Connection * connection, const char * url, const char * method, const char * version, const char * upload_data, size_t * upload_data_size, void ** ptr);
#endif
2016-03-22 01:48:59 +00:00
#endif