فهرست منبع

run autoformatter

Missingmew 5 سال پیش
والد
کامیت
4f9aa6796f
1فایلهای تغییر یافته به همراه79 افزوده شده و 82 حذف شده
  1. 79 82
      cli/src/cmdman.cpp

+ 79 - 82
cli/src/cmdman.cpp

@@ -109,25 +109,24 @@ CmdMan::CmdRet CmdMan::cmdPut(vector<string> args) {
   CmdRet retval;
   DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
   Json::Value root;
-	
-  if(args.size() < 1) {
-	  retval.type = error;
-	  root["accept"] = false;
-	  root["error"] = "not enough arguments, at least 1 argument required";
-  }
-  else {
-	  bool opened = fileman.openPut(args[0]);
-	  root["command"] = "put";
-	  root["file"] = fileman.getPutName();
-	  if (opened) {
-	    root["size"] = fileman.getPutSize();
-	    root["chunks"] = fileman.getPutChunks();
-	    retval.type = send;
-	  } else {
-	    retval.type = error;
-	    root["accept"] = false;
-	    root["error"] = "couldnt open local file \"" + args[0] + "\"";
-	  }
+
+  if (args.size() < 1) {
+    retval.type = error;
+    root["accept"] = false;
+    root["error"] = "not enough arguments, at least 1 argument required";
+  } else {
+    bool opened = fileman.openPut(args[0]);
+    root["command"] = "put";
+    root["file"] = fileman.getPutName();
+    if (opened) {
+      root["size"] = fileman.getPutSize();
+      root["chunks"] = fileman.getPutChunks();
+      retval.type = send;
+    } else {
+      retval.type = error;
+      root["accept"] = false;
+      root["error"] = "couldnt open local file \"" + args[0] + "\"";
+    }
   }
 
   retval.msg = root;
@@ -156,23 +155,22 @@ CmdMan::CmdRet CmdMan::cmdGet(vector<string> args) {
   CmdRet retval;
   DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
   Json::Value root;
-	
-  if(args.size() < 1) {
-	  retval.type = error;
-	  root["accept"] = false;
-	  root["error"] = "not enough arguments, at least 1 argument required";
-  }
-  else {
-	  bool opened = fileman.openGet(args[0]);
-	  root["command"] = "get";
-	  root["file"] = fileman.getGetName();
-	  if (opened) {
-	    retval.type = send;
-	  } else {
-	    retval.type = error;
-	    root["accept"] = false;
-	    root["error"] = "local file \"" + args[0] + "\" already exists";
-	  }
+
+  if (args.size() < 1) {
+    retval.type = error;
+    root["accept"] = false;
+    root["error"] = "not enough arguments, at least 1 argument required";
+  } else {
+    bool opened = fileman.openGet(args[0]);
+    root["command"] = "get";
+    root["file"] = fileman.getGetName();
+    if (opened) {
+      retval.type = send;
+    } else {
+      retval.type = error;
+      root["accept"] = false;
+      root["error"] = "local file \"" + args[0] + "\" already exists";
+    }
   }
 
   retval.msg = root;
@@ -272,29 +270,29 @@ CmdMan::CmdRet CmdMan::cmdLogin(vector<string> args) {
   CmdRet retval;
   DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
   Json::Value root;
-	
-  if(args.size() < 2) {
-	  retval.type = error;
-	    root["command"] = "login";
-	  root["accept"] = false;
-	  root["error"] = "not enough arguments, at least 2 argument required";
-  }
-  else {
-	  if (loginpossible) {
-	    dologin = true;
-	    loginpossible = false;
-	    root["user"] = args[0];
-	    root["pass"] = args[1];
-	    root["login"] = true;
-	    root["cancel"] = false;
-	    retval.type = send;
-	  } else {
-	    root["command"] = "login";
-	    root["error"] = "Login not possible, because you already requested a login "
-			    "or you are logged in";
-	    root["accept"] = false;
-	    retval.type = error;
-	  }
+
+  if (args.size() < 2) {
+    retval.type = error;
+    root["command"] = "login";
+    root["accept"] = false;
+    root["error"] = "not enough arguments, at least 2 argument required";
+  } else {
+    if (loginpossible) {
+      dologin = true;
+      loginpossible = false;
+      root["user"] = args[0];
+      root["pass"] = args[1];
+      root["login"] = true;
+      root["cancel"] = false;
+      retval.type = send;
+    } else {
+      root["command"] = "login";
+      root["error"] =
+          "Login not possible, because you already requested a login "
+          "or you are logged in";
+      root["accept"] = false;
+      retval.type = error;
+    }
   }
 
   retval.msg = root;
@@ -305,29 +303,28 @@ CmdMan::CmdRet CmdMan::cmdSignup(vector<string> args) {
   CmdRet retval;
   DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
   Json::Value root;
-	
-  if(args.size() < 2) {
-	  retval.type = error;
-	    root["command"] = "signup";
-	  root["accept"] = false;
-	  root["error"] = "not enough arguments, at least 2 argument required";
-  }
-  else {
-	  if (loginpossible) {
-	    dosignup = true;
-	    loginpossible = false;
-	    root["user"] = args[0];
-	    root["pass"] = args[1];
-	    root["login"] = false;
-	    root["cancel"] = false;
-	    retval.type = send;
-	  } else {
-	    root["command"] = "signup";
-	    root["error"] = "Signup not possible, because you already requested a "
-			    "login or you are logged in";
-	    root["accept"] = false;
-	    retval.type = error;
-	  }
+
+  if (args.size() < 2) {
+    retval.type = error;
+    root["command"] = "signup";
+    root["accept"] = false;
+    root["error"] = "not enough arguments, at least 2 argument required";
+  } else {
+    if (loginpossible) {
+      dosignup = true;
+      loginpossible = false;
+      root["user"] = args[0];
+      root["pass"] = args[1];
+      root["login"] = false;
+      root["cancel"] = false;
+      retval.type = send;
+    } else {
+      root["command"] = "signup";
+      root["error"] = "Signup not possible, because you already requested a "
+                      "login or you are logged in";
+      root["accept"] = false;
+      retval.type = error;
+    }
   }
 
   retval.msg = root;