1: <?php
2: /**
3: * @package Kolab_Filter
4: */
5:
6: /**
7: * Echos a mail for debugging.
8: *
9: * Copyright 2008 Klarälvdalens Datakonsult AB
10: *
11: * See the enclosed file COPYING for license information (LGPL). If you
12: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
13: *
14: * @author Gunnar Wrobel <wrobel@pardus.de>
15: * @package Kolab_Filter
16: */
17: class Horde_Kolab_Filter_Transport_echo extends Horde_Kolab_Filter_Transport
18: {
19: /**
20: * Create the transport handler.
21: *
22: * @return StdOutWrapper Wraps STDOUT as transport
23: */
24: function _createTransport()
25: {
26: $transport = new EchoWrapper();
27: return $transport;
28: }
29: }
30:
31: /**
32: * Defines an echo wrapper that provides functionality comparable to
33: * the Net/*MTP.php classes.
34: *
35: * Copyright 2008 Klarälvdalens Datakonsult AB
36: *
37: * See the enclosed file COPYING for license information (LGPL). If you
38: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
39: *
40: * @author Gunnar Wrobel <wrobel@pardus.de>
41: * @package Kolab_Filter
42: */
43: class EchoWrapper
44: {
45: /**
46: * Pretends to connect to STDOUT.
47: *
48: * @return boolean Always true.
49: */
50: function connect()
51: {
52: return true;
53: }
54:
55: /**
56: * Pretends to disconnect from STDOUT.
57: *
58: * @return boolean Always true.
59: */
60: function disconnect()
61: {
62: return true;
63: }
64:
65: /**
66: * Set the sender.
67: *
68: * @return mixed Result from writing the sender to STDOUT.
69: */
70: function mailFrom($sender)
71: {
72: echo sprintf("Mail from sender: %s\r\n", $sender);
73: return true;
74: }
75:
76: /**
77: * Set the recipient.
78: *
79: * @return mixed Result from writing the recipient to STDOUT.
80: */
81: function rcptTo($recipient)
82: {
83: echo sprintf("Mail to recipient: %s\r\n", $recipient);
84: return true;
85: }
86:
87: /**
88: * Pretends to send commands to STDOUT.
89: *
90: * @param string $cmd The command.
91: *
92: * @return boolean Always true.
93: */
94: function _put($cmd)
95: {
96: return true;
97: }
98:
99: /**
100: * Pretends to handle STDOUT responses.
101: *
102: * @param string $code The response to parse.
103: *
104: * @return boolean Always true.
105: */
106: function _parseResponse($code)
107: {
108: return true;
109: }
110:
111: /**
112: * Echo data.
113: *
114: * @param string $data The data to write.
115: *
116: * @return mixed Result from writing data to STDOUT.
117: */
118: function _send($data)
119: {
120: echo $data;
121: return true;
122: }
123: }
124: