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;
quotewraphard = false;
ra2usersbbs = 0;
replylink = 0;
replylink = REPLYLINK_DIRECT;
replylinklist = 0;
screenblanker = 180;
screenblankertype = BLANK_SLIDEWIN;

View File

@ -317,6 +317,7 @@ int AreaList::SetActiveAreaId(int __areaid) {
class SelMaskPick : public gwinpick {
gwindow window;
int DESC_LEN;
void open(); // Called after window is opened
void close(); // Called after window is closed
@ -345,9 +346,9 @@ void SelMaskPick::close() {
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);
}
@ -367,7 +368,7 @@ bool SelMaskPick::handle_key() {
default:
if(key < KK_Commands) {
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();
}
break;
@ -378,10 +379,12 @@ bool SelMaskPick::handle_key() {
void SelMaskPick::Run() {
DESC_LEN = (sizeof(Desc) > (MAXCOL-6)) ? MAXCOL-6 : sizeof(Desc);
ypos = (MAXROW-18)/2;
xpos = (MAXCOL-sizeof(Desc)-4)/2-1;
xpos = (MAXCOL-DESC_LEN-4)/2-1;
ylen = 16;
xlen = sizeof(Desc)+2;
xlen = DESC_LEN+2;
btype = W_BMENU;
battr = C_MENUB;
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()) {
if(*msg->ito) {
sprintf(buf, "To: %s", msg->ito);
if(AA->Internetrfcbody()) {
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
else {
line = AddLine(line, buf);
}
if(AA->Internetrfcbody() and line->next and not strblank(line->next->txt.c_str())) {
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->idest, buf);
strcpy(msg->iaddr, buf);
if(AA->isinternet())
ptr = strcpy(buf1, *buf2 ? buf2 : buf);
else {
if(ptr)
strcpy(buf2, buf1+1);
ptr = strcpy(buf1, ptr and *buf2 ? buf2 : *buf ? buf : buf2);
}
}
else if(AA->isinternet()) {
ParseInternetAddr(buf1, buf2, buf);
strcpy(msg->realto, buf2);
strcpy(msg->idest, buf);
strcpy(msg->iaddr, buf);
ptr = strcpy(buf1, *buf2 ? buf2 : buf);
}
else {
@ -206,7 +211,7 @@ bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fro
// Internet gating
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) {
strcpy(msg->iaddr, toname->buf);
strcpy(msg->to, AA->Internetgate().name);
@ -317,14 +322,6 @@ bool GMsgHeaderEdit::validate() {
strsetsz(bot2, EDIT->HdrNodeLen());
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(toaddr.update) ftoaddr->update();
if(fromaddr.update) ffromaddr->update();
@ -500,7 +497,7 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
else
strcpy(msg->to, to_name.c_str());
}
if(AA->Internetgate().addr.net)
if(AA->Internetgate().addr.valid())
msg->dest = AA->Internetgate().addr;
}
else
@ -522,6 +519,8 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
}
else
strcpy(msg->ito, msg->iaddr);
if(not *msg->idest)
strcpy(msg->idest, msg->iaddr);
}
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
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
if(strchr(name, '@') and AA->Internetgate().addr.net) {
if(strchr(name, '@') and AA->Internetgate().addr.valid()) {
strcpy(msg->idest, name);
if(*AA->Internetgate().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(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->idest, entry.system);
if(*AA->Internetgate().name)

View File

@ -241,7 +241,7 @@ int ImportQWK() {
INam _fromname;
IAdr _fromaddr;
ParseInternetAddr(msg->ifrom, _fromname, _fromaddr);
if(AA->Internetgate().addr.net) {
if(AA->Internetgate().addr.valid()) {
char abuf[40];
sprintf(kbuf, "\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r",
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++;
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();
time_t a = time(NULL);
struct tm *tp = gmtime(&a);
@ -237,7 +237,7 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
IAdr fromaddr;
ParseInternetAddr(mptr, fromname, fromaddr, false);
strxcpy(msg->by, *fromname ? fromname : fromaddr, sizeof(msg->by));
if(AA->Internetgate().addr.net) {
if(AA->Internetgate().addr.valid()) {
char abuf[40];
char kbuf[2048];
sprintf(kbuf, "\x1""REPLYTO %s %s",

View File

@ -825,7 +825,8 @@ void guserbase::update_addressbook(GMsg* msg, bool reverse, bool force) {
// Update address
if(AA->isinternet() or (not *entry.iaddr and *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;
lock();
@ -855,7 +856,7 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
found = true;
if(*msg->iaddr and not AA->isinternet()) {
if(not strblank(entry.iaddr) and not AA->isinternet()) {
// do UUCP addressing
strcpy(msg->realto, entry.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);
if(AA->isinternet())
strcpy(msg->realto, entry.name);
else
*msg->realto = NUL;
}
if(not strblank(entry.pseudo))
@ -874,8 +877,11 @@ bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browse
if(aka) {
*aka = NUL;
if(AA->isinternet())
if(AA->isinternet()) {
strcpy(aka, entry.iaddr);
strcpy(msg->idest, entry.iaddr);
strcpy(msg->iaddr, entry.iaddr);
}
else {
entry.fidoaddr.make_string(aka);
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())
AA->Internetgate().addr.make_string(aka);
}
else {
*msg->iaddr = NUL;
*msg->idest = NUL;
}
}
}
}