Different fixes

This commit is contained in:
Alexander S. Aganichev 2001-07-03 04:27:54 +00:00
parent 28e2cff62c
commit d9891a8e6e
21 changed files with 318 additions and 79 deletions

View File

@ -12,6 +12,26 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/ Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________ ______________________________________________________________________
- Fixed EDITHEADERFIRST operation.
+ Added new keyword AreaListGroupOrder to specify groups sorting order
in arealist. The only parameter is string which specifies groups
order (case sensitive!). If some groups are not found in the list
they will be placed below specifyed ones in regular order.
+ Implemented FSP-0013 support. You may notice warnings about obsolete
codepages in your config, please fix them. If you use XLATEXPORT to
obsolte codepage and this is required on some reason you may prevent
error by setting USECHARSET to No.
+ GoldED+ now tries to set up correct values for XLATLOCALSET,
XLATIMPORT and XLATEXPORT basing on your locale settings.
+ Added Serg Borodin's patch for X-Comment-To recognition on SOUP
import.
- Fixed crash on long Message ID in Internet messages.
- Fixed crash on very long name in Internet messages. - Fixed crash on very long name in Internet messages.
! ZapQuotesBelow now acts only on the single quotation block, not on ! ZapQuotesBelow now acts only on the single quotation block, not on

View File

@ -26,6 +26,7 @@
#include <golded.h> #include <golded.h>
#include <gmoprot.h> #include <gmoprot.h>
#include <gcharset.h>
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -629,6 +630,7 @@ CfgGed::CfgGed() {
// strings // strings
strcpy(arealistformat, "AM D CPUN E G "); strcpy(arealistformat, "AM D CPUN E G ");
*arealistgrouporder = 0;
strcpy(arealistsort, "FYTUE"); strcpy(arealistsort, "FYTUE");
strcpy(areascansort, "XZBE"); strcpy(areascansort, "XZBE");
strcpy(importbegin, "=== Cut ==="); strcpy(importbegin, "=== Cut ===");
@ -656,14 +658,9 @@ CfgGed::CfgGed() {
__gver_postname__, __gver_platform__); __gver_postname__, __gver_platform__);
strcpy(tearline, "@longpid @version"); strcpy(tearline, "@longpid @version");
strcpy(whoto, "All"); strcpy(whoto, "All");
*xlatexport = 0; strcpy(xlatlocalset, get_charset());
*xlatimport = 0; strcpy(xlatimport, get_dos_charset(xlatlocalset));
#ifdef __UNIX__ strcpy(xlatexport, xlatimport);
strcpy(xlatlocalset, "LATIN-1");
#else
strcpy(xlatlocalset, "IBMPC");
#endif
// variables & switches // variables & switches
adeptxbbsuserno = 0; adeptxbbsuserno = 0;
addressbookadd = YES; addressbookadd = YES;

View File

@ -62,6 +62,7 @@ const word CRC_AREAKEEPLAST = 0x5876;
const word CRC_AREALISTECHOMAX = 0x944D; const word CRC_AREALISTECHOMAX = 0x944D;
const word CRC_AREALISTFORMAT = 0x9080; const word CRC_AREALISTFORMAT = 0x9080;
const word CRC_AREALISTGROUPID = 0x1F75; const word CRC_AREALISTGROUPID = 0x1F75;
const word CRC_AREALISTGROUPORDER=0xCE99;
const word CRC_AREALISTNOS = 0x5FD7; const word CRC_AREALISTNOS = 0x5FD7;
const word CRC_AREALISTPAGEBAR = 0x6C37; const word CRC_AREALISTPAGEBAR = 0x6C37;
const word CRC_AREALISTSCAN = 0xDAF7; const word CRC_AREALISTSCAN = 0xDAF7;

View File

@ -203,6 +203,7 @@ SwitchA:
case CRC_AREAISNEWS : CfgAreaisnews (); break; case CRC_AREAISNEWS : CfgAreaisnews (); break;
case CRC_AREALISTECHOMAX : CfgArealistechomax (); break; case CRC_AREALISTECHOMAX : CfgArealistechomax (); break;
case CRC_AREALISTFORMAT : CfgArealistformat (); break; case CRC_AREALISTFORMAT : CfgArealistformat (); break;
case CRC_AREALISTGROUPORDER: CfgArealistgrouporder(); break;
case CRC_AREALISTSCAN : CfgArealistscan (); break; case CRC_AREALISTSCAN : CfgArealistscan (); break;
case CRC_AREALISTSORT : CfgArealistsort (); break; case CRC_AREALISTSORT : CfgArealistsort (); break;
case CRC_AREALISTTYPE : CfgArealisttype (); break; case CRC_AREALISTTYPE : CfgArealisttype (); break;

