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

Modified Files:
        LogCircle.cpp MailFolderCC.cpp SendMessageCC.cpp 
Log Message:
don't hide our explanation behind the 'Details' button, nobody is ever going to see 
them; other minor enhancements in MLogCircle; recognize self-signed SSL certs error 
(bug 840)

Index: LogCircle.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/LogCircle.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -u -2 -r1.3 -r1.4
--- LogCircle.cpp       18 Sep 2003 16:30:58 -0000      1.3
+++ LogCircle.cpp       7 Oct 2003 12:42:00 -0000       1.4
@@ -58,5 +58,6 @@
          if(m_Messages[i].Contains(needle))
          {
-            if(store) *store = m_Messages[i];
+            if(store)
+               *store = m_Messages[i];
             return true;
          }
@@ -68,5 +69,6 @@
       if(m_Messages[i].Contains(needle))
       {
-         if(store) *store = m_Messages[i];
+         if(store)
+            *store = m_Messages[i];
          return true;
       }
@@ -76,20 +78,6 @@
 }
 
-String
-MLogCircle::GetLog(void) const
-{
-   String log;
-   // search from m_Next to m_N
-   int i;
-   for(i = m_Next; i < m_N ; i++)
-      log << m_Messages[i] << '\n';
-         // search from 0 to m_Next-1:
-   for(i = 0; i < m_Next; i++)
-      log << m_Messages[i] << '\n';
-   return log;
-}
-
 /* static */
-void
+String
 MLogCircle::GuessError(void) const
 {
@@ -119,6 +107,4 @@
                 "please verify if they are correct.");
    }
-   // the SMTP error messages are not redirected to MLogCircle yet anyhow...
-#if 0
    // SMTP 554 error
    else if ( Find("recipients failed", &err) )
@@ -126,5 +112,4 @@
       guess = _("Mail server didn't accept one or more of the message recipients");
    }
-#endif // 0
    // these are generated by c-client
    else if ( Find("INVALID_ADDRESS", &err) ||
@@ -142,10 +127,19 @@
                  "please close it first and retry.");
    }
+   else if ( Find("Self-signed certificate or untrusted authority", &err) )
+   {
+      guess = _("You chose not to trust the SSL certificate of this server.\n"
+                "\n"
+                "You may want to check the \"Accept unsigned certificates\" option\n"
+                "in the \"Access\" page of the folder properties dialog if you\n"
+                "want to accept self-signed certificates.");
+   }
 
    if ( !guess.empty() )
    {
-      wxLogMessage(guess);
       wxLogMessage(_("The exact error message was: %s"), err.c_str());
    }
+
+   return guess;
 }
 

Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.679
retrieving revision 1.680
diff -b -u -2 -r1.679 -r1.680
--- MailFolderCC.cpp    3 Oct 2003 17:08:06 -0000       1.679
+++ MailFolderCC.cpp    7 Oct 2003 12:42:00 -0000       1.680
@@ -2314,8 +2314,17 @@
    {
       // can we give the user a hint as to why did it fail?
-      GetLogCircle().GuessError();
+      String explanation = GetLogCircle().GuessError();
 
       // give the general error message anyhow
-      wxLogError(_("Could not open mailbox '%s'."), GetName().c_str());
+      String err;
+      err.Printf(_("Could not open mailbox '%s'."), GetName().c_str());
+
+      // and then try to give more details about what happened
+      if ( !explanation.empty() )
+      {
+         err << _T("\n\n") << explanation;
+      }
+
+      wxLogError(_T("%s"), err.c_str());
 
       return false;

Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.214
retrieving revision 1.215
diff -b -u -2 -r1.214 -r1.215
--- SendMessageCC.cpp   30 Sep 2003 13:46:21 -0000      1.214
+++ SendMessageCC.cpp   7 Oct 2003 12:42:00 -0000       1.215
@@ -1817,17 +1817,44 @@
       else // failed to send/post
       {
-         wxLogWarning(_("%s error: %s"),
-                      m_Protocol == Prot_SMTP ? "SMTP" : "NNTP",
-                      reply.empty() ? _("unknown error") : reply.c_str());
+         MLogCircle& log = MailFolder::GetLogCircle();
+         if ( !reply.empty() )
+         {
+            log.Add(reply);
+         }
+
+         const String explanation = log.GuessError();
+
+         // give the general error message anyhow
+         String err = m_Protocol == Prot_SMTP ? _("Failed to send the message.")
+                                              : _("Failed to post the article.");
+
+         // and then try to give more details about what happened
+         if ( !explanation.empty() )
+         {
+            err << _T("\n\n") << explanation;
+         }
+         else if ( !reply.empty() )
+         {
+            // no explanation, at least show the server error message
+            err << _T("\n\n") << _("Server error: ") << reply;
+         }
 
-         MailFolder::GetLogCircle().GuessError();
+         ERRORMESSAGE((_T("%s"), err.c_str()));
       }
    }
    else // error in opening stream
    {
-      MailFolder::GetLogCircle().GuessError();
+      String err;
+      err.Printf(_("Cannot open connection to the %s server '%s'."),
+               m_Protocol == Prot_SMTP ? "SMTP" : "NNTP",
+                 m_ServerHost.c_str());
+
+      String explanation = MailFolder::GetLogCircle().GuessError();
+      if ( !explanation.empty() )
+      {
+         err << _T("\n\n") << explanation;
+      }
 
-      ERRORMESSAGE((_("Cannot open connection to the server '%s'."),
-                    m_ServerHost.c_str()));
+      ERRORMESSAGE((_T("%s"), err.c_str()));
 
       success = false;



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to