]> git.stg.codes - stg.git/blobdiff - projects/sgconf/users.cpp
Implemented check-user.
[stg.git] / 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,