View File

@ -331,7 +331,15 @@ void CfgArealistechomax() {
void CfgArealistformat() { void CfgArealistformat() {
strcpy(CFG->arealistformat, StripQuotes(val)); strxcpy(CFG->arealistformat, StripQuotes(val), sizeof(CFG->arealistformat));
}
// ------------------------------------------------------------------
void CfgArealistgrouporder() {
strxcpy(CFG->arealistgrouporder, StripQuotes(val), sizeof(CFG->arealistgrouporder));
} }

View File

@ -513,6 +513,10 @@ void CfgXlatexport() {
CFG->grp.AddItm(GRP_XLATEXPORT, buf, strlen(buf)+1); CFG->grp.AddItm(GRP_XLATEXPORT, buf, strlen(buf)+1);
else else
strcpy(CFG->xlatexport, buf); strcpy(CFG->xlatexport, buf);
if(CFG->usecharset and (strieql(buf, "IBMPC") or strieql(buf, "+7_FIDO"))) {
cout << "* Warning: Charset " << buf << " is obsolte. Consider using CPxxx form." << endl;
cfgerrors++;
}
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -532,6 +536,10 @@ void CfgXlatimport() {
void CfgXlatlocalset() { void CfgXlatlocalset() {
strupr(strxcpy(CFG->xlatlocalset, val, sizeof(CFG->xlatlocalset))); strupr(strxcpy(CFG->xlatlocalset, val, sizeof(CFG->xlatlocalset)));
if(strieql(CFG->xlatlocalset, "IBMPC") or strieql(CFG->xlatlocalset, "+7_FIDO")) {
cout << "* Warning: Charset " << CFG->xlatlocalset << " is obsolte. Cosider using CPxxx form." << endl;
cfgerrors++;
}
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -698,6 +698,8 @@ void ReadXlatTables() {
} }
fclose(ifp); fclose(ifp);
} }
else
cout << "* XLAT table " << buf << " could not be opened." << endl;
fwrite(&ChsTable, sizeof(Chs), 1, ofp); fwrite(&ChsTable, sizeof(Chs), 1, ofp);
} }
@ -775,6 +777,8 @@ void ReadXlatTables() {
fclose(ifp); fclose(ifp);
} }
else
cout << "* XLAT table " << buf << " could not be opened." << endl;
fwrite(&EscTable, sizeof(Esc), 1, ofp); fwrite(&EscTable, sizeof(Esc), 1, ofp);
} }

View File

@ -63,6 +63,7 @@ void CfgAreakeeplast ();
void CfgArealistechomax (); void CfgArealistechomax ();
void CfgArealistformat (); void CfgArealistformat ();
void CfgArealistgroupid (); void CfgArealistgroupid ();
void CfgArealistgrouporder();
void CfgArealistnos (); void CfgArealistnos ();
void CfgArealistpagebar (); void CfgArealistpagebar ();
void CfgArealistscan (); void CfgArealistscan ();

View File

@ -52,6 +52,32 @@ int AreaTypeOrder[17] = {
}; };
// ------------------------------------------------------------------
// Areagroups compare
int compare_groups(int ga, int gb)
{
char *gap, *gbp;
if((ga > 0xff) || (gb > 0xff))
return compare_two(ga, gb);
gap = strchr(CFG->arealistgrouporder, (char)ga);
gbp = strchr(CFG->arealistgrouporder, (char)gb);
if(gap == NULL) {
if(gbp != NULL)
return -1;
else
return compare_two(ga, gb);
}
else {
if(gbp == NULL)
return 1;
else
return compare_two(gap, gbp);
}
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Arealist compare // Arealist compare
@ -123,7 +149,7 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
return cmp; return cmp;
} }
else { else {
if((cmp = compare_two(ga, gb)) != 0) if((cmp = compare_groups(ga, gb)) != 0)
return cmp; return cmp;
} }
} }

View File

