[UI] if "mail.default_sendlater_uri" pref point to a non-existant folder we get a bogus alert.

VERIFIED FIXED in M12

Status

SeaMonkey
MailNews: Message Display
P3
normal
VERIFIED FIXED
19 years ago
14 years ago

People

(Reporter: (not reading, please use seth@sspitzer.org instead), Assigned: (not reading, please use seth@sspitzer.org instead))

Tracking

Firefox Tracking Flags

(Not tracked)

Details

see related bug #18620

to test,
set up 4.x to use pop
migrate to 5.0, not you won't have a "Local Mail" account

set this pref
user_pref("mail.default_sendlater_uri", "mailbox://nobody@Local Mail/Unsent
Messages");

do a send later, and you get his alert error message:

"StringID(hex)=8000ffff"

in nsMsgCopy.cpp, we call

rv = rdf->GetResource(aFolderURI, getter_AddRefs(resource));

if the server doesn't exist, this should fail and rv != NS_OK
it fails, but rv == NS_OK.

the problem is in mozilla/mailnews/base/util/nsMsgFolder.cpp

the following patch fixes the problem, but I want to discuss with putterman
first.

Index: util/nsMsgFolder.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/base/util/nsMsgFolder.cpp,v
retrieving revision 1.107
diff -p -r1.107 nsMsgFolder.cpp
*** nsMsgFolder.cpp     1999/11/06 03:29:24     1.107
--- nsMsgFolder.cpp     1999/11/10 00:24:21
*************** nsMsgFolder::Init(const char* aURI)
*** 181,187 ****
    m_server = server;
    NS_IF_RELEASE(server);

!   NS_ASSERTION(m_server, "Failed to get server..");
    return NS_OK;
  }

--- 181,194 ----
    m_server = server;
    NS_IF_RELEASE(server);

!   // m_server might be null.
!   // for example, if someone does a GetResource()
!   // on a folder on a server that did exist.
!   // this would happen.
!   if (!m_server) {
!       return NS_ERROR_FAILURE;
!   }
!
    return NS_OK;
  }
ignore that patch.  I got a better fix.  patch coming soon.
here's the right patch.

waiting to talk to putterman


Index: nsMsgFolder.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/base/util/nsMsgFolder.cpp,v
retrieving revision 1.108
diff -p -r1.108 nsMsgFolder.cpp
*** nsMsgFolder.cpp     1999/11/10 00:41:52     1.108
--- nsMsgFolder.cpp     1999/11/10 00:48:27
*************** nsMsgFolder::Init(const char* aURI)
*** 177,182 ****
--- 177,184 ----
                                    hostName,
                                    GetIncomingServerType(),
                                    &server);
+   if (NS_FAILED(rv)) return rv;
+
    // keep weak ref to server
    m_server = server;
    NS_IF_RELEASE(server);

Updated

19 years ago
QA Contact: lchiang → laurel
Status: NEW → ASSIGNED
Target Milestone: M12
after talking to putterman and alecf, i've got the right fix for this now,

here's the patch.  I'll check this in after I get it reviewed and the tree
opens.

I'll also add a comment to nsMsgFolder::Init() explaining why we
don't return if FindServer() fails.

Index: nsMsgCopy.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/compose/src/nsMsgCopy.cpp,v
retrieving revision 1.32
diff -p -r1.32 nsMsgCopy.cpp
*** nsMsgCopy.cpp       1999/11/10 00:12:37     1.32
--- nsMsgCopy.cpp       1999/11/10 22:22:56
*************** LocateMessageFolder(nsIMsgIdentity   *us
*** 313,318 ****
--- 313,328 ----
      nsCOMPtr <nsIMsgFolder> folderResource;
      folderResource = do_QueryInterface(resource, &rv);
      if (NS_SUCCEEDED(rv) && folderResource) {
+       // check that folder really exists by seeing if it has a server
+       // GetResource() will return NS_OK and create the resource, but it may n
ot
+       // be a "real" folder
+       // we need to return a failure code, so the user gets the alert that
+       // their pref was bogus
+       nsCOMPtr <nsIMsgIncomingServer> server;
+       rv = folderResource->GetServer(getter_AddRefs(server));
+       if (NS_FAILED(rv)) return rv;
+       if (!server) return NS_ERROR_FAILURE;
+
        *msgFolder = folderResource;
        NS_ADDREF(*msgFolder);
        return NS_OK;
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
fixed.

to test, migrate a 4.x pop account, start up mailnews, and verify
that send later works.

then quit 5.0, change the "mail.default_sendlater_uri" pref to be
"mailbox://nobody@Local Mail/Unsent Messages"


start up 5.0, do a send later, because that server / folder doesn't exist, you
will get a nice, helpful alert, and not that "StringID=..." junk.

Comment 5

19 years ago
OK using 12-07-08m12 commercial build on NT 4.0. Message which comes up is:
Unable to save your message in order to send it later. Please verify that your
Mail preferences are correct and try again.

Comment 6

19 years ago
OK using 12-08-08 m12 commercial build on Linux 6.0

Updated

19 years ago
Status: RESOLVED → VERIFIED

Comment 7

19 years ago
OK using 12-08-08m12 commercial build on Mac OS 8.5.1
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.