@@ -33,6 +33,39 @@ namespace Plugin {
33
33
class Messenger : public PluginHost ::IPlugin
34
34
, public Exchange::IRoomAdministrator::INotification
35
35
, public PluginHost::JSONRPCSupportsEventStatus {
36
+ #ifdef USE_THUNDER_R4
37
+ private:
38
+ class Notification : public RPC ::IRemoteConnection::INotification {
39
+ public:
40
+ Notification () = delete ;
41
+ Notification (const Notification&) = delete ;
42
+ Notification& operator =(const Notification&) = delete ;
43
+
44
+ explicit Notification (Messenger* parent)
45
+ : _parent(*parent)
46
+ {
47
+ ASSERT (parent != nullptr );
48
+ }
49
+ ~Notification () override = default ;
50
+
51
+ public:
52
+ virtual void Activated (RPC::IRemoteConnection*)
53
+ {
54
+ }
55
+ virtual void Deactivated (RPC::IRemoteConnection* connection)
56
+ {
57
+ _parent.Deactivated (connection);
58
+ }
59
+
60
+ BEGIN_INTERFACE_MAP (Notification)
61
+ INTERFACE_ENTRY (RPC::IRemoteConnection::INotification)
62
+ END_INTERFACE_MAP
63
+
64
+ private:
65
+ Messenger& _parent;
66
+ };
67
+ #endif
68
+
36
69
public:
37
70
Messenger (const Messenger&) = delete ;
38
71
Messenger& operator =(const Messenger&) = delete ;
@@ -45,6 +78,9 @@ namespace Plugin {
45
78
, _roomAdmin(nullptr )
46
79
, _roomIds()
47
80
, _adminLock()
81
+ #ifdef USE_THUNDER_R4
82
+ , _notification(this )
83
+ #endif
48
84
{
49
85
RegisterAll ();
50
86
}
@@ -55,9 +91,9 @@ namespace Plugin {
55
91
}
56
92
57
93
// IPlugin methods
58
- virtual const string Initialize (PluginHost::IShell* service) override ;
59
- virtual void Deinitialize (PluginHost::IShell* service) override ;
60
- virtual string Information () const override { return { }; }
94
+ const string Initialize (PluginHost::IShell* service) override ;
95
+ void Deinitialize (PluginHost::IShell* service) override ;
96
+ string Information () const override { return { }; }
61
97
62
98
// Notification handling
63
99
class MsgNotification : public Exchange ::IRoomAdministrator::IRoom::IMsgNotification {
@@ -71,7 +107,7 @@ namespace Plugin {
71
107
{ /* empty */ }
72
108
73
109
// IRoom::Notification methods
74
- virtual void Message (const string& senderName, const string& message) override
110
+ void Message (const string& senderName, const string& message) override
75
111
{
76
112
ASSERT (_messenger != nullptr );
77
113
_messenger->MessageHandler (_roomId, senderName, message);
@@ -99,13 +135,13 @@ namespace Plugin {
99
135
{ /* empty */ }
100
136
101
137
// IRoom::ICallback methods
102
- virtual void Joined (const string& userName) override
138
+ void Joined (const string& userName) override
103
139
{
104
140
ASSERT (_messenger != nullptr );
105
141
_messenger->UserJoinedHandler (_roomId, userName);
106
142
}
107
143
108
- virtual void Left (const string& userName) override
144
+ void Left (const string& userName) override
109
145
{
110
146
ASSERT (_messenger != nullptr );
111
147
_messenger->UserLeftHandler (_roomId, userName);
@@ -171,6 +207,9 @@ namespace Plugin {
171
207
}
172
208
173
209
private:
210
+ #ifdef USE_THUNDER_R4
211
+ void Deactivated (RPC::IRemoteConnection* connection);
212
+ #endif
174
213
string GenerateRoomId (const string& roomName, const string& userName);
175
214
bool SubscribeUserUpdate (const string& roomId, bool subscribe);
176
215
@@ -183,15 +222,21 @@ namespace Plugin {
183
222
void event_roomupdate (const string& room, const JsonData::Messenger::RoomupdateParamsData::ActionType& action);
184
223
void event_userupdate (const string& id, const string& user, const JsonData::Messenger::UserupdateParamsData::ActionType& action);
185
224
void event_message (const string& id, const string& user, const string& message);
225
+ #ifndef USE_THUNDER_R4
186
226
bool CheckToken (const string& token, const string& method, const string& parameters);
187
-
227
+ #else
228
+ PluginHost::JSONRPC::classification CheckToken (const string& token, const string& method, const string& parameters);
229
+ #endif
188
230
uint32_t _connectionId;
189
231
PluginHost::IShell* _service;
190
232
Exchange::IRoomAdministrator* _roomAdmin;
191
233
std::map<string, Exchange::IRoomAdministrator::IRoom*> _roomIds;
192
234
std::set<string> _rooms;
193
235
std::map<string, std::list<string>> _roomACL;
194
236
mutable Core::CriticalSection _adminLock;
237
+ #ifdef USE_THUNDER_R4
238
+ Core::Sink<Notification> _notification;
239
+ #endif
195
240
}; // class Messenger
196
241
197
242
} // namespace Plugin
0 commit comments