40a0a69dffa65ae72b01e9d98c7b13f44f434184
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
18 function get_caps($imap_stream) {
19 $sid = sqimap_session_id();
20 $query = "$sid CAPABILITY\r\n";
21 fputs ($imap_stream, $query);
22 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
26 function imap_test($imap_stream, $string) {
27 global $default_charset;
29 $responses = array ();
30 $sid = sqimap_session_id();
32 $query = "$sid ".trim($string)."\r\n";
33 print "<TR><TD>".$query."</TD></TR>";
34 fputs ($imap_stream, $query);
35 $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message);
36 array_push($response, $message);
40 function print_response($response) {
41 foreach($response as $index=>$value) {
42 if (is_array($value)) {
43 print_response($value);
46 $value = preg_replace("/</", "<", $value);
47 $value = preg_replace("/>/", ">", $value);
48 print $value."<BR>\n";