01: package com.quadcap.pop3.client;
02:
03: /*
04: * Copyright 1997 - 2003 by Stan Bailes and Quadcap Software.
05: *
06: **/
07:
08: import java.io.IOException;
09: import java.io.InputStream;
10:
11: import java.util.Map;
12: import java.util.Properties;
13:
14: /**
15: * Interface for message delivery.
16: *
17: * @author Stan Bailes
18: */
19: public class HookShell implements MessageHook {
20: /**
21: * Initialize the hook with its property set
22: */
23: public void init(Properties p) {
24: }
25:
26: /**
27: * Return <code>true</code> if the call to
28: * <code>boolean passHeaders(Map headers)</code> will always return
29: * true, so the message receiver can avoid calling it.
30: */
31: public boolean passAllHeaders() {
32: return false;
33: }
34:
35: /**
36: * A hook first gets called with the parsed headers from the message.
37: * If the hook returns 'true' to this call, it will be called again
38: * to process the body using <code>sendMessage()</code>, below.
39: */
40: public boolean passHeaders(Map headers) {
41: return "shell".equals(headers.get("X-MessageHook"));
42: }
43:
44: /**
45: * The hook is called to process the entire message (including headers)
46: * as an octet stream.
47: *
48: * @return <code>false</code> if the message is to be retained in
49: * the store, <code>true</code> to delete it.
50: */
51: public boolean passMessage(InputStream is) throws IOException {
52: return false;
53: }
54: }
|