Closed
Bug 1043819
Opened 10 years ago
Closed 10 years ago
GetMsgFolderFromUri() does not work in version 31.0
Categories
(Thunderbird :: Mail Window Front End, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: manuel.schmitt, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release) Build ID: 20140605174243 Steps to reproduce: I tried to use the GetMsgFolderFromUri() function as follows var targetUri = "imap://foo@bar/INBOX/dummy"; var targetFolder = GetMsgFolderFromUri(targetUri); MsgMoveMessage(targetFolder); Actual results: Before version 31.0 this did work perfectly, but now it seems to fail. While ding some debugging like var targetUri = "imap://foo@bar/INBOX/dummy"; alert(targetUri); var targetFolder = GetMsgFolderFromUri(targetUri); alert(targetFolder); MsgMoveMessage(targetFolder); only one alert message pops up. Expected results: As to the original "script" the currently selected message should be moved to the given imap folder.
![]() |
||
Comment 1•10 years ago
|
||
The function is gone in Thunderbird 31, see bug 889022. Import the MailUtils JavaScript Module with |Components.utils.import("resource:///modules/MailUtils.js");| abnd replace the calls of |GetMsgFolderFromUri| with |MailUtils.getFolderForURI|.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Comment 2•10 years ago
|
||
(In reply to Archaeopteryx [:aryx] from comment #1) > The function is gone in Thunderbird 31, see bug 889022. Import the MailUtils > JavaScript Module with > |Components.utils.import("resource:///modules/MailUtils.js");| abnd replace > the calls of |GetMsgFolderFromUri| with |MailUtils.getFolderForURI|. Uhh! thanks, I didn't know that. Backwards compatibility is a b!tch. since which version is the alternative method (MailUtils.getFolderForURI) supported? I have to make sure it works in SeaMonkey and Postbox as well...
Comment 3•10 years ago
|
||
(In reply to Axel Grude [:realRaven] from comment #2) > (In reply to Archaeopteryx [:aryx] from comment #1) > > The function is gone in Thunderbird 31, see bug 889022. Import the MailUtils > > JavaScript Module with > > |Components.utils.import("resource:///modules/MailUtils.js");| abnd replace > > the calls of |GetMsgFolderFromUri| with |MailUtils.getFolderForURI|. > > Uhh! thanks, I didn't know that. Backwards compatibility is a b!tch. since > which version is the alternative method (MailUtils.getFolderForURI) > supported? I have to make sure it works in SeaMonkey and Postbox as well... Well actually, I knew it at one stage and forgot about it again. Wrapper code already written a long time ago, that's why: Here is the boilerplate code I am using - which works across Postbox / SeaMonkey and Thunderbird getMsgFolderFromUri: function(uri, checkFolderAttributes) { let msgfolder = null; if (typeof MailUtils != 'undefined' && MailUtils.getFolderForURI) { return MailUtils.getFolderForURI(uri, checkFolderAttributes); } try { let resource = GetResourceFromUri(uri); msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder); if (checkFolderAttributes) { if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) { msgfolder = null; } } } catch (ex) { //dump("failed to get the folder resource\n"); } return msgfolder; } ,
Updated•10 years ago
|
Component: Untriaged → Mail Window Front End
![]() |
||
Comment 4•10 years ago
|
||
(In reply to Axel Grude [:realRaven] from comment #2) > Uhh! thanks, I didn't know that. Backwards compatibility is a b!tch. since > which version is the alternative method (MailUtils.getFolderForURI) > supported? I have to make sure it works in SeaMonkey and Postbox as well... It landed in bug 467768 in mid-2009, so likely it's supported in Thunderbird 3.1 and newer.
Comment 5•9 years ago
|
||
(In reply to Axel Grude [:realRaven] from comment #3) For anyone using Axel's code: As Archaeopteryx reminds us, we must first import MailUtils: if ("undefined" == typeof(MailUtils)) { try { Components.utils.import("resource:///modules/MailUtils.js"); } catch(ex) { /* error handling if MailUtils is missing */ } };
You need to log in
before you can comment on or make changes to this bug.
Description
•