Moved yet another function to pre declaration instead of inline. Also made sure references for smsGroupIds work as expected even if they are several

This commit is contained in:
2015-06-13 15:58:55 +02:00
parent e42aa4f1e7
commit 93fdf8c83a
+14 -13
View File
@@ -455,18 +455,6 @@ function longSms(pduObj) {
this.checkLongSmses();
}
// Walk through the long sms storage to investigate if we can send complete messages along
// or should remove old ones
function checkLongSmses() {
var that = this,
smsGroupId,
smsGroup,
smsObj,
i,
curPduObj;
log.silly('larvitsmpp: lib/session.js: checkLongSmses() - Running');
// Sort function to sort group parts
function sortLongSmsPdus(a, b) {
if (a.partNr < b.partNr) {
@@ -480,12 +468,24 @@ function checkLongSmses() {
return 0;
}
// Walk through the long sms storage to investigate if we can send complete messages along
// or should remove old ones
function checkLongSmses() {
var that = this,
smsGroupId,
smsGroup,
smsObj,
i,
curPduObj;
log.silly('larvitsmpp: lib/session.js: checkLongSmses() - Running');
// Call when complete SMS is received
function smsReceived() {
that.emit('sms', smsObj);
// This needs to be ran if DLRs are sent for these messages
delete that.longSmses[smsGroupId];
delete that.longSmses[smsObj.smsGroupId];
}
for (smsGroupId in this.longSmses) {
@@ -498,6 +498,7 @@ function checkLongSmses() {
smsObj = {
// These are needed for references here and there in functions
'session': that,
'smsGroupId': smsGroupId,
'pduObjs': smsGroup.pduObjs,
'from': smsGroup.pduObjs[0].pduObj.params.source_addr,
'to': smsGroup.pduObjs[0].pduObj.params.destination_addr,