Wtx ~ Wt Extension Library
WtxLib
Account.cpp
1 
2 #include <vmime/vmime.hpp>
3 
4 #include <Wt/WString.h>
5 
6 #include "Account.h"
7 
8 Wtx::Eml::Service::Account::Account
9 (
10  const std::string & name,
11  const std::string & protocol,
12  const std::string & hostname,
13  const std::string & username,
14  const std::string & password
15 )
16 : Wt::WObject(),
17  m_name( name )
18 {
19 
20  m_urlString =
21  Wt::WString("{1}://{2}:{3}@{4}")
22  .arg( protocol )
23  .arg( username )
24  .arg( password )
25  .arg( hostname )
26  .toUTF8()
27  ;
28 
29 #ifdef NEVER
30  auto url = vmime::utility::url( urlString );
31 
32  auto sess = vmime::net::session::create();
33  auto store = sess-> getStore(url);
34  store-> connect();
35  auto defaultFolder = store-> getDefaultFolder();
36  defaultFolder-> open( vmime::net::folder::Modes::MODE_READ_ONLY );
37  auto messages =
38  defaultFolder-> getAndFetchMessages
39  (
40  vmime::net::messageSet::byNumber(1,-1),
41  vmime::net::fetchAttributes::FLAGS |
42  vmime::net::fetchAttributes::ENVELOPE
43  );
44 
45  auto folders =
46  defaultFolder-> getFolders();
47 
48  std::cout << __FILE__ << ":" << __LINE__
49  << " " << messages.size()
50  << " " << defaultFolder-> getName().generate()
51  << " " << folders.size()
52  << std::endl
53  ;
54 
55  for( auto folder : folders )
56  {
57  std::cout << __FILE__ << ":" << __LINE__
58  << " " << folder-> getName().generate()
59  << std::endl
60  ;
61  }
62 #endif
63 
64 
65 #ifdef NEVER
66 616 ·
67 583 for( auto message : messages )·
68 584 {·
69 585 auto flags = message-> getFlags();·
70 586 ·
71 587 auto header = message-> getHeader();·
72 588 ·
73 589 std::cout << __FILE__ << ":" << __LINE__·
74 590 << " " << header-> Date()-> generate()·
75 591 << " " << header-> From()-> generate()·
76 592 << std::endl·
77 593 ;·
78 594 ·
79 595 ·
80 596 }·
81 #endif
82 
83 
84 } // endWtx::Eml::Service::Account::Account
85 
86 const std::string & Wtx::Eml::Service::Account::name() const
87 {
88  return m_name;
89 }
90 
91 
92 
const WString & message() const
Get the message.