SDK Script sms-read-inbox.are

sms-read-inbox.are
/* DESC: This script can be used to read the SMS inbox.
 * Copyright (C) 2012 NetModule AG, Switzerland
 */
 
msgs = nb_sms_list();
 
printf("there are %d messages in your SMS inbox\n", (int)msgs);
 
for (i=0; i<(int)msgs; i++) {
    msg = nb_sms_retrieve(msgs[i]);
    if (!msg) continue;
 
    printf("message %d (ID %s, length %d):\n%s\n\n", i, msgs[i], strlen(msg), msg);
 
    ret = nb_sms_delete(msgs[i]);
    if (ret == 0) printf("deleted message %d\n", i);
}
 
exit(0);