]> git.stg.codes - stg.git/commitdiff
Implemented check-user.
authorMaxim Mamontov <faust.madf@gmail.com>
Thu, 29 May 2014 14:49:48 +0000 (17:49 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Thu, 29 May 2014 14:49:48 +0000 (17:49 +0300)
projects/sgconf/users.cpp

index 9c6c30b5c4c02f94150dd71031e4b0b0a468a639..680625c232f24ffc3c88d9a55251085c69e570af 100644 (file)
@@ -205,9 +205,14 @@ bool CheckUserFunction(const SGCONF::CONFIG & config,
                        const std::string & arg,
                        const std::map<std::string, std::string> & options)
 {
-// TODO
-std::cerr << "Unimplemented.\n";
-return false;
+std::map<std::string, std::string>::const_iterator it(options.find("password"));
+if (it == options.end())
+    throw SGCONF::ACTION::ERROR("Password is not specified.");
+STG::SERVCONF proto(config.server.data(),
+                    config.port.data(),
+                    config.userName.data(),
+                    config.userPass.data());
+return proto.CheckUser(arg, it->second, SimpleCallback, NULL) == STG::st_ok;
 }
 
 bool SendMessageFunction(const SGCONF::CONFIG & config,