Merge branch '459-activitypub-integration' of ssh://numinibsd/git/base/enigma-bbs into 459-activitypub-integration

This commit is contained in:
Bryan Ashby 2023-05-11 08:47:14 -06:00
commit cded6a59b5
4 changed files with 48 additions and 27 deletions

View File

@ -379,7 +379,9 @@ exports.getModule = class mrcModule extends MenuModule {
} }
// Deliver PrivMsg // Deliver PrivMsg
else if (message.to_user.toLowerCase() == this.state.alias.toLowerCase()) { else if (
message.to_user.toLowerCase() == this.state.alias.toLowerCase()
) {
const currentTime = moment().format( const currentTime = moment().format(
this.client.currentTheme.helpers.getTimeFormat() this.client.currentTheme.helpers.getTimeFormat()
); );
@ -387,8 +389,6 @@ exports.getModule = class mrcModule extends MenuModule {
'|08' + currentTime + '|00 ' + message.body + '|00' '|08' + currentTime + '|00 ' + message.body + '|00'
); );
} }
} }
this.viewControllers.mrcChat.switchFocus(MciViewIds.mrcChat.inputArea); this.viewControllers.mrcChat.switchFocus(MciViewIds.mrcChat.inputArea);
@ -563,39 +563,27 @@ exports.getModule = class mrcModule extends MenuModule {
* Process known additional server commands directly * Process known additional server commands directly
*/ */
case 'afk': case 'afk':
this.sendServerMessage( this.sendServerMessage(`AFK ${message.substr(5)}`);
`AFK ${message.substr(5)}`
);
break; break;
case 'roomconfig': case 'roomconfig':
this.sendServerMessage( this.sendServerMessage(`ROOMCONFIG ${message.substr(12)}`);
`ROOMCONFIG ${message.substr(12)}`
);
break; break;
case 'roompass': case 'roompass':
this.sendServerMessage( this.sendServerMessage(`ROOMPASS ${message.substr(12)}`);
`ROOMPASS ${message.substr(12)}`
);
break; break;
case 'status': case 'status':
this.sendServerMessage( this.sendServerMessage(`STATUS ${message.substr(8)}`);
`STATUS ${message.substr(8)}`
);
break; break;
case 'lastseen': case 'lastseen':
this.sendServerMessage( this.sendServerMessage(`LASTSEEN ${message.substr(10)}`);
`LASTSEEN ${message.substr(10)}`
);
break; break;
case 'help': case 'help':
this.sendServerMessage( this.sendServerMessage(`HELP ${message.substr(6)}`);
`HELP ${message.substr(6)}`
);
break; break;
case 'statistics': case 'statistics':
@ -603,7 +591,7 @@ exports.getModule = class mrcModule extends MenuModule {
case 'listbans': case 'listbans':
case 'listmutes': case 'listmutes':
case 'routing': case 'routing':
this.sendServerMessage(cmd[0].toUpperCase()); this.sendServerMessage(cmd[0].toUpperCase());
break; break;
case 'quit': case 'quit':

View File

@ -183,6 +183,8 @@ General Information:
MessageBase: `usage: oputil.js mb <action> [<arguments>] MessageBase: `usage: oputil.js mb <action> [<arguments>]
Actions: Actions:
list-confs List conferences and areas
areafix CMD1 CMD2 ... ADDR Sends an AreaFix NetMail areafix CMD1 CMD2 ... ADDR Sends an AreaFix NetMail
NetMail is sent to supplied address with the supplied command(s). Multi-part commands NetMail is sent to supplied address with the supplied command(s). Multi-part commands
@ -195,6 +197,9 @@ Actions:
packet in the directory specified by PATH. The QWK packet in the directory specified by PATH. The QWK
BBS ID will be obtained by the final component of PATH. BBS ID will be obtained by the final component of PATH.
list-confs arguments:
--areas Include areas within each message conference.
import-areas arguments: import-areas arguments:
--conf CONF_TAG Conference tag in which to import areas --conf CONF_TAG Conference tag in which to import areas
--network NETWORK Network name/key to associate FTN areas --network NETWORK Network name/key to associate FTN areas

View File

@ -692,6 +692,30 @@ function exportQWKPacket() {
); );
} }
const listConferences = () => {
initConfigAndDatabases(err => {
if (err) {
return console.error(err.reason ? err.reason : err.message);
}
const { getSortedAvailMessageConferences } = require('../../core/message_area');
const conferences = getSortedAvailMessageConferences(null, { noClient: true });
for (let conf of conferences) {
console.info(`${conf.confTag} - ${conf.conf.name}`);
if (!argv.areas) {
continue;
}
for (let areaTag of Object.keys(conf.conf.areas)) {
console.info(` ${areaTag} - ${conf.conf.areas[areaTag].name}`);
}
}
});
};
function handleMessageBaseCommand() { function handleMessageBaseCommand() {
function errUsage() { function errUsage() {
return printUsageAndSetExitCode(getHelpFor('MessageBase'), ExitCodes.ERROR); return printUsageAndSetExitCode(getHelpFor('MessageBase'), ExitCodes.ERROR);
@ -709,6 +733,7 @@ function handleMessageBaseCommand() {
'import-areas': importAreas, 'import-areas': importAreas,
'qwk-dump': dumpQWKPacket, 'qwk-dump': dumpQWKPacket,
'qwk-export': exportQWKPacket, 'qwk-export': exportQWKPacket,
'list-confs': listConferences,
}[action] || errUsage }[action] || errUsage
)(); )();
} }

View File

@ -8,10 +8,10 @@ const theme = require('./theme.js');
const sysValidate = require('./system_view_validate.js'); const sysValidate = require('./system_view_validate.js');
const UserProps = require('./user_property.js'); const UserProps = require('./user_property.js');
const { getISOTimestampString } = require('./database.js'); const { getISOTimestampString } = require('./database.js');
const EnigAssert = require('./enigma_assert');
// deps // deps
const async = require('async'); const async = require('async');
const assert = require('assert');
const _ = require('lodash'); const _ = require('lodash');
const moment = require('moment'); const moment = require('moment');
@ -110,7 +110,10 @@ exports.getModule = class UserConfigModule extends MenuModule {
// Handlers // Handlers
// //
saveChanges: function (formData, extraArgs, cb) { saveChanges: function (formData, extraArgs, cb) {
assert(formData.value.password === formData.value.passwordConfirm); EnigAssert(formData.value.password === formData.value.passwordConfirm);
// cache a copy of |formData| as changing a theme below can invalidate it
formData = _.clone(formData);
const newProperties = { const newProperties = {
[UserProps.RealName]: formData.value.realName, [UserProps.RealName]: formData.value.realName,
@ -127,7 +130,7 @@ exports.getModule = class UserConfigModule extends MenuModule {
self.availThemeInfo[formData.value.theme].themeId, self.availThemeInfo[formData.value.theme].themeId,
}; };
// runtime set theme // Runtime set theme
theme.setClientTheme(self.client, newProperties.theme_id); theme.setClientTheme(self.client, newProperties.theme_id);
// persist all changes // persist all changes