@ -157,6 +157,7 @@ public:
gstrarray areaisnews; gstrarray areaisnews;
int arealistechomax; int arealistechomax;
char arealistformat[80]; char arealistformat[80];
char arealistgrouporder[256];
char arealistsort[20]; // areasort[10]; char arealistsort[20]; // areasort[10];
int arealisttype; int arealisttype;
Path areapath; Path areapath;

View File

@ -346,7 +346,7 @@ bool GMsgHeaderEdit::validate() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int EditHeaderinfo(int mode, GMsgHeaderView &view) { int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
GMsgHeaderEdit hedit(view); GMsgHeaderEdit hedit(view);
GMsg *msg = view.msg; GMsg *msg = view.msg;
@ -374,64 +374,69 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) {
} }
subject = msg->re; subject = msg->re;
if(AA->isnet()) if(doedithdr) {
hedit.lookup = CFG->switches.get(lookupnet);
else if(AA->isecho())
hedit.lookup = CFG->switches.get(lookupecho);
else
hedit.lookup = CFG->switches.get(lookuplocal);
int from_name_pos = EDIT->HdrNamePos(); if(AA->isnet())
int from_name_len = EDIT->HdrNameLen(); hedit.lookup = CFG->switches.get(lookupnet);
int from_addr_pos = EDIT->HdrNodePos(); else if(AA->isecho())
int from_addr_len = EDIT->HdrNodeLen(); hedit.lookup = CFG->switches.get(lookupecho);
int to_name_pos = from_name_pos; else
int to_name_len = from_name_len; hedit.lookup = CFG->switches.get(lookuplocal);
int to_addr_pos = from_addr_pos;
int to_addr_len = hedit.lookup or AA->isnet() ? from_addr_len : 0;
int subject_pos = 8;
int subject_len = MAXCOL - subject_pos;
int name_cvt = AA->Editmixcase() ? GMsgHeaderEdit::cvt_mixedcase : GMsgHeaderEdit::cvt_none;
int addr_cvt = GMsgHeaderEdit::cvt_none;
int subj_cvt = GMsgHeaderEdit::cvt_none;
hedit.setup(C_HEADW, C_HEADW, C_HEADE, _box_table(W_BHEAD,13), true); int from_name_pos = EDIT->HdrNamePos();
int from_name_len = EDIT->HdrNameLen();
int from_addr_pos = EDIT->HdrNodePos();
int from_addr_len = EDIT->HdrNodeLen();
int to_name_pos = from_name_pos;
int to_name_len = from_name_len;
int to_addr_pos = from_addr_pos;
int to_addr_len = hedit.lookup or AA->isnet() ? from_addr_len : 0;
int subject_pos = 8;
int subject_len = MAXCOL - subject_pos;
int name_cvt = AA->Editmixcase() ? GMsgHeaderEdit::cvt_mixedcase : GMsgHeaderEdit::cvt_none;
int addr_cvt = GMsgHeaderEdit::cvt_none;
int subj_cvt = GMsgHeaderEdit::cvt_none;
hedit.add_field(GMsgHeaderEdit::id_from_name, 2, from_name_pos, from_name_len, from_name, sizeof(INam), name_cvt); hedit.setup(C_HEADW, C_HEADW, C_HEADE, _box_table(W_BHEAD,13), true);
hedit.add_field(GMsgHeaderEdit::id_from_addr, 2, from_addr_pos, from_addr_len, from_addr, sizeof(IAdr), addr_cvt);
hedit.add_field(GMsgHeaderEdit::id_to_name, 3, to_name_pos, to_name_len, to_name, sizeof(INam), name_cvt);
hedit.add_field(GMsgHeaderEdit::id_to_addr, 3, to_addr_pos, to_addr_len, to_addr, sizeof(IAdr), addr_cvt);
hedit.add_field(GMsgHeaderEdit::id_subject, 4, subject_pos, subject_len, subject, sizeof(ISub), subj_cvt);
hedit.start_id = GMsgHeaderEdit::id_to_name; hedit.add_field(GMsgHeaderEdit::id_from_name, 2, from_name_pos, from_name_len, from_name, sizeof(INam), name_cvt);
switch(mode) { hedit.add_field(GMsgHeaderEdit::id_from_addr, 2, from_addr_pos, from_addr_len, from_addr, sizeof(IAdr), addr_cvt);
case MODE_REPLYCOMMENT: hedit.add_field(GMsgHeaderEdit::id_to_name, 3, to_name_pos, to_name_len, to_name, sizeof(INam), name_cvt);
if(not (msg->dest.net or not AA->isnet())) hedit.add_field(GMsgHeaderEdit::id_to_addr, 3, to_addr_pos, to_addr_len, to_addr, sizeof(IAdr), addr_cvt);
hedit.add_field(GMsgHeaderEdit::id_subject, 4, subject_pos, subject_len, subject, sizeof(ISub), subj_cvt);
hedit.start_id = GMsgHeaderEdit::id_to_name;
switch(mode) {
case MODE_REPLYCOMMENT:
if(not (msg->dest.net or not AA->isnet()))
break;
// else drop through ...
case MODE_REPLY:
case MODE_QUOTE:
case MODE_CHANGE:
hedit.start_id = GMsgHeaderEdit::id_subject;
break; break;
// else drop through ... }
case MODE_REPLY:
case MODE_QUOTE: ChgAttrs(YES, msg);
case MODE_CHANGE:
hedit.start_id = GMsgHeaderEdit::id_subject; vcurshow();
break; if(not (hedit.lookup or AA->isnet())) {
char date2[25] = "";
strsetsz(date2, view.width - CFG->disphdrdateset.pos);
view.window.prints(3, CFG->disphdrdateset.pos, view.to_color, date2);
}
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-1, view.title_color, LNG->HeaderEditHelp1);
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-strlen(LNG->HeaderEditHelp2)-3, view.title_color, LNG->HeaderEditHelp2);
hedit.run(H_Header);
vcurhide();
ChgAttrs(NO, msg);
} }
else
ChgAttrs(YES, msg); hedit.dropped = false;
vcurshow();
if(not (hedit.lookup or AA->isnet())) {
char date2[25] = "";
strsetsz(date2, view.width - CFG->disphdrdateset.pos);
view.window.prints(3, CFG->disphdrdateset.pos, view.to_color, date2);
}
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-1, view.title_color, LNG->HeaderEditHelp1);
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-strlen(LNG->HeaderEditHelp2)-3, view.title_color, LNG->HeaderEditHelp2);
hedit.run(H_Header);
vcurhide();
ChgAttrs(NO, msg);
if(not hedit.dropped and not gkbd.quitall) { if(not hedit.dropped and not gkbd.quitall) {

View File

@ -498,7 +498,7 @@ void Initialize(int argc, char* argv[]) {
// set locale // set locale
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
// and get it's name // and get it's name
char* lc = setlocale(LC_CTYPE, ""); const char* lc = setlocale(LC_CTYPE, "");
if(lc and not (strstr(lc, "German_") or strstr(lc, "Polish_"))) if(lc and not (strstr(lc, "German_") or strstr(lc, "Polish_")))
right_alt_same_as_left = true; right_alt_same_as_left = true;
#if defined(GUTLOS_FUNCS) #if defined(GUTLOS_FUNCS)

View File

@ -65,6 +65,7 @@ enum {
FSC_CHARSET, FSC_CHARSET,
FSC_CHRC, FSC_CHRC,
FSC_CHRS, FSC_CHRS,
FSC_CODEPAGE,
FSC_DOMAIN, FSC_DOMAIN,
FSC_EID, FSC_EID,
FSC_ENC, FSC_ENC,
@ -92,7 +93,6 @@ enum {
enum { enum {
MASK_XXX = 0x8000, MASK_XXX = 0x8000,
XXX_ACUPDATE, XXX_ACUPDATE,
XXX_CODEPAGE,
XXX_DESTADDR, XXX_DESTADDR,
XXX_ENCRYPTION, XXX_ENCRYPTION,
XXX_EOT, XXX_EOT,
@ -235,6 +235,7 @@ static const Kludges fsc_list[] = {
{ "CHARSET" , FSC_CHARSET , KCRQ_CASE }, { "CHARSET" , FSC_CHARSET , KCRQ_CASE },
{ "CHRC" , FSC_CHRC , KCRQ_CASE }, { "CHRC" , FSC_CHRC , KCRQ_CASE },
{ "CHRS" , FSC_CHRS , KCRQ_CASE }, { "CHRS" , FSC_CHRS , KCRQ_CASE },
{ "CODEPAGE" , FSC_CODEPAGE , KCRQ_CASE },
{ "DOMAIN" , FSC_DOMAIN , KCRQ_CASE }, { "DOMAIN" , FSC_DOMAIN , KCRQ_CASE },
{ "EID" , FSC_EID , KCRQ_CASE }, { "EID" , FSC_EID , KCRQ_CASE },
{ "ENC" , FSC_ENC , KCRQ_CASE }, { "ENC" , FSC_ENC , KCRQ_CASE },
@ -265,7 +266,6 @@ static const Kludges fsc_list[] = {
static const Kludges xxx_list[] = { static const Kludges xxx_list[] = {
{ "ACUPDATE" , XXX_ACUPDATE , KCRQ_CASE }, { "ACUPDATE" , XXX_ACUPDATE , KCRQ_CASE },
{ "CODEPAGE" , XXX_CODEPAGE , KCRQ_CASE },
{ "DESTADDR" , XXX_DESTADDR , KCRQ_CASE }, { "DESTADDR" , XXX_DESTADDR , KCRQ_CASE },
{ "ENCRYPTION" , XXX_ENCRYPTION , KCRQ_CASE }, { "ENCRYPTION" , XXX_ENCRYPTION , KCRQ_CASE },
{ "EOT" , XXX_EOT , KCRQ_CASE }, { "EOT" , XXX_EOT , KCRQ_CASE },
@ -958,6 +958,10 @@ static int HandleKludges(GMsg* msg, Line* line, int kludgenum, const char* ptr,
line->kludge = GKLUD_CHARSET; line->kludge = GKLUD_CHARSET;
return true; return true;
case FSC_CODEPAGE:
line->kludge = GKLUD_CHARSET;
return true;
case FSC_DOMAIN: case FSC_DOMAIN:
//line->kludge = GKLUD_DOMAIN; //line->kludge = GKLUD_DOMAIN;
if(getvalue) if(getvalue)
@ -1072,7 +1076,6 @@ static int HandleKludges(GMsg* msg, Line* line, int kludgenum, const char* ptr,
return true; return true;
case XXX_ACUPDATE: case XXX_ACUPDATE:
case XXX_CODEPAGE:
case XXX_ENCRYPTION: case XXX_ENCRYPTION:
case XXX_EOT: case XXX_EOT:
case XXX_GATECHK: case XXX_GATECHK:
@ -2018,6 +2021,8 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
kludgetype = FSC_I51; kludgetype = FSC_I51;
else if(strieql(kludge, "CHRS") or strieql(kludge, "CHARSET")) else if(strieql(kludge, "CHRS") or strieql(kludge, "CHARSET"))
kludgetype = FSC_CHARSET; kludgetype = FSC_CHARSET;
else if(strieql(kludge, "CODEPAGE"))
kludgetype = FSC_CODEPAGE;
else if(strieql(kludge, "Content-Type")) else if(strieql(kludge, "Content-Type"))
kludgetype = RFC_CONTENT_TYPE; kludgetype = RFC_CONTENT_TYPE;
else if(strieql(kludge, "Content-Transfer-Encoding")) else if(strieql(kludge, "Content-Transfer-Encoding"))
@ -2045,10 +2050,13 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
strcpy(msg->charset, chsbuf); strcpy(msg->charset, chsbuf);
} }
} }
else if(kludgetype == FSC_CHARSET) { else if((kludgetype == FSC_CHARSET) || (kludgetype == FSC_CODEPAGE)) {
*chsbuf = NUL; *chsbuf = NUL;
qpencoded = IsQuotedPrintable(ptr); qpencoded = IsQuotedPrintable(ptr);
strxcpy(chsbuf, qpencoded ? ExtractPlainCharset(ptr) : ptr, sizeof(chsbuf)); if(kludgetype == FSC_CODEPAGE)
strxmerge(chsbuf, sizeof(chsbuf), "CP", ptr, NULL);
else
strxcpy(chsbuf, qpencoded ? ExtractPlainCharset(ptr) : ptr, sizeof(chsbuf));
// Workaround for buggy mailreaders which stores '_' in charset name // Workaround for buggy mailreaders which stores '_' in charset name
strchg(chsbuf,'_',' '); strchg(chsbuf,'_',' ');
chslev = LoadCharset(chsbuf, CFG->xlatlocalset); chslev = LoadCharset(chsbuf, CFG->xlatlocalset);

View File

@ -867,11 +867,9 @@ int GMenuEditHeader::Run(int mode, GMsg* msg) {
update_statusline(LNG->EditHeader); update_statusline(LNG->EditHeader);
if(doedithdr) { _tag = EditHeaderinfo(mode, *HeaderView, doedithdr);
_tag = EditHeaderinfo(mode, *HeaderView); if((_tag == W_ESCPRESS) or gkbd.quitall)
if((_tag == W_ESCPRESS) or gkbd.quitall) break;
break;
}
do { do {

View File

@ -261,7 +261,7 @@ bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fro
// GEPOST prototypes // GEPOST prototypes
void MakeMsg(int mode, GMsg* oldmsg, bool ignore_replyto=false); void MakeMsg(int mode, GMsg* oldmsg, bool ignore_replyto=false);
int EditHeaderinfo(int mode, GMsgHeaderView &view); int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr = true);
void CheckSubject(GMsg* msg, char* subj); void CheckSubject(GMsg* msg, char* subj);

View File

@ -54,12 +54,14 @@ char* CvtMessageIDtoMSGID(const char* mptr, char* msgidbuf, const char* echoid,
else { else {
*bptr++ = *mptr++; *bptr++ = *mptr++;
} }
if(bptr-msgidbuf > 200) // Check for overrun
break;
} }
*bptr = NUL; *bptr = NUL;
} }
else { else {
int spaces = strchr(mptr, ' ') ? true : false; bool spaces = strchr(mptr, ' ') ? true : false;
dword crc32 = CRC32_MASK_CCITT; dword crc32 = CRC32_MASK_CCITT;
crc32 = strCrc32(mptr, NO, crc32); crc32 = strCrc32(mptr, NO, crc32);
@ -72,6 +74,8 @@ char* CvtMessageIDtoMSGID(const char* mptr, char* msgidbuf, const char* echoid,
if(spaces and (*mptr == '\"')) if(spaces and (*mptr == '\"'))
*bptr++ = '\"'; *bptr++ = '\"';
*bptr++ = *mptr++; *bptr++ = *mptr++;
if(bptr-msgidbuf > (200-9-(spaces?2:0))) // Check for overrun
break;
} }
if(spaces) if(spaces)
*bptr++ = '\"'; *bptr++ = '\"';
@ -253,6 +257,9 @@ void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tossto
ParseInternetAddr(mptr, toname, toaddr); ParseInternetAddr(mptr, toname, toaddr);
strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to)); strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to));
} }
else if(MatchRFC(mptr, "X-Comment-To: ")) {
strxcpy(msg->to, mptr, sizeof(msg->to));
}
else if(MatchRFC(mptr, "Cc: ")) { else if(MatchRFC(mptr, "Cc: ")) {
char* ccbuf = (char*)throw_malloc(strlen(msg->icc) + strlen(mptr) + 3); char* ccbuf = (char*)throw_malloc(strlen(msg->icc) + strlen(mptr) + 3);
strcpy(stpcpy(stpcpy(ccbuf, msg->icc), *msg->icc ? ", " : ""), mptr); strcpy(stpcpy(stpcpy(ccbuf, msg->icc), *msg->icc ? ", " : ""), mptr);

View File

@ -334,6 +334,8 @@ int is_quote(const char* ptr) {
if(IsQuoteChar(ptr)) if(IsQuoteChar(ptr))
return true; return true;
endptr = ptr + 11; // match 10 chars after whitespaces
int spaces = 0; int spaces = 0;
while((ptr < endptr) and *ptr) { while((ptr < endptr) and *ptr) {

View File

@ -97,14 +97,14 @@ void FreqWaZOO(const char* files, const Addr& dest, const Attr& attr) {
strcpy(filename, outbound); strcpy(filename, outbound);
if(dest.zone != CFG->aka[0].addr.zone) { if(dest.zone != CFG->aka[0].addr.zone) {
sprintf(tmp, ".%03X", dest.zone); sprintf(tmp, ".%03x", dest.zone);
strcat(filename, tmp); strcat(filename, tmp);
if(not is_dir(filename)) if(not is_dir(filename))
mkdir(filename, S_IWUSR); mkdir(filename, S_IWUSR);
} }
AddBackslash(filename); AddBackslash(filename);
sprintf(tmp, "%04X%04X", dest.net, dest.node); sprintf(tmp, "%04x%04x", dest.net, dest.node);
strcat(filename, tmp); strcat(filename, tmp);
if(dest.point) { if(dest.point) {
@ -112,7 +112,7 @@ void FreqWaZOO(const char* files, const Addr& dest, const Attr& attr) {
if(not is_dir(filename)) if(not is_dir(filename))
mkdir(filename, S_IWUSR); mkdir(filename, S_IWUSR);
AddBackslash(filename); AddBackslash(filename);
sprintf(tmp, "%08X", dest.point); sprintf(tmp, "%08x", dest.point);
strcat(filename, tmp); strcat(filename, tmp);
} }

View File

@ -135,6 +135,7 @@ gutlmisc cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
gutlmtsk cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gutlmtsk cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
gutltag cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gutltag cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
gutlvers cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gutlvers cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
gcharset cpp all nov bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
## OS specific utilities ## OS specific utilities
gutldos cpp all djg gutldos cpp all djg

113
goldlib/gall/gcharset.cpp Normal file
View File

@ -0,0 +1,113 @@
// This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------
// The Goldware Library
// Copyright (C) 1990-1999 Odinn Sorensen
// Copyright (C) 1999-2000 Alexander S. Aganichev
// ------------------------------------------------------------------
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307, USA
// ------------------------------------------------------------------
// $Id$
// ------------------------------------------------------------------
// Utility functions.
// ------------------------------------------------------------------
#include <cstdlib>
#include <cstdio>
#include <clocale>
#include <gcmpall.h>
#include <gstrall.h>
#ifdef __WIN32__
#include <windows.h>
#endif
#ifdef __OS2__
#define INCL_DOS
#include <os2.h>
#endif
#ifdef __DJGPP__
#include <dpmi.h>
#include <sys/farptr.h>
#endif
static char charsetbuf[256];
const char *get_charset(void)
{
#if defined(__DJGPP__)
int segment, selector;
__dpmi_regs regs;
strcpy(charsetbuf, "IBMPC");
if ((segment = __dpmi_allocate_dos_memory(3, &selector)) != -1) {
regs.h.ah = 0x65;
regs.h.al = 0x01;
regs.x.bx = 0xffff;
regs.x.dx = 0xffff;
regs.x.cx = 41;
regs.x.es = segment;
regs.x.di = 0;
__dpmi_int(0x21, &regs);
if (!(regs.x.flags & 1) and (regs.x.cx == 41)) {
int CCP = _farpeekw(selector, 5);
sprintf(charsetbuf, "CP%i", CCP);
}
__dpmi_free_dos_memory(selector);
}
#elif defined(__WIN32__)
sprintf(charsetbuf, "CP%i", GetOEMCP());
#elif defined(__OS2__)
ULONG CCP[8];
ULONG cb;
strcpy(charsetbuf, "IBMPC");
if(DosQueryCp(sizeof (CCP), CCP, &cb) == 0)
sprintf(charsetbuf, "CP%i", CCP[0]);
#else
const char *cp;
strcpy(charsetbuf, "LATIN-1");
cp = setlocale(LC_CTYPE, "");
if((cp != NULL) and ((cp = strchr(cp, '.')) != NULL)) {
if(strieql(cp, "KOI8R"))
cp = "KOI8-R";
strxcpy(charsetbuf, cp, sizeof(charsetbuf));
}
#endif
return charsetbuf;
}
const char *get_dos_charset(const char *cpfrom)
{
#if defined(__WIN32__) || defined(__MSDOS__) || defined(__OS2__)
(void)cpfrom; // These platforms use DOS CP on console, so ignore request
return "";
#else
static const struct _cpmap {
char *from, *to;
} cpmap[] = {
{ "LATIN-1", "CP437" },
{ "KOI8-R", "CP866" },
{ NULL, NULL }
};
int i;
for(i = 0; cpmap[i].from != NULL; i++) {
if(strieql(cpfrom, cpmap[i].from))
return cpmap[i].to;
}
return "";
#endif
}

38
goldlib/gall/gcharset.h Normal file
View File

@ -0,0 +1,38 @@
// This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------
// The Goldware Library
// Copyright (C) 1990-1999 Odinn Sorensen
// ------------------------------------------------------------------
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307, USA
// ------------------------------------------------------------------
// $Id$
// ------------------------------------------------------------------
// Charset handling utility.
// ------------------------------------------------------------------
#ifndef __gcharset_h
#define __gcharset_h
// ------------------------------------------------------------------
const char *get_charset(void);
const char *get_dos_charset(const char *);
// ------------------------------------------------------------------
#endif // __gcharset_h