Change AUTOMESSAGE_WRITE to AUTOMESSAGE and add prompt.

This commit is contained in:
Andrew Pamment 2018-02-14 14:36:26 +10:00
parent 28d7e8081b
commit d002d681d7
5 changed files with 34 additions and 10 deletions

View File

@ -9,7 +9,11 @@ Changes from v0.9-alpha -> v0.10-alpha
LINE: 275 NEW LINE: 275 NEW
OLDSTRING: (NONE) OLDSTRING: (NONE)
NEWSTRING: \r\n\e[1;31mError executing archiver.\r\n\e[0m NEWSTRING: "\r\n\e[1;31mError executing archiver.\r\n\e[0m"
LINE: 276 NEW
OLDSTRING: (NONE)
NEWSTRING: "\r\n\r\n\e[1;37m(\e[1;32mV\e[1;37m)iew or \e[1;37m(\e[1;32mU\e[1;37m)pdate Automessage or \e[1;37m(\e[1;31mQ\e[1;37m)uit: \e[0m"
Changes from v0.8-alpha -> v0.9-alpha Changes from v0.8-alpha -> v0.9-alpha
-------------------------------------------------------------- --------------------------------------------------------------

View File

@ -273,3 +273,4 @@ File exists!\r\n
\e[8;28H\e[1;31;40mNo BBSes in the list! \e[8;28H\e[1;31;40mNo BBSes in the list!
\e[10;22H\e[1;37mPress \e[1;33mA \e[1;37m to Add yours or \e[1;33mQ \e[1;37mto Quit\e[0m \e[10;22H\e[1;37mPress \e[1;33mA \e[1;37m to Add yours or \e[1;33mQ \e[1;37mto Quit\e[0m
\r\n\e[1;31mError executing archiver.\r\n\e[0m \r\n\e[1;31mError executing archiver.\r\n\e[0m
\r\n\r\n\e[1;37m(\e[1;32mV\e[1;37m)iew or \e[1;37m(\e[1;32mU\e[1;37m)pdate Automessage or \e[1;37m(\e[1;31mQ\e[1;37m)uit: \e[0m

View File

@ -668,7 +668,7 @@ void display_info() {
s_getc(); s_getc();
} }
void automessage_write(struct user_record *user) { void automessage_write() {
FILE *fptr; FILE *fptr;
char automsg[450]; char automsg[450];
char buffer[76]; char buffer[76];
@ -679,11 +679,11 @@ void automessage_write(struct user_record *user) {
memset(automsg, 0, 450); memset(automsg, 0, 450);
memset(buffer, 0, 76); memset(buffer, 0, 76);
if (user->sec_level >= conf.automsgwritelvl) { if (gUser->sec_level >= conf.automsgwritelvl) {
timen = time(NULL); timen = time(NULL);
localtime_r(&timen, &timenow); localtime_r(&timen, &timenow);
sprintf(automsg, get_string(15), user->loginname, asctime(&timenow)); sprintf(automsg, get_string(15), gUser->loginname, asctime(&timenow));
automsg[strlen(automsg) - 1] = '\r'; automsg[strlen(automsg) - 1] = '\r';
automsg[strlen(automsg)] = '\n'; automsg[strlen(automsg)] = '\n';
@ -733,6 +733,24 @@ void automessage_display() {
s_getc(); s_getc();
} }
void automessage() {
char c;
s_printf(get_string(275));
c = s_getchar();
s_printf("\r\n");
switch(tolower(c)) {
case 'v':
automessage_display();
break;
case 'u':
automessage_write();
break;
default:
break;
}
return;
}
void runbbs_real(int socket, char *ip, int ssh) { void runbbs_real(int socket, char *ip, int ssh) {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
char password[17]; char password[17];

View File

@ -242,8 +242,9 @@ struct msg_headers {
extern char *str_replace(const char *orig, const char *rep, const char *with); extern char *str_replace(const char *orig, const char *rep, const char *with);
extern int copy_file(char *src, char *dest); extern int copy_file(char *src, char *dest);
extern int recursive_delete(const char *dir); extern int recursive_delete(const char *dir);
extern void automessage_write(struct user_record *user); extern void automessage_write();
extern void automessage_display(); extern void automessage_display();
extern void automessage();
extern void dolog(char *fmt, ...); extern void dolog(char *fmt, ...);
extern void dolog_www(char *ipaddr, char *fmt, ...); extern void dolog_www(char *ipaddr, char *fmt, ...);
extern void runbbs_ssh(char *ipaddress); extern void runbbs_ssh(char *ipaddress);

View File

@ -11,7 +11,7 @@
#define MENU_SUBMENU 1 #define MENU_SUBMENU 1
#define MENU_LOGOFF 2 #define MENU_LOGOFF 2
#define MENU_PREVMENU 3 #define MENU_PREVMENU 3
#define MENU_AUTOMESSAGEWRITE 4 #define MENU_AUTOMESSAGE 4
#define MENU_TEXTFILES 5 #define MENU_TEXTFILES 5
#define MENU_CHATSYSTEM 6 #define MENU_CHATSYSTEM 6
#define MENU_BBSLIST 7 #define MENU_BBSLIST 7
@ -133,8 +133,8 @@ int menu_system(char *menufile) {
menu[menu_items-1]->command = MENU_LOGOFF; menu[menu_items-1]->command = MENU_LOGOFF;
} else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) { } else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) {
menu[menu_items-1]->command = MENU_PREVMENU; menu[menu_items-1]->command = MENU_PREVMENU;
} else if (strncasecmp(&buffer[8], "AUTOMESSAGE_WRITE", 17) == 0) { } else if (strncasecmp(&buffer[8], "AUTOMESSAGE", 11) == 0) {
menu[menu_items-1]->command = MENU_AUTOMESSAGEWRITE; menu[menu_items-1]->command = MENU_AUTOMESSAGE;
} else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) { } else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) {
menu[menu_items-1]->command = MENU_TEXTFILES; menu[menu_items-1]->command = MENU_TEXTFILES;
} else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) { } else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) {
@ -388,8 +388,8 @@ int menu_system(char *menufile) {
} }
free(menu); free(menu);
return 0; return 0;
case MENU_AUTOMESSAGEWRITE: case MENU_AUTOMESSAGE:
automessage_write(gUser); automessage();
break; break;
case MENU_TEXTFILES: case MENU_TEXTFILES:
display_textfiles(); display_textfiles();