get header from messageID

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

get header from messageID

opto
I need to get a message from a messageID (or gloda.headerMessageId).

I see that I can get it from the DB: getMsgHdrForMessageID().

I can get the DB from a folder by getMsgDatabase(in nsIMsgWindow msgWindow);

What do I use for msgWindow? I thought there is only one DB, and I could do something like:

gFolderDisplay.displayedFolder.getMsgDatabase( ????).getMsgHdrForMessageID(myID);

any help is appreciated,

Klaus
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: get header from messageID

karel.gudera
Dne neděle 19. března 2017 20:30:00 UTC+1 opto napsal(a):

> I need to get a message from a messageID (or gloda.headerMessageId).
>
> I see that I can get it from the DB: getMsgHdrForMessageID().
>
> I can get the DB from a folder by getMsgDatabase(in nsIMsgWindow msgWindow);
>
> What do I use for msgWindow? I thought there is only one DB, and I could do something like:
>
> gFolderDisplay.displayedFolder.getMsgDatabase( ????).getMsgHdrForMessageID(myID);
>
> any help is appreciated,
>
> Klaus

nsIMsgFolder has msgDatabase atribute. You don't need to worry about msgWindow.

  /**
   * Gets the message database for the folder.
   *
   * Note that if the database is out of date, the implementation MAY choose to
   * throw an error. For a handle to the database which MAY NOT throw an error,
   * one can use getDBFolderInfoAndDB.
   *
   * The attribute can also be set to another database or to null to force the
   * folder to reopen the same database when it is needed again.
   *
   * @exception NS_MSG_ERROR_FOLDER_SUMMARY_MISSING If the database does not
   *                         exist.
   * @exception NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE If the database contains
   *                         out of date information.
   * @see nsIMsgFolder::getDBFolderInfoAndDB.
   */
attribute nsIMsgDatabase msgDatabase;

Hope thats what you looking for.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: get header from messageID

opto
many thanks!!

I am just thinking: what happens if there are several headers with the same messageID?

Like if I copy the email to another folder, I have two messages with same messageid. But I should have two headers, because msgHdr.folder.name would be different for the two versions of the message.

many thanks,

Klaus
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: get header from messageID

karel.gudera
Dne neděle 19. března 2017 23:02:29 UTC+1 opto napsal(a):
> many thanks!!
>
> I am just thinking: what happens if there are several headers with the same messageID?
>
> Like if I copy the email to another folder, I have two messages with same messageid. But I should have two headers, because msgHdr.folder.name would be different for the two versions of the message.
>
> many thanks,
>
> Klaus

Well you will have the original msgDBHdr in folder1 and the second msgDBHdr will be in folder2 both with the same messageId. Every folder has its own database of msgDBHdrs. Nothing special about this. If there were two messages with the same ID in one folder then getMessageById would return the first occurance I suppose.
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird