X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6d5f129aad1a6cbaf4d1441c68398e00fa949185..61b5cf35c82a5850ceb07fca5232a409e249444c:/stglibs/srvconf.lib/servconf.cpp diff --git a/stglibs/srvconf.lib/servconf.cpp b/stglibs/srvconf.lib/servconf.cpp index b8507098..f2498ef5 100644 --- a/stglibs/srvconf.lib/servconf.cpp +++ b/stglibs/srvconf.lib/servconf.cpp @@ -18,12 +18,6 @@ * Author : Boris Mikhailenko */ - /* - $Revision: 1.8 $ - $Date: 2010/08/04 00:40:38 $ - $Author: faust $ - */ - #include "stg/servconf.h" #include "stg/common.h" @@ -31,10 +25,8 @@ #include #include -using namespace std; - //----------------------------------------------------------------------------- -int AnsRecv(void * data, list * list1) +int AnsRecv(void * data, std::list * list1) { SERVCONF * sc = static_cast(data); @@ -46,7 +38,7 @@ char ans[ENC_MSG_LEN + 1]; int len, done = 0; //loop parsing -list::iterator node; +std::list::iterator node; node = list1->begin(); while (node != list1->end()) @@ -64,7 +56,6 @@ while (node != list1->end()) return st_xml_parse_error; } ++node; - } return st_ok; @@ -72,22 +63,18 @@ return st_ok; //----------------------------------------------------------------------------- void Start(void *data, const char *el, const char **attr) { -SERVCONF * sc; -sc = (SERVCONF*)data; +SERVCONF * sc = static_cast(data); sc->Start(el, attr); } //----------------------------------------------------------------------------- -void End(void *data, const char *el) +void End(void * data, const char * el) { -SERVCONF * sc; -sc = (SERVCONF*)data; +SERVCONF * sc = static_cast(data); sc->End(el); } //----------------------------------------------------------------------------- SERVCONF::SERVCONF() - : currParser(NULL), - RecvSendMessageCb(NULL), - sendMessageDataCb(NULL) + : currParser(NULL) { parser = XML_ParserCreate(NULL); nt.SetRxCallback(this, AnsRecv); @@ -139,19 +126,6 @@ char request[] = ""; currParser = &parserGetUsers; -return Exec(request); -} -//----------------------------------------------------------------------------- -int SERVCONF::SendMessage(const char * login, const char * message, int prio) -{ -char request[1000]; -char msg[500]; -Encode12(msg, message, strlen(message)); -snprintf(request, 1000, "", login, prio, msg); - -currParser = &parserSendMessage; -parserSendMessage.SetSendMessageRecvCb(RecvSendMessageCb, sendMessageDataCb); - return Exec(request); } //----------------------------------------------------------------------------- @@ -171,12 +145,9 @@ currParser = &parserChgUser; return Exec(request); } //----------------------------------------------------------------------------- -// TODO: remove this shit! -//----------------------------------------------------------------------------- -int SERVCONF::MsgUser(const char * request) +int SERVCONF::SendMessage(const char * request) { currParser = &parserSendMessage; -parserSendMessage.SetSendMessageRecvCb(RecvSendMessageCb, sendMessageDataCb); return Exec(request); } @@ -191,13 +162,13 @@ currParser = &parserCheckUser; return Exec(request); } //----------------------------------------------------------------------------- -int SERVCONF::Start(const char *el, const char **attr) +int SERVCONF::Start(const char * el, const char ** attr) { currParser->ParseStart(el, attr); return 0; } //----------------------------------------------------------------------------- -void SERVCONF::End(const char *el) +void SERVCONF::End(const char * el) { currParser->ParseEnd(el); } @@ -232,10 +203,9 @@ void SERVCONF::SetCheckUserCallback(PARSER_CHECK_USER::CALLBACK f, void * data) parserCheckUser.SetCallback(f, data); } //----------------------------------------------------------------------------- -void SERVCONF::SetSendMessageCb(RecvSendMessageCb_t f, void * data) +void SERVCONF::SetSendMessageCallback(PARSER_SEND_MESSAGE::CALLBACK f, void * data) { -RecvSendMessageCb = f; -sendMessageDataCb = data; +parserSendMessage.SetCallback(f, data); } //----------------------------------------------------------------------------- const std::string & SERVCONF::GetStrError() const