Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv31816/src/mail
Modified Files:
SendMessageCC.cpp
Log Message:
made WriteToFile() do at least something (has it been _ever_ tested?)
Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.181
retrieving revision 1.182
diff -b -u -2 -r1.181 -r1.182
--- SendMessageCC.cpp 16 Mar 2002 23:38:48 -0000 1.181
+++ SendMessageCC.cpp 18 Mar 2002 00:26:20 -0000 1.182
@@ -1629,10 +1629,22 @@
SendMessageCC::WriteToFile(const String &filename, bool append)
{
- ofstream *ostr = new ofstream(filename.c_str(),
- append ? ios::out : ios::out | ios::trunc);
+ int flags = ios::out | ios::binary;
+ if ( !append )
+ flags |= ios::trunc;
+
+ ofstream ostr(filename.c_str(), flags);
+
+ bool ok = !(!ostr || ostr.bad());
+ if ( ok )
+ {
+ // we need a valid "From " line or c-client wouldn't recognize this file
+ // as a MBOX one
+ time_t t = time(NULL);
+ ostr << "From Mahogany-AutoSave " << ctime(&t);
+ ok = !ostr.fail();
+ }
- bool ok = !(!ostr || ostr->bad());
if ( ok )
- ok = WriteMessage(write_stream_output, ostr);
+ ok = WriteMessage(write_stream_output, &ostr);
if ( !ok )
@@ -1682,7 +1694,7 @@
ostream *o = (ostream *)stream;
*o << string;
- if( o->fail() )
+ if ( o->fail() )
return NIL;
- else
+
return T;
}
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates