changing function signature for messaging.getMessages

@julianlam should this be moved to 0.8.0?
This commit is contained in:
psychobunny
2015-08-27 17:32:33 -04:00
parent 00eea65a70
commit e0cfc117c7
3 changed files with 22 additions and 7 deletions

View File

@@ -96,11 +96,16 @@ var db = require('./database'),
});
};
Messaging.getMessages = function(fromuid, touid, since, isNew, callback) {
var uids = sortUids(fromuid, touid);
Messaging.getMessages = function(params, callback) {
var fromuid = params.fromuid,
touid = params.touid,
since = params.since,
isNew = params.isNew,
count = params.count || parseInt(meta.config.chatMessageInboxSize, 10) || 250;
var uids = sortUids(fromuid, touid),
min = Date.now() - (terms[since] || terms.day);
var count = parseInt(meta.config.chatMessageInboxSize, 10) || 250;
var min = Date.now() - (terms[since] || terms.day);
if (since === 'recent') {
count = 49;
min = 0;
@@ -166,7 +171,7 @@ var db = require('./database'),
message.newSet = true;
} else if (index > 0 && message.fromuid !== messages[index-1].fromuid) {
// If the previous message was from the other person, this is also a new set
message.newSet = true
message.newSet = true;
}
return message;