Allow pointers to be set, read, unread or at msg no
This commit is contained in:
parent
027c047b42
commit
3ec7305cbe
@ -33,4 +33,12 @@ NEWSTRING: "\e[%d;1H\e[1;30;40m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[
|
||||
|
||||
LINE 261 NEW
|
||||
OLDSTRING: (NONE)
|
||||
NEWSTRING: "\e[%d;1H\e[1;30;40m[\e[1;34m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K"
|
||||
NEWSTRING: "\e[%d;1H\e[1;30;40m[\e[1;34m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K"
|
||||
|
||||
LINE 230 MODIFIED
|
||||
OLDSTRING: "\r\n\e[1;37mAre you sure you want to reset all messages in %s to unread? \e[0m"
|
||||
NEWSTRING: "\r\n\r\n\e[1;37mReset pointers to All (\e[1;33mR\e[1;37m)ead, All (\e[1;33mU\e[1;37m)nread? or Msg #: "
|
||||
|
||||
LINE 231 MODIFIED
|
||||
OLDSTRING: "\r\n\e[1;37mAre you sure you want to reset \e[1;31mall messages \e[1;37min all bases to unread? \e[0m"
|
||||
NEWSTRING: "\r\n\r\n\e[1;37mReset \e[1;31mALL\e[1;37m pointers in \e[1;31mALL \e[1;37mareas to (\e[1;33mR\e[1;37m)ead, (\e[1;33mU\e[1;37m)nread? \e[0m"
|
4
dist/magicka.strings
vendored
4
dist/magicka.strings
vendored
@ -227,8 +227,8 @@ File exists!\r\n
|
||||
\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
|
||||
\r\n\e[1;37mAre you sure you want to reset all messages in %s to unread? \e[0m
|
||||
\r\n\e[1;37mAre you sure you want to reset \e[1;31mall messages \e[1;37min all bases to unread? \e[0m
|
||||
\r\n\r\n\e[1;37mReset pointers to All (\e[1;33mR\e[1;37m)ead, All (\e[1;33mU\e[1;37m)nread? or Msg #:
|
||||
\r\n\r\n\e[1;37mReset \e[1;31mALL\e[1;37m pointers in \e[1;31mALL \e[1;37mareas to (\e[1;33mR\e[1;37m)ead, (\e[1;33mU\e[1;37m)nread? \e[0m
|
||||
\r\n\r\n\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;33m%3ddloads \e[1;36m%4d%c \e[1;37m%-56s\r\n \e[1;31mNEW \e[0;32m
|
||||
\r\nScan for new files? (Y/N) :
|
||||
\r\n\e[1;37mOrder by (\e[1;32mF\e[1;37m)ilename, (\e[1;32mU\e[1;37m)pload Date, (\e[1;32mP\e[1;37m)opularity, (\e[1;32mN\e[1;37m)ew Files Only: \e[0m
|
||||
|
@ -298,8 +298,8 @@ extern void next_mail_area(struct user_record *user);
|
||||
extern void prev_mail_area(struct user_record *user);
|
||||
extern void post_message(struct user_record *user);
|
||||
extern void msg_conf_sub_bases();
|
||||
extern void msgbase_reset_pointers(int conference, int msgarea);
|
||||
extern void msgbase_reset_all_pointers();
|
||||
extern void msgbase_reset_pointers(int conference, int msgarea, int readm, int msgno);
|
||||
extern void msgbase_reset_all_pointers(int readm);
|
||||
extern void full_mail_scan(struct user_record *user);
|
||||
extern int read_new_msgs(struct user_record *user, struct msg_headers *msghs);
|
||||
extern int new_messages(struct user_record *user, int conference, int area);
|
||||
|
@ -3231,30 +3231,76 @@ void msg_conf_sub_bases() {
|
||||
} while (!done);
|
||||
}
|
||||
|
||||
void msgbase_reset_pointers(int conference, int msgarea) {
|
||||
void msgbase_reset_pointers(int conference, int msgarea, int readm, int msgno) {
|
||||
s_JamBase *jb;
|
||||
s_JamBaseHeader jbh;
|
||||
s_JamLastRead jlr;
|
||||
|
||||
s_JamMsgHeader jmh;
|
||||
|
||||
int max_msg;
|
||||
int active_msgs;
|
||||
int i, j, k;
|
||||
|
||||
jb = open_jam_base(conf.mail_conferences[conference]->mail_areas[msgarea]->path);
|
||||
if (!jb) {
|
||||
dolog("Unable to open message base");
|
||||
return;
|
||||
}
|
||||
|
||||
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
|
||||
JAM_CloseMB(jb);
|
||||
return;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
|
||||
if (msgno == -1 && readm) {
|
||||
k = jbh.ActiveMsgs;
|
||||
} else if (msgno == -1 && !readm) {
|
||||
k = 0;
|
||||
} else {
|
||||
if (msgno > jbh.ActiveMsgs) {
|
||||
k = jbh.ActiveMsgs;
|
||||
} else {
|
||||
k = msgno;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;j<k;i++) {
|
||||
memset(&jmh, 0, sizeof(s_JamMsgHeader));
|
||||
if (JAM_ReadMsgHeader(jb, i, &jmh, NULL) != 0) {
|
||||
dolog("Failed to read msg header: Erro %d", JAM_Errno(jb));
|
||||
return;
|
||||
}
|
||||
|
||||
if (jmh.Attribute & JAM_MSG_DELETED) {
|
||||
continue;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
max_msg = i;
|
||||
|
||||
if (JAM_ReadLastRead(jb, gUser->id, &jlr) != JAM_NO_USER) {
|
||||
jlr.LastReadMsg = 0;
|
||||
jlr.HighReadMsg = 0;
|
||||
jlr.LastReadMsg = max_msg;
|
||||
jlr.HighReadMsg = max_msg;
|
||||
JAM_WriteLastRead(jb, gUser->id, &jlr);
|
||||
} else {
|
||||
jlr.LastReadMsg = max_msg;
|
||||
jlr.HighReadMsg = max_msg;
|
||||
jlr.UserCRC = JAM_Crc32(gUser->loginname, strlen(gUser->loginname));
|
||||
jlr.UserID = gUser->id;
|
||||
JAM_WriteLastRead(jb, gUser->id, &jlr);
|
||||
}
|
||||
JAM_CloseMB(jb);
|
||||
}
|
||||
|
||||
void msgbase_reset_all_pointers() {
|
||||
void msgbase_reset_all_pointers(int readm) {
|
||||
int i, j;
|
||||
|
||||
for (i=0;i<conf.mail_conference_count;i++) {
|
||||
for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) {
|
||||
msgbase_reset_pointers(i, j);
|
||||
msgbase_reset_pointers(i, j, readm, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
41
src/menus.c
41
src/menus.c
@ -77,6 +77,7 @@ int menu_system(char *menufile) {
|
||||
char *ansi_file;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
struct stat s;
|
||||
char *lRet;
|
||||
lua_State *L;
|
||||
@ -85,7 +86,7 @@ int menu_system(char *menufile) {
|
||||
char c;
|
||||
int clearscreen = 0;
|
||||
char confirm;
|
||||
|
||||
|
||||
if (menufile[0] == '/') {
|
||||
snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
|
||||
} else {
|
||||
@ -500,18 +501,36 @@ int menu_system(char *menufile) {
|
||||
msg_conf_sub_bases();
|
||||
break;
|
||||
case MENU_RESETPOINTERS:
|
||||
s_printf(get_string(229), conf.mail_conferences[gUser->cur_mail_conf]->mail_areas[gUser->cur_mail_area]->name);
|
||||
confirm = s_getc();
|
||||
if (confirm == 'y' || confirm == 'Y') {
|
||||
msgbase_reset_pointers(gUser->cur_mail_conf, gUser->cur_mail_area);
|
||||
}
|
||||
s_printf(get_string(229));
|
||||
s_readstring(buffer, 10);
|
||||
if (tolower(buffer[0]) == 'r') {
|
||||
k = -1;
|
||||
j = 1;
|
||||
} else if (tolower(buffer[0]) == 'u') {
|
||||
k = -1;
|
||||
j = 0;
|
||||
} else if (buffer[0] < '0' || buffer[0] > '9') {
|
||||
s_printf(get_string(39));
|
||||
break;
|
||||
} else {
|
||||
k = atoi(buffer) - 1;
|
||||
}
|
||||
|
||||
msgbase_reset_pointers(gUser->cur_mail_conf, gUser->cur_mail_area, j, k);
|
||||
|
||||
break;
|
||||
case MENU_RESETALLPOINTERS:
|
||||
s_printf(get_string(230));
|
||||
confirm = s_getc();
|
||||
if (confirm == 'y' || confirm == 'Y') {
|
||||
msgbase_reset_all_pointers();
|
||||
}
|
||||
s_printf(get_string(230));
|
||||
confirm = s_getc();
|
||||
if (confirm == 'r' || confirm == 'R') {
|
||||
j = 1;
|
||||
} else if (confirm == 'u' || confirm == 'U') {
|
||||
j = 0;
|
||||
} else {
|
||||
s_printf(get_string(39));
|
||||
break;
|
||||
}
|
||||
msgbase_reset_all_pointers(j);
|
||||
break;
|
||||
case MENU_FILESCAN:
|
||||
file_scan();
|
||||
|
Reference in New Issue
Block a user