diff options
author | ache <ache@ache.one> | 2019-09-13 00:36:54 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2019-09-13 00:36:54 +0200 |
commit | a7ec793bf9814be7ea8d331ca3d1d35f58b17da1 (patch) | |
tree | da27a7f018f299562a34e1cd7997a097991a0aa6 | |
parent | Error when contact file is empty (diff) |
Search in conv feature
-rw-r--r-- | main.c | 13 | ||||
-rw-r--r-- | messageWind.c | 11 | ||||
-rw-r--r-- | messageWind.h | 2 |
3 files changed, 23 insertions, 3 deletions
@@ -292,6 +292,17 @@ int main(int argc, char* argv[]){ } curs_set(0); showContactListW(); + } else { + move(LINES-1,0); + readline_n("/ ", ""); + int res = searchSMS(msg_win_str); + + if( res >= 0 ) { + canAugment = 1; + firstSMSIndex = res; + clearWind(); + showMessageWind(); + } } break; case 'n': @@ -436,5 +447,3 @@ end: return 0; } - - diff --git a/messageWind.c b/messageWind.c index 73d1182..5b71b5e 100644 --- a/messageWind.c +++ b/messageWind.c @@ -6,7 +6,6 @@ extern contact* contactList; extern size_t nbContacts; - conversation* currentConv; int x_WMessage = 1,y_WMessage = 1; @@ -127,6 +126,16 @@ void showMessageWind(void) { } +int searchSMS( const char* toSearch ) { + if( !currentConv ) + return -1; + for(int i = firstSMSIndex - 1; i >= 0 ; --i) { + if(strstr(currentConv->listSMS[i].text, toSearch) != NULL) + return i; + } + + return -1; +} diff --git a/messageWind.h b/messageWind.h index 99f0f57..b1b4550 100644 --- a/messageWind.h +++ b/messageWind.h @@ -11,6 +11,8 @@ void clearWind(void); void toTheEnd(void); +int searchSMS(const char*); + #endif |