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 * @return A BananaMessage or null if the given id can't be retreived
46 public function &getMessage($id);
48 /** Return the sources of a message
49 * @param id Id of the emssage (can be either an Message-id or a message index)
50 * @return The sources of the message (or null)
52 public function getMessageSource($id);
54 /** Return the indexes of the messages presents in the Box
55 * @return Array(number of messages, MSGNUM of the first message, MSGNUM of the last message)
57 public function getIndexes();
59 /** Return the message headers (in BananaMessage) for messages from firstid to lastid
60 * @return Array(id => array(headername => headervalue))
62 public function &getMessageHeaders($firstid, $lastid, array $msg_headers = array());
64 /** Update the spool to add protocole specifics data
65 * @param Array(id => message headers)
67 public function updateSpool(array &$messages);
69 /** Return the indexes of the new messages since the give date
70 * @return Array(MSGNUM of new messages)
72 public function getNewIndexes($since);
74 /** Return wether or not the protocole can be used to add new messages
76 public function canSend();
78 /** Return wether or not the protocole allow message deletion
80 public function canCancel();
82 /** Return the list of requested headers
83 * @return Array('header1', 'header2', ...) with the key 'dest' for the destination header
84 * and 'reply' for the reply header, eg:
85 * * for a mail: Array('From', 'Subject', 'dest' => 'To', 'Cc', 'Bcc', 'reply' => 'Reply-To')
86 * * for a post: Array('From', 'Subject', 'dest' => 'Newsgroups', 'reply' => 'Followup-To')
88 public function requestedHeaders();
91 * @return true if it was successfull
93 public function send(BananaMessage
&$message);
96 * @return true if it was successfull
98 public function cancel(BananaMessage
&$message);
100 /** Return the protocole name
102 public function name();
104 /** Return the spool filename to use for the given box
105 * @param box STRING boxname
107 public function filename();
110 // vim:set et sw=4 sts=4 ts=4 enc=utf-8: