Closed Bug 25819 Opened 25 years ago Closed 25 years ago

nsIMsgMessageService.CopyMessage doesn't call stream listener for news messages

Categories

(MailNews Core :: Backend, defect, P3)

x86
Windows 98
defect

Tracking

(Not tracked)

VERIFIED WORKSFORME

People

(Reporter: cbegle, Assigned: mscott)

Details

(Whiteboard: [PDT-])

Attachments

(2 files)

M13, Win98.

I would like to be able to select a menu item that calls a script that parses 
the text of a news message.

I have a script allows me to parse the text of a mailbox_message.  However, the 
stream listener's OnDataAvailable never gets called if I try a slightly 
modified script on a news message.  (The only difference is that the 
messageService is an instance of 
"component://netscape/messenger/messageservice;type=news_message"
instead of 
"component://netscape/messenger/messageservice;type=mailbox_message"

I'll attach the whole function.

Any clues?
the way i'm running this script is by overriding one of the event handlers 
called by menu items in the mailnews window's Message menu.
re-assigning to me.
Assignee: phil → mscott
I rebuilt this morning, and my stream listener is now being notified.  
Excellent!
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → WORKSFORME
spoke too soon, i tried it against what was an old build.  arg, too many builds 
on my machine.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
scott, do you think this will happen for beta1?  If not, I am going to have to 
come up with a different solution for dealing with newsgroup feedback.
Keywords: beta1
Putting on PDT- radar for beta1.  This is not a stopper for beta.
Whiteboard: [PDT-]
when using news_message, do you get a message service back at all? or does that
throw an exception in JS?

If you do get one back. are you getting a on start request call? Just no on data
available?


I did notice one thing...I'm not sure if JS handles this or not...but your
variable for the news uri is defined inside of a block:
if ()
{
var uri = get the uri for the selection in the thread pane
}

then outside of that block you reference the variable uri in order to pass it
into the copy service. Does JS remember the variable outside of the scope it was
defined in?

just curious.

Oh one more question, when you run this test script for news, what does the dump
statement for the news uri look like?
Hey, Scott.  I updated and will attach the new version of the script.  The only 
real difference is that I moved that uri declaration out of the if block, and 
added some stuff to the dump statements so you know where that output comes 
from.
 
What class has an OnStartRequest method?  I didn't think I needed anything else.
I implemented nsIURLListener (with methods OnStartRunning/OnStopRunning) and an 
nsIStreamListener (OnDataAvailable).  OnDataAvailable never gets called.

I am pretty sure that CopyMessage succeeds; no JavaScript exception is thrown, 
and the nsIURLListener start/stop running methods are called.  Odd: looks like 
the OnStartRunning method is called twice.

Here's the console output.  Note that MsgURLListener's OnStartRunning method is 
called twice, but the MsgStreamListener's OnDataAvailable method is not called 
at all.  I'll attach the script that generated this output.

EventHandler: currentMessage id:     
news_message://news.mozilla.org/netscape.test#3104
MsgURLListener: start running /389612C6.AF40B4CD@mozilla.org
EventHandler: CopyMessage completed without error.
EventHandler: done handling
MsgURLListener: start running /389612C6.AF40B4CD@mozilla.org
MsgURLListener: stopped running /389612C6.AF40B4CD@mozilla.org:2153185328
Document: Done (1.125 secs)

(Note: if i substitute this line of the script:
    var messageService = Components.classes[
        "component://netscape/messenger/messageservice;type=news_message"]
        .getService();

with this:
    var messageService = Components.classes[
        "component://netscape/messenger/messageservice;type=mailbox_message"]
        .getService();

And run the same script on a mailbox message, the script works fine.  Stream 
Listener gets called and I can get the contents of the message.)
Attached file test case.
Target Milestone: M14
Oh okay this might be in. First I have to confess that I have not tried running
your script yet. But this might be the problem....

nsIStreamListener has a method called OnDataAvailable which you added to your
variable. However, it also inherits from nsIStreamObserver which is the class
that has:
OnStartRequest
OnStopRequest

Your variable needs to support these methods too. Maybe the problem is that
because of this, xpconnect isn't properly creating a nsIStreamListener to get
passed around the back end.

I'd suggest giving that a try.
that's it. thanks, mscott!
it works.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → WORKSFORME
I'll mark as verified then per christine's comment.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: