small fixes

This commit is contained in:
Alexander S. Aganichev 2001-11-13 11:35:21 +00:00
parent 6afc6df423
commit 1df219b606
11 changed files with 30 additions and 42 deletions

View File

@ -216,6 +216,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, "\001CC: %s %s", (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddKludge(ccline, buf);
(*carbon)[n].attr.tou0();
}
}
break;
@ -229,6 +230,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, buf2, (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddLine(ccline, buf);
(*carbon)[n].attr.tou0();
}
}
break;
@ -242,7 +244,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
hline += msg->To();
++line_items;
}
for(n=0; n < cc; n++)
for(n=0; n < cc; n++) {
if((*carbon)[n].attr.tou()) {
const char *user = (*carbon)[n].To();
if((hline.length() + strlen(user) + 2 > margintext) and line_items) {
@ -255,6 +257,8 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
hline += ", ";
hline += user;
++line_items;
(*carbon)[n].attr.tou0();
}
}
if(line_items) {
sprintf(buf, LNG->CCTo, hline.c_str());

View File

@ -70,17 +70,14 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
if(mode == MODE_WRITE) {
if(AA->LoadMsg(msg, msg->msgno, margin) == false) {
msg->txt = throw_strdup("");
msg->attr.tou0();
msg->TextToLines(margin);
}
}
else if((mode == MODE_SAVE) or (mode == MODE_SAVENOCTRL)) {
msg->attr.tou0();
msg->TextToLines(margin);
}
TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->WTpl(), CurrArea);
msg->attr.tou1();
msg->TextToLines(margin);
msg->TextToLines(margin, false);
#endif
int n = 0;
Line** lin = msg->line;
@ -403,9 +400,7 @@ void QuoteBuf(GMsg* msg) {
char openmode[4];
TemplateToText(MODE_QUOTEBUF, msg, msg, AA->Tpl(), CurrArea);
msg->attr.tou1();
msg->TextToLines(-CFG->quotemargin);
msg->attr.tou0();
msg->TextToLines(-CFG->quotemargin, false);
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, CFG->xlatlocalset);
msg->LinesToText();

View File

@ -827,7 +827,7 @@ void IEclass::LoadFile() {
AA->SetXlatimport(CFG->xlatlocalset);
// Index message text
msgptr->TextToLines(margintext-1);
msgptr->TextToLines(margintext-1, false);
_line = currline = msgptr->lin;
// Restore charset

View File

@ -559,6 +559,7 @@ static void KludgeREPLYADDR(GMsg* msg, const char* ptr) {
INam name;
char *buf=throw_strdup(ptr);
*name = NUL;
ParseInternetAddr(buf, *msg->realby ? name : msg->realby, msg->iaddr);
if(*name)
strxcpy(msg->realby, name, sizeof(INam));
@ -1782,9 +1783,9 @@ int cmp_quotes(char* q1, char* q2) {
// ------------------------------------------------------------------
void GMsg::TextToLines(int __line_width, bool header_recode) {
void GMsg::TextToLines(int __line_width, bool getvalue, bool header_recode) {
MakeLineIndex(this, __line_width, header_recode);
MakeLineIndex(this, __line_width, getvalue, header_recode);
}
@ -1832,7 +1833,7 @@ inline bool put_on_new_line(const char *ptr, const char *prev_ptr) {
// ------------------------------------------------------------------
void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
uint idx=0;
uint len;
@ -1856,7 +1857,6 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
uint qlen=0, qlen2=0;
int wraps=0, para=0, chslev;
bool reflow = false, quoteflag = false;
bool getvalue = not msg->attr.tou();
bool quotewraphard = AA->Quotewraphard();
bool qpencoded = getvalue and IsQuotedPrintable(AA->Xlatimport());
bool gotmime = false;
@ -2946,7 +2946,7 @@ Line* AddHexdump(Line*& line, void* data, size_t datalen) {
// ------------------------------------------------------------------
char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
char* ParseInternetAddr(char* __string, char* __name, char* __addr, bool detect_charset) {
*__name = *__addr = NUL;
char* commaptr = NULL;
@ -3021,7 +3021,7 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
if(not strchr(__addr, '@'))
*__addr = NUL;
strxmimecpy(__name, __name, 0, strlen(__name)+1, true);
strxmimecpy(__name, __name, 0, strlen(__name)+1, detect_charset);
return __name;
}

View File

@ -90,7 +90,6 @@ int Area::LoadMsg(GMsg* msg, ulong msgno, int margin, int mode) {
if(not (msg->attr.uns() and not msg->attr.rcv()))
return true;
}
msg->attr.tou0();
msg->TextToLines(margin);
return true;
}

View File

@ -510,10 +510,8 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
HeaderView->Use(AA, msg);
HeaderView->Paint();
}
msg->attr.tou1(); // Ignore any kludge address found
msg->attr.pos1();
msg->TextToLines(CFG->dispmargin-1);
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found
msg->attr.pos0();
}
uint lineno = position = reader_topline+1;
@ -623,9 +621,7 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
LoadText(msg, AddPath(CFG->goldpath, EDIT->File()));
if(mode == MODE_FORWARD)
msg->attr.pos1();
msg->attr.tou1(); // ignore any kludge address found
msg->TextToLines(CFG->dispmargin-1);
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1, false); // Ignore any kludge address found
msg->attr.pos0();
if(not savedirect) {
@ -733,7 +729,6 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
AA->RandomizeData(mode);
}
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1);
msg->orig = AA->Aka().addr;
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, AA->Xlatexport());
@ -766,8 +761,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
msg->messageid = NULL;
msg->inreplyto = NULL;
msg->references = NULL;
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1, false);
msg->TextToLines(CFG->dispmargin-1, true, false);
msg->msgid.reset();
*msg->iorig = NUL;
*msg->idest = NUL;
@ -793,8 +787,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
msg->messageid = NULL;
msg->inreplyto = NULL;
msg->references = NULL;
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1, false);
msg->TextToLines(CFG->dispmargin-1, true, false);
break;
case MODE_NEW:
wfill(MINROW, 0, MAXROW-2, MAXCOL-1, ' ', C_READW);
@ -837,8 +830,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
case MODE_REPLYCOMMENT:
if(CurrArea != OrigArea)
AA->SetXlatimport(AL.AreaIdToPtr(OrigArea)->Xlatimport());
omsg->attr.tou0();
omsg->TextToLines(-CFG->quotemargin, false);
omsg->TextToLines(-CFG->quotemargin, true, false);
if(ignore_replyto)
*omsg->ireplyto = NUL;
if(omsg->attr.rot())

