Add 'My Messages' module

This commit is contained in:
Bryan Ashby 2019-02-15 21:55:18 -07:00
parent c695c1f4c5
commit 83d0daf4b7
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
5 changed files with 111 additions and 0 deletions

Binary file not shown.

View File

@ -450,6 +450,21 @@
} }
} }
messageAreaMyMessagesList: {
config: {
// Fri Sep 25th
dateTimeFormat: ddd MMM Do
}
mci: {
VM1: {
height: 16
width: 71
itemFormat: "|00|15 {msgNum:<4.4} |03{subject:<34.33} {fromUserName:<19.18} |03{ts:<12.12}"
focusItemFormat: "|00|19> |15{msgNum:<4.4} {subject:<34.33} {fromUserName:<19.18} {ts:<12.12}"
}
}
}
messageAreaViewPost: { messageAreaViewPost: {
0: { 0: {
mci: { mci: {

59
core/my_messages.js Normal file
View File

@ -0,0 +1,59 @@
/* jslint node: true */
'use strict';
// ENiGMA½
const MenuModule = require('./menu_module.js').MenuModule;
const Message = require('./message.js');
const UserProps = require('./user_property.js');
exports.moduleInfo = {
name : 'My Messages',
desc : 'Finds messages addressed to the current user.',
author : 'NuSkooler',
};
exports.getModule = class MyMessagesModule extends MenuModule {
constructor(options) {
super(options);
}
initSequence() {
const filter = {
toUserName : [ this.client.user.username, this.client.user.getProperty(UserProps.RealName) ],
sort : 'modTimestamp',
resultType : 'messageList',
limit : 1024 * 16, // we want some sort of limit...
};
Message.findMessages(filter, (err, messageList) => {
if(err) {
this.client.log.warn( { error : err.message }, 'Error finding messages addressed to current user');
return this.prevMenu();
}
this.messageList = messageList;
this.finishedLoading();
});
}
finishedLoading() {
if(!this.messageList || 0 === this.messageList.length) {
return this.gotoMenu(
this.menuConfig.config.noResultsMenu || 'messageSearchNoResults',
{ menuFlags : [ 'popParent' ] }
);
}
const menuOpts = {
extraArgs : {
messageList : this.messageList,
noUpdateLastReadId : true
},
menuFlags : [ 'popParent' ],
};
return this.gotoMenu(
this.menuConfig.config.messageListMenu || 'messageAreaMessageList',
menuOpts
);
}
};

View File

@ -1970,6 +1970,43 @@
} }
} }
messageAreaMyMessagesList: {
desc: Personal Messages
module: msg_list
art: MYMSGLST
config: {
menuViewPost: messageAreaViewPost
}
form: {
0: {
mci: {
VM1: {
focus: true
submit: true
argName: message
}
TL6: {
// theme me!
}
}
submit: {
*: [
{
value: { message: null }
action: @method:selectMessage
}
]
}
actionKeys: [
{
keys: [ "escape", "q", "shift + q" ]
action: @systemMethod:prevMenu
}
]
}
}
}
messageSearchNoResults: { messageSearchNoResults: {
desc: Message Search desc: Message Search
art: MSRCNORES art: MSRCNORES