Update to v0.12-alpha and add area headers
This commit is contained in:
parent
1d1f83cd41
commit
991b1c4368
@ -14,7 +14,7 @@
|
||||
#include "jamlib/jam.h"
|
||||
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 11
|
||||
#define VERSION_MINOR 12
|
||||
#define VERSION_STR "alpha"
|
||||
|
||||
#define NETWORK_FIDO 1
|
||||
@ -76,6 +76,7 @@ struct mail_conference {
|
||||
char *path;
|
||||
char *tagline;
|
||||
char *domain;
|
||||
char *header;
|
||||
int networked;
|
||||
int nettype;
|
||||
int realnames;
|
||||
|
@ -2921,6 +2921,14 @@ void choose_area() {
|
||||
int start = 0;
|
||||
int selected = 0;
|
||||
char c;
|
||||
int offset = 2;
|
||||
int height = 22;
|
||||
|
||||
if (conf.mail_conferences[gUser->cur_mail_conf]->header != NULL) {
|
||||
offset = 8;
|
||||
height = 13;
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
@ -2939,25 +2947,31 @@ void choose_area() {
|
||||
|
||||
while (1) {
|
||||
if (redraw) {
|
||||
if (conf.mail_conferences[gUser->cur_mail_conf]->header != NULL) {
|
||||
s_printf("\e[2J\e[1;1H");
|
||||
s_displayansi(conf.mail_conferences[gUser->cur_mail_conf]->header);
|
||||
s_printf("\e[7;1H");
|
||||
} else {
|
||||
s_printf("\e[2J\e[1;1H");
|
||||
}
|
||||
s_printf(get_string(251), conf.mail_conferences[gUser->cur_mail_conf]->name);
|
||||
s_printf(get_string(248));
|
||||
for (i=start;i<start+22 && i < list_tmp;i++) {
|
||||
for (i=start;i<start+height && i < list_tmp;i++) {
|
||||
if (i == selected) {
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[i]->index)) {
|
||||
s_printf(get_string(259), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
s_printf(get_string(259), i - start + offset, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(249), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
s_printf(get_string(249), i - start + offset, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
}
|
||||
} else {
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[i]->index)) {
|
||||
s_printf(get_string(260), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
s_printf(get_string(260), i - start + offset, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(250), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
s_printf(get_string(250), i - start + offset, area_tmp[i]->index, area_tmp[i]->area->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
s_printf("\e[%d;5H", selected - start + 2);
|
||||
s_printf("\e[%d;5H", selected - start + offset);
|
||||
redraw = 0;
|
||||
}
|
||||
c = s_getchar();
|
||||
@ -2969,10 +2983,10 @@ void choose_area() {
|
||||
c = s_getchar();
|
||||
if (c == 66) {
|
||||
// down
|
||||
if (selected + 1 >= start + 22) {
|
||||
start += 22;
|
||||
if (selected + 1 >= start + height) {
|
||||
start += height;
|
||||
if (start >= list_tmp) {
|
||||
start = list_tmp - 22;
|
||||
start = list_tmp - height;
|
||||
}
|
||||
redraw = 1;
|
||||
}
|
||||
@ -2982,22 +2996,22 @@ void choose_area() {
|
||||
} else {
|
||||
if (!redraw) {
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected - 1]->index)) {
|
||||
s_printf(get_string(260), selected - start + 1, area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name);
|
||||
s_printf(get_string(260), selected - start + (offset - 1), area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(250), selected - start + 1, area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name);
|
||||
s_printf(get_string(250), selected - start + (offset - 1), area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name);
|
||||
}
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected]->index)) {
|
||||
s_printf(get_string(259), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
s_printf(get_string(259), selected - start + offset, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
s_printf(get_string(249), selected - start + offset, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
}
|
||||
s_printf("\e[%d;5H", selected - start + 2);
|
||||
s_printf("\e[%d;5H", selected - start + offset);
|
||||
}
|
||||
}
|
||||
} else if (c == 65) {
|
||||
// up
|
||||
if (selected - 1 < start) {
|
||||
start -= 22;
|
||||
start -= height;
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
@ -3009,22 +3023,22 @@ void choose_area() {
|
||||
} else {
|
||||
if (!redraw) {
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected]->index)) {
|
||||
s_printf(get_string(259), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
s_printf(get_string(259), selected - start + offset, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
s_printf(get_string(249), selected - start + offset, area_tmp[selected]->index, area_tmp[selected]->area->name);
|
||||
}
|
||||
if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected + 1]->index)) {
|
||||
s_printf(get_string(260), selected - start + 3, area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name);
|
||||
s_printf(get_string(260), selected - start + (offset + 1), area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name);
|
||||
} else {
|
||||
s_printf(get_string(250), selected - start + 3, area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name);
|
||||
s_printf(get_string(250), selected - start + (offset + 1), area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name);
|
||||
}
|
||||
s_printf("\e[%d;5H", selected - start + 2);
|
||||
s_printf("\e[%d;5H", selected - start + offset);
|
||||
}
|
||||
}
|
||||
} else if (c == 75) {
|
||||
// END KEY
|
||||
selected = list_tmp - 1;
|
||||
start = list_tmp - 22;
|
||||
start = list_tmp - height;
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
@ -3039,7 +3053,7 @@ void choose_area() {
|
||||
s_getchar();
|
||||
}
|
||||
// PAGE UP
|
||||
selected = selected - 22;
|
||||
selected = selected - height;
|
||||
if (selected < 0) {
|
||||
selected = 0;
|
||||
}
|
||||
@ -3050,7 +3064,7 @@ void choose_area() {
|
||||
s_getchar();
|
||||
}
|
||||
// PAGE DOWN
|
||||
selected = selected + 22;
|
||||
selected = selected + height;
|
||||
if (selected >= list_tmp) {
|
||||
selected = list_tmp -1;
|
||||
}
|
||||
|
@ -330,6 +330,8 @@ static int mail_area_handler(void* user, const char* section, const char* name,
|
||||
}
|
||||
} else if (strcasecmp(name, "tagline") == 0) {
|
||||
mc->tagline = strdup(value);
|
||||
} else if (strcasecmp(name, "header") == 0) {
|
||||
mc->header = strdup(value);
|
||||
}
|
||||
} else if (strcasecmp(section, "network") == 0) {
|
||||
if (strcasecmp(name, "type") == 0) {
|
||||
@ -584,6 +586,7 @@ static int handler(void* user, const char* section, const char* name,
|
||||
conf->mail_conferences[conf->mail_conference_count]->mail_area_count = 0;
|
||||
conf->mail_conferences[conf->mail_conference_count]->nettype = 0;
|
||||
conf->mail_conferences[conf->mail_conference_count]->domain = NULL;
|
||||
conf->mail_conferences[conf->mail_conference_count]->header = NULL;
|
||||
conf->mail_conference_count++;
|
||||
} else if (strcasecmp(section, "file directories") == 0) {
|
||||
if (conf->file_directory_count == 0) {
|
||||
|
Reference in New Issue
Block a user