|
1 /* |
|
2 * Copyright (c) 2008 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: factory helper class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "timcachemessagefactory.h" |
|
22 #include "cimcachemessageheader.h" |
|
23 #include "cimcachemessagebase.h" |
|
24 //logs |
|
25 #include "imcachedebugtrace.h" |
|
26 |
|
27 |
|
28 // ================= MEMBER FUNCTIONS ======================= |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // TIMCacheMessageFactory::CreateIMCacheMessageHeaderL |
|
32 // Create instantmessagingcache message header |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 MIMCacheMessageHeader* TIMCacheMessageFactory::CreateIMCacheMessageHeaderL(TInt aServiceId, const TDesC& aBuddyId ) |
|
36 { |
|
37 TRACE( T_LIT( "TIMCacheMessageFactory::CreateIMCacheMessageHeaderL") ); |
|
38 return CIMCacheMessageHeader::NewL( aServiceId, aBuddyId ); |
|
39 } |
|
40 |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // TIMCacheMessageFactory::CreateCacheMessageL |
|
44 // Create instantmessagingcache message header |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CIMCacheMessageBase* TIMCacheMessageFactory::CreateCacheMessageL( |
|
48 const TDesC& aData ) |
|
49 { |
|
50 TRACE( T_LIT( "TIMCacheMessageFactory::CreateCacheMessageL") ); |
|
51 return CIMCacheMessageBase::NewL(aData) ; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // TIMCacheMessageFactory::FindHeaderIndexL |
|
56 // Create instantmessagingcache message header |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 TInt TIMCacheMessageFactory::FindHeaderIndexL(RPointerArray<MIMCacheMessageHeader>& aArray, |
|
60 TInt aServiceId, |
|
61 const TDesC& aBuddyId ) |
|
62 { |
|
63 TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL begin") ); |
|
64 TInt count = aArray.Count(); |
|
65 TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL count = %d"),count ); |
|
66 |
|
67 for(TInt index = 0; index <count ; index++ ) |
|
68 { |
|
69 MIMCacheMessageHeader* header = aArray[index]; |
|
70 if(header ) |
|
71 { |
|
72 if( ( aServiceId == header->ServiceId() ) && ( aBuddyId.CompareC( header->BuddyId() ) == 0 ) ) |
|
73 { |
|
74 return index; |
|
75 } |
|
76 } |
|
77 } |
|
78 |
|
79 TRACE( T_LIT( "TIMCacheMessageFactory::FindHeaderIndexL end") ); |
|
80 return KErrNotFound; |
|
81 } |
|
82 |
|
83 // end of file |
|
84 |