<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>LibOFX: ofxpartner.cpp Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.0 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul></div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul></div> <h1>ofxpartner.cpp</h1><a href="ofxpartner_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> ofx_partner.cpp </span> <a name="l00003"></a>00003 <span class="comment"> -------------------</span> <a name="l00004"></a>00004 <span class="comment"> copyright : (C) 2005 by Ace Jones</span> <a name="l00005"></a>00005 <span class="comment"> email : acejones@users.sourceforge.net</span> <a name="l00006"></a>00006 <span class="comment">***************************************************************************/</span> <a name="l00011"></a>00011 <span class="comment">/***************************************************************************</span> <a name="l00012"></a>00012 <span class="comment"> * *</span> <a name="l00013"></a>00013 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span> <a name="l00014"></a>00014 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span> <a name="l00015"></a>00015 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span> <a name="l00016"></a>00016 <span class="comment"> * (at your option) any later version. *</span> <a name="l00017"></a>00017 <span class="comment"> * *</span> <a name="l00018"></a>00018 <span class="comment"> ***************************************************************************/</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#endif</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <<a class="code" href="libofx-0_89_81_2inc_2libofx_8h.html">libofx.h</a>></span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="comment">//#ifdef HAVE_LIBCURL</span> <a name="l00027"></a>00027 <span class="preprocessor">#include <curl/curl.h></span> <a name="l00028"></a>00028 <span class="comment">//#endif</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="ofxpartner_8h.html">ofxpartner.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="nodeparser_8h.html">nodeparser.h</a>"</span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="preprocessor">#include <sys/stat.h></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include <iostream></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <string></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <vector></span> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="keyword">using</span> std::string; <a name="l00040"></a>00040 <span class="keyword">using</span> std::vector; <a name="l00041"></a>00041 <span class="keyword">using</span> std::cout; <a name="l00042"></a>00042 <span class="keyword">using</span> std::endl; <a name="l00043"></a>00043 <a name="l00044"></a><a class="code" href="namespaceOfxPartner.html">00044</a> <span class="keyword">namespace </span>OfxPartner <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <span class="keywordtype">bool</span> <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="keyword">const</span> string& request, <span class="keyword">const</span> string& url, <span class="keyword">const</span> string& filename); <a name="l00047"></a>00047 <a name="l00048"></a><a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">00048</a> <span class="keyword">const</span> string <a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">kBankFilename</a> = <span class="stringliteral">"ofx-bank-index.xml"</span>; <a name="l00049"></a><a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">00049</a> <span class="keyword">const</span> string <a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">kCcFilename</a> = <span class="stringliteral">"ofx-cc-index.xml"</span>; <a name="l00050"></a><a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">00050</a> <span class="keyword">const</span> string <a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">kInvFilename</a> = <span class="stringliteral">"ofx-inv-index.xml"</span>; <a name="l00051"></a>00051 <a name="l00052"></a><a class="code" href="namespaceOfxPartner.html#ef396b717081bb217cc350676d9b8165">00052</a> <span class="keywordtype">void</span> <a class="code" href="namespaceOfxPartner.html#ef396b717081bb217cc350676d9b8165">ValidateIndexCache</a>(<span class="keywordtype">void</span>) <a name="l00053"></a>00053 { <a name="l00054"></a>00054 <span class="comment">// TODO Check whether these files exist and are recent enough before getting them again</span> <a name="l00055"></a>00055 <a name="l00056"></a>00056 <span class="keyword">struct </span>stat filestats; <a name="l00057"></a>00057 <span class="keywordflow">if</span> ( stat( <a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">kBankFilename</a>.c_str(), &filestats ) || difftime(time(0),filestats.st_mtime) > 7.0*24.0*60.0*60.0 ) <a name="l00058"></a>00058 <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="stringliteral">"T=1&S=*&R=1&O=0&TEST=0"</span>,<span class="stringliteral">"http://moneycentral.msn.com/money/2005/mnynet/service/ols/filist.aspx?SKU=3&VER=6"</span>,<a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">kBankFilename</a>); <a name="l00059"></a>00059 <span class="keywordflow">if</span> ( stat( <a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">kCcFilename</a>.c_str(), &filestats ) || difftime(time(0),filestats.st_mtime) > 7.0*24.0*60.0*60.0 ) <a name="l00060"></a>00060 <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="stringliteral">"T=2&S=*&R=1&O=0&TEST=0"</span>,<span class="stringliteral">"http://moneycentral.msn.com/money/2005/mnynet/service/ols/filist.aspx?SKU=3&VER=6"</span>,<a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">kCcFilename</a>); <a name="l00061"></a>00061 <span class="keywordflow">if</span> ( stat( <a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">kInvFilename</a>.c_str(), &filestats ) || difftime(time(0),filestats.st_mtime) > 7.0*24.0*60.0*60.0 ) <a name="l00062"></a>00062 <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="stringliteral">"T=3&S=*&R=1&O=0&TEST=0"</span>,<span class="stringliteral">"http://moneycentral.msn.com/money/2005/mnynet/service/ols/filist.aspx?SKU=3&VER=6"</span>,<a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">kInvFilename</a>); <a name="l00063"></a>00063 } <a name="l00064"></a>00064 <a name="l00065"></a><a class="code" href="namespaceOfxPartner.html#849cbb4d1d013b56c3ba28ef1e574fba">00065</a> vector<string> <a class="code" href="namespaceOfxPartner.html#849cbb4d1d013b56c3ba28ef1e574fba">BankNames</a>(<span class="keywordtype">void</span>) <a name="l00066"></a>00066 { <a name="l00067"></a>00067 vector<string> result; <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="comment">// Make sure the index files are up to date</span> <a name="l00070"></a>00070 <a class="code" href="namespaceOfxPartner.html#ef396b717081bb217cc350676d9b8165">ValidateIndexCache</a>(); <a name="l00071"></a>00071 <a name="l00072"></a>00072 xmlpp::DomParser parser; <a name="l00073"></a>00073 parser.set_substitute_entities(); <a name="l00074"></a>00074 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">kBankFilename</a>); <a name="l00075"></a>00075 <span class="keywordflow">if</span> ( parser ) <a name="l00076"></a>00076 { <a name="l00077"></a>00077 vector<string> names = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov/name"</span>).Text(); <a name="l00078"></a>00078 result.insert(result.end(),names.begin(),names.end()); <a name="l00079"></a>00079 } <a name="l00080"></a>00080 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">kCcFilename</a>); <a name="l00081"></a>00081 <span class="keywordflow">if</span> ( parser ) <a name="l00082"></a>00082 { <a name="l00083"></a>00083 vector<string> names = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov/name"</span>).Text(); <a name="l00084"></a>00084 result.insert(result.end(),names.begin(),names.end()); <a name="l00085"></a>00085 } <a name="l00086"></a>00086 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">kInvFilename</a>); <a name="l00087"></a>00087 <span class="keywordflow">if</span> ( parser ) <a name="l00088"></a>00088 { <a name="l00089"></a>00089 vector<string> names = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov/name"</span>).Text(); <a name="l00090"></a>00090 result.insert(result.end(),names.begin(),names.end()); <a name="l00091"></a>00091 } <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">// Add Innovision</span> <a name="l00094"></a>00094 result.push_back(<span class="stringliteral">"Innovision"</span>); <a name="l00095"></a>00095 <a name="l00096"></a>00096 <span class="comment">// sort the list and remove duplicates, to return one unified list of all supported banks </span> <a name="l00097"></a>00097 sort(result.begin(),result.end()); <a name="l00098"></a>00098 result.erase(unique(result.begin(),result.end()),result.end()); <a name="l00099"></a>00099 <span class="keywordflow">return</span> result; <a name="l00100"></a>00100 } <a name="l00101"></a>00101 <a name="l00102"></a><a class="code" href="namespaceOfxPartner.html#cfd9337cce7e4f82bd69b5d78362f7bb">00102</a> vector<string> <a class="code" href="namespaceOfxPartner.html#cfd9337cce7e4f82bd69b5d78362f7bb">FipidForBank</a>(<span class="keyword">const</span> string& bank) <a name="l00103"></a>00103 { <a name="l00104"></a>00104 vector<string> result; <a name="l00105"></a>00105 <a name="l00106"></a>00106 xmlpp::DomParser parser; <a name="l00107"></a>00107 parser.set_substitute_entities(); <a name="l00108"></a>00108 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#20028fb5bb6216afa275d5a400692026">kBankFilename</a>); <a name="l00109"></a>00109 <span class="keywordflow">if</span> ( parser ) <a name="l00110"></a>00110 { <a name="l00111"></a>00111 vector<string> fipids = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov"</span>).Select(<span class="stringliteral">"name"</span>,bank).Path(<span class="stringliteral">"guid"</span>).Text(); <a name="l00112"></a>00112 <span class="keywordflow">if</span> ( ! fipids.back().empty() ) <a name="l00113"></a>00113 result.insert(result.end(),fipids.begin(),fipids.end()); <a name="l00114"></a>00114 } <a name="l00115"></a>00115 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#23fa7b5e68a615741fefb26e61bed53d">kCcFilename</a>); <a name="l00116"></a>00116 <span class="keywordflow">if</span> ( parser ) <a name="l00117"></a>00117 { <a name="l00118"></a>00118 vector<string> fipids = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov"</span>).Select(<span class="stringliteral">"name"</span>,bank).Path(<span class="stringliteral">"guid"</span>).Text(); <a name="l00119"></a>00119 <span class="keywordflow">if</span> ( ! fipids.back().empty() ) <a name="l00120"></a>00120 result.insert(result.end(),fipids.begin(),fipids.end()); <a name="l00121"></a>00121 } <a name="l00122"></a>00122 parser.parse_file(<a class="code" href="namespaceOfxPartner.html#e941d2197fe884768f5790d9f99fafcf">kInvFilename</a>); <a name="l00123"></a>00123 <span class="keywordflow">if</span> ( parser ) <a name="l00124"></a>00124 { <a name="l00125"></a>00125 vector<string> fipids = <a class="code" href="classNodeParser.html">NodeParser</a>(parser).Path(<span class="stringliteral">"fi/prov"</span>).Select(<span class="stringliteral">"name"</span>,bank).Path(<span class="stringliteral">"guid"</span>).Text(); <a name="l00126"></a>00126 <span class="keywordflow">if</span> ( ! fipids.back().empty() ) <a name="l00127"></a>00127 result.insert(result.end(),fipids.begin(),fipids.end()); <a name="l00128"></a>00128 } <a name="l00129"></a>00129 <a name="l00130"></a>00130 <span class="comment">// the fipid for Innovision is 1.</span> <a name="l00131"></a>00131 <span class="keywordflow">if</span> ( bank == <span class="stringliteral">"Innovision"</span> ) <a name="l00132"></a>00132 result.push_back(<span class="stringliteral">"1"</span>); <a name="l00133"></a>00133 <a name="l00134"></a>00134 sort(result.begin(),result.end()); <a name="l00135"></a>00135 result.erase(unique(result.begin(),result.end()),result.end()); <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="keywordflow">return</span> result; <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00140"></a><a class="code" href="namespaceOfxPartner.html#7707f0e2acc21b43faca823ef9a2fef3">00140</a> <a class="code" href="structOfxFiServiceInfo.html">OfxFiServiceInfo</a> <a class="code" href="namespaceOfxPartner.html#7707f0e2acc21b43faca823ef9a2fef3">ServiceInfo</a>(<span class="keyword">const</span> std::string& fipid) <a name="l00141"></a>00141 { <a name="l00142"></a>00142 <a class="code" href="structOfxFiServiceInfo.html">OfxFiServiceInfo</a> result; <a name="l00143"></a>00143 memset(&result,0,<span class="keyword">sizeof</span>(<a class="code" href="structOfxFiServiceInfo.html">OfxFiServiceInfo</a>)); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="comment">// Hard-coded values for Innovision test server</span> <a name="l00146"></a>00146 <span class="keywordflow">if</span> ( fipid == <span class="stringliteral">"1"</span> ) <a name="l00147"></a>00147 { <a name="l00148"></a>00148 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#88f49d1eb8a58dd0af68b04839a742c1">fid</a>,<span class="stringliteral">"00000"</span>,<a class="code" href="inc_2libofx_8h.html#5524910cf3ba47b3d7a1b6752b69d056">OFX_FID_LENGTH</a>-1); <a name="l00149"></a>00149 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#3c7f2c8d42640c526ff8849d17a1ca08">org</a>,<span class="stringliteral">"ReferenceFI"</span>,<a class="code" href="inc_2libofx_8h.html#74914e6380be88d51ab921a0f3078646">OFX_ORG_LENGTH</a>-1); <a name="l00150"></a>00150 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#d346b124e8c33724472150fc8addaed0">url</a>,<span class="stringliteral">"http://ofx.innovision.com"</span>,<a class="code" href="inc_2libofx_8h.html#2c364470aa70104473ba7c0134c27ae2">OFX_URL_LENGTH</a>-1); <a name="l00151"></a>00151 result.<a class="code" href="structOfxFiServiceInfo.html#aecf3ea65f7ccd118d1264739da3f915">accountlist</a> = 1; <a name="l00152"></a>00152 result.<a class="code" href="structOfxFiServiceInfo.html#49e460457156291004eed7c1841c9efe">statements</a> = 1; <a name="l00153"></a>00153 result.<a class="code" href="structOfxFiServiceInfo.html#40a3cf5456923865ec22cc3bb2e3b07c">billpay</a> = 1; <a name="l00154"></a>00154 result.<a class="code" href="structOfxFiServiceInfo.html#37b1522705817d12494f524658d7633b">investments</a> = 1; <a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="keywordflow">return</span> result; <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <a name="l00159"></a>00159 string url = <span class="stringliteral">"http://moneycentral.msn.com/money/2005/mnynet/service/olsvcupd/OnlSvcBrandInfo.aspx?MSNGUID=&GUID=%1&SKU=3&VER=6"</span>; <a name="l00160"></a>00160 url.replace(url.find(<span class="stringliteral">"%1"</span>),2,fipid); <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="comment">// TODO: Check whether this file exists and is recent enough before getting it again</span> <a name="l00163"></a>00163 string guidfile = <span class="stringliteral">"fipid-%1.xml"</span>; <a name="l00164"></a>00164 guidfile.replace(guidfile.find(<span class="stringliteral">"%1"</span>),2,fipid); <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keyword">struct </span>stat filestats; <a name="l00167"></a>00167 <span class="keywordflow">if</span> ( stat( guidfile.c_str(), &filestats ) || difftime(time(0),filestats.st_mtime) > 7.0*24.0*60.0*60.0 ) <a name="l00168"></a>00168 <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="stringliteral">""</span>,url.c_str(),guidfile.c_str()); <a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="comment">// Print the FI details</span> <a name="l00171"></a>00171 xmlpp::DomParser parser; <a name="l00172"></a>00172 parser.set_substitute_entities(); <a name="l00173"></a>00173 parser.parse_file(guidfile); <a name="l00174"></a>00174 <span class="keywordflow">if</span> ( parser ) <a name="l00175"></a>00175 { <a name="l00176"></a>00176 <a class="code" href="classNodeParser.html">NodeParser</a> nodes(parser); <a name="l00177"></a>00177 <a name="l00178"></a>00178 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#88f49d1eb8a58dd0af68b04839a742c1">fid</a>,nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"ProviderSettings/FID"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back().c_str(),<a class="code" href="inc_2libofx_8h.html#5524910cf3ba47b3d7a1b6752b69d056">OFX_FID_LENGTH</a>-1); <a name="l00179"></a>00179 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#3c7f2c8d42640c526ff8849d17a1ca08">org</a>,nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"ProviderSettings/Org"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back().c_str(),<a class="code" href="inc_2libofx_8h.html#74914e6380be88d51ab921a0f3078646">OFX_ORG_LENGTH</a>-1); <a name="l00180"></a>00180 strncpy(result.<a class="code" href="structOfxFiServiceInfo.html#d346b124e8c33724472150fc8addaed0">url</a>,nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"ProviderSettings/ProviderURL"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back().c_str(),<a class="code" href="inc_2libofx_8h.html#2c364470aa70104473ba7c0134c27ae2">OFX_URL_LENGTH</a>-1); <a name="l00181"></a>00181 result.<a class="code" href="structOfxFiServiceInfo.html#aecf3ea65f7ccd118d1264739da3f915">accountlist</a> = (nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"ProviderSettings/AcctListAvail"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back() == <span class="stringliteral">"1"</span>); <a name="l00182"></a>00182 result.<a class="code" href="structOfxFiServiceInfo.html#49e460457156291004eed7c1841c9efe">statements</a> = (nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"BankingCapabilities/Bank"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back() == <span class="stringliteral">"1"</span>); <a name="l00183"></a>00183 result.<a class="code" href="structOfxFiServiceInfo.html#40a3cf5456923865ec22cc3bb2e3b07c">billpay</a> = (nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"BillPayCapabilities/Pay"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back() == <span class="stringliteral">"1"</span>); <a name="l00184"></a>00184 result.<a class="code" href="structOfxFiServiceInfo.html#37b1522705817d12494f524658d7633b">investments</a> = (nodes.<a class="code" href="classNodeParser.html#1e51fce16f61b3ba2a7d644e7d4de86e">Path</a>(<span class="stringliteral">"InvestmentCapabilities/BrkStmt"</span>).<a class="code" href="classNodeParser.html#374b3f6bdda993e165ff783575a89f4e">Text</a>().back() == <span class="stringliteral">"1"</span>); <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <span class="keywordflow">return</span> result; <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a name="l00189"></a><a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">00189</a> <span class="keywordtype">bool</span> <a class="code" href="namespaceOfxPartner.html#eae033ba144dd6e1a27a81d80fb985f4">post</a>(<span class="keyword">const</span> string& request, <span class="keyword">const</span> string& url, <span class="keyword">const</span> string& filename) <a name="l00190"></a>00190 { <a name="l00191"></a>00191 <span class="preprocessor">#if 1 //#ifdef HAVE_LIBCURL</span> <a name="l00192"></a>00192 <span class="preprocessor"></span> CURL *curl = curl_easy_init(); <a name="l00193"></a>00193 <span class="keywordflow">if</span>(! curl) <a name="l00194"></a>00194 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00195"></a>00195 <a name="l00196"></a>00196 unlink(filename.c_str()); <a name="l00197"></a>00197 FILE* file = fopen(filename.c_str(),<span class="stringliteral">"wb"</span>); <a name="l00198"></a>00198 <span class="keywordflow">if</span> (! file ) <a name="l00199"></a>00199 { <a name="l00200"></a>00200 curl_easy_cleanup(curl); <a name="l00201"></a>00201 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00202"></a>00202 } <a name="l00203"></a>00203 <a name="l00204"></a>00204 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); <a name="l00205"></a>00205 <span class="keywordflow">if</span> ( request.length() ) <a name="l00206"></a>00206 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request.c_str()); <a name="l00207"></a>00207 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite); <a name="l00208"></a>00208 curl_easy_setopt(curl, CURLOPT_WRITEDATA, (<span class="keywordtype">void</span> *)file); <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="comment">/*CURLcode res =*/</span> curl_easy_perform(curl); <a name="l00211"></a>00211 <a name="l00212"></a>00212 curl_easy_cleanup(curl); <a name="l00213"></a>00213 <a name="l00214"></a>00214 fclose(file); <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00217"></a>00217 <span class="preprocessor">#else</span> <a name="l00218"></a>00218 <span class="preprocessor"></span> request; url; filename; <a name="l00219"></a>00219 cerr << <span class="stringliteral">"ERROR: libox must be configured with libcurl to post this request"</span> << endl; <a name="l00220"></a>00220 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00221"></a>00221 <span class="preprocessor">#endif</span> <a name="l00222"></a>00222 <span class="preprocessor"></span>} <a name="l00223"></a>00223 <a name="l00224"></a>00224 } <span class="comment">// namespace OfxPartner</span> <a name="l00225"></a>00225 <a name="l00226"></a>00226 <a name="l00227"></a>00227 <span class="comment">// vim:cin:si:ai:et:ts=2:sw=2:</span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 9 21:21:59 2009 for LibOFX by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address> </body> </html>