Author Topic: AutoReply Plugin  (Read 4966 times)

Offline roundfan88

  • Newbie
  • *
  • Posts: 2
AutoReply Plugin
« on: July 11, 2008, 04:45:11 PM »
For the AutoReply Plugin does not work with me, I want to create an own plugin, hence fore I have a few questions:

1) I need to know WHERE in the code can I influence what happens if the users clicks the "Get Email Button" on the startpage of RoundCube?

2) How am I able to determine if an email, RoundCube received is read or unread?
    Is there a way to check the database? I didn't find any marker to determine if the email is

Thanks for your time and your answers

greets from Toby

Offline roundfan88

  • Newbie
  • *
  • Posts: 2
AutoReply Plugin
« Reply #1 on: July 12, 2008, 07:37:57 AM »
And I need to determine if a new email has arrived!
Please help me!

Offline Adbie

  • Newbie
  • *
  • Posts: 1
AutoReply Plugin
« Reply #2 on: July 14, 2008, 02:26:13 PM »
req too.
auto filter would also be very useful

Offline bpat1434

  • Administrator
  • Hero Member
  • *****
  • Posts: 673
AutoReply Plugin
« Reply #3 on: July 14, 2008, 11:07:21 PM »
1.) Search the source (or follow the request) through using the "checkmail" as the command.  If you go to /skins/default/templates/mail.html you can see on line 102 the following:

So starting from the top:
  • We see in the template mail.html we have an "checkmail" action.
  • We then look in the JS to see if there's somethign going on with that and we see it's an "enabled_command"
  • The enabled_command means it's useable, so we continue scrolling to see what command it executes: check_for_recent()
  • check_for_recent() then sends a request to index.php using "check-recent" as the action.
  • Index.php receives this request and sees the task as being "mail" and the action as "check-recent" so it includes /program/steps/mail/
So there you have it.  You can impact it by looking in that include file.

2.) According to the javascript there is an "unread" array key which is either true for unread, or false for read.  So I guess you could put in your code:
// The message is "new" or marked as unread
// The message is "old" or marked as read

Now, that's not to take into account that it may in fact be marked for deletion.

Just to double-check me, try using var_dump() on the roundcube message object in /program/steps/mail/ to see what's in it.  Here's an example:
Code: [Select]
object(iilBasicHeader)#17 (29) {
  string(1) "2"
  string(2) "74"
  string(20) "Re: Some Website"
  string(38) &quot;&quot;Some Name.&quot; <>&quot;
  string(21) &quot;;
  string(13) &quot;;
  string(32) &quot;;
  string(37) &quot;Mon, 14 Jul 2008 18:56:19 -0400 (EDT)&quot;
  string(57) &quot;<>&quot;
  string(4) &quot;2523&quot;
  string(4) &quot;8bit&quot;
  string(10) &quot;iso-8859-1&quot;
  string(10) &quot;text/plain&quot;
  array(1) {
    string(4) &quot;Seen&quot;
  string(20) &quot;14-Jul-2008 15:49:13&quot;
  string(34) &quot;<>&quot;

Now, in your code you could do something like:
// $message is our "message" object
// Message is "old" or read
// Message is "new" or unread

Hope that helps.

Offline krasko

  • Newbie
  • *
  • Posts: 2
AutoReply Plugin
« Reply #4 on: July 18, 2008, 06:16:31 AM »
For autoreply is, I think, better to use eg dovecot as deliver and sieve plugin.

It will reply after accept message, but round cube will reply after login to webmail.