xref: /AOO41X/main/shell/source/win32/sysmail/senddoc.cxx (revision 47148b3bc50811ceb41802e4cc50a5db21535900)
1*ae77b8caSAriel Constenla-Haile /**************************************************************
2*ae77b8caSAriel Constenla-Haile  *
3*ae77b8caSAriel Constenla-Haile  * Licensed to the Apache Software Foundation (ASF) under one
4*ae77b8caSAriel Constenla-Haile  * or more contributor license agreements.  See the NOTICE file
5*ae77b8caSAriel Constenla-Haile  * distributed with this work for additional information
6*ae77b8caSAriel Constenla-Haile  * regarding copyright ownership.  The ASF licenses this file
7*ae77b8caSAriel Constenla-Haile  * to you under the Apache License, Version 2.0 (the
8*ae77b8caSAriel Constenla-Haile  * "License"); you may not use this file except in compliance
9*ae77b8caSAriel Constenla-Haile  * with the License.  You may obtain a copy of the License at
10*ae77b8caSAriel Constenla-Haile  *
11*ae77b8caSAriel Constenla-Haile  *   http://www.apache.org/licenses/LICENSE-2.0
12*ae77b8caSAriel Constenla-Haile  *
13*ae77b8caSAriel Constenla-Haile  * Unless required by applicable law or agreed to in writing,
14*ae77b8caSAriel Constenla-Haile  * software distributed under the License is distributed on an
15*ae77b8caSAriel Constenla-Haile  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ae77b8caSAriel Constenla-Haile  * KIND, either express or implied.  See the License for the
17*ae77b8caSAriel Constenla-Haile  * specific language governing permissions and limitations
18*ae77b8caSAriel Constenla-Haile  * under the License.
19*ae77b8caSAriel Constenla-Haile  *
20*ae77b8caSAriel Constenla-Haile  *************************************************************/
21*ae77b8caSAriel Constenla-Haile 
22*ae77b8caSAriel Constenla-Haile // MARKER(update_precomp.py): autogen include statement, do not remove
23*ae77b8caSAriel Constenla-Haile #include "precompiled_shell.hxx"
24*ae77b8caSAriel Constenla-Haile #include <osl/diagnose.h>
25*ae77b8caSAriel Constenla-Haile 
26*ae77b8caSAriel Constenla-Haile #ifndef _RTL_STRING_HXX_
27*ae77b8caSAriel Constenla-Haile //#include <rtl/string.hxx>
28*ae77b8caSAriel Constenla-Haile #endif
29*ae77b8caSAriel Constenla-Haile #include "sysmapi.hxx"
30*ae77b8caSAriel Constenla-Haile 
31*ae77b8caSAriel Constenla-Haile #define WIN32_LEAN_AND_MEAN
32*ae77b8caSAriel Constenla-Haile #if defined _MSC_VER
33*ae77b8caSAriel Constenla-Haile #pragma warning(push, 1)
34*ae77b8caSAriel Constenla-Haile #endif
35*ae77b8caSAriel Constenla-Haile #include <windows.h>
36*ae77b8caSAriel Constenla-Haile #if defined _MSC_VER
37*ae77b8caSAriel Constenla-Haile #pragma warning(pop)
38*ae77b8caSAriel Constenla-Haile #endif
39*ae77b8caSAriel Constenla-Haile #include <tchar.h>
40*ae77b8caSAriel Constenla-Haile 
41*ae77b8caSAriel Constenla-Haile #include <iostream>
42*ae77b8caSAriel Constenla-Haile #include <vector>
43*ae77b8caSAriel Constenla-Haile #include <sstream>
44*ae77b8caSAriel Constenla-Haile #include <stdexcept>
45*ae77b8caSAriel Constenla-Haile 
46*ae77b8caSAriel Constenla-Haile #if OSL_DEBUG_LEVEL > 2
47*ae77b8caSAriel Constenla-Haile void dumpParameter();
48*ae77b8caSAriel Constenla-Haile #endif
49*ae77b8caSAriel Constenla-Haile 
50*ae77b8caSAriel Constenla-Haile typedef std::vector<std::string> StringList_t;
51*ae77b8caSAriel Constenla-Haile typedef StringList_t::const_iterator StringListIterator_t;
52*ae77b8caSAriel Constenla-Haile typedef std::vector<MapiRecipDesc> MapiRecipientList_t;
53*ae77b8caSAriel Constenla-Haile typedef std::vector<MapiFileDesc> MapiAttachmentList_t;
54*ae77b8caSAriel Constenla-Haile 
55*ae77b8caSAriel Constenla-Haile const int LEN_SMTP_PREFIX = 5; // "SMTP:"
56*ae77b8caSAriel Constenla-Haile 
57*ae77b8caSAriel Constenla-Haile namespace /* private */
58*ae77b8caSAriel Constenla-Haile {
59*ae77b8caSAriel Constenla-Haile     std::string gFrom;
60*ae77b8caSAriel Constenla-Haile     std::string gSubject;
61*ae77b8caSAriel Constenla-Haile     std::string gBody;
62*ae77b8caSAriel Constenla-Haile     StringList_t gTo;
63*ae77b8caSAriel Constenla-Haile     StringList_t gCc;
64*ae77b8caSAriel Constenla-Haile     StringList_t gBcc;
65*ae77b8caSAriel Constenla-Haile     StringList_t gAttachments;
66*ae77b8caSAriel Constenla-Haile     int gMapiFlags = 0;
67*ae77b8caSAriel Constenla-Haile }
68*ae77b8caSAriel Constenla-Haile 
69*ae77b8caSAriel Constenla-Haile /**
70*ae77b8caSAriel Constenla-Haile     Add a prefix to an email address. MAPI requires that that
71*ae77b8caSAriel Constenla-Haile     email addresses have an 'SMTP:' prefix.
72*ae77b8caSAriel Constenla-Haile 
73*ae77b8caSAriel Constenla-Haile     @param  aEmailAddress
74*ae77b8caSAriel Constenla-Haile     [in] the email address.
75*ae77b8caSAriel Constenla-Haile 
76*ae77b8caSAriel Constenla-Haile     @param  aPrefix
77*ae77b8caSAriel Constenla-Haile     [in] the prefix to be added to the email address.
78*ae77b8caSAriel Constenla-Haile 
79*ae77b8caSAriel Constenla-Haile     @returns
80*ae77b8caSAriel Constenla-Haile     the email address prefixed with the specified prefix.
81*ae77b8caSAriel Constenla-Haile */
prefixEmailAddress(const std::string & aEmailAddress,const std::string & aPrefix="SMTP:")82*ae77b8caSAriel Constenla-Haile inline std::string prefixEmailAddress(
83*ae77b8caSAriel Constenla-Haile     const std::string& aEmailAddress,
84*ae77b8caSAriel Constenla-Haile     const std::string& aPrefix = "SMTP:")
85*ae77b8caSAriel Constenla-Haile {
86*ae77b8caSAriel Constenla-Haile     return (aPrefix + aEmailAddress);
87*ae77b8caSAriel Constenla-Haile }
88*ae77b8caSAriel Constenla-Haile 
89*ae77b8caSAriel Constenla-Haile /** @internal */
addRecipient(ULONG recipClass,const std::string & recipAddress,MapiRecipientList_t * pMapiRecipientList)90*ae77b8caSAriel Constenla-Haile void addRecipient(
91*ae77b8caSAriel Constenla-Haile     ULONG recipClass,
92*ae77b8caSAriel Constenla-Haile     const std::string& recipAddress,
93*ae77b8caSAriel Constenla-Haile     MapiRecipientList_t* pMapiRecipientList)
94*ae77b8caSAriel Constenla-Haile {
95*ae77b8caSAriel Constenla-Haile     MapiRecipDesc mrd;
96*ae77b8caSAriel Constenla-Haile     ZeroMemory(&mrd, sizeof(mrd));
97*ae77b8caSAriel Constenla-Haile 
98*ae77b8caSAriel Constenla-Haile     mrd.ulRecipClass = recipClass;
99*ae77b8caSAriel Constenla-Haile     mrd.lpszName = const_cast<char*>(recipAddress.c_str()) + LEN_SMTP_PREFIX;
100*ae77b8caSAriel Constenla-Haile     mrd.lpszAddress = const_cast<char*>(recipAddress.c_str());
101*ae77b8caSAriel Constenla-Haile     pMapiRecipientList->push_back(mrd);
102*ae77b8caSAriel Constenla-Haile }
103*ae77b8caSAriel Constenla-Haile 
104*ae77b8caSAriel Constenla-Haile /** @internal */
initRecipientList(MapiRecipientList_t * pMapiRecipientList)105*ae77b8caSAriel Constenla-Haile void initRecipientList(MapiRecipientList_t* pMapiRecipientList)
106*ae77b8caSAriel Constenla-Haile {
107*ae77b8caSAriel Constenla-Haile     OSL_ASSERT(pMapiRecipientList->size() == 0);
108*ae77b8caSAriel Constenla-Haile 
109*ae77b8caSAriel Constenla-Haile     // add to recipients
110*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter = gTo.begin();
111*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter_end = gTo.end();
112*ae77b8caSAriel Constenla-Haile     for (; iter != iter_end; ++iter)
113*ae77b8caSAriel Constenla-Haile         addRecipient(MAPI_TO, *iter, pMapiRecipientList);
114*ae77b8caSAriel Constenla-Haile 
115*ae77b8caSAriel Constenla-Haile     // add cc recipients
116*ae77b8caSAriel Constenla-Haile     iter = gCc.begin();
117*ae77b8caSAriel Constenla-Haile     iter_end = gCc.end();
118*ae77b8caSAriel Constenla-Haile     for (; iter != iter_end; ++iter)
119*ae77b8caSAriel Constenla-Haile         addRecipient(MAPI_CC, *iter, pMapiRecipientList);
120*ae77b8caSAriel Constenla-Haile 
121*ae77b8caSAriel Constenla-Haile     // add bcc recipients
122*ae77b8caSAriel Constenla-Haile     iter = gBcc.begin();
123*ae77b8caSAriel Constenla-Haile     iter_end = gBcc.end();
124*ae77b8caSAriel Constenla-Haile     for (; iter != iter_end; ++iter)
125*ae77b8caSAriel Constenla-Haile         addRecipient(MAPI_BCC, *iter, pMapiRecipientList);
126*ae77b8caSAriel Constenla-Haile }
127*ae77b8caSAriel Constenla-Haile 
128*ae77b8caSAriel Constenla-Haile /** @internal */
initAttachementList(MapiAttachmentList_t * pMapiAttachmentList)129*ae77b8caSAriel Constenla-Haile void initAttachementList(MapiAttachmentList_t* pMapiAttachmentList)
130*ae77b8caSAriel Constenla-Haile {
131*ae77b8caSAriel Constenla-Haile     OSL_ASSERT(pMapiAttachmentList->size() == 0);
132*ae77b8caSAriel Constenla-Haile 
133*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter = gAttachments.begin();
134*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter_end = gAttachments.end();
135*ae77b8caSAriel Constenla-Haile     for (/**/; iter != iter_end; ++iter)
136*ae77b8caSAriel Constenla-Haile     {
137*ae77b8caSAriel Constenla-Haile         MapiFileDesc mfd;
138*ae77b8caSAriel Constenla-Haile         ZeroMemory(&mfd, sizeof(mfd));
139*ae77b8caSAriel Constenla-Haile         mfd.lpszPathName = const_cast<char*>(iter->c_str());
140*ae77b8caSAriel Constenla-Haile         mfd.nPosition = sal::static_int_cast<ULONG>(-1);
141*ae77b8caSAriel Constenla-Haile         pMapiAttachmentList->push_back(mfd);
142*ae77b8caSAriel Constenla-Haile     }
143*ae77b8caSAriel Constenla-Haile }
144*ae77b8caSAriel Constenla-Haile 
145*ae77b8caSAriel Constenla-Haile /** @internal */
initMapiOriginator(MapiRecipDesc * pMapiOriginator)146*ae77b8caSAriel Constenla-Haile void initMapiOriginator(MapiRecipDesc* pMapiOriginator)
147*ae77b8caSAriel Constenla-Haile {
148*ae77b8caSAriel Constenla-Haile     ZeroMemory(pMapiOriginator, sizeof(MapiRecipDesc));
149*ae77b8caSAriel Constenla-Haile 
150*ae77b8caSAriel Constenla-Haile     pMapiOriginator->ulRecipClass = MAPI_ORIG;
151*ae77b8caSAriel Constenla-Haile     pMapiOriginator->lpszName = "";
152*ae77b8caSAriel Constenla-Haile     pMapiOriginator->lpszAddress = const_cast<char*>(gFrom.c_str());
153*ae77b8caSAriel Constenla-Haile }
154*ae77b8caSAriel Constenla-Haile 
155*ae77b8caSAriel Constenla-Haile /** @internal */
initMapiMessage(MapiRecipDesc * aMapiOriginator,MapiRecipientList_t & aMapiRecipientList,MapiAttachmentList_t & aMapiAttachmentList,MapiMessage * pMapiMessage)156*ae77b8caSAriel Constenla-Haile void initMapiMessage(
157*ae77b8caSAriel Constenla-Haile     MapiRecipDesc* aMapiOriginator,
158*ae77b8caSAriel Constenla-Haile     MapiRecipientList_t& aMapiRecipientList,
159*ae77b8caSAriel Constenla-Haile     MapiAttachmentList_t& aMapiAttachmentList,
160*ae77b8caSAriel Constenla-Haile     MapiMessage* pMapiMessage)
161*ae77b8caSAriel Constenla-Haile {
162*ae77b8caSAriel Constenla-Haile     ZeroMemory(pMapiMessage, sizeof(MapiMessage));
163*ae77b8caSAriel Constenla-Haile 
164*ae77b8caSAriel Constenla-Haile     pMapiMessage->lpszSubject = const_cast<char*>(gSubject.c_str());
165*ae77b8caSAriel Constenla-Haile     pMapiMessage->lpszNoteText = (gBody.length() ? const_cast<char*>(gBody.c_str()) : NULL);
166*ae77b8caSAriel Constenla-Haile     pMapiMessage->lpOriginator = aMapiOriginator;
167*ae77b8caSAriel Constenla-Haile     pMapiMessage->lpRecips = aMapiRecipientList.size() ? &aMapiRecipientList[0] : 0;
168*ae77b8caSAriel Constenla-Haile     pMapiMessage->nRecipCount = aMapiRecipientList.size();
169*ae77b8caSAriel Constenla-Haile     pMapiMessage->lpFiles = aMapiAttachmentList.size() ? &aMapiAttachmentList[0] : 0;
170*ae77b8caSAriel Constenla-Haile     pMapiMessage->nFileCount = aMapiAttachmentList.size();
171*ae77b8caSAriel Constenla-Haile }
172*ae77b8caSAriel Constenla-Haile 
173*ae77b8caSAriel Constenla-Haile char* KnownParameter[] =
174*ae77b8caSAriel Constenla-Haile {
175*ae77b8caSAriel Constenla-Haile     "--to",
176*ae77b8caSAriel Constenla-Haile     "--cc",
177*ae77b8caSAriel Constenla-Haile     "--bcc",
178*ae77b8caSAriel Constenla-Haile     "--from",
179*ae77b8caSAriel Constenla-Haile     "--subject",
180*ae77b8caSAriel Constenla-Haile     "--body",
181*ae77b8caSAriel Constenla-Haile     "--attach",
182*ae77b8caSAriel Constenla-Haile     "--mapi-dialog",
183*ae77b8caSAriel Constenla-Haile     "--mapi-logon-ui"
184*ae77b8caSAriel Constenla-Haile };
185*ae77b8caSAriel Constenla-Haile 
186*ae77b8caSAriel Constenla-Haile const size_t nKnownParameter = (sizeof(KnownParameter)/sizeof(KnownParameter[0]));
187*ae77b8caSAriel Constenla-Haile 
188*ae77b8caSAriel Constenla-Haile /** @internal */
isKnownParameter(const char * aParameterName)189*ae77b8caSAriel Constenla-Haile bool isKnownParameter(const char* aParameterName)
190*ae77b8caSAriel Constenla-Haile {
191*ae77b8caSAriel Constenla-Haile     for (size_t i = 0; i < nKnownParameter; i++)
192*ae77b8caSAriel Constenla-Haile         if (_tcsicmp(aParameterName, KnownParameter[i]) == 0)
193*ae77b8caSAriel Constenla-Haile             return true;
194*ae77b8caSAriel Constenla-Haile 
195*ae77b8caSAriel Constenla-Haile     return false;
196*ae77b8caSAriel Constenla-Haile }
197*ae77b8caSAriel Constenla-Haile 
198*ae77b8caSAriel Constenla-Haile /** @internal */
initParameter(int argc,char * argv[])199*ae77b8caSAriel Constenla-Haile void initParameter(int argc, char* argv[])
200*ae77b8caSAriel Constenla-Haile {
201*ae77b8caSAriel Constenla-Haile     for (int i = 1; i < argc; i++)
202*ae77b8caSAriel Constenla-Haile     {
203*ae77b8caSAriel Constenla-Haile         if (!isKnownParameter(argv[i]))
204*ae77b8caSAriel Constenla-Haile         {
205*ae77b8caSAriel Constenla-Haile             OSL_ENSURE(false, "Wrong parameter received");
206*ae77b8caSAriel Constenla-Haile             continue;
207*ae77b8caSAriel Constenla-Haile         }
208*ae77b8caSAriel Constenla-Haile 
209*ae77b8caSAriel Constenla-Haile         if ((_tcsicmp(argv[i], TEXT("--mapi-dialog")) == 0))
210*ae77b8caSAriel Constenla-Haile         {
211*ae77b8caSAriel Constenla-Haile             gMapiFlags |= MAPI_DIALOG;
212*ae77b8caSAriel Constenla-Haile         }
213*ae77b8caSAriel Constenla-Haile         else if ((_tcsicmp(argv[i], TEXT("--mapi-logon-ui")) == 0))
214*ae77b8caSAriel Constenla-Haile         {
215*ae77b8caSAriel Constenla-Haile             gMapiFlags |= MAPI_LOGON_UI;
216*ae77b8caSAriel Constenla-Haile         }
217*ae77b8caSAriel Constenla-Haile         else if ((i+1) < argc) // is the value of a parameter available too?
218*ae77b8caSAriel Constenla-Haile         {
219*ae77b8caSAriel Constenla-Haile             if (_tcsicmp(argv[i], TEXT("--to")) == 0)
220*ae77b8caSAriel Constenla-Haile                 gTo.push_back(prefixEmailAddress(argv[i+1]));
221*ae77b8caSAriel Constenla-Haile             else if (_tcsicmp(argv[i], TEXT("--cc")) == 0)
222*ae77b8caSAriel Constenla-Haile                 gCc.push_back(prefixEmailAddress(argv[i+1]));
223*ae77b8caSAriel Constenla-Haile             else if (_tcsicmp(argv[i], TEXT("--bcc")) == 0)
224*ae77b8caSAriel Constenla-Haile                 gBcc.push_back(prefixEmailAddress(argv[i+1]));
225*ae77b8caSAriel Constenla-Haile             else if (_tcsicmp(argv[i], TEXT("--from")) == 0)
226*ae77b8caSAriel Constenla-Haile                 gFrom = prefixEmailAddress(argv[i+1]);
227*ae77b8caSAriel Constenla-Haile             else if (_tcsicmp(argv[i], TEXT("--subject")) == 0)
228*ae77b8caSAriel Constenla-Haile                 gSubject = argv[i+1];
229*ae77b8caSAriel Constenla-Haile             else if (_tcsicmp(argv[i], TEXT("--body")) == 0)
230*ae77b8caSAriel Constenla-Haile                 gBody = argv[i+1];
231*ae77b8caSAriel Constenla-Haile             else if ((_tcsicmp(argv[i], TEXT("--attach")) == 0))
232*ae77b8caSAriel Constenla-Haile                 gAttachments.push_back(argv[i+1]);
233*ae77b8caSAriel Constenla-Haile 
234*ae77b8caSAriel Constenla-Haile             i++;
235*ae77b8caSAriel Constenla-Haile         }
236*ae77b8caSAriel Constenla-Haile     }
237*ae77b8caSAriel Constenla-Haile }
238*ae77b8caSAriel Constenla-Haile 
239*ae77b8caSAriel Constenla-Haile /**
240*ae77b8caSAriel Constenla-Haile     Main.
241*ae77b8caSAriel Constenla-Haile     NOTE: Because this is program only serves implementation
242*ae77b8caSAriel Constenla-Haile     purposes and should not be used by any end user the
243*ae77b8caSAriel Constenla-Haile     parameter checking is very limited. Every unknown parameter
244*ae77b8caSAriel Constenla-Haile     will be ignored.
245*ae77b8caSAriel Constenla-Haile */
main(int argc,char * argv[])246*ae77b8caSAriel Constenla-Haile int main(int argc, char* argv[])
247*ae77b8caSAriel Constenla-Haile {
248*ae77b8caSAriel Constenla-Haile     //MessageBox(NULL, "Debug", "Debug", MB_OK);
249*ae77b8caSAriel Constenla-Haile 
250*ae77b8caSAriel Constenla-Haile     initParameter(argc, argv);
251*ae77b8caSAriel Constenla-Haile 
252*ae77b8caSAriel Constenla-Haile #if OSL_DEBUG_LEVEL > 2
253*ae77b8caSAriel Constenla-Haile     dumpParameter();
254*ae77b8caSAriel Constenla-Haile #endif
255*ae77b8caSAriel Constenla-Haile 
256*ae77b8caSAriel Constenla-Haile     ULONG ulRet = MAPI_E_FAILURE;
257*ae77b8caSAriel Constenla-Haile 
258*ae77b8caSAriel Constenla-Haile     try
259*ae77b8caSAriel Constenla-Haile     {
260*ae77b8caSAriel Constenla-Haile         shell::WinSysMapi mapi;
261*ae77b8caSAriel Constenla-Haile 
262*ae77b8caSAriel Constenla-Haile         // #93007# we have to set the flag MAPI_NEW_SESSION,
263*ae77b8caSAriel Constenla-Haile         // because in the case Outlook xxx (not Outlook Express!)
264*ae77b8caSAriel Constenla-Haile         // is installed as Exchange and Mail Client a Profile
265*ae77b8caSAriel Constenla-Haile         // selection dialog must appear because we specify no
266*ae77b8caSAriel Constenla-Haile         // profile name, so the user has to specify a profile
267*ae77b8caSAriel Constenla-Haile         FLAGS flFlag = MAPI_NEW_SESSION | MAPI_LOGON_UI;
268*ae77b8caSAriel Constenla-Haile         LHANDLE hSession;
269*ae77b8caSAriel Constenla-Haile         ulRet = mapi.MAPILogon(0, NULL, NULL, flFlag, 0L, &hSession);
270*ae77b8caSAriel Constenla-Haile 
271*ae77b8caSAriel Constenla-Haile         if (ulRet == SUCCESS_SUCCESS)
272*ae77b8caSAriel Constenla-Haile         {
273*ae77b8caSAriel Constenla-Haile             MapiRecipDesc mapiOriginator;
274*ae77b8caSAriel Constenla-Haile             MapiRecipientList_t mapiRecipientList;
275*ae77b8caSAriel Constenla-Haile             MapiAttachmentList_t mapiAttachmentList;
276*ae77b8caSAriel Constenla-Haile             MapiMessage mapiMsg;
277*ae77b8caSAriel Constenla-Haile 
278*ae77b8caSAriel Constenla-Haile             initMapiOriginator(&mapiOriginator);
279*ae77b8caSAriel Constenla-Haile             initRecipientList(&mapiRecipientList);
280*ae77b8caSAriel Constenla-Haile             initAttachementList(&mapiAttachmentList);
281*ae77b8caSAriel Constenla-Haile             initMapiMessage((gFrom.length() ? &mapiOriginator : NULL), mapiRecipientList, mapiAttachmentList, &mapiMsg);
282*ae77b8caSAriel Constenla-Haile 
283*ae77b8caSAriel Constenla-Haile             ulRet = mapi.MAPISendMail(hSession, 0, &mapiMsg, gMapiFlags, 0);
284*ae77b8caSAriel Constenla-Haile 
285*ae77b8caSAriel Constenla-Haile             mapi.MAPILogoff(hSession, 0, 0, 0);
286*ae77b8caSAriel Constenla-Haile         }
287*ae77b8caSAriel Constenla-Haile     }
288*ae77b8caSAriel Constenla-Haile     catch (const std::runtime_error&
289*ae77b8caSAriel Constenla-Haile #if OSL_DEBUG_LEVEL > 0
290*ae77b8caSAriel Constenla-Haile                 ex
291*ae77b8caSAriel Constenla-Haile #endif
292*ae77b8caSAriel Constenla-Haile               )
293*ae77b8caSAriel Constenla-Haile     {
294*ae77b8caSAriel Constenla-Haile         OSL_ENSURE(false, ex.what());
295*ae77b8caSAriel Constenla-Haile     }
296*ae77b8caSAriel Constenla-Haile     return ulRet;
297*ae77b8caSAriel Constenla-Haile }
298*ae77b8caSAriel Constenla-Haile 
299*ae77b8caSAriel Constenla-Haile #if OSL_DEBUG_LEVEL > 2
dumpParameter()300*ae77b8caSAriel Constenla-Haile void dumpParameter()
301*ae77b8caSAriel Constenla-Haile {
302*ae77b8caSAriel Constenla-Haile     std::ostringstream oss;
303*ae77b8caSAriel Constenla-Haile 
304*ae77b8caSAriel Constenla-Haile     if (gFrom.length() > 0)
305*ae77b8caSAriel Constenla-Haile         oss << "--from" << " " << gFrom << std::endl;
306*ae77b8caSAriel Constenla-Haile 
307*ae77b8caSAriel Constenla-Haile     if (gSubject.length() > 0)
308*ae77b8caSAriel Constenla-Haile         oss << "--subject" << " " << gSubject << std::endl;
309*ae77b8caSAriel Constenla-Haile 
310*ae77b8caSAriel Constenla-Haile     if (gBody.length() > 0)
311*ae77b8caSAriel Constenla-Haile         oss << "--body" << " " << gBody << std::endl;
312*ae77b8caSAriel Constenla-Haile 
313*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter = gTo.begin();
314*ae77b8caSAriel Constenla-Haile     StringListIterator_t iter_end = gTo.end();
315*ae77b8caSAriel Constenla-Haile     for (/**/; iter != iter_end; ++iter)
316*ae77b8caSAriel Constenla-Haile         oss << "--to" << " " << *iter << std::endl;
317*ae77b8caSAriel Constenla-Haile 
318*ae77b8caSAriel Constenla-Haile     iter = gCc.begin();
319*ae77b8caSAriel Constenla-Haile     iter_end = gCc.end();
320*ae77b8caSAriel Constenla-Haile     for (/**/; iter != iter_end; ++iter)
321*ae77b8caSAriel Constenla-Haile         oss << "--cc" << " " << *iter << std::endl;
322*ae77b8caSAriel Constenla-Haile 
323*ae77b8caSAriel Constenla-Haile     iter = gBcc.begin();
324*ae77b8caSAriel Constenla-Haile     iter_end = gBcc.end();
325*ae77b8caSAriel Constenla-Haile     for (/**/; iter != iter_end; ++iter)
326*ae77b8caSAriel Constenla-Haile         oss << "--bcc" << " " << *iter << std::endl;
327*ae77b8caSAriel Constenla-Haile 
328*ae77b8caSAriel Constenla-Haile     iter = gAttachments.begin();
329*ae77b8caSAriel Constenla-Haile     iter_end = gAttachments.end();
330*ae77b8caSAriel Constenla-Haile     for (/**/; iter != iter_end; ++iter)
331*ae77b8caSAriel Constenla-Haile         oss << "--attach" << " " << *iter << std::endl;
332*ae77b8caSAriel Constenla-Haile 
333*ae77b8caSAriel Constenla-Haile     if (gMapiFlags & MAPI_DIALOG)
334*ae77b8caSAriel Constenla-Haile         oss << "--mapi-dialog" << std::endl;
335*ae77b8caSAriel Constenla-Haile 
336*ae77b8caSAriel Constenla-Haile     if (gMapiFlags & MAPI_LOGON_UI)
337*ae77b8caSAriel Constenla-Haile         oss << "--mapi-logon-ui" << std::endl;
338*ae77b8caSAriel Constenla-Haile 
339*ae77b8caSAriel Constenla-Haile     MessageBox(NULL, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION);
340*ae77b8caSAriel Constenla-Haile }
341*ae77b8caSAriel Constenla-Haile #endif
342