* put the vcard we just read back in.
authorWilfried Göesgens <willi@citadel.org>
Wed, 13 Jun 2007 21:16:15 +0000 (21:16 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 13 Jun 2007 21:16:15 +0000 (21:16 +0000)
ctdlphp/ctdlprotocol.php
ctdlphp/myinfo.php

index 4b921f223580f36b81a5d05354cf3ca07ba76525..7a332052b4ca57faa305968aa9e239900c26b3c5 100644 (file)
@@ -8,6 +8,10 @@
 include "config_ctdlclient.php";
 
 
+define("FMT_CITADEL", 0);
+define("FMT_FIXED", 1);
+define("FMT_RFC822", 4);
+
 //--------------------------------------------------------------------------------
 //   internal functions for server communication
 //--------------------------------------------------------------------------------
@@ -718,5 +722,76 @@ function download_attachment($msgnum, $attindex)
 }
 
 
+function enter_message_0($msgHdr, $contentType, $data)
+{
+       $send = array();
+
+       if (isset($msgHdr['newusermail']))
+               array_unshift($send, $msgHdr['newusermail']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['supplied_euid']))
+               array_unshift($send, $msgHdr['supplied_euid']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['bcc']))
+               array_unshift($send, $msgHdr['bcc']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['cc']))
+               array_unshift($send, $msgHdr['cc']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['do_confirm']))
+               array_unshift($send, $msgHdr['do_confirm']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['newusername']))
+               array_unshift($send, $msgHdr['newusername']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['subject']))
+               array_unshift($send, $msgHdr['subject']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['format_type']))
+               array_unshift($send, $msgHdr['format_type']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['anon_flag']))
+               array_unshift($send, $msgHdr['anon_flag']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['recp']))
+               array_unshift($send, $msgHdr['recp']);
+       else
+               array_unshift($send, "");
+
+       if (isset($msgHdr['post']))
+               array_unshift($send, $msgHdr['post']);
+       else
+               array_unshift($send, "");
+
+       $params = implode('|', $send);
+       serv_puts("ENT0 ".$params);
+
+       $reply=serv_gets();
+       if (substr($reply, 0, 1) != 4)
+               return array(false, array(), array());
+       serv_puts("Content-type: ".$contentType);
+       serv_puts("");
+       serv_puts($data."\r\n");
+       serv_puts("000");
+}
+
 
 ?>
index 41007e27ea04a111ca3f27b54d1612f3a93532df..5f0ebf40ee64fbbc586530d094c1d966d2d17cb2 100644 (file)
@@ -1,37 +1,42 @@
 <?PHP
 $vcard="";
-       include "ctdlheader.php";
-       bbs_page_header();
-
-       echo    "This is an example of the use of " .
-               "ctdl_get_registration_info() to display " .
-               "your personal data.<BR><BR>\n" ;
-
-       echo    "<TABLE border=1>" .
-               "<TR>" .
-               "<TD><B>User</B></TD>" .
-               "<TD><B>Room</B></TD>" .
-               "<TD><B>Host</B></TD>" .
-               "</TR>" ;
-
-        ctdl_goto("My Citadel Config");
-       list($num_msgs, $response, $msgs) = ctdl_msgs("", "");
-
-       echo "num_msgs: " . $num_msgs . "<BR>\n" ;
-       echo "response: " . htmlspecialchars($response) . "<BR>\n" ;
-
-        if ($num_msgs > 0) foreach ($msgs as $msgnum) {
-               print_r($msgnum);
-               $result = get_message_partlist($msgnum);
-               if (is_array($result) &&
-                   ($result[4]=="text/x-vcard"))
-               {
-                       list($size, $vcard) = download_attachment($msgnum, $result[2]);
-               }
+include "ctdlheader.php";
+bbs_page_header();
+
+echo   "This is an example of the use of " .
+"ctdl_get_registration_info() to display " .
+"your personal data.<BR><BR>\n" ;
+
+echo   "<TABLE border=1>" .
+"<TR>" .
+"<TD><B>User</B></TD>" .
+"<TD><B>Room</B></TD>" .
+"<TD><B>Host</B></TD>" .
+"</TR>" ;
+
+ctdl_goto("My Citadel Config");
+list($num_msgs, $response, $msgs) = ctdl_msgs("", "");
+
+echo "num_msgs: " . $num_msgs . "<BR>\n" ;
+echo "response: " . htmlspecialchars($response) . "<BR>\n" ;
+
+if ($num_msgs > 0) foreach ($msgs as $msgnum) {
+       print_r($msgnum);
+       $result = get_message_partlist($msgnum);
+       if (is_array($result) &&
+           ($result[4]=="text/x-vcard"))
+       {
+               list($size, $vcard) = download_attachment($msgnum, $result[2]);
        }
+}
 
-       echo "</TABLE>\n <pre>\n".$vcard."</pre>";
+echo "</TABLE>\n <pre>\n".$vcard."</pre>";
 
+echo "putting it back in!";
+$entearray=array();
+$entarray['post']=1;
+$entarray['format_type']=FMT_RFC822;
+enter_message_0($entarray, "text/x-vcard; charset=UTF-8", $vcard);
 ?>
 
 <BR>Sample links<BR>