aboutsummaryrefslogtreecommitdiff
path: root/sms.c
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-02-10 23:31:44 +0100
committerache <ache@ache.one>2019-02-10 23:31:44 +0100
commit10959bf8d4b034173b818e86ca2ed3530e29df78 (patch)
tree0a33a85ca27be90191814a4273c3f46d9c8dd855 /sms.c
parentRefesh from inotify (fuck yeah !) (diff)
Manage new message
Diffstat (limited to 'sms.c')
-rw-r--r--sms.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sms.c b/sms.c
index df48780..b7f49cb 100644
--- a/sms.c
+++ b/sms.c
@@ -26,7 +26,7 @@ int insertSMS(sms* S) {
return 1;
}
int indexSMS = -1;
-
+
for(int i = 0 ; i < listConv[index].nbSMS; i++) {
if( listConv[index].listSMS[i].outDate > S->outDate ) {
indexSMS = i;
@@ -78,7 +78,7 @@ void showConv(const char* number) {
}
}
-int readSMS(char* filename, int inbox_outbox) {
+int readSMS(char* filename, int inbox_outbox, char state) {
FILE* file = fopen(filename,"r");
if( file ) {
@@ -95,7 +95,7 @@ int readSMS(char* filename, int inbox_outbox) {
loop:
// On cherche [SMSBackup]
while( fgets(line, 1024, file) != NULL) {
-
+
if( strstr(line, "[SMSBackup") ) {
char SMSBackup[30] = "";
sprintf(SMSBackup, "[SMSBackup%.03d]\n", sms_number);
@@ -152,9 +152,13 @@ int readSMS(char* filename, int inbox_outbox) {
}
if( !feof(file) )
goto loop;
+
sms_text[++sms_len] = lastChar;
getSms.text = sms_text;
getSms.len = sms_len;
+ if( state == SMS_UNREAD && getSms.in_out == SMS_IN ) {
+ getSms.state = state;
+ }
int r = insertSMS(&getSms);
if( r ) {
@@ -180,7 +184,7 @@ int listSMS(char* smsInboxDir, int inorout) {
char filename[1024] ="";
sprintf(filename, "%s/%s", smsInboxDir, dir->d_name);
- int r = readSMS(filename, inorout);
+ int r = readSMS(filename, inorout, SMS_READ);
if( r ) {
return 2;
}
@@ -194,9 +198,6 @@ int listSMS(char* smsInboxDir, int inorout) {
return 0;
}
-
-
-
int loadConv(void) {
int r = 0;
@@ -227,4 +228,3 @@ int loadConv(void) {
return 0;
}
-