From 9f8c3258846972d6fbb4355d42e808d57bc23d2f Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Sun, 2 Oct 2005 12:17:28 +0000 Subject: [PATCH] New config file token: LocationAlias. --- cfgs/config/advanced.cfg | 7 ++ cfgs/config/advanced.rus | 6 ++ cfgs/config/aliasru.cfg | 140 +++++++++++++++++++++++++++++++++++++++ docs/notework.txt | 3 + docs/tokencfg.txt | 3 +- golded3/gccfgg.h | 1 + golded3/gccfgg0.cpp | 1 + golded3/gccfgg5.cpp | 11 +++ golded3/gcprot.h | 1 + golded3/gecfgg.h | 1 + golded3/genode.cpp | 17 ++++- 11 files changed, 188 insertions(+), 3 deletions(-) create mode 100755 cfgs/config/aliasru.cfg diff --git a/cfgs/config/advanced.cfg b/cfgs/config/advanced.cfg index d72e75b..3556fc3 100644 --- a/cfgs/config/advanced.cfg +++ b/cfgs/config/advanced.cfg @@ -243,6 +243,13 @@ DISPAREANO YES ; Only shows it if available. ;DispHdrLocation No DispHdrLocation Yes +// Substitutions for the city name retrieved from nodelist to display in +// message header delimeter line. May be used to show national-language +// names of the nodes cities. +// LocationAlias is used when "DispHdrLocation" sets to "Yes". +;LocationAlias "sity" "alias" +;INCLUDE aliasru.cfg ; Russian city names + // 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 b188613..91927ea 100644 --- a/cfgs/config/advanced.rus +++ b/cfgs/config/advanced.rus @@ -216,6 +216,12 @@ DispAreaNo Yes ; ;DispHdrLocation No DispHdrLocation Yes +// Подстановка названий городов для показа в строке-разделителе заголовка +// и тела сообщения. Можно использовать для показа русских названий городов. +// Имеет смысл только при указании DispHdrLocation Yes. +;LocationAlias "город" "алиас" +;INCLUDE aliasru.cfg + // Расположение и длина полей Имя/Адрес/Дата в верху экрана. // Здесь указаны значения по умолчанию. ;DispHdrNameSet 8 36 diff --git a/cfgs/config/aliasru.cfg b/cfgs/config/aliasru.cfg new file mode 100755 index 0000000..7be2426 --- /dev/null +++ b/cfgs/config/aliasru.cfg @@ -0,0 +1,140 @@ +LocationAlias " Belarus" "" +LocationAlias " Crimea" "" +LocationAlias " Kazakhstan" "" +LocationAlias " Mari El" "" +LocationAlias " MariEl" "" +LocationAlias " region" "" +LocationAlias " Russia" "" +LocationAlias " UA" "" +LocationAlias " Ukraina" "" +LocationAlias " Ukraine" "" +LocationAlias "Belozerye Cherkassy" Белозерые-Черкассы +LocationAlias Komsomolsk-on-Amur Комсомольск-на-Амуре +LocationAlias "Naberezhnye Chelny" "Набережные Челны" +LocationAlias Yuzhno-Sakhalinsk Южно-Сахалинск +LocationAlias Dniepropetrowsk Днепропетровск +LocationAlias Ivano-Frankivsk Ивано-Франковск +LocationAlias "Nizhny Novgorod" "Нижний Новгород" +LocationAlias "Novaya Kakhovka" "Новая Каховка" +LocationAlias Novocheboksarsk Новочебоксарск +LocationAlias Petropavlovsk Петропавловск +LocationAlias Rostov-on-Don Ростов-на-Дону +LocationAlias Severodonetsk Северодонецк +LocationAlias St.Petersburg Санкт-Петербург +LocationAlias Chernyahovsk Черняховск +LocationAlias Ekaterinburg Екатеринбург +LocationAlias Yekaterinburg Екатеринбург +LocationAlias Petrozavodsk Петрозаводск +LocationAlias St.Peterburg Санкт-Петербург +LocationAlias Chelyabinsk Челябинск +LocationAlias Joshkar-Ola Йошкар-Ола +LocationAlias Khmelnitsky Хмельницкий +LocationAlias Krasnoyarsk Красноярск +LocationAlias Kuznetsovsk Кузнецовск +LocationAlias Leninogorsk Лениногорск +LocationAlias Nefteugansk Нефтеуганск +LocationAlias Novosibirsk Новосибирск +LocationAlias Sayanogorsk Саяногорск +LocationAlias Severomorsk Североморск +LocationAlias Vladivostok Владивосток +LocationAlias Zapolyarnie Заполярный +LocationAlias Cheboksary Чебоксары +LocationAlias Dzerzhinsk Дзержинск +LocationAlias Khabarovsk Хабаровск +LocationAlias Michurinsk Мичуринск +LocationAlias Sebastopol Севастополь +LocationAlias Sevastopol Севастополь +LocationAlias Simferopol Симферополь +LocationAlias Volgodonsk Волгодонск +LocationAlias Zaporozhye Запорожье +LocationAlias Cherkassy Черкассы +LocationAlias Chornobyl Чернобыль +LocationAlias Essentuky Ессентуки +LocationAlias Karaganda Караганда +LocationAlias Krasnodar Краснодар +LocationAlias Leningrad Санкт-Петербург +LocationAlias Lomonosov Ломоносов +LocationAlias Samarkand Самарканд +LocationAlias Stavropol Ставрополь +LocationAlias Ussuriisk Уссурийск +LocationAlias Volgograd Волгоград +LocationAlias Zhukovsky Жуковский +LocationAlias Alma-Ata Алматы +LocationAlias Belgorod Белгород +LocationAlias Chisinau Кишинeв +LocationAlias Gorlovka Горловка +LocationAlias Kemerovo Кемерово +LocationAlias Kishinau Кишинeв +LocationAlias Kishinev Кишинeв +LocationAlias Kostroma Кострома +LocationAlias Markovka Марковка +LocationAlias Murmansk Мурманск +LocationAlias Nikolaev Николаев +LocationAlias Novgorod Новгород +LocationAlias Orenburg Оренбург +LocationAlias Pavlodar Павлодар +LocationAlias Simbirsk Симбирск +LocationAlias Smolensk Смоленск +LocationAlias Tashkent Ташкент +LocationAlias Tiraspol Тирасполь +LocationAlias Vladimir Владимир +LocationAlias Voronezh Воронеж +LocationAlias Angarsk Ангарск +LocationAlias Barnaul Барнаул +LocationAlias Bendery Бендеры +LocationAlias Borisov Борисов +LocationAlias Bryansk Брянск +LocationAlias Donetsk Донецк +LocationAlias Giessen Гессен +LocationAlias Irkutsk Иркутск +LocationAlias Ivanovo Иваново +LocationAlias Izhevsk Ижевск +LocationAlias Kharkov Харьков +LocationAlias Kherson Херсон +LocationAlias kherson Херсон +LocationAlias Klichev Кличев +LocationAlias Kolomna Коломна +LocationAlias Lipetsk Липетск +LocationAlias Lugansk Луганск +LocationAlias Poltava Полтава +LocationAlias Pushkin Пушкин +LocationAlias Saratov Саратов +LocationAlias Vologda Вологда +LocationAlias Vorkuta Воркута +LocationAlias Abakan Абакан +LocationAlias Astana Астана +LocationAlias Bobrov Бобров +LocationAlias Bratsk Братск +LocationAlias Dniepr Днепр +LocationAlias Kaluga Калуга +LocationAlias kurgan Курган +LocationAlias Kurgan Курган +LocationAlias Moscow Москва +LocationAlias Odessa Одесса +LocationAlias Ryazan Рязань +LocationAlias Samara Самара +LocationAlias Surgut Сургут +LocationAlias Tambov Тамбов +LocationAlias Tyumen Тюмень +LocationAlias Vyatka Вятка +LocationAlias Brest Брест +LocationAlias Cahul Кахул +LocationAlias Dnepr Днепр +LocationAlias Gomel Гомель +LocationAlias Kazan Казань +LocationAlias Kijow Киев +LocationAlias Kursk Курск +LocationAlias Minsk Минск +LocationAlias Penza Пенза +LocationAlias Pskov Псков +LocationAlias Tomsk Томск +LocationAlias Kiev Киев +LocationAlias Kyiv Киев +LocationAlias Lviv Львов +LocationAlias Omsk Омск +LocationAlias Orel Орел +LocationAlias Perm Пермь +LocationAlias Riga Рига +LocationAlias Tula Тула +LocationAlias Tver Тверь +LocationAlias Ufa Уфа diff --git a/docs/notework.txt b/docs/notework.txt index 3bea4d1..ea2feab 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,9 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ New config file token: LocationAlias. Used to display national city names + in bottom delimeter of the message header. + - Fix MS Visual C 6.0 library bug in vector::sort(). GoldNode+/MSVC sort nodelist correctly with nodes quantity > 32767 now. (Patch from Ianos Gnatiuc 2:5030/830.17) diff --git a/docs/tokencfg.txt b/docs/tokencfg.txt index 5e5a742..6daa6e9 100644 --- a/docs/tokencfg.txt +++ b/docs/tokencfg.txt @@ -1,5 +1,4 @@ * Golded+ config file tokens list. -*$Id$ ========================================================================== ADDRESS ADDRESSBOOKADD @@ -216,8 +215,8 @@ KEYBMODE KEYBSTACK KLUDGE KLUDGECHRS -LAST_CRC LOADLANGUAGE +LOCATIONALIAS LOGFILE LOGFORMAT LOGLEVEL diff --git a/golded3/gccfgg.h b/golded3/gccfgg.h index a762bf0..d2044f7 100644 --- a/golded3/gccfgg.h +++ b/golded3/gccfgg.h @@ -238,6 +238,7 @@ const word CRC_KEYBSTACK = 0x5F23; const word CRC_KLUDGE = 0xA600; const word CRC_KLUDGECHRS = 0x0EEF; const word CRC_LOADLANGUAGE = 0x9F1B; +const word CRC_LOCATIONALIAS = 0x1B5F; const word CRC_LOGFILE = 0x8ACE; const word CRC_LOGFORMAT = 0x9E51; const word CRC_LOGLEVEL = 0xCF59; diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index b818705..bdaf3fb 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -410,6 +410,7 @@ SwitchK: SwitchL: switch(crc) { case CRC_LOADLANGUAGE : CfgLoadlanguage (); break; + case CRC_LOCATIONALIAS : CfgLocationalias (); break; case CRC_LOGFILE : CfgLogfile (); break; case CRC_LOGFORMAT : CfgLogformat (); break; default : found = false; diff --git a/golded3/gccfgg5.cpp b/golded3/gccfgg5.cpp index ea9f7df..529b34a 100644 --- a/golded3/gccfgg5.cpp +++ b/golded3/gccfgg5.cpp @@ -320,6 +320,17 @@ void CfgLoadlanguage() { // ------------------------------------------------------------------ +void CfgLocationalias() +{ + char* key; + getkeyval(&key, &val); + StripQuotes(key); + StripQuotes(val); + CFG->locationalias.Add(key, val); +} + +// ------------------------------------------------------------------ + void CfgLogfile() { strcpy(CFG->logfile, val); diff --git a/golded3/gcprot.h b/golded3/gcprot.h index b26c1fb..d18de19 100644 --- a/golded3/gcprot.h +++ b/golded3/gcprot.h @@ -228,6 +228,7 @@ void CfgKeybstack (); void CfgKludge (); void CfgKludgechrs (); void CfgLoadlanguage (); +void CfgLocationalias (); void CfgLogfile (); void CfgLogformat (); void CfgLookupecho (); diff --git a/golded3/gecfgg.h b/golded3/gecfgg.h index fbf528f..1d83794 100644 --- a/golded3/gecfgg.h +++ b/golded3/gecfgg.h @@ -254,6 +254,7 @@ public: char keybstack[80]; // keybuf[80]; gstrarray kludge; Path loadlanguage; + GStrBag2 locationalias; Path logfile; // goldedlog; int logformat; std::vector mailinglist; diff --git a/golded3/genode.cpp b/golded3/genode.cpp index 18ae2ca..e3466b8 100644 --- a/golded3/genode.cpp +++ b/golded3/genode.cpp @@ -1136,7 +1136,22 @@ void LookupNodeLocation(GMsg* msg, std::string &location, int what) if (addr.invalid()) buf[0] = NUL; - item.loc = location = buf; + std::string city = buf; + GStrBag2 &strbag = CFG->locationalias; + + if (strbag.First()) + { + do + { + const char* str = strbag.Current1(); + size_t pos = city.find(str); + if (pos != city.npos) + city.replace(pos, strlen(str), strbag.Current2()); + } + while (strbag.Next()); + } + + item.loc = location = city; cash.insert(it, item); }