|
1 /* |
|
2 * Copyright (c) 2002-2009 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: |
|
15 * Utility methods for UI and engine modules. Provides help for address |
|
16 * string parsing, resource files and contact database access. |
|
17 * General address format is either |
|
18 * alias<real-address> |
|
19 * or |
|
20 * <real-address> |
|
21 * as used in the Client MTM API. |
|
22 * |
|
23 */ |
|
24 |
|
25 |
|
26 |
|
27 // INCLUDE FILES |
|
28 #include <barsc.h> // resource file |
|
29 #include <bautils.h> |
|
30 #include <miutpars.h> // e-mail utilities |
|
31 #include "cimconvertcharconv.h" |
|
32 #include "cimconvertheader.h" |
|
33 #include <miutconv.h> // CharConv |
|
34 #include <flogger.h> |
|
35 #include <e32svr.h> |
|
36 #include <e32base.h> |
|
37 #include <imcvcodc.h> |
|
38 #include <f32file.h> |
|
39 #include <UiklafInternalCRKeys.h> |
|
40 // #include <telconfigcrkeys.h> |
|
41 #include <centralrepository.h> |
|
42 #include <CoreApplicationUIsSDKCRKeys.h> |
|
43 #include <data_caging_path_literals.hrh> |
|
44 |
|
45 |
|
46 #include "telconfigcrkeys.h" |
|
47 #include "mmsgenutils.h" |
|
48 #include "MmsEnginePrivateCRKeys.h" |
|
49 |
|
50 // EXTERNAL DATA STRUCTURES |
|
51 |
|
52 // EXTERNAL FUNCTION PROTOTYPES |
|
53 |
|
54 // CONSTANTS |
|
55 |
|
56 #ifdef _DEBUG |
|
57 const TInt KLogBufferLength = 256; |
|
58 _LIT( KLogDir, "mmsc" ); |
|
59 _LIT( KLogFile, "mmsc.txt" ); |
|
60 #endif |
|
61 |
|
62 const TUint KExtraSpaceForConversion10 = 10; |
|
63 const TUint KExtraSpaceForConversion30 = 30; |
|
64 |
|
65 |
|
66 // MACROS |
|
67 |
|
68 // LOCAL CONSTANTS AND MACROS |
|
69 |
|
70 // MODULE DATA STRUCTURES |
|
71 |
|
72 // LOCAL FUNCTION PROTOTYPES |
|
73 |
|
74 // ==================== LOCAL FUNCTIONS ==================== |
|
75 |
|
76 // ================= MEMBER FUNCTIONS ======================= |
|
77 |
|
78 // Constructor |
|
79 // |
|
80 EXPORT_C TMmsGenUtils::TMmsGenUtils() |
|
81 { |
|
82 } |
|
83 |
|
84 // Destructor |
|
85 // |
|
86 // THERE SHOULD NOT BE DESTRUCTOR IN T-CLASS. |
|
87 // MUST BE REMOVED |
|
88 EXPORT_C TMmsGenUtils::~TMmsGenUtils() |
|
89 { |
|
90 } |
|
91 |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // TMmsGenUtils::AddressTypeAndRealAddress |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C TInt TMmsGenUtils::AddressTypeAndRealAddress( |
|
98 const TDesC& aAddress, |
|
99 TMmsAddressType& aType, |
|
100 TDes& aRealAddress, |
|
101 TInt aMaxLength, |
|
102 const TDesC& aOpen, |
|
103 const TDesC& aClose ) |
|
104 { |
|
105 aRealAddress.Zero(); |
|
106 aType = EMmsAddressTypeUnknown; |
|
107 |
|
108 TPtrC realAddress; |
|
109 realAddress.Set( PureAddress( aAddress, aOpen, aClose ) ); |
|
110 |
|
111 if ( realAddress.Length() > aMaxLength ) |
|
112 { |
|
113 return KErrTooBig; |
|
114 } |
|
115 |
|
116 if ( IsValidMMSPhoneAddress( realAddress ) ) |
|
117 { |
|
118 aType = EMmsAddressTypeMobile; |
|
119 } |
|
120 else if ( IsValidEmailAddress( realAddress ) ) |
|
121 { |
|
122 aType = EMmsAddressTypeEmail; |
|
123 } |
|
124 else |
|
125 { |
|
126 |
|
127 } |
|
128 |
|
129 // we returned earlier if address was too big. |
|
130 if ( aType != EMmsAddressTypeUnknown ) |
|
131 { |
|
132 aRealAddress.Copy( realAddress ); |
|
133 } |
|
134 |
|
135 return KErrNone; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // TMmsGenUtils::IsValidAddress |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C TBool TMmsGenUtils::IsValidAddress( |
|
143 const TDesC& aAddress, |
|
144 TBool aReal, |
|
145 const TDesC& aOpen, |
|
146 const TDesC& aClose ) |
|
147 { |
|
148 TPtrC realAddress; |
|
149 |
|
150 if ( !aReal) |
|
151 { |
|
152 realAddress.Set( PureAddress( aAddress, aOpen, aClose ) ); |
|
153 } |
|
154 else |
|
155 { |
|
156 realAddress.Set ( aAddress ); |
|
157 } |
|
158 |
|
159 if ( !IsValidMMSPhoneAddress( realAddress ) ) |
|
160 { |
|
161 return IsValidEmailAddress( realAddress ); |
|
162 } |
|
163 |
|
164 return ETrue; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------- |
|
168 // TMmsGenUtils::IsValidEmailAddress |
|
169 // --------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C TBool TMmsGenUtils::IsValidEmailAddress( |
|
172 const TDesC& aAddress, |
|
173 TBool aReal, |
|
174 const TDesC& aOpen, |
|
175 const TDesC& aClose ) |
|
176 { |
|
177 // Strip off alias part if necessary |
|
178 TPtrC realAddress; |
|
179 if ( aReal ) |
|
180 { |
|
181 realAddress.Set( aAddress ); |
|
182 } |
|
183 else |
|
184 { |
|
185 realAddress.Set( PureAddress( aAddress, aOpen, aClose ) ); |
|
186 } |
|
187 TImMessageField email; |
|
188 return email.ValidInternetEmailAddress( realAddress ); |
|
189 } |
|
190 |
|
191 // --------------------------------------------------------- |
|
192 // TMmsGenUtils::IsValidMMSPhoneAddress |
|
193 // --------------------------------------------------------- |
|
194 // |
|
195 EXPORT_C TBool TMmsGenUtils::IsValidMMSPhoneAddress( |
|
196 const TDesC& aAddress, |
|
197 TBool aReal, |
|
198 const TDesC& aOpen, |
|
199 const TDesC& aClose ) |
|
200 { |
|
201 // global_phone_number = [+] 1*(DIGIT, written-sep) |
|
202 // written_sep = ('-') |
|
203 |
|
204 // Strip off alias part if necessary |
|
205 TPtrC realAddress; |
|
206 if ( aReal ) |
|
207 { |
|
208 realAddress.Set( aAddress ); |
|
209 } |
|
210 else |
|
211 { |
|
212 realAddress.Set( PureAddress( aAddress, aOpen, aClose ) ); |
|
213 } |
|
214 |
|
215 TInt length = realAddress.Length(); |
|
216 |
|
217 if ( length == 0 ) |
|
218 { |
|
219 return EFalse; |
|
220 } |
|
221 |
|
222 TInt pos = 0; |
|
223 TInt ich = realAddress[0]; |
|
224 TChar ch = ich; |
|
225 if ( ch == '+' ) |
|
226 { |
|
227 pos++; |
|
228 } |
|
229 |
|
230 if ( pos == length ) |
|
231 { |
|
232 return EFalse; |
|
233 } |
|
234 |
|
235 while ( pos < length ) |
|
236 { |
|
237 ich = realAddress[pos]; |
|
238 ch = ich; |
|
239 ch.Fold(); |
|
240 TInt fch = ch; |
|
241 // do not check for fch == '.' |
|
242 //Even # and * are valid characters now |
|
243 if ( !( ch.IsDigit() || fch == '-' || fch == '#' || fch == '*' ) ) |
|
244 { |
|
245 return EFalse; |
|
246 } |
|
247 pos++; |
|
248 } |
|
249 |
|
250 return ETrue; |
|
251 } |
|
252 |
|
253 |
|
254 // --------------------------------------------------------- |
|
255 // TMmsGenUtils::Alias |
|
256 // --------------------------------------------------------- |
|
257 // |
|
258 EXPORT_C TPtrC TMmsGenUtils::Alias( |
|
259 const TDesC& aAddress, |
|
260 const TDesC& aOpen, |
|
261 const TDesC& aClose ) |
|
262 { |
|
263 |
|
264 // syntax is : |
|
265 // <alias><separator1><pure_address><separator2> | |
|
266 // <pure_address> |
|
267 TInt firstPos = 0; |
|
268 TInt lastPos = 0; |
|
269 TInt length = aAddress.Length(); |
|
270 TInt sepaLen1 = aOpen.Length(); |
|
271 TInt sepaLen2 = aClose.Length(); |
|
272 TInt firstSeparatorPosition = 0; |
|
273 |
|
274 while( firstSeparatorPosition >= 0 ) |
|
275 { |
|
276 firstSeparatorPosition = aAddress.Mid( firstPos ).Find( aOpen ); |
|
277 if ( firstSeparatorPosition >= 0 ) |
|
278 { |
|
279 firstPos += firstSeparatorPosition + sepaLen1; |
|
280 } |
|
281 } |
|
282 if ( firstPos <= 0 ) |
|
283 { |
|
284 // No alias |
|
285 return TPtrC(); |
|
286 } |
|
287 |
|
288 // Search another separator after the first separator from |
|
289 lastPos = aAddress.Mid( firstPos ).Find( aClose ); |
|
290 if ( lastPos == KErrNotFound ) |
|
291 { |
|
292 return TPtrC(); |
|
293 } |
|
294 firstPos -= sepaLen1; // point to first separator |
|
295 if ( lastPos == length - firstPos - sepaLen1 - sepaLen2 ) |
|
296 { |
|
297 // Alias part found |
|
298 // remove trailing and leading spaces |
|
299 lastPos = firstPos; |
|
300 firstPos = 0; |
|
301 while ( firstPos < aAddress.Length() && |
|
302 aAddress.Mid( firstPos, 1 ).Compare( KSpace16 ) == 0 ) |
|
303 { |
|
304 // remove leading spaces |
|
305 firstPos++; |
|
306 } |
|
307 while ( lastPos > 0 && aAddress.Mid( lastPos - 1, 1 ).Compare( KSpace16 ) == 0 ) |
|
308 { |
|
309 lastPos--; |
|
310 } |
|
311 if ( lastPos > firstPos ) |
|
312 { |
|
313 return aAddress.Mid( firstPos, lastPos - firstPos ); |
|
314 } |
|
315 } |
|
316 // No alias defined - spaces alone do not count as alias. |
|
317 return TPtrC(); |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------- |
|
321 // TMmsGenUtils::PureAddress |
|
322 // --------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C TPtrC TMmsGenUtils::PureAddress( |
|
325 const TDesC& aAddress, |
|
326 const TDesC& aOpen, |
|
327 const TDesC& aClose ) |
|
328 { |
|
329 // syntax is : |
|
330 // <alias><separator1><pure_address><separator2> | |
|
331 // <pure_address> |
|
332 TInt firstPos = 0; |
|
333 TInt lastPos = 0; |
|
334 TInt length = aAddress.Length(); |
|
335 TInt sepaLen1 = aOpen.Length(); |
|
336 TInt sepaLen2 = aClose.Length(); |
|
337 TInt firstSeparatorPosition = 0; |
|
338 |
|
339 while( firstSeparatorPosition >= 0 ) |
|
340 { |
|
341 firstSeparatorPosition = aAddress.Mid( firstPos ).Find( aOpen ); |
|
342 if ( firstSeparatorPosition >= 0 ) |
|
343 { |
|
344 firstPos += firstSeparatorPosition + sepaLen1; |
|
345 } |
|
346 } |
|
347 if ( firstPos <= 0 ) |
|
348 { |
|
349 // No alias |
|
350 return aAddress; |
|
351 } |
|
352 |
|
353 // Check if the second separator ends the address |
|
354 TPtrC last = aAddress.Right( sepaLen2 ); |
|
355 lastPos = length - sepaLen2; |
|
356 |
|
357 if ( !last.Compare( aClose ) ) |
|
358 { |
|
359 // Alias part found |
|
360 if ( lastPos > firstPos ) |
|
361 { |
|
362 return aAddress.Mid( firstPos, lastPos - firstPos ); |
|
363 } |
|
364 } |
|
365 // No alias defined - return the original string as pure address |
|
366 // If syntax is weird, namely |
|
367 // alias <> |
|
368 // with nothing between the separators, we return the original string as is |
|
369 return aAddress; |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------- |
|
373 // TMmsGenUtils::GenerateDetails |
|
374 // --------------------------------------------------------- |
|
375 // |
|
376 EXPORT_C TInt TMmsGenUtils::GenerateDetails( |
|
377 const TDesC& aAddress, |
|
378 TDes& aAlias, |
|
379 TInt aMaxLength, |
|
380 RFs& aFs ) |
|
381 { |
|
382 |
|
383 TInt err = KErrNone; |
|
384 |
|
385 // alias search order: Local alias, remote alias, none |
|
386 |
|
387 TPtrC realAddress; |
|
388 realAddress.Set( PureAddress( aAddress, KSepaOpen, KSepaClose ) ); |
|
389 |
|
390 TRAP( err, DoGetAliasL( aFs, realAddress, aAlias, aMaxLength ) ); |
|
391 if ( err != KErrNone || aAlias.Length() == 0 ) |
|
392 { |
|
393 // No alias found from Contact db, see if there is a local alias |
|
394 TPtrC myAddress = Alias( aAddress, KSepaOpen, KSepaClose ); |
|
395 if ( myAddress.Length() > 0 ) |
|
396 { |
|
397 // Alias was found from the address |
|
398 aAlias.Copy( myAddress.Left( aMaxLength ) ); |
|
399 return KErrNone; |
|
400 } |
|
401 else |
|
402 { |
|
403 if ( err == KErrNotFound ) |
|
404 { |
|
405 err = KErrNone; |
|
406 } |
|
407 // just keep the original address |
|
408 aAlias.Copy( aAddress.Left( aMaxLength ) ); |
|
409 } |
|
410 } |
|
411 |
|
412 return err; |
|
413 |
|
414 } |
|
415 |
|
416 |
|
417 // --------------------------------------------------------- |
|
418 // TMmsGenUtils::GetAlias |
|
419 // --------------------------------------------------------- |
|
420 // |
|
421 EXPORT_C TInt TMmsGenUtils::GetAlias( |
|
422 const TDesC& /*aAddress*/, |
|
423 TDes& /*aAlias*/, |
|
424 TInt /*aMaxLength*/, |
|
425 RFs& /*aFs*/ ) |
|
426 { |
|
427 return KErrNone; |
|
428 } |
|
429 |
|
430 |
|
431 // --------------------------------------------------------- |
|
432 // TMmsGenUtils::GetAliasForAllL |
|
433 // This function searches aliases for all addresses in a |
|
434 // address field by opening the contact db only once for all |
|
435 // addresses. This significantly reduces processing time |
|
436 // when executing "Create Reply to all" with a lot of addresses |
|
437 // --------------------------------------------------------- |
|
438 // |
|
439 EXPORT_C void TMmsGenUtils::GetAliasForAllL( |
|
440 const CDesCArray& /*aAddress*/, |
|
441 CDesCArray& /*aAlias*/, |
|
442 TInt /*aMaxLength*/, |
|
443 RFs& /*aFs*/ ) |
|
444 { |
|
445 |
|
446 |
|
447 } |
|
448 |
|
449 // --------------------------------------------------------- |
|
450 // TMmsGenUtils::GenerateAddress |
|
451 // --------------------------------------------------------- |
|
452 // |
|
453 EXPORT_C HBufC* TMmsGenUtils::GenerateAddressL( |
|
454 const TDesC& aRealAddress, |
|
455 const TDesC& aAlias, |
|
456 const TDesC& aOpen, |
|
457 const TDesC& aClose ) |
|
458 { |
|
459 TInt sepaLen1 = aOpen.Length(); |
|
460 TInt sepaLen2 = aClose.Length(); |
|
461 TInt length = aRealAddress.Length() + aAlias.Length() + sepaLen1 + sepaLen2; |
|
462 HBufC* buf = HBufC::NewL( length ); |
|
463 buf->Des().Copy( aAlias ); |
|
464 buf->Des().Append( aOpen ); |
|
465 buf->Des().Append( aRealAddress ); |
|
466 buf->Des().Append( aClose ); |
|
467 return buf; |
|
468 } |
|
469 |
|
470 // --------------------------------------------------------- |
|
471 // TMmsGenUtils::GetDescriptionL |
|
472 // --------------------------------------------------------- |
|
473 // |
|
474 EXPORT_C void TMmsGenUtils::GetDescriptionL( |
|
475 RFs& aFs, |
|
476 const TDesC& aPath, |
|
477 TInt aFileSize, |
|
478 TPtrC8 aMimetype, |
|
479 TInt aCharSet, |
|
480 TDes& aDescription ) |
|
481 { |
|
482 TInt fileSize = aFileSize; // file size in characters |
|
483 TInt error = KErrNone; |
|
484 // set empty description if we cannot get anything |
|
485 aDescription = TPtrC(); |
|
486 |
|
487 // No subject set, so we have to |
|
488 // find the first text/plain attachment. |
|
489 |
|
490 // Update iDescription if necessary |
|
491 |
|
492 if ( aMimetype.CompareF( KMmsTextPlain )) |
|
493 { |
|
494 // no description available |
|
495 return; |
|
496 } |
|
497 |
|
498 TInt outLength = aDescription.MaxLength(); |
|
499 |
|
500 // Open the attachment file |
|
501 RFileReadStream reader; |
|
502 reader.PushL(); |
|
503 error = reader.Open( aFs, |
|
504 aPath, |
|
505 EFileShareReadersOnly ); |
|
506 if ( error != KErrNone ) |
|
507 { |
|
508 CleanupStack::PopAndDestroy( &reader ); //reader |
|
509 // cannot open file, cannot get description |
|
510 return; |
|
511 } |
|
512 |
|
513 TInt firstSize = 0; |
|
514 if ( TUint( aCharSet ) == KMmsIso10646Ucs2 ) |
|
515 { |
|
516 // Read the content |
|
517 TUint16 word = 0; |
|
518 TBool bom = EFalse; |
|
519 TBool nativeEndian = EFalse; |
|
520 |
|
521 // Check if first character is BOM and if so, then what kind it is. |
|
522 TRAP ( error, {word = reader.ReadUint16L();}); |
|
523 if ( error != KErrNone ) |
|
524 { |
|
525 CleanupStack::PopAndDestroy( &reader ); //reader |
|
526 return; // no description available |
|
527 } |
|
528 |
|
529 // reserve extra space for conversion |
|
530 firstSize = outLength + KExtraSpaceForConversion10; |
|
531 HBufC* buf1 = HBufC::NewLC( firstSize ); |
|
532 TPtr tp = buf1->Des(); |
|
533 |
|
534 if ( word == KMmsByteOrderMark ) |
|
535 { |
|
536 bom = ETrue; |
|
537 nativeEndian = ETrue; |
|
538 } |
|
539 else if ( word == KMmsReversedByteOrderMark ) |
|
540 { |
|
541 bom = ETrue; |
|
542 } |
|
543 else |
|
544 { |
|
545 } |
|
546 |
|
547 if ( bom ) |
|
548 { |
|
549 fileSize -= 2; |
|
550 } |
|
551 |
|
552 fileSize = fileSize / 2; |
|
553 |
|
554 // Read the rest of the characters |
|
555 if ( nativeEndian ) |
|
556 { |
|
557 // No need for byte order changes |
|
558 reader.ReadL( tp, Min( firstSize, fileSize )); |
|
559 } |
|
560 else if ( bom ) |
|
561 { |
|
562 // Change byte order. |
|
563 TUint8 byte1 = 0; |
|
564 TUint16 byte2 = 0; |
|
565 TUint16 word1 = 0; |
|
566 TInt numChars = Min( firstSize, fileSize ); |
|
567 for ( TInt i = 0; i < numChars; i++ ) |
|
568 { |
|
569 byte1 = reader.ReadUint8L(); |
|
570 byte2 = reader.ReadUint8L(); |
|
571 word1 = byte1; |
|
572 const TInt KMmsBitsInByte = 8; |
|
573 word1 <<= KMmsBitsInByte; |
|
574 word1 |= byte2; |
|
575 tp.Append( word1 ); |
|
576 } |
|
577 } |
|
578 |
|
579 else // no bom |
|
580 { |
|
581 // Return the first character if it was not BOM. |
|
582 // should not happen regularly |
|
583 // Read the characters |
|
584 reader.ReadL( tp, Min( firstSize, fileSize - 2 )); |
|
585 TBuf<2> auxBuf; |
|
586 auxBuf.Append(word); |
|
587 tp.Insert(0, auxBuf); |
|
588 } |
|
589 |
|
590 // Replace CR and LF with SPACE. |
|
591 ReplaceCRLFAndTrim( tp ); |
|
592 |
|
593 // Set output parameter |
|
594 aDescription = tp.Left( Min( outLength, tp.Length()) ); |
|
595 CleanupStack::PopAndDestroy( buf1 ); |
|
596 } |
|
597 |
|
598 else if ( aCharSet == KMmsUsAscii ) |
|
599 { |
|
600 // reserve extra space for conversion |
|
601 firstSize = outLength + KExtraSpaceForConversion10; |
|
602 HBufC8* buf8 = HBufC8::NewLC( firstSize ); |
|
603 TPtr8 tp8 = buf8->Des(); |
|
604 |
|
605 // Read the characters |
|
606 reader.ReadL( tp8, Min( firstSize, fileSize )); |
|
607 |
|
608 // Replace CR and LF with SPACE |
|
609 ReplaceCRLFAndTrim( tp8 ); |
|
610 |
|
611 // Copy 8 bit data to 16 bit description |
|
612 HBufC* buf16 = NULL; |
|
613 buf16 = HBufC::NewLC( tp8.Length() ); |
|
614 TPtr tp16 = buf16->Des(); |
|
615 tp16.Copy( tp8 ); |
|
616 |
|
617 // Set output parameter |
|
618 aDescription = tp16.Left( Min( outLength, tp16.Length()) ); |
|
619 CleanupStack::PopAndDestroy( buf16 ); |
|
620 CleanupStack::PopAndDestroy( buf8 ); |
|
621 } |
|
622 else if ( aCharSet == KMmsUtf8 ) |
|
623 { |
|
624 |
|
625 if ( fileSize > KMmsMaxDescription ) |
|
626 { |
|
627 fileSize = KMmsMaxDescription; |
|
628 } |
|
629 |
|
630 // reserve extra space for conversion |
|
631 firstSize = outLength + KExtraSpaceForConversion30; |
|
632 HBufC8* buf8 = HBufC8::NewLC( firstSize ); |
|
633 TPtr8 tp8 = buf8->Des(); |
|
634 |
|
635 // Read the characters |
|
636 TRAP( error, reader.ReadL( tp8, Min( firstSize, fileSize ))); |
|
637 |
|
638 if ( error == KErrNone ) |
|
639 { |
|
640 // Convert 8-bit UTF to Unicode |
|
641 HBufC* buf16 = HBufC::NewLC( tp8.Length() ); |
|
642 TPtr tp16 = buf16->Des(); |
|
643 CnvUtfConverter::ConvertToUnicodeFromUtf8( tp16, tp8 ); |
|
644 |
|
645 // Replace CR and LF with SPACE |
|
646 ReplaceCRLFAndTrim( tp16 ); |
|
647 |
|
648 // Set output parameter |
|
649 aDescription = tp16.Left( Min( outLength, tp16.Length()) ); |
|
650 CleanupStack::PopAndDestroy( buf16 ); |
|
651 } |
|
652 CleanupStack::PopAndDestroy( buf8 ); |
|
653 } |
|
654 else |
|
655 { |
|
656 |
|
657 } |
|
658 |
|
659 // Free memory |
|
660 CleanupStack::PopAndDestroy( &reader ); //reader |
|
661 } |
|
662 |
|
663 // --------------------------------------------------------- |
|
664 // TMmsGenUtils::ReplaceCRLFAndTrim |
|
665 // --------------------------------------------------------- |
|
666 // |
|
667 EXPORT_C void TMmsGenUtils::ReplaceCRLFAndTrim( TDes16& aDes ) |
|
668 { |
|
669 TInt position = -1; |
|
670 |
|
671 // Find all <CR> and <LF> characters and replace them with spaces |
|
672 |
|
673 for ( position = 0; position < aDes.Length(); position++ ) |
|
674 { |
|
675 if ( aDes.Mid( position, 1 ) < KSpace16 || |
|
676 aDes.Mid( position, 1 ) == KMmsUnicodeLineSeparator || |
|
677 aDes.Mid( position, 1 ) == KMmsUnicodeParagraphSeparator || |
|
678 aDes.Mid( position, 1 ) == KMmsIdeographicSpace || |
|
679 ((TChar)aDes[position]).IsControl() ) |
|
680 { |
|
681 aDes.Replace( position, 1, KSpace16 ); |
|
682 } |
|
683 } |
|
684 |
|
685 // Delete leading and trailing space characters from the descriptor’s |
|
686 // data and replace each contiguous set of space characters within |
|
687 // the data by one space character. |
|
688 aDes.TrimAll(); |
|
689 } |
|
690 |
|
691 |
|
692 // --------------------------------------------------------- |
|
693 // TMmsGenUtils::ReplaceCRLFAndTrim |
|
694 // --------------------------------------------------------- |
|
695 // |
|
696 EXPORT_C void TMmsGenUtils::ReplaceCRLFAndTrim( TDes8& aDes ) |
|
697 { |
|
698 // This function should be used for US-ASCII only |
|
699 TInt position = -1; |
|
700 |
|
701 for ( position = 0; position < aDes.Length(); position++ ) |
|
702 { |
|
703 if ( aDes.Mid( position, 1 ) < KSpace8 ) |
|
704 { |
|
705 aDes.Replace( position, 1, KSpace8 ); |
|
706 } |
|
707 } |
|
708 |
|
709 // Delete leading and trailing space characters from the descriptor’s |
|
710 // data and replace each contiguous set of space characters within |
|
711 // the data by one space character. |
|
712 aDes.TrimAll(); |
|
713 } |
|
714 |
|
715 // --------------------------------------------------------- |
|
716 // TMmsGenUtils::Log |
|
717 // --------------------------------------------------------- |
|
718 // |
|
719 EXPORT_C void TMmsGenUtils::Log( TRefByValue<const TDesC> aFmt,...) |
|
720 { |
|
721 #ifdef _DEBUG |
|
722 VA_LIST list; |
|
723 VA_START( list, aFmt ); |
|
724 |
|
725 // Print to log file |
|
726 TBuf<KLogBufferLength> buf; |
|
727 buf.FormatList( aFmt, list ); |
|
728 |
|
729 // Write to log file |
|
730 RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, buf ); |
|
731 #endif |
|
732 } |
|
733 |
|
734 // --------------------------------------------------------- |
|
735 // TMmsGenUtils::DoGetAliasL |
|
736 // --------------------------------------------------------- |
|
737 // |
|
738 void TMmsGenUtils::DoGetAliasL( |
|
739 RFs& /*aFs*/, |
|
740 const TDesC& /*aAddress*/, |
|
741 TDes& /*aAlias*/, |
|
742 TInt /*aMaxLength*/ ) |
|
743 { |
|
744 |
|
745 } |
|
746 |
|
747 |
|
748 // --------------------------------------------------------- |
|
749 // TMmsGenUtils::DoGetAliasL |
|
750 // --------------------------------------------------------- |
|
751 // |
|
752 void TMmsGenUtils::DoGetAliasL( |
|
753 const TDesC& /*aAddress*/, |
|
754 TDes& /*aAlias*/, |
|
755 TInt /*aMaxLength*/, |
|
756 CContactMatcher& /*aContactMatcher*/, |
|
757 TInt /*aDigitsToMatch*/ ) |
|
758 { |
|
759 } |
|
760 |
|
761 // --------------------------------------------------------- |
|
762 // TMmsGenUtils::ConvertEscapesFromUri |
|
763 // --------------------------------------------------------- |
|
764 // |
|
765 /*TInt TMmsGenUtils::ConvertEscapesFromUri( |
|
766 const TDesC8& aInput, |
|
767 TDes8& aOutput ) |
|
768 { |
|
769 TInt retval = KErrNone; |
|
770 |
|
771 // Checkings |
|
772 if( aOutput.MaxLength() < aInput.Length() ) |
|
773 { |
|
774 retval = KErrArgument; |
|
775 return retval; |
|
776 } |
|
777 |
|
778 // Loop through aInput and find the number of '%' chars |
|
779 for( TUint8 i = 0; i < aInput.Length(); i++ ) |
|
780 { |
|
781 if( aInput[i] == 0x25 ) // '%' found |
|
782 { |
|
783 // Store the chars representing the hexvalue |
|
784 TUint8 highbyte = aInput[i+1]; |
|
785 TUint8 lowbyte = aInput[i+2]; |
|
786 |
|
787 // Check the bytes |
|
788 TUint8 result = 0; |
|
789 |
|
790 // Map the highbyte to correct upperbits of result |
|
791 // (In order to save code lines and keep code readable, |
|
792 // the following does not follow the coding convention.) |
|
793 if(highbyte == 0x30) result = 0x0; |
|
794 if(highbyte == 0x31) result = 0x1; |
|
795 if(highbyte == 0x32) result = 0x2; |
|
796 if(highbyte == 0x33) result = 0x3; |
|
797 if(highbyte == 0x34) result = 0x4; |
|
798 if(highbyte == 0x35) result = 0x5; |
|
799 if(highbyte == 0x36) result = 0x6; |
|
800 if(highbyte == 0x37) result = 0x7; |
|
801 if(highbyte == 0x38) result = 0x8; |
|
802 if(highbyte == 0x39) result = 0x9; |
|
803 if(highbyte == 0x41 || highbyte == 0x61) result = 0xA; |
|
804 if(highbyte == 0x42 || highbyte == 0x62) result = 0xB; |
|
805 if(highbyte == 0x43 || highbyte == 0x63) result = 0xC; |
|
806 if(highbyte == 0x44 || highbyte == 0x64) result = 0xD; |
|
807 if(highbyte == 0x45 || highbyte == 0x65) result = 0xE; |
|
808 if(highbyte == 0x46 || highbyte == 0x66) result = 0xF; |
|
809 |
|
810 if( ( result == 0 ) && ( highbyte != 0x30 ) ) |
|
811 { |
|
812 retval = KErrArgument; |
|
813 } |
|
814 result <<= 4; |
|
815 |
|
816 // Map the lowbyte to correct lowerbits of result |
|
817 // (In order to save code lines and keep code readable, |
|
818 // the following does not follow the coding convention.) |
|
819 if(lowbyte == 0x30) result += 0x0; |
|
820 if(lowbyte == 0x31) result += 0x1; |
|
821 if(lowbyte == 0x32) result += 0x2; |
|
822 if(lowbyte == 0x33) result += 0x3; |
|
823 if(lowbyte == 0x34) result += 0x4; |
|
824 if(lowbyte == 0x35) result += 0x5; |
|
825 if(lowbyte == 0x36) result += 0x6; |
|
826 if(lowbyte == 0x37) result += 0x7; |
|
827 if(lowbyte == 0x38) result += 0x8; |
|
828 if(lowbyte == 0x39) result += 0x9; |
|
829 if(lowbyte == 0x41 || lowbyte == 0x61) result += 0xA; |
|
830 if(lowbyte == 0x42 || lowbyte == 0x62) result += 0xB; |
|
831 if(lowbyte == 0x43 || lowbyte == 0x63) result += 0xC; |
|
832 if(lowbyte == 0x44 || lowbyte == 0x64) result += 0xD; |
|
833 if(lowbyte == 0x45 || lowbyte == 0x65) result += 0xE; |
|
834 if(lowbyte == 0x46 || lowbyte == 0x66) result += 0xF; |
|
835 |
|
836 if( ( ( result & 0xF ) == 0 ) && ( lowbyte != 0x30 ) ) |
|
837 { |
|
838 retval = KErrArgument; |
|
839 } |
|
840 |
|
841 // Abort if error has occurred |
|
842 if( retval != KErrNone ) |
|
843 { |
|
844 return retval; |
|
845 } |
|
846 |
|
847 // Insert the value to output parameter |
|
848 aOutput.Append( result ); |
|
849 i += 2; // Jumping over the two chars already handled |
|
850 } |
|
851 else |
|
852 { |
|
853 aOutput.Append( aInput[i] ); |
|
854 } |
|
855 } // for |
|
856 return retval; |
|
857 }*/ |
|
858 |
|
859 // --------------------------------------------------------- |
|
860 // TMmsGenUtils::DecodeMessageHeader |
|
861 // --------------------------------------------------------- |
|
862 // |
|
863 EXPORT_C void TMmsGenUtils::DecodeAndConvertMessageHeaderL( |
|
864 const TDesC8& aInput, |
|
865 TDes16& aOutput, |
|
866 RFs& aFs |
|
867 ) |
|
868 { |
|
869 // Create CCnvCharacterSetConverter |
|
870 CCnvCharacterSetConverter* characterSetConverter |
|
871 = CCnvCharacterSetConverter::NewL(); |
|
872 CleanupStack::PushL( characterSetConverter ); |
|
873 |
|
874 // Create CImConvertCharconv |
|
875 // (this is a wrapper for the actual char converter) |
|
876 CImConvertCharconv* converter |
|
877 = CImConvertCharconv::NewL( *characterSetConverter, aFs ); |
|
878 CleanupStack::PushL( converter ); |
|
879 |
|
880 // Create CImConvertHeader that actually does the task |
|
881 CImConvertHeader* headerConverter = CImConvertHeader::NewL( *converter ); |
|
882 CleanupStack::PushL( headerConverter ); |
|
883 |
|
884 // Perform the decoding and charset conversion |
|
885 headerConverter->DecodeHeaderFieldL( aInput, aOutput ); |
|
886 |
|
887 // Clean up and return |
|
888 CleanupStack::PopAndDestroy( headerConverter ); |
|
889 CleanupStack::PopAndDestroy( converter ); |
|
890 CleanupStack::PopAndDestroy( characterSetConverter ); |
|
891 } |
|
892 |
|
893 |
|
894 // --------------------------------------------------------- |
|
895 // |
|
896 // Return the free space in a drive identified by the aDrive parameter |
|
897 // and the media type of the drive. |
|
898 // |
|
899 // --------------------------------------------------------- |
|
900 static TInt64 FreeSpaceL(RFs* aFs, TInt aDrive, TMediaType& aMediaType) |
|
901 { |
|
902 RFs fs; |
|
903 TInt err = KErrNone; |
|
904 |
|
905 if ( !aFs ) |
|
906 User::LeaveIfError(fs.Connect()); // Create temp session |
|
907 else |
|
908 fs = *aFs; |
|
909 |
|
910 TVolumeInfo vinfo; |
|
911 err = fs.Volume(vinfo, aDrive); |
|
912 |
|
913 TDriveInfo driveInfo; |
|
914 TInt errorCode = fs.Drive( driveInfo, aDrive ); |
|
915 if ( errorCode == KErrNone ) |
|
916 { |
|
917 aMediaType = driveInfo.iType; |
|
918 } |
|
919 else |
|
920 { |
|
921 aMediaType = EMediaUnknown; |
|
922 } |
|
923 |
|
924 if ( !aFs ) |
|
925 fs.Close(); // Close temp. session |
|
926 |
|
927 if (err != KErrNone) |
|
928 { |
|
929 User::LeaveIfError(err); |
|
930 } |
|
931 |
|
932 return TInt64(vinfo.iFree); |
|
933 } |
|
934 |
|
935 // --------------------------------------------------------- |
|
936 // TMmsGenUtils::DiskSpaceBelowCriticalLevelL |
|
937 // --------------------------------------------------------- |
|
938 // |
|
939 EXPORT_C TBool TMmsGenUtils::DiskSpaceBelowCriticalLevelL( |
|
940 RFs* aFs, TInt aBytesToWrite, TInt aDrive) |
|
941 { |
|
942 TInt64 free; |
|
943 TInt64 criticalLevel; |
|
944 CRepository* repository = NULL; |
|
945 TMediaType mediaType = EMediaNotPresent; |
|
946 free = FreeSpaceL(aFs, aDrive, mediaType); |
|
947 |
|
948 TInt64 newFree = free - (TInt64)aBytesToWrite; |
|
949 |
|
950 // Querying Critical Level from CenRep |
|
951 TInt error = KErrNone; |
|
952 TInt level = 0; |
|
953 TRAP( error, repository = CRepository::NewL( KCRUidUiklaf ) ); |
|
954 if ( error == KErrNone) |
|
955 { |
|
956 error = repository->Get( KUikOODDiskCriticalThreshold, level ); |
|
957 delete repository; |
|
958 if( error != KErrNone ) |
|
959 { |
|
960 // Default value 0 means "anything goes" |
|
961 level = 0; |
|
962 } |
|
963 } |
|
964 |
|
965 #ifdef _DEBUG |
|
966 if ( error != KErrNone ) |
|
967 { |
|
968 _LIT( KMmsCriticalSpaceError, "- Get critical disk space threshold returned error %d" ); |
|
969 Log( KMmsCriticalSpaceError, error ); |
|
970 } |
|
971 else |
|
972 { |
|
973 _LIT( KMmsCriticalSpaceLog, "- Critical level: %d, free space: %d" ); |
|
974 Log( KMmsCriticalSpaceLog, level, newFree ); |
|
975 } |
|
976 #endif |
|
977 |
|
978 criticalLevel = level; |
|
979 return newFree <= criticalLevel; |
|
980 } |
|
981 |
|
982 // --------------------------------------------------------- |
|
983 // TMmsGenUtils::NetworkOperationsAllowed() |
|
984 // |
|
985 // --------------------------------------------------------- |
|
986 // |
|
987 EXPORT_C TBool TMmsGenUtils::NetworkOperationsAllowed() |
|
988 { |
|
989 TBool networkAllowed = ETrue; // optimist |
|
990 // If there is no such key, we will continue normally. |
|
991 // This means that in a system where online/offline mode switching |
|
992 // is not supported, we behave as we were always online |
|
993 |
|
994 CRepository* repository = NULL; |
|
995 TInt error = KErrNone; |
|
996 TInt value = ECoreAppUIsNetworkConnectionAllowed; |
|
997 TRAP( error, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) ); |
|
998 if( error == KErrNone ) |
|
999 { |
|
1000 repository->Get( KCoreAppUIsNetworkConnectionAllowed, value ); |
|
1001 delete repository; |
|
1002 repository = NULL; |
|
1003 if ( value == ECoreAppUIsNetworkConnectionNotAllowed ) |
|
1004 { |
|
1005 networkAllowed = EFalse; |
|
1006 } |
|
1007 } |
|
1008 |
|
1009 return networkAllowed; |
|
1010 } |
|
1011 |
|
1012 // --------------------------------------------------------- |
|
1013 // TMmsGenUtils::GetLoggingSettings |
|
1014 // --------------------------------------------------------- |
|
1015 // |
|
1016 EXPORT_C void TMmsGenUtils::GetLoggingSettings( TBool& aDecodeLoggingOn, TBool& aDumpOn ) |
|
1017 { |
|
1018 // Consult CenRep for decodelogging and binarydump settings |
|
1019 CRepository* repository = NULL; |
|
1020 // default values are false if not found in repository |
|
1021 aDecodeLoggingOn = EFalse; |
|
1022 aDumpOn = EFalse; |
|
1023 |
|
1024 TInt retval = KErrNone; |
|
1025 TRAP_IGNORE( |
|
1026 { |
|
1027 repository = CRepository::NewL( KUidMmsServerMtm ); |
|
1028 CleanupStack::PushL( repository ); |
|
1029 TInt temp = 0; |
|
1030 retval = repository->Get( KMmsEngineDecodeLog, temp ); |
|
1031 if( retval == KErrNone ) |
|
1032 { |
|
1033 aDecodeLoggingOn = ( temp != 0 ); |
|
1034 } |
|
1035 retval = repository->Get( KMmsEngineBinaryDump, temp ); |
|
1036 if( retval == KErrNone ) |
|
1037 { |
|
1038 aDumpOn = ( temp != 0 ); |
|
1039 } |
|
1040 CleanupStack::PopAndDestroy( repository ); |
|
1041 repository = NULL; |
|
1042 } |
|
1043 ); |
|
1044 #ifndef __WINS__ |
|
1045 // turn decode logging on in armv5 version |
|
1046 // Release versions never log anyway |
|
1047 aDecodeLoggingOn = ETrue; |
|
1048 #endif |
|
1049 } |
|
1050 |
|
1051 // --------------------------------------------------------- |
|
1052 // TMmsGenUtils::AddAttributeL |
|
1053 // |
|
1054 // --------------------------------------------------------- |
|
1055 // |
|
1056 EXPORT_C void TMmsGenUtils::AddAttributeL( |
|
1057 const TDesC& aName, |
|
1058 const TDesC& aValue, |
|
1059 CDesCArray& aAttributeList ) |
|
1060 { |
|
1061 TInt position = FindAttributePosition( aName, aAttributeList ); |
|
1062 TInt error = KErrNone; |
|
1063 |
|
1064 if ( position == KErrNotFound ) |
|
1065 { |
|
1066 // not found, append to end |
|
1067 aAttributeList.AppendL( aName ); |
|
1068 TRAP ( error, aAttributeList.AppendL( aValue ) ); |
|
1069 if ( error != KErrNone ) |
|
1070 { |
|
1071 // could not add value, delete name, too. |
|
1072 // It is the last item in the list |
|
1073 aAttributeList.Delete( aAttributeList.MdcaCount() - 1 ); |
|
1074 } |
|
1075 } |
|
1076 else |
|
1077 { |
|
1078 // delete old value and insert new one |
|
1079 aAttributeList.Delete( position + 1 ); |
|
1080 TRAP ( error, aAttributeList.InsertL( position + 1, aValue ) ); |
|
1081 if ( error != KErrNone ) |
|
1082 { |
|
1083 // could not add value, delete name, too. |
|
1084 aAttributeList.Delete( position ); |
|
1085 } |
|
1086 } |
|
1087 User::LeaveIfError( error ); |
|
1088 |
|
1089 } |
|
1090 |
|
1091 // --------------------------------------------------------- |
|
1092 // TMmsGenUtils::GetAttributeL |
|
1093 // |
|
1094 // --------------------------------------------------------- |
|
1095 // |
|
1096 EXPORT_C TPtrC TMmsGenUtils::GetAttributeL( |
|
1097 const TDesC& aName, |
|
1098 const CDesCArray& aAttributeList ) |
|
1099 { |
|
1100 TInt position = FindAttributePosition( aName, aAttributeList ); |
|
1101 |
|
1102 if ( position == KErrNotFound ) |
|
1103 { |
|
1104 User::Leave( KErrNotFound ); |
|
1105 } |
|
1106 return ( aAttributeList.MdcaPoint( position + 1 ) ); |
|
1107 } |
|
1108 |
|
1109 // --------------------------------------------------------- |
|
1110 // TMmsGenUtils::FindAttribute |
|
1111 // |
|
1112 // --------------------------------------------------------- |
|
1113 // |
|
1114 EXPORT_C TBool TMmsGenUtils::FindAttribute( |
|
1115 const TDesC& aName, |
|
1116 const CDesCArray& aAttributeList ) |
|
1117 { |
|
1118 if ( FindAttributePosition( aName, aAttributeList ) == KErrNotFound ) |
|
1119 { |
|
1120 return EFalse; |
|
1121 } |
|
1122 return ETrue; |
|
1123 } |
|
1124 |
|
1125 // --------------------------------------------------------- |
|
1126 // TMmsGenUtils::DeleteAttribute |
|
1127 // |
|
1128 // --------------------------------------------------------- |
|
1129 // |
|
1130 EXPORT_C void TMmsGenUtils::DeleteAttribute( |
|
1131 const TDesC& aName, |
|
1132 CDesCArray& aAttributeList ) |
|
1133 { |
|
1134 TInt position = FindAttributePosition( aName, aAttributeList ); |
|
1135 |
|
1136 if ( position == KErrNotFound ) |
|
1137 { |
|
1138 return; // not found, nothing to delete |
|
1139 } |
|
1140 // delete both name and value |
|
1141 aAttributeList.Delete( position, 2 ); |
|
1142 } |
|
1143 |
|
1144 // --------------------------------------------------------- |
|
1145 // TMmsGenUtils::FindAttributePosition |
|
1146 // |
|
1147 // --------------------------------------------------------- |
|
1148 // |
|
1149 TInt TMmsGenUtils::FindAttributePosition( |
|
1150 const TDesC& aName, |
|
1151 const CDesCArray& aAttributeList ) |
|
1152 { |
|
1153 TInt position = KErrNotFound; |
|
1154 |
|
1155 TInt i; |
|
1156 |
|
1157 for ( i = 0; i < aAttributeList.MdcaCount() - 1; i+=2 ) |
|
1158 { |
|
1159 //It is not possible to index out of bound (codescanner warning) |
|
1160 if ( aAttributeList[i].Compare( aName ) == 0 ) |
|
1161 { |
|
1162 position = i; |
|
1163 } |
|
1164 } |
|
1165 return position; |
|
1166 } |
|
1167 |
|
1168 |
|
1169 // --------------------------------------------------------- |
|
1170 // TMmsGenUtils::DigitsToMatch |
|
1171 // |
|
1172 // --------------------------------------------------------- |
|
1173 TInt TMmsGenUtils::DigitsToMatch() |
|
1174 { |
|
1175 // Find the number of digits to be used when matching phone numbers |
|
1176 TInt digitsToMatch( KMmsNumberOfDigitsToMatch ); |
|
1177 |
|
1178 CRepository* repository = NULL; |
|
1179 TRAPD( err, repository = CRepository::NewL( KCRUidTelConfiguration )); |
|
1180 if ( err == KErrNone ) |
|
1181 { |
|
1182 err = repository->Get( KTelMatchDigits , digitsToMatch ); |
|
1183 delete repository; |
|
1184 if( err != KErrNone ) |
|
1185 { |
|
1186 digitsToMatch=KMmsNumberOfDigitsToMatch; |
|
1187 } |
|
1188 } |
|
1189 return digitsToMatch; |
|
1190 } |
|
1191 |
|
1192 // --------------------------------------------------------- |
|
1193 // TMmsGenUtils::OpenAllStoresL |
|
1194 // |
|
1195 // --------------------------------------------------------- |
|
1196 CContactMatcher* TMmsGenUtils::OpenAllStoresL( RFs& /*aFs*/ ) |
|
1197 { |
|
1198 // Use contact wrapper to open all databases |
|
1199 /* CContactMatcher* contactMatcher = CContactMatcher::NewL( &aFs ); |
|
1200 CleanupStack::PushL( contactMatcher ); |
|
1201 |
|
1202 contactMatcher->OpenDefaultMatchStoresL(); |
|
1203 |
|
1204 CleanupStack::Pop( contactMatcher ); |
|
1205 return contactMatcher;*/ |
|
1206 return NULL; |
|
1207 } |
|
1208 |
|
1209 // ----------------------------------------------------------------------------- |
|
1210 // TMmsGenUtils::GetContactNameL |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // |
|
1213 HBufC* TMmsGenUtils::GetContactNameL( |
|
1214 const MVPbkContactLink& /*aContactLink*/, |
|
1215 CContactMatcher& /*aContactMatcher*/) |
|
1216 { |
|
1217 |
|
1218 return NULL; |
|
1219 } |
|
1220 |
|
1221 // ----------------------------------------------------------------------------- |
|
1222 // TMmsGenUtils::GetContactNameInLowerCaseL |
|
1223 // ----------------------------------------------------------------------------- |
|
1224 // |
|
1225 HBufC* TMmsGenUtils::GetContactNameInLowerCaseL( |
|
1226 const MVPbkContactLink& aContactLink, |
|
1227 CContactMatcher &aContactMatcher) |
|
1228 { |
|
1229 //get the name |
|
1230 HBufC* nameBuff = GetContactNameL( aContactLink, aContactMatcher ); |
|
1231 CleanupStack::PushL( nameBuff ); |
|
1232 |
|
1233 //Convert to lower case , since this name buffer is used to compare names. |
|
1234 HBufC* nameInLowerCase = HBufC::NewL( nameBuff->Length() + 2 ); |
|
1235 nameInLowerCase->Des().CopyLC( *nameBuff ); |
|
1236 |
|
1237 CleanupStack::PopAndDestroy( nameBuff ); // nameBuff |
|
1238 return nameInLowerCase; |
|
1239 } |
|
1240 |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // TMmsGenUtils::ShowContactNameL |
|
1243 // ----------------------------------------------------------------------------- |
|
1244 // |
|
1245 TBool TMmsGenUtils::ShowContactNameL( |
|
1246 CVPbkContactLinkArray* /*aLinkArray*/, |
|
1247 TInt& /*aNameIndex*/, |
|
1248 CContactMatcher& /*aContactMatcher*/) |
|
1249 { |
|
1250 return 0; |
|
1251 } |
|
1252 |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // TMmsGenUtils::GetCurrentStoreIndexL |
|
1255 // ----------------------------------------------------------------------------- |
|
1256 // |
|
1257 TInt TMmsGenUtils::GetCurrentStoreIndexL( CVPbkContactLinkArray& /*aLinkArray*/ ) |
|
1258 { |
|
1259 |
|
1260 return 0; |
|
1261 } |
|
1262 |
|
1263 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
1264 |
|
1265 // End of File |