debug code, new autoreply try
[old-projects.git] / philter / philter / include / plugin_autoreply.inc.php
CommitLineData
dd8de1ec
PH
1<?php
2/********************************************************************************
3* include/plugin_autoreply.inc.php : The class for auto-replies
4* --------------------------------
5*
6* This file is part of the philter distribution
7* Copyright: See COPYING files that comes with this distribution
8********************************************************************************/
9
10class AutoReplyPlugin extends ActionPlugin {
11 function FwdPlugin() { $this->ActionPlugin(); }
12 function rtti() { return 2; }
5ae3e923 13 function name() { return _i18n('2_auto_reply'); }
dd8de1ec
PH
14
15 function to_js() {
99dcf940
PH
16 return <<<EOF
17function(Node, data) {
18 var i,j;
19 var ta = document.createElement('textarea');
20 ta.setAttribute('name', Node.name+'[1]');
21 ta.setAttribute('style', 'width:100%;');
22 ta.setAttribute('rows', '10');
23 if(data[1]) ta.value = data[1];
24
25 Node.appendChild(document.createElement('br'));
26 Node.appendChild(ta);
27}
28EOF;
dd8de1ec
PH
29 return $res;
30 }
99dcf940
PH
31
32 function to_string($_data) {
33 $uid = get_user_id();
5199c520
PH
34
35 $text = addslashes($_data[1]);
36 $text = str_replace('$', '\$', $text);
37 $lines = split("\n", $text);
5534b9a9
PH
38
39 $res = " if(! /^X-Philter-Autoreply: $uid$/)\n" # TODO : et ne vient pas da démon
40 . " {\n"
5199c520
PH
41 . " cc \"| reformail -rt -A'X-Philter-Autoreply: $uid' -A'X-Precedence: junk' \\\n"
42 . " | ( cat - ; echo '';";
43 foreach($lines as $line)
44 $res .= " echo '".chop($line)."';";
45 $res.= " \\\n"
46 . " ) | $"."SENDMAIL -oi -t\"\n";
5534b9a9 47 return $res." }\n";
99dcf940 48 }
dd8de1ec
PH
49}
50
51/********************************************************************************
52* $Id$
53* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
54********************************************************************************/
55?>