Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to move a huge amount of messages

9 views
Skip to first unread message

Alex Furman

unread,
Nov 23, 2006, 11:23:55 AM11/23/06
to
Hi, I have a problem again :(
This time I need to move huge amount of messages from one folder to
another. Yes, I know if you want just move messages it's quite simple
and looks like:
[code]
function moveMessageArray(srcFolder, dstFolder, msgArray)
{
var msgService =
Components.classes["@mozilla.org/messenger/messagecopyservice;1"].createInstance(Components.interfaces.nsIMsgCopyService);
msgService.CopyMessages( srcFolder, msgArray, dstFolder, true,
mailMoverListener, null, false);
}

var mailMoverListener =
{
OnStopCopy: function( status ){},
GetMessageId : function(messageId) {},
OnProgress : function(progress, progressMax) {},
OnStartCopy : function() {},
SetMessageKey : function(key) {},
}
[/code]
But in my case I want to have a dialog with a progressbar that displays
number of messages is moved and the button that can be used for stop
this process. I can divide
this huge amount of massages for a small parts (50-100 messages) each
and run moveMessageArray function for each of them. And every time I
finish to move one of this small parts of messages I can calculate and
modify the progressbar. In this case I need to know when messages
movement will be finished, my first idea was to use OnStopCopy method
but it seems this method don't work like I expect. Currently I don't
know what should I do, any help will be great.

kenoa

unread,
Nov 24, 2006, 5:40:35 AM11/24/06
to
> movement will be finished, my first idea was to use OnStopCopy method
> but it seems this method don't work like I expect. Currently I don't
> know what should I do, any help will be great.

What's wrong with this idea? In my extension, I'm moving messages one
by one and it works great when listening on the OnStopCopy event. Maybe
you can even use the OnProgress event?

Alex Furman

unread,
Nov 27, 2006, 8:08:35 AM11/27/06
to

kenoa wrote:

> What's wrong with this idea? In my extension, I'm moving messages one
> by one and it works great when listening on the OnStopCopy event. Maybe
> you can even use the OnProgress event?

I've found some errors in my code and now it works. But when I try to
move messages one by one it works VERY slow. Probably I did something
wrong again, but I don't know what. If you have good working source
code that moves messages one by one, would you send me it?

0 new messages