Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1:/tmp/cvs-serv6042/src/mail

Modified Files:
        SendMessageCC.cpp ThreadJWZ.cpp VFolder.cpp 
Log Message:
unicode fixes

Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.216
retrieving revision 1.217
diff -b -u -2 -r1.216 -r1.217
--- SendMessageCC.cpp   12 Oct 2003 11:30:45 -0000      1.216
+++ SendMessageCC.cpp   12 Oct 2003 22:03:37 -0000      1.217
@@ -123,5 +123,5 @@
 
 // trace mask for message sending/queuing operations
-#define TRACE_SEND   "send"
+#define TRACE_SEND   _T("send")
 
 // ----------------------------------------------------------------------------
@@ -367,5 +367,5 @@
 
    if ( READ_CONFIG_BOOL(m_profile, MP_COMPOSE_USE_XFACE) )
-      m_XFaceFile = m_profile->readEntry(MP_COMPOSE_XFACE_FILE, "");
+      m_XFaceFile = m_profile->readEntry(MP_COMPOSE_XFACE_FILE, _T(""));
 
    m_CharSet = READ_CONFIG_TEXT(m_profile,MP_CHARSET);
@@ -390,5 +390,5 @@
 
    bool firstHeader = true;
-   for ( const char *p = hdrOrig; *p; p++ )
+   for ( const wxChar *p = hdrOrig; *p; p++ )
    {
       // start of line?
@@ -407,11 +407,11 @@
          }
 
-#define STARTS_WITH(p, what) (!(wxStrnicmp((p), (what), strlen(what))))
+#define STARTS_WITH(p, what) (!(wxStrnicmp((p), (what), wxStrlen(what))))
 
-         if ( STARTS_WITH(p, "Delivered-To:") ||
-               STARTS_WITH(p, "Received:") ||
-                 STARTS_WITH(p, "Resent-") )
+         if ( STARTS_WITH(p, _T("Delivered-To:")) ||
+               STARTS_WITH(p, _T("Received:")) ||
+                 STARTS_WITH(p, _T("Resent-")) )
          {
-            hdr += "X-";
+            hdr += _T("X-");
          }
 
@@ -422,5 +422,5 @@
    }
 
-   m_Envelope->remail = cpystr(hdr.c_str());
+   m_Envelope->remail = cpystr(wxConvertWX2MB(hdr.c_str()));
 
    // now copy the body: note that we have to use ENC7BIT here to prevent
@@ -432,5 +432,5 @@
    // FIXME: we potentially copy a lot of data here!
    String text = message->FetchText();
-   m_Body->contents.text.data = (unsigned char *)cpystr(text.c_str());
+   m_Body->contents.text.data = (unsigned char *)cpystr(wxConvertWX2MB(text.c_str()));
    m_Body->contents.text.size = text.length();
 }
@@ -529,5 +529,5 @@
    // if a header contains "=?", encode it anyhow to avoid generating invalid
    // encoded words
-   if ( !strstr(header, "=?") )
+   if ( !wxStrstr(header, _T("=?")) )
    {
       // only encode the strings which contain the characters unallowed in RFC
@@ -567,5 +567,5 @@
       FAIL_MSG( _T("should have a valid charset name!") );
 
-      csName = "UNKNOWN";
+      csName = _T("UNKNOWN");
    }
 
@@ -576,5 +576,5 @@
    // encode the header splitting it in the chunks such that they will be no
    // longer than 75 characters each
