Few more fixes to the damned internetgating

This commit is contained in:
Alexander S. Aganichev 2001-11-22 12:32:49 +00:00
parent bc8721532f
commit f7a39d9cdf
9 changed files with 68 additions and 32 deletions

View File

@ -730,7 +730,7 @@ CfgGed::CfgGed() {
quotemargin = 70; quotemargin = 70;
quotewraphard = false; quotewraphard = false;
ra2usersbbs = 0; ra2usersbbs = 0;
replylink = 0; replylink = REPLYLINK_DIRECT;
replylinklist = 0; replylinklist = 0;
screenblanker = 180; screenblanker = 180;
screenblankertype = BLANK_SLIDEWIN; screenblankertype = BLANK_SLIDEWIN;

View File

@ -317,6 +317,7 @@ int AreaList::SetActiveAreaId(int __areaid) {
class SelMaskPick : public gwinpick { class SelMaskPick : public gwinpick {
gwindow window; gwindow window;
int DESC_LEN;
void open(); // Called after window is opened void open(); // Called after window is opened
void close(); // Called after window is closed void close(); // Called after window is closed
@ -345,9 +346,9 @@ void SelMaskPick::close() {
void SelMaskPick::print_line(uint idx, uint pos, bool isbar) { void SelMaskPick::print_line(uint idx, uint pos, bool isbar) {
char buf[sizeof(Desc)+3]; __extension__ char buf[DESC_LEN+3];
*buf = ' '; strcpy(buf+1, AL.alistselections[idx]); *buf = ' '; strxcpy(buf+1, AL.alistselections[idx], DESC_LEN);
window.printns(pos, 0, isbar ? sattr : wattr, buf, xlen); window.printns(pos, 0, isbar ? sattr : wattr, buf, xlen);
} }
@ -367,7 +368,7 @@ bool SelMaskPick::handle_key() {
default: default:
if(key < KK_Commands) { if(key < KK_Commands) {
kbput(key); kbput(key);
edit_string(AL.alistselections[index], sizeof(Desc)-1, LNG->SelectMarksEdit, H_SelectMarks); edit_string(AL.alistselections[index], DESC_LEN-1, LNG->SelectMarksEdit, H_SelectMarks);
display_bar(); display_bar();
} }
break; break;
@ -378,10 +379,12 @@ bool SelMaskPick::handle_key() {
void SelMaskPick::Run() { void SelMaskPick::Run() {
DESC_LEN = (sizeof(Desc) > (MAXCOL-6)) ? MAXCOL-6 : sizeof(Desc);
ypos = (MAXROW-18)/2; ypos = (MAXROW-18)/2;
xpos = (MAXCOL-sizeof(Desc)-4)/2-1; xpos = (MAXCOL-DESC_LEN-4)/2-1;
ylen = 16; ylen = 16;
xlen = sizeof(Desc)+2; xlen = DESC_LEN+2;
btype = W_BMENU; btype = W_BMENU;
battr = C_MENUB; battr = C_MENUB;
wattr = C_MENUW; wattr = C_MENUW;

View File

@ -655,13 +655,23 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
else if(((mode != MODE_CHANGE) or AA->Internetrfcbody()) and AA->isnet()) { else if(((mode != MODE_CHANGE) or AA->Internetrfcbody()) and AA->isnet()) {
if(*msg->ito) { if(*msg->ito) {
sprintf(buf, "To: %s", msg->ito); sprintf(buf, "To: %s", msg->ito);
line = AddKludge(line, buf); if(AA->Internetrfcbody()) {
line->kludge = GKLUD_RFC; line = AddKludge(line, buf);
if(AA->Internetrfcbody() and line->next and not strblank(line->next->txt.c_str())) {
line = AddKludge(line, "");
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
} }
else {
line = AddLine(line, buf);
}
if(line->next and not strblank(line->next->txt.c_str())) {
if(AA->Internetrfcbody()) {
line = AddKludge(line, "");
line->kludge = GKLUD_RFC;
}
else {
line = AddLine(line, "");
}
}
} }
} }
} }

View File

@ -155,14 +155,19 @@ bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fro
strcpy(msg->realto, buf2); strcpy(msg->realto, buf2);
strcpy(msg->idest, buf); strcpy(msg->idest, buf);
strcpy(msg->iaddr, buf); strcpy(msg->iaddr, buf);
if(ptr) if(AA->isinternet())
strcpy(buf2, buf1+1); ptr = strcpy(buf1, *buf2 ? buf2 : buf);
ptr = strcpy(buf1, ptr and *buf2 ? buf2 : *buf ? buf : buf2); else {
if(ptr)
strcpy(buf2, buf1+1);
ptr = strcpy(buf1, ptr and *buf2 ? buf2 : *buf ? buf : buf2);
}
} }
else if(AA->isinternet()) { else if(AA->isinternet()) {
ParseInternetAddr(buf1, buf2, buf); ParseInternetAddr(buf1, buf2, buf);
strcpy(msg->realto, buf2); strcpy(msg->realto, buf2);
strcpy(msg->idest, buf); strcpy(msg->idest, buf);
strcpy(msg->iaddr, buf);
ptr = strcpy(buf1, *buf2 ? buf2 : buf); ptr = strcpy(buf1, *buf2 ? buf2 : buf);
} }
else { else {
@ -206,7 +211,7 @@ bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fro
// Internet gating // Internet gating
if(not AA->isinternet()) { if(not AA->isinternet()) {
if(strchr(toname->buf, '@') and AA->Internetgate().addr.net) { if(strchr(toname->buf, '@') and AA->Internetgate().addr.valid()) {
if(*AA->Internetgate().name) { if(*AA->Internetgate().name) {
strcpy(msg->iaddr, toname->buf); strcpy(msg->iaddr, toname->buf);
strcpy(msg->to, AA->Internetgate().name); strcpy(msg->to, AA->Internetgate().name);
@ -317,14 +322,6 @@ bool GMsgHeaderEdit::validate() {
strsetsz(bot2, EDIT->HdrNodeLen()); strsetsz(bot2, EDIT->HdrNodeLen());
window.prints(1, EDIT->HdrNodePos(), C_HEADW, bot2); window.prints(1, EDIT->HdrNodePos(), C_HEADW, bot2);
// once we changed name invalidate realto and internet address
if(not strieql(orig_toname.c_str(), toname.buf)) {
if(strieql(realto.c_str(), msg->realto))
*msg->realto = NUL;
if(not AA->isinternet() and strieql(iaddr.c_str(), msg->iaddr))
*msg->iaddr = NUL;
}
if(toname.update) current->update(); if(toname.update) current->update();
if(toaddr.update) ftoaddr->update(); if(toaddr.update) ftoaddr->update();
if(fromaddr.update) ffromaddr->update(); if(fromaddr.update) ffromaddr->update();
@ -500,7 +497,7 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
else else
strcpy(msg->to, to_name.c_str()); strcpy(msg->to, to_name.c_str());
} }
if(AA->Internetgate().addr.net) if(AA->Internetgate().addr.valid())
msg->dest = AA->Internetgate().addr; msg->dest = AA->Internetgate().addr;
} }
else else
@ -522,6 +519,8 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
} }
else else
strcpy(msg->ito, msg->iaddr); strcpy(msg->ito, msg->iaddr);
if(not *msg->idest)
strcpy(msg->idest, msg->iaddr);
} }
if(not *msg->realto and isuucp(msg->to)) if(not *msg->realto and isuucp(msg->to))

View File

@ -2583,6 +2583,20 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
// Scan for kludge-, tear- and originlines // Scan for kludge-, tear- and originlines
ScanKludges(msg, getvalue); ScanKludges(msg, getvalue);
// Try to fix the following situation:
// Messagebase From field: fido7@da.ru
// @REPLYADDR: fido7@da.ru
// @REPLYTO: 2:5020/52 Sergey Kitsya
// From: fido7@da.ru
if(getvalue and streql(msg->by, msg->iaddr) and not *msg->realby and *msg->igate) {
ptr = strchr(msg->igate, ' ');
if(ptr) {
ptr = strskip_wht(ptr);
if(not isuucp(ptr))
strcpy(msg->realby, ptr);
}
}
} }
} }

View File

@ -888,7 +888,7 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) {
} }
// Automatic internet gating // Automatic internet gating
if(strchr(name, '@') and AA->Internetgate().addr.net) { if(strchr(name, '@') and AA->Internetgate().addr.valid()) {
strcpy(msg->idest, name); strcpy(msg->idest, name);
if(*AA->Internetgate().name) { if(*AA->Internetgate().name) {
strcpy(msg->iaddr, name); strcpy(msg->iaddr, name);
@ -1041,7 +1041,7 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) {
if(topline >= 0) { if(topline >= 0) {
if(CFG->switches.get(internetlookup)) { if(CFG->switches.get(internetlookup)) {
if(*entry.system and strchr(entry.system, '@') and AA->Internetgate().addr.net) { if(*entry.system and strchr(entry.system, '@') and AA->Internetgate().addr.valid()) {
strcpy(msg->iaddr, entry.system); strcpy(msg->iaddr, entry.system);
strcpy(msg->idest, entry.system); strcpy(msg->idest, entry.system);
if(*AA->Internetgate().name) if(*AA->Internetgate().name)

View File

@ -241,7 +241,7 @@ int ImportQWK() {
INam _fromname; INam _fromname;
IAdr _fromaddr; IAdr _fromaddr;
ParseInternetAddr(msg->ifrom, _fromname, _fromaddr); ParseInternetAddr(msg->ifrom, _fromname, _fromaddr);
if(AA->Internetgate().addr.net) { if(AA->Internetgate().addr.valid()) {
char abuf[40]; char abuf[40];
sprintf(kbuf, "\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r", sprintf(kbuf, "\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r",
AA->Internetgate().addr.make_string(abuf), AA->Internetgate().addr.make_string(abuf),

View File

@ -169,7 +169,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
msgs++; msgs++;
msg->orig = msg->oorig = CFG->internetgate.addr.net ? CFG->internetgate.addr : AA->aka(); msg->orig = msg->oorig = CFG->internetgate.addr.valid() ? CFG->internetgate.addr : AA->aka();
msg->dest = msg->odest = AA->aka(); msg->dest = msg->odest = AA->aka();
time_t a = time(NULL); time_t a = time(NULL);
struct tm *tp = gmtime(&a); struct tm *tp = gmtime(&a);
@ -237,7 +237,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
IAdr fromaddr; IAdr fromaddr;
ParseInternetAddr(mptr, fromname, fromaddr, false); ParseInternetAddr(mptr, fromname, fromaddr, false);
strxcpy(msg->by, *fromname ? fromname : fromaddr, sizeof(msg->by)); strxcpy(msg->by, *fromname ? fromname : fromaddr, sizeof(msg->by));
if(AA->Internetgate().addr.net) { if(AA->Internetgate().addr.valid()) {
char abuf[40]; char abuf[40];
char kbuf[2048]; char kbuf[2048];
sprintf(kbuf, "\x1""REPLYTO %s %s", sprintf(kbuf, "\x1""REPLYTO %s %s",

View File

@ -825,7 +825,8 @@ void guserbase::update_addressbook(GMsg* msg, bool reverse, bool force) {
// Update address // Update address
if(AA->isinternet() or (not *entry.iaddr and *iaddr)) if(AA->isinternet() or (not *entry.iaddr and *iaddr))
strxcpy(entry.iaddr, iaddr, sizeof(entry.iaddr)); strxcpy(entry.iaddr, iaddr, sizeof(entry.iaddr));
if(not AA->isinternet() and not (AA->Internetgate().addr.valid() and (fidoaddr == AA->Internetgate().addr))) // If iaddr is not empty then we adding entry from gated message
if(not AA->isinternet() and not *iaddr and (not AA->Internetgate().addr.valid() or (AA->Internetgate().addr != fidoaddr)))
entry.fidoaddr = fidoaddr; entry.fidoaddr = fidoaddr;
lock(); lock();
@ -855,7 +856,7 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
found = true; found = true;
if(*msg->iaddr and not AA->isinternet()) { if(not strblank(entry.iaddr) and not AA->isinternet()) {
// do UUCP addressing // do UUCP addressing
strcpy(msg->realto, entry.name); strcpy(msg->realto, entry.name);
if(*AA->Internetgate().name) if(*AA->Internetgate().name)
@ -867,6 +868,8 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
strcpy(name, entry.name); strcpy(name, entry.name);
if(AA->isinternet()) if(AA->isinternet())
strcpy(msg->realto, entry.name); strcpy(msg->realto, entry.name);
else
*msg->realto = NUL;
} }
if(not strblank(entry.pseudo)) if(not strblank(entry.pseudo))
@ -874,8 +877,11 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
if(aka) { if(aka) {
*aka = NUL; *aka = NUL;
if(AA->isinternet()) if(AA->isinternet()) {
strcpy(aka, entry.iaddr); strcpy(aka, entry.iaddr);
strcpy(msg->idest, entry.iaddr);
strcpy(msg->iaddr, entry.iaddr);
}
else { else {
entry.fidoaddr.make_string(aka); entry.fidoaddr.make_string(aka);
if(strblank(aka) and not strblank(entry.iaddr)) { if(strblank(aka) and not strblank(entry.iaddr)) {
@ -884,6 +890,10 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
if(AA->Internetgate().addr.valid()) if(AA->Internetgate().addr.valid())
AA->Internetgate().addr.make_string(aka); AA->Internetgate().addr.make_string(aka);
} }
else {
*msg->iaddr = NUL;
*msg->idest = NUL;
}
} }
} }
} }