From f1dee6711694a5db4496ce1f30ffe1e1b526b9da Mon Sep 17 00:00:00 2001 From: Ben Youngblood Date: Sun, 23 Jan 2011 13:40:23 -0700 Subject: [PATCH] bug fix (incorrect if condition); renamed variables for clarity --- lib/smpp.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/smpp.js b/lib/smpp.js index 77f59dd..2db8b9e 100644 --- a/lib/smpp.js +++ b/lib/smpp.js @@ -53,7 +53,7 @@ exports.command_ids = { // Use command_ids to look 0x80000103: 'data_sm_resp' }; -// Reverse coomand_ids into commands so we can have easy lookup either way! +// Reverse command_ids into commands so we can have easy lookup either way! for (var command_id in exports.command_ids) { exports.commands[ exports.command_ids[command_id] ] = parseInt(command_id); } @@ -78,10 +78,11 @@ for (var command_id in exports.command_ids) { * things done, I'm not going to implement it right now. -- Ben */ exports.submit_sm_resp = function(sequence_number, message_id, cmd_status) { - if (cmd_status == undefined) { - cmd_status = 0x0; + var command_status; + if (cmd_status == undefined || cmd_status == true) { + command_status = 0x0; } else if (cmd_status == false) { - cmd_status = 0x00000045; + command_status = 0x00000045; } if (message_id == undefined) { @@ -89,7 +90,7 @@ exports.submit_sm_resp = function(sequence_number, message_id, cmd_status) { } var payload = pdu.pack('a' + (message_id.length + 1), message_id); - return pdu.createPdu(exports.commands.submit_sm_resp, sequence_number, payload, cmd_status); + return pdu.createPdu(exports.commands.submit_sm_resp, sequence_number, payload, command_status); }; exports.bind_resp = function(bind_type, sequence_number, system_id, error_status) {