-   const char *s = header.c_str();
+   const wxChar *s = header.c_str();
    while ( *s )
    {
@@ -582,5 +582,5 @@
       if ( !headerEnc.empty() )
       {
-         headerEnc << "\r\n ";
+         headerEnc << _T("\r\n ");
       }
 
@@ -619,5 +619,5 @@
 
          // but not more than what we have
-         size_t lenMax = strlen(s);
+         size_t lenMax = wxStrlen(s);
          if ( len > lenMax )
          {
@@ -648,5 +648,6 @@
 
       // put into string as we might want to do some more replacements...
-      String encword(textEnc, (size_t)lenEnc);
+      String encword((wxChar*)textEnc, (size_t)lenEnc);
+      //String encword = strutil_strdup(wxConvertMB2WX(textEnc));
 
       // hack: rfc822_8bit() doesn't encode spaces normally but we must
@@ -660,18 +661,18 @@
 
          bool replaced = false;
-         for ( const char *p = encword.c_str(); *p; p++ )
+         for ( const wxChar *p = encword.c_str(); *p; p++ )
          {
             switch ( *p )
             {
                case ' ':
-                  encword2 += "=20";
+                  encword2 += _T("=20");
                   break;
 
                case '\t':
-                  encword2 += "=09";
+                  encword2 += _T("=09");
                   break;
 
                case '?':
-                  encword2 += "=3F";
+                  encword2 += _T("=3F");
                   break;
 
@@ -693,7 +694,7 @@
 
       // append this word to the header
-      headerEnc << "=?" << csName << '?' << (char)enc2047 << '?'
+      headerEnc << _T("=?") << csName << _T('?') << (char)enc2047 << _T('?')
                 << encword
-                << "?=";
+                << _T("?=");
 
       fs_give((void **)&textEnc);
@@ -714,5 +715,5 @@
    {
       char *tmp = adr->personal;
-      adr->personal = cpystr(EncodeHeaderString(tmp, true /* address field */));
+      adr->personal = cpystr(wxConvertWX2MB(EncodeHeaderString(wxConvertMB2WX(tmp), 
true /* address field */)));
 
       fs_give((void **)&tmp);
@@ -738,5 +739,5 @@
 
    String subj = EncodeHeaderString(subject);
-   m_Envelope->subject = cpystr(subj.c_str());
+   m_Envelope->subject = cpystr(wxConvertWX2MB(subj.c_str()));
 }
 
@@ -813,5 +814,5 @@
          adrPrev->next = adr->next;
 
-         DBGMESSAGE(("Invalid recipient address '%s' ignored.",
+         DBGMESSAGE((_T("Invalid recipient address '%s' ignored."),
                     AddressCC(adr).GetAddress().c_str()));
 
@@ -858,5 +859,5 @@
    {
       ASSERT(m_Envelope->newsgroups == NIL);
-      m_Envelope->newsgroups = strdup(groups);
+      m_Envelope->newsgroups = strdup(wxConvertWX2MB(groups));
    }
 
@@ -962,15 +963,15 @@
    strutil_delwhitespace(name);
 
-   if (name == "TO")
+   if (name == _T("TO"))
       ; //TODO: Fix this?SetAddresses(*value);
-   else if(name == "CC")
+   else if(name == _T("CC"))
       ; //SetAddresses("",*value);
-   else if(name == "BCC")
+   else if(name == _T("BCC"))
       ; //SetAddresses("","",*value);
-   else if ( name == "MIME-VERSION" ||
-             name == "CONTENT-TYPE" ||
-             name == "CONTENT-DISPOSITION" ||
-             name == "CONTENT-TRANSFER-ENCODING" ||
-             name == "MESSAGE-ID" )
+   else if ( name == _T("MIME-VERSION") ||
+             name == _T("CONTENT-TYPE") ||
+             name == _T("CONTENT-DISPOSITION") ||
+             name == _T("CONTENT-TRANSFER-ENCODING") ||
+             name == _T("MESSAGE-ID") )
    {
       ERRORMESSAGE((_("The value of the header '%s' cannot be modified."),
@@ -979,5 +980,5 @@
       return;
    }
-   else if ( name == "SUBJECT" )
+   else if ( name == _T("SUBJECT") )
    {
       SetSubject(value);
@@ -1039,8 +1040,8 @@
    }
 
-   return String::Format("<[EMAIL PROTECTED]>",
+   return String::Format(_T("<[EMAIL PROTECTED]>"),
                          M_VERSION,
                          s_pid,
-                         dt.Format("%Y%m%d-%H%M%S").c_str(),
+                         dt.Format(_T("%Y%m%d-%H%M%S")).c_str(),
                          s_numInSec,
                          hostname);
@@ -1073,5 +1074,5 @@
    // NB: we do allow the user to override the date header because this is
    //     useful when editing a previously postponed message
-   if ( !HasHeaderEntry("Date") )
+   if ( !HasHeaderEntry(_T("Date")) )
    {
       char tmpbuf[MAILTMPLEN];
@@ -1085,5 +1086,5 @@
    if ( m_DefaultHost.find('.') != String::npos )
    {
-      m_Envelope->message_id = cpystr(BuildMessageId(m_DefaultHost));
+      m_Envelope->message_id = 
cpystr(wxConvertWX2MB(BuildMessageId(wxConvertWX2MB(m_DefaultHost))));
    }
 
@@ -1106,5 +1107,5 @@
       // The X-BCC will be converted back to BCC by Send()
       if ( m_Envelope->bcc )
-         AddHeaderEntry("X-BCC", m_Bcc);
+         AddHeaderEntry(_T("X-BCC"), m_Bcc);
    }
    else // send, not store
@@ -1115,5 +1116,5 @@
          back to a proper bcc setting:
        */
-      if ( HasHeaderEntry("X-BCC") )
+      if ( HasHeaderEntry(_T("X-BCC")) )
       {
          if ( m_Envelope->bcc )
@@ -1122,9 +1123,9 @@
          }
 
-         SetAddressField(&m_Envelope->bcc, GetHeaderEntry("X-BCC"));
+         SetAddressField(&m_Envelope->bcc, GetHeaderEntry(_T("X-BCC")));
 
          // don't send X-BCC field or the recipient would still see the BCC
          // contents (which is highly undesirable!)
-         RemoveHeaderEntry("X-BCC");
+         RemoveHeaderEntry(_T("X-BCC"));
       }
    }
@@ -1147,11 +1148,11 @@
          ++i, ++h )
    {
-      m_headerNames[h] = strutil_strdup(i->m_name);
-      if ( wxStricmp(m_headerNames[h], "Reply-To") == 0 )
+      m_headerNames[h] = strutil_strdup(wxConvertWX2MB(i->m_name));
+      if ( wxStricmp(wxConvertMB2WX(m_headerNames[h]), _T("Reply-To")) == 0 )
          replyToSet = true;
-      else if ( wxStricmp(m_headerNames[h], "X-Mailer") == 0 )
+      else if ( wxStricmp(wxConvertMB2WX(m_headerNames[h]), _T("X-Mailer")) == 0 )
          xmailerSet = true;
 
-      m_headerValues[h] = strutil_strdup(i->m_value);
+      m_headerValues[h] = strutil_strdup(wxConvertWX2MB(i->m_value));
    }
 
@@ -1167,11 +1168,11 @@
       //     headers!
       String version;
-      version << "Mahogany " << M_VERSION_STRING;
+      version << _T("Mahogany ") << M_VERSION_STRING;
 #ifdef OS_UNIX
-      version  << ", compiled for " << M_OSINFO;
+      version  << _T(", compiled for ") << M_OSINFO;
 #else // Windows
-      version << ", running under " << wxGetOsDescription();
+      version << _T(", running under ") << wxGetOsDescription();
 #endif // Unix/Windows
-      m_headerValues[h++] = strutil_strdup(version);
+      m_headerValues[h++] = strutil_strdup(wxConvertWX2MB(version));
    }
 
@@ -1179,10 +1180,10 @@
    if ( !replyToSet )
    {
-      ASSERT_MSG( !HasHeaderEntry("Reply-To"), _T("logic error") );
+      ASSERT_MSG( !HasHeaderEntry(_T("Reply-To")), _T("logic error") );
 
       if ( !m_ReplyTo.empty() )
       {
          m_headerNames[h] = strutil_strdup("Reply-To");
-         m_headerValues[h++] = strutil_strdup(m_ReplyTo);
+         m_headerValues[h++] = strutil_strdup(wxConvertWX2MB(m_ReplyTo));
       }
    }
@@ -1190,5 +1191,5 @@
 #ifdef HAVE_XFACES
    // add an XFace?
-   if ( !HasHeaderEntry("X-Face") && !m_XFaceFile.empty() )
+   if ( !HasHeaderEntry(_T("X-Face")) && !m_XFaceFile.empty() )
    {
       XFace xface;
@@ -1196,5 +1197,5 @@
       {
          m_headerNames[h] = strutil_strdup("X-Face");
-         m_headerValues[h] = strutil_strdup(xface.GetHeaderLine());
+         m_headerValues[h] = strutil_strdup(wxConvertWX2MB(xface.GetHeaderLine()));
          if(strlen(m_headerValues[h]))  // paranoid, I know.
          {
@@ -1252,7 +1253,7 @@
    {
       if ( type == TYPETEXT )
-         subtype = "PLAIN";
+         subtype = _T("PLAIN");
       else if ( type == TYPEAPPLICATION )
-         subtype = "OCTET-STREAM";
+         subtype = _T("OCTET-STREAM");
       else
       {
@@ -1261,5 +1262,5 @@
          ERRORMESSAGE((_("MIME type specified without subtype and\n"
                          "no default subtype for this type.")));
-         subtype = "UNKNOWN";
+         subtype = _T("UNKNOWN");
       }
    }
@@ -1352,5 +1353,5 @@
 
          String name = i->name;
-         if ( name.Lower() == "charset" )
+         if ( name.Lower() == _T("charset") )
          {
             if ( hasCharset )
@@ -1363,6 +1364,6 @@
          }
 
-         par->attribute = strdup(name);
-         par->value     = strdup(i->value);
+         par->attribute = strdup(wxConvertWX2MB(name));
+         par->value     = strdup(wxConvertWX2MB(i->value));
          par->next      = lastpar;
          lastpar = par;
@@ -1378,5 +1379,5 @@
          // plain text messages should be in US_ASCII as all clients should be
          // able to show them and some might complain [even] about iso8859-1
-         cs = "US-ASCII";
+         cs = _T("US-ASCII");
       }
       else // 8bit message
@@ -1398,5 +1399,5 @@
          par = mail_newbody_parameter();
          par->attribute = strdup("CHARSET");
-         par->value     = strdup(cs);
+         par->value     = strdup(wxConvertWX2MB(cs));
          par->next      = lastpar;
          lastpar = par;
@@ -1405,5 +1406,5 @@
 
    bdy->parameter = lastpar;
-   bdy->disposition.type = strdup(disposition);
+   bdy->disposition.type = strdup(wxConvertWX2MB(disposition));
    if ( dlist )
    {
@@ -1415,6 +1416,6 @@
       {
          par = mail_newbody_parameter();
-         par->attribute = strdup(i->name);
-         par->value     = strdup(i->value);
+         par->attribute = strdup(wxConvertWX2MB(i->name));
+         par->value     = strdup(wxConvertWX2MB(i->value));
          par->next      = NULL;
          if(lastpar)
@@ -1515,5 +1516,5 @@
    String textTmp;
    WriteToString(textTmp);
-   MDialog_ShowText(m_frame, "Outgoing message text", textTmp, "SendPreview");
+   MDialog_ShowText(m_frame, _T("Outgoing message text"), textTmp, _T("SendPreview"));
 
    if ( text )
@@ -1552,5 +1553,5 @@
    if ( !m_UserName.empty() )
    {
-      server << "/user=\"" << m_UserName << '"';
+      server << _T("/user=\"") << m_UserName << _T('"');
       MailFolderCC::SetLoginData(m_UserName, m_Password);
    }
@@ -1588,5 +1589,5 @@
             if ( useSSL != SSLSupport_TLSIfAvailable )
             {
-               ERRORMESSAGE(("SSL support is unavailable; try disabling SSL/TLS."));
+               ERRORMESSAGE((_T("SSL support is unavailable; try disabling 
SSL/TLS.")));
 
                return false;
@@ -1710,6 +1711,6 @@
 
             // write to temp file:
-#if 0 // VZ: wxGetTempFileName() is broken beyond repair, don't use it for now
-            const char *filename = wxGetTempFileName("Mtemp");
+#if 1 // VZ: wxGetTempFileName() is broken beyond repair, don't use it for now (NB - 
maybe not already?)
+            const wxChar *filename = wxGetTempFileName(_T("Mtemp"));
 #else
             // tmpnam() is POSIX, so use it even if mk(s)temp() would be better
@@ -1733,13 +1734,13 @@
                   {
                      String command;
-                     command.Printf("%s < '%s'; exec /bin/rm -f '%s'",
+                     command.Printf(_T("%s < '%s'; exec /bin/rm -f '%s'"),
                                     m_SendmailCmd.c_str(),
                                     filename, filename);
                      // HORRIBLE HACK: this should be `const char *' but wxExecute's
                      // prototype doesn't allow it...
-                     char *argv[4];
-                     argv[0] = (char *)"/bin/sh";
-                     argv[1] = (char *)"-c";
-                     argv[2] = (char *)command.c_str();
+                     wxChar *argv[4];
+                     argv[0] = (wxChar *)"/bin/sh";
+                     argv[1] = (wxChar *)"-c";
+                     argv[2] = (wxChar *)command.c_str();
                      argv[3] = 0;  // NULL
                      success = wxExecute(argv) != 0;
@@ -1759,5 +1760,5 @@
                                   m_frame, // parent window
                                   MDIALOG_MSGTITLE,
-                                  "MailSentMessage");
+                                  _T("MailSentMessage"));
                }
             }
@@ -1787,5 +1788,5 @@
          case Prot_SMTP:
             success = smtp_mail (stream,"MAIL",m_Envelope,m_Body) != 0;
-            reply = stream->reply;
+            reply = wxConvertMB2WX(stream->reply);
             smtp_close (stream);
             break;
@@ -1793,5 +1794,5 @@
          case Prot_NNTP:
             success = nntp_mail (stream,m_Envelope,m_Body) != 0;
-            reply = stream->reply;
+            reply = wxConvertMB2WX(stream->reply);
             nntp_close (stream);
             break;
@@ -1812,5 +1813,5 @@
                             m_frame, // parent window
                             MDIALOG_MSGTITLE,
-                         "MailSentMessage");
+                            _T("MailSentMessage"));
          }
       }
@@ -1891,5 +1892,5 @@
    if ( !WriteMessage(write_str_output, &output) )
    {
-      ERRORMESSAGE (("Can't write message to string."));
+      ERRORMESSAGE ((_T("Can't write message to string.")));
 
       return false;
@@ -1907,5 +1908,5 @@
    // note that we have to repeat ios::out and binary below, otherwise gcc 3.0
    // refuses to compile it as it converts everything to int and then fails
-   ofstream ostr(filename.c_str(),
+   ofstream ostr(filename.fn_str(),
                  append ? ios::out | ios::binary
                         : ios::out | ios::binary | ios::trunc);
@@ -1980,5 +1981,5 @@
 {
    String *o = (String *)stream;
-   *o << string;
+   *o << wxConvertMB2WX(string);
    return 1;
 }

Index: ThreadJWZ.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/ThreadJWZ.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -b -u -2 -r1.29 -r1.30
--- ThreadJWZ.cpp       18 Sep 2003 16:31:00 -0000      1.29
+++ ThreadJWZ.cpp       12 Oct 2003 22:03:37 -0000      1.30
@@ -65,5 +65,5 @@
 
 /// Used for wxLogTrace calls
-#define TRACE_JWZ "jwz"
+#define TRACE_JWZ _T("jwz")
 
 // ----------------------------------------------------------------------------
@@ -443,5 +443,5 @@
 
    // Scan the provided id to remove the garbage
-   const char *s = m_hi->GetId().c_str();
+   const wxChar *s = m_hi->GetId().c_str();
 
    enum State {
@@ -483,5 +483,5 @@
 
    if (that->m_id->empty()) {
-      *that->m_id = String("<emptyId:") << (int)this << ">";
+      *that->m_id = String(_T("<emptyId:")) << (int)this << _T(">");
    }
 
@@ -519,5 +519,5 @@
       return tmp;
 
-   const char *s = refs.c_str();
+   const wxChar *s = refs.c_str();
 
    enum State {
@@ -1109,5 +1109,5 @@
    // is destroyed ?
    char *s = new char[str.Len()+1];
-   strcpy(s, str.c_str());
+   strcpy(s, wxConvertWX2MB(str.c_str()));
    hash_add(hTable, s, container, 0);
 }
@@ -1154,5 +1154,5 @@
    for (; th != 0; th = th->getNext())
    {
-      VERIFY(th->getChild() == 0, "Bad input list in Threader::thread()");
+      VERIFY(th->getChild() == 0, _T("Bad input list in Threader::thread()"));
       thCount++;
    }
@@ -1174,11 +1174,11 @@
    for (th = threadableRoot; th != 0; th = th->getNext())
    {
-      VERIFY(th->getIndex() >= 0, "Negative index in Threader::thread()");
-      VERIFY(th->getIndex() < thCount, "Too big in Threader::thread()");
+      VERIFY(th->getIndex() >= 0, _T("Negative index in Threader::thread()"));
+      VERIFY(th->getIndex() < thCount, _T("Too big in Threader::thread()"));
       // As things are now, dummy messages won't get past the algorithm
       // and won't be displayed. Thus we should not get them back when
       // re-threading this folder.
       // When this changes, we will have to take care to skip them.
-      VERIFY(!th->isDummy(), "Dummy message in Threader::thread()");
+      VERIFY(!th->isDummy(), _T("Dummy message in Threader::thread()"));
       buildContainer(th);
    }
@@ -1266,5 +1266,5 @@
          // the same id. Let's give a new id to this message,
          // and create a container for it.
-         id = String("<bogusId:") << m_bogusIdCount++ << ">";
+         id = String(_T("<bogusId:")) << m_bogusIdCount++ << _T(">");
          container = 0;
       }
@@ -1755,5 +1755,5 @@
          count += collectSubjects(subjectTable, c, true);
          depth--;
-         VERIFY(depth >= 0, "Negative recursion depth in 
Threader::collectSubjects()");
+         VERIFY(depth >= 0, _T("Negative recursion depth in 
Threader::collectSubjects()"));
       }
    }
@@ -1828,5 +1828,5 @@
       breakThreads(kid);
       depth--;
-      VERIFY(depth >= 0, "Negative recursion depth in Threader::breakThreads()");
+      VERIFY(depth >= 0, _T("Negative recursion depth in Threader::breakThreads()"));
 
       kid = next;

Index: VFolder.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/VFolder.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -b -u -2 -r1.14 -r1.15
--- VFolder.cpp 30 Sep 2003 13:46:21 -0000      1.14
+++ VFolder.cpp 12 Oct 2003 22:03:37 -0000      1.15
@@ -164,5 +164,5 @@
                                 const String& /* login */)
 {
-   CHECK( folder, "", _T("NULL folder in MailFolderVirt::GetFullImapSpec") );
+   CHECK( folder, _T(""), _T("NULL folder in MailFolderVirt::GetFullImapSpec") );
 
    String spec;



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to