void send_a_bbs_message(int bbs_num,struct board_info *new_board, int bbs_mesg, struct bbs_board_info *board_info) { char s[40]; char subject[60]; FILE *fileptr; char directory[24]; if ((bbs_num<0) || (bbs_num>999)) return; print_cr(); special_code(1,tswitch); print_string("|*h1|*f4From:|*r1 "); print_str_cr(user_lines[tswitch].handle); print_string("|*r1|*h1|*f4Subject:|*f7 "); get_string(subject,57); print_cr(); special_code(0,tswitch); if (!(*subject)) { print_cr(); return; }; sprintf(s,"bbs\\tempfl.%02d",tswitch); lock_dos(); if ((fileptr=g_fopen(s,"wb","BBS#4"))==NULL) { log_error(s); unlock_dos(); return; }; g_fclose(fileptr); unlock_dos(); if (line_editor(s,MESSAGE_SIZE)) { find_bbs_directory(directory,bbs_num); create_bbs_message(directory,s,subject,user_lines[tswitch].number, user_lines[tswitch].handle,new_board,bbs_mesg,board_info); print_str_cr("Message posted."); }; }
void global_newscan(int *board_num, struct board_info *new_board, struct bbs_board_info *bbs_info, char *directory, struct bbs_user_account *bbs_user, int *mail_pieces) { int cur_board = 1; int is_still_boards = 1; struct board_info test_board; char tempdirectory[30]; char s[250]; int state; int key_pr; int key; int num_new_msg; int skip; while (is_still_boards) { if (state=load_board_info(cur_board,&test_board,tempdirectory)) { if (state==2) is_still_boards = 0; } else { enter_board(cur_board,new_board,bbs_info,directory, bbs_user,mail_pieces); *board_num = cur_board; if ((num_new_msg=is_new_messages(bbs_info,*mail_pieces,bbs_user)) && (bbs_user->newscan)) { check_for_privates(); print_cr(); sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] New: |*f4|*h1%02d|*r1 [|*h1R|*h0]ead [|*h1S|*h0]kip [|*h1Q|*h0]uit: ",cur_board,new_board->title,num_new_msg); skip = 0; switch (get_hot_key_prompt(s,"RSQP",'R',1)) { case 'R' : new_messages(directory,bbs_info,mail_pieces, new_board,cur_board,bbs_user); break; case 'P' : break; case 'S' : skip=1; break; case 'Q' : is_still_boards=0; break; } if (!skip) { print_cr(); sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] Post on board? [|*h1Y|*h0/|*h1N|*h0/|*h1Q|*h0] ",cur_board,new_board->title,num_new_msg); special_code(1,tswitch); print_string(s); special_code(0,tswitch); key_pr = 1; while (key_pr) { key=wait_ch(); if (key>'Z') key -= 32; if (key == 'Y') { print_chr('Y'); print_cr(); key_pr = 0; send_a_bbs_message(*board_num,new_board,*mail_pieces,bbs_info); find_bbs(directory,bbs_info,mail_pieces,new_board->limit_messages); }; if (key == 'Q') { print_chr('Q'); print_cr(); key_pr = 0; is_still_boards = 0; }; if ((key == 13) || (key == 'N')) { print_chr('N'); print_cr(); key = 'N'; key_pr = 0; }; }; }; }; }; cur_board++; }; };
void list_bbs(char *directory, struct bbs_board_info *bbs_info, int num_files,struct bbs_user_account *bbs_user) { int file; int anyfile = 1; int key; int abort=0; char user_l[80]; char date_l[80]; char subject_l[120]; char num_l[120]; int count=0; FILE *fileptr; print_cr(); file=num_files; while ((file>0) && (!abort)) { file--; lock_dos(); if (open_bbs_file(directory,bbs_info,file,&fileptr)) { mail_line(user_l,20,40,fileptr); mail_line(subject_l,32,70,fileptr); mail_line(date_l,16,40,fileptr); g_fclose(fileptr); unlock_dos(); anyfile = 0; if (bbs_info[file].filedate > (bbs_user->last_entered_bbs)) sprintf(num_l,"*%02d: ",file+1); else sprintf(num_l," %02d: ",file+1); special_code(1,tswitch); print_string(num_l); print_string(user_l); print_chr(' '); print_string(date_l); print_chr(' '); print_string(subject_l); print_cr(); count++; special_code(0,tswitch); key = get_first_char(tswitch); if ((key == 27) || (key == 3)) { int_char(tswitch); file = -1; }; if (key == 19) { wait_ch(); wait_ch(); }; if (count>=24) { abort= do_page_break(); count=0; } lock_dos(); }; unlock_dos(); }; if (anyfile) print_str_cr("No BBS messages."); };
void read_a_bbs_message(char *directory, struct bbs_board_info *bbs_info, int *num_files, int which_fl, struct board_info *new_board, int board_num, struct bbs_user_account *bbs_user) { char s[200]; int not_abort = 1; int testnum; if ((which_fl<1) || (which_fl>(*num_files))) return; which_fl--; while (not_abort) { print_cr(); sprintf(s,"|*f4|*h1Message:|*f7 #%03d on %s(%02d)",which_fl+1,new_board->title,board_num); special_code(1,tswitch); print_str_cr(s); special_code(0,tswitch); sprintf(s,"%s\\%s",directory,bbs_info[which_fl].filename); print_file_to_cntrl(s,tswitch,1,1,1,BBS_PAGING); check_for_privates(); print_cr(); sprintf(s,"[|*f2|*h1%02d |*r1of |*f2|*h1%02d|*r1] [|*h1A|*h0]gain [|*h1N|*h0]ext [|*h1J|*h0]ump [|*h1R|*h0]eply [|*h1Q|*h0]uit: ",which_fl+1,*num_files); switch (get_hot_key_prompt(s,"ANJRQ",'N',1)) { case 'N': which_fl++; if (which_fl == *num_files) { which_fl--; not_abort = 0; }; break; case 'A': break; case 'J': sprintf(s,"Which message to jump to: (1-%d) ",*num_files); print_string(s); get_string(s,10); if (!(*s)) print_cr(); else { testnum = atoi(s); if ((testnum>=1) && (testnum<=(*num_files))) which_fl = testnum-1; }; break; case 'D': print_cr(); print_string("Are you sure you want to delete? "); get_string(s,10); if (!(*s)) print_cr(); else if ((*s=='y') || (*s=='Y')) { delete_a_bbs_message(directory,bbs_info,num_files,which_fl, new_board); find_bbs(directory,bbs_info,num_files,new_board->limit_messages); if (which_fl>=(*num_files)) which_fl = *num_files - 1; } break; case 'R': send_a_bbs_message(board_num,new_board,*num_files,bbs_info); find_bbs(directory,bbs_info,num_files,new_board->limit_messages); break; case 'Q': not_abort = 0; break; }// end switch }//end while if (bbs_info[which_fl].filedate>bbs_user->last_entered_bbs) { bbs_user->last_entered_bbs = bbs_info[which_fl].filedate; save_bbs_user(directory,user_lines[tswitch].number,bbs_user); }; };
/** * \brief Function called when a key is pressed. * \param key The pressed key. */ bool bear::gui::horizontal_flow::on_key_press( const input::key_info& key ) { return special_code( key ); } // horizontal_flow::on_key_press()