Added Ansi/textfile collections
This commit is contained in:
parent
2373391b2e
commit
7c344319ea
@ -1,15 +1,14 @@
|
||||
[?7h[255D[40m
|
||||
[0;1m[5C[32mワワワワワワワワワワワ ワワワワワワ ワワ ワワワワワワ ワワワワワワワワワワワ ワワワワワワワ ワワワワワワ ワワ [30mワ [32mワワ
|
||||
[5C[42mイ゚[30;40mーワ [32;42mイ゚[30;40mーワ [32;42mイロ[1Cイ゚[30;40mー [32;42mイロ[1Cロロ[1Cイ゚[30;40mーワ [32;42mイロ[2Cイ゚[30;40mーワ [32;42mイ゚[30;40mーワ [32;42mイロ[1Cイ゚[0;32mワワ [1m゚゚ [42mイ゚[30;40mーワ [32;42mイロ[1Cイ゚[1C[30;40mロ [32;42mロイ[40m
|
||||
[5C[42mー[0;32mイ [1;30mイ [32;42mー[0;32mイ [1;30mイ [32;42mア゚[1Cー[0;32mイ[1m゚゚゚[42mア゚[1Cイ[0;32mイ [1;42mー[0;32mイ [1;30mイ [32;42mア゚[2Cー[0;32mイ [1;30mイ [32;42mー[0;32mイ [1;30mイ [32;42mア゚[1Cア[0;32mイワ[1;30mー [32;42mイ゚[1Cー[0;32mイ [1;30mイ [32;42mア゚[1Cー[0;32mイワ[1;30m゚ [32;42mイ [40m
|
||||
[5C[0;32m゚゚ [1;30m゚ [0;32m゚゚ [1;30m゚ [32;42mー[0;32mロ ゚゚ [1;30m゚ [32;42mー[0;32mロ ゚゚ ゚゚ [1;30m゚ [32;42mー[0;32mロ ゚゚ [1;30m゚ [0;32m゚゚ [1;30m゚ [32;42mー[0;32mロ ゚゚゚゚゚゚ ゚゚ [1;30m゚ [32;42mー[0;32mロ ゚゚゚゚゚゚
|
||||
[0;40;37m
|
||||
[5C[1;32mワワワワワワワワワワワ ワワワワワワ ワワ ワワワワワワ ワワワワワワワワワワワ ワワワワワワワ ワワワワワワ ワワ [30mワ [32mワワ
|
||||
[0m[5C[1;42;32mイ゚[40;30mーワ [42;32mイ゚[40;30mーワ [42;32mイロ[0m [1;42;32mイ゚[40;30mー [42;32mイロ[0m [1;42;32mロロ[0m [1;42;32mイ゚[40;30mーワ [42;32mイロ[0m [1;42;32mイ゚[40;30mーワ [42;32mイ゚[40;30mーワ [42;32mイロ[0m [1;42;32mイ゚[0;32mワワ [1m゚゚ [42mイ゚[40;30mーワ [42;32mイロ[0m [1;42;32mイ゚[0m [1;30mロ [42;32mロイ[0m
|
||||
[5C[1;42;32mー[0;32mイ [1;30mイ [42;32mー[0;32mイ [1;30mイ [42;32mア゚[0m [1;42;32mー[0;32mイ[1m゚゚゚[42mア゚[0m [1;42;32mイ[0;32mイ [1;42mー[0;32mイ [1;30mイ [42;32mア゚[0m [1;42;32mー[0;32mイ [1;30mイ [42;32mー[0;32mイ [1;30mイ [42;32mア゚[0m [1;42;32mア[0;32mイワ[1;30mー [42;32mイ゚[0m [1;42;32mー[0;32mイ [1;30mイ [42;32mア゚[0m [1;42;32mー[0;32mイワ[1;30m゚ [42;32mイ [0m
|
||||
[5C[32m゚゚ [1;30m゚ [0;32m゚゚ [1;30m゚ [42;32mー[0;32mロ ゚゚ [1;30m゚ [42;32mー[0;32mロ ゚゚ ゚゚ [1;30m゚ [42;32mー[0;32mロ ゚゚ [1;30m゚ [0;32m゚゚ [1;30m゚ [42;32mー[0;32mロ ゚゚゚゚゚゚ ゚゚ [1;30m゚ [42;32mー[0;32mロ ゚゚゚゚゚゚
|
||||
[1;30mトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
|
||||
ウ [0;36mM. [1;37mMessage Areas[16C[30mウ [0;36mL. [1;37mBBS List[22C[30mウ
|
||||
ウ T. File Areas[19Cウ C. Chat System[19Cウ
|
||||
ウ [0;36mB. [1;37mBulletins[20C[30mウ [0;36mU. [1;37mUser List[21C[30mウ
|
||||
ウ [0;36mD. [1;37mOnline Games[17C[30mウ [0;36m1. [1;37mLast 10 Callers[15C[30mウ
|
||||
ウ[34Cウ[35Cウ
|
||||
ウ[34Cウ[35Cウ
|
||||
ウ[34Cウ [0;36mG. [1;31mGoodbye [0;31m([1mLog Off[0;31m)[13C[1;30mウ
|
||||
ウ [0;36mM. [1;37mMessage Areas[0m[16C[1;30mウ [0;36mL.[1;37m BBS List[0m[22C[1;30mウ
|
||||
ウ T. File Areas[0m[19C[1;30mウ [0;36mC.[1;30m [37mChat System[0m[19C[1;30mウ
|
||||
ウ [0;36mB. [1;37mBulletins[0m[20C[1;30mウ [0;36mU. [1;37mUser List[0m[21C[1;30mウ
|
||||
ウ [0;36mD. [1;37mDoor Games & Utilites[0m[8C[1;30mウ [0;36m1. [1;37mLast 10 Callers[0m[15C[1;30mウ
|
||||
ウ[0m [36mA. [1;37mText/ANSI File Collection[0m [1;30mウ[0m[35C[1;30mウ
|
||||
ウ[0m[34C[1;30mウ[0m[35C[1;30mウ
|
||||
ウ[0m[34C[1;30mウ [0;36mG. [1;31mGoodbye [0;31m([1mLog Off[0;31m)[37m[13C[1;30mウ
|
||||
トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
|
||||
[0m[255D
|
||||
|
30
bbs.c
30
bbs.c
@ -326,6 +326,18 @@ static int handler(void* user, const char* section, const char* name,
|
||||
conf->file_directories[conf->file_directory_count]->path = strdup(value);
|
||||
conf->file_directories[conf->file_directory_count]->file_sub_count = 0;
|
||||
conf->file_directory_count++;
|
||||
} else if (strcasecmp(section, "text files") == 0) {
|
||||
if (conf->text_file_count == 0) {
|
||||
conf->text_files = (struct text_file **)malloc(sizeof(struct text_file *));
|
||||
} else {
|
||||
conf->text_files = (struct text_file **)realloc(conf->text_files, sizeof(struct text_file *) * (conf->text_file_count + 1));
|
||||
}
|
||||
|
||||
conf->text_files[conf->text_file_count] = (struct text_file *)malloc(sizeof(struct text_file));
|
||||
conf->text_files[conf->text_file_count]->name = strdup(name);
|
||||
conf->text_files[conf->text_file_count]->path = strdup(value);
|
||||
conf->text_file_count++;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -339,6 +351,23 @@ void s_putstring(int socket, char *c) {
|
||||
write(socket, c, strlen(c));
|
||||
}
|
||||
|
||||
void s_displayansi_p(int socket, char *file) {
|
||||
FILE *fptr;
|
||||
char c;
|
||||
|
||||
fptr = fopen(file, "r");
|
||||
if (!fptr) {
|
||||
return;
|
||||
}
|
||||
c = fgetc(fptr);
|
||||
while (!feof(fptr)) {
|
||||
s_putchar(socket, c);
|
||||
c = fgetc(fptr);
|
||||
}
|
||||
fclose(fptr);
|
||||
}
|
||||
|
||||
|
||||
void s_displayansi(int socket, char *file) {
|
||||
FILE *fptr;
|
||||
char c;
|
||||
@ -577,6 +606,7 @@ void runbbs(int socket, char *config_path) {
|
||||
conf.file_directory_count = 0;
|
||||
conf.irc_server = NULL;
|
||||
conf.irc_port = 6667;
|
||||
conf.text_file_count = 0;
|
||||
|
||||
// Load BBS data
|
||||
if (ini_parse(config_path, handler, &conf) <0) {
|
||||
|
8
bbs.h
8
bbs.h
@ -26,6 +26,11 @@ struct last10_callers {
|
||||
time_t time;
|
||||
}__attribute__((packed));
|
||||
|
||||
struct text_file {
|
||||
char *name;
|
||||
char *path;
|
||||
};
|
||||
|
||||
struct door_config {
|
||||
char *name;
|
||||
char key;
|
||||
@ -88,6 +93,8 @@ struct bbs_config {
|
||||
struct door_config **doors;
|
||||
int file_directory_count;
|
||||
struct file_directory **file_directories;
|
||||
int text_file_count;
|
||||
struct text_file **text_files;
|
||||
};
|
||||
|
||||
struct sec_level_t {
|
||||
@ -118,6 +125,7 @@ extern void runbbs(int sock, char *config);
|
||||
extern struct fido_addr *parse_fido_addr(const char *str);
|
||||
extern void s_putchar(int socket, char c);
|
||||
extern void s_putstring(int socket, char *c);
|
||||
extern void s_displayansi_p(int socket, char *file);
|
||||
extern void s_displayansi(int socket, char *file);
|
||||
extern char s_getchar(int socket);
|
||||
extern void s_readstring(int socket, char *buffer, int max);
|
||||
|
@ -18,3 +18,6 @@ IllusionNet = config/illusionnet.ini
|
||||
|
||||
[file directories]
|
||||
General Files = config/filesgen.ini
|
||||
|
||||
[text files]
|
||||
Warning = ansis/bulletin0.ans
|
||||
|
34
main_menu.c
34
main_menu.c
@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include "bbs.h"
|
||||
@ -23,6 +24,39 @@ void main_menu(int socket, struct user_record *user) {
|
||||
c = s_getc(socket);
|
||||
|
||||
switch(tolower(c)) {
|
||||
case 'a':
|
||||
{
|
||||
if (conf.text_file_count > 0) {
|
||||
|
||||
while(1) {
|
||||
s_putstring(socket, "\r\n\e[1;32mText Files Collection\r\n");
|
||||
s_putstring(socket, "\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
|
||||
|
||||
for (i=0;i<conf.text_file_count;i++) {
|
||||
sprintf(buffer, "\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;37m%s\r\n", i, conf.text_files[i]->name);
|
||||
s_putstring(socket, buffer);
|
||||
}
|
||||
s_putstring(socket, "\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
|
||||
s_putstring(socket, "Enter the number of a text file to display or Q to quit: ");
|
||||
s_readstring(socket, buffer, 4);
|
||||
if (tolower(buffer[0]) != 'q') {
|
||||
i = atoi(buffer);
|
||||
if (i >= 0 && i < conf.text_file_count) {
|
||||
s_displayansi_p(socket, conf.text_files[i]->path);
|
||||
s_putstring(socket, "Press any key to continue...\r\n");
|
||||
s_getc(socket);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_putstring(socket, "\r\nSorry, there are no text files to display\r\n");
|
||||
s_putstring(socket, "Press any key to continue...\r\n");
|
||||
s_getc(socket);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
{
|
||||
chat_system(socket, user);
|
||||
|
Reference in New Issue
Block a user