SmartFoxServer 2X C++ API
BanUserRequest.h
1 // ===================================================================
2 //
3 // Description
4 // Contains the definition of BanUserRequest
5 //
6 // Revision history
7 // Date Description
8 // 30-Nov-2012 First version
9 //
10 // ===================================================================
11 #ifndef __BanUserRequest__
12 #define __BanUserRequest__
13 
14 #include "../Util/Common.h"
15 #include "BaseRequest.h"
16 #include "BanMode.h"
17 
18 #include <boost/shared_ptr.hpp> // Boost Asio shared pointer
19 
20 #if defined(_MSC_VER)
21 #pragma warning(disable:4786) // STL library: disable warning 4786; this warning is generated due to a Microsoft bug
22 #endif
23 #include <list> // STL library: list object
24 using namespace std; // STL library: declare the STL namespace
25 
26 namespace Sfs2X {
27 namespace Requests {
28 
35  class DLLImportExport BanUserRequest : public BaseRequest
36  {
37  public:
38 
39  // -------------------------------------------------------------------
40  // Public methods
41  // -------------------------------------------------------------------
42 
46  BanUserRequest(long int userId);
47 
51  BanUserRequest(long int userId, string message);
52 
56  BanUserRequest(long int userId, string message, BanMode banMode);
57 
61  BanUserRequest(long int userId, string message, BanMode banMode, long int delaySeconds);
62 
90  BanUserRequest(long int userId, string message, BanMode banMode, long int delaySeconds, long int durationHours);
91 
92  virtual ~BanUserRequest();
93 
94  void Validate(boost::shared_ptr<SmartFox> sfs);
95 
96  void Execute (boost::shared_ptr<SmartFox> sfs);
97 
98  // -------------------------------------------------------------------
99  // Public members
100  // -------------------------------------------------------------------
101 
102  static boost::shared_ptr<string> KEY_USER_ID;
103 
104  static boost::shared_ptr<string> KEY_MESSAGE;
105 
106  static boost::shared_ptr<string> KEY_DELAY;
107 
108  static boost::shared_ptr<string> KEY_BAN_MODE;
109 
110  static boost::shared_ptr<string> KEY_BAN_DURATION_HOURS;
111 
112  protected:
113 
114  // -------------------------------------------------------------------
115  // Protected methods
116  // -------------------------------------------------------------------
117 
118  // -------------------------------------------------------------------
119  // Protected members
120  // -------------------------------------------------------------------
121 
122  private:
123 
124  // -------------------------------------------------------------------
125  // Private methods
126  // -------------------------------------------------------------------
127  void Init(long int userId, string message, BanMode banMode, long int delaySeconds, long int durationHours);
128 
129  // -------------------------------------------------------------------
130  // Private members
131  // -------------------------------------------------------------------
132  long int userId;
133  boost::shared_ptr<string> message;
134  long int delay;
135  BanMode banMode;
136  long int durationHours;
137  };
138 
139 } // namespace Requests
140 } // namespace Sfs2X
141 
142 #endif
STL namespace.
Banish a User from the system (for moderators and admins only)
Definition: BanUserRequest.h:35
Definition: SmartFox.cpp:24