Some improvements, and fix spoolgen.php
[banana.git] / banana / protocoleinterface.inc.php
CommitLineData
7027794f 1<?php
2/********************************************************************************
3* banana/protocoleinterface.inc.php : interface for box access
4* ------------------------
5*
6* This file is part of the banana distribution
7* Copyright: See COPYING files that comes with this distribution
8********************************************************************************/
9
10require_once dirname(__FILE__) . '/banana.inc.php';
11
12interface BananaProtocoleInterface
13{
14 /** Build a protocole handler plugged on the given box
15 */
0e25d15d 16 public function __construct();
7027794f 17
18 /** Indicate if the Protocole handler has been succesfully built
19 */
20 public function isValid();
21
22 /** Indicate last error n°
23 */
24 public function lastErrNo();
25
26 /** Indicate last error text
27 */
28 public function lastError();
29
30 /** Return the description of the current box
31 */
32 public function getDescription();
33
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)
39 */
40 public function getBoxList($mode = Banana::BOXES_ALL, $since = 0, $withstats = false);
41
42 /** Return a message
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
47 */
48 public function getMessage($id, array $msg_headers = array(), $is_msgid = false);
49
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)
52 */
53 public function getIndexes();
54
55 /** Return the message headers (in BananaMessage) for messages from firstid to lastid
56 * @return Array(id => array(headername => headervalue))
57 */
58 public function &getMessageHeaders($firstid, $lastid, array $msg_headers = array());
59
60 /** Update the spool to add protocole specifics data
61 * @param Array(id => message headers)
62 */
63 public function updateSpool(array &$messages);
64
65 /** Return the indexes of the new messages since the give date
66 * @return Array(MSGNUM of new messages)
67 */
68 public function getNewIndexes($since);
69
70 /** Return wether or not the protocole can be used to add new messages
71 */
72 public function canSend();
73
74 /** Return wether or not the protocole allow message deletion
75 */
76 public function canCancel();
77
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')
83 */
84 public function requestedHeaders();
85
86 /** Send a message
87 * @return true if it was successfull
88 */
89 public function send(BananaMessage &$message);
90
91 /** Cancel a message
92 * @return true if it was successfull
93 */
94 public function cancel(BananaMessage &$message);
95
96 /** Return the protocole name
97 */
98 public function name();
99}
100
101// vim:set et sw=4 sts=4 ts=4:
102?>