* Start some work on message list fetching
This commit is contained in:
parent
3be271aab5
commit
140990811a
|
@ -34,22 +34,8 @@ function changeMessageArea(client, areaName, cb) {
|
|||
async.waterfall(
|
||||
[
|
||||
function getArea(callback) {
|
||||
/*
|
||||
var availAreas = getAvailableMessageAreas();
|
||||
|
||||
areaName = areaName.toLowerCase(); // always lookup lowercase
|
||||
var index = _.findIndex(availAreas, function pred(a) {
|
||||
return a.name === areaName;
|
||||
});
|
||||
|
||||
if(index > -1) {
|
||||
callback(null, availAreas[index]);
|
||||
} else {
|
||||
callback(new Error('Invalid message area'));
|
||||
}
|
||||
*/
|
||||
|
||||
var area = getMessageAreaByName(areaName);
|
||||
|
||||
if(area) {
|
||||
callback(null, area);
|
||||
} else {
|
||||
|
@ -77,3 +63,47 @@ function changeMessageArea(client, areaName, cb) {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getMessageListForArea(options, areaName, cb) {
|
||||
//
|
||||
// options.client (required)
|
||||
//
|
||||
|
||||
assert(_.isObject(options.client));
|
||||
|
||||
/*
|
||||
[
|
||||
{
|
||||
messageId, messageUuid, replyToId, toUserName, fromUserName, subject, modTimestamp,
|
||||
status(new|old),
|
||||
viewCount
|
||||
}
|
||||
]
|
||||
*/
|
||||
|
||||
var msgList = [];
|
||||
|
||||
async.series(
|
||||
[
|
||||
function fetchMessages(callback) {
|
||||
msgDb.each(
|
||||
'SELECT message_id, message_uuid, reply_to_message_id, to_user_name, from_user_name, subject, modified_timestamp, view_count '
|
||||
'FROM message '
|
||||
'WHERE area_name=? '
|
||||
'ORDER BY message_id;',
|
||||
[ areaName.toLowerCase() ],
|
||||
function msgRow(err, row) {
|
||||
if(!err) {
|
||||
msgList.push( {
|
||||
id : row.message_id,
|
||||
uuid : row.message_uuid,
|
||||
replyToId : row.reply_to_message_id,
|
||||
} );
|
||||
}
|
||||
},
|
||||
callback
|
||||
);
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
|||
};
|
||||
|
||||
vc.loadFromMenuConfig(loadOpts, callback);
|
||||
},
|
||||
function fetchMessagesInArea(callback) {
|
||||
|
||||
}
|
||||
],
|
||||
function complete(err) {
|
||||
|
|
Loading…
Reference in New Issue