diff --git a/cfgs/config/advanced.cfg b/cfgs/config/advanced.cfg index dfcbc71..e454880 100644 --- a/cfgs/config/advanced.cfg +++ b/cfgs/config/advanced.cfg @@ -235,6 +235,10 @@ DISPATTACHSIZE KBYTES DISPAREANO YES ; Only shows it if available. ;DISPAREANO ALWAYS ; Will show 0 if there is no board number. +// +;DispHdrLocation No +DispHdrLocation Yes + // Positions and lengths of name/node/date fields in header display. // These are the default values. ;DISPHDRNAMESET 8 36 diff --git a/cfgs/config/advanced.rus b/cfgs/config/advanced.rus index ce90691..7233452 100644 --- a/cfgs/config/advanced.rus +++ b/cfgs/config/advanced.rus @@ -205,6 +205,12 @@ DispAreaNo Yes ; ;DispAreaNo Always ; Показывать 0 если нет "board number". ;DispAreaNo No ; Не выводить. +// Вывод в полоске под хедером имени города из нод- и пойнтлистов. +// Если поинтовый адрес не найден, будет использован адрес ноды. +// (по умолчанию: No) +;DispHdrLocation No +DispHdrLocation Yes + // Расположение и длина полей Имя/Адрес/Дата в верху экрана. // Здесь указаны значения по умолчанию. ;DispHdrNameSet 8 36 diff --git a/docs/notework.txt b/docs/notework.txt index 20f0c1b..178ad87 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,10 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Display originator's city in delimiter line between header and message body. + New config file token: DISPHDRLOCATION (yes/no). + (Patch from Ianos Gnatiuc 2:5030/830.17) + + Don't use a GOLDMARK char in default status line. (Patch from Ianos Gnatiuc 2:5030/830.17) diff --git a/golded3/gccfgg.cpp b/golded3/gccfgg.cpp index 4f79fa1..3085848 100644 --- a/golded3/gccfgg.cpp +++ b/golded3/gccfgg.cpp @@ -711,6 +711,7 @@ CfgGed::CfgGed() { ctrlinfonews = 0; dispareano = true; dispattachsize = ATTACH_KBYTES; + disphdrlocation = false; displistcursor = NO; dispmargin = 0; dispmsgsize = DISPMSGSIZE_BYTES; diff --git a/golded3/gccfgg.h b/golded3/gccfgg.h index 5564ecb..cebb2fb 100644 --- a/golded3/gccfgg.h +++ b/golded3/gccfgg.h @@ -122,6 +122,7 @@ const word CRC_DISPAREANO = 0x68CE; const word CRC_DISPATTACHSIZE = 0x7BB4; const word CRC_DISPAUTONEXT = 0x52D9; const word CRC_DISPHDRDATESET = 0x65A5; +const word CRC_DISPHDRLOCATION = 0x8EF6; const word CRC_DISPHDRNAMESET = 0xFEF9; const word CRC_DISPHDRNODESET = 0xC232; const word CRC_DISPLISTCURSOR = 0x8B82; diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index bc2c8d6..4728703 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -276,6 +276,7 @@ SwitchD: case CRC_DISPAREANO : CfgDispareano (); break; case CRC_DISPATTACHSIZE : CfgDispattachsize (); break; case CRC_DISPHDRDATESET : CfgDisphdrdateset (); break; + case CRC_DISPHDRLOCATION : CfgDisphdrlocation (); break; case CRC_DISPHDRNAMESET : CfgDisphdrnameset (); break; case CRC_DISPHDRNODESET : CfgDisphdrnodeset (); break; case CRC_DISPLISTCURSOR : CfgDisplistcursor (); break; diff --git a/golded3/gccfgg2.cpp b/golded3/gccfgg2.cpp index eaa7b31..6d7a829 100644 --- a/golded3/gccfgg2.cpp +++ b/golded3/gccfgg2.cpp @@ -449,6 +449,13 @@ void CfgDisphdrdateset() { // ------------------------------------------------------------------ +void CfgDisphdrlocation() +{ + CFG->disphdrlocation = (0 != GetYesno(val)); +} + +// ------------------------------------------------------------------ + void CfgDisphdrnameset() { char* key; diff --git a/golded3/gcprot.h b/golded3/gcprot.h index afc6dac..9bce2cb 100644 --- a/golded3/gcprot.h +++ b/golded3/gcprot.h @@ -122,6 +122,7 @@ void CfgDispareano (); void CfgDispattachsize (); void CfgDispautonext (); void CfgDisphdrdateset (); +void CfgDisphdrlocation (); void CfgDisphdrnameset (); void CfgDisphdrnodeset (); void CfgDisplistcursor (); diff --git a/golded3/geall.h b/golded3/geall.h index 5c5eab4..db93811 100644 --- a/golded3/geall.h +++ b/golded3/geall.h @@ -194,6 +194,8 @@ const int CS_MONO = 2; const int LOOK_DEST = 0; const int LOOK_ORIG = 1; const int LOOK_NAME = 2; +const int LOOK_CITY1 = 3; +const int LOOK_CITY2 = 4; // ------------------------------------------------------------------ diff --git a/golded3/gecfgg.h b/golded3/gecfgg.h index 9b8e662..3f306ca 100644 --- a/golded3/gecfgg.h +++ b/golded3/gecfgg.h @@ -200,6 +200,7 @@ public: int ctrlinfonews; int dispareano; int dispattachsize; + bool disphdrlocation; PosLen disphdrdateset; PosLen disphdrnameset; PosLen disphdrnodeset; diff --git a/golded3/genode.cpp b/golded3/genode.cpp index 0b61838..18ae2ca 100644 --- a/golded3/genode.cpp +++ b/golded3/genode.cpp @@ -1005,16 +1005,36 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) { else NLP->find(matchaddr); - found = (exactmatch and NLP->found()) ? true : false; - if(found) { + found = (NLP->found() && (exactmatch || topline == -100)); + + if (found && (topline != -100)) + { NLP->push_state(); if(NLP->next()) if(NLP->found()) found = false; NLP->pop_state(); } + else if (!found && matchaddr.point && (topline == -100)) + { + matchaddr.point = 0; + NLP->find(matchaddr); + found = NLP->found(); + } + entry = NLP->entry(); + if (topline == -100) + { + if (found) + strcpy(name, entry.location); + else + strcpy(name, ""); + + NLP_close(); + return; + } + if(not found or (topline < 0)) { strcpy(buf, information); update_statusline(status); @@ -1061,6 +1081,71 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) { } +// ------------------------------------------------------------------ + +struct location_item +{ + Addr addr; + std::string loc; + + location_item(Addr &a) { addr = a; } + + bool operator<(Addr &other) { return (addr.compare(other) < 0); } + bool operator==(Addr &other) { return addr.equals(other); } +}; + +void LookupNodeLocation(GMsg* msg, std::string &location, int what) +{ + static std::vector cash; + + Subj statuslinebak; + strcpy(statuslinebak, information); + + vcurhide(); + w_info(LNG->Wait); + + Addr addr; + switch (what) + { + case LOOK_CITY2: + addr = msg->dest; + break; + case LOOK_CITY1: + addr = msg->orig; + break; + } + + if (addr.zone == 0) + addr.zone = AA->Aka().addr.zone; + + std::vector::iterator it = cash.begin(); + std::vector::iterator end = cash.end(); + + while ((it != end) && (*it < addr)) it++; + + if ((it != end) && (*it == addr)) + location = it->loc; + else + { + char buf[256]; + location_item item(addr); + + addr.make_string(buf); + Lookup(msg, &addr, buf, -100, LNG->LookupInfo); + + if (addr.invalid()) + buf[0] = NUL; + + item.loc = location = buf; + cash.insert(it, item); + } + + update_statusline(statuslinebak); + + w_info(NULL); +} + + // ------------------------------------------------------------------ // Lookup and display info about the node diff --git a/golded3/geprot.h b/golded3/geprot.h index a0f2e06..aef650d 100644 --- a/golded3/geprot.h +++ b/golded3/geprot.h @@ -235,6 +235,7 @@ bool Lookup2(Addr& addr, char* name, int topline, const char* status); const char *lookup_nodelist(ftn_addr* addr); +void LookupNodeLocation(GMsg* msg, std::string &location, int what); void LookupNode(GMsg* msg, const char* name, int what); void CheckNodelists(); diff --git a/golded3/geview.cpp b/golded3/geview.cpp index c642430..b3906a8 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -322,6 +322,27 @@ void GMsgHeaderView::Paint() { if(*buf1) window.prints(5, 1, title_color, buf1); } + + if (CFG->disphdrlocation && !_in_editor) + { + std::string loc; + LookupNodeLocation(msg, loc, LOOK_CITY1); + if (loc.length()) loc = " " + loc; + + if (AA->isnet()) + { + std::string loc2; + LookupNodeLocation(msg, loc2, LOOK_CITY2); + if (loc.length()) loc += " | " + loc2; + } + + if (loc.length()) + { + loc += " "; + int pos = window.width() - loc.length() - 1; + window.prints(5, pos, window_color, loc.c_str()); + } + } }