//-----------------------------------------------------------------------------
bool ProcessSendMessage(const std::string & server, uint16_t port,
const std::string & login, const std::string & password,
- const std::string & requestString)
+ const std::string & user, const std::string & text)
{
SERVCONF sc(server, port, login, password);
ResultData data;
-int res = sc.SendMessage(requestString.c_str(), ResultCallback, &data);
+int res = sc.SendMessage(user, text, ResultCallback, &data);
if (res == st_ok && data.result)
{
bool ProcessSendMessage(const std::string & server, uint16_t port,
const std::string & login, const std::string & password,
- const std::string & requestString);
+ const std::string & user, const std::string & text);
#endif
CreateRequestSet(&req, rstr);
if (isMessage)
- return ProcessSendMessage(req.server.data(), req.port.data(), req.admLogin.data(), req.admPasswd.data(), rstr);
+ return ProcessSendMessage(req.server.data(), req.port.data(), req.admLogin.data(), req.admPasswd.data(), req.login.data(), req.usrMsg.data());
return ProcessSetUser(req.server.data(), req.port.data(), req.admLogin.data(), req.admPasswd.data(), rstr);
}
}
}
//---------------------------------------------------------------------------
+std::string Encode12str(const std::string & src)
+{
+std::string res;
+Encode12str(res, src);
+return res;
+}
+//---------------------------------------------------------------------------
+std::string Decode21str(const std::string & src)
+{
+std::string res;
+Decode21str(res, src);
+return res;
+}
+//---------------------------------------------------------------------------
void Encode12(char * dst, const char * src, size_t srcLen)
{
for (size_t i = 0; i <= srcLen; i++)
void Encode12str(std::string & dst, const std::string & src);
void Decode21str(std::string & dst, const std::string & src);
+std::string Encode12str(const std::string & src);
+std::string Decode21str(const std::string & src);
int ParseIPString(const char * str, uint32_t * ips, int maxIP);
void KOIToWin(const char * s1, char * s2, int l);
int GetUsers(GET_USERS::CALLBACK f, void * data);
int GetUser(const std::string & login, GET_USER::CALLBACK f, void * data);
int ChgUser(const std::string & request, SIMPLE::CALLBACK f, void * data);
+ int DelUser(const std::string & login, SIMPLE::CALLBACK f, void * data);
+ int AddUser(const std::string & login, SIMPLE::CALLBACK f, void * data);
int AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data);
- int SendMessage(const std::string & request, SIMPLE::CALLBACK f, void * data);
+ int SendMessage(const std::string & login, const std::string & text, SIMPLE::CALLBACK f, void * data);
int CheckUser(const std::string & login, const std::string & password, SIMPLE::CALLBACK f, void * data);
const std::string & GetStrError() const;
return pImpl->Exec<CHG_USER::PARSER>(request, f, data);
}
+int SERVCONF::DelUser(const std::string & login, SIMPLE::CALLBACK f, void * data)
+{
+return pImpl->Exec<SIMPLE::PARSER>("DelUser", "<DelUser login=\"" + login + "\"/>", f, data);
+}
+
+int SERVCONF::AddUser(const std::string & login, SIMPLE::CALLBACK f, void * data)
+{
+return pImpl->Exec<SIMPLE::PARSER>("AddUser", "<AddUser><Login value=\"" + login + "\"/></AddUser>", f, data);
+}
+
int SERVCONF::AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data)
{
return pImpl->Exec<AUTH_BY::PARSER>("<GetUserAuthBy login=\"" + login + "\"/>", f, data);
}
-int SERVCONF::SendMessage(const std::string & request, SIMPLE::CALLBACK f, void * data)
+int SERVCONF::SendMessage(const std::string & login, const std::string & text, SIMPLE::CALLBACK f, void * data)
{
-return pImpl->Exec<SIMPLE::PARSER>("SendMessage", request, f, data);
+return pImpl->Exec<SIMPLE::PARSER>("SendMessage", "<Message login=\"" + login + "\" msgver=\"1\" msgtype=\"1\" repeat=\"0\" repeatperiod=\"0\" showtime=\"0\" text=\"" + Encode12str(text) + "\"/>", f, data);
}
int SERVCONF::CheckUser(const std::string & login, const std::string & password, SIMPLE::CALLBACK f, void * data)