2 /********************************************************************************
3 * banana/protocoleinterface.inc.php : interface for box access
4 * ------------------------
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
10 require_once dirname(__FILE__
) . '/banana.inc.php';
12 interface BananaProtocoleInterface
14 /** Build a protocole handler plugged on the given box
16 public function __construct();
18 /** Indicate if the Protocole handler has been succesfully built
20 public function isValid();
22 /** Indicate last error n°
24 public function lastErrNo();
26 /** Indicate last error text
28 public function lastError();
30 /** Return the description of the current box
32 public function getDescription();
34 /** Return the list of the boxes
35 * @param mode Kind of boxes to list
36 * @param since date of last check (for new boxes and new messages)
37 * @param withstats Indicated whether msgnum and unread must be set in the result
38 * @return Array(boxname => array(desc => boxdescripton, msgnum => number of message, unread =>number of unread messages)
40 public function getBoxList($mode = Banana
::BOXES_ALL
, $since = 0, $withstats = false
);
43 * @param id Id of the emssage (can be either an Message-id or a message index)
44 * @param msg_headers Headers to process
45 * @param is_msgid If is set, $id is en Message-Id
46 * @return A BananaMessage or null if the given id can't be retreived
48 public function getMessage($id, array $msg_headers = array(), $is_msgid = false
);
50 /** Return the indexes of the messages presents in the Box
51 * @return Array(number of messages, MSGNUM of the first message, MSGNUM of the last message)
53 public function getIndexes();
55 /** Return the message headers (in BananaMessage) for messages from firstid to lastid
56 * @return Array(id => array(headername => headervalue))
58 public function &getMessageHeaders($firstid, $lastid, array $msg_headers = array());
60 /** Update the spool to add protocole specifics data
61 * @param Array(id => message headers)
63 public function updateSpool(array &$messages);
65 /** Return the indexes of the new messages since the give date
66 * @return Array(MSGNUM of new messages)
68 public function getNewIndexes($since);
70 /** Return wether or not the protocole can be used to add new messages
72 public function canSend();
74 /** Return wether or not the protocole allow message deletion
76 public function canCancel();
78 /** Return the list of requested headers
79 * @return Array('header1', 'header2', ...) with the key 'dest' for the destination header
80 * and 'reply' for the reply header, eg:
81 * * for a mail: Array('From', 'Subject', 'dest' => 'To', 'Cc', 'Bcc', 'reply' => 'Reply-To')
82 * * for a post: Array('From', 'Subject', 'dest' => 'Newsgroups', 'reply' => 'Followup-To')
84 public function requestedHeaders();
87 * @return true if it was successfull
89 public function send(BananaMessage
&$message);
92 * @return true if it was successfull
94 public function cancel(BananaMessage
&$message);
96 /** Return the protocole name
98 public function name();
100 /** Return the spool filename to use for the given box
101 * @param box STRING boxname
103 public function filename();
106 // vim:set et sw=4 sts=4 ts=4: