|
@@ -25,8 +25,8 @@ UserIoMan::UserIoMan(bool usessl, const char *certfile, bool beverbose) : IoMan(
|
|
|
printmap["version"] = &UserIoMan::printVersion;
|
|
|
printmap["login"] = &UserIoMan::printLogin;
|
|
|
printmap["signup"] = &UserIoMan::printSignup;
|
|
|
- printmap["putdata"] = &UserIoMan::printPutdata;
|
|
|
- printmap["getdata"] = &UserIoMan::printGetdata;
|
|
|
+ //~ printmap["putdata"] = &UserIoMan::printPutdata;
|
|
|
+ //~ printmap["getdata"] = &UserIoMan::printGetdata;
|
|
|
printmap["head"] = &UserIoMan::printHead;
|
|
|
printmap["deletefile"] = &UserIoMan::printDeletefile;
|
|
|
printmap["deleteme"] = &UserIoMan::printDeleteme;
|
|
@@ -41,13 +41,8 @@ UserIoMan::~UserIoMan() { delete reader; }
|
|
|
|
|
|
void UserIoMan::printMessage(std::string msg, OutMsgType type) {
|
|
|
Json::Value root;
|
|
|
- msgmutex.lock();
|
|
|
+ vector<string>::const_iterator connectit;
|
|
|
|
|
|
- char *savedline = rl_copy_text(0, rl_end);
|
|
|
- int savedpoint = rl_point;
|
|
|
- rl_set_prompt("");
|
|
|
- rl_replace_line("", 0);
|
|
|
- rl_redisplay();
|
|
|
|
|
|
switch (type) {
|
|
|
case normal:
|
|
@@ -61,19 +56,28 @@ void UserIoMan::printMessage(std::string msg, OutMsgType type) {
|
|
|
break;
|
|
|
}
|
|
|
case debug: {
|
|
|
- if (verbose)
|
|
|
+ if (verbose) {
|
|
|
+ msgmutex.lock();
|
|
|
+
|
|
|
+ char *savedline = rl_copy_text(0, rl_end);
|
|
|
+ int savedpoint = rl_point;
|
|
|
+ rl_set_prompt("");
|
|
|
+ rl_replace_line("", 0);
|
|
|
+ rl_redisplay();
|
|
|
+
|
|
|
std::cerr << msg << std::endl;
|
|
|
+
|
|
|
+ rl_set_prompt(getCmdPrompt().c_str());
|
|
|
+ rl_replace_line(savedline, 0);
|
|
|
+ rl_point = savedpoint;
|
|
|
+ rl_redisplay();
|
|
|
+ free(savedline);
|
|
|
+
|
|
|
+ msgmutex.unlock();
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- rl_set_prompt(getCmdPrompt().c_str());
|
|
|
- rl_replace_line(savedline, 0);
|
|
|
- rl_point = savedpoint;
|
|
|
- rl_redisplay();
|
|
|
- free(savedline);
|
|
|
-
|
|
|
- msgmutex.unlock();
|
|
|
}
|
|
|
|
|
|
void UserIoMan::printWelcomeMessage() {
|
|
@@ -93,7 +97,23 @@ void UserIoMan::printJson(Json::Value root) {
|
|
|
printMessage(string(__PRETTY_FUNCTION__) + " unknown command \"" + root["command"].asString() + "\".\nEnsure code is implemented.", debug);
|
|
|
return;
|
|
|
}
|
|
|
+ msgmutex.lock();
|
|
|
+
|
|
|
+ char *savedline = rl_copy_text(0, rl_end);
|
|
|
+ int savedpoint = rl_point;
|
|
|
+ rl_set_prompt("");
|
|
|
+ rl_replace_line("", 0);
|
|
|
+ rl_redisplay();
|
|
|
+
|
|
|
(this->*(printmap[root["command"].asString()]))(root);
|
|
|
+
|
|
|
+ rl_set_prompt(getCmdPrompt().c_str());
|
|
|
+ rl_replace_line(savedline, 0);
|
|
|
+ rl_point = savedpoint;
|
|
|
+ rl_redisplay();
|
|
|
+ free(savedline);
|
|
|
+
|
|
|
+ msgmutex.unlock();
|
|
|
}
|
|
|
|
|
|
void UserIoMan::printError(Json::Value root) { std::cout << "Error: " << root["error"].asString() << std::endl; }
|