aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c4
-rw-r--r--messageWind.c2
-rw-r--r--wind.c39
-rw-r--r--wind.h2
4 files changed, 35 insertions, 12 deletions
diff --git a/main.c b/main.c
index 7305a04..20ffea5 100644
--- a/main.c
+++ b/main.c
@@ -155,9 +155,7 @@ int main(int argc, char* argv[]){
/* Initialisation ncurses */
- int size = 0;
int c;
- int comp = 0;
int defaultBG = -1;
@@ -378,7 +376,7 @@ int main(int argc, char* argv[]){
case 'i':
case 's': {
char* number = NULL;
-
+
if( ! currentConv ) {
contact* tmp = getContactSelected();
if( !tmp )
diff --git a/messageWind.c b/messageWind.c
index b8ee9c8..fa99e77 100644
--- a/messageWind.c
+++ b/messageWind.c
@@ -11,8 +11,6 @@ conversation* currentConv;
int x_WMessage = 1,y_WMessage = 1;
int w_WMessage,h_WMessage;
-int contactListSelection;
-
int firstSMSIndex;
int canAugment = 1;
diff --git a/wind.c b/wind.c
index 20f6bdc..5015a61 100644
--- a/wind.c
+++ b/wind.c
@@ -15,7 +15,35 @@ static short my_bg = COLOR_BLACK;
//extern char status[10];
extern WINDOW *cmd_win;
//extern WINDOW *sep_win;
+//
+
+int showMessagePreview(int x, int y, int w, const char* txt, char onlyCount) {
+ char line[w];
+ memset(line, 0, w);
+
+ int X = 0, Y=0, iS= 0;
+ while( txt[iS] ) {
+ X = 0;
+ while( X < w-1 && txt[iS]) {
+ if( txt[iS] == '\n' ) {
+ iS++;
+ break;
+ }
+ line[X++] = txt[iS++];
+ }
+ line[X] = 0;
+ if( Y+1 >= h_WMessage -1 ) {
+ break;
+ }
+ Y++;
+ if( onlyCount ) {
+ move(Y+y, x+2);
+ printw("%s", line);
+ }
+ }
+ return Y;
+}
void resize() {
h_menuContact = LINES-2;
w_menuContact = COLS/5-1;
@@ -58,16 +86,15 @@ void runtimeHelp(void) {
clear();
}
-int confirmSend(char* txt, char* autheur) {
+int confirmSend(const char* txt, const char* autheur) {
int x = COLS/6;
- int y = LINES/3;
-
- int w = COLS*2/3;
- int h = LINES/3;
+ int w = (COLS*2)/3;
+ int nbLignes = showMessagePreview(x, 0, w, txt, 0);
+ int y = (LINES - nbLignes - 2) / 2;
clear();
move(y,x);
- printw("Voulez-vous vraiment envoyé ce SMS à %s ?", autheur);
+ printw("Voulez-vous vraiment envoyé ce SMS de %d ligne%s à %s ?", nbLignes, nbLignes > 1 ? "s":"", autheur);
y++;
move(y,x);
diff --git a/wind.h b/wind.h
index 92eb281..5b34c31 100644
--- a/wind.h
+++ b/wind.h
@@ -10,7 +10,7 @@
void resize();
-int confirmSend(char*,char*);
+int confirmSend(const char*, const char*);
void runtimeHelp(void);