]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_message.h
Merge branch 'stg-2.409-radius'
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_message.h
index e7c12f4f64cee4375496297a42df10506aa5169f..6ed6622de9f03bee114e233391d72966bf3ebf75 100644 (file)
  *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
  */
 
-#ifndef __STG_SGCONFIG_PARSER_USERS_H__
-#define __STG_SGCONFIG_PARSER_USERS_H__
+#ifndef __STG_SGCONFIG_PARSER_SEND_MESSAGE_H__
+#define __STG_SGCONFIG_PARSER_SEND_MESSAGE_H__
 
 #include "parser.h"
 
 #include "stg/message.h"
+#include "stg/common.h"
 
 #include <vector>
 #include <string>
@@ -40,8 +41,21 @@ namespace PARSER
 class SEND_MESSAGE: public BASE_PARSER
 {
     public:
+        class FACTORY : public BASE_PARSER::FACTORY
+        {
+            public:
+                explicit FACTORY(USERS & users) : m_users(users) {}
+                virtual BASE_PARSER * create(const ADMIN & admin) { return new SEND_MESSAGE(admin, m_users); }
+                static void Register(REGISTRY & registry, USERS & users)
+                { registry[ToLower(tag)] = new FACTORY(users); }
+            private:
+                USERS & m_users;
+        };
+
+        static const char * tag;
+
         SEND_MESSAGE(const ADMIN & admin, USERS & users)
-            : BASE_PARSER(admin, "Message"), m_users(users), m_result(res_ok), m_user(NULL) {}
+            : BASE_PARSER(admin, tag), m_users(users), m_result(res_ok), m_user(NULL) {}
         int Start(void *data, const char *el, const char **attr);
         int End(void *data, const char *el);
 
@@ -56,7 +70,7 @@ class SEND_MESSAGE: public BASE_PARSER
         void CreateAnswer();
 };
 
-}
-}
+} // namespace PARSER
+} // namespace STG
 
 #endif