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:
+15
-14
@@ -455,6 +455,19 @@ function longSms(pduObj) {
|
|||||||
this.checkLongSmses();
|
this.checkLongSmses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort function to sort group parts
|
||||||
|
function sortLongSmsPdus(a, b) {
|
||||||
|
if (a.partNr < b.partNr) {
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.partNr > b.partNr) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Walk through the long sms storage to investigate if we can send complete messages along
|
// Walk through the long sms storage to investigate if we can send complete messages along
|
||||||
// or should remove old ones
|
// or should remove old ones
|
||||||
function checkLongSmses() {
|
function checkLongSmses() {
|
||||||
@@ -467,25 +480,12 @@ function checkLongSmses() {
|
|||||||
|
|
||||||
log.silly('larvitsmpp: lib/session.js: checkLongSmses() - Running');
|
log.silly('larvitsmpp: lib/session.js: checkLongSmses() - Running');
|
||||||
|
|
||||||
// Sort function to sort group parts
|
|
||||||
function sortLongSmsPdus(a, b) {
|
|
||||||
if (a.partNr < b.partNr) {
|
|
||||||
return - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a.partNr > b.partNr) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call when complete SMS is received
|
// Call when complete SMS is received
|
||||||
function smsReceived() {
|
function smsReceived() {
|
||||||
that.emit('sms', smsObj);
|
that.emit('sms', smsObj);
|
||||||
|
|
||||||
// This needs to be ran if DLRs are sent for these messages
|
// 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) {
|
for (smsGroupId in this.longSmses) {
|
||||||
@@ -498,6 +498,7 @@ function checkLongSmses() {
|
|||||||
smsObj = {
|
smsObj = {
|
||||||
// These are needed for references here and there in functions
|
// These are needed for references here and there in functions
|
||||||
'session': that,
|
'session': that,
|
||||||
|
'smsGroupId': smsGroupId,
|
||||||
'pduObjs': smsGroup.pduObjs,
|
'pduObjs': smsGroup.pduObjs,
|
||||||
'from': smsGroup.pduObjs[0].pduObj.params.source_addr,
|
'from': smsGroup.pduObjs[0].pduObj.params.source_addr,
|
||||||
'to': smsGroup.pduObjs[0].pduObj.params.destination_addr,
|
'to': smsGroup.pduObjs[0].pduObj.params.destination_addr,
|
||||||
|
|||||||
Reference in New Issue
Block a user