diff --git a/magicka.strings b/magicka.strings index 2fd8172..fab7646 100644 --- a/magicka.strings +++ b/magicka.strings @@ -184,3 +184,4 @@ Login Name: \r\n-------------------------------------\r\n Is this Correct? (Y/N) \e[1;37mPress any key to continue...\e[0m +\e[24;1H\e[1;37;44mUp / Down to Scroll, Left / Right Change Message, R reply, Q quit\e[K\e[0m diff --git a/mail_menu.c b/mail_menu.c index 9b6715b..6ae8ef8 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -765,7 +765,12 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn int chars = 0; int ansi; int sem_fd; - + char **msg_lines; + int msg_line_count; + int start_line; + int should_break; + int position; + jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path); if (!jb) { dolog("Error opening JAM base.. %s", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path); @@ -844,92 +849,104 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn lines = 0; chars = 0; - - for (z=0;z= 17) { - s_printf(get_string(185)); - s_getc(); - lines = 0; - s_printf("\e[7;1H\e[0J"); - } - } else if (body[z] == '\e' && body[z + 1] == '[') { - ansi = z; - while (strchr("ABCDEFGHIGJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", body[z]) == NULL) - z++; - if (body[z] == 'm') { - strncpy(buffer, &body[ansi], (z - ansi) + 1); - buffer[z - ansi + 1] = '\0'; - s_printf("%s", buffer); - } else if (body[z] == 'A') { - j = atoi(&body[ansi + 2]); - if (j == 0 && ansi + 2 == z) { - j = 1; - } - for (i=0;i= 0) { - s_printf("\e[A"); - lines--; - } else { - break; - } - } - } else if (body[z] == 'C') { - j = atoi(&body[ansi + 2]); - if (j == 0 && ansi + 2 == z) { - j = 1; - } - for (i=0;i= 0) { - s_printf("\e[D"); - chars--; - } else { - break; - } - } - } - } else { - chars++; - s_putchar(body[z]); - } - } - - s_printf(get_string(112)); - - c = s_getc(); + + + msg_line_count = 0; + start_line = 0; + + // count the number of lines... + for (z=0;z= 16) { + break; + } + } + s_printf(get_string(186)); + c = s_getc(); + + if (c == 'r') { + should_break = 1; + } else if (c == 'q') { + should_break = 1; + } else if (c == '\e') { + c = s_getc(); + if (c == 91) { + c = s_getc(); + if (c == 65) { + position--; + if (position < 0) { + position = 0; + } + } else if (c == 66) { + position++; + if (position + 16 > msg_line_count) { + position--; + } + } else if (c == 67) { + c = ' '; + should_break = 1; + } else if (c == 68) { + c = 'b'; + should_break = 1; + } + } + } + + } if (tolower(c) == 'r') { JAM_CloseMB(jb); @@ -1003,6 +1020,10 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn free(subject); free(to); free(from); + for (i=0;i 0) { mailno--; } - } + free(body); + } else { + free(body); + } + for (i=0;i