test/mime_test.cc
changeset 159 ad6d0993d1ab
parent 147 b03a10242e4c
child 165 f0894860af4a
     1.1 --- a/test/mime_test.cc	Sun Mar 29 13:54:38 2015 +0200
     1.2 +++ b/test/mime_test.cc	Sun Mar 29 21:03:41 2015 +0200
     1.3 @@ -1,7 +1,10 @@
     1.4 +#include "platform.h"
     1.5 +
     1.6  #include <iostream>
     1.7  #include <fstream>
     1.8  #include <string>
     1.9  #include <assert.h>
    1.10 +
    1.11  #include "mime.h"
    1.12  
    1.13  using namespace std;
    1.14 @@ -69,6 +72,17 @@
    1.15          cout << msg3->longmsg << "\n\n";
    1.16      if (msg3->longmsg_formatted)
    1.17          cout << msg3->longmsg_formatted << "\n\n";
    1.18 +    bloblist_t *_b;
    1.19 +    for (_b = msg3->attachments; _b; _b = _b->next) {
    1.20 +        cout << "attachment of type " << _b->mime_type << "\n";
    1.21 +        if (_b->filename) {
    1.22 +            cout << "filename: " << _b->filename << "\n";
    1.23 +            unlink(_b->filename);
    1.24 +            ofstream outFile3(_b->filename);
    1.25 +            outFile3.write(_b->data, _b->size);
    1.26 +            outFile3.close();
    1.27 +        }
    1.28 +    }
    1.29  
    1.30      free_message(msg3);
    1.31