1 2 // ------------------------------------------------------------------ 3 // GoldED+ 4 // Copyright (C) 1990-1999 Odinn Sorensen 5 // Copyright (C) 1999-2000 Alexander S. Aganichev 6 // ------------------------------------------------------------------ 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License as 9 // published by the Free Software Foundation; either version 2 of the 10 // License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 // General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program; if not, write to the Free Software 19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 // MA 02111-1307 USA 21 // ------------------------------------------------------------------ 22 // $Id: gecfgg.h,v 1.49 2011/03/14 02:56:12 stas_degteff Exp $ 23 // ------------------------------------------------------------------ 24 // The main GoldED configuration structure. 25 // ------------------------------------------------------------------ 26 #ifndef __GECFGG__H 27 #define __GECFGG__H 28 29 #include <list> 30 #include <gmo_msg.h> 31 #include <geall.h> 32 #include "gekeys.h" 33 34 #define AREALISTSORTSIZE 20 // Size of the "arealistsort" variable 35 36 // ------------------------------------------------------------------ 37 // en_gswitches{} enumeration elements shoulds be complemented with 38 // globalbool[] array elements (see gccfgg0.cpp). 39 enum en_gswitches { 40 internetlookup, 41 kludgechrs, 42 mouse, 43 displocalhigh, 44 arealistgroupid, 45 askdelorig, 46 lookuplocal, 47 dispstatusline, 48 screenusebios, 49 highlightunread, 50 akamatchlocal, 51 fidonullfix, 52 dispautonext, 53 lookupuserbase, 54 areakeeplast, 55 filelistpagebar, 56 printformfeed, 57 arealistnos, 58 disppagebar, 59 internetreply, 60 arealistpagebar, 61 usemsgid, 62 lookupnet, 63 jamsmapihw, 64 squishdirect, 65 fidohwmarks, 66 msglistpagebar, 67 beepnoises, 68 screenshadows, 69 emptytearline, 70 menudropmsg, 71 beeplocalmsg, 72 statuslineclock, 73 twitto, 74 keybdefaults, 75 displistwrap, 76 quotespacing, 77 lookupecho, 78 keybext, 79 beepcomment, 80 rcvdisablescfm, 81 quoteblank, 82 keybclear, 83 dosprompt, 84 areacatchupread, 85 formfeedseparator, 86 useflags, 87 jamharddelete, 88 disprealmsgno, 89 frqwazoo, 90 msglistviewsubj, 91 akamatchecho, 92 areafilegroups, 93 areaautonext, 94 timeoutsavemsg, 95 nodelistwarn, 96 akamatchnet, 97 98 gswitches_last 99 }; 100 101 class gswitches { 102 103 public: 104 get(en_gswitches what)105 inline bool get(en_gswitches what) { return cfg[what]; } set(en_gswitches what,bool value)106 inline void set(en_gswitches what, bool value) { cfg[what] = value; } 107 108 bool handle(word crc, const char* value); 109 gswitches()110 gswitches() { for(uint i=0; i<gswitches_last; i++) {cfg[i] = false; } }; 111 112 private: 113 114 bool cfg[gswitches_last]; 115 }; 116 117 118 // ------------------------------------------------------------------ 119 120 struct Win { 121 int btype; // Border type 122 vattr c[16]; // Colors 123 int w; // Window handle 124 }; 125 126 127 // ------------------------------------------------------------------ 128 // Combined name/address structure 129 130 struct Node 131 { 132 Name name; 133 Addr addr; 134 Node &operator=(const Node &a) { strxcpy(name, a.name, ARRAYSIZE(name)); addr=a.addr; return *this; } 135 }; 136 137 138 // ------------------------------------------------------------------ 139 // Filename aliases 140 141 struct FileAlias { 142 char alias[9]; 143 Path file; 144 FileAlias& operator=(const FileAlias& a) { 145 strxcpy(alias, a.alias, sizeof(alias)); 146 strxcpy(file, a.file, sizeof(Path)); 147 return *this; 148 } 149 }; 150 151 152 // ------------------------------------------------------------------ 153 // Template typedefs 154 155 struct Tpl { 156 Path file; 157 Desc name; 158 Addr match; 159 }; 160 161 162 // ------------------------------------------------------------------ 163 // Address macro record 164 165 struct AddrMacro { 166 char macro[20]; 167 IAdr name; 168 Addr addr; 169 Subj subj; 170 Attr attr; 171 }; 172 173 174 // ------------------------------------------------------------------ 175 176 struct AkaMatchG { 177 Addr mask; 178 Addr aka; 179 }; 180 181 182 // ------------------------------------------------------------------ 183 184 struct MailList { 185 Echo echoid; 186 IAdr sender; 187 IAdr contribution; 188 bool sender_is_pattern; 189 }; 190 191 192 // ------------------------------------------------------------------ 193 194 struct FrqNodeMap { 195 Addr from; 196 Addr to; 197 }; 198 199 200 // ------------------------------------------------------------------ 201 202 class CfgGed { 203 204 public: 205 CfgGed(); 206 ~CfgGed(); 207 208 Path goldcfg; 209 Stamp helpcfg; 210 Path helpged; 211 Path keyscfg; 212 Path langcfg; 213 Path xlatged; 214 Path goldlast; 215 Path golduser; 216 217 Grp grp; 218 219 int cfgeditquotemargin; 220 221 std::list<CmdKey> cmdkey; 222 std::vector<Macro> macro; 223 224 int addressbookadd; 225 int addresslookupfirst; 226 std::vector<AddrMacro> addressmacro; 227 Path adeptxbbspath; 228 int adeptxbbsuserno; 229 std::vector<gaka> aka; 230 std::vector<AkaMatchG> akamatch; 231 int akamatchfromto; 232 bool akamatchmanually; 233 int areaautoid; 234 Echo areacfmreplyto; 235 bool areacopydirect; 236 Echo areacopyto; 237 bool areacopyaddid; 238 gstrarray areaexcl; 239 bool areaforwarddirect; 240 int areafilegroups; // areausegroups; 241 bool areafreqdirect; 242 Echo areafreqto; 243 gstrarray areaincl; 244 gstrarray areaisemail; 245 gstrarray areaisnews; 246 int arealistechomax; 247 char arealistformat[80]; 248 char arealistgrouporder[256]; 249 char arealistsort[AREALISTSORTSIZE]; 250 int arealisttype; 251 Path areapath; 252 gstrarray areapmscan; 253 gstrarray areapmscanexcl; 254 gstrarray areapmscanincl; 255 int areareadonly; 256 Echo arearecyclebin; 257 bool arearecyclebinask; 258 std::vector<EchoRen> arearename; 259 bool areareplydirect; 260 Echo areareplyto; 261 gstrarray areascan; 262 gstrarray areascanexcl; 263 gstrarray areascanincl; 264 char areascansort[20]; 265 Echo areastart; // startecho; 266 int areatypeorder[17]; 267 Echo areayouwroteto; 268 Path attachpath; 269 Attr attribsattach; 270 Attr attribscc; // ccattrib; 271 Attr attribscfm; // cfmattrib; 272 Attr attribsecho; // echoattrib; 273 Attr attribsemail; 274 Attr attribsfrq; 275 Attr attribslocal; // localattrib; 276 Attr attribsnet; // netattrib; 277 Attr attribsnews; 278 int beepfactor; 279 int beepyourmail; 280 int carboncopylist; // cclist; 281 Win color[16]; 282 std::vector< std::pair<Node, vattr> > colorname; 283 Path confirmfile; // goldedcfm; 284 int confirmresponse; 285 Path cookiepath; 286 int crosspost; 287 int crosspostlist; // xplist; 288 int ctrlinfoecho; 289 int ctrlinfoemail; 290 int ctrlinfolocal; 291 int ctrlinfonet; 292 int ctrlinfonews; 293 int dispareano; 294 int dispattachsize; 295 int disphdrlocation; 296 PosLen disphdrdateset; 297 PosLen disphdrnameset; 298 PosLen disphdrnodeset; 299 int displistcursor; 300 int dispmargin; // rightmargin; 301 bool disppmfirst; 302 int dispmsgsize; 303 bool dispsoftcr; 304 uint disptabsize; // tabsize; 305 bool encodeemailheaders; 306 std::vector<GEvent> event; 307 uint32_t externoptions; 308 std::vector<ExtUtil> externutil; 309 Ezycom ezycom; 310 int ezycomuserno; 311 Path fidolastread; // lastread; 312 const char *fidomsgtype; 313 Path fidouserlist; 314 int fidouserno; // lastreaduser; 315 std::vector<FileAlias> filealias; 316 bool forcetemplate; 317 gstrarray frqext; 318 std::vector<FrqNodeMap> frqnodemap; 319 int frqoptions; 320 bool gedhandshake; 321 Path goldbasepath; 322 Path goldbasesyspath; 323 int goldbaseuserno; 324 Path goldpath; 325 bool hidestylies; 326 bool highlighturls; 327 Path hudsonpath; 328 long hudsonsizewarn; 329 Path hudsonsyspath; 330 int hudsonuserno; 331 bool ignorecharset; 332 char importbegin[80]; 333 char importend[80]; 334 Path inboundpath; 335 Path inputfile; 336 bool intensecolors; 337 bool transparentcolors; 338 IAdr internetaddress; 339 char internetdomain[96]; 340 Node internetgate; 341 int internetgateexp; 342 bool internetmsgid; 343 int internetrfcbody; 344 bool internetviagate; 345 Invalidate invalidate; 346 Path jampath; 347 int keybmode; 348 char keybstack[80]; // keybuf[80]; 349 gstrarray kludge; 350 bool latin2local; 351 char latintolocal[256]; 352 Path loadlanguage; 353 GStrBag2 locationalias; 354 std::string locationdelimiter; 355 Path logfile; // goldedlog; 356 int logformat; 357 std::vector<MailList> mailinglist; 358 std::vector< std::pair<std::string, std::string> > mappath; 359 int menumarked; 360 int menunextarea; 361 int msglistdate; 362 bool msglistfast; 363 bool msglistfirst; 364 bool msglistheader; 365 bool msglistwidesubj; 366 Path namesfile; 367 Name nickname; 368 Name netname; 369 Path nodepath; 370 Path nodepathfd; 371 Path nodepathv7; 372 INam organization; 373 gstrarray origin; 374 int originno; 375 Path outboundpath; 376 Path outputfile; 377 Path pathreportfile; 378 Path pcboardpath; 379 int pcboarduserno; 380 int peekurloptions; 381 int personalmail; 382 GPlay play; 383 Path printdevice; // p_device; 384 char printinit[80]; // p_init[80]; 385 int printlength; // p_length; 386 int printmargin; // p_margin; 387 char printreset[80]; // p_reset[80]; 388 Path quotebuffile; 389 int quotebufmode; 390 char quotechars[11]; 391 uint quotectrl; 392 int quotemargin; 393 char quotestring[10]; 394 char quotestops[41]; 395 bool quotewraphard; 396 bool quoteusenewai; 397 int ra2usersbbs; // RA2; 398 int replylink; 399 bool replylinkfloat; 400 int replylinklist; 401 bool replylinkshowalways; 402 gstrarray robotname; 403 #if defined(GCFG_SPELL_INCLUDED) 404 int scheckerenabled; 405 char scheckerdeflang[10240]; 406 Path scheckeruserdic; 407 Path scheckerdicpath; 408 #endif 409 int screenblanker; // blanktime; 410 int screenblankertype; 411 int screenmaxcol; // maxcols; 412 int screenmaxrow; // maxrows; 413 int screenpalette[17]; 414 int screensize; 415 INam searchfor; 416 Semaphore semaphore; 417 Path seqdir; 418 int seqmsgid; 419 uint32_t seqoutrun; 420 int sharemode; // share; 421 bool showdeleted; 422 Path soundpath; 423 Echo soupbadmsgs; 424 Echo soupemail; 425 int soupexportmargin; 426 Path soupexportpath; 427 Path soupimportpath; 428 Path soupnewsrcfile; 429 Path soupreplylinker; 430 char soupreplyto[60]; 431 Path souptosslog; 432 int squishscan; 433 int squishuserno; 434 Path squishuserpath; 435 int statuslinehelp; 436 bool striphtml; 437 char stylecodepunct[41]; 438 char stylecodestops[41]; 439 gstrarray tagline; 440 int taglineno; 441 char taglinechar; 442 bool taglinesupport; 443 char tasktitle[60]; 444 Tear tearline; 445 bool titlestatus; 446 GStrBag2 translate; 447 std::vector<Tpl> tpl; 448 int tplno; 449 bool templatematch; 450 Path templatepath; 451 Path temppath; 452 int timeout; 453 int twitmode; // showtwits; 454 std::vector<Node> twitname; 455 gstrarray twitsubj; 456 std::vector< std::pair<std::string, std::string> > unpacker; 457 std::vector<UrlHandler> urlhandler; 458 bool usearea; 459 bool usecharset; 460 int usefwd; 461 bool useintl; 462 bool usepid; 463 Path userlistfile; // goldedlst; 464 std::vector<Node> username; 465 int usernameno; 466 bool usesoftcrxlat; 467 bool usestylies; 468 bool usetzutc; 469 Path uudecodepath; 470 bool viewhidden; 471 bool viewkludge; 472 bool viewquote; 473 Name whoto; 474 int wildcatuserno; 475 int writeheader; 476 std::string wtpl; 477 std::vector<Map> xlatcharset; 478 std::vector<Map> xlatescset; 479 std::vector< std::pair<std::string, gstrarray> > xlatcharsetalias; 480 char xlatexport[17]; // exportcharset[17]; 481 char xlatimport[17]; // localcharset[17]; 482 char xlatlocalset[17]; 483 Path xlatpath; 484 int zonegating; 485 486 gswitches switches; 487 }; 488 489 490 491 // ------------------------------------------------------------------ 492 493 class GSaveUtil : public GStrBag2 { 494 495 public: 496 Add(int n,char * s)497 void Add(int n, char* s) { GStrBag2::Add((void*)&n, sizeof(n), s); } 498 Number()499 int Number() { return *(int*)Current1(); } Text()500 const char* Text() { return Current2(); } 501 Number(int i)502 int Number(int i) { return *(int*)Index1(i); } Text(int i)503 const char* Text(int i) { return Index2(i); } 504 }; 505 506 507 // ------------------------------------------------------------------ 508 509 class GEditTrigger : public GStrBag2 { 510 511 public: 512 Trigger()513 const char* Trigger() { return Current1(); } Text()514 const char* Text() { return Current2(); } 515 Trigger(int i)516 const char* Trigger(int i) { return Index1(i); } Text(int i)517 const char* Text(int i) { return Index2(i); } 518 }; 519 520 521 // ------------------------------------------------------------------ 522 523 class GoldedCfgEdit { 524 525 protected: 526 527 // ----------------------------------------------------------------- 528 // Configuration data 529 530 struct { 531 532 // Boolean values 533 uint autoattach : 1; 534 uint crlfterm : 1; 535 uint fieldclear : 1; 536 uint hardlines : 1; 537 uint hardterm : 1; 538 uint headerattrs : 1; 539 uint internal : 1; 540 uint menu : 1; 541 uint mixcase : 1; 542 uint savemenu : 1; 543 544 // Multi values 545 uint changedate; 546 int autosave; 547 char charpara; 548 char charspace; 549 int hdrnamepos; 550 int hdrnamelen; 551 int hdrnodepos; 552 int hdrnodelen; 553 int headerfirst; 554 int quotemargin; 555 int replyre; 556 char softcrxlat; 557 int undelete; 558 559 // String handles 560 int external; 561 int file; 562 int hardline; 563 int spellchecker; 564 } cfg; 565 566 // ----------------------------------------------------------------- 567 // String bag 568 569 gstrarray str; 570 571 public: 572 573 // ----------------------------------------------------------------- 574 // Configuration data 575 576 GEditTrigger Comment; 577 GEditTrigger Completion; 578 GSaveUtil SaveUtil; 579 580 581 // ----------------------------------------------------------------- 582 // Constructor/destructor 583 584 GoldedCfgEdit(); 585 586 // ----------------------------------------------------------------- 587 // Return values 588 AutoAttach()589 bool AutoAttach() { return cfg.autoattach; } AutoSave()590 int AutoSave() { return cfg.autosave; } ChangeDate()591 int ChangeDate() { return cfg.changedate; } CharPara()592 char CharPara() { return cfg.charpara; } CharSpace()593 char CharSpace() { return cfg.charspace; } CrLfTerm()594 bool CrLfTerm() { return cfg.crlfterm; } External()595 const char* External() { return str[cfg.external].c_str(); } FieldClear()596 bool FieldClear() { return cfg.fieldclear; } File()597 const char* File() { return str[cfg.file].c_str(); } HardLine()598 const char* HardLine() { return str[cfg.hardline].c_str(); } HardLines()599 bool HardLines() { return cfg.hardlines; } HardTerm()600 bool HardTerm() { return cfg.hardterm; } HdrNamePos()601 int HdrNamePos() { return cfg.hdrnamepos; } HdrNameLen()602 int HdrNameLen() { return cfg.hdrnamelen; } HdrNodePos()603 int HdrNodePos() { return cfg.hdrnodepos; } HdrNodeLen()604 int HdrNodeLen() { return cfg.hdrnodelen; } HeaderAttrs()605 bool HeaderAttrs() { return cfg.headerattrs; } HeaderFirst()606 int HeaderFirst() { return cfg.headerfirst; } Internal()607 bool Internal() { return cfg.internal; } Menu()608 bool Menu() { return cfg.menu; } MixCase()609 bool MixCase() { return cfg.mixcase; } QuoteMargin()610 int QuoteMargin() { return cfg.quotemargin; } ReplyRe()611 int ReplyRe() { return cfg.replyre; } SaveMenu()612 bool SaveMenu() { return cfg.savemenu; } SoftCrXlat()613 char SoftCrXlat() { return cfg.softcrxlat; } SpellChecker()614 const char* SpellChecker() { return str[cfg.spellchecker].c_str(); } UnDelete()615 int UnDelete() { return cfg.undelete; } 616 617 // ----------------------------------------------------------------- 618 // Set values 619 AutoAttach(bool s)620 void AutoAttach(bool s) { cfg.autoattach = s; } AutoSave(int s)621 void AutoSave(int s) { cfg.autosave = s; } ChangeDate(int s)622 void ChangeDate(int s) { cfg.changedate = s; } CharPara(char s)623 void CharPara(char s) { cfg.charpara = s; } CharSpace(char s)624 void CharSpace(char s) { cfg.charspace = s; } CrLfTerm(bool s)625 void CrLfTerm(bool s) { cfg.crlfterm = s; } External(char * s)626 void External(char* s) { str[cfg.external] = s; } FieldClear(bool s)627 void FieldClear(bool s) { cfg.fieldclear = s; } File(char * s)628 void File(char* s) { str[cfg.file] = s; } HardLine(char * s)629 void HardLine(char* s) { str[cfg.hardline] = s; } HardLines(bool s)630 void HardLines(bool s) { cfg.hardlines = s; } HardTerm(bool s)631 void HardTerm(bool s) { cfg.hardterm = s; } HdrNamePos(int p)632 void HdrNamePos(int p) { cfg.hdrnamepos = p; } HdrNameLen(int l)633 void HdrNameLen(int l) { cfg.hdrnamelen = l; } HdrNodePos(int p)634 void HdrNodePos(int p) { cfg.hdrnodepos = p; } HdrNodeLen(int l)635 void HdrNodeLen(int l) { cfg.hdrnodelen = l; } HeaderAttrs(bool s)636 void HeaderAttrs(bool s) { cfg.headerattrs = s; } HeaderFirst(int s)637 void HeaderFirst(int s) { cfg.headerfirst = s; } Internal(bool s)638 void Internal(bool s) { cfg.internal = s; } Menu(bool s)639 void Menu(bool s) { cfg.menu = s; } MixCase(bool s)640 void MixCase(bool s) { cfg.mixcase = s; } QuoteMargin(int s)641 void QuoteMargin(int s) { cfg.quotemargin = s; } ReplyRe(int s)642 void ReplyRe(int s) { cfg.replyre = s; } SaveMenu(bool s)643 void SaveMenu(bool s) { cfg.savemenu = s; } SoftCrXlat(char s)644 void SoftCrXlat(char s) { cfg.softcrxlat = s; } SpellChecker(char * s)645 void SpellChecker(char* s) { str[cfg.spellchecker] = s; } UnDelete(int s)646 void UnDelete(int s) { cfg.undelete = s; } 647 }; 648 649 650 // ------------------------------------------------------------------ 651 652 #endif 653