* Some progress on message list fetching / display... WIP!
This commit is contained in:
parent
ede00f8937
commit
8dc06cb49d
|
@ -136,6 +136,16 @@ function createMessageBaseTables() {
|
||||||
' message_id INTEGER NOT NULL' +
|
' message_id INTEGER NOT NULL' +
|
||||||
');'
|
');'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
dbs.message.run(
|
||||||
|
'CREATE TABLE IF NOT EXISTS user_message_status (' +
|
||||||
|
' user_id INTEGER NOT NULL,' +
|
||||||
|
' message_id INTEGER NOT NULL,' +
|
||||||
|
' status INTEGER NOT NULL,' +
|
||||||
|
' UNIQUE(user_id, message_id, status),' +
|
||||||
|
' FOREIGN KEY(user_id) REFERENCES user(id)' +
|
||||||
|
');'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createInitialMessageValues() {
|
function createInitialMessageValues() {
|
||||||
|
|
|
@ -78,6 +78,11 @@ Message.WellKnownAreaNames = {
|
||||||
Private : 'private_mail'
|
Private : 'private_mail'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Message.Status = {
|
||||||
|
New : 0,
|
||||||
|
Read : 1,
|
||||||
|
};
|
||||||
|
|
||||||
Message.MetaCategories = {
|
Message.MetaCategories = {
|
||||||
System : 1, // ENiGMA1/2 stuff
|
System : 1, // ENiGMA1/2 stuff
|
||||||
FtnProperty : 2, // Various FTN network properties, ftn_cost, ftn_origin, ...
|
FtnProperty : 2, // Various FTN network properties, ftn_cost, ftn_origin, ...
|
||||||
|
|
|
@ -11,6 +11,7 @@ var assert = require('assert');
|
||||||
exports.getAvailableMessageAreas = getAvailableMessageAreas;
|
exports.getAvailableMessageAreas = getAvailableMessageAreas;
|
||||||
exports.getMessageAreaByName = getMessageAreaByName;
|
exports.getMessageAreaByName = getMessageAreaByName;
|
||||||
exports.changeMessageArea = changeMessageArea;
|
exports.changeMessageArea = changeMessageArea;
|
||||||
|
exports.getMessageListForArea = getMessageListForArea;
|
||||||
|
|
||||||
function getAvailableMessageAreas() {
|
function getAvailableMessageAreas() {
|
||||||
return Config.messages.areas;
|
return Config.messages.areas;
|
||||||
|
@ -95,15 +96,26 @@ function getMessageListForArea(options, areaName, cb) {
|
||||||
function msgRow(err, row) {
|
function msgRow(err, row) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
msgList.push( {
|
msgList.push( {
|
||||||
id : row.message_id,
|
id : row.message_id,
|
||||||
uuid : row.message_uuid,
|
uuid : row.message_uuid,
|
||||||
replyToId : row.reply_to_message_id,
|
replyToId : row.reply_to_message_id,
|
||||||
|
toUsername : row.to_user_name,
|
||||||
|
fromUsername : row.from_user_name,
|
||||||
|
subject : row.subject,
|
||||||
|
timestamp : row.modified_timestamp,
|
||||||
|
viewCount : row.view_count,
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
function fetchStatus(callback) {
|
||||||
|
callback(null);// :TODO: fixmeh.
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
function complete(err) {
|
||||||
|
cb(err, msgList);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ exports.pad = pad;
|
||||||
exports.replaceAt = replaceAt;
|
exports.replaceAt = replaceAt;
|
||||||
exports.isPrintable = isPrintable;
|
exports.isPrintable = isPrintable;
|
||||||
exports.debugEscapedString = debugEscapedString;
|
exports.debugEscapedString = debugEscapedString;
|
||||||
exports.format = format;
|
|
||||||
|
|
||||||
// :TODO: create Unicode verison of this
|
// :TODO: create Unicode verison of this
|
||||||
var VOWELS = [ 'a', 'e', 'i', 'o', 'u' ];
|
var VOWELS = [ 'a', 'e', 'i', 'o', 'u' ];
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||||
var ViewController = require('../core/view_controller.js').ViewController;
|
var ViewController = require('../core/view_controller.js').ViewController;
|
||||||
|
var messageArea = require('../core/message_area.js');
|
||||||
|
|
||||||
//var moment = require('moment');
|
//var moment = require('moment');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
|
@ -32,7 +33,7 @@ exports.moduleInfo = {
|
||||||
//
|
//
|
||||||
// Ideas
|
// Ideas
|
||||||
// * Module config can define custom formats for items & focused items (inc. Pipe Codes)
|
// * Module config can define custom formats for items & focused items (inc. Pipe Codes)
|
||||||
// * Single list view with advanced formatting (would need textOverflow stuff)
|
// * Single list view with advanced formatting (would need textOverflow stuff), advanced formatting...
|
||||||
// * Multiple LV's in sync with keyboard input
|
// * Multiple LV's in sync with keyboard input
|
||||||
// * New Table LV (TV)
|
// * New Table LV (TV)
|
||||||
// *
|
// *
|
||||||
|
@ -52,7 +53,7 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
|
|
||||||
var vc = self.viewControllers.msgList = new ViewController( { client : self.client } );
|
var vc = self.viewControllers.msgList = new ViewController( { client : self.client } );
|
||||||
|
|
||||||
async.series(
|
async.waterfall(
|
||||||
[
|
[
|
||||||
function callParentMciReady(callback) {
|
function callParentMciReady(callback) {
|
||||||
MessageListModule.super_.prototype.mciReady.call(this, mciData, callback);
|
MessageListModule.super_.prototype.mciReady.call(this, mciData, callback);
|
||||||
|
@ -66,10 +67,31 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
vc.loadFromMenuConfig(loadOpts, callback);
|
vc.loadFromMenuConfig(loadOpts, callback);
|
||||||
},
|
},
|
||||||
function fetchMessagesInArea(callback) {
|
function fetchMessagesInArea(callback) {
|
||||||
|
messageArea.getMessageListForArea( { client : self.client }, self.client.user.properties.message_area_name, function msgs(err, msgList) {
|
||||||
|
callback(err, msgList);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function populateList(msgList, callback) {
|
||||||
|
var msgListView = vc.getView(1);
|
||||||
|
|
||||||
|
// :TODO: {name!over5}, ...over6, over7... -> "text..." for format()
|
||||||
|
|
||||||
|
var msgNum = 1;
|
||||||
|
msgListView.setItems(_.map(msgList, function formatMsgListEntry(mle) {
|
||||||
|
return '{msgNum} - {subj} {to}'.format( {
|
||||||
|
msgNum : msgNum++,
|
||||||
|
subj : mle.subject,
|
||||||
|
to : mle.to
|
||||||
|
} );
|
||||||
|
}));
|
||||||
|
|
||||||
|
msgListView.redraw();
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
|
if(err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue