Toggle all or none subs.

This commit is contained in:
Andrew Pamment 2017-10-13 16:55:33 +10:00
parent c07eb6825a
commit aa01e574df
2 changed files with 57 additions and 13 deletions

View File

@ -223,7 +223,7 @@ File exists!\r\n
\e[0;36mE. \e[1;37mUse External Editor (\e[1;33m%s\e[1;37m)\r\n
\e[1;37mMore? (Y/N/C) \e[0m
\e[1;31mYou have not subscribed to any areas!\e[0m\r\n
\e[1;37mPlease enter an area number to toggle, or hit enter to continue: \e[0m
\e[1;37mEnter an area number to toggle, A to toggle all ON, N to toggle all OFF: \e[0m
\e[1;30m[\e[1;37m%3d\e[1;30m] [%s\e[1;30m] \e[1;37m%s\e[0m\r\n
\e[1;32mSUB\e[0m
\e[1;31mUNSUB\e[0m

View File

@ -2843,7 +2843,7 @@ void msg_conf_sub_bases() {
char buffer[10];
int toggle_area;
int done = 0;
int j;
s_printf("\e[1;1H\e[2J");
do {
@ -2858,12 +2858,36 @@ void msg_conf_sub_bases() {
s_printf(get_string(225));
s_readstring(buffer, 9);
s_printf("\r\n");
if (strlen(buffer) > 0 && buffer[0] >= '0' && buffer[0] <= '9') {
toggle_area = atoi(buffer);
msgbase_sub_unsub(gUser->cur_mail_conf, toggle_area);
lines = 0;
if (strlen(buffer) > 0) {
if (buffer[0] >= '0' && buffer[0] <= '9') {
toggle_area = atoi(buffer);
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[toggle_area]->read_sec_level <= gUser->sec_level) {
msgbase_sub_unsub(gUser->cur_mail_conf, toggle_area);
}
lines = 0;
break;
break;
}
if (buffer[0] == 'a' || buffer[0] == 'A') {
for (j=0;j<conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count;j++) {
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[j]->read_sec_level <= gUser->sec_level) {
if (!msgbase_is_subscribed(gUser->cur_mail_conf, j)) {
msgbase_sub_unsub(gUser->cur_mail_conf, j);
}
}
}
break;
}
if (buffer[0] == 'n' || buffer[0] == 'N') {
for (j=0;j<conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count;j++) {
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[j]->read_sec_level <= gUser->sec_level) {
if (msgbase_is_subscribed(gUser->cur_mail_conf, j)) {
msgbase_sub_unsub(gUser->cur_mail_conf, j);
}
}
}
break;
}
}
lines = 0;
}
@ -2873,12 +2897,32 @@ void msg_conf_sub_bases() {
s_printf(get_string(225));
s_readstring(buffer, 9);
s_printf("\r\n");
if (strlen(buffer) > 0 && buffer[0] >= '0' && buffer[0] <= '9') {
toggle_area = atoi(buffer);
msgbase_sub_unsub(gUser->cur_mail_conf, toggle_area);
lines = 0;
} else {
done = 1;
if (strlen(buffer) > 0) {
if (buffer[0] >= '0' && buffer[0] <= '9') {
toggle_area = atoi(buffer);
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[toggle_area]->read_sec_level <= gUser->sec_level) {
msgbase_sub_unsub(gUser->cur_mail_conf, toggle_area);
}
lines = 0;
} else if (buffer[0] == 'a' || buffer[0] == 'A') {
for (j=0;j<conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count;j++) {
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[j]->read_sec_level <= gUser->sec_level) {
if (!msgbase_is_subscribed(gUser->cur_mail_conf, j)) {
msgbase_sub_unsub(gUser->cur_mail_conf, j);
}
}
}
} else if (buffer[0] == 'n' || buffer[0] == 'N') {
for (j=0;j<conf.mail_conferences[gUser->cur_mail_conf]->mail_area_count;j++) {
if (conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[j]->read_sec_level <= gUser->sec_level) {
if (msgbase_is_subscribed(gUser->cur_mail_conf, j)) {
msgbase_sub_unsub(gUser->cur_mail_conf, j);
}
}
}
} else {
done = 1;
}
}
} else {
done = 1;