|
@@ -32,6 +32,7 @@ CmdMan::CmdMan(FileMan &fm, void (*dpf)(string)) : fileman(fm) {
|
|
|
execmap["putdata"] = &CmdMan::cmdPutdata;
|
|
|
execmap["getdata"] = &CmdMan::cmdGetdata;
|
|
|
execmap["listdata"] = &CmdMan::cmdListdata;
|
|
|
+ execmap["deleteme"] = &CmdMan::cmdDeleteme;
|
|
|
|
|
|
/* initialize description map */
|
|
|
helpmap["help"] = descHelp;
|
|
@@ -40,6 +41,7 @@ CmdMan::CmdMan(FileMan &fm, void (*dpf)(string)) : fileman(fm) {
|
|
|
helpmap["put"] = descPut;
|
|
|
helpmap["get"] = descGet;
|
|
|
helpmap["list"] = descList;
|
|
|
+ helpmap["deleteme"] = descDeleteme;
|
|
|
|
|
|
/* initialize handle command map */
|
|
|
handlemap["status"] = &CmdMan::handleStatus;
|
|
@@ -53,6 +55,7 @@ CmdMan::CmdMan(FileMan &fm, void (*dpf)(string)) : fileman(fm) {
|
|
|
handlemap["login"] = &CmdMan::handleLogin;
|
|
|
handlemap["signup"] = &CmdMan::handleSignup;
|
|
|
handlemap["listdata"] = &CmdMan::handleListdata;
|
|
|
+ handlemap["deleteme"] = &CmdMan::handleDeleteme;
|
|
|
|
|
|
debugprintfunc = dpf;
|
|
|
}
|
|
@@ -253,6 +256,19 @@ CmdMan::CmdRet CmdMan::execute(string cmd, vector<string> args) {
|
|
|
return (this->*(execmap[cmd]))(args);
|
|
|
}
|
|
|
|
|
|
+CmdMan::CmdRet CmdMan::cmdDeleteme(vector<string> args) {
|
|
|
+ CmdRet retval;
|
|
|
+ DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
|
|
|
+ Json::Value root;
|
|
|
+
|
|
|
+ root["command"] = "deleteme";
|
|
|
+ root["pass"] = args[0];
|
|
|
+ retval.type = send;
|
|
|
+ retval.msg = root;
|
|
|
+
|
|
|
+ return retval;
|
|
|
+}
|
|
|
+
|
|
|
/* login and signup commands */
|
|
|
CmdMan::CmdRet CmdMan::cmdLogin(vector<string> args) {
|
|
|
CmdRet retval;
|
|
@@ -649,3 +665,16 @@ CmdMan::CmdRet CmdMan::handleSignup(Json::Value root) {
|
|
|
|
|
|
return retval;
|
|
|
}
|
|
|
+
|
|
|
+CmdMan::CmdRet CmdMan::handleDeleteme(Json::Value root) {
|
|
|
+ CmdRet retval;
|
|
|
+ DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
|
|
|
+
|
|
|
+ if (!root["accept"].asBool()) {
|
|
|
+ retval.type = error;
|
|
|
+ } else {
|
|
|
+ retval.type = close;
|
|
|
+ }
|
|
|
+ retval.msg = root;
|
|
|
+ return retval;
|
|
|
+}
|