View File

@ -175,7 +175,7 @@ Line* DeleteLine(Line* line);
Line* FirstLine(Line* line);
Line* InsertLine(Line* newline, Line* oldline, int pos);
Line* LastLine(Line* line);
void MakeLineIndex(GMsg* msg, int rmargin, bool header_recode = true);
void MakeLineIndex(GMsg* msg, int rmargin, bool getvalue, bool header_recode);
void MsgLineReIndex(GMsg* msg, int viewhidden=-1, int viewkludge=-1, int viewquote=-1);
char* XlatStr(char* dest, const char* src, int level, Chs* chrtbl, int qpencoded=false, bool i51=false);
char* mime_header_decode(char* decoded, const char* encoded, char* charset = NULL);
@ -221,7 +221,7 @@ void Rot13(GMsg* msg);
void ResetMsg(GMsg* msg);
int DoCarboncopy(GMsg* msg, GMsg** carbon);
void DoCrosspost(GMsg* msg, std::vector<int> &postareas);
char* ParseInternetAddr(char* __string, char* __name, char* __addr);
char* ParseInternetAddr(char* __string, char* __name, char* __addr, bool detect_charset = true);
// ------------------------------------------------------------------

View File

@ -233,7 +233,6 @@ int ImportQWK() {
AA->istossed = true;
update_statuslinef("%s: %u", AA->echoid(), imported);
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1);
if(msg->messageid or msg->references or msg->inreplyto or *msg->ifrom) {
char kbuf[256];

View File

@ -585,9 +585,8 @@ int ExternUtil(GMsg *msg, ExtUtil *extutil) {
WipeFile(tmpfile, 0);
EDIT->HardLines(hardlines);
msg->attr.tou1(); // Ignore any kludge address found
msg->TextToLines(CFG->dispmargin-(int)CFG->switches.get(disppagebar));
msg->attr.tou0();
// Ignore any kludge address found
msg->TextToLines(CFG->dispmargin-(int)CFG->switches.get(disppagebar), false);
}
return YES;
@ -690,7 +689,7 @@ void ReadPeekURLs(GMsg* msg) {
--end;
if(begin < end) {
buf[0] = ' ';
strxcpy(buf+1, ptr, MinV((end-ptr)+1, MAXCOL-2-2-2));
strxcpy(buf+1, ptr, MinV((long)((end-ptr)+1), (long)(MAXCOL-2-2-2)));
strcat(buf, " ");
for(i = urls.begin(); i != urls.end(); i++)
if(strieql(*i, buf))

View File

@ -235,7 +235,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
if(MatchRFC(mptr, "From: ")) {
INam fromname;
IAdr fromaddr;
ParseInternetAddr(mptr, fromname, fromaddr);
ParseInternetAddr(mptr, fromname, fromaddr, false);
strxcpy(msg->by, *fromname ? fromname : fromaddr, sizeof(msg->by));
if(AA->Internetgate().addr.net) {
char abuf[40];
@ -254,7 +254,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
strxcpy(msg->ito, mptr, sizeof(msg->ito));
INam toname;
IAdr toaddr;
ParseInternetAddr(mptr, toname, toaddr);
ParseInternetAddr(mptr, toname, toaddr, false);
strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to));
}
else if(MatchRFC(mptr, "X-Comment-To: ")) {
@ -275,7 +275,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
else if(MatchRFC(mptr, "X-To: ")) {
INam toname;
IAdr toaddr;
ParseInternetAddr(mptr, toname, toaddr);
ParseInternetAddr(mptr, toname, toaddr, false);
strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to));
}
else if(MatchRFC(mptr, "Subject: ")) {
@ -310,13 +310,13 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
else if(MatchRFC(mptr, "Sender: ")) {
INam sendername;
IAdr senderaddr;
ParseInternetAddr(mptr, sendername, senderaddr);
ParseInternetAddr(mptr, sendername, senderaddr, false);
CurrArea = CheckMailinglists(senderaddr, CurrArea);
}
else if(MatchRFC(mptr, "X-Mailing-List: ")) {
INam listname;
IAdr listaddr;
ParseInternetAddr(mptr, listname, listaddr);
ParseInternetAddr(mptr, listname, listaddr, false);
CurrArea = CheckMailinglists(listaddr, CurrArea);
}

View File

@ -103,7 +103,7 @@ public:
bool to_you() { return (you_and_I & TO_YOU); }
bool by_you() { return (you_and_I & BY_YOU); }
void TextToLines(int __line_width, bool header_recode = true);
void TextToLines(int __line_width, bool getvalue = true, bool header_recode = true);
void LinesToText();
};