diff python/test.py @ 196:ffd1503a7530

build proper python rpm subpackage
author Carl Byington <carl@five-ten-sg.com>
date Wed, 22 Apr 2009 13:52:18 -0700
parents 320cfcba8058
children 268458c79e9b
line wrap: on
line diff
--- a/python/test.py	Mon Apr 20 19:39:26 2009 -0700
+++ b/python/test.py	Wed Apr 22 13:52:18 2009 -0700
@@ -1,10 +1,21 @@
 import _libpst, sys
 
+print _libpst.__dict__
+exit
+
+ft = _libpst.FILETIME()
+ft.dwLowDateTime = 0
+ft.dwHighDateTime = 1
+
+
 for i in range(1,len(sys.argv)):
     print "try file %s" % (sys.argv[i])
     pst = _libpst.pst(sys.argv[i])
     topf = pst.pst_getTopOfFolders()
 
+    print pst.pst_rfc2425_datetime_format(ft)
+    print pst.pst_rfc2445_datetime_format(ft)
+
     while (topf):
         #print "topf d_id is %d\n" % (topf.d_id)
         item = pst.pst_parse_item(topf, None)
@@ -12,10 +23,19 @@
             if (item.type == 1):
                 em = item.email
                 if (em):
+                    print "default charset %s" % (pst.pst_default_charset(item))
+                    ft = em.arrival_date
+                    if (ft):
+                        print "message arrived at %s" % (pst.pst_rfc2425_datetime_format(ft))
                     if (em.messageid.str):
                         print "message id is |%s|" % (em.messageid.str)
                     subj = item.subject;
-                    if (subj.str):
+                    if (subj and subj.str):
+                        was = subj.is_utf8;
+                        pst.pst_convert_utf8(item, subj)
+                        now = subj.is_utf8;
+                        if (was != now):
+                            print "subject was converted to utf8"
                         print "subject is %s" % (subj.str)
                     body = item.body
                     #if (body.str):
@@ -27,10 +47,24 @@
                         att1 = att.filename1
                         att2 = att.filename2
                         print "attachment file name %s %s" % (att1.str, att2.str)
-                        attdata = pst.pst_attach_to_mem(att)
-                        if (attdata):
-                            print "data size %d" % (len(attdata))
+                        if (0):
+                            attdata = pst.pst_attach_to_mem(att)
+                            if (attdata):
+                                print "data size %d" % (len(attdata))
+                        if (0):
+                            f = pst.ppst_open_file(att2.str, 'w')
+                            if (f):
+                                si = pst.pst_attach_to_file_base64(att, f)
+                                pst.ppst_close_file(f)
+                                print "wrote %d bytes in %s" % (si, att2.str)
+                        if (1):
+                            f = pst.ppst_open_file(att2.str, 'w')
+                            if (f):
+                                si = pst.pst_attach_to_file(att, f)
+                                pst.ppst_close_file(f)
+                                print "wrote %d bytes in %s" % (si, att2.str)
                         att = att.next
+            pst.pst_freeItem(item)
         topf = pst.pst_getNextDptr(topf)
     print "done"