92f666dcc69f8b36e7d5c8bfda429e2296620503
3 /* functions for info plugin
4 * Copyright (c) 1999-2002 The SquirrelMail Project Team
5 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 * Here are two functions for the info plugin
8 * The first gets the CAPABILITY response from your IMAP server.
9 * The second runs the passed IMAP test and returns the results
10 * The third prints the results of the IMAP command
12 * by: Jason Munro jason@stdbev.com
15 function get_caps($imap_stream) {
16 $sid = sqimap_session_id();
17 $query = "$sid CAPABILITY\r\n";
18 fputs ($imap_stream, $query);
19 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
23 function imap_test($imap_stream, $string) {
24 global $default_charset;
26 $responses = array ();
27 $sid = sqimap_session_id();
29 $query = "$sid ".trim($string)."\r\n";
30 print "<TR><TD>".$query."</TD></TR>";
31 fputs ($imap_stream, $query);
32 $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message);
33 array_push($response, $message);
37 function print_response($response) {
38 foreach($response as $index=>$value) {
39 if (is_array($value)) {
40 print_response($value);
43 $value = preg_replace("/</", "<", $value);
44 $value = preg_replace("/>/", ">", $value);
45 print $value."<BR>\n";