Пример #1
0
Файл: BBS.C Проект: jeske/GTalk
void jump_board(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 jump_to)
{
   int new_board_num;
   struct board_info test_board;
   char s[10];
   char tempdirectory[30];

   if (jump_to == -1)
    {
     do
      {
        print_cr();
        print_string("Jump to which board: (?=List) ");
        get_string(s,8);
        if (*s=='?') print_file("bbs\\boards.lst");
      } while (*s == '?');
     if (!(*s)) print_cr();
    };

      if (jump_to != -1) new_board_num = jump_to;
       else new_board_num = atoi(s);
      if ((new_board_num<1) || (new_board_num>MAX_BOARDS))
       print_str_cr("Board number does not exist.");
       else
       {
        if (load_board_info(new_board_num,&test_board,tempdirectory))
         {
           print_str_cr("Cannot access board.");
         }
         else
         {
           enter_board(new_board_num,new_board,bbs_info,directory,
              bbs_user,mail_pieces);
           *board_num = new_board_num;
         };
       };
};
Пример #2
0
Файл: BBS.C Проект: jeske/GTalk
void bbs_system(const char *str,const char *name, int portnum)
 {
   char directory[20];
   struct bbs_board_info bbs_info[MAX_MESG_LIMIT];
   struct board_info new_board;
   struct bbs_user_account bbs_user;
   int mail_pieces;
   int board_num = 1;
   int flag = 1;
   int num;
   char *point;
   char command[7];
   char s[100];

   if (user_lines[tswitch].number<0)
     { print_str_cr("--> BBS access denied. Guests not allowed.");
       return;
     }

   if (enter_board(board_num,&new_board,bbs_info,directory,
                &bbs_user,&mail_pieces))
    {
      print_str_cr("--> BBS access denied.");
      return;
    };
   while (flag)
    {
      check_for_privates();
      print_cr();
      sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] [|*f2|*h11-%d|*r1] BBS Command (|*h1?|*h0 for Menu): ",board_num,new_board.title,mail_pieces);

      prompt_get_string(s,command,4);

      if (*command>'Z') *command -= 32;

      if ((num=str_to_num(command,&point))>0)
       { if (num<=mail_pieces)
           {
            read_a_bbs_message(directory,bbs_info,&mail_pieces,num,
                               &new_board,board_num,&bbs_user);
           };
        }
       else
      switch (*command)
       {
         case 'N': new_messages(directory,bbs_info,&mail_pieces,
                        &new_board,board_num,&bbs_user);
                   break;
         case 'G': global_newscan(&board_num,&new_board,bbs_info,directory,
                        &bbs_user,&mail_pieces);
                   break;
         case 'Q': flag = 0;
                   break;
         case 'J': jump_board(&board_num,&new_board,bbs_info,directory,
                      &bbs_user,&mail_pieces,str_to_num(command+1,&point));
                   break;
         case 'L': list_bbs(directory,bbs_info,mail_pieces,&bbs_user);
                   break;
         case 'R': if ((num=str_to_num(command+1,&point))==-1)
                      read_bbs_message(directory,bbs_info,&mail_pieces,
                         &new_board,board_num,&bbs_user);
                    else read_a_bbs_message(directory,bbs_info,
                         &mail_pieces,num,&new_board,board_num,&bbs_user);
                   break;
         case 'X': reset_bbs_message_date(&bbs_user,mail_pieces,
                      bbs_info,directory);
                   break;
         case 'P': send_a_bbs_message(board_num,&new_board,
                      mail_pieces,bbs_info);
                   find_bbs(directory,bbs_info,&mail_pieces,
                      new_board.limit_messages);
                   break;
         case 'D': if ((num=str_to_num(command+1,&point))==-1)
                     delete_bbs_message(directory,bbs_info,
                         &mail_pieces,&new_board);
                     else delete_a_bbs_message(directory,bbs_info,
                         &mail_pieces,num,&new_board);
                   find_bbs(directory,bbs_info,&mail_pieces,
                      new_board.limit_messages);
                   break;
         case 'E': if ((num=str_to_num(command+1,&point))==-1)
                     edit_bbs_message(directory,bbs_info,
                          &mail_pieces,&new_board);
                     else edit_a_bbs_message(directory,bbs_info,
                          &mail_pieces,num,&new_board);
                   break;
         case 'T': toggle_global_on(directory,&bbs_user,board_num);
                   break;
         case '?': print_file("help\\bbs.hlp");
        };
    };
    print_str_cr("--> GinsuTalk: Returning to System");
 };
Пример #3
0
Файл: BBS.C Проект: jeske/GTalk
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++;
    };
 };
Пример #4
0
string solve(string command,user*& cur_user)
{
  vector <string> commands;
  string x;

  string sol;
  commands=parse(command);
  x=commands[0];
  if(x=="exit" || x=="disconnect")
    return x;
  if(x=="signup")
    sol=signup(cur_user,commands);
  if(x=="signin")
    sol=signin(cur_user,commands);
  if(x=="signout" && commands.size()==1)
    {
      cur_user=NULL;
      return "signing out completed.\n";
    }
  if(x=="show_boards")
    sol=show_boards(cur_user);
  if(x=="enter_board")
    sol=enter_board(cur_user,commands);
  if(x=="add_user")
    sol=add_user(cur_user,commands);
  if(x=="remove_user_from_board")
    sol=remove_user_from_board(cur_user,commands);
  if(x=="show_lists" && commands.size()==1)
    sol=show_lists(cur_user);
  if(x=="show_cards")
    sol=show_cards(cur_user,commands);
  if(x=="show_card")
    sol=show_card(cur_user,commands);
  if(x=="create_board")
    sol=create_board(cur_user,commands);
  if(x=="remove_board")
    sol=remove_board(cur_user,commands);
  if(x=="add_list")
    sol=add_list(cur_user,commands);
  if(x=="remove_list")
    sol=remove_list(cur_user,commands);
  if(x=="add_card")
    sol=add_card(cur_user,commands);
  if(x=="remove_card")
    sol=remove_card(cur_user,commands);
  if(x=="move_card")
    sol=move_card(cur_user,commands);
  if(x=="rename_card")
    sol=rename_card(cur_user,commands);
  if(x=="edit_card_description")
    sol=edit_card_des(cur_user,commands);
  if(x=="edit_card_due_date")
    sol=edit_card_date(cur_user,commands);
  if(x=="assign_user")
    sol=assign(cur_user,commands);
  if(x=="remove_user")
    sol=remove_user_from_card(cur_user,commands);
  if(x=="comment")
    sol=commenting(cur_user,commands);
  if(x=="filter")
    sol=filter(cur_user,commands);
  if(sol.size()==0)
    sol="Invalid command.\n";
  return sol;
     
}