Browse code

[add] progation of events "topic", "selfMessage", "nick"

Christian FraƟ authored on20/11/2021 19:05:33
Showing1 changed files
... ...
@@ -228,6 +228,44 @@ async function execute
228 228
 					}
229 229
 				);
230 230
 				client.addListener
231
+				(
232
+					"selfMessage",
233
+					(to, text) =>
234
+					{
235
+						if (to.charAt(0) === "#")
236
+						{
237
+							connection.eventqueue.push
238
+							({
239
+								"timestamp": get_timestamp(),
240
+								"kind": "message_channel",
241
+								"data": {"channel": to, "sender": null, "content": text}
242
+							});
243
+						}
244
+						else
245
+						{
246
+							connection.eventqueue.push
247
+							({
248
+								"timestamp": get_timestamp(),
249
+								"kind": "message_query",
250
+								"data": {"user_name": to, "sender": null, "content": text}
251
+							});
252
+						}
253
+					}
254
+				);
255
+				client.addListener
256
+				(
257
+					"topic",
258
+					(channel, topic, nick, message) =>
259
+					{
260
+						connection.eventqueue.push
261
+						({
262
+							"timestamp": get_timestamp(),
263
+							"kind": "topic",
264
+							"data": {"channel": channel, "content": topic}
265
+						});
266
+					}
267
+				);
268
+				client.addListener
231 269
 				(
232 270
 					"names",
233 271
 					(channel, users) =>
... ...
@@ -241,6 +279,19 @@ async function execute
241 279
 					}
242 280
 				);
243 281
 				client.addListener
282
+				(
283
+					"nick",
284
+					(oldnick, newnick, channels, message) =>
285
+					{
286
+						connection.eventqueue.push
287
+						({
288
+							"timestamp": get_timestamp(),
289
+							"kind": "user_renamed",
290
+							"data": {"user_name_old": oldnick, "user_name_to": newnick}
291
+						});
292
+					}
293
+				);
294
+				client.addListener
244 295
 				(
245 296
 					"join",
246 297
 					(channel, nick, message) =>