diff --git a/dist/magicka.strings b/dist/magicka.strings index 8935029..c0683a1 100644 --- a/dist/magicka.strings +++ b/dist/magicka.strings @@ -124,7 +124,7 @@ Read message [1-%d] or N for New: \r\nMailing to %d:%d/%d.%d (%s)\r\n \r\nMailing to @%d\r\n Start at message [1-%d] or N for New? -\e[2J\e[1;1H\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m +\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m \e[1;30m[\e[1;34m%5d\e[1;30m]\e[1;32m*\e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n \e[1;30m[\e[1;34m%5d\e[1;30m] \e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n (#) Read Message # (Q) Quit (ENTER) Continue\r\n diff --git a/src/mail_menu.c b/src/mail_menu.c index 97bf810..291e26f 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -2334,6 +2334,13 @@ void list_messages(struct user_record *user) { int redraw; struct tm msg_date; char c; + int offset = 2; + int height = 22; + + if (conf.mail_conferences[gUser->cur_mail_conf]->header != NULL) { + offset = 8; + height = 16; + } s_printf("\r\n"); // list mail in message base @@ -2386,8 +2393,15 @@ void list_messages(struct user_record *user) { start = i - 1; while (!closed) { if (redraw) { + if (conf.mail_conferences[user->cur_mail_conf]->header != NULL) { + s_printf("\e[2J\e[1;1H"); + s_displayansi(conf.mail_conferences[user->cur_mail_conf]->header); + s_printf("\e[7;1H"); + } else { + s_printf("\e[2J\e[1;1H"); + } s_printf(get_string(126)); - for (j = start; j < start + 22 && j < msghs->msg_count; j++) { + for (j = start; j < start + height && j < msghs->msg_count; j++) { gmtime_r((time_t *)&msghs->msgs[j]->msg_h->DateWritten, &msg_date); if (j == i - 1) { if (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[j]->msg_h->MsgNum)) { @@ -2432,7 +2446,7 @@ void list_messages(struct user_record *user) { } } s_printf(get_string(190)); - s_printf("\e[%d;5H", i - start + 1); + s_printf("\e[%d;5H", i - start + offset - 1); redraw = 0; } c = s_getchar(); @@ -2445,18 +2459,18 @@ void list_messages(struct user_record *user) { if (c == 66) { // down i++; - if (i > start + 22) { - start += 22; + if (i > start + height) { + start += height; if (start > msghs->msg_count) { - start = msghs->msg_count - 22; + start = msghs->msg_count - height; } redraw = 1; } if (i - 1 == msghs->msg_count) { i--; - s_printf("\e[%d;5H", i - start + 1); + s_printf("\e[%d;5H", i - start + offset - 1); } else if (!redraw) { - s_printf("\e[%d;1H", i - start); + s_printf("\e[%d;1H", i - start + offset - 2); gmtime_r((time_t *)&msghs->msgs[i - 2]->msg_h->DateWritten, &msg_date); if (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[i - 2]->msg_h->MsgNum)) { if (conf.date_style == 1) { @@ -2477,7 +2491,7 @@ void list_messages(struct user_record *user) { s_printf(get_string(128), i - 1, msghs->msgs[i - 2]->subject, msghs->msgs[i - 2]->from, msghs->msgs[i - 2]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100); } } - s_printf("\e[%d;1H", i - start + 1); + s_printf("\e[%d;1H", i - start + offset - 1); gmtime_r((time_t *)&msghs->msgs[i - 1]->msg_h->DateWritten, &msg_date); if (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[i - 1]->msg_h->MsgNum)) { if (conf.date_style == 1) { @@ -2498,13 +2512,13 @@ void list_messages(struct user_record *user) { s_printf(get_string(189), i, msghs->msgs[i - 1]->subject, msghs->msgs[i - 1]->from, msghs->msgs[i - 1]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100); } } - s_printf("\e[%d;5H", i - start + 1); + s_printf("\e[%d;5H", i - start + offset - 1); } } else if (c == 65) { // up i--; if (i - 1 < start) { - start -= 22; + start -= height; if (start < 0) { start = 0; } @@ -2515,7 +2529,7 @@ void list_messages(struct user_record *user) { i = 1; redraw = 1; } else if (!redraw) { - s_printf("\e[%d;1H", i - start + 2); + s_printf("\e[%d;1H", i - start + offset); gmtime_r((time_t *)&msghs->msgs[i]->msg_h->DateWritten, &msg_date); if (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[i]->msg_h->MsgNum)) { if (conf.date_style == 1) { @@ -2536,7 +2550,7 @@ void list_messages(struct user_record *user) { s_printf(get_string(128), i + 1, msghs->msgs[i]->subject, msghs->msgs[i]->from, msghs->msgs[i]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100); } } - s_printf("\e[%d;1H", i - start + 1); + s_printf("\e[%d;1H", i - start + offset - 1); gmtime_r((time_t *)&msghs->msgs[i - 1]->msg_h->DateWritten, &msg_date); if (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[i - 1]->msg_h->MsgNum)) { if (conf.date_style == 1) { @@ -2557,12 +2571,12 @@ void list_messages(struct user_record *user) { s_printf(get_string(189), i, msghs->msgs[i - 1]->subject, msghs->msgs[i - 1]->from, msghs->msgs[i - 1]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100); } } - s_printf("\e[%d;5H", i - start + 1); + s_printf("\e[%d;5H", i - start + offset - 1); } } else if (c == 75) { // END KEY i = msghs->msg_count; - start = i - 22; + start = i - height; if (start < 0) { start = 0; } @@ -2577,7 +2591,7 @@ void list_messages(struct user_record *user) { s_getchar(); } // PAGE UP - i = i - 22; + i = i - height; if (i <= 0) { i = 1; } @@ -2588,7 +2602,7 @@ void list_messages(struct user_record *user) { s_getchar(); } // PAGE DOWN - i = i + 22; + i = i + height; if (i > msghs->msg_count) { i = msghs->msg_count; } @@ -2789,15 +2803,15 @@ void choose_area() { if (conf.mail_conferences[gUser->cur_mail_conf]->header != NULL) { offset = 8; - height = 13; + height = 16; } init_ptr_vector(&vec); for (i = 0; i < conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count; i++) { if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[i]->read_sec_level <= gUser->sec_level) { struct area_tmp_t *area = (struct area_tmp_t *)malloz(sizeof(struct area_tmp_t)); - area_tmp[list_tmp]->area = conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[i]; - area_tmp[list_tmp]->index = i; + area->area = conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[i]; + area->index = i; ptr_vector_append(&vec, area); } }