SMS Plugin show ignored too

This commit is contained in:
Milos Kozak 2019-03-08 23:30:25 +01:00
parent 9e2cb7d047
commit 95da55724e
3 changed files with 7 additions and 1 deletions

View file

@ -11,6 +11,7 @@ class Sms {
boolean received = false;
boolean sent = false;
boolean processed = false;
boolean ignored = false;
Sms(SmsMessage message) {
phoneNumber = message.getOriginatingAddress();

View file

@ -59,7 +59,9 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
String logText = "";
for (int x = start; x < SmsCommunicatorPlugin.getPlugin().messages.size(); x++) {
Sms sms = SmsCommunicatorPlugin.getPlugin().messages.get(x);
if (sms.received) {
if (sms.ignored) {
logText += DateUtil.timeString(sms.date) + " &lt;&lt;&lt; " + "" + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
} else if (sms.received) {
logText += DateUtil.timeString(sms.date) + " &lt;&lt;&lt; " + (sms.processed ? "" : "") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
} else if (sms.sent) {
logText += DateUtil.timeString(sms.date) + " &gt;&gt;&gt; " + (sms.processed ? "" : "") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";

View file

@ -142,6 +142,9 @@ public class SmsCommunicatorPlugin extends PluginBase {
}
if (!isAllowedNumber(receivedSms.phoneNumber)) {
log.debug("Ignoring SMS from: " + receivedSms.phoneNumber + ". Sender not allowed");
receivedSms.ignored = true;
messages.add(receivedSms);
MainApp.bus().post(new EventSmsCommunicatorUpdateGui());
return;
}