#include "parser_message.h"
#include "stg/users.h"
-#include "stg/common.h"
+#include "stg/user.h"
-extern volatile time_t stgTime; // So sad...
+#include <cstring>
using STG::PARSER::SEND_MESSAGE;
+const char * SEND_MESSAGE::tag = "Message";
+
int SEND_MESSAGE::Start(void *, const char *el, const char **attr)
{
- if (strcasecmp(el, tag.c_str()) != 0)
+ if (strcasecmp(el, m_tag.c_str()) != 0)
return -1;
for (size_t i = 0; i < 14; i++)
int SEND_MESSAGE::End(void *, const char *el)
{
- if (strcasecmp(el, tag.c_str()) != 0)
+ if (strcasecmp(el, m_tag.c_str()) != 0)
return -1;
m_result = res_unknown;
printfd(__FILE__, "User not found. %s\n", m_logins[i].c_str());
continue;
}
- m_msg.header.creationTime = static_cast<unsigned int>(stgTime);
+ m_msg.header.creationTime = static_cast<unsigned int>(time(NULL));
m_user->AddMessage(&m_msg);
m_result = res_ok;
}
switch (m_result)
{
case res_ok:
- answer = "<SendMessageResult value=\"ok\"/>";
+ m_answer = "<SendMessageResult value=\"ok\"/>";
break;
case res_params_error:
- answer = "<SendMessageResult value=\"Parameters error.\"/>";
+ m_answer = "<SendMessageResult value=\"Parameters error.\"/>";
break;
case res_unknown:
- answer = "<SendMessageResult value=\"Unknown user.\"/>";
+ m_answer = "<SendMessageResult value=\"Unknown user.\"/>";
break;
}
}