ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/dclient/src/frontend/tclient/tquery_handler.cpp
Revision: 1.1
Committed: Sun Oct 24 22:24:50 2010 UTC (16 years ago) by sf-pippijn
Branch: MAIN
Log Message:
added a command line client (no curses)

File Contents

# User Rev Content
1 sf-pippijn 1.1 #include "tquery_handler.h"
2    
3     #include "adt/string.h"
4    
5     #include <boost/algorithm/string/split.hpp>
6    
7     query_handler::query_handler ( communicator &comm
8     , std::string const &username
9     , std::string const &password
10     )
11     : sender (comm)
12     , username (username)
13     , password (password)
14     {
15     }
16    
17     void
18     query_handler::query (int flags, std::string const &prompt)
19     {
20     if (!username.empty ())
21     {
22     if (flags == 0 && !strncmp (prompt, "What is your name?"))
23     send ("reply", username);
24     else if (flags == 4 && !strncmp (prompt, "What is your password?"))
25     send ("reply", password);
26     else if (flags == 4 && !strncmp (prompt, "Please type your password again."))
27     send ("reply", password);
28     return;
29     }
30     else
31     {
32     #if 0
33     if (flags == 4 && !strncmp (prompt, "What is your password?"))
34     ui.query_input->set_mode (ndk::edit::password);
35     else if (flags == 4 && !strncmp (prompt, "Please type your password again."))
36     ui.query_input->set_mode (ndk::edit::password);
37     else
38     ui.query_input->set_mode (ndk::edit::normal);
39     #endif
40     }
41     }