Second word lost when SMS is received from email

When SMS is sent from a email address, Email Gateway server sends a string
containing from address, message text.  Current code is treating the first
word as from_address, second word as subject and rest of the string as message_body.
Because of this second word is getting stored in separate variable and not as part
of message text, so second word is always lost.
This commit is contained in:
Satish Roddom
2009-07-29 05:40:41 -05:00
committed by Wink Saville
parent a05f75d61a
commit bd55b0cb15

View File

@@ -372,16 +372,10 @@ public abstract class SmsMessageBase {
* -or-
* 2. [x@y][ ]/[body]
*/
String[] parts = messageBody.split("( /)|( )", 3);
if (parts.length < 2 || parts[0].indexOf('@') == -1) return;
String[] parts = messageBody.split("( /)|( )", 2);
if (parts.length < 1 || parts[0].indexOf('@') == -1) return;
emailFrom = parts[0];
if (parts.length == 3) {
pseudoSubject = parts[1];
emailBody = parts[2];
} else {
pseudoSubject = null;
emailBody = parts[1];
}
emailBody = parts[1];
isEmail = true;
}