From: Maxim Mamontov Date: Sun, 15 Sep 2013 01:30:53 +0000 (+0300) Subject: [NY] Code deduplication. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/8e4002dc82b45344b2f8d90000d10eb9a904b1bc [NY] Code deduplication. --- diff --git a/projects/sgconf/common_sg.cpp b/projects/sgconf/common_sg.cpp index 06fd9823..1db7c9c4 100644 --- a/projects/sgconf/common_sg.cpp +++ b/projects/sgconf/common_sg.cpp @@ -294,14 +294,7 @@ void ConvertFromKOI8(const std::string & src, std::string * dst) ConvertKOI8(src, dst, FROM_KOI8); } //----------------------------------------------------------------------------- -void SendMessageCallback(bool result, const std::string & reason, void * d) -{ -ResultData * data = static_cast(d); -data->result = result; -data->reason = reason; -} -//----------------------------------------------------------------------------- -void RecvSetUserAnswer(bool result, const std::string & reason, void * d) +void ResultCallback(bool result, const std::string & reason, void * d) { ResultData * data = static_cast(d); data->result = result; @@ -447,7 +440,7 @@ bool ProcessSetUser(const std::string & server, SERVCONF sc(server, port, login, password); ResultData data; -int res = sc.ChgUser(str.c_str(), RecvSetUserAnswer, &data); +int res = sc.ChgUser(str.c_str(), ResultCallback, &data); if (res == st_ok && data.result) { @@ -470,7 +463,7 @@ bool ProcessSendMessage(const std::string & server, uint16_t port, SERVCONF sc(server, port, login, password); ResultData data; -int res = sc.SendMessage(requestString.c_str(), SendMessageCallback, &data); +int res = sc.SendMessage(requestString.c_str(), ResultCallback, &data); if (res == st_ok && data.result) {