Merge pull request #2320 from mushroom-dev/mushroom/trim_sms
Trim leading and trailing whitespaces in incoming SMS messages
This commit is contained in:
commit
757544e2b2
1 changed files with 2 additions and 1 deletions
|
@ -259,7 +259,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
messages.add(receivedSms)
|
messages.add(receivedSms)
|
||||||
aapsLogger.debug(LTag.SMS, receivedSms.toString())
|
aapsLogger.debug(LTag.SMS, receivedSms.toString())
|
||||||
val divided = receivedSms.text.split(Regex("\\s+")).toTypedArray()
|
val divided = receivedSms.text.trim().split(Regex("\\s+")).toTypedArray()
|
||||||
val remoteCommandsAllowed = sp.getBoolean(R.string.key_smscommunicator_remote_commands_allowed, false)
|
val remoteCommandsAllowed = sp.getBoolean(R.string.key_smscommunicator_remote_commands_allowed, false)
|
||||||
|
|
||||||
val minDistance =
|
val minDistance =
|
||||||
|
@ -1226,6 +1226,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
|
|
||||||
override fun sendSMS(sms: Sms): Boolean {
|
override fun sendSMS(sms: Sms): Boolean {
|
||||||
sms.text = stripAccents(sms.text)
|
sms.text = stripAccents(sms.text)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
aapsLogger.debug(LTag.SMS, "Sending SMS to " + sms.phoneNumber + ": " + sms.text)
|
aapsLogger.debug(LTag.SMS, "Sending SMS to " + sms.phoneNumber + ": " + sms.text)
|
||||||
if (sms.text.toByteArray().size <= 140) smsManager?.sendTextMessage(sms.phoneNumber, null, sms.text, null, null)
|
if (sms.text.toByteArray().size <= 140) smsManager?.sendTextMessage(sms.phoneNumber, null, sms.text, null, null)
|
||||||
|
|
Loading…
Reference in a new issue