mobian-scripts/mms-check

31 lines
832 B
Plaintext
Raw Normal View History

2021-01-20 03:39:03 +00:00
#!/usr/bin/perl
2021-01-22 02:50:55 +00:00
# Check ModemManager for pending SMS/MMS messages clogging its queue.
# Until mobile Linux natively supports MMS messages, ModemManager is
# needed along with Janky MMS (https://git.sr.ht/~amindfv/jmms) to get
# your messages and flush the queue; if the queue gets clogged you don't
# get incoming messages anymore.
# Usage: run this in your .bashrc so it'll print in your new terminal
# session to remind you that messages are pending.
2021-01-20 03:39:03 +00:00
use 5.12.0;
use strict;
use warnings;
# Find modem ID
my $modem;
my $list = `mmcli -L`;
if ($list =~ m{/Modem/(\d+)}i) {
$modem = $1;
} else {
die "didn't find modem id";
}
my $chk = `mmcli -m $modem --messaging-list-sms`;
my @lines = split(/\n/, $chk);
if ($chk !~ /no sms messages were found/i) {
say "Notice: mmcli shows there are pending SMS messages:";
say $chk;
}