[RCD] Getting message ID for selected message/message replied to

A.L.E.C alec at alec.pl
Tue Apr 23 08:16:36 CEST 2013


On 04/22/2013 10:25 PM, Daniel Böhmer wrote:
> Hi,
> 
> this is how I got it partly working:
> 
> #####################################################
> 	function init() {
> 		$this->add_hook('message_headers_output', array($this, 'headers'));
> 	}
> 
> 	function compose($args) {
> 		// retrieve RC's UID
> 		$reply_uid = $args['param']['reply_uid'];
> 		
> 		if($reply_uid) {
> 			// we are going to reply to some e-mail
> 			
> 			// fetch header block
> 			$rcube = rcube::get_instance();
> 			$storage = $rcube->get_storage();
> 			$header = $storage->get_raw_headers($reply_uid);
> 			
> 			/* doesn't work:
> 			$header = $storage->get_message_header($uid);
                                                             ^^^^^^^
should be $reply_uid

> Unfortunately I don't find the value from $args['message-id'] with JavaScript. 
> Where should it be?

As I said, it will be stored in session, because on compose (on reply)
there's a redirect sent. You need to read this value after redirect and
use set_env() to make it available in javascript on compose page.

There's no good hook for this, so I propose to add such code in plugin
init() method:

$rcmail = rcube::get_instance();
if ($rcmail->task == 'mail' && $rcmail->action == 'compose') {
  $ID = get_input_value('_id', RCUBE_INPUT_GET);
  if ($ID && ($COMPOSE = $_SESSION['compose_data_'.$ID])) {
    $rcmail->output->set_env('messageid', $COMPOSE['message-id']);
  }
}

or sth like that.

-- 
Aleksander 'A.L.E.C' Machniak
LAN Management System Developer [http://lms.org.pl]
Roundcube Webmail Developer  [http://roundcube.net]
---------------------------------------------------
PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl


More information about the dev mailing list