From 3b938d46f36f8e8aacb1c463c8aee954088f9926 Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Wed, 27 Dec 2000 12:45:20 +0000 Subject: [PATCH] Fixed macro mechanism --- docs/notework.txt | 10 +++++++++- golded3/gectrl.cpp | 2 +- golded3/geglob.cpp | 14 ++++++++++++-- goldlib/gall/gctype.h | 16 ++++++++++++++-- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 93300b5..9ec3dbb 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,14 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, December xx 2000 ______________________________________________________________________ +- PGP encoded/signed messages now detected by substring + + "-----BEGIN PGP " + + in first line of message rather than + + "-----BEGIN PGP MESSAGE-----" + - Fixed keyboard handling in Win9x/ME (not well tested). - Control characters (except tab, CR and LF) no longer stripped at the @@ -71,7 +79,7 @@ ______________________________________________________________________ another area correspondingly). Both added to READMainmenu menu. There's no default keyboard assignment. (Not tested) -- Fixed EDITMainmenu operation. +- Fixed READMainmenu operation. - Fixed incorrect filenames displaying in /w32 version. diff --git a/golded3/gectrl.cpp b/golded3/gectrl.cpp index a058b71..4607c8f 100644 --- a/golded3/gectrl.cpp +++ b/golded3/gectrl.cpp @@ -266,7 +266,7 @@ void DoKludges(int mode, GMsg* msg, bool attronly) { if(AA->isnet()) { // 123456789012345678901234567 - if(line->next and strneql(line->next->txt.c_str(), "-----BEGIN PGP MESSAGE-----", 27)) { + if(line->next and strneql(line->next->txt.c_str(), "-----BEGIN PGP ", 15)) { line = AddKludge(line, "\001ENC: PGP"); } diff --git a/golded3/geglob.cpp b/golded3/geglob.cpp index f51d5ce..5f0dcfd 100644 --- a/golded3/geglob.cpp +++ b/golded3/geglob.cpp @@ -252,13 +252,23 @@ void CfgInit2() { } +// ------------------------------------------------------------------ + +bool inline samekey(gkey key1, gkey key2) { + + if(key1 > 0xff) // special key + return false; + return (tolower(key1) == key2) or (toupper(key1) == key2); +} + + // ------------------------------------------------------------------ int IsMacro(gkey key, int type) { vector::iterator m = CFG->macro.begin(); while(m != CFG->macro.end()) { - if(((key == m->key) or (tolower(key) == m->key) or (toupper(key) == m->key)) and (type == m->type)) + if(((key == m->key) or samekey(key, m->key)) and (type == m->type)) return true; m++; } @@ -273,7 +283,7 @@ int PlayMacro(gkey key, int type) { vector::iterator m = CFG->macro.begin(); while(m != CFG->macro.end()) { - if(((key == m->key) or (tolower(key) == m->key) or (toupper(key) == m->key)) and (type == m->type)) { + if(((key == m->key) or samekey(key, m->key)) and (type == m->type)) { RunMacro(m); return true; } diff --git a/goldlib/gall/gctype.h b/goldlib/gall/gctype.h index e4761c7..d9bc613 100644 --- a/goldlib/gall/gctype.h +++ b/goldlib/gall/gctype.h @@ -43,17 +43,29 @@ #define tolower(a) _nls_tolower((unsigned char)(a)) #define toupper(a) _nls_toupper((unsigned char)(a)) #elif defined(__WIN32__) +#ifdef __cplusplus +extern "C" { +#endif extern char tl[256], tu[256]; -inline char tolower(char c) { return tl[c]; } -inline char toupper(char c) { return tu[c]; } +inline int tolower(int c) { return tl[c]; } +inline int toupper(int c) { return tu[c]; } +#ifdef __cplusplus +} +#endif #endif // ------------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif inline int iswhite(char c) { return c and (iscntrl(c) or (c == ' ')); } // NLS chars detected by converting to lower or upper case and in case they don't match they treated as characters inline int isxalnum(char c) { return isalnum(c) or ((c >= 128) and ((c != tolower(c)) or (c != toupper(c)))); } +#ifdef __cplusplus +} +#endif // ------------------------------------------------------------------