From 36d55a409e61f4fbf5391f0296fc6ace1482d1c3 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 1 Dec 2018 17:00:07 -0700 Subject: [PATCH] Add send node msg event --- core/module_util.js | 2 +- core/node_msg.js | 5 ++++- core/stat_log.js | 2 +- core/system_events.js | 1 + docs/modding/last-callers.md | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/module_util.js b/core/module_util.js index ae342d4b..273ddaf0 100644 --- a/core/module_util.js +++ b/core/module_util.js @@ -149,7 +149,7 @@ function initializeModules(cb) { return nextModule(null); } } catch(e) { - Log.warn( { error : e }, 'Exception during "moduleInitialize"'); + Log.warn( { error : e.message, fullModulePath }, 'Exception during "moduleInitialize"'); return nextModule(null); } }, diff --git a/core/node_msg.js b/core/node_msg.js index 72c54430..bf22e24a 100644 --- a/core/node_msg.js +++ b/core/node_msg.js @@ -12,6 +12,7 @@ const { getThemeArt } = require('./theme.js'); const { pipeToAnsi } = require('./color_codes.js'); const stringFormat = require('./string_format.js'); const { renderStringLength } = require('./string_util.js'); +const Events = require('./events.js'); // deps const series = require('async/series'); @@ -37,7 +38,7 @@ const MciViewIds = { customRangeStart : 10, } -} +}; exports.getModule = class NodeMessageModule extends MenuModule { constructor(options) { @@ -64,6 +65,8 @@ exports.getModule = class NodeMessageModule extends MenuModule { } } + Events.emit(Events.getSystemEvents().UserSendNodeMsg, { user : this.client.user } ); + return this.prevMenu(cb); }); }, diff --git a/core/stat_log.js b/core/stat_log.js index b97ea417..6cf6198b 100644 --- a/core/stat_log.js +++ b/core/stat_log.js @@ -355,7 +355,7 @@ class StatLog { systemEvents.NewUser, systemEvents.UserUpload, systemEvents.UserDownload, systemEvents.UserPostMessage, systemEvents.UserSendMail, - systemEvents.UserRunDoor, + systemEvents.UserRunDoor, systemEvents.UserSendNodeMsg, ]; Events.addListenerMultipleEvents(interestedEvents, (eventName, event) => { diff --git a/core/system_events.js b/core/system_events.js index c8345160..0f8118a2 100644 --- a/core/system_events.js +++ b/core/system_events.js @@ -20,4 +20,5 @@ module.exports = { UserPostMessage : 'codes.l33t.enigma.system.user_post_msg', // { areaTag } UserSendMail : 'codes.l33t.enigma.system.user_send_mail', UserRunDoor : 'codes.l33t.enigma.system.user_run_door', + UserSendNodeMsg : 'codes.l33t.enigma.system.user_send_node_msg', }; diff --git a/docs/modding/last-callers.md b/docs/modding/last-callers.md index f754a912..830244d7 100644 --- a/docs/modding/last-callers.md +++ b/docs/modding/last-callers.md @@ -20,6 +20,7 @@ Available `config` block entries: * `userPostMsg` * `userSendMail` * `userRunDoor` + * `userSendNodeMsg` * `actionIndicatorDefault`: Default indicator when an action is not set. Defaults to "-". Remember that entries such as `actionIndicators` and `actionIndicatorDefault` may contain pipe color codes! @@ -32,6 +33,6 @@ The following `itemFormat` object is provided to MCI 1 (ie: `%VM1`): * `ts`: Timestamp in `dateTimeFormat` format. * `location`: User's location. * `affiliation` or `affils`: Users affiliations. -* `actions`: A string built by concatenating action indicators for a users logged in session. For example, given a indincator of `userDownload` mapped to "D", the string may be "-D----". The format was made popular on Amiga style boards. +* `actions`: A string built by concatenating action indicators for a users logged in session. For example, given a indicator of `userDownload` mapped to "D", the string may be "-D----". The format was made popular on Amiga style boards.