Author Topic: [Plugin] Read message on button click  (Read 5400 times)

Offline Martin Schrimpf

  • Newbie
  • *
  • Posts: 3
[Plugin] Read message on button click
« on: August 16, 2012, 05:51:44 AM »
Hello,

i am currently writing a Plugin for Roundcube which has the purpose to generate a PDF from a message.
But i can't figure out how to read the (currently opened) message on button click.

Google doesn't really help - i tried to solve the problem by reading the code of other plugins but didn't come to a solution yet.

I hope, somebody can help.

Best Regards,
Martin

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: [Plugin] Read message on button click
« Reply #1 on: August 16, 2012, 08:09:36 PM »
I think there is two ways to do this:
1. Start another imap request and get the message again.
2. Get the message using JS and send it back to the plugin.

Offline Martin Schrimpf

  • Newbie
  • *
  • Posts: 3
Re: [Plugin] Read message on button click
« Reply #2 on: August 17, 2012, 03:39:00 AM »
Hi SKaero,

thank you for your reply!

The second way with JS you mentioned would be the preferred one here.
Unfortunately, i cannot find a way to read the message with JS (at least not in a comfortable way, we only found a way to read the message from the site-html) - could you give me some further help?

Best Regards,
Martin

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: [Plugin] Read message on button click
« Reply #3 on: August 17, 2012, 06:49:03 AM »
Well with the JS method you would have to get the formatted html version, but isn't that what you would want to make the pdf? How do you want the message formatted?

Offline Martin Schrimpf

  • Newbie
  • *
  • Posts: 3
Re: [Plugin] Read message on button click
« Reply #4 on: August 24, 2012, 03:31:52 AM »
We solved it by getting the raw body with

rcmail
->storage->get_raw_body()

and converting the result to HTML with a MailParser.

Thank you for your help!

Offline Volnhar

  • Jr. Member
  • **
  • Posts: 39
    • http://www.andrew.stoker.name/wp
Re: [Plugin] Read message on button click
« Reply #5 on: August 30, 2012, 09:37:58 PM »
Hi,

I would be interested in having a look at this plugin as well. Sounds really handy when you want to get a pdf copy of your messages.