Fixed highlightunread and areareplydirect

This commit is contained in:
Alexander S. Aganichev 2001-09-07 04:15:16 +00:00
parent 0a16f51eb0
commit 07ba5c6413
6 changed files with 258 additions and 168 deletions

View File

@ -12,6 +12,14 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
- Fixed AreaReplyDirect operation when AreaReply is defined (Thanks to
Pavel Gulchouck for the patch).
- Fixed problem with incorrect updating of timesread field when
MSGLISTFIRST is YES.
! @pseudo creation stops at dot now as well.
- Added EditDeleteSOL action: delete text to the start of line. It
works the same way as EditDeleteEOL in terms of what we consider to
be a line, since it deletes to the start of the line as it seen in

View File

@ -326,7 +326,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
continue;
if(tokenxchg(dst, "@msgs", msgs))
continue;
if(tokenxchg(dst, "@cpseudo", *AA->Nickname() ? AA->Nickname() : strlword(strcpy(buf, AA->Username().name), " @")))
if(tokenxchg(dst, "@cpseudo", *AA->Nickname() ? AA->Nickname() : strlword(strcpy(buf, AA->Username().name), " @.")))
continue;
if(tokenxchg(dst, "@version", __gver_ver__))
continue;

View File

@ -43,6 +43,7 @@ int reader_direction;
int reader_rcv_noise = false;
gkey reader_keycode;
gkey reader_lastcode = 0;
bool reader_msglistfirst = false;
GMsgHeaderView *HeaderView;
GMsgBodyView *BodyView;
@ -185,8 +186,12 @@ void Reader() {
else {
AL.SetActiveAreaNo(startecho);
AA->RandomizeData();
if(AA->Msglistfirst())
if(AA->Msglistfirst()) {
reader_msglistfirst = true;
kbput(KK_ReadMessageList);
}
else
reader_msglistfirst = false;
}
if(not reader_finished) {
@ -261,33 +266,35 @@ void Reader() {
HeaderView->Paint();
if(AA->isreadmark or AA->isreadpm) {
GTag& tag = AA->isreadpm ? AA->PMrk : AA->Mark;
uint mtemp = tag.Find(msg->msgno);
sprintf(buf2, "%s [%s%s%s%s]",
LNG->ReadMarked,
AA->Viewhidden() ? "H" : "",
AA->Viewkludge() ? "K" : "",
AA->Twitmode() == TWIT_IGNORE ? "Ti" : AA->Twitmode() == TWIT_SKIP ? "Ts" : AA->Twitmode() == TWIT_BLANK ? "Tb" : AA->Twitmode() == TWIT_KILL ? "Tk" : "",
CFG->showdeleted ? "D" : ""
);
sprintf(buf, buf2,
mtemp, tag.Count(), tag.Count()-mtemp
);
if(reader_msglistfirst == false) {
if(AA->isreadmark or AA->isreadpm) {
GTag& tag = AA->isreadpm ? AA->PMrk : AA->Mark;
uint mtemp = tag.Find(msg->msgno);
sprintf(buf2, "%s [%s%s%s%s]",
LNG->ReadMarked,
AA->Viewhidden() ? "H" : "",
AA->Viewkludge() ? "K" : "",
AA->Twitmode() == TWIT_IGNORE ? "Ti" : AA->Twitmode() == TWIT_SKIP ? "Ts" : AA->Twitmode() == TWIT_BLANK ? "Tb" : AA->Twitmode() == TWIT_KILL ? "Tk" : "",
CFG->showdeleted ? "D" : ""
);
sprintf(buf, buf2,
mtemp, tag.Count(), tag.Count()-mtemp
);
}
else {
sprintf(buf2, "%s [%s%s%s%s]",
LNG->ReadAll,
AA->Viewhidden() ? "H" : "",
AA->Viewkludge() ? "K" : "",
AA->Twitmode() == TWIT_IGNORE ? "Ti" : AA->Twitmode() == TWIT_SKIP ? "Ts" : AA->Twitmode() == TWIT_BLANK ? "Tb" : AA->Twitmode() == TWIT_KILL ? "Tk" : "",
CFG->showdeleted ? "D" : ""
);
sprintf(buf, buf2,
AA->lastread(), AA->Msgn.Count(), AA->Msgn.Count()-AA->lastread()
);
}
update_statusline(buf);
}
else {
sprintf(buf2, "%s [%s%s%s%s]",
LNG->ReadAll,
AA->Viewhidden() ? "H" : "",
AA->Viewkludge() ? "K" : "",
AA->Twitmode() == TWIT_IGNORE ? "Ti" : AA->Twitmode() == TWIT_SKIP ? "Ts" : AA->Twitmode() == TWIT_BLANK ? "Tb" : AA->Twitmode() == TWIT_KILL ? "Tk" : "",
CFG->showdeleted ? "D" : ""
);
sprintf(buf, buf2,
AA->lastread(), AA->Msgn.Count(), AA->Msgn.Count()-AA->lastread()
);
}
update_statusline(buf);
reader_done = false;
reader_keyok = false;
@ -296,95 +303,100 @@ void Reader() {
AA->set_lastread(AA->Msgn.ToReln(msg->msgno));
AA->UpdateAreadata();
// Determine if the message is of the "twit" type
istwit = MsgIsTwit(msg, istwitto, istwitsubj);
if(reader_msglistfirst == false) {
if(istwit)
HandleGEvent(EVTT_MSGISTWIT);
// Determine if the message is of the "twit" type
istwit = MsgIsTwit(msg, istwitto, istwitsubj);
if((istwit == TWIT_SKIP) or (not CFG->showdeleted and msg->attr.del())) {
if(reader_direction == DIR_NEXT) {
if(AA->lastread() < AA->Msgn.Count()) {
if(gkbd.kbuf == NULL) {
switch(reader_lastcode) {
case KK_ReadGotoReplies:
case KK_ReadGotoReply1st:
case KK_ReadGotoReplyNext:
if(MsgHasReplies(msg)) {
kbput(KK_ReadGotoReplies);
}
else {
SayBibi();
kbput(KK_ReadGotoReplyPrev);
}
break;
default:
kbput(KK_ReadGotoNextMsg);
}
}
}
}
else {
if(AA->lastread() > 1) {
if(gkbd.kbuf == NULL) {
if(reader_lastcode == KK_ReadGotoReplyPrev) {
if(AA->Msgn.ToReln(msg->link.to()))
kbput(KK_ReadGotoReplyPrev);
else {
SayBibi();
kbput(KK_ReadGotoReplies);
if(istwit)
HandleGEvent(EVTT_MSGISTWIT);
if((istwit == TWIT_SKIP) or (not CFG->showdeleted and msg->attr.del())) {
if(reader_direction == DIR_NEXT) {
if(AA->lastread() < AA->Msgn.Count()) {
if(gkbd.kbuf == NULL) {
switch(reader_lastcode) {
case KK_ReadGotoReplies:
case KK_ReadGotoReply1st:
case KK_ReadGotoReplyNext:
if(MsgHasReplies(msg)) {
kbput(KK_ReadGotoReplies);
}
else {
SayBibi();
kbput(KK_ReadGotoReplyPrev);
}
break;
default:
kbput(KK_ReadGotoNextMsg);
}
}
else
kbput(KK_ReadGotoPrevMsg);
}
}
else {
if(AA->lastread() > 1) {
if(gkbd.kbuf == NULL) {
if(reader_lastcode == KK_ReadGotoReplyPrev) {
if(AA->Msgn.ToReln(msg->link.to()))
kbput(KK_ReadGotoReplyPrev);
else {
SayBibi();
kbput(KK_ReadGotoReplies);
}
}
else
kbput(KK_ReadGotoPrevMsg);
}
}
}
}
}
BodyView->Use(AA, msg, reader_topline);
if(istwit > TWIT_SHOW) {
BodyView->window.clear();
if(istwit == TWIT_SKIP)
BodyView->window.prints(1, 0, C_READW, LNG->SkippingTwit);
else if(istwit == TWIT_KILL)
BodyView->window.prints(1, 0, C_READW, LNG->KillingTwit);
BodyView->Use(AA, msg, reader_topline);
if(istwit > TWIT_SHOW) {
BodyView->window.clear();
if(istwit == TWIT_SKIP)
BodyView->window.prints(1, 0, C_READW, LNG->SkippingTwit);
else if(istwit == TWIT_KILL)
BodyView->window.prints(1, 0, C_READW, LNG->KillingTwit);
else {
BodyView->window.prints(1, 0, C_READW, LNG->HidingTwit);
}
}
else {
BodyView->window.prints(1, 0, C_READW, LNG->HidingTwit);
BodyView->Paint();
}
if(reader_rcv_noise) {
if(CFG->beepyourmail == ALWAYS)
HandleGEvent(EVTT_MSGTOYOU);
else if(reader_rcv_noise > 1 and CFG->beepyourmail == true)
HandleGEvent(EVTT_MSGTOYOU);
reader_rcv_noise = false;
}
else {
if(msg->attr.fmu())
HandleGEvent(EVTT_MSGFROMYOU);
}
if(msg->attr.loc() and CFG->switches.get(beeplocalmsg))
HandleGEvent(EVTT_MSGISLOCAL);
if(AA->Msgn.Count() and CFG->switches.get(highlightunread) and (msg->orig_timesread == 0))
AA->UpdateTimesread(msg);
switch(istwit) {
case TWIT_KILL:
TwitDeleteMsg(msg);
continue;
case TWIT_SKIP:
reader_keycode = ReaderGetKey();
break;
default:
reader_keycode = ViewMessage(istwit);
}
}
else {
BodyView->Paint();
}
if(reader_rcv_noise) {
if(CFG->beepyourmail == ALWAYS)
HandleGEvent(EVTT_MSGTOYOU);
else if(reader_rcv_noise > 1 and CFG->beepyourmail == true)
HandleGEvent(EVTT_MSGTOYOU);
reader_rcv_noise = false;
}
else {
if(msg->attr.fmu())
HandleGEvent(EVTT_MSGFROMYOU);
}
if(msg->attr.loc() and CFG->switches.get(beeplocalmsg))
HandleGEvent(EVTT_MSGISLOCAL);
if(AA->Msgn.Count() and CFG->switches.get(highlightunread) and (msg->orig_timesread == 0))
AA->UpdateTimesread(msg);
switch(istwit) {
case TWIT_KILL:
TwitDeleteMsg(msg);
continue;
case TWIT_SKIP:
reader_keycode = ReaderGetKey();
break;
default:
reader_keycode = ViewMessage(istwit);
}
else
reader_keycode = ReaderGetKey();
reader_topline = BodyView->UpperLine();
@ -572,6 +584,7 @@ void Reader() {
case KK_ReadMessageList:
MessageBrowse();
reader_msglistfirst = false;
break;
case KK_ReadThreadtree:
@ -580,7 +593,7 @@ void Reader() {
case KK_ReadDosShell:
DosShell();
reader_keyok = YES;
reader_keyok = true;
break;
case KK_ReadFindAll:
@ -914,42 +927,44 @@ int LoadMessage(GMsg* msg, int margin) {
msg->attr.tou1();
}
if(msg->attr.tou()) {
reader_rcv_noise = 1;
if(not msg->attr.rcv()) { // Have we seen it?
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->received = a + a - b; // Get current date
msg->attr.rcv1(); // Mark as received
reader_rcv_noise++;
if(reader_msglistfirst == false) {
if(msg->attr.tou()) {
reader_rcv_noise = 1;
if(not msg->attr.rcv()) { // Have we seen it?
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
tp->tm_isdst = -1;
time_t b = mktime(tp);
msg->received = a + a - b; // Get current date
msg->attr.rcv1(); // Mark as received
reader_rcv_noise++;
}
else if(not CFG->switches.get(rcvdisablescfm))
reader_rcv_noise++;
}
else if(not CFG->switches.get(rcvdisablescfm))
reader_rcv_noise++;
// Touch the msg if it's the first time received
if(reader_rcv_noise > 1)
msg->attr.upd1(); // Tell SaveHdr to "touch" the time stamp of the *.MSG file
// Update the "Times Read" field
msg->orig_timesread = msg->timesread++;
if(reader_rcv_noise > 1) {
GMsg* tmsg = (GMsg*) throw_calloc(1, sizeof(GMsg));
AA->LoadHdr(tmsg, msg->msgno, false);
tmsg->attr = msg->attr;
tmsg->orig_timesread = msg->orig_timesread;
tmsg->received = msg->received;
AA->SaveHdr(GMSG_UPDATE, tmsg);
throw_free(tmsg);
}
msg->attr.upd0();
if((reader_rcv_noise > 1) and AA->isnet() and (msg->attr.cfm() or msg->attr.rrq()))
reader_gen_confirm = true;
}
// Touch the msg if it's the first time received
if(reader_rcv_noise > 1)
msg->attr.upd1(); // Tell SaveHdr to "touch" the time stamp of the *.MSG file
// Update the "Times Read" field
msg->orig_timesread = msg->timesread++;
if(reader_rcv_noise > 1) {
GMsg* tmsg = (GMsg*) throw_calloc(1, sizeof(GMsg));
AA->LoadHdr(tmsg, msg->msgno, false);
tmsg->attr = msg->attr;
tmsg->orig_timesread = msg->orig_timesread;
tmsg->received = msg->received;
AA->SaveHdr(GMSG_UPDATE, tmsg);
throw_free(tmsg);
}
msg->attr.upd0();
if((reader_rcv_noise > 1) and AA->isnet() and (msg->attr.cfm() or msg->attr.rrq()))
reader_gen_confirm = true;
}
}
else {

View File

@ -36,6 +36,7 @@
// Global data from GEREAD
extern GMsg* reader_msg;
extern bool reader_msglistfirst;
// ------------------------------------------------------------------
@ -485,8 +486,10 @@ void NewArea(bool jumpnext) {
OrigArea = CurrArea;
strcpy(stecho, AA->echoid());
AA->RandomizeData();
if(AA->Msglistfirst())
if(AA->Msglistfirst()) {
kbput(KK_ReadMessageList);
reader_msglistfirst = true;
}
}
}

View File

@ -273,13 +273,13 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
// build @tpseudo
if(is_user(msg->to))
strcpy(msg->pseudoto, *AA->Nickname() ? AA->Nickname() : strlword(msg->to, " @"));
strcpy(msg->pseudoto, *AA->Nickname() ? AA->Nickname() : strlword(msg->to, " @."));
else
*(msg->pseudoto) = NUL;
// build @fpseudo
if(is_user(msg->By()))
strcpy(msg->pseudofrom, *AA->Nickname() ? AA->Nickname() : strlword(msg->By(), " @"));
strcpy(msg->pseudofrom, *AA->Nickname() ? AA->Nickname() : strlword(msg->By(), " @."));
else
*(msg->pseudofrom) = NUL;
@ -394,6 +394,8 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
goto loop_next;
if(AL.AreaIdToPtr(origarea)->Areareplydirect() and oldmsg->areakludgeid and strieql(oldmsg->areakludgeid, AA->echoid()))
goto loop_next;
if(AL.AreaIdToPtr(origarea)->Areareplydirect() and strieql(AL.AreaIdToPtr(origarea)->Areareplyto(), AA->echoid()))
goto loop_next;
if(strieql(oldmsg->fwdarea, AA->echoid()))
goto loop_next;
token = end_token;
@ -962,16 +964,68 @@ void ConfirmMsg() {
bool _allow_pick = true;
void OtherAreaReplyMsg() {
if(AA->Msgn.Count()) {
int destarea = CurrArea;
if(CurrArea == OrigArea) {
if(*AA->Areareplyto()) {
int a = AL.AreaEchoToNo(AA->Areareplyto());
if(a != -1)
destarea = AL.AreaNoToId(a);
}
reader_topline = 0;
AA->attr().hex0();
const char* destinationecho = *reader_msg->fwdarea ? reader_msg->fwdarea : reader_msg->areakludgeid;
if(destinationecho and *destinationecho) {
for(uint n=0; n<AL.size(); n++) {
if(strieql(AL[n]->echoid(), destinationecho)) {
destarea = AL[n]->areaid();
break;
}
}
}
if(_allow_pick or not AA->Areareplydirect())
destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
}
if(destarea != -1) {
int adat_viewhidden = AA->adat->viewhidden;
int adat_viewkludge = AA->adat->viewkludge;
int adat_viewquote = AA->adat->viewquote;
AL.SetActiveAreaId(destarea);
if(CurrArea != OrigArea) {
AA->Open();
if(CurrArea != OrigArea) {
AA->adat->viewhidden = adat_viewhidden;
AA->adat->viewkludge = adat_viewkludge;
AA->adat->viewquote = adat_viewquote;
}
}
ReplyMsg();
if(CurrArea != OrigArea) {
AA->Close();
AL.SetActiveAreaId(OrigArea);
}
}
}
}
// ------------------------------------------------------------------
void ReplyMsg() {
if(CurrArea == OrigArea) {
if(AA->Areareplydirect() and reader_msg->areakludgeid) {
int a = AL.AreaEchoToNo(reader_msg->areakludgeid);
const char *destarea = AA->Areareplyto();
if (!*destarea)
destarea = reader_msg->areakludgeid;
if(AA->Areareplydirect() and destarea) {
int a = AL.AreaEchoToNo(destarea);
if(a != -1) {
CurrArea = AL.AreaNoToId(a);
if(CurrArea != OrigArea) {
_allow_pick = false;
OtherAreaQuoteMsg();
OtherAreaReplyMsg();
_allow_pick = true;
return;
}
@ -997,8 +1051,12 @@ void ReplyMsg() {
void QuoteMsg(bool ignore_replyto) {
if(CurrArea == OrigArea) {
if(AA->Areareplydirect() and reader_msg->areakludgeid) {
int a = AL.AreaEchoToNo(reader_msg->areakludgeid);
const char *destarea = AA->Areareplyto();
if (!*destarea)
destarea = reader_msg->areakludgeid;
if(AA->Areareplydirect() and destarea) {
int a = AL.AreaEchoToNo(destarea);
if(a != -1) {
CurrArea = AL.AreaNoToId(a);
if(CurrArea != OrigArea) {
@ -1029,8 +1087,12 @@ void QuoteMsg(bool ignore_replyto) {
void CommentMsg() {
if(CurrArea == OrigArea) {
if(AA->Areareplydirect() and reader_msg->areakludgeid) {
int a = AL.AreaEchoToNo(reader_msg->areakludgeid);
const char *destarea = AA->Areareplyto();
if (!*destarea)
destarea = reader_msg->areakludgeid;
if(AA->Areareplydirect() && destarea) {
int a = AL.AreaEchoToNo(destarea);
if(a != -1) {
CurrArea = AL.AreaNoToId(a);
if(CurrArea != OrigArea) {
@ -1112,24 +1174,26 @@ void OtherAreaCommentMsg() {
if(AA->Msgn.Count()) {
int destarea = CurrArea;
if(*AA->Areareplyto()) {
int a = AL.AreaEchoToNo(AA->Areareplyto());
if(a != -1)
destarea = AL.AreaNoToId(a);
}
reader_topline = 0;
AA->attr().hex0();
const char* destinationecho = *reader_msg->fwdarea ? reader_msg->fwdarea : reader_msg->areakludgeid;
if(destinationecho and *destinationecho) {
for(uint n=0; n<AL.size(); n++) {
if(strieql(AL[n]->echoid(), destinationecho)) {
destarea = AL[n]->areaid();
break;
if(CurrArea == OrigArea) {
if(*AA->Areareplyto()) {
int a = AL.AreaEchoToNo(AA->Areareplyto());
if(a != -1)
destarea = AL.AreaNoToId(a);
}
reader_topline = 0;
AA->attr().hex0();
const char* destinationecho = *reader_msg->fwdarea ? reader_msg->fwdarea : reader_msg->areakludgeid;
if(destinationecho and *destinationecho) {
for(uint n=0; n<AL.size(); n++) {
if(strieql(AL[n]->echoid(), destinationecho)) {
destarea = AL[n]->areaid();
break;
}
}
}
if(_allow_pick or not AA->Areareplydirect())
destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
}
if(_allow_pick or not AA->Areareplydirect())
destarea = AreaPick(LNG->ReplyArea, 6, &destarea);
if(destarea != -1) {
int adat_viewhidden = AA->adat->viewhidden;
int adat_viewkludge = AA->adat->viewkludge;

View File

@ -868,9 +868,9 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
void guserbase::build_pseudo(GMsg* msg, char* name, char* aka, bool direction) {
if(*msg->iaddr and isuucp(name))
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(msg->iaddr, " @"));
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(msg->iaddr, " @."));
else
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(name, " @"));
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(name, " @."));
if(find_entry(name, true) and not entry.is_deleted) {