1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>LibOFX: ofx_request.cpp Source File</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
6
<!-- Generated by Doxygen 1.3.9.1 -->
7
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
9
<a class="el" href="dir_000002.html">lib</a></div>
10
<h1>ofx_request.cpp</h1><a href="ofx__request_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/***************************************************************************</span>
11
00002 <span class="comment"> ofx_request.cpp </span>
12
00003 <span class="comment"> -------------------</span>
13
00004 <span class="comment"> copyright : (C) 2005 by Ace Jones</span>
14
00005 <span class="comment"> email : acejones@users.sourceforge.net</span>
15
00006 <span class="comment">***************************************************************************/</span>
16
00011 <span class="comment">/***************************************************************************</span>
17
00012 <span class="comment"> * *</span>
18
00013 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span>
19
00014 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span>
20
00015 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span>
21
00016 <span class="comment"> * (at your option) any later version. *</span>
22
00017 <span class="comment"> * *</span>
23
00018 <span class="comment"> ***************************************************************************/</span>
25
00020 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
26
00021 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
27
00022 <span class="preprocessor">#endif</span>
28
00023 <span class="preprocessor"></span>
29
00024 <span class="preprocessor">#include <string></span>
30
00025 <span class="preprocessor">#include "<a class="code" href="messages_8hh.html">messages.hh</a>"</span>
31
00026 <span class="preprocessor">#include "<a class="code" href="libofx-0_88_80_2inc_2libofx_8h.html">libofx.h</a>"</span>
32
00027 <span class="preprocessor">#include "<a class="code" href="ofx__request_8hh.html">ofx_request.hh</a>"</span>
34
00029 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
36
00031 string time_t_to_ofxdatetime( time_t time )
38
00033 <span class="keyword">static</span> <span class="keywordtype">char</span> buffer[51];
40
00035 strftime( buffer, 50, <span class="stringliteral">"%Y%m%d%H%M%S.000"</span>, localtime(&time) );
43
00038 <span class="keywordflow">return</span> string(buffer);
46
00041 string time_t_to_ofxdate( time_t time )
48
00043 <span class="keyword">static</span> <span class="keywordtype">char</span> buffer[51];
50
00045 strftime( buffer, 50, <span class="stringliteral">"%Y%m%d"</span>, localtime(&time) );
53
00048 <span class="keywordflow">return</span> string(buffer);
56
00051 string OfxHeader(<span class="keywordtype">void</span>)
58
00053 <span class="keywordflow">return</span> string(<span class="stringliteral">"OFXHEADER:100\r\n"</span>
59
00054 <span class="stringliteral">"DATA:OFXSGML\r\n"</span>
60
00055 <span class="stringliteral">"VERSION:102\r\n"</span>
61
00056 <span class="stringliteral">"SECURITY:NONE\r\n"</span>
62
00057 <span class="stringliteral">"ENCODING:USASCII\r\n"</span>
63
00058 <span class="stringliteral">"CHARSET:1252\r\n"</span>
64
00059 <span class="stringliteral">"COMPRESSION:NONE\r\n"</span>
65
00060 <span class="stringliteral">"OLDFILEUID:NONE\r\n"</span>
66
00061 <span class="stringliteral">"NEWFILEUID:"</span>)
67
00062 + time_t_to_ofxdatetime( time(NULL) )
68
00063 + string(<span class="stringliteral">"\r\n\r\n"</span>);
71
<a name="l00066"></a><a class="code" href="classOfxRequest.html#b0">00066</a> <a class="code" href="classOfxAggregate.html">OfxAggregate</a> <a class="code" href="classOfxRequest.html#b0">OfxRequest::SignOnRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
72
00067 <span class="keyword"></span>{
73
00068 <a class="code" href="classOfxAggregate.html">OfxAggregate</a> fiTag(<span class="stringliteral">"FI"</span>);
74
00069 fiTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"ORG"</span>, m_login.<a class="code" href="structOfxFiLogin.html#o1">org</a> );
75
00070 <span class="keywordflow">if</span> ( strlen(m_login.<a class="code" href="structOfxFiLogin.html#o0">fid</a>) > 0 )
76
00071 fiTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"FID"</span>, m_login.<a class="code" href="structOfxFiLogin.html#o0">fid</a> );
78
00073 <a class="code" href="classOfxAggregate.html">OfxAggregate</a> sonrqTag(<span class="stringliteral">"SONRQ"</span>);
79
00074 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"DTCLIENT"</span>, time_t_to_ofxdatetime( time(NULL) ) );
80
00075 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"USERID"</span>, m_login.<a class="code" href="structOfxFiLogin.html#o2">userid</a>);
81
00076 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"USERPASS"</span>, m_login.<a class="code" href="structOfxFiLogin.html#o3">userpass</a>);
82
00077 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"LANGUAGE"</span>,<span class="stringliteral">"ENG"</span>);
83
00078 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( fiTag );
84
00079 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"APPID"</span>,<span class="stringliteral">"QWIN"</span>);
85
00080 sonrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"APPVER"</span>,<span class="stringliteral">"1200"</span>);
87
00082 <a class="code" href="classOfxAggregate.html">OfxAggregate</a> signonmsgTag(<span class="stringliteral">"SIGNONMSGSRQV1"</span>);
88
00083 signonmsgTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( sonrqTag );
90
00085 <span class="keywordflow">return</span> signonmsgTag;
93
<a name="l00088"></a><a class="code" href="classOfxRequest.html#b1">00088</a> <a class="code" href="classOfxAggregate.html">OfxAggregate</a> <a class="code" href="classOfxRequest.html#b1">OfxRequest::RequestMessage</a>(<span class="keyword">const</span> string& _msgType, <span class="keyword">const</span> string& _trnType, <span class="keyword">const</span> <a class="code" href="classOfxAggregate.html">OfxAggregate</a>& _request)<span class="keyword"> const</span>
94
00089 <span class="keyword"></span>{
95
00090 <a class="code" href="classOfxAggregate.html">OfxAggregate</a> trnrqTag( _trnType+<span class="stringliteral">"TRNRQ"</span> );
96
00091 trnrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"TRNUID"</span>, time_t_to_ofxdatetime( time(NULL) ) );
97
00092 trnrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( <span class="stringliteral">"CLTCOOKIE"</span>,<span class="stringliteral">"1"</span> );
98
00093 trnrqTag.<a class="code" href="classOfxAggregate.html#a1">Add</a>( _request );
100
00095 <a class="code" href="classOfxAggregate.html">OfxAggregate</a> result( _msgType+<span class="stringliteral">"MSGSRQV1"</span> );
101
00096 result.<a class="code" href="classOfxAggregate.html#a1">Add</a>( trnrqTag );
103
00098 <span class="keywordflow">return</span> result;
105
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Jul 31 15:38:35 2005 for LibOFX by
106
<a href="http://www.doxygen.org/index.html">
107
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>