[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unable to retrieve listed messages
From: |
Daniele Forsi |
Subject: |
Re: unable to retrieve listed messages |
Date: |
Sat, 21 Sep 2013 16:35:52 +0200 |
2013/9/21 Noel Butler:
> On Sat, 2013-09-21 at 11:09 +1000, Noel Butler wrote:
>
>
> and message 0 is unable to be retrieved (say, its compressed), gnokii should
> at least, complain about it as it did, but then ignore the
>
>
> My bad, I should have mentioned, even though it complained about the
> message, it still exited with status 0 (hence why our perl script never
> picked up any problems)
there is more than one issue:
in 0.6.31 some regular SMS are detected as compressed SMS, this is
fixed in commit ea2dfe081cc75c58f9528fb0c03ce7a6201c6b81
gnokii --getsms exits with the status of the last read, changing this
means that you won't be able to read anything past the first error
command line gnokii is a low level tool not suitable for handling SMS
in a loop, better use smsd, but since it works for your use case, as a
workaround you can execute "gnokii --deletesms ... 0 end" to clean up
after "gnokii --getsms ... 0 end --delete" but there is a race so you
delete any message that arrives in between the two commands, you can
execute it once a week to reduce the damage
or since you are using Perl you can use the GSM::Gnokii module,
something like the following is enough to process one message and you
can use GetSMSFolderList to know how many messages are present (there
could be empty locations between them)
use GSM::Gnokii;
my $gsm = GSM::Gnokii->new ();
$gsm = $gsm->connect ();
my $sms = $gsm->GetSMS ("ME", 1);
print $sms->{'text'};
$gsm->DeleteSMS ("ME", 1);
--
Daniele Forsi