31
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: mmsheaders implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <msvstore.h>
|
|
22 |
#include <badesca.h>
|
|
23 |
#include <msvids.h>
|
|
24 |
#include <mtmdef.h>
|
|
25 |
#include <e32def.h>
|
|
26 |
#include <e32math.h>
|
|
27 |
#include <mmsvattachmentmanager.h>
|
|
28 |
#include <cmsvmimeheaders.h>
|
|
29 |
#include "mmsconst.h"
|
|
30 |
#include "mmsheaders.h"
|
|
31 |
#include "mmssettings.h"
|
|
32 |
#include "mmsversion.h"
|
|
33 |
#include "mmselementdescriptor.h"
|
|
34 |
#include "mmsmmboxmessageheaders.h"
|
|
35 |
#include "mmsmmboxviewheaders.h"
|
|
36 |
|
|
37 |
// EXTERNAL DATA STRUCTURES
|
|
38 |
|
|
39 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
40 |
|
|
41 |
// CONSTANTS
|
|
42 |
const TInt KMmsArrayAllocationNumber = 6;
|
|
43 |
|
|
44 |
// MACROS
|
|
45 |
|
|
46 |
// LOCAL CONSTANTS AND MACROS
|
|
47 |
|
|
48 |
// MODULE DATA STRUCTURES
|
|
49 |
|
|
50 |
// LOCAL FUNCTION PROTOTYPES
|
|
51 |
|
|
52 |
// ==================== LOCAL FUNCTIONS ====================
|
|
53 |
|
|
54 |
|
|
55 |
// ================= MEMBER FUNCTIONS =======================
|
|
56 |
|
|
57 |
// C++ default constructor can NOT contain any code that
|
|
58 |
// might leave.
|
|
59 |
//
|
|
60 |
CMmsHeaders::CMmsHeaders():
|
|
61 |
iLinearOrder( CMmsSendingChain::Compare ),
|
|
62 |
iDeleteResultOrder( CMmsDeleteResultArray::Compare )
|
|
63 |
// in a class derived from CBase all member variables are set initially to 0
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
// Symbian OS default constructor can leave.
|
|
68 |
void CMmsHeaders::ConstructL( TInt16 aMmsDefaultVersion )
|
|
69 |
{
|
|
70 |
iToArray = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
71 |
iCcArray = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
72 |
iBccArray = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
73 |
iMmsDefaultVersion = aMmsDefaultVersion;
|
|
74 |
if ( iMmsDefaultVersion < KMmsMinimumSupportedVersion ||
|
|
75 |
iMmsDefaultVersion > KMmsMaximumSupportedVersion )
|
|
76 |
{
|
|
77 |
// The supported default version must be within limits.
|
|
78 |
// The actual messages can carry any version
|
|
79 |
iMmsDefaultVersion = KMmsDefaultVersion;
|
|
80 |
}
|
|
81 |
Reset( NULL );
|
|
82 |
}
|
|
83 |
|
|
84 |
// Two-phased constructor.
|
|
85 |
EXPORT_C CMmsHeaders* CMmsHeaders::NewL( TInt16 aMmsVersion )
|
|
86 |
{
|
|
87 |
CMmsHeaders* self = new ( ELeave ) CMmsHeaders;
|
|
88 |
|
|
89 |
CleanupStack::PushL( self );
|
|
90 |
// default value for legacy applications that are not aware of mms version
|
|
91 |
self->ConstructL( aMmsVersion );
|
|
92 |
CleanupStack::Pop( self );
|
|
93 |
|
|
94 |
return self;
|
|
95 |
}
|
|
96 |
|
|
97 |
// Two-phased constructor.
|
|
98 |
EXPORT_C CMmsHeaders* CMmsHeaders::NewL()
|
|
99 |
{
|
|
100 |
CMmsHeaders* self = new ( ELeave ) CMmsHeaders;
|
|
101 |
|
|
102 |
CleanupStack::PushL( self );
|
|
103 |
// default value for legacy applications that are not aware of mms version
|
|
104 |
self->ConstructL( KMmsDefaultVersion );
|
|
105 |
CleanupStack::Pop( self );
|
|
106 |
|
|
107 |
return self;
|
|
108 |
}
|
|
109 |
|
|
110 |
// Destructor
|
|
111 |
CMmsHeaders::~CMmsHeaders()
|
|
112 |
{
|
|
113 |
iPreviouslySentArray.ResetAndDestroy();
|
|
114 |
iDeleteResultArray.ResetAndDestroy();
|
|
115 |
delete iOperatorResponseText;
|
|
116 |
delete iReplyChargingId;
|
|
117 |
delete iToArray;
|
|
118 |
delete iCcArray;
|
|
119 |
delete iBccArray;
|
|
120 |
delete iSender;
|
|
121 |
delete iContentLocation;
|
|
122 |
delete iSubject;
|
|
123 |
delete iTID;
|
|
124 |
delete iMessageId;
|
|
125 |
delete iRootContentID;
|
|
126 |
delete iElementDescriptor;
|
|
127 |
delete iMmBoxMessageHeaders;
|
|
128 |
delete iMmBoxViewHeaders;
|
|
129 |
delete iExtendedNotificationText;
|
|
130 |
delete iApplicationId;
|
|
131 |
delete iReplyToApplicationId;
|
|
132 |
delete iApplicationInfo;
|
|
133 |
delete iRecommendedRetrievalModeText;
|
|
134 |
delete iReplaceCancelId;
|
|
135 |
}
|
|
136 |
|
|
137 |
// ---------------------------------------------------------
|
|
138 |
// CMmsHeaders::RestoreL
|
|
139 |
//
|
|
140 |
// ---------------------------------------------------------
|
|
141 |
//
|
|
142 |
|
|
143 |
EXPORT_C void CMmsHeaders::RestoreL(
|
|
144 |
CMsvStore& aStore )
|
|
145 |
{
|
|
146 |
|
|
147 |
RMsvReadStream stream;
|
|
148 |
Reset( NULL ); // all old pointers are deleted here
|
|
149 |
if ( aStore.IsPresentL( KUidMmsHeaderStream ) )
|
|
150 |
{
|
|
151 |
stream.OpenLC( aStore, KUidMmsHeaderStream ); // pushes 'stream' to the stack
|
|
152 |
InternalizeL( stream );
|
|
153 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
154 |
}
|
|
155 |
// restore MMBox header streams if present
|
|
156 |
if ( aStore.IsPresentL( KUidMMsElementDescriptorStream ) )
|
|
157 |
{
|
|
158 |
stream.OpenLC( aStore, KUidMMsElementDescriptorStream ); // pushes 'stream' to the stack
|
|
159 |
iElementDescriptor = new( ELeave )CMmsElementDescriptor;
|
|
160 |
iElementDescriptor->InternalizeL( stream );
|
|
161 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
162 |
}
|
|
163 |
if ( aStore.IsPresentL( KUidMMsMMBoxMessageHeaderStream ) )
|
|
164 |
{
|
|
165 |
stream.OpenLC( aStore, KUidMMsMMBoxMessageHeaderStream ); // pushes 'stream' to the stack
|
|
166 |
iMmBoxMessageHeaders = CMmsMMBoxMessageHeaders::NewL();
|
|
167 |
iMmBoxMessageHeaders->InternalizeL( stream );
|
|
168 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
169 |
}
|
|
170 |
if ( aStore.IsPresentL( KUidMMsMMBoxViewHeadersStream ) )
|
|
171 |
{
|
|
172 |
stream.OpenLC( aStore, KUidMMsMMBoxViewHeadersStream ); // pushes 'stream' to the stack
|
|
173 |
iMmBoxViewHeaders = new( ELeave )CMmsMMBoxViewHeaders;
|
|
174 |
iMmBoxViewHeaders->InternalizeL( stream );
|
|
175 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
176 |
}
|
|
177 |
|
|
178 |
// Extended notification also restored here
|
|
179 |
TInt length = 0; // string length
|
|
180 |
|
|
181 |
// Completeness indicator is not saved or restored.
|
|
182 |
// If we have stored the text, it normally indicates that the message is not complete
|
|
183 |
if ( aStore.IsPresentL( KUidMMsExtendedNotificationStream ) )
|
|
184 |
{
|
|
185 |
stream.OpenLC( aStore, KUidMMsExtendedNotificationStream ); // pushes 'stream' to the stack
|
|
186 |
length = stream.ReadInt32L();
|
|
187 |
if ( length > 0 )
|
|
188 |
{
|
|
189 |
iExtendedNotificationText = HBufC::NewL( stream, length );
|
|
190 |
}
|
|
191 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
192 |
}
|
|
193 |
|
|
194 |
if ( aStore.IsPresentL( KUidMmsApplicationInfoStream ) )
|
|
195 |
{
|
|
196 |
stream.OpenLC( aStore, KUidMmsApplicationInfoStream ); // pushes 'stream' to the stack
|
|
197 |
length = stream.ReadInt32L();
|
|
198 |
if ( length > 0 )
|
|
199 |
{
|
|
200 |
iApplicationId = HBufC::NewL( stream, length );
|
|
201 |
}
|
|
202 |
length = stream.ReadInt32L();
|
|
203 |
if ( length > 0 )
|
|
204 |
{
|
|
205 |
iReplyToApplicationId = HBufC::NewL( stream, length );
|
|
206 |
}
|
|
207 |
length = stream.ReadInt32L();
|
|
208 |
if ( length > 0 )
|
|
209 |
{
|
|
210 |
iApplicationInfo = HBufC8::NewL( stream, length );
|
|
211 |
}
|
|
212 |
|
|
213 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
214 |
}
|
|
215 |
|
|
216 |
if ( aStore.IsPresentL( KUidMmsReserved ) )
|
|
217 |
{
|
|
218 |
stream.OpenLC( aStore, KUidMmsReserved ); // pushes 'stream' to the stack
|
|
219 |
iRecommendedRetrievalMode = stream.ReadInt32L();
|
|
220 |
length = stream.ReadInt32L();
|
|
221 |
if ( length > 0 )
|
|
222 |
{
|
|
223 |
iRecommendedRetrievalModeText = HBufC16::NewL( stream, length );
|
|
224 |
}
|
|
225 |
length = stream.ReadInt32L();
|
|
226 |
if ( length > 0 )
|
|
227 |
{
|
|
228 |
iReplaceCancelId = HBufC8::NewL( stream, length );
|
|
229 |
}
|
|
230 |
iCancelStatus = stream.ReadInt32L();
|
|
231 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
232 |
}
|
|
233 |
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------
|
|
237 |
// CMmsEntry::StoreL
|
|
238 |
//
|
|
239 |
// ---------------------------------------------------------
|
|
240 |
//
|
|
241 |
|
|
242 |
EXPORT_C void CMmsHeaders::StoreL(
|
|
243 |
CMsvStore& aStore )
|
|
244 |
{
|
|
245 |
|
|
246 |
// Check if message root is correctly set
|
|
247 |
// We have an edit store in our hands, so we can access the attachment manager
|
|
248 |
|
|
249 |
if ( iStart != 0 )
|
|
250 |
{
|
|
251 |
MMsvAttachmentManager& attaMan = aStore.AttachmentManagerL();
|
|
252 |
CMsvAttachment* attaInfo = NULL;
|
|
253 |
TRAPD( error, attaInfo = attaMan.GetAttachmentInfoL( iStart ) );
|
|
254 |
if ( error == KErrNotFound )
|
|
255 |
{
|
|
256 |
// The attachment is not present, clear the root indicator
|
|
257 |
iStart = 0;
|
|
258 |
delete iRootContentID;
|
|
259 |
iRootContentID = 0;
|
|
260 |
}
|
|
261 |
else if ( error == KErrNone )
|
|
262 |
{
|
|
263 |
// got the attachment, check content id
|
|
264 |
CleanupStack::PushL( attaInfo );
|
|
265 |
CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
|
|
266 |
CleanupStack::PushL( mimeHeaders );
|
|
267 |
mimeHeaders->RestoreL( *attaInfo );
|
|
268 |
if ( RootContentId().Compare( mimeHeaders->ContentId() ) != 0 )
|
|
269 |
{
|
|
270 |
if ( mimeHeaders->ContentId().Length() > 0 )
|
|
271 |
{
|
|
272 |
// mime headers win
|
|
273 |
SetRootContentIdL( mimeHeaders->ContentId() );
|
|
274 |
}
|
|
275 |
else if ( RootContentId().Length() > 0 )
|
|
276 |
{
|
|
277 |
// if mime headers not set, but root set, root wins
|
|
278 |
mimeHeaders->SetContentIdL( RootContentId() );
|
|
279 |
mimeHeaders->StoreL( *attaInfo );
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
// keep LINT happy
|
|
284 |
}
|
|
285 |
}
|
|
286 |
CleanupStack::PopAndDestroy( mimeHeaders );
|
|
287 |
CleanupStack::PopAndDestroy( attaInfo );
|
|
288 |
}
|
|
289 |
// If error == KErrNoMemory there is nothing we can do
|
|
290 |
// We try to continue anyway, maybe we still can save our message
|
|
291 |
else
|
|
292 |
{
|
|
293 |
// Keep LINT happy.
|
|
294 |
}
|
|
295 |
}
|
|
296 |
|
|
297 |
// caller must commit the store
|
|
298 |
RMsvWriteStream stream;
|
|
299 |
stream.AssignLC( aStore, KUidMmsHeaderStream ); // pushes 'stream' to the stack
|
|
300 |
ExternalizeL( stream );
|
|
301 |
stream.CommitL();
|
|
302 |
stream.Close();
|
|
303 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
304 |
|
|
305 |
// store element descriptor and mmbox headers, if they are present
|
|
306 |
if ( iElementDescriptor )
|
|
307 |
{
|
|
308 |
stream.AssignLC( aStore, KUidMMsElementDescriptorStream ); // pushes 'stream' to the stack
|
|
309 |
iElementDescriptor->ExternalizeL( stream );
|
|
310 |
stream.CommitL();
|
|
311 |
stream.Close();
|
|
312 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
313 |
}
|
|
314 |
if ( iMmBoxMessageHeaders )
|
|
315 |
{
|
|
316 |
stream.AssignLC( aStore, KUidMMsMMBoxMessageHeaderStream ); // pushes 'stream' to the stack
|
|
317 |
iMmBoxMessageHeaders->ExternalizeL( stream );
|
|
318 |
stream.CommitL();
|
|
319 |
stream.Close();
|
|
320 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
321 |
}
|
|
322 |
if ( iMmBoxViewHeaders )
|
|
323 |
{
|
|
324 |
stream.AssignLC( aStore, KUidMMsMMBoxViewHeadersStream ); // pushes 'stream' to the stack
|
|
325 |
iMmBoxViewHeaders->ExternalizeL( stream );
|
|
326 |
stream.CommitL();
|
|
327 |
stream.Close();
|
|
328 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
329 |
}
|
|
330 |
|
|
331 |
TInt length = 0; //
|
|
332 |
// store extended notification if present
|
|
333 |
if ( iExtendedNotificationText )
|
|
334 |
{
|
|
335 |
stream.AssignLC( aStore, KUidMMsExtendedNotificationStream ); // pushes 'stream' to the stack
|
|
336 |
length = ExtendedNotification().Length();
|
|
337 |
stream.WriteInt32L( length );
|
|
338 |
if ( length > 0 )
|
|
339 |
{
|
|
340 |
stream << ExtendedNotification();
|
|
341 |
}
|
|
342 |
stream.CommitL();
|
|
343 |
stream.Close();
|
|
344 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
345 |
}
|
|
346 |
|
|
347 |
if ( iApplicationId ||
|
|
348 |
iReplyToApplicationId ||
|
|
349 |
iApplicationInfo )
|
|
350 |
{
|
|
351 |
stream.AssignLC( aStore, KUidMmsApplicationInfoStream ); // pushes 'stream' to the stack
|
|
352 |
length = ApplicId().Length();
|
|
353 |
stream.WriteInt32L( length );
|
|
354 |
if ( length > 0 && iApplicationId )
|
|
355 |
{
|
|
356 |
stream << iApplicationId->Des();
|
|
357 |
}
|
|
358 |
|
|
359 |
length = ReplyApplicId().Length();
|
|
360 |
stream.WriteInt32L( length );
|
|
361 |
if ( length > 0 && iReplyToApplicationId )
|
|
362 |
{
|
|
363 |
stream << iReplyToApplicationId->Des();
|
|
364 |
}
|
|
365 |
|
|
366 |
length = AuxApplicInfo().Length();
|
|
367 |
stream.WriteInt32L( length );
|
|
368 |
if ( length > 0 && iApplicationInfo )
|
|
369 |
{
|
|
370 |
stream << iApplicationInfo->Des();
|
|
371 |
}
|
|
372 |
|
|
373 |
stream.CommitL();
|
|
374 |
stream.Close();
|
|
375 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
376 |
}
|
|
377 |
|
|
378 |
// reserved transaction info stream
|
|
379 |
if ( iRecommendedRetrievalMode != 0 ||
|
|
380 |
iRecommendedRetrievalModeText ||
|
|
381 |
iReplaceCancelId ||
|
|
382 |
iCancelStatus != 0 )
|
|
383 |
{
|
|
384 |
stream.AssignLC( aStore, KUidMmsReserved ); // pushes 'stream' to the stack
|
|
385 |
|
|
386 |
stream.WriteInt32L( iRecommendedRetrievalMode );
|
|
387 |
|
|
388 |
length = RecommendedRetrievalModeText().Length();
|
|
389 |
stream.WriteInt32L( length );
|
|
390 |
if ( length > 0 && iRecommendedRetrievalModeText )
|
|
391 |
{
|
|
392 |
stream << iRecommendedRetrievalModeText->Des();
|
|
393 |
}
|
|
394 |
|
|
395 |
length = ReplaceCancelId().Length();
|
|
396 |
stream.WriteInt32L( length );
|
|
397 |
if ( length > 0 && iReplaceCancelId )
|
|
398 |
{
|
|
399 |
stream << iReplaceCancelId->Des();
|
|
400 |
}
|
|
401 |
|
|
402 |
stream.WriteInt32L( iCancelStatus );
|
|
403 |
|
|
404 |
stream.CommitL();
|
|
405 |
stream.Close();
|
|
406 |
CleanupStack::PopAndDestroy( &stream ); // close stream
|
|
407 |
}
|
|
408 |
|
|
409 |
}
|
|
410 |
|
|
411 |
// ---------------------------------------------------------
|
|
412 |
// CMmsHeaders::TypedAddresseeList
|
|
413 |
//
|
|
414 |
// ---------------------------------------------------------
|
|
415 |
//
|
|
416 |
EXPORT_C const CDesCArray& CMmsHeaders::TypedAddresseeList(
|
|
417 |
TMmsRecipients aType )
|
|
418 |
{
|
|
419 |
|
|
420 |
TInt type = aType;
|
|
421 |
|
|
422 |
if (type == EMmsTo)
|
|
423 |
{
|
|
424 |
return *iToArray;
|
|
425 |
}
|
|
426 |
else if ( type == EMmsCc )
|
|
427 |
{
|
|
428 |
return *iCcArray;
|
|
429 |
}
|
|
430 |
else
|
|
431 |
{
|
|
432 |
return *iBccArray;
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
// ---------------------------------------------------------
|
|
437 |
// CMmsHeaders::AddTypedAddresseeL
|
|
438 |
//
|
|
439 |
// ---------------------------------------------------------
|
|
440 |
//
|
|
441 |
EXPORT_C void CMmsHeaders::AddTypedAddresseeL(
|
|
442 |
const TDesC& aRealAddress,
|
|
443 |
TMmsRecipients aType )
|
|
444 |
{
|
|
445 |
|
|
446 |
TInt type = aType;
|
|
447 |
|
|
448 |
if ( type == EMmsTo )
|
|
449 |
{
|
|
450 |
iToArray->AppendL( aRealAddress );
|
|
451 |
}
|
|
452 |
if ( type == EMmsCc )
|
|
453 |
{
|
|
454 |
iCcArray->AppendL( aRealAddress );
|
|
455 |
}
|
|
456 |
if ( type == EMmsBcc )
|
|
457 |
{
|
|
458 |
iBccArray->AppendL( aRealAddress );
|
|
459 |
}
|
|
460 |
}
|
|
461 |
|
|
462 |
// ---------------------------------------------------------
|
|
463 |
// CMmsHeaders::RemoveAddresseeL
|
|
464 |
//
|
|
465 |
// ---------------------------------------------------------
|
|
466 |
//
|
|
467 |
EXPORT_C TBool CMmsHeaders::RemoveAddressee( const TDesC& aRealAddress )
|
|
468 |
{
|
|
469 |
|
|
470 |
if ( RemoveAddressee( *iToArray, aRealAddress) )
|
|
471 |
{
|
|
472 |
return ETrue;
|
|
473 |
}
|
|
474 |
if ( RemoveAddressee( *iCcArray, aRealAddress) )
|
|
475 |
{
|
|
476 |
return ETrue;
|
|
477 |
}
|
|
478 |
if ( RemoveAddressee( *iBccArray, aRealAddress) )
|
|
479 |
{
|
|
480 |
return ETrue;
|
|
481 |
}
|
|
482 |
|
|
483 |
return EFalse;
|
|
484 |
|
|
485 |
}
|
|
486 |
|
|
487 |
// ---------------------------------------------------------
|
|
488 |
// CMmsHeaders::SetSubjectL
|
|
489 |
//
|
|
490 |
// ---------------------------------------------------------
|
|
491 |
//
|
|
492 |
EXPORT_C void CMmsHeaders::SetSubjectL( const TDesC& aSubject )
|
|
493 |
{
|
|
494 |
HBufC* newAttrib = aSubject.AllocL();
|
|
495 |
delete iSubject;
|
|
496 |
iSubject = newAttrib;
|
|
497 |
}
|
|
498 |
|
|
499 |
// ---------------------------------------------------------
|
|
500 |
// CMmsHeaders::Subject
|
|
501 |
//
|
|
502 |
// ---------------------------------------------------------
|
|
503 |
//
|
|
504 |
EXPORT_C TPtrC CMmsHeaders::Subject() const
|
|
505 |
{
|
|
506 |
return iSubject ? TPtrC( *iSubject ) : TPtrC();
|
|
507 |
}
|
|
508 |
|
|
509 |
// ---------------------------------------------------------
|
|
510 |
// CMmsHeaders::SetSenderL
|
|
511 |
//
|
|
512 |
// ---------------------------------------------------------
|
|
513 |
//
|
|
514 |
EXPORT_C void CMmsHeaders::SetSenderL( const TDesC& aAlias )
|
|
515 |
{
|
|
516 |
HBufC* newAttrib = aAlias.AllocL();
|
|
517 |
delete iSender;
|
|
518 |
iSender = newAttrib;
|
|
519 |
}
|
|
520 |
|
|
521 |
// ---------------------------------------------------------
|
|
522 |
// CMmsHeaders::Sender
|
|
523 |
//
|
|
524 |
// ---------------------------------------------------------
|
|
525 |
//
|
|
526 |
EXPORT_C TPtrC CMmsHeaders::Sender() const
|
|
527 |
{
|
|
528 |
return iSender ? TPtrC( *iSender ) : TPtrC();
|
|
529 |
}
|
|
530 |
|
|
531 |
// ---------------------------------------------------------
|
|
532 |
// CMmsHeaders::SetExpiryInterval
|
|
533 |
//
|
|
534 |
// ---------------------------------------------------------
|
|
535 |
//
|
|
536 |
EXPORT_C void CMmsHeaders::SetExpiryInterval(
|
|
537 |
TInt aInterval )
|
|
538 |
{
|
|
539 |
iExpiry = aInterval;
|
|
540 |
iExpiryAbs = EFalse;
|
|
541 |
}
|
|
542 |
|
|
543 |
// ---------------------------------------------------------
|
|
544 |
// CMmsHeaders::ExpiryInterval
|
|
545 |
//
|
|
546 |
// ---------------------------------------------------------
|
|
547 |
//
|
|
548 |
EXPORT_C TInt CMmsHeaders::ExpiryInterval()
|
|
549 |
{
|
|
550 |
return iExpiryAbs ? 0 : I64LOW( iExpiry );
|
|
551 |
}
|
|
552 |
|
|
553 |
|
|
554 |
// ---------------------------------------------------------
|
|
555 |
// CMmsHeaders::SetExpiryDate
|
|
556 |
//
|
|
557 |
// ---------------------------------------------------------
|
|
558 |
//
|
|
559 |
EXPORT_C void CMmsHeaders::SetExpiryDate( TInt64 aDate )
|
|
560 |
{
|
|
561 |
iExpiry = aDate;
|
|
562 |
iExpiryAbs = ETrue;
|
|
563 |
}
|
|
564 |
|
|
565 |
// ---------------------------------------------------------
|
|
566 |
// CMmsHeaders::ExpiryDate
|
|
567 |
//
|
|
568 |
// ---------------------------------------------------------
|
|
569 |
//
|
|
570 |
EXPORT_C TInt64 CMmsHeaders::ExpiryDate()
|
|
571 |
{
|
|
572 |
return iExpiryAbs ? iExpiry : TInt64( 0 );
|
|
573 |
}
|
|
574 |
|
|
575 |
// ---------------------------------------------------------
|
|
576 |
// CMmsHeaders::SetDeliveryTimeInterval
|
|
577 |
//
|
|
578 |
// ---------------------------------------------------------
|
|
579 |
//
|
|
580 |
EXPORT_C void CMmsHeaders::SetDeliveryTimeInterval( TInt aInterval )
|
|
581 |
{
|
|
582 |
iDelivery = aInterval;
|
|
583 |
iDeliveryAbs = EFalse;
|
|
584 |
}
|
|
585 |
|
|
586 |
// ---------------------------------------------------------
|
|
587 |
// CMmsHeaders::DeliveryTimeInterval
|
|
588 |
//
|
|
589 |
// ---------------------------------------------------------
|
|
590 |
//
|
|
591 |
EXPORT_C TInt CMmsHeaders::DeliveryTimeInterval()
|
|
592 |
{
|
|
593 |
return iDeliveryAbs ? 0 : I64LOW( iDelivery );
|
|
594 |
}
|
|
595 |
|
|
596 |
// ---------------------------------------------------------
|
|
597 |
// CMmsHeaders::SetDeliveryDate
|
|
598 |
//
|
|
599 |
// ---------------------------------------------------------
|
|
600 |
//
|
|
601 |
EXPORT_C void CMmsHeaders::SetDeliveryDate( TInt64 aDate )
|
|
602 |
{
|
|
603 |
iDelivery = aDate;
|
|
604 |
iDeliveryAbs = ETrue;
|
|
605 |
}
|
|
606 |
|
|
607 |
// ---------------------------------------------------------
|
|
608 |
// CMmsHeaders::DeliveryDate
|
|
609 |
//
|
|
610 |
// ---------------------------------------------------------
|
|
611 |
//
|
|
612 |
EXPORT_C TInt64 CMmsHeaders::DeliveryDate()
|
|
613 |
{
|
|
614 |
return iDeliveryAbs ? iDelivery : TInt64( 0 );
|
|
615 |
}
|
|
616 |
|
|
617 |
// ---------------------------------------------------------
|
|
618 |
// CMmsHeaders::SetTidL
|
|
619 |
//
|
|
620 |
// ---------------------------------------------------------
|
|
621 |
//
|
|
622 |
EXPORT_C void CMmsHeaders::SetTidL( const TDesC8& aCid )
|
|
623 |
{
|
|
624 |
// If New TID has length zero, TID is cleared
|
|
625 |
if ( aCid.Length() == 0 )
|
|
626 |
{
|
|
627 |
delete iTID;
|
|
628 |
iTID = NULL;
|
|
629 |
}
|
|
630 |
else
|
|
631 |
{
|
|
632 |
HBufC8 * newAttrib = aCid.AllocL();
|
|
633 |
if ( newAttrib->Length() > KMaxHeaderStringLength )
|
|
634 |
{
|
|
635 |
newAttrib->Des().SetLength( KMaxHeaderStringLength );
|
|
636 |
}
|
|
637 |
delete iTID;
|
|
638 |
iTID = newAttrib;
|
|
639 |
}
|
|
640 |
}
|
|
641 |
|
|
642 |
// ---------------------------------------------------------
|
|
643 |
// CMmsHeaders::ContentLocation
|
|
644 |
//
|
|
645 |
// ---------------------------------------------------------
|
|
646 |
//
|
|
647 |
|
|
648 |
EXPORT_C TPtrC8 CMmsHeaders::ContentLocation() const
|
|
649 |
{
|
|
650 |
return iContentLocation ? TPtrC8( *iContentLocation ) : TPtrC8();
|
|
651 |
}
|
|
652 |
|
|
653 |
// ---------------------------------------------------------
|
|
654 |
// CMmsHeaders::SetContentLocationL
|
|
655 |
//
|
|
656 |
// ---------------------------------------------------------
|
|
657 |
//
|
|
658 |
EXPORT_C void CMmsHeaders::SetContentLocationL( const TDesC8& aURL )
|
|
659 |
{
|
|
660 |
HBufC8 * newAttrib = aURL.AllocL();
|
|
661 |
if ( newAttrib->Length() > KMaxHeaderStringLength )
|
|
662 |
{
|
|
663 |
newAttrib->Des().SetLength( KMaxHeaderStringLength );
|
|
664 |
}
|
|
665 |
delete iContentLocation;
|
|
666 |
iContentLocation = newAttrib;
|
|
667 |
}
|
|
668 |
|
|
669 |
// ---------------------------------------------------------
|
|
670 |
// CMmsHeaders::Tid
|
|
671 |
//
|
|
672 |
// ---------------------------------------------------------
|
|
673 |
//
|
|
674 |
EXPORT_C TPtrC8 CMmsHeaders::Tid() const
|
|
675 |
{
|
|
676 |
return iTID ? TPtrC8( *iTID ) : TPtrC8();
|
|
677 |
}
|
|
678 |
|
|
679 |
// ---------------------------------------------------------
|
|
680 |
// CMmsHeaders::InternalizeL
|
|
681 |
//
|
|
682 |
// ---------------------------------------------------------
|
|
683 |
//
|
|
684 |
EXPORT_C void CMmsHeaders::InternalizeL( RMsvReadStream& aStream )
|
|
685 |
{
|
|
686 |
|
|
687 |
aStream >> iVersion;
|
|
688 |
aStream >> iMsgType;
|
|
689 |
|
|
690 |
iSubject = HBufC::NewL( aStream, KMaxHeaderStringLength );
|
|
691 |
iTID = HBufC8::NewL( aStream, KMaxHeaderStringLength );
|
|
692 |
aStream >> iDate;
|
|
693 |
|
|
694 |
iSender = HBufC::NewL( aStream, KMaxHeaderStringLength );
|
|
695 |
aStream >> iMsgClass;
|
|
696 |
|
|
697 |
aStream >> iExpiry;
|
|
698 |
iExpiryAbs = aStream.ReadInt8L();
|
|
699 |
aStream >> iDelivery;
|
|
700 |
iDeliveryAbs = aStream.ReadInt8L();
|
|
701 |
|
|
702 |
aStream >> iPriority;
|
|
703 |
aStream >> iSenderVisi;
|
|
704 |
|
|
705 |
aStream >> iDelivReport;
|
|
706 |
aStream >> iReadReply;
|
|
707 |
|
|
708 |
iStart = aStream.ReadInt32L();
|
|
709 |
iContentLocation = HBufC8::NewL( aStream, KMaxHeaderStringLength );
|
|
710 |
|
|
711 |
aStream >> iMessageSize;
|
|
712 |
aStream >> iReportAllowed;
|
|
713 |
aStream >> iResponseStatus;
|
|
714 |
|
|
715 |
iMessageId = HBufC8::NewL( aStream, KMaxHeaderStringLength );
|
|
716 |
aStream >> iStatus;
|
|
717 |
|
|
718 |
aStream >> iMaxImageWidth;
|
|
719 |
aStream >> iMaxImageHeight;
|
|
720 |
|
|
721 |
// Internalize fields which may have multiple values.
|
|
722 |
InternalizeArrayL( *iToArray, aStream );
|
|
723 |
InternalizeArrayL( *iCcArray, aStream );
|
|
724 |
InternalizeArrayL( *iBccArray, aStream );
|
|
725 |
|
|
726 |
TInt32 length = 0;
|
|
727 |
length = aStream.ReadInt32L();
|
|
728 |
|
|
729 |
if ( length > 0 )
|
|
730 |
{
|
|
731 |
iRootContentID = HBufC8::NewL( aStream, length );
|
|
732 |
}
|
|
733 |
|
|
734 |
length = aStream.ReadInt32L();
|
|
735 |
if ( length > 0 )
|
|
736 |
{
|
|
737 |
iOperatorResponseText = HBufC::NewL( aStream, length );
|
|
738 |
}
|
|
739 |
|
|
740 |
TInt i;
|
|
741 |
aStream >> iReadStatus;
|
|
742 |
aStream >> iReplyCharging;
|
|
743 |
aStream >> iReplyChargingDeadline;
|
|
744 |
iReplyChargingAbs = aStream.ReadInt8L();
|
|
745 |
aStream >> iReplyChargingSize;
|
|
746 |
aStream >> length;
|
|
747 |
if ( length > 0 )
|
|
748 |
{
|
|
749 |
iReplyChargingId = HBufC8::NewL( aStream, length );
|
|
750 |
}
|
|
751 |
|
|
752 |
aStream >> length;
|
|
753 |
|
|
754 |
for ( i = 0; i < length ; i++ )
|
|
755 |
{
|
|
756 |
CMmsSendingChain* item = new( ELeave )CMmsSendingChain;
|
|
757 |
CleanupStack::PushL( item );
|
|
758 |
item->InternalizeL( aStream );
|
|
759 |
User::LeaveIfError( iPreviouslySentArray.InsertInOrder( item, iLinearOrder ));
|
|
760 |
CleanupStack::Pop( item ); // item is in member array now
|
|
761 |
}
|
|
762 |
|
|
763 |
iDistributionIndicator = aStream.ReadInt32L();
|
|
764 |
|
|
765 |
iRelatedEntry = aStream.ReadInt32L();
|
|
766 |
iMultipartType = aStream.ReadInt32L();
|
|
767 |
|
|
768 |
TInt64 tempTime;
|
|
769 |
aStream >> tempTime;
|
|
770 |
iReceivingTime = TTime( tempTime );
|
|
771 |
|
|
772 |
iContentClass = aStream.ReadInt32L();
|
|
773 |
iDrmContent = aStream.ReadInt32L();
|
|
774 |
iAdaptationAllowed = aStream.ReadInt32L();
|
|
775 |
}
|
|
776 |
|
|
777 |
// ---------------------------------------------------------
|
|
778 |
// CMmsHeaders::ExternalizeL
|
|
779 |
//
|
|
780 |
// ---------------------------------------------------------
|
|
781 |
//
|
|
782 |
EXPORT_C void CMmsHeaders::ExternalizeL( RMsvWriteStream& aStream ) const
|
|
783 |
{
|
|
784 |
|
|
785 |
// This MUST be the 1st item written into the stream
|
|
786 |
aStream << iVersion;
|
|
787 |
// This must be 2nd.
|
|
788 |
aStream << iMsgType;
|
|
789 |
|
|
790 |
aStream << LimitStringSize( Subject(), KMaxHeaderStringLength );
|
|
791 |
aStream << LimitStringSize( Tid(), KMaxHeaderStringLength );
|
|
792 |
aStream << iDate;
|
|
793 |
|
|
794 |
aStream << LimitStringSize( Sender(), KMaxHeaderStringLength );
|
|
795 |
aStream << iMsgClass;
|
|
796 |
|
|
797 |
aStream << iExpiry;
|
|
798 |
aStream.WriteInt8L( iExpiryAbs );
|
|
799 |
aStream << iDelivery;
|
|
800 |
aStream.WriteInt8L( iDeliveryAbs );
|
|
801 |
|
|
802 |
aStream << iPriority;
|
|
803 |
aStream << iSenderVisi;
|
|
804 |
|
|
805 |
aStream << iDelivReport;
|
|
806 |
aStream << iReadReply;
|
|
807 |
|
|
808 |
aStream.WriteInt32L( iStart );
|
|
809 |
aStream << LimitStringSize( ContentLocation(), KMaxHeaderStringLength );
|
|
810 |
|
|
811 |
aStream << iMessageSize;
|
|
812 |
aStream << iReportAllowed;
|
|
813 |
aStream << iResponseStatus;
|
|
814 |
|
|
815 |
aStream << LimitStringSize( MessageId(), KMaxHeaderStringLength );
|
|
816 |
aStream << iStatus;
|
|
817 |
|
|
818 |
aStream << iMaxImageWidth;
|
|
819 |
aStream << iMaxImageHeight;
|
|
820 |
|
|
821 |
// Externalize fields which may have multiple values.
|
|
822 |
ExternalizeArrayL( *iToArray, aStream );
|
|
823 |
ExternalizeArrayL( *iCcArray, aStream );
|
|
824 |
ExternalizeArrayL( *iBccArray, aStream );
|
|
825 |
|
|
826 |
TInt32 length;
|
|
827 |
length = RootContentId().Length();
|
|
828 |
aStream << length;
|
|
829 |
if ( length > 0 )
|
|
830 |
{
|
|
831 |
aStream << RootContentId();
|
|
832 |
}
|
|
833 |
length = ResponseText().Length();
|
|
834 |
aStream << length;
|
|
835 |
if ( length > 0 )
|
|
836 |
{
|
|
837 |
aStream << ResponseText();
|
|
838 |
}
|
|
839 |
|
|
840 |
TInt i;
|
|
841 |
aStream << iReadStatus;
|
|
842 |
aStream << iReplyCharging;
|
|
843 |
aStream << iReplyChargingDeadline;
|
|
844 |
aStream.WriteInt8L( iReplyChargingAbs );
|
|
845 |
aStream << iReplyChargingSize;
|
|
846 |
length = ReplyChargingId().Length();
|
|
847 |
aStream << length;
|
|
848 |
if ( length > 0 )
|
|
849 |
{
|
|
850 |
aStream << ReplyChargingId();
|
|
851 |
}
|
|
852 |
|
|
853 |
length = iPreviouslySentArray.Count();
|
|
854 |
aStream << length;
|
|
855 |
for ( i = 0; i < iPreviouslySentArray.Count(); i++ )
|
|
856 |
{
|
|
857 |
iPreviouslySentArray[ i ]->ExternalizeL( aStream );
|
|
858 |
}
|
|
859 |
|
|
860 |
aStream.WriteInt32L( iDistributionIndicator );
|
|
861 |
aStream.WriteInt32L( iRelatedEntry );
|
|
862 |
aStream.WriteInt32L( iMultipartType );
|
|
863 |
|
|
864 |
aStream << iReceivingTime.Int64();
|
|
865 |
|
|
866 |
aStream.WriteInt32L( iContentClass );
|
|
867 |
aStream.WriteInt32L( iDrmContent );
|
|
868 |
aStream.WriteInt32L( iAdaptationAllowed );
|
|
869 |
|
|
870 |
}
|
|
871 |
|
|
872 |
// ---------------------------------------------------------
|
|
873 |
// CMmsHeaders::ElementDescriptorL
|
|
874 |
//
|
|
875 |
// ---------------------------------------------------------
|
|
876 |
//
|
|
877 |
EXPORT_C CMmsElementDescriptor& CMmsHeaders::ElementDescriptorL()
|
|
878 |
{
|
|
879 |
if ( !iElementDescriptor )
|
|
880 |
{
|
|
881 |
iElementDescriptor = new( ELeave )CMmsElementDescriptor;
|
|
882 |
}
|
|
883 |
return *iElementDescriptor;
|
|
884 |
}
|
|
885 |
|
|
886 |
// ---------------------------------------------------------
|
|
887 |
// CMmsHeaders::MMBoxMessageHeadersL
|
|
888 |
//
|
|
889 |
// ---------------------------------------------------------
|
|
890 |
//
|
|
891 |
EXPORT_C CMmsMMBoxMessageHeaders& CMmsHeaders::MMBoxMessageHeadersL()
|
|
892 |
{
|
|
893 |
if ( !iMmBoxMessageHeaders )
|
|
894 |
{
|
|
895 |
iMmBoxMessageHeaders = CMmsMMBoxMessageHeaders::NewL();
|
|
896 |
}
|
|
897 |
return *iMmBoxMessageHeaders;
|
|
898 |
}
|
|
899 |
|
|
900 |
// ---------------------------------------------------------
|
|
901 |
// CMmsHeaders::MMBoxViewHeadersL
|
|
902 |
//
|
|
903 |
// ---------------------------------------------------------
|
|
904 |
//
|
|
905 |
EXPORT_C CMmsMMBoxViewHeaders& CMmsHeaders::MMBoxViewHeadersL()
|
|
906 |
{
|
|
907 |
if ( !iMmBoxViewHeaders )
|
|
908 |
{
|
|
909 |
iMmBoxViewHeaders = new( ELeave )CMmsMMBoxViewHeaders;
|
|
910 |
}
|
|
911 |
return *iMmBoxViewHeaders;
|
|
912 |
}
|
|
913 |
|
|
914 |
// ---------------------------------------------------------
|
|
915 |
// CMmsHeaders::SetExtendedNotificationL
|
|
916 |
//
|
|
917 |
// ---------------------------------------------------------
|
|
918 |
//
|
|
919 |
EXPORT_C void CMmsHeaders::SetExtendedNotificationL( const TDesC& aText )
|
|
920 |
{
|
|
921 |
HBufC* newAttrib = NULL;
|
|
922 |
if ( aText.Length() > 0 )
|
|
923 |
{
|
|
924 |
newAttrib = aText.AllocL();
|
|
925 |
}
|
|
926 |
delete iExtendedNotificationText;
|
|
927 |
iExtendedNotificationText = newAttrib;
|
|
928 |
}
|
|
929 |
|
|
930 |
// ---------------------------------------------------------
|
|
931 |
// CMmsHeaders::ExtendedNotification
|
|
932 |
//
|
|
933 |
// ---------------------------------------------------------
|
|
934 |
//
|
|
935 |
EXPORT_C TPtrC CMmsHeaders::ExtendedNotification() const
|
|
936 |
{
|
|
937 |
return iExtendedNotificationText ? TPtrC( *iExtendedNotificationText ) : TPtrC();
|
|
938 |
}
|
|
939 |
|
|
940 |
// ---------------------------------------------------------
|
|
941 |
// CMmsHeaders::RemoveAddressee
|
|
942 |
//
|
|
943 |
// ---------------------------------------------------------
|
|
944 |
//
|
|
945 |
TBool CMmsHeaders::RemoveAddressee(
|
|
946 |
CDesCArray& aList,
|
|
947 |
const TDesC& aAddress )
|
|
948 |
{
|
|
949 |
|
|
950 |
TInt count = aList.Count();
|
|
951 |
TInt i;
|
|
952 |
|
|
953 |
// We must compare only pure addresses.
|
|
954 |
// The list may contain addresses that include aliases.
|
|
955 |
for ( i = count - 1; i >= 0; i-- )
|
|
956 |
{
|
|
957 |
if ( TMmsGenUtils::PureAddress( aAddress ).CompareF(
|
|
958 |
TMmsGenUtils::PureAddress( aList.MdcaPoint( i ) ) ) == 0 )
|
|
959 |
{
|
|
960 |
aList.Delete( i );
|
|
961 |
aList.Compress();
|
|
962 |
return ETrue;
|
|
963 |
}
|
|
964 |
}
|
|
965 |
|
|
966 |
return EFalse;
|
|
967 |
}
|
|
968 |
|
|
969 |
// ---------------------------------------------------------
|
|
970 |
// CMmsHeaders::Reset
|
|
971 |
//
|
|
972 |
// ---------------------------------------------------------
|
|
973 |
//
|
|
974 |
EXPORT_C void CMmsHeaders::Reset( CMmsSettings* aSettings )
|
|
975 |
{
|
|
976 |
|
|
977 |
iMsgType = 0;
|
|
978 |
|
|
979 |
delete iTID;
|
|
980 |
iTID = NULL;
|
|
981 |
|
|
982 |
// Always restore the default version - even if not reading other settings
|
|
983 |
iVersion = iMmsDefaultVersion;
|
|
984 |
iDate = 0;
|
|
985 |
|
|
986 |
delete iSender;
|
|
987 |
iSender = NULL;
|
|
988 |
|
|
989 |
iToArray->Reset();
|
|
990 |
iCcArray->Reset();
|
|
991 |
iBccArray->Reset();
|
|
992 |
|
|
993 |
delete iSubject;
|
|
994 |
iSubject = NULL;
|
|
995 |
|
|
996 |
iMsgClass = 0;
|
|
997 |
|
|
998 |
iExpiry = 0;
|
|
999 |
iExpiryAbs = 0;
|
|
1000 |
iDelivery = 0;
|
|
1001 |
iDeliveryAbs = 0;
|
|
1002 |
iPriority = 0;
|
|
1003 |
iSenderVisi = 0;
|
|
1004 |
iDelivReport = 0;
|
|
1005 |
iReadReply = 0;
|
|
1006 |
iStart = KMsvNullIndexEntryId;
|
|
1007 |
|
|
1008 |
delete iContentLocation;
|
|
1009 |
iContentLocation = NULL;
|
|
1010 |
|
|
1011 |
iMessageSize = 0;
|
|
1012 |
iReportAllowed = 0;
|
|
1013 |
iResponseStatus = 0;
|
|
1014 |
|
|
1015 |
delete iMessageId;
|
|
1016 |
iMessageId = NULL;
|
|
1017 |
|
|
1018 |
iStatus = 0;
|
|
1019 |
|
|
1020 |
iMaxImageHeight = 0;
|
|
1021 |
iMaxImageWidth = 0;
|
|
1022 |
|
|
1023 |
delete iOperatorResponseText;
|
|
1024 |
iOperatorResponseText = NULL;
|
|
1025 |
|
|
1026 |
delete iRootContentID;
|
|
1027 |
iRootContentID = NULL;
|
|
1028 |
|
|
1029 |
iReadStatus = 0;
|
|
1030 |
iReplyCharging = 0;
|
|
1031 |
iReplyChargingDeadline = 0;
|
|
1032 |
iReplyChargingAbs = EFalse;
|
|
1033 |
delete iReplyChargingId;
|
|
1034 |
iReplyChargingId = NULL;
|
|
1035 |
iReplyChargingSize = 0;
|
|
1036 |
iPreviouslySentArray.ResetAndDestroy();
|
|
1037 |
iDeleteResultArray.ResetAndDestroy();
|
|
1038 |
|
|
1039 |
iDistributionIndicator = 0;
|
|
1040 |
iRelatedEntry = 0;
|
|
1041 |
iMultipartType = 0;
|
|
1042 |
iReceivingTime = 0;
|
|
1043 |
// encapsulation 1.3 headers
|
|
1044 |
iContentClass = 0;
|
|
1045 |
iDrmContent = 0;
|
|
1046 |
iAdaptationAllowed = 0;
|
|
1047 |
|
|
1048 |
delete iElementDescriptor;
|
|
1049 |
iElementDescriptor = NULL;
|
|
1050 |
delete iMmBoxMessageHeaders;
|
|
1051 |
iMmBoxMessageHeaders = NULL;
|
|
1052 |
delete iMmBoxViewHeaders;
|
|
1053 |
iMmBoxViewHeaders = NULL;
|
|
1054 |
|
|
1055 |
delete iExtendedNotificationText;
|
|
1056 |
iExtendedNotificationText = NULL;
|
|
1057 |
|
|
1058 |
iExtensionStatus = 0; // set unknown status
|
|
1059 |
|
|
1060 |
delete iApplicationId;
|
|
1061 |
iApplicationId = NULL;
|
|
1062 |
delete iReplyToApplicationId;
|
|
1063 |
iReplyToApplicationId = NULL;
|
|
1064 |
delete iApplicationInfo;
|
|
1065 |
iApplicationInfo = NULL;
|
|
1066 |
|
|
1067 |
iRecommendedRetrievalMode = 0;
|
|
1068 |
delete iRecommendedRetrievalModeText;
|
|
1069 |
iRecommendedRetrievalModeText = NULL;
|
|
1070 |
delete iReplaceCancelId;
|
|
1071 |
iReplaceCancelId = NULL;
|
|
1072 |
iCancelStatus = 0;
|
|
1073 |
|
|
1074 |
SetSettings( aSettings );
|
|
1075 |
|
|
1076 |
}
|
|
1077 |
|
|
1078 |
// ---------------------------------------------------------
|
|
1079 |
// CMmsHeaders::Size
|
|
1080 |
//
|
|
1081 |
// ---------------------------------------------------------
|
|
1082 |
//
|
|
1083 |
EXPORT_C TInt CMmsHeaders::Size() const
|
|
1084 |
{
|
|
1085 |
|
|
1086 |
TInt size = sizeof( iMsgType );
|
|
1087 |
|
|
1088 |
size+= Tid().Size();
|
|
1089 |
|
|
1090 |
size+= sizeof( iVersion );
|
|
1091 |
|
|
1092 |
size+= sizeof( iDate );
|
|
1093 |
|
|
1094 |
TInt i;
|
|
1095 |
|
|
1096 |
TInt nbr = iToArray->MdcaCount();
|
|
1097 |
for ( i=0; i < nbr; ++i )
|
|
1098 |
{
|
|
1099 |
size += iToArray->MdcaPoint(i).Size();
|
|
1100 |
}
|
|
1101 |
|
|
1102 |
nbr = iCcArray->MdcaCount();
|
|
1103 |
for ( i=0; i < nbr; ++i )
|
|
1104 |
{
|
|
1105 |
size+=iCcArray->MdcaPoint(i).Size();
|
|
1106 |
}
|
|
1107 |
|
|
1108 |
nbr = iBccArray->MdcaCount();
|
|
1109 |
for ( i=0; i < nbr; ++i )
|
|
1110 |
{
|
|
1111 |
size+=iBccArray->MdcaPoint(i).Size();
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
size+= Sender().Size();
|
|
1115 |
|
|
1116 |
size+= Subject().Size();
|
|
1117 |
|
|
1118 |
size+= sizeof( iMsgClass );
|
|
1119 |
|
|
1120 |
size+= sizeof( iExpiry );
|
|
1121 |
|
|
1122 |
size+= sizeof( iExpiryAbs );
|
|
1123 |
|
|
1124 |
size+= sizeof( iDelivery );
|
|
1125 |
|
|
1126 |
size+= sizeof( iDeliveryAbs );
|
|
1127 |
|
|
1128 |
size+= sizeof( iPriority );
|
|
1129 |
|
|
1130 |
size+= sizeof( iSenderVisi );
|
|
1131 |
|
|
1132 |
size+= sizeof( iDelivReport );
|
|
1133 |
|
|
1134 |
size+= sizeof( iReadReply );
|
|
1135 |
|
|
1136 |
size+= sizeof( iStart );
|
|
1137 |
|
|
1138 |
size+= ContentLocation().Size();
|
|
1139 |
|
|
1140 |
size+= sizeof( iMessageSize );
|
|
1141 |
|
|
1142 |
size+= sizeof( iReportAllowed );
|
|
1143 |
|
|
1144 |
size+= sizeof( iResponseStatus );
|
|
1145 |
|
|
1146 |
size+= MessageId().Size();
|
|
1147 |
|
|
1148 |
size+= sizeof( iStatus );
|
|
1149 |
|
|
1150 |
size+= sizeof( iMaxImageWidth );
|
|
1151 |
|
|
1152 |
size+= sizeof( iMaxImageHeight );
|
|
1153 |
|
|
1154 |
// operator response text
|
|
1155 |
size += sizeof( TInt32 );
|
|
1156 |
size += ResponseText().Length();
|
|
1157 |
|
|
1158 |
// length of root content
|
|
1159 |
size+= sizeof( TInt32 );
|
|
1160 |
size += RootContentId().Length();
|
|
1161 |
|
|
1162 |
if ( iVersion > KMmsVersion1 )
|
|
1163 |
{
|
|
1164 |
size+= sizeof( iReadStatus );
|
|
1165 |
|
|
1166 |
size+= sizeof( iReplyCharging );
|
|
1167 |
|
|
1168 |
size+= sizeof( iReplyChargingDeadline );
|
|
1169 |
|
|
1170 |
size+= sizeof( iReplyChargingAbs );
|
|
1171 |
|
|
1172 |
size+= sizeof( iReplyChargingSize );
|
|
1173 |
|
|
1174 |
// length of reply charging id
|
|
1175 |
size+= sizeof( TInt32 );
|
|
1176 |
size+= ReplyChargingId().Length();
|
|
1177 |
|
|
1178 |
// number of items in array
|
|
1179 |
size+= sizeof( TInt32 );
|
|
1180 |
for ( i = 0; i < iPreviouslySentArray.Count(); i++ )
|
|
1181 |
{
|
|
1182 |
size += iPreviouslySentArray[ i ]->Size();
|
|
1183 |
}
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
size += sizeof( iDistributionIndicator );
|
|
1187 |
size += sizeof( iRelatedEntry );
|
|
1188 |
size += sizeof( iMultipartType );
|
|
1189 |
size += sizeof( iReceivingTime );
|
|
1190 |
|
|
1191 |
// iContentClass, iDrmContent & iAdaptationAllowed
|
|
1192 |
size += sizeof( TInt32 );
|
|
1193 |
size += sizeof( TInt32 );
|
|
1194 |
size += sizeof( TInt32 );
|
|
1195 |
|
|
1196 |
// add element descriptor and mmbox header sizes
|
|
1197 |
if ( iElementDescriptor )
|
|
1198 |
{
|
|
1199 |
size += iElementDescriptor->Size();
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
if ( iMmBoxMessageHeaders )
|
|
1203 |
{
|
|
1204 |
size += iMmBoxMessageHeaders->Size();
|
|
1205 |
}
|
|
1206 |
|
|
1207 |
if ( iMmBoxViewHeaders )
|
|
1208 |
{
|
|
1209 |
size += iMmBoxViewHeaders->Size();
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
// add extended notification size
|
|
1213 |
if ( ExtendedNotification().Length() > 0 )
|
|
1214 |
{
|
|
1215 |
// size of lenghth
|
|
1216 |
size+= sizeof( TInt32 );
|
|
1217 |
size += ExtendedNotification().Size();
|
|
1218 |
}
|
|
1219 |
|
|
1220 |
if ( iApplicationId ||
|
|
1221 |
iReplyToApplicationId ||
|
|
1222 |
iApplicationInfo )
|
|
1223 |
{
|
|
1224 |
// size of lenghth
|
|
1225 |
size+= sizeof( TInt32 );
|
|
1226 |
size += ApplicId().Size();
|
|
1227 |
size+= sizeof( TInt32 );
|
|
1228 |
size += ReplyApplicId().Size();
|
|
1229 |
size+= sizeof( TInt32 );
|
|
1230 |
size += AuxApplicInfo().Size();
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
if ( iRecommendedRetrievalMode > 0 ||
|
|
1234 |
iRecommendedRetrievalModeText ||
|
|
1235 |
iReplaceCancelId ||
|
|
1236 |
iCancelStatus )
|
|
1237 |
{
|
|
1238 |
size+= sizeof( TInt32 );
|
|
1239 |
size+= sizeof( TInt32 );
|
|
1240 |
size += RecommendedRetrievalModeText().Size();
|
|
1241 |
size+= sizeof( TInt32 );
|
|
1242 |
size += ReplaceCancelId().Size();
|
|
1243 |
size+= sizeof( TInt32 );
|
|
1244 |
}
|
|
1245 |
|
|
1246 |
return size;
|
|
1247 |
|
|
1248 |
}
|
|
1249 |
|
|
1250 |
// ---------------------------------------------------------
|
|
1251 |
// CMmsHeaders::SetMessageIdL
|
|
1252 |
//
|
|
1253 |
// ---------------------------------------------------------
|
|
1254 |
//
|
|
1255 |
EXPORT_C void CMmsHeaders::SetMessageIdL( const TDesC8& aId )
|
|
1256 |
{
|
|
1257 |
HBufC8 * newAttrib = aId.AllocL();
|
|
1258 |
if ( newAttrib->Length() > KMaxHeaderStringLength )
|
|
1259 |
{
|
|
1260 |
newAttrib->Des().SetLength( KMaxHeaderStringLength );
|
|
1261 |
}
|
|
1262 |
delete iMessageId;
|
|
1263 |
iMessageId = newAttrib;
|
|
1264 |
}
|
|
1265 |
|
|
1266 |
// ---------------------------------------------------------
|
|
1267 |
// CMmsHeaders::MessageId
|
|
1268 |
//
|
|
1269 |
// ---------------------------------------------------------
|
|
1270 |
//
|
|
1271 |
EXPORT_C TPtrC8 CMmsHeaders::MessageId() const
|
|
1272 |
{
|
|
1273 |
return iMessageId ? TPtrC8( *iMessageId ) : TPtrC8();
|
|
1274 |
}
|
|
1275 |
|
|
1276 |
// ---------------------------------------------------------
|
|
1277 |
// CMmsHeaders::CopyL
|
|
1278 |
//
|
|
1279 |
// ---------------------------------------------------------
|
|
1280 |
//
|
|
1281 |
|
|
1282 |
EXPORT_C CMmsHeaders* CMmsHeaders::CopyL(
|
|
1283 |
TMsvPartList aParts,
|
|
1284 |
TBool aReply )
|
|
1285 |
{
|
|
1286 |
// legacy function, opens new file system handle
|
|
1287 |
// DEPRECATED
|
|
1288 |
RFs fs;
|
|
1289 |
CleanupClosePushL( fs );
|
|
1290 |
User::LeaveIfError( fs.Connect() );
|
|
1291 |
|
|
1292 |
CMmsHeaders* mms = CopyL( aParts, aReply, fs );
|
|
1293 |
|
|
1294 |
CleanupStack::PopAndDestroy( &fs ); //fs
|
|
1295 |
|
|
1296 |
return mms; // caller takes posession
|
|
1297 |
|
|
1298 |
}
|
|
1299 |
|
|
1300 |
// ---------------------------------------------------------
|
|
1301 |
// CMmsHeaders::CopyL
|
|
1302 |
//
|
|
1303 |
// ---------------------------------------------------------
|
|
1304 |
//
|
|
1305 |
|
|
1306 |
EXPORT_C CMmsHeaders* CMmsHeaders::CopyL(
|
|
1307 |
TMsvPartList aParts,
|
|
1308 |
TBool aReply,
|
|
1309 |
RFs& aFs )
|
|
1310 |
{
|
|
1311 |
|
|
1312 |
CMmsHeaders* mms = CMmsHeaders::NewL();
|
|
1313 |
CleanupStack::PushL( mms );
|
|
1314 |
HBufC* buffer = NULL;
|
|
1315 |
|
|
1316 |
// Copy those values as specified by aParts.
|
|
1317 |
|
|
1318 |
if ( aReply )
|
|
1319 |
{
|
|
1320 |
|
|
1321 |
// Copy original sender as recipient
|
|
1322 |
if ( this->Sender().Length() > 0 )
|
|
1323 |
{
|
|
1324 |
buffer = AliasedAddressL( this->Sender(), aFs );
|
|
1325 |
CleanupStack::PushL( buffer );
|
|
1326 |
mms->AddTypedAddresseeL( buffer->Des(), EMmsTo );
|
|
1327 |
CleanupStack::PopAndDestroy( buffer );
|
|
1328 |
buffer = NULL;
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
if ( aParts & KMsvMessagePartRecipient )
|
|
1332 |
{
|
|
1333 |
// Copy all recipients for reply-to-all message.
|
|
1334 |
const CDesCArray& array1 = this->ToRecipients();
|
|
1335 |
mms->CopyAddresseeListL( array1, EMmsTo, this->Sender(), aFs );
|
|
1336 |
|
|
1337 |
const CDesCArray& array2 = this->BccRecipients();
|
|
1338 |
mms->CopyAddresseeListL( array2, EMmsBcc, this->Sender(), aFs );
|
|
1339 |
|
|
1340 |
const CDesCArray& array3 = this->CcRecipients();
|
|
1341 |
mms->CopyAddresseeListL( array3, EMmsCc, this->Sender(), aFs );
|
|
1342 |
}
|
|
1343 |
}
|
|
1344 |
else
|
|
1345 |
{
|
|
1346 |
// forward
|
|
1347 |
if ( aParts & KMsvMessagePartRecipient )
|
|
1348 |
{
|
|
1349 |
// Copy original Recipient to recipient
|
|
1350 |
const CDesCArray& array1 = this->ToRecipients();
|
|
1351 |
mms->CopyAddresseeListL( array1, EMmsTo, TPtrC(), aFs );
|
|
1352 |
|
|
1353 |
const CDesCArray& array2 = this->BccRecipients();
|
|
1354 |
mms->CopyAddresseeListL( array2, EMmsBcc, TPtrC(), aFs );
|
|
1355 |
|
|
1356 |
const CDesCArray& array3 = this->CcRecipients();
|
|
1357 |
mms->CopyAddresseeListL( array3, EMmsCc, TPtrC(), aFs );
|
|
1358 |
}
|
|
1359 |
if ( aParts & KMsvMessagePartOriginator )
|
|
1360 |
{
|
|
1361 |
// Copy original originator to originator
|
|
1362 |
mms->SetSenderL( Sender() );
|
|
1363 |
}
|
|
1364 |
|
|
1365 |
// message class and priority must always be copied
|
|
1366 |
// when forwarding a message
|
|
1367 |
mms->SetMessageClass( MessageClass() );
|
|
1368 |
mms->SetMessagePriority( MessagePriority() );
|
|
1369 |
|
|
1370 |
// When forwarding a message, root part pointer must be
|
|
1371 |
// copied, too. However, root is referred to by TMsvId,
|
|
1372 |
// and when the message is copied, new id is generated.
|
|
1373 |
// The root pointer copying must be done by someone else.
|
|
1374 |
|
|
1375 |
}
|
|
1376 |
if ( aParts & KMsvMessagePartDescription )
|
|
1377 |
{
|
|
1378 |
mms->SetSubjectL( Subject() );
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
CleanupStack::Pop( mms );
|
|
1382 |
return mms;
|
|
1383 |
}
|
|
1384 |
|
|
1385 |
// ---------------------------------------------------------
|
|
1386 |
// CMmsHeaders::SetSettings
|
|
1387 |
//
|
|
1388 |
// ---------------------------------------------------------
|
|
1389 |
//
|
|
1390 |
EXPORT_C void CMmsHeaders::SetSettings(
|
|
1391 |
CMmsSettings* aSettings )
|
|
1392 |
{
|
|
1393 |
if( !aSettings )
|
|
1394 |
{
|
|
1395 |
return;
|
|
1396 |
}
|
|
1397 |
// Make sure the version number follows the default setting
|
|
1398 |
iMmsDefaultVersion = aSettings->MmsVersion();
|
|
1399 |
iVersion = iMmsDefaultVersion;
|
|
1400 |
SetExpiryInterval( aSettings->ExpiryInterval() );
|
|
1401 |
SetSenderVisibility( aSettings->SenderVisibility() );
|
|
1402 |
SetDeliveryReport( aSettings->DeliveryReportWanted() );
|
|
1403 |
SetReadReply( aSettings->ReadReplyReportWanted() );
|
|
1404 |
// Don't override priority if it has been set already.
|
|
1405 |
// It gets set when message is forwarded.
|
|
1406 |
if ( iPriority == 0 )
|
|
1407 |
{
|
|
1408 |
SetMessagePriority( aSettings->MessagePriority() );
|
|
1409 |
}
|
|
1410 |
// Don't override message class if it has been set already.
|
|
1411 |
// It gets set when message is forwarded.
|
|
1412 |
if ( iMsgClass == 0 )
|
|
1413 |
{
|
|
1414 |
SetMessageClass( aSettings->MessageClass() );
|
|
1415 |
}
|
|
1416 |
SetMaximumImage( aSettings->ImageWidth(), aSettings->ImageHeight());
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
|
|
1420 |
// ---------------------------------------------------------
|
|
1421 |
// CMmsHeaders::SetMaximumImage
|
|
1422 |
//
|
|
1423 |
// ---------------------------------------------------------
|
|
1424 |
//
|
|
1425 |
EXPORT_C void CMmsHeaders::SetMaximumImage(
|
|
1426 |
TInt aWidth, TInt aHeight )
|
|
1427 |
{
|
|
1428 |
iMaxImageHeight = aHeight;
|
|
1429 |
iMaxImageWidth = aWidth;
|
|
1430 |
}
|
|
1431 |
|
|
1432 |
// ---------------------------------------------------------
|
|
1433 |
// CMmsHeaders::GetMaximumImage
|
|
1434 |
//
|
|
1435 |
// ---------------------------------------------------------
|
|
1436 |
//
|
|
1437 |
EXPORT_C void CMmsHeaders::GetMaximumImage(
|
|
1438 |
TInt& aWidth, TInt& aHeight ) const
|
|
1439 |
{
|
|
1440 |
aHeight = iMaxImageHeight;
|
|
1441 |
aWidth = iMaxImageWidth;
|
|
1442 |
}
|
|
1443 |
|
|
1444 |
// ---------------------------------------------------------
|
|
1445 |
// CMmsHeaders::SetRootContentIdL
|
|
1446 |
//
|
|
1447 |
// ---------------------------------------------------------
|
|
1448 |
//
|
|
1449 |
EXPORT_C void CMmsHeaders::SetRootContentIdL( const TDesC8& aId )
|
|
1450 |
{
|
|
1451 |
delete iRootContentID;
|
|
1452 |
iRootContentID = NULL;
|
|
1453 |
if ( aId.Length() > 0 )
|
|
1454 |
{
|
|
1455 |
iRootContentID = aId.AllocL();
|
|
1456 |
}
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
// ---------------------------------------------------------
|
|
1460 |
// CMmsHeaders::RootContentId
|
|
1461 |
//
|
|
1462 |
// ---------------------------------------------------------
|
|
1463 |
//
|
|
1464 |
EXPORT_C TPtrC8 CMmsHeaders::RootContentId() const
|
|
1465 |
{
|
|
1466 |
return iRootContentID ? TPtrC8( *iRootContentID ) : TPtrC8();
|
|
1467 |
}
|
|
1468 |
|
|
1469 |
|
|
1470 |
// ---------------------------------------------------------
|
|
1471 |
// CMmsHeaders::SetReplyChargingIdL
|
|
1472 |
//
|
|
1473 |
// ---------------------------------------------------------
|
|
1474 |
//
|
|
1475 |
EXPORT_C void CMmsHeaders::SetReplyChargingIdL( const TDesC8& aId )
|
|
1476 |
{
|
|
1477 |
delete iReplyChargingId;
|
|
1478 |
iReplyChargingId = NULL;
|
|
1479 |
iReplyChargingId = aId.AllocL();
|
|
1480 |
}
|
|
1481 |
|
|
1482 |
|
|
1483 |
// ---------------------------------------------------------
|
|
1484 |
// CMmsHeaders::ReplyChargingId
|
|
1485 |
//
|
|
1486 |
// ---------------------------------------------------------
|
|
1487 |
//
|
|
1488 |
EXPORT_C TPtrC8 CMmsHeaders::ReplyChargingId() const
|
|
1489 |
{
|
|
1490 |
return iReplyChargingId ? TPtrC8( *iReplyChargingId ) : TPtrC8();
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
// ---------------------------------------------------------
|
|
1494 |
// CMmsHeaders::SetReplyChargingInterval
|
|
1495 |
//
|
|
1496 |
// ---------------------------------------------------------
|
|
1497 |
//
|
|
1498 |
EXPORT_C void CMmsHeaders::SetReplyChargingInterval(
|
|
1499 |
TInt aInterval )
|
|
1500 |
{
|
|
1501 |
iReplyChargingDeadline = aInterval;
|
|
1502 |
iReplyChargingAbs = EFalse;
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
// ---------------------------------------------------------
|
|
1506 |
// CMmsHeaders::ReplyChargingInterval
|
|
1507 |
//
|
|
1508 |
// ---------------------------------------------------------
|
|
1509 |
//
|
|
1510 |
EXPORT_C TInt CMmsHeaders::ReplyChargingInterval()
|
|
1511 |
{
|
|
1512 |
return iReplyChargingAbs ? 0 : I64LOW( iReplyChargingDeadline );
|
|
1513 |
}
|
|
1514 |
|
|
1515 |
|
|
1516 |
// ---------------------------------------------------------
|
|
1517 |
// CMmsHeaders::SetReplyChargingDate
|
|
1518 |
//
|
|
1519 |
// ---------------------------------------------------------
|
|
1520 |
//
|
|
1521 |
EXPORT_C void CMmsHeaders::SetReplyChargingDate( TInt64 aDate )
|
|
1522 |
{
|
|
1523 |
iReplyChargingDeadline = aDate;
|
|
1524 |
iReplyChargingAbs = ETrue;
|
|
1525 |
}
|
|
1526 |
|
|
1527 |
// ---------------------------------------------------------
|
|
1528 |
// CMmsHeaders::ReplyChargingDate
|
|
1529 |
//
|
|
1530 |
// ---------------------------------------------------------
|
|
1531 |
//
|
|
1532 |
EXPORT_C TInt64 CMmsHeaders::ReplyChargingDate()
|
|
1533 |
{
|
|
1534 |
return iReplyChargingAbs ? iReplyChargingDeadline : TInt64( 0 );
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
// ---------------------------------------------------------
|
|
1538 |
// CMmsHeaders::InsertPreviouslySentByL
|
|
1539 |
//
|
|
1540 |
// ---------------------------------------------------------
|
|
1541 |
//
|
|
1542 |
EXPORT_C void CMmsHeaders::InsertPreviouslySentByL( TInt aOrder, const TDesC& aSender )
|
|
1543 |
{
|
|
1544 |
TInt error = KErrNone;
|
|
1545 |
CMmsSendingChain* item = new (ELeave)CMmsSendingChain;
|
|
1546 |
CleanupStack::PushL( item );
|
|
1547 |
item->SetOrder( aOrder );
|
|
1548 |
item->SetSenderL( aSender );
|
|
1549 |
|
|
1550 |
TInt index = KErrNotFound;
|
|
1551 |
index = iPreviouslySentArray.FindInOrder( item, iLinearOrder );
|
|
1552 |
CleanupStack::Pop( item );
|
|
1553 |
if ( index == KErrNotFound )
|
|
1554 |
{
|
|
1555 |
error = iPreviouslySentArray.InsertInOrder( item, iLinearOrder );
|
|
1556 |
if ( error != KErrNone )
|
|
1557 |
{
|
|
1558 |
delete item;
|
|
1559 |
}
|
|
1560 |
}
|
|
1561 |
else
|
|
1562 |
{
|
|
1563 |
delete item;
|
|
1564 |
// modify existing entry
|
|
1565 |
// order is already set, as we use that as our match
|
|
1566 |
// we just put in new sender.
|
|
1567 |
// Index is valid because we just set it to the index where match was found
|
|
1568 |
iPreviouslySentArray[index]->SetSenderL( aSender );
|
|
1569 |
}
|
|
1570 |
item = NULL; // this was either deleted or inserted into our array.
|
|
1571 |
|
|
1572 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1573 |
|
|
1574 |
}
|
|
1575 |
|
|
1576 |
// ---------------------------------------------------------
|
|
1577 |
// CMmsHeaders::InsertPreviouslySentDateL
|
|
1578 |
//
|
|
1579 |
// ---------------------------------------------------------
|
|
1580 |
//
|
|
1581 |
EXPORT_C void CMmsHeaders::InsertPreviouslySentDateL( TInt aOrder, TInt64 aDate )
|
|
1582 |
{
|
|
1583 |
|
|
1584 |
TInt error = KErrNone;
|
|
1585 |
CMmsSendingChain* item = new (ELeave)CMmsSendingChain;
|
|
1586 |
CleanupStack::PushL( item );
|
|
1587 |
item->SetOrder( aOrder );
|
|
1588 |
item->SetDate( aDate );
|
|
1589 |
|
|
1590 |
TInt index = KErrNotFound;
|
|
1591 |
index = iPreviouslySentArray.FindInOrder( item, iLinearOrder );
|
|
1592 |
CleanupStack::Pop( item );
|
|
1593 |
if ( index == KErrNotFound )
|
|
1594 |
{
|
|
1595 |
error = iPreviouslySentArray.InsertInOrder( item, iLinearOrder );
|
|
1596 |
if ( error != KErrNone )
|
|
1597 |
{
|
|
1598 |
delete item;
|
|
1599 |
}
|
|
1600 |
}
|
|
1601 |
else
|
|
1602 |
{
|
|
1603 |
delete item;
|
|
1604 |
// modify existing entry
|
|
1605 |
// order is already set, as we use that as our match
|
|
1606 |
// we just put in new sender.
|
|
1607 |
// Index is valid because we just set it to the index where match was found
|
|
1608 |
iPreviouslySentArray[index]->SetDate( aDate );
|
|
1609 |
}
|
|
1610 |
item = NULL; // this was either deleted or inserted into our array.
|
|
1611 |
|
|
1612 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1613 |
|
|
1614 |
}
|
|
1615 |
|
|
1616 |
// ---------------------------------------------------------
|
|
1617 |
// CMmsHeaders::AppendPreviouslySentItemL
|
|
1618 |
//
|
|
1619 |
// ---------------------------------------------------------
|
|
1620 |
//
|
|
1621 |
EXPORT_C void CMmsHeaders::AppendPreviouslySentItemL( TInt64 aDate, const TDesC& aSender )
|
|
1622 |
{
|
|
1623 |
TInt error = KErrNone;
|
|
1624 |
CMmsSendingChain* item = new (ELeave)CMmsSendingChain;
|
|
1625 |
CleanupStack::PushL( item );
|
|
1626 |
item->SetDate( aDate );
|
|
1627 |
item->SetSenderL( aSender );
|
|
1628 |
TInt count = iPreviouslySentArray.Count();
|
|
1629 |
// we are creating a new item that must go to the end of the array
|
|
1630 |
if ( count == 0 )
|
|
1631 |
{
|
|
1632 |
// First item in array
|
|
1633 |
item->SetOrder( 1 );
|
|
1634 |
}
|
|
1635 |
else
|
|
1636 |
{
|
|
1637 |
item->SetOrder( iPreviouslySentArray[ count - 1 ]->Order() + 1 );
|
|
1638 |
}
|
|
1639 |
CleanupStack::Pop( item );
|
|
1640 |
error = iPreviouslySentArray.InsertInOrder( item, iLinearOrder );
|
|
1641 |
if ( error != KErrNone )
|
|
1642 |
{
|
|
1643 |
delete item;
|
|
1644 |
}
|
|
1645 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1646 |
}
|
|
1647 |
|
|
1648 |
// ---------------------------------------------------------
|
|
1649 |
// CMmsHeaders::SetResponseTextL
|
|
1650 |
//
|
|
1651 |
// ---------------------------------------------------------
|
|
1652 |
//
|
|
1653 |
EXPORT_C void CMmsHeaders::SetResponseTextL( const TDesC& aText )
|
|
1654 |
{
|
|
1655 |
// If the length of the new text is 0, the text is cleared
|
|
1656 |
delete iOperatorResponseText;
|
|
1657 |
iOperatorResponseText = NULL;
|
|
1658 |
if ( aText.Length() > 0 )
|
|
1659 |
{
|
|
1660 |
HBufC* newAttrib = aText.AllocL();
|
|
1661 |
iOperatorResponseText = newAttrib;
|
|
1662 |
}
|
|
1663 |
}
|
|
1664 |
|
|
1665 |
// ---------------------------------------------------------
|
|
1666 |
// CMmsHeaders::ResponseText
|
|
1667 |
//
|
|
1668 |
// ---------------------------------------------------------
|
|
1669 |
//
|
|
1670 |
EXPORT_C TPtrC CMmsHeaders::ResponseText() const
|
|
1671 |
{
|
|
1672 |
return iOperatorResponseText ? TPtrC( *iOperatorResponseText ) : TPtrC();
|
|
1673 |
}
|
|
1674 |
|
|
1675 |
// ---------------------------------------------------------
|
|
1676 |
// CMmsHeaders::InsertDeleteStatusL
|
|
1677 |
//
|
|
1678 |
// ---------------------------------------------------------
|
|
1679 |
//
|
|
1680 |
EXPORT_C void CMmsHeaders::InsertDeleteStatusL( TUint aOrder, const TInt32 aStatus )
|
|
1681 |
{
|
|
1682 |
TInt error = KErrNone;
|
|
1683 |
CMmsDeleteResultArray* item = new (ELeave)CMmsDeleteResultArray;
|
|
1684 |
CleanupStack::PushL( item );
|
|
1685 |
item->SetOrder( aOrder );
|
|
1686 |
item->SetResponseStatus( aStatus );
|
|
1687 |
|
|
1688 |
TInt index = KErrNotFound;
|
|
1689 |
index = iDeleteResultArray.FindInOrder( item, iDeleteResultOrder );
|
|
1690 |
CleanupStack::Pop( item );
|
|
1691 |
|
|
1692 |
if ( index == KErrNotFound )
|
|
1693 |
{
|
|
1694 |
error = iDeleteResultArray.InsertInOrder( item, iDeleteResultOrder );
|
|
1695 |
if ( error != KErrNone )
|
|
1696 |
{
|
|
1697 |
delete item;
|
|
1698 |
}
|
|
1699 |
}
|
|
1700 |
else
|
|
1701 |
{
|
|
1702 |
delete item;
|
|
1703 |
// modify existing entry - find all possible matches and modify all.
|
|
1704 |
TInt i;
|
|
1705 |
for ( i = 0; i < iDeleteResultArray.Count(); i++ )
|
|
1706 |
{
|
|
1707 |
if ( iDeleteResultArray[i]->Order() == aOrder )
|
|
1708 |
{
|
|
1709 |
iDeleteResultArray[i]->SetResponseStatus( aStatus );
|
|
1710 |
}
|
|
1711 |
}
|
|
1712 |
}
|
|
1713 |
item = NULL; // this was either deleted or inserted into our array.
|
|
1714 |
|
|
1715 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1716 |
|
|
1717 |
}
|
|
1718 |
|
|
1719 |
// ---------------------------------------------------------
|
|
1720 |
// CMmsHeaders::InsertDeleteContentLocationL
|
|
1721 |
//
|
|
1722 |
// ---------------------------------------------------------
|
|
1723 |
//
|
|
1724 |
EXPORT_C void CMmsHeaders::InsertDeleteContentLocationL(
|
|
1725 |
TUint aOrder, const TDesC8& aContentLocation )
|
|
1726 |
{
|
|
1727 |
TInt error = KErrNone;
|
|
1728 |
CMmsDeleteResultArray* item = new (ELeave)CMmsDeleteResultArray;
|
|
1729 |
CleanupStack::PushL( item );
|
|
1730 |
item->SetOrder( aOrder );
|
|
1731 |
item->SetContentLocationL( aContentLocation );
|
|
1732 |
|
|
1733 |
TInt index = KErrNotFound;
|
|
1734 |
index = iDeleteResultArray.FindInOrder( item, iDeleteResultOrder );
|
|
1735 |
CleanupStack::Pop( item );
|
|
1736 |
|
|
1737 |
if ( index == KErrNotFound )
|
|
1738 |
{
|
|
1739 |
error = iDeleteResultArray.InsertInOrder( item, iDeleteResultOrder );
|
|
1740 |
if ( error != KErrNone )
|
|
1741 |
{
|
|
1742 |
delete item;
|
|
1743 |
}
|
|
1744 |
}
|
|
1745 |
else
|
|
1746 |
{
|
|
1747 |
// If we find an entry without content location we modify existing entry
|
|
1748 |
// otherwise we insert a new entry
|
|
1749 |
TInt i;
|
|
1750 |
TBool updated = EFalse;
|
|
1751 |
for ( i = 0; i < iDeleteResultArray.Count() && !updated ; i++ )
|
|
1752 |
{
|
|
1753 |
if ( iDeleteResultArray[i]->Order() == aOrder &&
|
|
1754 |
iDeleteResultArray[i]->ContentLocation().Length() == 0 )
|
|
1755 |
{
|
|
1756 |
iDeleteResultArray[i]->SetContentLocationL( aContentLocation );
|
|
1757 |
updated = ETrue;
|
|
1758 |
}
|
|
1759 |
}
|
|
1760 |
if ( !updated )
|
|
1761 |
{
|
|
1762 |
item->SetResponseStatus( iDeleteResultArray[index]->ResponseStatus() );
|
|
1763 |
item->SetResponseTextL( iDeleteResultArray[index]->ResponseText() );
|
|
1764 |
// order and contentlocation are already there
|
|
1765 |
error = iDeleteResultArray.InsertInOrderAllowRepeats( item, iDeleteResultOrder );
|
|
1766 |
if ( error != KErrNone )
|
|
1767 |
{
|
|
1768 |
delete item;
|
|
1769 |
}
|
|
1770 |
}
|
|
1771 |
else
|
|
1772 |
{
|
|
1773 |
delete item;
|
|
1774 |
}
|
|
1775 |
}
|
|
1776 |
item = NULL; // this was either deleted or inserted into our array.
|
|
1777 |
|
|
1778 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1779 |
|
|
1780 |
}
|
|
1781 |
|
|
1782 |
// ---------------------------------------------------------
|
|
1783 |
// CMmsHeaders::InsertDeleteResponseTextL
|
|
1784 |
//
|
|
1785 |
// ---------------------------------------------------------
|
|
1786 |
//
|
|
1787 |
EXPORT_C void CMmsHeaders::InsertDeleteResponseTextL( TUint aOrder, const TDesC& aResponseText )
|
|
1788 |
{
|
|
1789 |
TInt error = KErrNone;
|
|
1790 |
CMmsDeleteResultArray* item = new (ELeave)CMmsDeleteResultArray;
|
|
1791 |
CleanupStack::PushL( item );
|
|
1792 |
item->SetOrder( aOrder );
|
|
1793 |
item->SetResponseTextL( aResponseText );
|
|
1794 |
|
|
1795 |
TInt index = KErrNotFound;
|
|
1796 |
index = iDeleteResultArray.FindInOrder( item, iDeleteResultOrder );
|
|
1797 |
CleanupStack::Pop( item );
|
|
1798 |
|
|
1799 |
if ( index == KErrNotFound )
|
|
1800 |
{
|
|
1801 |
error = iDeleteResultArray.InsertInOrder( item, iDeleteResultOrder );
|
|
1802 |
if ( error != KErrNone )
|
|
1803 |
{
|
|
1804 |
delete item;
|
|
1805 |
}
|
|
1806 |
}
|
|
1807 |
else
|
|
1808 |
{
|
|
1809 |
delete item;
|
|
1810 |
// modify existing entry
|
|
1811 |
// order is already set, as we use that as our match
|
|
1812 |
TInt i;
|
|
1813 |
for ( i = 0; i < iDeleteResultArray.Count(); i++ )
|
|
1814 |
{
|
|
1815 |
if ( iDeleteResultArray[i]->Order() == aOrder )
|
|
1816 |
{
|
|
1817 |
iDeleteResultArray[i]->SetResponseTextL( aResponseText );
|
|
1818 |
}
|
|
1819 |
}
|
|
1820 |
}
|
|
1821 |
item = NULL; // this was either deleted or inserted into our array.
|
|
1822 |
|
|
1823 |
User::LeaveIfError( error ); // The only error that should be possible is KErrNoMemory
|
|
1824 |
|
|
1825 |
}
|
|
1826 |
|
|
1827 |
// ---------------------------------------------------------
|
|
1828 |
// CMmsHeaders::SetApplicIdL
|
|
1829 |
//
|
|
1830 |
// ---------------------------------------------------------
|
|
1831 |
//
|
|
1832 |
EXPORT_C void CMmsHeaders::SetApplicIdL( const TDesC16& aApplicId )
|
|
1833 |
{
|
|
1834 |
// If the length of the new text is 0, the text is cleared
|
|
1835 |
delete iApplicationId;
|
|
1836 |
iApplicationId = NULL;
|
|
1837 |
if ( aApplicId.Length() > 0 )
|
|
1838 |
{
|
|
1839 |
HBufC* newAttrib = aApplicId.AllocL();
|
|
1840 |
iApplicationId = newAttrib;
|
|
1841 |
}
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
// ---------------------------------------------------------
|
|
1845 |
// CMmsHeaders::ApplicId
|
|
1846 |
//
|
|
1847 |
// ---------------------------------------------------------
|
|
1848 |
//
|
|
1849 |
EXPORT_C TPtrC16 CMmsHeaders::ApplicId() const
|
|
1850 |
{
|
|
1851 |
return iApplicationId ? TPtrC16( *iApplicationId ) : TPtrC16();
|
|
1852 |
}
|
|
1853 |
|
|
1854 |
// ---------------------------------------------------------
|
|
1855 |
// CMmsHeaders::SetReplyApplicIdL
|
|
1856 |
//
|
|
1857 |
// ---------------------------------------------------------
|
|
1858 |
//
|
|
1859 |
EXPORT_C void CMmsHeaders::SetReplyApplicIdL( const TDesC16& aApplicId )
|
|
1860 |
{
|
|
1861 |
// If the length of the new text is 0, the text is cleared
|
|
1862 |
delete iReplyToApplicationId;
|
|
1863 |
iReplyToApplicationId = NULL;
|
|
1864 |
if ( aApplicId.Length() > 0 )
|
|
1865 |
{
|
|
1866 |
HBufC* newAttrib = aApplicId.AllocL();
|
|
1867 |
iReplyToApplicationId = newAttrib;
|
|
1868 |
}
|
|
1869 |
}
|
|
1870 |
|
|
1871 |
// ---------------------------------------------------------
|
|
1872 |
// CMmsHeaders::ReplyApplicId
|
|
1873 |
//
|
|
1874 |
// ---------------------------------------------------------
|
|
1875 |
//
|
|
1876 |
EXPORT_C TPtrC16 CMmsHeaders::ReplyApplicId() const
|
|
1877 |
{
|
|
1878 |
return iReplyToApplicationId ? TPtrC16( *iReplyToApplicationId ) : TPtrC16();
|
|
1879 |
}
|
|
1880 |
|
|
1881 |
// ---------------------------------------------------------
|
|
1882 |
// CMmsHeaders::SetAuxApplicInfoL
|
|
1883 |
//
|
|
1884 |
// ---------------------------------------------------------
|
|
1885 |
//
|
|
1886 |
EXPORT_C void CMmsHeaders::SetAuxApplicInfoL( const TDesC8& aAuxApplicInfo )
|
|
1887 |
{
|
|
1888 |
// If the length of the new text is 0, the text is cleared
|
|
1889 |
delete iApplicationInfo;
|
|
1890 |
iApplicationInfo = NULL;
|
|
1891 |
if ( aAuxApplicInfo.Length() > 0 )
|
|
1892 |
{
|
|
1893 |
HBufC8* newAttrib = aAuxApplicInfo.AllocL();
|
|
1894 |
iApplicationInfo = newAttrib;
|
|
1895 |
}
|
|
1896 |
}
|
|
1897 |
|
|
1898 |
// ---------------------------------------------------------
|
|
1899 |
// CMmsHeaders::AuxApplicInfo
|
|
1900 |
//
|
|
1901 |
// ---------------------------------------------------------
|
|
1902 |
//
|
|
1903 |
EXPORT_C TPtrC8 CMmsHeaders::AuxApplicInfo() const
|
|
1904 |
{
|
|
1905 |
return iApplicationInfo ? TPtrC8( *iApplicationInfo ) : TPtrC8();
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
// ---------------------------------------------------------
|
|
1909 |
//
|
|
1910 |
// ---------------------------------------------------------
|
|
1911 |
//
|
|
1912 |
EXPORT_C void CMmsHeaders::SetRecommendedRetrievalModeTextL(
|
|
1913 |
const TDesC16& aRecommendedRetrievalModeText )
|
|
1914 |
{
|
|
1915 |
// If the length of the new text is 0, the text is cleared
|
|
1916 |
delete iRecommendedRetrievalModeText;
|
|
1917 |
iRecommendedRetrievalModeText = NULL;
|
|
1918 |
if ( aRecommendedRetrievalModeText.Length() > 0 )
|
|
1919 |
{
|
|
1920 |
HBufC* newAttrib = aRecommendedRetrievalModeText.AllocL();
|
|
1921 |
iRecommendedRetrievalModeText = newAttrib;
|
|
1922 |
}
|
|
1923 |
}
|
|
1924 |
|
|
1925 |
// ---------------------------------------------------------
|
|
1926 |
//
|
|
1927 |
// ---------------------------------------------------------
|
|
1928 |
//
|
|
1929 |
EXPORT_C TPtrC16 CMmsHeaders::RecommendedRetrievalModeText() const
|
|
1930 |
{
|
|
1931 |
return iRecommendedRetrievalModeText ?
|
|
1932 |
TPtrC16( *iRecommendedRetrievalModeText ) : TPtrC16();
|
|
1933 |
}
|
|
1934 |
|
|
1935 |
// ---------------------------------------------------------
|
|
1936 |
//
|
|
1937 |
// ---------------------------------------------------------
|
|
1938 |
//
|
|
1939 |
EXPORT_C void CMmsHeaders::SetReplaceCancelIdL( const TDesC8& aReplaceCancelId )
|
|
1940 |
{
|
|
1941 |
HBufC8 * newAttrib = aReplaceCancelId.AllocL();
|
|
1942 |
if ( newAttrib->Length() > KMaxHeaderStringLength )
|
|
1943 |
{
|
|
1944 |
newAttrib->Des().SetLength( KMaxHeaderStringLength );
|
|
1945 |
}
|
|
1946 |
delete iReplaceCancelId;
|
|
1947 |
iReplaceCancelId = newAttrib;
|
|
1948 |
}
|
|
1949 |
|
|
1950 |
// ---------------------------------------------------------
|
|
1951 |
//
|
|
1952 |
// ---------------------------------------------------------
|
|
1953 |
//
|
|
1954 |
EXPORT_C TPtrC8 CMmsHeaders::ReplaceCancelId() const
|
|
1955 |
{
|
|
1956 |
return iReplaceCancelId ? TPtrC8( *iReplaceCancelId ) : TPtrC8();
|
|
1957 |
}
|
|
1958 |
|
|
1959 |
// ---------------------------------------------------------
|
|
1960 |
// CMmsHeaders::ExternalizeArrayL
|
|
1961 |
//
|
|
1962 |
// ---------------------------------------------------------
|
|
1963 |
//
|
|
1964 |
void CMmsHeaders::ExternalizeArrayL(
|
|
1965 |
CDesC16Array& anArray,
|
|
1966 |
RWriteStream& aStream ) const
|
|
1967 |
{
|
|
1968 |
|
|
1969 |
TInt count=anArray.Count();
|
|
1970 |
aStream << TCardinality( count ); // compressed value
|
|
1971 |
for ( TInt ii = 0; ii < count; ++ii )
|
|
1972 |
{
|
|
1973 |
aStream << anArray[ii].Left( Min( anArray[ii].Length(), KMaxHeaderStringLength ) ) ;
|
|
1974 |
}
|
|
1975 |
}
|
|
1976 |
|
|
1977 |
// ---------------------------------------------------------
|
|
1978 |
// CMmsHeaders::InternalizeArrayL
|
|
1979 |
//
|
|
1980 |
// ---------------------------------------------------------
|
|
1981 |
//
|
|
1982 |
void CMmsHeaders::InternalizeArrayL(
|
|
1983 |
CDesC16Array& anArray,
|
|
1984 |
RReadStream& aStream )
|
|
1985 |
{
|
|
1986 |
TCardinality card;
|
|
1987 |
aStream >> card;
|
|
1988 |
TInt count=card;
|
|
1989 |
anArray.Reset();
|
|
1990 |
for ( TInt ii = 0; ii < count; ++ii )
|
|
1991 |
{
|
|
1992 |
HBufC16* buf=HBufC16::NewLC( aStream, KMaxHeaderStringLength );
|
|
1993 |
anArray.CArrayFixBase::InsertL( ii, &buf );
|
|
1994 |
CleanupStack::Pop( buf );
|
|
1995 |
}
|
|
1996 |
}
|
|
1997 |
|
|
1998 |
// ---------------------------------------------------------
|
|
1999 |
// CMmsHeaders::CopyAddresseeListL()
|
|
2000 |
//
|
|
2001 |
// ---------------------------------------------------------
|
|
2002 |
//
|
|
2003 |
void CMmsHeaders::CopyAddresseeListL(
|
|
2004 |
const CDesCArray& aArray,
|
|
2005 |
TMmsRecipients aType,
|
|
2006 |
const TPtrC& aExclude,
|
|
2007 |
RFs& aFs )
|
|
2008 |
{
|
|
2009 |
TInt size;
|
|
2010 |
size = aArray.Count();
|
|
2011 |
CDesCArray* array = NULL;
|
|
2012 |
array = AliasedAddressL( aArray, aFs );
|
|
2013 |
CleanupStack::PushL( array );
|
|
2014 |
|
|
2015 |
for (TInt i=0; i < size; i++)
|
|
2016 |
{
|
|
2017 |
if ( aExclude.Length() == 0 ||
|
|
2018 |
( aExclude.Length() > 0 &&
|
|
2019 |
TMmsGenUtils::PureAddress( aExclude ).CompareF(
|
|
2020 |
TMmsGenUtils::PureAddress( array->MdcaPoint(i) ) ) != 0 ) )
|
|
2021 |
{
|
|
2022 |
this->AddTypedAddresseeL( array->MdcaPoint(i), aType );
|
|
2023 |
}
|
|
2024 |
}
|
|
2025 |
CleanupStack::PopAndDestroy( array );
|
|
2026 |
}
|
|
2027 |
|
|
2028 |
// ---------------------------------------------------------
|
|
2029 |
// CMmsHeaders::AliasedAddressL()
|
|
2030 |
//
|
|
2031 |
// ---------------------------------------------------------
|
|
2032 |
//
|
|
2033 |
HBufC* CMmsHeaders::AliasedAddressL(
|
|
2034 |
const TDesC& aOriginalAddress,
|
|
2035 |
RFs& aFs )
|
|
2036 |
{
|
|
2037 |
HBufC* result = NULL;
|
|
2038 |
TPtrC realAddress;
|
|
2039 |
TInt error = KErrNone;
|
|
2040 |
|
|
2041 |
realAddress.Set( TMmsGenUtils::PureAddress( aOriginalAddress ) );
|
|
2042 |
HBufC* alias = HBufC::NewL( KMaxHeaderStringLength );
|
|
2043 |
CleanupStack::PushL( alias );
|
|
2044 |
TPtr aliasPtr = alias->Des();
|
|
2045 |
error = TMmsGenUtils::GetAlias( realAddress, aliasPtr, KMaxHeaderStringLength, aFs );
|
|
2046 |
if ( error == KErrNone && aliasPtr.Length() > 0 )
|
|
2047 |
{
|
|
2048 |
result = TMmsGenUtils::GenerateAddressL( realAddress, aliasPtr );
|
|
2049 |
}
|
|
2050 |
else
|
|
2051 |
{
|
|
2052 |
result = HBufC::NewL( aOriginalAddress.Length() );
|
|
2053 |
result->Des().Copy( aOriginalAddress );
|
|
2054 |
}
|
|
2055 |
|
|
2056 |
CleanupStack::PopAndDestroy( alias );
|
|
2057 |
|
|
2058 |
// It is the caller's responsibility to put result on cleanup stack
|
|
2059 |
return result;
|
|
2060 |
|
|
2061 |
}
|
|
2062 |
// ---------------------------------------------------------
|
|
2063 |
// CMmsHeaders::AliasedAddressL()
|
|
2064 |
//
|
|
2065 |
// ---------------------------------------------------------
|
|
2066 |
//
|
|
2067 |
CDesCArray* CMmsHeaders::AliasedAddressL(
|
|
2068 |
const CDesCArray& aOriginalAddress,
|
|
2069 |
RFs& aFs )
|
|
2070 |
{
|
|
2071 |
TInt size;
|
|
2072 |
TInt error( KErrNone );
|
|
2073 |
TInt i( 0 );
|
|
2074 |
size = aOriginalAddress.MdcaCount();
|
|
2075 |
|
|
2076 |
CDesCArray* aliasArray = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
2077 |
CleanupStack::PushL( aliasArray );
|
|
2078 |
|
|
2079 |
CDesCArray* realAddress = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
2080 |
CleanupStack::PushL( realAddress );
|
|
2081 |
|
|
2082 |
//This is popped later because of the caller ...
|
|
2083 |
CDesCArray* result = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
|
|
2084 |
CleanupStack::PushL( result );
|
|
2085 |
|
|
2086 |
for ( i=0; i < size; i++ )
|
|
2087 |
{
|
|
2088 |
// index is valid as i is always less than aOriginalAddress size
|
|
2089 |
realAddress->InsertL( i,
|
|
2090 |
( TMmsGenUtils::PureAddress( aOriginalAddress[i] ) ) );
|
|
2091 |
}
|
|
2092 |
|
|
2093 |
//GetAlias and GetAliasForAll returns error only in very rare case, in case on oom
|
|
2094 |
//or in case of programming error. That's why if some of the alias matchings fails let's
|
|
2095 |
//ignore the whole alias matching
|
|
2096 |
TRAP( error,
|
|
2097 |
TMmsGenUtils::GetAliasForAllL( *realAddress, *aliasArray, KMaxHeaderStringLength, aFs )
|
|
2098 |
);
|
|
2099 |
|
|
2100 |
size = aliasArray->MdcaCount();
|
|
2101 |
|
|
2102 |
HBufC* tempAddress( NULL );
|
|
2103 |
|
|
2104 |
if ( error != KErrNone )
|
|
2105 |
{
|
|
2106 |
//Something badly wrong, let's not set any alias
|
|
2107 |
for ( i = 0; i < size; i++ )
|
|
2108 |
{
|
|
2109 |
// index is valid as i is always less than aOriginalAddress size
|
|
2110 |
result->InsertL( i, aOriginalAddress[i] );
|
|
2111 |
}
|
|
2112 |
}
|
|
2113 |
else
|
|
2114 |
{
|
|
2115 |
for ( i = 0; i < size; i++ )
|
|
2116 |
{
|
|
2117 |
if ( ( aliasArray->MdcaPoint(i)).Length() > 0 )
|
|
2118 |
{
|
|
2119 |
tempAddress = TMmsGenUtils::GenerateAddressL(
|
|
2120 |
realAddress->MdcaPoint(i),
|
|
2121 |
aliasArray->MdcaPoint(i) );
|
|
2122 |
CleanupStack::PushL( tempAddress );
|
|
2123 |
result->InsertL( i, tempAddress->Des() );
|
|
2124 |
CleanupStack::PopAndDestroy( tempAddress );
|
|
2125 |
}
|
|
2126 |
else
|
|
2127 |
{
|
|
2128 |
// index is valid as i is always less than aOriginalAddress size
|
|
2129 |
result->InsertL( i, aOriginalAddress[i] );
|
|
2130 |
}
|
|
2131 |
}
|
|
2132 |
}
|
|
2133 |
|
|
2134 |
CleanupStack::Pop( result );
|
|
2135 |
CleanupStack::PopAndDestroy( realAddress );
|
|
2136 |
CleanupStack::PopAndDestroy( aliasArray );
|
|
2137 |
|
|
2138 |
return result;
|
|
2139 |
|
|
2140 |
}
|
|
2141 |
|
|
2142 |
// ---------------------------------------------------------
|
|
2143 |
// CMmsHeaders::CreateContentId()
|
|
2144 |
//
|
|
2145 |
// ---------------------------------------------------------
|
|
2146 |
//
|
|
2147 |
EXPORT_C void CMmsHeaders::CreateContentId( TDes8& aCid )
|
|
2148 |
{
|
|
2149 |
TTime now;
|
|
2150 |
now.UniversalTime();
|
|
2151 |
TInt random;
|
|
2152 |
TInt64 seed = now.Int64();
|
|
2153 |
random = Math::Rand( seed );
|
|
2154 |
|
|
2155 |
aCid.Num( random );
|
|
2156 |
aCid.Insert(0, KMmsLeftAngle );
|
|
2157 |
aCid.Append( KMmsRightAngle );
|
|
2158 |
}
|
|
2159 |
|
|
2160 |
// ---------------------------------------------------------
|
|
2161 |
// CMmsHeaders::LimitStringSize
|
|
2162 |
//
|
|
2163 |
// ---------------------------------------------------------
|
|
2164 |
//
|
|
2165 |
TPtrC8 CMmsHeaders::LimitStringSize( const TPtrC8& aString, TInt aMaxSize)
|
|
2166 |
{
|
|
2167 |
if (aString.Length() < aMaxSize)
|
|
2168 |
return aString;
|
|
2169 |
else
|
|
2170 |
return aString.Left(aMaxSize);
|
|
2171 |
}
|
|
2172 |
|
|
2173 |
// ---------------------------------------------------------
|
|
2174 |
// CMmsHeaders::LimitStringSize
|
|
2175 |
//
|
|
2176 |
// ---------------------------------------------------------
|
|
2177 |
//
|
|
2178 |
TPtrC16 CMmsHeaders::LimitStringSize( const TPtrC16& aString, TInt aMaxSize)
|
|
2179 |
{
|
|
2180 |
if (aString.Length() < aMaxSize)
|
|
2181 |
return aString;
|
|
2182 |
else
|
|
2183 |
return aString.Left(aMaxSize);
|
|
2184 |
}
|
|
2185 |
|
|
2186 |
// ================= OTHER EXPORTED FUNCTIONS ==============
|
|
2187 |
|
|
2188 |
|
|
2189 |
// End of File
|
|
2190 |
|