--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/BWINSCW/XdmEngineU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,115 @@
+EXPORTS
+ ??0CXdmDirectory@@IAE@AAVCXdmEngine@@@Z @ 1 NONAME ; CXdmDirectory::CXdmDirectory(class CXdmEngine &)
+ ??0CXdmDocument@@IAE@AAVCXdmEngine@@@Z @ 2 NONAME ; CXdmDocument::CXdmDocument(class CXdmEngine &)
+ ??0CXdmDocumentNode@@IAE@AAVCXdmEngine@@AAVMXdmNodeFactory@@@Z @ 3 NONAME ; CXdmDocumentNode::CXdmDocumentNode(class CXdmEngine &, class MXdmNodeFactory &)
+ ??0CXdmDocumentNode@@IAE@AAVCXdmEngine@@AAVMXdmNodeFactory@@PAV0@@Z @ 4 NONAME ; CXdmDocumentNode::CXdmDocumentNode(class CXdmEngine &, class MXdmNodeFactory &, class CXdmDocumentNode *)
+ ??0CXdmDocumentNode@@IAE@HAAVCXdmEngine@@AAVMXdmNodeFactory@@PAV0@@Z @ 5 NONAME ; CXdmDocumentNode::CXdmDocumentNode(int, class CXdmEngine &, class MXdmNodeFactory &, class CXdmDocumentNode *)
+ ??0CXdmNodeAttribute@@IAE@AAVCXdmEngine@@AAVMXdmNodeFactory@@@Z @ 6 NONAME ; CXdmNodeAttribute::CXdmNodeAttribute(class CXdmEngine &, class MXdmNodeFactory &)
+ ??0CXdmNodeAttribute@@IAE@AAVCXdmEngine@@AAVMXdmNodeFactory@@PAVCXdmDocumentNode@@@Z @ 7 NONAME ; CXdmNodeAttribute::CXdmNodeAttribute(class CXdmEngine &, class MXdmNodeFactory &, class CXdmDocumentNode *)
+ ??0TXdmCredentials@@QAE@ABVTDesC16@@0@Z @ 8 NONAME ; TXdmCredentials::TXdmCredentials(class TDesC16 const &, class TDesC16 const &)
+ ??0TXdmCredentials@@QAE@XZ @ 9 NONAME ; TXdmCredentials::TXdmCredentials(void)
+ ??1CXdmDirectory@@UAE@XZ @ 10 NONAME ; CXdmDirectory::~CXdmDirectory(void)
+ ??1CXdmDocument@@UAE@XZ @ 11 NONAME ; CXdmDocument::~CXdmDocument(void)
+ ??1CXdmDocumentNode@@UAE@XZ @ 12 NONAME ; CXdmDocumentNode::~CXdmDocumentNode(void)
+ ??1CXdmEngine@@UAE@XZ @ 13 NONAME ; CXdmEngine::~CXdmEngine(void)
+ ??1CXdmNodeAttribute@@UAE@XZ @ 14 NONAME ; CXdmNodeAttribute::~CXdmNodeAttribute(void)
+ ??1CXdmProtocolInfo@@UAE@XZ @ 15 NONAME ; CXdmProtocolInfo::~CXdmProtocolInfo(void)
+ ??8CXdmDocument@@QBEHAAV0@@Z @ 16 NONAME ; int CXdmDocument::operator==(class CXdmDocument &) const
+ ??8CXdmDocumentNode@@QBEHABV0@@Z @ 17 NONAME ; int CXdmDocumentNode::operator==(class CXdmDocumentNode const &) const
+ ?AccessPoint@CXdmProtocolInfo@@QBEHXZ @ 18 NONAME ; int CXdmProtocolInfo::AccessPoint(void) const
+ ?AppendChileNodeL@CXdmDocumentNode@@QAEXPAV1@@Z @ 19 NONAME ; void CXdmDocumentNode::AppendChileNodeL(class CXdmDocumentNode *)
+ ?AppendL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@@Z @ 20 NONAME ; void CXdmDocument::AppendL(class CXdmDocumentNode *)
+ ?AppendToModelL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@0@Z @ 21 NONAME ; void CXdmDocument::AppendToModelL(class CXdmDocumentNode *, class CXdmDocumentNode *)
+ ?Attribute@CXdmDocumentNode@@QBEPAVCXdmNodeAttribute@@ABVTDesC16@@@Z @ 22 NONAME ; class CXdmNodeAttribute * CXdmDocumentNode::Attribute(class TDesC16 const &) const
+ ?Attribute@CXdmDocumentNode@@QBEPAVCXdmNodeAttribute@@H@Z @ 23 NONAME ; class CXdmNodeAttribute * CXdmDocumentNode::Attribute(int) const
+ ?AttributeCount@CXdmDocumentNode@@QBEHXZ @ 24 NONAME ; int CXdmDocumentNode::AttributeCount(void) const
+ ?AttributeValue@CXdmNodeAttribute@@QBE?AVTPtrC16@@XZ @ 25 NONAME ; class TPtrC16 CXdmNodeAttribute::AttributeValue(void) const
+ ?BaseConstructL@CXdmDirectory@@IAEXABVTDesC16@@@Z @ 26 NONAME ; void CXdmDirectory::BaseConstructL(class TDesC16 const &)
+ ?BaseConstructL@CXdmDocument@@IAEXHABVTDesC16@@@Z @ 27 NONAME ; void CXdmDocument::BaseConstructL(int, class TDesC16 const &)
+ ?BaseConstructL@CXdmDocument@@IAEXHABVTDesC8@@@Z @ 28 NONAME ; void CXdmDocument::BaseConstructL(int, class TDesC8 const &)
+ ?BaseConstructL@CXdmDocumentNode@@IAEXABVTDesC16@@@Z @ 29 NONAME ; void CXdmDocumentNode::BaseConstructL(class TDesC16 const &)
+ ?BaseConstructL@CXdmNodeAttribute@@IAEXABVTDesC16@@@Z @ 30 NONAME ; void CXdmNodeAttribute::BaseConstructL(class TDesC16 const &)
+ ?CancelUpdate@CXdmEngine@@QAEXPAVCXdmDirectory@@@Z @ 31 NONAME ; void CXdmEngine::CancelUpdate(class CXdmDirectory *)
+ ?CancelUpdate@CXdmEngine@@QAEXPAVCXdmDocument@@@Z @ 32 NONAME ; void CXdmEngine::CancelUpdate(class CXdmDocument *)
+ ?CheckFileExistsL@XdmStaticUtils@@SAHAAVRFs@@ABVTDesC16@@@Z @ 33 NONAME ; int XdmStaticUtils::CheckFileExistsL(class RFs &, class TDesC16 const &)
+ ?ChileNode@CXdmDocumentNode@@QBEPAV1@H@Z @ 34 NONAME ; class CXdmDocumentNode * CXdmDocumentNode::ChileNode(int) const
+ ?CleanUpDirectoryL@XdmStaticUtils@@SAXAAVRFs@@ABVTDesC16@@@Z @ 35 NONAME ; void XdmStaticUtils::CleanUpDirectoryL(class RFs &, class TDesC16 const &)
+ ?CopyConstructL@CXdmDocumentNode@@MAEXABV1@0@Z @ 36 NONAME ; void CXdmDocumentNode::CopyConstructL(class CXdmDocumentNode const &, class CXdmDocumentNode const &)
+ ?CreateAttributeL@CXdmDocumentNode@@QAEPAVCXdmNodeAttribute@@ABVTDesC16@@@Z @ 37 NONAME ; class CXdmNodeAttribute * CXdmDocumentNode::CreateAttributeL(class TDesC16 const &)
+ ?CreateAttributeL@CXdmDocumentNode@@QAEPAVCXdmNodeAttribute@@XZ @ 38 NONAME ; class CXdmNodeAttribute * CXdmDocumentNode::CreateAttributeL(void)
+ ?CreateChileNodeL@CXdmDocumentNode@@QAEPAV1@ABVTDesC16@@@Z @ 39 NONAME ; class CXdmDocumentNode * CXdmDocumentNode::CreateChileNodeL(class TDesC16 const &)
+ ?CreateChileNodeL@CXdmDocumentNode@@QAEPAV1@XZ @ 40 NONAME ; class CXdmDocumentNode * CXdmDocumentNode::CreateChileNodeL(void)
+ ?CreateDirectoryModelL@CXdmEngine@@QAEPAVCXdmDirectory@@ABVTDesC16@@@Z @ 41 NONAME ; class CXdmDirectory * CXdmEngine::CreateDirectoryModelL(class TDesC16 const &)
+ ?CreateDocumentModelL@CXdmEngine@@QAEPAVCXdmDocument@@ABVTDesC16@@W4TXdmDocType@@@Z @ 42 NONAME ; class CXdmDocument * CXdmEngine::CreateDocumentModelL(class TDesC16 const &, enum TXdmDocType)
+ ?CreateDocumentNodeL@CXdmEngine@@QAEPAVCXdmDocumentNode@@XZ @ 43 NONAME ; class CXdmDocumentNode * CXdmEngine::CreateDocumentNodeL(void)
+ ?Credentials@CXdmProtocolInfo@@QBEABVTXdmCredentials@@XZ @ 44 NONAME ; class TXdmCredentials const & CXdmProtocolInfo::Credentials(void) const
+ ?DeleteDataL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@@Z @ 45 NONAME ; void CXdmDocument::DeleteDataL(class CXdmDocumentNode *)
+ ?DeleteDirectoryModelL@CXdmEngine@@QAEXPBVCXdmDirectory@@@Z @ 46 NONAME ; void CXdmEngine::DeleteDirectoryModelL(class CXdmDirectory const *)
+ ?DeleteDocumentModelL@CXdmEngine@@QAEXPBVCXdmDocument@@@Z @ 47 NONAME ; void CXdmEngine::DeleteDocumentModelL(class CXdmDocument const *)
+ ?DirectoryCollection@CXdmEngine@@QBEABV?$RPointerArray@VCXdmDirectory@@@@XZ @ 48 NONAME ; class RPointerArray<class CXdmDirectory> const & CXdmEngine::DirectoryCollection(void) const
+ ?DocumentCollection@CXdmEngine@@QBEABV?$RPointerArray@VCXdmDocument@@@@XZ @ 49 NONAME ; class RPointerArray<class CXdmDocument> const & CXdmEngine::DocumentCollection(void) const
+ ?DocumentSubsetL@CXdmDocument@@QAEPAVCXdmDocumentNode@@ABVTDesC16@@@Z @ 50 NONAME ; class CXdmDocumentNode * CXdmDocument::DocumentSubsetL(class TDesC16 const &)
+ ?EightBitNodeNameLC@CXdmDocumentNode@@QBEPAVHBufC8@@XZ @ 51 NONAME ; class HBufC8 * CXdmDocumentNode::EightBitNodeNameLC(void) const
+ ?EightBitValueLC@CXdmNodeAttribute@@QBEPAVHBufC8@@XZ @ 52 NONAME ; class HBufC8 * CXdmNodeAttribute::EightBitValueLC(void) const
+ ?ElementDataLC@CXdmDocumentNode@@QBEPAVHBufC8@@XZ @ 53 NONAME ; class HBufC8 * CXdmDocumentNode::ElementDataLC(void) const
+ ?ElementType@CXdmDocumentNode@@UBE?AW4TXdmElementType@@XZ @ 54 NONAME ; enum TXdmElementType CXdmDocumentNode::ElementType(void) const
+ ?ElementType@CXdmNodeAttribute@@UBE?AW4TXdmElementType@@XZ @ 55 NONAME ; enum TXdmElementType CXdmNodeAttribute::ElementType(void) const
+ ?EscapeLeafNodeContentLC@CXdmDocumentNode@@QBEPAVHBufC8@@XZ @ 56 NONAME ; class HBufC8 * CXdmDocumentNode::EscapeLeafNodeContentLC(void) const
+ ?EscapedValueLC@CXdmNodeAttribute@@QBEPAVHBufC8@@XZ @ 57 NONAME ; class HBufC8 * CXdmNodeAttribute::EscapedValueLC(void) const
+ ?FetchDataL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@@Z @ 58 NONAME ; void CXdmDocument::FetchDataL(class CXdmDocumentNode *)
+ ?Find@CXdmDocument@@QBEHABVCXdmDocumentNode@@AAV?$RPointerArray@VCXdmDocumentNode@@@@@Z @ 59 NONAME ; int CXdmDocument::Find(class CXdmDocumentNode const &, class RPointerArray<class CXdmDocumentNode> &) const
+ ?Find@CXdmDocument@@QBEHABVTDesC16@@AAV?$RPointerArray@VCXdmDocumentNode@@@@@Z @ 60 NONAME ; int CXdmDocument::Find(class TDesC16 const &, class RPointerArray<class CXdmDocumentNode> &) const
+ ?Find@CXdmDocument@@QBEHABVTDesC16@@AAV?$RPointerArray@VCXdmDocumentNode@@@@ABV?$RPointerArray@USXdmAttribute16@@@@@Z @ 61 NONAME ; int CXdmDocument::Find(class TDesC16 const &, class RPointerArray<class CXdmDocumentNode> &, class RPointerArray<struct SXdmAttribute16> const &) const
+ ?Find@CXdmDocument@@QBEHABVTDesC16@@AAV?$RPointerArray@VCXdmNodeAttribute@@@@@Z @ 62 NONAME ; int CXdmDocument::Find(class TDesC16 const &, class RPointerArray<class CXdmNodeAttribute> &) const
+ ?Find@CXdmDocumentNode@@QBEHABV1@AAV?$RPointerArray@VCXdmDocumentNode@@@@@Z @ 63 NONAME ; int CXdmDocumentNode::Find(class CXdmDocumentNode const &, class RPointerArray<class CXdmDocumentNode> &) const
+ ?Find@CXdmDocumentNode@@QBEHABVTDesC16@@AAV?$RPointerArray@VCXdmDocumentNode@@@@@Z @ 64 NONAME ; int CXdmDocumentNode::Find(class TDesC16 const &, class RPointerArray<class CXdmDocumentNode> &) const
+ ?Find@CXdmDocumentNode@@QBEHABVTDesC16@@AAV?$RPointerArray@VCXdmDocumentNode@@@@ABV?$RPointerArray@USXdmAttribute16@@@@@Z @ 65 NONAME ; int CXdmDocumentNode::Find(class TDesC16 const &, class RPointerArray<class CXdmDocumentNode> &, class RPointerArray<struct SXdmAttribute16> const &) const
+ ?GenerateFileNameL@XdmStaticUtils@@SAPAVHBufC16@@AAVRFs@@ABVTDesC16@@1@Z @ 66 NONAME ; class HBufC16 * XdmStaticUtils::GenerateFileNameL(class RFs &, class TDesC16 const &, class TDesC16 const &)
+ ?HasAttribute@CXdmDocumentNode@@QBEHABVTDesC16@@@Z @ 67 NONAME ; int CXdmDocumentNode::HasAttribute(class TDesC16 const &) const
+ ?InsertChileNodeL@CXdmDocumentNode@@QAEXHPAV1@@Z @ 68 NONAME ; void CXdmDocumentNode::InsertChileNodeL(int, class CXdmDocumentNode *)
+ ?InsertL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@@Z @ 69 NONAME ; void CXdmDocument::InsertL(class CXdmDocumentNode *)
+ ?IsCacheEnabled@CXdmProtocolInfo@@QBEHXZ @ 70 NONAME ; int CXdmProtocolInfo::IsCacheEnabled(void) const
+ ?IsEmptyNode@CXdmDocumentNode@@QBEHXZ @ 71 NONAME ; int CXdmDocumentNode::IsEmptyNode(void) const
+ ?IsLeafNode@CXdmDocumentNode@@QBEHXZ @ 72 NONAME ; int CXdmDocumentNode::IsLeafNode(void) const
+ ?IsSecure@CXdmProtocolInfo@@QBEHXZ @ 73 NONAME ; int CXdmProtocolInfo::IsSecure(void) const
+ ?LeafNodeContent@CXdmDocumentNode@@QBE?AVTPtrC8@@XZ @ 74 NONAME ; class TPtrC8 CXdmDocumentNode::LeafNodeContent(void) const
+ ?Match@CXdmDocumentNode@@QBEHABV1@@Z @ 75 NONAME ; int CXdmDocumentNode::Match(class CXdmDocumentNode const &) const
+ ?Match@CXdmDocumentNode@@QBEHABVTDesC16@@ABV?$RPointerArray@USXdmAttribute8@@@@@Z @ 76 NONAME ; int CXdmDocumentNode::Match(class TDesC16 const &, class RPointerArray<struct SXdmAttribute8> const &) const
+ ?Name@CXdmDocument@@QBE?AVTPtrC16@@XZ @ 77 NONAME ; class TPtrC16 CXdmDocument::Name(void) const
+ ?NewL@CXdmEngine@@SAPAV1@ABVCXdmProtocolInfo@@@Z @ 78 NONAME ; class CXdmEngine * CXdmEngine::NewL(class CXdmProtocolInfo const &)
+ ?NewL@CXdmLogWriter@@SAPAV1@ABVTDesC16@@@Z @ 79 NONAME ; class CXdmLogWriter * CXdmLogWriter::NewL(class TDesC16 const &)
+ ?NewL@CXdmProtocolInfo@@SAPAV1@H@Z @ 80 NONAME ; class CXdmProtocolInfo * CXdmProtocolInfo::NewL(int)
+ ?NewL@CXdmProtocolInfo@@SAPAV1@HHABVTDesC16@@@Z @ 81 NONAME ; class CXdmProtocolInfo * CXdmProtocolInfo::NewL(int, int, class TDesC16 const &)
+ ?NextNode@CXdmDocumentNode@@QBEPAV1@XZ @ 82 NONAME ; class CXdmDocumentNode * CXdmDocumentNode::NextNode(void) const
+ ?NodeCount@CXdmDocumentNode@@QBEHXZ @ 83 NONAME ; int CXdmDocumentNode::NodeCount(void) const
+ ?NodeName@CXdmDocumentNode@@QBE?AVTPtrC16@@XZ @ 84 NONAME ; class TPtrC16 CXdmDocumentNode::NodeName(void) const
+ ?Parent@CXdmDocumentNode@@QBEPAV1@XZ @ 85 NONAME ; class CXdmDocumentNode * CXdmDocumentNode::Parent(void) const
+ ?Print@CXdmDocumentNode@@QAEXXZ @ 86 NONAME ; void CXdmDocumentNode::Print(void)
+ ?ProtocolUid@CXdmProtocolInfo@@QBE?AVTUid@@XZ @ 87 NONAME ; class TUid CXdmProtocolInfo::ProtocolUid(void) const
+ ?RemoveChileNodeL@CXdmDocumentNode@@QAEXPAV1@@Z @ 88 NONAME ; void CXdmDocumentNode::RemoveChileNodeL(class CXdmDocumentNode *)
+ ?RemoveFromModelL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@@Z @ 89 NONAME ; void CXdmDocument::RemoveFromModelL(class CXdmDocumentNode *)
+ ?ReplaceChileNodeL@CXdmDocumentNode@@QAEXPAV1@0@Z @ 90 NONAME ; void CXdmDocumentNode::ReplaceChileNodeL(class CXdmDocumentNode *, class CXdmDocumentNode *)
+ ?ReplaceInModelL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@0@Z @ 91 NONAME ; void CXdmDocument::ReplaceInModelL(class CXdmDocumentNode *, class CXdmDocumentNode *)
+ ?ReplaceL@CXdmDocument@@QAEXPAVCXdmDocumentNode@@0@Z @ 92 NONAME ; void CXdmDocument::ReplaceL(class CXdmDocumentNode *, class CXdmDocumentNode *)
+ ?ReplaceL@CXdmDocument@@QAEXXZ @ 93 NONAME ; void CXdmDocument::ReplaceL(void)
+ ?ResetSubset@CXdmDocument@@UAEXXZ @ 94 NONAME ; void CXdmDocument::ResetSubset(void)
+ ?Root@CXdmProtocolInfo@@QBE?AVTPtrC16@@XZ @ 95 NONAME ; class TPtrC16 CXdmProtocolInfo::Root(void) const
+ ?SetAttributeValueL@CXdmNodeAttribute@@QAEXABVTDesC16@@@Z @ 96 NONAME ; void CXdmNodeAttribute::SetAttributeValueL(class TDesC16 const &)
+ ?SetAttributeValueL@CXdmNodeAttribute@@QAEXABVTDesC8@@@Z @ 97 NONAME ; void CXdmNodeAttribute::SetAttributeValueL(class TDesC8 const &)
+ ?SetCacheUsage@CXdmProtocolInfo@@QAEXH@Z @ 98 NONAME ; void CXdmProtocolInfo::SetCacheUsage(int)
+ ?SetCredentials@CXdmProtocolInfo@@QAEXVTXdmCredentials@@@Z @ 99 NONAME ; void CXdmProtocolInfo::SetCredentials(class TXdmCredentials)
+ ?SetEmptyNode@CXdmDocumentNode@@QAEXH@Z @ 100 NONAME ; void CXdmDocumentNode::SetEmptyNode(int)
+ ?SetLeafNode@CXdmDocumentNode@@QAEXH@Z @ 101 NONAME ; void CXdmDocumentNode::SetLeafNode(int)
+ ?SetLeafNodeContentL@CXdmDocumentNode@@QAEXABVTDesC16@@@Z @ 102 NONAME ; void CXdmDocumentNode::SetLeafNodeContentL(class TDesC16 const &)
+ ?SetLeafNodeContentL@CXdmDocumentNode@@QAEXABVTDesC8@@@Z @ 103 NONAME ; void CXdmDocumentNode::SetLeafNodeContentL(class TDesC8 const &)
+ ?SetNameL@CXdmDocumentNode@@QAEXABVTDesC16@@@Z @ 104 NONAME ; void CXdmDocumentNode::SetNameL(class TDesC16 const &)
+ ?SetNameL@CXdmDocumentNode@@QAEXABVTDesC8@@@Z @ 105 NONAME ; void CXdmDocumentNode::SetNameL(class TDesC8 const &)
+ ?SetNextNode@CXdmDocumentNode@@QAEXPAV1@@Z @ 106 NONAME ; void CXdmDocumentNode::SetNextNode(class CXdmDocumentNode *)
+ ?SetSecurity@CXdmProtocolInfo@@QAEXH@Z @ 107 NONAME ; void CXdmProtocolInfo::SetSecurity(int)
+ ?SettingsID@CXdmProtocolInfo@@QBEHXZ @ 108 NONAME ; int CXdmProtocolInfo::SettingsID(void) const
+ ?UpdateL@CXdmEngine@@QAEXAAVTRequestStatus@@PAVCXdmDirectory@@W4TDirUpdatePhase@@@Z @ 109 NONAME ; void CXdmEngine::UpdateL(class TRequestStatus &, class CXdmDirectory *, enum TDirUpdatePhase)
+ ?UpdateL@CXdmEngine@@QAEXPAVCXdmDocument@@AAVTRequestStatus@@@Z @ 110 NONAME ; void CXdmEngine::UpdateL(class CXdmDocument *, class TRequestStatus &)
+ ?WriteToLog@CXdmLogWriter@@QBEXABVTDesC16@@@Z @ 111 NONAME ; void CXdmLogWriter::WriteToLog(class TDesC16 const &) const
+ ?WriteToLog@CXdmLogWriter@@QBEXABVTDesC8@@@Z @ 112 NONAME ; void CXdmLogWriter::WriteToLog(class TDesC8 const &) const
+ ?XdmSettingsLC@CXdmEngine@@SAPAVCDesC16Array@@AAV?$RArray@H@@@Z @ 113 NONAME ; class CDesC16Array * CXdmEngine::XdmSettingsLC(class RArray<int> &)
+
Binary file XDMEngine/Conf/xdmengine.confml has changed
Binary file XDMEngine/Conf/xdmengine_10207453.crml has changed
Binary file XDMEngine/Conf/xdmengine_10282384.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/bwinscw/XdmDeviceManagementAdapterU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/data/10275112.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM / SmlDmAdapter / OMA XDM Device Management Adapter
+*
+*/
+
+
+
+
+#include <registryinfo.rh>
+#include "../inc/xdmdmuid.h"
+
+RESOURCE REGISTRY_INFO theRegistryInfo
+ {
+ dll_uid = KXdmDmDllUid; // The DLL's 3rd UID.
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KSmlDMInterfaceUid; // KSmlDMInterfaceUid, DM interface
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = KXdmDmImplUid; // DM OMA XDM implementation UID
+ version_no = 1;
+ display_name = "";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/eabi/XdmDeviceManagementAdapterU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZTI13CXdmDMAdapter @ 2 NONAME ; #<TI>#
+ _ZTV13CXdmDMAdapter @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+xdmdevicemanagementadapter.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/group/xdmdevicemanagementadapter.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA XDM Device Management adapter
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+
+TARGET xdmdevicemanagementadapter.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10275112
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+
+SOURCEPATH ../src
+SOURCE xdmdmadaptergroupproxy.cpp
+SOURCE xdmdmadapter.cpp
+
+SOURCEPATH ../data
+START RESOURCE 10275112.rss
+TARGET xdmdevicemanagementadapter.rsc
+END
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+
+USERINCLUDE ../inc
+
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY charconv.lib
+LIBRARY nsmldmclientserverutils.lib
+
+DEBUGLIBRARY flogger.lib
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+ deffile ../bwinscw/
+#elif defined (WINS )
+ deffile ../BWINS/
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/inc/xdmdmadapter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,329 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DM OMA XDM Settings Adapter
+ *
+*/
+
+
+
+
+
+#ifndef __XDMDMADAPTER_H__
+#define __XDMDMADAPTER_H__
+
+#include <e32base.h>
+#include <smldmadapter.h>
+#include <XdmSettingsApi.h>
+
+
+// LITERALS
+_LIT8( KXdmDmNodeName, "OMA_XDM" );
+_LIT8( KXdmDmAppId, "APPID" );
+_LIT8( KXdmDmName, "NAME" );
+_LIT8( KXdmDmProviderId, "PROVIDER-ID" );
+_LIT8( KXdmDmToConRef, "ToConRef" );
+_LIT8( KXdmDmConRef, "ConRef" );
+_LIT8( KXdmDmSip, "SIP" );
+_LIT8( KXdmDmToNapId, "TO-NAPID" );
+_LIT8( KXdmDmAP, "AP" );
+_LIT8( KXdmDmUri, "URI" );
+_LIT8( KXdmDmAAuthName, "AAUTHNAME" );
+_LIT8( KXdmDmAAuthSecret, "AAUTHSECRET" );
+_LIT8( KXdmDmAAuthType, "AAUTHTYPE" );
+
+_LIT8( KXdmDmNodeNameDescription, "The interior object holds all OMA XDM objects" );
+_LIT8( KXdmDmAppIdDescription, "The identity of the application service" );
+_LIT8( KXdmDmNameDescription, "Application name which is to be displayed in the user's equipment" );
+_LIT8( KXdmDmProviderIdDescription, "Provides an identifier for the service provider" );
+_LIT8( KXdmDmUriDescription, "Defines the root of all XDM resources" );
+_LIT8( KXdmDmAAuthNameDescription, "Defines the user name for XDMC authentication using HTTP digest" );
+_LIT8( KXdmDmAAuthSecretDescription, "Defines the password for XDMC authentication using HTTP digest" );
+_LIT8( KXdmDmAAuthTypeDescription, "Defines the authentication type for XDMC authentication" );
+_LIT8( KXdmDmDynamicDescription, "Placeholder for one or more connectivity parameters" );
+_LIT8( KXdmDmToConRefDescription, "Refers to a collection of connectivity definitions" );
+_LIT8( KXdmDmConRefDescription, "Indicates the linkage to connectivity parameters" );
+_LIT8( KXdmDmSipDescription, "Reference to SIP DM Object" );
+_LIT8( KXdmDmToNapIdDescription, "Reference to the connection used for the XCAP traffic" );
+
+_LIT8( KXdmDDFVersion, "1.0" );
+_LIT8( KXdmDmTextPlain, "text/plain" );
+_LIT8( KXdmDmUriDotSlash, "./" );
+_LIT8( KXdmDmSeparator, "/" );
+_LIT8( KXdmDmSipLinkPrefix, "./SIP" );
+_LIT( KXdmDefaultId, "-1" );
+_LIT( KXdmDmStartBracket, "(" );
+_LIT( KXdmDmCloseBracket, ")" );
+
+_LIT( KXdmDmLogDir, "Xdm" );
+_LIT( KXdmDmLogFile, "XdmDm.txt" );
+
+// CONSTANTS
+const TInt KXdmDmLogBufferMaxSize = 2000;
+const TInt KXdmDefaultResultSize = 255;
+const TInt KXdmDmLevel = 2;
+const TInt KXdmDmIdTableSize = 16;
+const TInt KXdmDmHexLength = 8;
+const TInt KXdmDmMaxIntLength = 10; // max length of 32bit integer
+const TUint8 KXdmDmObjectSizeWidth = 4;
+const TUint8 KXdmDmSeparatorDef = 0x2f; // forward slash
+
+
+/**
+* The main class of the OMA XDM DM adapter. Handles
+* requests of fetching and updating settings sets and
+* settings items.
+*/
+class CXdmDMAdapter : public CSmlDmAdapter
+ {
+ public:
+ // Adapter interface from CSmlDmAdapter
+ static CXdmDMAdapter* NewL( MSmlDmCallback* aDmCallback );
+
+ ~CXdmDMAdapter();
+
+ void DDFVersionL( CBufBase& aDDFVersion );
+
+ void DDFStructureL( MSmlDmDDFObject& aDDF );
+
+ void UpdateLeafObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aObject,
+ const TDesC8& aType,
+ TInt aStatusRef );
+
+ void DeleteObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TInt aStatusRef );
+
+ void FetchLeafObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef );
+
+ void ChildURIListL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
+ const TInt aResultsRef,
+ const TInt aStatusRef );
+
+ void AddNodeObjectL( const TDesC8& aUri,
+ const TDesC8& aParentLUID,
+ const TInt aStatusRef );
+
+ void UpdateLeafObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ RWriteStream*& aStream,
+ const TDesC8& aType,
+ const TInt aStatusRef );
+
+ void FetchLeafObjectSizeL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef );
+
+ void ExecuteCommandL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aArgument,
+ const TDesC8& aType,
+ const TInt aStatusRef );
+
+ void ExecuteCommandL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ RWriteStream*& aStream,
+ const TDesC8& aType,
+ const TInt aStatusRef );
+
+ void CopyCommandL( const TDesC8& aTargetURI,
+ const TDesC8& aTargetLUID,
+ const TDesC8& aSourceURI,
+ const TDesC8& aSourceLUID,
+ const TDesC8& aType,
+ TInt aStatusRef );
+
+ void StartAtomicL();
+ void CommitAtomicL();
+ void RollbackAtomicL();
+ TBool StreamingSupport( TInt& aItemSize);
+ void StreamCommittedL();
+ void CompleteOutstandingCmdsL();
+
+ /**
+ * Log writing
+ * DEBUG only
+ */
+ #ifdef _DEBUG
+ static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+ #endif
+
+
+ private:
+
+ /**
+ * Default constructor
+ * @param aDmCallback Pointer to callback interface
+ */
+ CXdmDMAdapter( MSmlDmCallback* aDmCallback );
+
+
+ /**
+ * Fetches an object from the given uri
+ * @param aUri Uri to the fetched object
+ * @param aObject The result is inserted to this buffer
+ * @return Error code
+ */
+ CSmlDmAdapter::TError FetchObjectL( const TDesC8& aUri,
+ CBufBase& aObject,
+ TInt aSettingsId );
+
+ /**
+ * Updates the parameters of given DDF node
+ * @param aNode The node to update.
+ * @param aAccTypes Access types of the node.
+ * @param aOccurrence Occurrance of the node.
+ * @param aScope Scope of the node.
+ * @param aFormat Format of the node.
+ * @param aDescription A description of the node.
+ */
+ void FillNodeInfoL( MSmlDmDDFObject& aNode,
+ TSmlDmAccessTypes aAccTypes,
+ MSmlDmDDFObject::TOccurence aOccurrence,
+ MSmlDmDDFObject::TScope aScope,
+ MSmlDmDDFObject::TDFFormat aFormat,
+ const TDesC8& aDescription);
+
+ /**
+ * Get property from settings storage
+ * @param aSettingsId unique id of the settings set
+ * @param aProperty type of asked property
+ * @param aObject returns property value
+ * @return CSmlDmAdapter::EOk if successfull
+ */
+ CSmlDmAdapter::TError GetPropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aProperty,
+ CBufBase& aObject );
+
+ /**
+ * Create/update settings property
+ * @param aSettingsId unique id of the settings set
+ * @param aProperty type of property
+ * @param aObject property value
+ * @return CSmlDmAdapter::EOk if successfull
+ */
+ CSmlDmAdapter::TError UpdatePropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aProperty,
+ const TDesC8& aObject );
+ /**
+ * Find IAP id based on uri
+ * @param aUri uri of the wanted object
+ * @return id or KErrNotFound
+ */
+ TInt IapIdFromURIL( const TDesC8& aUri );
+
+ /**
+ * Find uri based on IAP id
+ * @param aId value stored to xdm settings
+ * @return uri or NULL
+ */
+ HBufC8* URIFromIapIdL( TInt aId );
+
+ /**
+ * Find SIP id based on uri
+ * @param aUri uri of the wanted object
+ * @return id or KErrNotFound
+ */
+ TInt GetSipIdL( const TDesC8& aUri );
+
+ /**
+ * Finds uri based on SIP id, updates result
+ * @param aSettingsId xdm settings id
+ * @param aObject object to be updated
+ * @return Ok or Error
+ */
+ CXdmDMAdapter::TError FetchSipConRefL( TInt aSettingsId,
+ CBufBase& aObject );
+
+ /**
+ * Find settings id
+ * @param aLUID luid of the wanted object
+ * @param aUri uri of the wanted object
+ * @return id or KErrNotFound
+ */
+ TInt FindSettingsIdL( const TDesC8& aLUID, const TDesC8& aUri );
+
+ /**
+ * Checks if the settings name is already in use,
+ * creates a unique name if needed
+ * @param aName name of the settings
+ * @return unique name
+ */
+ HBufC* CheckExistingNamesLC( const TDesC8& aName );
+
+
+ /**
+ * Compares strings
+ * @param aLeft first string
+ * @param aRight second string
+ * @return True if the strings are identical
+ */
+ TBool Match( const TDesC8& aLeft, const TDesC8& aRight );
+
+
+ /**
+ * Converts descriptor to int
+ * @param aSource descriptor to be converted
+ * @return TInt converted value
+ */
+ TInt DesToInt( const TDesC& aSource ) const;
+
+ /**
+ * Converts descriptor to int
+ * @param aSource descriptor to be converted
+ * @return TInt converted value
+ */
+ TInt DesToInt( const TDesC8& aSource ) const;
+
+ /**
+ * Converts int to descriptor
+ * @param aSource int to be converted
+ * @return HBufC8* converted value
+ */
+ HBufC8* IntToDes8LC( const TInt aSource );
+
+ /**
+ * Converts 16-bit descriptor to 8-bit
+ * @param aSource descriptor to be converted
+ * @return HBufC8* converted value
+ */
+ HBufC8* ConvertLC( const TDesC& aSource );
+
+ /**
+ * Converts 8-bit descriptor to 16-bit
+ * @param aSource descriptor to be converted
+ * @return HBufC* converted value
+ */
+ HBufC* ConvertLC( const TDesC8& aSource );
+
+
+
+ private: // Data
+
+
+
+ };
+
+#endif // __XDMDMADAPTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/inc/xdmdmuid.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Uids for XDM DM
+*
+*/
+
+
+
+
+#ifndef __XDMDMUID__
+#define __XDMDMUID__
+
+// Device Management ECOM plugin interface
+#define KSmlDMInterfaceUid 0x102018B4
+
+// XDM Device management DLL uid
+#define KXdmDmDllUid 0x10275112
+
+// XDM DM implementation UID
+#define KXdmDmImplUid 0x10275113
+
+
+
+#endif // __XDMDMUID__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/src/xdmdmadapter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1244 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DM OMA XDM Settings Adapter
+ *
+*/
+
+
+
+
+#include <implementationproxy.h>
+#include <utf.h>
+#include <nsmldmuri.h>
+#include <XdmSettingsApi.h>
+#include <XdmSettingsCollection.h>
+#include <XdmSettingsProperty.h>
+#include "xdmdmadapter.h"
+
+#ifdef _DEBUG
+ #include <flogger.h>
+#endif
+
+
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::NewL( )
+// -----------------------------------------------------------------------------
+//
+CXdmDMAdapter* CXdmDMAdapter::NewL( MSmlDmCallback* aDmCallback )
+ {
+ CXdmDMAdapter* self = new (ELeave) CXdmDMAdapter( aDmCallback );
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::NewL(): end") );
+#endif
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::CXdmDMAdapter()
+// -----------------------------------------------------------------------------
+//
+CXdmDMAdapter::CXdmDMAdapter( MSmlDmCallback* aDmCallback ) :
+CSmlDmAdapter( aDmCallback )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::CXdmDMAdapter()") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::~CXdmDMAdapter()
+// -----------------------------------------------------------------------------
+//
+CXdmDMAdapter::~CXdmDMAdapter()
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::~CXdmDMAdapter()") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::DDFVersionL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::DDFVersionL( CBufBase& aDDFVersion )
+ {
+ aDDFVersion.InsertL( 0, KXdmDDFVersion );
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DDFVersionL(TDes& aDDFVersion)") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::DDFStructureL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DDFStructureL(): begin") );
+#endif
+
+ // For OMA_XDM
+ TSmlDmAccessTypes accTypeGet;
+ accTypeGet.SetGet();
+
+ // For OMA_XDM/<X>
+ TSmlDmAccessTypes accTypeAll;
+ accTypeAll.SetAdd();
+ accTypeAll.SetGet();
+ accTypeAll.SetReplace();
+ accTypeAll.SetDelete();
+
+ // For leaf nodes
+ TSmlDmAccessTypes accTypeNoDelete;
+ accTypeNoDelete.SetAdd();
+ accTypeNoDelete.SetGet();
+ accTypeNoDelete.SetReplace();
+
+ // ./OMA_XDM
+ MSmlDmDDFObject& omaXdmNode = aDDF.AddChildObjectL( KXdmDmNodeName );
+ FillNodeInfoL( omaXdmNode, accTypeGet, MSmlDmDDFObject::EOne,
+ MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode,
+ KXdmDmNodeNameDescription );
+
+ // ./OMA_XDM/<X>
+ MSmlDmDDFObject& rtNode = omaXdmNode.AddChildObjectGroupL();
+ FillNodeInfoL( rtNode, accTypeAll, MSmlDmDDFObject::EOneOrMore,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KXdmDmDynamicDescription );
+
+ // ./OMA_XDM/<X>/APPID
+ MSmlDmDDFObject& appIdNode = rtNode.AddChildObjectL( KXdmDmAppId );
+ FillNodeInfoL( appIdNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmAppIdDescription );
+
+ // ./OMA_XDM/<X>/NAME
+ MSmlDmDDFObject& nameNode = rtNode.AddChildObjectL( KXdmDmName );
+ FillNodeInfoL( nameNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmNameDescription );
+
+ // ./OMA_XDM/<X>/PROVIDER-ID
+ MSmlDmDDFObject& provIdNode = rtNode.AddChildObjectL( KXdmDmProviderId );
+ FillNodeInfoL( provIdNode, accTypeNoDelete,MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmProviderIdDescription );
+
+ // ./OMA_XDM/<X>/ToConRef
+ MSmlDmDDFObject& toConRefNode = rtNode.AddChildObjectL( KXdmDmToConRef );
+ FillNodeInfoL( toConRefNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KXdmDmToConRefDescription);
+
+ // ./OMA_XDM/<X>/ToConRef/<X> (TO-NAPID)
+ MSmlDmDDFObject& napIdNode = toConRefNode.AddChildObjectL( KXdmDmToNapId );
+ FillNodeInfoL( napIdNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KXdmDmToNapIdDescription );
+
+ // ./OMA_XDM/<X>/ToConRef/TO-NAPID/ConRef
+ MSmlDmDDFObject& napIdRefNode = napIdNode.AddChildObjectL( KXdmDmConRef );
+ FillNodeInfoL( napIdRefNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmConRefDescription );
+
+ // ./OMA_XDM/<X>/ToConRef/<X> (SIP)
+ MSmlDmDDFObject& sipNode = toConRefNode.AddChildObjectL( KXdmDmSip );
+ FillNodeInfoL( sipNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KXdmDmSipDescription );
+
+ // ./OMA_XDM/<X>/ToConRef/SIP/ConRef
+ MSmlDmDDFObject& sipRefNode = sipNode.AddChildObjectL( KXdmDmConRef );
+ FillNodeInfoL( sipRefNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmConRefDescription );
+
+ // ./OMA_XDM/<X>/URI
+ MSmlDmDDFObject& uriNode = rtNode.AddChildObjectL( KXdmDmUri );
+ FillNodeInfoL( uriNode, accTypeNoDelete, MSmlDmDDFObject::EOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmUriDescription );
+
+ // ./OMA_XDM/<X>/AAUTHNAME
+ MSmlDmDDFObject& userIdNode = rtNode.AddChildObjectL( KXdmDmAAuthName );
+ FillNodeInfoL( userIdNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KXdmDmAAuthNameDescription );
+
+ // ./OMA_XDM/<X>/AAUTHSECRET
+ MSmlDmDDFObject& pwdNode = rtNode.AddChildObjectL( KXdmDmAAuthSecret );
+ FillNodeInfoL( pwdNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
+ KXdmDmAAuthSecretDescription );
+
+ // ./OMA_XDM/<X>/AAUTHTYPE
+ MSmlDmDDFObject& authTypeNode = rtNode.AddChildObjectL( KXdmDmAAuthType );
+ FillNodeInfoL( authTypeNode, accTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
+ KXdmDmAAuthTypeDescription );
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DDFStructureL(): end") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::ChildURIListL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::ChildURIListL( const TDesC8& aUri,
+ const TDesC8& /*aLUID*/,
+ const CArrayFix<TSmlDmMappingInfo>&
+ /*aPreviousURISegmentList*/,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): begin") );
+#endif
+
+ CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+ CBufBase* currentList = CBufFlat::NewL( 1 );
+ CleanupStack::PushL( currentList ); // << currentList
+
+ const TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+ TBuf8<KSmlMaxURISegLen> segmentName;
+
+ // ./OMA_XDM
+ if( Match( lastUriSeg, KXdmDmNodeName ) )
+ {
+ RArray<TInt> settingIds;
+ CleanupClosePushL( settingIds ); // << settingIds
+ CDesCArray* names = TXdmSettingsApi::CollectionNamesLC( settingIds ); // << names
+ TInt idCount = settingIds.Count();
+ for( TInt i(0); i < idCount; i++ )
+ {
+ segmentName.Copy( KNullDesC8 );
+ segmentName.AppendNum( settingIds[i] );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+ }
+ Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
+ Callback().SetStatusL( aStatusRef, retValue );
+ CleanupStack::PopAndDestroy( 3, currentList ); // >>> settingIds, names, currentList
+ return;
+ }
+
+ // ./OMA_XDM/X
+ if( NSmlDmURI::NumOfURISegs( aUri ) == KXdmDmLevel )
+ {
+ segmentName.Copy( KXdmDmAppId );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmName );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmProviderId );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmToConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmUri );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmAAuthName );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmAAuthSecret );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmAAuthType );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+ }
+
+ // ./OMA_XDM/X/ToConRef
+ else if ( Match( lastUriSeg, KXdmDmToConRef ) )
+ {
+ segmentName.Copy( KXdmDmSip );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+
+ segmentName.Copy( KXdmDmToNapId );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+ }
+
+ // ./OMA_XDM/X/ToConRef/SIP
+ else if( Match( lastUriSeg, KXdmDmSip ) )
+ {
+ segmentName.Copy( KXdmDmConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+ }
+
+ // ./OMA_XDM/X/ToConRef/TO-NAPID
+ else if( Match ( lastUriSeg, KXdmDmToNapId ) )
+ {
+ segmentName.Copy( KXdmDmConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KXdmDmSeparator );
+ }
+ else
+ {
+ // if none of asked nodes found return error.
+ retValue = CSmlDmAdapter::ENotFound;
+ }
+
+ Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
+ Callback().SetStatusL( aStatusRef, retValue );
+ CleanupStack::PopAndDestroy( currentList ); // >>> currentList
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::ChildURIListL(): end") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::FetchLeafObjectL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::FetchLeafObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchLeafObjectL(): begin") );
+#endif
+
+ TInt settingsId = FindSettingsIdL( aLUID, aUri );
+
+ CBufBase* result = CBufFlat::NewL( KXdmDefaultResultSize );
+ CleanupStack::PushL( result ); // << result
+ CSmlDmAdapter::TError status = FetchObjectL( aUri, *result, settingsId );
+ if( status == CSmlDmAdapter::EOk )
+ {
+ Callback().SetResultsL( aResultsRef, *result, aType );
+ }
+ Callback().SetStatusL( aStatusRef, status );
+ CleanupStack::PopAndDestroy( result ); // >>> result
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchLeafObjectL(): end") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSmlDmAdapter::TError FetchObjectL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CXdmDMAdapter::FetchObjectL( const TDesC8& aUri,
+ CBufBase& aObject,
+ TInt aSettingsId )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchObjectL(): begin") );
+#endif
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+
+ TXdmSettingsProperty property ( EXdmPropNotFound );
+ TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+ // APPID
+ if( Match( lastUriSeg, KXdmDmAppId ) )
+ {
+ property = EXdmPropAppId;
+ }
+ // NAME
+ else if( Match( lastUriSeg, KXdmDmName ) )
+ {
+ property = EXdmPropName;
+ }
+ // PROVIDER-ID
+ else if( Match( lastUriSeg, KXdmDmProviderId ) )
+ {
+ property = EXdmPropProvId;
+ }
+ // URI
+ else if( Match( lastUriSeg, KXdmDmUri) )
+ {
+ property = EXdmPropUri;
+ }
+ // AAUTHNAME
+ else if( Match( lastUriSeg, KXdmDmAAuthName) )
+ {
+ property = EXdmPropAuthName;
+ }
+ // AAUTHSECRET
+ else if( Match( lastUriSeg, KXdmDmAAuthSecret) )
+ {
+ property = EXdmPropAuthSecret;
+ }
+ // AAUTHTYPE
+ else if( Match( lastUriSeg, KXdmDmAAuthType ) )
+ {
+ property = EXdmPropAuthType;
+ }
+ // ToConRef/SIP/ConRef
+ // ToConRef/TO-NAPID/ConRef
+ else if( Match( lastUriSeg, KXdmDmConRef) )
+ {
+ TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg( aUri );
+ TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg( conRefUri );
+
+ if( Match( lastConRefSeg, KXdmDmSip ) )
+ {
+ return FetchSipConRefL( aSettingsId, aObject );
+ }
+ else if( Match( lastConRefSeg, KXdmDmToNapId ) )
+ {
+ HBufC* value = NULL;
+ TInt error( KErrNone );
+ TRAP( error, ( value = TXdmSettingsApi::PropertyL( aSettingsId, EXdmPropToNapId ) ) );
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL( value ); // << value
+ TInt iapId = DesToInt( *value );
+ CleanupStack::PopAndDestroy( value ); // >>> value
+ HBufC8* uri = URIFromIapIdL( iapId );
+ if( uri )
+ {
+ CleanupStack::PushL( uri ); // << uri
+ aObject.InsertL( 0, uri->Des() );
+ status = CSmlDmAdapter::EOk;
+ CleanupStack::PopAndDestroy( uri ); // uri
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ return status;
+ }
+ }
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ // known property
+ if ( status == CSmlDmAdapter::EOk )
+ {
+ status = GetPropertyL( aSettingsId, property, aObject );
+ }
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchObjectL(): end") );
+#endif
+ return status;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::FetchLeafObjectSizeL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::FetchLeafObjectSizeL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchLeafObjectSizeL(): begin") );
+#endif
+
+ TInt settingsId = FindSettingsIdL( aLUID, aUri );
+
+ CBufBase* result = CBufFlat::NewL( KXdmDefaultResultSize );
+ CleanupStack::PushL( result );
+ CSmlDmAdapter::TError status = FetchObjectL( aUri, *result, settingsId );
+
+ if( status == CSmlDmAdapter::EOk )
+ {
+ TInt objSizeInBytes = result->Size();
+
+ TBuf8<KXdmDmObjectSizeWidth> stringObjSizeInBytes;
+ stringObjSizeInBytes.Num( objSizeInBytes );
+
+ result->Reset();
+ result->InsertL( 0, stringObjSizeInBytes );
+
+ Callback().SetResultsL( aResultsRef, *result, aType );
+ }
+
+ Callback().SetStatusL( aStatusRef, status );
+ CleanupStack::PopAndDestroy( result ); // >>> result
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::FetchLeafObjectSizeL(): end") );
+ #endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::UpdateLeafObjectL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::UpdateLeafObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TDesC8& aObject,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): begin") );
+#endif
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+
+ TInt settingsId = FindSettingsIdL( aLUID, aUri );
+
+ TXdmSettingsProperty property;
+ TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+ // APPID
+ if( Match( lastUriSeg, KXdmDmAppId ) )
+ {
+ property = EXdmPropAppId;
+ }
+ // NAME
+ else if( Match( lastUriSeg, KXdmDmName ) )
+ {
+ // first check if the new value is same as earlier
+ HBufC* current = NULL;
+ TInt error( KErrNone );
+ TRAP( error, ( current = TXdmSettingsApi::PropertyL( settingsId, EXdmPropName ) ) );
+ if ( error == KErrNone )
+ {
+ TBool same ( EFalse );
+ CleanupStack::PushL( current ); // << current
+ HBufC8* current8 = ConvertLC( *current ); // << current8
+ if ( Match( current8->Des(), aObject ) )
+ {
+ same = ETrue;
+ }
+ CleanupStack::PopAndDestroy( 2, current8 ); // >>> current, current8
+ if ( same )
+ {
+ Callback().SetStatusL( aStatusRef, status );
+ return;
+ }
+ }
+ // if the name is already in use, new name with index is created
+ HBufC* value = CheckExistingNamesLC( aObject ); // << value
+ TRAP( error, TXdmSettingsApi::UpdatePropertyL( settingsId, *value, EXdmPropName ) );
+ CleanupStack::PopAndDestroy( value ); // >>> value
+ if ( error != KErrNone )
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ Callback().SetStatusL( aStatusRef, status );
+ return;
+ }
+ // PROVIDER-ID
+ else if( Match( lastUriSeg, KXdmDmProviderId ) )
+ {
+ property = EXdmPropProvId;
+ }
+ // URI
+ else if( Match( lastUriSeg, KXdmDmUri) )
+ {
+ property = EXdmPropUri;
+ }
+ // AAUTHNAME
+ else if( Match( lastUriSeg, KXdmDmAAuthName) )
+ {
+ property = EXdmPropAuthName;
+ }
+ // AAUTHSECRET
+ else if( Match( lastUriSeg, KXdmDmAAuthSecret) )
+ {
+ property = EXdmPropAuthSecret;
+ }
+ // AAUTHTYPE
+ else if( Match( lastUriSeg, KXdmDmAAuthType ) )
+ {
+ property = EXdmPropAuthType;
+ }
+ // ToConRef/TO-NAPID/ConRef
+ // ToConRef/SIP/ConRef
+ else if( Match( lastUriSeg, KXdmDmConRef ) )
+ {
+ TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg( aUri );
+ TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg( conRefUri );
+ if( Match( lastConRefSeg, KXdmDmToNapId ) )
+ {
+ TInt iapId = IapIdFromURIL( aObject );
+ HBufC8* idBuf = IntToDes8LC( iapId ); // << idBuf
+ status = UpdatePropertyL( settingsId, EXdmPropToNapId, *idBuf );
+ CleanupStack::PopAndDestroy( idBuf ); // >>> idBuf
+ Callback().SetStatusL( aStatusRef, status );
+ #ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): TO_NAPID/ConRef end") );
+ #endif
+ return;
+ }
+ else if( Match( lastConRefSeg, KXdmDmSip ) )
+ {
+ TInt sipId = GetSipIdL( aObject );
+ HBufC8* idBuf = IntToDes8LC( sipId ); // << idBuf
+ status = UpdatePropertyL( settingsId, EXdmPropToAppRef, *idBuf );
+ CleanupStack::PopAndDestroy( idBuf ); // >>> idBuf
+ Callback().SetStatusL( aStatusRef, status );
+ #ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): SIP/ConRef end") );
+ #endif
+ return;
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ // known property
+ if ( status == CSmlDmAdapter::EOk )
+ {
+ status = UpdatePropertyL( settingsId, property, aObject );
+ }
+
+ Callback().SetStatusL( aStatusRef, status );
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::UpdateLeafObjectL(): end") );
+ #endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::AddNodeObjectL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::AddNodeObjectL( const TDesC8& aUri,
+ const TDesC8& /*aParentLUID*/,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): begin") );
+#endif
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+ if ( Match( NSmlDmURI::RemoveLastSeg( aUri ), KXdmDmNodeName ) )
+ {
+ // create new set
+ CXdmSettingsCollection* collection = new ( ELeave ) CXdmSettingsCollection;
+ CleanupStack::PushL( collection ); // << collection
+ collection->AppendL( KXdmDefaultId, EXdmPropSettingsId );
+ TInt id = TXdmSettingsApi::CreateCollectionL( *collection );
+ HBufC8* luid = IntToDes8LC( id ); // << luid
+ Callback().SetMappingL( aUri, *luid );
+ CleanupStack::PopAndDestroy( 2, luid ); // >>> collection, luid
+ status = CSmlDmAdapter::EOk;
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): Settings created id=%d"), id );
+#endif
+ }
+ Callback().SetStatusL( aStatusRef, status );
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::AddNodeObjectL(): end") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::DeleteObjectL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::DeleteObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TInt aStatusRef )
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DeleteObjectL( ): begin") );
+#endif
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+ if ( Match( NSmlDmURI::RemoveLastSeg( aUri ), KXdmDmNodeName ) )
+ {
+ TInt id = FindSettingsIdL( aLUID, aUri );
+ TInt error (KErrNone );
+ TRAP( error, TXdmSettingsApi::RemoveCollectionL( id ) );
+ if ( error == KErrNone )
+ {
+ status = CSmlDmAdapter::EOk;
+ }
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DeleteObjectL(): Settings deleted id=%d"), id );
+#endif
+ }
+ Callback().SetStatusL( aStatusRef, status );
+
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::DeleteObjectL( ): end") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::UpdateLeafObjectL
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::UpdateLeafObjectL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ RWriteStream*& /*aStream*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ // Update from stream not used
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::ExecuteCommandL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::ExecuteCommandL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ const TDesC8& /*aArgument*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ // Not supported
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::ExecuteCommandL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::ExecuteCommandL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ RWriteStream*& /*aStream*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ // Not supported
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::CopyCommandL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/,
+ const TDesC8& /*aTargetLUID*/,
+ const TDesC8& /*aSourceURI*/,
+ const TDesC8& /*aSourceLUID*/,
+ const TDesC8& /*aType*/,
+ TInt aStatusRef )
+ {
+ // Not supported
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::StartAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::StartAtomicL()
+ {
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::CommitAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::CommitAtomicL()
+ {
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::RollbackAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::RollbackAtomicL()
+ {
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::StreamingSupport()
+// -----------------------------------------------------------------------------
+//
+TBool CXdmDMAdapter::StreamingSupport( TInt& /*aItemSize*/ )
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::StreamCommittedL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::StreamCommittedL()
+ {
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::CompleteOutstandingCmdsL()
+// -----------------------------------------------------------------------------
+//
+void CXdmDMAdapter::CompleteOutstandingCmdsL()
+ {
+#ifdef _DEBUG
+ WriteToLog(_L8("CXdmDMAdapter::CompleteOutstandingCmdsL()") );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::GetPropertyL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CXdmDMAdapter::GetPropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aProperty,
+ CBufBase& aObject )
+ {
+ HBufC* value = NULL;
+ TInt error( KErrNone );
+ TRAP( error, ( value = TXdmSettingsApi::PropertyL( aSettingsId, aProperty ) ) );
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL( value ); // << value
+ HBufC8* utfValue = ConvertLC( *value ); // << utfValue
+ aObject.InsertL( 0, *utfValue );
+ CleanupStack::PopAndDestroy( 2, utfValue ); // >>> value, utfValue
+ return CSmlDmAdapter::EOk;
+ }
+ return CSmlDmAdapter::ENotFound;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::UpdatePropertyL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CXdmDMAdapter::UpdatePropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aProperty,
+ const TDesC8& aObject )
+ {
+ HBufC* value = ConvertLC( aObject ); // << value
+ TInt error( KErrNone );
+ TRAP( error, TXdmSettingsApi::UpdatePropertyL( aSettingsId, *value, aProperty ) );
+ CleanupStack::PopAndDestroy( value ); // >>> value
+
+ if ( error == KErrNone )
+ {
+ return CSmlDmAdapter::EOk;
+ }
+ return CSmlDmAdapter::ENotFound;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::FillNodeInfoL
+// ------------------------------------------------------------------------------
+//
+void CXdmDMAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,
+ TSmlDmAccessTypes aAccTypes,
+ MSmlDmDDFObject::TOccurence aOccurrence,
+ MSmlDmDDFObject::TScope aScope,
+ MSmlDmDDFObject::TDFFormat aFormat,
+ const TDesC8& aDescription)
+ {
+ aNode.SetAccessTypesL( aAccTypes );
+ aNode.SetOccurenceL( aOccurrence );
+ aNode.SetScopeL( aScope );
+ aNode.SetDFFormatL( aFormat );
+
+ if( aFormat != MSmlDmDDFObject::ENode )
+ {
+ aNode.AddDFTypeMimeTypeL( KXdmDmTextPlain );
+ }
+ aNode.SetDescriptionL( aDescription );
+ }
+
+
+// ----------------------------------------------------------------------------
+// CXdmDMAdapter::IapIdFromURIL
+// ----------------------------------------------------------------------------
+//
+TInt CXdmDMAdapter::IapIdFromURIL( const TDesC8& aUri )
+ {
+ TInt id( KErrNotFound );
+ MSmlDmAdapter::TError status( MSmlDmAdapter::EError );
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL( result ); // << result
+
+ TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
+ // Request the identifier
+ Callback().FetchLinkL( uri, *result, status );
+
+ if( status == MSmlDmAdapter::EOk )
+ {
+ HBufC8* luid = Callback().GetLuidAllocL( uri );
+ if ( luid && luid->Length() )
+ {
+ id = DesToInt( *luid );
+ }
+ delete luid;
+ luid = NULL;
+ }
+
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ return id;
+ }
+
+// ----------------------------------------------------------------------------
+// CXdmDMAdapter::URIFromIapIdL
+// ----------------------------------------------------------------------------
+//
+HBufC8* CXdmDMAdapter::URIFromIapIdL( TInt aId )
+ {
+ CBufBase *allIds = CBufFlat::NewL(KXdmDmIdTableSize);
+ CleanupStack::PushL( allIds ); // << allIds
+ MSmlDmAdapter::TError status;
+ // Fetch all IAP ids
+ Callback().FetchLinkL( KXdmDmAP, *allIds, status );
+
+ if ( status == MSmlDmAdapter::EOk )
+ {
+ TInt index(0);
+ TInt segStart(0);
+ while ( index != KErrNotFound )
+ {
+ // Get pointer from segStart
+ TPtrC8 allIdsPtr = allIds->Ptr(segStart).Mid(0);
+ // Find the end of the segment
+ index = allIdsPtr.Locate('/');
+ HBufC8* uriSeg = NULL;
+ // This is the last one
+ if ( index == KErrNotFound )
+ {
+ TPtrC8 uriSeg8Ptr = allIds->Ptr(segStart);
+ uriSeg = uriSeg8Ptr.AllocLC(); // << uriSeg
+ }
+ else
+ {
+ TPtrC8 uriSeg8Ptr = allIds->Ptr(segStart).Mid( 0, index );
+ uriSeg = uriSeg8Ptr.AllocLC(); // << uriSeg8Ptr
+ }
+ // Construct the uri
+ HBufC8* uri = HBufC8::NewLC( KXdmDmAP().Length()
+ + KXdmDmSeparator().Length()
+ + uriSeg->Length() ); // << uri
+ TPtr8 uriPtr = uri->Des();
+ uriPtr.Format( KXdmDmAP );
+ uriPtr.Append( KXdmDmSeparator );
+ uriPtr.Append( *uriSeg );
+ // Get the luid from the uri
+ HBufC8* luid = Callback().GetLuidAllocL( uriPtr );
+ if ( luid && luid->Length() > 0 )
+ {
+ // No need to push luid to the CleanupStack
+ TInt id = DesToInt( luid->Des() );
+ delete luid;
+ luid = NULL;
+ if ( id == aId )
+ {
+ // The correct one found
+ CleanupStack::Pop(); // >>> uri
+ CleanupStack::PopAndDestroy( 2, allIds ); // >>> uriSeg, allIds
+ return uri;
+ }
+ }
+ // This was wrong, delete and get the next one
+ CleanupStack::PopAndDestroy( 2, uriSeg ); // >>> uri, uriSeg
+ segStart += index + 1;
+ }
+ }
+ CleanupStack::PopAndDestroy( allIds ); // >>> allIds
+ return NULL;
+ }
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::GetSipIdL
+// -----------------------------------------------------------------------------
+//
+TInt CXdmDMAdapter::GetSipIdL( const TDesC8& aUri )
+ {
+
+ CSmlDmAdapter::TError status = EOk;
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL( result ); // << result
+
+ TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
+ // Request the sip settings identifier
+ Callback().FetchLinkL( uri, *result, status);
+
+ if( status == EOk )
+ {
+ TUint32 id( 0 );
+ TPtrC8 hexIndex = uri.Right( KXdmDmHexLength );
+ TLex8 lexer( hexIndex );
+ lexer.Val( id, EHex );
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ return id;
+ }
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ return KErrNotFound;
+ }
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::FetchSipConRefL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CXdmDMAdapter::FetchSipConRefL( TInt aSettingsId,
+ CBufBase& aObject)
+ {
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+ TInt sipSettingsId( KErrNotFound );
+
+ HBufC* value = NULL;
+ TInt error( KErrNone );
+ TRAP( error, ( value = TXdmSettingsApi::PropertyL( aSettingsId, EXdmPropToAppRef ) ) );
+ if ( error == KErrNone )
+ {
+ sipSettingsId = DesToInt( *value );
+ delete value;
+ value = NULL;
+ }
+
+ if( sipSettingsId != KErrNotFound )
+ {
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL(result); // << result
+
+ // Request all the sip settings identifiers
+ Callback().FetchLinkL( KXdmDmSip, *result, status);
+
+ if( status == EOk )
+ {
+ TPtr8 uriSeg8Ptr = result->Ptr(0);
+
+ HBufC8* uriSegBuffer = uriSeg8Ptr.AllocL();
+ CleanupStack::PushL( uriSegBuffer ); // << uriSegBuffer
+
+ TPtr8 uriSegBufferPtr = uriSegBuffer->Des();
+
+ TInt numOfUriSegs = NSmlDmURI::NumOfURISegs(uriSeg8Ptr);
+
+ // Check if the SIP settings id match with one of the found
+ // SIP settings identifiers
+ while( numOfUriSegs > 1)
+ {
+ uriSegBufferPtr = NSmlDmURI::RemoveLastSeg(uriSegBufferPtr);
+
+ TPtrC8 hexIndex = uriSegBufferPtr.Right(KXdmDmHexLength);
+
+ TUint32 id(0);
+ TLex8 lexer(hexIndex);
+ if( lexer.Val(id, EHex) == KErrNone )
+ {
+ if( id == sipSettingsId )
+ {
+ TPtrC8 lastUriSegSip = NSmlDmURI::LastURISeg(uriSegBufferPtr);
+
+ // Total length of the sip settings link where one is for
+ // the separator
+ TInt sipLinkLength = KXdmDmSip().Length() +
+ KXdmDmSeparator().Length() +
+ lastUriSegSip.Length();
+ HBufC8* sipLink = HBufC8::NewLC( sipLinkLength ); // <<< sipLink
+
+ TPtr8 sipLinkPtr = sipLink->Des();
+ sipLinkPtr.Append( KXdmDmSip );
+ sipLinkPtr.Append( KXdmDmSeparator );
+ sipLinkPtr.Append( lastUriSegSip );
+
+ aObject.InsertL( 0, sipLinkPtr );
+
+ CleanupStack::PopAndDestroy( sipLink ); // >>> sipLink
+ break;
+ }
+ }
+
+ numOfUriSegs -= 1;
+ }
+
+ CleanupStack::PopAndDestroy( uriSegBuffer ); // >>> uriSegBuffer
+ }
+
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+
+ return status;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::FindSettingsIdL
+// -----------------------------------------------------------------------------
+//
+TInt CXdmDMAdapter::FindSettingsIdL( const TDesC8& aLUID, const TDesC8& aUri )
+ {
+ TInt settingsId(0);
+ if ( aLUID.Length() > 0 )
+ {
+ settingsId = DesToInt( aLUID );
+ return settingsId;
+ }
+ else
+ {
+ TPtrC8 name = NSmlDmURI:: URISeg( aUri, KXdmDmLevel );
+ settingsId = DesToInt( name );
+ HBufC8* luid = IntToDes8LC( settingsId ); // << luid
+ Callback().SetMappingL( aUri, *luid );
+ CleanupStack::PopAndDestroy( luid ); // luid
+ return settingsId;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::CheckExistingNamesLC()
+// -----------------------------------------------------------------------------
+//
+HBufC* CXdmDMAdapter::CheckExistingNamesLC( const TDesC8& aName )
+ {
+ TBool ready( EFalse );
+ RArray<TInt> settingIds;
+ CleanupClosePushL( settingIds ); // << settingIds
+ CDesCArray* settingNames = TXdmSettingsApi::CollectionNamesLC( settingIds ); // << settingNames
+ TInt index( 0 );
+ TBuf<512> tempName;
+ while ( !ready )
+ {
+ TBool found ( EFalse );
+ TInt count = settingNames->MdcaCount();
+ tempName.Copy( aName );
+ if ( index > 0 )
+ {
+ tempName.Append( KXdmDmStartBracket );
+ tempName.AppendNumFixedWidth( index, EDecimal, 2 );
+ tempName.Append( KXdmDmCloseBracket );
+ }
+ for ( TInt i(0); i < count && !found; i++ )
+ {
+ if ( !settingNames->MdcaPoint(i).CompareF( tempName ) )
+ {
+ found = ETrue;
+ index++;
+ }
+ }
+ if ( !found )
+ {
+ ready = ETrue;
+ }
+ }
+ CleanupStack::PopAndDestroy( 2 ); // >>> settingNames, settingIds
+ HBufC* newName = tempName.AllocLC(); // << newName
+ return newName;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::Match
+// -----------------------------------------------------------------------------
+//
+TBool CXdmDMAdapter::Match( const TDesC8& aLeft, const TDesC8& aRight )
+ {
+ if ( !aLeft.Compare( aRight ) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::ConvertLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CXdmDMAdapter::ConvertLC( const TDesC& aSource )
+ {
+ HBufC8* destination = HBufC8::NewLC( aSource.Length() ); // << destination
+ TPtr8 bufferPtr = destination->Des();
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( bufferPtr, aSource );
+ return destination;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmDMAdapter::ConvertLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CXdmDMAdapter::ConvertLC( const TDesC8& aSource )
+ {
+ HBufC* destination = HBufC::NewLC( aSource.Length() ); // << destination
+ TPtr bufferPtr = destination->Des();
+ CnvUtfConverter::ConvertToUnicodeFromUtf8( bufferPtr, aSource );
+ return destination;
+ }
+// ----------------------------------------------------------------------------
+// CXdmDMAdapter::DesToInt
+// ----------------------------------------------------------------------------
+TInt CXdmDMAdapter::DesToInt( const TDesC& aSource ) const
+ {
+ TLex16 lex( aSource );
+ TInt value ( KErrNotFound );
+ lex.Val( value );
+ return value;
+ }
+
+// ----------------------------------------------------------------------------
+// CXdmDMAdapter::DesToInt
+// ----------------------------------------------------------------------------
+TInt CXdmDMAdapter::DesToInt( const TDesC8& aSource ) const
+ {
+ TLex8 lex( aSource );
+ TInt value ( KErrNotFound );
+ lex.Val( value );
+ return value;
+ }
+
+// ----------------------------------------------------------------------------
+// CXdmDMAdapter::IntToDes8LC
+// ----------------------------------------------------------------------------
+HBufC8* CXdmDMAdapter::IntToDes8LC( const TInt aSource )
+ {
+ // 10 = max length of 32bit integer
+ HBufC8* buf = HBufC8::NewLC( KXdmDmMaxIntLength ); // << buf
+ TPtr8 ptrBuf = buf->Des();
+ ptrBuf.Num( aSource );
+ return buf;
+ }
+
+// ----------------------------------------------------
+// CXdmDMAdapter::WriteToLog
+// DEBUG only
+// ----------------------------------------------------
+//
+#ifdef _DEBUG
+void CXdmDMAdapter::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KXdmDmLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KXdmDmLogDir, KXdmDmLogFile, EFileLoggingModeAppend, buf );
+ }
+#endif
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmDeviceManagement/src/xdmdmadaptergroupproxy.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Table of plugins for ECom
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <implementationproxy.h>
+
+#include "xdmdmadapter.h"
+#include "xdmdmuid.h"
+
+
+// -----------------------------------------------------------------------------
+// TImplementationProxy ImplementationTable[]
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KXdmDmImplUid, CXdmDMAdapter::NewL )
+#else
+ { { KXdmDmImplUid }, CXdmDMAdapter::NewL },
+#endif
+ };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy()
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt&
+ aTableCount )
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+#ifdef _DEBUG
+ CXdmDMAdapter::WriteToLog(_L8( "CXdmDMAdapter:ImplementationGroupProxy") );
+#endif
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/BWINSCW/XdmProvisioningU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/data/1028237A.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Provisioning Adapter
+*
+*/
+
+
+
+
+#include "registryinfo.rh"
+#include "../inc/xdmprovuid.h"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XdmProvisioningInfo
+ {
+ dll_uid = KXdmProvAdapterDll;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KXdmProvAdapterInterface;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = KXdmProvAdapterImplementation;
+ version_no = 1;
+ display_name = "XDM Provisioning Plugin||Copyright © 2006 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/data/xdmprovisioningtexts.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions of texts visible to user.
+*
+*/
+
+
+
+
+// INCLUDES
+#include <badef.rh>
+#include <xdmprovisioningadapter.loc>
+
+// RESOURCE DEFINITIONS
+RESOURCE LBUF r_qtn_sm_head_connection
+ {
+ txt = qtn_sm_head_connection;
+ }
+
+RESOURCE LBUF r_qtn_xdm_provisioning_name
+ {
+ txt = qtn_xdm_provisioning_name;
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/eabi/XdmProvisioningU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZTI12CXdmProvItem @ 2 NONAME ; #<TI>#
+ _ZTI15CXdmProvAdapter @ 3 NONAME ; #<TI>#
+ _ZTV12CXdmProvItem @ 4 NONAME ; #<VT>#
+ _ZTV15CXdmProvAdapter @ 5 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+xdmprovisioning.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/group/xdmprovisioning.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Provisioning Adapter
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+// needed for RESOURCE_FILES_DIR
+#include <data_caging_paths.hrh>
+
+
+
+TARGET xdmprovisioning.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x1028237A
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE xdmprovitem.cpp
+SOURCE xdmprovadapter.cpp
+SOURCE xdmprovadaptergroupproxy.cpp
+
+SOURCEPATH ../data
+START RESOURCE 1028237A.rss
+ TARGET xdmprovisioning.rsc
+END
+
+
+START RESOURCE xdmprovisioningtexts.rss
+HEADER
+TARGET xdmprovisioningtexts.rsc
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY ecom.lib
+LIBRARY euser.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY provisioningengine.lib
+LIBRARY commdb.lib
+
+
+DEBUGLIBRARY flogger.lib
+
+
+
+
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+ deffile ../BWINSCW/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/inc/xdmprovadapter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM OMA Provisioning Adapter class
+*
+*/
+
+
+
+
+#ifndef __XDMPROVADAPTER_H__
+#define __XDMPROVADAPTER_H__
+
+// INCLUDES
+#include <CWPAdapter.h>
+
+// FORWARD DECLARATIONS
+class CXdmProvItem;
+class CWPCharacteristic;
+
+// CONSTANTS
+#ifdef _DEBUG
+_LIT( KXdmProvAdapterLogDir, "Xdm" );
+_LIT( KXdmProvAdapterLogFile, "XdmProvAdapter.txt" );
+const TInt KXdmProvAdapterBufferMaxSize = 2000;
+#endif
+
+const TInt KXdmProvIntMaxLength = 10; // max length of 32bit integer
+
+_LIT8( KXdmProvAppId8, "ap0003" );
+_LIT8( KXdmProvSipIdentifier, "w9010" );
+
+// CLASS DECLARATION
+
+class CXdmProvAdapter : public CWPAdapter
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CXdmProvAdapter* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CXdmProvAdapter();
+
+#ifdef _DEBUG
+ /**
+ * Writes logs to file.
+ */
+ static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+#endif
+
+ private: // from CWPAdapter
+
+ TInt ItemCount() const;
+ const TDesC16& SummaryTitle( TInt aIndex ) const;
+ const TDesC16& SummaryText( TInt aIndex ) const;
+ void SaveL( TInt aItem );
+ TBool CanSetAsDefault( TInt aItem ) const;
+ void SetAsDefaultL( TInt aItem );
+ TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+ void VisitL( CWPCharacteristic& aCharacteristic);
+ void VisitL( CWPParameter& aParameter );
+ void VisitLinkL( CWPCharacteristic& aLink );
+ void SettingsSavedL ( const TDesC8& aAppIdOfSavingItem,
+ const TDesC8& aAppRef,
+ const TDesC8& aStorageIdValue);
+ void SavingFinalizedL();
+
+ void GetSavingInfoL( TInt aIndex,
+ RPointerArray<HBufC8>& aSavingInfo );
+
+
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CXdmProvAdapter();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+
+ private:
+
+ // Default name for settings
+ HBufC* iDefaultName;
+
+ // Title for XDM settings
+ HBufC* iTitle;
+
+ // XdmItems
+ RPointerArray<CXdmProvItem> iProvItems;
+
+
+ };
+
+#endif // __XDMPROVADAPTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/inc/xdmprovitem.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provisioning item for parsing and saving XDM settings
+*
+*/
+
+
+
+
+#ifndef __XDMPROVITEM_H__
+#define __XDMPROVITEM_H__
+
+// INCLUDES
+#include <CWPAdapter.h>
+
+// FORWARD DECLARATIONS
+class CWPCharacteristic;
+class CWPParameter;
+
+_LIT( KXdmProvAppId, "ap0003" );
+_LIT( KXdmProvAppRef, "APPREF" );
+_LIT( KXdmProvToAppRef, "TO-APPREF" );
+_LIT( KXdmProvStartBracket, "(" );
+_LIT( KXdmProvCloseBracket, ")" );
+
+const TInt KXdmProvIdLength = 10;
+const TInt KXdmProvNameLength = 40;
+const TInt KXdmProvBufLength = 512;
+
+/**
+* Xdm settings item for provisioning.
+*
+* @since S60 3.2
+*/
+class CXdmProvItem : public CBase, public MWPVisitor
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CXdmProvItem* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXdmProvItem();
+
+
+ private: // From MWPVisitor
+
+ void VisitL( CWPCharacteristic& aCharacteristic );
+
+ void VisitL( CWPParameter& aParameter );
+
+ void VisitLinkL( CWPCharacteristic& aLink );
+
+ public:
+
+ /**
+ * Validates the provisioning item for mandatory fields
+ * @return ETrue if correct item
+ */
+ TBool Validate() const;
+
+ /**
+ * Saves the provisioned settings
+ * @return KErrNone if successfull
+ */
+ TInt SaveL();
+
+ /**
+ * Returns name of the provisioning item
+ * @return Name or KNullDesC
+ */
+ const TDesC& Name() const;
+
+ /**
+ * Returns application id of the provisioning item
+ * @return ApplicationId or KNullDesC
+ */
+ const TDesC& ApplicationId() const;
+
+ /**
+ * Returns id of the created settings
+ * @return The id or KErrNotFound if not yet saved
+ */
+ TInt XdmSettingsId() const;
+
+ /**
+ * Returns value of the APPREF of the provisioning item
+ * @return iAppRef or KNullDesC
+ */
+ const TDesC& AppReference() const;
+
+ /**
+ * Returns the application references from this item to other
+ * applications
+ * @return Array of references
+ */
+ const RArray<TPtrC>& ToAppReferences() const;
+
+
+ /**
+ * Set SIP settings id
+ * @param aStorageIdValue Settings id
+ */
+ void SetSipSettingsIdL( const TDesC8& aStorageIdValue );
+
+ /**
+ * Set name of the access point
+ * @param aLink
+ */
+ void SetNapDefL ( CWPCharacteristic& aLink );
+
+ private:
+
+
+ /**
+ * C++ default constructor.
+ */
+ CXdmProvItem();
+
+ /**
+ * Determines and saves named parameter
+ * @param aName Name of the parameter
+ * @param aValue Value of the parameter
+ */
+ void DetermineNamedParameter( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Finds the access point id from CommsDb
+ * based on access poin name
+ */
+ void FindAccessPointIdL ();
+
+ /**
+ * Checks that the settings name is not in use.
+ * Creates new name with index if needed.
+ */
+ void CheckExistingNamesL( );
+
+ private:
+
+
+ // The allocated id for the saved settings
+ TInt iXdmSettingsId;
+
+ // APPID
+ TPtrC iAppId;
+
+ // APPNAME
+ TPtrC iAppName;
+
+ // PROVIDER-ID
+ TPtrC iProviderId;
+
+ // TO-APPREF
+ HBufC* iSipReference;
+
+ // TO-NAPID
+ TPtrC iToNapId;
+
+ // Access point id
+ HBufC* iNapId;
+
+ // Name of the access point
+ TPtrC iNapName;
+
+ // APPREF
+ TPtrC iAppRef;
+
+ // URI
+ TPtrC iXcapRootUri;
+
+ // AAUTHNAME
+ TPtrC iUserName;
+
+ // AAUTHSECRET
+ TPtrC iPassword;
+
+ // AAUTHTYPE
+ TPtrC iAuthType;
+
+ // Flag indicating wheather settings are saved
+ TBool iSettingsSaved;
+
+ // Application references
+ RArray<TPtrC> iToAppReferences;
+
+
+ };
+
+#endif // __XDMPROVITEM_H__
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/inc/xdmprovuid.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Uids for Xdm Provisioning
+*
+*/
+
+
+
+
+#ifndef __XDMPROVISIONINGUID__
+#define __XDMPROVISIONINGUID__
+
+// XDM Provisioning Adapter ECOM plugin interface
+#define KXdmProvAdapterDll 0x1028237A
+
+// ECOM plugin interface for all provisioning adapters
+#define KXdmProvAdapterInterface 0x101F84D5
+
+// XDM Provisioning Adapter implementation
+#define KXdmProvAdapterImplementation 0x1028237B
+
+#endif // __XDMPROVISIONINGUID__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/loc/xdmprovisioningadapter.loc Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains all logical names for
+* XDM Provisioning Adapter.
+*
+*/
+
+
+
+
+// LOCALISATION STRINGS
+
+//d: Summary title for Xdm provisioning entries.
+//l: msg_body_pane/opt
+//
+#define qtn_sm_head_connection "Connection settings"
+
+
+//d: Default name for new Xdm server settings.
+//l: msg_body_pane/opt
+//
+#define qtn_xdm_provisioning_name "New XDM settings"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/src/xdmprovadapter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Provisioning Adapter implementation.
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <CWPCharacteristic.h>
+#include <WPAdapterUtil.h>
+#include <xdmprovisioningtexts.rsg>
+#include <XdmSettingsApi.h>
+
+#include "xdmprovitem.h"
+#include "xdmprovadapter.h"
+
+
+#ifdef _DEBUG
+ #include <flogger.h>
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::CXdmProvAdapter
+//
+// -----------------------------------------------------------------------------
+//
+CXdmProvAdapter::CXdmProvAdapter():
+iDefaultName( NULL ),
+iTitle( NULL ),
+iProvItems( 1 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::ConstructL()
+ {
+ // AdapterUtil needs the name of the resource file without the prefix and
+ // the path returned by Dll::FileName. Note that Dll::FileName is an
+ // undocumented method.
+ //
+ _LIT( KXdmAdapterName, "xdmprovisioningtexts"); // xdmprovisioningtexts.rss
+ TFileName fileName;
+ Dll::FileName(fileName);
+
+ iTitle = WPAdapterUtil::ReadHBufCL( fileName,
+ KXdmAdapterName,
+ R_QTN_SM_HEAD_CONNECTION);
+ iDefaultName = WPAdapterUtil::ReadHBufCL( fileName,
+ KXdmAdapterName,
+ R_QTN_XDM_PROVISIONING_NAME);
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CXdmProvAdapter* CXdmProvAdapter::NewL()
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::NewL" ) );
+#endif
+ CXdmProvAdapter* self = new(ELeave) CXdmProvAdapter;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::~CXdmProvAdapter
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CXdmProvAdapter::~CXdmProvAdapter()
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::~CXdmProvAdapter" ) );
+#endif
+ delete iTitle;
+ delete iDefaultName;
+ iProvItems.ResetAndDestroy();
+ iProvItems.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::ItemCount
+// -----------------------------------------------------------------------------
+//
+TInt CXdmProvAdapter::ItemCount() const
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::ItemCount returns %d" ), iProvItems.Count());
+#endif
+ return iProvItems.Count();
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SummaryTitle
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CXdmProvAdapter::SummaryTitle(TInt /*aIndex*/) const
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SummaryTitle" ) );
+#endif
+ return *iTitle;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SummaryText
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CXdmProvAdapter::SummaryText( TInt aIndex ) const
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SummaryText" ) );
+#endif
+ TInt count = iProvItems.Count();
+ if( aIndex < count )
+ {
+ if( 0 < iProvItems[aIndex]->Name().Length() )
+ {
+ return iProvItems[aIndex]->Name();
+ }
+ }
+ return *iDefaultName;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SaveL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::SaveL( TInt aItem )
+ {
+ if ( aItem < iProvItems.Count() - 1 )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SaveL leaves with KErrArgument" ) );
+#endif
+ User::Leave ( KErrArgument );
+ }
+ iProvItems[aItem]->SaveL();
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SaveL done" ) );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::CanSetAsDefault
+// -----------------------------------------------------------------------------
+//
+TBool CXdmProvAdapter::CanSetAsDefault( TInt /*aItem*/ ) const
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::CanSetAsDefault" ) );
+#endif
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SetAsDefaultL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::SetAsDefaultL( TInt /*aItem*/ )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SetAsDefaultL" ) );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::DetailsL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CXdmProvAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::DetailsL" ) );
+#endif
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::VisitL( CWPCharacteristic& aCharacteristic )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::VisitL( CWPCharacteristic& aCharacteristic)" ) );
+#endif
+ if( KWPApplication == aCharacteristic.Type() )
+ {
+ CXdmProvItem* item = CXdmProvItem::NewL();
+ CleanupStack::PushL( item ); // << item
+ aCharacteristic.AcceptL( *item );
+
+ if( item->Validate() )
+ {
+ iProvItems.AppendL( item );
+ CleanupStack::Pop( item ); // >> item
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( item ); // >>> item
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::VisitL( CWPParameter& /*aParameter*/ )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::VisitL( CWPParameter& /*aParameter*/" ) );
+#endif
+ // Not used.
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::VisitLinkL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvAdapter::VisitLinkL( CWPCharacteristic& /*aLink*/ )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::VisitLinkL( CWPCharacteristic& aLink" ) );
+#endif
+ // Not used.
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SettingsSavedL
+//
+// -----------------------------------------------------------------------------
+void CXdmProvAdapter::SettingsSavedL( const TDesC8& aAppIdOfSavingItem,
+ const TDesC8& aAppRef,
+ const TDesC8& aStorageIdValue )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SettingsSavedL" ) );
+#endif
+ // Convert aAppRef
+ HBufC* appRef16 = HBufC::NewLC( aAppRef.Length() ); // << aAppRef16
+ appRef16->Des().Copy( aAppRef );
+
+ // Offer application references to all provisioned XDM settings
+ TInt provItemsCount( iProvItems.Count() );
+ for( TInt i(0); i < provItemsCount; i++ )
+ {
+ CXdmProvItem* item = iProvItems[i];
+ const RArray<TPtrC>& toAppRefs = item->ToAppReferences();
+
+ // Find application reference that is being offered
+ TInt toAppRefsCount( toAppRefs.Count() );
+ for( TInt j(0); j < toAppRefsCount; j++ )
+ {
+ const TDesC& toAppRef = toAppRefs[j];
+ if( !toAppRef.Compare( *appRef16 ) )
+ {
+ // Set correct application reference
+ if( !aAppIdOfSavingItem.Compare( KXdmProvSipIdentifier ) )
+ {
+ item->SetSipSettingsIdL( aStorageIdValue );
+ break;
+ }
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( appRef16 ); // >>> appRef16
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::GetSavingInfoL
+//
+// -----------------------------------------------------------------------------
+void CXdmProvAdapter::GetSavingInfoL( TInt aIndex,
+ RPointerArray<HBufC8>& aSavingInfo )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::GetSavingInfoL" ) );
+#endif
+ if ( aIndex < iProvItems.Count() - 1 )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::GetSavingInfoL leaves with KErrArgument" ) );
+#endif
+ User::Leave ( KErrArgument );
+ }
+ TInt length ( iProvItems[aIndex]->AppReference().Length() );
+ // if the APPREF exists
+ if ( 0 < length )
+ {
+ // APPID into place [0].
+ TPtrC8 appId ( KXdmProvAppId8 );
+ HBufC8* appIdBuf = appId.AllocLC(); // << appIdBuf
+ aSavingInfo.AppendL( appIdBuf );
+ CleanupStack::Pop( appIdBuf ); // >> appIdBuf
+ appIdBuf = NULL;
+
+ // APPREF into place [1].
+ HBufC8* appRefBuf = HBufC8::NewLC( length ); // << appRefBuf
+ TPtr8 appRef = appRefBuf->Des();
+ appRef.Copy( iProvItems[aIndex]->AppReference() );
+ aSavingInfo.AppendL( appRefBuf );
+ CleanupStack::Pop( appRefBuf ); // >> appRefBuf
+ appRefBuf = NULL;
+
+ // Xdm settings id into place [2].
+ HBufC8* idBuf = HBufC8::NewLC( KXdmProvIntMaxLength ); // << idBuf
+ TPtr8 id = idBuf->Des();
+ id.Num( iProvItems[aIndex]->XdmSettingsId() );
+ aSavingInfo.AppendL( idBuf );
+ CleanupStack::Pop( idBuf ); // >> idBuf
+ idBuf = NULL;
+ }
+
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::GetSavingInfoL done" ) );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvAdapter::SavingFinalizedL()
+//
+// -----------------------------------------------------------------------------
+void CXdmProvAdapter::SavingFinalizedL()
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmProvAdapter::SavingFinalizedL" ) );
+#endif
+ }
+
+
+// ----------------------------------------------------
+// CXdmProvAdapter::WriteToLog
+// _DEBUG only
+// ----------------------------------------------------
+//
+#ifdef _DEBUG
+void CXdmProvAdapter::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KXdmProvAdapterBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KXdmProvAdapterLogDir, KXdmProvAdapterLogFile, EFileLoggingModeAppend, buf );
+ }
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/src/xdmprovadaptergroupproxy.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Table of plugins for ECom
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <implementationproxy.h>
+
+#include "xdmprovadapter.h"
+#include "xdmprovuid.h"
+
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KXdmProvAdapterImplementation, CXdmProvAdapter::NewL )
+#else
+ { { KXdmProvAdapterImplementation }, CXdmProvAdapter::NewL },
+#endif
+ };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+ return KImplementationTable;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmProvisioning/src/xdmprovitem.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,500 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provisioning item.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <CWPParameter.h>
+#include <CWPCharacteristic.h>
+#include <commdb.h>
+#include <XdmSettingsCollection.h>
+#include <XdmSettingsApi.h>
+
+#include "xdmprovitem.h"
+
+#ifdef _DEBUG
+ #include "xdmprovadapter.h"
+#endif
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::CXdmProvItem
+//
+// -----------------------------------------------------------------------------
+//
+CXdmProvItem::CXdmProvItem():
+ iXdmSettingsId( KErrNotFound ),
+ iAppId( KNullDesC ),
+ iAppName( KNullDesC ),
+ iProviderId( KNullDesC ),
+ iSipReference( NULL ),
+ iToNapId( KNullDesC ),
+ iNapId( NULL ),
+ iNapName( KNullDesC ),
+ iAppRef( KNullDesC ),
+ iXcapRootUri( KNullDesC ),
+ iUserName( KNullDesC ),
+ iPassword( KNullDesC ),
+ iAuthType( KNullDesC ),
+ iSettingsSaved( EFalse )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CXdmProvItem* CXdmProvItem::NewL()
+ {
+ CXdmProvItem* self = new (ELeave) CXdmProvItem();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::~CXdmProvItem
+// -----------------------------------------------------------------------------
+//
+CXdmProvItem::~CXdmProvItem()
+ {
+ iToAppReferences.Close();
+ delete iSipReference;
+ delete iNapId;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::Validate
+// -----------------------------------------------------------------------------
+//
+TBool CXdmProvItem::Validate() const
+ {
+ if ( !iAppId.Length() )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate iAppId missing" ) );
+#endif
+ return EFalse;
+ }
+ else if ( iAppId.Compare( KXdmProvAppId ) )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate wrong iAppId" ) );
+#endif
+ return EFalse;
+ }
+ else if ( !iAppName.Length() )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate iAppName missing" ) );
+#endif
+ return EFalse;
+ }
+ else if ( !iToNapId.Length() )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate iNapId missing" ) );
+#endif
+ return EFalse;
+ }
+ else if ( !iXcapRootUri.Length() )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate iXcapRootUri missing" ) );
+#endif
+ return EFalse;
+ }
+ else
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::Validate returns true" ) );
+#endif
+ return ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CXdmProvItem::Name() const
+ {
+ return iAppName;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::ApplicationId
+// -----------------------------------------------------------------------------
+//
+const TDesC& CXdmProvItem::ApplicationId() const
+ {
+ return iAppId;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::XdmSettingsId
+// -----------------------------------------------------------------------------
+//
+TInt CXdmProvItem::XdmSettingsId() const
+ {
+ return iXdmSettingsId;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::AppReference
+// -----------------------------------------------------------------------------
+//
+const TDesC& CXdmProvItem::AppReference() const
+ {
+ return iAppRef;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::SaveL
+// -----------------------------------------------------------------------------
+//
+TInt CXdmProvItem::SaveL()
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::SaveL" ) );
+#endif
+
+ if( !iSettingsSaved )
+ {
+ CXdmSettingsCollection* settings = new (ELeave) CXdmSettingsCollection();
+ CleanupStack::PushL( settings ); // << settings
+ settings->AppendL( iAppId, EXdmPropAppId );
+ CheckExistingNamesL();
+ settings->AppendL( iAppName, EXdmPropName );
+ settings->AppendL( iProviderId, EXdmPropProvId );
+ FindAccessPointIdL();
+ settings->AppendL( *iNapId, EXdmPropToNapId );
+ if( iSipReference )
+ {
+ settings->AppendL( *iSipReference, EXdmPropToAppRef );
+ }
+ settings->AppendL( iXcapRootUri, EXdmPropUri );
+ settings->AppendL( iUserName, EXdmPropAuthName );
+ settings->AppendL( iPassword, EXdmPropAuthSecret );
+ settings->AppendL( iAuthType, EXdmPropAuthType );
+ iXdmSettingsId = TXdmSettingsApi::CreateCollectionL( *settings );
+ CleanupStack::PopAndDestroy( settings ); // >>> settings
+ iSettingsSaved = ETrue;
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::SaveL settings saved" ) );
+#endif
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::ToAppReferences
+// -----------------------------------------------------------------------------
+//
+const RArray<TPtrC>& CXdmProvItem::ToAppReferences() const
+ {
+ return iToAppReferences;
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::VisitL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::VisitL( CWPCharacteristic& aCharacteristic )
+ {
+ if ( KWPResource == aCharacteristic.Type( ) )
+ {
+ aCharacteristic.AcceptL( *this );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::VisitL CWPCharacteristic" ) );
+#endif
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::VisitL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::VisitL( CWPParameter& aParameter )
+ {
+#ifdef _DEBUG
+ HBufC8* value = HBufC8::NewLC( aParameter.Value().Length() ); // << value
+ TPtr8 bufferPtr = value->Des();
+ bufferPtr.Copy( aParameter.Value() );
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::VisitL CWPParameter aParameter.Value() =%S" ), &bufferPtr );
+ CleanupStack::PopAndDestroy( value ); // >>> value
+#endif
+ switch( aParameter.ID() )
+ {
+ case EWPParameterAppID:
+ {
+ iAppId.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterAppID" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterProviderID:
+ {
+ iProviderId.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterProviderID" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterName:
+ {
+ iAppName.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterName" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterToAppRef:
+ {
+ iToAppReferences.Append( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterToAppRef" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterToNapID:
+ {
+ iToNapId.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterToNapID" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterURI:
+ {
+ iXcapRootUri.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterURI" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterAAuthName:
+ {
+ iUserName.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterAAuthName" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterAAuthSecret:
+ {
+ iPassword.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterAAuthSecret" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterAAuthType:
+ {
+ iAuthType.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterAAuthType" ) );
+#endif
+ }
+ break;
+
+ case EWPParameterAppRef:
+ {
+ iAppRef.Set( aParameter.Value() );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::EWPParameterAppRef" ) );
+#endif
+ }
+ break;
+ default:
+ {
+ DetermineNamedParameter( aParameter.Name(), aParameter.Value() );
+ }
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::DetermineNamedParameter
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::DetermineNamedParameter( const TDesC& aName, const TDesC& aValue )
+ {
+ if ( !aName.Compare( KXdmProvAppRef ) )
+ {
+ iAppRef.Set( aValue );
+ }
+ else if ( !aName.Compare( KXdmProvToAppRef ) )
+ {
+ iToAppReferences.Append( aValue );
+ }
+ }
+// -----------------------------------------------------------------------------
+// CXdmProvItem::VisitLinkL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::VisitLinkL( CWPCharacteristic& aLink )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::VisitLinkL" ) );
+#endif
+ if( KWPNapDef == aLink.Type() )
+ {
+ // check that this is the correct one
+ CArrayFix<TPtrC>* napId = new (ELeave) CArrayFixFlat<TPtrC>(1);
+ CleanupStack::PushL( napId ); // << napId
+ aLink.ParameterL( EWPParameterNapID, napId );
+ if ( 0 < napId->Count() )
+ {
+ if ( !napId->At(0).Compare( iToNapId ) )
+ {
+ SetNapDefL( aLink );
+ }
+ }
+ CleanupStack::PopAndDestroy( napId ); // >>> napId
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::SetNapDefL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::SetNapDefL ( CWPCharacteristic& aLink )
+ {
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::SetNapDefL" ) );
+#endif
+ // find the name of the access point
+ CArrayFix<TPtrC>* name = new (ELeave) CArrayFixFlat<TPtrC>(1);
+ CleanupStack::PushL( name ); // << name
+ aLink.ParameterL( EWPParameterName, name );
+ if ( name->Count() > 0 )
+ {
+ iNapName.Set( name->At(0) );
+ }
+ CleanupStack::PopAndDestroy( name ); // >>> name
+
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::SetNapDefL done" ) );
+#endif
+ }
+// -----------------------------------------------------------------------------
+// CXdmProvItem::SetSipSettingsIdL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::SetSipSettingsIdL( const TDesC8& aStorageIdValue )
+ {
+ delete iSipReference;
+ iSipReference = NULL;
+ iSipReference = HBufC::NewL( aStorageIdValue.Length() );
+ iSipReference->Des().Copy( aStorageIdValue );
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::FindAccessPointIdL
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::FindAccessPointIdL ()
+ {
+
+ TInt result( KErrNone );
+ TUint32 idNum;
+ TBuf<KXdmProvNameLength> name;
+ // Get IAP names and ids from the database
+ CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+ CleanupStack::PushL( commsDb ); // << commsDb
+ commsDb->ShowHiddenRecords();
+ CCommsDbTableView* view = commsDb->OpenTableLC( TPtrC( IAP ) ); // << view
+ result = view->GotoFirstRecord();
+
+ while( KErrNone == result )
+ {
+ view->ReadTextL( TPtrC( COMMDB_NAME ), name );
+ if ( KErrNotFound != name.Find( iNapName ) )
+ {
+ view->ReadUintL( TPtrC( COMMDB_ID ), idNum );
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::FindAccessPointIdL IAP found id=%d" ), idNum );
+#endif
+ }
+ result = view->GotoNextRecord();
+ }
+#ifdef _DEBUG
+ CXdmProvAdapter::WriteToLog( _L8( "CXdmProvItem::FindAccessPointIdL IAP using id=%d" ), idNum );
+#endif
+ CleanupStack::PopAndDestroy( 2, commsDb ); // >>> view, commsDb
+ TBuf<KXdmProvIdLength> id;
+ id.AppendNum( idNum, EDecimal );
+ delete iNapId;
+ iNapId = NULL;
+ iNapId = id.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CXdmProvItem::CheckExistingNamesL()
+// -----------------------------------------------------------------------------
+//
+void CXdmProvItem::CheckExistingNamesL( )
+ {
+ TBool ready( EFalse );
+ RArray<TInt> settingIds;
+ CleanupClosePushL( settingIds ); // << settingIds
+ CDesCArray* settingNames = TXdmSettingsApi::CollectionNamesLC( settingIds ); // << settingNames
+ TInt index( 0 );
+ while ( !ready )
+ {
+ TBool found ( EFalse );
+ TInt count = settingNames->MdcaCount();
+ TBuf<KXdmProvBufLength> tempName;
+ tempName.Copy( iAppName );
+ if ( index > 0 )
+ {
+ tempName.Append( KXdmProvStartBracket );
+ tempName.AppendNumFixedWidth( index, EDecimal, 2 );
+ tempName.Append( KXdmProvCloseBracket );
+ }
+ for ( TInt i(0); i < count && !found; i++ )
+ {
+ if ( !settingNames->MdcaPoint(i).CompareF( tempName ) )
+ {
+ found = ETrue;
+ index++;
+ }
+ }
+ if ( !found )
+ {
+ ready = ETrue;
+ iAppName.Set( tempName );
+ }
+ }
+ // only number used in next function, type of RArray
+ CleanupStack::PopAndDestroy( 2 ); // >>> settingNames, settingIds
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/BWINSCW/XdmSettingsApiU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,20 @@
+EXPORTS
+ ??0CXdmSettingsCollection@@QAE@XZ @ 1 NONAME ; CXdmSettingsCollection::CXdmSettingsCollection(void)
+ ??1CXdmSettingsCollection@@UAE@XZ @ 2 NONAME ; CXdmSettingsCollection::~CXdmSettingsCollection(void)
+ ??1CXdmSettingsProperty@@UAE@XZ @ 3 NONAME ; CXdmSettingsProperty::~CXdmSettingsProperty(void)
+ ?AppendL@CXdmSettingsCollection@@QAEXABVTDesC16@@W4TXdmSettingsProperty@@@Z @ 4 NONAME ; void CXdmSettingsCollection::AppendL(class TDesC16 const &, enum TXdmSettingsProperty)
+ ?CollectionNamesLC@TXdmSettingsApi@@SAPAVCDesC16Array@@AAV?$RArray@H@@@Z @ 5 NONAME ; class CDesC16Array * TXdmSettingsApi::CollectionNamesLC(class RArray<int> &)
+ ?Count@CXdmSettingsCollection@@QBEHXZ @ 6 NONAME ; int CXdmSettingsCollection::Count(void) const
+ ?CreateCollectionL@TXdmSettingsApi@@SAHABVCXdmSettingsCollection@@@Z @ 7 NONAME ; int TXdmSettingsApi::CreateCollectionL(class CXdmSettingsCollection const &)
+ ?CreatePropertyL@TXdmSettingsApi@@SAXHABVTDesC16@@W4TXdmSettingsProperty@@@Z @ 8 NONAME ; void TXdmSettingsApi::CreatePropertyL(int, class TDesC16 const &, enum TXdmSettingsProperty)
+ ?Property@CXdmSettingsCollection@@QBE?AVTPtrC16@@W4TXdmSettingsProperty@@@Z @ 9 NONAME ; class TPtrC16 CXdmSettingsCollection::Property(enum TXdmSettingsProperty) const
+ ?Property@CXdmSettingsCollection@@QBEABVCXdmSettingsProperty@@H@Z @ 10 NONAME ; class CXdmSettingsProperty const & CXdmSettingsCollection::Property(int) const
+ ?PropertyL@TXdmSettingsApi@@SAPAVHBufC16@@HW4TXdmSettingsProperty@@@Z @ 11 NONAME ; class HBufC16 * TXdmSettingsApi::PropertyL(int, enum TXdmSettingsProperty)
+ ?PropertyName@CXdmSettingsProperty@@QBE?AW4TXdmSettingsProperty@@XZ @ 12 NONAME ; enum TXdmSettingsProperty CXdmSettingsProperty::PropertyName(void) const
+ ?PropertyValue@CXdmSettingsProperty@@QBE?AVTPtrC16@@XZ @ 13 NONAME ; class TPtrC16 CXdmSettingsProperty::PropertyValue(void) const
+ ?RemoveCollectionL@TXdmSettingsApi@@SAXH@Z @ 14 NONAME ; void TXdmSettingsApi::RemoveCollectionL(int)
+ ?RemoveL@CXdmSettingsCollection@@QAEXW4TXdmSettingsProperty@@@Z @ 15 NONAME ; void CXdmSettingsCollection::RemoveL(enum TXdmSettingsProperty)
+ ?RemovePropertyL@TXdmSettingsApi@@SAXHW4TXdmSettingsProperty@@@Z @ 16 NONAME ; void TXdmSettingsApi::RemovePropertyL(int, enum TXdmSettingsProperty)
+ ?SettingsCollectionL@TXdmSettingsApi@@SAPAVCXdmSettingsCollection@@H@Z @ 17 NONAME ; class CXdmSettingsCollection * TXdmSettingsApi::SettingsCollectionL(int)
+ ?UpdatePropertyL@TXdmSettingsApi@@SAXHABVTDesC16@@W4TXdmSettingsProperty@@@Z @ 18 NONAME ; void TXdmSettingsApi::UpdatePropertyL(int, class TDesC16 const &, enum TXdmSettingsProperty)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/eabi/XdmSettingsApiU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+ _ZN15TXdmSettingsApi15CreatePropertyLEiRK7TDesC1620TXdmSettingsProperty @ 1 NONAME
+ _ZN15TXdmSettingsApi15RemovePropertyLEi20TXdmSettingsProperty @ 2 NONAME
+ _ZN15TXdmSettingsApi15UpdatePropertyLEiRK7TDesC1620TXdmSettingsProperty @ 3 NONAME
+ _ZN15TXdmSettingsApi17CollectionNamesLCER6RArrayIiE @ 4 NONAME
+ _ZN15TXdmSettingsApi17CreateCollectionLERK22CXdmSettingsCollection @ 5 NONAME
+ _ZN15TXdmSettingsApi17RemoveCollectionLEi @ 6 NONAME
+ _ZN15TXdmSettingsApi19SettingsCollectionLEi @ 7 NONAME
+ _ZN15TXdmSettingsApi9PropertyLEi20TXdmSettingsProperty @ 8 NONAME
+ _ZN22CXdmSettingsCollection7AppendLERK7TDesC1620TXdmSettingsProperty @ 9 NONAME
+ _ZN22CXdmSettingsCollection7RemoveLE20TXdmSettingsProperty @ 10 NONAME
+ _ZN22CXdmSettingsCollectionC1Ev @ 11 NONAME
+ _ZN22CXdmSettingsCollectionC2Ev @ 12 NONAME
+ _ZN22CXdmSettingsCollectionD0Ev @ 13 NONAME
+ _ZN22CXdmSettingsCollectionD1Ev @ 14 NONAME
+ _ZN22CXdmSettingsCollectionD2Ev @ 15 NONAME
+ _ZNK20CXdmSettingsProperty12PropertyNameEv @ 16 NONAME
+ _ZNK20CXdmSettingsProperty13PropertyValueEv @ 17 NONAME
+ _ZNK22CXdmSettingsCollection5CountEv @ 18 NONAME
+ _ZNK22CXdmSettingsCollection8PropertyE20TXdmSettingsProperty @ 19 NONAME
+ _ZNK22CXdmSettingsCollection8PropertyEi @ 20 NONAME
+ _ZTI22CXdmSettingsCollection @ 21 NONAME ; #<TI>#
+ _ZTV22CXdmSettingsCollection @ 22 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/group/XdmSettingsApi.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine settings API
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xdmsettingsapi.dll
+UID 0x1000008d 0x010000DC
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+TARGETTYPE DLL
+
+SOURCEPATH ../src
+
+SOURCE XdmSettingsApi.cpp
+SOURCE XdmSettingsProperty.cpp
+SOURCE XdmSettingsCollection.cpp
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY bafl.lib
+LIBRARY euser.lib
+LIBRARY centralrepository.lib
+LIBRARY flogger.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../BWINSCW/
+#elif defined (WINS )
+deffile ../BWINS/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XdmSettingsApi.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/src/XdmSettingsApi.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine settings API
+*
+*/
+
+
+
+#include <flogger.h>
+#include <centralrepository.h>
+#include "XdmSettingsApi.h"
+#include "XdmSettingsProperty.h"
+#include "XdmSettingsCollection.h"
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::CreateCollectionL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt TXdmSettingsApi::CreateCollectionL( const CXdmSettingsCollection& aCollection )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::CreateCollectionL()" ) );
+ #endif
+ TInt error = KErrArgument;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ TInt row = LastRow( repository );
+ TInt count = aCollection.Count();
+ __ASSERT_DEBUG( count > 0, User::Leave( KErrArgument ) );
+ for( TInt i = 0;i < count;i++ )
+ {
+ const CXdmSettingsProperty& prop = aCollection.Property( i );
+ TInt32 column = prop.PropertyName();
+ //Don't let the client set the settings ID, since
+ //this might create conflicting IDs in the repository
+ if( column != KXdmSettingsId )
+ {
+ //Now merge row & column
+ TInt32 newKey = ( row * 0x100 ) | column;
+ error = repository->Create( newKey, prop.PropertyValue() );
+ #ifdef _DEBUG
+ HBufC8* buf = HBufC8::NewLC( prop.PropertyValue().Length() );
+ buf->Des().Copy( prop.PropertyValue() );
+ TPtrC8 des( buf->Des() );
+ WriteToLog( _L8( " New key [0x%08x] created - Name: %d Value: %S" ), newKey, column, &des );
+ CleanupStack::PopAndDestroy(); //buf
+ #endif
+ }
+ }
+ error = CreateUniqueIdL( repository, row );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " New settings ID created - ID: %d Error: %d" ), row, error );
+ #endif
+ CleanupStack::PopAndDestroy(); //repository
+ return error == KErrNone ? row : error;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::RemoveCollectionL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void TXdmSettingsApi::RemoveCollectionL( TInt aSettingsId )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::RemoveCollectionL() - ID: %d" ), aSettingsId );
+ #endif
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ TInt row = FindRowL( aSettingsId, repository );
+ if( row >= KErrNone )
+ {
+ TInt32 key = -1;
+ TInt error = KErrNone;
+ for( TInt i = 0;i < KXdmPropertyCount;i++ )
+ {
+ key = ( row * 0x100 ) | i;
+ error = repository->Delete( key );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Key %x deleted - Error: %d" ), key, error );
+ #endif
+ }
+ }
+ else User::Leave( KErrNotFound );
+ CleanupStack::PopAndDestroy();
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::CreatePropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void TXdmSettingsApi::CreatePropertyL( TInt aSettingsId,
+ const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::UpdatePropertyL()" ) );
+ WriteToLog( _L8( " Property: %d" ), aPropertyName );
+ WriteToLog( _L8( " Property set ID: %d" ), aSettingsId );
+ WriteToLog( _L8( " Property value: %S" ), &aPropertyValue );
+ #endif
+ TInt error = KErrNotFound;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ TInt row = FindRowL( aSettingsId, repository );
+ if( row >= 0 )
+ {
+ TInt32 key = ( row * 0x100 ) | aPropertyName;
+ error = repository->Create( key, aPropertyValue );
+ if( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Create() failed with %d" ), error );
+ #endif
+ User::Leave( error );
+ }
+ }
+ else //No keys or too many
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Property set not found - Error: %d" ), row );
+ #endif
+ User::Leave( error );
+ }
+ CleanupStack::PopAndDestroy(); //repository
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::UpdatePropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void TXdmSettingsApi::UpdatePropertyL( TInt aSettingsId,
+ const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName )
+
+ {
+ #ifdef _DEBUG
+ HBufC8* value = HBufC8::NewLC( aPropertyValue.Length() );
+ TPtr8 prop( value->Des() );
+ prop.Copy( aPropertyValue );
+ WriteToLog( _L8( "TXdmSettingsApi::UpdatePropertyL()" ) );
+ WriteToLog( _L8( " Settings ID: %d" ), aSettingsId );
+ WriteToLog( _L8( " Property name: %d" ), aPropertyName );
+ WriteToLog( _L8( " Property value: %S" ), &prop );
+ CleanupStack::PopAndDestroy(); //value
+ #endif
+ TInt error = KErrAlreadyExists;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ RArray<TUint32> keys = FindByIdL( aSettingsId, repository );
+ CleanupClosePushL( keys );
+ TInt count = keys.Count();
+ if( count == 1 )
+ {
+ TInt32 row = ( keys[0] & 0xFFFFFF00 ) / 0x100;
+ TInt32 key = ( row * 0x100 ) | aPropertyName;
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Key to update: 0x%08x" ), key );
+ #endif
+ error = repository->Set( key, aPropertyValue );
+ if( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Set() failed with %d, try Create()" ), error );
+ #endif
+ error = repository->Create( key, aPropertyValue );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Create() completed with %d" ), error );
+ #endif
+ }
+ }
+ else //No keys or too many
+ {
+ #ifdef _DEBUG
+ TBuf<32> errBuf;
+ count > 0 ? errBuf.Append( _L( "Too many results" ) ) :
+ errBuf.Append( _L( "No results found" ) );
+ WriteToLog( _L8( " * Error - %S: %d" ), &errBuf, count );
+ #endif
+ TInt error = count > 0 ? KErrGeneral : KErrNotFound;
+ User::Leave( error );
+ }
+ CleanupStack::PopAndDestroy( 2 ); //keys, repository
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::RemovePropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void TXdmSettingsApi::RemovePropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aPropertyName )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::RemovePropertyL() - ID: %d" ), aSettingsId );
+ #endif
+ TInt error = KErrNotFound;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ TInt row = FindRowL( aSettingsId, repository );
+ if( row >= 0 )
+ {
+ TInt32 key = ( row * 0x100 ) | aPropertyName;
+ error = repository->Delete( key );
+ if( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Delete() failed with %d" ), error );
+ #endif
+ User::Leave( error );
+ }
+ }
+ else //No keys or too many
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Property set not found - Error: %d" ), row );
+ #endif
+ User::Leave( error );
+ }
+ CleanupStack::PopAndDestroy(); //repository
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::CreateUniqueIdL
+//
+// ---------------------------------------------------------
+//
+TInt TXdmSettingsApi::CreateUniqueIdL( CRepository* aRepository, TInt aRow )
+ {
+ TBuf<10> numBuf;
+ numBuf.Zero();
+ numBuf.AppendNum( aRow );
+ TInt error = KErrNone;
+ RArray<TUint32> keys;
+ CleanupClosePushL( keys );
+ const TInt32 KPartialIdMask = 0x000000FF;
+ error = aRepository->FindEqL( KXdmSettingsId, KPartialIdMask, numBuf, keys );
+ __ASSERT_DEBUG( error == KErrNotFound, User::Panic( _L( "CXdmSettingsApi" ), 1 ) );
+ TInt32 newKey = ( aRow * 0x100 ) | KXdmSettingsId;
+ error = aRepository->Create( newKey, numBuf );
+ CleanupStack::PopAndDestroy(); //keys
+ return error;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::LastRow
+//
+// ---------------------------------------------------------
+//
+TInt TXdmSettingsApi::LastRow( CRepository* aRepository )
+ {
+ RArray<TUint32> keys;
+ CleanupClosePushL( keys );
+ const TInt32 KPartialNameMask = 0x000000FF;
+ TInt error = aRepository->FindL( KXdmSettingsId, KPartialNameMask, keys );
+ TInt count = keys.Count();
+ //Must check for existing IDs
+ if( count > 0 )
+ {
+ TInt exists = FindRowL( count, aRepository );
+ while( exists != KErrNotFound )
+ {
+ count++;
+ exists = FindRowL( count, aRepository );
+ }
+ }
+ CleanupStack::PopAndDestroy(); //keys
+ return count;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::FindRowL
+//
+// ---------------------------------------------------------
+//
+TInt TXdmSettingsApi::FindRowL( TInt aSettingsId,
+ CRepository* aRepository )
+ {
+ TUint32 rowNum = 0;
+ RArray<TUint32> keys;
+ CleanupClosePushL( keys );
+ TBuf<10> numBuf;
+ numBuf.AppendNum( aSettingsId );
+ const TInt32 KPartialNameMask = 0x000000FF;
+ TInt error = aRepository->FindEqL( KXdmSettingsId, KPartialNameMask, numBuf, keys );
+ if( error == KErrNone && keys.Count() == 1 )
+ {
+ //Extract row part from the key
+ TInt row = keys[0] & 0xFFFFFF00;
+ //e.g. 0x00000400 => 0x00000004
+ rowNum = row / 0x100;
+ }
+ CleanupStack::PopAndDestroy(); //keys
+ return error == KErrNone ? rowNum : error;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::FindByIdL
+//
+// ---------------------------------------------------------
+//
+RArray<TUint32> TXdmSettingsApi::FindByIdL( TInt aSettingsId, CRepository* aRepository )
+ {
+ const TInt32 KPartialKeyMask = 0x000000FF;
+ RArray<TUint32> keys;
+ CleanupClosePushL( keys );
+ TBuf<15> numBuf;
+ numBuf.AppendNum( aSettingsId );
+ TInt error = aRepository->FindEqL( KXdmSettingsId, KPartialKeyMask, numBuf, keys );
+ CleanupStack::Pop(); //keys
+ return keys;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::FindByTypeL
+//
+// ---------------------------------------------------------
+//
+RArray<TUint32> TXdmSettingsApi::FindByTypeL( CRepository* aRepository,
+ TXdmSettingsProperty aSingleProp )
+ {
+ const TInt32 KPartialKeyMask = 0x000000FF;
+ RArray<TUint32> keys;
+ CleanupClosePushL( keys );
+ TInt error = aRepository->FindL( aSingleProp, KPartialKeyMask, keys );
+ CleanupStack::Pop(); //keys
+ return keys;
+ }
+
+// ----------------------------------------------------------
+// TXdmSettingsApi::WriteToLog
+//
+// ----------------------------------------------------------
+//
+void TXdmSettingsApi::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KXdmSettingsLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KXdmSettingsLogDir, KXdmSettingsLogFile,
+ EFileLoggingModeAppend, buf );
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::CollectionNamesL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CDesCArray* TXdmSettingsApi::CollectionNamesLC( RArray<TInt>& aSettingIds )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesL()" ) );
+ #endif
+ TInt error = KErrNone;
+ CDesCArrayFlat* propertySet = new ( ELeave ) CDesCArrayFlat( 10 );
+ CleanupStack::PushL( propertySet );
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ RArray<TUint32> nameKeys = FindByTypeL( repository, EXdmPropName );
+ CleanupClosePushL( nameKeys );
+ RArray<TUint32> idKeys = FindByTypeL( repository, EXdmPropSettingsId );
+ CleanupClosePushL( idKeys );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " ID key count: %d" ), idKeys.Count() );
+ WriteToLog( _L8( " Name key count: %d" ), nameKeys.Count() );
+ #endif
+ TInt count = nameKeys.Count();
+ if( count > 0 )
+ {
+ TInt numId = 0;
+ HBufC* name = NULL;
+ TBuf<10> identifier;
+ for( TInt i = 0;i < count;i++ )
+ {
+ identifier.Zero();
+ name = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength );
+ TPtr desc( name->Des());
+ error = repository->Get( nameKeys[i], desc );
+ error = repository->Get( idKeys[i], identifier );
+ if( error == KErrNone && desc.Length() > 0 && identifier.Length() > 0 )
+ {
+ #ifdef _DEBUG
+ HBufC8* eightName = HBufC8::NewLC( desc.Length() );
+ TPtr8 eightDesc( eightName->Des() );
+ eightDesc.Copy( desc );
+ WriteToLog( _L8( " Collection no. %d - Name: %S ID: %S" ), i, &eightDesc, &identifier );
+ CleanupStack::PopAndDestroy(); //eightName
+ #endif
+ propertySet->AppendL( desc );
+ TLex id( identifier );
+ error = id.Val( numId );
+ aSettingIds.Append( error == KErrNone ? numId : error );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Fetching of the name no. %d failed with: %d" ), i, error );
+ #endif
+ }
+ CleanupStack::PopAndDestroy(); //name
+ }
+ }
+ CleanupStack::PopAndDestroy( 3 ); //idKeys, nameKeys, repository
+ return propertySet;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::SettingsCollectionLC
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CXdmSettingsCollection* TXdmSettingsApi::SettingsCollectionL( TInt aSettingsId )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::SettingsCollectionL() - ID: %d" ), aSettingsId );
+ #endif
+ CXdmSettingsCollection* collection = NULL;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ TInt row = FindRowL( aSettingsId, repository );
+ if( row >= KErrNone )
+ {
+ TInt32 key = -1;
+ HBufC* buf = NULL;
+ TInt error = KErrNone;
+ collection = new ( ELeave ) CXdmSettingsCollection();
+ CleanupStack::PushL( collection );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Data in the specified colletion: " ) );
+ #endif
+ for( TInt i = 0;i < KXdmPropertyCount;i++ )
+ {
+ key = ( row * 0x100 ) | i;
+ buf = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength );
+ TPtr desc( buf->Des() );
+ error = repository->Get( key, desc );
+ if( error == KErrNone )
+ {
+ #ifdef _DEBUG
+ HBufC8* eight = HBufC8::NewLC( desc.Length() );
+ TPtr8 eightDesc( eight->Des() );
+ eightDesc.Copy( desc );
+ WriteToLog( _L8( " Property %d [0x%08x]: %S" ), i, key, &eightDesc );
+ CleanupStack::PopAndDestroy(); //eight
+ #endif
+ collection->AppendL( desc, ( TXdmSettingsProperty )i );
+ }
+ CleanupStack::PopAndDestroy(); //buf
+ }
+ CleanupStack::Pop(); //collection
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Could not find the collection, leaves with KErrNotFound" ) );
+ #endif
+ User::Leave( KErrNotFound );
+ }
+ CleanupStack::PopAndDestroy(); //repository
+ return collection;
+ }
+
+// ---------------------------------------------------------
+// TXdmSettingsApi::PropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C HBufC* TXdmSettingsApi::PropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aSingleProp )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "TXdmSettingsApi::PropertyLC()" ) );
+ WriteToLog( _L8( " Property: %d" ), &aSingleProp );
+ WriteToLog( _L8( " Property set ID: %d" ), aSettingsId );
+ #endif
+ HBufC* buf = NULL;
+ TInt error = KErrGeneral;
+ CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
+ CleanupStack::PushL( repository );
+ RArray<TUint32> keys = FindByIdL( aSettingsId, repository );
+ CleanupClosePushL( keys );
+ TInt count = keys.Count();
+ if( count == 1 ) //This is the normal case
+ {
+ TInt32 row = ( keys[0] & 0xFFFFFF00 ) / 0x100;
+ TInt32 key = ( row * 0x100 ) | aSingleProp;
+ buf = HBufC::NewL( NCentralRepositoryConstants::KMaxUnicodeStringLength );
+ TPtr desc( buf->Des() );
+ error = repository->Get( key, desc );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Error: %d" ), error );
+ #endif
+ }
+ else //No keys or too many
+ {
+ #ifdef _DEBUG
+ TBuf8<32> errBuf;
+ count > 0 ? errBuf.Append( _L8( "Too many results" ) ) :
+ errBuf.Append( _L8( "No results found" ) );
+ WriteToLog( _L8( " * Error - %S: %d" ), &errBuf, count );
+ #endif
+ error = count > 0 ? KErrGeneral : KErrNotFound;
+ User::Leave( error );
+ }
+ CleanupStack::PopAndDestroy( 2 ); //keys, repository
+ return buf;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/src/XdmSettingsCollection.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine settings collection
+*
+*/
+
+
+
+#include "XdmSettingsApi.h"
+#include "XdmSettingsProperty.h"
+#include "XdmSettingsCollection.h"
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::SetPropCollectionL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CXdmSettingsCollection::CXdmSettingsCollection()
+ {
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::~CXdmSettingsCollection
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CXdmSettingsCollection::~CXdmSettingsCollection()
+ {
+ iPropCollection.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::Property
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TPtrC CXdmSettingsCollection::Property( TXdmSettingsProperty aProperty ) const
+ {
+ CXdmSettingsProperty* property = Find( aProperty );
+ return property ? property->PropertyValue(): TPtrC();
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::Property
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const CXdmSettingsProperty& CXdmSettingsCollection::Property( TInt aIndex ) const
+ {
+ __ASSERT_ALWAYS( aIndex >= 0 && aIndex < iPropCollection.Count(),
+ User::Panic( _L( "CXdmSettingsCollection" ), 0 ) );
+ return *iPropCollection[aIndex];
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::Count
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CXdmSettingsCollection::Count() const
+ {
+ return iPropCollection.Count();
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::AppendL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void CXdmSettingsCollection::AppendL( const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName )
+ {
+ CXdmSettingsProperty* prop = CXdmSettingsProperty::NewL( aPropertyValue, aPropertyName );
+ CleanupStack::PushL( prop );
+ User::LeaveIfError( iPropCollection.Append( prop ) );
+ CleanupStack::Pop(); //property
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::RemoveL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void CXdmSettingsCollection::RemoveL( TXdmSettingsProperty aPropertyName )
+ {
+ CXdmSettingsProperty* property = Find( aPropertyName );
+ if( property )
+ {
+ TInt index = iPropCollection.Find( property );
+ iPropCollection.Remove( index );
+ delete property;
+ property = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsCollection::Find
+//
+// ---------------------------------------------------------
+//
+CXdmSettingsProperty* CXdmSettingsCollection::Find( TXdmSettingsProperty aProperty ) const
+ {
+ TBool found = EFalse;
+ CXdmSettingsProperty* property = NULL;
+ const TInt count = iPropCollection.Count();
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ if( iPropCollection[i]->PropertyName() == aProperty )
+ {
+ found = ETrue;
+ property = iPropCollection[i];
+ }
+ }
+ return property;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/XdmSettingsApi/src/XdmSettingsProperty.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine settings property
+*
+*/
+
+
+
+#include "XdmSettingsApi.h"
+#include "XdmSettingsProperty.h"
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::SetPropCollectionL
+//
+// ---------------------------------------------------------
+//
+CXdmSettingsProperty::CXdmSettingsProperty( TXdmSettingsProperty aPropertyName ) :
+ iPropertyName( aPropertyName )
+ {
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXdmSettingsProperty::ConstructL( const TDesC& aPropertyValue )
+ {
+ iPropertyValue = HBufC::NewL( aPropertyValue.Length() );
+ iPropertyValue->Des().Copy( aPropertyValue );
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::SetPropCollectionL
+//
+// ---------------------------------------------------------
+//
+CXdmSettingsProperty::~CXdmSettingsProperty()
+ {
+ delete iPropertyValue;
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::SetPropCollectionL
+//
+// ---------------------------------------------------------
+//
+CXdmSettingsProperty* CXdmSettingsProperty::NewL( const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName )
+ {
+ CXdmSettingsProperty* self = new ( ELeave ) CXdmSettingsProperty( aPropertyName );
+ CleanupStack::PushL( self );
+ self->ConstructL( aPropertyValue );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::SetPropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TXdmSettingsProperty CXdmSettingsProperty::PropertyName() const
+ {
+ return iPropertyName;
+ }
+
+// ---------------------------------------------------------
+// CXdmSettingsProperty::SetPropertyL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TPtrC CXdmSettingsProperty::PropertyValue() const
+ {
+ return iPropertyValue != NULL ? iPropertyValue->Des() : TPtrC();
+ }
+
+
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/cenrep/backup_registration.xml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+ <proxy_data_manager sid = "0x10202BE9" />
+ <restore requires_reboot = "no"/>
+</backup_registration>
Binary file XDMEngine/cenrep/keys_xdmengine.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/eabi/XdmEngineU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,140 @@
+EXPORTS
+ _ZN10CXdmEngine12CancelUpdateEP12CXdmDocument @ 1 NONAME
+ _ZN10CXdmEngine12CancelUpdateEP13CXdmDirectory @ 2 NONAME
+ _ZN10CXdmEngine13XdmSettingsLCER6RArrayIiE @ 3 NONAME
+ _ZN10CXdmEngine19CreateDocumentNodeLEv @ 4 NONAME
+ _ZN10CXdmEngine20CreateDocumentModelLERK7TDesC1611TXdmDocType @ 5 NONAME
+ _ZN10CXdmEngine20DeleteDocumentModelLEPK12CXdmDocument @ 6 NONAME
+ _ZN10CXdmEngine21CreateDirectoryModelLERK7TDesC16 @ 7 NONAME
+ _ZN10CXdmEngine21DeleteDirectoryModelLEPK13CXdmDirectory @ 8 NONAME
+ _ZN10CXdmEngine4NewLERK16CXdmProtocolInfo @ 9 NONAME
+ _ZN10CXdmEngine7UpdateLEP12CXdmDocumentR14TRequestStatus @ 10 NONAME
+ _ZN10CXdmEngine7UpdateLER14TRequestStatusP13CXdmDirectory15TDirUpdatePhase @ 11 NONAME
+ _ZN12CXdmDocument10FetchDataLEP16CXdmDocumentNode @ 12 NONAME
+ _ZN12CXdmDocument11DeleteDataLEP16CXdmDocumentNode @ 13 NONAME
+ _ZN12CXdmDocument11ResetSubsetEv @ 14 NONAME
+ _ZN12CXdmDocument14AppendToModelLEP16CXdmDocumentNodeS1_ @ 15 NONAME
+ _ZN12CXdmDocument14BaseConstructLEiRK6TDesC8 @ 16 NONAME
+ _ZN12CXdmDocument14BaseConstructLEiRK7TDesC16 @ 17 NONAME
+ _ZN12CXdmDocument15DocumentSubsetLERK7TDesC16 @ 18 NONAME
+ _ZN12CXdmDocument15ReplaceInModelLEP16CXdmDocumentNodeS1_ @ 19 NONAME
+ _ZN12CXdmDocument16RemoveFromModelLEP16CXdmDocumentNode @ 20 NONAME
+ _ZN12CXdmDocument7AppendLEP16CXdmDocumentNode @ 21 NONAME
+ _ZN12CXdmDocument7InsertLEP16CXdmDocumentNode @ 22 NONAME
+ _ZN12CXdmDocument8ReplaceLEP16CXdmDocumentNodeS1_ @ 23 NONAME
+ _ZN12CXdmDocument8ReplaceLEv @ 24 NONAME
+ _ZN12CXdmDocumentC2ER10CXdmEngine @ 25 NONAME
+ _ZN12CXdmDocumentD0Ev @ 26 NONAME
+ _ZN12CXdmDocumentD1Ev @ 27 NONAME
+ _ZN12CXdmDocumentD2Ev @ 28 NONAME
+ _ZN13CXdmDirectory14BaseConstructLERK7TDesC16 @ 29 NONAME
+ _ZN13CXdmDirectoryC2ER10CXdmEngine @ 30 NONAME
+ _ZN13CXdmDirectoryD0Ev @ 31 NONAME
+ _ZN13CXdmDirectoryD1Ev @ 32 NONAME
+ _ZN13CXdmDirectoryD2Ev @ 33 NONAME
+ _ZN13CXdmLogWriter4NewLERK7TDesC16 @ 34 NONAME
+ _ZN14XdmStaticUtils16CheckFileExistsLER3RFsRK7TDesC16 @ 35 NONAME
+ _ZN14XdmStaticUtils17CleanUpDirectoryLER3RFsRK7TDesC16 @ 36 NONAME
+ _ZN14XdmStaticUtils17GenerateFileNameLER3RFsRK7TDesC16S4_ @ 37 NONAME
+ _ZN15TXdmCredentialsC1ERK7TDesC16S2_ @ 38 NONAME
+ _ZN15TXdmCredentialsC1Ev @ 39 NONAME
+ _ZN15TXdmCredentialsC2ERK7TDesC16S2_ @ 40 NONAME
+ _ZN15TXdmCredentialsC2Ev @ 41 NONAME
+ _ZN16CXdmDocumentNode11SetLeafNodeEi @ 42 NONAME
+ _ZN16CXdmDocumentNode11SetNextNodeEPS_ @ 43 NONAME
+ _ZN16CXdmDocumentNode12SetEmptyNodeEi @ 44 NONAME
+ _ZN16CXdmDocumentNode14BaseConstructLERK7TDesC16 @ 45 NONAME
+ _ZN16CXdmDocumentNode14CopyConstructLERKS_S1_ @ 46 NONAME
+ _ZN16CXdmDocumentNode16AppendChileNodeLEPS_ @ 47 NONAME
+ _ZN16CXdmDocumentNode16CreateAttributeLERK7TDesC16 @ 48 NONAME
+ _ZN16CXdmDocumentNode16CreateAttributeLEv @ 49 NONAME
+ _ZN16CXdmDocumentNode16CreateChileNodeLERK7TDesC16 @ 50 NONAME
+ _ZN16CXdmDocumentNode16CreateChileNodeLEv @ 51 NONAME
+ _ZN16CXdmDocumentNode16InsertChileNodeLEiPS_ @ 52 NONAME
+ _ZN16CXdmDocumentNode16RemoveChileNodeLEPS_ @ 53 NONAME
+ _ZN16CXdmDocumentNode17ReplaceChileNodeLEPS_S0_ @ 54 NONAME
+ _ZN16CXdmDocumentNode19SetLeafNodeContentLERK6TDesC8 @ 55 NONAME
+ _ZN16CXdmDocumentNode19SetLeafNodeContentLERK7TDesC16 @ 56 NONAME
+ _ZN16CXdmDocumentNode5PrintEv @ 57 NONAME
+ _ZN16CXdmDocumentNode8SetNameLERK6TDesC8 @ 58 NONAME
+ _ZN16CXdmDocumentNode8SetNameLERK7TDesC16 @ 59 NONAME
+ _ZN16CXdmDocumentNodeC2ER10CXdmEngineR15MXdmNodeFactory @ 60 NONAME
+ _ZN16CXdmDocumentNodeC2ER10CXdmEngineR15MXdmNodeFactoryPS_ @ 61 NONAME
+ _ZN16CXdmDocumentNodeC2EiR10CXdmEngineR15MXdmNodeFactoryPS_ @ 62 NONAME
+ _ZN16CXdmDocumentNodeD0Ev @ 63 NONAME
+ _ZN16CXdmDocumentNodeD1Ev @ 64 NONAME
+ _ZN16CXdmDocumentNodeD2Ev @ 65 NONAME
+ _ZN16CXdmProtocolInfo11SetSecurityEi @ 66 NONAME
+ _ZN16CXdmProtocolInfo13SetCacheUsageEi @ 67 NONAME
+ _ZN16CXdmProtocolInfo14SetCredentialsE15TXdmCredentials @ 68 NONAME
+ _ZN16CXdmProtocolInfo4NewLEi @ 69 NONAME
+ _ZN16CXdmProtocolInfo4NewLEiiRK7TDesC16 @ 70 NONAME
+ _ZN16CXdmProtocolInfoD0Ev @ 71 NONAME
+ _ZN16CXdmProtocolInfoD1Ev @ 72 NONAME
+ _ZN16CXdmProtocolInfoD2Ev @ 73 NONAME
+ _ZN17CXdmNodeAttribute14BaseConstructLERK7TDesC16 @ 74 NONAME
+ _ZN17CXdmNodeAttribute18SetAttributeValueLERK6TDesC8 @ 75 NONAME
+ _ZN17CXdmNodeAttribute18SetAttributeValueLERK7TDesC16 @ 76 NONAME
+ _ZN17CXdmNodeAttributeC2ER10CXdmEngineR15MXdmNodeFactory @ 77 NONAME
+ _ZN17CXdmNodeAttributeC2ER10CXdmEngineR15MXdmNodeFactoryP16CXdmDocumentNode @ 78 NONAME
+ _ZN17CXdmNodeAttributeD0Ev @ 79 NONAME
+ _ZN17CXdmNodeAttributeD1Ev @ 80 NONAME
+ _ZN17CXdmNodeAttributeD2Ev @ 81 NONAME
+ _ZNK10CXdmEngine18DocumentCollectionEv @ 82 NONAME
+ _ZNK10CXdmEngine19DirectoryCollectionEv @ 83 NONAME
+ _ZNK12CXdmDocument4FindERK16CXdmDocumentNodeR13RPointerArrayIS0_E @ 84 NONAME
+ _ZNK12CXdmDocument4FindERK7TDesC16R13RPointerArrayI16CXdmDocumentNodeE @ 85 NONAME
+ _ZNK12CXdmDocument4FindERK7TDesC16R13RPointerArrayI16CXdmDocumentNodeERKS3_I15SXdmAttribute16E @ 86 NONAME
+ _ZNK12CXdmDocument4FindERK7TDesC16R13RPointerArrayI17CXdmNodeAttributeE @ 87 NONAME
+ _ZNK12CXdmDocument4NameEv @ 88 NONAME
+ _ZNK12CXdmDocumenteqERS_ @ 89 NONAME
+ _ZNK13CXdmLogWriter10WriteToLogERK6TDesC8 @ 90 NONAME
+ _ZNK13CXdmLogWriter10WriteToLogERK7TDesC16 @ 91 NONAME
+ _ZNK16CXdmDocumentNode10IsLeafNodeEv @ 92 NONAME
+ _ZNK16CXdmDocumentNode11ElementTypeEv @ 93 NONAME
+ _ZNK16CXdmDocumentNode11IsEmptyNodeEv @ 94 NONAME
+ _ZNK16CXdmDocumentNode12HasAttributeERK7TDesC16 @ 95 NONAME
+ _ZNK16CXdmDocumentNode13ElementDataLCEv @ 96 NONAME
+ _ZNK16CXdmDocumentNode14AttributeCountEv @ 97 NONAME
+ _ZNK16CXdmDocumentNode15LeafNodeContentEv @ 98 NONAME
+ _ZNK16CXdmDocumentNode18EightBitNodeNameLCEv @ 99 NONAME
+ _ZNK16CXdmDocumentNode23EscapeLeafNodeContentLCEv @ 100 NONAME
+ _ZNK16CXdmDocumentNode4FindERK7TDesC16R13RPointerArrayIS_E @ 101 NONAME
+ _ZNK16CXdmDocumentNode4FindERK7TDesC16R13RPointerArrayIS_ERKS3_I15SXdmAttribute16E @ 102 NONAME
+ _ZNK16CXdmDocumentNode4FindERKS_R13RPointerArrayIS_E @ 103 NONAME
+ _ZNK16CXdmDocumentNode5MatchERK7TDesC16RK13RPointerArrayI14SXdmAttribute8E @ 104 NONAME
+ _ZNK16CXdmDocumentNode5MatchERKS_ @ 105 NONAME
+ _ZNK16CXdmDocumentNode6ParentEv @ 106 NONAME
+ _ZNK16CXdmDocumentNode8NextNodeEv @ 107 NONAME
+ _ZNK16CXdmDocumentNode8NodeNameEv @ 108 NONAME
+ _ZNK16CXdmDocumentNode9AttributeERK7TDesC16 @ 109 NONAME
+ _ZNK16CXdmDocumentNode9AttributeEi @ 110 NONAME
+ _ZNK16CXdmDocumentNode9ChileNodeEi @ 111 NONAME
+ _ZNK16CXdmDocumentNode9NodeCountEv @ 112 NONAME
+ _ZNK16CXdmDocumentNodeeqERKS_ @ 113 NONAME
+ _ZNK16CXdmProtocolInfo10SettingsIDEv @ 114 NONAME
+ _ZNK16CXdmProtocolInfo11AccessPointEv @ 115 NONAME
+ _ZNK16CXdmProtocolInfo11CredentialsEv @ 116 NONAME
+ _ZNK16CXdmProtocolInfo11ProtocolUidEv @ 117 NONAME
+ _ZNK16CXdmProtocolInfo14IsCacheEnabledEv @ 118 NONAME
+ _ZNK16CXdmProtocolInfo4RootEv @ 119 NONAME
+ _ZNK16CXdmProtocolInfo8IsSecureEv @ 120 NONAME
+ _ZNK17CXdmNodeAttribute11ElementTypeEv @ 121 NONAME
+ _ZNK17CXdmNodeAttribute14AttributeValueEv @ 122 NONAME
+ _ZNK17CXdmNodeAttribute14EscapedValueLCEv @ 123 NONAME
+ _ZNK17CXdmNodeAttribute15EightBitValueLCEv @ 124 NONAME
+ _ZTI10CXdmEngine @ 125 NONAME ; #<TI>#
+ _ZTI12CXdmDocument @ 126 NONAME ; #<TI>#
+ _ZTI13CXdmDirectory @ 127 NONAME ; #<TI>#
+ _ZTI13CXdmLogWriter @ 128 NONAME ; #<TI>#
+ _ZTI16CXdmDocumentNode @ 129 NONAME ; #<TI>#
+ _ZTI16CXdmProtocolInfo @ 130 NONAME ; #<TI>#
+ _ZTI17CXdmNodeAttribute @ 131 NONAME ; #<TI>#
+ _ZTV10CXdmEngine @ 132 NONAME ; #<VT>#
+ _ZTV12CXdmDocument @ 133 NONAME ; #<VT>#
+ _ZTV13CXdmDirectory @ 134 NONAME ; #<VT>#
+ _ZTV13CXdmLogWriter @ 135 NONAME ; #<VT>#
+ _ZTV16CXdmDocumentNode @ 136 NONAME ; #<VT>#
+ _ZTV16CXdmProtocolInfo @ 137 NONAME ; #<VT>#
+ _ZTV17CXdmNodeAttribute @ 138 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/group/XdmEngine.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xdmengine.dll
+UID 0x1000008d 0x1020740E
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+TARGETTYPE DLL
+
+SOURCEPATH ../src
+
+SOURCE XdmEngine.cpp
+SOURCE XdmDocument.cpp
+SOURCE XdmDirectory.cpp
+SOURCE XdmLogWriter.cpp
+SOURCE XdmStaticUtils.cpp
+SOURCE XdmCredentials.cpp
+SOURCE XdmProtocolInfo.cpp
+SOURCE XdmDocumentNode.cpp
+SOURCE XdmNodeAttribute.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../pressrv_dom/xdm_api/inc
+//USERINCLUDE ../XdmSettingsApi/inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY charconv.lib
+LIBRARY flogger.lib
+LIBRARY xdmsettingsapi.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../BWINSCW/
+#elif defined (WINS )
+deffile ../bwins/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine build file
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+//--------------------
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_EXPORTS
+//--------------------
+
+../Conf/xdmengine.confml MW_LAYER_CONFML(xdmengine.confml)
+../Conf/xdmengine_10207453.crml MW_LAYER_CRML(xdmengine_10207453.crml)
+../Conf/xdmengine_10282384.crml MW_LAYER_CRML(xdmengine_10282384.crml)
+
+//For _DEBUG
+../inc/XdmLogWriter.h |../../inc/xdmlogwriter.h
+
+//Backup registry
+../cenrep/backup_registration.xml z:/private/10207421/backup_registration.xml
+
+// IBYs
+../rom/XdmEngine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(xdmengine.iby)
+../rom/XdmEngineResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(xdmengineresources.iby)
+
+// LOC (note: This would be better in XdmProvisioning's bld.inf, but since it is not used, it is here.)
+../XdmProvisioning/loc/xdmprovisioningadapter.loc MW_LAYER_LOC_EXPORT_PATH(xdmprovisioningadapter.loc)
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+../XdmSettingsApi/group/XdmSettingsApi.mmp
+XdmEngine.mmp
+../XdmProvisioning/group/xdmprovisioning.mmp
+../XdmDeviceManagement/group/xdmdevicemanagementadapter.mmp
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/group/bld_engine.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+XdmEngine.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/inc/XdmEngineDefines.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine defines
+*
+*/
+
+
+
+
+#ifndef __XdmENGINEDEFINES__
+#define __XdmENGINEDEFINES__
+
+#include <e32base.h>
+
+//General defines
+_LIT8( KGeneralEqualsAndQuotes, "=\"" );
+_LIT8( KGeneralQuotes, "\"" );
+
+//Xdm specific defines
+const TInt KXdmPathSeparator = 47;
+
+//XCAP specific defines
+_LIT8( KXCAPEquality, "=" );
+_LIT8( KXCAPNodeSeparator, "~~" );
+_LIT8( KXCAPPathSeparator, "/" );
+_LIT8( KXCAPAttributeIdentifier, "@" );
+
+//HTTP specific defines
+_LIT8( KHTTPAngleBracketOpen, "%5b");
+_LIT8( KHTTPAngleBracketClose, "%5d");
+_LIT8( KHTTPAngleQuotationMark, "%22");
+
+//XML specific defines
+_LIT8( KXmlSpace, " ");
+#endif //__XdmENGINEDEFINES__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/inc/XdmLogWriter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine log writer
+*
+*/
+
+
+
+
+#ifndef __XDMLOGWRITER__
+#define __XDMLOGWRITER__
+
+#include <e32base.h>
+
+_LIT( KXdmLogDir, "XDM" );
+_LIT( KXdmLogFileExt, ".txt" );
+_LIT( KXdmLogRoot, "C:\\logs\\" );
+
+//Determines how many log file instances are
+//retained until the directory is cleaned up
+/* E.g. XdmEngine1.txt, XdmEngine2.txt ... XdmEngine10.txt */
+const TInt KMaxLogFiles = 10;
+
+/* Default size of the log buffer */
+const TInt KLogBufferMaxSize = 2000;
+
+// CLASS DECLARATION
+class CXdmLogWriter : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ *
+ * @param TDesC& The log file name
+ * @return CXdmLogWriter* A log writer instance
+ */
+ IMPORT_C static CXdmLogWriter* NewL( const TDesC& aLogName );
+
+ /**
+ * Write a log string.
+ *
+ * @param TDesC& Log string in 16-bit
+ * @return void
+ */
+ IMPORT_C void WriteToLog( const TDesC& aLogLine ) const;
+
+ /**
+ * Write a log string.
+ *
+ * @param TDesC8& Log string in 8-bit
+ * @return void
+ */
+ IMPORT_C void WriteToLog( const TDesC8& aLogLine ) const;
+
+ /**
+ * Destructor
+ */
+ virtual ~CXdmLogWriter();
+
+ private:
+
+ /**
+ * C++ constructor is private
+ */
+ CXdmLogWriter();
+
+ /**
+ * Symbian OS second-phase constructor
+ * @param TDesC& Name of the log file to write to
+ * @return void
+ */
+ void ConstructL( const TDesC& aLogName );
+
+ private: //Data
+
+ HBufC* iLogFileName;
+
+ };
+
+#endif //__XDMLOGWRITER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/inc/XdmStaticUtils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine static utils
+*
+*/
+
+
+
+
+#ifndef __XDMSTATICUTILS__
+#define __XDMSTATICUTILS__
+
+#include <e32base.h>
+
+const TInt KBackSlash = 92;
+
+class RFs;
+
+// CLASS DECLARATION
+class XdmStaticUtils
+
+ {
+ public:
+
+ /**
+ * Check whether a file already exists.
+ *
+ * @param RFs& An opened file session
+ * @param TDesC& The file name to check
+ * @return TBool Is the file already there
+ */
+ IMPORT_C static TBool CheckFileExistsL( RFs& aFileSession, const TDesC& aFileName );
+
+ /**
+ * Generate a new file name unique in the context
+ * of the folder in which it resides
+ *
+ * @param RFs& An opened file session
+ * @param TDesC& The file name to check
+ * @param TDesC& The extension in the filename
+ * @return HBufC* The generated filename
+ */
+ IMPORT_C static HBufC* GenerateFileNameL( RFs& aFileSession, const TDesC& aFileName,
+ const TDesC& aExtension );
+
+ /**
+ * Clean up a directory
+ *
+ * @param RFs& An opened file session
+ * @param TDesC& The directory to clean up
+ * @return void
+ */
+ IMPORT_C static void CleanUpDirectoryL( RFs& aFileSession, const TDesC& aDirectory );
+
+ };
+
+#endif //__XDMCREDENTIALS__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/rom/XdmEngine.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine rom file
+*
+*/
+
+
+
+
+#ifndef __XDMENGINE_IBY__
+#define __XDMENGINE_IBY__
+
+#ifdef __XDM
+ file=ABI_DIR\BUILD_DIR\XdmEngine.dll SHARED_LIB_DIR\XdmEngine.dll
+ file=ABI_DIR\BUILD_DIR\XdmXmlParser.dll SHARED_LIB_DIR\XdmXmlParser.dll
+ file=ABI_DIR\BUILD_DIR\XdmSettingsApi.dll SHARED_LIB_DIR\XdmSettingsApi.dll
+ ECOM_PLUGIN( XdmDeviceManagementAdapter.dll, 10275112.rsc)
+ ECOM_PLUGIN( XdmProvisioning.dll, 1028237A.rsc)
+#endif //__XDM
+
+#endif //__XDMENGINE_IBY__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/rom/XdmEngineResources.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Application resource files for ROM image compilation.
+*
+*/
+
+
+
+#ifndef __XDMENGINE_RESOURCES_IBY__
+#define __XDMENGINE_RESOURCES_IBY__
+
+//
+// Settings provisioning adapter plugin resources
+//
+data=DATAZ_\RESOURCE_FILES_DIR\XdmProvisioningTexts.RSC RESOURCE_FILES_DIR\XdmProvisioningTexts.RSC
+
+#endif //__XDMENGINE_RESOURCES_IBY__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmCredentials.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine credentials
+*
+*/
+
+
+
+#include "XdmCredentials.h"
+
+// ---------------------------------------------------------
+// TXdmCredentials::TXdmCredentials
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TXdmCredentials::TXdmCredentials()
+ {
+ }
+
+// ---------------------------------------------------------
+// TXdmCredentials::TXdmCredentials
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TXdmCredentials::TXdmCredentials( const TDesC& aUserName,
+ const TDesC& aPassword )
+ {
+ iUserName.Copy( aUserName );
+ iPassword.Copy( aPassword );
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmDirectory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine directory
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XdmEngine.h"
+
+// ----------------------------------------------------------
+// CXdmDirectory::CXdmDirectory
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDirectory::CXdmDirectory( CXdmEngine& aXdmEngine ) :
+ CActive( EPriorityStandard ),
+ iFileCount( KErrNotReady ),
+ iXdmEngine( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmDirectory::BaseConstructL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDirectory::BaseConstructL( const TDesC& aDirectoryPath )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDirectory::ConstructL()" ) );
+ #endif
+ iDirectoryPath = aDirectoryPath.AllocL();
+ iDirectoryPath->Des().Copy( aDirectoryPath );
+ }
+
+// ----------------------------------------------------------
+// CXdmDirectory::CXdmDirectory
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDirectory::~CXdmDirectory()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDirectory::~CXdmDirectory()" ) );
+ #endif
+ delete iDirectoryPath;
+ }
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmDocument.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,506 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine document
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include "XdmEngine.h"
+#include "XdmProtocol.h"
+#include "XdmDocument.h"
+#include "XdmOperation.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+#include "XdmOperationFactory.h"
+
+// ----------------------------------------------------------
+// CXdmDocument::CXdmDocument
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocument::CXdmDocument( CXdmEngine& aXdmEngine ) :
+ CActive( EPriorityStandard ),
+ iDocSubset( EFalse ),
+ iXdmEngine( aXdmEngine )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmDocument::BaseConstructL( 16-bit )
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocument::BaseConstructL( TInt aOperationFactoryUid,
+ const TDesC& aDocumentName )
+ {
+ delete iDocumentName;
+ iDocumentName = NULL;
+ iDocumentName = HBufC::NewL( aDocumentName.Length() );
+ iDocumentName->Des().Copy( aDocumentName );
+ iOperationFactory = CXdmOperationFactory::NewL( aOperationFactoryUid );
+ }
+
+// ----------------------------------------------------------
+// CXdmDocument::BaseConstructL( 8-bit )
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocument::BaseConstructL( TInt aOperationFactoryUid,
+ const TDesC8& aDocumentName )
+ {
+ delete iDocumentName;
+ iDocumentName = NULL;
+ iDocumentName = HBufC::NewL( aDocumentName.Length() );
+ iDocumentName->Des().Copy( aDocumentName );
+ iOperationFactory = CXdmOperationFactory::NewL( aOperationFactoryUid );
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::~CXdmDocument
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocument::~CXdmDocument()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::~CXdmDocument()" ) );
+ #endif
+ delete iDocumentName;
+ EmptyOperationQueue();
+ iChangeRequests.Close();
+ delete iOperationFactory;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocument::EmptyOperationQueue
+//
+// ---------------------------------------------------------
+//
+void CXdmDocument::EmptyOperationQueue()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::EmptyOperationQueue()" ) );
+ #endif
+ MXdmOperation* operation = NULL;
+ TInt count = iChangeRequests.Count();
+ for( TInt i = 0;i < count;i++ )
+ {
+ operation = iChangeRequests[i];
+ iChangeRequests.Remove( i );
+ operation->Destroy();
+ operation = NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::FetchDataL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::FetchDataL( CXdmDocumentNode* aDocNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::FetchDataL()" ) );
+ #endif
+ MXdmOperation* operation = iOperationFactory->FetchL( *this, aDocNode );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::ReplaceL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::ReplaceL( CXdmDocumentNode* aOldNode,
+ CXdmDocumentNode* aNewNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::ReplaceL()" ) );
+ #endif
+ if( aOldNode->Parent() == aNewNode->Parent() )
+ {
+ MXdmOperation* operation = iOperationFactory->ReplaceL(
+ *this, aOldNode, aNewNode );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Different parents, leaves!" ) );
+ #endif
+ User::Leave( KErrGeneral );
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::ReplaceL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::ReplaceL()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::ReplaceL()" ) );
+ #endif
+ MXdmOperation* operation = iOperationFactory->ReplaceL( *this, NULL, NULL );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::InsertL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::InsertL( CXdmDocumentNode* aDocNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::InsertL()" ) );
+ #endif
+ __ASSERT_DEBUG( aDocNode != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ MXdmOperation* operation = iOperationFactory->InsertL(
+ *this, aDocNode );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::AppendL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::AppendL( CXdmDocumentNode* aDocNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::AppendL()" ) );
+ #endif
+ MXdmOperation* operation =
+ iOperationFactory->AppendL( *this, aDocNode );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::DeleteDataL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::DeleteDataL( CXdmDocumentNode* aDocNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::DeleteDataL()" ) );
+ #endif
+ MXdmOperation* operation = aDocNode == NULL ?
+ iOperationFactory->DeletionL( *this, NULL ) :
+ iOperationFactory->DeletionL( *this, aDocNode );
+ CleanupStack::PushL( operation );
+ User::LeaveIfError( iChangeRequests.Append( operation ) );
+ CleanupStack::Pop(); //operation
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::Find
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXdmDocument::Find( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::Find()" ) );
+ #endif
+ TInt error = KErrNone;
+ CXdmDocumentNode* root = DocumentRoot();
+ __ASSERT_ALWAYS( root != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ if( root->NodeName().Compare( aTargetNode.NodeName() ) == 0 )
+ {
+ TBool found = EFalse;
+ TInt attrCount = root->AttributeCount();
+ TInt attrCount2 = aTargetNode.AttributeCount();
+ if( attrCount > 0 && attrCount == attrCount2 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < attrCount;i++ )
+ {
+ attribute.iName.Set( aTargetNode.Attribute( i )->NodeName() );
+ attribute.iValue.Set( aTargetNode.Attribute( i )->AttributeValue() );
+ found = root->HasAttribute( attribute );
+ }
+ }
+ error = found ? aResultArray.Append( root ) : KErrNotFound;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Root does not match, search child nodes" ) );
+ #endif
+ error = root->Find( aTargetNode, aResultArray );
+ }
+ TInt count = aResultArray.Count();
+ return error == KErrNone && count > 0 ? count : KErrNotFound;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::Find
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXdmDocument::Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::Find()" ) );
+ #endif
+ TInt error = KErrNone;
+ CXdmDocumentNode* root = DocumentRoot();
+ __ASSERT_ALWAYS( root != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ if( root->NodeName().Compare( aNodeName ) == 0 )
+ {
+ TBool found = EFalse;
+ TInt attrCount = root->AttributeCount();
+ if( attrCount > 0 )
+ {
+ for( TInt i = 0;i < attrCount;i++ )
+ found = root->HasAttribute( *aAttributeArray[i] );
+ }
+ error = found ? aResultArray.Append( root ) : KErrNotFound;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Root does not match, search child nodes" ) );
+ #endif
+ error = root->Find( aNodeName, aResultArray, aAttributeArray );
+ }
+ TInt count = aResultArray.Count();
+ return error == KErrNone && count > 0 ? count : KErrNotFound;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::Find
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXdmDocument::Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::Find()" ) );
+ #endif
+ TInt error = KErrNone;
+ CXdmDocumentNode* root = DocumentRoot();
+ __ASSERT_ALWAYS( root != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ if( root->NodeName().Compare( aNodeName ) == 0 )
+ error = aResultArray.Append( root );
+ else
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Root does not match, search child nodes" ) );
+ #endif
+ error = root->Find( aNodeName, aResultArray );
+ }
+ TInt count = aResultArray.Count();
+ return error == KErrNone && count > 0 ? count : KErrNotFound;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::operator==
+//
+// ----------------------------------------------------
+//
+EXPORT_C TBool CXdmDocument::operator==( CXdmDocument& aDocument ) const
+ {
+ CXdmDocumentNode* root1 = DocumentRoot();
+ CXdmDocumentNode* root2 = aDocument.DocumentRoot();
+ __ASSERT_ALWAYS( root1 != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ __ASSERT_ALWAYS( root2 != NULL, User::Panic( _L( "CXcapDocument" ), EDocNodeNull ) );
+ return Name().Compare( aDocument.Name() ) == 0 ? *root1 == *root2 : EFalse;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::Name
+//
+// ----------------------------------------------------
+//
+EXPORT_C TPtrC CXdmDocument::Name() const
+ {
+ return iDocumentName != NULL ? iDocumentName->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::Find
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXdmDocument::Find( const TDesC& aAttributeName,
+ RPointerArray<CXdmNodeAttribute>& aResultArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::Find()" ) );
+ #endif
+ TInt error = KErrNone;
+ CXdmDocumentNode* root = DocumentRoot();
+ __ASSERT_ALWAYS( root != NULL, User::Panic( _L( "CXdmDocument" ), EDocNodeNull ) );
+ error = DoFindAttributes( root, aAttributeName, aResultArray );
+ TInt count = aResultArray.Count();
+ return error == KErrNone && count > 0 ? count : KErrNotFound;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::RemoveFromModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::RemoveFromModelL( CXdmDocumentNode* aChileNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::RemoveFromModel()" ) );
+ #endif
+ if( !iDocSubset )
+ {
+ CXdmDocumentNode* parent = aChileNode->Parent();
+ parent != NULL ? parent->RemoveChileNodeL( aChileNode ) : User::Leave( KErrArgument);
+ }
+ else User::Leave( KErrGeneral );
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::ResetSubset
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::ResetSubset()
+ {
+ iDocSubset = EFalse;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::AppendToModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::AppendToModelL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aParentNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::AppendToModelL()" ) );
+ #endif
+ if( !iDocSubset )
+ {
+ if( aNewNode != NULL && aParentNode != NULL )
+ aParentNode->AppendChileNodeL( aNewNode );
+ }
+ else User::Leave( KErrGeneral );
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::ReplaceInModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocument::ReplaceInModelL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::ReplaceInModelL()" ) );
+ #endif
+ if( !iDocSubset )
+ {
+ CXdmDocumentNode* parent = aTargetNode->Parent();
+ parent != NULL ? parent->ReplaceChileNodeL( aNewNode, aTargetNode ) : User::Leave( KErrArgument);
+ }
+ else User::Leave( KErrGeneral );
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::DocumentSubsetL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocument::DocumentSubsetL( const TDesC& aNodePath )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::DocumentSubsetL()" ) );
+ #endif
+ TBool ready = EFalse;
+ HBufC* temp = HBufC::NewLC( aNodePath.Length() );
+ temp->Des().Copy( aNodePath );
+ TPtr nodePath( temp->Des() );
+ while( !ready && nodePath.Length() != 0 )
+ {
+ TPtrC part;
+ TInt index = nodePath.LocateF( KXdmPathSeparatorChar );
+ if( index > 0 )
+ part.Set( nodePath.Left( index ) );
+ else
+ {
+ part.Set( nodePath );
+ ready = ETrue;
+ }
+ AppendPathPartL( part );
+ nodePath.Delete( 0, index + 1 );
+ }
+ iDocSubset = ETrue;
+ CleanupStack::PopAndDestroy(); //temp
+ return CurrentExtent();
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::DoFindAttributes
+//
+// ----------------------------------------------------
+//
+TInt CXdmDocument::DoFindAttributes( CXdmDocumentNode* aNode,
+ const TDesC& aAttributeName,
+ RPointerArray<CXdmNodeAttribute>& aResultArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocument::DoFindAttributes()" ) );
+ #endif
+ TInt error = KErrNone;
+ CXdmDocumentNode* node = aNode;
+ TInt attrCount = aNode->AttributeCount();
+ for( TInt i = 0; i < attrCount; i++ )
+ {
+ CXdmNodeAttribute* attr = node->Attribute( i );
+ if( !attr->NodeName().CompareF( aAttributeName ) )
+ error = aResultArray.Append( attr );
+ }
+ TInt nodeCount = node->NodeCount();
+ for( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* child = node->ChileNode( i );
+ DoFindAttributes ( child, aAttributeName, aResultArray );
+ }
+ TInt count = aResultArray.Count();
+ return error == KErrNone && count > 0 ? count : KErrNotFound;
+ }
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmDocumentNode.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1143 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine document node
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XdmEngine.h"
+#include "XdmDocument.h"
+#include "XdmNodeFactory.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+
+//XML Escape codes
+_LIT8( KXmlBracketOpenEsc, "<");
+_LIT8( KXmlBracketCloseEsc, ">");
+_LIT8( KXmlAmpersandEsc, "&");
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::CXdmDocumentNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode::CXdmDocumentNode( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory ) :
+ iPosition( KErrNotFound ),
+ iEmptyNode( EFalse ),
+ iXdmEngine( aXdmEngine ),
+ iNodeFactory( aNodeFactory )
+ {
+ }
+
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::CXdmDocumentNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode::CXdmDocumentNode( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode ) :
+ iEmptyNode( EFalse ),
+ iXdmEngine( aXdmEngine ),
+ iNodeFactory( aNodeFactory ),
+ iParentNode( aParentNode )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::CXdmDocumentNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode::CXdmDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode ) :
+ iLeafNode( aLeafNode ),
+ iEmptyNode( EFalse ),
+ iXdmEngine( aXdmEngine ),
+ iNodeFactory( aNodeFactory ),
+ iParentNode( aParentNode )
+
+ {
+
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::ConstructL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::BaseConstructL( const TDesC& aNodeName )
+ {
+ delete iNodeName;
+ iNodeName = NULL;
+ iNodeName = HBufC::NewL( aNodeName.Length() );
+ iNodeName->Des().Copy( aNodeName );
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::CopyConstructL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CopyConstructL()" ) );
+ #endif
+ if( aAnotherNode.ElementType() != EXdmElementAttribute )
+ {
+ ConstructChildrenL( aAnotherNode );
+ ConstructAttributesL( aAnotherNode );
+ }
+ iLeafNode = aAnotherNode.IsLeafNode();
+ iEmptyNode = aAnotherNode.IsEmptyNode();
+ if( iLeafNode )
+ {
+ iLeafContent = HBufC8::New( aAnotherNode.LeafNodeContent().Length() );
+ iLeafContent->Des().Copy( aAnotherNode.LeafNodeContent() );
+ }
+ iParentNode = CONST_CAST( CXdmDocumentNode*, &aParentNode );
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::ConstructAttributesL
+//
+// ----------------------------------------------------------
+//
+void CXdmDocumentNode::ConstructAttributesL( const CXdmDocumentNode& aAnotherNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CopyConstructL()" ) );
+ #endif
+ TInt attrCount = aAnotherNode.AttributeCount();
+ for( TInt i = 0;i < attrCount;i++ )
+ {
+ TPtrC name = aAnotherNode.Attribute( i )->NodeName();
+ TPtrC value = aAnotherNode.Attribute( i )->AttributeValue();
+ CXdmNodeAttribute* attribute = iNodeFactory.AttributeL( name );
+ CleanupStack::PushL( attribute );
+ attribute->SetAttributeValueL( value );
+ User::LeaveIfError( iAttributes.Append( attribute ) );
+ CleanupStack::Pop(); //attribute
+ }
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::ConstructChildrenL
+//
+// ----------------------------------------------------------
+//
+void CXdmDocumentNode::ConstructChildrenL( const CXdmDocumentNode& aAnotherNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::ConstructChildrenL()" ) );
+ #endif
+ TInt childCount = aAnotherNode.NodeCount();
+ for( TInt i = 0;i < childCount;i++ )
+ {
+ CXdmDocumentNode* node = aAnotherNode.ChileNode( i );
+ CXdmDocumentNode* copy = iNodeFactory.ChileNodeL( node );
+ CleanupStack::PushL( copy );
+ User::LeaveIfError( iChildren.Append( copy ) );
+ CleanupStack::Pop(); //copy
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::~CXdmDocumentNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode::~CXdmDocumentNode()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::~CXdmDocumentNode()" ) );
+ #endif
+ delete iNextNode;
+ iNextNode = NULL;
+ delete iLeafContent;
+ delete iNodeName;
+ iChildren.ResetAndDestroy();
+ iChildren.Close();
+ iAttributes.ResetAndDestroy();
+ iAttributes.Close();
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::CreateChileNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocumentNode::CreateChileNodeL()
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CreateChileNodeL()" ) );
+ #endif*/
+ __ASSERT_ALWAYS( !iEmptyNode, User::Panic( _L( "CXdmDocumentNode" ), ENodeNotEmpty ) );
+ CXdmDocumentNode* node = iNodeFactory.ChileNodeL();
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iChildren.Append( node ) );
+ CleanupStack::Pop(); //node
+ return node;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::CreateChileNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocumentNode::CreateChileNodeL( const TDesC& aChildName )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CreateChileNodeL() - Name: %S" ), &aChildName );
+ #endif*/
+ __ASSERT_ALWAYS( !iEmptyNode, User::Panic( _L( "CXdmDocumentNode" ), ENodeNotEmpty ) );
+ CXdmDocumentNode* node = iNodeFactory.ChileNodeL( aChildName );
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iChildren.Append( node ) );
+ CleanupStack::Pop(); //node
+ return node;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::SetLeafNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetLeafNode( const TBool aIsLeafNode )
+ {
+ iLeafNode = aIsLeafNode;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::IsLeafNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::IsLeafNode() const
+ {
+ return iLeafNode;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::SetEmptyNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetEmptyNode( const TBool aIsEmptyNode )
+ {
+ //Do nothing if the state is not being changed
+ if( aIsEmptyNode != iEmptyNode )
+ {
+ if( aIsEmptyNode )
+ {
+ if( !iEmptyNode )
+ {
+ TInt count = iChildren.Count();
+ if( count > 0 )
+ iChildren.ResetAndDestroy();
+ }
+ }
+ iEmptyNode = aIsEmptyNode;
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::IsEmptyNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::IsEmptyNode() const
+ {
+ return iEmptyNode;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute* CXdmDocumentNode::CreateAttributeL()
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CreateAttributeL()" ) );
+ #endif*/
+ CXdmDocumentNode* node = iNodeFactory.AttributeL();
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iAttributes.Append( ( CXdmNodeAttribute* )node ) );
+ CleanupStack::Pop(); //node
+ return ( CXdmNodeAttribute* )node;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute* CXdmDocumentNode::CreateAttributeL( const TDesC& aAttributeName )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::CreateAttributeL() - Name: %S" ), &aAttributeName );
+ #endif*/
+ CXdmDocumentNode* node = iNodeFactory.AttributeL( aAttributeName );
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iAttributes.Append( ( CXdmNodeAttribute* )node ) );
+ CleanupStack::Pop(); //node
+ return ( CXdmNodeAttribute* )node;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::SetLeafNodeContentL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetLeafNodeContentL( const TDesC& aLeafContent )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::SetLeafNodeContentL( 16 ) - Content: %S" ),
+ &aLeafContent );
+ #endif*/
+ if( iLeafNode )
+ {
+ delete iLeafContent;
+ iLeafContent = NULL;
+ iLeafContent = CXdmEngine::ConvertToUTF8L( aLeafContent );
+ }
+ else
+ User::Leave( KErrGeneral );
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::SetLeafNodeContentL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetLeafNodeContentL( const TDesC8& aLeafContent )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::SetLeafNodeContentL( 8 ) - Content: %S" ),
+ &aLeafContent );
+ #endif*/
+ if( iLeafNode )
+ {
+ delete iLeafContent;
+ iLeafContent = NULL;
+ iLeafContent = HBufC8::NewL( aLeafContent.Length() );
+ iLeafContent->Des().Copy( aLeafContent );
+ }
+ else
+ User::Leave( KErrGeneral );
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::ElementData
+//
+// ----------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmDocumentNode::ElementDataLC() const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::ElementDataLC()" ) );
+ #endif*/
+ TInt position = 0;
+ CBufFlat* buffer = CBufFlat::NewL( 48 );
+ CleanupStack::PushL( buffer );
+ buffer->InsertL( position, EightBitNodeNameLC()->Des() );
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC()
+ position = position + NodeName().Length();
+ TInt attributeCount = iAttributes.Count();
+ if( attributeCount > 0 )
+ {
+ for( TInt i = 0;i < attributeCount;i++ )
+ {
+ buffer->InsertL( position, KGeneralSpace );
+ position = position + KGeneralSpace().Length();
+ CXdmNodeAttribute* attribute = iAttributes[i];
+ TPtrC8 name( attribute->EightBitNodeNameLC()->Des() );
+ buffer->InsertL( position, name );
+ position = position + name.Length();
+ buffer->InsertL( position, KGeneralEqualsAndQuotes );
+ position = position + KGeneralEqualsAndQuotes().Length();
+ TPtrC8 value( attribute->EscapedValueLC()->Des() );
+ buffer->InsertL( position, value );
+ position = position + value.Length();
+ buffer->InsertL( position, KGeneralQuotes );
+ position = position + KGeneralQuotes().Length();
+ CleanupStack::PopAndDestroy( 2 ); //EscapedValueLC(),
+ //EightBitNodeNameLC()
+ }
+ }
+ HBufC8* ret = HBufC8::NewL( buffer->Size() );
+ TPtr8 pointer( ret->Des() );
+ buffer->Read( 0, pointer, buffer->Size() );
+ CleanupStack::PopAndDestroy(); //buffer
+ CleanupStack::PushL( ret );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::NodeCount
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TInt CXdmDocumentNode::NodeCount() const
+ {
+ return iNextNode ? 1 : iChildren.Count();
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::NodeCount
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TInt CXdmDocumentNode::AttributeCount() const
+ {
+ return iAttributes.Count();
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Parent
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocumentNode::ChileNode( const TInt aPosition ) const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::ChileNode() - Position: %d" ), aPosition );
+ #endif*/
+ if( iNextNode )
+ return iNextNode;
+ else
+ {
+ TInt count = NodeCount();
+ if( count > 0 && aPosition >= 0 && aPosition < count )
+ return iChildren[aPosition];
+ else return NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Attribute
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute* CXdmDocumentNode::Attribute( const TInt aPosition ) const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Attribute() - Position: %d" ), aPosition );
+ #endif*/
+ TInt count = iAttributes.Count();
+ if( count > 0 && aPosition >= 0 && aPosition < count )
+ return iAttributes[aPosition];
+ else return NULL;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Attribute
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute* CXdmDocumentNode::Attribute( const TDesC& aAttributeName ) const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Attribute() - Name: %S" ), &aAttributeName );
+ #endif*/
+ TInt count = iAttributes.Count();
+ if( count > 0 )
+ {
+ TBool found = EFalse;
+ CXdmNodeAttribute* target = NULL;
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ if( iAttributes[i]->NodeName().Compare( aAttributeName ) == 0 )
+ {
+ target = iAttributes[i];
+ found = ETrue;
+ }
+ }
+ return target;
+ }
+ else return NULL;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Parent
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXdmDocumentNode::LeafNodeContent() const
+ {
+ return iLeafNode && iLeafContent != NULL ? iLeafContent->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Parent
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmDocumentNode::EscapeLeafNodeContentLC() const
+ {
+ return iLeafNode && iLeafContent != NULL ? EscapeDescLC( iLeafContent->Des() ) : NULL;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::SetNextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC CXdmDocumentNode::NodeName() const
+ {
+ return iNodeName != NULL ? iNodeName->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::SetNextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmDocumentNode::EightBitNodeNameLC() const
+ {
+ HBufC8* eightBit = CXdmEngine::ConvertToUTF8L( iNodeName->Des() );
+ CleanupStack::PushL( eightBit );
+ return eightBit;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::SetNextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetNameL( const TDesC& aNodeName )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::SetNameL( 16-Bit ) - Name: %S" ),
+ &aNodeName );
+ #endif*/
+ delete iNodeName;
+ iNodeName = NULL;
+ iNodeName = HBufC::NewL( aNodeName.Length() );
+ iNodeName->Des().Copy( aNodeName );
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::SetNextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetNameL( const TDesC8& aNodeName )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::SetNameL( 8-Bit ) - Name: %S" ),
+ &aNodeName );
+ #endif*/
+ delete iNodeName;
+ iNodeName = NULL;
+ iNodeName = HBufC::NewL( aNodeName.Length() );
+ iNodeName->Des().Copy( aNodeName );
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::ElementType
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocumentNode::Parent() const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Parent()" ) );
+ #endif*/
+ return iParentNode;
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::ElementType
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TXdmElementType CXdmDocumentNode::ElementType() const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::ElementType()" ) );
+ #endif*/
+ return EXdmElementNode;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Match
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::Match( const CXdmDocumentNode& aAnotherNode ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Match()" ) );
+ #endif
+ if( NodeName().Compare( aAnotherNode.NodeName() ) == 0 )
+ {
+ TBool match = ETrue;
+ TInt attrCount = iAttributes.Count();
+ if( attrCount == aAnotherNode.AttributeCount() )
+ {
+ for( TInt i = 0;match && i < attrCount;i++ )
+ match = HasAttribute( *aAnotherNode.Attribute( i ) );
+ }
+ else match = EFalse;
+ return match;
+ }
+ else return EFalse;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::Match
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::Match( const TDesC& aNodeName,
+ const RPointerArray<SXdmAttribute8>&
+ aAttributeArray ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Match()" ) );
+ #endif
+ if( NodeName().Compare( aNodeName ) == 0 )
+ {
+ TBool match = ETrue;
+ TInt attrCount = iAttributes.Count();
+ if( attrCount == aAttributeArray.Count() )
+ {
+ for( TInt i = 0;match && i < attrCount;i++ )
+ match = HasAttributeL( *aAttributeArray[i] );
+ }
+ else match = EFalse;
+ return match;
+ }
+ else return EFalse;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::HasAttribute
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::HasAttribute( const TDesC& aAttributeName ) const
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::HasAttribute()" ) );
+ #endif
+ TInt count = iAttributes.Count();
+ for( TInt i = 0; i < count;i++ )
+ {
+ if( !iAttributes[i]->NodeName().Compare( aAttributeName ) )
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::Print
+// !!! For debugging ONLY !!!
+// ---------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::Print()
+ {
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::Print()" ) );
+ HBufC8* nameBuf = HBufC8::NewLC( iNodeName->Des().Length() );
+ TPtr8 name( nameBuf->Des() );
+ name.Copy( iNodeName->Des() );
+ if( ElementType() == EXdmElementAttribute )
+ {
+ CXdmNodeAttribute* attr = ( CXdmNodeAttribute* )this;
+ TPtrC8 value( attr->EightBitValueLC()->Des() );
+ iXdmEngine.WriteToLog( _L8( "* Name: %S Value: %S" ), &name, &value );
+ CleanupStack::PopAndDestroy(); //value
+ }
+ else
+ {
+ iXdmEngine.WriteToLog( _L8( "* Name: %S" ), &name );
+ TInt count = iAttributes.Count();
+ if( count > 0 )
+ {
+ for( TInt i = 0;i < count;i++ )
+ {
+ CXdmNodeAttribute* attr = iAttributes[i];
+ TPtrC8 value( attr->EightBitValueLC()->Des() );
+ TPtrC8 name( attr->EightBitNodeNameLC()->Des() );
+ iXdmEngine.WriteToLog( _L8( "* Attribute %d - Name: %S Value: %S" ), i, &name, &value );
+ CleanupStack::PopAndDestroy( 2 ); //name, value
+ }
+
+ }
+ if( iLeafNode )
+ {
+ TPtr8 data( iLeafContent->Des() );
+ iXdmEngine.WriteToLog( _L8( "* Data: %S" ), &data );
+ }
+ CXdmDocumentNode* node = NULL;
+ TInt nodeCount = NodeCount();
+ for( TInt i = 0;i < nodeCount;i++ )
+ {
+ node = ChileNode( i );
+ node->Print();
+ }
+ }
+ CleanupStack::PopAndDestroy(); //nameBuf
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::Find
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CXdmDocumentNode::Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ TInt error = KErrNotFound;
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt i = 0;i < childCount;i++ )
+ error = ChileNode( i )->DoFind( aNodeName, aResultArray );
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::DoFind
+//
+// ---------------------------------------------------------
+//
+TInt CXdmDocumentNode::DoFind( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ TInt error = KErrNone;
+ if( NodeName().Compare( aNodeName ) == 0 )
+ error = aResultArray.Append( this );
+ if( error == KErrNone )
+ {
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt i = 0;i < childCount;i++ )
+ error = ChileNode( i )->DoFind( aNodeName, aResultArray );
+ }
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::Find
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CXdmDocumentNode::Find( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ TInt error = KErrNotFound;
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt i = 0;i < childCount;i++ )
+ error = ChileNode( i )->DoFind( aTargetNode, aResultArray );
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::Find
+//
+// ---------------------------------------------------------
+//
+TInt CXdmDocumentNode::DoFind( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const
+ {
+ TInt error = KErrNone;
+ if( *this == aTargetNode )
+ error = aResultArray.Append( this );
+ if( error == KErrNone )
+ {
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt i = 0;i < childCount;i++ )
+ error = ChileNode( i )->DoFind( aTargetNode, aResultArray );
+ }
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::Find
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CXdmDocumentNode::Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray ) const
+ {
+ TInt error = KErrNone;
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt j = 0;j < childCount;j++ )
+ error = ChileNode( j )->DoFind( aNodeName, aResultArray, aAttributeArray );
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::RemoveNamespaceAttributes
+//
+// ---------------------------------------------------------
+//
+void CXdmDocumentNode::RemoveNamespaceAttributes()
+ {
+ _LIT( KXmlNamespaceAttr, "xmlns" );
+ for( TInt i( iAttributes.Count() - 1 ); i > KErrNotFound; i-- )
+ {
+ CXdmNodeAttribute* attr( iAttributes[i] );
+ if( attr->NodeName().Find( KXmlNamespaceAttr ) == 0 )
+ {
+ iAttributes.Remove( i );
+ delete attr;
+ attr = NULL;
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::DoFind
+//
+// ---------------------------------------------------------
+//
+TInt CXdmDocumentNode::DoFind( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray )
+ {
+ TBool match = EFalse;
+ TInt error = KErrNone;
+ if( NodeName().Compare( aNodeName ) == 0 )
+ {
+ match = ETrue;
+ RemoveNamespaceAttributes();
+ TInt attrCount = iAttributes.Count();
+ if( attrCount == aAttributeArray.Count() )
+ {
+ if( attrCount > 0 )
+ {
+ for( TInt i = 0;i < attrCount;i++ )
+ match = HasAttribute( *aAttributeArray[i] );
+ }
+ }
+ else match = EFalse;
+ error = match ? aResultArray.Append( this ) : KErrNotFound;
+ }
+ TInt childCount = NodeCount();
+ if( childCount > 0 )
+ {
+ for( TInt j = 0;j < childCount;j++ )
+ error = ChileNode( j )->DoFind( aNodeName, aResultArray, aAttributeArray );
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::operator==
+//
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CXdmDocumentNode::operator==( const CXdmDocumentNode& aNode ) const
+ {
+ TBool match = EFalse;
+ if( NodeName().Compare( aNode.NodeName() ) == 0 )
+ {
+ match = ETrue;
+ TInt attrCount = iAttributes.Count();
+ if( attrCount == aNode.AttributeCount() )
+ {
+ if( attrCount > 0 )
+ {
+ for( TInt i = 0;i < attrCount;i++ )
+ match = aNode.HasAttribute( *iAttributes[i] );
+ }
+ }
+ if( match )
+ {
+ TInt childCount = NodeCount();
+ if( childCount == aNode.NodeCount() )
+ {
+ if( childCount > 0 )
+ {
+ for( TInt j = 0;j < childCount;j++ )
+ {
+ match = *ChileNode( j ) == *aNode.ChileNode( j );
+ if( !match )
+ break;
+ }
+ }
+ }
+ else match = EFalse;
+ }
+ else match = EFalse;
+ }
+ return match;
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::AppendChileNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::AppendChileNodeL( CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CLocalDocument::AppendChileNodeL()" ) );
+ #endif
+ CXdmDocumentNode* node = iNodeFactory.ChileNodeL( aDocumentNode );
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iChildren.Append( node ) );
+ CleanupStack::Pop(); //node
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::InsertChileNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::InsertChileNodeL( TInt aIndex, CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CLocalDocument::InsertChileNodeL()" ) );
+ #endif
+ __ASSERT_ALWAYS( aIndex >= 0, User::Panic( _L( "CXdmDocumentNode" ), EIndexOutOfBounds ) );
+ CXdmDocumentNode* node = iNodeFactory.ChileNodeL( aDocumentNode );
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iChildren.Insert( node, aIndex ) );
+ CleanupStack::Pop(); //node
+ }
+
+// ----------------------------------------------------
+// CXdmDocumentNode::ReplaceChileNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::ReplaceChileNodeL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode )
+ {
+ CXdmDocumentNode* remove = NULL;
+ TInt index = iChildren.Find( aTargetNode );
+ #ifdef _DEBUG
+ CXdmDocumentNode* a = NULL;
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::ReplaceChileNodeL()" ) );
+ iXdmEngine.WriteToLog( _L8( " New node: %x" ), aNewNode );
+ iXdmEngine.WriteToLog( _L8( " Target node: %x" ), aTargetNode );
+ for( TInt i = 0;i < iChildren.Count();i++ )
+ {
+ a = iChildren[i];
+ iXdmEngine.WriteToLog( _L8( " Child %d: %x" ), i, a );
+ }
+ #endif
+ __ASSERT_DEBUG( index >= 0, User::Panic( _L( "CXdmDocumentNode" ), EIndexOutOfBounds ) );
+ remove = iChildren[index];
+ iChildren.Remove( index );
+ delete remove;
+ remove = NULL;
+ CXdmDocumentNode* node = iNodeFactory.ChileNodeL( aNewNode );
+ CleanupStack::PushL( node );
+ User::LeaveIfError( iChildren.Insert( node, index ) );
+ CleanupStack::Pop(); //node
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::RemoveChileNodeL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::RemoveChileNodeL( CXdmDocumentNode* aChileNode )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::RemoveChileNodeL()" ) );
+ #endif
+ CXdmDocumentNode* remove = NULL;
+ switch( aChileNode->ElementType() )
+ {
+ case EXdmElementNode:
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Element is a node" ) );
+ #endif
+ TInt index( iChildren.Find( aChileNode ) );
+ __ASSERT_DEBUG( index >= 0, User::Panic( _L( "CXdmDocumentNode" ), EIndexOutOfBounds ) );
+ remove = iChildren[index];
+ iChildren.Remove( index );
+ delete remove;
+ remove = NULL;
+ }
+ break;
+ case EXdmElementAttribute:
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Element is an attribute" ) );
+ #endif
+ TInt index( iAttributes.Find( ( CXdmNodeAttribute* )aChileNode ) );
+ __ASSERT_DEBUG( index >= 0, User::Panic( _L( "CXdmDocumentNode" ), EIndexOutOfBounds ) );
+ remove = iAttributes[index];
+ iAttributes.Remove( index );
+ delete remove;
+ remove = NULL;
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( " Element is of undefined type, ignore" ) );
+ #endif
+ break;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::NextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmDocumentNode::NextNode() const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXcapDocumentNode::NextNode()" ) );
+ #endif*/
+ return iNextNode;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::SetNextNode
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmDocumentNode::SetNextNode( CXdmDocumentNode* aNextNode )
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::SetNextNode()" ) );
+ #endif*/
+ __ASSERT_DEBUG( aNextNode != NULL, User::Panic( _L( "CXdmDocumentNode" ), EDocNodeNull ) );
+ iNextNode = aNextNode;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::EscapeDescLC
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXdmDocumentNode::EscapeDescLC( const TDesC8& aDescriptor ) const
+ {
+ /*#ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmDocumentNode::EscapeDescLC()" ) );
+ #endif*/
+ TInt bufPos = 0;
+ TBuf8<10> format;
+ HBufC8* ret = NULL;
+ CBufFlat* buffer = CBufFlat::NewL( 50 );
+ CleanupStack::PushL( buffer );
+ for( TInt i = 0;i < aDescriptor.Length();i++ )
+ {
+ TUint8 byte = aDescriptor[i];
+ switch( byte )
+ {
+ case 0x26: //'&'
+ format.Append( KXmlAmpersandEsc );
+ break;
+ case 0x3C: //'<'
+ format.Append( KXmlBracketOpenEsc );
+ break;
+ case 0x3E: //'>'
+ format.Append( KXmlBracketCloseEsc );
+ break;
+ default:
+ format.Append( byte );
+ break;
+ }
+ buffer->InsertL( bufPos, format );
+ bufPos = bufPos + format.Length();
+ format.Zero();
+ }
+ ret = HBufC8::NewL( buffer->Size() );
+ ret->Des().Copy( buffer->BackPtr( buffer->Size() ) );
+ CleanupStack::PopAndDestroy(); //buffer
+ CleanupStack::PushL( ret );
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::HasAttribute
+//
+// ---------------------------------------------------------
+//
+TBool CXdmDocumentNode::HasAttribute( const CXdmNodeAttribute& aAttribute ) const
+ {
+ TBool ret = EFalse;
+ TInt count = iAttributes.Count();
+ for( TInt i = 0;i < count && !ret;i++ )
+ {
+ ret = iAttributes[i]->NodeName().Compare( aAttribute.NodeName() ) == 0 &&
+ iAttributes[i]->AttributeValue().Compare( aAttribute.AttributeValue() ) == 0;
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::HasAttribute
+//
+// ---------------------------------------------------------
+//
+TBool CXdmDocumentNode::HasAttributeL( const SXdmAttribute8& aAttribute ) const
+ {
+ TBool ret = EFalse;
+ TInt count = iAttributes.Count();
+ for( TInt i = 0;i < count && !ret;i++ )
+ {
+ HBufC8* name = CXdmEngine::ConvertToUTF8L( iAttributes[i]->NodeName() );
+ CleanupStack::PushL( name );
+ HBufC8* value = CXdmEngine::ConvertToUTF8L( iAttributes[i]->AttributeValue() );
+ CleanupStack::PushL( value );
+ ret = name->Des().Compare( aAttribute.iName ) == 0 &&
+ value->Des().Compare( aAttribute.iValue ) == 0;
+ CleanupStack::PopAndDestroy( 2 ); //value, name
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXdmDocumentNode::HasAttribute
+//
+// ---------------------------------------------------------
+//
+TBool CXdmDocumentNode::HasAttribute( const SXdmAttribute16& aAttribute ) const
+ {
+ TBool ret = EFalse;
+ TInt count = iAttributes.Count();
+ for( TInt i = 0;i < count && !ret;i++ )
+ {
+ ret = iAttributes[i]->NodeName().Compare( aAttribute.iName ) == 0 &&
+ iAttributes[i]->AttributeValue().Compare( aAttribute.iValue ) == 0;
+ }
+ return ret;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmEngine.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <utf.h>
+#include <ecom.h>
+#include <f32file.h>
+#include <flogger.h>
+#include "XdmEngine.h"
+#include "XdmDocument.h"
+#include "XdmProtocol.h"
+#include "XdmDirectory.h"
+#include "XdmLogWriter.h"
+#include "XdmStaticUtils.h"
+#include "XdmSettingsApi.h"
+#include "XdmProtocolInfo.h"
+
+// ----------------------------------------------------------
+// CXdmEngine::CXdmEngine
+//
+// ----------------------------------------------------------
+//
+CXdmEngine::CXdmEngine() : CActive( EPriorityStandard )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmEngine::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmEngine* CXdmEngine::NewL( const CXdmProtocolInfo& aProtocolInfo )
+ {
+ CXdmEngine* self = new ( ELeave ) CXdmEngine();
+ CleanupStack::PushL( self );
+ self->ConstructL( CONST_CAST( CXdmProtocolInfo&, aProtocolInfo ) );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmEngine::XdmSettingsLC
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CDesC16Array* CXdmEngine::XdmSettingsLC( RArray<TInt>& aSettingIds )
+ {
+ return TXdmSettingsApi::CollectionNamesLC( aSettingIds );
+ }
+
+// ----------------------------------------------------------
+// CXdmEngine::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXdmEngine::ConstructL( CXdmProtocolInfo& aProtocolInfo )
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KXdmEngLogFile );
+ WriteToLog( _L8( "CXdmEngine::ConstructL()" ) );
+ #endif
+ TRAPD( error, iXdmProtocol = CXdmProtocol::NewL( *this, aProtocolInfo ) );
+ if( error == KErrNone && iXdmProtocol != NULL )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Protocol implementation created successfully" ) );
+ #endif
+ CActiveScheduler::Add( this );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Protocol creation failed - Error: %d Protocol: %x" ), error, iXdmProtocol );
+ #endif
+ User::Leave( KErrUnknown );
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::~CXdmEngine
+//
+// ----------------------------------------------------
+//
+CXdmEngine::~CXdmEngine()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::~CXdmEngine()" ) );
+ #endif
+ iDocUpdateQueue.Close();
+ iDirUpdateQueue.Close();
+ iDocumentQueue.Close();
+ iDirectoryQueue.Close();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Queues closed" ) );
+ #endif
+ delete iXdmProtocol;
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Protocol deleted" ) );
+ #endif
+ REComSession::FinalClose();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Destructor finished" ) );
+ #endif
+ delete iLogWriter;
+ }
+
+// ----------------------------------------------------------
+// CXdmEngine::WriteToLog
+//
+// ----------------------------------------------------------
+//
+void CXdmEngine::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::DirectoryCollection
+//
+// ----------------------------------------------------
+//
+EXPORT_C const RPointerArray<CXdmDocument>& CXdmEngine::DocumentCollection() const
+ {
+ return iDocumentQueue;
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::DirectoryCollection
+//
+// ----------------------------------------------------
+//
+EXPORT_C const RPointerArray<CXdmDirectory>& CXdmEngine::DirectoryCollection() const
+ {
+ return iDirectoryQueue;
+ }
+
+
+// ----------------------------------------------------
+// CXdmEngine::CancelUpdate
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::CancelUpdate( CXdmDocument* aDocument )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::CancelUpdate( document )" ) );
+ #endif
+ TInt index = iDocumentQueue.Find( aDocument );
+ if( IsActive() )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Transfer media init pending, cancel self" ) );
+ #endif
+ Cancel();
+ }
+ else if( index != KErrNotFound && aDocument->IsActive() )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Cancel document update" ) );
+ #endif
+ aDocument->CancelUpdate();
+ if( iDocUpdateQueue.Find( aDocument ) == KErrNone )
+ iDocUpdateQueue.Remove( index );
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::CancelUpdate
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::CancelUpdate( CXdmDirectory* aDirectory )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::CancelUpdate( directory )" ) );
+ #endif
+ TInt index = iDirectoryQueue.Find( aDirectory );
+ if( IsActive() )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Transfer media init pending, cancel self" ) );
+ #endif
+ Cancel();
+ }
+ else if( index != KErrNotFound && aDirectory->IsActive() )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Cancel directory update" ) );
+ #endif
+ aDirectory->CancelUpdate();
+ if( iDirUpdateQueue.Find( aDirectory ) == KErrNone )
+ iDirUpdateQueue.Remove( index );
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::CreateDocumentModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocument* CXdmEngine::CreateDocumentModelL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::CreateDocumentModelL()" ) );
+ #endif
+ CXdmDocument* document = iXdmProtocol->CreateDocumentL( aDocumentName, aDocumentType );
+ CleanupStack::PushL( document );
+ User::LeaveIfError( iDocumentQueue.Append( document ) );
+ CleanupStack::Pop(); //document
+ return document;
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::DeleteDocumentModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::DeleteDocumentModelL( const CXdmDocument* aDocument )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::DeleteDocumentModelL()" ) );
+ #endif
+ TInt index = iDocumentQueue.Find( aDocument );
+ __ASSERT_ALWAYS( index != KErrNotFound, User::Leave( KErrNotFound ) );
+ iDocumentQueue.Remove( index );
+ delete aDocument;
+ aDocument = NULL;
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::CreateDirectoryModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDirectory* CXdmEngine::CreateDirectoryModelL( const TDesC& aDirectoryPath )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::CreateDirectoryModelL()" ) );
+ #endif
+ CXdmDirectory* directory = iXdmProtocol->CreateDirectoryL( aDirectoryPath );
+ CleanupStack::PushL( directory );
+ User::LeaveIfError( iDirectoryQueue.Append( directory ) );
+ CleanupStack::Pop(); //document
+ return directory;
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::DeleteDirectoryModelL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::DeleteDirectoryModelL( const CXdmDirectory* aDirectory )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::DeleteDirectoryModelL()" ) );
+ #endif
+ TInt index = iDirectoryQueue.Find( aDirectory );
+ __ASSERT_ALWAYS( index != KErrNotFound, User::Panic( _L( "CXdmEngine" ), EDirModelNotFound ) );
+ iDirectoryQueue.Remove( index );
+ delete aDirectory;
+ aDirectory = NULL;
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::CreateDocumentNodeL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmDocumentNode* CXdmEngine::CreateDocumentNodeL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::CreateDocumentNodeL()" ) );
+ #endif
+ return iXdmProtocol->CreateDocumentNodeL();
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::UpdateL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::UpdateL( CXdmDocument* aDocument,
+ TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::UpdateL( document )" ) );
+ #endif
+ iClientStatus = &aStatus;
+ aStatus = KRequestPending;
+ aDocument->SaveClientStatus( aStatus );
+ User::LeaveIfError( iDocUpdateQueue.Append( aDocument ) );
+ if( !IsActive() )
+ {
+ iXdmProtocol->InitTransferMedium( KDefaultIdleTimeout, iStatus );
+ SetActive();
+ }
+ }
+
+// ----------------------------------------------------
+// CXdmEngine::UpdateL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmEngine::UpdateL( TRequestStatus& aStatus,
+ CXdmDirectory* aDirectory,
+ TDirUpdatePhase aUpdatePhase )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::UpdateL( directory )" ) );
+ #endif
+ iClientStatus = &aStatus;
+ aStatus = KRequestPending;
+ aDirectory->SaveRequestData( aUpdatePhase, aStatus );
+ User::LeaveIfError( iDirUpdateQueue.Append( aDirectory ) );
+ if( !IsActive() )
+ {
+ iXdmProtocol->InitTransferMedium( KDefaultIdleTimeout, iStatus );
+ SetActive();
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmEngine::RunL
+//
+// ---------------------------------------------------------
+//
+void CXdmEngine::RunL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::RunL() - Status: %d" ), iStatus.Int() );
+ #endif
+ if( iStatus == KErrCancel )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Update cancelled, complete client request" ) );
+ #endif
+ if( iClientStatus )
+ {
+ iDocUpdateQueue.Reset();
+ iDirUpdateQueue.Reset();
+ User::RequestComplete( iClientStatus, KErrCancel );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Request complete" ) );
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Transfer media initialised, start update" ) );
+ #endif
+ TInt dirCount( iDirUpdateQueue.Count() );
+ TInt docCount( iDocUpdateQueue.Count() );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Document queue count: %d" ), docCount );
+ WriteToLog( _L8( " Directory queue count: %d" ), dirCount );
+ #endif
+ //First check the document queue
+ for( TInt i = 0;i < docCount;i++ )
+ {
+ iDocUpdateQueue[0]->StartUpdateL();
+ iDocUpdateQueue.Remove( 0 );
+ }
+ //Then the directory queue
+ for( TInt j = 0;j < dirCount;j++ )
+ {
+ iDirUpdateQueue[0]->StartUpdateL();
+ iDirUpdateQueue.Remove( 0 );
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmEngine::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CXdmEngine::DoCancel()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::DoCancel()" ) );
+ #endif
+ iXdmProtocol->CancelTransferMediumInit();
+ if( iClientStatus )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Client request pending => Complete" ) );
+ #endif
+ iDocUpdateQueue.Reset();
+ iDirUpdateQueue.Reset();
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmEngine::XdmProtocol
+//
+// ---------------------------------------------------------
+//
+CXdmProtocol* CXdmEngine::XdmProtocol() const
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::XdmProtocol()" ) );
+ #endif
+ return iXdmProtocol;
+ }
+
+// ---------------------------------------------------------
+// CXdmEngine::ConvertToUTF8L
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXdmEngine::ConvertToUTF8L( const TDesC& aUnicodeDesc )
+ {
+ /*#ifdef _DEBUG
+ WriteToLog( _L8( "CXdmEngine::ConvertToUTF8L()" ) );
+ #endif*/
+ return CnvUtfConverter::ConvertFromUnicodeToUtf8L( aUnicodeDesc );
+ }
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmLogWriter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine log writer
+*
+*/
+
+
+
+#include <f32file.h>
+#include <flogger.h>
+#include <e32debug.h>
+#include "XdmLogWriter.h"
+#include "XdmStaticUtils.h"
+
+
+// ----------------------------------------------------------
+// XdmStaticUtils::CheckFileExistsL
+//
+// ----------------------------------------------------------
+//
+CXdmLogWriter::CXdmLogWriter()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmLogWriter::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmLogWriter* CXdmLogWriter::NewL( const TDesC& aLogName )
+ {
+ CXdmLogWriter* self = new ( ELeave ) CXdmLogWriter();
+ CleanupStack::PushL( self );
+ self->ConstructL( aLogName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmLogWriter::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXdmLogWriter::ConstructL( const TDesC& aLogName )
+ {
+ RFs session;
+ HBufC* full = NULL;
+ User::LeaveIfError( session.Connect() );
+ CleanupClosePushL( session );
+ HBufC* concat = HBufC::NewLC( KXdmLogRoot().Length() +
+ KXdmLogDir().Length() +
+ aLogName.Length() + 1 );
+ TPtr path( concat->Des() );
+ path.Copy( KXdmLogRoot );
+ path.Append( KXdmLogDir );
+ path.Append( _L( "\\") );
+ path.Append( aLogName );
+ TRAPD( error, full = XdmStaticUtils::GenerateFileNameL( session, path, KXdmLogFileExt ) );
+ if( full && error == KErrNone )
+ {
+ CleanupStack::PushL( full );
+ TPtrC fullDes( full->Des() );
+ iLogFileName = fullDes.Mid( fullDes.LocateReverse( 92 ) + 1 ).AllocL();
+ CleanupStack::PopAndDestroy(); //full
+ }
+ else iLogFileName = NULL;
+ CleanupStack::PopAndDestroy( 2 ); //concat, session
+ }
+
+// ----------------------------------------------------------
+// CXdmLogWriter::~CXdmLogWriter
+//
+// ----------------------------------------------------------
+//
+CXdmLogWriter::~CXdmLogWriter()
+ {
+ delete iLogFileName;
+ }
+
+// ----------------------------------------------------------
+// CXdmLogWriter::WriteToLog
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmLogWriter::WriteToLog( const TDesC& aLogLine ) const
+ {
+ if( iLogFileName )
+ {
+ RFileLogger::Write( KXdmLogDir, *iLogFileName, EFileLoggingModeAppend, aLogLine );
+ }
+ RDebug::Print( aLogLine );
+ }
+
+// ----------------------------------------------------------
+// CXdmLogWriter::WriteToLog
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmLogWriter::WriteToLog( const TDesC8& aLogLine ) const
+ {
+ if( iLogFileName )
+ {
+ RFileLogger::Write( KXdmLogDir, *iLogFileName, EFileLoggingModeAppend, aLogLine );
+ }
+ RDebug::RawPrint( aLogLine );
+ }
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmNodeAttribute.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine node attribute
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XdmEngine.h"
+#include "XdmNodeFactory.h"
+#include "XdmNodeAttribute.h"
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::CXdmNodeAttribute
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute::CXdmNodeAttribute( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory ) :
+ CXdmDocumentNode( aXdmEngine, aNodeFactory )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::CXdmNodeAttribute
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute::CXdmNodeAttribute( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode ) :
+ CXdmDocumentNode( aXdmEngine, aNodeFactory, aParentNode )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::ConstructL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmNodeAttribute::BaseConstructL( const TDesC& aAttributeName )
+ {
+ SetNameL( aAttributeName );
+ }
+
+// ----------------------------------------------------------
+// CXdmNodeAttribute::ElementType
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TXdmElementType CXdmNodeAttribute::ElementType() const
+ {
+ return EXdmElementAttribute;
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::~CXdmNodeAttribute
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmNodeAttribute::~CXdmNodeAttribute()
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmNodeAttribute::~CXdmNodeAttribute()" ) );
+ #endif
+ delete iAttributeValue;
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::AttributeValue
+//
+// ----------------------------------------------------
+//
+EXPORT_C TPtrC CXdmNodeAttribute::AttributeValue() const
+ {
+ return iAttributeValue != NULL ? iAttributeValue->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::AttributeValue
+//
+// ----------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmNodeAttribute::EightBitValueLC() const
+ {
+ HBufC8* eightBit = CXdmEngine::ConvertToUTF8L( iAttributeValue->Des() );
+ CleanupStack::PushL( eightBit );
+ return eightBit;
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::EscapedValueLC
+//
+// ----------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmNodeAttribute::EscapedValueLC() const
+ {
+ HBufC8* eightBit = CXdmEngine::ConvertToUTF8L( iAttributeValue->Des() );
+ CleanupStack::PushL( eightBit );
+ HBufC8* escape = EscapeDescLC( eightBit->Des() );
+ CleanupStack::Pop(); //escape
+ CleanupStack::PopAndDestroy(); //eightBit
+ CleanupStack::PushL( escape );
+ return escape;
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::SetAttributeValue
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmNodeAttribute::SetAttributeValueL( const TDesC& aAttributeValue )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmNodeAttribute::SetAttributeValueL() - Value: %S" ),
+ &aAttributeValue );
+ #endif
+ delete iAttributeValue;
+ iAttributeValue = NULL;
+ iAttributeValue = HBufC::NewL( aAttributeValue.Length() );
+ iAttributeValue->Des().Copy( aAttributeValue );
+ }
+
+// ----------------------------------------------------
+// CXdmNodeAttribute::SetAttributeValue
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXdmNodeAttribute::SetAttributeValueL( const TDesC8& aAttributeValue )
+ {
+ #ifdef _DEBUG
+ iXdmEngine.WriteToLog( _L8( "CXdmNodeAttribute::SetAttributeValueL() - Value: %S" ),
+ &aAttributeValue );
+ #endif
+ delete iAttributeValue;
+ iAttributeValue = NULL;
+ iAttributeValue = HBufC::NewL( aAttributeValue.Length() );
+ iAttributeValue->Des().Copy( aAttributeValue );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmProtocol.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine protocol
+*
+*/
+
+
+
+#include <ecom.h>
+#include "XdmProtocol.h"
+#include "XdmProtocolInfo.h"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmProtocolInfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine protocol info
+*
+*/
+
+
+
+#include "XdmProtocol.h"
+#include "XdmDocument.h"
+#include "XdmSettingsApi.h"
+#include "XdmProtocolInfo.h"
+#include "XdmProtocolUidList.h"
+#include "XdmSettingsProperty.h"
+#include "XdmSettingsCollection.h"
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::CXdmProtocolInfo
+//
+// ----------------------------------------------------------
+//
+CXdmProtocolInfo::CXdmProtocolInfo() : iSecure( EFalse ),
+ iUseCache( ETrue )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::CXdmProtocolInfo
+//
+// ----------------------------------------------------------
+//
+CXdmProtocolInfo::CXdmProtocolInfo( TInt aProtocolUid ) :
+ iProtocolUid( TUid::Uid( aProtocolUid ) ),
+ iSecure( EFalse ),
+ iUseCache( ETrue )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::CXdmProtocolInfo
+//
+// ----------------------------------------------------------
+//
+CXdmProtocolInfo::CXdmProtocolInfo( TInt aAccessPoint,
+ TInt aProtocolUid ) :
+ iProtocolUid( TUid::Uid( aProtocolUid ) ),
+ iAccessPoint( aAccessPoint ),
+ iSecure( EFalse ),
+ iUseCache( ETrue )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmProtocolInfo* CXdmProtocolInfo::NewL( TInt aAccessPoint,
+ TInt aProtocolUid,
+ const TDesC& aRootLocation )
+ {
+ CXdmProtocolInfo* self = new ( ELeave ) CXdmProtocolInfo( aAccessPoint, aProtocolUid );
+ CleanupStack::PushL( self );
+ self->ConstructL( aRootLocation );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmProtocolInfo* CXdmProtocolInfo::NewL( TInt aSettingsId )
+ {
+ CXdmProtocolInfo* self = new ( ELeave ) CXdmProtocolInfo( KXcapProtocol );
+ self->Construct( aSettingsId );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXdmProtocolInfo::ConstructL( const TDesC& aRootLocation )
+ {
+ delete iRootLocation;
+ iRootLocation = NULL;
+ iRootLocation = HBufC::NewL( aRootLocation.Length() );
+ iRootLocation->Des().Copy( aRootLocation );
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::Construct
+//
+// ----------------------------------------------------------
+//
+void CXdmProtocolInfo::Construct( TInt aSettingsId )
+ {
+ iSettingsId = aSettingsId;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::~CXdmProtocolInfo
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmProtocolInfo::~CXdmProtocolInfo()
+ {
+ delete iRootLocation;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::SetCredentials
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmProtocolInfo::SetCredentials( const TXdmCredentials aCredentials )
+ {
+ iCredentials = aCredentials;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::SetCacheUsage
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmProtocolInfo::SetCacheUsage( const TBool aCacheUsage )
+ {
+ iUseCache = aCacheUsage;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::CacheUsage
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool CXdmProtocolInfo::IsCacheEnabled() const
+ {
+ return iUseCache;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::Credentials
+//
+// ----------------------------------------------------------
+//
+EXPORT_C const TXdmCredentials& CXdmProtocolInfo::Credentials() const
+ {
+ return iCredentials;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::SetCredentials
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmProtocolInfo::SetSecurity( const TBool aSecure )
+ {
+ iSecure = aSecure;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::SetCredentials
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool CXdmProtocolInfo::IsSecure() const
+ {
+ return iSecure;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::Root
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TUid CXdmProtocolInfo::ProtocolUid() const
+ {
+ return iProtocolUid;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::AccessPoint
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TInt CXdmProtocolInfo::AccessPoint() const
+ {
+ return iAccessPoint;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::AccessPoint
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TInt CXdmProtocolInfo::SettingsID() const
+ {
+ return iSettingsId;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocolInfo::Root
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC CXdmProtocolInfo::Root() const
+ {
+ return iRootLocation != NULL ? iRootLocation->Des() : TPtrC();
+ }
+
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMEngine/src/XdmStaticUtils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine static utils
+*
+*/
+
+
+
+
+#include <f32file.h>
+#include "XdmStaticUtils.h"
+#include "XdmLogWriter.h"
+
+// ----------------------------------------------------------
+// XdmStaticUtils::CheckFileExistsL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool XdmStaticUtils::CheckFileExistsL( RFs& aFileSession, const TDesC& aFileName )
+ {
+ TBool found = EFalse;
+ CDir* directory = NULL;
+ TInt index = aFileName.LocateReverse( KBackSlash );
+ TPtrC dir( aFileName.Left( index + 1 ) );
+ TPtrC name( aFileName.Right( aFileName.Length() - index - 1 ) );
+ User::LeaveIfError( aFileSession.GetDir( dir, KEntryAttNormal, ESortNone, directory ) );
+ CleanupStack::PushL( directory );
+ const TInt count = directory->Count();
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ if( name.CompareF( ( *directory )[i].iName ) == 0 )
+ found = ETrue;
+ }
+ CleanupStack::PopAndDestroy(); //directory
+ return found;
+ }
+
+// ----------------------------------------------------------
+// XdmStaticUtils::GenerateFileNameLC
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC* XdmStaticUtils::GenerateFileNameL( RFs& aFileSession, const TDesC& aFileName,
+ const TDesC& aExtension )
+ {
+ TInt i = 1;
+ TBuf<KMaxFileName> name;
+ name.Copy( aFileName );
+ name.Append( aExtension );
+ TBool exists = XdmStaticUtils::CheckFileExistsL( aFileSession, name );
+ for( ;exists && i <= KMaxLogFiles;i++ )
+ {
+ name.Zero();
+ name.Copy( aFileName );
+ name.AppendNum( i );
+ name.Append( aExtension );
+ exists = XdmStaticUtils::CheckFileExistsL( aFileSession, name );
+ }
+ if( i >= KMaxLogFiles )
+ {
+ TPtrC dir( aFileName.Left( aFileName.LocateReverse( KBackSlash ) ) );
+ CleanUpDirectoryL( aFileSession, dir );
+ name.Zero();
+ name.Copy( aFileName );
+ name.Append( aExtension );
+ }
+ return name.AllocL();
+ }
+
+// ----------------------------------------------------------
+// XdmStaticUtils::CleanUpDirectoryL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void XdmStaticUtils::CleanUpDirectoryL( RFs& aFileSession, const TDesC& aDirectory )
+ {
+ TBuf<KMaxFileName> allFiles;
+ allFiles.Copy( aDirectory );
+ allFiles.Append( _L( "\\*.*") );
+ CFileMan* manager = CFileMan::NewL( aFileSession );
+ manager->Delete( allFiles );
+ delete manager;
+ manager = NULL;
+ }
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/data/10207428.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM plugin resource file for GS XDM plugin.
+*
+*/
+
+
+
+#include <registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ dll_uid = 0x10207428; // Plugin dll UID
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207236; // UID for CGSPluginInterface
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207429; // Plugin UID
+ version_no = 1;
+ display_name = "XDM Settings Plugin"; // Plugin debug name
+
+ #ifdef RD_CONTROL_PANEL // for control panel change (5.0)
+ default_data = "0x10283341"; // Parent UID adminstrative settings
+ opaque_data = "50"; // Order number
+ #else // for normal 3.0 without control panel change
+ default_data = "0x10207250"; // Parent UID connection settings
+ opaque_data = "140"; // Order number
+ #endif //RD_CONTROL_PANEL
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/data/XDMPluginRsc.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource file for XDMPlugin
+*
+*/
+
+
+
+
+// RESOURCE IDENTIFIER
+NAME GSXD // 4 letter ID
+
+// INCLUDES
+#include <bldvariant.hrh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <eikcore.rsg>
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.loc>
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+
+#include <gsxdmplugin.loc>
+#include "XDMPlugin.hrh"
+
+// CONSTANTS
+//----------------------------------------------------
+//
+//
+// Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+ {
+ }
+
+//----------------------------------------------------
+//
+// r_gs_xdm_settings_main_menubar
+// Menu when main list is visible
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_gs_xdm_settings_main_menubar
+ {
+ titles =
+ {
+ MENU_TITLE { menu_pane = r_gs_xdm_settings_main_menu;}
+ };
+ }
+
+//----------------------------------------------------
+//
+// r_gs_xdm_settings_main_menu
+// Main menu when we enter in XDM settings
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_gs_xdm_settings_main_menu
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdChange;
+ txt = qtn_xdm_settings_change;
+ flags = EEikMenuItemAction;
+ },
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdEdit;
+ txt = qtn_xdm_options_edit_set;
+ flags = EEikMenuItemAction;
+ },
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdNewSettings;
+ cascade = r_gs_xdm_new_settings_menu;
+ txt = qtn_xdm_options_new_set;
+ },
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdDelete;
+ txt = qtn_xdm_options_delete;
+ flags = EEikMenuItemSpecific;
+ },
+ MENU_ITEM
+ {
+ command = EAknCmdHelp;
+ txt = qtn_options_help;
+ },
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdExitFromSL;
+ txt = qtn_options_exit;
+ },
+ MENU_ITEM
+ {
+ command = EAknCmdExit;
+ txt = qtn_options_exit;
+ }
+ };
+ }
+
+//----------------------------------------------------
+//
+// r_gs_xdm_new_settings_menu
+// case menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_gs_xdm_new_settings_menu
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdNewDefault;
+ txt = qtn_xdm_options_new_sub_default;
+ },
+ MENU_ITEM
+ {
+ command = EGSXDMPluginCmdNewExisting;
+ txt = qtn_xdm_options_new_sub_existing;
+ }
+ };
+ }
+
+//----------------------------------------------------
+//
+// r_gs_xdm_main_view_title
+// XDM view's title.
+//
+//----------------------------------------------------
+//
+RESOURCE TITLE_PANE r_gs_xdm_main_view_title
+ {
+ txt = qtn_xdm_title;
+ }
+
+//----------------------------------------------------
+//
+// r_gs_xdm_main_view
+// XDM plugin main view.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_gs_xdm_main_view
+ {
+ menubar = r_gs_xdm_settings_main_menubar;
+ cba = r_xdmui_mainview_softkeys;//R_AVKON_SOFTKEYS_OPTIONS_BACK;
+ }
+
+//----------------------------------------------------
+//
+// r_xdmui_mainview_softkeys
+// XDM plugin main view softkeys.
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_xdmui_mainview_softkeys
+ {
+ flags = 0;
+ buttons =
+ {
+ CBA_BUTTON {id=EAknSoftkeyOptions; txt= text_softkey_option;},
+ CBA_BUTTON {id=EAknSoftkeyBack; txt= text_softkey_back;},
+ CBA_BUTTON {id=EGSXDMPluginCmdEdit; txt= qtn_msk_edit;}
+ };
+ }
+
+//----------------------------------------------------
+//
+// r_xdmui_mainview_softkeys_sl
+// XDM plugin main view softkeys for settings list
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_xdmui_mainview_softkeys_sl
+ {
+ flags = 0;
+ buttons =
+ {
+ CBA_BUTTON {id=EAknSoftkeyOptions; txt= text_softkey_option;},
+ CBA_BUTTON {id=EAknSoftkeyBack; txt= text_softkey_back;},
+ CBA_BUTTON {id=EGSXDMPluginCmdChange; txt= qtn_msk_change;}
+ };
+ }
+
+// ---------------------------------------------------------
+//
+// r_settings
+//
+// settings list - collection of all setting types
+//
+// ---------------------------------------------------------
+//
+RESOURCE LISTBOX r_gs_xdm_main_list
+ {
+ flags = EAknListBoxSelectionList;
+ }
+
+
+// ---------------------------------------------------------
+//
+// r_settings
+//
+// settings list - collection of all setting types
+//
+// ---------------------------------------------------------
+//
+
+RESOURCE AVKON_SETTING_ITEM_LIST r_settings
+ {
+ flags = EAknSettingItemIncludeHiddenInOrdinal;
+ title = qtn_xdm_title;
+ items =
+ {
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemSettingName;
+ setting_page_resource = r_server_name_editor_page;
+ name = qtn_xdm_settings_set_name;
+ compulsory_ind_string = qtn_xdm_compulsory_indicator;
+ empty_item_text = qtn_xdm_settings_must_define;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemAccessPoint;
+ setting_page_resource = r_accesspoint_editor_page;
+ name = qtn_xdm_settings_access_point;
+ compulsory_ind_string = qtn_xdm_compulsory_indicator;
+ empty_item_text = qtn_xdm_settings_must_define;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemServerAddress;
+ setting_page_resource = r_server_address_editor_page;
+ name = qtn_xdm_settings_address;
+ compulsory_ind_string = qtn_xdm_compulsory_indicator;
+ empty_item_text = qtn_xdm_settings_must_define;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemSipURL;
+ setting_page_resource = r_sip_url_editor_page;
+ name = qtn_xdm_settings_sip;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemUserID;
+ setting_page_resource = r_user_id_editor_page;
+ name = qtn_xdm_settings_username;
+ compulsory_ind_string = qtn_xdm_compulsory_indicator;
+ empty_item_text = qtn_xdm_settings_must_define;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = ESettingItemPassword;
+ setting_page_resource = r_password_editor_page;
+ name = qtn_xdm_settings_password;
+ empty_item_text = qtn_xdm_text_password;
+ }
+ };
+ }
+
+// ---------------------------------------------------------
+//
+// Settings Pages
+//
+// defines the AVKON_SETTING_PAGE structures referred to in
+// setting_page_resource fields above.
+//
+// These structures define the way in which the editors used
+// to change the setting data are presented.
+//
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_server_name_editor_page
+ {
+ label= qtn_xdm_settings_set_name;
+ type = EEikCtEdwin;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_server_name_editor;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_server_address_editor_page
+ {
+ label= qtn_xdm_settings_address;
+ type = EEikCtEdwin;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_server_address_editor;
+ }
+
+
+RESOURCE AVKON_SETTING_PAGE r_accesspoint_editor_page
+ {
+ label= qtn_xdm_settings_access_point;
+ type = EEikCtEdwin;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_accesspoint_editor;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_sip_url_editor_page
+ {
+ label= qtn_xdm_settings_sip;
+ type = EEikCtEdwin;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_sip_url_editor;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_user_id_editor_page
+ {
+ label= qtn_xdm_settings_username;
+ type = EEikCtEdwin;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_user_id_editor;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_password_editor_page
+ {
+ label= qtn_xdm_settings_password;
+ type = EEikCtSecretEd;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ editor_resource_id = r_password_editor;
+ }
+
+RESOURCE EDWIN r_user_id_editor
+ {
+ flags = EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+ allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase;
+ numeric_keymap=EAknEditorCalculatorNumberModeKeymap;
+ allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+ default_input_mode = EAknEditorTextInputMode;
+ special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+ default_case = EAknEditorLowerCase;
+ avkon_flags = EAknEditorFlagLatinInputModesOnly;
+ width = 0;
+ lines = 0;
+ maxlength = KMaxUserIDLength;
+ }
+
+RESOURCE SECRETED r_password_editor
+ {
+ num_letters = KMaxPasswordLength;
+ }
+
+RESOURCE EDWIN r_server_address_editor
+ {
+ flags = EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+ allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase;
+ numeric_keymap=EAknEditorCalculatorNumberModeKeymap;
+ allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+ default_input_mode = EAknEditorTextInputMode;
+ special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+ default_case = EAknEditorLowerCase;
+ avkon_flags = EAknEditorFlagLatinInputModesOnly;
+ width = 0;
+ lines = 0;
+ maxlength = KMaxServerAddressLength;
+ }
+
+RESOURCE EDWIN r_accesspoint_editor
+ {
+ maxlength = KMaxAccessPointNameLength;
+ }
+
+RESOURCE EDWIN r_server_name_editor
+ {
+ width = 0;
+ lines = 0;
+ flags = EEikEdwinNoLineOrParaBreaks;
+ maxlength = KMaxSettingSetNameLength;
+ }
+
+RESOURCE EDWIN r_sip_url_editor
+ {
+ width = 0;
+ lines = 0;
+ maxlength = KMaxSIPURLLength;
+ }
+
+
+RESOURCE DIALOG r_confirmation_query
+ {
+ flags = EGeneralQueryFlags;
+ buttons = R_AVKON_SOFTKEYS_YES_NO;
+ items=
+ {
+ DLG_LINE
+ {
+ type = EAknCtQuery;
+ id = EGeneralQuery;
+ control = AVKON_CONFIRMATION_QUERY
+ {
+ layout =EConfirmationQueryLayout;
+ };
+ }
+ };
+ }
+
+//----------------------------------------------------
+//
+// string resouces
+// the strings can be localized in loc file
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_str_xdm_settings { buf = qtn_xdm_title; }
+RESOURCE TBUF r_str_xdm_compulsory { buf = qtn_selec_setting_compulsory; }
+RESOURCE TBUF r_str_xdm_must_define { buf = qtn_poc_settings_must_define; }
+RESOURCE TBUF r_str_xdm_use_existing { buf = qtn_xdm_propmt_use_exist; }
+RESOURCE TBUF r_str_xdm_empty_text { buf = qtn_xdm_main_empty_info_text; }
+RESOURCE TBUF r_str_xdm_empty_text_sec { buf = qtn_xdm_main_empty_info_text_secondary; }
+RESOURCE TBUF r_str_xdm_new_set { buf = qtn_xdm_text_new_set; }
+RESOURCE TBUF r_str_xdm_new_set_many { buf = qtn_xdm_text_new_set_many; }
+RESOURCE TBUF r_str_xdm_conf_delete_last { buf = qtn_xdm_conf_delete_last; }
+RESOURCE TBUF r_str_xdm_conf_delete { buf = qtn_query_common_conf_delete; }
+RESOURCE TBUF r_str_xdm_conf_compulsory { buf = qtn_xdm_compulsory_query_info_text; }
+RESOURCE TBUF r_str_xdm_title_pane_text { buf = qtn_xdm_title; }
+RESOURCE TBUF r_str_xdm_name_already_exist { buf = qtn_xdm_set_already_exist_info; }
+RESOURCE TBUF r_str_xdm_ap_name_for_debug_only { buf = qtn_xdm_settings_access_point;}
+
+// ****** PDATA RESOURCES END ******
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/group/XDMPlugin.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is project specification file for GS XDMPlugin.
+*
+*/
+
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+CAPABILITY CAP_ECOM_PLUGIN
+TARGET gsxdmplugin.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10207428
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE XDMPluginImplementationTable.cpp
+SOURCE XDMPlugin.cpp
+SOURCE XDMPluginContainer.cpp
+SOURCE SettingsData.cpp
+SOURCE XDMPluginSettinglist.cpp
+SOURCE XDMPluginSLContainer.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../data
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH ../data
+
+//ECOM resource definition
+START RESOURCE 10207428.rss
+ TARGET gsxdmplugin.rsc
+END // ECOM resource definition
+
+//XDMPlugin resources
+START RESOURCE XDMPluginRsc.rss
+ HEADER
+ TARGETPATH RESOURCE_FILES_DIR
+ LANGUAGE_IDS
+END // XDMPlugin resources
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY eikctl.lib
+LIBRARY commonengine.lib//For RConeResourceLoader
+
+LIBRARY egul.lib // CGulIcon
+LIBRARY aknskins.lib // AknsUtils.h
+LIBRARY apsettingshandlerui.lib // access point UI
+LIBRARY commdb.lib
+LIBRARY apengine.lib //AP engine
+LIBRARY xdmsettingsapi.lib
+LIBRARY gsecomplugin.lib //GS Ecom plugin
+LIBRARY agentdialog.lib // To show access points only in emulator
+
+LIBRARY featmgr.lib // Feature Manager
+LIBRARY hlplch.lib // HlpLauncher
+
+// This is optional - used only by Codewarrior for convenience.
+DOCUMENT 10207428.rss
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/group/XDMPluginIcons.mk Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: XDM Settings UI
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# TODO: Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\gsxdmplugin.mif
+HEADERFILENAME=$(HEADERDIR)\gsxdmplugin.mbg
+
+do_nothing :
+ @rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# TODO: Configure these.
+#
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+ mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+ /c8,8 qgn_prop_set_conn_xdm.bmp
+
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+ @echo $(HEADERFILENAME)&& \
+ @echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file GS XDM Plugin
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+#ifdef __XDM
+
+// Platforms
+PRJ_PLATFORMS
+DEFAULT
+// Help exports
+#include "../help/group/bld.inf"
+
+PRJ_EXPORTS
+// IBYs
+../rom/GSXDMPlugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(gsxdmplugin.iby)
+../rom/GSXDMPluginResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(gsxdmpluginresources.iby)
+// LOC
+../loc/GSXDMPlugin.loc MW_LAYER_LOC_EXPORT_PATH(gsxdmplugin.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+ OPTION TARGETFILE gsxdmplugin.mif
+ OPTION HEADERFILE gsxdmplugin.mbg
+ OPTION SOURCES -c8,8 qgn_prop_set_conn_xdm
+END
+
+
+// MMP Files
+PRJ_MMPFILES
+XDMPlugin.mmp
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/test/group/ut_xdmplugin.mmp
+
+
+#endif //__XDM
+
+// End of File
+
+
Binary file XDMSettingsUI/help/data/xhtml.zip has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/help/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+*
+*
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>
+PRJ_EXPORTS
+:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite
+
+../inc/xdm.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/xdm.hlp.hrh)
+../rom/xdmsettingsuihelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(xdmsettingsuihelps_variant.iby)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/help/inc/xdm.hlp.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+//
+// xdm.hlp.hrh generated by CSXHelp Utilities.
+//
+
+#ifndef __XDM_HLP_HRH__
+#define __XDM_HLP_HRH__
+
+_LIT(KXDM_HLP_LIST_VIEW, "XDM_HLP_LIST_VIEW"); //
+_LIT(KXDM_HLP_EDIT_SET, "XDM_HLP_EDIT_SET"); //
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/help/rom/xdmsettingsuihelps_variant.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __XDMSETTINGSUIHELPS_VARIANT_IBY__
+#define __XDMSETTINGSUIHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE) && defined(__GSXDMPLUGIN_USED)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207428\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10207428\contents.zip)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207428\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207428\index.xml)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207428\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207428\keywords.xml)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10207428\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10207428\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/SettingsData.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin data holding class for XDM setting list
+*
+*/
+
+
+
+
+#ifndef __SettingsData_H__
+#define __SettingsData_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <in_sock.h>
+
+#include "XDMPlugin.hrh"
+
+
+/**
+* CSettingsData data holding class for an XDM set
+*/
+class CSettingsData : public CBase
+ {
+ public:
+
+ /**
+ * Default 1st phase factory method.
+ * Creates an instance of CSettingsData
+ */
+ static CSettingsData* NewL();
+
+ /**
+ * Default 1st phase factory method.
+ * Creates an instance of CSettingsData, leaves it on stack
+ */
+ static CSettingsData* NewLC();
+
+ /**
+ * Destructor
+ */
+ virtual ~CSettingsData();
+
+ /**
+ * Resets all data to initial values
+ */
+ void Reset();
+
+ private:
+
+ /**
+ * 2nd Phase constructor
+ */
+ void ConstructL();
+
+ /**
+ * C++ Constructor
+ */
+ CSettingsData();
+
+ public:
+
+ // Buffer holding the XDM set name
+ TBuf<KMaxSettingSetNameLength> iSettingName;
+
+ // Buffer holding the XDM set name with localized digits for display
+ TBuf<KMaxSettingSetNameLength> iSettingNameDisp;
+
+ // Buffer holding the XDM set server address
+ TBuf<KMaxServerAddressLength> iServerAddress;
+
+ // Access point number
+ TInt32 iAccessPoint;
+
+ // Buffer holding the access point number as a descriptor
+ TBuf<KMaxAccessPointDesLength> iAccessPointDes;
+
+ // Buffer holding the SIP URL
+ TBuf<KMaxSIPURLLength> iSipURL;
+
+ // Buffer holding the User ID
+ TBuf<KMaxUserIDLength> iUserID;
+
+ // Buffer holding the password
+ TBuf<KMaxPasswordLength> iPassword;
+
+ // Buffer holding the access point name
+ TBuf<KMaxAccessPointNameLength> iAccessPointName;
+
+ // XDM setting, settings id, used to identify in XDM settings API
+ TInt32 iSettingId;
+ };
+
+#endif // __SettingsData_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMExternalInterface.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file with UID definitions
+ *
+*/
+
+
+
+#ifndef XDMEXTERNALINTERFACE_H
+#define XDMEXTERNALINTERFACE_H
+
+#include <e32std.h>
+#include <bldvariant.hrh>
+#include <XDMPluginRsc.rsg>
+#include "XDMPlugin.h"
+#define XDM_PLUGIN
+
+/**
+* This UID is used for both the view UID and the ECOM plugin implementation
+* UID.
+*/
+const TUid KGSXDMPluginUid = { 0x10207429 };
+
+// View UIDs
+const TUid KViewId= {0x1028236B};
+
+#endif // XDMEXTERNALINTERFACE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMPlugin.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin, UI(CAknView) interface header
+*
+*/
+
+
+
+
+#ifndef GS_XDMPLUGIN_H
+#define GS_XDMPLUGIN_H
+
+// INCLUDES
+#include <aknview.h>
+#include <eikclb.h>
+#include <ConeResLoader.h>
+#include <gsplugininterface.h>
+
+#include "XDMPlugin.hrh"
+
+// FORWARD DECLARATIONS
+class CXDMPluginContainer;
+class CXDMPluginSLContainer;
+class CAknViewAppUi;
+class CSettingsData;
+
+/**
+* This UID is used for both the view UID and the ECOM plugin implementation
+* UID.
+*/
+//const TUid KGSXDMPluginUid = { 0x10207429 };
+
+// CLASS DECLARATION
+
+/**
+* CXDMPlugin view class (CAknView).
+*
+* This is XDM GS plugin.
+*/
+class CXDMPlugin : public CGSPluginInterface
+ {
+
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS two-phased constructor
+ * @return
+ */
+ static CXDMPlugin* NewL( TAny* aInitParams );
+
+ /**
+ * Destructor.
+ */
+ ~CXDMPlugin();
+
+ /**
+ * Load the SettingsView with specified XDM set and type of loading
+ * The types are EEditExisting, ENewDefault, ENewFromExisting
+ */
+ void LoadSettingsViewL(TXDMSettingsViewType aType, TDesC& aXDMSetName);
+
+ /**
+ * Loads the Main View where list of XDM sets are visible
+ */
+ void LoadMainViewL();
+
+ /**
+ * Manual resource change method
+ * @param aType ype of resource
+ */
+ void HandleResourceChangeManual(TInt aType);
+
+ /**
+ * Hides MSK if not needed
+ */
+ void UpdateMskL();
+
+ public: // From CAknView
+
+ /**
+ * This function is used for identifying the plugin
+ */
+ TUid Id() const;
+
+ /**
+ * See CAknView
+ */
+ //void HandleClientRectChange();
+ void HandleViewRectChange();
+
+ /**
+ * See CAknView
+ */
+ void DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid aCustomMessageId,
+ const TDesC8& aCustomMessage );
+ /**
+ * See CAknView
+ */
+ void DoDeactivate();
+
+ /**
+ * See CAknView
+ */
+ void HandleCommandL( TInt aCommand );
+
+
+
+ protected:
+
+ /**
+ * C++ default constructor.
+ */
+ CXDMPlugin( );
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ private:
+
+ /**
+ * See base classes
+ */
+ void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+ public: // From CGSPluginInterface
+
+ /**
+ * See CGSPluginInterface
+ */
+ void GetCaptionL( TDes& aCaption ) const;
+
+ /**
+ * See CGSPluginInterface
+ */
+ TInt PluginProviderCategory() const;
+
+ /**
+ * @see CGSPluginInterface
+ */
+ CGulIcon* CreateIconL( const TUid aIconType );
+
+
+ protected: //Data
+
+ // Reference to application UI - not owned.
+ CAknViewAppUi* iAppUi;
+
+ // RConeResourceLoader
+ RConeResourceLoader iResources;
+
+ // Previous View ID
+ TVwsViewId iPrevViewId; // Previous view.
+
+ private:
+
+ // Pointer to the main list container - owned
+ CXDMPluginContainer* iMainListContainer;
+
+ // Pointer to the setting list container - owned.
+ CXDMPluginSLContainer* iSettingListContainer;
+
+ // Pointer to the current container - not owned.
+ CCoeControl* iCurrentContainer;
+
+#ifdef _DEBUG
+ friend class UT_CXDMPluginContainer;
+#endif
+ };
+
+#endif // GS_XDMPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMPlugin.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Settings enumerations
+*
+*/
+
+
+#ifndef XDM_PLUGIN_HRH
+#define XDM_PLUGIN_HRH
+
+/**
+ * TSettingItems - identifiers for individual setting items
+ */
+enum TSettingItems
+ {
+ ESettingItemSettingName = 1,
+ ESettingItemAccessPoint,
+ ESettingItemServerAddress,
+ ESettingItemSipURL,
+ ESettingItemUserID,
+ ESettingItemPassword
+ };
+
+/**
+ * TGSXDMPluginCommandIds - GSXDMPlugin menu commands
+ */
+enum TGSXDMPluginCommandIds
+ {
+ EGSXDMPluginCmdChange = 0x06000,
+ EGSXDMPluginCmdEdit,
+ EGSXDMPluginCmdNewSettings,
+ EGSXDMPluginCmdNewExisting,
+ EGSXDMPluginCmdNewDefault,
+ EGSXDMPluginCmdDelete,
+ EGSXDMPluginCmdExitFromSL
+ };
+
+/**
+ * TXDMSettingsViewType - Used inside UI to differentiate
+ * different kinds of editing
+ */
+enum TXDMSettingsViewType
+ {
+ EEditExisting,
+ ENewDefault,
+ ENewFromExisting
+ };
+
+/**
+ * Constants used in application
+ */
+enum TXDMSettingsIndex
+ {
+ ESettingNameIndex = 0,
+ EAccessPointIndex,
+ EServerAddressIndex,
+ ESipURLIndex,
+ EUserIDIndex,
+ EPasswordIndex
+ };
+
+/**
+ * Constants used in resources and in application
+ */
+#define KMaxSettingSetNameLength 30
+#define KMaxSettingSetNameArrayGran 10
+#define KMaxUserIDLength 100
+#define KMaxServerAddressLength 100
+#define KMaxPasswordLength 100
+#define KMaxSIPURLLength 100
+#define KMaxAccessPointNameLength 30
+#define KMaxAccessPointDesLength 30
+#define KMaxMessageToDisplayLength 100
+
+
+#endif // XDM_PLUGIN_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMPluginContainer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin main list container.
+*
+*/
+
+
+
+
+#ifndef GS_XDMPLUGIN_CONTAINER_H
+#define GS_XDMPLUGIN_CONTAINER_H
+
+// INCLUDES
+#include <bldvariant.hrh>
+#include <coeccntx.h>
+#include <eikclb.h>
+#include <eikmobs.h>
+#include <akntitle.h>
+#include <aknview.h>
+
+#include "XDMPlugin.hrh"
+
+
+// FORWARD DECLARATION
+class CGSListBoxItemTextArray;
+class CEikTextListBox;
+class CAknSingleStyleListBox;
+class CXDMPluginMainList;
+class CAknColumnListBox;
+class CAknViewAppUi;
+class CXDMPlugin;
+class CMainView;
+
+// CLASS DECLARATION
+
+/**
+* CXDMPluginContainer main list container class
+*/
+class CXDMPluginContainer : public CCoeControl,
+ public MEikListBoxObserver,
+ public MEikMenuObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CXDMPluginContainer(CAknView* aView);
+
+ /**
+ * Symbian OS constructor.
+ *
+ * @param aRect Listbox's rect.
+ */
+ void ConstructL( const TRect& aRect );
+
+ /**
+ * Destructor.
+ */
+ ~CXDMPluginContainer();
+
+ public: // From CCoeControl
+
+ /**
+ * See CCoeControl
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * See CCoeControl
+ */
+ CCoeControl* ComponentControl( TInt aIndex ) const;
+
+ /**
+ * See CCoeControl
+ */
+ TKeyResponse OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType );
+
+ /**
+ * See CCoeControl
+ */
+ void SizeChanged();
+
+ /**
+ * See CCoeControl
+ */
+ void HandleResourceChange( TInt aType );
+
+ /**
+ * Gets help context
+ */
+ void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+ /**
+ * See CCoeControl
+ */
+ void FocusChanged(TDrawNow aDrawNow);
+
+
+ public: // own methods
+
+ /**
+ * Invokes editing on current item, in response to UI Edit command
+ */
+ void EditCurrentItemL();
+
+ /**
+ * See MEikListBoxObserver
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ /**
+ * From MEikMenuObserver
+ */
+ void SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ){};
+
+
+ /**
+ * From MEikMenuObserver
+ */
+ void ProcessCommandL( TInt /*aCommandId*/ ){};
+
+ /**
+ * Finds whether main list is empty
+ * @return ETrue if main list is empty.
+ */
+ TBool IsListEmpty();
+
+ /**
+ * Finds whether the current item is the last item in main list
+ * @return ETrue if current item is last in main list.
+ */
+ TBool IsLastItem();
+
+ /**
+ * Delete the currently focused set. Also deletes it using XDM API
+ */
+ void DeleteCurrentSetL();
+
+ /**
+ * Load the main list using XDM API, and perform other necessary tasks
+ */
+ void LoadSettingsListArrayL();
+
+ /**
+ * Get the name of currently focused set. Usually called by UI.
+ * The pointer to buffer remains on heap, which is deleted by caller.
+ * @return HBufC* pointer to currently focused set name
+ */
+ HBufC* GetCurrentSetNameLC();
+
+ /**
+ * This function starts the deleting current XDM set. All sub functions
+ * are called through this function.
+ */
+ void DeleteSetProcedureL();
+
+ /**
+ * This function does necessary action on layout change, it is called from
+ * actual resource change function.
+ * @param aType type of resource
+ */
+ void HandleResourceChangeManual(TInt aType);
+
+ /**
+ * Set the focus to the given set name if it exist
+ * @param aSetName Set name to set focus
+ */
+ void SetFocusIfExist(TDes& aSetName);
+
+
+ private: // own methods
+
+ /**
+ * Perform the initial setup of the main list. Called by Constructor
+ */
+ void SetupListL();
+
+ /**
+ * Get the Setting ID of the current set
+ * @return TInt setting ID of the current set
+ */
+ TInt CXDMPluginContainer::GetCurrentSetIdL();
+
+ /**
+ * Load XDM Collection names with trap, useful when list doesnt have anything
+ * @param Reference to setting ids
+ * @return CDesCArray collection names
+ */
+ CDesCArray* LoadCollectionNamesL(RArray<TInt>& aSettingIDs);
+
+
+
+ private: // data
+
+ // Pointer to the main list, owned
+ CAknColumnListBox* iMainList;
+
+ // Pointer to the application view, not owned
+ CAknView* iView; // not owned
+
+ // The XDM set names list array, not owned
+ CDesCArray* iSettingListArray;
+
+ // Buffer for holding new XDM set name
+ TBuf<KMaxSettingSetNameLength> iSettingNewName;
+
+ // Title for menu pane
+ TBuf<KMaxSettingSetNameLength> iTitle;
+
+ // Pointer to title pane, not owned
+ CAknTitlePane* iTitlePane;
+
+ // Menubar, owned
+ CEikMenuBar* iEikMenuBar;
+ };
+
+#endif //GS_XDMPLUGIN_CONTAINER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMPluginSLContainer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin Settings list container.
+*
+*/
+
+
+
+
+#ifndef GS_XDMPLUGIN_SL_CONTAINER_H
+#define GS_XDMPLUGIN_SL_CONTAINER_H
+
+// INCLUDES
+#include <bldvariant.hrh>
+#include <coeccntx.h>
+#include <eikclb.h>
+#include <aknview.h>
+
+#include "XDMPlugin.hrh"
+
+// FORWARD DECLARATION
+class CGSListBoxItemTextArray;
+class CEikTextListBox;
+class CSettingsData;
+class CXDMPluginSettinglist;
+class CAknColumnListBox;
+class CAknViewAppUi;
+
+/**
+* CXDMPluginSLContainer Settings list container class
+*/
+class CXDMPluginSLContainer : public CCoeControl, MEikListBoxObserver
+ {
+ public:
+
+ /**
+ * C++ Constructor
+ */
+ CXDMPluginSLContainer(CAknView* aView);
+
+ /**
+ * Symbian OS constructor.
+ * @param aRect Listbox's rect.
+ */
+ void ConstructL( const TRect& aRect);
+
+ /**
+ * Destructor.
+ */
+ ~CXDMPluginSLContainer();
+
+ public: // From CCoeControl
+
+ /**
+ * See CCoeControl.
+ */
+ TInt CountComponentControls() const;
+
+ /**
+ * See CCoeControl.
+ */
+ CCoeControl* ComponentControl( TInt aIndex ) const;
+
+ /**
+ * See CCoeControl.
+ */
+ TKeyResponse OfferKeyEventL(
+ const TKeyEvent& aKeyEvent, TEventCode aType );
+
+ /**
+ * See CCoeControl.
+ */
+ void SizeChanged();
+
+ /**
+ * See CCoeControl.
+ */
+ void Draw(const TRect& aRect) const;
+
+ /**
+ * See CCoeControl
+ */
+ void HandleResourceChange( TInt aType );
+
+ /**
+ * Gets help context
+ */
+ void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+ /**
+ * See CCoeControl
+ */
+ void FocusChanged(TDrawNow aDrawNow);
+
+ public:
+
+ /**
+ * Edit currently focused item on settings list. called from UI
+ */
+ void EditCurrentItemL();
+
+ /**
+ * See MEikListBoxObserver
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ /**
+ * Prepare the XDM set with given name for editing
+ * @param aXDMSetName reference to the XDM set name to be edited
+ */
+ void PrepareXDMSetForEditingL(TDesC& aXDMSetName);
+
+ /**
+ * Prepare the a new XDM set with default values
+ * @param none
+ */
+ void PrepareXDMSetNewDefaultL();
+
+ /**
+ * Prepare the a new XDM set with values from an existing set
+ * @param aXDMSetName reference to the new XDM set name
+ */
+ void PrepareNewXDMSetFromExistingL(TDesC& aXDMSetName);
+
+ /**
+ * Display the dialog to the user to select the creation of new set
+ * from existing sets. Saves the selected name to iData
+ * @return ETrue if user has choosen a set, return EFalse if user cancels
+ */
+ TBool DisplayNewXDMSetOptionsL();
+
+ /**
+ * Called by the UI when back button is pressed, to perform needed steps
+ * @return ETrue if settings list is allowed to close
+ */
+ TBool IsExitProcessingOKL();
+
+ /**
+ * Handle manual resource change with its type
+ * @param aType, type of resource
+ */
+ void HandleResourceChangeManual(TInt aType);
+
+ /**
+ * Save settings if possible, without any user interaction.
+ * this is useful for force exit, e.g. when mmc taken out
+ */
+ void SaveSettingsIfPossibleL();
+
+ /**
+ * Return the name of current set in iData
+ * @return TDes reference to current set
+ */
+ TDes& GetCurrentSetName();
+
+
+ private: // Most of these methods perform operations using iData
+
+ /**
+ * Sets the title pane text with given discriptor
+ * @param aTitleText text to be shown on title pane
+ */
+ void SetTitlePaneTextL( const TDesC& aTitleText ) const;
+
+ /**
+ * Finds out whether compulsory items are filled
+ * @return ETrue if compulsory items are filled
+ */
+ TBool AreCompulsoryItemsFilled();
+
+ /**
+ * Display a query dialog to user that compulsory settings are not
+ * filled, and if user wants to delete the settings
+ * @return ETrue if user wants to delete the settings
+ */
+ TBool DisplayDeleteOrDontSaveDialogL();
+
+ /**
+ * Update an XDM set if it already exist or create it if it doesnt exist
+ * @param aShowDialog whether dialog will be displayed or not
+ * @return ETrue if save procedure goes ok
+ */
+ TBool SaveOrCreateAndSaveXDMSetL(TBool aShowDialog);
+
+ /**
+ * Deletes the XDM set if it exist in the XDM settings API
+ */
+ void DeleteXDMSetIfExistL();
+
+ /**
+ * Gets the setting id of the given set name
+ * @param aXDMSetName reference to XDM set name
+ * @return settingid of the given xdm set
+ */
+ TInt GetSettingIdL(TDesC& aXDMSetName);
+
+ /**
+ * If the given XDM set name with given ID is exist or not
+ * @param aXDMSetName reference to XDM set name
+ * aSettingId settings id of the XDM
+ * @return ETrue of XDM set exist with given name
+ */
+ TBool IsXDMSetNameExistL(TDesC& aXDMSetName, TInt32& aSettingId);
+
+ /**
+ * Load XDM Collection names with trap, useful when list doesnt have anything
+ * @param Reference to setting ids
+ * @return CDesCArray collection names
+ */
+ CDesCArray* LoadCollectionNamesL(RArray<TInt>& aSettingIDs, TBool aDisp);
+
+ /**
+ * Check the given name and returns the possible altered name. NULL
+ * pointer is returned no change is needed in aName, so aName can be
+ * used if NULL pointer is returned. If some valid pointer is returned
+ * then that pointer is owned by client, and needed to be deleted after
+ * usage.
+ * @param aName, the name from which to start suggestion.
+ * @param aChanged, returns ETrue if an alternate name is returned.
+ * @return HBufC* pointer to the new name, can be NULL if not needed.
+ */
+ HBufC* DoMakeValidNameL(HBufC* aName, TBool& aChanged);
+
+ /**
+ * Ensures that the passed name is valid, length > 0 & length < max.
+ * If length == 0, leaves with KErrInvalidName
+ * If name is only whitespace, leaves with KErrInvalidName
+ * If name is longer than max, name is truncated
+ * It copies the name, pushes it onto the CleanupStack and passes
+ * ownership.
+
+ * @param aName The name
+ * @param aChanged A reference to a boolean to hold whether the name
+ * had been changed or not.
+ * @return The valid-length name
+ */
+ HBufC* EnsureMaxLengthLC( const TDesC* aName, TBool& aChanged);
+
+ /**
+ * Given aName in the format <prefix> or
+ * <prefix><brace><integer><brace>, return a
+ * pointer to the leading part. That is, if there is
+ * trailing <space><integer>, then that is excluded;
+ * if there is no trailing part, then the original
+ * decriptor is returned.
+ * Examples:
+ * - "Foo" returns "Foo";
+ * - "Foo 12" returns "Foo 12";
+ * - "Foo(12)" returns "Foo";
+ * - "Foo 12 (34)" returns "Foo 12 ";
+ * - "Foo bar" returns "Foo bar";
+ * - "Foo " returns "Foo ".
+ * @param aName The name to get the prefix from
+ * @return The prefix
+ */
+ TPtrC GetPrefix( const TDesC& aName );
+
+
+ /**
+ * If aName is constructed from aPrefix with a postfix, get the numeric
+ * value of the postfix, e.g:
+ * - GetPostfix( "Foo (3)", "Foo" ) == 3
+ * - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45
+ * If aName is the same as aPrefix, return 0, e.g.:
+ * - GetPostfix( "Foo", "Foo" ) == 0
+ * If aName is not constructed from aPrefix, return -1, e.g.:
+ * - GetPostfix( "Foobar", "Foo" ) == -1
+ * - GetPostfix( "Fo 23 45", "Foo" ) == -1
+ * @param aName The name to get the postfix from
+ * @param aPrefix The prefix
+ * @return The postfix
+ */
+ TInt GetPostfix( const TDesC& aName, const TDesC& aPrefix );
+
+
+ private: // data
+
+ // CXDMPluginSettinglist owned
+ CXDMPluginSettinglist* iSettingList;
+
+ // Pointer to settings data owned
+ CSettingsData* iData;
+
+ // Pointer to the application view, not owned
+ CAknView* iView; // not owned
+
+ };
+
+#endif //GS_XDMPLUGIN_SL_CONTAINER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/inc/XDMPluginSettinglist.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin, Setting List class
+*
+*/
+
+
+
+
+#ifndef CXDMPLUGINSETTINGLIST_H
+#define CXDMPLUGINSETTINGLIST_H
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <aknsettingitemlist.h>
+#include <agentdialog.h>
+
+// FORWARD DECLARATIONS
+class CSettingsData;
+
+/**
+* CXDMPluginSettinglist derived from CAknSettingItemList
+*/
+class CXDMPluginSettinglist : public CAknSettingItemList
+ {
+
+ public:
+
+ /**
+ * Symbian OS two-phased constructor
+ * @param reference to CSettingsData from which data to be displayed
+ */
+ static CXDMPluginSettinglist* NewL(CSettingsData &aData);
+
+ /**
+ * Symbian OS two-phased constructor, leave pointer to stack
+ * @param reference to CSettingsData from which data to be displayed
+ */
+ static CXDMPluginSettinglist* NewLC(CSettingsData &aData);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXDMPluginSettinglist();
+
+ /**
+ * Inherited from base classes. See CCoeControl
+ */
+ void SizeChanged();
+
+ /**
+ * Edit the indexed item. This probably came as a result of UI command
+ * @param aIndex index to the item
+ * aCalledFromMenu ETrue of this call resulted from UI command
+ */
+ void EditItemL (TInt aIndex, TBool aCalledFromMenu);
+
+ /**
+ * Actual editing of item done here, from whereever the call is made from
+ */
+ void EditCurrentItemL();
+
+ /**
+ * Gets the Access point name
+ * @param aAP Access point number as integer
+ * aAccessPoint reference to TDes, doesnt change if AP not found
+ * otherwise access point name returns here
+ */
+ void GetAccessPointNameL(TInt32 aAP, TDes& aAccessPoint);
+
+ /**
+ * Sets the focus to the first item of the settings list
+ */
+ void ResetItemIndex();
+
+ private:
+
+ /**
+ * C++ constructor
+ * @param reference to CSettingsData
+ */
+ CXDMPluginSettinglist(CSettingsData &aData);
+
+ /**
+ * See CAknSettingItemList
+ */
+ CAknSettingItem* CreateSettingItemL (TInt aSettingId);
+
+ /**
+ * Edit the AccessPoint, We edit the access point differently than other
+ * settings. We bypass the list's text editor and open the S60 standard
+ * access point editor
+ */
+ void EditAccessPointL();
+
+ /**
+ * Saves the changed settings to the list's data
+ * @param aIndex index of the setting to be saved
+ */
+ void SaveSettingL(TInt aIndex);
+
+ /**
+ * Sets the title pane text with given discriptor
+ * @param aTitleText text to be shown on title pane
+ */
+ void SetTitlePaneTextL( const TDesC& aTitleText ) const;
+
+ private:
+
+ // Reference to the data owned by container
+ CSettingsData& iSettingsData;
+
+ };
+
+#endif // CXDMPLUGINSETTINGLIST_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/loc/GSXDMPlugin.loc Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Localization strings for GS XDM Plugin
+*
+*/
+
+
+
+
+// LOCALISATION STRINGS
+
+//d:Caption string for AIF file (short)
+//d:GS XDM Settings plugin
+//l:cell_app_pane_t1
+//r:3.0
+#define qtn_apps_xdm_grid "XDMSettingsApp"
+
+//d:Caption string for AIF file (long)
+//d:GS XDM Settings plugin
+//l:list_single_large_graphic_pane_t1
+//r:3.0
+#define qtn_apps_xdm_list "XDMSettingsApp"
+
+//d:Popup confirmation dialog text when deleting the last XDM set of the list
+//d:GS XDM Settings plugin
+//l:popup_note_window
+//r:3.1
+#define qtn_xdm_conf_delete_last "%U is the last XDM set. Are you sure to delete it?"
+
+//d:Popup confirmation dialog text when deleting a XDM set, not the last.
+//d:GS XDM Settings plugin
+//l:popup_note_window
+//r:3.1
+#define qtn_xdm_conf_delete "Delete %U?"
+
+//d:Menu Item use existing set
+//d:GS XDM Settings plugin
+//l:heading_pane_t1
+//r:3.1
+#define qtn_xdm_propmt_use_exist "Use existing set"
+
+//d:Menu Item to change a specific setting in an XDM set
+//d:GS XDM Settings plugin
+//l:list_single_pane_t1_cp2
+//r:3.1
+#define qtn_xdm_settings_change "Change"
+
+//d:Default text in password setting field
+//d:GS XDM Settings plugin
+//l:list_set_graphic_pane_t1
+//r:3.1
+#define qtn_xdm_text_password "****"
+
+//d:Title for password setting field
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_password "HTTP password"
+
+//d:Title for SIP setting field
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_sip "SIP in use"
+
+//d:Title for user id settings
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_username "HTTP username"
+
+//d:Title of the service address setting field
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_address "XDM service address"
+
+//d:Default text in compulsory setting fields
+//d:GS XDM Settings plugin
+//l:list_set_graphic_pane_t1
+//r:3.1
+#define qtn_xdm_settings_must_define "Must be defined"
+
+//d:Title of the access point setting field
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_access_point "Access point"
+
+//d:Default xdm set name
+//d:GS XDM Settings plugin
+//l:list_set_graphic_pane_t1
+//r:3.1
+#define qtn_xdm_text_new_set_many "New XDM set(%N)"
+
+//d:Menu item for setting up a new XDM set
+//d:GS XDM Settings plugin
+//l:list_single_pane_t1_cp2
+//r:3.1
+#define qtn_xdm_text_new_set "New XDM set"
+
+//d:Title of XDM set name setting
+//d:GS XDM Settings plugin
+//l:list_setting_pane_t1
+//r:3.1
+#define qtn_xdm_settings_set_name "XDM set name"
+
+//d:Menu item delete, to delete an specific XDM set
+//d:GS XDM Settings plugin
+//l:list_single_pane_t1_cp2
+//r:3.1
+#define qtn_xdm_options_delete "Delete"
+
+//d:Title of the popup sub menu
+//d:GS XDM Settings plugin
+//l:list_single_popup_submenu_pane_t1
+//r:3.1
+#define qtn_xdm_options_new_sub_existing "Use existing set"
+
+//d:Menu item to edit an XDM set
+//d:GS XDM Settings plugin
+//l:list_single_pane_t1_cp2
+//r:3.1
+#define qtn_xdm_options_edit_set "Edit XDM set"
+
+//d: Menu Item to use default set template for a new set
+//d:GS XDM Settings plugin
+//l:list_single_popup_submenu_pane_t1
+//r:3.1
+#define qtn_xdm_options_new_sub_default "Use default set"
+
+//d:Menu item New XDM set
+//d:GS XDM Settings plugin
+//l:list_single_pane_t1_cp2/opt3
+//r:3.1
+#define qtn_xdm_options_new_set "New XDM set"
+
+//d:Compulsory setting item indicator
+//d:GS XDM Settings plugin
+//l:list_set_graphic_pane_t1
+//r:3.1
+#define qtn_xdm_compulsory_indicator "*"
+
+//d:XDM sets, empty list primary text
+//d:GS XDM Settings plugin
+//l:main_pane_empty_t1/opt2
+//r:3.1
+#define qtn_xdm_main_empty_info_text "No XDM settings"
+
+//d:XDM sets, empty list secondary text
+//d:GS XDM Settings plugin
+//l:main_list_empty_pane/opt2
+//r:3.1
+#define qtn_xdm_main_empty_info_text_secondary "Create new settings from Options menu"
+
+//d:Text in main title pane
+//d:GS XDM Settings plugin
+//l:title_pane_t2/opt12
+//r:3.1
+#define qtn_xdm_title "XDM settings"
+
+//d:Text in pop up query dialog for reminding compulsory settings
+//d:GS XDM Settings plugin
+//l:popup_note_window
+//r:3.1
+#define qtn_xdm_compulsory_query_info_text "Incomplete XDM setting set. Delete set?"
+
+//d:Text in info note that a given xdm set name is already exist
+//d:GS XDM Settings plugin
+//l:popup_note_window
+//r:3.1
+#define qtn_xdm_set_already_exist_info "Name already in use: %U"
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/rom/GSXDMPlugin.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: GS XDM Plugin UI
+*
+*/
+
+
+#ifndef __GS_XDM_Plugin_IBY__
+#define __GS_XDM_Plugin_IBY__
+
+#include <bldvariant.hrh>
+#ifdef __XDM
+
+//GS plugin in use
+#ifdef RD_GS_RENOVATION
+
+// GS XDM Plugin UI
+ECOM_PLUGIN(GSXDMPlugin.dll,10207428.rsc) // this publishes the DLL and the
+ // resource file to the correct location
+data=DATAZ_\BITMAP_DIR\GSXDMplugin.mif BITMAP_DIR\GSXDMplugin.mif
+
+#endif //RD_GS_RENOVATION
+
+#endif //__XDM
+
+#endif //__GS_XDM_Plugin_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/rom/GSXDMPluginResources.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: GS XDM Plugin UI Resources
+*
+*/
+
+
+#ifndef __GS_XDM_Plugin_Resources_IBY__
+#define __GS_XDM_Plugin_Resources_IBY__
+
+#include <bldvariant.hrh>
+#ifdef __XDM
+
+//GS plugin in use
+#ifdef RD_GS_RENOVATION
+
+// GS XDM Plugin UI
+
+data=DATAZ_\RESOURCE_FILES_DIR\XDMPluginRsc.RSC RESOURCE_FILES_DIR\XDMPluginRsc.RSC
+
+#endif //RD_GS_RENOVATION
+
+#endif //__XDM
+
+#endif //__GS_XDM_Plugin_Resources_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/SettingsData.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin data holding class for XDM setting list
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "SettingsData.h"
+
+// -----------------------------------------------------------------------------
+// CSettingsData::NewL
+// -----------------------------------------------------------------------------
+//
+CSettingsData *CSettingsData::NewL()
+ {
+ CSettingsData *self = CSettingsData::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSettingsData::NewLC()
+// -----------------------------------------------------------------------------
+//
+CSettingsData *CSettingsData::NewLC()
+ {
+ CSettingsData *self = new (ELeave) CSettingsData();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSettingsData::~CSettingsData()
+// -----------------------------------------------------------------------------
+//
+CSettingsData::~CSettingsData()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSettingsData::CSettingsData()
+// -----------------------------------------------------------------------------
+//
+CSettingsData::CSettingsData()
+ {
+ // initialise local data
+ Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// CSettingsData::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CSettingsData::ConstructL()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSettingsData::Reset()
+// -----------------------------------------------------------------------------
+//
+void CSettingsData::Reset()
+ {
+ iSettingName = KNullDesC;
+ iSettingNameDisp = KNullDesC;
+ iServerAddress = KNullDesC;
+ iAccessPoint = -1;
+ iAccessPointDes = KNullDesC;
+ iSipURL = KNullDesC;
+ iUserID= KNullDesC;
+ iPassword = KNullDesC;
+ iAccessPointName = KNullDesC;
+ iSettingId = -1;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/XDMPlugin.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,474 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDMPlugin Implementation
+*
+*/
+
+
+
+
+// Includes
+#include "XDMExternalInterface.h"
+
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
+#include <GSPrivatePluginProviderIds.h>
+#include <eikmenub.h>
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <XdmSettingsApi.h>
+#include <AknQueryDialog.h>
+#include <featmgr.h>
+#include <hlplch.h>
+#include <csxhelp/xdm.hlp.hrh>
+#include <gsxdmplugin.mbg>
+#include <bautils.h>
+
+#include "XDMPlugin.h"
+#include "XDMPluginContainer.h"
+#include "XDMPluginSLContainer.h"
+#include "XDMPlugin.hrh"
+
+
+// Constants
+_LIT( KGSXDMPluginResourceFileName, "z:\\resource\\XDMPluginRsc.rsc" );
+
+#ifdef __SCALABLE_ICONS
+// bitmap
+_LIT( KGSXDMPluginIconFileName, "\\resource\\apps\\GSXDMplugin.mif");
+#else //__SCALABLE_ICONS
+// svg file
+_LIT( KGSXDMPluginIconFileName, "\\resource\\apps\\GSXDMplugin.mbm");
+#endif //__SCALABLE_ICONS
+
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::CXDMPlugin()
+// Constructor
+//
+// ---------------------------------------------------------------------------
+//
+CXDMPlugin::CXDMPlugin( )
+ : iAppUi( CAknView::AppUi() ), iResources( *CCoeEnv::Static() )
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::~CXDMPlugin()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CXDMPlugin::~CXDMPlugin()
+ {
+ if (iCurrentContainer)
+ {
+ if(iAppUi)
+ iAppUi->RemoveFromViewStack( *this, iCurrentContainer );
+ iCurrentContainer = NULL;
+ }
+
+ if( iMainListContainer )
+ {
+ delete iMainListContainer;
+ iMainListContainer=NULL;
+ }
+
+ if (iSettingListContainer)
+ {
+ delete iSettingListContainer;
+ iSettingListContainer=NULL;
+ }
+
+ iResources.Close();
+ /** Nice to know when the plugin is cleaned up */
+ #ifdef _DEBUG
+ RDebug::Print( _L( "[CXDMPlugin] ~CXDMPlugin()" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::ConstructL()
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::ConstructL()
+ {
+ // To know if the plugin is loaded (for debugging)
+ #ifdef _DEBUG
+ RDebug::Print(_L("[CXDMPlugin] ConstructL()" ));
+ RDebug::Print( _L( "[CXDMPlugin] Loading resource from :" ) );
+ RDebug::Print( KGSXDMPluginResourceFileName );
+ #endif
+
+ TFileName fileName( KGSXDMPluginResourceFileName );
+ BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
+ iResources.OpenL( fileName );
+ BaseConstructL( R_GS_XDM_MAIN_VIEW );
+
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::NewL()
+// Static constructor
+// ---------------------------------------------------------------------------
+//
+CXDMPlugin* CXDMPlugin::NewL( TAny* /*aInitParams*/ )
+ {
+ CXDMPlugin* self = new(ELeave) CXDMPlugin( );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::Id() const
+// ---------------------------------------------------------------------------
+//
+TUid CXDMPlugin::Id() const
+ {
+ return KGSXDMPluginUid;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::HandleClientRectChange()
+// ---------------------------------------------------------------------------
+void CXDMPlugin::HandleViewRectChange()
+ {
+ if ( iMainListContainer->IsVisible() )
+ {
+ iMainListContainer->SetRect( ClientRect() );
+ }
+
+ if ( iSettingListContainer->IsVisible() )
+ {
+ iSettingListContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::DoActivateL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/ )
+ {
+ iPrevViewId = aPrevViewId;
+ if (iCurrentContainer)
+ {
+ iAppUi->RemoveFromViewStack( *this, iCurrentContainer );
+ iCurrentContainer = NULL;
+ }
+
+
+ if( iMainListContainer )
+ {
+ delete iMainListContainer;
+ iMainListContainer=NULL;
+ }
+
+ if( iSettingListContainer )
+ {
+ delete iSettingListContainer;
+ iSettingListContainer = NULL;
+ }
+
+ iMainListContainer = new( ELeave ) CXDMPluginContainer(this);
+ iMainListContainer->SetMopParent(this);
+ TRAPD( error, iMainListContainer->ConstructL( ClientRect() ) );
+ if (error)
+ {
+ delete iMainListContainer;
+ iMainListContainer = NULL;
+ User::Leave( error );
+ }
+
+ iSettingListContainer = new( ELeave ) CXDMPluginSLContainer(this);
+ iSettingListContainer->SetMopParent(this);
+ TRAPD( error1, iSettingListContainer->ConstructL( ClientRect()));
+ if (error1)
+ {
+ delete iSettingListContainer;
+ iSettingListContainer = NULL;
+ User::Leave( error1 );
+ }
+
+ // switching control
+ iSettingListContainer->MakeVisible(EFalse);
+ iCurrentContainer = iMainListContainer;
+ iAppUi->AddToViewStackL( *this, iCurrentContainer );
+ UpdateMskL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::DoDeactivate()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::DoDeactivate()
+ {
+ // try to save settings if in settings list container
+ TInt err;
+ if (iCurrentContainer == iSettingListContainer)
+ TRAP(err, iSettingListContainer->SaveSettingsIfPossibleL());
+ if (iCurrentContainer)
+ iAppUi->RemoveFromViewStack( *this, iCurrentContainer );
+ iCurrentContainer = NULL;
+
+ if( iMainListContainer )
+ {
+ delete iMainListContainer;
+ iMainListContainer = NULL;
+ }
+
+ if( iSettingListContainer )
+ {
+ delete iSettingListContainer;
+ iSettingListContainer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::HandleCommandL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::HandleCommandL( TInt aCommand )
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ if (iCurrentContainer == iSettingListContainer)
+ {
+ if (iSettingListContainer->IsExitProcessingOKL())
+ LoadMainViewL();
+ }
+ else
+ iAppUi->ActivateLocalViewL( iPrevViewId.iViewUid );
+ break;
+ case EGSXDMPluginCmdChange:
+ iSettingListContainer->EditCurrentItemL();
+ break;
+ case EGSXDMPluginCmdEdit:
+ iMainListContainer->EditCurrentItemL();
+ break;
+ case EGSXDMPluginCmdNewExisting:
+ if(iSettingListContainer->DisplayNewXDMSetOptionsL()) // if user ok
+ LoadSettingsViewL(ENewFromExisting, iSettingListContainer->GetCurrentSetName());
+ break;
+ case EGSXDMPluginCmdNewDefault:
+ LoadSettingsViewL(ENewDefault, iSettingListContainer->GetCurrentSetName());
+ break;
+ case EGSXDMPluginCmdDelete:
+ iMainListContainer->DeleteSetProcedureL();
+ UpdateMskL();
+ break;
+ case EAknCmdHelp:
+ HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL ());
+ break;
+ case EGSXDMPluginCmdExitFromSL:
+ if (iCurrentContainer == iSettingListContainer)
+ {
+ if (iSettingListContainer->IsExitProcessingOKL())
+ iAppUi->HandleCommandL( EAknCmdExit );
+ }
+ break;
+ case EAknCmdExit:
+ case EEikCmdExit:
+ if (iCurrentContainer == iSettingListContainer)
+ iSettingListContainer->SaveSettingsIfPossibleL();
+ iAppUi->HandleCommandL( EAknCmdExit );
+ break;
+ default:
+ iAppUi->HandleCommandL( aCommand );
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::GetCaptionL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::GetCaptionL( TDes& aCaption ) const
+ {
+ StringLoader::Load( aCaption, R_STR_XDM_SETTINGS );
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::PluginProviderCategory()
+// ---------------------------------------------------------------------------
+//
+TInt CXDMPlugin::PluginProviderCategory() const
+ {
+ return KGSPluginProviderInternal;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::LoadSettingsViewL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::LoadSettingsViewL(TXDMSettingsViewType aType, TDesC& aXDMSetName)
+ {
+ switch(aType)
+ {
+ case EEditExisting:
+ iSettingListContainer->PrepareXDMSetForEditingL(aXDMSetName);
+ break;
+ case ENewDefault:
+ iSettingListContainer->PrepareXDMSetNewDefaultL();
+ break;
+ case ENewFromExisting:
+ iSettingListContainer->PrepareNewXDMSetFromExistingL(aXDMSetName);
+ break;
+ default:
+ break;
+ }
+ if (iCurrentContainer)
+ iAppUi->RemoveFromViewStack( *this, iCurrentContainer );
+ iCurrentContainer = iSettingListContainer;
+ iAppUi->AddToViewStackL( *this, iCurrentContainer );
+ iMainListContainer->MakeVisible(EFalse);
+ iSettingListContainer->MakeVisible(ETrue);
+ UpdateMskL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::LoadMainViewL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::LoadMainViewL()
+ {
+ TInt err(KErrNone);
+ TRAP(err,iMainListContainer->LoadSettingsListArrayL()); // update main container
+ if (iCurrentContainer)
+ iAppUi->RemoveFromViewStack( *this, iCurrentContainer );
+ iCurrentContainer = iMainListContainer;
+ iAppUi->AddToViewStackL( *this, iCurrentContainer );
+
+ iMainListContainer->SetFocusIfExist(iSettingListContainer->GetCurrentSetName());
+
+ iSettingListContainer->MakeVisible(EFalse);
+ iMainListContainer->MakeVisible(ETrue);
+ UpdateMskL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::DynInitMenuPaneL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
+ {
+ if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
+ {
+ aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
+ }
+
+ if (aResourceId == R_GS_XDM_SETTINGS_MAIN_MENU)
+ {
+ if (iCurrentContainer == iMainListContainer)
+ {
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdChange, ETrue);
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdExitFromSL, ETrue);
+ if (iMainListContainer->IsListEmpty())
+ {
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdEdit, ETrue);
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdDelete, ETrue);
+ }
+ }
+ else
+ {
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdEdit, ETrue);
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdDelete, ETrue);
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdNewSettings, ETrue);
+ aMenuPane->SetItemDimmed(EAknCmdExit, ETrue);
+ }
+ }
+
+ if (aResourceId == R_GS_XDM_NEW_SETTINGS_MENU)
+ {
+ if (iMainListContainer->IsListEmpty())
+ {
+ aMenuPane->SetItemDimmed(EGSXDMPluginCmdNewExisting, ETrue);
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXDMPlugin::HandleResourceChangeManual()
+// ---------------------------------------------------------
+//
+void CXDMPlugin::HandleResourceChangeManual(TInt aType)
+ {
+ if (iMainListContainer)
+ iSettingListContainer->HandleResourceChangeManual(aType);
+ if (iSettingListContainer)
+ iMainListContainer->HandleResourceChangeManual(aType);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::CreateIconL
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CXDMPlugin::CreateIconL( const TUid aIconType )
+ {
+ CGulIcon* icon;
+
+ if( aIconType == KGSIconTypeLbxItem )
+ {
+ icon = AknsUtils::CreateGulIconL(
+ AknsUtils::SkinInstance(),
+ KAknsIIDQgnPropSetConnXdm,
+ KGSXDMPluginIconFileName,
+ EMbmGsxdmpluginQgn_prop_set_conn_xdm,
+ EMbmGsxdmpluginQgn_prop_set_conn_xdm_mask);
+ }
+ else
+ {
+ icon = CGSPluginInterface::CreateIconL( aIconType );
+ }
+
+ return icon;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPlugin::UpdateMskL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPlugin::UpdateMskL()
+ {
+ if ( !Cba() )
+ {
+ return;
+ }
+
+ CEikCba* cba = static_cast< CEikCba* >( Cba()->ButtonGroup() );
+ if(iCurrentContainer==iMainListContainer)
+ {
+ TBool showEdit = !(iMainListContainer->IsListEmpty());
+ cba->SetCommandSetL(R_XDMUI_MAINVIEW_SOFTKEYS);
+ cba->MakeCommandVisible( EGSXDMPluginCmdEdit, showEdit );
+ }
+ else if(iCurrentContainer==iSettingListContainer)
+ {
+ cba->SetCommandSetL(R_XDMUI_MAINVIEW_SOFTKEYS_SL);
+ cba->MakeCommandVisible( EGSXDMPluginCmdChange, ETrue);
+ }
+ cba->DrawNow();
+ }
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/XDMPluginContainer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,462 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin main list container.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XDMExternalInterface.h"
+
+#include <aknappui.h>
+#include <akntitle.h>
+#include <eikspane.h>
+#include <barsread.h>
+#include <eiktxlbm.h>
+#include <StringLoader.h>
+#include <aknlists.h>
+#include <AknUtils.h>
+#include <eiksbfrm.h>
+#include <AknQueryDialog.h>
+#include <XdmSettingsApi.h>
+
+#include "SettingsData.h"
+#include "XDMPluginContainer.h"
+
+#include <csxhelp/xdm.hlp.hrh>
+
+
+
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::CXDMPluginContainer()
+// ---------------------------------------------------------------------------
+//
+CXDMPluginContainer::CXDMPluginContainer(CAknView* aView) : iView(aView)
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::ConstructL(const TRect& aRect)
+// Symbian OS two phased constructor
+//
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::ConstructL( const TRect& aRect )
+ {
+ #ifdef _DEBUG
+ RDebug::Print( _L( "[CXDMPluginContainer] ConstructL()" ) );
+ #endif
+
+ CEikStatusPane* sp = static_cast<CAknAppUi*>
+ ( CEikonEnv::Static()->EikAppUi() )->StatusPane();
+ iTitlePane = static_cast<CAknTitlePane*>
+ ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+ // Set title
+
+ StringLoader::Load ( iTitle, R_STR_XDM_TITLE_PANE_TEXT );
+ iTitlePane->SetTextL(iTitle);// FromResourceL( rReader );
+ CreateWindowL(); // Makes the control a window-owning control
+
+ // Main List creation and initialization
+ iMainList = new(ELeave) CAknSingleStyleListBox();
+ iMainList->SetContainerWindowL(*this);
+ iMainList->ConstructL(this, EAknListBoxLoopScrolling);
+
+ // Main list scroll bar issues
+ iMainList->CreateScrollBarFrameL(EFalse);
+ iMainList->ScrollBarFrame()->SetScrollBarVisibilityL(
+ CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+
+ // Empty text processing
+ _LIT (KStringHeader, "%S\n%S");
+ HBufC* emptyText = iEikonEnv->AllocReadResourceLC( R_STR_XDM_EMPTY_TEXT );
+ HBufC* emptyText2 = iEikonEnv->AllocReadResourceLC( R_STR_XDM_EMPTY_TEXT_SEC);
+ HBufC* emptyFinal = HBufC::NewLC(
+ emptyText->Length() + emptyText2->Length() + 2 );// 2 is length of "\n"
+ emptyFinal->Des().Format(KStringHeader, emptyText, emptyText2);
+
+ iMainList->SetListBoxObserver(this);
+ iMainList->View()->SetListEmptyTextL(*emptyFinal);
+ CleanupStack::PopAndDestroy(3, emptyText);//emptyText, emptyText2, emptyFinal
+
+ // This call fails if Problems in XDM API, so leave if error
+ TRAPD(err,SetupListL());
+ User::LeaveIfError(err);
+
+ SetRect( aRect );
+ ActivateL();
+
+ iEikMenuBar = new ( ELeave ) CEikMenuBar();
+ iEikMenuBar->ConstructL( this, NULL, R_GS_XDM_SETTINGS_MAIN_MENUBAR );
+
+ #ifdef _DEBUG
+ RDebug::Print( _L( "[CXDMPluginContainer] Construct done" ) );
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::~CXDMPluginContainer()
+// Destructor
+//
+// ---------------------------------------------------------------------------
+//
+CXDMPluginContainer::~CXDMPluginContainer()
+ {
+ if (iMainList)
+ {
+ delete iMainList;
+ }
+
+ delete iEikMenuBar;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::SizeChanged()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::SizeChanged()
+ {
+ iMainList->SetRect(Rect());
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::CountComponentControls() const
+// ---------------------------------------------------------------------------
+//
+TInt CXDMPluginContainer::CountComponentControls() const
+ {
+ return 1;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::ComponentControl() const
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CXDMPluginContainer::ComponentControl( TInt aIndex ) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iMainList;
+ default:
+ return NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::EditCurrentItemL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::EditCurrentItemL()
+ {
+ TPtrC16 xDMSetName;
+ TPtrC16 xDMSetNameClipped;
+ xDMSetName.Set(iSettingListArray->MdcaPoint(iMainList->CurrentItemIndex()));
+ xDMSetNameClipped.Set(xDMSetName.Mid(1)); // remove '/t' from the begining
+ CXDMPlugin* iTempView = static_cast<CXDMPlugin*> (iView);
+ iTempView->LoadSettingsViewL(EEditExisting, xDMSetNameClipped);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::GetCurrentSetNameLC()
+// ---------------------------------------------------------------------------
+//
+HBufC* CXDMPluginContainer::GetCurrentSetNameLC()
+ {
+ TPtrC16 xDMSetName;
+ TPtrC16 xDMSetNameClipped;
+ xDMSetName.Set(iSettingListArray->MdcaPoint(iMainList->CurrentItemIndex()));
+ xDMSetNameClipped.Set(xDMSetName.Mid(1)); // remove '/t' from the begining
+
+ HBufC* name = xDMSetNameClipped.AllocLC();
+ TPtr ptr(name->Des());
+ AknTextUtils::ConvertDigitsTo(ptr, EDigitTypeWestern );
+
+ return name;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CXDMPluginContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+ TEventCode aType )
+ {
+ if (iMainList)
+ {
+ // if cancel key is pressed and list is not empty, invoke deletion
+ if ((aKeyEvent.iCode == EKeyBackspace ) && (aType == EEventKey) &&
+ iEikMenuBar->ItemSpecificCommandsEnabled() )
+ {
+ if(!IsListEmpty())
+ DeleteSetProcedureL();
+ CXDMPlugin* iTempView = static_cast<CXDMPlugin*> (iView);
+ iTempView->UpdateMskL();
+ return EKeyWasConsumed;
+ }
+ else
+ {
+ return iMainList->OfferKeyEventL (aKeyEvent, aType);
+ }
+ }
+ return EKeyWasNotConsumed;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::HandleListBoxEventL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aListBoxEvent)
+ {
+ // if the Select Key has been pressed
+ if ((aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed) ||
+ (aListBoxEvent == MEikListBoxObserver::EEventItemSingleClicked))
+ {
+ EditCurrentItemL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::SetupListL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::SetupListL()
+ {
+ CTextListBoxModel* model = iMainList->Model();
+ model->SetOwnershipType(ELbmOwnsItemArray);
+
+ iSettingListArray = STATIC_CAST(CDesCArray*,model->ItemTextArray());
+ LoadSettingsListArrayL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::LoadSettingsListArrayL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::LoadSettingsListArrayL()
+ {
+ iTitlePane->SetTextL(iTitle);
+ _LIT (KStringHeader, "\t%S");
+ TBuf <KMaxSettingSetNameLength+2> myString; // maximum name + \t
+ RArray<TInt> settingIds;
+ CleanupClosePushL(settingIds);
+ CDesCArray* xdmSetList = NULL;
+ TRAPD(err, xdmSetList = LoadCollectionNamesL(settingIds));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(1); //settingIds
+ return;
+ }
+ CleanupStack::PushL(xdmSetList);
+ TInt xdmSetListCount = xdmSetList->Count();
+ iSettingListArray->Reset();
+ for (TInt i = 0; i< xdmSetListCount; i++)
+ {
+ myString.Format(KStringHeader, &(xdmSetList->MdcaPoint(i)));
+ AknTextUtils::LanguageSpecificNumberConversion(myString);
+ iSettingListArray->AppendL (myString);
+ }
+ iSettingListArray->Sort(ECmpCollated);
+ CleanupStack::PopAndDestroy(2); //xdmSetList,settingIds
+ iMainList->HandleItemRemovalL();
+ iMainList->HandleItemAdditionL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::IsListEmpty()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginContainer::IsListEmpty()
+ {
+ if (iSettingListArray->Count())
+ return EFalse;
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::IsLastItem()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginContainer::IsLastItem()
+ {
+ if (iSettingListArray->Count() == 1)
+ return ETrue;
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::DeleteCurrentSetL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::DeleteCurrentSetL()
+ {
+ TXdmSettingsApi::RemoveCollectionL( GetCurrentSetIdL() );
+ TInt deletedItemIndex = iMainList->CurrentItemIndex();
+ iSettingListArray->Delete( deletedItemIndex );
+
+ AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
+ iMainList, deletedItemIndex, ETrue );
+ iMainList->DrawNow();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::GetCurrentSetIdL()
+// ---------------------------------------------------------------------------
+//
+TInt CXDMPluginContainer::GetCurrentSetIdL()
+ {
+ TInt myId(-1);
+ RArray<TInt> settingIds;
+ CleanupClosePushL(settingIds);
+ CDesCArray* xdmSetList = NULL;
+
+ TRAPD(err, xdmSetList = LoadCollectionNamesL(settingIds));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(1); //settingIds
+ return myId;
+ }
+ CleanupStack::PushL(xdmSetList);
+
+ TInt xdmSetListCount = xdmSetList->Count();
+ HBufC* currentSetName = GetCurrentSetNameLC();
+ for (TInt i = 0; i< xdmSetListCount; i++)
+ {
+ if (!((xdmSetList->MdcaPoint(i)).Compare(*currentSetName))) // if equal
+ {
+ myId = settingIds[i];
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy(3); //xdmSetList,settingIds,currentSetName
+ return myId;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::LoadCollectionNamesL()
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CXDMPluginContainer::LoadCollectionNamesL(RArray<TInt>& aSettingIDs)
+ {
+ CDesCArray* myArray = TXdmSettingsApi::CollectionNamesLC(aSettingIDs);
+ CleanupStack::Pop(1); // will be pop if above doesnt leave
+ return myArray;
+ }
+
+// ---------------------------------------------------------
+// CXDMPluginContainer::GetHelpContext
+// This function is called when Help application is launched
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CXDMPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+ {
+ aContext.iMajor = KGSXDMPluginUid;
+ aContext.iContext = KXDM_HLP_LIST_VIEW;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::DeleteSetProcedureL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginContainer::DeleteSetProcedureL()
+ {
+ HBufC* myDisplayMessage = NULL;
+ HBufC* currentSetName = GetCurrentSetNameLC();
+ TPtr myname(currentSetName->Des());
+ AknTextUtils::LanguageSpecificNumberConversion(myname);
+
+ CAknQueryDialog* query = CAknQueryDialog::NewL(CAknQueryDialog::EConfirmationTone);
+ if (IsLastItem())
+ myDisplayMessage = StringLoader::LoadLC(R_STR_XDM_CONF_DELETE_LAST, *currentSetName );
+ else
+ myDisplayMessage = StringLoader::LoadLC(R_STR_XDM_CONF_DELETE, *currentSetName );
+
+ if ( query->ExecuteLD( R_CONFIRMATION_QUERY, *myDisplayMessage ) )
+ {
+ DeleteCurrentSetL();
+ }
+ CleanupStack::PopAndDestroy(2); //currentSetName, myDisplayMessage
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::HandleResourceChange()
+// ---------------------------------------------------------------------------
+void CXDMPluginContainer::HandleResourceChange( TInt aType )
+ {
+ if ( aType == KAknsMessageSkinChange ||
+ aType == KEikDynamicLayoutVariantSwitch )
+ {
+ CXDMPlugin* iTempView = static_cast<CXDMPlugin*> (iView);
+ iTempView->HandleResourceChangeManual(aType);
+ }
+ CCoeControl::HandleResourceChange( aType );
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::HandleResourceChangeManual()
+// ---------------------------------------------------------------------------
+void CXDMPluginContainer::HandleResourceChangeManual(TInt aType)
+ {
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+ mainPaneRect);
+ SetRect( mainPaneRect );
+ //DrawNow();
+
+ iMainList->HandleResourceChange(aType);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::FocusChanged
+// Set focus on the selected listbox. For animated skins feature.
+// ---------------------------------------------------------------------------
+void CXDMPluginContainer::FocusChanged(TDrawNow aDrawNow)
+ {
+ if(iMainList)
+ {
+ iMainList->SetFocus( IsFocused(),aDrawNow );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginContainer::SetFocusIfExist
+// Set focus on the given set name
+// ---------------------------------------------------------------------------
+void CXDMPluginContainer::SetFocusIfExist(TDes& aSetName)
+ {
+ _LIT (KStringHeader, "\t%S");
+ TBuf <KMaxSettingSetNameLength+2> myString; // maximum name + \t
+ myString.Format(KStringHeader, &aSetName);
+ AknTextUtils::LanguageSpecificNumberConversion(myString);
+
+ TInt xdmSetListCount = iSettingListArray->Count();
+ for (TInt i = 0; i< xdmSetListCount; i++)
+ {
+ if (!((iSettingListArray->MdcaPoint(i)).Compare(myString))) // if equal
+ {
+ iMainList->SetCurrentItemIndex(i);
+ break;
+ }
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/XDMPluginImplementationTable.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005,2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM proxy table for this plugin
+*
+*/
+
+
+
+
+// System includes
+#include <e32std.h>
+#include <implementationproxy.h>
+
+// User includes
+#include "XDMPlugin.h"
+
+// Constants
+const TImplementationProxy KXDMPluginImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x10207429, CXDMPlugin::NewL)
+ };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(KXDMPluginImplementationTable)
+ / sizeof(TImplementationProxy);
+ return KXDMPluginImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/XDMPluginSLContainer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,981 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin Settins list container
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XDMExternalInterface.h"
+
+#include <aknappui.h>
+#include <akntitle.h>
+#include <eikspane.h>
+#include <barsread.h>
+#include <eiktxlbm.h>
+#include <aknlists.h>
+#include <AknUtils.h>
+#include <eiksbfrm.h>
+#include <XdmSettingsApi.h>
+#include <aknPopup.h>
+#include <StringLoader.h>
+#include <XdmSettingsCollection.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+#include <aknnotedialog.h>
+
+#include "XDMPluginSLContainer.h"
+#include "XDMPluginSettinglist.h"
+#include "SettingsData.h"
+
+#include <csxhelp/xdm.hlp.hrh>
+
+// LOCAL CONSTANTS AND MACROS
+_LIT(KFormatPostfix, "%S(%02d)");
+_LIT(KFormatNoPostfix, "%S");
+_LIT(KFormatLargePostfix, "%S(%d)");
+const TInt KMaxPostfixLength = 5;
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::CXDMPluginSLContainer()
+// ---------------------------------------------------------------------------
+//
+CXDMPluginSLContainer::CXDMPluginSLContainer(CAknView* aView) : iView(aView)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::ConstructL(const TRect& aRect)
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::ConstructL( const TRect& aRect)
+ {
+ #ifdef _DEBUG
+ RDebug::Print( _L( "[CXDMPluginSLContainer] ConstructL()" ) );
+ #endif
+
+ CEikStatusPane* sp = static_cast<CAknAppUi*>
+ ( CEikonEnv::Static()->EikAppUi() )->StatusPane();
+ CAknTitlePane* title = static_cast<CAknTitlePane*>
+ ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+ // Set the proper title of this list
+ TResourceReader rReader;
+ iCoeEnv->CreateResourceReaderLC( rReader, R_GS_XDM_MAIN_VIEW_TITLE );
+ title->SetFromResourceL( rReader );
+ CleanupStack::PopAndDestroy(); //rReader
+
+ CreateWindowL(); // Makes the control a window-owning control
+
+ // construct the data object the settings list will use
+ iData = CSettingsData::NewL();
+ // construct control and set parent
+ iSettingList = CXDMPluginSettinglist::NewL(*iData);
+ iSettingList->SetContainerWindowL(*this);
+
+ // CreateResourceReaderLC will allocate a buffer to be used by
+ // the TResourceReader. This buffer is pushed onto the cleanup
+ // stack - not the TResourceReader itself
+ CEikonEnv::Static()->CreateResourceReaderLC(rReader, R_SETTINGS);
+ iSettingList->ConstructFromResourceL(rReader);
+
+ // Clean up the buffer allocated above, NOT the reader itself.
+ // Cannot use expected item overload of PopAndDestroy() as buffer
+ // is inaccessible.
+ CleanupStack::PopAndDestroy();
+ iSettingList->ActivateL();
+
+ SetRect( aRect );
+ ActivateL();
+
+ #ifdef _DEBUG
+ RDebug::Print( _L( "[CXDMPluginSLContainer] Construct done" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::~CXDMPluginSLContainer()
+// ---------------------------------------------------------------------------
+//
+CXDMPluginSLContainer::~CXDMPluginSLContainer()
+ {
+ if (iData)
+ delete iData;
+ if(iSettingList) // if setting list has been created
+ {
+ delete iSettingList;
+ iSettingList = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::SizeChanged()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::SizeChanged()
+ {
+ iSettingList->SetRect(Rect());
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::CountComponentControls() const
+// ---------------------------------------------------------------------------
+//
+TInt CXDMPluginSLContainer::CountComponentControls() const
+ {
+ return 1;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::ComponentControl( TInt aIndex ) const
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CXDMPluginSLContainer::ComponentControl( TInt aIndex ) const
+ {
+ switch ( aIndex )
+ {
+ case 0:
+ return iSettingList;
+ default:
+ return NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::EditCurrentItemL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::EditCurrentItemL()
+ {
+ iSettingList->EditCurrentItemL();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::OfferKeyEventL()
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CXDMPluginSLContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent,
+ TEventCode aType )
+ {
+ if (iSettingList)
+ return iSettingList->OfferKeyEventL(aKeyEvent, aType);
+ else
+ return EKeyWasNotConsumed;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::Draw(const TRect& aRect) const
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::Draw(const TRect& aRect) const
+ {
+ CWindowGc& gc = SystemGc();
+ gc.Clear(aRect);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::HandleListBoxEventL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aListBoxEvent)
+ {
+ // if the Select Key has been pressed
+ if ((aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed) ||
+ (aListBoxEvent == MEikListBoxObserver::EEventItemClicked))
+ {
+ iSettingList->EditCurrentItemL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::PrepareXDMSetForEditingL(TDesC& aXDMSetName)
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::PrepareXDMSetForEditingL(TDesC& aXDMSetName)
+ {
+ TLex16 myLex;
+ iData->Reset();
+
+ iData->iSettingName = aXDMSetName;
+ AknTextUtils::ConvertDigitsTo(iData->iSettingName, EDigitTypeWestern );
+ iData->iSettingId = GetSettingIdL(iData->iSettingName);
+
+ CXdmSettingsCollection* xDMSet = NULL;
+
+ // read the source setting
+ xDMSet = TXdmSettingsApi::SettingsCollectionL(iData->iSettingId);
+ CleanupStack::PushL(xDMSet);
+
+ iData->iSettingNameDisp = aXDMSetName;
+ iData->iServerAddress = xDMSet->Property(EXdmPropUri);
+
+ // AccessPoint handling
+ iData->iAccessPointDes = xDMSet->Property(EXdmPropToNapId);
+ myLex.Assign(iData->iAccessPointDes);
+ myLex.Val(iData->iAccessPoint);
+
+ iSettingList->GetAccessPointNameL(iData->iAccessPoint, iData->iAccessPointName);
+ if ( (iData->iAccessPointName) == KNullDesC) // if name is not found
+ {
+ iData->iAccessPoint = -1;
+ }
+
+ iData->iUserID = xDMSet->Property(EXdmPropAuthName);
+ iData->iPassword = xDMSet->Property(EXdmPropAuthSecret);
+
+ CleanupStack::PopAndDestroy(1); //xDMSet
+ iSettingList->LoadSettingsL();
+ SetTitlePaneTextL(iData->iSettingName);
+ iSettingList->ResetItemIndex();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::PrepareXDMSetNewDefaultL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::PrepareXDMSetNewDefaultL()
+ {
+ iData->Reset();
+
+ HBufC* defName = StringLoader::LoadL( R_STR_XDM_NEW_SET );
+ CleanupStack::PushL( defName );
+
+ TBool changed;
+
+ HBufC* newName = DoMakeValidNameL(defName, changed);
+
+ if ( newName )
+ // name converted to unique
+ {
+ (iData->iSettingName).Copy(newName->Des());
+ delete newName;
+ }
+ else
+ {
+ (iData->iSettingName).Copy(defName->Des());
+ }
+ CleanupStack::PopAndDestroy( defName );
+
+ iData->iSettingNameDisp = iData->iSettingName;
+ AknTextUtils::LanguageSpecificNumberConversion(iData->iSettingNameDisp);
+
+ iSettingList->LoadSettingsL();
+ iSettingList->ResetItemIndex();
+ iSettingList->DrawNow();
+ SetTitlePaneTextL(iData->iSettingName);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::PrepareNewXDMSetFromExistingL(TDesC& aXDMSetName)
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::PrepareNewXDMSetFromExistingL(TDesC& aXDMSetName)
+ {
+ TLex16 myLex;
+
+ // iData is already resetted in this case and iSettingId has id of
+ // existing list from which data to be copied
+ // we need to find the new name, from given name
+ HBufC* originalName = aXDMSetName.AllocL();
+ CleanupStack::PushL( originalName );
+
+ // aXDMSetName is in disp format, need to convert to western format
+ TPtr corrFormat(originalName->Des());
+ AknTextUtils::ConvertDigitsTo(corrFormat, EDigitTypeWestern );
+
+ TBool changed;
+
+ HBufC* newName = DoMakeValidNameL(originalName, changed);
+
+ if ( newName )
+ // name converted to unique
+ {
+ (iData->iSettingName).Copy(newName->Des());
+ delete newName;
+ }
+ else
+ {
+ (iData->iSettingName).Copy(originalName->Des());
+ }
+
+ CleanupStack::PopAndDestroy( originalName );
+
+
+ CXdmSettingsCollection* xDMSet = NULL;
+
+ // Displayable name
+ iData->iSettingNameDisp = iData->iSettingName;
+ AknTextUtils::LanguageSpecificNumberConversion(iData->iSettingNameDisp);
+
+ // read the source setting
+ xDMSet = TXdmSettingsApi::SettingsCollectionL(iData->iSettingId);
+ CleanupStack::PushL(xDMSet);
+
+ iData->iServerAddress = xDMSet->Property(EXdmPropUri);
+
+ // AccessPoint handling
+ iData->iAccessPointDes = xDMSet->Property(EXdmPropToNapId);
+ myLex.Assign(iData->iAccessPointDes);
+ myLex.Val(iData->iAccessPoint);
+
+ iSettingList->GetAccessPointNameL(iData->iAccessPoint, iData->iAccessPointName);
+ if ( (iData->iAccessPointName) == KNullDesC) // if name is not found
+ {
+ iData->iAccessPoint = -1;
+ }
+
+ iData->iUserID = xDMSet->Property(EXdmPropAuthName);
+ iData->iPassword = xDMSet->Property(EXdmPropAuthSecret);
+
+ // also overwrite the setting id now since we dont need it anymore
+ iData->iSettingId = -1;
+ CleanupStack::PopAndDestroy(1); //xDMSet
+ iSettingList->LoadSettingsL();
+ SetTitlePaneTextL(iData->iSettingNameDisp);
+ iSettingList->ResetItemIndex();
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::DisplayNewXDMSetOptions()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::DisplayNewXDMSetOptionsL()
+ {
+ // First phase construction of menu list
+ CAknSinglePopupMenuStyleListBox* newXDMsetMenuList =
+ new (ELeave) CAknSinglePopupMenuStyleListBox;
+ CleanupStack::PushL(newXDMsetMenuList);
+
+ // Create a popuplist to show the menu list in
+ CAknPopupList* popupList = CAknPopupList::NewL(
+ newXDMsetMenuList,
+ R_AVKON_SOFTKEYS_OK_CANCEL);
+
+ CleanupStack::PushL(popupList);
+
+ // Second phase construction of menulist
+ newXDMsetMenuList->ConstructL(popupList,EAknListBoxMenuList);
+ // Set up scroll bars
+ newXDMsetMenuList->CreateScrollBarFrameL(ETrue);
+ newXDMsetMenuList->ScrollBarFrame()->SetScrollBarVisibilityL(
+ CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+
+ // Set up menu items
+ CTextListBoxModel* model = newXDMsetMenuList->Model(); // not taking ownership
+ model->SetOwnershipType (ELbmOwnsItemArray); // list'll delete with listbox
+ RArray<TInt> settingIDs;
+ CleanupClosePushL(settingIDs);
+ CDesCArray* newXDMsetMenuListArray = NULL;
+
+ TRAPD(err, newXDMsetMenuListArray = LoadCollectionNamesL(settingIDs, ETrue));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(3); //newXDMsetMenuList, popupList, settingIDs
+ return EFalse;
+ }
+ CleanupStack::PushL(newXDMsetMenuListArray);
+
+ newXDMsetMenuListArray->Sort(ECmpCollated);
+ model->SetItemTextArray(newXDMsetMenuListArray);
+ CleanupStack::Pop(1); // newXDMsetMenuListArray owned by model
+ CleanupStack::PopAndDestroy(1); //settingIDs
+
+ // Set title
+ HBufC* title;
+ title = StringLoader::LoadLC(R_STR_XDM_USE_EXISTING);
+ popupList->SetTitleL(*title);
+ CleanupStack::PopAndDestroy(1); //title
+
+ // Show the menu in the popup list
+ TInt popupOk = popupList->ExecuteLD();
+
+ CleanupStack::Pop(popupList);
+
+ // if the user selected some set
+ if (popupOk)
+ {
+ iData->Reset();
+ TPtrC setName = newXDMsetMenuListArray->MdcaPoint
+ (newXDMsetMenuList->CurrentItemIndex());
+
+ iData->iSettingId = GetSettingIdL(setName);
+ (iData->iSettingNameDisp).Copy(setName);
+ (iData->iSettingName).Copy(setName);
+ AknTextUtils::ConvertDigitsTo(iData->iSettingName, EDigitTypeWestern );
+ CleanupStack::PopAndDestroy(newXDMsetMenuList);
+ return ETrue;
+ }
+ // otherwise return false
+ CleanupStack::PopAndDestroy(1); //newXDMsetMenuList
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::SetTitlePaneTextL( const TDesC& aTitleText ) const
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::SetTitlePaneTextL( const TDesC& aTitleText ) const
+ {
+ CAknTitlePane* title = static_cast< CAknTitlePane* >
+ ( CEikonEnv::Static()->AppUiFactory()->StatusPane()->ControlL(
+ TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ if ( !title )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ title->SetTextL( aTitleText );
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::AreCompulsoryItemsFilled()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::AreCompulsoryItemsFilled()
+ {
+ if ( (iData->iAccessPoint > -1) && ((iData->iServerAddress)!=KNullDesC) &&
+ ((iData->iUserID)!=KNullDesC) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::DisplayDeleteOrDontSaveDialog()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::DisplayDeleteOrDontSaveDialogL()
+ {
+ TBuf<KMaxMessageToDisplayLength> myDisplayMessage;
+ CAknQueryDialog* query = CAknQueryDialog::NewL
+ (CAknQueryDialog::EConfirmationTone);
+ StringLoader::Load ( myDisplayMessage, R_STR_XDM_CONF_COMPULSORY );
+ return (query->ExecuteLD( R_CONFIRMATION_QUERY, myDisplayMessage ));
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::DeleteXDMSetIfExistL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::DeleteXDMSetIfExistL()
+ {
+ TRAPD(err, TXdmSettingsApi::RemoveCollectionL(iData->iSettingId));
+ if ( (err!=KErrNone) && (err!=KErrNotFound) )
+ {
+ User::LeaveIfError(err);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::IsExitProcessingOKL()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::IsExitProcessingOKL()
+ {
+ if (AreCompulsoryItemsFilled())
+ {
+ return SaveOrCreateAndSaveXDMSetL(ETrue);
+ }
+ else
+ {
+ if (DisplayDeleteOrDontSaveDialogL())
+ {
+ DeleteXDMSetIfExistL();
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::SaveSettingsIfPossibleL()
+// ---------------------------------------------------------------------------
+//
+void CXDMPluginSLContainer::SaveSettingsIfPossibleL()
+ {
+ if (AreCompulsoryItemsFilled())
+ SaveOrCreateAndSaveXDMSetL(EFalse);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::SaveOrCreateAndSaveXDMSetL()
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::SaveOrCreateAndSaveXDMSetL(TBool aShowDialog)
+ {
+ TBool ret = ETrue;
+ CXdmSettingsCollection* myXDMSet(NULL);
+ TInt err(KErrNotFound); // Initialize such that id not found in settings API
+
+ // take the saveable name
+ iData->iSettingName = iData->iSettingNameDisp;
+ AknTextUtils::ConvertDigitsTo(iData->iSettingName, EDigitTypeWestern );
+
+ // check whether this is a new set or an existing set was edited
+ if ((iData->iSettingId) > NULL) // is there is valid id
+ {
+ TRAP(err, myXDMSet = TXdmSettingsApi::SettingsCollectionL
+ (iData->iSettingId));
+ }
+ if(myXDMSet)
+ {
+ delete myXDMSet; // we dont need it
+ }
+
+ // check if the setting name is already exist
+ // ask user to change name
+ if (IsXDMSetNameExistL(iData->iSettingName, iData->iSettingId))
+ {
+ if (!aShowDialog) // if we cant display dialog than return.
+ return EFalse;
+ HBufC* myDisplayMessage = NULL;
+ CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
+ note->SetTimeout( CAknNoteDialog::ELongTimeout );
+ myDisplayMessage = StringLoader::LoadLC(R_STR_XDM_NAME_ALREADY_EXIST, iData->iSettingNameDisp);
+ note->ExecuteLD( *myDisplayMessage );
+ CleanupStack::PopAndDestroy(1); //myDisplayMessage
+ iSettingList->EditItemL(ESettingNameIndex,EFalse);
+ return EFalse;
+ }
+
+ if(err == KErrNone) // if set exists update it
+ {
+ TXdmSettingsApi::UpdatePropertyL(iData->iSettingId,
+ iData->iSettingName, EXdmPropName);
+ TXdmSettingsApi::UpdatePropertyL(iData->iSettingId,
+ iData->iAccessPointDes, EXdmPropToNapId);
+ TXdmSettingsApi::UpdatePropertyL(iData->iSettingId,
+ iData->iServerAddress, EXdmPropUri);
+ TXdmSettingsApi::UpdatePropertyL(iData->iSettingId,
+ iData->iUserID, EXdmPropAuthName);
+ TXdmSettingsApi::UpdatePropertyL(iData->iSettingId,
+ iData->iPassword, EXdmPropAuthSecret);
+ ret = ETrue;
+ }
+
+ else if (err == KErrNotFound) // if set doenst exists create and save it
+ {
+ myXDMSet = new (ELeave) CXdmSettingsCollection();
+ CleanupStack::PushL(myXDMSet);
+ myXDMSet->AppendL(iData->iSettingName, EXdmPropName);
+ myXDMSet->AppendL(iData->iServerAddress, EXdmPropUri);
+ myXDMSet->AppendL(iData->iAccessPointDes, EXdmPropToNapId);
+ myXDMSet->AppendL(iData->iUserID, EXdmPropAuthName);
+ myXDMSet->AppendL(iData->iPassword, EXdmPropAuthSecret);
+ TRAPD(err,TXdmSettingsApi::CreateCollectionL(*myXDMSet));
+ err = err; //just to satisfy compiler
+ CleanupStack::PopAndDestroy(1); // myXDMSet
+ ret = ETrue;
+ }
+
+ else
+ {
+ User::LeaveIfError(err);
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::GetSettingIdL(TDesC& aXDMSetName)
+// ---------------------------------------------------------------------------
+//
+TInt CXDMPluginSLContainer::GetSettingIdL(TDesC& aXDMSetName)
+ {
+ TInt myId(-1);
+ RArray<TInt> settingIds;
+ CleanupClosePushL(settingIds);
+ CDesCArray* xdmSetList =NULL;
+
+ TBuf<KMaxSettingSetNameLength> setName = aXDMSetName;
+ AknTextUtils::ConvertDigitsTo(setName, EDigitTypeWestern );
+
+ TRAPD(err, xdmSetList = LoadCollectionNamesL(settingIds, EFalse));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(1); //settingIds
+ return myId;
+ }
+ CleanupStack::PushL(xdmSetList);
+
+ TInt xdmSetListCount = xdmSetList->Count();
+ for (TInt i = 0; i< xdmSetListCount; i++)
+ {
+ if (!((xdmSetList->MdcaPoint(i)).Compare(setName))) // if equal
+ {
+ myId = settingIds[i];
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy(2); //xdmSetList,settingIds
+ return myId;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::IsXDMSetNameExistL(TDesC& aXDMSetName, TInt32& aSettingId)
+// ---------------------------------------------------------------------------
+//
+TBool CXDMPluginSLContainer::IsXDMSetNameExistL(TDesC& aXDMSetName, TInt32& aSettingId)
+ {
+ TBool ret(EFalse);
+ RArray<TInt> settingIds;
+ CleanupClosePushL(settingIds);
+ CDesCArray* xdmSetList = NULL;
+
+ TBuf<KMaxSettingSetNameLength> setName = aXDMSetName;
+ AknTextUtils::ConvertDigitsTo(setName, EDigitTypeWestern );
+
+ TRAPD(err, xdmSetList = LoadCollectionNamesL(settingIds, EFalse));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(1); //settingIds
+ return EFalse;
+ }
+ CleanupStack::PushL(xdmSetList);
+
+ TInt xdmSetListCount = xdmSetList->Count();
+ for (TInt i = 0; i< xdmSetListCount; i++)
+ {
+ if (!((xdmSetList->MdcaPoint(i)).Compare(setName))) // if equal
+ {
+ if (settingIds[i] != aSettingId) // if the set is not itself
+ {
+ ret = ETrue;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(2); //xdmSetList,settingIds
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::LoadCollectionNamesL
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CXDMPluginSLContainer::LoadCollectionNamesL(RArray<TInt>& aSettingIDs
+ , TBool aDisp)
+ {
+ CDesCArray* myArray = TXdmSettingsApi::CollectionNamesLC(aSettingIDs);
+ TBuf<KMaxSettingSetNameLength> name;
+ if(aDisp) // convert all names to disp names
+ {
+ TInt count = myArray->Count();
+ CDesCArray* dispArray = new CDesCArrayFlat(count+1);
+ CleanupStack::PushL(dispArray);
+ for(TInt i=0;i<count;i++)
+ {
+ name.Copy(myArray->MdcaPoint(i));
+ AknTextUtils::LanguageSpecificNumberConversion(name);
+ TPtrC16 ptr = name;
+ dispArray->AppendL(ptr);
+ }
+ CleanupStack::Pop(2);
+ return dispArray;
+ }
+ CleanupStack::Pop(1); // myArray
+ return myArray;
+ }
+
+// ---------------------------------------------------------
+// CXDMPluginSLContainer::GetHelpContext
+// This function is called when Help application is launched
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CXDMPluginSLContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+ {
+ aContext.iMajor = KGSXDMPluginUid;
+ aContext.iContext = KXDM_HLP_EDIT_SET;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::HandleResourceChange()
+// ---------------------------------------------------------------------------
+void CXDMPluginSLContainer::HandleResourceChange( TInt aType )
+ {
+ CCoeControl::HandleResourceChange( aType );
+ if ( aType == KAknsMessageSkinChange ||
+ aType == KEikDynamicLayoutVariantSwitch )
+ {
+ CXDMPlugin* iTempView = static_cast<CXDMPlugin*> (iView);
+ iTempView->HandleResourceChangeManual(aType);
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::HandleResourceChangeManual()
+// ---------------------------------------------------------------------------
+void CXDMPluginSLContainer::HandleResourceChangeManual(TInt aType)
+ {
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+ mainPaneRect);
+ SetRect( mainPaneRect );
+ DrawDeferred();
+
+ iSettingList->HandleResourceChange(aType);
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::FocusChanged
+// Set focus on the selected listbox. For animated skins feature.
+// ---------------------------------------------------------------------------
+void CXDMPluginSLContainer::FocusChanged(TDrawNow aDrawNow)
+ {
+ if(iSettingList)
+ {
+ iSettingList->SetFocus( IsFocused(), aDrawNow );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::GetCurrentSetName()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TDes& CXDMPluginSLContainer::GetCurrentSetName()
+ {
+ return iData->iSettingName;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::DoMakeValidNameL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CXDMPluginSLContainer::DoMakeValidNameL(HBufC* aName, TBool& aChanged)
+ {
+ aChanged = EFalse;
+ HBufC* temp = HBufC::NewLC( KMaxSettingSetNameLength );
+ HBufC* temp2 = HBufC::NewLC( KMaxSettingSetNameLength );
+
+ HBufC* corrname = EnsureMaxLengthLC( aName, aChanged);
+ *temp = *corrname;
+ TInt postfix( 0 );
+ TInt pf( 0 );
+ TInt i( 0 );
+
+
+ // Load the names
+ RArray<TInt> settingIDs;
+ CleanupClosePushL(settingIDs);
+ CDesCArray* xdmSetList = NULL;
+
+ TRAPD(err, xdmSetList = LoadCollectionNamesL(settingIDs, EFalse));
+ if(err!=KErrNone)
+ {
+ CleanupStack::PopAndDestroy(4); //settingIds
+ return corrname;
+ }
+ CleanupStack::PushL(xdmSetList);
+
+ // do the actual checking of name
+ TInt found(0);
+ TInt pos(0);
+
+ TPtrC prefix = GetPrefix( *corrname );
+
+ postfix = GetPostfix( *temp, prefix );
+ postfix = -1;
+ do
+ {
+ found = xdmSetList->Find( *temp, pos );
+ if ( found == KErrNone )
+ {
+ aChanged = ETrue;
+ postfix++;
+ // check the length of postfix, check text length accordingly
+ pf = postfix;
+ for (i=1; i<10; i++)
+ {
+ pf /= 10;
+ if ( !pf )
+ break;
+ }
+ TPtr sgdptr( temp->Des() );
+ TPtr sgdptr2( temp2->Des() );
+ if ( postfix )
+ {
+ if ( postfix < 10 )
+ {
+ sgdptr2 = prefix.Left( KMaxSettingSetNameLength - i - 3 );
+ }
+ else
+ {
+ sgdptr2 = prefix.Left( KMaxSettingSetNameLength - i - 2 );
+ }
+ }
+ else
+ {
+ sgdptr2 = prefix.Left( KMaxSettingSetNameLength );
+ }
+ if ( postfix )
+ {
+ if ( postfix > 9 )
+ {
+ sgdptr.Format( KFormatLargePostfix, &sgdptr2,
+ postfix );
+ }
+ else
+ {
+ sgdptr.Format( KFormatPostfix, &sgdptr2,
+ postfix );
+ }
+ }
+ else
+ {
+ sgdptr.Format( KFormatNoPostfix, &sgdptr2 );
+ }
+ }
+ } while (found == KErrNone);
+
+ CleanupStack::PopAndDestroy(xdmSetList);
+ CleanupStack::PopAndDestroy(1); //settingIds
+ CleanupStack::PopAndDestroy( corrname );
+ CleanupStack::PopAndDestroy( temp2 );
+
+ if ( aChanged )
+ {
+ CleanupStack::Pop( temp );
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( temp );
+ temp = NULL;
+ }
+
+ return temp;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::EnsureMaxLengthLC()
+// See header for details.
+// ---------------------------------------------------------------------------
+HBufC* CXDMPluginSLContainer::EnsureMaxLengthLC( const TDesC* aName, TBool& aChanged)
+ {
+ TInt length = aName->Length();
+
+ aChanged = EFalse;
+
+ if ( !length )
+ {
+ // Name is required.
+ User::Leave(KErrArgument);
+ }
+
+ HBufC* corrname;
+ if ( KMaxSettingSetNameLength < length )
+ { // name too long, truncate.
+ corrname = aName->Left( KMaxSettingSetNameLength ).AllocLC();
+ aChanged = ETrue;
+ }
+ else
+ {
+ corrname = aName->AllocLC();
+ corrname->Des().Trim();
+ if ( corrname->Length() == 0 )
+ {
+ User::Leave(KErrArgument);
+ }
+ // comes here only if name is valid
+ if ( corrname->Length() != aName->Length() )
+ {
+ aChanged = ETrue;
+ }
+ }
+
+ return corrname;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::GetPrefix()
+// See header for details.
+// ---------------------------------------------------------------------------
+TPtrC CXDMPluginSLContainer::GetPrefix( const TDesC& aName )
+ {
+ TPtrC prefix = aName;
+ TInt lastBrace = aName.LocateReverse('(');
+ if ( lastBrace != KErrNotFound )
+ {
+ // aName looks like "<prefix><brace><something>".
+ // See if <something> is an integer number.
+ TPtrC num = aName.Right( aName.Length() - lastBrace - 1 );
+ TInt val;
+ TLex lex( num );
+ if ( lex.Val( val ) == KErrNone )
+ {
+ // Yes, the trailer is an integer.
+ prefix.Set( aName.Left( lastBrace ) );
+ }
+ }
+ return prefix;
+ }
+
+// ---------------------------------------------------------------------------
+// CXDMPluginSLContainer::GetPostfix()
+// See header for details.
+// ---------------------------------------------------------------------------
+TInt CXDMPluginSLContainer::GetPostfix( const TDesC& aName, const TDesC& aPrefix )
+ {
+ TInt postfix( KErrNotFound );
+ TInt nameLength = aName.Length();
+ TInt prefixLength = aPrefix.Length();
+ if ( nameLength >= prefixLength && aName.FindF( aPrefix ) == 0 )
+ {
+ // aName is longer or equal length, and
+ // aPrefix can be found in the beginning of aName.
+ if ( nameLength == prefixLength )
+ {
+ // They have the same length; they equal.
+ postfix = 0;
+ }
+ else
+ {
+ if ( aName[ prefixLength ] == '(' )
+ {
+ // (Now we know that aName is longer than aPrefix.)
+ // aName looks like "aPrefix<brace><something>".
+ // See if <something> is an integer number.
+ TPtrC num = aName.Right( nameLength - prefixLength - 1 );
+ TBuf< KMaxPostfixLength > pf;
+ if (num.Length() <= pf.Length())
+ pf = num;
+ TInt val;
+ TLex lex( pf );
+ if ( lex.Val( val ) == KErrNone )
+ {
+ // Yes, the trailer is an integer.
+ if ( val > 0 )
+ {
+ postfix = val;
+ }
+ else
+ {
+ // signal that it is invalid...
+ postfix = -1;
+ }
+ }
+ }
+ }
+ }
+ return postfix;
+ }
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XDMSettingsUI/src/XDMPluginSettinglist.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM GS plugin, Setting List class implementation
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XDMExternalInterface.h"
+
+#include <barsread.h>
+#include <ApSettingsHandlerUI.h>
+#include <ApUtils.h>
+#include <commdb.h>
+#include <avkon.loc>
+#include <StringLoader.h>
+#include <akntitle.h>
+#include <eikspane.h>
+
+#include "XDMPlugin.hrh"
+#include "XDMPluginSettinglist.h"
+#include "SettingsData.h"
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::NewL(CSettingsData &aData)
+// -----------------------------------------------------------------------------
+//
+CXDMPluginSettinglist *CXDMPluginSettinglist::NewL(CSettingsData &aData)
+ {
+ CXDMPluginSettinglist* self = CXDMPluginSettinglist::NewLC(aData);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::NewLC(CSettingsData &aData)
+// -----------------------------------------------------------------------------
+//
+CXDMPluginSettinglist *CXDMPluginSettinglist::NewLC(CSettingsData &aData)
+ {
+ CXDMPluginSettinglist* self = new (ELeave) CXDMPluginSettinglist(aData);
+ CleanupStack::PushL(self);
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::CXDMPluginSettinglist(CSettingsData &aData)
+// -----------------------------------------------------------------------------
+//
+CXDMPluginSettinglist::CXDMPluginSettinglist(CSettingsData &aData) :
+ CAknSettingItemList(),
+ iSettingsData(aData)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::~CXDMPluginSettinglist()
+// -----------------------------------------------------------------------------
+//
+CXDMPluginSettinglist::~CXDMPluginSettinglist()
+ {
+ // no specific destruction code required - no owned data
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::SizeChanged()
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::SizeChanged()
+ {
+ // if size changes, make sure component takes whole available space
+ if (ListBox())
+ {
+ ListBox()->SetRect(Rect());
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::EditCurrentItemL()
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::EditCurrentItemL()
+ {
+ // invoke EditItemL on the current item
+ TInt index = ListBox()->CurrentItemIndex();
+
+ //Cause SIP setting is hidden
+ if(index >= 3) //ESipURLIndex == 3
+ index++;
+
+ // if access point need to be edit
+ if (index == EAccessPointIndex)
+ {
+ EditAccessPointL();
+ SaveSettingL(index);
+ }
+ else
+ EditItemL(index,ETrue); // invoked from menu
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::EditItemL (TInt aIndex, TBool aCalledFromMenu)
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::EditItemL (TInt aIndex, TBool aCalledFromMenu)
+ {
+ if (aIndex == EAccessPointIndex)
+ {
+ EditAccessPointL();
+ }
+ else
+ {
+ CAknSettingItemList::EditItemL(aIndex, aCalledFromMenu);
+ }
+ (*SettingItemArray())[aIndex]->StoreL();
+ SaveSettingL(aIndex);
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::SaveSettingL(TInt aIndex)
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::SaveSettingL(TInt aIndex)
+ {
+
+ switch (aIndex)
+ {
+ case ESettingNameIndex:
+ SetTitlePaneTextL(iSettingsData.iSettingNameDisp);
+ break;
+
+ case EAccessPointIndex:
+ if (iSettingsData.iAccessPoint > -1) // if Valid AP number
+ {
+ (iSettingsData.iAccessPointDes).Num(iSettingsData.iAccessPoint);
+ GetAccessPointNameL(iSettingsData.iAccessPoint,
+ iSettingsData.iAccessPointName);
+ }
+ LoadSettingsL();
+ break;
+
+ case EServerAddressIndex:
+ break;
+
+
+ case ESipURLIndex:
+ break;
+ case EUserIDIndex:
+ break;
+
+ case EPasswordIndex:
+ break;
+
+ default:
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::CreateSettingItemL (TInt aIdentifier)
+// -----------------------------------------------------------------------------
+//
+CAknSettingItem * CXDMPluginSettinglist::CreateSettingItemL (TInt aIdentifier)
+ {
+ // method is used to create specific setting item as required at run-time.
+ // aIdentifier is used to determine what kind of setting item should be
+ // created
+
+ CAknSettingItem* settingItem = NULL;
+
+ switch (aIdentifier)
+ {
+ case ESettingItemSettingName:
+
+ settingItem = new (ELeave) CAknTextSettingItem ( aIdentifier,
+ iSettingsData.iSettingNameDisp);
+ break;
+
+ case ESettingItemAccessPoint:
+ GetAccessPointNameL(iSettingsData.iAccessPoint, iSettingsData.iAccessPointName);
+ settingItem = new (ELeave) CAknTextSettingItem (
+ aIdentifier, iSettingsData.iAccessPointName);
+ break;
+
+ case ESettingItemServerAddress:
+ settingItem = new (ELeave) CAknTextSettingItem (
+ aIdentifier,
+ iSettingsData.iServerAddress);
+ break;
+
+
+
+ case ESettingItemSipURL:
+ settingItem = new (ELeave) CAknTextSettingItem (
+ aIdentifier,
+ iSettingsData.iSipURL);
+ settingItem->SetHidden(ETrue);
+ break;
+
+
+ case ESettingItemUserID:
+ settingItem = new (ELeave) CAknTextSettingItem (
+ aIdentifier,
+ iSettingsData.iUserID);
+ break;
+ case ESettingItemPassword:
+ settingItem = new (ELeave) CAknPasswordSettingItem (
+ aIdentifier,
+ CAknPasswordSettingItem::EAlpha,
+ iSettingsData.iPassword);
+ break;
+ default:
+ break;
+ }
+ return settingItem;
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::EditAccessPoint()
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::EditAccessPointL()
+ {
+ // After dialog server for access point selection (RGenConAgentDialogServer)
+ // has deprecated wins emulator mode needs a different technique to show
+ // emulator-lan access point.
+
+ CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+ CleanupStack::PushL(commsDb);
+ CApUtils* aPUtils = CApUtils::NewLC( *commsDb );
+
+ CApSettingsHandler *apUi = CApSettingsHandler::NewLC(
+ ETrue,
+ EApSettingsSelListIsPopUp,
+ EApSettingsSelMenuSelectNormal,
+ KEApIspTypeAll,
+ EApBearerTypeAllBearers,
+ KEApSortNameAscending,
+ EIPv4 | EIPv6
+ );
+ TUint32 id;
+
+ TRAP_IGNORE(id = aPUtils->WapIdFromIapIdL(iSettingsData.iAccessPoint));
+
+ //err can also be in case this is new set, iSettingsData.iAccessPoint = -1
+ //so ignoring the error
+
+ if ( apUi->RunSettingsL( id, id ) == KApUiEventSelected)
+ {
+ iSettingsData.iAccessPoint = aPUtils->IapIdFromWapIdL(id);
+ }
+ CleanupStack::PopAndDestroy(3, commsDb); //commsDb, aPUtils, apUi
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::GetAccessPointNameL(TInt32 aAP, TDes& aAccessPoint)
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::GetAccessPointNameL(TInt32 aAP, TDes& aAccessPoint)
+ {
+#if defined __WINS__ && defined _DEBUG // handled differently in wins+debug
+ if (aAP != KErrNotFound) // if access point is defined take a general name
+ StringLoader::Load ( aAccessPoint, R_STR_XDM_AP_NAME_FOR_DEBUG_ONLY);
+#else
+ CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+ CleanupStack::PushL(commsDb);
+ CApUtils* aPUtils = CApUtils::NewLC( *commsDb );
+ TInt err(KErrNone);
+ // to remove id bug
+ TRAP(err, aAP = aPUtils->WapIdFromIapIdL(aAP));
+ TRAP(err, aPUtils->NameL(aAP, aAccessPoint));
+ // dont do anything if name not found or if some error occur
+ CleanupStack::PopAndDestroy(2); // commsDb, aPUtils
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::SetTitlePaneTextL( const TDesC& aTitleText ) const
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::SetTitlePaneTextL( const TDesC& aTitleText ) const
+ {
+ CAknTitlePane* title = static_cast< CAknTitlePane* >
+ ( CEikonEnv::Static()->AppUiFactory()->StatusPane()->ControlL(
+ TUid::Uid( EEikStatusPaneUidTitle ) ) );
+ if ( !title )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ title->SetTextL( aTitleText );
+ }
+
+// -----------------------------------------------------------------------------
+// CXDMPluginSettinglist::ResetItemIndex()
+// -----------------------------------------------------------------------------
+//
+void CXDMPluginSettinglist::ResetItemIndex()
+ {
+ ListBox()->SetCurrentItemIndexAndDraw(NULL);
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: legacypresence build file
+*
+*/
+
+
+
+#include "../pressrv_plat/group/bld.inf"
+#include "../XDMEngine/group/bld.inf"
+#include "../XDMSettingsUI/group/bld.inf"
+#include "../xdmprotocols/group/bld.inf"
+#include "../msgconnmanager/group/bld.inf"
+#include "../presencesettingsui/group/bld.inf"
+#include "../simpleengine/group/bld.inf"
+#include "../presencefwsimpleadpt/group/bld.inf"
+#include "../simpledatamodeladapter/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/xcapappusagedef.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapAppUsage enumerations
+*
+*/
+
+
+
+
+#ifndef __XCAPAPPUSAGEDEF__
+#define __XCAPAPPUSAGEDEF__
+
+// Supported data types
+enum TDataType
+ {
+ EDataTypeUndefined = 0,
+ EDataTypeString,
+ EDataTypeNonNegativeInteger,
+ EDataTypeAnyURI,
+ EDataTypeDateTime,
+ EDataTypeBoolean,
+ EDataTypeToken,
+ EDataTypeEmpty
+ };
+
+// AUIDs
+_LIT8( KXdmResourceListsUsageAUID, "/resource-lists/" );
+_LIT8( KXdmCapabilityUsageAUID, "/xcap-caps/" );
+_LIT8( KXdmDirectoryUsageAUID, "/org.openmobilealliance.xcap-directory/" );
+_LIT8( KXdmIetfCommonPolicyUsageAUID, "/policy-capabilities/" );
+_LIT8( KXdmOmaCommonPolicyUsageAUID, "/org.openmobilealliance.policy-capabilities/" );
+_LIT8( KXdmPocUserAccessUsageAUID, "/org.openmobilealliance.poc-rules/" );
+_LIT8( KXdmIetfPresRulesUsageAUID, "/pres-rules/" );
+_LIT8( KXdmRlsServicesUsageAUID, "/rls-services/" );
+_LIT8( KXdmSharedXDMUsageAUID, "/resource-lists/" );
+_LIT8( KXdmOmaPresRulesUsageAUID, "/org.openmobilealliance.pres-rules/" );
+_LIT8( KXdmPocGroupUsageAUID, "/org.openmobilealliance.poc-groups/" );
+// add new AUID definitions here
+//_LIT8( KXdmTestAppUsageAUID, "/org.foo.bar/" );
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentAUID, "/org.openmobilealliance.pres-content/" );
+// PRES-CONTENT ends
+
+// ContentTypes
+_LIT8( KXdmResourceListsUsageContType, "application/resource-lists+xml" );
+_LIT8( KXdmCapabilityUsageContType, "application/xcap-caps+xml" );
+_LIT8( KXdmDirectoryUsageContType, "application/oma-directory+xml" );
+_LIT8( KXdmIetfCommonPolicyUsageContType, "application/policy-caps+xml" );
+_LIT8( KXdmOmaCommonPolicyUsageContType, "application/policy-caps+xml" );
+_LIT8( KXdmSharedXDMUsageContType, "application/resource-lists+xml" );
+_LIT8( KXdmIetfPresRulesUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmPocUserAccessUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmOmaPresRulesUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmRlsServicesUsageContType, "application/rls-services+xml" );
+_LIT8( KXdmPocGroupUsageContType, "application/vnd.oma.poc.groups+xml" );
+// add new content types here
+//_LIT8( KXdmTestAppUsageContType, "application/test-type+xml" );
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentContType, "application/vnd.oma.pres-content+xml" );
+_LIT8( KXdmPresContentContTypeOld, "application/vnd.oma.content+xml" );
+// PRES-CONTENT ends
+
+// Namespaces
+_LIT8( KXdmResourceListsNamespace, "urn:ietf:params:xml:ns:resource-lists" );
+_LIT8( KXdmCapabilityNamespace, "urn:ietf:params:xml:ns:xcap-caps" );
+_LIT8( KXdmDirectoryNamespace, "urn:oma:params:xml:ns:xcap-directory" );
+_LIT8( KXdmIetfCommonPolicyNamespace, "urn:ietf:params:xml:ns:common-policy" );
+_LIT8( KXdmOmaCommonPolicyNamespace, "urn:oma:xml:xdm:common-policy" );
+_LIT8( KXdmOmaPresRulesNamespace, "urn:oma:xml:prs:pres-rules" );
+_LIT8( KXdmIetfPresRulesNamespace, "urn:ietf:params:xml:ns:pres-rules" );
+_LIT8( KXdmRlsServicesNamespace, "urn:ietf:params:xml:ns:rls-services" );
+_LIT8( KXdmSharedXDMUriUsageNamespace, "urn:oma:params:xml:ns:resource-list:oma-uriusage" );
+_LIT8( KXdmPocUserAccessNamespace, "urn:oma:xml:poc:poc-rules" );
+_LIT8( KXdmPocGroupNamespace, "urn:oma:xml:poc:list-service" );
+// add new namespace definitions here
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentNamespace, "urn:oma:xml:prs:pres-content" );
+// PRES-CONTENT ends
+
+// Namespace prefixes
+_LIT8( KXdmSharedXDMUriUsageNsPrefix, "ou" );
+_LIT8( KXdmResourceListsNsPrefix, "rl" );
+_LIT8( KXdmIetfCommonPolicyNsPrefix, "cr" );
+_LIT8( KXdmOmaCommonPolicyNsPrefix, "ocp" );
+_LIT8( KXdmIetfPresRulesNsPrefix, "pr" );
+_LIT8( KXdmTestAppUsageDefaultNamespace, "ta" );
+_LIT8( KXdmPocUserAccessNsPrefix, "poc" );
+_LIT8( KXdmOmaPresRulesNsPrefix, "opr" );
+_LIT8( KXdmRlsServicesNsPrefix, "rls" );
+_LIT8( KXdmPocGroupNsPrefix, "ls" );
+// add new namespace prefix definitions here
+
+// Common literals
+_LIT( KXdmAuid, "auid" );
+_LIT( KXdmUri, "uri" );
+_LIT( KXdmEtag, "etag" );
+_LIT( KXdmName, "name" );
+_LIT( KXdmRef, "ref" );
+_LIT( KXdmUse, "use" );
+_LIT( KXdmRuleset, "ruleset" );
+_LIT( KXdmEntry, "entry" );
+_LIT( KXdmEntity, "entity" );
+_LIT( KXdmId, "id" );
+_LIT( KXdmAnyIdentity, "any-identity" );
+_LIT( KXdmIdentity, "identity" );
+_LIT( KXdmDomain, "domain" );
+_LIT( KXdmAnc, "anc" );
+_LIT( KXdmDisplayName, "display-name" );
+_LIT( KXdmAnchor, "anchor" );
+_LIT( KXdmExternal, "external" );
+_LIT( KXdmList, "list" );
+_LIT( KXdmServiceId, "service-id" );
+_LIT8( KXdmZero, "0" );
+_LIT8( KXdmOneNbr, "1" );
+_LIT8( KXdmTrue, "true" );
+_LIT8( KXdmFalse, "false");
+_LIT8( KXdmFull, "full" );
+_LIT8( KXdmAllow, "allow" );
+_LIT8( KXdmBlock, "block" );
+
+// Literals for capability
+_LIT( KXdmExtensions, "extensions" );
+_LIT( KXdmExtension, "extension" );
+_LIT( KXdmAuids, "auids" );
+_LIT( KXdmNamespaces, "namespaces" );
+_LIT( KXdmNamespace, "namespace");
+
+// Literals for directory
+_LIT( KXdmXcapDirectory, "xcap-directory" );
+_LIT( KXdmFolder, "folder" );
+_LIT( KXdmErrorCode, "error-code" );
+_LIT( KXdmLastModified, "last-modified" );
+_LIT( KXdmSize, "size" );
+
+// Literals for presence
+_LIT( KXdmServiceUriScheme, "service-uri-scheme" );
+_LIT( KXdmClass, "class" );
+_LIT( KXdmOccurenceId, "occurence-id" );
+_LIT( KXdmServiceUri, "service-uri" );
+_LIT( KXdmAllServices, "all-services" );
+_LIT( KXdmProvideServices, "provide-services" );
+// pres-rules-03
+_LIT( KXdmDeviceId, "device-id" );
+// pres-rules-05
+_LIT( KXdmDeviceID, "deviceID" );
+_LIT( KXdmAllDevices, "all-devices" );
+_LIT( KXdmProvideDevices, "provide-devices" );
+_LIT( KXdmAllPersons, "all-persons" );
+_LIT( KXdmProvidePersons, "provide-persons" );
+_LIT( KXdmProvideActivities, "provide-activities" );
+_LIT( KXdmProvideClass, "provide-class" );
+_LIT( KXdmProvideDeviceId, "provide-device-id" );
+_LIT( KXdmProvideMood, "provide-mood" );
+_LIT( KXdmProvidePlaceIs, "provide-place-is" );
+_LIT( KXdmProvidePlaceType, "provide-place-type" );
+_LIT( KXdmProvidePrivacy, "provide-privacy" );
+_LIT( KXdmProvideRelationship, "provide-relationship" );
+_LIT( KXdmProvideStatusIcon, "provide-status-icon" );
+_LIT( KXdmProvideSphere, "provide-sphere" );
+_LIT( KXdmProvideTimeOffset, "provide-time-offset" );
+_LIT( KXdmProvideUserInput, "provide-user-input" );
+_LIT( KXdmProvideNote, "provide-note" );
+_LIT( KXdmProvideUnknownAttribute, "provide-unknown-attribute" );
+_LIT( KXdmProvideAllAttributes, "provide-all-attributes" );
+_LIT( KXdmSubHandling, "sub-handling" );
+_LIT( KXdmProvideWillingness, "provide-willingness" );
+_LIT( KXdmProvideNetworkAvailability, "provide-network-availability" );
+_LIT( KXdmProvideSessionParticipation, "provide-session-participation" );
+_LIT( KXdmProvideGeopriv, "provide-geopriv" );
+_LIT( KXdmProvideRegistrationState, "provide-registration-state" );
+_LIT( KXdmProvideBarringState, "provide-barring-state" );
+_LIT8( KXdmBare, "bare" );
+_LIT8( KXdmThresholds, "thresholds" );
+_LIT8( KXdmRandomize, "randomize" );
+_LIT8( KXdmObfuscate, "obfuscate" );
+_LIT8( KXdmConfirm, "confirm" );
+_LIT8( KXdmPoliteBlock, "polite-block" );
+
+// Literals for commonpolicy
+_LIT( KXdmOtherIdentity, "other-identity" );
+_LIT( KXdmExternalList, "external-list" );
+_LIT( KXdmAnonymousRequest, "anonymous-request" );
+_LIT( KXdmRule, "rule" );
+_LIT( KXdmExceptDomain, "except-domain" );
+_LIT( KXdmExcept, "except" );
+_LIT( KXdmFrom, "from" );
+_LIT( KXdmTo, "to" );
+_LIT( KXdmValue, "value" );
+_LIT( KXdmSphere, "sphere" );
+_LIT( KXdmValidity, "validity" );
+_LIT( KXdmConditions, "conditions" );
+_LIT( KXdmActions, "actions" );
+_LIT( KXdmTransformations, "transformations" );
+_LIT( KXdmMany, "many" );
+_LIT( KXdmUntil, "until" );
+_LIT( KXdmOne, "one" );
+_LIT( KXdmScheme, "scheme" );
+
+// Literals for poc
+_LIT( KXdmGroup, "group");
+_LIT( KXdmListService, "list-service" );
+_LIT( KXdmInviteMembers, "invite-members" );
+_LIT( KXdmMaxParticipantCount, "max-participant-count" );
+_LIT( KXdmIsListMember, "is-list-member" );
+_LIT( KXdmAllowConfState, "allow-conference-state" );
+_LIT( KXdmAllowInvUsersDyn, "allow-invite-users-dynamically" );
+_LIT( KXdmJoinHandling, "join-handling" );
+_LIT( KXdmAllowInitiateConf, "allow-initiate-conference" );
+_LIT( KXdmAllowAnonymity, "allow-anonymity");
+_LIT( KXdmIsKeyParticipant, "list-service" );
+_LIT( KXdmAllowInvite, "allow-invite" );
+_LIT8( KXdmReject, "reject" );
+_LIT8( KXdmAccept, "accept" );
+_LIT8( KXdmPass, "pass" );
+
+// Literals for resource list
+_LIT( KXdmEntryRef, "entry-ref");
+_LIT( KXdmResourceLists, "resource-lists");
+
+// Literals for shared
+_LIT( KXdmUriUsages, "uriusages");
+_LIT( KXdmUriUsage, "uriusage");
+
+// Literals for rls
+_LIT( KXdmRlsServices, "rls-services" );
+_LIT( KXdmService, "service");
+_LIT( KXdmResourceList, "resource-list" );
+_LIT( KXdmPackages, "packages" );
+_LIT( KXdmPackage, "package" );
+_LIT8( KXdmPresence, "presence" );
+
+// PRES-CONTENT starts
+_LIT( KXdmMimeType, "mime-type");
+_LIT( KXdmEncoding, "encoding");
+_LIT( KXdmDescription, "description");
+_LIT( KXdmData, "data");
+_LIT( KXdmSvg, "svg");
+_LIT( KXdmRect, "rect");
+// PRES-CONTENT ends
+
+#endif //__XCAPAPPUSAGEDEF__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/xdmlogwriter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine log writer
+*
+*/
+
+
+
+
+#ifndef __XDMLOGWRITER__
+#define __XDMLOGWRITER__
+
+#include <e32base.h>
+
+_LIT( KXdmLogDir, "XDM" );
+_LIT( KXdmLogFileExt, ".txt" );
+_LIT( KXdmLogRoot, "C:\\logs\\" );
+
+//Determines how many log file instances are
+//retained until the directory is cleaned up
+/* E.g. XdmEngine1.txt, XdmEngine2.txt ... XdmEngine10.txt */
+const TInt KMaxLogFiles = 10;
+
+/* Default size of the log buffer */
+const TInt KLogBufferMaxSize = 2000;
+
+// CLASS DECLARATION
+class CXdmLogWriter : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ *
+ * @param TDesC& The log file name
+ * @return CXdmLogWriter* A log writer instance
+ */
+ IMPORT_C static CXdmLogWriter* NewL( const TDesC& aLogName );
+
+ /**
+ * Write a log string.
+ *
+ * @param TDesC& Log string in 16-bit
+ * @return void
+ */
+ IMPORT_C void WriteToLog( const TDesC& aLogLine ) const;
+
+ /**
+ * Write a log string.
+ *
+ * @param TDesC8& Log string in 8-bit
+ * @return void
+ */
+ IMPORT_C void WriteToLog( const TDesC8& aLogLine ) const;
+
+ /**
+ * Destructor
+ */
+ virtual ~CXdmLogWriter();
+
+ private:
+
+ /**
+ * C++ constructor is private
+ */
+ CXdmLogWriter();
+
+ /**
+ * Symbian OS second-phase constructor
+ * @param TDesC& Name of the log file to write to
+ * @return void
+ */
+ void ConstructL( const TDesC& aLogName );
+
+ private: //Data
+
+ HBufC* iLogFileName;
+
+ };
+
+#endif //__XDMLOGWRITER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+ <!ENTITY layer_real_source_path "sf/mw/legacypresence" >
+]>
+
+<SystemDefinition name="legacypresence" schema="1.4.0">
+ <systemModel>
+ <layer name="mw_layer">
+ <module name="legacypresence">
+ <unit unitID="presdo.legacypresence" mrp="" bldFile="&layer_real_source_path;/group" name="legacypresence" />
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/bwinscw/msgconnmanagerU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewMsgConnManagerL@@YAPAVMMsgConnManager@@H@Z @ 1 NONAME ; class MMsgConnManager * NewMsgConnManagerL(int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/eabi/msgconnmanagerU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+ _Z18NewMsgConnManagerLi @ 1 NONAME
+ _ZTI13CMsgConnTimer @ 2 NONAME ; #<TI>#
+ _ZTI15CMsgConnManager @ 3 NONAME ; #<TI>#
+ _ZTV13CMsgConnTimer @ 4 NONAME ; #<VT>#
+ _ZTV15CMsgConnManager @ 5 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager build file
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+//--------------------
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_EXPORTS
+//--------------------
+// IBYs
+../rom/msgconnmanager.iby CORE_MW_LAYER_IBY_EXPORT_PATH(msgconnmanager.iby)
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+msgconnmanager.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/group/msgconnmanager.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET msgconnmanager.dll
+TARGETTYPE dll
+UID 0x1000008d 0x101FB0C2
+CAPABILITY CAP_GENERAL_DLL
+
+SOURCEPATH ../src
+
+SOURCE msgconntimer.cpp
+SOURCE msgconnmanager.cpp
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+DEBUGLIBRARY flogger.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY commdb.lib
+LIBRARY esock.lib
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+ deffile ../bwinscw/
+#elif defined (WINS )
+ deffile ../bwins/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/inc/msgconnmanager.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager
+*
+*/
+
+
+
+
+#ifndef __MSGCONNMANAGER__
+#define __MSGCONNMANAGER__
+
+// INCLUDES
+#include <commdb.h>
+#include <es_sock.h>
+#include <commdbconnpref.h>
+#include <msgconnmanagerapi.h>
+#include "msgconntimercallback.h"
+
+
+//CONSTANTS
+_LIT( KConnManLogDir, "MsgConnMan" );
+_LIT( KConnManLogFile, "MsgConnManager.txt" );
+const TInt KConnManLogBufferMaxSize = 2000;
+
+//FORWARD DECLARATIONS
+class CMsgConnTimer;
+class MMsgBearerObsCallback;
+
+// CLASS DECLARATION
+class CMsgConnManager : public CActive,
+ public MMsgConnManager,
+ public MMsgConnTimerCallback
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CMsgConnManager*
+ */
+ static CMsgConnManager* NewL( const TInt aAccessPoint );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMsgConnManager();
+
+ public: //New functions
+
+ /**
+ * Symbian OS default constructor.
+ * @param TRequestStatus& Request status of the caller
+ * @return void
+ */
+ virtual void StartConnection( TRequestStatus& aStatus );
+
+ /**
+ * Stop a connection, synchronous version
+ * @return void
+ */
+ virtual void StopConnection();
+
+ /**
+ * Stop a connection, asynchronous version
+ * @return void
+ */
+ virtual void StopConnection( TRequestStatus& aStatus );
+
+ /**
+ * Cancel StartConnection(). The method may leave with
+ * - KErrAbort if the TRequestStatus object the client
+ * supplied is not active, hence, there is no pending
+ * request that would require cancelling.
+ * In normal cases - when RConnection::Start() or its
+ * progress notifications are pending - ConnMan completes
+ * the client's request with the "error" KErrCancel.
+ */
+ virtual void CancelStartL();
+
+ /**
+ * Set the ID of the Access Point to connect to.
+ * @param aAccessPointID
+ * @return void
+ */
+ virtual void SetAccessPointIDL( const TInt aAccessPointID );
+
+ /**
+ * Returns the number of connections presently active
+ * @return TInt
+ */
+ virtual TInt NumberOfActiveConns();
+
+ /**
+ * Read from the Comms Database
+ * @param const TMsgSupportedCommDbRecords& aParameter
+ * @return HBufC8*
+ */
+ virtual HBufC* ReadFromCommsDbLC( const TSupportedCommDbRecords aParameter );
+
+ /**
+ * Returns a reference to the active socket server.
+ * @return RConnection&
+ */
+ virtual RConnection& Connection();
+
+ /**
+ * Returns a reference to the active socket server.
+ * @return RSocketServ&
+ */
+ virtual RSocketServ& SocketSession();
+
+ /**
+ * Add an object to the queue of listeners. The object to be added
+ * must inplement the interface MMsgBearerObsCallback in order
+ * to receive events from the system agent. It is important to note
+ * that the call to the notification handler (HandleBearerEventL())
+ * takes place inside the RunL() method of this Connection Manager,
+ * so the listening object MUST return the control to the Manager
+ * AS SOON AS POSSIBLE in order not to clog the scheduler.
+ * @param MMsgBearerObsCallback* aClient
+ * @return void
+ */
+ virtual void AddEventSubscriberL( MMsgBearerObsCallback* aClient );
+
+ /**
+ * Remove an object from the queue of listeners. It is no necessary
+ * to call this method at deletion time, as the destructor destroys
+ * the subscriber queue altogether. If, however, a listener object is
+ * destroyed before an instance of Connection Manager, it is mandatory
+ * to remove the listener from the queue prior to deleting the listener.
+ * @param MMsgBearerObsCallback* aClient
+ * @return void
+ */
+ virtual void RemoveEventSubscriber( MMsgBearerObsCallback* aClient );
+
+ /**
+ * Returns the status of the ConnMan: ETrue if sending is OK, EFalse otherwise
+ * @return TBool
+ */
+ virtual TBool Status() const;
+
+ /**
+ * Destructor.
+ * @return void
+ */
+ virtual void Destroy();
+
+ public:
+
+ #ifdef _DEBUG
+
+ /**
+ * A Global logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+
+ #endif
+
+ private:
+
+ /**
+ * Start to keep an eye on the opened connection
+ * @return void
+ */
+ void StartNetworkObserver();
+
+ /**
+ * Determine the state of the connection opening
+ * @return void
+ */
+ void WatchConnectionOpening();
+
+ /**
+ * Determine the state of the (opened) connection
+ * @return void
+ */
+ void DetermineConnectionStatusL();
+
+ /**
+ * Broadcast the bearer event to registered listeners
+ * @param TMsgBearerEvent aBearerEvent
+ * @return void
+ */
+ void BroadcastBearerEventL( const TMsgBearerEvent aBearerEvent );
+
+ /**
+ * Determine which value is to be fetched from the CommsDb
+ * @param TPtrC& aDbView
+ * @param TPtrC& TPtrC& aDbColumn
+ * @param TMsgSupportedCommDbRecords aParameter
+ * @return TBool
+ */
+ TInt DetermineRecordTypeLC( TPtrC& aDbColumn,
+ CCommsDbTableView*& aView,
+ const TSupportedCommDbRecords aParameter );
+
+ /**
+ * Broadcast the bearer event to registered listeners
+ * @param TMsgBearerEvent aBearerEvent
+ * @return void
+ */
+ TInt InitCommDbViewLC( TPtrC& aDbRecord,
+ CCommsDbTableView*& aView,
+ const TSupportedCommDbRecords aParameter );
+
+ /**
+ * Broadcast the bearer event to registered listeners
+ * @param TMsgBearerEvent aBearerEvent
+ * @return void
+ */
+ TBool CheckProxyUsageLC( CCommsDbTableView*& aView );
+
+ /**
+ * Issue a new asynchronous request
+ * @return void
+ */
+ void IssueRequest();
+
+ /**
+ * Check the availability of GPRS Network
+ * @return TBool Available or not
+ */
+ TBool IsValidApL( TUint32 aUid );
+
+ /**
+ * Handle the opening of a new connection
+ * @return void
+ */
+ void HandleNewConnection();
+
+ /**
+ * Handle an existing connection
+ * @return void
+ */
+ void HandleExistingConnection();
+
+ /**
+ * Symbian OS second-phase constructor
+ * @param TInt aAccessPoint
+ * @return void
+ */
+ void ConstructL( const TInt aAccessPoint );
+
+ /**
+ * Delete the log files
+ * @return void
+ */
+ void DeleteLogFileL();
+
+ /**
+ * C++ default constructor is private
+ * @return void
+ */
+ CMsgConnManager();
+
+ /**
+ * From CActive
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ * @return void
+ */
+ void DoCancel();
+
+ private: //From MMsgConnectionTimerCallback
+
+ /**
+ * Catch a timer event
+ * @param TInt aStatus
+ * @return void
+ */
+ virtual void HandleTimerEvent( TInt aStatus );
+
+ private: //Data
+
+ enum TMsgConnManState
+ {
+ EMsgConnManIdle = 0,
+ EMsgConnManWaitingForStartComplete,
+ EMsgConnManWaitingForNotifications,
+ EMsgConnManDisconnectingPrevious,
+ EMsgConnManObservingAccessPoint,
+ EMsgConnManBearerSuspended,
+ EMsgConnManBearerLost
+ };
+
+ TInt iAccessPointID;
+ TInt iLastConnectionStage;
+ TBool iProgressStarted;
+ TBool iConnectionClosed;
+ TNifProgressBuf iProgressBuffer;
+ TMsgConnManState iConnManStatus;
+ TRequestStatus* iClientStatus;
+ TRequestStatus* iPingRequestStatus;
+ TRequestStatus* iTimedCompleteStatus;
+ CCommsDatabase* iCommsDatabase;
+ CMsgConnTimer* iConnectionTimer;
+ RConnection iConnection;
+ TCommDbConnPref iAccessPointSettings;
+ RSocketServ iSocketSession;
+ RPointerArray<MMsgBearerObsCallback> iEventSubscribers;
+ };
+
+// ---------------------------------------------------------
+// CMsgConnManager::StartBearerObserver
+// If the status is any other than EMsgConnManObservingAccessPoint
+// there is something fishy going on => do not send/receive anything
+// ---------------------------------------------------------
+//
+inline TBool CMsgConnManager::Status() const
+ {
+ return iConnManStatus == EMsgConnManObservingAccessPoint;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::SocketSession
+//
+// ---------------------------------------------------------
+//
+inline RSocketServ& CMsgConnManager::SocketSession()
+ {
+ return iSocketSession;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::Connection
+//
+// ---------------------------------------------------------
+//
+inline RConnection& CMsgConnManager::Connection()
+ {
+ return iConnection;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::Destroy
+//
+// ---------------------------------------------------------
+//
+inline void CMsgConnManager::Destroy()
+ {
+ delete this;
+ }
+
+#endif
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/inc/msgconntimer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager timer
+*
+*/
+
+
+
+
+#ifndef __MSGCONNTIMER__
+#define __MSGCONNTIMER__
+
+#include <e32base.h>
+
+class MMsgConnTimerCallback;
+
+// CLASS DECLARATION
+class CMsgConnTimer : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @return CMsgConnTimer*
+ */
+ static CMsgConnTimer* NewL();
+
+ /**
+ * Two-phased constructor.
+ * @param MMsgConnectionTimerCallback* aClient
+ * @return CMsgConnTimer*
+ */
+ static CMsgConnTimer* NewL( MMsgConnTimerCallback* aClient );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMsgConnTimer();
+
+ public: // New functions
+
+ /**
+ * Request to activate timer
+ * @param TRequestStatus& aStatus
+ * @param TTimeIntervalMicroSeconds32 aDelay
+ * @param TBool aCompleteIfCancel = EFalse
+ * @return void
+ */
+ void ActivateTimer( TRequestStatus& aStatus,
+ TTimeIntervalMicroSeconds32 aDelay );
+
+ /**
+ * Request to activate timer
+ * @param TTimeIntervalMicroSeconds32 aDelay
+ * @param MMsgConnectionTimerCallback* aClient
+ * @return void
+ */
+ void ActivateTimer( MMsgConnTimerCallback* aClient,
+ TTimeIntervalMicroSeconds32 aDelay );
+
+ private:
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * By default Symbian OS constructor is private.
+ * @return void
+ */
+ void ConstructL();
+
+ /**
+ * C++ constructor.
+ */
+ CMsgConnTimer();
+
+ /**
+ * C++ constructor.
+ * @param MMsgConnectionTimerCallback* aClient
+ */
+ CMsgConnTimer( MMsgConnTimerCallback* aClient );
+
+ private: // Data
+
+ RTimer iTimer;
+ TRequestStatus* iClientStatus;
+ TBool iCompleteIfCancel;
+ MMsgConnTimerCallback* iClient;
+ };
+
+#endif //MSGCONNTIMER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/inc/msgconntimercallback.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager timer callback
+*
+*/
+
+
+
+
+#ifndef __MSGCONNTIMERCALLBACK__
+#define __MSGCONNTIMERCALLBACK__
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+class MMsgConnTimerCallback
+ {
+ public:
+
+ /**
+ * Pure virtual callback function to be implemented in the
+ * derived class. This function is called when timer has
+ * compeleted.
+ * @param aStatus The integer value of iStatus of the timer class
+ * @return void
+ */
+ virtual void HandleTimerEvent( TInt aStatus ) = 0;
+ };
+
+#endif //__MSGCONNTIMERCALLBACK__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/rom/msgconnmanager.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager rom file
+*
+*/
+
+
+
+
+#ifndef __MSGCONNMANAGER_IBY__
+#define __MSGCONNMANAGER_IBY__
+
+ #ifdef __XDM
+ #define __INCLUDE_CM__
+ #endif //__XDM
+
+ #ifdef __IM
+ #define __INCLUDE_CM__
+ #endif //__IM
+
+ #ifdef __PRESENCE
+ #define __INCLUDE_CM__
+ #endif //__PRESENCE
+
+ #ifdef __INCLUDE_CM__
+ file=ABI_DIR\BUILD_DIR\msgconnmanager.dll SHARED_LIB_DIR\msgconnmanager.dll
+ #endif //__INCLUDE_CM__
+
+#endif //__MSGCONNMANAGER_IBY__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/src/msgconnmanager.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1065 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <in_sock.h>
+#include <es_enum.h>
+#include <f32file.h>
+#include <flogger.h>
+#include "msgconntimer.h"
+#include "msgconnmanager.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+
+// ----------------------------------------------------------
+// CMsgConnManager::CMsgConnManager
+//
+// ----------------------------------------------------------
+//
+CMsgConnManager::CMsgConnManager() : CActive( EPriorityUserInput + 2 ),
+ iProgressStarted( EFalse ),
+ iConnectionClosed( ETrue )
+
+ {
+
+ }
+
+// ----------------------------------------------------------
+// CMsgConnManager::NewL
+//
+// ----------------------------------------------------------
+//
+CMsgConnManager* CMsgConnManager::NewL( const TInt aAccessPoint )
+ {
+ CMsgConnManager* self = new ( ELeave ) CMsgConnManager();
+ CleanupStack::PushL( self );
+ self->ConstructL( aAccessPoint );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CMsgConnManager::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CMsgConnManager::ConstructL( const TInt aAccessPoint )
+ {
+ DeleteLogFileL();
+ iAccessPointID = aAccessPoint;
+ iConnectionTimer = CMsgConnTimer::NewL();
+ iCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
+ User::LeaveIfError( iSocketSession.Connect() );
+ User::LeaveIfError( iConnection.Open( iSocketSession ) );
+ iConnectionClosed = EFalse;
+ iAccessPointSettings.SetIapId( aAccessPoint );
+ iAccessPointSettings.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CONNMAN: LOGGING ENABLED" ) );
+ #endif
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::~CMsgConnManager
+//
+// ----------------------------------------------------
+//
+CMsgConnManager::~CMsgConnManager()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::~CMsgConnManager(), Destructor." ) );
+ #endif
+ Cancel();
+ delete iCommsDatabase;
+ delete iConnectionTimer;
+ iConnection.Close();
+ iSocketSession.Close();
+ iEventSubscribers.Close();
+ }
+
+// ----------------------------------------------------------
+// CMsgConnManager::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+void CMsgConnManager::DeleteLogFileL()
+ {
+ RFs session;
+ User::LeaveIfError( session.Connect() );
+ CFileMan* manager = CFileMan::NewL( session );
+ manager->Delete( _L("C:\\logs\\MsgConnMan\\*.*") );
+ session.Close();
+ delete manager;
+ manager = NULL;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::StartBearerObserver
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::StartNetworkObserver()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::StartNetworkObserver() Closed: %d" ), iConnectionClosed );
+ #endif
+ #ifdef __WINS__
+ if( !iConnectionClosed )
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ }
+ #else
+ if( !iConnectionClosed )
+ {
+ if( !IsActive() )
+ {
+ iStatus = KRequestPending;
+ iConnection.ProgressNotification( iProgressBuffer, iStatus );
+ SetActive();
+ }
+ }
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::RunL()
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::RunL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::RunL(), iConnManStatus: %d iStatus: %d iStage: %d iError: %d" ),
+ iConnManStatus, iStatus.Int(), iProgressBuffer().iStage, iProgressBuffer().iError );
+ #endif
+ switch( iConnManStatus )
+ {
+ case EMsgConnManWaitingForStartComplete:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManWaitingForStartComplete." ) );
+ #endif
+ WatchConnectionOpening();
+ break;
+ case EMsgConnManWaitingForNotifications:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManWaitingForNotifications." ) );
+ #endif
+ WatchConnectionOpening();
+ break;
+ case EMsgConnManObservingAccessPoint:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManObservingAccessPoint." ) );
+ #endif
+ DetermineConnectionStatusL();
+ break;
+ case EMsgConnManBearerSuspended:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManBearerSuspended." ) );
+ #endif
+ DetermineConnectionStatusL();
+ break;
+ case EMsgConnManDisconnectingPrevious:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Timer expired, complete client's request." ) );
+ #endif
+ User::RequestComplete( iTimedCompleteStatus, KErrNone );
+ iConnManStatus = EMsgConnManIdle;
+ break;
+ case EMsgConnManIdle:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Idle, iStatus is %d." ), iStatus.Int() );
+ #endif
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Default case, should not be here." ) );
+ #endif
+ break;
+ }
+ #ifdef _DEBUG
+ WriteToLog( _L8( " RunL() ends" ) );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::WatchConnectionOpening()
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::WatchConnectionOpening()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::WatchConnectionOpening() - iProgressStarted: %d" ), iProgressStarted );
+ #endif
+ //Lets quit right away if it is an error
+ if( iStatus != KErrNone )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Something wrong, complete with error: %d." ), iStatus.Int() );
+ #endif
+ iConnectionTimer->Cancel();
+ if( iConnManStatus == EMsgConnManWaitingForNotifications )
+ iConnection.CancelProgressNotification();
+ iConnection.Close();
+ iConnectionClosed = ETrue;
+ User::RequestComplete( iClientStatus, iStatus.Int() );
+ iConnManStatus = EMsgConnManIdle;
+ }
+ else
+ {
+ if( iProgressStarted )
+ {
+ iLastConnectionStage = iProgressBuffer().iStage;
+ if( iLastConnectionStage == KLinkLayerOpen ) //we are done
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Connected. Completing with KErrNone." ) );
+ #endif
+ iConnectionTimer->Cancel();
+ iConnManStatus = EMsgConnManObservingAccessPoint;
+ StartNetworkObserver();
+ User::RequestComplete( iClientStatus, KErrNone );
+ iProgressStarted = EFalse;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Keep on waiting for progress." ) );
+ #endif
+ IssueRequest();
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Start complete, watch progress." ) );
+ #endif
+ if( iConnManStatus == EMsgConnManWaitingForStartComplete )
+ {
+ iProgressStarted = ETrue;
+ iConnManStatus = EMsgConnManWaitingForNotifications;
+ }
+ IssueRequest();
+ }
+ }
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::DetermineConnectionStatus()
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::DetermineConnectionStatusL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::DetermineConnectionStatus()" ) );
+ #endif
+ #ifdef __WINS__
+ Cancel();
+ switch( iStatus.Int() )
+ #else
+ switch( iProgressBuffer().iStage )
+ #endif
+ {
+ case KLinkLayerClosed:
+ case KConnectionUninitialised:
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " KLinkLayerClosed, notify clients of EMsgBearerLost" ) );
+ #endif
+ Cancel();
+ iConnManStatus = EMsgConnManBearerLost;
+ BroadcastBearerEventL( EMsgBearerLost );
+ iConnection.Close();
+ iConnectionClosed = ETrue;
+ iEventSubscribers.Reset();
+ iConnManStatus = EMsgConnManIdle;
+ break;
+ case KLinkLayerOpen:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " KLinkLayerOpen -> GPRS Context Active." ) );
+ #endif
+ if( iConnManStatus == EMsgConnManBearerSuspended )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Moving to active state." ) );
+ #endif
+ iConnManStatus = EMsgConnManObservingAccessPoint;
+ BroadcastBearerEventL( EMsgBearerActive );
+ StartNetworkObserver();
+ }
+ break;
+ case KDataTransferTemporarilyBlocked:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " KDataTransferTemporarilyBlocked -> GPRS Context Suspended." ) );
+ #endif
+ if( iConnManStatus != EMsgConnManBearerSuspended )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Moving to suspended state." ) );
+ #endif
+ iConnManStatus = EMsgConnManBearerSuspended;
+ BroadcastBearerEventL( EMsgBearerSuspended );
+ }
+ StartNetworkObserver();
+ break;
+ default:
+ #ifdef _DEBUG
+ #ifdef __WINS__
+ if( iStatus.Int() == KErrCancel )
+ WriteToLog( _L8( " Bearer event generation cancelled" ) );
+ else
+ WriteToLog( _L8( " Some weird status: %d" ), iStatus.Int() );
+ #else
+ WriteToLog( _L8( " Default case! WTF?!?" ) );
+ #endif
+ #endif
+ StartNetworkObserver();
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::CancelStartL
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::CancelStartL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::CancelStartL()" ) );
+ #endif
+ if( iClientStatus != NULL && iClientStatus->Int() == KRequestPending )
+ {
+ if( iConnManStatus == EMsgConnManWaitingForStartComplete ||
+ iConnManStatus == EMsgConnManWaitingForNotifications )
+ {
+ Cancel();
+ iEventSubscribers.Reset();
+ User::RequestComplete( iClientStatus, KErrCancel );
+ iConnManStatus = EMsgConnManIdle;
+ iConnectionClosed = ETrue;
+ }
+ else User::Leave( KErrAbort );
+ }
+ else User::Leave( KErrAbort );
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::StopConnection
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::StopConnection()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::StopConnection()" ) );
+ #endif
+ if( iConnManStatus == EMsgConnManWaitingForStartComplete ||
+ iConnManStatus == EMsgConnManWaitingForNotifications ||
+ iConnManStatus == EMsgConnManIdle )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is %d, wrong state for this operation. Abort." ), iConnManStatus );
+ #endif
+ }
+ else
+ {
+ //If bearer has been lost, we're already closed
+ if( iConnManStatus != EMsgConnManBearerLost )
+ {
+ Cancel();
+ iConnection.Close();
+ iConnectionClosed = ETrue;
+ iEventSubscribers.Reset();
+ iConnManStatus = EMsgConnManIdle;
+ }
+ }
+ #ifdef _DEBUG
+ WriteToLog( _L8( " StopConnection() ends." ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::StopConnection
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::StopConnection( TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CImpsConnectionManager::StopConnectionL()" ) );
+ #endif
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+ iTimedCompleteStatus = &aStatus;
+ if( iConnManStatus == EMsgConnManWaitingForStartComplete ||
+ iConnManStatus == EMsgConnManWaitingForNotifications ||
+ iConnManStatus == EMsgConnManDisconnectingPrevious ||
+ iConnManStatus == EMsgConnManIdle )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is %d, wrong state for this operation. Abort." ),
+ iConnManStatus );
+ #endif
+ User::RequestComplete( iClientStatus, KErrAbort );
+ }
+ else
+ {
+ //If bearer has been lost, we're already closed
+ if( iConnManStatus != EMsgConnManBearerLost )
+ {
+ Cancel();
+ iConnection.Close();
+ iConnectionClosed = ETrue;
+ iEventSubscribers.Reset();
+ iConnectionTimer->ActivateTimer( iStatus, 4000000 );
+ iConnManStatus = EMsgConnManDisconnectingPrevious;
+ SetActive();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Bearer lost, nothing to do. Complete with KErrNone" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNone );
+ }
+ }
+ #ifdef _DEBUG
+ WriteToLog( _L8( " StopConnectionL() ends" ) );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::BroadcastBearerEvent
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::BroadcastBearerEventL( const TMsgBearerEvent aBearerEvent )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::BroadcastBearerEvent" ) );
+ #endif
+ TInt subs = iEventSubscribers.Count();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " %d clients subscribed." ), subs );
+ #endif
+ if( subs > 0 )
+ {
+ TBool empty = EFalse;
+ MMsgBearerObsCallback* client = NULL;
+ for( TInt i = 0;i < subs && !empty;i++ )
+ {
+ //Just in case:
+ //If a client has managed to remove a listener from the queue
+ //in the previous callback, "i" will index a bad handle.
+ subs = iEventSubscribers.Count();
+ if( subs > 0 && i < subs )
+ {
+ client = iEventSubscribers[i];
+ __ASSERT_ALWAYS( client != NULL, User::Panic( _L( "ObserverNULL!" ), 1 ) );
+ TInt error = iProgressBuffer().iError;
+ if( aBearerEvent == EMsgBearerLost )
+ {
+ #ifdef _DEBUG
+ TInt stage = iProgressBuffer().iStage;
+ WriteToLog( _L8( " Event is EMsgBearerLost" ) );
+ WriteToLog( _L8( " Stage: %d" ), stage );
+ WriteToLog( _L8( " Error: %d" ), error );
+ #endif
+ }
+ TBool authClose = error == KErrConnectionTerminated;
+ client->HandleBearerEventL( authClose, aBearerEvent );
+ #ifdef _DEBUG
+ WriteToLog( _L8(" Client no. %d serviced" ), i );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8(
+ " An event listener was removed inside the callback!" ) );
+ #endif
+ //Leave the for loop
+ empty = ETrue;
+ }
+ }
+ }
+ #ifdef _DEBUG
+ WriteToLog( _L8( " BroadcastBearerEvent() ends" ) );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::IssueRequest
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::IssueRequest()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::IssueRequest(), status: %d" ), IsActive() );
+ #endif
+ iStatus = KRequestPending;
+ iConnection.ProgressNotification( iProgressBuffer, iStatus );
+ SetActive();
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::StartConnection
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::StartConnection( TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::StartConnection() iConnManStatus: %d" ), iConnManStatus );
+ #endif
+ TInt error = 0;
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+ if( iConnectionClosed )
+ {
+ error = iConnection.Open( iSocketSession );
+ iConnectionClosed = EFalse;
+ }
+ TBool exists = EFalse;
+ TNifProgress progress;
+ error = iConnection.Progress( progress );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Connection stage: %d error: %d" ), progress.iStage, error );
+ #endif
+ TRAPD( err, exists = IsValidApL( iAccessPointID ) );
+ if( ( error == KErrNone && err == KErrNone ) && exists )
+ {
+ if( progress.iStage == KConnectionUninitialised )
+ HandleNewConnection();
+ else
+ HandleExistingConnection();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Something's wrong, complete with KErrUnknown. IAP exists: %d Error: %d Err: %d" ), exists, error, err );
+ #endif
+ User::RequestComplete( iClientStatus, KErrUnknown );
+ iConnectionClosed = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::HandleNewConnection
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::HandleNewConnection()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::HandleNewConnection()" ) );
+ #endif
+ switch( iConnManStatus )
+ {
+ case EMsgConnManIdle:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManIdle," ) );
+ WriteToLog( _L8( " starting to connect IAP: %d" ), iAccessPointSettings.IapId() );
+ #endif
+ iLastConnectionStage = KConnectionUninitialised;
+ iConnection.Start( iAccessPointSettings, iStatus );
+ iConnManStatus = EMsgConnManWaitingForStartComplete;
+ iConnectionTimer->ActivateTimer( this, 20000000 );
+ SetActive();
+ break;
+ case EMsgConnManDisconnectingPrevious:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManDisconnectingPrevious," ) );
+ WriteToLog( _L8( " new connection cannot be started, ignore." ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNotReady );
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " We're in some weird state, complete with KErrUnknown" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrUnknown );
+ iConnManStatus = EMsgConnManIdle;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::HandleExistingConnection
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::HandleExistingConnection()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::HandleOldConnection()" ) );
+ #endif
+ switch( iConnManStatus )
+ {
+ case EMsgConnManDisconnectingPrevious:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManDisconnectingPrevious," ) );
+ WriteToLog( _L8( " attempting to open a connection while previous one is still disconnecting. Complete with KErrNotReady." ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNotReady );
+ break;
+ case EMsgConnManObservingAccessPoint:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Current status is EMsgConnManObservingAccessPoint," ) );
+ WriteToLog( _L8( " already connected" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNone );
+ break;
+ case EMsgConnManWaitingForStartComplete:
+ case EMsgConnManWaitingForNotifications:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Already connecting, ignore" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrAlreadyExists );
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Unknown state, complete with KErrUnknown." ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrUnknown );
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::HandleTimerEventL
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::HandleTimerEvent( TInt /*aStatus*/ )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::HandleTimerEventL()" ) );
+ #endif
+ switch( iConnManStatus )
+ {
+ case EMsgConnManWaitingForNotifications:
+ case EMsgConnManWaitingForStartComplete:
+ Cancel();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Connection initiation timed out, complete with error KErrTimedOut" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrTimedOut );
+ iConnection.Close();
+ iConnectionClosed = ETrue;
+ iConnManStatus = EMsgConnManIdle;
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Default case, problems..." ) );
+ #endif
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::AddEventSubscriberL
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::AddEventSubscriberL( MMsgBearerObsCallback* aClient )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::AddEventSubscriberL()" ) );
+ #endif
+ if( iEventSubscribers.Count() < KMaxNumberOfSubscribers )
+ User::LeaveIfError( iEventSubscribers.Append( aClient ) );
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Not allowed to have more than %d clients" ), KMaxNumberOfSubscribers );
+ #endif
+ User::Leave( KErrAlreadyExists );
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::RemoveEventSubscriber
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::RemoveEventSubscriber( MMsgBearerObsCallback* aClient )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::RemoveEventSubscriber()" ) );
+ #endif
+ TInt index = iEventSubscribers.Find( aClient );
+ if( index >= 0 )
+ {
+ iEventSubscribers.Remove( index );
+ }
+ }
+
+#ifdef _DEBUG
+// ----------------------------------------------------
+// CMsgConnManager::WriteToLog
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KConnManLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RDebug::RawPrint( buf );
+ RFileLogger::Write( KConnManLogDir, KConnManLogFile, EFileLoggingModeAppend, buf );
+ }
+#endif
+
+// ----------------------------------------------------
+// CMsgConnManager::SetAccessPointIDL
+//
+// ----------------------------------------------------
+//
+void CMsgConnManager::SetAccessPointIDL( const TInt aAccessPointID )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::SetAccessPointIDL: %d" ), aAccessPointID );
+ #endif
+ if( IsValidApL( aAccessPointID ) )
+ {
+ iAccessPointID = aAccessPointID;
+ iAccessPointSettings.SetIapId( iAccessPointID );
+ iAccessPointSettings.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " The specified AP does not exist, leaves with KErrNotFound" ) );
+ #endif
+ User::Leave( KErrNotFound );
+ }
+ }
+
+// ----------------------------------------------------
+// CMsgConnManager::NumberOfActiveConns
+//
+// ----------------------------------------------------
+//
+TInt CMsgConnManager::NumberOfActiveConns()
+ {
+ TUint count = 0;
+ TInt error = KErrNone;
+ if( !iConnectionClosed )
+ {
+ error = iConnection.EnumerateConnections( count );
+ }
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::NumberOfActiveConns() Conns: %d Error: %d" ), count, error );
+ #endif
+ return KErrNone == error ? count : error;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::ReadFromCommsDbLC
+//
+// ---------------------------------------------------------
+//
+HBufC* CMsgConnManager::ReadFromCommsDbLC( const TSupportedCommDbRecords aParameter )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::ReadFromCommsDbLC()" ) );
+ #endif
+ TPtrC dbRecord;
+ HBufC* value = NULL;
+ CCommsDbTableView* view = NULL;
+ TInt error = InitCommDbViewLC( dbRecord, view, aParameter );
+ if( error == KErrNone )
+ {
+ TDbColType colType;
+ TUint32 attribute = 0;
+ view->ReadTypeAttribL( dbRecord, colType, attribute );
+ switch( colType )
+ {
+ case EDbColBit:
+ break;
+ case EDbColUint32:
+ {
+ TUint32 intValue = 0;
+ _LIT( KProxyPort,"%d" );
+ view->ReadUintL( dbRecord, intValue );
+ value = HBufC::NewLC( sizeof( KProxyPort ) );
+ TPtr portPtr( value->Des() );
+ portPtr.Format( KProxyPort, intValue );
+ value->Des().Copy( portPtr );
+ }
+ break;
+ case EDbColText8:
+ break;
+ case EDbColText16:
+ break;
+ case EDbColLongText16:
+ value = view->ReadLongTextLC( dbRecord );
+ break;
+ default:
+ break;
+ }
+ if( value != NULL )
+ {
+ #ifdef _DEBUG
+ HBufC8* temp = HBufC8::NewL( value->Des().Length() );
+ TPtr8 ptr( temp->Des() );
+ ptr.Copy( *value );
+ WriteToLog( _L8( " Value was found: %S" ), &ptr );
+ delete temp;
+ temp = NULL;
+ #endif
+ CleanupStack::Pop(); //value
+ CleanupStack::PopAndDestroy(); //view
+ CleanupStack::PushL( value ); //Put it back in
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " No proxy address defined in CommDb" ) );
+ #endif
+ CleanupStack::PopAndDestroy(); //view
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Error: %d" ), error );
+ #endif
+ }
+ return value;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::InitCommDbViewLC
+//
+// ---------------------------------------------------------
+//
+TInt CMsgConnManager::InitCommDbViewLC( TPtrC& aDbRecord,
+ CCommsDbTableView*& aView,
+ const TSupportedCommDbRecords aParameter )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::InitCommDbViewLC" ) );
+ #endif
+ aView = iCommsDatabase->OpenViewMatchingUintLC
+ ( TPtrC( IAP ), TPtrC( COMMDB_ID ), iAccessPointID );
+ TInt error = aView->GotoFirstRecord();
+ if( error == KErrNone )
+ {
+ error = DetermineRecordTypeLC( aDbRecord, aView, aParameter );
+ #ifdef _DEBUG
+ if( error != KErrNone )
+ WriteToLog( _L8( " DetermineRecordType() failed - Error: %d" ), error );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " No matching view found - Error: %d" ), error );
+ #endif
+ CleanupStack::PopAndDestroy(); //aView
+ aView = NULL;
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::DetermineRecordType
+//
+// ---------------------------------------------------------
+//
+TInt CMsgConnManager::DetermineRecordTypeLC( TPtrC& aDbColumn,
+ CCommsDbTableView*& aView,
+ const TSupportedCommDbRecords aParameter )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " CMsgConnManager::DetermineRecordType()" ) );
+ #endif
+ TInt error = KErrNotFound;
+ switch( aParameter )
+ {
+ case EMsgProxyAddress:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Type is EImpsProxyAddress" ) );
+ #endif
+ if( CheckProxyUsageLC( aView ) )
+ {
+ error = KErrNone;
+ aDbColumn.Set( TPtrC( PROXY_SERVER_NAME ) );
+ }
+ break;
+ case EMsgProxyPort:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Type is EImpsProxyPort" ) );
+ #endif
+ if( CheckProxyUsageLC( aView ) )
+ {
+ error = KErrNone;
+ aDbColumn.Set( TPtrC( PROXY_PORT_NUMBER ) );
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Default case, problems..." ) );
+ #endif
+ error = KErrNotSupported;
+ break;
+ }
+ return error;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::CheckProxyUsageLC
+//
+// ---------------------------------------------------------
+//
+TBool CMsgConnManager::CheckProxyUsageLC( CCommsDbTableView*& aView )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::CheckProxyUsageL()" ) );
+ #endif
+ TBool useProxy = EFalse;
+ TUint32 serviceIdNumber = 0;
+ TBuf<KCommsDbSvrMaxFieldLength> serviceIdText;
+ aView->ReadTextL( TPtrC( IAP_SERVICE_TYPE ), serviceIdText );
+ aView->ReadUintL( TPtrC( IAP_SERVICE ), serviceIdNumber );
+ CleanupStack::PopAndDestroy(); //aView
+ aView = NULL;
+ aView = iCommsDatabase->OpenViewOnProxyRecordLC( serviceIdNumber, serviceIdText );
+ TInt error = aView->GotoFirstRecord();
+ if( error == KErrNone )
+ {
+ aView->ReadBoolL( TPtrC( PROXY_USE_PROXY_SERVER ), useProxy );
+ if( !useProxy )
+ {
+ CleanupStack::PopAndDestroy(); //aView
+ aView = NULL;
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " The AP does not use a proxy server." ) );
+ #endif
+ CleanupStack::PopAndDestroy(); //aView
+ aView = NULL;
+ }
+ return useProxy;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::IsValidApL
+//
+// ---------------------------------------------------------
+//
+TBool CMsgConnManager::IsValidApL( TUint32 aUid )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::IsValidApL()" ) );
+ #endif
+ CCommsDbTableView* table = iCommsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+ TPtrC( COMMDB_ID ),
+ aUid );
+ TInt res = table->GotoFirstRecord();
+ CleanupStack::PopAndDestroy(); // table
+ return res == KErrNone;
+ }
+
+// ---------------------------------------------------------
+// CMsgConnManager::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CMsgConnManager::DoCancel()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CMsgConnManager::DoCancel()" ) );
+ #endif
+ switch( iConnManStatus )
+ {
+ case EMsgConnManWaitingForStartComplete:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is EMsgConnManWaitingForStartComplete" ) );
+ #endif
+ iConnection.Close();
+ iConnectionTimer->Cancel();
+ break;
+ case EMsgConnManWaitingForNotifications:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is EMsgConnManWaitingForNotifications" ) );
+ #endif
+ iConnection.CancelProgressNotification();
+ iConnectionTimer->Cancel();
+ iConnection.Close();
+ break;
+ case EMsgConnManDisconnectingPrevious:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is EMsgConnManDisconnectingPrevious" ) );
+ #endif
+ iConnectionTimer->Cancel();
+ User::RequestComplete( iClientStatus, KErrCancel );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " StopConnection() terminated, client's request completed." ) );
+ #endif
+ break;
+ case EMsgConnManObservingAccessPoint:
+ case EMsgConnManBearerSuspended:
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is %d" ), iConnManStatus );
+ #endif
+ iConnection.CancelProgressNotification();
+ #ifdef __WINS__
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrCancel );
+ #endif
+ }
+ break;
+ case EMsgConnManIdle:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Status is EMsgConnManIdle" ) );
+ #endif
+ break;
+ default:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Default case" ) );
+ #endif
+ break;
+ }
+ }
+
+// ----------------------------------------------------
+// NewImpsConnManL
+// Returns a ConnManager instance
+// ----------------------------------------------------
+//
+EXPORT_C MMsgConnManager* NewMsgConnManagerL( const TInt aDefaultAccessPoint )
+ {
+ return CMsgConnManager::NewL( aDefaultAccessPoint );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/msgconnmanager/src/msgconntimer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager timer
+*
+*/
+
+
+
+
+// INCLUDES
+#include "msgconntimer.h"
+#include "msgconnmanager.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CMsgConnTimer::CMsgConnTimer() : CActive( EPriorityStandard ),
+ iCompleteIfCancel( EFalse )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CMsgConnTimer::CMsgConnTimer( MMsgConnTimerCallback* aClient ) :
+ CActive( EPriorityStandard ),
+ iClient( aClient )
+
+
+ {
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+void CMsgConnTimer::ConstructL()
+ {
+ User::LeaveIfError( iTimer.CreateLocal() );
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CMsgConnTimer* CMsgConnTimer::NewL()
+ {
+ CMsgConnTimer* self = new ( ELeave ) CMsgConnTimer();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CMsgConnTimer* CMsgConnTimer::NewL( MMsgConnTimerCallback* aClient )
+ {
+ CMsgConnTimer* self = new ( ELeave ) CMsgConnTimer( aClient );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CMsgConnTimer::~CMsgConnTimer()
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( "CMsgConnTimer::~CMsgConnTimer(), destructor called." ) );
+ #endif
+ Cancel();
+ iTimer.Close();
+ }
+
+// ---------------------------------------------------------
+// CMsgConnTimer::ActivateTimer
+//
+// ---------------------------------------------------------
+//
+void CMsgConnTimer::ActivateTimer( TRequestStatus& aStatus,
+ TTimeIntervalMicroSeconds32 aDelay )
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( "CMsgConnTimer::ActivateTimer()." ) );
+ #endif
+ __ASSERT_ALWAYS( !IsActive(), User::Panic( _L("ConnectionTimer"), 1 ) );
+ iClient = NULL;
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+ iTimer.After( iStatus, aDelay );
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " Timer activated." ) );
+ #endif
+ SetActive();
+ }
+
+// ---------------------------------------------------------
+// CMsgConnTimer::ActivateTimer
+//
+// ---------------------------------------------------------
+//
+void CMsgConnTimer::ActivateTimer( MMsgConnTimerCallback* aClient,
+ TTimeIntervalMicroSeconds32 aDelay )
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( "CMsgConnTimer::ActivateTimer()" ) );
+ #endif
+ __ASSERT_ALWAYS( !IsActive(), User::Panic( _L("ConnectionTimer"), 1 ) );
+ iClient = aClient;
+ iClientStatus = NULL;
+ iTimer.After( iStatus, aDelay );
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " Timer activated (with client)" ) );
+ #endif
+ SetActive();
+ }
+
+// ---------------------------------------------------------
+// CMsgConnTimer::RunL
+//
+// ---------------------------------------------------------
+//
+void CMsgConnTimer::RunL()
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( "CMsgConnTimer::RunL()." ) );
+ #endif
+ if( iClient != NULL )
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " iClient != NULL, Callback interface in use." ) );
+ #endif
+ iClient->HandleTimerEvent( iStatus.Int() );
+ iClient = NULL;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " iClient == NULL, completing request." ) );
+ #endif
+ User::RequestComplete( iClientStatus, iStatus.Int() );
+ }
+ }
+
+// ---------------------------------------------------------
+// CMsgConnTimer::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CMsgConnTimer::DoCancel()
+ {
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( "CMsgConnTimer::DoCancel()" ) );
+ #endif
+ iTimer.Cancel();
+ if( iClientStatus != NULL )
+ User::RequestComplete( iClientStatus, KErrCancel );
+ #ifdef _DEBUG
+ CMsgConnManager::WriteToLog( _L8( " DoCancel() ends" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+ <package id="legacypresence" name="Legacy Presence Services" levels="engine fw ui">
+ <collection id="xdmengine" name="XDM Engine" level="engine">
+ <component id="xdmsettingsapi" filter="s60" name="XDM Settings Api">
+ <!-- <unit bldFile="xdmengine/xdmsettingsapi/group"/> -->
+ </component>
+ <component id="xdmprovisioning" filter="s60" name="XDM Provisioning">
+ <!-- <unit bldFile="xdmengine/xdmprovisioning/group"/> -->
+ </component>
+ <component id="xdmdevicemanagement" filter="s60" name="XDM Device Management">
+ <!-- <unit bldFile="xdmengine/xdmdevicemanagement/group"/> -->
+ </component>
+ <component id="xdmengine_build" filter="s60" name="XDM Engine Build">
+ <!-- should move the necesary parts into the above components, or collapse them all into one -->
+ <unit bldFile="xdmengine/group"/>
+ </component>
+ </collection>
+ <collection id="xdmsettingsui" name="XDM Settings UI" level="ui">
+ <component id="xdmsettingsui_help" filter="s60" name="XDM Settings UI Help">
+ <unit bldFile="xdmsettingsui/help/group"/>
+ </component>
+ <component id="xdmsettingsui_build" filter="s60" name="XDM Settings UI Build">
+ <unit bldFile="xdmsettingsui/group"/>
+ </component>
+ </collection>
+ <collection id="msgconnmanager" name="Messaging Connection Manager" level="fw">
+ <component id="msgconnmanager_build" filter="s60" name="Messaging Connection Manager Build">
+ <unit bldFile="msgconnmanager/group"/>
+ </component>
+ </collection>
+ <collection id="presencefwsimpleadpt" name="Presence Framework SIMPLE Adaptation" level="fw">
+ <component id="simpleplugin" filter="s60" class="plugin" name="SIMPLE Plugin">
+ <unit bldFile="presencefwsimpleadpt/group"/>
+ </component>
+ </collection>
+ <collection id="presencesettingsui" name="Presence Settings UI" level="ui">
+ <component id="presencesettingsui_help" filter="s60" name="Presence Settings UI Help">
+ <unit bldFile="presencesettingsui/help/group"/>
+ </component>
+ <component id="presencesettingsui_build" filter="s60" name="Presence Settings UI Build">
+ <unit bldFile="presencesettingsui/group"/>
+ </component>
+ </collection>
+ <collection id="simpleengine" name="SIMPLE Engine" level="engine">
+ <component id="presencesettingsapi" filter="s60" name="Presence Settings API">
+ <!-- <unit bldFile="simpleengine/presencesettingsapi/group"/> -->
+ </component>
+ <component id="siputils" filter="s60" name="SIP Utils">
+ <!-- <unit bldFile="simpleengine/siputils/group"/> -->
+ </component>
+ <component id="xmlutils" filter="s60" name="XML Utils">
+ <!-- <unit bldFile="simpleengine/xmlutils/group"/> -->
+ </component>
+ <component id="simpleengine_engine" filter="s60" name="Engine">
+ <!-- <unit bldFile="simpleengine/engine/group"/> -->
+ </component>
+ <component id="xdmrlspres" filter="s60" name="RLS and Presence XDM">
+ <!-- <unit bldFile="simpleengine/xdmrlspres/group"/> -->
+ </component>
+ <component id="presencedm" filter="s60" name="Presence DM Adapter" class="plugin">
+ <!-- <unit bldFile="simpleengine/presencedm/group"/> -->
+ </component>
+ <component id="presenceprovisioning" filter="s60" name="Presence Provisioning" class="plugin">
+ <!-- <unit bldFile="simpleengine/presenceprovisioning/group"/> -->
+ </component>
+ <component id="simpleengine_build" filter="s60" name="SIMPLE Engine Build">
+ <!-- should move the necesary parts into the above components, or collapse them all into one -->
+ <unit bldFile="simpleengine/group"/>
+ </component>
+ </collection>
+ <collection id="xdmprotocols" name="XDM Protocols" level="fw">
+ <component id="xdmxmlparser" filter="s60" name="XDM XML Parser">
+ <!-- <unit bldFile="xdmprotocols/xdmxmlparser/group"/> -->
+ </component>
+ <component id="xcapprotocol" filter="s60" name="Xcap Protocol">
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcapappusage/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcapcache/client/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcapcache/server/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcaphttptransport/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcapoperations/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/xcapprotocol/xcaputils/group"/> -->
+ </component>
+ <component id="localprotocol" filter="s60" name="Local Protocol">
+ <!-- <unit bldFile="xdmprotocols/localprotocol/group"/> -->
+ <!-- <unit bldFile="xdmprotocols/localprotocol/localoperations/group"/> -->
+ </component>
+ <component id="xdmprotocols_build" filter="s60" name="XDM Protocols Build">
+ <!-- should move the necesary parts into the above components, or collapse them all into one -->
+ <unit bldFile="xdmprotocols/group"/>
+ </component>
+ </collection>
+ <collection id="simpledatamodeladapter" name="SIMPLE Data Model Adapter" level="fw">
+ <component id="presenceplugin" filter="s60" class="plugin" name="Presence Plugin" introduced="^2">
+ <unit bldFile="simpledatamodeladapter/group"/>
+ </component>
+ </collection>
+ <collection id="legacypresence_info" name="Legacy Presence Services Info" level="ui">
+ <component id="pressrv_plat" filter="s60" class="api" name="Legacy Presence Services Platform Interfaces">
+ <unit bldFile="pressrv_plat/group"/>
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>
Binary file presencefwsimpleadpt/Conf/presencefwsimpleadpt.confml has changed
Binary file presencefwsimpleadpt/Conf/presencefwsimpleadpt_10282C84.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/cenrep/backup_registration.xml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+ <proxy_data_manager sid = "0x10282C84" />
+ <restore requires_reboot = "no"/>
+</backup_registration>
Binary file presencefwsimpleadpt/cenrep/keys_presencefwsimpleadpt.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for SIP/Simple Protocol Plugin
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// CenRep config files
+../Conf/presencefwsimpleadpt.confml MW_LAYER_CONFML(presencefwsimpleadpt.confml)
+../Conf/presencefwsimpleadpt_10282C84.crml MW_LAYER_CRML(presencefwsimpleadpt_10282c84.crml)
+
+
+// backup registry file
+../cenrep/backup_registration.xml z:/private/10282c84/backup_registration.xml
+
+//ROM SIS stub
+presencefwsimpleadptstub.SIS /epoc32/data/z/system/install/presencefwsimpleadptstub.sis
+
+// IBYs
+../rom/presencefwsimpleadpt.iby CORE_MW_LAYER_IBY_EXPORT_PATH(presencefwsimpleadpt.iby)
+
+PRJ_MMPFILES
+simpleplugin.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/make_StubSis.bat Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: SIMPLE Protocol implementation for Presence Framework
+rem
+
+if exist presencefwsimpleadptstub.sis (del presencefwsimpleadptstub.sis)
+makesis -s presencefwsimpleadptstub.pkg presencefwsimpleadptstub.sis
Binary file presencefwsimpleadpt/group/presencefwsimpleadptstub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/presencefwsimpleadptstub.pkg Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,38 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: SIMPLE Protocol implementation for Presence Framework
+;
+&EN
+
+;Header
+#{"PresenceFwSimpleAdpt"}, (0x10282C84), 1, 0, 0, TYPE=SA
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;Supports Series 60 v 3.0
+;This line indicates that this installation is for the Series 60 platform v3.0
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.0 platforms
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;Files
+""-"z:\sys\bin\simpleplugin.dll"
+
+;resources
+""-"z:\resource\plugins\simpleplugin.rsc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/prfwsimpleplugin.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: resource definitions
+*
+*/
+
+
+
+#ifndef SIMPLEPLUGIN_RESOURCE_HRH
+#define SIMPLEPLUGIN_RESOURCE_HRH
+
+/**
+ * System wide UID 2:s for ECom plugin dlls.
+ */
+#define SIMPLEPLUGIN_DLL_UID_ECOM_PLUGIN 0x10009D8D
+
+/**
+ * SIMPLE protocol dll.
+ */
+#define SIMPLEPLUGIN_DLL_UID_SIMPLE_PROTOCOL 0x10282C84
+
+/**
+ * Resource file compatible defintions for PrFw test protocols.
+ */
+#define SIMPLEPLUGIN_1_IMPLEMENTATION_UID 0x10282C86
+
+#endif // SIMPLEPLUGIN_RESOURCE_HRH
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/simpleplugin.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for SIP/Simple Protocol Plugin
+*
+*/
+
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include "prfwsimpleplugin.hrh"
+
+TARGET simpleplugin.dll
+TARGETTYPE plugin
+UID SIMPLEPLUGIN_DLL_UID_ECOM_PLUGIN SIMPLEPLUGIN_DLL_UID_SIMPLE_PROTOCOL
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+// ECOM RESOURCE
+START RESOURCE simpleplugin.rss
+TARGET simpleplugin.rsc
+END
+
+
+SOURCEPATH ../src
+SOURCE simpleplugin.cpp
+SOURCE simplepluginauthorization.cpp
+SOURCE simplepluginconnection.cpp
+SOURCE simpleplugindata.cpp
+SOURCE simplepluginentitywatcher.cpp
+SOURCE simpleplugingroups.cpp
+SOURCE simplepluginpublisher.cpp
+SOURCE simplepluginsession.cpp
+SOURCE simplepluginvariation.cpp
+SOURCE simplepluginwatcher.cpp
+SOURCE simplepluginwinfo.cpp
+SOURCE simplepluginxdmutils.cpp
+SOURCE simpleplugindebugutils.cpp
+
+USERINCLUDE .
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY euser.lib // Base
+LIBRARY ecom.lib
+LIBRARY bafl.lib
+LIBRARY xmlparser.lib
+LIBRARY xmldom.lib
+LIBRARY charconv.lib
+
+LIBRARY simpleengine.lib
+LIBRARY rlspresxdm.lib
+LIBRARY xdmengine.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY presencesettingsapi.lib
+LIBRARY centralrepository.lib
+
+DEBUGLIBRARY flogger.lib // Sending trace data to log file
+DEBUGLIBRARY efsrv.lib // file server
+DEBUGLIBRARY apparc.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/group/simpleplugin.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM registery info for SIP/Simple Protocol Plugin
+*
+*/
+
+
+
+
+#include <ecom/registryinfov2.rh>
+#include <ximpprotocolpluginifids.hrh>
+#include "prfwsimpleplugin.hrh"
+
+// ---------------------------------------------------------------------------
+// ECOM registery info for Presence Framework ECOM hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ dll_uid = SIMPLEPLUGIN_DLL_UID_SIMPLE_PROTOCOL;
+
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // implemented interface
+ interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE;
+
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = SIMPLEPLUGIN_1_IMPLEMENTATION_UID;
+ version_no = 1;
+ display_name = "SIMPLE Protocol";
+ default_data = "SIMPLE";
+
+ // Protocol capabilities: "<tag1>value<tag2>value..."
+ //
+ // <p>Provider
+ // <f>Feature id
+ // <s>Supported schema
+ //
+ // Example:
+ // "<p>Nokia<f>feat/pres/foo<f>feat/pres/bar<s>sip"
+ //
+ opaque_data = "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip";
+ }
+ };
+ }
+ };
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/msimplepluginconnectionobs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence FW SIMPLE plugin engine connection observer
+*
+*/
+
+
+
+
+#ifndef MSIMPLEPLUGINCONNECTIONOBSERVER_H
+#define MSIMPLEPLUGINCONNECTIONOBSERVER_H
+
+#include <e32std.h>
+
+class TXIMPRequestId;
+class MXIMPObjectFactory;
+class MPresenceObjectFactory;
+class MXIMPProtocolConnectionHost;
+
+class CSimplePluginWinfo;
+class MSimpleWinfo;
+class CSimplePluginXdmUtils;
+
+
+/**
+ * MSimplePluginConnectionObs
+ *
+ * SIMPLE engine connection
+ *
+ * @lib simpleengine
+ * @since s60 v5.0
+ */
+
+class MSimplePluginConnectionObs
+ {
+
+public:
+
+enum TReqType
+ {
+ /** undefined */
+ ENoReq = 0,
+ /** Connection initializing */
+ EOpenSess
+ };
+
+ /**
+ * Coplete the request
+ *
+ * @since S60 3.2
+ * @param aType request type
+ * @param aStatus status
+ */
+ virtual void CompleteReq( TReqType aType, TInt aStatus ) = 0;
+
+ /**
+ * Coplete the request
+ *
+ * @since S60 3.2
+ * @param aReqId PrFw request id
+ * @param aStatus status
+ */
+ virtual void CompleteReq( TXIMPRequestId aReqId, TInt aStatus ) = 0;
+
+ /**
+ * Coplete the SIP watcher info request
+ *
+ * @since S60 3.2
+ * @param aReqId PrFw request id
+ * @param aStatus status
+ */
+ virtual void CompleteWinfoReq( TXIMPRequestId aReqId, TInt aStatus ) = 0;
+
+ /**
+ * PrFw Object Factory accessor
+ * @since S60 3.2
+ * @return PrFw Object Factory
+ */
+ virtual MXIMPObjectFactory& ObjectFactory()=0;
+
+ /**
+ * PrFw Object Factory accessor
+ * @since S60 3.2
+ * @return PrFw Object Factory
+ */
+ virtual MPresenceObjectFactory& PresenceObjectFactory()=0;
+
+ /**
+ * CSimplePluginWinfo accessor
+ * @since S60 3.2
+ * @return CSimplePluginWinfo, ownership is not transferred.
+ */
+ virtual CSimplePluginWinfo* WinfoHandlerL()=0;
+
+ /**
+ * CSimplePluginWinfoObserver is terminated
+ * @since S60 3.2
+ * @param aReason reason code
+ */
+ virtual void WinfoTerminatedL( TInt aReason )=0;
+
+ /**
+ * Watcher info subscription notification is received
+ * @aWinfo notification content
+ */
+ virtual void WinfoNotification( MSimpleWinfo& aWinfo ) = 0;
+
+ /**
+ * Access CSimplePluginXdmUtils
+ * @return CSimplePluginXdmUtils entity
+ */
+ virtual CSimplePluginXdmUtils* XdmUtilsL() = 0;
+
+ /**
+ * Access connection host
+ * @return MXIMPProtocolConnectionHost
+ */
+ virtual MXIMPProtocolConnectionHost* Host() = 0;
+
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/msimplepluginsettings.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence FW SIMPLE plugin engine settings
+*
+*/
+
+
+
+
+#ifndef MSIMPLEPLUGINCONNECTIONSETTINGS_H
+#define MSIMPLEPLUGINCONNECTIONSETTINGS_H
+
+#include <e32std.h>
+
+class CSimplePluginVariation;
+
+/**
+ * MSimplePluginConnectionObs
+ *
+ * SIMPLE engine connection
+ *
+ * @lib simpleengine
+ * @since s60 v5.0
+ */
+
+class MSimplePluginSettings
+ {
+
+public:
+
+ /**
+ * Current registered SIP entity
+ */
+ virtual TPtrC16 CurrentSipPresentity() = 0;
+
+ /**
+ * Current registered SIP entity
+ */
+ virtual TPtrC8 CurrentSipPresentity8() = 0;
+
+ /**
+ * Current domain syntax accessor
+ */
+ virtual TPtrC16 CurrentDomain() = 0;
+
+ /**
+ * Variation
+ */
+ virtual CSimplePluginVariation& Variation() = 0;
+
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/msimpleplugintestobs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence FW SIMPLE plugin test suite
+*
+*/
+
+
+
+
+#ifndef MSIMPLEPLUGINTESTOBS_H
+#define MSIMPLEPLUGINTESTOBS_H
+
+#include <e32std.h>
+
+
+/**
+ * MSimplePluginTestObs
+ *
+ * SIMPLE plugin tester observer for active object testing
+ *
+ * @lib simpleplugin
+ * @since s60 v5.0
+ */
+
+class MSimplePluginTestObs
+ {
+
+public:
+
+ /**
+ * Test callback in the begin of RunL or callback
+ */
+ virtual void TestCallbackInRunL(
+ TInt aStatus, TInt aState, TInt aAuxInt, const TDesC& aAuxStr) = 0;
+
+ /**
+ * Test callback before new asynch request
+ */
+ virtual void TestCallbackAsynchL(
+ TInt aStatus, TInt aState, TInt aAuxInt, const TDesC& aAuxStr) = 0;
+
+
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/msimpleplugtestobs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence FW SIMPLE plugin test suite
+*
+*/
+
+
+
+
+#ifndef MSIMPLEPLUGINTESTOBS_H
+#define MSIMPLEPLUGINTESTOBS_H
+
+#include <e32std.h>
+
+
+/**
+ * MSimplePluginTestObs
+ *
+ * SIMPLE plugin tester observer for active object testing
+ *
+ * @lib simpleplugin
+ * @since S60 v3.2
+ */
+
+class MSimplePluginTestObs
+ {
+
+public:
+
+ /**
+ * Current registered SIP entity
+ */
+ virtual void TestCallback(
+ TInt aStatus, TInt aState, TInt aAuxInt, const TDesC& aAuxStr) = 0;
+
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/presencefwsimpleadptprivatecrkeys.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+#ifndef PRESENCEFWSIMPLEADPTPRIVATECRKEYS_H
+#define PRESENCEFWSIMPLEADPTPRIVATECRKEYS_H
+
+#include <e32std.h>
+
+const TUid KCRUIDPresencefwSimpleadptVariation = {0x10282C84};
+
+// Id for rule to grant all elements
+const TUint32 KPrFwSimpleGrantAllRuleName = 0x00000001;
+// Id for rule to grant own data
+const TUint32 KPrFwSimpleGrantOwnRuleName = 0x00000002;
+// Id for default rule
+const TUint32 KPrFwSimpleDefaultRuleName = 0x00000003;
+// Id for block rule
+const TUint32 KPrFwSimpleBlockRuleName = 0x00000004;
+// Default rule action, allow/confirm/block
+const TUint32 KPrFwSimpleDefaultRuleAction = 0x00000005;
+// Block rule action, block/polit
+const TUint32 KPrFwSimpleBlockRuleAction = 0x00000006;
+// Template for RLS service URI for a user group
+const TUint32 KPrFwSimpleRlsGroupUriTemplate = 0x00000007;
+// Top level for lists in shared XDM index document
+const TUint32 KPrFwSimpleSharedXdmTop = 0x00000008;
+// Name of the Shared XDM list for granted users
+const TUint32 KPrFwSimpleGrantListName = 0x00000009;
+
+#endif // PRESENCEFWSIMPLEADPTPRIVATECRKEYS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugin.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGIN_H
+#define CSIMPLEPLUGIN_H
+
+#include <e32std.h>
+
+#include <ximpbase.h>
+#include <ximpprotocolpluginbase.h>
+
+class MXIMPProtocolConnection;
+class MXIMPServiceInfo;
+class MXIMPClientContextInfo;
+class CSimplePluginConnection;
+
+
+/**
+ * CSimplePlugin
+ *
+ * Implementation of CPrFwProtocolPluginBase
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+class CSimplePlugin: public CXIMPProtocolPluginBase
+ {
+public:
+
+ static CSimplePlugin* NewL();
+ static CSimplePlugin* NewLC();
+
+ virtual ~CSimplePlugin();
+
+private:
+
+ CSimplePlugin();
+ void ConstructL();
+
+
+public:
+
+// from base class MXIMPProtocolPlugin
+
+ /**
+ * Defined in a base class
+ */
+ void PrimeHost( MXIMPProtocolPluginHost& aHost );
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPProtocolConnection& AcquireConnectionL(
+ const MXIMPServiceInfo& aService,
+ const MXIMPContextClientInfo& aContextClient );
+
+ /**
+ * Defined in a base class
+ */
+ void ReleaseConnection(
+ MXIMPProtocolConnection& aConnection );
+
+// from base class MXIMPBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+private: // Data
+
+ /*
+ * Prime host
+ * Not own.
+ */
+ MXIMPProtocolPluginHost* iHost;
+
+ /**
+ * Simple plugin connections
+ */
+ RPointerArray< CSimplePluginConnection > iConnections;
+
+ };
+
+#endif // CSIMPLEPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginauthorization.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINAUTHORIZATION_H
+#define CSIMPLEPLUGINAUTHORIZATION_H
+
+#include <e32std.h>
+
+#include <ximpbase.h>
+#include <protocolpresenceauthorization.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+class MProtocolPresenceAuthorizationDataHost;
+
+class MSimpleWinfo;
+class CPresenceXDM;
+class CRLSXDM;
+class CXdmEngine;
+class CXdmDocument;
+
+
+/**
+ * CSimplePluginAuthorization
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginAuthorization ) : public CActive,
+ public MProtocolPresenceAuthorization
+ {
+public:
+
+
+ /**
+ * Current operation
+ */
+ enum TPluginAuthOperation
+ {
+ ENoOperation,
+ // XDM operations
+ EGrantPresenceForPresentity,
+ EGrantPresenceForPresentityGroupMembers,
+ EWithdrawFromPresentity,
+ EWithdrawFromGroupMembers,
+ EGrantForEveryone,
+ EWithdrawFromEveryone,
+ ESubscribeBlockList,
+ EUnsubscribeBlockList,
+ EBlockPresentity,
+ EUnblockPresentity,
+ // SIP and XDM operations
+ ESubscribePresenceGrantRequestList,
+ EUnsubscribePresenceGrantRequestList
+ };
+
+ /**
+ * Current default rule
+ */
+ enum TPluginAuthDefRule
+ {
+ ERuleDef,
+ ERuleConfirm,
+ ERuleAllow
+ };
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ */
+ static CSimplePluginAuthorization* NewL(
+ MSimplePluginConnectionObs& aObs );
+
+ virtual ~CSimplePluginAuthorization();
+
+ /**
+ * SetDataHost
+ *
+ * Set Data Host
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+ void SetDataHost( MProtocolPresenceAuthorizationDataHost& aDataHost );
+
+ /**
+ * WinfoTerminatedL
+ *
+ * SIMPLE Winfo watcher subscription is terminated
+ * @param aReason reason code
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * WINFO received from SIMPLE
+ * @param aWinfo WINFO
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * This is to ensure that WINFO watchers responses are detected.
+ * @param aPrFwId framework request id to be completed
+ * @param sStatus error code
+ */
+ TBool HandleIfMine( TXIMPRequestId aPrFwId, TInt aStatus );
+
+
+private:
+
+ CSimplePluginAuthorization(
+ MSimplePluginConnectionObs& aObs );
+
+ void ConstructL( );
+
+
+// from base class MXIMPBase
+public:
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+// from base class MProtocolPresenceAuthorization
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId );
+
+// Granting presence information access to single presentities
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+// Granting presence information access to presentity group members
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+// Granting presence information access to everyone
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForEveryoneL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForEveryoneL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromEveryoneL(
+ TXIMPRequestId aReqId );
+
+// Subscribe presence block list
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceBlockListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceBlockListL(
+ TXIMPRequestId aReqId );
+
+// Blocking presence information access from single presentities
+
+ /**
+ * Defined in a base class
+ */
+ void DoBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+
+
+protected:
+
+// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Save presentity id
+ * @param aPresentityId presentity id
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId );
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ * @param aStatus error status
+ */
+ void CompletePrFwReq( TInt aStatus );
+
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation );
+
+ /**
+ * Start XDM operation. StartXdmOperationL calls this.
+ */
+ void DoStartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation );
+
+ /**
+ * Start XDM operation. HandleIfMine calls this.
+ */
+ void DoStartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation );
+
+ /**
+ * Call CSimpleXdmUtils operation
+ */
+ void CallActualXdmOperationL();
+
+ /**
+ * Copy data from aBlockers to aBlockedSouls
+ * @param aBlockers user ids
+ * @param aBlockedSouls user PrFwIdentities
+ *
+ */
+ void CopyBlockersToArrayL(
+ CPtrCArray& aBlockers, RPointerArray<MXIMPIdentity>& aBlockedSouls );
+
+ /**
+ * Handle full Winfo notification
+ * @param aWinfo WINFO
+ */
+ void HandleFullWinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * Handle partial Winfo notification
+ * @param aWinfo WINFO
+ */
+ void HandlePartialWinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * Call HandlePresenceGrantRequestReceivedL
+ * @param aUserId user id
+ */
+ void CallHandlePresenceGrantRequestReceivedL( const TDesC& aUserId );
+
+ /**
+ * Call HandlePresenceGrantRequestObsoletedL(
+ * @param aUserId user id
+ */
+ void CallHandlePresenceGrantRequestObsoletedL( const TDesC& aUserId );
+
+ /**
+ * Handle block list subscription routines
+ */
+ void HandleSubscribeBlockListL();
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * PrFw Plugin Authorization Data Host
+ * Not own.
+ */
+ MProtocolPresenceAuthorizationDataHost* iDataHost;
+
+ /**
+ * XDM Settings id
+ */
+ TInt iSettingsId;
+
+ /**
+ * PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * PrFW request id for own requests
+ */
+ TXIMPRequestId iPrFwIdOwn;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * Current operation
+ */
+ TPluginAuthOperation iOperation;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * Whether XDM utility is initialized
+ */
+ TBool iXdmOk;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CSimplePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Current default rule
+ */
+ TPluginAuthDefRule iDefRule;
+
+ /**
+ * Active WINFO subscription
+ */
+ TBool iWinfoSubs;
+
+
+ };
+
+#endif // CSimplePluginAuthorization_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugincommon.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: C++ compatible definitions for PrFw SIMPLE protocol
+*
+*/
+
+
+
+#ifndef SIMPLEPLUGINCOMMON_H
+#define SIMPLEPLUGINCOMMON_H
+
+#include <e32std.h>
+#include <e32err.h>
+
+
+/**
+ * common definitions for SIMPLE Plugin
+ */
+
+// Simple Plugin specifications
+
+/** Nothing subscribed */
+const TUint KSimplePluginSubsNone = 0x00000000;
+/** Grant list subscribed */
+const TUint KSimplePluginSubsGrant = 0x00000001;
+
+/** max length of auth rule id in auth rules document */
+const TUint KSimplePluginMaxRuleLength = 100;
+
+/** the last general error code in e32err.h */
+const TInt KSimplePluginGeneralErrorLow = KErrCommsBreak;
+
+// OMA specifications
+
+/** OMA buddy list id */
+_LIT( KSimpleOMABuddyList, "oma_buddylist");
+/** OMA blocked list id */
+_LIT( KSimpleOMABlockedList, "oma_blockedcontacts");
+
+
+namespace NSimplePlugin
+ {
+ namespace NSimpleRls
+ {
+ _LIT( KOne, "http://"); // 7
+ _LIT( KThree, "/resource-lists/users/"); // 22
+ _LIT( KFive, "/index/~~/resource-lists/list%5b@name=%22"); // 41
+ _LIT( KSeven, "%22%5d"); // 6
+ const TInt totalSize = 76;
+ }
+ namespace NSimpleRlsBuddy
+ {
+ _LIT( KOne, "http://"); // 7
+ _LIT( KThree, "/resource-lists/users/"); // 22
+ _LIT( KFive, "/index/~~/resource-lists/list%5b@name=%22oma_buddylist%22%5d/list%5b@name=%22"); // 77
+ _LIT( KSeven, "%22%5d"); // 6
+ const TInt totalSize = 112;
+ }
+ namespace NSimpleOma
+ {
+ _LIT( KSimpleIndex, "index");
+ _LIT( KSimpleResourceLists, "resource-lists");
+ _LIT( KSimpleList, "list");
+ _LIT( KSimpleName, "name");
+ _LIT( KSimpleDisplayName, "display-name");
+ _LIT( KSimpleEntry, "entry");
+ _LIT( KSimpleExternal, "external");
+ _LIT( KSimpleAnchor, "anchor");
+ _LIT( KSimplePerson, "person");
+ _LIT( KSimpleBlock, "block");
+ _LIT( KSimplePoliteBlock, "polite-block");
+ _LIT( KSimpleConfirm, "confirm");
+ _LIT( KSimpleAllow, "allow");
+ _LIT( KSimpleOpen, "open");
+ _LIT( KSimpleClosed, "closed");
+ _LIT( KSimpleUri, "uri");
+ _LIT8( KSimplePerson8, "person");
+ _LIT8( KSimpleWatcher8, "watcher");
+ _LIT8( KSimpleWatherInfo8, "watcherinfo");
+ _LIT8( KSimpleWatcherList8, "watcher-list");
+ _LIT8( KSimpleStatus8, "status");
+ _LIT8( KSimpleActive8, "active");
+ _LIT8( KSimpleEvent8, "event");
+ _LIT8( KSimplePending8, "pending");
+ _LIT8( KSimpleOverridingwillingness8, "overriding-willingness");
+ _LIT8( KSimpleBasic8, "basic");
+ _LIT8( KSimpleStatusicon8, "status-icon");
+ _LIT8( KSimpleNote8, "note");
+ _LIT8( KSimpleSubscribe8, "subscribe");
+ _LIT8( KSimpleList8, "list");
+ _LIT8( KSimpleResource8, "resource");
+ _LIT8( KSimpleInstance8, "instance");
+ _LIT8( KSimpleState8, "state");
+ _LIT8( KSimpleTerminated8, "terminated");
+ _LIT8( KSimpleUri8, "uri");
+ _LIT8( KSimpleFull8, "full");
+ _LIT8( KSimpleFullState8, "fullState");
+ _LIT8( KSimpleTrue8, "true");
+ _LIT8( KSimpleId8, "id");
+ _LIT8( KSimpleTimestamp8, "timestamp");
+ }
+ }
+
+
+// S60 specifications
+
+/** Presence XDM block rule id */
+_LIT( KSimpleXdmBlockRule, "blockall");
+/** Presence XDM grant rule id */
+_LIT( KSimpleXdmGrantRule, "allowall");
+/** Presence XDM grant rule id for own sbscribe*/
+_LIT( KSimpleXdmOwnGrantRule, "grantown");
+/** Presence XDM default rule id */
+_LIT( KSimpleXdmDefaultRule, "default");
+
+/** S60 Shared XDM list for granted entities */
+_LIT( KSimpleS60GrantedList, "oma_grantlist");
+
+/** S60 default RLS URI template */
+_LIT( KSimpleRlsGroupUriTemplate, "<GROUP_ID>_<USER_ID>@<DOMAIN>");
+_LIT16( KSimpleGroupTag, "<GROUP_ID>");
+_LIT16( KSimpleUserTag, "<USER_ID>");
+_LIT16( KSimpleDomainTag, "<DOMAIN>");
+
+/**
+ example:
+
+ <rls-services ...
+ <service uri="sip:my_friends_MY-IDENTITY@EXAMPLE.COM">
+ <resource-list>http://EXAMPLE.COM/resource-lists/users/
+ sip:USER@EXAMPLE.COM/index/~~/resource-lists/list%5b@name=%22oma_buddylist%22%5d/list%5b@name=%22my_friends%22%5d
+ </resource-list>
+ <packages>
+ <package>presence</package>
+ </packages>
+ </service>
+ <service uri="sip:my_colleques_MY-IDENTITY@EXAMPLE@EXAMPLE.COM">
+ <resource-list>http://EXAMPLE.COM/resource-lists/users/
+ sip:USER@EXAMPLE.COM/index/~~/resource-lists/list%5b@name=%22oma_buddylist%22%5d/list%5b@name=%22my_colleques%22%5d
+ </resource-list>
+ <packages>
+ <package>presence</package>
+ </packages>
+ </service>
+ </rls-services
+
+ */
+
+namespace NSimpleDocument
+ {
+ _LIT8( KSimpleAvatarContent8, "simpleavatar.s60.com" ); // notice: static now, supports only one
+ _LIT8( KSimpleAvatarCIDURI8, "cid:simpleavatar.s60.com" ); // notice: static now, supports only one
+ }
+
+
+#endif // SIMPLEPLUGINDEF_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginconnection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSimplePluginConnection implementation.
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINCONNECTION_H
+#define CSIMPLEPLUGINCONNECTION_H
+
+
+#include <ximpprotocolconnection.h>
+#include <protocolpresencefeatures.h>
+#include "msimplepluginconnectionobs.h"
+#include "msimplepluginsettings.h"
+
+class MXIMPObjectFactory;
+class MXIMPServiceInfo;
+class CSimplePluginAuthorization;
+class CSimplePluginSession;
+class CSimplePluginPublisher;
+class CSimplePluginWatcher;
+class CSimplePluginGroups;
+class CSimplePluginVariation;
+
+/**
+ * CSimplePluginConnection
+ *
+ * Implementation of MXIMPProtocolConnection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS(CSimplePluginConnection) : public CBase,
+ public MXIMPProtocolConnection,
+ public MProtocolPresenceFeatures,
+ public MSimplePluginConnectionObs,
+ public MSimplePluginSettings
+ {
+
+public:
+
+ static CSimplePluginConnection* NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo );
+
+ ~CSimplePluginConnection();
+
+private:
+
+ CSimplePluginConnection();
+
+
+ void ConstructL( const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo );
+
+public:
+
+ /**
+ * Convert error code into PrFW errors
+ * @param aStatus error code [IN]
+ * @return harmonized error code
+ */
+ static TInt HarmonizeErrorCode( TInt aStatus );
+
+// from base class MXIMPBase
+public:
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+// from base class MXIMPProtocolConnection
+public:
+
+ /**
+ * Defined in a base class
+ */
+ void PrimeHost( MXIMPProtocolConnectionHost& aHost );
+
+ /**
+ * Defined in a base class
+ */
+ void OpenSessionL(
+ const MXIMPContextClientInfo& aContextClient,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void OpenSessionL(
+ const TInt& aSettingsId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void CloseSession(
+ const MXIMPContextClientInfo& aContextClient,
+ TXIMPRequestId aOpId );
+
+ /**
+ * Defined in a base class
+ */
+ void GetSupportedFeaturesL( CDesC8Array& aFeatures ) const;
+
+ /**
+ * Defined in a base class
+ */
+ MProtocolPresenceFeatures& ProtocolPresenceFeatures();
+
+/*<branchInfo originator="gronoff" since="08-06-06" category="new_feature" error=”none”>
+<pf_5250_OFF_CYCLE_SW_INT>
+</branchInfo>*/
+// BRANCH 08-06-06 : gronoff
+ TAny* GetProtocolInterface( TInt aInterfaceId );
+// BRANCH_END 08-06-06 : gronoff
+
+
+// from base class MProtocolPresenceFeatures
+
+ MProtocolPresenceWatching& PresenceWatching();
+
+
+ MProtocolPresencePublishing& PresencePublishing();
+
+
+ MProtocolPresentityGroups& PresentityGroups();
+
+
+ MProtocolPresenceAuthorization& PresenceAuthorization();
+
+
+
+// from base class MSimplePluginConnectionObs
+
+ /**
+ * Defined in a base class
+ */
+ void CompleteReq( TReqType aType, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void CompleteReq( TXIMPRequestId aReqId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void CompleteWinfoReq( TXIMPRequestId aReqId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPObjectFactory& ObjectFactory();
+
+ /**
+ * Defined in a base class
+ */
+ MPresenceObjectFactory& PresenceObjectFactory();
+
+ /**
+ * Defined in a base class
+ */
+ CSimplePluginWinfo* WinfoHandlerL();
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoNotification( MSimpleWinfo& aWinfo );
+
+ /**
+ * Defined in a base class
+ */
+ CSimplePluginXdmUtils* XdmUtilsL();
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPProtocolConnectionHost* Host();
+
+
+// from base class MSimplePluginSettings
+
+ /**
+ * Defined in a base class
+ */
+ TPtrC16 CurrentSipPresentity();
+
+ /**
+ * Defined in a base class
+ */
+ TPtrC8 CurrentSipPresentity8();
+
+ /**
+ * Defined in a base class
+ */
+ TPtrC16 CurrentDomain();
+
+ /**
+ * Variation
+ */
+ CSimplePluginVariation& Variation();
+
+private:
+
+
+
+private: // data members
+
+ /**
+ * Host for connection.
+ * Not own.
+ */
+ MXIMPProtocolConnectionHost* iConnectionHost;
+
+ /**
+ * Simple Engine session
+ * Own.
+ */
+ CSimplePluginSession* iSession;
+
+ /**
+ * current request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * MProtocolPresenceAuthorization implementation.
+ * Own.
+ */
+ CSimplePluginAuthorization* iAuth;
+
+ /**
+ * CSimplePluginWinfo
+ * Own.
+ */
+ CSimplePluginWinfo* iPluginWinfo;
+
+ /**
+ * CSimplePluginPublisher
+ * Own.
+ */
+ CSimplePluginPublisher* iPublisher;
+
+ /**
+ * CSimplePluginWatcher
+ * Own.
+ */
+ CSimplePluginWatcher* iWatcher;
+
+ /**
+ * CSimplePluginGroups
+ * Own.
+ */
+ CSimplePluginGroups* iGroups;
+
+ /**
+ * Current user SIP identity
+ * Own.
+ */
+ HBufC16* iSipPresentity;
+
+ /**
+ * XDM utils
+ * Own.
+ */
+ CSimplePluginXdmUtils* iXdmUtils;
+
+
+ /**
+ * Run time variation
+ * Own
+ */
+ CSimplePluginVariation* iVariation;
+
+ };
+
+
+#endif // CSIMPLEPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugindata.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef C_SIMPLEPLUGINDATA_H
+#define C_SIMPLEPLUGINDATA_H
+
+
+// Includes
+#include <e32std.h>
+
+class MXIMPObjectFactory;
+class MXIMPIdentity;
+
+class MPresenceObjectFactory;
+class MSimpleDocument;
+class MPresenceInfo;
+class MSimplePresenceList;
+class MPresenceInfoFieldCollection;
+class MPersonPresenceInfo;
+class MPresenceInfoFieldValueEnum;
+class MSimpleElement;
+class MPresenceInfoFieldValueText;
+
+
+/**
+ * CSimplePluginData
+ *
+ * This provides data conversion between SIMPLE Engine and PrFw data strcutres.
+ *
+ * @lib simplexmlutils
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS(CSimplePluginData) : public CBase
+ {
+public:
+
+ static CSimplePluginData* NewL( );
+
+ static CSimplePluginData* NewLC();
+
+ virtual ~CSimplePluginData();
+
+ /**
+ * Convert to engine notification to MPresenceInfo
+ * @param aPresenceFactory PrFw Presence Factory
+ * @param aDocument notification
+ * @param aPrInfo PrFW info structure [out]
+ */
+ static void NotifyToPrInfoL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleDocument& aDocument,
+ MPresenceInfo& aPrInfo );
+
+ /**
+ * Convert to engine list notification to MPresenceInfo elements
+ * @param aFactory PrFw Factory
+ * @param aPresenceFactory PrFw Presence Factory
+ * @param aList notification
+ * @param aEntities array of PrFW info structure [out]
+ * @param aTerminated array of PrFW info structure for terminated entities [out]
+ * @param aFullList ETrue if full state list [out]
+ */
+ static void NotifyListToPrInfoL(
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimplePresenceList& aList,
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ TBool& aFullList );
+
+ /**
+ * Converts MPersonPresenceInfo to MSimpleDocument elements
+ * @param aInfo Person's presence info [in]
+ * @param aDocument PIDF document containing Person's presence info [out]
+ * @param aSipId Person's SIP indetity
+ */
+ static void AddPrPersToSimpleDocumentL(
+ const MPersonPresenceInfo* aInfo,
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId );
+
+
+private:
+
+ CSimplePluginData();
+
+ void ConstructL( );
+
+ static void UserOverridingWillingnessToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection );
+
+ static void UserStatusIconToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection,
+ MSimpleDocument& aDocument );
+
+ static void UserNoteToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection );
+
+ static void CollectAllPresentitiesL(
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MSimpleDocument>& aDocs,
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory );
+
+ /**
+ * Add terminated instances into array
+ * @param aTerminated list of PrFw indetities [OUT]
+ * @param aElems RLS meta data list entry elements
+ * @param aFactory PrFw Factory
+ */
+ static void CollectTerminatedPresentitiesL(
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ RPointerArray<MSimpleElement>& aElems,
+ MXIMPObjectFactory& aFactory );
+
+ /**
+ * Search the latest timestamp in the elements
+ * @param aElems element array
+ * @retun position of the latest element in the element array. KErrNotFound if not found.
+ */
+ static TInt SearchLatestTimestampL(
+ RPointerArray<MSimpleElement>& aElems );
+
+ /**
+ * Add availability info into SIMPLE document
+ * @param aText new value [IN]
+ * @param aPersElem personal data to be modified [OUT]
+ */
+ static void AddPrPersAvailabilityToDocL(
+ const MPresenceInfoFieldValueText* aText,
+ MSimpleElement* aPersElem );
+
+ /**
+ * Check if the current element is terminated instance.
+ * If yes then add the aUri into aTerminated
+ * @param aTerminated list of PrFw indetities [OUT]
+ * @param aElem current element
+ * @param aUri8 corresponding sip entity URI
+ * @param aFactory PrFw Factory
+ */
+ static void SearchTerminatedInstanceL(
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ MSimpleElement* aElem,
+ const TDesC8* aUri8,
+ MXIMPObjectFactory& aFactory );
+
+
+
+};
+
+
+
+#endif // C_SIMPLEPLUGINDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugindebugutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DEBUG utilities, for DEBUG version only
+*
+*/
+
+
+
+
+#ifndef SIMPLEPLUGINDEBUGUTILS_H
+#define SIMPLEPLUGINDEBUGUTILS_H
+
+#ifdef _DEBUG
+
+#include <e32std.h>
+#include <s32file.h>
+
+// FORWARD DECLARATION
+class RFs;
+class RFileReadStream;
+
+
+//**********************************
+// PluginLogger
+//**********************************
+NONSHARABLE_CLASS( PluginLogger )
+ {
+public:
+ static void Log(TRefByValue<const TDesC> aFmt,...);
+ };
+
+#endif // _DEBUG
+
+#endif // simpledebugutils_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugindef.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: C++ compatible definitions for PrFw SIMPLE protocol
+*
+*/
+
+
+
+#ifndef SIMPLEPLUGINDEF_H
+#define SIMPLEPLUGINDEF_H
+
+#include <e32std.h>
+#include "prfwsimpleplugin.hrh"
+
+
+/**
+ * C++ compatible definitions for PrFw SIMPLE protocol.
+ *
+ * This must be kept in-sync with definitions in
+ * "simpleplugin_resource.hrh"
+ */
+
+//PrFw primary test protocol
+const TInt K_SIMPLEPLUGIN_1_IMPLEMENTATION_UID = SIMPLEPLUGIN_1_IMPLEMENTATION_UID;
+const TInt K_SIMPLEPLUGIN_1_VERSION_NO = 1;
+_LIT( K_SIMPLEPLUGIN_1_DISPLAY_NAME, "PrFw SIMPLE protocol" );
+_LIT( K_SIMPLEPLUGIN_1_DEFAULT_DATA, "SIMPLE" );
+_LIT( K_SIMPLEPLUGIN_1_OPAQUE_DATA , " " );
+
+#endif // SIMPLEPLUGINDEF_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginentitywatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINENTITYWATCHER_H
+#define CSIMPLEPLUGINENTITYWATCHER_H
+
+#include <e32std.h>
+
+#include <protocolpresencewatching.h>
+
+#include <msimplewatcherobserver.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPProtocolConnectionHost;
+class MPersonPresenceInfo;
+
+class MSimpleDocument;
+class MSimpleWatcher;
+
+class CSimplePluginWatcher;
+
+/**
+ * CSimplePluginEntityWatcher
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginEntityWatcher ): public CBase,
+ public MSimpleWatcherObserver
+ {
+
+private:
+ /**
+ * Current operation
+ */
+ enum TPluginEntityWatcherOperation
+ {
+ EPluginIdle,
+ EPluginStop,
+ EPluginStart
+ };
+
+public:
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ * @param aHost PrFw connection host
+ */
+ static CSimplePluginEntityWatcher* NewL(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CSimplePluginWatcher& aWatcher );
+
+ virtual ~CSimplePluginEntityWatcher();
+
+
+ /**
+ * Access Request id
+ * @return PrFw request id
+ */
+ TXIMPRequestId PrFwRequestId();
+
+ /**
+ * Access Presentity id
+ * @return Presentity id
+ */
+ TPtrC8 PresentityId();
+
+ /**
+ * Start subscribe
+ * @param aPresentityId presentity id
+ */
+ void StartSubscribeL(
+ const TDesC8& aPresentityId );
+
+ /**
+ * Start subscribe
+ * @param aPresentityId presentity id
+ */
+ void StartSubscribeListL(
+ const TDesC8& aPresentityId );
+
+ /**
+ * Set simple name
+ * @param aPresentityId presentity id
+ */
+ void SetSimpleNameL(
+ const TDesC8& aPresentityId );
+
+ void StopSubscribeL( );
+
+private:
+
+ CSimplePluginEntityWatcher(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CSimplePluginWatcher& aWatcher );
+
+ void ConstructL( );
+
+public:
+
+// from base class MSimpleWatcherObserver
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherReqCompleteL( TInt aOpId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherNotificationL( MSimpleDocument& aDocument );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherListNotificationL( MSimplePresenceList& aList );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherTerminatedL(
+ TInt aOpId, TInt aReason );
+
+private:
+
+ /**
+ * Calls caller active object
+ * @param aStatus error status
+ */
+ void CompleteClientReq( TInt aStatus );
+
+
+
+private: // Data
+
+ /**
+ * host class
+ */
+ CSimplePluginWatcher& iPluginWatcher;
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine watcher
+ * Own.
+ */
+ MSimpleWatcher* iWatcher;
+
+ /**
+ * PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ /**
+ * Subscribed entity id
+ * Own.
+ */
+ HBufC8* iEntityId;
+
+ /**
+ * Subscribed entity id, pure group name
+ * Own.
+ */
+ HBufC8* iSimpleEntityId;
+
+ /**
+ * current pending operation
+ */
+ TPluginEntityWatcherOperation iOperation;
+
+ /**
+ * Whether subscription of list is pending
+ */
+ TBool iListSubsActive;
+
+ };
+
+#endif // CSimplePluginEntityWatcher_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simpleplugingroups.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,441 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINGROUPS_H
+#define CSIMPLEPLUGINGROUPS_H
+
+#include <e32std.h>
+
+#include <ximpbase.h>
+#include <protocolpresentitygroups.h>
+
+#include <mrlspresxdmasynchandler.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+class MProtocolPresentityGroupsDataHost;
+class MXIMPObjectCollection;
+
+class MSimpleWinfo;
+class CPresenceXDM;
+class CRLSXDM;
+class CXdmEngine;
+class CXdmDocument;
+
+
+/**
+ * CSimplePluginGroups
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginGroups ) : public CActive,
+ public MProtocolPresentityGroups
+ {
+private:
+
+
+ /**
+ * Current operation
+ */
+ enum TPluginGroupsOperation
+ {
+ ENoOperation,
+ ECreatePresentityGroup,
+ EDeletePresentityGroup,
+ EAddPresentityGroupMember,
+ ERemovePresentityGroupMember,
+ EGetListOfLists,
+ EGetListContent
+ };
+
+ /**
+ * Current actibe object state
+ */
+ enum TPluginGroupsState
+ {
+ EPluginIdle,
+ EPluginInitXdm,
+ EPluginFetchRls,
+ EPluginAddGroupMember,
+ EPluginRemoveGroupMember,
+ EPluginCommitRls,
+ EPluginCommitXdm,
+ ERemoveGroupFromGranted
+ };
+
+public:
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ */
+ static CSimplePluginGroups* NewL(
+ MSimplePluginConnectionObs& aObs );
+
+ virtual ~CSimplePluginGroups();
+
+
+
+private:
+
+ CSimplePluginGroups(
+ MSimplePluginConnectionObs& aObs );
+
+ void ConstructL( );
+
+
+// from base class MXIMPBase
+public:
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+// from base class MProtocolPresentityGroups
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCreatePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoDeletePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupDisplayNameL(
+ const MXIMPIdentity& aGroupId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoAddPresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aMemberDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoRemovePresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupMemberDisplayNameL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aMemberDisplayName,
+ TXIMPRequestId aReqId );
+
+protected:
+
+// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Save presentity id
+ * @param aPresentityId presentity id
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId );
+
+ /**
+ * Save presentity id
+ * @param aPresentityId presentity id
+ */
+ void SetPresIdentity2L(
+ const MXIMPIdentity& aPresentityId );
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ * @param aStatus error status
+ */
+ void CompletePrFwReq( TInt aStatus );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ */
+ void StartXdmOperationL();
+
+ /**
+ * Start XDM operation, StartXdmOperationL calls this.
+ */
+ void DoStartXdmOperationL( );
+
+ /**
+ * Call CSimpleXdmUtils operation
+ */
+ void CallActualXdmOperationL();
+
+ /**
+ * Get list of the entity lists
+ */
+ void GetListOfListsL();
+
+ /**
+ * Get content of the entity list
+ */
+ void GetListContentL();
+
+ /**
+ * Yields to active scheduler and runs next RunL loop
+ * @param aStatus error status
+ */
+ void CompleteMe( TInt aStatus );
+
+ /**
+ * Copy data from aLists and from aNames into aCollection
+ * @param aNames group names [IN]
+ * @param aNames group display names [IN]
+ * @param aCollection collection of MPresentityGroupInfo [OUT]
+ */
+ void CopyGroupArraysToCollectionL(
+ CDesCArrayFlat& aLists, CDesCArrayFlat& aNames, MXIMPObjectCollection& aCollection );
+
+ /**
+ * Copy data from aIds and from aNames into aCollection
+ * @param aNames group member names [IN]
+ * @param aNames group member display names [IN]
+ * @param aCollection collection of MPresentityGroupMemberInfo [OUT]
+ */
+ void CopyGroupMembersToCollectionL(
+ CPtrCArray& aIds, CPtrCArray& aNames, MXIMPObjectCollection& aCollection);
+
+
+ /**
+ * Add presentity group
+ * @param aGroupId group id
+ * @param adispName display name
+ */
+ void HandleCreatePresentityGroupL(
+ const TDesC& aGroupId, const TDesC& aDispName );
+
+ /**
+ * Delete presentity group
+ * @param aGroupId group id
+ */
+ void HandleDeletePresentityGroupL( const TDesC& aGroupId );
+
+ /**
+ * Add presentity group member
+ */
+ void HandleAddPresentityGroupMemberL();
+
+ /**
+ * Remove group member
+ */
+ void HandleRemovePresentityGroupMemberL();
+
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * XDM Settings id
+ */
+ TInt iSettingsId;
+
+ /**
+ * PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * PrFW request id for own requests
+ */
+ TXIMPRequestId iPrFwIdOwn;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed items. Bitmask.
+ */
+ TUint iSubscribed;
+
+ /**
+ * Current operation
+ */
+ TPluginGroupsOperation iOperation;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity2;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CSimplePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Display name
+ * Own
+ */
+ HBufC* iDisplayName;
+
+ /**
+ * Active object state
+ */
+ TPluginGroupsState iState;
+
+ TBool iCompleted;
+
+ };
+
+#endif // CSimplePluginGroups_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginpublisher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINPUBLISHER_H
+#define CSIMPLEPLUGINPUBLISHER_H
+
+#include <e32std.h>
+
+#include <ximpbase.h>
+#include <protocolpresencepublishing.h>
+
+#include <msimplepublishobserver.h>
+#include <msimplewatcherobserver.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+#include "msimplepluginsettings.h"
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPProtocolConnectionHost;
+
+class MPersonPresenceInfo;
+class MServicePresenceInfo;
+class MDevicePresenceInfo;
+
+class MSimplePublisher;
+class MSimpleDocument;
+class MSimpleWinfo;
+class MSimpleWatcher;
+class MSimpleElement;
+
+
+/**
+ * CSimplePluginWatcherInfo
+ *
+ * watcher info.
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginWatcherInfo ): public CBase
+ {
+public:
+
+ /**
+ * Constructor.
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ */
+ static CSimplePluginWatcherInfo* NewL(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+ virtual ~CSimplePluginWatcherInfo();
+
+ /**
+ * Destructor
+ */
+ void Destroy();
+
+ /**
+ * Match to given info
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ * @return ETrue if current entity matches to the parameters
+ */
+ TBool Match( const TDesC8& aId,
+ const TDesC& aSipId );
+
+ TPtrC SipId();
+
+ inline static TInt LinkOffset();
+
+private:
+
+ CSimplePluginWatcherInfo( );
+
+ /**
+ * Constructor
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ */
+ void ConstructL(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+public: // data
+
+ TDblQueLink iLink;
+
+private: // data
+
+ HBufC8* iId;
+ HBufC* iSipId;
+
+ };
+
+/**
+ * CSimplePluginPublisher
+ *
+ * publisher.
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginPublisher ): public CActive,
+ public MSimplePublishObserver,
+ public MSimpleWatcherObserver,
+ public MProtocolPresencePublishing
+ {
+public:
+
+ /**
+ * Current operation
+ */
+ enum TPluginPublishOperation
+ {
+ ENoOperation,
+ EPublishOwn,
+ ESubscribeOwn,
+ EUnsubscribeOwn,
+ ESubscribeWinfo,
+ EUnsubscribeWinfo
+ };
+
+ /**
+ * Constructor.
+ * @param aConnSetts current settings
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CSimplePluginPublisher* NewL(
+ MSimplePluginSettings& aConnSetts,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ virtual ~CSimplePluginPublisher();
+
+ /**
+ * WinfoTerminatedL
+ *
+ * SIMPLE Winfo watcher sunscription is terminated
+ * @param aReason reason code
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * WINFO received from SIMPLE
+ * @param aWinfo WINFO
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+private:
+
+ CSimplePluginPublisher(
+ MSimplePluginSettings& aConnSetts,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ void ConstructL( );
+
+
+public:
+
+// from base class MSimplePublishObserver
+
+ /**
+ * Defined in a base class
+ */
+ void PublishReqCompleteL( TInt aOpid, TInt aStatus);
+
+ /**
+ * Defined in a base class
+ */
+ void PublishTerminatedL( TInt aOpid );
+
+// from base class MSimpleWatcherObserver
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherReqCompleteL( TInt aOpId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherNotificationL( MSimpleDocument& aDocument );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherListNotificationL( MSimplePresenceList& aList );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherTerminatedL(
+ TInt aOpId, TInt aReason );
+
+
+// from base class MXIMPBase
+public:
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+// from base class MProtocolPresencePublishing
+public:
+
+ /**
+ * Defined in a base class
+ */
+ void DoPublishOwnPresenceL(
+ const MPresenceInfo& aOwnPresence,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribeOwnPresenceL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdateOwnPresenceSubscriptionPifL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribeOwnPresenceL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId );
+
+
+protected:
+
+// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+private:
+
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ * @param aStatus error status
+ */
+ void CompletePrFwReq( TInt aStatus );
+
+ /**
+ * Initialize a document
+ */
+ void InitializeSimpleDocumentL( );
+
+ /**
+ * Add person information to the document.
+ * @param aPersInfo personal information
+ */
+ void AddSimpleDocumentPersL(
+ const MPersonPresenceInfo* aInfo );
+
+ void AddSimpleDocumentServiceL(
+ const MServicePresenceInfo& aInfo );
+
+ void AddSimpleDocumentDeviceL(
+ const MDevicePresenceInfo& aInfo );
+
+ /**
+ * Make a publish request
+ */
+ void MakePublishReqL();
+
+ /**
+ * Start XDM initialization
+ */
+ void StartXdmOperationL( TXIMPRequestId aReqId );
+
+ /**
+ * Start XDM initialization. StartXdmOperationL calls this.
+ */
+ void DoStartXdmOperationL( TXIMPRequestId aReqId );
+
+ /**
+ * Delete watcher information
+ */
+ void DeleteWatchers();
+
+ void AddWatcherIfNotExistsL( const TDesC8& aId, const TDesC& aSipId );
+
+ void RemoveWatcherIfExistsL( const TDesC8& aId, const TDesC& aSipId );
+
+ CDesCArrayFlat* MakeCurrentWatcherListLC();
+
+
+ /**
+ * Update private data member of active watchers list
+ * @param aElems SIMPLE elements [IN]
+ */
+ void UpdateActiveWatchersListL(
+ RPointerArray<MSimpleElement>& aElems );
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * Current settings
+ */
+ MSimplePluginSettings& iConnSets;
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine publisher
+ * Own.
+ */
+ MSimplePublisher* iPublisher;
+
+ /**
+ * SIMPLE engine watcher
+ * Own.
+ */
+ MSimpleWatcher* iWatcher;
+
+ /**
+ * PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed winfo
+ */
+ TBool iSubscribed;
+
+ /**
+ * Subscribed own data
+ */
+ TBool iSubscribedOwn;
+
+ /**
+ * Published own data
+ */
+ TBool iPublished;
+
+ /**
+ * Current operation
+ */
+ TPluginPublishOperation iOperation;
+
+ /**
+ * Simple publish document
+ * Own.
+ */
+ MSimpleDocument* iDocument;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CSimplePluginXdmUtils* iXdmUtils;
+
+ /**
+ * WINFO watchers
+ * Own.
+ */
+ TDblQue<CSimplePluginWatcherInfo> iWatcherList;
+
+ };
+
+ TInt CSimplePluginWatcherInfo::LinkOffset()
+ {
+ return _FOFF(CSimplePluginWatcherInfo, iLink);
+ }
+
+#endif // CSimplePluginPublisher_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginsession.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINSESSION_H
+#define CSIMPLEPLUGINSESSION_H
+
+
+#include <e32std.h>
+#include <msimpleconnectionobserver.h>
+#include "msimplepluginconnectionobs.h"
+
+class MXIMPContextClientInfo;
+class MXIMPProtocolConnection;
+class MXIMPServiceInfo;
+
+
+class MSimpleConnection;
+
+/**
+ * CSimplePluginSession
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginSession ) : public CBase,
+ public MSimpleConnectionObserver
+ {
+public:
+
+ static CSimplePluginSession* NewL(
+ const MXIMPServiceInfo& aService,
+ MSimplePluginConnectionObs& aObs );
+
+ virtual ~CSimplePluginSession();
+
+ /**
+ * OpenSessionL
+ *
+ * Opens the SIP connection (registers when needed)
+ *
+ */
+ void OpenSessionL();
+
+ /**
+ * OpenSessionL
+ *
+ * Opens the SIP connection (registers when needed)
+ * @param aSettingsId settings id
+ *
+ */
+ void OpenSessionL( TInt aSettingsId );
+
+ /**
+ * MSimpleConnection accessor
+ * @return MSImpleConnection instance
+ */
+ MSimpleConnection* SimpleConnection();
+
+ /**
+ * XDMSettings accessor
+ * @return XDM Settings ID
+ */
+ TInt XdmSettingsId();
+
+ /**
+ * Current registered SIP entity
+ */
+ TPtrC8 CurrentSipPresentity();
+
+ /**
+ * Domain syntax for current settings
+ */
+ TPtrC16 CurrentDomain();
+
+private:
+
+ CSimplePluginSession( MSimplePluginConnectionObs& aObs );
+
+ void ConstructL(
+ const MXIMPServiceInfo& aService );
+
+
+public:
+
+// from base class MSimpleConnectionObserver
+
+ /**
+ * Defined in a base class
+ */
+ void ConnectionStatusL( MSimpleConnection::TSimpleState aState );
+
+ /**
+ * Defined in a base class
+ */
+ void RequestCompleteL( TInt aOpId, TInt aStatus );
+
+// from base class CActive
+
+protected:
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iObs;
+
+ /**
+ * Simple Engine connection.
+ * Own.
+ */
+ MSimpleConnection* iConnection;
+
+ /**
+ * Current Simple Engine operation id
+ */
+ TInt iOpId;
+
+ /**
+ * IAP Id
+ */
+ TInt32 iIap;
+
+ /**
+ * XDM Settings id
+ */
+ TInt iXdmSetting;
+
+ /**
+ * Request type
+ */
+ MSimplePluginConnectionObs::TReqType iType;
+
+ /**
+ * Current User ID, User's SIP identity
+ * Own.
+ */
+ HBufC8* iUserId8;
+
+ /**
+ * Domain syntax for current settings
+ * Own,
+ */
+ HBufC16* iDomain;
+
+ /**
+ * Whether conncted to network
+ */
+ TBool iConnected;
+
+ };
+
+#endif // CSIMPLEPLUGINSESSION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginvariation.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSimplePluginVariation implementation.
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINVARIATION_H
+#define CSIMPLEPLUGINVARIATION_H
+
+#include <e32std.h>
+
+class CRepository;
+
+/**
+ * CSimplePluginVariation
+ *
+ * Implementation of MXIMPProtocolConnection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS(CSimplePluginVariation) : public CBase
+ {
+
+public:
+
+ enum TSimplePluginAuthRule
+ {
+ ERuleNone,
+ ERulePoliteBlock,
+ ERuleBlock,
+ ERuleConfirm,
+ ERuleAllow
+ };
+
+ static CSimplePluginVariation* NewL( );
+
+ ~CSimplePluginVariation();
+
+private:
+
+ CSimplePluginVariation();
+
+
+ void ConstructL( );
+
+
+public:
+
+ /**
+ * Get data from CenRep
+ */
+ void InitL();
+
+ /**
+ * Grant rule name
+ * @return rule name
+ */
+ TPtrC GrantRuleName();
+
+ /**
+ * Grant own rule name
+ * @return rule name
+ */
+ TPtrC GrantOwnRuleName();
+
+ /**
+ * Default rule name
+ * @return rule name
+ */
+ TPtrC DefaultRuleName();
+
+ /**
+ * Block rule name
+ * @return rule name
+ */
+ TPtrC BlockRuleName();
+
+ /**
+ * Default rule action
+ * @return action
+ */
+ TSimplePluginAuthRule DefaultRuleAction();
+
+ /**
+ * Block rule action
+ * @return action
+ */
+ TSimplePluginAuthRule BlockRuleAction();
+
+ /**
+ * RlsGroupUriTemplate
+ * @return RlsGroupUriTemplate
+ */
+ TPtrC RlsGroupUriTemplate();
+
+ /**
+ * SharedXdmTop
+ * @return SharedXdmTop
+ */
+ TPtrC SharedXdmTop();
+
+ /**
+ * GrantListName
+ * @return GrantListName
+ */
+ TPtrC GrantListName();
+
+private:
+
+ void InitGrantRuleNameL( CRepository* aRepository );
+
+ void InitGrantOwnRuleNameL( CRepository* aRepository );
+
+ void InitDefaultRuleNameL( CRepository* aRepository );
+
+ void InitBlockRuleNameL( CRepository* aRepository );
+
+ void InitDefaultRuleActionL( CRepository* aRepository );
+
+ void InitBlockRuleActionL( CRepository* aRepository );
+
+ void InitRlsGroupUriTemplateL( CRepository* aRepository );
+
+ void InitSharedXdmTopL( CRepository* aRepository );
+
+ void InitGrantListNameL( CRepository* aRepository );
+
+
+private: // data members
+
+ /**
+ * Id for rule to grant all elements
+ * Own
+ */
+ HBufC* iGrantAllRuleName;
+
+ /**
+ * Id for rule to grant own data
+ * Own
+ */
+ HBufC* iGrantOwnRuleName;
+
+ /**
+ * Id for default rule
+ * Own
+ */
+ HBufC* iDefaultRuleName;
+
+ /**
+ * Id for block rule
+ * Own
+ */
+ HBufC* iBlockRuleName;
+
+ /**
+ * Default rule action, allow/confirm/block/polite-block
+ */
+ TSimplePluginAuthRule iDefaultRuleAction;
+
+ /**
+ * Block rule action, block/polite-block
+ */
+ TSimplePluginAuthRule iBlockRuleAction;
+
+ /**
+ * Template for RLS service URI for a user group
+ * Own
+ */
+ HBufC* iRlsGroupUriTemplate;
+
+ /**
+ * Top level for lists in shared XDM index document
+ * Own
+ */
+ HBufC* iSharedXdmTop;
+
+ /**
+ * Name of list for granted users in XDM list
+ * Own
+ */
+ HBufC* iGrantListName;
+
+ };
+
+
+#endif // CSIMPLEPLUGINVARIATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginwatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINWATCHER_H
+#define CSIMPLEPLUGINWATCHER_H
+
+#include <e32std.h>
+
+#include <protocolpresencewatching.h>
+
+#include <msimplewatcherobserver.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+#include "msimplepluginsettings.h"
+
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPProtocolConnectionHost;
+class MPersonPresenceInfo;
+class MXIMPObjectCollection;
+
+class MSimpleDocument;
+class MSimpleWatcher;
+
+class CSimplePluginEntityWatcher;
+class CSimplePluginXdmUtils;
+
+/**
+ * CSimplePluginWatcher
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginWatcher ): public CActive,
+ public MProtocolPresenceWatching
+ {
+
+private:
+
+ /**
+ * Current operation
+ */
+ enum TPluginWatcherOperation
+ {
+ EPluginUndef,
+ EPluginSubscribeGroup,
+ EPluginUnsubscribeGroup
+ };
+
+ /**
+ * Current actibe object state
+ */
+ enum TPluginXdmState
+ {
+ EPluginIdle,
+ EPluginInitXdm,
+ EPluginFetchRls,
+ EPluginAddGroupMember,
+ EPluginRemoveGroupMember
+ // EPluginCommitRls,
+ // EPluginCommitXdm
+ };
+
+public:
+
+ /**
+ * Constructor.
+ * @param aconnSets current settings
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CSimplePluginWatcher* NewL(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ virtual ~CSimplePluginWatcher();
+
+ /**
+ * SetHost
+ *
+ * Set PrFw Host
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ * @patam aHost PrFW Host
+ */
+ void SetHost( MXIMPProtocolConnectionHost* aHost );
+
+ /**
+ * SIP Watcher is complets it's task.
+ * @param aStatus error status
+ */
+ void CompleteWatcher( TInt aStatus );
+
+ /**
+ * Delete a single entity watcher
+ * @param aPresentityid presentity id
+ */
+ void DeleteWatcher(
+ const TDesC8& aPresentityid );
+
+ /**
+ * Get Block list
+ * @param aList list name
+ * @param aMembers blocked users [OUT]
+ */
+ void GetEntitiesInListL(
+ const TDesC& aList,
+ MXIMPObjectCollection& aMembers );
+
+
+private:
+
+ CSimplePluginWatcher(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ void ConstructL( );
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ * @param aStatus error status
+ */
+ void CompletePrFwReq( TInt aStatus );
+
+ /**
+ * Handles RunL routines for subscription
+ */
+ void DoRunForSubscriptionL();
+
+ /**
+ * Handles RunL routines for unsubscription
+ */
+ void DoRunForUnsubscriptionL();
+
+
+public:
+
+
+// from base class MXIMPBase
+public:
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+// from base class MProtocolPresenceWatching
+public:
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityPresenceSubscriptionPifL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+protected:
+
+// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Match existing watcher
+ * @param aPresentityId presentity id
+ * @return watcher or NULL when not found
+ */
+ CSimplePluginEntityWatcher* MatchWatcher2L(
+ const TDesC8& aPresentityId, TBool aCreate );
+
+ /**
+ * Save presentity id
+ * @param aPresentityId presentity id
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId );
+
+ /**
+ * Start watching service in RLS
+ */
+ void StartWatchingRlsL();
+
+ void StartXdmOperationL();
+
+ /**
+ * StartXdmoperationL calls this
+ */
+ void DoStartXdmOperationL();
+
+ void GetListContentL();
+
+ /**
+ * Copy data from aIds and from aNames into aCollection
+ * @param aNames group member names [IN]
+ * @param aNames group member display names [IN]
+ * @param aCollection collection of MPresentityGroupMemberInfo [OUT]
+ */
+ void CopyGroupMembersToCollectionL(
+ CPtrCArray& aIds, CPtrCArray& aNames, MXIMPObjectCollection& aCollection);
+
+ /**
+ * DoSubscribePresentityPresenceL calls this.
+ */
+ void DoDoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * DoUnsubscribePresentityPresenceL calls this.
+ */
+ void DoDoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * DoDoUnsubscribePresentityGroupMembersPresenceL calls this
+ */
+ void DoDoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+
+private: // Data
+
+ /**
+ * Current settings
+ */
+ MSimplePluginSettings& iConnSets;
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine watchers
+ */
+ RPointerArray<CSimplePluginEntityWatcher> iWatchers;
+
+ /**
+ * Current PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CSimplePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Whether the request is completed
+ */
+ TBool iCompleted;
+
+ TPluginWatcherOperation iOperation;
+
+ TPluginXdmState iXdmState;
+
+ };
+
+#endif // CSimplePluginWatcher_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginwinfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINWINFO_H
+#define CSIMPLEPLUGINWINFO_H
+
+#include <e32std.h>
+
+#include <msimplewinfoobserver.h>
+
+#include "simpleplugincommon.h"
+#include "msimplepluginconnectionobs.h"
+
+#include <ximpbase.h>
+
+class MSimpleWinfo;
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+class MSimpleWinfoWatcher;
+class MXIMPProtocolConnectionHost;
+class MSimpleConnection;
+
+
+
+
+/**
+ * CSimplePluginWinfo
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginWinfo ) : public CBase,
+ public MSimpleWinfoObserver
+ {
+public:
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CSimplePluginWinfo* NewL(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ virtual ~CSimplePluginWinfo();
+
+ /**
+ * SetHost
+ *
+ * Set PrFw Host
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ * @patam aHost PrFW Host
+ */
+ void SetHost( MXIMPProtocolConnectionHost* aHost );
+
+ /**
+ * SubscribeWinfoListL
+ *
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ * @param aReqId PrFw req id
+ */
+ void SubscribeWinfoListL( TXIMPRequestId aReqId );
+
+ /**
+ * UnsubscribeWinfoListL
+ *
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ * @param aReqId PrFw req id
+ */
+ void UnsubscribeWinfoListL( TXIMPRequestId aReqId );
+
+private:
+
+ CSimplePluginWinfo(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ void ConstructL( );
+
+
+public:
+
+// from base class MSimpleWinfoObserver
+
+// Subscribe presence grant request list
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoReqCompleteL( TInt aOpid, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoTerminatedL(
+ TInt aOpid, TInt aReason );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginConnectionObs& iConnObs;
+
+ /**
+ * PrFw Host.
+ * Not Own.
+ */
+ MXIMPProtocolConnectionHost* iHost;
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine winfo watcher.
+ * Own.
+ */
+ MSimpleWinfoWatcher* iWinfoWatcher;
+
+ /**
+ * PrFW request id
+ */
+ TXIMPRequestId iPrFwId;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed
+ */
+ TInt iSubscribed;
+
+ /**
+ * Winfo subscribe completed
+ */
+ TBool iWinfoCompleted;
+
+
+ };
+
+#endif // CSimplePluginWinfo_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/inc/simplepluginxdmutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,747 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#ifndef CSIMPLEPLUGINXDMUTILS_H
+#define CSIMPLEPLUGINXDMUTILS_H
+
+#include <e32std.h>
+
+#include <badesca.h>
+
+#include <mrlspresxdmasynchandler.h>
+
+#include "simpleplugincommon.h"
+
+// Test suite
+class MSimplePluginTestObs;
+
+class MSimplePluginSettings;
+
+class CPresenceXDM;
+class CRLSXDM;
+class CXdmEngine;
+class CXdmDocument;
+class CXdmDocumentNode;
+
+class TPresenceActionXDM;
+class TPresenceTransformXDM;
+class TPresCondMisc;
+
+
+// notice: class CPtrCArray; after PrFw headers fixed.
+
+class TRequestStatus;
+
+
+/**
+ * CSimplePluginXdmUtils
+ *
+ * Simple Engine Connection
+ *
+ * @lib ?library
+ * @since s60 v5.0
+ */
+NONSHARABLE_CLASS( CSimplePluginXdmUtils ) : public CActive,
+ public MRLSPresXDMAsyncHandler
+ {
+public:
+
+
+ /**
+ * Active object asynch states
+ */
+ enum TPluginXdmState
+ {
+ EStateIdle,
+ /** Get OMA XDM lists */
+ EGetXdmOMALists,
+ /** Create OMA XDM lists */
+ ECreateXdmOMALists,
+ /** Get OMA XDM lists only, no rules later */
+ EGetXdmOMAListsOnly,
+ /** Create OMA XDM lists only, no rules later */
+ ECreateXdmOMAListsOnly,
+ /** Get RLS service */
+ EGetRlsServices,
+ /** Update RLS service */
+ EUpdateRlsServices,
+ /** Get rules from server for GrantPresenceForPresentity */
+ EGetXdmRules,
+ /** Update rules to server for GrantPresenceForPresentity */
+ EUpdateXdmRules,
+ /** Update XDM OMA List */
+ EUpdateXdmOMAList,
+ /** Cancel XDM document operation */
+ ECancelDocument,
+ /** Re-Update RLS service - 409 HTTP error handling*/
+ EReUpdateRlsServices
+ };
+
+ /**
+ * Current operation
+ */
+ enum TPluginXdmOperation
+ {
+ ENoOperation,
+ EXdmInit,
+ EXdmInitXdmsOnly,
+ EXdmDeleteAll,
+ EXdmCancel,
+ EXdmAddUserToGroup,
+ EXdmAddGroupToGroup,
+ EXdmRemoveUserFromGroup,
+ EXdmRemoveGroupFromGroup,
+ EXdmGrantForAll,
+ EXdmWithdrawFromAll,
+ EXdmGetBlockedList,
+ EXdmCreateGroup,
+ EXdmDeleteGroup,
+ EXdmRlsFetch,
+ EXdmRlsAdd,
+ EXdmRlsRemove,
+ EXdmGrantGroup,
+ EXdmWithdrawGroup,
+ EXdmSetReactiveAuth,
+ EXdmSetProactiveAuth
+ };
+
+
+ /**
+ * Constructor.
+ * @param aConnSets connection settings
+ * @param aXdmId XDm settings id
+ */
+ static CSimplePluginXdmUtils* NewL(
+ MSimplePluginSettings& aConnSets,
+ TInt aXdmId);
+
+ virtual ~CSimplePluginXdmUtils();
+
+ /**
+ * Cancel non active wrappers
+ */
+ void CancelWrappers();
+
+ /**
+ * Initialize XDMS and Presence XDM structures in network.
+ * @param aStatus Request status of the caller
+ */
+ void InitializeXdmL( TRequestStatus& aStatus );
+
+ /**
+ * Initialize XDMS in network
+ * @param aStatus Request status of the caller
+ */
+ void InitializeXdmsOnlyL( TRequestStatus& aStatus );
+
+ /**
+ * Add resource-list into RLS document, overwrite old document
+ * @param aStatus Request status of the caller
+ */
+ void FetchRlsL( TRequestStatus& aStatus );
+
+ /**
+ * Add resource-list into RLS document.
+ * FetchRlsL must be called before this method.
+ * @param aName list name
+ */
+ void AddRlsGroupL(
+ const TDesC& aName );
+
+ /**
+ * Remove resource-list in RLS document
+ * FetchRlsL must be called before this method.
+ * Use RemoveRlsServiceByResourceListL instead when possible.
+ * @param aName list name
+ */
+ void RemoveRlsGroupL( const TDesC& aName );
+
+ /**
+ * Remove service URI in RLS document by corresponding shared XDM document entry.
+ * The document in the server is updated when needed.
+ * FetchRlsL must be called before this method.
+ * This completes without error if the service was not found.
+ * @param aGroup user's group name, that's converted to resource-list value and used
+ * to match the service resource-list in the rls-services document.
+ * @param aStatus Request status of the caller.
+ */
+ void RemoveRlsServiceByResourceListL( const TDesC& aGroup, TRequestStatus& aStatus );
+
+
+ /**
+ * Access service URI in RLS document by corresponding shared XDM document entry.
+ * FetchRlsL must be called before this method.
+ * Leaves with KErrNotFound if RLS service is not found.
+ * @param aGroup user's group name, that's converted to resource-list value and used
+ * to match the service resource-list in the rls-services document.
+ * @return Access service URI in RLS document, ownership is transferred. May be NULL.
+ */
+ HBufC* RlsServiceByResourceListLC( const TDesC& aGroup );
+
+ /**
+ * Add entity to granted list.
+ * InitializeXdmL must be called before this method.
+ * @param aUri entity URI to be granted
+ * @param aStatus Request status of the caller
+ */
+ void AddEntityToGrantedL( const TDesC& aUri, TRequestStatus& aStatus );
+
+ /**
+ * Remove entity from granted list.
+ * InitializeXdmL must be called before this method.
+ * @param aUri entity URI to be removed
+ * @param aStatus Request status of the caller
+ */
+ void RemoveEntityFromGrantedL(
+ const TDesC& aUri, TRequestStatus& aStatus );
+
+ /**
+ * Add entity to blocked list.
+ * InitializeXdmL must be called before this method.
+ * @param aUri entity URI to be blocked
+ * @param aStatus Request status of the caller
+ */
+ void AddEntityToBlockedL( const TDesC& aUri, TRequestStatus& aStatus );
+
+ /**
+ * Remove entity from blocked list.
+ * InitializeXdmL must be called before this method.
+ * @param aUri entity URI to be removed
+ * @param aStatus Request status of the caller
+ */
+ void RemoveEntityFromBlockedL(
+ const TDesC& aUri, TRequestStatus& aStatus );
+
+ /**
+ * Add group to granted.
+ * InitializeXdmL must be called before this method.
+ * @param aName a group to be granted
+ * @param aStatus Request status of the caller
+ */
+ void AddGroupToGrantedL( const TDesC& aName, TRequestStatus& aStatus );
+
+ /**
+ * Remove group from granted list.
+ * InitializeXdmL must be called before this method.
+ * @param aName a group to be removed from granted list
+ * @param aStatus Request status of the caller
+ */
+ void RemoveGroupFromGrantedL(
+ const TDesC& aName, TRequestStatus& aStatus );
+
+ /**
+ * Grant right for everyone, proactive authorization is set on.
+ * InitializeXdmL must be called before this method.
+ * @param aStatus Request status of the caller
+ */
+ void GrantForEveryoneL( TRequestStatus& aStatus );
+
+ /**
+ * Withdraw right from eveyone, reactive authorization is set on.
+ * InitializeXdmL must be called before this method.
+ * @param aStatus Request status of the caller
+ */
+ void WithdrawFromEveryoneL( TRequestStatus& aStatus );
+
+ /**
+ * Set reactive authorization policy.
+ * Default rule is set to CONFIRM.
+ */
+ void SetReactiveAuthL( TRequestStatus& aStatus );
+
+ /**
+ * Set proactive authorization policy.
+ * Default rule is set to ALLOW if it was CONFIRM.
+ */
+ void SetProactiveAuthL( TRequestStatus& aStatus );
+
+ /**
+ * Get (subscribe) Block List.
+ * InitializeXdmL must be called before this method.
+ * @param aMembers blocked users [OUT].
+ */
+ void SubscribeBlockListL( CPtrCArray& aMembers );
+
+ /**
+ * Unsubscribe Block List.
+ * @param aStatus Request status of the caller
+ */
+ void UnsubscribeBlockListL( TRequestStatus& aStatus );
+
+ /**
+ * Create entity's own group
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ * @param aName group name
+ * @param aDisplayName group's display name
+ */
+ void CreateEntityGroupL(
+ const TDesC& aName,
+ const TDesC& aDisplayName );
+
+ /**
+ * Delete entity's own group
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ */
+ void DeleteEntityGroupL( const TDesC& aName );
+
+ /**
+ * Add group member
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ * @param aGroup group name
+ * @param aUser member
+ * @param aDispName display name
+ * @param aStatus Request status of the caller
+ */
+ void AddPresentityGroupMemberL(
+ const TDesC& aGroup,
+ const TDesC& aUser,
+ const TDesC& aDispName,
+ TRequestStatus& aStatus );
+
+ /**
+ * Remove group member
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ * @param aGroup group name
+ * @param aUser member
+ * @param aStatus Request status of the caller
+ */
+ void RemovePresentityGroupMemberL(
+ const TDesC& aGroup,
+ const TDesC& aUser,
+ TRequestStatus& aStatus );
+
+ /**
+ * GetUserListsL
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ * The size of the parameter arrays are same.
+ * @param aIds sip id array [OUT]
+ * @param aDispNames display name array [OUT]
+ */
+ void GetUserListsL( CDesCArrayFlat& aIds, CDesCArrayFlat& aDispNames );
+
+ /**
+ * GetEntitiesInListL
+ * InitializeXdmL or InitilaizeXdmsOnlyL must be called before this method.
+ * The size of the parameter arrays are same.
+ * @param aList naem of the user's list [IN]
+ * @param aIds sip id array [OUT]
+ * @param aDispNames display name array [OUT]
+ */
+ void GetEntitiesInListL(
+ const TDesC& aList, CPtrCArray& aIds, CPtrCArray& aDispNames);
+
+ /**
+ * Updates XDM reource lists into server
+ * @param aStatus Request status of the caller
+ */
+ void CommitXdmL( TRequestStatus& aStatus );
+
+ /**
+ * Updates RLS reource lists into server
+ * @param aStatus Request status of the caller
+ */
+ void CommitRlsL( TRequestStatus& aStatus );
+
+ /**
+ * Test Suite setter
+ * @param aObs test observer, may be NULL
+ */
+ void SetTestObserver( MSimplePluginTestObs* aObs );
+
+ /**
+ * Generate RLS document URI based on URI template located in CentRep variation definition.
+ * @param aGroup grouup name
+ * @param aPresentityUri presntity's URI, may be SIP or TEL URI. Domain part is stripped from SIP URI.
+ * @param aDomain domain part of the URI,
+ Leading '@' is stripped off and it must be hard coded in a template when needed.
+ * @return RLS document URI
+ */
+ HBufC16* CreateRlsDocumentUri16LC(
+ const TDesC16& aGroup,
+ const TDesC16& aPresentityUri,
+ const TDesC16& aDomain );
+
+private:
+
+ CSimplePluginXdmUtils(
+ MSimplePluginSettings& aObs, TInt aXdmId );
+
+ void ConstructL( );
+
+ TBool DoesUserListExistsL( const TDesC& aName );
+
+
+public:
+
+// from base class MRLSPresXDMAsyncHandler
+
+ /**
+ * Defined in a base class
+ */
+ void HandleRLSUpdateDocumentL(TInt aErrorCode);
+
+ /**
+ * Defined in a base class
+ */
+ void HandleRLSUpdateCancelL(TInt aErrorCode);
+
+ /**
+ * Defined in a base class
+ */
+ void HandleRLSDeleteAllEmptyListsL(TInt aErrorCode);
+
+ /**
+ * Defined in a base class
+ */
+ void HandlePresUpdateDocumentL(TInt aErrorCode);
+
+ /**
+ * Defined in a base class
+ */
+ void HandlePresUpdateCancelL(TInt aErrorCode);
+
+
+
+protected:
+
+// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Complete client request
+ * @param aStatus return code
+ */
+ void CompleteClientReq( TInt aStatus );
+
+ /**
+ * Get XDm OMA lists from a server
+ */
+ void GetXdmOMAListsL();
+
+ /**
+ * Create OMA Shared Xdm Lists when needed.
+ * @return true if a list is created.
+ */
+ TBool CreateXdmOMAListsIfNeededL( );
+
+ /**
+ * Create a specified OMA Shared Xdm List when needed.
+ *
+ * @param aRoot parent for the new list
+ * @param aName name for the new list
+ * Leave with KErrAlreadyExists if all the lists already exist.
+ * @return true is list was added into root node.
+ */
+ TBool CreateXdmOMAListIfNeededL( CXdmDocumentNode* aRoot, const TDesC& aName );
+
+ /**
+ * Create Resource List in shared xdm document
+ * @param aParent parent for the new list
+ * @param aName name for the new list
+ */
+ void CreateResourceListL(
+ CXdmDocumentNode* aParent, const TDesC& aName );
+
+ /**
+ * Search List under a parent list, one level only
+ * @param aParent parent list node
+ * @param aName list to be searched for
+ * @return child node found or NULL if not found.
+ */
+ CXdmDocumentNode* SearchListUnderParentL(
+ CXdmDocumentNode* aParent, const TDesC& aName );
+
+ void GetXdmRulesL();
+
+ /**
+ * Make Rls list URI
+ * @param aXCapUri XCAP URI
+ * @param aListName a list to be referred
+ * @return URI, ownerhisp is transferred
+ */
+ HBufC* MakeRlsUriL(
+ const TDesC& aXcapUri, const TDesC& aListName );
+
+ /**
+ * Make Rls list URI
+ * @param aXCapUri XCAP URI
+ * @param aListName a list to be referred
+ * @return URI, ownerhisp is transferred
+ */
+ HBufC* MakeRlsBuddyUriL(
+ const TDesC& aXcapUri, const TDesC& aListName );
+
+ void MakeInitialXdmsDocumentL();
+
+ /**
+ * Updates XDM rules into server
+ */
+ void UpdateXdmRulesL();
+
+ /**
+ * Updates XDMS reource lists into server
+ */
+ void UpdateXdmsL();
+
+ /**
+ * Updates RLS document into server
+ */
+ void UpdateRlsL();
+
+ /**
+ * Handles pres auth rules document callback method
+ * @param aErrorCode returned error code
+ */
+ void DoHandlePresUpdateDocumentL( TInt aErrorCode );
+
+ /**
+ * Handles RLS document callback method
+ * @param aErrorCode returned error code
+ */
+ void DoHandleRLSUpdateDocumentL(TInt aErrorCode);
+
+ void DoAddUserToListL(
+ const TDesC& aList, const TDesC& aName );
+
+ void DoAddUserToUserListL(
+ const TDesC& aList, const TDesC& aUser, const TDesC& aDispName );
+
+ void DoAddListIntoGrantRuleL( const TDesC& aListUri );
+
+ void DoRemoveListFromGrantRuleL( const TDesC& aListUri );
+
+ void DoRemoveUserFromListL(
+ const TDesC& aList, const TDesC& aName );
+
+ void DoRemoveUserFromUserListL( const TDesC& aList, const TDesC& aUser );
+
+ void DoGrantForAllL();
+
+ void DoWithdrawFromAllL();
+
+ void DoSetReactiveAuthL();
+
+ /**
+ * Set Proactive authorization
+ */
+ void DoSetProactiveAuthL();
+
+ void DoGetListMembersL(
+ const TDesC& aList, CPtrCArray& aMembers );
+
+ void DoCreateEntityGroupL( const TDesC& aList, const TDesC& aDisName );
+
+ void DoDeleteEntityGroupL( const TDesC& aList );
+
+ /**
+ * Search OMA Buddy List
+ * Leaves with KErrNotFound if not found
+ * @return list node
+ */
+ CXdmDocumentNode* DoGetBuddyListL();
+
+ /**
+ * Search a specific user XDM list
+ * Leaves with KErrNotFound if not found
+ * @param aList list name
+ * @param aBuddyList parent buddy list
+ * @return list node
+ */
+ CXdmDocumentNode* DoGetUserListL(
+ const TDesC& aList, CXdmDocumentNode* aBuddyList );
+
+ /**
+ * Remove service URI in RLS document by corresponding shared XDM document entry.
+ * FetchRlsL must be called before this method.
+ * @param aResourceList resource-list entry value, a reference to Shared XDM document.
+ * @return ETrue if service is found and removed.
+ */
+ TBool DoRemoveRlsServiceByResourceListL( const TDesC& aResourceList );
+
+ /**
+ * Access service URI in RLS document by corresponding shared XDM document entry.
+ * FetchRlsL must be called before this method.
+ * @param aResourceList resource-list entry value, a reference to Shared XDM document.
+ * @return service URI, ownership is transferred.
+ */
+ HBufC* DoGetRlsServiceByResourceListL( const TDesC& aResourceList );
+
+ /**
+ * Accesor for iAuxBuffer that contains last negotiated RLS service URI
+ * @return buffer content
+ */
+ TPtrC AuxBuffer();
+
+ /**
+ * Run next XDM routines
+ * @param aOrigState original XDM state
+ * @param aStatus error status
+ */
+ void DoXdmRunL( TPluginXdmState aOrigState, TInt aStatus );
+
+ /**
+ * Handle RLS service URI negatioation
+ */
+ void RlsServiceUriNegotiationL();
+
+ /**
+ * Make default auth rule
+ * @param aRuleId Rule id
+ * @param aAction action class initialized
+ * @param aTransform transform class initialized
+ */
+ void MakeDefaultRuleL(
+ TDes& aRuleId,
+ TPresenceActionXDM& aAction,
+ TPresenceTransformXDM& aTransform,
+ TPresCondMisc& aMisc );
+
+ /**
+ * Replace Group tag in URI
+ * @param aBuf URI buffer [IN,OUT]
+ * @param aGroup Group name
+ */
+ static void ReplaceGroupTag( HBufC16* aBuf, const TDesC16& aGroup );
+
+ /**
+ * Replace Domain tag in URI
+ * @param aBuf URI buffer [IN,OUT]
+ * @param aDomain Domain value
+ */
+ static void ReplaceDomainTag( HBufC16* aBuf, const TDesC16& aDomain );
+
+ /**
+ * Replace User tag in URI
+ * @param aBuf URI buffer [IN,OUT]
+ * @param aPresentityUri User URI value
+ */
+ static void ReplaceUserTag(
+ HBufC16* aBuf, const TDesC16& aPresentityUri );
+
+
+private: // Data
+
+ /**
+ * PrFw Plugin connection observer
+ */
+ MSimplePluginSettings& iConnSets;
+
+ /**
+ * XDM Settings id
+ */
+ TInt iSettingsId;
+
+ /**
+ * Simple Engine request id
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed items. Bitmask.
+ */
+ TUint iSubscribed;
+
+ /**
+ * Presence XDM Client
+ * Own.
+ */
+ CPresenceXDM* iPresenceXdm;
+
+ /**
+ * RlsXDM Client
+ * Own.
+ */
+ CRLSXDM* iRlsXdm;
+
+ /**
+ * XDM Engine
+ * Own.
+ */
+ CXdmEngine* iXdmEngine;
+
+ /**
+ * XDM document for resource-lists
+ * Own.
+ */
+ CXdmDocument* iXdmDoc;
+
+ /**
+ * Current state
+ */
+ TPluginXdmState iXdmState;
+
+ /**
+ * Current operation
+ */
+ TPluginXdmOperation iOperation;
+
+ /**
+ * Whether Presence XDM is up-to-date
+ */
+ TBool iPresXdmOk;
+
+ /**
+ * Whether XDM is up-to-date
+ */
+ TBool iXdmOk;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ /**
+ * Test suite observer
+ * Not own.
+ */
+ MSimplePluginTestObs* iTestObs;
+
+ /**
+ * Auxiliary buffer for for Negotiated RLS service URI
+ */
+ HBufC* iAuxBuffer;
+
+ /**
+ * Auxiliary buffer for for Negotiated RLS service URI
+ */
+ HBufC* iAuxBuffer2;
+
+ };
+
+
+
+#endif // CSimplePluginXdmUtils_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/rom/presencefwsimpleadpt.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for SIMPLE Adaptation
+*
+*/
+
+
+
+
+#ifndef PRESENCEFW_SIMPLE_IBY
+#define PRESENCEFW_SIMPLE_IBY
+
+#ifdef __PRESENCE_FRAMEWORK
+#ifdef __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+#include <data_caging_paths_for_iby.hrh>
+
+// Presence ECOM plugin
+ECOM_PLUGIN( simpleplugin.dll, simpleplugin.rss )
+
+// stub SIS, provides support for SIS upgrading
+data=DATAZ_\system\install\presencefwsimpleadptstub.sis system\install\presencefwsimpleadptstub.sis
+
+#endif // __SIP_SIMPLE_PRESENCE_PROTOCOL
+#endif // __PRESENCE_FRAMEWORK
+
+#endif // PRESENCEFW_SIMPLE_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simpleplugin.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <ecom/implementationproxy.h>
+
+#include <ximpserviceinfo.h>
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <presenceinfo.h>
+#include <ximpprotocolconnectionhost.h>
+
+#include "simpleplugin.h"
+#include "simpleplugindef.h"
+#include "simplepluginconnection.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( K_SIMPLEPLUGIN_1_IMPLEMENTATION_UID, CSimplePlugin::NewL )
+ };
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::CSimplePlugin()
+// ---------------------------------------------------------------------------
+//
+CSimplePlugin::CSimplePlugin()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePlugin::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::NewLC()
+// ---------------------------------------------------------------------------
+//
+CSimplePlugin* CSimplePlugin::NewLC()
+ {
+ CSimplePlugin* self = new( ELeave ) CSimplePlugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::NewL()
+// ---------------------------------------------------------------------------
+//
+CSimplePlugin* CSimplePlugin::NewL()
+ {
+ CSimplePlugin* self = CSimplePlugin::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::~CSimplePlugin()
+// ---------------------------------------------------------------------------
+//
+CSimplePlugin::~CSimplePlugin()
+ {
+ iConnections.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::PrimeHost()
+// ---------------------------------------------------------------------------
+//
+void CSimplePlugin::PrimeHost( MXIMPProtocolPluginHost& aHost )
+ {
+ iHost = &aHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::AcquireConnectionL()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection& CSimplePlugin::AcquireConnectionL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aContextClient )
+ {
+
+ // TODO: singleton takes place here. Change name to CSimplePluginImp???
+ // CSimplePluginConnection reflects to Singleton. This should compare PresenceID
+ // and share a single entity with identical ids.HOW DOES PrFW work in this case???
+
+ // support multiple connections
+ // always create a new connection - no connection sharing, it takes place in SIP Stack.
+ CSimplePluginConnection* connection =
+ CSimplePluginConnection::NewL( aServiceInfo, aContextClient );
+ CleanupStack::PushL( connection );
+ iConnections.AppendL( connection );
+ CleanupStack::Pop( connection );
+ return *connection;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::ReleaseConnection()
+// ---------------------------------------------------------------------------
+//
+void CSimplePlugin::ReleaseConnection( MXIMPProtocolConnection& aConnection )
+ {
+ TInt connectionsCount = iConnections.Count();
+
+ for( TInt i( connectionsCount - 1 ); i >= 0; i-- )
+ {
+ MXIMPProtocolConnection* tmp = iConnections[i];
+ if( tmp == &aConnection )
+ {
+ delete iConnections[i];
+ iConnections.Remove( i );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePlugin::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MXIMPProtocolPlugin* myIf = this;
+ return myIf;
+ }
+ if( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePlugin::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MXIMPProtocolPlugin* myIf = this;
+ return myIf;
+ }
+ if( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePlugin::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePlugin::GetInterfaceId() const
+ {
+ return MXIMPProtocolPlugin::KInterfaceId;
+ }
+
+
+
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginauthorization.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1071 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+
+#include <e32std.h>
+
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresenceauthorizationdatahost.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <ximpstatus.h>
+#include <ximpidentity.h>
+#include <presencegrantrequestinfo.h>
+#include <ximpobjectcollection.h>
+#include <presenceblockinfo.h>
+#include <presenceerrors.hrh>
+
+#include <simplefactory.h>
+#include <msimpleconnection.h>
+#include <msimplewinfo.h>
+#include <msimpleelement.h>
+
+#include "simplepluginauthorization.h"
+#include "simpleplugindebugutils.h"
+#include "simplepluginwinfo.h"
+#include "simplepluginxdmutils.h"
+#include "simpleplugincommon.h"
+#include "simplepluginconnection.h"
+
+/**
+ The design is the following one
+
+ 1. DoGrantPresenceForEveryOneL
+ modify default rule to ALLOW.
+
+ 2. DoWithdrawPresenceFromEveryOneL
+ if current rule is ALLOW then
+ { BLOCK }
+ otherwise no action.
+
+ 3. DoSubscribePresenceGrantRequestListL
+ modify default rule to CONFIRM.
+
+ 4. DoUnsubscribePresenceGrantRequestListL
+ if current rule is CONFIRM then
+ { go to ALLOW }
+ otherwise no action.
+*/
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CSimplePluginAuthorization
+// ---------------------------------------------------------------------------
+//
+CSimplePluginAuthorization::CSimplePluginAuthorization(
+ MSimplePluginConnectionObs& aObs )
+: CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs),
+ iOperation(ENoOperation),
+ iXdmOk(EFalse), iDefRule(ERuleDef), iWinfoSubs( EFalse )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::ConstructL( )
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginAuthorization* CSimplePluginAuthorization::NewL(
+ MSimplePluginConnectionObs& aObs )
+ {
+ CSimplePluginAuthorization* self =
+ new( ELeave ) CSimplePluginAuthorization( aObs );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: NewL this=%d"), (TInt)self );
+#endif
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::~CSimplePluginAuthorization
+// ---------------------------------------------------------------------------
+//
+CSimplePluginAuthorization::~CSimplePluginAuthorization()
+ {
+ delete iPresIdentity;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::SetDataHost
+// We assume that this method is given by PrFw right after
+// constrcution.
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::SetDataHost(
+ MProtocolPresenceAuthorizationDataHost& aDataHost )
+ {
+ iDataHost = &aDataHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::WinfoTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::WinfoTerminatedL( TInt /*aReason*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: WinfoTerminatedL") );
+#endif
+
+ if ( iWinfoSubs )
+ {
+ MXIMPDataSubscriptionState* myState = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+ // Notice: consider error codes
+ myStatus->SetResultCode( KErrCompletion );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ // parameters' OWNERSHIP is taken
+ iDataHost->SetPresenceGrantRequestDataSubscriptionStateL(
+ myState,
+ myStatus );
+
+ iWinfoSubs = EFalse;
+
+ CleanupStack::Pop( /*myStatus*/ );
+ CleanupStack::Pop( /*myState*/ );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoSubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoSubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoSubscribePresenceGrantRequestListL"));
+#endif
+
+ /*
+ This means Reactive authorization, i.e. modify default rule as CONFIRM.
+ Also this starts the WINFO subscription.
+
+ Once the authorization request is received the
+ MProtocolPresenceAuthorizationDataHost::HandlePresenceGrantRequestReceivedL shall
+ be called in the host API.
+
+ First make the watcher list SIP subscription and after that is completed
+ in HandleIfMine then continue and modify XDMS authentication rule.
+ HandleIfMine can be called also immediately if there already exists an WINFO subscrption.
+ */
+
+ iOperation = ESubscribePresenceGrantRequestList;
+ iPrFwId = aReqId;
+ TRAPD( err, iConnObs.WinfoHandlerL()->SubscribeWinfoListL( aReqId ));
+ if ( err )
+ {
+ iOperation = ENoOperation;
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ else
+ {
+ iWinfoSubs = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoUnsubscribePresenceGrantRequestListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoUnsubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoUnsubscribePresenceGrantRequestListL TEST COVERS 4"));
+#endif
+
+ // First modify XDMS authentication rule and then unsubscribe
+ // SIP watcher list subscription.
+ TRAPD( err, DoStartXdmOperationL( aReqId, EUnsubscribePresenceGrantRequestList ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ iPrFwId = aReqId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoGrantPresenceForPresentityL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& /*aPif*/, // notice: pif not supported
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoGrantPresenceForPresentityL"));
+#endif
+ StartXdmOperationL( aPresentityId, aReqId, EGrantPresenceForPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoUpdatePresenceGrantPifForPresentityL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoUpdatePresenceGrantPifForPresentityL(
+ const MXIMPIdentity& /*aPresentityId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoUpdatePresenceGrantPifForPresentityL"));
+#endif
+ // Notice: aPif filter not supported.
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoWithdrawPresenceGrantFromPresentityL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoWithdrawPresenceGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoWithdrawPresenceGrantFromPresentityL"));
+#endif
+ StartXdmOperationL( aPresentityId, aReqId, EWithdrawFromPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoGrantPresenceForPresentityGroupMembersL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoGrantPresenceForPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoGrantPresenceForPresentityGroupMembersL"));
+#endif
+ StartXdmOperationL( aGroupId, aReqId, EGrantPresenceForPresentityGroupMembers );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoUpdatePresenceGrantPifForPresentityGroupMembersL"));
+#endif
+ // Notice: aPif filter not supported
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoWithdrawPresenceGrantFromPresentityGroupMembersL"));
+#endif
+ StartXdmOperationL( aGroupId, aReqId, EWithdrawFromGroupMembers );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoGrantPresenceForEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoGrantPresenceForEveryoneL(
+ const MPresenceInfoFilter& /*aPif*/, // // Notice: aPif filter not supported
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoGrantPresenceForEveryoneL"));
+#endif
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC(); // << nobody
+ StartXdmOperationL( *nobody, aReqId, EGrantForEveryone );
+ CleanupStack::PopAndDestroy( ); // >> nobody
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoUpdatePresenceGrantPifForEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoUpdatePresenceGrantPifForEveryoneL(
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoUpdatePresenceGrantPifForEveryoneL"));
+#endif
+ // Notice: aPif filter not supported
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoWithdrawPresenceGrantFromEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoWithdrawPresenceGrantFromEveryoneL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoWithdrawPresenceGrantFromEveryoneL"));
+#endif
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC(); // << nobody
+ StartXdmOperationL( *nobody, aReqId, EWithdrawFromEveryone );
+ CleanupStack::PopAndDestroy( ); // >> nobody
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoSubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoSubscribePresenceBlockListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoSubscribePresenceBlockListL"));
+#endif
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC(); // << nobody
+ StartXdmOperationL( *nobody, aReqId, ESubscribeBlockList );
+ CleanupStack::PopAndDestroy( ); // >> nobody
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoUnsubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoUnsubscribePresenceBlockListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoUnsubscribePresenceBlockListL"));
+#endif
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC(); // << nobody
+ StartXdmOperationL( *nobody, aReqId, EUnsubscribeBlockList );
+ CleanupStack::PopAndDestroy( ); // >> nobody
+ }
+
+// Blocking presence information access from single presentities
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoBlockPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoBlockPresenceForPresentityL"));
+#endif
+ StartXdmOperationL( aPresentityId, aReqId, EBlockPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoCancelPresenceBlockFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: DoCancelPresenceBlockFromPresentityL"));
+#endif
+ StartXdmOperationL( aPresentityId, aReqId, EUnblockPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoCancel( )
+ {
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::RunL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::RunL( )
+ {
+ TInt myStatus = iStatus.Int();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: RunL %d"), myStatus );
+#endif
+
+ if ( iOperation == EUnsubscribePresenceGrantRequestList && !myStatus )
+ {
+ // unsubscribe watcher list after successful default rule modification.
+ TRAPD( err, iConnObs.WinfoHandlerL()->UnsubscribeWinfoListL( iPrFwId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ else
+ {
+ // This will end to HandleIfMine.
+ }
+ }
+ else if ( !iXdmOk && !myStatus )
+ {
+ iXdmOk = ETrue;
+ CallActualXdmOperationL();
+ }
+ else // iXdmOK or myStatus
+ {
+ CompletePrFwReq( myStatus );
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CallActualXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::CallActualXdmOperationL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: CallActualXdmOperationL") );
+#endif
+ switch ( iOperation )
+ {
+ case EGrantPresenceForPresentity:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->AddEntityToGrantedL( iPresIdentity->Des(), iStatus );
+ SetActive();
+ break;
+ case EWithdrawFromPresentity:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->RemoveEntityFromGrantedL( iPresIdentity->Des(),iStatus );
+ SetActive();
+ break;
+ case EGrantPresenceForPresentityGroupMembers:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->AddGroupToGrantedL( iPresIdentity->Des(), iStatus );
+ SetActive();
+ break;
+ case EWithdrawFromGroupMembers:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->RemoveGroupFromGrantedL( iPresIdentity->Des(), iStatus );
+ SetActive();
+ break;
+ case EGrantForEveryone:
+ iXdmUtils->GrantForEveryoneL( iStatus );
+ SetActive();
+ break;
+ case EWithdrawFromEveryone:
+ iXdmUtils->WithdrawFromEveryoneL( iStatus );
+ SetActive();
+ break;
+ case ESubscribeBlockList:
+ HandleSubscribeBlockListL();
+ break;
+ case EUnsubscribeBlockList:
+ iXdmUtils->UnsubscribeBlockListL( iStatus );
+ SetActive();
+ break;
+ case EBlockPresentity:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->AddEntityToBlockedL( iPresIdentity->Des(), iStatus );
+ SetActive();
+ break;
+ case EUnblockPresentity:
+ // iPresIdentity can't be null in this case
+ iXdmUtils->RemoveEntityFromBlockedL( iPresIdentity->Des(), iStatus );
+ SetActive();
+ break;
+ case ESubscribePresenceGrantRequestList:
+ iXdmUtils->SetReactiveAuthL( iStatus );
+ SetActive();
+ break;
+ case EUnsubscribePresenceGrantRequestList:
+ default:
+ iXdmUtils->SetProactiveAuthL( iStatus );
+ SetActive();
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CopyBlockersToArrayL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::CopyBlockersToArrayL(
+ CPtrCArray& aBlockers, RPointerArray<MXIMPIdentity>& aBlockedSouls )
+ {
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+
+ aBlockedSouls.Reset();
+
+ TInt nodeCount = aBlockers.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ MXIMPIdentity* entity = myFactory.NewIdentityLC(); // << entity
+ entity->SetIdentityL( aBlockers[i] );
+ aBlockedSouls.Append( entity );
+ CleanupStack::Pop(); // >> entity
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginAuthorization::RunError( TInt aError )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: RunError %d"), aError );
+#endif
+ // complete the open request
+ CompletePrFwReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginAuthorization::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresenceAuthorization* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePluginAuthorization::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresenceAuthorization* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePluginAuthorization::GetInterfaceId() const
+ {
+ return MProtocolPresenceAuthorization::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId )
+ {
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::WinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ if ( !iWinfoSubs )
+ {
+ return;
+ }
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: WinfoNotificationL starts"));
+#endif
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ if ( !count )
+ {
+ // stop parsing empty notification
+ User::Leave( KErrArgument );
+ }
+
+ __ASSERT_DEBUG( count == 1, User::Leave( KErrCorrupt ) );
+
+ const TDesC8* stateVal = aWinfo.AttrValue( KSimpleState8 );
+ if ( stateVal && !stateVal->CompareF( KSimpleFull8 ))
+ {
+ // Call full list method
+ HandleFullWinfoNotificationL( aWinfo );
+ }
+ else
+ {
+ // Indicate changes in WINFO list one by one.
+ HandlePartialWinfoNotificationL( aWinfo );
+ }
+ CleanupStack::PopAndDestroy( &elems );
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: WinfoNotificationL ends"));
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation )
+ {
+ TRAPD( err, DoStartXdmOperationL(aId, aReqId, aOperation ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoStartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoStartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation )
+ {
+ SetPresIdentityL( aId );
+ DoStartXdmOperationL( aReqId, aOperation );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::DoStartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::DoStartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ if ( iXdmOk )
+ {
+ CallActualXdmOperationL();
+ }
+ else
+ {
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::HandleFullWinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::HandleFullWinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandleFullWinfoNotificationL starts"));
+#endif
+
+ // Search for pending watchers and call HandlePresenceGrantRequestListL
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KSimpleWatcherList8 );
+ User::LeaveIfError( err );
+
+ err = elem->SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ count = elems.Count();
+
+ // Search watchers who are pending (status = pending)
+ HBufC* nodeContent = NULL;
+ MXIMPObjectCollection *pendings = iConnObs.ObjectFactory().NewObjectCollectionLC();
+
+ TBool pendingFound(EFalse);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ elem = elems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KSimpleWatcher8 )))
+ {
+ const TDesC8* pp8 = elem->AttrValue( KSimpleStatus8 );
+ if ( pp8 && !pp8->CompareF( KSimplePending8 ))
+ {
+ // Build collection of grant requests
+ // Find the child node containing the SIP entity
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ // create the collection entry here
+ MPresenceGrantRequestInfo* grInfo =
+ iConnObs.PresenceObjectFactory().NewPresenceGrantRequestInfoLC();
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( nodeContent->Des());
+ grInfo->SetRequestorIdL( identity ); // ownership is taken
+ CleanupStack::Pop( ); // identity
+#ifdef _DEBUG
+ TBuf<200> debug_buffer;
+ debug_buffer = nodeContent->Des();
+ PluginLogger::Log(
+ _L("PluginAuth: add pending into collection: %S"), &debug_buffer );
+#endif
+ pendings->AddObjectL( grInfo ); // ownership is taken
+ CleanupStack::Pop( ); // grInfo
+ pendingFound = ETrue;
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ }
+ }
+
+ if ( pendingFound )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: callback HandlePresenceGrantRequestListL"));
+#endif
+ iPrFwIdOwn = iDataHost->HandlePresenceGrantRequestListL( pendings );
+ CleanupStack::Pop(); // >> pendings
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( ); // >> pendings
+ }
+
+ CleanupStack::PopAndDestroy( &elems );
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandleFullWinfoNotificationL ends"));
+#endif
+
+ /* example:
+
+ <?xml version="1.0"?>
+ <watcherinfo xmlns="urn:ietf:params:xml:ns:watcherinfo"
+ version="0" state="full">
+ <watcher-list resource="sip:presentity@example.com"
+ package="presence">
+ <watcher status="active"
+ id="sr8fdsj"
+ duration-subscribed="509"
+ expiration="20"
+ event="approved">sip:watcherA@example.com"
+ </watcher>
+ */
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::HandlePartialWinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::HandlePartialWinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandlePartialWinfoNotificationL starts"));
+#endif
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KSimpleWatcherList8 );
+ User::LeaveIfError( err );
+
+ err = elem->SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ count = elems.Count();
+
+ HBufC* nodeContent = NULL;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ elem = elems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KSimpleWatcher8 )))
+ {
+ const TDesC8* pp8 = elem->AttrValue( KSimpleStatus8 );
+ if ( pp8 && !pp8->CompareF( KSimplePending8 ))
+ {
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ CallHandlePresenceGrantRequestReceivedL( nodeContent->Des() );
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ else if ( pp8 && !pp8->CompareF( KSimpleTerminated8 ))
+ {
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ CallHandlePresenceGrantRequestObsoletedL( nodeContent->Des() );
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( &elems );
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandlePartialWinfoNotificationL ends"));
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CallHandlePresenceGrantRequestReceivedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::CallHandlePresenceGrantRequestReceivedL(
+ const TDesC& aUserId )
+ {
+ // create the collection entry here
+ MPresenceGrantRequestInfo* grInfo =
+ iConnObs.PresenceObjectFactory().NewPresenceGrantRequestInfoLC(); // +grInfo
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC(); // +identity
+ identity->SetIdentityL( aUserId );
+ grInfo->SetRequestorIdL( identity ); // ownership is taken
+ CleanupStack::Pop( ); // -identity
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: callback HandlePresenceGrantRequestReceivedL"));
+#endif
+ iPrFwIdOwn = iDataHost->HandlePresenceGrantRequestReceivedL( grInfo ); // ownership is taken
+ CleanupStack::Pop( ); // -grInfo
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CallHandlePresenceGrantRequestObsoletedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::CallHandlePresenceGrantRequestObsoletedL(
+ const TDesC& aUserId)
+ {
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( aUserId );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: callback HandlePresenceGrantRequestObsoletedL"));
+#endif
+ iPrFwIdOwn = iDataHost->HandlePresenceGrantRequestObsoletedL( identity); // ownership is taken
+ CleanupStack::Pop( ); // >> identity
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::HandleSubscribeBlockListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::HandleSubscribeBlockListL()
+ {
+ RPointerArray<MXIMPIdentity> blockedSouls;
+ CleanupClosePushL( blockedSouls );
+
+ const TInt KMyGran = 10;
+ CPtrCArray* blockers = new (ELeave) CPtrCArray( KMyGran );
+ CleanupStack::PushL( blockers ); // << blockers
+
+ iXdmUtils->SubscribeBlockListL( *blockers );
+
+ CopyBlockersToArrayL( *blockers, blockedSouls );
+
+ CleanupStack::PopAndDestroy( blockers );
+
+ MXIMPObjectCollection* coll =
+ iConnObs.ObjectFactory().NewObjectCollectionLC(); // << coll
+ TInt count = blockedSouls.Count();
+ for ( TInt i = count-1; i >= 0; i-- )
+ {
+ MXIMPIdentity* currId = blockedSouls[i];
+ MPresenceBlockInfo* bInfo = iConnObs.PresenceObjectFactory().NewPresenceBlockInfoLC();
+ bInfo->SetBlockedEntityIdL( currId ); // ownership is taken
+ bInfo->SetBlockedEntityDisplayNameL( currId->Identity() );
+ blockedSouls.Remove( i );
+ coll->AddObjectL( bInfo ); // ownership is taken
+ CleanupStack::Pop(); // >> bInfo
+ }
+ CompletePrFwReq( KErrNone );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuth: callback HandlePresenceBlockListL"));
+#endif
+ // Callback for subscription result
+ iDataHost->HandlePresenceBlockListL( coll );
+
+ CleanupStack::Pop(); // >> coll
+ CleanupStack::PopAndDestroy( &blockedSouls );
+
+ // Callback for subscription state (terminated).
+ MXIMPDataSubscriptionState* myState = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+ // Notice: consider error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: callback SetPresenceBlockDataSubscriptionStateL"));
+#endif
+ iDataHost->SetPresenceBlockDataSubscriptionStateL(
+ myState, myStatus );
+ CleanupStack::Pop( 2 ); // >> myState, myStatus
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::CompletePrFwReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginAuthorization::CompletePrFwReq( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: CompletePrFwReq status=%d"), aStatus );
+#endif
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iPrFwId, aStatus );
+ iPrFwId = TXIMPRequestId();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginAuthorization::HandleIfMine
+// ---------------------------------------------------------------------------
+//
+TBool CSimplePluginAuthorization::HandleIfMine( TXIMPRequestId aReqId, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandleIfMine aStatus=%d iOper=%d"), aStatus, iOperation);
+#endif
+ TInt err = KErrNone;
+ TBool ret = EFalse;
+
+ // We check wheter the request is made by this entity.
+ if ( iPrFwId != aReqId )
+ {
+ // Nothing to do, request was not orginated by this entity.
+ }
+ else
+ {
+ if ( !aStatus )
+ {
+ switch ( iOperation )
+ {
+ case ESubscribePresenceGrantRequestList:
+ // Modify rule to CONFIRM
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandleIfMine TEST COVERS 7"));
+#endif
+ TRAP( err, DoStartXdmOperationL( aReqId, iOperation ));
+ err = CSimplePluginConnection::HarmonizeErrorCode( err );
+ ret = ETrue;
+ break;
+ // In UnsubscribePresenceGrantRequestList case the rule modifcation
+ // has been made first before SIP unsubscribe operation.
+ case EUnsubscribePresenceGrantRequestList:
+ default:
+ iWinfoSubs = EFalse;
+ break;
+ }
+ }
+ else
+ {
+ CompletePrFwReq( err );
+ ret = ETrue;
+ }
+ if ( err )
+ {
+ CompletePrFwReq( err );
+ ret = ETrue;
+ }
+ else
+ {
+ }
+ }
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginAuthorization: HandleIfMine returns %d"), ret );
+#endif
+ return ret;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginconnection.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,573 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+
+#include <ximpstatus.h>
+#include <ximpserviceinfo.h>
+#include <ximpcontextclientinfo.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpfeatureinfo.h>
+#include <ximpidentity.h>
+#include <ximperrors.hrh>
+#include <presenceerrors.hrh>
+
+#include <protocolpresencedatahost.h>
+
+#include "simplepluginconnection.h"
+#include "simplepluginsession.h"
+#include "simpleplugindebugutils.h"
+#include "simplepluginauthorization.h"
+#include "simplepluginwinfo.h"
+#include "simplepluginpublisher.h"
+#include "simplepluginwatcher.h"
+#include "simpleplugingroups.h"
+#include "simplepluginxdmutils.h"
+#include "simplepluginvariation.h"
+#include "msimplepluginconnectionobs.h"
+#include "msimplepluginsettings.h"
+#include "simpleerrors.h"
+
+class MXIMPObjectFactory;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CSimplePluginConnection
+// ---------------------------------------------------------------------------
+//
+CSimplePluginConnection::CSimplePluginConnection()
+: iSipPresentity(NULL)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginConnection* CSimplePluginConnection::NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo )
+ {
+ CSimplePluginConnection* self = new( ELeave ) CSimplePluginConnection( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceInfo, aClientCtxInfo );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::ConstructL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& /* aClientCtxInfo */ )
+ {
+ iSession = CSimplePluginSession::NewL( aServiceInfo, *this );
+
+ iAuth = CSimplePluginAuthorization::NewL( *this );
+
+ iPublisher = CSimplePluginPublisher::NewL(
+ *this, *this,
+ *iSession->SimpleConnection() );
+
+ iWatcher = CSimplePluginWatcher::NewL(
+ *this, *this,
+ *iSession->SimpleConnection() );
+
+ iGroups = CSimplePluginGroups::NewL(
+ *this );
+
+ iPluginWinfo = CSimplePluginWinfo::NewL(
+ *this, *(iSession->SimpleConnection()));
+
+ iVariation = CSimplePluginVariation::NewL();
+ iVariation->InitL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::~CSimplePluginConnection
+// ---------------------------------------------------------------------------
+//
+CSimplePluginConnection::~CSimplePluginConnection()
+ {
+
+ delete iSipPresentity;
+
+ delete iVariation;
+ delete iPluginWinfo;
+ delete iWatcher;
+ delete iPublisher;
+ delete iAuth;
+ delete iGroups;
+ delete iSession;
+
+ delete iXdmUtils;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PrimeHost
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::PrimeHost( MXIMPProtocolConnectionHost& aHost )
+ {
+ iConnectionHost = &aHost;
+ iAuth->SetDataHost( iConnectionHost->ProtocolPresenceDataHost().AuthorizationDataHost() );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::ProtocolPresenceFeatures
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceFeatures& CSimplePluginConnection::ProtocolPresenceFeatures()
+ {
+ return *this;
+ }
+
+/*<branchInfo originator="gronoff" since="08-06-06" category="new_feature" error=”none”>
+<pf_5250_OFF_CYCLE_SW_INT>
+</branchInfo>*/
+// BRANCH 08-06-17 : gronoff
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetProtocolInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginConnection::GetProtocolInterface( TInt /*aInterfaceId*/ )
+ {
+ return NULL;
+ }
+// BRANCH_END 08-06-17 : gronoff
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PresenceWatching
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceWatching& CSimplePluginConnection::PresenceWatching()
+ {
+ return *iWatcher;
+ }
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PresencePublishing
+// ---------------------------------------------------------------------------
+//
+MProtocolPresencePublishing& CSimplePluginConnection::PresencePublishing()
+ {
+ return *iPublisher;
+ }
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PresentityGroups
+// ---------------------------------------------------------------------------
+//
+MProtocolPresentityGroups& CSimplePluginConnection::PresentityGroups()
+ {
+ return *iGroups;
+ }
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PresenceAuthorization
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceAuthorization& CSimplePluginConnection::PresenceAuthorization()
+ {
+ return *iAuth;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::OpenSessionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::OpenSessionL(
+ const TInt& aSettingsId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: OpenSessionL"));
+#endif
+ iPrFwId = aReqId;
+ TRAPD( err, iSession->OpenSessionL( aSettingsId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::OpenSessionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::OpenSessionL(
+ const MXIMPContextClientInfo& /*aClientCtxInfo*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: OpenSessionL - error: not supported"));
+#endif
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CloseSession
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::CloseSession(
+ const MXIMPContextClientInfo& /*aClientCtxInfo*/,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CloseSession"));
+#endif
+ iPrFwId = aReqId;
+
+ delete iPluginWinfo;
+ iPluginWinfo = NULL;
+ delete iWatcher;
+ iWatcher = NULL;
+ delete iPublisher;
+ iPublisher = NULL;
+ delete iAuth;
+ iAuth = NULL;
+ delete iSession;
+ iSession = NULL;
+ delete iGroups;
+ iGroups = NULL;
+ delete iXdmUtils;
+ iXdmUtils = NULL;
+
+ CompleteReq( iPrFwId, KErrNone );
+ }
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::GetSupportedFeaturesL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::GetSupportedFeaturesL( CDesC8Array& aFeatures ) const
+ {
+ // first empty the whole array
+ aFeatures.Reset();
+ using namespace NXIMPFeature::Presence;
+ aFeatures.AppendL( KPublish );
+ aFeatures.AppendL( KFetch );
+ aFeatures.AppendL( KSubscribe );
+ aFeatures.AppendL( KUnsubscribe );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CompleteReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::CompleteReq( TReqType aType, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CompleteReq stat=%d"), aStatus);
+#endif
+
+ TInt retVal = HarmonizeErrorCode( aStatus );
+
+ // Return immediately if PrimeHost() is not called. This is for testing purposes.
+ if ( !iConnectionHost )
+ {
+ iPrFwId = TXIMPRequestId();
+ return;
+ }
+
+ switch ( aType )
+ {
+ case EOpenSess:
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginConnection: callback HandleRequestCompleted stat=%d"), retVal);
+ PluginLogger::Log(
+ _L("PluginConnection: ------------------------------------------------1"));
+#endif
+ iConnectionHost->HandleRequestCompleted( iPrFwId, retVal );
+ iPrFwId = TXIMPRequestId();
+ break;
+ default:
+ break;
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CompleteReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::CompleteReq( TXIMPRequestId aReqId, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CompleteReq stat=%d"), aStatus);
+#endif
+
+ TInt retVal = HarmonizeErrorCode( aStatus );
+
+ // Return immediately if PrimeHost() is not called. This is for testing purposes.
+ if ( !iConnectionHost )
+ {
+ return;
+ }
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginConnection: callback HandleRequestCompleted stat=%d"), retVal);
+ PluginLogger::Log(
+ _L("PluginConnection: ------------------------------------------------2"));
+#endif
+ iConnectionHost->HandleRequestCompleted( aReqId, retVal );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CompleteWinfoReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::CompleteWinfoReq( TXIMPRequestId aReqId, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CompleteWinfoReq stat=%d"), aStatus);
+#endif
+
+ if ( iAuth && iAuth->HandleIfMine( aReqId, aStatus ))
+ {
+ // Nothing to do, the request in not complete yet
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CompleteWinfoReq waits ***"), aStatus);
+#endif
+ }
+ else
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginConnection: CompleteWinfoReq completes ***"), aStatus);
+#endif
+ CompleteReq( aReqId, aStatus );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::ObjectFactory
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectFactory& CSimplePluginConnection::ObjectFactory()
+ {
+ return iConnectionHost->ObjectFactory();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::PresenceObjectFactory
+// ---------------------------------------------------------------------------
+//
+MPresenceObjectFactory& CSimplePluginConnection::PresenceObjectFactory()
+ {
+ return iConnectionHost->ProtocolPresenceDataHost().PresenceObjectFactory();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::Host
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnectionHost* CSimplePluginConnection::Host()
+ {
+ return iConnectionHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CurrentDomain
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CSimplePluginConnection::CurrentDomain()
+ {
+ return iSession->CurrentDomain();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::Variation
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation& CSimplePluginConnection::Variation()
+ {
+ return *iVariation;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CurrentSipPresentity
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CSimplePluginConnection::CurrentSipPresentity()
+ {
+ delete iSipPresentity;
+ iSipPresentity = NULL;
+ TRAPD( err, iSipPresentity = HBufC16::NewL( iSession->CurrentSipPresentity().Length() ));
+
+ if ( !err )
+ {
+ iSipPresentity->Des().Copy( iSession->CurrentSipPresentity() );
+ return iSipPresentity->Des();
+ }
+ else
+ {
+ return TPtrC16();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::CurrentSipPresentit8
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimplePluginConnection::CurrentSipPresentity8()
+ {
+ return iSession->CurrentSipPresentity();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::XdmUtilsL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginXdmUtils* CSimplePluginConnection::XdmUtilsL()
+ {
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = CSimplePluginXdmUtils::NewL(
+ *this, iSession->XdmSettingsId() );
+ }
+ return iXdmUtils;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::WinfoHandlerL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWinfo* CSimplePluginConnection::WinfoHandlerL()
+ {
+ if ( !iPluginWinfo )
+ {
+ iPluginWinfo = CSimplePluginWinfo::NewL(
+ *this, *(iSession->SimpleConnection() ));
+ }
+ iPluginWinfo->SetHost( iConnectionHost );
+ return iPluginWinfo;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::WinfoTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::WinfoTerminatedL( TInt aReason )
+ {
+ // Pass the information to iAuth and iPublisher,
+ // so that they can call PrFw Plugin Data Host callbacks.
+ iAuth->WinfoTerminatedL( aReason );
+ iPublisher->WinfoTerminatedL( aReason );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::WinfoNotification
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginConnection::WinfoNotification( MSimpleWinfo& aWinfo )
+ {
+ TRAP_IGNORE( iPublisher->WinfoNotificationL( aWinfo ));
+ TRAP_IGNORE( iAuth->WinfoNotificationL( aWinfo ));
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::GetInterface
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginConnection::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MXIMPProtocolConnection* myIf = this;
+ return myIf;
+ }
+ if( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::GetInterface
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePluginConnection::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MXIMPProtocolConnection* myIf = this;
+ return myIf;
+ }
+ if( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::GetInterfaceId
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePluginConnection::GetInterfaceId() const
+ {
+ return MXIMPProtocolConnection::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginConnection::HarmonizeErrorCode
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginConnection::HarmonizeErrorCode( TInt aStatus )
+ {
+
+ TInt retVal = aStatus;
+
+ // Convert error codes outsise e32err.h error range into PrFw errors.
+
+ switch ( aStatus )
+ {
+ case KSimpleErrAuthorization:
+ retVal = KPresenceErrNotEnoughCredits;
+ break;
+ case KSimpleErrTimeout:
+ case KErrTimedOut:
+ retVal = KXIMPErrServicRequestTimeouted;
+ break;
+ default:
+ {
+ if ( aStatus < KSimplePluginGeneralErrorLow )
+ {
+ retVal = KXIMPErrServiceGeneralError;
+ }
+ }
+ break;
+ };
+
+ return retVal;
+ }
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simpleplugindata.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,776 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+
+// *** system include files go here:
+#include <e32std.h>
+#include <s32strm.h>
+#include <utf.h>
+
+#include <presenceobjectfactory.h>
+#include <presenceinfo.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofieldcollection.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceinfofieldvaluebinary.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceerrors.hrh>
+
+#include <ximpobjectfactory.h>
+#include <ximpidentity.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+
+#include <msimpledocument.h>
+#include <msimpleelement.h>
+#include <msimplepresencelist.h>
+#include <msimplemeta.h>
+#include <msimplecontent.h>
+#include <simpleutils.h>
+#include <simplefactory.h>
+
+#include "simpleplugindata.h"
+#include "simpleplugincommon.h"
+#include "simpleplugindebugutils.h"
+
+
+// ----------------------------------------------------------
+// CSimplePluginData::CSimplePluginData
+// ----------------------------------------------------------
+//
+CSimplePluginData::CSimplePluginData( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::~CSimplePluginData
+// ---------------------------------------------------------------------------
+//
+CSimplePluginData::~CSimplePluginData()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginData* CSimplePluginData::NewL( )
+ {
+ CSimplePluginData* self = CSimplePluginData::NewLC( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::NewLC
+// ---------------------------------------------------------------------------
+//
+CSimplePluginData* CSimplePluginData::NewLC( )
+ {
+ CSimplePluginData* self = new( ELeave ) CSimplePluginData;
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::ConstructL( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::NotifyToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::NotifyToPrInfoL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleDocument& aDocument,
+ MPresenceInfo& aPrInfo )
+ {
+ MPersonPresenceInfo* persInfo = aPresenceFactory.NewPersonPresenceInfoLC();
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ // Search own person info. Notice: Extend supported attributes later
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aDocument.SimpleElementsL( elems );
+
+ if ( !err )
+ {
+ TInt myLatestPosition = SearchLatestTimestampL( elems );
+
+ if ( myLatestPosition != KErrNotFound )
+ {
+ MSimpleElement* elem = elems[myLatestPosition];
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ // person element found
+ RPointerArray<MSimpleElement> elems2;
+ CleanupClosePushL( elems2 );
+ elem->SimpleElementsL( elems2 );
+ TInt count2 = elems2.Count();
+
+ for ( TInt j = 0; j < count2; j++ )
+ {
+ MSimpleElement* elem2 = elems2[j];
+ if ( !elem2->LocalName().CompareF( KSimpleOverridingwillingness8 ))
+ {
+ UserOverridingWillingnessToPrFwL( aPresenceFactory, elem2, coll );
+ }
+ else if ( !elem2->LocalName().CompareF( KSimpleStatusicon8 ))
+ {
+ UserStatusIconToPrFwL( aPresenceFactory, elem2, coll, aDocument );
+ }
+ else if ( !elem2->LocalName().CompareF( KSimpleNote8 ))
+ {
+ UserNoteToPrFwL( aPresenceFactory, elem2, coll );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &elems2 );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &elems );
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::UserOverridingWillingnessToPrFwL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::UserOverridingWillingnessToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: UserOverridingWillingnessToPrFwL") );
+#endif
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ User::LeaveIfError( aElement->SimpleElementsL( elems ));
+ MSimpleElement* elem3 = elems[0]; // notice: we assume that there is no other sub-elements
+ if ( !elem3->LocalName().CompareF( KSimpleBasic8 ))
+ {
+ // write the data into text field.
+ HBufC* nodeContent = elem3->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ if ( nodeContent )
+ {
+ // Save availability
+ using namespace NPresenceInfo::NFieldType;
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailability );
+ MPresenceInfoFieldValueText* text = aPresenceFactory.NewTextInfoFieldLC();
+ text->SetTextValueL( nodeContent->Des() );
+ field->SetFieldValue( text );
+ CleanupStack::Pop(); // >> text
+ aCollection.AddOrReplaceFieldL( field );
+ CleanupStack::Pop(); // >> field
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ CleanupStack::PopAndDestroy( &elems ); // close the array, do not delete the content
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::UserStatusIconToPrFwL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::UserStatusIconToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection,
+ MSimpleDocument& aDocument )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: UserStatusIconToPrFwL") );
+#endif
+ using namespace NSimpleDocument;
+
+ using namespace NPresenceInfo::NFieldType;
+
+ HBufC* nodeContent = aElement->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ if ( nodeContent )
+ {
+ RPointerArray<MSimpleContent> contents;
+ CleanupClosePushL( contents );
+
+ // Search the corresponding direct content
+ aDocument.GetDirectContentsL( contents );
+
+ TInt contCount = contents.Count();
+ for ( TInt i = 0; i<contCount; i++ )
+ {
+ TPtrC8 id = (contents[i])->ContentID();
+ // nodecontent = "cid:simple.avatar.com"
+ // content-id: simple.avatar.com
+ HBufC8* cid8 = NULL;
+ cid8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( nodeContent->Des() );
+ CleanupStack::PushL( cid8 ); // << cid8
+
+ TInt contentLen = cid8->Des().Length() - 4; // "cid:"
+ TInt headLen = id.Length();
+ TPtrC8 pUnquoted( KNullDesC8 );
+ if ( id.Locate('"') == 0 )
+ {
+ // remove "..." characters
+ pUnquoted.Set( id.Mid( 1, headLen-2 ));
+ }
+ else
+ {
+ pUnquoted.Set( id );
+ }
+ TInt foundPos = cid8->Des().Find( pUnquoted );
+ if ( contentLen == headLen && foundPos >= 0 )
+ {
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvatar );
+ MPresenceInfoFieldValueBinary* val = aPresenceFactory.NewBinaryInfoFieldLC();
+ val->SetMimeTypeL( (contents[i])->ContentType() );
+ // Body is not BASE64 encoded internally
+ val->SetBinaryValueL( (contents[i])->Body() );
+ field->SetFieldValue( val );
+ CleanupStack::Pop(); // >> val
+ aCollection.AddOrReplaceFieldL( field );
+ CleanupStack::Pop(); // >> field
+ }
+ CleanupStack::PopAndDestroy( cid8 ); // >> cid8
+ }
+ CleanupStack::PopAndDestroy( &contents );
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::UserNoteToPrFwL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::UserNoteToPrFwL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: UserNoteToPrFwL") );
+#endif
+ // using namespace NSimplePlugin::NSimpleOma;
+ HBufC* nodeContent = aElement->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ if ( nodeContent )
+ {
+ // Save note, convert from unicode
+ // notice: consider xml::lang-attribute
+ // note <-> KStatusMessage
+ using namespace NPresenceInfo::NFieldType;
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KStatusMessage );
+ MPresenceInfoFieldValueText* text = aPresenceFactory.NewTextInfoFieldLC();
+ text->SetTextValueL( nodeContent->Des() );
+ field->SetFieldValue( text );
+ CleanupStack::Pop(); // >> text
+ aCollection.AddOrReplaceFieldL( field );
+ CleanupStack::Pop(); // >> field
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::NotifyListToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::NotifyListToPrInfoL(
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimplePresenceList& aList,
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ TBool& aFullList )
+ {
+ // Split array into individual prInfos
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: NotifyListToPrInfoL") );
+#endif
+
+ RPointerArray<MSimpleDocument> docs;
+ CleanupClosePushL( docs );
+ // get documents, ownership is not transferred.
+ aList.GetDocuments( docs );
+
+ CollectAllPresentitiesL( aEntities, aActives, docs, aFactory, aPresenceFactory );
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ MSimpleMeta* meta = aList.MetaData();
+
+#ifdef _DEBUG
+ // TODO: remove
+ if ( meta == NULL )
+ PluginLogger::Log(_L("PluginData: META Is NULL !!! *****"));
+#endif
+
+
+
+ // ownership in not transferred
+ if ( meta && !meta->LocalName().CompareF( KSimpleList8 ))
+ {
+ // list element found, find out if fullstate
+ const TDesC8* fullStateVal = meta->AttrValue( KSimpleFullState8 );
+ if ( fullStateVal && !fullStateVal->CompareF( KSimpleTrue8 ))
+ {
+ aFullList = ETrue;
+ }
+ else
+ {
+ aFullList = EFalse;
+ }
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: fullState === %d"), aFullList );
+#endif
+
+ // Search "terminated" presentities
+ RPointerArray<MSimpleElement> elems2;
+ CleanupClosePushL( elems2 );
+ meta->SimpleElementsL( elems2);
+ CollectTerminatedPresentitiesL( aTerminated, elems2, aFactory );
+ CleanupStack::PopAndDestroy( &elems2 );
+ }
+
+ CleanupStack::PopAndDestroy( &docs );
+ }
+
+ /*
+ example:
+ Content-Transfer-Encoding: binary
+ Content-ID: <nXYxAE@pres.vancouver.example.com>
+ Content-Type: application/rlmi+xml;charset="UTF-8"
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <list xmlns="urn:ietf:params:xml:ns:rlmi"
+ uri="sip:adam-friends@pres.vancouver.example.com"
+ version="1" fullState="true">
+ <name xml:lang="en">Buddy List at COM</name>
+ <name xml:lang="de">Liste der Freunde an COM</name>
+ <resource uri="sip:bob@vancouver.example.com""> <------- note
+ <name>Bob Smith</name>
+ <instance id="juwigmtboe" state="active"
+ cid="bUZBsM@pres.vancouver.example.com"/>
+ </resource>
+ <resource uri="sip:dave@vancouver.example.com">
+ <name>Dave Jones</name>
+ <instance id="hqzsuxtfyq" state="active"
+ cid="ZvSvkz@pres.vancouver.example.com"/>
+ </resource>
+ <resource uri="sip:ed@dallas.example.net">
+ <name>Ed at NET</name>
+ </resource>
+ <resource uri="sip:adam-friends@stockholm.example.org">
+ <name xml:lang="en">My Friends at ORG</name>
+ <name xml:lang="de">Meine Freunde an ORG</name>
+ </resource>
+ </list>
+ */
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::AddPrPersToSimpleDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::AddPrPersToSimpleDocumentL(
+ const MPersonPresenceInfo* aInfo,
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId )
+ {
+ using namespace NSimpleDocument;
+
+ TPtrC8 p8( KSimpleAvatarCIDURI8 );
+ TInt bufSize = p8.Length();
+
+ HBufC16* CIDcontent = HBufC16::NewLC( bufSize ); // << CID
+ CIDcontent->Des().Copy( KSimpleAvatarCIDURI8 );
+
+ // notice: we do not generate random id but a static one.
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ aDocument.SetEntityURIL( aSipId );
+
+ MSimpleElement* persElem = aDocument.AddSimpleElementL(
+ KSimpleNsPDM, KSimplePerson8 );
+ CleanupClosePushL( *persElem ); // << persElem
+
+ using namespace NPresenceInfo::NFieldType;
+
+ const MPresenceInfoFieldCollection& coll = aInfo->Fields();
+
+ TInt myCount = coll.FieldCount();
+ for ( TInt i = 0; i < myCount; i++ )
+ {
+ const MPresenceInfoField& field = coll.FieldAt( i );
+ const TDesC8& fieldType = field.FieldType();
+ const MXIMPBase& storage = field.FieldValue();
+
+ // Notice: tuple id saving for partial data in future.
+
+ /*
+ Mapping:
+ Avatar -> Person/status-icon
+ status-msg -> Person/note
+ Availability -> Person/overriding-willingness
+ */
+
+ if ( !fieldType.CompareF( KAvatar ) )
+ {
+ const MPresenceInfoFieldValueBinary* bin =
+ TXIMPGetInterface< const MPresenceInfoFieldValueBinary >::From( storage,
+ MXIMPBase::EReturnNullIfUnknown );
+ if ( bin )
+ {
+ MSimpleElement* elem = persElem->AddSimpleElementL(
+ KSimpleNsRPID,
+ KSimpleStatusicon8 );
+ CleanupClosePushL( *elem ); // << elem
+ elem->SetContentUnicodeL( CIDcontent->Des());
+ // Create the MIME multipart content
+ MSimpleContent* content = TSimpleFactory::NewContentL(
+ KSimpleAvatarContent8, bin->MimeType() );
+ CleanupClosePushL( *content ); // << content
+ content->CopyBodyL( bin->BinaryValue( ) );
+ aDocument.AddDirectContentL( *content, EFalse );
+ CleanupStack::PopAndDestroy( content ); // >> content
+ CleanupStack::PopAndDestroy( elem ); // >> elem
+ }
+ }
+ else if ( !fieldType.CompareF( KStatusMessage ) )
+ {
+ const MPresenceInfoFieldValueText* text =
+ TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( storage,
+ MXIMPBase::EReturnNullIfUnknown );
+ if ( text )
+ {
+ MSimpleElement* elem = persElem->AddSimpleElementL(
+ KSimpleNsPDM,
+ KSimpleNote8 );
+ CleanupClosePushL( *elem ); // << elem
+ elem->SetContentUnicodeL( text->TextValue() );
+ CleanupStack::PopAndDestroy( elem ); // >> elem
+ }
+ }
+ else if ( !fieldType.CompareF( KAvailability ))
+ {
+ const MPresenceInfoFieldValueText* text =
+ TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( storage,
+ MXIMPBase::EReturnNullIfUnknown );
+ if ( text )
+ {
+ AddPrPersAvailabilityToDocL( text, persElem );
+ }
+ }
+ else
+ {
+ // Notice: currently all the fields in the namespace are supported,
+ // but this ensures that if namespace is extended later, it is
+ // handled right way in the adaptation
+ User::Leave( KPresenceErrPresenceInfoFieldTypeNotSupported );
+ }
+ }
+ CleanupStack::PopAndDestroy( persElem );
+ CleanupStack::PopAndDestroy( CIDcontent );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::CollectAllPresentitiesL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::CollectAllPresentitiesL(
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MSimpleDocument>& aDocs,
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory )
+ {
+ TInt count = aDocs.Count();
+
+ // active presentities
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MPresenceInfo* info = aPresenceFactory.NewPresenceInfoLC(); // << info
+ aEntities.Append( info );
+ // aEntities may contain entries even this method leaves
+ CleanupStack::Pop(); // >> info
+
+ NotifyToPrInfoL( aPresenceFactory, *aDocs[i], *info );
+
+ // Add SIP identity to active users list
+ MXIMPIdentity* active = aFactory.NewIdentityLC(); // << active
+ aActives.Append( active );
+ CleanupStack::Pop(); // >> active
+
+ // Convert SIP entity URI from UTF to Unicode.
+ const TDesC8* pUri8 = (aDocs[i])->EntityURI();
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *pUri8 );
+ CleanupStack::PushL( uri16 ); // << uri16
+ active->SetIdentityL( uri16->Des() );
+
+#ifdef _DEBUG
+ // ---------------------------------------------------------
+ TBuf<200> buffer2;
+ buffer2.Copy(uri16->Des());
+ const MPersonPresenceInfo* pers_debug = info->PersonPresence();
+ const MPresenceInfoFieldCollection& coll_debug = pers_debug->Fields();
+ TInt count_debug = coll_debug.FieldCount();
+ PluginLogger::Log(_L("PluginData: nbr of fields received =%d"), count_debug );
+ PluginLogger::Log(_L("PluginData: User added to actives: %S"), &buffer2 );
+ // ---------------------------------------------------------
+#endif
+ CleanupStack::PopAndDestroy( uri16 ); // >> uri16
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::CollectTerminatedPresentitiesL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::CollectTerminatedPresentitiesL(
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ RPointerArray<MSimpleElement>& aElems,
+ MXIMPObjectFactory& aFactory )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: CollectTerminatedPresentitiesL"));
+#endif
+ using namespace NSimplePlugin::NSimpleOma;
+
+ TInt count2 = aElems.Count();
+ for ( TInt i = 0; i < count2; i++ )
+ {
+ MSimpleElement* elem2 = aElems[i];
+ if ( !elem2->LocalName().CompareF( KSimpleResource8 ))
+ {
+ // resource element
+ RPointerArray<MSimpleElement> elems3;
+ CleanupClosePushL( elems3 );
+ elem2->SimpleElementsL( elems3 );
+ TInt count3 = elems3.Count();
+ const TDesC8* uri8 = elem2->AttrValue( KSimpleUri8 );
+ if ( !uri8 )
+ {
+ continue;
+ }
+ for ( TInt j=0; j < count3; j++ )
+ {
+ MSimpleElement* elem3 = elems3[j];
+ SearchTerminatedInstanceL( aTerminated, elem3, uri8, aFactory );
+ }
+ CleanupStack::PopAndDestroy( &elems3 );
+ } // resource element
+ }// for (i); list element subelement
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: CollectTerminatedPresentitiesL ends"));
+#endif
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::SearchLatestTimestampL
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginData::SearchLatestTimestampL(
+ RPointerArray<MSimpleElement>& aElems )
+ {
+ TInt ret = KErrNotFound;
+
+ const TInt KMaxTimestamp = 40;
+ TBuf<KMaxTimestamp> myTimestamp;
+
+ // Timestamp to save the latest one person data
+ myTimestamp = KNullDesC;
+
+ // They want to get empty notifications too.
+ TInt count = aElems.Count();
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ MSimpleElement* elem = NULL;
+ TPtrC8 p8;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ elem = aElems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KSimplePerson8 )))
+ {
+
+ if ( ret == KErrNotFound )
+ {
+ // Save since the time stamp is optional, this is first <person> .
+ // the whole <person> may also be missing.
+ ret = i;
+ }
+
+ // person element found
+ RPointerArray<MSimpleElement> elems2;
+ CleanupClosePushL( elems2 );
+ elem->SimpleElementsL( elems2 );
+ TInt count2 = elems2.Count();
+
+ // Search optional timestamp element first, the latest one
+ for ( TInt j = 0; j < count2; j++ )
+ {
+ //
+ MSimpleElement* elem2 = elems2[j];
+ // Search optional timestamp element
+ if ( !elem2->LocalName().CompareF( KSimpleTimestamp8 ))
+ {
+ HBufC* nodeContent = elem2->ContentUnicodeL();
+ // Notice: Timestamp comparision assumes now
+ // that all the timestamps have a similar format.
+ if ( myTimestamp.Compare( nodeContent->Des() ) < 0 )
+ {
+ // Save latest timestamp
+ myTimestamp.Copy( nodeContent->Des() );
+ ret = i;
+ }
+ delete nodeContent;
+ }
+ }
+ CleanupStack::PopAndDestroy( &elems2 );
+ }
+ } // for
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::AddPrPersAvailabilityToDocL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::AddPrPersAvailabilityToDocL(
+ const MPresenceInfoFieldValueText* aText, MSimpleElement* aPersElem )
+ {
+ using namespace NSimplePlugin::NSimpleOma;
+
+ MSimpleElement* elem = aPersElem->AddSimpleElementL(
+ KSimpleNsOP,
+ KSimpleOverridingwillingness8 );
+ CleanupClosePushL( *elem ); // << elem
+ MSimpleElement* elem2 = elem->AddSimpleElementL(
+ KSimpleNsOP,
+ KSimpleBasic8 );
+ CleanupClosePushL( *elem2 ); // << elem2
+ if ( !aText->TextValue().CompareF( KSimpleOpen ) )
+ {
+ elem2->SetContentUnicodeL( KSimpleOpen );
+ }
+ else
+ {
+ elem2->SetContentUnicodeL( KSimpleClosed );
+ }
+ CleanupStack::PopAndDestroy( elem2 ); // >> elem2
+ CleanupStack::PopAndDestroy( elem ); // >> elem
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginData::SearchTerminatedInstanceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginData::SearchTerminatedInstanceL(
+ RPointerArray<MXIMPIdentity>& aTerminated,
+ MSimpleElement* aElem,
+ const TDesC8* uri8,
+ MXIMPObjectFactory& aFactory )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginData: SearchTerminatedInstanceL"));
+#endif
+
+ using namespace NSimplePlugin::NSimpleOma;
+ if ( !aElem->LocalName().CompareF( KSimpleInstance8 ))
+ {
+ // instance element
+ const TDesC8* stateVal = aElem->AttrValue( KSimpleState8 );
+ if ( stateVal && !stateVal->CompareF( KSimpleTerminated8 ))
+ {
+ // Add presentity into terminated list
+ MXIMPIdentity* terminated = aFactory.NewIdentityLC(); // +terminated
+ aTerminated.Append( terminated );
+ CleanupStack::Pop(); // -terminated
+
+ // Convert SIP entity URI from UTF to Unicode.
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *uri8 );
+ CleanupStack::PushL( uri16 ); // +uri16
+ terminated->SetIdentityL( uri16->Des() );
+
+#ifdef _DEBUG
+ // Debug buffer size
+ const TInt KMyBufSize = 200;
+ // ---------------------------------------------------------
+ TBuf<KMyBufSize> buffer3;
+ buffer3.Copy(uri16->Des());
+ PluginLogger::Log(_L("PluginData: SearchTerminatedInstanceL TERMINATED INSTANCE FOUND ***"));
+ PluginLogger::Log(_L("PluginData: User added to terminated: %S"), &buffer3 );
+ // ---------------------------------------------------------
+#endif
+ CleanupStack::PopAndDestroy( uri16 ); // -uri16
+ }
+ else
+ {
+ // -------------------------------------------------------------
+#ifdef _DEBUG
+ if ( stateVal != NULL )
+ {
+ // Debug buffer size
+ const TInt KMyBufSize = 100;
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *stateVal );
+ CleanupStack::PushL( uri16 ); // +uri16
+ TBuf<KMyBufSize> buffer4;
+ buffer4.Copy(uri16->Des());
+ PluginLogger::Log(_L(" STATEVAL: %S"), &buffer4 );
+ CleanupStack::PopAndDestroy( uri16 ); // -uri16
+ }
+#endif
+ // -------------------------------------------------------------
+ }
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simpleplugindebugutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DEBUG utilities, for DEBUG version only
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+
+#ifdef _DEBUG
+#include <flogger.h>
+#include <e32debug.h>
+#include <apparc.h>
+#include <bautils.h>
+
+#include "simpleplugindebugutils.h"
+
+//**********************************
+// PluginLogger
+//**********************************
+const TInt KLogBufferLength = 256;
+
+// ---------------------------------------------------------
+// PluginLogger::Log
+// ---------------------------------------------------------
+//
+void PluginLogger::Log(TRefByValue<const TDesC> aFmt,...)
+ {
+ VA_LIST list;
+ VA_START(list, aFmt);
+
+ // Print to log file
+ TBuf<KLogBufferLength> buf;
+ buf.FormatList(aFmt, list);
+
+ _LIT(KLogDir, "simple");
+ _LIT(KLogFile, "simple.txt");
+ // Write to log file
+ RFileLogger::Write(KLogDir, KLogFile, EFileLoggingModeAppend, buf);
+ }
+
+#endif // _DEBUG
+
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginentitywatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,459 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+#include <utf.h>
+
+#include <ximpdatasubscriptionstate.h>
+#include <personpresenceinfo.h>
+#include <protocolpresencewatchingdatahost.h>
+#include <presenceinfo.h>
+#include <presenceinfofieldcollection.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceobjectfactory.h>
+#include <presentitygroupmemberinfo.h>
+#include <protocolpresencedatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <ximpobjectcollection.h>
+#include <ximpobjectfactory.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+#include <ximpidentity.h>
+
+#include <simplefactory.h>
+
+#include <msimplewinfo.h>
+#include <msimplewatcher.h>
+#include <msimpledocument.h>
+#include <msimpleelement.h>
+
+#include "simpleplugincommon.h"
+#include "simplepluginentitywatcher.h"
+#include "simpleplugindebugutils.h"
+#include "simpleplugindata.h"
+#include "simpleutils.h"
+#include "simplepluginwatcher.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::CSimplePluginEntityWatcher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginEntityWatcher::CSimplePluginEntityWatcher(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CSimplePluginWatcher& aWatcher
+ )
+ : iPluginWatcher(aWatcher), iConnObs(aObs), iConnection(aConn),
+ iOperation(EPluginIdle)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::ConstructL( )
+ {
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginEntityWatcher* CSimplePluginEntityWatcher::NewL(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CSimplePluginWatcher& aWatcher )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: NewL"));
+#endif
+ CSimplePluginEntityWatcher* self =
+ new( ELeave ) CSimplePluginEntityWatcher( aObs, aConn, aWatcher );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::~CSimplePluginEntityWatcher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginEntityWatcher::~CSimplePluginEntityWatcher()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: DESTRUCTOR"));
+#endif
+ if ( iWatcher )
+ {
+ iWatcher->Close();
+ }
+ delete iEntityId;
+ delete iSimpleEntityId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::StartSubscribeL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::StartSubscribeL(
+ const TDesC8& aPresentityId )
+ {
+ delete iEntityId;
+ iEntityId = NULL;
+
+ iListSubsActive = EFalse;
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: -> SubscribeL"));
+#endif
+ iSimpleId = iWatcher->SubscribeL( aPresentityId, NULL, ETrue, EFalse );
+
+ // Save entity id after successful call
+ iEntityId = aPresentityId.AllocL();
+
+ iOperation = EPluginStart;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::StartSubscribeListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::StartSubscribeListL(
+ const TDesC8& aPresentityId )
+ {
+ delete iEntityId;
+ iEntityId = NULL;
+
+ iListSubsActive = ETrue;
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: -> SubscribeListL"));
+#endif
+ iSimpleId = iWatcher->SubscribeListL( aPresentityId, NULL, ETrue, EFalse );
+
+ // Save entity id after successful call
+ iEntityId = aPresentityId.AllocL();
+
+ iOperation = EPluginStart;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::SetSimpleNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::SetSimpleNameL(
+ const TDesC8& aPresentityId )
+ {
+ delete iSimpleEntityId;
+ iSimpleEntityId = NULL;
+
+
+ // Save entity id after successful call
+ iSimpleEntityId = aPresentityId.AllocL();
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::StopSubscribeL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::StopSubscribeL(
+ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: -> UnsubscribeL"));
+#endif
+ iSimpleId = iWatcher->UnsubscribeL( );
+ iOperation = EPluginStop;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::WatcherReqCompleteL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::WatcherReqCompleteL(
+ TInt /*aOpId*/, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: WatcherReqCompleteL"));
+#endif
+ TPluginEntityWatcherOperation orig = iOperation;
+ iOperation = EPluginIdle;
+
+ CompleteClientReq( aStatus );
+
+ if ( aStatus && ( orig == EPluginStop || orig == EPluginStart) )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: calls DeleteWatcher **"));
+#endif
+ // Delete this entity as useless
+ iPluginWatcher.DeleteWatcher( iEntityId->Des() );
+ // Do not call anything, since the method call above deletes this instance.
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::WatcherNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::WatcherNotificationL(
+ MSimpleDocument& aDocument )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: WatcherNotificationL" ));
+#endif
+
+ // No need to check the expiration here since WatcherTerminatedL
+ // is called then too.
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().WatchingDataHost();
+ MPresenceInfo* prInfo = iConnObs.PresenceObjectFactory().NewPresenceInfoLC();
+
+ CSimplePluginData::NotifyToPrInfoL( iConnObs.PresenceObjectFactory(), aDocument, *prInfo );
+
+#ifdef _DEBUG
+ // ---------------------------------------------------------
+ const MPersonPresenceInfo* pers_debug = prInfo->PersonPresence();
+ const MPresenceInfoFieldCollection& coll_debug = pers_debug->Fields();
+ TInt count_debug = coll_debug.FieldCount();
+ PluginLogger::Log(_L("PluginEntityWatcher: nbr of fields received =%d"), count_debug );
+ // ---------------------------------------------------------
+#endif
+
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* uniBuffer =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L( *aDocument.EntityURI() );
+ CleanupStack::PushL( uniBuffer ); // << uniBuffer
+ identity2->SetIdentityL( uniBuffer->Des() );
+ CleanupStack::PopAndDestroy( uniBuffer ); // >> uniBuffer
+
+ if ( iListSubsActive )
+ {
+ // Set Group Id
+ HBufC* uniBuffer2 =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L( iEntityId->Des() );
+ CleanupStack::PushL( uniBuffer2 );
+ MXIMPIdentity* gId = iConnObs.ObjectFactory().NewIdentityLC(); // << gId
+ gId->SetIdentityL( uniBuffer2->Des() );
+
+ MXIMPObjectCollection* coll =
+ iConnObs.ObjectFactory().NewObjectCollectionLC(); // << coll
+
+ iPluginWatcher.GetEntitiesInListL( uniBuffer2->Des(), *coll );
+
+ MProtocolPresentityGroupsDataHost& groupHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().GroupsDataHost();
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginEntityWatcher: callback HandlePresentityGroupContentL"));
+#endif
+ groupHost.HandlePresentityGroupContentL( gId, coll );
+
+ CleanupStack::Pop( 2 ); // >> gId, coll
+ CleanupStack::PopAndDestroy( uniBuffer2 );
+
+ // This is done only for first notification for group subscription
+ iListSubsActive = EFalse;
+ }
+
+ // PrFw Host API callback
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginEntityWatcher: callback HandleSubscribedPresentityPresenceL"));
+#endif
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+ CleanupStack::Pop(); // >> identity2
+ CleanupStack::Pop(); // >> prInfo
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::WatcherListNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::WatcherListNotificationL(
+ MSimplePresenceList& aList )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: WatcherListNotificationL" ));
+#endif
+
+ // call all the necessary callbacks, for new data + teminated ones.
+
+ // check out whether fullstate list or not
+ TBool fullState( EFalse );
+
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().WatchingDataHost();
+
+ RPointerArray<MPresenceInfo> entities;
+ RPointerArray<MXIMPIdentity> terminated;
+ RPointerArray<MXIMPIdentity> allEntities;
+
+ TRAPD( err, CSimplePluginData::NotifyListToPrInfoL(
+ iConnObs.ObjectFactory(), iConnObs.PresenceObjectFactory(),
+ aList, entities, allEntities, terminated, fullState ));
+ if ( err )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: WatcherListNotificationL error *" ));
+#endif
+ entities.ResetAndDestroy();
+ terminated.ResetAndDestroy();
+ allEntities.ResetAndDestroy();
+ entities.Close();
+ terminated.Close();
+ allEntities.Close();
+ return;
+ }
+
+ CompleteClientReq( KErrNone );
+
+ // Call HandleSubscribedPresentityPresenceL for all users
+ TInt counter = entities.Count();
+ for ( TInt i = counter-1 ; i>=0; i-- )
+ {
+ // ---------------------------------------------------------
+#ifdef _DEBUG
+ const MPersonPresenceInfo* info = entities[i]->PersonPresence();
+ const MPresenceInfoFieldCollection& coll_debug = info->Fields();
+ TInt count_debug = coll_debug.FieldCount();
+
+ PluginLogger::Log(
+ _L("PluginWatcher: callback HandleSubscribedPresentityPresenceL nbrFields=%d"), count_debug );
+#endif
+ // ---------------------------------------------------------
+
+ watcherHost.HandleSubscribedPresentityPresenceL(
+ allEntities[i], entities[i] );
+ // Owenership is transferred
+ allEntities.Remove(i);
+ entities.Remove(i);
+ }
+
+ // call SetPresentityPresenceDataSubscriptionStateL for terminated users
+ counter = terminated.Count();
+ for ( TInt i = counter-1 ; i>=0; i-- )
+ {
+ MXIMPDataSubscriptionState *state = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ state->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: TEST COVERS 1"));
+ PluginLogger::Log(
+ _L("PluginWatcher: callback SetPresentityPresenceDataSubscriptionStateL"));
+#endif
+ watcherHost.SetPresentityPresenceDataSubscriptionStateL(
+ terminated[i], state, NULL );
+ CleanupStack::Pop( 1 ); // state
+ // Owenership is transferred
+ terminated.Remove(i);
+ }
+
+ entities.ResetAndDestroy();
+ terminated.ResetAndDestroy();
+ allEntities.ResetAndDestroy();
+
+ entities.Close();
+ terminated.Close();
+ allEntities.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::WatcherTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::WatcherTerminatedL(
+ TInt /*aOpId*/, TInt /*aReason*/ )
+ {
+ // Call PrFw Host and tell to CSimplePluginWatcher that
+ // this entity can be deleted.
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginEntityWatcher: WatcherTerminatedL" ));
+#endif
+
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().WatchingDataHost();
+ MXIMPDataSubscriptionState *state = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* status = iConnObs.ObjectFactory().NewStatusLC();
+ state->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+ status->SetResultCode( KErrCompletion );
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+
+ HBufC16* buf16 = HBufC16::NewLC( PresentityId().Length());
+ buf16->Des().Copy( PresentityId() );
+ identity->SetIdentityL( buf16->Des() );
+ CleanupStack::PopAndDestroy( buf16 );
+
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: callback SetPresentityPresenceDataSubscriptionStateL"));
+#endif
+ watcherHost.SetPresentityPresenceDataSubscriptionStateL(
+ identity, state, status );
+ CleanupStack::Pop( 3 ); // identity, status, state
+
+ // Delete this entity as useless
+ iPluginWatcher.DeleteWatcher( iEntityId->Des() );
+ // Do not call anything, since the method call above deletes this instance.
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::CompleteClientReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginEntityWatcher::CompleteClientReq( TInt aStatus )
+ {
+ // complete the open PrFw request immediately here!
+ iPluginWatcher.CompleteWatcher( aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::PresentityId
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimplePluginEntityWatcher::PresentityId( )
+ {
+ return iEntityId ? iEntityId->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginEntityWatcher::PrFwRequestId
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CSimplePluginEntityWatcher::PrFwRequestId( )
+ {
+ return iPrFwId;
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simpleplugingroups.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,893 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+
+#include <presentitygroupinfo.h>
+#include <presenceobjectfactory.h>
+#include <presentitygroupmemberinfo.h>
+#include <protocolpresencedatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <ximpdatasubscriptionstate.h>
+#include <ximpidentity.h>
+#include <ximpobjectfactory.h>
+#include <ximpobjectcollection.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+
+#include <simplefactory.h>
+#include <msimpleconnection.h>
+
+#include <pressettingsapi.h>
+#include <cpresencexdm.h>
+#include <rlspresxdmconsts.h>
+#include <XdmErrors.h>
+#include <presenceerrors.hrh>
+
+#include "simpleplugingroups.h"
+#include "simpleplugindebugutils.h"
+#include "simplepluginxdmutils.h"
+#include "simpleplugincommon.h"
+#include "simplepluginconnection.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CSimplePluginGroups
+// ---------------------------------------------------------------------------
+//
+CSimplePluginGroups::CSimplePluginGroups(
+ MSimplePluginConnectionObs& aObs )
+: CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iSubscribed(KSimplePluginSubsNone),
+ iOperation( ENoOperation),
+ iState( EPluginIdle ), iCompleted( ETrue )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::ConstructL( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginGroups* CSimplePluginGroups::NewL(
+ MSimplePluginConnectionObs& aObs )
+ {
+ CSimplePluginGroups* self =
+ new( ELeave ) CSimplePluginGroups( aObs );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::~CSimplePluginGroups
+// ---------------------------------------------------------------------------
+//
+CSimplePluginGroups::~CSimplePluginGroups()
+ {
+ delete iPresIdentity;
+ delete iPresIdentity2;
+ delete iDisplayName;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoSubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoSubscribePresentityGroupListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoSubscribePresentityGroupListL"));
+#endif
+
+ iCompleted = EFalse;
+
+ // List of lists under OMa buddylist
+ StartXdmOperationL( aReqId, EGetListOfLists );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoUnsubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoUnsubscribePresentityGroupListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoUnsubscribePresentityGroupListL"));
+#endif
+ iPrFwId = aReqId;
+ iCompleted = EFalse;
+ CompletePrFwReq( KErrNone );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoCreatePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoCreatePresentityGroupL"));
+#endif
+ iCompleted = EFalse;
+ StartXdmOperationL(
+ aGroupId, aDisplayName, aReqId, ECreatePresentityGroup );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoDeletePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoDeletePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoDeletePresentityGroupL"));
+#endif
+ iCompleted = EFalse;
+ StartXdmOperationL( aGroupId, aReqId, EDeletePresentityGroup );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoUpdatePresentityGroupDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoUpdatePresentityGroupDisplayNameL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const TDesC16& /*aDisplayName*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoUpdatePresentityGroupDisplayNameL"));
+#endif
+ // Notice: not supported.
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoSubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoSubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoSubscribePresentityGroupContentL"));
+#endif
+ iCompleted = EFalse;
+
+ // List of lists under OMa buddylist
+ StartXdmOperationL( aGroupId, aReqId, EGetListContent );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoUnsubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoUnsubscribePresentityGroupContentL(
+ const MXIMPIdentity& /*aGroupId*/,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoUnsubscribePresentityGroupContentL"));
+#endif
+ iCompleted = EFalse;
+ iPrFwId = aReqId;
+ CompletePrFwReq( KErrNone );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoAddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoAddPresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aMemberDisplayName,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoAddPresentityGroupMemberL"));
+#endif
+ iCompleted = EFalse;
+ StartXdmOperationL(
+ aGroupId, aMemberId, aMemberDisplayName,
+ aReqId, EAddPresentityGroupMember );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoRemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoRemovePresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoRemovePresentityGroupMemberL"));
+#endif
+ iCompleted = EFalse;
+ StartXdmOperationL(
+ aGroupId, aMemberId,
+ aReqId, ERemovePresentityGroupMember );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoUpdatePresentityGroupMemberDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoUpdatePresentityGroupMemberDisplayNameL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MXIMPIdentity& /*aMemberId*/,
+ const TDesC16& /*aMemberDisplayName*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginGroups: DoUpdatePresentityGroupMemberDisplayNameL"));
+#endif
+ // Notice: Not supported.
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoCancel( )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: DoCancel"));
+#endif
+ if ( iOperation != ENoOperation )
+ {
+ iXdmUtils->Cancel();
+ }
+ else
+ {
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::RunL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::RunL( )
+ {
+ TInt myStatus = iStatus.Int();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: RunL status=%d active=%d"), myStatus, IsActive() );
+#endif
+
+ if ( !myStatus )
+ {
+ // OK resposne
+ CallActualXdmOperationL();
+ }
+ else
+ {
+ if ( iOperation == EDeletePresentityGroup && iState == EPluginCommitRls )
+ {
+ // Igonere RLS deletion failure and contine Shared XDM deletion
+ CallActualXdmOperationL();
+ }
+ else
+ {
+ // Other errors terminated the show
+ CompletePrFwReq( myStatus );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CallActualXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::CallActualXdmOperationL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: CallActualXdmOperationL operation=%d"), iOperation );
+#endif
+
+ switch ( iOperation )
+ {
+ case ECreatePresentityGroup:
+ HandleCreatePresentityGroupL( iPresIdentity->Des(), iDisplayName->Des() );
+ break;
+ case EDeletePresentityGroup:
+ HandleDeletePresentityGroupL( iPresIdentity->Des() );
+ break;
+ case EAddPresentityGroupMember:
+ HandleAddPresentityGroupMemberL();
+ break;
+ case ERemovePresentityGroupMember:
+ HandleRemovePresentityGroupMemberL();
+ break;
+ case EGetListOfLists:
+ GetListOfListsL();
+ break;
+ case EGetListContent:
+ GetListContentL();
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginGroups::RunError( TInt aError )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: RunError %d active=%d"), aError, IsActive());
+#endif
+ // complete the open request
+ CompletePrFwReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginGroups::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresentityGroups* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePluginGroups::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresentityGroups* myIf = this;
+ return myIf;
+ }
+ else if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePluginGroups::GetInterfaceId() const
+ {
+ return MProtocolPresentityGroups::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId )
+ {
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::SetPresIdentity2L()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::SetPresIdentity2L(
+ const MXIMPIdentity& aPresentityId )
+ {
+ delete iPresIdentity2;
+ iPresIdentity2 = NULL;
+ iPresIdentity2 = aPresentityId.Identity().AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ SetPresIdentityL( aId );
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ SetPresIdentityL( aId );
+
+ delete iDisplayName;
+ iDisplayName = NULL;
+ iDisplayName = aDisplayName.AllocL();
+
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ SetPresIdentityL( aId );
+ SetPresIdentity2L( aMemberId );
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ SetPresIdentityL( aId );
+ SetPresIdentity2L( aMemberId );
+
+ delete iDisplayName;
+ iDisplayName = NULL;
+ iDisplayName = aDisplayName.AllocL();
+
+ iPrFwId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::StartXdmOperationL()
+ {
+ TRAPD( err, DoStartXdmOperationL() );
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ else
+ {
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::DoStartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::DoStartXdmOperationL()
+ {
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ else
+ {
+ }
+
+ // Delete Group is the only method that access XDM rules,
+ // others access shared lists only.
+ if ( iOperation != EDeletePresentityGroup )
+ {
+ iXdmUtils->InitializeXdmsOnlyL( iStatus );
+ }
+ else
+ {
+ iXdmUtils->InitializeXdmL( iStatus );
+ }
+
+ iState = EPluginInitXdm;
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::GetListOfListsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::GetListOfListsL()
+ {
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().GroupsDataHost();
+
+ // This searches data from the local cache only.
+ MXIMPObjectCollection* userLists =
+ myFactory.NewObjectCollectionLC(); // << userLists
+
+ const TInt KMyGran = 10;
+ CDesCArrayFlat* lists = new (ELeave) CDesCArrayFlat( KMyGran );
+ CleanupStack::PushL( lists ); // << lists
+
+ CDesCArrayFlat* dNames = new (ELeave) CDesCArrayFlat( KMyGran );
+ CleanupStack::PushL( dNames ); // << dNames
+
+ iXdmUtils->GetUserListsL( *lists, *dNames );
+
+ CopyGroupArraysToCollectionL( *lists, *dNames, *userLists );
+
+ CleanupStack::PopAndDestroy( dNames ); // >> dNames
+ CleanupStack::PopAndDestroy( lists ); // >> lists
+
+ CompletePrFwReq( KErrNone );
+
+ // Callback for subscription state (terminated).
+ MXIMPDataSubscriptionState* myState =
+ myFactory.NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = myFactory.NewStatusLC();
+ // Notice: consider error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+ myState->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginGroups: callback SetPresentityGroupListDataSubscriptionStateL"));
+#endif
+ dataHost.SetPresentityGroupListDataSubscriptionStateL(
+ myState, myStatus );
+
+
+ CleanupStack::Pop( 2 ); // >> myState, myStatus
+
+ // callback for data
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: callback HandlePresentityGroupListL"));
+#endif
+ dataHost.HandlePresentityGroupListL( userLists );
+ CleanupStack::Pop(); // >> userLists
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::GetListContentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::GetListContentL()
+ {
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().GroupsDataHost();
+
+ MXIMPObjectCollection* entities =
+ myFactory.NewObjectCollectionLC(); // << entities
+
+ const TInt KMyGran = 10;
+ CPtrCArray* ids = new (ELeave) CPtrCArray( KMyGran );
+ CleanupStack::PushL( ids ); // << ids
+
+ CPtrCArray* dispNames = new (ELeave) CPtrCArray( KMyGran );
+ CleanupStack::PushL( dispNames ); // << dispNames
+
+
+ iXdmUtils->GetEntitiesInListL( iPresIdentity->Des(), *ids, *dispNames );
+
+ CopyGroupMembersToCollectionL( *ids, *dispNames, *entities );
+
+ CleanupStack::PopAndDestroy( dispNames );
+ CleanupStack::PopAndDestroy( ids );
+
+ // Complete the PrFw request
+ CompletePrFwReq( KErrNone );
+
+ // callback for data
+ MXIMPIdentity* id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginGroups: callback HandlePresentityGroupContentL ."));
+#endif
+ dataHost.HandlePresentityGroupContentL( id, entities );
+ CleanupStack::Pop(); // >> id
+ CleanupStack::Pop(); // >> entities
+
+ // Callback for subscription state (terminated).
+ id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+ MXIMPDataSubscriptionState* myState =
+ myFactory.NewDataSubscriptionStateLC(); // << myState
+ MXIMPStatus* myStatus = myFactory.NewStatusLC(); // << myStatus
+ // Notice: consider error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginGroups: callback SetPresentityGroupContentDataSubscriptionStateL"));
+#endif
+ dataHost.SetPresentityGroupContentDataSubscriptionStateL(
+ id, myState, myStatus );
+ CleanupStack::Pop( 3 ); // >> myStatus, myState, id
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CompletePrFwReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::CompletePrFwReq( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: CompletePrFwReq status=%d"), aStatus );
+#endif
+
+ if ( iCompleted )
+ {
+ return;
+ }
+
+ iCompleted = ETrue;
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iPrFwId, aStatus );
+ iPrFwId = TXIMPRequestId();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CompleteMe
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::CompleteMe( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginGroups: CompleteMe status=%d"), aStatus );
+#endif
+
+ iStatus = KRequestPending;
+ TRequestStatus* s= &iStatus;
+ User::RequestComplete( s, aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CopyGroupArraysToCollectionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::CopyGroupArraysToCollectionL(
+ CDesCArrayFlat& aLists, CDesCArrayFlat& aNames, MXIMPObjectCollection& aCollection )
+ {
+ TInt count = aLists.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ // create here the PrFW group info
+ MPresentityGroupInfo* info =
+ iConnObs.PresenceObjectFactory().NewPresentityGroupInfoLC(); // << info
+ MXIMPIdentity* id = iConnObs.ObjectFactory().NewIdentityLC(); // << id
+ id->SetIdentityL( aLists[i] );
+ info->SetGroupIdL( id );
+ CleanupStack::Pop(); // >> id
+
+ info->SetGroupDisplayNameL( aNames[i] );
+ aCollection.AddObjectL( info );
+ CleanupStack::Pop(); // >> info
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::CopyGroupMembersToCollectionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::CopyGroupMembersToCollectionL(
+ CPtrCArray& aIds, CPtrCArray& aNames, MXIMPObjectCollection& aCollection)
+ {
+ TInt count = aIds.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ // create here MPresentityGroupMemberInfo
+ MPresentityGroupMemberInfo* info =
+ iConnObs.PresenceObjectFactory().NewPresentityGroupMemberInfoLC(); // << info
+ MXIMPIdentity* id = iConnObs.ObjectFactory().NewIdentityLC(); // << id
+ id->SetIdentityL( aIds[i] );
+ info->SetGroupMemberIdL( id );
+ CleanupStack::Pop(); // >> id
+
+ info->SetGroupMemberDisplayNameL( aNames[i] );
+ aCollection.AddObjectL( info );
+ CleanupStack::Pop(); // >> info
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::HandleCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::HandleCreatePresentityGroupL(
+ const TDesC& aGroupId, const TDesC& aDispName )
+ {
+ if ( iState == EPluginInitXdm )
+ {
+ iState = EPluginCommitXdm;
+ iXdmUtils->CreateEntityGroupL( aGroupId, aDispName );
+ iXdmUtils->CommitXdmL( iStatus );
+ SetActive();
+ }
+ else
+ {
+ // We are ready
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::HandleDeletePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::HandleDeletePresentityGroupL( const TDesC& aGroupId )
+ {
+ if ( iState == EPluginInitXdm )
+ {
+ iState = EPluginFetchRls;
+ iXdmUtils->FetchRlsL( iStatus );
+ SetActive();
+ }
+ else if ( iState == EPluginFetchRls )
+ {
+ iState = EPluginCommitRls;
+ // Remove RLS service
+ iXdmUtils->RemoveRlsServiceByResourceListL( aGroupId, iStatus );
+ SetActive();
+ }
+ else if ( iState == EPluginCommitRls )
+ {
+ iState = EPluginCommitXdm;
+ iXdmUtils->DeleteEntityGroupL( aGroupId );
+ iXdmUtils->CommitXdmL( iStatus );
+ SetActive();
+ }
+ else if ( iState == EPluginCommitXdm )
+ {
+ // Delete the group from a granted rule. The following won't leave if
+ // it does not locate under the rule.
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: TEST COVERS 2 **"));
+#endif
+ iState = ERemoveGroupFromGranted;
+ iXdmUtils->RemoveGroupFromGrantedL( aGroupId, iStatus );
+ SetActive();
+ }
+ else
+ {
+ // We are ready
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::HandleAddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::HandleAddPresentityGroupMemberL( )
+ {
+ if ( iState == EPluginInitXdm )
+ {
+ iXdmUtils->AddPresentityGroupMemberL(
+ iPresIdentity->Des(), iPresIdentity2->Des(),
+ iDisplayName->Des(), iStatus );
+ iState = EPluginAddGroupMember;
+ SetActive();
+ }
+ else
+ {
+ // We are ready
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginGroups::HandleRemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginGroups::HandleRemovePresentityGroupMemberL()
+ {
+ if ( iState == EPluginInitXdm )
+ {
+ iXdmUtils->RemovePresentityGroupMemberL(
+ iPresIdentity->Des(), iPresIdentity2->Des(), iStatus );
+ iState = EPluginRemoveGroupMember;
+ SetActive();
+ }
+ else
+ {
+ // We are ready
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginpublisher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1071 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+#include <utf.h>
+
+#include <personpresenceinfo.h>
+#include <presenceinfo.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldcollection.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceinfofieldvaluebinary.h>
+#include <presenceobjectfactory.h>
+#include <presencewatcherinfo.h>
+#include <presenceerrors.hrh>
+
+#include <servicepresenceinfo.h>
+#include <devicepresenceinfo.h>
+
+#include <protocolpresencedatahost.h>
+#include <protocolpresencepublishingdatahost.h>
+
+#include <ximpdatasubscriptionstate.h>
+#include <ximperrors.hrh>
+#include <ximpidentity.h>
+#include <ximpobjectcollection.h>
+#include <ximpobjectfactory.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+
+#include <simplefactory.h>
+
+#include <msimplewinfo.h>
+#include <msimplepublisher.h>
+#include <msimplewatcher.h>
+#include <msimpledocument.h>
+#include <msimpleelement.h>
+#include <msimplecontent.h>
+
+#include "simpleplugincommon.h"
+#include "simplepluginpublisher.h"
+#include "simpleplugindebugutils.h"
+#include "simpleutils.h"
+#include "simplepluginwinfo.h"
+#include "simpleplugindata.h"
+#include "simplepluginxdmutils.h"
+#include "simplepluginconnection.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// -----------------------------------------------------------------------------
+// CSimplePluginWatcherInfo::CSimplePluginWatcherInfo
+// -----------------------------------------------------------------------------
+CSimplePluginWatcherInfo::CSimplePluginWatcherInfo( )
+ {}
+
+// -----------------------------------------------------------------------------
+// CSimplePluginWatcherInfo::~CSimplePluginWatcherInfo
+// -----------------------------------------------------------------------------
+CSimplePluginWatcherInfo::~CSimplePluginWatcherInfo()
+ {
+ delete iId;
+ delete iSipId;
+ }
+
+// ----------------------------------------------------------
+// CSimplePluginWatcherInfo::NewL
+// ----------------------------------------------------------
+//
+CSimplePluginWatcherInfo* CSimplePluginWatcherInfo::NewL(
+ const TDesC8& aId, const TDesC& aSipId )
+ {
+ CSimplePluginWatcherInfo* self = new (ELeave) CSimplePluginWatcherInfo( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aId, aSipId );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimplePluginWatcherInfo::ConstructL
+// ----------------------------------------------------------
+//
+void CSimplePluginWatcherInfo::ConstructL(
+ const TDesC8& aId, const TDesC& aSipId )
+ {
+ iId = aId.AllocL();
+ iSipId = aSipId.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginWatcherInfo::Destroy
+// -----------------------------------------------------------------------------
+void CSimplePluginWatcherInfo::Destroy()
+ {
+ iLink.Deque();
+ delete this;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginWatcherInfo::Match
+// -----------------------------------------------------------------------------
+TBool CSimplePluginWatcherInfo::Match( const TDesC8& aId, const TDesC& aSipId )
+ {
+ if ( (!iId->Des().CompareF( aId )) && (!iSipId->Des().CompareF( aSipId)) )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginWatcherInfo::SipId
+// -----------------------------------------------------------------------------
+TPtrC CSimplePluginWatcherInfo::SipId( )
+ {
+ return iSipId ? iSipId->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::CSimplePluginPublisher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginPublisher::CSimplePluginPublisher(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+: CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iConnSets( aConnSets), iConnection(aConn),
+ iSubscribed(EFalse), iSubscribedOwn(EFalse), iPublished(EFalse),
+ iWatcherList( CSimplePluginWatcherInfo::LinkOffset())
+ {
+ CActiveScheduler::Add(this);
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::ConstructL( )
+ {
+ iPublisher = TSimpleFactory::NewPublisherL( iConnection, *this );
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginPublisher* CSimplePluginPublisher::NewL(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ {
+ CSimplePluginPublisher* self =
+ new( ELeave ) CSimplePluginPublisher( aConnSets, aObs, aConn );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::~CSimplePluginPublisher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginPublisher::~CSimplePluginPublisher()
+ {
+ if ( iDocument )
+ {
+ iDocument->Close();
+ }
+
+ if ( iPublisher )
+ {
+ iPublisher->Close();
+ }
+
+ if ( iWatcher )
+ {
+ iWatcher->Close();
+ }
+
+ // delete iWatchers;
+ DeleteWatchers();
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginPublisher::DeleteWatchers
+// -----------------------------------------------------------------------------
+void CSimplePluginPublisher::DeleteWatchers()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DeleteWatchers" ) );
+#endif
+ // Delete all buffered transaction requests
+ TDblQueIter<CSimplePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimplePluginWatcherInfo* w = rIter;
+ rIter++;
+ // delete wathcer info
+ w->Destroy();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginPublisher::AddWatcherIfNotExistsL
+// -----------------------------------------------------------------------------
+void CSimplePluginPublisher::AddWatcherIfNotExistsL( const TDesC8& aId, const TDesC& aSipId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: AddWatcherIfNotExistsL" ) );
+#endif
+ TDblQueIter<CSimplePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ TBool found(EFalse);
+
+ while ( rIter )
+ {
+ CSimplePluginWatcherInfo* w = rIter;
+ rIter++;
+ found = w->Match( aId, aSipId );
+ if ( found )
+ {
+ break;
+ }
+ else
+ {
+ // continue searching
+ }
+ }
+ if ( !found )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: AddWatcherIfNotExistsL adds a watcher" ) );
+#endif
+ CSimplePluginWatcherInfo* w = CSimplePluginWatcherInfo::NewL( aId, aSipId );
+ iWatcherList.AddLast( *w );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimplePluginPublisher::RemoveWatcherIfExistsL
+// -----------------------------------------------------------------------------
+void CSimplePluginPublisher::RemoveWatcherIfExistsL( const TDesC8& aId, const TDesC& aSipId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: RemoveWatcherIfExistsL" ) );
+#endif
+ TDblQueIter<CSimplePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ TBool found(EFalse);
+
+ while ( rIter )
+ {
+ CSimplePluginWatcherInfo* w = rIter;
+ rIter++;
+ // delete wathcer info
+ found = w->Match( aId, aSipId );
+ if ( found )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: RemoveWatcherIfExistsL removes a watcher" ) );
+#endif
+ w->Destroy();
+ break;
+ }
+ else
+ {
+ // continue searching
+ }
+ }
+ }
+// -----------------------------------------------------------------------------
+// CSimplePluginPublisher::MakeCurrentWatcherListLC
+// -----------------------------------------------------------------------------
+CDesCArrayFlat* CSimplePluginPublisher::MakeCurrentWatcherListLC()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: MakeCurrentWatcherListL" ) );
+#endif
+ // No one should be added more than once
+ const TInt KMyGran = 10;
+ CDesCArrayFlat* watchers = new (ELeave) CDesCArrayFlat( KMyGran );
+ CleanupStack::PushL( watchers ); // << watchers
+
+ // add user only once here.
+ TDblQueIter<CSimplePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimplePluginWatcherInfo* w = rIter;
+ rIter++;
+
+ TInt dummy = 0;
+ if ( watchers->Find( w->SipId(), dummy ))
+ {
+ watchers->AppendL( w->SipId() );
+ }
+ else
+ {
+ // continue searching
+ }
+ }
+
+ return watchers;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoPublishOwnPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoPublishOwnPresenceL(
+ const MPresenceInfo& aOwnPresence,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoPublishOwnPresenceL"));
+#endif
+
+ const MPersonPresenceInfo* persInfo = aOwnPresence.PersonPresence();
+
+ // convert data format from PrFW to internal
+ if ( !persInfo )
+ {
+ // Notice: error codes
+ CompletePrFwReq( KErrArgument );
+ return;
+ }
+ InitializeSimpleDocumentL( );
+ AddSimpleDocumentPersL( persInfo );
+
+ TInt myCount = aOwnPresence.ServicePresenceCount();
+ for ( TInt i=0; i < myCount; i++ )
+ {
+ const MServicePresenceInfo& servInfo = aOwnPresence.ServicePresenceAt(i);
+ AddSimpleDocumentServiceL( servInfo );
+ }
+ myCount = aOwnPresence.DevicePresenceCount();
+ for ( TInt i=0; i < myCount; i++ )
+ {
+ const MDevicePresenceInfo& devInfo = aOwnPresence.DevicePresenceAt(i);
+ AddSimpleDocumentDeviceL( devInfo );
+ }
+
+ // Ensure that XDM rules exists, the show continues in RunL
+ StartXdmOperationL(aReqId );
+ iOperation = EPublishOwn;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoSubscribeOwnPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoSubscribeOwnPresenceL(
+ const MPresenceInfoFilter& /*aPif*/, // notice: aPif filter not supported
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoSubscribeOwnPresenceL"));
+#endif
+
+ StartXdmOperationL( aReqId );
+
+ iOperation = ESubscribeOwn;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoUpdateOwnPresenceSubscriptionPifL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoUpdateOwnPresenceSubscriptionPifL(
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoUpdateOwnPresenceSubscriptionPifL"));
+#endif
+ // Notice: aPif filter not supported
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoUnsubscribeOwnPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoUnsubscribeOwnPresenceL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoUnsubscribeOwnPresenceL"));
+#endif
+ iSubscribedOwn = EFalse;
+ TRAPD( err, iSimpleId = iWatcher->UnsubscribeL());
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ iPrFwId = aReqId;
+ iOperation = EUnsubscribeOwn;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoSubscribePresenceWatcherListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoSubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoSubscribePresenceWatcherListL"));
+#endif
+
+ if ( !iSubscribed )
+ {
+ TRAPD( err, iConnObs.WinfoHandlerL()->SubscribeWinfoListL( aReqId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ iSubscribed = ETrue;
+ iPrFwId = aReqId;
+ iOperation = ESubscribeWinfo;
+ }
+ else
+ {
+ iPrFwId = aReqId;
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoUnsubscribePresenceWatcherListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoUnsubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: DoUnsubscribePresenceWatcherListL"));
+#endif
+ if ( iSubscribed )
+ {
+ TRAPD( err, iConnObs.WinfoHandlerL()->UnsubscribeWinfoListL( aReqId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ iSubscribed = EFalse;
+ iPrFwId = aReqId;
+ iOperation = EUnsubscribeWinfo;
+ }
+ else
+ {
+ iPrFwId = aReqId;
+ CompletePrFwReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::PublishReqCompleteL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::PublishReqCompleteL( TInt /*aOpid*/, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: PublishReqCompleteL("));
+#endif
+ if ( !aStatus )
+ {
+ iPublished = ETrue;
+ }
+ else
+ {
+ }
+
+ CompletePrFwReq( aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::PublishTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::PublishTerminatedL( TInt /*aOpid*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: PublishTerminatedL"));
+#endif
+ // Notice: nothing to do now in Host APi.
+ iPublished = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WatcherReqCompleteL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WatcherReqCompleteL( TInt /*aOpid*/, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: WatcherReqCompleteL"));
+#endif
+ if ( !aStatus )
+ {
+ iSubscribedOwn = ETrue;
+ }
+ else
+ {
+ }
+ CompletePrFwReq( aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WatcherNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WatcherNotificationL( MSimpleDocument& aDocument )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: WatcherNotificationL"));
+#endif
+
+ // Notice: Do not need to check the expiration here since WatcherTerminatedL
+ // is called then too.
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+ MPresenceInfo* prInfo = iConnObs.PresenceObjectFactory().NewPresenceInfoLC(); // << prInfo
+ CSimplePluginData::NotifyToPrInfoL( iConnObs.PresenceObjectFactory(), aDocument, *prInfo );
+
+#ifdef _DEBUG
+ // ---------------------------------------------------------
+ const MPersonPresenceInfo* pers_debug = prInfo->PersonPresence();
+ const MPresenceInfoFieldCollection& coll_debug = pers_debug->Fields();
+ TInt count_debug = coll_debug.FieldCount();
+ PluginLogger::Log(_L("PluginPublisher: nbr of fields received =%d"), count_debug );
+ // ---------------------------------------------------------
+#endif
+
+ // PrFw Host API callbacks
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: callback HandleSubscribedOwnPresenceL"));
+#endif
+ publishHost.HandleSubscribedOwnPresenceL( prInfo );
+ CleanupStack::Pop(); // >> prInfo
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WatcherListNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WatcherListNotificationL( MSimplePresenceList& /*aList*/ )
+ {
+ // Notice: not needed.
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WatcherTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WatcherTerminatedL(
+ TInt /*aOpId*/, TInt /*aReason*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: WatcherTerminatedL"));
+#endif
+ iSubscribedOwn = EFalse;
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+ MXIMPDataSubscriptionState *state = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* status = iConnObs.ObjectFactory().NewStatusLC();
+ state->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionInactive );
+ status->SetResultCode( KErrCompletion );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: callback SetOwnPresenceDataSubscriptionStateL"));
+#endif
+ publishHost.SetOwnPresenceDataSubscriptionStateL( state, status );
+ CleanupStack::Pop( 2 ); // status, state
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::CompletePrFwReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::CompletePrFwReq( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: CompletePrFwReq status=%d"), aStatus );
+#endif
+ if ( iOperation != ENoOperation )
+ {
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iPrFwId, aStatus );
+ iPrFwId = TXIMPRequestId();
+ }
+ else
+ {
+ }
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoCancel( )
+ {
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::RunL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::RunL( )
+ {
+
+ TInt status = iStatus.Int();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: RunL %d"), status );
+#endif
+
+ if ( !status )
+ {
+ if ( iOperation == ESubscribeOwn )
+ {
+ iSimpleId = iWatcher->SubscribeL(
+ iConnSets.CurrentSipPresentity8(),
+ NULL, // aFilter <-> aPif
+ ETrue, EFalse );
+ }
+ else
+ {
+ MakePublishReqL();
+ }
+ }
+ else
+ {
+ CompletePrFwReq( status );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginPublisher::RunError( TInt aError )
+ {
+ CompletePrFwReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::GetInterface
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginPublisher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresencePublishing* myIf = this;
+ return myIf;
+ }
+ else if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::GetInterface
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePluginPublisher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresencePublishing* myIf = this;
+ return myIf;
+ }
+ else if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::GetInterfaceId
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePluginPublisher::GetInterfaceId() const
+ {
+ return MProtocolPresencePublishing::KInterfaceId;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::InitializeSimpleDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::InitializeSimpleDocumentL( )
+ {
+ if ( iDocument )
+ {
+ iDocument->Close();
+ iDocument = NULL;
+ }
+ iDocument = TSimpleFactory::NewDocumentL();
+ iDocument->AddNamespaceL( KSimplePDM, KSimpleNsPDM );
+ iDocument->AddNamespaceL( KSimpleRPID, KSimpleNsRPID );
+ iDocument->AddNamespaceL( KSimpleOP, KSimpleNsOP );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::AddSimpleDocumentPersL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::AddSimpleDocumentPersL(
+ const MPersonPresenceInfo* aInfo )
+ {
+ CSimplePluginData::AddPrPersToSimpleDocumentL(
+ aInfo, *iDocument, iConnSets.CurrentSipPresentity8() );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::AddSimpleDocumentServiceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::AddSimpleDocumentServiceL(
+ const MServicePresenceInfo& aInfo )
+ {
+ if ( aInfo.Fields().FieldCount() > 0 || aInfo.ServiceType().Length() )
+ {
+ // Notice: currently all the fields in the namespace are supported,
+ // but this ensures that if namespace is extended later, it is
+ // handled right way in the adaptation
+ User::Leave( KPresenceErrPresenceInfoFieldTypeNotSupported );
+ }
+ else
+ {
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::AddSimpleDocumentDeviceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::AddSimpleDocumentDeviceL(
+ const MDevicePresenceInfo& aInfo )
+ {
+ if ( aInfo.Fields().FieldCount() > 0 || aInfo.DeviceName().Length() )
+ {
+ // Notice: currently all the fields in the namespace are supported,
+ // but this ensures that if namespace is extended later, it is
+ // handled right way in the adaptation
+ User::Leave( KPresenceErrPresenceInfoFieldTypeNotSupported );
+ }
+ else
+ {
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::MakePublishReqL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::MakePublishReqL( )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: -> MakePublishReqL"));
+#endif
+ // Send the iDocument
+ if ( !iPublished )
+ {
+ iSimpleId = iPublisher->StartPublishL( *iDocument, ETrue );
+ }
+ else
+ {
+ iSimpleId = iPublisher->ModifyPublishL( *iDocument);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::StartXdmOperationL(
+ TXIMPRequestId aReqId )
+ {
+ TRAPD( err, DoStartXdmOperationL( aReqId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::DoStartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::DoStartXdmOperationL(
+ TXIMPRequestId aReqId )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ iPrFwId = aReqId;
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ // ignore if not subscribed
+ if ( !iSubscribed )
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: WinfoNotificationL"));
+#endif
+
+ // Handle full-state and partial state notifications
+ // - If terminated -> remove from iWatcherList
+ // - If active -> add into iWatcherList if does not already exist
+ // WinfoTerminatedL handles termination of subscription.
+
+ // Notice: CSimplePluginWinfo has completed the open request if needed before this.
+
+
+ /* example:
+
+ // active/pending/terminated
+
+ <?xml version="1.0"?>
+ <watcherinfo xmlns="urn:ietf:params:xml:ns:watcherinfo"
+ version="0" state="full">
+ <watcher-list resource="sip:presentity@example.com"
+ package="presence">
+ <watcher status="active"
+ id="sr8fdsj"
+ duration-subscribed="509"
+ expiration="20"
+ event="approved">sip:watcherA@example.com"
+ </watcher>
+ */
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems ); // << elems
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ __ASSERT_DEBUG( count == 1, User::Leave( KErrCorrupt ) );
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ const TDesC8* stateVal = aWinfo.AttrValue( KSimpleState8 );
+ if ( stateVal && !stateVal->CompareF( KSimpleFull8 ))
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: fullstate = TRUE") );
+#endif
+ // full winfo-list is received
+ DeleteWatchers();
+ }
+ else
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: fullstate = FALSE") );
+#endif
+ }
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KSimpleWatcherList8 );
+ User::LeaveIfError( err );
+
+ err = elem->SimpleElementsL( elems );
+ User::LeaveIfError( err );
+
+ // Collect the active watchers only.
+ UpdateActiveWatchersListL( elems );
+
+ CDesCArrayFlat* watchers = MakeCurrentWatcherListLC(); // << watchers
+ MXIMPObjectCollection *actives =
+ iConnObs.ObjectFactory().NewObjectCollectionLC(); // << actives
+
+ // Create MPresenceWatcherInfo entities for
+ // all active watchers and add to actives.
+ TInt wCount = watchers->MdcaCount();
+ for ( TInt j = 0; j < wCount; j++ )
+ {
+ // create MPresenceWatcherInfo object
+ MPresenceWatcherInfo* wInfo =
+ iConnObs.PresenceObjectFactory().NewPresenceWatcherInfoLC(); // << wInfo
+
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC(); // << identity
+#ifdef _DEBUG
+ TBuf<200> debug_buffer;
+ debug_buffer = watchers->MdcaPoint( j );
+ PluginLogger::Log(_L("PluginPublisher: add watcher into collection: %S"), &debug_buffer);
+#endif
+ identity->SetIdentityL( watchers->MdcaPoint( j ) );
+ wInfo->SetWatcherIdL( identity );
+ CleanupStack::Pop( ); // >> identity
+
+ wInfo->SetWatcherDisplayNameL( watchers->MdcaPoint( j ) );
+ wInfo->SetWatcherTypeL( MPresenceWatcherInfo::EPresenceSubscriber );
+
+ actives->AddObjectL( wInfo );
+ CleanupStack::Pop( ); // >> wInfo
+ }
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: callback HandlePresenceWatcherListL"));
+#endif
+ publishHost.HandlePresenceWatcherListL( actives );
+ CleanupStack::Pop(); // >> actives
+ CleanupStack::PopAndDestroy( watchers ); // >> watchers
+ CleanupStack::PopAndDestroy( &elems ); // >> elems
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::WinfoTerminatedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::WinfoTerminatedL( TInt /*aReason*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: WinfoTerminatedL") );
+#endif
+
+ if ( !iSubscribed )
+ {
+ return;
+ }
+
+ // call SetPresenceWatcherListDataSubscriptionStateL
+ iSubscribed = EFalse;
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+ MXIMPDataSubscriptionState *state = iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* status = iConnObs.ObjectFactory().NewStatusLC();
+ state->SetSubscriptionStateL( MXIMPDataSubscriptionState::ESubscriptionInactive );
+ state->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+ status->SetResultCode( KErrCompletion );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginPublisher: callback SetPresenceWatcherListDataSubscriptionStateL"));
+#endif
+ publishHost.SetPresenceWatcherListDataSubscriptionStateL( state, status );
+ CleanupStack::Pop( 2 ); // status, state
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimplePluginPublisher::UpdateActiveWatchersListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginPublisher::UpdateActiveWatchersListL(
+ RPointerArray<MSimpleElement>& aElems )
+ {
+ // Collect active users.
+ using namespace NSimplePlugin::NSimpleOma;
+
+ HBufC* nodeContent = NULL;
+
+ TInt count = aElems.Count();
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MSimpleElement* elem = aElems[i];
+ TPtrC8 p8( elem->LocalName());
+ if (!( p8.CompareF( KSimpleWatcher8 )))
+ {
+ const TDesC8* pp8 = elem->AttrValue( KSimpleStatus8 );
+ // Active wathers here
+ if ( pp8 && !pp8->CompareF( KSimpleActive8 ))
+ {
+
+ // save id since there may be multiple subscriptions
+ // from a single watcher SIP identity.
+ const TDesC8* pId8 = elem->AttrValue( KSimpleId8 );
+
+ // Build collection of grant requests
+ // Find the child node containing the SIP entity
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent ); // << nodeContent
+
+ AddWatcherIfNotExistsL( pId8 ? *pId8 : KNullDesC8, nodeContent->Des() );
+
+ CleanupStack::PopAndDestroy( nodeContent ); // >> nodeContent
+ }
+ // Terminated wathers here, remove them from active list
+ else if ( pp8 && !pp8->CompareF( KSimpleTerminated8 ))
+ {
+
+ const TDesC8* pId8 = elem->AttrValue( KSimpleId8 );
+
+ // Remove terminated from iWatcherList
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent ); // << nodeContent
+
+ RemoveWatcherIfExistsL( pId8 ? *pId8 : KNullDesC8, nodeContent->Des() );
+
+ CleanupStack::PopAndDestroy( nodeContent ); // >> nodeContent
+ }
+ }
+ }
+
+ }
+
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginsession.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+
+#include <presenceinfo.h>
+
+#include <ximpserviceinfo.h>
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <ximpprotocolconnectionhost.h>
+
+#include <simplefactory.h>
+#include <msimpleconnection.h>
+#include <msimpleconnectionobserver.h>
+#include <pressettingsapi.h>
+
+#include "simplepluginsession.h"
+#include "simpleplugindebugutils.h"
+#include "msimplepluginconnectionobs.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::CSimplePluginSession()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginSession::CSimplePluginSession( MSimplePluginConnectionObs& aObs)
+: // CActive( CActive::EPriorityStandard ) ,
+ iObs(aObs), iType( MSimplePluginConnectionObs::ENoReq ), iConnected( EFalse )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginSession::ConstructL(
+ const MXIMPServiceInfo& aService )
+ {
+ // iIap is needed only
+ iIap = aService.IapId();
+
+ iConnection = TSimpleFactory::NewConnectionL( *this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::NewL()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginSession* CSimplePluginSession::NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ MSimplePluginConnectionObs& aObs )
+ {
+ CSimplePluginSession* self = new( ELeave ) CSimplePluginSession( aObs );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceInfo );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::~CSimplePluginSession()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginSession::~CSimplePluginSession()
+ {
+ delete iUserId8;
+ delete iDomain;
+ if ( iConnection )
+ {
+ iConnection->Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::SimpleConnection()
+// ---------------------------------------------------------------------------
+//
+MSimpleConnection* CSimplePluginSession::SimpleConnection( )
+ {
+ return iConnection;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::XdmSettingsId()
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginSession::XdmSettingsId( )
+ {
+ return iXdmSetting;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::CurrentDomain()
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CSimplePluginSession::CurrentDomain( )
+ {
+ return iDomain ? iDomain->Des() : TPtrC16();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::OpenSessionL()
+// Notice: MXIMPServiceInfo::IapId supported only
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginSession::OpenSessionL()
+ {
+ TPresSettingsSet mySet;
+
+#ifdef _DEBUG
+
+ PluginLogger::Log(_L("PluginSession: OpenSessionL") );
+
+ RArray<TInt> setIds;
+ CDesCArray* carr = PresSettingsApi::GetAllSetsNamesLC( setIds );
+ TInt myCount = setIds.Count();
+ for (TInt i=0; i<myCount; i++)
+ {
+
+ TBuf<500> buffer2; buffer2.Copy(carr->MdcaPoint(i));
+ PluginLogger::Log(_L("PluginSession: ID:%d = %S"), setIds[i], &buffer2);
+ }
+ setIds.Reset();
+ CleanupStack::PopAndDestroy( carr );
+#endif
+
+ iConnected = EFalse;
+
+ User::LeaveIfError( PresSettingsApi::SettingsSetL( iIap, mySet ));
+ iXdmSetting = mySet.iXDMSetting;
+
+ iDomain = mySet.iDomainSyntax.AllocL();
+
+ // SIP register
+ iOpId = iConnection->LoginL( iIap );
+ iType = MSimplePluginConnectionObs::EOpenSess;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::OpenSessionL()
+// Notice: Multiple connections support to be done.
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginSession::OpenSessionL( TInt aSettingsId )
+ {
+ iIap = aSettingsId;
+ OpenSessionL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::ConnectionStatusL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginSession::ConnectionStatusL( MSimpleConnection::TSimpleState aState )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginSession: ConnectionStatusL %d"), aState );
+#endif
+
+ if ( (aState == MSimpleConnection::EInactive || aState == MSimpleConnection::EUnavailable ) &&
+ iConnected )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginSession: ConnectionStatusL callback HandleConnectionTerminated") );
+#endif
+ iConnected = EFalse;
+ iObs.Host()->HandleConnectionTerminated( NULL );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::RequestCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginSession::RequestCompleteL( TInt /*aOpId*/, TInt aStatus )
+ {
+ MSimplePluginConnectionObs::TReqType current = iType;
+ iType = MSimplePluginConnectionObs::ENoReq;
+ if ( !aStatus )
+ {
+ iConnected = ETrue;
+ }
+ iObs.CompleteReq( current, aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginSession::CurrentSipPresentity()
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimplePluginSession::CurrentSipPresentity()
+ {
+ // Get from Simple engine
+ delete iUserId8;
+ iUserId8 = NULL;
+ TRAP_IGNORE( iUserId8 = iConnection->CurrentSIPIdentityL().AllocL() );
+ return iUserId8 ? iUserId8->Des() : TPtrC8();
+ }
+
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginvariation.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+#include <centralrepository.h>
+
+#include "simpleplugincommon.h"
+#include "simplepluginvariation.h"
+#include "presencefwsimpleadptprivatecrkeys.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::CSimplePluginVariation
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation::CSimplePluginVariation( )
+: iDefaultRuleAction(ERuleConfirm), iBlockRuleAction(ERulePoliteBlock)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::ConstructL( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation* CSimplePluginVariation::NewL( )
+ {
+ CSimplePluginVariation* self =
+ new( ELeave ) CSimplePluginVariation();
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::~CSimplePluginVariation
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation::~CSimplePluginVariation()
+ {
+ delete iGrantAllRuleName;
+ delete iGrantOwnRuleName;
+ delete iDefaultRuleName;
+ delete iBlockRuleName;
+ delete iRlsGroupUriTemplate;
+ delete iSharedXdmTop;
+ delete iGrantListName;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitL()
+ {
+ // Read Central Repository settings
+ CRepository* repository = NULL;
+
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ TRAP_IGNORE( repository =
+ CRepository::NewL( KCRUIDPresencefwSimpleadptVariation ));
+
+ CleanupStack::PushL( repository );
+
+ // initialize strings
+ delete iGrantAllRuleName;
+ iGrantAllRuleName = NULL;
+ delete iGrantOwnRuleName;
+ iGrantOwnRuleName = NULL;
+ delete iDefaultRuleName;
+ iDefaultRuleName = NULL;
+ delete iBlockRuleName;
+ iBlockRuleName = NULL;
+ delete iRlsGroupUriTemplate;
+ iRlsGroupUriTemplate = NULL;
+ delete iSharedXdmTop;
+ iSharedXdmTop = NULL;
+ delete iGrantListName;
+ iGrantListName = NULL;
+
+ // Read values from CenRep
+ InitGrantRuleNameL( repository );
+ InitGrantOwnRuleNameL( repository );
+ InitDefaultRuleNameL( repository );
+ InitBlockRuleNameL( repository );
+ InitDefaultRuleActionL( repository );
+ InitBlockRuleActionL( repository );
+ InitRlsGroupUriTemplateL( repository );
+ InitSharedXdmTopL( repository );
+ InitGrantListNameL( repository );
+
+ CleanupStack::PopAndDestroy( repository );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::GrantRuleName
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::GrantRuleName()
+ {
+ return iGrantAllRuleName ? iGrantAllRuleName->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::GrantOwnRuleName
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::GrantOwnRuleName()
+ {
+ return iGrantOwnRuleName ? iGrantOwnRuleName->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::DefaultRuleName
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::DefaultRuleName()
+ {
+ return iDefaultRuleName ? iDefaultRuleName->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::BlockRuleName
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::BlockRuleName()
+ {
+ return iBlockRuleName ? iBlockRuleName->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::DefaultRuleAction
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation::TSimplePluginAuthRule CSimplePluginVariation::DefaultRuleAction()
+ {
+ return iDefaultRuleAction;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::BlockRuleAction
+// ---------------------------------------------------------------------------
+//
+CSimplePluginVariation::TSimplePluginAuthRule CSimplePluginVariation::BlockRuleAction()
+ {
+ return iBlockRuleAction;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::RlsGroupUriTemplate
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::RlsGroupUriTemplate()
+ {
+ return iRlsGroupUriTemplate ? iRlsGroupUriTemplate->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::SharedXdmTop
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::SharedXdmTop()
+ {
+ return iSharedXdmTop ? iSharedXdmTop->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::GrantListName
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginVariation::GrantListName()
+ {
+ return iGrantListName ? iGrantListName->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitGrantRuleNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitGrantRuleNameL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleGrantAllRuleName, myBuffer ))
+ {
+ // Use deault value when not found in Central Repository
+ myBuffer = KSimpleXdmGrantRule;
+ }
+ iGrantAllRuleName = myBuffer.AllocL( );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitGrantOwnRuleNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitGrantOwnRuleNameL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleGrantOwnRuleName, myBuffer ))
+ {
+ // Use deault value when not found in Central Repository
+ myBuffer = KSimpleXdmOwnGrantRule;
+ }
+ iGrantOwnRuleName = myBuffer.AllocL( );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitDefaultRuleNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitDefaultRuleNameL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleDefaultRuleName, myBuffer ))
+ {
+ // Use deault value when not found in Central Repository
+ myBuffer = KSimpleXdmDefaultRule;
+ }
+ iDefaultRuleName = myBuffer.AllocL( );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitBlockRuleNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitBlockRuleNameL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleBlockRuleName, myBuffer ))
+ {
+ // Use deault value when not found in Central Repository
+ myBuffer = KSimpleXdmBlockRule;
+ }
+ iBlockRuleName = myBuffer.AllocL( );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitDefaultRuleActionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitDefaultRuleActionL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ iDefaultRuleAction = ERuleAllow;
+ if ( aRepository && !aRepository->Get( KPrFwSimpleDefaultRuleAction, myBuffer ))
+ {
+ if ( !myBuffer.CompareF( KSimpleBlock ))
+ {
+ iDefaultRuleAction = ERuleBlock;
+ }
+ else if ( !myBuffer.CompareF( KSimplePoliteBlock ))
+ {
+ iDefaultRuleAction = ERulePoliteBlock;
+ }
+ else if ( !myBuffer.CompareF( KSimpleConfirm ))
+ {
+ iDefaultRuleAction = ERuleConfirm;
+ }
+ else if ( !myBuffer.CompareF( KSimpleAllow ))
+ {
+ iDefaultRuleAction = ERuleAllow;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitBlockRuleActionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitBlockRuleActionL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ iBlockRuleAction = ERuleBlock;
+ if ( aRepository && !aRepository->Get( KPrFwSimpleBlockRuleAction, myBuffer ))
+ {
+ if ( myBuffer.CompareF( KSimpleBlock ))
+ {
+ iBlockRuleAction = ERulePoliteBlock;
+ }
+ else
+ {
+ // default value is used
+ }
+ }
+ else
+ {
+ // default value is used
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitRlsGroupUriTemplateL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitRlsGroupUriTemplateL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleRlsGroupUriTemplate, myBuffer ))
+ {
+ myBuffer = KSimpleRlsGroupUriTemplate;
+ }
+ iRlsGroupUriTemplate = myBuffer.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitSharedXdmTopL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitSharedXdmTopL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleSharedXdmTop, myBuffer ))
+ {
+ myBuffer = KSimpleOMABuddyList;
+ }
+ iSharedXdmTop = myBuffer.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginVariation::InitGrantListNameL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginVariation::InitGrantListNameL( CRepository* aRepository )
+ {
+ TBuf<KSimplePluginMaxRuleLength> myBuffer;
+
+ if ( !aRepository || aRepository->Get( KPrFwSimpleGrantListName, myBuffer ))
+ {
+ myBuffer = KSimpleS60GrantedList;
+ }
+ iGrantListName = myBuffer.AllocL();
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginwatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,784 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+#include <utf.h>
+
+#include <personpresenceinfo.h>
+
+#include <presenceinfo.h>
+#include <presenceinfofieldcollection.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvalueenum.h>
+#include <presenceobjectfactory.h>
+#include <presenceerrors.hrh>
+
+#include <presentitygroupmemberinfo.h>
+
+#include <protocolpresencedatahost.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <protocolpresencewatchingdatahost.h>
+
+#include <ximpdatasubscriptionstate.h>
+#include <ximperrors.hrh>
+#include <ximpidentity.h>
+#include <ximpobjectcollection.h>
+#include <ximpobjectfactory.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+
+#include <simplefactory.h>
+#include <simpleerrors.h>
+#include <msimplewinfo.h>
+#include <msimplewatcher.h>
+#include <msimpledocument.h>
+#include <msimpleelement.h>
+
+#include "simpleplugincommon.h"
+#include "simplepluginwatcher.h"
+#include "simplepluginentitywatcher.h"
+#include "simpleplugindebugutils.h"
+#include "simpleutils.h"
+#include "simplepluginxdmutils.h"
+#include "simpleplugindata.h"
+#include "simplepluginconnection.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::CSimplePluginWatcher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWatcher::CSimplePluginWatcher(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+: CActive( CActive::EPriorityStandard ),
+ iConnSets( aConnSets), iConnObs(aObs), iConnection(aConn), iCompleted( ETrue ),
+ iOperation( EPluginUndef ), iXdmState( EPluginIdle )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::ConstructL( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWatcher* CSimplePluginWatcher::NewL(
+ MSimplePluginSettings& aConnSets,
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ {
+ CSimplePluginWatcher* self =
+ new( ELeave ) CSimplePluginWatcher( aConnSets, aObs, aConn );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::~CSimplePluginWatcher
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWatcher::~CSimplePluginWatcher()
+ {
+ iWatchers.ResetAndDestroy();
+ iWatchers.Close();
+ delete iPresIdentity;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoSubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& /*aPif*/, // notice: aPif filter not supported
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: DoSubscribePresentityPresenceL"));
+#endif
+
+ TRAPD( err, DoDoSubscribePresentityPresenceL(aPresentityId, aReqId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoDoSubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoDoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+ iOperation = EPluginUndef;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aPresentityId );
+ iPrFwId = aReqId;
+ iCompleted = EFalse;
+
+ HBufC8* pres8 = NULL;
+ pres8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CSimplePluginEntityWatcher* watcher = MatchWatcher2L( pres8->Des(), ETrue );
+ watcher->StartSubscribeL( pres8->Des() );
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoUpdatePresentityPresenceSubscriptionPifL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoUpdatePresentityPresenceSubscriptionPifL(
+ const MXIMPIdentity& /*aPresentityId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoUpdatePresentityPresenceSubscriptionPifL"));
+#endif
+
+ iOperation = EPluginUndef;
+
+ // notice: aPif filter not supported
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: DoUnsubscribePresentityPresenceL"));
+#endif
+
+ TRAPD( err, DoDoUnsubscribePresentityPresenceL( aPresentityId, aReqId ) );
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoDoUnsubscribePresentityPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoDoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+
+ iOperation = EPluginUndef;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aPresentityId );
+ iPrFwId = aReqId;
+ iCompleted = EFalse;
+
+ HBufC8* pres8 = NULL;
+ pres8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CSimplePluginEntityWatcher* watcher = MatchWatcher2L( pres8->Des(), EFalse );
+ if ( !watcher )
+ {
+ User::Leave( KErrNotFound ); // Notice: error code
+ }
+ else
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: -> StopSubscribeL"));
+#endif
+ watcher->StopSubscribeL();
+ }
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoSubscribePresentityGroupMembersPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoSubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& /*aPif*/, // notice: aPif filter not supported
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoSubscribePresentityGroupMembersPresenceL"));
+#endif
+
+ iOperation = EPluginSubscribeGroup;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aGroupId );
+ iPrFwId = aReqId;
+ iCompleted = EFalse;
+
+ // Get Shared XDM lists first and create RLS service first
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoUpdatePresentityGroupMembersPresenceSubscriptionPifL"));
+#endif
+ // notice: aPif filter not supported
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoUnsubscribePresentityGroupMembersPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoUnsubscribePresentityGroupMembersPresenceL"));
+#endif
+ TRAPD( err, DoDoUnsubscribePresentityGroupMembersPresenceL( aGroupId, aReqId ));
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoDoUnsubscribePresentityGroupMembersPresenceL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoDoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+ iOperation = EPluginUnsubscribeGroup;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aGroupId );
+ iPrFwId = aReqId;
+ iCompleted = EFalse;
+
+ HBufC* buf16 = iXdmUtils->RlsServiceByResourceListLC( iPresIdentity->Des() ); // << buf16
+
+ HBufC8* buf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( buf16->Des() );
+ CleanupStack::PushL( buf ); // << buf
+
+ CSimplePluginEntityWatcher* watcher = MatchWatcher2L( buf->Des(), EFalse );
+
+ CleanupStack::PopAndDestroy( buf ); // >> buf
+ CleanupStack::PopAndDestroy( buf16 ); // >> buf16
+
+ if ( !watcher )
+ {
+ User::Leave( KErrNotFound ); // Notice: error code
+ }
+ else
+ {
+ watcher->StopSubscribeL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::GetInterface
+// ---------------------------------------------------------------------------
+//
+TAny* CSimplePluginWatcher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresenceWatching* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::GetInterface
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimplePluginWatcher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresenceWatching* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( _L("CSimplePlugin"), KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::GetInterfaceId
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimplePluginWatcher::GetInterfaceId() const
+ {
+ return MProtocolPresenceWatching::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::MatchWatcher2L
+// ---------------------------------------------------------------------------
+//
+CSimplePluginEntityWatcher* CSimplePluginWatcher::MatchWatcher2L(
+ const TDesC8& aPresentityid, TBool aCreate )
+ {
+ TInt count = iWatchers.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CSimplePluginEntityWatcher* temp = (iWatchers[i]);
+ if ( !temp->PresentityId().CompareF( aPresentityid ))
+ {
+ return temp;
+ }
+ }
+
+ // If watcher was not found, crete it when wanted so.
+ if ( !aCreate )
+ {
+ return NULL;
+ }
+ else
+ {
+ CSimplePluginEntityWatcher* watcher = CSimplePluginEntityWatcher::NewL(
+ iConnObs, iConnection, *this );
+ iWatchers.Append( watcher );
+ return watcher;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DeleteWatcher
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DeleteWatcher(
+ const TDesC8& aPresentityid )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log( _L("PluginWatcher: DeleteWatcher **"));
+#endif
+
+ TInt count = iWatchers.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CSimplePluginEntityWatcher* temp = (iWatchers[i]);
+ if ( !temp->PresentityId().CompareF( aPresentityid ) )
+ {
+ iWatchers.Remove( i );
+ iWatchers.GranularCompress();
+ delete temp;
+ break;
+ }
+ else
+ {
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::GetEntitiesInListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::GetEntitiesInListL(
+ const TDesC& aList, MXIMPObjectCollection& aMembers )
+ {
+ __ASSERT_DEBUG( iXdmUtils, User::Leave( KErrCorrupt ) );
+
+ const TInt KMyGran = 10;
+ CPtrCArray* ids = new (ELeave) CPtrCArray( KMyGran );
+ CleanupStack::PushL( ids ); // << ids
+
+ CPtrCArray* dispNames = new (ELeave) CPtrCArray( KMyGran );
+ CleanupStack::PushL( dispNames ); // << dispNames
+
+ iXdmUtils->GetEntitiesInListL( aList, *ids, *dispNames );
+
+ CopyGroupMembersToCollectionL( *ids, *dispNames, aMembers );
+
+ CleanupStack::PopAndDestroy( dispNames );
+ CleanupStack::PopAndDestroy( ids );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::StartWatchingRlsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::StartWatchingRlsL()
+ {
+ HBufC* buf = iXdmUtils->RlsServiceByResourceListLC( iPresIdentity->Des() ); // << buf
+
+ HBufC8* buf2 = NULL;
+ buf2 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( buf->Des() );
+ CleanupStack::PushL( buf2 ); // << buf2
+
+ CSimplePluginEntityWatcher* watcher = MatchWatcher2L( buf2->Des(), ETrue );
+
+ watcher->StartSubscribeListL( buf2->Des() );
+
+ watcher->SetSimpleNameL( buf2->Des() );
+
+ CleanupStack::PopAndDestroy( buf2 ); // >> buf2
+ CleanupStack::PopAndDestroy( buf ); // >> buf
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId )
+ {
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::CompletePrFwReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::CompletePrFwReq( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: CompletePrFwReq status=%d"), aStatus );
+#endif
+ iXdmState = EPluginIdle;
+
+ if ( !iCompleted )
+ {
+ iCompleted = ETrue;
+ // Convert error code when needed
+ if ( aStatus == KSimpleErrNotFound &&
+ ( iOperation == EPluginSubscribeGroup ||
+ iOperation == EPluginUnsubscribeGroup ))
+ {
+ aStatus = KPresenceErrUnknownPresentityGroup;
+ }
+ else if ( aStatus == KSimpleErrNotFound )
+ {
+ aStatus = KPresenceErrUnknownPresentity;
+ }
+ else
+ {
+ }
+ iConnObs.CompleteReq( iPrFwId, aStatus );
+ iPrFwId = TXIMPRequestId();
+ iOperation = EPluginUndef;
+ }
+ else
+ {
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::CompleteWatcher
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::CompleteWatcher( TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: CompleteWatcher status=%d"), aStatus );
+#endif
+ // start to remove RLS service when needed.
+ if ( iOperation == EPluginUnsubscribeGroup && iXdmState == EPluginIdle )
+ {
+ TRAPD( err, iXdmUtils->FetchRlsL( iStatus ));
+ if ( err )
+ {
+ CompletePrFwReq( err );
+ }
+ else
+ {
+ iXdmState = EPluginFetchRls;
+ SetActive();
+ }
+ }
+ else
+ {
+ CompletePrFwReq( aStatus );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::StartXdmOperationL()
+ {
+ TRAPD( err, DoStartXdmOperationL() );
+ if ( err )
+ {
+ User::Leave( CSimplePluginConnection::HarmonizeErrorCode( err ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoStartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoStartXdmOperationL()
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ iXdmUtils->InitializeXdmsOnlyL( iStatus );
+
+ iXdmState = EPluginInitXdm;
+
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoCancel( )
+ {
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::RunL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::RunL( )
+ {
+
+ TInt status = iStatus.Int();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: RunL %d"), status );
+#endif
+ if ( !status )
+ {
+ // create RLS service first here
+ if ( iOperation == EPluginSubscribeGroup )
+ {
+ DoRunForSubscriptionL();
+ }
+ // remove RLS service when needed.
+ else if ( iOperation == EPluginUnsubscribeGroup )
+ {
+ DoRunForUnsubscriptionL();
+ }
+ else
+ {
+ // Idle state should not be completed. We should not come here
+ // because of PrFw core makes one request at a time.
+ }
+ }
+ else
+ {
+ CompletePrFwReq( status );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginWatcher::RunError( TInt aError )
+ {
+ CompletePrFwReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::GetListContentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::GetListContentL()
+ {
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().GroupsDataHost();
+
+ MXIMPObjectCollection* entities =
+ myFactory.NewObjectCollectionLC(); // << entities
+ GetEntitiesInListL( iPresIdentity->Des(), *entities );
+
+ // callback for data
+ MXIMPIdentity* id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: callback HandlePresentityGroupContentL"));
+#endif
+ dataHost.HandlePresentityGroupContentL( id, entities );
+ CleanupStack::Pop(); // >> id
+ CleanupStack::Pop(); // >> entities
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::CopyGroupMembersToCollectionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::CopyGroupMembersToCollectionL(
+ CPtrCArray& aIds, CPtrCArray& aNames, MXIMPObjectCollection& aCollection)
+ {
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MPresenceObjectFactory& myPresenceFactory = iConnObs.PresenceObjectFactory();
+ TInt count = aIds.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ // create here MPresentityGroupMemberInfo
+ MPresentityGroupMemberInfo* info = myPresenceFactory.NewPresentityGroupMemberInfoLC(); // << info
+ MXIMPIdentity* id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( aIds[i] );
+ info->SetGroupMemberIdL( id );
+ CleanupStack::Pop(); // >> id
+
+ info->SetGroupMemberDisplayNameL( aNames[i] );
+ aCollection.AddObjectL( info );
+ CleanupStack::Pop(); // >> info
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoRunForSubscriptionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoRunForSubscriptionL( )
+ {
+ if ( iXdmState == EPluginInitXdm )
+ {
+ // get members of the list first
+ GetListContentL();
+
+ // Fetch RLS document first before modifying the data.
+ TRAPD( err, iXdmUtils->FetchRlsL( iStatus ));
+ if ( err )
+ {
+ CompletePrFwReq( err );
+ }
+ else
+ {
+ iXdmState = EPluginFetchRls;
+ SetActive();
+ }
+ }
+ else if ( iXdmState == EPluginFetchRls )
+ {
+ // Create RLS document service
+ iXdmUtils->AddRlsGroupL( iPresIdentity->Des() );
+ iXdmState = EPluginAddGroupMember;
+ iXdmUtils->CommitRlsL( iStatus );
+ SetActive();
+ }
+ else
+ {
+ StartWatchingRlsL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWatcher::DoRunForUnsubscriptionL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWatcher::DoRunForUnsubscriptionL( )
+ {
+ TInt status = iStatus.Int();
+ if ( iXdmState == EPluginIdle )
+ {
+ TRAPD( err, iXdmUtils->FetchRlsL( iStatus ));
+ if ( err )
+ {
+ CompletePrFwReq( err );
+ }
+ else
+ {
+ iXdmState = EPluginFetchRls;
+ SetActive();
+ }
+ }
+ else if ( iXdmState == EPluginFetchRls )
+ {
+ TRAPD( err, iXdmUtils->RemoveRlsServiceByResourceListL( iPresIdentity->Des(), iStatus ));
+ if ( err )
+ {
+ CompletePrFwReq( err );
+ }
+ else
+ {
+ iXdmState = EPluginRemoveGroupMember;
+ SetActive();
+ }
+ }
+ else
+ {
+ CompletePrFwReq( status );
+ }
+ }
+
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginwinfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+
+#include <ximpdatasubscriptionstate.h>
+#include <ximpobjectfactory.h>
+
+#include <simplefactory.h>
+#include <msimplewinfowatcher.h>
+
+#include "simpleplugincommon.h"
+#include "simplepluginwinfo.h"
+#include "simpleplugindebugutils.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::CSimplePluginWinfo()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWinfo::CSimplePluginWinfo(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ : iConnObs(aObs), iConnection(aConn), iSubscribed(0), iWinfoCompleted(EFalse)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::ConstructL( )
+ {
+ iWinfoWatcher = TSimpleFactory::NewWinfoWatcherL( iConnection, *this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::NewL()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWinfo* CSimplePluginWinfo::NewL(
+ MSimplePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ {
+ CSimplePluginWinfo* self =
+ new( ELeave ) CSimplePluginWinfo( aObs, aConn );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::~CSimplePluginWinfo()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginWinfo::~CSimplePluginWinfo()
+ {
+ if ( iWinfoWatcher )
+ {
+ iWinfoWatcher->Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::SetHost()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::SetHost(
+ MXIMPProtocolConnectionHost* aHost )
+ {
+ iHost = aHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::SubscribeWinfoListL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::SubscribeWinfoListL( TXIMPRequestId aReqId )
+ {
+ iWinfoCompleted = EFalse;
+ iSubscribed++;
+ if ( iSubscribed == 1 )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: -> SubscribeWatcherListL") );
+#endif
+ iSimpleId = iWinfoWatcher->SubscribeWatcherListL( NULL );
+ iSubscribed = ETrue;
+ iPrFwId = aReqId;
+ }
+ else
+ {
+ iSimpleId = 0;
+ iPrFwId = aReqId;
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::UnsubscribeWinfoListL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::UnsubscribeWinfoListL( TXIMPRequestId aReqId )
+ {
+ iWinfoCompleted = EFalse;
+ TInt orig = iSubscribed;
+ iSubscribed--;
+ if ( iSubscribed < 0 )
+ {
+ iSubscribed = 0;
+ }
+
+ if ( !iSubscribed && orig )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: -> UnsubscribeL") );
+#endif
+ iSubscribed++;
+ iSimpleId = iWinfoWatcher->UnsubscribeL();
+ iSubscribed--;
+ iPrFwId = aReqId;
+ }
+ else
+ {
+ iSimpleId = 0;
+ iPrFwId = aReqId;
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::WinfoReqCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::WinfoReqCompleteL( TInt /*aOpId*/, TInt aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: WinfoReqCompleteL status=%d"), aStatus );
+#endif
+
+ if ( !iWinfoCompleted )
+ {
+ iWinfoCompleted = ETrue;
+ iSimpleId = 0;
+ iConnObs.CompleteWinfoReq( iPrFwId, aStatus );
+ // Do not wait MXIMPProtocolConnectionHostObserver callback, this
+ // class is ready to serve the next request now.
+ iPrFwId = TXIMPRequestId();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::WinfoTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::WinfoTerminatedL(
+ TInt aOpId, TInt aReason )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: WinfoTerminatedL opid=%d"), aOpId );
+#endif
+
+ if ( iSimpleId == aOpId )
+ {
+ iSimpleId = 0;
+ iConnObs.WinfoTerminatedL( aReason );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginWinfo::WinfoNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginWinfo::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: WinfoNotificationL starts"));
+#endif
+
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ iConnObs.WinfoNotification( aWinfo );
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWinfo: WinfoNotificationL ends"));
+#endif
+ }
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencefwsimpleadpt/src/simplepluginxdmutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,2522 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Protocol implementation for Presence Framework
+*
+*/
+
+
+
+
+#include <e32std.h>
+#include <utf.h>
+
+#include <simplefactory.h>
+#include <msimpleconnection.h>
+
+#include <pressettingsapi.h>
+#include <cpresencexdm.h>
+#include <rlspresxdmconsts.h>
+#include <XdmErrors.h>
+#include <prescondmisc.h>
+#include <prescondidentityone.h>
+#include <presenceactionxdm.h>
+#include <presencetransformxdm.h>
+#include <crlsxdm.h>
+
+#include <XdmEngine.h>
+#include <XdmDocument.h>
+#include <XdmProtocolInfo.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <XdmSettingsApi.h>
+#include <XdmErrors.h>
+
+#include "simpleplugindebugutils.h"
+#include "simpleplugincommon.h"
+#include "simplepluginxdmutils.h"
+#include "simpleplugindata.h"
+#include "simplepluginvariation.h"
+#include "msimplepluginsettings.h"
+
+// Test suite
+#include "msimpleplugintestobs.h"
+
+// This is for debugging and local test mode oly
+#include <in_sock.h>
+
+// URI prefixies
+const TInt KMyLenPrefix = 4;
+_LIT16( KMySip, "sip:" );
+_LIT16( KMyTel, "tel:" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CSimplePluginXdmUtils
+// ---------------------------------------------------------------------------
+//
+CSimplePluginXdmUtils::CSimplePluginXdmUtils(
+ MSimplePluginSettings& aConnSets, TInt aXmdId )
+: CActive( EPriorityStandard ),
+ iConnSets(aConnSets), iSettingsId(aXmdId),
+ iXdmState(EStateIdle), iOperation( ENoOperation), iTestObs( NULL )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::ConstructL( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::NewL
+// ---------------------------------------------------------------------------
+//
+CSimplePluginXdmUtils* CSimplePluginXdmUtils::NewL(
+ MSimplePluginSettings& aConnSets,
+ TInt aXmdId )
+ {
+ CSimplePluginXdmUtils* self =
+ new( ELeave ) CSimplePluginXdmUtils( aConnSets, aXmdId );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: NewL this=%d"), (TInt)self);
+#endif
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::~CSimplePluginXdmUtils()
+// ---------------------------------------------------------------------------
+//
+CSimplePluginXdmUtils::~CSimplePluginXdmUtils()
+ {
+
+ Cancel();
+
+ CancelWrappers();
+
+ if ( iXdmDoc && iXdmEngine )
+ {
+ TRAP_IGNORE( iXdmEngine->DeleteDocumentModelL( iXdmDoc ));
+ }
+ delete iRlsXdm;
+ delete iPresenceXdm;
+ delete iXdmEngine;
+ delete iAuxBuffer;
+
+ delete iAuxBuffer2;
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::InitializeXdmL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::InitializeXdmL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: InitializeXdmL") );
+#endif
+
+ iOperation = EXdmInit;
+ iClientStatus = &aStatus;
+
+ if ( !iXdmOk )
+ {
+ GetXdmOMAListsL();
+ iXdmState = EGetXdmOMALists;
+ *iClientStatus = KRequestPending;
+ }
+ else if ( !iPresXdmOk )
+ {
+ GetXdmRulesL();
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ // All is ok
+ *iClientStatus = KRequestPending;
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::InitializeXdmsOnlyL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::InitializeXdmsOnlyL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: InitializeXdmsOnlyL") );
+#endif
+
+ iOperation = EXdmInitXdmsOnly;
+ iClientStatus = &aStatus;
+
+ if ( !iXdmOk )
+ {
+ GetXdmOMAListsL();
+ iXdmState = EGetXdmOMAListsOnly;
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ // All is ok
+ *iClientStatus = KRequestPending;
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RunL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RunL( )
+ {
+ TPluginXdmState origState = iXdmState;
+ iXdmState = EStateIdle;
+ TInt myStatus = iStatus.Int();
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RunL %d"), myStatus );
+#endif
+
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackInRunL(
+ myStatus, origState, iOperation, KNullDesC );
+ }
+
+#ifdef FAKE_XDM_OK
+#ifdef _DEBUG
+ // -191 = KErrHostUnreach in_sock.h
+ if ( myStatus == KErrTimedOut || myStatus == KXcapErrorNetworkNotAvailabe || -191 )
+ {
+ PluginLogger::Log(_L("PluginXdmUtils : RunL FAKE_XDM_OK resets error code %d"), myStatus );
+ myStatus = 0;
+ }
+#endif
+#endif
+
+ DoXdmRunL( origState, myStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoXdmRunL()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoXdmRunL( TPluginXdmState aOrigState, TInt aStatus )
+ {
+
+ switch ( aOrigState )
+ {
+ case EGetXdmOMALists:
+ case EGetXdmOMAListsOnly:
+ {
+ // no OMA resource-list, let's start to create it.
+ if ( CreateXdmOMAListsIfNeededL() )
+ {
+ iXdmState = aOrigState == EGetXdmOMALists ? ECreateXdmOMALists : ECreateXdmOMAListsOnly;
+ }
+ else
+ {
+ iXdmOk = ETrue;
+ if ( !iPresXdmOk && aOrigState == EGetXdmOMALists )
+ {
+ GetXdmRulesL();
+ }
+ else
+ {
+ CompleteClientReq( KErrNone );
+ }
+ }
+ }
+ break;
+ case ECreateXdmOMALists:
+ {
+ if ( aStatus )
+ {
+ CompleteClientReq( aStatus );
+ }
+ else
+ {
+ iXdmOk = ETrue;
+ GetXdmRulesL();
+ }
+ }
+ break;
+ case ECreateXdmOMAListsOnly:
+ {
+ if ( !aStatus )
+ {
+ iXdmOk = ETrue;
+ }
+ CompleteClientReq( aStatus );
+ }
+ break;
+ default:
+ // complete reqular request
+ CompleteClientReq( aStatus );
+ break;
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CancelWrappers()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CancelWrappers( )
+ {
+ iOperation = EXdmCancel;
+
+ // Cancel M-class interface methods that calls callback method.
+ if ( iXdmState == EGetRlsServices ||
+ iXdmState == EUpdateRlsServices ||
+ iXdmState == EReUpdateRlsServices )
+ {
+ iXdmState = ECancelDocument;
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: -> iRlsXdm->Cancel"));
+#endif
+ // Better call Cancel() instead of CancelUpdateL().
+ // It works and is easier to implement. Otherwise we should have here
+ // SetActive(); iStatus=KRequestPending; User::WaitForRequest(iStatus)
+ // and we should have implemented HandleRLSUpdateCancelL that completes
+ // own iStatus.
+ iRlsXdm->Cancel();
+ }
+ else if ( iXdmState == EGetXdmRules ||
+ iXdmState == EUpdateXdmRules )
+ {
+ iXdmState = ECancelDocument;
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: -> iPresenceXdm->Cancel"));
+#endif
+ iPresenceXdm->Cancel();
+ }
+ else
+ {
+ }
+ }
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoCancel( )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: DoCancel"));
+#endif
+ iOperation = EXdmCancel;
+
+ if ( iXdmState == EGetXdmOMALists || iXdmState == ECreateXdmOMALists ||
+ iXdmState == EGetXdmOMAListsOnly || iXdmState == ECreateXdmOMAListsOnly ||
+ iXdmState == EUpdateXdmOMAList )
+ {
+ // Cancel a request made to XDM Engine.
+ iXdmState = ECancelDocument;
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: iXdmEngine->CancelUpdate"));
+#endif
+ iXdmEngine->CancelUpdate( iXdmDoc );
+ CompleteClientReq( KErrCancel );
+ }
+ else
+ {
+ // Cancel a request where we have completed our own iStatus.
+ // Very rare posibility that this happens when GetXdmOMALists is not ready.
+ // It's very hard to make it happen in test suite.
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSimplePluginXdmUtils::RunError( TInt aError )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RunError"));
+#endif
+ // complete the open request
+ CompleteClientReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::FetchRlsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::FetchRlsL(
+ TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: FetchRlsL"));
+#endif
+ _LIT( KMyOper, "FetchRlsL");
+
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmRlsFetch;
+
+ if ( !iRlsXdm )
+ {
+ iRlsXdm = CRLSXDM::NewL( iSettingsId );
+ }
+
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackAsynchL(
+ KErrNone, iXdmState, iOperation, KMyOper );
+ }
+
+ // The following returns in MRLSPresXDMAsyncHandler callback
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: -> iRlsXdm->UpdateAllFromServerL"));
+#endif
+ User::LeaveIfError( iRlsXdm->UpdateAllFromServerL( this ));
+
+ *iClientStatus = KRequestPending;
+
+ iXdmState = EGetRlsServices;
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AddRlsGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::AddRlsGroupL(
+ const TDesC& aName )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: AddRlsGroupL"));
+#endif
+ iOperation = EXdmRlsAdd;
+
+ HBufC16* buf = CreateRlsDocumentUri16LC(
+ aName, iConnSets.CurrentSipPresentity(), iConnSets.CurrentDomain() );
+
+ // KErrAlreadyExists
+ TInt errx = iRlsXdm->AddServiceURIL( buf->Des() );
+ if ( errx && errx != KErrAlreadyExists )
+ {
+ User::Leave( errx );
+ }
+ User::LeaveIfError( iRlsXdm->SwitchToServiceURIL( buf->Des() ));
+
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), aName );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ TInt err = iRlsXdm->AddElementL( KPresResourceList,
+ listUri->Des(), aName );
+ if ( err && err != KErrAlreadyExists )
+ {
+ User::Leave( err );
+ }
+
+ // Save aName for RLS Service URI negoriation handling (HTTP error 409).
+ // Notice: We assume that only one AddRlsGroupL is called between CommitRlsL methods.
+
+ delete iAuxBuffer;
+ iAuxBuffer = NULL;
+ iAuxBuffer = aName.AllocL();
+
+ CleanupStack::PopAndDestroy( listUri ); // >> listUri
+ CleanupStack::PopAndDestroy( xcapUri ); // >> xcapUri
+ CleanupStack::PopAndDestroy( buf );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemoveRlsGroupL
+// Use RemoveRlsServiceByResourceListL when possible
+//
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemoveRlsGroupL(
+ const TDesC& aName )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemoveRlsGroupL"));
+#endif
+
+ iOperation = EXdmRlsRemove;
+
+ HBufC16* buf = CreateRlsDocumentUri16LC(
+ aName, iConnSets.CurrentSipPresentity(), iConnSets.CurrentDomain() );
+
+ User::LeaveIfError( iRlsXdm->RemoveServiceURIL( buf->Des()));
+ CleanupStack::PopAndDestroy( buf );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AddEntityToGrantedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::AddEntityToGrantedL(
+ const TDesC& aUri, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: AddEntityToGrantedL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmAddUserToGroup;
+
+ DoAddUserToListL( iConnSets.Variation().GrantListName(), aUri );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmOMAList;
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AddEntityToBlockedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::AddEntityToBlockedL(
+ const TDesC& aUri, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: AddEntityToBlockedL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmAddUserToGroup;
+ DoAddUserToListL( KSimpleOMABlockedList, aUri );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmOMAList;
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoAddUserToListL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoAddUserToListL(
+ const TDesC& aList, const TDesC& aUri )
+ {
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists ); // << lists
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aList );
+
+ if ( foundNode )
+ {
+ if ( foundNode->IsEmptyNode() )
+ {
+ foundNode->SetEmptyNode( EFalse );
+ }
+
+ CXdmDocumentNode* newNode = foundNode->CreateChileNodeL( KSimpleEntry );
+ CXdmNodeAttribute* attributeEntryUri = newNode->CreateAttributeL( KSimpleUri );
+ attributeEntryUri->SetAttributeValueL( aUri );
+ iXdmDoc->AppendL( newNode );
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PopAndDestroy( &lists ); // >> lists
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemoveEntityFromGrantedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemoveEntityFromGrantedL(
+ const TDesC& aUri, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemoveEntityFromGrantedL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmRemoveUserFromGroup;
+ DoRemoveUserFromListL( iConnSets.Variation().GrantListName(), aUri );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmOMAList;
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemoveEntityFromBlockedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemoveEntityFromBlockedL(
+ const TDesC& aUri, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemoveEntityFromBlockedL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmRemoveUserFromGroup;
+ DoRemoveUserFromListL( KSimpleOMABlockedList, aUri );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmOMAList;
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoRemoveUserFromListL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoRemoveUserFromListL(
+ const TDesC& aList, const TDesC& aUri )
+ {
+ CXdmNodeAttribute* attr = NULL;
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists );
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aList );
+ if ( foundNode )
+ {
+ User::LeaveIfError( foundNode->Find( KSimpleEntry, nodes ));
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = ( currNode )->Attribute( KSimpleUri );
+ if ( attr && !attr->AttributeValue().CompareF( aUri ))
+ {
+ // This is the user we are looking for deletion.
+ iXdmDoc->DeleteDataL( currNode );
+ break;
+ }
+ }
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &lists ); // >>> lists
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemoveGroupFromGrantedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemoveGroupFromGrantedL(
+ const TDesC& aName, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemoveGroupFromGrantedL"));
+#endif
+ iClientStatus = &aStatus;
+
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), aName );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ DoRemoveListFromGrantRuleL( listUri->Des() );
+
+ CleanupStack::PopAndDestroy( listUri );
+ CleanupStack::PopAndDestroy( xcapUri );
+
+ iOperation = EXdmWithdrawGroup;
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoRemoveListFromGrantRuleL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoRemoveListFromGrantRuleL(
+ const TDesC& aListUri )
+ {
+ TPresCondMisc misc;
+ misc.Init( iPresenceXdm );
+
+ if ( !misc.DeleteExternalListL( iConnSets.Variation().GrantRuleName(), aListUri ))
+ {
+ // update document in the server only if there was a modification.
+ UpdateXdmRulesL();
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ // Complete without server operation
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AddGroupToGrantedL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::AddGroupToGrantedL(
+ const TDesC& aName, TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: AddGroupToGrantedL"));
+#endif
+
+ iClientStatus = &aStatus;
+
+ if ( !DoesUserListExistsL( aName ) )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), aName );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ iOperation = EXdmGrantGroup;
+
+ DoAddListIntoGrantRuleL( listUri->Des() );
+
+ CleanupStack::PopAndDestroy( listUri ); // >> listUri
+ CleanupStack::PopAndDestroy( xcapUri ); // >> xcapUri
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoAddListIntoGrantRuleL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoAddListIntoGrantRuleL(
+ const TDesC& aListUri)
+ {
+ TPresCondMisc misc;
+ misc.Init( iPresenceXdm );
+
+ User::LeaveIfError( misc.AddExternListL( iConnSets.Variation().GrantRuleName(), aListUri ));
+
+ UpdateXdmRulesL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::GrantForEveryoneL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::GrantForEveryoneL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: GrantForEveryoneL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmGrantForAll;
+ DoGrantForAllL();
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::WithdrawFromEveryoneL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::WithdrawFromEveryoneL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: WithdrawFromEveryoneL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmWithdrawFromAll;
+ DoWithdrawFromAllL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::SetReactiveAuthL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::SetReactiveAuthL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: SetReactiveAuthL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmSetReactiveAuth;
+ DoSetReactiveAuthL();
+
+ *iClientStatus = KRequestPending;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::SetProactiveAuthL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::SetProactiveAuthL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: SetProactiveAuthL"));
+#endif
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmSetProactiveAuth;
+ DoSetProactiveAuthL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::SubscribeBlockListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::SubscribeBlockListL( CPtrCArray& aMembers )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: SubscribeBlockListL"));
+#endif
+ iOperation = EXdmGetBlockedList;
+ DoGetListMembersL( KSimpleOMABlockedList, aMembers );
+ // The cient will call a method GetEntitiesL that access those arrays
+ // Those member arrays will be emptied after the call. + in destrcutor.
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::UnsubscribeBlockListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::UnsubscribeBlockListL( TRequestStatus& aStatus )
+ {
+ iClientStatus = &aStatus;
+ *iClientStatus = KRequestPending;
+ // Subscription state is always terminated
+ CompleteClientReq( KErrNone );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoGetListMembersL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoGetListMembersL(
+ const TDesC& aList, CPtrCArray& aMembers )
+ {
+ using namespace NSimplePlugin::NSimpleOma;
+
+ aMembers.Reset();
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ CXdmNodeAttribute* attr = NULL;
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( buddylist, aList );
+ if ( foundNode )
+ {
+ nodes.Reset();
+ // Do not leave if there is nobody blocked
+ TRAP_IGNORE( foundNode->Find( KSimpleEntry, nodes ));
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ attr = (nodes[i])->Attribute( KSimpleUri );
+ if ( attr )
+ {
+ aMembers.AppendL( attr->AttributeValue() );
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &nodes );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::HandleRLSUpdateDocumentL
+// RLS Callback
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::HandleRLSUpdateDocumentL( TInt aErrorCode )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: HandleRLSUpdateDocumentL %d"), aErrorCode);
+#ifdef FAKE_XDM_OK
+
+ if ( aErrorCode == KErrTimedOut || aErrorCode == KXcapErrorNetworkNotAvailabe || aErrorCode == KErrHostUnreach )
+ {
+ PluginLogger::Log(
+ _L("PluginXdm : HandleRLSUpdateDocumentL FAKE_XDM_OK resets error code %d"),
+ aErrorCode );
+ aErrorCode = 0;
+ }
+#endif
+#endif
+
+ TRAPD( err, DoHandleRLSUpdateDocumentL( aErrorCode ));
+ if ( err )
+ {
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( err );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoHandleRLSUpdateDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoHandleRLSUpdateDocumentL( TInt aErrorCode )
+ {
+
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackInRunL( aErrorCode, iXdmState, iOperation, KNullDesC );
+ }
+
+ // Resend 409 failed request only if the server sent a preposal for the right URI
+ // and only once, so that this do not remain in endless loop between server and
+ // a client.
+ if ( aErrorCode == KXcapErrorHttpConflict &&
+ iOperation == EXdmRlsAdd &&
+ iRlsXdm->NegotiatedServiceUri().Length() )
+ {
+ RlsServiceUriNegotiationL();
+ return;
+ }
+
+ switch ( iXdmState )
+ {
+ case EGetRlsServices:
+ if ( aErrorCode == KXcapErrorHttpNotFound || aErrorCode == KErrNotFound )
+ {
+ aErrorCode = KErrNone;
+ }
+ break;
+ default:
+ break;
+ }
+
+ CompleteClientReq( aErrorCode );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::HandleRLSUpdateCancelL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::HandleRLSUpdateCancelL( TInt /*aErrorCode*/ )
+ {
+ // notice: not needed
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::HandleRLSDeleteAllEmptyListsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::HandleRLSDeleteAllEmptyListsL( TInt /*aErrorCode*/ )
+ {
+ // Notice: Not needed
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::HandlePresUpdateDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::HandlePresUpdateDocumentL( TInt aErrorCode )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: HandlePresUpdateDocumentL %d"), aErrorCode);
+#ifdef FAKE_XDM_OK
+ if ( aErrorCode == KErrTimedOut || aErrorCode == KXcapErrorNetworkNotAvailabe || aErrorCode == KErrHostUnreach )
+ {
+ PluginLogger::Log(_L("PluginXdm : HandlePresUpdateDocumentL FAKE_XDM_OK resets error code %d"), aErrorCode );
+ aErrorCode = 0;
+ }
+#endif
+#endif
+
+ TRAPD( err, DoHandlePresUpdateDocumentL( aErrorCode ));
+ if ( err )
+ {
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( err );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoHandlePresUpdateDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoHandlePresUpdateDocumentL( TInt aErrorCode )
+ {
+
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackInRunL(
+ aErrorCode, iXdmState, iOperation, KNullDesC );
+ }
+
+ if ( iXdmState == EGetXdmRules )
+ {
+ iXdmState = EStateIdle;
+ if ( aErrorCode && aErrorCode != KXcapErrorHttpNotFound &&
+ aErrorCode != KErrNotFound )
+ {
+ User::Leave( aErrorCode );
+ }
+ // check and create the rules when needed
+ MakeInitialXdmsDocumentL();
+ }
+ else
+ {
+ iPresXdmOk = ETrue;
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( aErrorCode );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::HandlePresUpdateCancelL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::HandlePresUpdateCancelL( TInt /*aErrorCode*/ )
+ {
+ // notice: not needed
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::GetXdmOMAListsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::GetXdmOMAListsL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: GetXdmOMAListsL"));
+#endif
+ if ( !iXdmEngine )
+ {
+ // get data from a network if not done so yet
+ CXdmProtocolInfo* info = CXdmProtocolInfo::NewL( iSettingsId );
+ CleanupStack::PushL( info );
+ // Notice: we don't use cache for XDM
+ info->SetCacheUsage( EFalse );
+ iXdmEngine = CXdmEngine::NewL( *info );
+ CleanupStack::PopAndDestroy( info );
+ }
+ if ( !iXdmOk )
+ {
+ using namespace NSimplePlugin::NSimpleOma;
+ if ( iXdmDoc )
+ {
+ // Clean a document from s previous failed case.
+ iXdmEngine->DeleteDocumentModelL( iXdmDoc );
+ iXdmDoc = NULL;
+ }
+
+ // Get data from network
+ iXdmDoc = iXdmEngine->CreateDocumentModelL( KSimpleIndex, EXdmSharedXdm );
+ iXdmDoc->FetchDataL();
+ UpdateXdmsL();
+ iXdmState = EGetXdmOMALists;
+ }
+ else
+ {
+ // Document already exists, no need to search from a server
+ iStatus = KRequestPending;
+ TRequestStatus* s= &iStatus;
+ User::RequestComplete( s, KErrNone );
+ SetActive();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CreateXdmOMAListsIfNeededL
+// Notice: separate CheckXdmOMAListsL method (validity)
+// ---------------------------------------------------------------------------
+//
+TBool CSimplePluginXdmUtils::CreateXdmOMAListsIfNeededL( )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: CreateXdmOMAListsIfNeededL"));
+#endif
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ if ( !root )
+ {
+ root = iXdmDoc->CreateRootL();
+ root->SetNameL( KSimpleResourceLists );
+ }
+
+ if ( root->IsEmptyNode() )
+ {
+ root->SetEmptyNode( EFalse );
+ }
+
+ TInt isCreated = 0;
+
+ // add all the list nodes
+
+ isCreated += CreateXdmOMAListIfNeededL( root, iConnSets.Variation().SharedXdmTop() );
+
+ isCreated += CreateXdmOMAListIfNeededL( root, KSimpleOMABlockedList );
+
+ // grant-list name is variable issue
+ isCreated += CreateXdmOMAListIfNeededL( root, iConnSets.Variation().GrantListName() );
+
+ if ( !isCreated )
+ {
+ return EFalse;
+ }
+
+ // send to the server and start wait a response
+ iXdmDoc->AppendL( root );
+ UpdateXdmsL();
+ iXdmState = ECreateXdmOMALists;
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CreateXdmOMAListIfNeededL
+// ---------------------------------------------------------------------------
+//
+TBool CSimplePluginXdmUtils::CreateXdmOMAListIfNeededL(
+ CXdmDocumentNode* aRoot, const TDesC& aName )
+ {
+ TBool isCreated( EFalse );
+ CXdmDocumentNode* nodeFound = SearchListUnderParentL( aRoot, aName );
+ if ( !nodeFound )
+ {
+ CreateResourceListL( aRoot, aName );
+ isCreated = ETrue;
+ }
+ return isCreated;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CreateResourceListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CreateResourceListL(
+ CXdmDocumentNode* aParent, const TDesC& aName )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: CreateResourceListL"));
+#endif
+ using namespace NSimplePlugin::NSimpleOma;
+ CXdmDocumentNode* child1 = aParent->CreateChileNodeL( KSimpleList );
+ CXdmNodeAttribute* name = child1->CreateAttributeL( KSimpleName );
+ name->SetAttributeValueL( aName );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::SearchListUnderParentL
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CSimplePluginXdmUtils::SearchListUnderParentL(
+ CXdmDocumentNode* aParent, const TDesC& aName )
+ {
+ using namespace NSimplePlugin::NSimpleOma;
+
+ if ( !aParent )
+ {
+ return NULL;
+ }
+
+ RPointerArray<CXdmDocumentNode> resultArray;
+ RPointerArray<SXdmAttribute16> attributeArray;
+
+ CleanupClosePushL( resultArray ); // <<< resultArray
+ CleanupClosePushL( attributeArray ); // <<< attributeArray
+
+ SXdmAttribute16 attr;
+ attr.iName.Set( KSimpleName );
+ attr.iValue.Set( aName );
+ attributeArray.Append( &attr );
+
+ CXdmDocumentNode* currNode = NULL;
+
+ aParent->Find( KSimpleList, resultArray, attributeArray );
+
+ TInt count = resultArray.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ currNode = resultArray[i];
+ CXdmDocumentNode* parent = currNode->Parent();
+ if ( parent == aParent )
+ {
+ break;
+ }
+ currNode = NULL;
+ }
+
+ CleanupStack::PopAndDestroy( &attributeArray); // >>> attributeArray
+ CleanupStack::PopAndDestroy( &resultArray ); // >>> resultArray
+
+ return currNode;
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::MakeRlsUriL
+// ---------------------------------------------------------------------------
+//
+HBufC* CSimplePluginXdmUtils::MakeRlsUriL(
+ const TDesC& aXcapUri, const TDesC& aListName )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: MakeRlsUriL"));
+#endif
+
+ /* example:
+ "http://XCAP.EXAMPLE.COM/resource-lists/users/
+ sip:USER@EXAMPLE.COM/index/~~/resource-lists/list%5b@name=%22oma_blockedlist%22%5d"
+ */
+
+ using namespace NSimplePlugin::NSimpleRls;
+
+ TInt myLen = totalSize;
+ myLen += aXcapUri.Length();
+ myLen += aListName.Length();
+ myLen += iConnSets.CurrentSipPresentity().Length();
+ HBufC* myBuf = HBufC::NewL( myLen );
+
+ myBuf->Des().Append( KOne );
+ myBuf->Des().Append( aXcapUri);
+ myBuf->Des().Append( KThree );
+ myBuf->Des().Append( iConnSets.CurrentSipPresentity() );
+ myBuf->Des().Append( KFive );
+ myBuf->Des().Append( aListName );
+ myBuf->Des().Append( KSeven );
+
+ return myBuf;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::MakeRlsBuddyUriL
+// ---------------------------------------------------------------------------
+//
+HBufC* CSimplePluginXdmUtils::MakeRlsBuddyUriL(
+ const TDesC& aXcapUri, const TDesC& aListName )
+ {
+ /* example:
+ "http://XCAP.EXAMPLE.COM/resource-lists/users/
+ sip:USER@EXAMPLE.COM/~~/resource-lists/list%5b@name=%22oma_buddylist%22%5d/
+ list5d@name=%22my_friends%22%5d"
+ */
+
+ using namespace NSimplePlugin::NSimpleRlsBuddy;
+
+ TInt myLen = totalSize + aXcapUri.Length() + aListName.Length() +
+ iConnSets.CurrentSipPresentity().Length();
+
+ HBufC* myBuf = HBufC::NewL( myLen );
+ TPtr temp = myBuf->Des();
+
+ temp.Append( KOne );
+ temp.Append( aXcapUri);
+ temp.Append( KThree );
+ temp.Append( iConnSets.CurrentSipPresentity() );
+ temp.Append( KFive );
+ temp.Append( aListName );
+ temp.Append( KSeven );
+
+ return myBuf;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::GetXdmRulesL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::GetXdmRulesL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: GetXdmRulesL"));
+#endif
+ if ( !iPresenceXdm )
+ {
+ // get data from a network if not done so yet
+ iPresenceXdm = CPresenceXDM::NewL( iSettingsId );
+ }
+ User::LeaveIfError( iPresenceXdm->UpdateAllFromServerL( this ));
+ iXdmState = EGetXdmRules;
+ // The is completed in a callback method, not in RunL
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::MakeInitialXdmsDocumentL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::MakeInitialXdmsDocumentL()
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: MakeInitialXdmsDocumentL"));
+#endif
+ TBuf<KSimplePluginMaxRuleLength> myRuleId;
+
+ TBool ruleAdded( EFalse );
+
+ TPresenceActionXDM action;
+ action.Init( iPresenceXdm );
+
+ TPresenceTransformXDM transform;
+ transform.Init( iPresenceXdm );
+
+ TPresCondMisc misc;
+ misc.Init( iPresenceXdm );
+
+ TPresCondIdentityOne one;
+ one.Init( iPresenceXdm );
+
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri );
+ HBufC* listUri = MakeRlsUriL( xcapUri->Des(), KSimpleOMABlockedList );
+ CleanupStack::PushL( listUri );
+
+ // Default rule
+ // get the rule id, use run-time variation
+ myRuleId = iConnSets.Variation().DefaultRuleName(); // KSimpleXdmDefaultRule;
+ if ( myRuleId.Length() && !iPresenceXdm->IsRuleExist( myRuleId ))
+ {
+ // If default rule does not exist in the variation then do not create it.
+ MakeDefaultRuleL( myRuleId, action, transform, misc );
+ ruleAdded = ETrue;
+ }
+
+ // Block rule
+ // get the rule id, use run-time variation
+ myRuleId = iConnSets.Variation().BlockRuleName();
+ // ruleCreate = EFalse;
+
+ if ( !iPresenceXdm->IsRuleExist( myRuleId ))
+ {
+ iPresenceXdm->CreateNewRuleL( myRuleId );
+ ruleAdded = ETrue;
+
+ // use run-time variation for rule action
+ CSimplePluginVariation::TSimplePluginAuthRule authRule =
+ iConnSets.Variation().BlockRuleAction();
+
+ User::LeaveIfError( misc.AddExternListL( myRuleId, listUri->Des() ));
+
+ switch (authRule)
+ {
+ case CSimplePluginVariation::ERulePoliteBlock:
+ User::LeaveIfError( action.AddOrReplaceActionL(myRuleId, KPresPoliteBlock ));
+ break;
+ default:
+ User::LeaveIfError( action.AddOrReplaceActionL(myRuleId, KPresBlock ));
+ };
+ }
+
+ // Grant rule
+ // get the rule id, use run-time variation
+ myRuleId = iConnSets.Variation().GrantRuleName();
+ if ( !iPresenceXdm->IsRuleExist( myRuleId ))
+ {
+ iPresenceXdm->CreateNewRuleL( myRuleId );
+ ruleAdded = ETrue;
+ CleanupStack::PopAndDestroy( listUri );
+ listUri = NULL;
+ listUri = MakeRlsUriL( xcapUri->Des(), iConnSets.Variation().GrantListName() );
+ CleanupStack::PushL( listUri );
+ User::LeaveIfError( misc.AddExternListL( myRuleId, listUri->Des() ));
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresAllow ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideAllAttributes ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvidePersons ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideDevices ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideServices ));
+ }
+
+ // Grant own subscription rule
+ // get the rule id, use run-time variation
+ myRuleId = iConnSets.Variation().GrantOwnRuleName();
+ if ( !iPresenceXdm->IsRuleExist( myRuleId ))
+ {
+ iPresenceXdm->CreateNewRuleL( myRuleId );
+ ruleAdded = ETrue;
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresAllow ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideAllAttributes ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvidePersons ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideDevices ));
+ User::LeaveIfError( transform.AddOrRepProvideAllTransComplexL(
+ myRuleId, KPresProvideServices ));
+ // own sip identity
+ User::LeaveIfError( one.AddIdentityL(
+ myRuleId, iConnSets.CurrentSipPresentity() ));
+ }
+
+ // Update into server only when needed.
+ if ( ruleAdded )
+ {
+ UpdateXdmRulesL();
+ }
+ else
+ {
+ iXdmState = EUpdateXdmRules;
+ iPresXdmOk = ETrue;
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( KErrNone );
+ }
+
+ CleanupStack::PopAndDestroy( listUri );
+ CleanupStack::PopAndDestroy( xcapUri );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoGrantForAllL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoGrantForAllL()
+ {
+ const TInt KMyPresRuleIDLength(30);
+ TBuf<KMyPresRuleIDLength> myRuleId;
+
+ TInt err( KErrNone );
+
+ TPresenceActionXDM action;
+ action.Init( iPresenceXdm );
+
+ // Default rule id is searched
+ myRuleId = iConnSets.Variation().DefaultRuleName(); // KSimpleXdmDefaultRule;
+ TRAP( err, iPresenceXdm->CreateNewRuleL( myRuleId ) );
+ if ( err && err != KErrAlreadyExists )
+ {
+ User::Leave( err );
+ }
+
+ // modify the rule in the server.
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresAllow ));
+ UpdateXdmRulesL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoWithdrawFromAllL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoWithdrawFromAllL()
+ {
+ const TInt KMyPresRuleIDLength(30);
+ TBuf<KMyPresRuleIDLength> myRuleId;
+
+ /* pseudo code:
+ if current rule is ALLOW then { BLOCK }
+ otherwise no action.
+ */
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginWatcher: DoWithdrawFromAllL TEST COVERS 3"));
+#endif
+
+
+ TInt err( KErrNone );
+
+ TPresenceActionXDM action;
+ action.Init( iPresenceXdm );
+
+ // Default rule id is searched
+ myRuleId = iConnSets.Variation().DefaultRuleName();
+ TRAP( err, iPresenceXdm->CreateNewRuleL( myRuleId ) );
+ if ( err && err != KErrAlreadyExists )
+ {
+ User::Leave( err );
+ }
+
+ TBuf<KMyPresRuleIDLength> myActionBuf;
+ err = action.GetActionL( myRuleId, myActionBuf);
+
+ if ( !myActionBuf.CompareF( KPresAllow ) )
+ {
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresPoliteBlock ));
+ UpdateXdmRulesL();
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoSetReactiveAuthL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoSetReactiveAuthL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoSetReactiveAuthL TEST COVERS 5"));
+#endif
+
+ // Default rule is modified to CONFIRM
+
+ const TInt KMyPresRuleIDLength(30);
+ TBuf<KMyPresRuleIDLength> myRuleId;
+
+ TInt err( KErrNone );
+
+ TPresenceActionXDM action;
+ action.Init( iPresenceXdm );
+
+ // Default rule id is searched
+ myRuleId = iConnSets.Variation().DefaultRuleName();
+ TRAP( err, iPresenceXdm->CreateNewRuleL( myRuleId ) );
+ if ( err && err != KErrAlreadyExists )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log( _L("PluginWatcher: TEST COVERS 5b"));
+#endif
+ User::Leave( err );
+ }
+
+ // modify the rule in the server.
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresConfirm ));
+ UpdateXdmRulesL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoSetProactiveAuthL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoSetProactiveAuthL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(
+ _L("PluginWatcher: DoSetProactiveAuthL TEST COVERS 6"));
+#endif
+
+ /* pseudo code:
+ if current rule is CONFIRM then { ALLOW }
+ otherwise no action.
+ */
+
+ const TInt KMyPresRuleIDLength(30);
+ TBuf<KMyPresRuleIDLength> myRuleId;
+
+ TInt err( KErrNone );
+
+ TPresenceActionXDM action;
+ action.Init( iPresenceXdm );
+
+ // Default rule id is searched
+ myRuleId = iConnSets.Variation().DefaultRuleName();
+ TRAP( err, iPresenceXdm->CreateNewRuleL( myRuleId ) );
+ if ( err && err != KErrAlreadyExists )
+ {
+ User::Leave( err );
+ }
+
+ // modify the rule in the server.
+ TBuf<KMyPresRuleIDLength> myActionBuf;
+ err = action.GetActionL( myRuleId, myActionBuf);
+
+ if ( !myActionBuf.CompareF( KPresConfirm ) )
+ {
+ User::LeaveIfError( action.AddOrReplaceActionL( myRuleId, KPresAllow ));
+ UpdateXdmRulesL();
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ CompleteClientReq( KErrNone );
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CreateEntityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CreateEntityGroupL(
+ const TDesC& aName, const TDesC& aDisplayName )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: CreateEntityGroupL"));
+#endif
+ iOperation = EXdmCreateGroup;
+ DoCreateEntityGroupL( aName, aDisplayName );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DeleteEntityGroupL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::DeleteEntityGroupL(
+ const TDesC& aName)
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: DeleteEntityGroupL"));
+#endif
+
+ iOperation = EXdmDeleteGroup;
+ DoDeleteEntityGroupL( aName );
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::AddPresentityGroupMemberL(
+ const TDesC& aGroup,
+ const TDesC& aUser,
+ const TDesC& aDispName,
+ TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: AddPresentityGroupMemberL"));
+#endif
+
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmAddUserToGroup;
+ DoAddUserToUserListL( aGroup, aUser, aDispName );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+
+ *iClientStatus = KRequestPending;
+ iXdmState = EUpdateXdmOMAList;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemovePresentityGroupMemberL(
+ const TDesC& aGroup,
+ const TDesC& aUser,
+ TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemovePresentityGroupMemberL"));
+#endif
+
+ iClientStatus = &aStatus;
+
+ iOperation = EXdmAddUserToGroup;
+ DoRemoveUserFromUserListL( aGroup, aUser );
+
+ // send to the server and start wait a response
+ UpdateXdmsL();
+
+ *iClientStatus = KRequestPending;
+ iXdmState = EUpdateXdmOMAList;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::GetUserListsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::GetUserListsL(
+ CDesCArrayFlat& aIds, CDesCArrayFlat& aDispNames )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: GetUserListsL"));
+#endif
+ using namespace NSimplePlugin::NSimpleOma;
+
+ aIds.Reset();
+ aDispNames.Reset();
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* entry = NULL;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists ); // <<< lists
+
+ RPointerArray<CXdmDocumentNode> lists2;
+ CleanupClosePushL( lists2 ); // <<< lists2
+
+ buddylist->Find( KSimpleList, lists );
+ TInt count = lists.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ // Name
+ entry = lists[i];
+ CXdmNodeAttribute* attr = entry->Attribute( KSimpleName );
+ if ( attr )
+ {
+ aIds.AppendL( attr->AttributeValue() );
+#ifdef _DEBUG
+ TBuf<200> debug_buffer;
+ debug_buffer = attr->AttributeValue();
+ PluginLogger::Log(_L("PluginXdm: add group id into aIds : %S"), &debug_buffer );
+#endif
+ }
+ else
+ {
+ continue;
+ }
+ // Display name
+ TInt err = entry->Find( KSimpleDisplayName, lists2 );
+ // Notice: assume there is only one display-name.
+ // Always when an item is added into aIds we have to add an itmem also into aDispNames.
+ if ( !err )
+ {
+ CXdmDocumentNode* disName = lists2[0];
+ if ( !disName->IsEmptyNode() )
+ {
+ // Convert Display-Name to Unicode.
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( disName->LeafNodeContent() );
+ CleanupStack::PushL( uri16 ); // << uri16
+ aDispNames.AppendL( uri16->Des() );
+ CleanupStack::PopAndDestroy( uri16 ); // >> uri16
+ }
+ else
+ {
+ aDispNames.AppendL( KNullDesC );
+ }
+ }
+ else
+ {
+ aDispNames.AppendL( KNullDesC );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &lists2 ); // >>> lists2
+ CleanupStack::PopAndDestroy( &lists ); // >>> lists
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::GetEntitiesInListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::GetEntitiesInListL(
+ const TDesC& aList, CPtrCArray& aIds, CPtrCArray& aDispNames )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: GetEntitiesInListL"));
+#endif
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* target = DoGetUserListL( aList, buddylist );
+
+ // make a collection of MPresentityGroupMemberInfo
+ RPointerArray<CXdmDocumentNode> entries;
+ CleanupClosePushL(entries); // <<< entries
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL(nodes); // <<< nodes
+
+ target->Find( KSimpleEntry, entries );
+ TInt count = entries.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ // ID
+ CXdmDocumentNode* entry = entries[i];
+ CXdmNodeAttribute* attr = entry->Attribute( KSimpleUri );
+ if ( attr )
+ {
+ aIds.AppendL( attr->AttributeValue() );
+#ifdef _DEBUG
+ TBuf<200> debug_buffer;
+ debug_buffer = attr->AttributeValue();
+ PluginLogger::Log(_L("PluginXdm: add member into collection : %S"), &debug_buffer );
+#endif
+ }
+ else
+ {
+ continue;
+ }
+
+ // Display name
+ TInt err = entry->Find( KSimpleDisplayName, nodes );
+ // Notice: assume there is only one display-name
+ if ( !err )
+ {
+ CXdmDocumentNode* disName = nodes[0];
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( disName->LeafNodeContent() );
+ CleanupStack::PushL( uri16 ); // << uri16
+ aDispNames.AppendL( uri16->Des() );
+ CleanupStack::PopAndDestroy( uri16 ); // >> uri16
+ }
+ else
+ {
+ aDispNames.AppendL( TPtrC() );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &entries ); // >>> entries
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CommitXdmL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CommitXdmL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: CommitXdmL"));
+#endif
+ iClientStatus = &aStatus;
+
+ UpdateXdmsL();
+
+ *iClientStatus = KRequestPending;
+ iXdmState = EUpdateXdmOMAList;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CommitRlsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CommitRlsL( TRequestStatus& aStatus )
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: CommitRlsL"));
+#endif
+ iClientStatus = &aStatus;
+ *iClientStatus = KRequestPending;
+ UpdateRlsL();
+
+ iXdmState = EUpdateRlsServices;
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoCreateEntityGroupL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoCreateEntityGroupL(
+ const TDesC& aList, const TDesC& aDisName )
+ {
+ using namespace NSimplePlugin::NSimpleOma;
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ if ( buddylist->IsEmptyNode() )
+ {
+ buddylist->SetEmptyNode( EFalse );
+ }
+
+ CXdmDocumentNode* foundNode = SearchListUnderParentL(
+ buddylist, aDisName );
+
+ if ( foundNode )
+ {
+ User::Leave( KErrAlreadyExists );
+ }
+
+ CXdmDocumentNode* newNode = buddylist->CreateChileNodeL( KSimpleList );
+ CXdmNodeAttribute* attributeName = newNode->CreateAttributeL( KSimpleName );
+ attributeName->SetAttributeValueL( aList );
+
+ // Display name
+ CXdmDocumentNode* displayName = newNode->CreateChileNodeL( KSimpleDisplayName );
+ displayName->SetLeafNode( ETrue );
+ displayName->SetLeafNodeContentL( aDisName );
+
+ iXdmDoc->AppendL( newNode );
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoDeleteEntityGroupL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoDeleteEntityGroupL(
+ const TDesC& aList )
+ {
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* target = DoGetUserListL( aList, buddylist );
+ iXdmDoc->DeleteDataL( target );
+ // iXdmEngine is asked to be updated to a server by CSimplePlugingGroups later.
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoAddUserToUserListL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoAddUserToUserListL(
+ const TDesC& aList, const TDesC& aUser, const TDesC& aDisName )
+ {
+ RPointerArray<CXdmDocumentNode> resultArray;
+ RPointerArray<SXdmAttribute16> attributeArray;
+
+ CleanupClosePushL( resultArray ); // << resultArray
+ CleanupClosePushL( attributeArray ); // << attributeArray
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* target = DoGetUserListL( aList, buddylist );
+
+ if ( target->IsEmptyNode() )
+ {
+ target->SetEmptyNode( EFalse );
+ }
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ SXdmAttribute16 attr;
+ attr.iName.Set( KSimpleUri );
+ attr.iValue.Set( aUser );
+ attributeArray.Append( &attr );
+
+ // If member already exists then leave
+ target->Find( KSimpleEntry, resultArray, attributeArray );
+ if ( resultArray.Count() > 0 )
+ {
+ User::Leave( KErrAlreadyExists );
+ }
+
+ CXdmDocumentNode* newNode = target->CreateChileNodeL( KSimpleEntry );
+ CXdmNodeAttribute* attributeName = newNode->CreateAttributeL( KSimpleUri );
+ attributeName->SetAttributeValueL( aUser );
+
+ // Display name
+ CXdmDocumentNode* displayName = newNode->CreateChileNodeL( KSimpleDisplayName );
+ displayName->SetLeafNode( ETrue );
+ displayName->SetLeafNodeContentL( aDisName );
+
+ iXdmDoc->AppendL( newNode );
+
+ CleanupStack::PopAndDestroy( &attributeArray );
+ CleanupStack::PopAndDestroy( &resultArray );
+ }
+
+// ----------------------------------------------------
+// CSimplePluginXdmUtils::DoRemoveUserFromUserListL
+// ----------------------------------------------------
+//
+void CSimplePluginXdmUtils::DoRemoveUserFromUserListL(
+ const TDesC& aList, const TDesC& aUri )
+ {
+ CXdmNodeAttribute* attr = NULL;
+ TBool myFound( EFalse );
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* target = DoGetUserListL( aList, buddylist );
+
+ RPointerArray<CXdmDocumentNode> entries;
+ CleanupClosePushL( entries ); // <<< entries
+
+ User::LeaveIfError( target->Find( KSimpleEntry, entries ));
+ TInt nodeCount = entries.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = entries[i];
+ attr = currNode->Attribute( KSimpleUri );
+ if ( attr && !attr->AttributeValue().CompareF( aUri ))
+ {
+ // This is the user we are looking for deletion.
+ iXdmDoc->DeleteDataL( currNode );
+ myFound = ETrue;
+ break;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &entries ); // >>> entries
+
+ if ( !myFound )
+ {
+ // If the member is not found then leave
+ User::Leave( KErrNotFound );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoGetBuddyListL
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CSimplePluginXdmUtils::DoGetBuddyListL()
+ {
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* ret = SearchListUnderParentL( root, iConnSets.Variation().SharedXdmTop() );
+ if ( !ret )
+ {
+ User::Leave( KErrNotFound );
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoGetUserListL
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CSimplePluginXdmUtils::DoGetUserListL(
+ const TDesC& aList, CXdmDocumentNode* aBuddyList )
+ {
+ CXdmDocumentNode* listNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+ TBool found( EFalse );
+
+ using namespace NSimplePlugin::NSimpleOma;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists );
+
+ User::LeaveIfError( aBuddyList->Find( KSimpleList, lists ));
+ TInt count = lists.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ listNode = lists[i];
+ attr = listNode->Attribute( KSimpleName );
+ if ( attr && !attr->AttributeValue().CompareF( aList ))
+ {
+ // List is found
+ found = ETrue;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PopAndDestroy( &lists );
+ return listNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::UpdateXdmRulesL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::UpdateXdmRulesL()
+ {
+ _LIT( KMyOper, "UpdateXdmRulesL");
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackAsynchL(
+ KErrNone, iXdmState, iOperation, KMyOper );
+ }
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: UpdateXdmRulesL -> iPresenceXdm->UpdateToServerL"));
+#endif
+ User::LeaveIfError( iPresenceXdm->UpdateToServerL( this ));
+ iXdmState = EUpdateXdmRules;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::UpdateXdmsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::UpdateXdmsL()
+ {
+ _LIT( KMyOper, "UpdateXdmsL");
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackAsynchL(
+ KErrNone, iXdmState, iOperation, KMyOper );
+ }
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: UpdateXdmsL -> iXdmEngine->UpdateToServerL"));
+#endif
+ iXdmEngine->UpdateL( iXdmDoc, iStatus );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::UpdateRlsL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::UpdateRlsL()
+ {
+ _LIT( KMyOper, "UpdateRlsL");
+
+ if ( iTestObs )
+ {
+ // Test suite
+ iTestObs->TestCallbackAsynchL(
+ KErrNone, iXdmState, iOperation, KMyOper );
+ }
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: -> iRlsXdm->UpdateToServerL"));
+#endif
+ User::LeaveIfError( iRlsXdm->UpdateToServerL( this ));
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::SetTestObserver
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::SetTestObserver( MSimplePluginTestObs* aObs )
+ {
+ iTestObs = aObs;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CreateRlsDocumentUri16LC
+// ---------------------------------------------------------------------------
+//
+HBufC16* CSimplePluginXdmUtils::CreateRlsDocumentUri16LC(
+ const TDesC16& aGroup,
+ const TDesC16& aPresentityUri,
+ const TDesC16& aDomain )
+ {
+
+ TPtrC uriTemplate( iConnSets.Variation().RlsGroupUriTemplate() );
+
+ // Calculate URI length
+ TInt uriSize = uriTemplate.Length() + KMyLenPrefix;
+ if ( uriTemplate.Find( KSimpleGroupTag ) != KErrNotFound )
+ {
+ TPtrC p8( KSimpleGroupTag );
+ uriSize = uriSize - p8.Length() + aGroup.Length();
+ }
+ if ( uriTemplate.Find( KSimpleUserTag ) != KErrNotFound )
+ {
+ TPtrC p8( KSimpleUserTag );
+ uriSize = uriSize - p8.Length() + aPresentityUri.Length();
+ }
+ if ( uriTemplate.Find( KSimpleDomainTag ) != KErrNotFound )
+ {
+ TPtrC p8( KSimpleDomainTag );
+ uriSize = uriSize - p8.Length() + aDomain.Length();
+ }
+
+ // allocate new buffer for URI
+ // Temporarily the buffer might need more space then the final URI length
+ // (when tags are longer than the real values replacing them).
+ if ( uriSize < uriTemplate.Length() + KMyLenPrefix )
+ {
+ uriSize = uriTemplate.Length() + KMyLenPrefix +
+ aGroup.Length() + aPresentityUri.Length() + aDomain.Length();
+ }
+ HBufC16* buf = HBufC16::NewLC( uriSize );
+ TPtr16 pBuf(buf->Des());
+
+ // Append "sip:" prefix
+ pBuf.Append( KMySip );
+
+ // Append template
+ pBuf.Append( uriTemplate );
+
+ // Replace tags in URI template with the real values.
+ ReplaceGroupTag( buf, aGroup );
+ ReplaceDomainTag( buf, aDomain );
+ ReplaceUserTag( buf, aPresentityUri );
+
+ return buf;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoesUserListExistsL
+// ---------------------------------------------------------------------------
+//
+TBool CSimplePluginXdmUtils::DoesUserListExistsL( const TDesC& aName )
+ {
+ CXdmDocumentNode* buddylist = DoGetBuddyListL();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( buddylist, aName );
+ return foundNode ? ETrue : EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::AuxBuffer
+// ---------------------------------------------------------------------------
+//
+TPtrC CSimplePluginXdmUtils::AuxBuffer( )
+ {
+ return iAuxBuffer ? iAuxBuffer->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RemoveRlsServiceByResourceListL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RemoveRlsServiceByResourceListL(
+ const TDesC& aGroup, TRequestStatus& aStatus )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: RemoveRlsServiceByResourceListL"));
+#endif
+
+ TBool ret( EFalse );
+
+ iOperation = EXdmRlsRemove;
+ iClientStatus = &aStatus;
+
+ // convert a Group into resource-list value
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), aGroup );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ // remove service-uri in the rls-services document
+ ret = DoRemoveRlsServiceByResourceListL( listUri->Des() );
+
+ CleanupStack::PopAndDestroy( listUri );
+ CleanupStack::PopAndDestroy( xcapUri );
+
+ *iClientStatus = KRequestPending;
+
+ if ( ret )
+ {
+ // Update RLS document when needed.
+ UpdateRlsL();
+ iXdmState = EUpdateRlsServices;
+ }
+ else
+ {
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoRemoveRlsServiceByResourceListL
+// ---------------------------------------------------------------------------
+//
+TBool CSimplePluginXdmUtils::DoRemoveRlsServiceByResourceListL( const TDesC& aResourceList )
+ {
+ TBool ret( EFalse );
+
+ CDesC16Array* myArray = new (ELeave) CDesC16ArraySeg(10);
+ CleanupStack::PushL( myArray );
+
+ CDesC16Array* myValues = new (ELeave) CDesC16ArraySeg(10);
+ CleanupStack::PushL( myValues );
+
+ iRlsXdm->GetServiceUrisL( *myArray );
+ TInt myCount = myArray->MdcaCount();
+
+ for ( TInt i=0; i < myCount && !ret; i++ )
+ {
+ iRlsXdm->SwitchToServiceURIL( myArray->MdcaPoint( i ));
+ iRlsXdm->GetElementsL( KPresResourceList, *myValues);
+ TInt myValuesCount = myValues->MdcaCount();
+ for ( TInt j=0; j < myValuesCount; j++ )
+ {
+ if ( !myValues->MdcaPoint( i ).Compare( aResourceList ) )
+ {
+ // delete service with the URI
+ iRlsXdm->RemoveServiceURIL( myArray->MdcaPoint( i ) );
+ ret = ETrue;
+ break;
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( myValues );
+ CleanupStack::PopAndDestroy( myArray );
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RlsServiceByResourceListL
+// ---------------------------------------------------------------------------
+//
+HBufC* CSimplePluginXdmUtils::RlsServiceByResourceListLC(
+ const TDesC& aGroup )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: :RlsServiceByResourceListLC"));
+#endif
+
+ HBufC* myRet = NULL;
+
+ // convert a Group into resource-list value
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), aGroup );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ // remove service-uri in the rls-services document
+ myRet = DoGetRlsServiceByResourceListL( listUri->Des() );
+
+ CleanupStack::PopAndDestroy( listUri );
+ CleanupStack::PopAndDestroy( xcapUri );
+
+ CleanupStack::PushL( myRet );
+
+ return myRet;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::DoGetRlsServiceByResourceListL
+// ---------------------------------------------------------------------------
+//
+HBufC* CSimplePluginXdmUtils::DoGetRlsServiceByResourceListL( const TDesC& aResourceList )
+ {
+
+ HBufC* ret = NULL;
+
+ CDesC16Array* myArray = new (ELeave) CDesC16ArraySeg(10);
+ CleanupStack::PushL( myArray );
+
+ CDesC16Array* myValues = new (ELeave) CDesC16ArraySeg(10);
+ CleanupStack::PushL( myValues );
+
+ iRlsXdm->GetServiceUrisL( *myArray );
+ TInt myCount = myArray->MdcaCount();
+
+ for ( TInt i=0; i < myCount && !ret; i++ )
+ {
+ iRlsXdm->SwitchToServiceURIL( myArray->MdcaPoint( i ));
+ iRlsXdm->GetElementsL( KPresResourceList, *myValues);
+ TInt myValuesCount = myValues->MdcaCount();
+ for ( TInt j=0; j < myValuesCount; j++ )
+ {
+ if ( !myValues->MdcaPoint( i ).Compare( aResourceList ) )
+ {
+ // save the URI
+ ret = myArray->MdcaPoint( i ).AllocL();
+ break;
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( myValues );
+ CleanupStack::PopAndDestroy( myArray );
+
+ if ( !ret )
+ {
+ User::Leave( KErrNotFound );
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::RlsServiceUriNegotiationL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::RlsServiceUriNegotiationL()
+ {
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: :RlsServiceUriNegotiationL"));
+#endif
+ // Handle RLS Service URI negotiation
+
+ HBufC16* buf = CreateRlsDocumentUri16LC(
+ AuxBuffer(), iConnSets.CurrentSipPresentity(), iConnSets.CurrentDomain() );
+
+ TRAP_IGNORE( iRlsXdm->RemoveServiceURIL( buf->Des() ));
+
+ TInt errx = iRlsXdm->AddServiceURIL( iRlsXdm->NegotiatedServiceUri() );
+ if ( errx && errx != KErrAlreadyExists )
+ {
+ User::Leave( errx );
+ }
+ User::LeaveIfError( iRlsXdm->SwitchToServiceURIL( iRlsXdm->NegotiatedServiceUri() ));
+
+ HBufC* xcapUri = TXdmSettingsApi::PropertyL( iSettingsId, EXdmPropUri );
+ CleanupStack::PushL( xcapUri ); // << xcapUri
+
+ HBufC* listUri = MakeRlsBuddyUriL( xcapUri->Des(), AuxBuffer() );
+ CleanupStack::PushL( listUri ); // << listUri
+
+ TInt err = iRlsXdm->AddElementL( KPresResourceList, listUri->Des(), AuxBuffer() );
+ if ( err && err != KErrAlreadyExists )
+ {
+ User::Leave( err );
+ }
+
+ CleanupStack::PopAndDestroy( listUri ); // >> listUri
+ CleanupStack::PopAndDestroy( xcapUri ); // >> xcapUri
+ CleanupStack::PopAndDestroy( buf );
+
+ delete iAuxBuffer;
+ iAuxBuffer = NULL;
+ iAuxBuffer = iRlsXdm->NegotiatedServiceUri().AllocL();
+
+ UpdateRlsL();
+ iXdmState = EReUpdateRlsServices;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::MakeDefaultRuleL
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::MakeDefaultRuleL(
+ TDes& aRuleId,
+ TPresenceActionXDM& aAction,
+ TPresenceTransformXDM& aTransform,
+ TPresCondMisc& aMisc )
+ {
+
+#ifdef _DEBUG
+ PluginLogger::Log(_L("PluginXdm: :MakeDefaultRuleL"));
+#endif
+
+ iPresenceXdm->CreateNewRuleL( aRuleId );
+ User::LeaveIfError( aMisc.AddOtherIdentityL(aRuleId) );
+
+ // use run-time variation for rule action
+ CSimplePluginVariation::TSimplePluginAuthRule authRule =
+ iConnSets.Variation().DefaultRuleAction();
+
+ switch (authRule)
+ {
+ case CSimplePluginVariation::ERuleConfirm:
+ User::LeaveIfError( aAction.AddOrReplaceActionL(aRuleId, KPresConfirm ));
+ break;
+ case CSimplePluginVariation::ERulePoliteBlock:
+ User::LeaveIfError( aAction.AddOrReplaceActionL(aRuleId, KPresPoliteBlock ));
+ break;
+ case CSimplePluginVariation::ERuleBlock:
+ User::LeaveIfError( aAction.AddOrReplaceActionL(aRuleId, KPresBlock ));
+ break;
+ default:
+ User::LeaveIfError( aAction.AddOrReplaceActionL(aRuleId, KPresAllow ));
+ };
+ User::LeaveIfError( aTransform.AddOrRepProvideAllTransComplexL(
+ aRuleId, KPresProvideAllAttributes ));
+ User::LeaveIfError( aTransform.AddOrRepProvideAllTransComplexL(
+ aRuleId, KPresProvidePersons ));
+ User::LeaveIfError( aTransform.AddOrRepProvideAllTransComplexL(
+ aRuleId, KPresProvideDevices ));
+ User::LeaveIfError( aTransform.AddOrRepProvideAllTransComplexL(
+ aRuleId, KPresProvideServices ));
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::ReplaceGroupTag
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::ReplaceGroupTag( HBufC16* aBuf, const TDesC16& aGroup )
+ {
+ // Replace group if found
+ TPtr pBuf( aBuf->Des() );
+ TInt pos = pBuf.Find( KSimpleGroupTag );
+ if ( pos != KErrNotFound )
+ {
+ TPtrC p8( KSimpleGroupTag );
+ pBuf.Replace( pos, p8.Length(), aGroup );
+ }
+ else
+ {
+ // No tag
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::ReplaceDomainTag
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::ReplaceDomainTag( HBufC16* aBuf, const TDesC16& aDomain )
+ {
+ // Replace domain if found
+ TPtr pBuf( aBuf->Des() );
+ TInt pos = pBuf.Find( KSimpleDomainTag );
+ if ( pos != KErrNotFound )
+ {
+ // remove leading "@"
+ TPtrC p8( KSimpleDomainTag );
+ if ( aDomain[0] == '@')
+ {
+ pBuf.Replace( pos, p8.Length(), aDomain.Mid( 1 ));
+ }
+ else
+ {
+ pBuf.Replace( pos, p8.Length(), aDomain );
+ }
+ }
+ else
+ {
+ // No tag
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::ReplaceUserTag
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::ReplaceUserTag(
+ HBufC16* aBuf, const TDesC16& aPresentityUri )
+ {
+ TPtr pBuf( aBuf->Des() );
+ TInt presentityUriLen = aPresentityUri.Length();
+ // Replace user if found
+ TInt pos = pBuf.Find( KSimpleUserTag );
+ if ( pos != KErrNotFound )
+ {
+ TPtrC p8( KSimpleUserTag );
+
+ // Remove leading "sip:" or "tel:" prefix and strip off domain part from aPresentityUri.
+ TInt domainPos = presentityUriLen;
+ TInt userIdPos = 0;
+
+ if ( !aPresentityUri.Left( KMyLenPrefix ).CompareF( KMySip ) ||
+ !aPresentityUri.Left( KMyLenPrefix ).CompareF( KMyTel ))
+ {
+ userIdPos = KMyLenPrefix;
+ }
+
+ for ( TInt i = userIdPos; i < presentityUriLen; i++ )
+ {
+ if ( aPresentityUri[i] == '@' )
+ {
+ domainPos = i;
+ break;
+ }
+ }
+
+ TPtrC userId( aPresentityUri.Mid( userIdPos, domainPos - userIdPos ));
+ pBuf.Replace( pos, p8.Length(), userId );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimplePluginXdmUtils::CompleteClientReq
+// ---------------------------------------------------------------------------
+//
+void CSimplePluginXdmUtils::CompleteClientReq( TInt aStatus )
+ {
+ iXdmState = EStateIdle;
+ iOperation = ENoOperation;
+ TRequestStatus* s = iClientStatus;
+ User::RequestComplete( s, aStatus );
+ }
+
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/data/10281ef0.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 1028 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM plugin resource file for Presence Settings UI GS plugin.
+*
+*/
+
+
+
+#include <registryinfo.rh>
+#include "psuigspluginids.hrh"
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ dll_uid = PSUIGSPluginDllUid;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207236;//KGSPluginInterfaceUid
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = PSUIGSPluginImplUid;
+ version_no = 1;
+ display_name = "Presence Settings GS plugin";
+ default_data = "0x10283341";//KGSAdminPluginUid;
+ opaque_data = "30"; // Order number
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/data/psuigspluginrsc.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,497 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource file for Presence Settings UI GS plugin
+*
+*/
+
+
+
+
+// RESOURCE IDENTIFIER
+NAME UIPS // 4 letter ID
+
+// INCLUDES
+#include <bldvariant.hrh>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <eikcore.rsg>
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.loc>
+#include <gscommon.rh> // Common GS resource structures
+#include <data_caging_paths_strings.hrh>
+#include <psuigsplugin.loc>
+#include "psuigsplugin.hrh"
+
+// CONSTANTS
+#define KPSUICompulsoryChar "*"
+#define KPSUIMaxServerNameLength 100
+#define KPSUIURILength 255
+#define KPSUIMaxObjectSize 999999999
+#define KPSUIObjectSizeEditorLength 9
+#define KPSUIPublIntervalEditorLength 6
+#define KPSUISubscriptionsEditorLength 4
+
+// RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------------------------
+// RSS_SIGNATURE
+// ---------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE {}
+
+// ---------------------------------------------------------------------------
+// r_psui_mainview_menubar - menubar
+// Settings mainview's titles
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_psui_mainview_menubar
+ {
+ titles =
+ {
+ MENU_TITLE { menu_pane = r_psui_mainview_menupane; }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_mainview_menupane - menupane
+// Settings mainview's menuitems
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_psui_mainview_menupane
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EPSUICmdEdit;
+ txt = qtn_presence_settings_edit;
+ flags = EEikMenuItemAction;
+ },
+ MENU_ITEM
+ {
+ command = EPSUICmdNewSettings;
+ txt = qtn_presence_settings_new;
+ cascade = r_psui_newsettings_menu;
+ },
+ MENU_ITEM
+ {
+ command = EPSUICmdDelete;
+ txt = qtn_presence_settings_delete;
+ flags = EEikMenuItemSpecific;
+ },
+ MENU_ITEM
+ {
+ command = EAknCmdHelp;
+ txt = qtn_options_help;
+ },
+ MENU_ITEM
+ {
+ command = EAknCmdExit;
+ txt = qtn_options_exit;
+ }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_newsettings_menu - titlepane
+// Settings mainview's menuitems in New Settings cascade menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_psui_newsettings_menu
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EPSUICmdNewSettingsDefault;
+ txt = qtn_presence_settings_new_default;
+ },
+ MENU_ITEM
+ {
+ command = EPSUICmdNewSettingsExisting;
+ txt = qtn_presence_settings_new_existing;
+ }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_mainview_title - titlepane
+// Settings mainview's title
+// ---------------------------------------------------------------------------
+//
+RESOURCE TITLE_PANE r_psui_mainview_title
+ {
+ txt = qtn_presence_settings_title;
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_main_view - view
+// Settings mainview's menubar and command button area definitions
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_psui_main_view
+ {
+ menubar = r_psui_mainview_menubar;
+ cba = r_psui_mainview_softkeys;
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_mainview_softkeys - cba
+// Settings mainview's command button area definitions
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_psui_mainview_softkeys
+ {
+ flags = 0;
+ buttons =
+ {
+ CBA_BUTTON {id=EAknSoftkeyOptions; txt= text_softkey_option;},
+ CBA_BUTTON {id=EAknSoftkeyBack; txt= text_softkey_back;},
+ CBA_BUTTON {id=EPSUICmdEdit; txt= qtn_msk_edit ;}
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_setting_view - view
+// Setting view's menubar and command button area definitions
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_psui_setting_view
+ {
+ menubar = r_psui_settingview_menubar;
+ cba = r_psui_settingview_softkeys;
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_settingview_softkeys - cba
+// Settings mainview's command button area definitions
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_psui_settingview_softkeys
+ {
+ flags = 0;
+ buttons =
+ {
+ CBA_BUTTON {id=EAknSoftkeyOptions; txt= text_softkey_option;},
+ CBA_BUTTON {id=EAknSoftkeyBack; txt= text_softkey_back;},
+ CBA_BUTTON {id=EPSUICmdChange; txt= qtn_msk_change ;}
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_settingview_menubar - menubar
+// Settingview's titles
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_psui_settingview_menubar
+ {
+ titles =
+ {
+ MENU_TITLE { menu_pane = r_psui_settingview_menupane; }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_settingview_menupane - menupane
+// Settingview's menuitems
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_psui_settingview_menupane
+ {
+ items =
+ {
+ MENU_ITEM
+ {
+ command = EPSUICmdChange;
+ txt = qtn_presence_settings_change;
+ flags = EEikMenuItemAction;
+ },
+ MENU_ITEM
+ {
+ command = EAknCmdHelp;
+ txt = qtn_options_help;
+ },
+ MENU_ITEM
+ {
+ command = EEikCmdExit;
+ txt = qtn_options_exit;
+ }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_setting_items - AVKON_SETTING_ITEM_LIST
+// Setting items for presence settings
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_psui_setting_items
+ {
+ items =
+ {
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIServerNameId;
+ setting_page_resource = r_psui_server_name_setting_page;
+ name = qtn_presence_settings_name;
+ compulsory_ind_string = KPSUICompulsoryChar;
+ empty_item_text = qtn_selec_setting_compulsory;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUISIPProfileId;
+ setting_page_resource = r_radiobutton_setting_page;
+ name = qtn_presence_settings_sip_profile;
+ compulsory_ind_string = KPSUICompulsoryChar;
+ empty_item_text = qtn_selec_setting_compulsory;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIXDMSettingsId;
+ setting_page_resource = r_radiobutton_setting_page;
+ name = qtn_presence_settings_xdm_settings;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIObjectSizeId;
+ setting_page_resource = r_psui_object_size_setting_page;
+ name = qtn_presence_settings_object_size;
+ compulsory_ind_string = KPSUICompulsoryChar;
+ empty_item_text = qtn_selec_setting_compulsory;
+ },
+/* server address disabled
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIServerAddrId;
+ setting_page_resource = r_psui_server_addr_setting_page;
+ name = qtn_presence_settings_url;
+ },*/
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIPublishingIntervalId;
+ setting_page_resource = r_psui_publ_interval_setting_page;
+ name = qtn_presence_settings_time_interval;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIMaxSubscriptionsId;
+ setting_page_resource = r_psui_subscriptions_setting_page;
+ name = qtn_presence_settings_number_subscriptions;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIMaxContactsInListId;
+ setting_page_resource = r_psui_subscriptions_list_setting_page;
+ name = qtn_presence_settings_number_subsc_lists;
+ },
+ AVKON_SETTING_ITEM
+ {
+ identifier = EPSUIDomainSyntaxId;
+ setting_page_resource = r_psui_domain_syntax_setting_page;
+ name = qtn_presence_settings_domain;
+ compulsory_ind_string = KPSUICompulsoryChar;
+ empty_item_text = qtn_selec_setting_compulsory;
+ }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_server_name_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_server_name_setting_page
+ {
+ label= qtn_presence_settings_name;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EEikCtEdwin;
+ editor_resource_id = r_psui_server_name_editor;
+ }
+
+RESOURCE EDWIN r_psui_server_name_editor
+ {
+ flags = EEikEdwinNoLineOrParaBreaks;
+ width = 0;
+ lines = 0;
+ maxlength = KPSUIMaxServerNameLength;
+ }
+
+// ---------------------------------------------------------------------------
+// r_radiobutton_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_radiobutton_setting_page
+ {
+ number = EAknSettingPageNoOrdinalDisplayed;
+ label = qtn_presence_settings_sip_profile;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EAknSetListBox;
+ editor_resource_id = r_setting_listbox;
+ }
+
+RESOURCE LISTBOX r_setting_listbox
+ {
+ flags = EAknListBoxMultiselectionList;//no actual multiselection, just to make radiobutton visible in previously chosen item
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_object_size_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_object_size_setting_page
+ {
+ label= qtn_presence_settings_object_size;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EAknCtIntegerEdwin;
+ editor_resource_id = r_psui_object_size_editor;
+ }
+
+RESOURCE AVKON_INTEGER_EDWIN r_psui_object_size_editor
+ {
+ maxlength = KPSUIObjectSizeEditorLength;
+ min = 1;
+ max = KPSUIMaxObjectSize;// needed since default value is smaller
+ unset_value = -1;//KErrNotFound
+ }
+
+// ---------------------------------------------------------------------------
+// r_server_addr_setting_page
+// ---------------------------------------------------------------------------
+/* server address disabled
+RESOURCE AVKON_SETTING_PAGE r_psui_server_addr_setting_page
+ {
+ label= qtn_presence_settings_url;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EEikCtEdwin;
+ editor_resource_id = r_psui_uri_editor;
+ }*/
+
+RESOURCE EDWIN r_psui_uri_editor
+ {
+ width = 0;
+ lines = 0;
+ maxlength = KPSUIURILength;
+ flags = EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+ allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase;
+ numeric_keymap=EAknEditorCalculatorNumberModeKeymap;
+ allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+ default_input_mode = EAknEditorTextInputMode;
+ special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+ default_case = EAknEditorLowerCase;
+ avkon_flags = EAknEditorFlagLatinInputModesOnly;
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_publ_interval_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_publ_interval_setting_page
+ {
+ label= qtn_presence_settings_time_interval;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EAknCtIntegerEdwin;
+ editor_resource_id = r_psui_publ_interval_editor;
+ }
+
+RESOURCE AVKON_INTEGER_EDWIN r_psui_publ_interval_editor
+ {
+ maxlength = KPSUIPublIntervalEditorLength;
+ min = 1;
+ unset_value = -1;//KErrNotFound
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_subscriptions_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_subscriptions_setting_page
+ {
+ label= qtn_presence_settings_number_subscriptions;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EAknCtIntegerEdwin;
+ editor_resource_id = r_psui_subscriptions_editor;
+ }
+
+RESOURCE AVKON_INTEGER_EDWIN r_psui_subscriptions_editor
+ {
+ maxlength = KPSUISubscriptionsEditorLength;
+ min = 0;
+ unset_value = -1;//KErrNotFound
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_subscriptions_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_subscriptions_list_setting_page
+ {
+ label= qtn_presence_settings_number_subsc_lists;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EAknCtIntegerEdwin;
+ editor_resource_id = r_psui_subscriptions_editor;
+ }
+
+// ---------------------------------------------------------------------------
+// r_psui_domain_syntax_setting_page
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_psui_domain_syntax_setting_page
+ {
+ label= qtn_presence_settings_domain;
+ softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
+ type = EEikCtEdwin;
+ editor_resource_id = r_psui_uri_editor;
+ }
+
+// ---------------------------------------------------------
+// r_deletesettingsconf_query - query
+// Query when deleting settings
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_psui_conf_query
+ {
+ flags=EGeneralQueryFlags;
+ buttons=R_AVKON_SOFTKEYS_YES_NO;
+ items=
+ {
+ DLG_LINE
+ {
+ type=EAknCtQuery;
+ id=EGeneralQuery;
+ control= AVKON_CONFIRMATION_QUERY
+ {
+ layout = EConfirmationLayout;
+ };
+ }
+ };
+ }
+
+// ---------------------------------------------------------------------------
+// resource texts
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_presence_settings_empty_primary { buf = qtn_presence_settings_empty_primary; }
+RESOURCE TBUF r_qtn_presence_settings_empty_secondary { buf = qtn_presence_settings_empty_secondary; }
+RESOURCE TBUF r_qtn_presence_propmt_use_exist { buf = qtn_presence_propmt_use_exist; }
+RESOURCE TBUF r_qtn_presence_name_default { buf = qtn_presence_name_default; }
+RESOURCE TBUF r_qtn_presence_name_default_number { buf = qtn_presence_name_default_number; }
+RESOURCE TBUF r_qtn_query_common_conf_delete { buf = qtn_query_common_conf_delete; }
+RESOURCE TBUF r_qtn_presence_settings_delete_last { buf = qtn_presence_settings_delete_last; }
+RESOURCE TBUF r_qtn_presence_settings_not_filled { buf = qtn_presence_settings_not_filled; }
+RESOURCE TBUF r_qtn_presence_settings_name_exists { buf = qtn_presence_settings_name_exists; }
+RESOURCE TBUF r_qtn_set_folder_presence { buf = qtn_set_folder_presence; }
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for Presence Settings UI GS plugin.
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+// Help exports
+#include "../help/group/bld.inf"
+
+PRJ_EXPORTS
+// IBYs
+../rom/psuigsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(psuigsplugin.iby)
+../rom/psuigspluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(psuigspluginresources.iby)
+// LOC
+../loc/psuigsplugin.loc MW_LAYER_LOC_EXPORT_PATH(psuigsplugin.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+ OPTION TARGETFILE psuigsplugin.mif
+ OPTION HEADERFILE psuigsplugin.mbg
+ OPTION SOURCES -c8,8 qgn_prop_set_conn_presence
+END
+
+PRJ_MMPFILES
+psuigsplugin.mmp
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/test/group/ut_presencesettingsui.mmp
+
+PRJ_TESTEXPORTS
+// none
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/group/psuigsplugin.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is project specification file for Presence UI Settings GS plugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+// definitions
+CAPABILITY CAP_ECOM_PLUGIN
+TARGET psuigsplugin.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10281EF0 //PSUIGSPluginDllUid
+VENDORID VID_DEFAULT
+
+// sources
+SOURCEPATH ../data
+SOURCEPATH ../src
+SOURCE psuigspluginimplementationtable.cpp
+SOURCE psuigsplugin.cpp
+SOURCE psuigsplugincontainer.cpp
+SOURCE psuigspluginmodel.cpp
+SOURCE psuigspluginsettingview.cpp
+SOURCE psuigspluginsettingviewcontainer.cpp
+SOURCE psuisipxdmsettingitem.cpp
+SOURCE psuiintegersettingitem.cpp
+
+// includes
+USERINCLUDE ../inc
+USERINCLUDE ../data
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+//ECOM resource definition
+START RESOURCE ../data/10281ef0.rss
+TARGET psuigsplugin.rsc
+END
+
+// resources
+START RESOURCE ../data/psuigspluginrsc.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+// dependancies
+LIBRARY euser.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY commonengine.lib
+LIBRARY featmgr.lib
+LIBRARY hlplch.lib
+LIBRARY gsframework.lib
+LIBRARY gsecomplugin.lib
+LIBRARY aknskins.lib
+LIBRARY sipprofilecli.lib
+LIBRARY inetprotutil.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY presencesettingsapi.lib
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/group/psuigspluginicons.mk Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Icons for presence settings ui gs plugin
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\psuigsplugin.mif
+HEADERFILENAME=$(HEADERDIR)\psuigsplugin.mbg
+
+do_nothing :
+ @rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN :
+ if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME)
+ if exist $(HEADERFILENAME) erase $(HEADERFILENAME)
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+ mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+ /c8,8 qgn_prop_set_conn_presence.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+ @echo $(HEADERFILENAME)&& \
+ @echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
Binary file presencesettingsui/help/data/xhtml.zip has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/help/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+*
+*
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>
+PRJ_EXPORTS
+:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite
+
+../inc/pre.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/pre.hlp.hrh)
+../rom/presencesettingsuihelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(presencesettingsuihelps_variant.iby)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/help/inc/pre.hlp.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+//
+// pre.hlp.hrh generated by CSXHelp Utilities.
+//
+
+#ifndef __PRE_HLP_HRH__
+#define __PRE_HLP_HRH__
+
+_LIT(KPRE_HLP_EDIT_SET, "PRE_HLP_EDIT_SET"); //
+_LIT(KPRE_HLP_LIST_VIEW, "PRE_HLP_LIST_VIEW"); //
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/help/rom/presencesettingsuihelps_variant.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __PRESENCESETTINGSUIHELPS_VARIANT_IBY__
+#define __PRESENCESETTINGSUIHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE) && defined(__PSUIGSPLUGIN_USED)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281EF0\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10281EF0\contents.zip)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281EF0\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281EF0\index.xml)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281EF0\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281EF0\keywords.xml)
+ data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10281EF0\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10281EF0\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigsplugin.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: GSFW plugin header for Presence Settings UI GS plugin.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGIN_H
+#define PSUIGSPLUGIN_H
+
+// INCLUDES
+#include <eikmobs.h>
+#include <ConeResLoader.h>
+#include <gsbaseview.h>
+
+// FORWARD DECLARATIONS
+class CPSUIGSPluginContainer;
+class CPSUIGSPluginModel;
+
+// CLASS DECLARATION
+
+/**
+* Header of CPSUIGSPlugin which implements the CGSPluginInterface.
+*
+* @lib PSUIGSPlugin.lib
+* @since Series60_3.2
+*/
+class CPSUIGSPlugin :
+ public CGSBaseView,
+ public MCoeViewDeactivationObserver,
+ public MEikListBoxObserver
+ {
+
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS two-phased constructor
+ */
+ static CPSUIGSPlugin* NewL( TAny* aAppUi );
+
+ /**
+ * Destructor.
+ */
+ ~CPSUIGSPlugin();
+
+ private: // Functions from base classes
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ TUid Id() const;
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid aCustomMessageId,
+ const TDesC8& aCustomMessage );
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void DoDeactivate();
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * From CGSBaseView
+ * See base class.
+ */
+ void NewContainerL();
+
+ /**
+ * From CGSBaseView
+ * See base class.
+ */
+ void HandleListBoxSelectionL();
+
+ /**
+ * From CGSPluginInterface
+ * See base class.
+ */
+ void GetCaptionL( TDes& aCaption ) const;
+
+ /**
+ * From CGSPluginInterface
+ * See base class.
+ */
+ TInt PluginProviderCategory() const;
+
+ /**
+ * From CGSPluginInterface
+ * See base class.
+ */
+ CGulIcon* CreateIconL( const TUid aIconType );
+
+ /**
+ * From MEikMenuObserver
+ * See base class.
+ */
+ void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane );
+
+ /**
+ * From MCoeViewDeactivationObserver
+ * Used to be able to free memory when plugin get's closed.
+ * See base class.
+ */
+ void HandleViewDeactivation (
+ const TVwsViewId& aViewIdToBeDeactivated,
+ const TVwsViewId& aNewlyActivatedViewId );
+
+ /**
+ * From MEikListBoxObserver
+ * See base class.
+ */
+ void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+ public: // New
+
+ /**
+ * Gives a handle to PS Model. Ownership is not transferred.
+ *
+ * @return handle to PS Model
+ */
+ CPSUIGSPluginModel* PSModel();
+
+ /**
+ * Takes care of settings deletion.
+ */
+ void DeleteSettingsL();
+
+ private: // New
+
+ /**
+ * Returns count and index of current item in listbox.
+ *
+ * @param aIndex returns the index. If no items, KErrNotFound.
+ * @return TInt containing the count.
+ */
+ TInt SettingCountAndIndex( TInt& aIndex );
+
+ /**
+ * Shows the delete certain setting set confirmation note.
+ *
+ * @param aCount is the amount of all settings
+ * @param aIndex is the to be deleted setting set
+ * @return TBool about proceed with deletion.
+ */
+ TBool AcceptDeletionL( TInt aCount, TInt aIndex );
+
+ /**
+ * Constructs the setting view
+ */
+ void ConstructSettingViewL();
+
+ /**
+ * Removes the setting view
+ */
+ void RemoveSettingView();
+
+ /**
+ * Create new default settings and launch setting view
+ */
+ void CreateNewDefaultSettingsL();
+
+ /**
+ * Create new a copy of existing settings and launch setting view
+ */
+ void CreateCopyOfExistingSettingsL();
+
+ /**
+ * Toggles visibility of MSK depending on the amount of setting sets
+ */
+ void UpdateMSK();
+
+ private: // Constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CPSUIGSPlugin();
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ // Presence UI model
+ CPSUIGSPluginModel* iPSModel;
+ // Presence Setting view
+ CAknView* iSettingView;
+ // Indicates when PSUIGSPlugin's views are closed
+ TBool iClosing;
+ // Previous view
+ TVwsViewId iPSUIGSPrevViewId;
+
+#ifdef _DEBUG
+ friend class UT_CPSUIGSPlugin;
+ friend class UT_CPSUIGSPluginContainer;
+#endif
+ };
+
+#endif // PSUIGSPLUGIN_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigsplugin.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings UI command definitions.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGIN_HRH
+#define PSUIGSPLUGIN_HRH
+
+/**
+* Commands used from menus
+*/
+enum TPSUIMenuCommands
+ {
+ EPSUICmdEdit = 100,
+ EPSUICmdNewSettings,
+ EPSUICmdNewSettingsDefault,
+ EPSUICmdNewSettingsExisting,
+ EPSUICmdDelete,
+ EPSUICmdChange
+ };
+
+/**
+* Ids for different setting fields
+*/
+enum TPSUISettingItemId
+ {
+ EPSUIServerNameId,
+ EPSUISIPProfileId,
+ EPSUIXDMSettingsId,
+ EPSUIObjectSizeId,
+ EPSUIServerAddrId,
+ EPSUIPublishingIntervalId,
+ EPSUIMaxSubscriptionsId,
+ EPSUIMaxContactsInListId,
+ EPSUIDomainSyntaxId
+ };
+
+#endif //PSUIGSPLUGIN_HRH
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigsplugincontainer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header for Presence Settings UI GS plugin container.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGINCONTAINER_H
+#define PSUIGSPLUGINCONTAINER_H
+
+// INCLUDES
+#include <eikmobs.h>
+#include <GSBaseContainer.h>
+
+// FORWARD DECLARATIONS
+class CPSUIGSPlugin;
+
+// CLASS DECLARATION
+
+/**
+* CPSUIGSPluginContainer container class
+* @since Series60_3.2
+*/
+class CPSUIGSPluginContainer : public CGSBaseContainer,
+ public MEikMenuObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Default constructor.
+ */
+ CPSUIGSPluginContainer( CPSUIGSPlugin* aView );
+
+ /**
+ * Destructor.
+ */
+ ~CPSUIGSPluginContainer();
+
+ private: // Functions from base classes
+
+ /**
+ * From CGSBaseContainer
+ * See base class.
+ */
+ void ConstructListBoxL( TInt aResLbxId );
+
+ /**
+ * From CGSBaseContainer
+ * See base class.
+ */
+ TKeyResponse OfferKeyEventL(
+ const TKeyEvent& aKeyEvent,
+ TEventCode aType );
+
+ /**
+ * From CCoeControl
+ * See base class.
+ */
+ void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+ /**
+ * From MEikMenuObserver
+ */
+ void SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ){};
+
+
+ /**
+ * From MEikMenuObserver
+ */
+ void ProcessCommandL( TInt /*aCommandId*/ ){};
+
+ private: // New
+
+ /**
+ * Sets empty texts to listbox
+ *
+ * @param none
+ */
+ void SetEmptyTextsToListboxL();
+
+ private: // Constructor
+
+ /**
+ * Symbian OS constructor.
+ *
+ * @param aRect Listbox's rect.
+ */
+ void ConstructL( const TRect& aRect );
+
+ private: // Data
+
+ // Handle to view
+ CPSUIGSPlugin* iView; // not owned
+
+ /**
+ * Menubar.
+ * Own.
+ */
+ CEikMenuBar* iEikMenuBar;
+
+#ifdef _DEBUG
+ friend class UT_CPSUIGSPluginContainer;
+#endif
+ };
+
+#endif //PSUIGSPLUGINCONTAINER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigspluginids.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file for Presence Settings GS plugin id consts
+*
+*/
+
+
+
+
+#ifndef __PSUIGSPLUGINIDS_HRH_
+#define __PSUIGSPLUGINIDS_HRH_
+
+/**
+* UID of the Presence Settings GS plugin dll
+*/
+#define PSUIGSPluginDllUid 0x10281EF0
+
+/**
+* UID of the Presence Settings GS plugin implementation
+*/
+#define PSUIGSPluginImplUid 0x10281EF1
+
+#endif // PSUIGSPLUGINIDS_HRH_
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigspluginmodel.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence settings UI model header.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGINMODEL_H
+#define PSUIGSPLUGINMODEL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <sipprofileregistryobserver.h>
+#include <pressettingsapi.h>
+#include "psuigsplugin.hrh"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class RPresenceSettingsArray;
+class CSIPManagedProfileRegistry;
+class CSIPManagedProfile;
+
+// Constants
+_LIT( KPSUIGSPluginPanicCategory, "PSUIGSPlugin" );
+
+/**
+* Presence settings UI model
+*
+* @lib PSUIGSPlugin.lib
+* @since Series60_3.2
+*/
+class CPSUIGSPluginModel :
+ public CBase,
+ public MDesCArray,
+ public MSIPProfileRegistryObserver
+ {
+
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS two-phased constructor
+ */
+ static CPSUIGSPluginModel* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CPSUIGSPluginModel();
+
+ public: // New
+
+ //
+ //
+ // Presence settings related
+
+ /**
+ * Retrieves current presence settings from system
+ */
+ void RetrieveSettingsL();
+
+ /**
+ * Stores current presence settings to system
+ */
+ void SaveSettingsL();
+
+ /**
+ * Checks are the compulsory fields filled.
+ *
+ * @return boolean about filled fields
+ */
+ TBool AllCompulsoryFieldsFilled();
+
+ /**
+ * Prepares iSettingSet for editing
+ *
+ * @param aIndex of presence settings to be edited
+ */
+ void EditSettingsL( TInt aIndex );
+
+ /**
+ * Refreshes the presence settings related arrays
+ */
+ void RefreshPSArraysL();
+
+ /**
+ * Prepares the iSettingSet and iSettingId
+ * with default values
+ */
+ void CreateDefaultSettingsL();
+
+ /**
+ * Prepares the iSettingSet and iSettingId
+ * with values from indexed presence setting
+ *
+ * @param aIndex is the presence settings to be duplicated
+ */
+ void DuplicateExistingSettingsL( TInt aIndex );
+
+ /**
+ * Creates new name for to be created settings. If aOriginal
+ * provided, then will use that as a base. If not, then will
+ * create the name based on default naming. Adds numbering to
+ * end of name if needed.
+ * Note : aOriginal will be stored to cleanupstack if provided
+ *
+ * @param aOriginal is optional base name
+ *
+ */
+ HBufC* CreateSettingNameLC( HBufC* aOriginal = NULL );
+
+ /**
+ * Deletes indexed settings through presence settings API.
+ *
+ * @param aToBeDeleted to be deleted settings
+ * @param aIsIndex tells is aToBeDeleted index or id
+ */
+ void DeleteSettingsL( TInt aToBeDeleted, TBool aIsIndex );
+
+ /**
+ * Returns name of the indexed settings.
+ *
+ * @param aIndex of the wanted name
+ * @return HBufC* containing the name
+ */
+ HBufC* SettingNameLC( TInt aIndex );
+
+ /**
+ * Checks if there already is settings with the same name.
+ */
+ TBool IsItDuplicatePSName();
+
+ /**
+ * Returns iPSNameArray, which contains names of the
+ * different setting sets. Ownership of array stays in
+ * CPSUIGSPluginModel.
+ *
+ * @return CDesCArray* containing the names of the settings
+ */
+ CDesCArray* SettingNames();
+
+ /**
+ * Returns a reference to iSettingSet.
+ *
+ * @return TPresSettingsSet& containing one set of the settings
+ */
+ TPresSettingsSet& SettingsSet();
+
+ /**
+ * Checks the validity of SIP- and XDM-fields,
+ * if not valid empties the fields.
+ */
+ void ClearInvalidSIPAndXDMSettingsL();
+
+ /**
+ * Returns a reference to iSettingSetId.
+ *
+ * @return TInt& containing setting id
+ */
+ TInt& SettingsId();
+
+ /**
+ * Returns a reference to iPSIdArray.
+ *
+ * @return RArray<TInt>& containing iPSIdArray
+ */
+ RArray<TInt>& SettingsIDArray();
+
+ //
+ //
+ // SIP related
+
+ /**
+ * Fetches names of defined SIP-profiles
+ * Refreshes also SIP related arrays.
+ *
+ * @return descriptor array of names
+ */
+ CDesCArray* SipProfilesLC();
+
+ /**
+ * Fetches the ID of indexed SIP profile
+ *
+ * @param aIndex is the index in the array
+ * @return ID of the SIP profile
+ */
+ TInt SipProfileId( TInt aIndex );
+
+ /**
+ * Fetches the index of ID'ed SIP profile
+ *
+ * @param aId is ID of the SIP profile
+ * @return index in the array
+ */
+ TInt SipProfileIndex( TInt aId );
+
+ /**
+ * Fetches the name of ID'ed SIP profile
+ * Refreshes also SIP related arrays.
+ *
+ * @param aId is ID of the SIP profile
+ * @return descriptor containing the name
+ */
+ HBufC* SipProfileNameL( TInt aId );
+
+ //
+ //
+ // XDM related
+
+ /**
+ * Fetches names of defined XDM settings.
+ * Refreshes also XDM related arrays.
+ *
+ * @return descriptor array of names
+ */
+ CDesCArray* XdmCollectionNamesL();
+
+ /**
+ * Fetches the name of ID'ed XDM setting
+ *
+ * @param aId is ID of the SIP profile
+ * @return descriptor containing the name
+ */
+ HBufC* XdmCollectionNameL( TInt aId );
+
+ /**
+ * Fetches the index of ID'ed XDM setting
+ *
+ * @param aId is ID of the SIP profile
+ * @return index in the array
+ */
+ TInt XdmSettingIndex( TInt aId );
+
+ /**
+ * Fetches the ID of indexed XDM setting
+ *
+ * @param aIndex is the index in the array
+ * @return ID of the SIP profile
+ */
+ TInt XdmSettingId( TInt aIndex );
+
+ private: // New
+
+ /**
+ * Destroys given array. Used with TCleanupItem.
+ *
+ * @param pointerarray to be deleted
+ */
+ static void ResetAndDestroy( TAny* aPointerArray );
+
+ /**
+ * Refreshes the SIP profile array. Needs to be
+ * called before calling most of the SIP-related methods.
+ */
+ void ReadSipArrayFromEngineL();
+
+ /**
+ * Checks if there is ordinal numbering at the end of
+ * descriptor and rips it off if there is.
+ *
+ * @return HBufC* containing the name ready for the numbering
+ */
+ HBufC* GetPrefixL( HBufC* aName );
+
+ /**
+ * Re-arranges presence settings (name and id arrays)
+ * to alphabetical order.
+ */
+ void ReArrangePresenceSettingsL();
+
+ private: // Functions from base classes
+
+ /**
+ * from MSIPProfileRegistryObserver
+ * Refreshes in most cases SIP related arrays.
+ *
+ * See base class.
+ */
+ void ProfileRegistryEventOccurred(
+ TUint32 aSIPProfileId,
+ TEvent aEvent );
+
+ /**
+ * from MSIPProfileRegistryObserver
+ * Refreshes SIP related arrays.
+ *
+ * See base class.
+ */
+ void ProfileRegistryErrorOccurred(
+ TUint32 aSIPProfileId,
+ TInt aError);
+
+ /**
+ * from MDesCArray
+ * See base class.
+ */
+ TInt MdcaCount() const;
+
+ /**
+ * from MDesCArray
+ * See base class.
+ */
+ TPtrC16 MdcaPoint( TInt aIndex ) const;
+
+ private: // Constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CPSUIGSPluginModel();
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ // Currently edited presence settings
+ TPresSettingsSet iSettingSet;
+ // Setting identifier
+ TInt iSettingId;
+ // SIP profile registry
+ CSIPManagedProfileRegistry* iSIPEngine;
+ // SIP profile array
+ CArrayPtrFlat<CSIPManagedProfile>* iSIPProfiles;
+ // XDM ID array
+ RArray<TInt> iXdmIdArray;
+ // XDM name array
+ CDesCArray* iXdmNameArray;
+ // Presence settings id array
+ RArray<TInt> iPSIdArray;
+ // Presence settings name array
+ CDesCArray* iPSNameArray;
+ // Texts for the MDesCArray
+ HBufC* iVisibleSettingName;
+
+ };
+
+/**
+* Small utility class to store presence settings
+* name and id.
+* Used in CPSUIGSPluginModel::ReArrangePresenceSettingsL().
+*
+* @lib PSUIGSPlugin.lib
+* @since Series60_3.2
+*/
+class CPSUINameIDPair :
+ public CBase
+ {
+ public :
+ inline ~CPSUINameIDPair() { delete iName; };
+
+ public :
+ TInt iID;
+ HBufC* iName;
+ };
+
+#endif // PSUIGSPLUGINMODEL_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigspluginsettingview.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings UI's setting view.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGINSETTINGVIEW_H
+#define PSUIGSPLUGINSETTINGVIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+// FORWARD DECLARATIONS
+class CPSUIGSPluginContainer;
+class CPSUIGSPluginSettingViewContainer;
+class CPSUIGSPlugin;
+
+const TUid KPreSettingViewId = {313};
+
+// CLASS DECLARATION
+
+/**
+* Header of CPSUIGSPluginSettingView.
+*
+* @lib PSUIGSPlugin.lib
+* @since Series60_3.2
+*/
+class CPSUIGSPluginSettingView :
+ public CAknView
+ {
+
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS two-phased constructor
+ */
+ static CPSUIGSPluginSettingView* NewL( CPSUIGSPlugin* aMainView );
+
+ /**
+ * Destructor.
+ */
+ ~CPSUIGSPluginSettingView();
+
+ private: // Functions from base classes
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ TUid Id() const;
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid aCustomMessageId,
+ const TDesC8& aCustomMessage );
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void DoDeactivate();
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void HandleCommandL( TInt aCommand );
+
+ /**
+ * From CAknView
+ * See base class.
+ */
+ void HandleViewRectChange();
+
+ public : // New
+
+ /**
+ * Gives a handle to plugin main view. Ownership is not transferred.
+ *
+ * @return handle to plugin main view
+ */
+ CPSUIGSPlugin* MainView();
+
+ /**
+ * Uses model to check if name is a duplicate and if it
+ * is shows a note.
+ *
+ * @return TBool about if duplicates were found
+ */
+ TBool HandleDuplicatePSNamesL();
+
+ private: // New
+
+ /**
+ * Creates the setting view container
+ *
+ * @param none
+ */
+ void CreateContainerL();
+
+ /**
+ * Handles back-key presses. Checks if all compulsory
+ * fields are filled and if there is duplicates. Based on
+ * this saves and switches view back to main view.
+ */
+ void HandleBackKeyL();
+
+ /**
+ * Handles saving funtionality when Exit is chosen from Menu.
+ * Checks if all compulsory fields are filled and in case of
+ * duplicate changes name, after this saves settings.
+ */
+ void HandleMenuExitL();
+
+ private: // Constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CPSUIGSPluginSettingView( CPSUIGSPlugin* aMainView );
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void ConstructL();
+
+ private: // Data
+
+ // Previous view ID
+ TVwsViewId iPrevViewId;
+ // Pointer to application UI.
+ CAknViewAppUi* iAppUi;
+ // Presence setting view container
+ CPSUIGSPluginSettingViewContainer* iPSUIContainer;
+ // Handle to main view
+ CPSUIGSPlugin* iMainView; // not owned
+ };
+
+#endif // PSUIGSPLUGINSETTINGVIEW_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuigspluginsettingviewcontainer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header for Presence Settings UI setting view container.
+*
+*/
+
+
+
+
+#ifndef PSUIGSPLUGINSETTINGVIEWCONTAINER_H
+#define PSUIGSPLUGINSETTINGVIEWCONTAINER_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+// FORWARD DECLARATIONS
+class CAknColumnListBox;
+class CPSUIGSPluginSettingView;
+
+// CLASS DECLARATION
+
+/**
+* CPSUIGSPluginSettingViewContainer container class
+* @since Series60_3.2
+*/
+class CPSUIGSPluginSettingViewContainer :
+ public CAknSettingItemList
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Default constructor.
+ */
+ CPSUIGSPluginSettingViewContainer( CPSUIGSPluginSettingView* aView );
+
+ /**
+ * Destructor.
+ */
+ ~CPSUIGSPluginSettingViewContainer();
+
+ private: // Functions from base classes
+
+ /**
+ * From CAknSettingItemList
+ * See base class.
+ */
+ CAknSettingItem* CreateSettingItemL( TInt aSettingId );
+
+ /**
+ * From CCoeControl
+ * See base class.
+ */
+ void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+ /**
+ * From CCoeControl
+ * See base class.
+ */
+ void HandleResourceChange(TInt aType);
+
+ /**
+ * From CCoeControl
+ * See base class.
+ */
+ void SizeChanged();
+
+ private: // New
+
+ /**
+ * Update titlepane with setting name
+ *
+ * @param none
+ */
+ void UpdateTitleL();
+
+ public: // Functions from base classes
+
+ /**
+ * From CAknSettingItemList
+ * See base class.
+ */
+ void EditItemL( TInt aIndex, TBool aCalledFromMenu );
+
+ public: // New
+
+ /**
+ * Edit setting which is currently under focus.
+ *
+ * @param none
+ */
+ void EditCurrentItemL();
+
+ public: // Constructor
+
+ /**
+ * Symbian OS constructor.
+ *
+ * @param aRect Listbox's rect.
+ */
+ void ConstructL( const TRect& aRect );
+
+ private: // Data
+
+ // Pointer to view
+ CPSUIGSPluginSettingView* iView;
+ };
+
+#endif //PSUIGSPLUGINSETTINGVIEWCONTAINER_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuiintegersettingitem.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Setting item for integer values
+*
+*/
+
+
+
+
+#ifndef PSUIINTEGERSETTINGITEM_H
+#define PSUIINTEGERSETTINGITEM_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* CPSUIIntegerSettingItem setting class. Needed to be able to
+* keep default values invisible.
+* @since Series60_3.2
+*/
+class CPSUIIntegerSettingItem : public CAknIntegerEdwinSettingItem
+ {
+ public : // Constructors and destructor
+
+ /*
+ * C++ default constructor.
+ */
+ CPSUIIntegerSettingItem( TInt aIdentifier, TInt& aValue );
+
+ /**
+ * Destructor
+ */
+ ~CPSUIIntegerSettingItem();
+
+ private: // Functions from base classes
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual const TDesC& SettingTextL();
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual void CompleteConstructionL();
+
+ private: // Data
+
+ // since no access to base classes descriptors,
+ // here are similar ones
+ HBufC* iPSUIInternalText;
+ TPtr iPSUIInternalTextPtr;
+ };
+
+#endif //PSUIINTEGERSETTINGITEM_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/inc/psuisipxdmsettingitem.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Setting item for SIP / XDM settings
+*
+*/
+
+
+
+
+#ifndef PSUISIPXDMSETTINGITEM_H
+#define PSUISIPXDMSETTINGITEM_H
+
+// INCLUDES
+#include <aknsettingitemlist.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CPSUIGSPluginModel;
+
+/**
+* CPSUISipXdmSettingItem setting class
+* @since Series60_3.2
+*/
+class CPSUISipXdmSettingItem : public CAknSettingItem
+ {
+
+ public: // Constructors and destructor
+
+ /*
+ * C++ default constructor.
+ */
+ CPSUISipXdmSettingItem( TInt aIdentifier, TInt& aId, CPSUIGSPluginModel* iPSModel );
+
+ /**
+ * Destructor
+ */
+ ~CPSUISipXdmSettingItem();
+
+ private: // New
+
+ /**
+ * Like in CAknSettingItem, but SIP specific.
+ */
+ void EditSipItemL();
+
+ /**
+ * Like in CAknSettingItem, but XDM specific.
+ */
+ void EditXdmItemL();
+
+ /**
+ * Launches the actual radio button setting dialog with data given.
+ *
+ * @param aIndex is currently selected setting
+ * @param aArray contains the settings to choose from
+ */
+ void LaunchSettingDlgL( TInt& aIndex, CDesCArray* aArray );
+
+ private: // Functions from base classes
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual void StoreL();
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual void LoadL();
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual const TDesC& SettingTextL();
+
+ /**
+ * From CAknSettingItem
+ * See base class.
+ */
+ virtual void EditItemL( TBool aCalledFromMenu );
+
+ protected: // Data
+
+ // reference to external value
+ TInt& iExtChosenSettingID;
+ // internal value
+ TInt iIntChosenSettingID;
+ // pointer to PSUI model
+ CPSUIGSPluginModel* iPSModel;// owned elsewhere
+ // internal text having the listbox text
+ HBufC* iPSUIInternalText;// owned
+};
+
+#endif //PSUISIPXDMSETTINGITEM_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/loc/psuigsplugin.loc Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Localisation strings for Presence Settings UI
+*
+*/
+
+
+
+
+
+/////////////////////////////////////////////////
+// Main view related
+
+// d:Title shown in title pane of main state.
+// l:title_pane_t2/opt9
+// r:3.2
+//
+#define qtn_presence_settings_title "Presence settings"
+
+// d:This is shown in listbox when no settings are defined. Primary text.
+// l:main_pane_empty_t1/opt2
+// r:3.2
+//
+#define qtn_presence_settings_empty_primary "No presence settings"
+
+// d:This is shown in listbox when no settings are defined. Secondary text.
+// l:main_list_empty_pane/opt2
+// r:3.2
+//
+#define qtn_presence_settings_empty_secondary "Please contatct your service provider for Presence settings"
+
+// d:Command in options menu for editing one set of presence settings
+// l:list_single_pane_t1_cp2
+// r:3.2
+//
+#define qtn_presence_settings_edit "Edit"
+
+// d:Submenu in options menu for commands for creating new settings.
+// l:list_single_pane_t1_cp2/opt3
+// r:3.2
+//
+#define qtn_presence_settings_new "New settings"
+
+// d:Command in submenu for creating new settings based on default settings.
+// l:list_single_popup_submenu_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_new_default "Default settings"
+
+// d:Command in submenu for creating new settings based on settings chosen by user.
+// l:list_single_popup_submenu_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_new_existing "Use existing"
+
+// d:Command in options menu for deleting one setting set.
+// l:list_single_pane_t1_cp2
+// r:3.2
+//
+#define qtn_presence_settings_delete "Delete"
+
+// d:Title of listbox when selecting which set to copy as a base of new settings.
+// l:heading_pane_t1
+// r:3.2
+//
+#define qtn_presence_propmt_use_exist "Use existing set"
+
+
+/////////////////////////////////////////////////
+// Setting view related
+
+// d:Command in options menu for changing setting values.
+// l:list_single_pane_t1_cp2
+// r:3.2
+//
+#define qtn_presence_settings_change "Change"
+
+// d:Title for the service name setting field in setting listbox.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_name "Service Name"
+
+// d:Title of chosen SIP profile -setting field in setting listbox.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_sip_profile "SIP Profile"
+
+// d:Title of chosen XDM settings -setting field in setting listbox.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_xdm_settings "XDM Settings"
+
+// d:Title of object size -setting field in setting listbox. This defines
+// d:the maximum size of the MIME object data in bytes when PUBLISH and NOTIFY methods are used.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_object_size "Object size"
+
+// d:Title of server address -setting field in setting listbox. This
+// d:defines the HTTP URL of the content server.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_url "Server address"
+
+// d:Title of publishing interval -setting field in setting listbox. This defines
+// d:the minimum time interval (in seconds) between two consecutive publications.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_time_interval "Publishing interval (sec)"
+
+// d:Title of maximum subscriptions -setting field in setting listbox. This
+// d:defines the maximum number of presence subscriptions.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_number_subscriptions "Maximum subscriptions"
+
+// d:Title of max contacts in list -setting field in setting listbox. This
+// d:defines the maximum number of contacts in the subscription list.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_number_subsc_lists "Max. contacts in list"
+
+// d:Title for the domain name setting field in setting listbox.
+// d:This defines the domain name part of the service URL including the at-sign.
+// l:list_setting_pane_t1
+// r:3.2
+//
+#define qtn_presence_settings_domain "Domain Name"
+
+// d:Confirmation query text for deleting the last setting set defined.
+// l:popup_note_window
+// r:3.2
+//
+#define qtn_presence_settings_delete_last "%U is the last presence settings. Are you sure to delete it?"
+
+// d:Confirmation query text shown when trying to go back from edit view
+// d:to main view (saves settings) without all the compulsory setting fields filled.
+// l:popup_note_window
+// r:3.2
+//
+#define qtn_presence_settings_not_filled "Presence settings are incomplete. Delete created settings?"
+
+// d:Confirmation query text shown when trying to go back from edit view
+// d:to main view (saves settings) and there are already a setting set named with same name.
+// l:popup_note_window
+// r:3.2
+//
+#define qtn_presence_settings_name_exists "Name %U already in use"
+
+
+/////////////////////////////////////////////////
+// Both main and setting view related
+
+// d:Default name for the presence settings.
+// d:Used in couple of different layouts and the smallest space available is in list_set_graphic_pane_t1.
+// l:list_set_graphic_pane_t1
+// r:3.2
+//
+#define qtn_presence_name_default "Default name"
+
+// d:Version with numbering if the default name for settings is already used.
+// d:Used in couple of different layouts and the smallest space available is in list_set_graphic_pane_t1.
+// l:list_set_graphic_pane_t1
+// r:3.2
+//
+#define qtn_presence_name_default_number "Default name(%N)"
+
+
+/////////////////////////////////////////////////
+// Other
+
+// d:Title of presence settings in general settings/connection tab.
+// l:list_single_large_graphic_pane_t1
+// r:3.2
+//
+#define qtn_set_folder_presence "Presence"
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/rom/psuigsplugin.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ROM creation file for presence settings ui
+*
+*/
+
+
+
+
+#ifndef __PSUIGSPLUGIN_IBY__
+#define __PSUIGSPLUGIN_IBY__
+
+#include <bldvariant.hrh>
+
+#ifdef RD_GS_RENOVATION_PHASE2
+#ifdef __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+ECOM_PLUGIN(psuigsplugin.dll,10281ef0.rsc)
+data=DATAZ_\BITMAP_DIR\psuigsplugin.mif BITMAP_DIR\psuigsplugin.mif
+
+#endif RD_GS_RENOVATION_PHASE2
+#endif __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+#endif //__PSUIGSPLUGIN_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/rom/psuigspluginresources.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ROM creation file for presence settings ui resources
+*
+*/
+
+
+
+
+#ifndef __PSUIGSPLUGINRESOURCES_IBY__
+#define __PSUIGSPLUGINRESOURCES_IBY__
+
+#include <bldvariant.hrh>
+
+#ifdef RD_GS_RENOVATION_PHASE2
+#ifdef __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+data=DATAZ_\RESOURCE_FILES_DIR\psuigspluginrsc.rsc RESOURCE_FILES_DIR\psuigspluginrsc.rsc
+
+#endif RD_GS_RENOVATION_PHASE2
+#endif __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+#endif //__PSUIGSPLUGINRESOURCES_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigsplugin.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,534 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: GSFW implementation for Presence Settings UI GS plugin.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <gsprivatepluginproviderids.h>
+#include <GSFWViewUIDs.h>
+#include <psuigspluginrsc.rsg>
+#include <psuigsplugin.mbg>
+#include <GSBaseView.h>
+#include <eiktxlbx.h>
+#include <eikmenup.h>
+#include <eiktxlbm.h>
+#include <featmgr.h>
+#include <hlplch.h>
+#include <coeaui.h>
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+
+#include "psuigsplugin.h"
+#include "psuigsplugin.hrh"
+#include "psuigsplugincontainer.h"
+#include "psuigspluginids.hrh"
+#include "psuigspluginmodel.h"
+#include "psuigspluginsettingview.h"
+
+// CONSTANTS
+_LIT( KPSUIGSPluginResourceFileName, "z:\\resource\\psuigspluginrsc.rsc" );
+
+#ifdef __SCALABLE_ICONS
+// bitmap
+_LIT( KPSUIGSPluginIconFileName, "\\resource\\apps\\psuigsplugin.mif");
+#else //__SCALABLE_ICONS
+// svg file
+_LIT( KPSUIGSPluginIconFileName, "\\resource\\apps\\psuigsplugin.mbm");
+#endif //__SCALABLE_ICONS
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::CPSUIGSPlugin()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPlugin::CPSUIGSPlugin()
+ : iClosing ( EFalse )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::~CPSUIGSPlugin()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPlugin::~CPSUIGSPlugin()
+ {
+ delete iPSModel;
+ FeatureManager::UnInitializeLib();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::ConstructL()
+ {
+ // preparing resources for use
+ TFileName fileName( KPSUIGSPluginResourceFileName );
+ BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
+ iResourceLoader.OpenL( fileName );
+ // base construct (base needs the resources to be loaded 1st)
+ BaseConstructL( R_PSUI_MAIN_VIEW );
+ FeatureManager::InitializeLibL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::NewL()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPlugin* CPSUIGSPlugin::NewL( TAny* /*aAppUi*/ )
+ {
+ CPSUIGSPlugin* self = new( ELeave ) CPSUIGSPlugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::Id()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TUid CPSUIGSPlugin::Id() const
+ {
+ return TUid::Uid( PSUIGSPluginImplUid );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::NewContainerL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::NewContainerL()
+ {
+ iContainer = new ( ELeave ) CPSUIGSPluginContainer( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::DoActivateL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid aCustomMessageId,
+ const TDesC8& aCustomMessage )
+ {
+ if ( KPreSettingViewId != aPrevViewId.iViewUid )
+ {
+ iPSUIGSPrevViewId = aPrevViewId;
+ }
+
+ // model & observer constructed only when needed
+ if ( !iPSModel )
+ {
+ iPSModel = CPSUIGSPluginModel::NewL();
+ iAppUi->AddViewDeactivationObserverL( this );
+ }
+
+ const TInt id = iPSModel->SettingsId();
+ if ( id )
+ {// readjust the focus
+ SetCurrentItem( iPSModel->SettingsIDArray().Find( id ));
+ }
+
+ iClosing = EFalse;
+ CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
+ UpdateMSK();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::DoDeactivate()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::DoDeactivate()
+ {
+ CGSBaseView::DoDeactivate();
+ if ( iClosing )
+ {// PSUI plugin is going to be closed so it is safe to free some memory
+ delete iPSModel;
+ iPSModel = NULL;
+ delete iSettingView;
+ iSettingView = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::HandleViewDeactivation()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::HandleViewDeactivation(
+ const TVwsViewId& aViewIdToBeDeactivated,
+ const TVwsViewId& aNewlyActivatedViewId)
+ {
+ if ( TUid::Uid( PSUIGSPluginImplUid ) == aViewIdToBeDeactivated.iViewUid &&
+ iPSUIGSPrevViewId.iViewUid == aNewlyActivatedViewId.iViewUid )
+ {
+ iClosing = ETrue;
+ iAppUi->RemoveViewDeactivationObserver( this );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::HandleCommandL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::HandleCommandL( TInt aCommand )
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ RemoveSettingView();
+ iAppUi->ActivateLocalViewL( iPSUIGSPrevViewId.iViewUid );
+ break;
+ }
+ case EPSUICmdEdit:
+ {
+ HandleListBoxSelectionL();
+ break;
+ }
+ case EPSUICmdDelete:
+ {
+ DeleteSettingsL();
+ break;
+ }
+ case EPSUICmdNewSettingsDefault:
+ {
+ CreateNewDefaultSettingsL();
+ break;
+ }
+ case EPSUICmdNewSettingsExisting:
+ {
+ CreateCopyOfExistingSettingsL();
+ break;
+ }
+ case EAknCmdHelp:
+ {
+ if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+ {
+ HlpLauncher::LaunchHelpApplicationL(
+ iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
+ }
+ break;
+ }
+ default:
+ {
+ iAppUi->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::SettingCountAndIndex()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPlugin::SettingCountAndIndex( TInt& aIndex )
+ {
+ CEikTextListBox* listbox = Container()->iListBox;// not owned
+ TInt count = listbox->Model()->NumberOfItems();
+ aIndex = count ? listbox->CurrentItemIndex() : KErrNotFound;
+
+ return count;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::HandleListBoxSelectionL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::HandleListBoxSelectionL()
+ {
+ TInt index = KErrNotFound;
+ if ( SettingCountAndIndex( index ))
+ {
+ iPSModel->EditSettingsL( index );
+
+ ConstructSettingViewL();
+ iAppUi->ActivateLocalViewL( KPreSettingViewId );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::DeleteSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::DeleteSettingsL()
+ {
+ TInt index = KErrNotFound;
+ TInt count = SettingCountAndIndex( index );
+ if ( count )
+ {
+ if ( AcceptDeletionL( count, index ))
+ {
+ iPSModel->DeleteSettingsL( index, ETrue );
+ CEikTextListBox* listbox = Container()->iListBox;// not owned
+ AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
+ listbox, index, ETrue );
+ listbox->DrawNow();
+ UpdateMSK();
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::AcceptDeletionL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TBool CPSUIGSPlugin::AcceptDeletionL( TInt aCount, TInt aIndex )
+ {
+ HBufC* currentName = iPSModel->SettingNameLC( aIndex );
+ HBufC* string = NULL;
+ if ( aCount == 1 )
+ {
+ string = StringLoader::LoadLC( R_QTN_PRESENCE_SETTINGS_DELETE_LAST, *currentName );
+ }
+ else
+ {
+ string = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, *currentName );
+ }
+
+ CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
+ TInt ok = query->ExecuteLD( R_PSUI_CONF_QUERY, *string );
+
+ CleanupStack::PopAndDestroy( 2, currentName );//currentName, string
+
+ return ( ok );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::GetCaptionL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::GetCaptionL( TDes& aCaption ) const
+ {
+ StringLoader::Load( aCaption, R_QTN_SET_FOLDER_PRESENCE );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::PluginProviderCategory()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPlugin::PluginProviderCategory() const
+ {
+ return KGSPluginProviderInternal;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::CreateIconL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CPSUIGSPlugin::CreateIconL( const TUid aIconType )
+ {
+ CGulIcon* icon = NULL;
+ if( aIconType == KGSIconTypeLbxItem )
+ {
+ icon = AknsUtils::CreateGulIconL(
+ AknsUtils::SkinInstance(),
+ KAknsIIDQgnPropSetConnPresence,
+ KPSUIGSPluginIconFileName,
+ EMbmPsuigspluginQgn_prop_set_conn_presence,
+ EMbmPsuigspluginQgn_prop_set_conn_presence_mask );
+ }
+ else
+ {
+ icon = CGSPluginInterface::CreateIconL( aIconType );
+ }
+
+ return icon;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::DynInitMenuPaneL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane )
+ {
+ // remove some of the items if no settings available
+ const TInt count = Container()->iListBox->Model()->NumberOfItems();
+ if ( aResourceId == R_PSUI_MAINVIEW_MENUPANE &&
+ 0 == count )
+ {
+ aMenuPane->DeleteMenuItem( EPSUICmdEdit );
+ aMenuPane->DeleteMenuItem( EPSUICmdDelete );
+ }
+ if ( aResourceId == R_PSUI_NEWSETTINGS_MENU &&
+ 0 == count )
+ {
+ aMenuPane->DeleteMenuItem( EPSUICmdNewSettingsExisting );
+ }
+
+ // help-item handling
+ if ( aResourceId == R_PSUI_MAINVIEW_MENUPANE &&
+ !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+ {
+ aMenuPane->DeleteMenuItem( EAknCmdHelp );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::PSModel()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginModel* CPSUIGSPlugin::PSModel()
+ {
+ __ASSERT_DEBUG( iPSModel,User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+ return iPSModel;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::ConstructSettingViewL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::ConstructSettingViewL()
+ {
+ if ( !iSettingView )
+ {// no view yet, construct it
+ CAknView* view = CPSUIGSPluginSettingView::NewL( this );
+ CleanupStack::PushL( view );
+ iAppUi->AddViewL( view );
+ CleanupStack::Pop( view );
+ iSettingView = view;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::RemoveSettingView()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::RemoveSettingView()
+ {
+ // Remove view from iAppUi -> View is deleted by iAppUi automatically.
+ if ( iSettingView )
+ {
+ iAppUi->RemoveView( KPreSettingViewId );
+ iSettingView = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::CreateNewDefaultSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::CreateNewDefaultSettingsL()
+ {
+ iPSModel->CreateDefaultSettingsL();
+ ConstructSettingViewL();
+ iAppUi->ActivateLocalViewL( KPreSettingViewId );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::CreateCopyOfExistingSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::CreateCopyOfExistingSettingsL()
+ {
+ CAknSinglePopupMenuStyleListBox* list =
+ new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+ CleanupStack::PushL( list );
+
+ CAknPopupList* popupList =
+ CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_OK_CANCEL );
+ CleanupStack::PushL( popupList );
+
+ HBufC* title = StringLoader::LoadLC( R_QTN_PRESENCE_PROPMT_USE_EXIST );
+ popupList->SetTitleL( *title );
+ CleanupStack::PopAndDestroy( title );
+
+ list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
+ list->CreateScrollBarFrameL( ETrue );
+ list->ScrollBarFrame()->SetScrollBarVisibilityL(
+ CEikScrollBarFrame::EOff,
+ CEikScrollBarFrame::EAuto );
+
+ CTextListBoxModel* model = list->Model();
+ model->SetItemTextArray( iPSModel->SettingNames() );// setting names not owned
+ model->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ list->HandleItemAdditionL();
+
+ CleanupStack::Pop( popupList );
+ TInt keyPress = popupList->ExecuteLD();
+
+ if ( keyPress )
+ {
+ iPSModel->DuplicateExistingSettingsL( list->CurrentItemIndex() );
+ ConstructSettingViewL();
+ iAppUi->ActivateLocalViewL( KPreSettingViewId );
+ }
+
+ CleanupStack::PopAndDestroy( list );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::UpdateMSK()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::UpdateMSK()
+ {
+ if ( !Cba() )
+ {
+ return;
+ }
+
+ TBool showEdit = ( 0 < Container()->iListBox->Model()->NumberOfItems());
+ CEikCba* cba = static_cast< CEikCba* >( Cba()->ButtonGroup() );
+ cba->MakeCommandVisible( EPSUICmdEdit, showEdit );
+ cba->DrawNow();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPlugin::HandleListBoxEventL()
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPlugin::HandleListBoxEventL(
+ CEikListBox* /*aListBox*/, TListBoxEvent aListBoxEvent)
+ {
+ // if the Select Key has been pressed
+ if ((aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed) ||
+ (aListBoxEvent == MEikListBoxObserver::EEventItemSingleClicked))
+ {
+ HandleListBoxSelectionL();
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigsplugincontainer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings UI GS plugin container implementation
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <psuigspluginrsc.rsg>
+#include <aknlists.h>
+#include <gsbasecontainer.h>
+#include "psuigsplugincontainer.h"
+#include "psuigspluginmodel.h"
+#include "psuigsplugin.h"
+#include "psuigspluginids.hrh"
+#include <csxhelp/pre.hlp.hrh>
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::CPSUIGSPluginContainer()
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginContainer::CPSUIGSPluginContainer( CPSUIGSPlugin* aView )
+ : iView ( aView )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::ConstructL(const TRect& aRect)
+// Symbian OS phase 2 constructor
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginContainer::ConstructL( const TRect& aRect )
+ {
+ iListBox = new ( ELeave ) CAknSingleStyleListBox();// base needs the iListBox to be prepared 1st
+ BaseConstructL( aRect, R_PSUI_MAINVIEW_TITLE, 0 );// last parameter 0, since dynamic listbox
+
+ iEikMenuBar = new ( ELeave ) CEikMenuBar();
+ iEikMenuBar->ConstructL( this, NULL, R_PSUI_MAINVIEW_MENUBAR );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::~CPSUIGSPluginContainer()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginContainer::~CPSUIGSPluginContainer()
+ {
+ delete iEikMenuBar;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::ConstructListBoxL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginContainer::ConstructListBoxL( TInt /*aResLbxId*/ )
+ {
+ // listbox creation and initialization
+ iListBox->SetContainerWindowL( *this );
+ iListBox->ConstructL( this, EAknListBoxLoopScrolling );
+ iListBox->CreateScrollBarFrameL( ETrue );
+ iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+ CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+
+ SetEmptyTextsToListboxL();
+
+ CPSUIGSPluginModel* psuiModel = iView->PSModel();// not owned
+ CTextListBoxModel* model = iListBox->Model();
+ model->SetItemTextArray( psuiModel );
+ model->SetOwnershipType( ELbmDoesNotOwnItemArray );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::SetEmptyTextsToListboxL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginContainer::SetEmptyTextsToListboxL()
+ {
+ // empty texts
+ _LIT ( KPSUIEmptyStringHeader, "%S\n%S" );
+ HBufC* emptyText = iEikonEnv->AllocReadResourceLC(
+ R_QTN_PRESENCE_SETTINGS_EMPTY_PRIMARY );
+ HBufC* emptyText2 = iEikonEnv->AllocReadResourceLC(
+ R_QTN_PRESENCE_SETTINGS_EMPTY_SECONDARY );
+ HBufC* emptyFinal = HBufC::NewLC(
+ emptyText->Length() + emptyText2->Length() + 2 );// 2 is length of "\n"
+ emptyFinal->Des().Format( KPSUIEmptyStringHeader, emptyText, emptyText2 );
+ iListBox->View()->SetListEmptyTextL( *emptyFinal );
+ CleanupStack::PopAndDestroy( 3, emptyText );// emptyText, emptyText2, emptyFinal
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginContainer::OfferKeyEventL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CPSUIGSPluginContainer::OfferKeyEventL(
+ const TKeyEvent& aKeyEvent,
+ TEventCode aType )
+ {
+ if ( iView && aType == EEventKey
+ && aKeyEvent.iCode == EKeyBackspace &&
+ iEikMenuBar->ItemSpecificCommandsEnabled() )
+ {
+ iView->DeleteSettingsL();
+ return EKeyWasConsumed;
+ }
+ else
+ {
+ return iListBox->OfferKeyEventL( aKeyEvent, aType );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CPSUIGSPluginContainer::GetHelpContext()
+// See header for details.
+// -----------------------------------------------------------------------------
+//
+void CPSUIGSPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+ {
+ aContext.iMajor = TUid::Uid( PSUIGSPluginDllUid );
+ aContext.iContext = KPRE_HLP_LIST_VIEW;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigspluginimplementationtable.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* ECOM proxy table for this plugin
+*
+*/
+
+
+
+
+// System includes
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "psuigspluginids.hrh"
+#include "psuigsplugin.h"
+
+// Constants
+const TImplementationProxy PSUIGSPluginImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( PSUIGSPluginImplUid, CPSUIGSPlugin::NewL )
+ };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+ TInt& aTableCount )
+ {
+ aTableCount = sizeof( PSUIGSPluginImplementationTable )
+ / sizeof( TImplementationProxy );
+ return PSUIGSPluginImplementationTable;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigspluginmodel.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,756 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence settings UI model implementation.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <escapeutils.h>
+#include <sipmanagedprofileregistry.h>
+#include <sipprofileregistryobserver.h>
+#include <sipmanagedprofile.h>
+#include <sipprofile.h>
+#include <StringLoader.h>
+#include <psuigspluginrsc.rsg>
+#include <XdmSettingsApi.h>
+#include "psuigspluginmodel.h"
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::CPSUIGSPluginModel()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginModel::CPSUIGSPluginModel()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::~CPSUIGSPluginModel()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginModel::~CPSUIGSPluginModel()
+ {
+ delete iSIPEngine;
+ if ( iSIPProfiles )
+ {
+ iSIPProfiles->ResetAndDestroy();
+ delete iSIPProfiles;
+ }
+
+ iXdmIdArray.Close();
+ delete iXdmNameArray;
+
+ iPSIdArray.Close();
+ delete iPSNameArray;
+ delete iVisibleSettingName;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ConstructL()
+ {
+ RetrieveSettingsL();
+ iVisibleSettingName = HBufC::NewL(
+ KPresSetNameMaxLength + 2 );// max chars + KColumnListSeparator
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::NewL()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginModel* CPSUIGSPluginModel::NewL()
+ {
+ CPSUIGSPluginModel* self = new ( ELeave ) CPSUIGSPluginModel();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self ); // self
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::RetrieveSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::RetrieveSettingsL()
+ {
+ RefreshPSArraysL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SaveSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::SaveSettingsL()
+ {
+ if ( iSettingId == 0 )
+ {// new settings
+ iSettingId = PresSettingsApi::CreateSetL( iSettingSet );
+ }
+ else
+ {// old & edited settings
+ PresSettingsApi::UpdateSetL( iSettingSet, iSettingId );
+ }
+ RefreshPSArraysL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::CreateDefaultSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::CreateDefaultSettingsL()
+ {
+ iSettingId = 0; // new settings
+
+ iSettingSet.iSetName.Zero();
+ HBufC* name = CreateSettingNameLC();
+ iSettingSet.iSetName.Append( *name );
+ CleanupStack::PopAndDestroy( name );// name
+
+ iSettingSet.iSipProfile = KErrNotFound;
+ iSettingSet.iXDMSetting = KErrNotFound;
+ iSettingSet.iObjectSize = KErrNotFound;
+ iSettingSet.iContSrvrAdd.Zero();
+ iSettingSet.iPublicationInt = KErrNotFound;
+ iSettingSet.iMaxSubscriptions = KErrNotFound;
+ iSettingSet.iMaxContactsInList = KErrNotFound;
+ iSettingSet.iDomainSyntax.Zero();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::DuplicateExistingSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::DuplicateExistingSettingsL( TInt aIndex )
+ {
+ __ASSERT_DEBUG( aIndex < iPSIdArray.Count() ,User::Panic( KPSUIGSPluginPanicCategory, KErrOverflow ));
+
+ iSettingId = 0; // new settings
+ TPresSettingsSet originalSettings;
+ PresSettingsApi::SettingsSetL( iPSIdArray[ aIndex ], originalSettings );
+
+ iSettingSet.iSetName.Zero();
+ HBufC* name = CreateSettingNameLC( originalSettings.iSetName.AllocL() );
+ iSettingSet.iSetName.Append( *name );
+ CleanupStack::PopAndDestroy( name );// name
+
+ iSettingSet.iSipProfile = originalSettings.iSipProfile;
+ iSettingSet.iXDMSetting = originalSettings.iXDMSetting;
+ iSettingSet.iObjectSize = originalSettings.iObjectSize;
+ iSettingSet.iContSrvrAdd = originalSettings.iContSrvrAdd;
+ iSettingSet.iPublicationInt = originalSettings.iPublicationInt;
+ iSettingSet.iMaxSubscriptions = originalSettings.iMaxSubscriptions;
+ iSettingSet.iMaxContactsInList = originalSettings.iMaxContactsInList;
+ iSettingSet.iDomainSyntax = originalSettings.iDomainSyntax;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::AllCompulsoryFieldsFilled()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TBool CPSUIGSPluginModel::AllCompulsoryFieldsFilled()
+ {
+ TBool returnValue = ETrue;
+ for ( TInt i = EPSUIServerNameId ; i <= EPSUIDomainSyntaxId && returnValue ; i++ )
+ {
+ switch( i )
+ {
+ case EPSUIServerNameId:
+ returnValue = ( iSettingSet.iSetName.Length() != 0 );
+ break;
+ case EPSUISIPProfileId:
+ returnValue = ( iSettingSet.iSipProfile != KErrNotFound );
+ break;
+ case EPSUIObjectSizeId:
+ returnValue = ( iSettingSet.iObjectSize != KErrNotFound );
+ break;
+ case EPSUIDomainSyntaxId:
+ returnValue = ( iSettingSet.iDomainSyntax.Length() != 0 );
+ break;
+ default:
+ // do nothing with non-compulsory ones
+ break;
+ }
+ }
+ return returnValue;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::IsItDuplicatePSName()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TBool CPSUIGSPluginModel::IsItDuplicatePSName()
+ {
+ TBool found = KErrNone;
+ TInt pos = 0;
+ found = ( iPSNameArray->Find( iSettingSet.iSetName, pos ) == KErrNone );
+ if ( found )
+ {// dupe found, let's check it's not the same setting
+ __ASSERT_DEBUG( pos < iPSIdArray.Count() ,User::Panic( KPSUIGSPluginPanicCategory, KErrOverflow ));
+ found = !( iSettingId == iPSIdArray[ pos ]);
+ }
+ return found;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::EditSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::EditSettingsL( TInt aIndex )
+ {
+ __ASSERT_DEBUG( aIndex < iPSIdArray.Count() ,User::Panic( KPSUIGSPluginPanicCategory, KErrOverflow ));
+ TInt settingId = iPSIdArray[ aIndex ];
+ PresSettingsApi::SettingsSetL( settingId, iSettingSet );
+ iSettingId = settingId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::DeleteSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::DeleteSettingsL( TInt aToBeDeleted, TBool aIsIndex )
+ {
+ if ( aIsIndex )
+ {// is index
+ __ASSERT_DEBUG( aToBeDeleted < iPSIdArray.Count() ,
+ User::Panic( KPSUIGSPluginPanicCategory, KErrOverflow ));
+ PresSettingsApi::RemoveSetL( iPSIdArray[ aToBeDeleted ]);
+ }
+ else
+ {// is id
+ PresSettingsApi::RemoveSetL( aToBeDeleted );
+ }
+ RefreshPSArraysL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::RefreshPSArraysL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::RefreshPSArraysL()
+ {
+ delete iPSNameArray;
+ iPSNameArray = NULL;
+ iPSIdArray.Reset();
+
+ iPSNameArray = PresSettingsApi::GetAllSetsNamesLC( iPSIdArray );
+ CleanupStack::Pop( iPSNameArray );// iPSNameArray
+ ReArrangePresenceSettingsL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ReArrangePresenceSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ReArrangePresenceSettingsL()
+ {
+ const TInt settingsCount = iPSNameArray->Count();
+ __ASSERT_DEBUG(
+ settingsCount == iPSIdArray.Count(),
+ User::Panic( KPSUIGSPluginPanicCategory, KErrArgument ));
+
+ // make a tables of the original pairs
+ RPointerArray<CPSUINameIDPair> pairArray;
+ TCleanupItem clItem( ResetAndDestroy, &pairArray );
+ CleanupStack::PushL( clItem );
+ CPSUINameIDPair* pair = NULL;
+ for( TInt i = 0;i < settingsCount;i++ )
+ {
+ pair = new ( ELeave ) CPSUINameIDPair;
+ CleanupStack::PushL( pair );
+ pair->iID = iPSIdArray[ i ];
+ pair->iName = iPSNameArray->MdcaPoint( i ).AllocL();
+ pairArray.AppendL( pair );
+ CleanupStack::Pop( pair );// pair is in array's responsibility now
+ }
+
+ // sort the original
+ iPSNameArray->Sort( ECmpCollated );
+
+ // re-arrange the iPSIdArray based on order of iPSNameArray
+ iPSIdArray.Reset();
+ for( TInt i = 0;i < settingsCount;i++ )
+ {
+ for( TInt ii = 0;ii < pairArray.Count();ii++ )
+ {
+ if ( !iPSNameArray->MdcaPoint( i ).Compare(
+ *pairArray[ii]->iName ))
+ {
+ iPSIdArray.AppendL( pairArray[ii]->iID );
+ delete pairArray[ii];
+ pairArray.Remove(ii);
+ break;// no need to go through if already found
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( &pairArray );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::MdcaCount()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPluginModel::MdcaCount() const
+ {
+ return iPSNameArray->MdcaCount();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::MdcaPoint()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CPSUIGSPluginModel::MdcaPoint( TInt aIndex ) const
+ {
+ TPtr tempText = iVisibleSettingName->Des();
+ tempText.Zero();
+ tempText.Append( KColumnListSeparator );
+ tempText.Append( iPSNameArray->MdcaPoint( aIndex ));
+
+ return tempText;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::CreateSettingNameLC()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CPSUIGSPluginModel::CreateSettingNameLC( HBufC* aOriginalName )
+ {
+ _LIT( KPSUIGSPluginNumbering, "(%N)" );
+ const TInt KPSUIFormattingExtraLength = 6;
+
+ // prepare
+ HBufC* settingName = aOriginalName ?
+ aOriginalName :
+ StringLoader::LoadL( R_QTN_PRESENCE_NAME_DEFAULT );
+
+ if ( settingName->Length() + KPSUIFormattingExtraLength > KPresSetNameMaxLength )
+ {//if there is no room for duplicate-numbering, let user take care of that when saving settings
+ CleanupStack::PushL( settingName );
+ return settingName;
+ }
+
+ settingName = settingName->ReAlloc(
+ settingName->Length() + KPSUIFormattingExtraLength );// enough for formatting
+ CleanupStack::PushL( settingName );
+ HBufC* tempSetName = NULL;
+ TInt pos = 0;// used as dummy
+ TInt found = 0;
+ TInt index = 1;
+ TPtr ptr = settingName->Des();
+
+ // do the actual checking of name
+ found = iPSNameArray->Find( *settingName, pos );
+ while ( found == 0 )
+ {
+ if ( !tempSetName )
+ {
+ if ( aOriginalName )
+ {// aOriginalName given
+ tempSetName = GetPrefixL( settingName );
+ tempSetName = tempSetName->ReAlloc(
+ tempSetName->Length() + KPSUIFormattingExtraLength );// enough for formatting
+ CleanupStack::PushL( tempSetName );
+ tempSetName->Des().Append( KPSUIGSPluginNumbering );
+ }
+ else
+ {// aOriginalName not given
+ tempSetName = StringLoader::LoadLC( R_QTN_PRESENCE_NAME_DEFAULT_NUMBER );
+ }
+ }
+ StringLoader::Format( ptr, *tempSetName, -1, index );
+ found = iPSNameArray->Find( *settingName, pos );
+ index++;
+ }
+
+ // cleanup
+ if ( tempSetName )
+ {
+ CleanupStack::PopAndDestroy( tempSetName ); //tempSetName
+ }
+
+ return settingName;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::GetPrefixL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CPSUIGSPluginModel::GetPrefixL( HBufC* aName )
+ {
+ TPtrC prefix = aName->Des();
+ TInt lastBrace = aName->LocateReverse('(');
+ if ( lastBrace != KErrNotFound )
+ {
+ // aName looks like "<prefix><brace><something>".
+ // See if <something> is an integer number and
+ // <something> ends to a brace.
+ TPtrC num = aName->Right( aName->Length() - lastBrace - 1 );
+ TInt val;
+ TLex lex( num );
+ if ( lex.Val( val ) == KErrNone && num.Locate(')') == num.Length() - 1 )
+ {
+ // Yes, the trailer is an integer.
+ prefix.Set( aName->Left( lastBrace ) );
+ }
+ }
+ return prefix.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::CurrentSettingName()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CPSUIGSPluginModel::SettingNameLC( TInt aIndex )
+ {
+ return iPSNameArray->MdcaPoint( aIndex ).AllocLC();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SettingNames()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CPSUIGSPluginModel::SettingNames()
+ {
+ return iPSNameArray;// ownership stays in CPSUIGSPluginModel
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SettingsSet()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TPresSettingsSet& CPSUIGSPluginModel::SettingsSet()
+ {
+ return iSettingSet;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ClearInvalidSIPAndXDMSettingsL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ClearInvalidSIPAndXDMSettingsL()
+ {
+ // SIP
+ ReadSipArrayFromEngineL();
+ if ( iSettingSet.iSipProfile != KErrNotFound &&
+ KErrNotFound == SipProfileIndex( iSettingSet.iSipProfile ))
+ {
+ iSettingSet.iSipProfile = KErrNotFound;
+ }
+ // XDM
+ XdmCollectionNamesL();
+ if ( iSettingSet.iXDMSetting != KErrNotFound &&
+ KErrNotFound == XdmSettingIndex( iSettingSet.iXDMSetting ))
+ {
+ iSettingSet.iXDMSetting = KErrNotFound;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SettingsId()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt& CPSUIGSPluginModel::SettingsId()
+ {
+ return iSettingId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SettingsIDArray()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+RArray<TInt>& CPSUIGSPluginModel::SettingsIDArray()
+ {
+ return iPSIdArray;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SipProfilesLC()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CPSUIGSPluginModel::SipProfilesLC()
+ {
+ ReadSipArrayFromEngineL();
+ CDesCArray* array = new ( ELeave ) CDesCArrayFlat( 2 );
+ CleanupStack::PushL( array );
+ const TInt arrayCount = iSIPProfiles->Count();
+ for ( TInt i = 0; i < arrayCount; i++ )
+ {
+ const TDesC8* profileName;
+ iSIPProfiles->At( i )->GetParameter( KSIPProviderName, profileName );
+ HBufC* profileName16 =
+ EscapeUtils::ConvertToUnicodeFromUtf8L( *profileName );
+ CleanupStack::PushL( profileName16 );
+ array->AppendL( profileName16->Des() );
+ CleanupStack::PopAndDestroy( profileName16 );// profileName16
+ }
+ return array;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SipProfileId()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPluginModel::SipProfileId( TInt aIndex )
+ {
+ __ASSERT_DEBUG( iSIPProfiles, User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+
+ TUint32 id = 0;
+ if ( aIndex < iSIPProfiles->Count())
+ {
+ iSIPProfiles->At( aIndex )->GetParameter( KSIPProfileId, id );
+ }
+
+ __ASSERT_DEBUG( id < KMaxTInt ,User::Panic( KPSUIGSPluginPanicCategory, KErrOverflow ));
+ return id ? TInt( id ) : KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SipProfileIndex()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPluginModel::SipProfileIndex( TInt aId )
+ {
+ __ASSERT_DEBUG( iSIPProfiles, User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+ const TInt arrayCount = iSIPProfiles->Count();
+ TUint32 idValue = aId;
+ for ( TInt i = 0; i < arrayCount; i++ )
+ {
+ TUint32 tempValue;
+ iSIPProfiles->At( i )->GetParameter( KSIPProfileId, tempValue );
+ if ( tempValue == idValue )
+ {
+ return i;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::SipProfileNameL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CPSUIGSPluginModel::SipProfileNameL( TInt aId )
+ {
+ const TInt arrayCount = iSIPProfiles->Count();
+ TUint32 idValue = aId;
+ for ( TInt i = 0; i < arrayCount; i++ )
+ {
+ TUint32 tempValue;
+ iSIPProfiles->At( i )->GetParameter( KSIPProfileId, tempValue );
+ if ( tempValue == idValue )
+ {
+ const TDesC8* profileName;
+ iSIPProfiles->At( i )->GetParameter( KSIPProviderName, profileName );
+ return EscapeUtils::ConvertToUnicodeFromUtf8L( *profileName );// name found
+ }
+ }
+ return HBufC::NewL( 0 );// name not found
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ReadSipArrayFromEngineL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ReadSipArrayFromEngineL()
+ {
+ RArray<TSIPProfileTypeInfo> array;
+ CleanupClosePushL( array );
+
+ if ( !iSIPEngine )
+ {
+ iSIPEngine = CSIPManagedProfileRegistry::NewL( *this );
+ }
+
+ // Get the supported profile types
+ iSIPEngine->SupportedProfileTypesL( array );
+
+ // check iSIPProfiles, if exists delete
+ if ( iSIPProfiles )
+ {
+ iSIPProfiles->ResetAndDestroy();
+ delete iSIPProfiles;
+ }
+
+ // Create the profile pointer array
+ iSIPProfiles =
+ new ( ELeave ) CArrayPtrFlat<CSIPManagedProfile>( 2 );
+
+ RPointerArray<CSIPProfile> profilePointerArray;
+ TCleanupItem clItem( ResetAndDestroy, &profilePointerArray );
+ CleanupStack::PushL( clItem );
+
+ // Get all profiles based on profile types
+ const TInt arrayCount = array.Count();
+ for ( TInt i = 0; i < arrayCount; i++ )
+ {
+ iSIPEngine->ProfilesL( array[i], profilePointerArray );
+ while ( profilePointerArray.Count() > 0 )
+ {
+ CSIPManagedProfile* profile =
+ static_cast<CSIPManagedProfile*>( profilePointerArray[ 0 ]);
+ iSIPProfiles->AppendL( profile );
+ profilePointerArray.Remove( 0 );
+ }
+ profilePointerArray.Reset();
+ }
+
+ CleanupStack::PopAndDestroy( 2, &array ); // array
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ResetAndDestroy()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ResetAndDestroy(
+ TAny* aPointerArray )
+ {
+ RPointerArray<CSIPProfile>* array =
+ static_cast<RPointerArray<CSIPProfile>*>( aPointerArray );
+ array->ResetAndDestroy();
+ array->Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ProfileRegistryEventOccurred()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ProfileRegistryEventOccurred(
+ TUint32 /*aSIPProfileId*/, TEvent aEvent )
+ {
+ switch( aEvent )
+ {
+ case EProfileCreated:
+ case EProfileUpdated:
+ case EProfileDestroyed:
+ // update sip profile array
+ TRAP_IGNORE( ReadSipArrayFromEngineL() );
+ break;
+ default:
+ // do nothing.
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::ProfileRegistryErrorOccurred()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginModel::ProfileRegistryErrorOccurred(
+ TUint32 /*aSIPProfileId*/,
+ TInt /*aError*/ )
+ {
+ // update sip profile array
+ TRAP_IGNORE( ReadSipArrayFromEngineL() );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::XdmCollectionNamesL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CDesCArray* CPSUIGSPluginModel::XdmCollectionNamesL()
+ {
+ delete iXdmNameArray;
+ iXdmNameArray = NULL;
+ iXdmIdArray.Reset();
+
+ iXdmNameArray = TXdmSettingsApi::CollectionNamesLC( iXdmIdArray );
+ CleanupStack::Pop( iXdmNameArray );// iXdmNameArray
+ return iXdmNameArray;// pointer is given, but ownership stays here
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::XdmCollectionNameL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+HBufC* CPSUIGSPluginModel::XdmCollectionNameL( TInt aId )
+ {
+ HBufC* buf = NULL;
+ TRAPD( err, buf = TXdmSettingsApi::PropertyL( aId, EXdmPropName ));
+ return ( err == KErrNone ) ? buf : HBufC::NewL( 0 );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::XdmSettingIndex()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPluginModel::XdmSettingIndex( TInt aId )
+ {
+ const TInt arrayCount = iXdmIdArray.Count();
+ for ( TInt i = 0; i < arrayCount; i++ )
+ {
+ if ( aId == iXdmIdArray[ i ] )
+ {
+ return i;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginModel::XdmSettingId()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TInt CPSUIGSPluginModel::XdmSettingId( TInt aIndex )
+ {
+ TInt id = KErrNotFound;
+ if ( aIndex+1 <= iXdmIdArray.Count())
+ {
+ id = iXdmIdArray[ aIndex ];
+ }
+ return id;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigspluginsettingview.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings UI setting view implementation.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <psuigspluginrsc.rsg>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+#include <aknViewAppUi.h>
+#include <featmgr.h>
+#include <hlplch.h>
+#include "psuigsplugin.h"
+#include "psuigspluginsettingview.h"
+#include "psuigspluginmodel.h"
+#include "psuigspluginsettingviewcontainer.h"
+
+// CONSTANTS
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::CPSUIGSPluginSettingView()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginSettingView::CPSUIGSPluginSettingView( CPSUIGSPlugin* aMainView )
+ : iMainView ( aMainView )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::~CPSUIGSPluginSettingView()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginSettingView::~CPSUIGSPluginSettingView()
+ {
+ // iAppUi, iMainView deleted elsewhere
+ if ( iPSUIContainer && iAppUi )
+ {
+ iAppUi->RemoveFromViewStack( *this, iPSUIContainer );
+ delete iPSUIContainer;
+ iPSUIContainer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::ConstructL()
+ {
+ // base construct
+ BaseConstructL( R_PSUI_SETTING_VIEW );
+ iAppUi = AppUi();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::NewL()
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginSettingView* CPSUIGSPluginSettingView::NewL( CPSUIGSPlugin* aMainView )
+ {
+ CPSUIGSPluginSettingView* self = new( ELeave ) CPSUIGSPluginSettingView( aMainView );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::Id()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TUid CPSUIGSPluginSettingView::Id() const
+ {
+ return KPreSettingViewId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::HandleViewRectChange()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::HandleViewRectChange()
+ {
+ if ( iPSUIContainer && iPSUIContainer->ListBox() )
+ {
+ iPSUIContainer->SetRect( ClientRect() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::DoActivateL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::DoActivateL( const TVwsViewId& aPrevViewId,
+ TUid /*aCustomMessageId*/,
+ const TDesC8& /*aCustomMessage*/ )
+ {
+ iPrevViewId = aPrevViewId;
+
+ CreateContainerL();
+ iAppUi->AddToViewStackL( *this, iPSUIContainer );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::DoDeactivate()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::DoDeactivate()
+ {
+ if ( iPSUIContainer )
+ {
+ iAppUi->RemoveFromViewStack( *this, iPSUIContainer );
+ delete iPSUIContainer;
+ iPSUIContainer = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::HandleCommandL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::HandleCommandL( TInt aCommand )
+ {
+ switch ( aCommand )
+ {
+ case EAknSoftkeyBack:
+ {
+ HandleBackKeyL();
+ break;
+ }
+ case EPSUICmdChange:
+ {
+ iPSUIContainer->EditCurrentItemL();
+ break;
+ }
+ case EAknCmdHelp:
+ {
+ if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+ {
+ HlpLauncher::LaunchHelpApplicationL(
+ iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
+ }
+ break;
+ }
+ default:
+ {
+ if ( EEikCmdExit == aCommand )
+ {
+ HandleMenuExitL();
+ }
+
+ iAppUi->HandleCommandL( aCommand );
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::CreateContainerL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::CreateContainerL()
+ {
+ // delete container if present
+ if( iPSUIContainer )
+ {
+ iAppUi->RemoveFromViewStack( *this, iPSUIContainer );
+ delete iPSUIContainer;
+ iPSUIContainer = NULL;
+ }
+
+ // check the data
+ iMainView->PSModel()->ClearInvalidSIPAndXDMSettingsL();
+
+ // create container
+ iPSUIContainer = new ( ELeave ) CPSUIGSPluginSettingViewContainer( this );
+ iPSUIContainer->SetMopParent( this );
+ iPSUIContainer->ConstructL( ClientRect() );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::HandleBackKeyL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::HandleBackKeyL()
+ {
+ CPSUIGSPluginModel* psModel = iMainView->PSModel();// not owned
+
+ TBool okToGoBack = ETrue;
+ TBool okToSave = ETrue;
+ psModel->ClearInvalidSIPAndXDMSettingsL();
+ const TInt id = psModel->SettingsId();
+
+ // compulsory-field handling
+ if ( !psModel->AllCompulsoryFieldsFilled())
+ {// empty compulsory fields found
+ okToSave = EFalse;
+ HBufC* string = StringLoader::LoadLC(
+ R_QTN_PRESENCE_SETTINGS_NOT_FILLED );
+ CAknQueryDialog* query = CAknQueryDialog::NewL(
+ CAknQueryDialog::EConfirmationTone );
+ if ( !query->ExecuteLD( R_PSUI_CONF_QUERY, *string ))
+ {
+ okToGoBack = EFalse;
+ }
+ CleanupStack::PopAndDestroy( string );// string
+ }
+
+ // same name checking
+ if ( okToSave && HandleDuplicatePSNamesL() )
+ {// same name found
+ okToGoBack = EFalse;
+ okToSave = EFalse;
+ iPSUIContainer->EditItemL( EPSUIServerNameId, ETrue );
+ }
+
+ if ( okToSave )
+ {// save settings
+ psModel->SaveSettingsL();
+ }
+ else if ( !okToSave && okToGoBack && id )
+ {// old settings, delete and go back
+ psModel->DeleteSettingsL( id, EFalse );
+ }
+ if ( okToGoBack )
+ {// go back, no save or delete
+ iAppUi->ActivateLocalViewL( iPrevViewId.iViewUid );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::HandleMenuExitL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingView::HandleMenuExitL()
+ {
+ CPSUIGSPluginModel* psModel = iMainView->PSModel();// not owned
+ if ( !psModel )
+ {// no model, can't do anything
+ // (leaving would stop exiting, so just return)
+ return;
+ }
+
+ if ( psModel->AllCompulsoryFieldsFilled() )
+ {// needed fields filled, proceed saving
+ if ( psModel->IsItDuplicatePSName() )
+ {// a dupe name -> change name
+ HBufC* newName = psModel->CreateSettingNameLC(
+ psModel->SettingsSet().iSetName.AllocL() );
+ psModel->SettingsSet().iSetName.Copy( newName->Des() );
+ CleanupStack::PopAndDestroy( newName );
+ }
+ // save settings
+ psModel->SaveSettingsL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::HandleDuplicatePSNamesL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+TBool CPSUIGSPluginSettingView::HandleDuplicatePSNamesL()
+ {
+ TBool found = iMainView->PSModel()->IsItDuplicatePSName();
+ if ( found )
+ {
+ HBufC* fullText = StringLoader::LoadLC(
+ R_QTN_PRESENCE_SETTINGS_NAME_EXISTS,
+ iMainView->PSModel()->SettingsSet().iSetName );
+ CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); //wait-flag on
+ note->ExecuteLD( *fullText );
+ CleanupStack::PopAndDestroy( fullText );
+ }
+ return found;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingView::MainView()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPlugin* CPSUIGSPluginSettingView::MainView()
+ {
+ return iMainView;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuigspluginsettingviewcontainer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings UI view container implementation
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <psuigspluginrsc.rsg>
+#include <aknlists.h>
+#include <aknnavi.h>
+#include <akntitle.h>
+#include <AknUtils.h>
+#include "psuigspluginsettingviewcontainer.h"
+#include "psuigspluginsettingview.h"
+#include "psuigspluginmodel.h"
+#include "psuisipxdmsettingitem.h"
+#include "psuiintegersettingitem.h"
+#include "psuigsplugin.h"
+#include "psuigspluginids.hrh"
+#include <csxhelp/pre.hlp.hrh>
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::CPSUIGSPluginSettingViewContainer()
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginSettingViewContainer::CPSUIGSPluginSettingViewContainer(
+ CPSUIGSPluginSettingView* aView )
+ : iView ( aView )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::ConstructL(const TRect& aRect)
+// Symbian OS phase 2 constructor
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::ConstructL( const TRect& aRect )
+ {
+ UpdateTitleL();
+ CreateWindowL();
+ ConstructFromResourceL( R_PSUI_SETTING_ITEMS );
+ SetRect( aRect );
+ ActivateL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::~CPSUIGSPluginSettingViewContainer()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUIGSPluginSettingViewContainer::~CPSUIGSPluginSettingViewContainer()
+ {
+ // iView is deleted elsewhere
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::CreateSettingItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CAknSettingItem* CPSUIGSPluginSettingViewContainer::CreateSettingItemL(
+ TInt aSettingId )
+ {
+ CAknSettingItem* settingItem = NULL;
+ TPresSettingsSet& settingSet = iView->MainView()->PSModel()->SettingsSet();
+
+ switch ( aSettingId )
+ {
+ case EPSUIServerNameId:
+ settingItem = new (ELeave) CAknTextSettingItem(
+ aSettingId, settingSet.iSetName );
+ break;
+ case EPSUISIPProfileId:
+ settingItem = new (ELeave) CPSUISipXdmSettingItem(
+ aSettingId, settingSet.iSipProfile, iView->MainView()->PSModel() );
+ break;
+ case EPSUIXDMSettingsId:
+ settingItem = new (ELeave) CPSUISipXdmSettingItem(
+ aSettingId, settingSet.iXDMSetting, iView->MainView()->PSModel() );
+ break;
+ case EPSUIObjectSizeId:
+ settingItem = new (ELeave) CPSUIIntegerSettingItem(
+ aSettingId, settingSet.iObjectSize );
+ break;
+/* server address disabled
+ case EPSUIServerAddrId:
+ settingItem = new (ELeave) CAknTextSettingItem(
+ aSettingId, settingSet.iContSrvrAdd );
+ break;*/
+ case EPSUIPublishingIntervalId:
+ settingItem = new (ELeave) CPSUIIntegerSettingItem(
+ aSettingId, settingSet.iPublicationInt );
+ break;
+ case EPSUIMaxSubscriptionsId:
+ settingItem = new (ELeave) CPSUIIntegerSettingItem(
+ aSettingId, settingSet.iMaxSubscriptions );
+ break;
+ case EPSUIMaxContactsInListId:
+ settingItem = new (ELeave) CPSUIIntegerSettingItem(
+ aSettingId, settingSet.iMaxContactsInList );
+ break;
+ case EPSUIDomainSyntaxId:
+ settingItem = new (ELeave) CAknTextSettingItem(
+ aSettingId, settingSet.iDomainSyntax );
+ break;
+ default:
+ __ASSERT_DEBUG( 0, User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+ break;
+ }
+
+ return settingItem;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::EditItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::EditItemL(
+ TInt aIndex, TBool aCalledFromMenu )
+ {
+ CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+
+ // update setting to setting-object
+ (*SettingItemArray())[aIndex]->StoreL();
+
+ if ( EPSUIServerNameId == aIndex )
+ {
+ UpdateTitleL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::EditCurrentItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::EditCurrentItemL()
+ {
+ EditItemL( ListBox()->CurrentItemIndex(), ETrue );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::UpdateTitleL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::UpdateTitleL()
+ {
+ // title construction
+ static_cast<CAknTitlePane*>(
+ iAvkonAppUi->StatusPane()->ControlL( TUid::Uid(
+ EEikStatusPaneUidTitle )))->SetTextL(
+ iView->MainView()->PSModel()->SettingsSet().iSetName );
+ }
+
+// -----------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::GetHelpContext()
+// See header for details.
+// -----------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+ {
+ aContext.iMajor = TUid::Uid( PSUIGSPluginDllUid );
+ aContext.iContext = KPRE_HLP_EDIT_SET;
+ }
+
+// -----------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::HandleResourceChange()
+// See header for details.
+// -----------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::HandleResourceChange(TInt aType)
+ {
+ CAknSettingItemList::HandleResourceChange( aType );
+ if ( aType == KAknsMessageSkinChange ||
+ aType == KEikDynamicLayoutVariantSwitch )
+ {
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+ mainPaneRect);
+ SetRect( mainPaneRect );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CPSUIGSPluginSettingViewContainer::SizeChanged()
+// See header for details.
+// -----------------------------------------------------------------------------
+//
+void CPSUIGSPluginSettingViewContainer::SizeChanged()
+ {
+ ListBox()->SetRect( Rect() );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuiintegersettingitem.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Setting item for integer settings
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <aknradiobuttonsettingpage.h>
+#include <akntextsettingpage.h>
+#include "psuigspluginmodel.h"
+#include "psuiintegersettingitem.h"
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUIIntegerSettingItem::CPSUIIntegerSettingItem()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CPSUIIntegerSettingItem::CPSUIIntegerSettingItem( TInt aIdentifier, TInt& aValue )
+ : CAknIntegerEdwinSettingItem ( aIdentifier, aValue ),
+ iPSUIInternalTextPtr( 0,0 )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIIntegerSettingItem::~CPSUIIntegerSettingItem()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+CPSUIIntegerSettingItem::~CPSUIIntegerSettingItem()
+ {
+ delete iPSUIInternalText;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIIntegerSettingItem::CompleteConstructionL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUIIntegerSettingItem::CompleteConstructionL()
+ {
+ const TInt KPSUIMaxIntegerDigits = 2 * EAknMaxIntegerDigits;// a bit longer for storing also empty texts
+ iPSUIInternalText = HBufC::NewMaxL( KPSUIMaxIntegerDigits );
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUIIntegerSettingItem::SettingTextL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+const TDesC& CPSUIIntegerSettingItem::SettingTextL()
+ {
+ _LIT( KAknIntegerFormat, "%d" );
+ iPSUIInternalTextPtr.Set( iPSUIInternalText->Des() );
+ TInt& intValueRef = InternalValueRef();
+ if ( intValueRef == KErrNotFound )
+ {
+ iPSUIInternalTextPtr.Zero();
+ iPSUIInternalTextPtr.Append( EmptyItemText() );
+ iPSUIInternalTextPtr.Append( KColumnListSeparator );
+ }
+ else
+ {
+ iPSUIInternalTextPtr.Format( KAknIntegerFormat, intValueRef );
+ AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
+ iPSUIInternalTextPtr );
+ }
+
+ return iPSUIInternalTextPtr;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/presencesettingsui/src/psuisipxdmsettingitem.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Setting item for SIP / XDM settings
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <psuigspluginrsc.rsg>
+#include <aknradiobuttonsettingpage.h>
+#include <akntextsettingpage.h>
+#include "psuigspluginmodel.h"
+#include "psuisipxdmsettingitem.h"
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::CPSUISipXdmSettingItem()
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CPSUISipXdmSettingItem::CPSUISipXdmSettingItem(
+ TInt aIdentifier, TInt& aId, CPSUIGSPluginModel* aPSModel ):
+ CAknSettingItem( aIdentifier ),
+ iExtChosenSettingID ( aId ),
+ iPSModel ( aPSModel )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::~CPSUISipXdmSettingItem()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSUISipXdmSettingItem::~CPSUISipXdmSettingItem()
+ {
+ // iPSModel deleted elsewhere
+ delete iPSUIInternalText;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::LoadL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::LoadL()
+ {
+ delete iPSUIInternalText;
+ iPSUIInternalText = 0;
+
+ TInt id = Identifier();
+ if ( id == EPSUISIPProfileId )
+ {// SIP
+ iPSUIInternalText = iPSModel->SipProfileNameL( iExtChosenSettingID );
+ }
+ else if ( id == EPSUIXDMSettingsId )
+ {// XDM
+ iPSUIInternalText = iPSModel->XdmCollectionNameL( iExtChosenSettingID );
+ }
+ else
+ {
+ __ASSERT_DEBUG( 0,User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+ }
+
+ iIntChosenSettingID = iExtChosenSettingID;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::StoreL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::StoreL()
+ {
+ iExtChosenSettingID = iIntChosenSettingID;
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::SettingTextL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+const TDesC& CPSUISipXdmSettingItem::SettingTextL()
+ {
+ if ( iPSUIInternalText->Length() > 0 )
+ return *iPSUIInternalText;
+ else
+ return EmptyItemText();
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::EditItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::EditItemL( TBool /*aCalledFromMenu*/ )
+ {
+ TInt id = Identifier();
+ if ( id == EPSUISIPProfileId )
+ {// SIP
+ EditSipItemL();
+ }
+ else if ( id == EPSUIXDMSettingsId )
+ {// XDM
+ EditXdmItemL();
+ }
+ else
+ {
+ __ASSERT_DEBUG( 0,User::Panic( KPSUIGSPluginPanicCategory, KErrNotFound ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::EditSipItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::EditSipItemL()
+ {
+ CDesCArray* array = iPSModel->SipProfilesLC();
+ TInt index = iPSModel->SipProfileIndex( iIntChosenSettingID );
+ LaunchSettingDlgL( index, array );
+ CleanupStack::PopAndDestroy( array ); // array
+
+ if ( index != KErrNotFound )
+ {// update only if index available
+ iIntChosenSettingID = iPSModel->SipProfileId( index );
+
+ delete iPSUIInternalText;
+ iPSUIInternalText = 0;
+ iPSUIInternalText = iPSModel->SipProfileNameL( iIntChosenSettingID );
+
+ UpdateListBoxTextL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::EditXdmItemL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::EditXdmItemL()
+ {
+ CDesCArray* array = iPSModel->XdmCollectionNamesL();// array not owned
+ TInt index = iPSModel->XdmSettingIndex( iIntChosenSettingID );
+ LaunchSettingDlgL( index, array );
+
+ if ( index != KErrNotFound )
+ {// update only if index available
+ iIntChosenSettingID = iPSModel->XdmSettingId( index );
+
+ delete iPSUIInternalText;
+ iPSUIInternalText = 0;
+ iPSUIInternalText = iPSModel->XdmCollectionNameL( iIntChosenSettingID );
+
+ UpdateListBoxTextL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPSUISipXdmSettingItem::LaunchSettingDlgL()
+// See header for details.
+// ---------------------------------------------------------------------------
+//
+void CPSUISipXdmSettingItem::LaunchSettingDlgL( TInt& aIndex, CDesCArray* aArray )
+ {
+ CAknRadioButtonSettingPage* dlg = new (ELeave ) CAknRadioButtonSettingPage(
+ R_RADIOBUTTON_SETTING_PAGE,
+ aIndex,
+ aArray );
+ CleanupStack::PushL( dlg );
+ dlg->SetSettingTextL( SettingName() );
+ SetSettingPage( dlg );
+ SettingPage()->SetSettingPageObserver( this );
+ CleanupStack::Pop( dlg ); // dlg
+ SettingPage()->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
+ SetSettingPage( 0 ); // dlg deleted
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/authorization_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<api id="f7f26a357dcbf067a342aea4c6f192c4" dataversion="1.0">
+ <name>Authorization API</name>
+ <description>API for presence rules. It supports authorization rule management by:
+- creating modifying and deleting individual rules
+- creating, modifying and deleting default policy</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="rlspresxdm.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Authorization API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mrlspresxdmasynchandler.h MW_LAYER_PLATFORM_EXPORT_PATH(mrlspresxdmasynchandler.h)
+../inc/presencetransformxdm.h MW_LAYER_PLATFORM_EXPORT_PATH(presencetransformxdm.h)
+../inc/prescondmisc.h MW_LAYER_PLATFORM_EXPORT_PATH(prescondmisc.h)
+../inc/prescondidentitymany.h MW_LAYER_PLATFORM_EXPORT_PATH(prescondidentitymany.h)
+../inc/prescondidentityone.h MW_LAYER_PLATFORM_EXPORT_PATH(prescondidentityone.h)
+../inc/prescondvalidity.h MW_LAYER_PLATFORM_EXPORT_PATH(prescondvalidity.h)
+../inc/prescondsphere.h MW_LAYER_PLATFORM_EXPORT_PATH(prescondsphere.h)
+../inc/cpresencexdm.h MW_LAYER_PLATFORM_EXPORT_PATH(cpresencexdm.h)
+../inc/presenceactionxdm.h MW_LAYER_PLATFORM_EXPORT_PATH(presenceactionxdm.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/cpresencexdm.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is primary class for Presence XDM
+*
+*/
+
+
+
+#ifndef __PRESENCEXDM_H__
+#define __PRESENCEXDM_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+#include "prescondidentityone.h"
+#include "prescondidentitymany.h"
+#include "prescondmisc.h"
+#include "prescondvalidity.h"
+#include "prescondsphere.h"
+#include "presenceactionxdm.h"
+#include "presencetransformxdm.h"
+
+// Forward declarations
+class MRLSPresXDMAsyncHandler;
+class CXdmDocumentNode;
+class CXdmProtocolInfo;
+class CXdmEngine;
+class CXdmDocument;
+
+// Class declaration
+/**
+* This class deals with the Presence rules as a whole and has communication
+* with the server. Rules can be manipulated using this class, however the
+* three childrens of rule namely condition, action and transform manipulation
+* also requires their respective classes in conjunction with this class.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class CPresenceXDM : public CActive
+ {
+ public:
+
+ /**
+ * Create CPresenceXDM
+ *
+ * @param TInt XDMSettingsList ID, see XDMSettingsApi.h for more info
+ * @return Pointer to created CPresenceXDM
+ */
+ IMPORT_C static CPresenceXDM* NewL(const TInt aSettingId);
+
+ /**
+ * Create CPresenceXDM, leaves pointer to stack
+ *
+ * @param TInt XDMSettingsList ID, see XDMSettingsApi.h for more info
+ * @return Pointer to created CPresenceXDM, pushed on cleanup stack
+ */
+ IMPORT_C static CPresenceXDM* NewLC( const TInt aSettingId );
+
+
+ /**
+ * Updates information (document) to server. This results in
+ * HandlePresUpdateDocumentL on completion.
+ *
+ * @param aHandler, pointer to MRLSPresXDMAsyncHandler callback handler
+ * @return Error code, KErrAlreadyExist if some async already going on
+ */
+ IMPORT_C TInt UpdateToServerL(MRLSPresXDMAsyncHandler* const aHandler);
+
+ /**
+ * Updates all information (document) from server. This results in
+ * HandlePresUpdateDocumentL on completion.
+ *
+ * @param aHandler, pointer to MRLSPresXDMAsyncHandler callback handler
+ * @return Error code, KErrAlreadyExist if some async already going on
+ */
+ IMPORT_C TInt UpdateAllFromServerL(MRLSPresXDMAsyncHandler* const aHandler);
+
+ /**
+ * Cancels document update to/from server if going on. This results in
+ * HandlePresUpdateCancelL on completion.
+ */
+ IMPORT_C void CancelUpdateL();
+
+ /**
+ * Gets all rule IDs in an array
+ *
+ * @param CDesCArray& aRuleIds, reference to rule IDs
+ */
+ IMPORT_C void GetAllRulesL(CDesCArray& aRuleIds);
+
+ /**
+ * Delete Rule and associated coditions/actions/transforms
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return KErrNotFound if not found. System wide error codes
+ */
+ IMPORT_C TInt DeleteRuleL(const TDesC& aRuleId);
+
+ /**
+ * Add a new rule. If aRuleId contains a valid descriptor it is used as
+ * rule id for the new rule. If a NULL descriptor is provided instead,
+ * a random id is generated automatically and returned in aRuleId.
+ * The new rule is created without condition, action or transformation.
+ * Those elements can be created using their respective classes.
+ *
+ * @param TDesC& aRuleId, if provided treated as rule id. Otherwise a
+ / random rule id is created and returned.
+ * @return Error code, KErrAlreadyExists, KErrNone, KErrNotFound if
+ * document root doesnt found.
+ */
+ IMPORT_C TInt CreateNewRuleL(TDes& aRuleId);
+
+ /**
+ * Finds if a Rule Exist
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return TBool if rule exist
+ */
+ IMPORT_C TBool IsRuleExist(const TDesC& aRuleId);
+
+ /**
+ * Delete all data by deleting all rules and their children
+ */
+ IMPORT_C void DeleteAllRules();
+
+ /**
+ * Deletes all rules which are empty
+ */
+ IMPORT_C void DeleteEmptyRulesL();
+
+
+ /**
+ * From CActive
+ *
+ */
+ void DoCancel();
+
+ /**
+ * From CActive
+ *
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ *
+ */
+ TInt RunError(TInt aError);
+
+ /**
+ * Destructor
+ *
+ */
+ ~CPresenceXDM();
+
+ /**
+ * Friend classes
+ *
+ */
+ friend class TPresenceActionXDM;
+ friend class TPresenceTransformXDM;
+ friend class TPresCondIdentityOne;
+ friend class TPresCondIdentityMany;
+ friend class TPresCondSphere;
+ friend class TPresCondValidity;
+ friend class TPresCondMisc;
+
+
+
+ protected:
+
+ /**
+ * Removes given node from document model
+ *
+ * @param CXdmDocumentNode* aNode
+ */
+ void RemoveFromModelL( CXdmDocumentNode* aNode );
+
+
+ private:
+
+ /**
+ * Second phase constructor
+ *
+ * @param TInt XDMSettingsList ID
+ */
+ void ConstructL(const TInt aSettingId );
+
+ /**
+ * C++ constructor
+ *
+ * @param none
+ * @return none
+ */
+ CPresenceXDM();
+
+ /**
+ * Creates the document root if needed
+ */
+ void CreateRootIfNeededL();
+
+ /**
+ * Finds if a Rule Exist, returns its pointer
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return CXdmDocumentNode if rule exist
+ */
+ CXdmDocumentNode* IsRuleExistInt(const TDesC& aRuleId);
+
+ /**
+ * Gets the condition, action or transform node. It is
+ * caller's responsiblity to provide a valid child name.
+ *
+ * @param TDesC& aRuleId rule ID.
+ * @param aRuleChild child node of a rule
+ * @param TBool aCreate if ETrue, creates child node if not exist
+ * @return CXdmDocumentNode* pointer to rule child node or NULL
+ */
+ CXdmDocumentNode* GetRuleChildNodeL(const TDesC& aRuleId,
+ const TDesC& aRuleChild, TBool aCreate);
+
+ /**
+ * Gets the conditions child node pointer in a rule. It is
+ * caller's responsiblity to provide a valid child name.
+ *
+ * @param TDesC& aRuleId rule ID.
+ * @param aCondChild child node of condition
+ * @param TBool aCreate if ETrue, creates child node if not exist
+ * @return CXdmDocumentNode* pointer to condition child node or NULL
+ */
+ CXdmDocumentNode* GetConditionChildNodeL(const TDesC& aRuleId,
+ const TDesC& aCondChild, TBool aCreate);
+
+ /**
+ * Gets a unique rule id
+ *
+ * @param TDesC& aRuleId unique rule id
+ */
+ void GetUniqueRuleId(TDes& aRuleId);
+
+ private: // data
+
+ CXdmProtocolInfo* iXDMProtocolInfo;
+ CXdmEngine* iXDMEngine;
+ CXdmDocument* iPresDocument;
+ TInt iAsyncReq;
+ MRLSPresXDMAsyncHandler* iAsyncHandler;
+
+ };
+
+#endif //__PRESENCEXDM_H__
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/mrlspresxdmasynchandler.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is Asynchronous handler
+*
+*/
+
+
+
+#ifndef __MRLSPRESXDMASYNCHANDLER_H__
+#define __MRLSPRESXDMASYNCHANDLER_H__
+
+// Class declaration
+/**
+* This is asynchronous handler class for CPresenceXDM's and CRLSXDM's async
+* functions. The client classes should drive from this class and must implement
+* it's functions to get async. requests handled.
+*/
+class MRLSPresXDMAsyncHandler
+ {
+ public:
+
+ // Functions needed implementation for using CRLSXDM, and empty implementation
+ // for using CPresenceXDM.
+ /**
+ * This method handles the async. call to function CRLSXDM::UpdateToServerL
+ * and CRLSXDM::UpdateAllFromServerL. Clients should implement this method
+ * to get callbacks
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandleRLSUpdateDocumentL(TInt aErrorCode) = 0;
+
+ /**
+ * This method is called when client cancels the update request to/from server
+ * using to function CRLSXDM::CancelUpdateL.
+ * Clients should implement this method to get a callback
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandleRLSUpdateCancelL(TInt aErrorCode) = 0;
+
+ /**
+ * This method handles the async. call to function CRLSXDM::DeleteAllEmptyListsL
+ * Clients should implement this method to get a callback
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandleRLSDeleteAllEmptyListsL(TInt aErrorCode) = 0;
+
+ // Functions needed implementation for using CPresenceXDM, and empty implementation
+ // for using CRLSXDM.
+
+ /**
+ * This method handles the async. call to function CPresenceXDM::UpdateToServerL
+ * and CPresenceXDM::UpdateAllFromServerL. Clients should implement this method
+ * to get a callback.
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandlePresUpdateDocumentL(TInt aErrorCode) = 0;
+
+ /**
+ * This method is called when client cancels the update request to/from server
+ * using to function CPresenceXDM::CancelUpdateL.
+ * Clients should implement this method to get a callback
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandlePresUpdateCancelL(TInt aErrorCode) = 0;
+ };
+
+#endif //__MRLSPRESXDMASYNCHANDLER_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/prescondidentitymany.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents the 'many' element
+* part of the Presence Condition
+*
+*/
+
+
+
+#ifndef __PRESCONDIDENTITYMANY_H__
+#define __PRESCONDIDENTITYMANY_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CPresenceXDM;
+class CXdmDocumentNode;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresCondIdentityMany is used to manipulate the 'many' element part of a
+* Condition in a rule. Remember to call Init function after constructing this object.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresCondIdentityMany
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresCondIdentityMany();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+
+ /**
+ * Puts the 'many' element in identity, with domain name
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule not found, KErrAlreadyExists
+ */
+ IMPORT_C TInt AddManyIdentityL(const TDesC& aRuleID,
+ const TDesC& aDomain);
+
+ /**
+ * Finds whether 'many' element exists in identities or not, with
+ * optional domain name
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return ETrue if exists
+ */
+ IMPORT_C TBool IsManyExistsL(const TDesC& aRuleID,
+ const TDesC& aDomain);
+
+ /**
+ * Removes the 'many' element from identity, optional domain name
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element not found
+ */
+ IMPORT_C TInt RemoveManyIdentityL(const TDesC& aRuleID,
+ const TDesC& aDomain);
+
+ /**
+ * Get the number of 'many' elements in identity node, those elements
+ * which has domain name are returned in aDomains array
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param CDesCArray& aDomains domain names if exists
+ * @return TInt number of total many elements.
+ */
+ IMPORT_C TInt GetManyIdentityElementsL(const TDesC& aRuleID,
+ CDesCArray& aDomains);
+
+ /**
+ * Add identity to 'except' child of many element
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aEntity to be added
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element not found
+ */
+ IMPORT_C TInt AddIdentityInManyExceptL(const TDesC& aRuleID,
+ const TDesC& aEntity, const TDesC& aDomain);
+
+ /**
+ * Add identities to 'except' child of many element
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param CDesCArray& aEntities to be added
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element not found
+ */
+ IMPORT_C TInt AddIdentitiesInManyExceptL(const TDesC& aRuleID,
+ const CDesCArray& aEntities, const TDesC& aDomain);
+
+ /**
+ * Get identities from 'except' child of many element
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param CDesCArray& aEntities fethed identities
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element not found
+ */
+ IMPORT_C TInt GetIdentitiesFromManyExceptL(const TDesC& aRuleID,
+ CDesCArray& aEntities, const TDesC& aDomain);
+
+ /**
+ * Removes an identity from 'except' child of many element
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aEntity to be deleted
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element or id not found
+ */
+ IMPORT_C TInt RemoveIdentityFromManyExceptL(const TDesC& aRuleID,
+ const TDesC& aEntity, const TDesC& aDomain);
+
+ /**
+ * Deletes all identities in the 'except' child of 'many'
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return KErrNotFound if rule or many element not found
+ */
+ IMPORT_C TInt DeleteAllIdentitiesFromManyExceptL(const TDesC& aRuleID,
+ const TDesC& aDomain);
+
+ /**
+ * Is identity exists in the 'except' child of many element
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aEntity to be searched
+ * @param TDesC& aDomain domain name, provide KNullDesC if not needed
+ * @return ETrue if exists
+ */
+ IMPORT_C TBool IsIdentityExistsInManyExceptL(const TDesC& aRuleID,
+ const TDesC& aEntity,
+ const TDesC& aDomain);
+
+ private:
+
+ /**
+ * Gets the 'many' node pointer in a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TBool aCreate if ETrue, creates many node if not exist
+ * @param TDesC& aDomain, domain name, can be KNullDesC
+ * @return CXdmDocumentNode* pointer to 'many' node or NULL
+ */
+ CXdmDocumentNode* GetManyNodeL(const TDesC& aRuleID,
+ TBool aCreate, const TDesC& aDomain);
+
+ /**
+ * Finds whether the given entity exists in the node array
+ *
+ * @param RPointerArray<CXdmDocumentNode>& nodes array of nodes
+ * @param TDesC& aEntity to find
+ * @return ETrue of exists
+ */
+ TBool IsEntityExistInNodeArray(const RPointerArray<CXdmDocumentNode>& nodes,
+ const TDesC& aEntity);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM; // not owned
+
+ };
+
+
+#endif //__PRESCONDIDENTITYMANY_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/prescondidentityone.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents 'one' identity part
+* of a Presence Condition in a rule
+*
+*/
+
+
+
+#ifndef __PRESCONDIDENTITYONE_H__
+#define __PRESCONDIDENTITYONE_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CPresenceXDM;
+class CXdmDocumentNode;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresCondIdentityOne is used to manipulate the 'one' identity part of a Condition
+* in a rule. Remember to call Init function after constructing this object.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresCondIdentityOne
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresCondIdentityOne();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+
+ /**
+ * Adds condition identities to a rule. This functions doesnt give
+ * error if any or all ids already exists, nor it overwrites them.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param aIds It contains array of ids.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found
+ */
+ IMPORT_C TInt AddIdentitiesL(const TDesC& aRuleID,
+ const MDesCArray& aIds);
+
+ /**
+ * Gets condition identities from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param aIds contains returned array of ids.
+ */
+ IMPORT_C void GetIdentitiesL(const TDesC& aRuleID,
+ CDesCArray& aIds);
+
+ /**
+ * Deletes specific condition identities if they found.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param aIds contains array of ids to be deleted.
+ */
+ IMPORT_C void DeleteIdentitiesL(const TDesC& aRuleID,
+ const MDesCArray& aIds);
+
+ /**
+ * Deletes all conditions identities from a rule if found
+ *
+ * @param TDesC& aRuleID rule ID
+ */
+ IMPORT_C void DeleteAllIdentitiesL(const TDesC& aRuleID);
+
+ /**
+ * Adds a condition identity to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param aId an identity to be added
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found or
+ * KErrAlreadyExists in case already exists
+ */
+ IMPORT_C TInt AddIdentityL(const TDesC& aRuleID,
+ const TDesC& aId);
+
+ /**
+ * Deletes an identity from a condition
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aId an identity to be removed
+ * @return KErrNotFound if not found.
+ */
+ IMPORT_C TInt DeleteIdentityL(const TDesC& aRuleID,
+ const TDesC& aId);
+
+ /**
+ * Finds if a identity exist in a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aId to be searched
+ * @return TBool ETrue if entry found
+ */
+ IMPORT_C TBool IsIdentityExistL(const TDesC& aRuleID,
+ const TDesC& aId);
+
+ private:
+
+ /**
+ * Finds whether the given id exists in the node array
+ *
+ * @param RPointerArray<CXdmDocumentNode>& nodes array of nodes
+ * @param TDesC& aId to find
+ * @return ETrue of exists
+ */
+ TBool IsIdExistInNodeArray(const RPointerArray<CXdmDocumentNode>& nodes,
+ const TDesC& aId);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM; // not owned
+
+ };
+
+
+#endif //__PRESCONDIDENTITYONE_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/prescondmisc.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents those parts of
+* presence identity which are not present in any other class.
+*
+*/
+
+
+
+#ifndef __PRESCONDMISC_H__
+#define __PRESCONDMISC_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CPresenceXDM;
+class CXdmDocumentNode;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresCondMisc is used to manipulate the those Presence rule's conditions
+* which are not present in any other class. This class supports following
+* conditions: external-list, anonymous-request and other-identity.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresCondMisc
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresCondMisc();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+ /**
+ * Adds condition's other-identity element to a rule. This functions doesnt give
+ * error if other-identity element already exists.
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found
+ */
+ IMPORT_C TInt AddOtherIdentityL(const TDesC& aRuleId);
+
+ /**
+ * Finds if other-identity element exist in a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return TBool ETrue if other-identity element found
+ */
+ IMPORT_C TBool IsOtherIdentityExistL(const TDesC& aRuleId);
+
+ /**
+ * Removes other-identity element from a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return KErrNotFound if rule or other-identity element not found.
+ */
+ IMPORT_C TInt RemoveOtherIdentityL(const TDesC& aRuleId);
+
+ /**
+ * Adds condition's anonymous-request element to a rule. This functions doesnt give
+ * error if anonymous-request element already exists.
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found
+ */
+ IMPORT_C TInt AddAnonymousRequestL(const TDesC& aRuleId);
+
+ /**
+ * Finds if anonymous-request element exist in a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return TBool ETrue if anonymous-request element found
+ */
+ IMPORT_C TBool IsAnonymousRequestExistL(const TDesC& aRuleId);
+
+ /**
+ * Removes anonymous-request element from a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @return KErrNotFound if rule or anonymous-request element not found.
+ */
+ IMPORT_C TInt RemoveAnonymousRequestL(const TDesC& aRuleId);
+
+ /**
+ * Adds a condition's external-list with 'anc' attribute containing a Uri
+ *
+ * @param TDesC& aRuleId rule ID
+ * @param aUri an external list to be added
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found or
+ * KErrAlreadyExists in case already exists
+ */
+ IMPORT_C TInt AddExternListL(const TDesC& aRuleId, const TDesC& aUri);
+
+ /**
+ * Finds if an external list is exist in a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @param aUri an external list to be find
+ * @return TBool ETrue if given external list is exist in the rule
+ */
+ IMPORT_C TBool IsExternListExistL(const TDesC& aRuleId, const TDesC& aUri);
+
+ /**
+ * Gets condition's external-lists from a rule
+ *
+ * @param TDesC& aRuleId rule ID
+ * @param aUris contains returned array of external Uris
+ */
+ IMPORT_C void GetExternalListsL(const TDesC& aRuleId,
+ CDesCArray& aUris);
+
+ /**
+ * Delete specific external list if found.
+ *
+ * @param TDesC& aRuleId rule ID
+ * @param aUri an external list to be removed
+ * @return KErrNotFound if rule or external list not found.
+ */
+ IMPORT_C TInt DeleteExternalListL(const TDesC& aRuleId,
+ const TDesC& aUri);
+
+ /**
+ * Deletes specific external lists if they found.
+ *
+ * @param TDesC& aRuleId rule ID
+ * @param aUris contains array of external lists to be deleted.
+ */
+ IMPORT_C void DeleteExternalListsL(const TDesC& aRuleId,
+ const MDesCArray& aUris);
+
+ /**
+ * Deletes all external lists from a rule if found
+ *
+ * @param TDesC& aRuleId rule ID
+ */
+ IMPORT_C void DeleteAllExternalListsL(const TDesC& aRuleId);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM;
+
+ };
+
+
+#endif //__PRESCONDMISC_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/prescondsphere.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents sphere part of
+* Presence Condition
+*
+*/
+
+
+
+#ifndef __PRESCONDSPHERE_H__
+#define __PRESCONDSPHERE_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CPresenceXDM;
+class CXdmDocumentNode;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresCondSphere is used to manipulate the sphere part of a Condition in a rule.
+* Remember to call Init function after constructing this object.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresCondSphere
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresCondSphere();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+ /**
+ * Adds a condition sphere to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aSphere Value of the sphere to be added
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found
+ */
+ IMPORT_C TInt AddOrReplaceSphereL(const TDesC& aRuleID,
+ const TDesC& aSphere);
+
+
+ /**
+ * Gets a condition sphere from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aSphere returned value of the sphere
+ * @return TInt KErrNone, KErrNotFound if rule or no sphere found
+ */
+ IMPORT_C TInt GetSphereL(const TDesC& aRuleID, TPtrC& aSphere);
+
+
+ /**
+ * Deletes condition sphere from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @return TInt KErrNone, KErrNotFound if rule or sphere doesnt found
+ */
+ IMPORT_C TInt DeleteSphereL(const TDesC& aRuleID);
+
+
+ private:
+
+ /**
+ * Gets the Sphere node pointer in a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TBool aCreate if ETrue, creates Sphere node if not exist
+ * @return CXdmDocumentNode* pointer to Sphere node or NULL
+ */
+ CXdmDocumentNode* GetSphereNodeL(const TDesC& aRuleID,
+ TBool aCreate);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM; // not owned
+
+ };
+
+
+#endif //__PRESCONDSPHERE_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/prescondvalidity.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents Presence Condition
+* validity part.
+*
+*/
+
+
+
+#ifndef __PRESCONDVALIDITY_H__
+#define __PRESCONDVALIDITY_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CPresenceXDM;
+class CXdmDocumentNode;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresCondValidity is used to manipulate the validity part of Condition in a rule.
+* Remember to call Init function after constructing this object.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresCondValidity
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresCondValidity();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ * @return none
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+ /**
+ * Gets condition validity values from a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param RArray<TTimePeriod>& returned array of valid times in local time.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found or none
+ * of validities found
+ */
+ IMPORT_C TInt GetValidityL(const TDesC& aRuleID,
+ RArray<TTimePeriod>& aValidTimes);
+
+ /**
+ * Deletes condition validity values from a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found.
+ */
+ IMPORT_C TInt DeleteAllValidityL(const TDesC& aRuleID);
+
+ /**
+ * Adds condition validity to a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TTimePeriod valid time to be added. In local time.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found.
+ */
+ IMPORT_C TInt AddValidityL(const TDesC& aRuleID,
+ const TTimePeriod aValidTime);
+
+ /**
+ * Checks if rule is valid for given time
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TTimePeriod valid time to be checked, in local time
+ * @return ETrue if given time is a subset of valid times in a rule
+ */
+ IMPORT_C TBool IsTimeValidL(const TDesC& aRuleID,
+ const TTimePeriod aTime);
+
+ private:
+
+ /**
+ * Gets the Validity node pointer in a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TBool aCreate if ETrue, creates Validity node if not exist
+ * @return CXdmDocumentNode* pointer to Validity node or NULL
+ */
+ CXdmDocumentNode* GetValidityNodeL(const TDesC& aRuleID,
+ TBool aCreate);
+
+ /**
+ * Parse from XML time string to TTime
+ *
+ * @param TDesC& aXMLTimeString, XML time string to parse
+ * @param TTime& aDateTime, returned here in TTime format
+ * @return error code
+ */
+ TInt ParseFromXMLTimeString(const TDesC& aXMLTimeString,
+ TTime& aDateTime);
+
+ /**
+ * Parse to XML time string from TTime
+ *
+ * @param TDes& aXMLTimeString, retuned XML time string
+ * @param TTime aDateTime, input TTime
+ * @return error code
+ */
+ TInt FormatToXMLTimeStringL(TDes& aXMLTimeString, const TTime aDateTime);
+
+ /**
+ * Convert local time to universal time
+ *
+ * @param TTime& aLocalDateTime, coverted to universal TTime
+ * @return none
+ */
+ void ConvertToUniversal(TTime& aLocalDateTime);
+
+ /**
+ * Convert universal time to local time
+ *
+ * @param TTime& aUniversalDateTime, coverted to local TTime
+ * @return none
+ */
+ void ConvertToLocal(TTime& aUniversalDateTime);
+
+
+ /**
+ * Logs Given dateTime
+ *
+ * @param TDateTime aDateTime date time to log
+ * @return None
+ */
+ void LogDateTime(TDateTime aDateTime);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM; // not owned
+
+ };
+
+
+#endif //__PRESCONDVALIDITY_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/presenceactionxdm.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents Presence Action
+*
+*/
+
+
+
+#ifndef __PRESENCEACTIONXDM_H__
+#define __PRESENCEACTIONXDM_H__
+
+// Includes
+#include <e32base.h>
+#include <rlspresxdmconsts.h>
+
+//Forward declarations
+class CXdmDocumentNode;
+class CPresenceXDM;
+
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresenceActionXDM is used to manipulate the Action part of a rule.
+* Remember to call Init function after constructing this object.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresenceActionXDM
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresenceActionXDM();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ * @return none
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+
+ /**
+ * Adds or replace action contents.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aAction it can be block,confirm, polite-block or allow,
+ * use constants from rlspresxdmconsts.h
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found,
+ * KErrArgument if invalid aAction
+ */
+ IMPORT_C TInt AddOrReplaceActionL(const TDesC& aRuleID,
+ const TDesC& aAction);
+
+ /**
+ * Removes action from a rule.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @return TInt KErrNone, KErrNotFound if rule or action doesnt found
+ */
+ IMPORT_C TInt RemoveActionL(const TDesC& aRuleID);
+
+ /**
+ * Gets Action contents from a rule.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TPtrC& aAction action which can be block,confirm, polite-block or allow
+ * @return TInt KErrNotFound if rule or action doesnt found.
+ */
+ IMPORT_C TInt GetActionL(const TDesC& aRuleID, TDes& aAction);
+
+ private:
+
+ /**
+ * Gets the SubHandling node pointer in a rule
+ *
+ * @param TDesC& aRuleID rule ID.
+ * @param TBool aCreate if ETrue, creates SubHandling node if not exist
+ * @return CXdmDocumentNode* pointer to SubHandling node or NULL
+ */
+ CXdmDocumentNode* GetSubHandlingNodeL(const TDesC& aRuleID,
+ TBool aCreate);
+
+ /**
+ * Finds whether the provided action is valid or not
+ *
+ * @param TDesC& aAction, as a discriptor
+ * @return ETrue of action is valid
+ */
+ TBool IsValidAction(const TDesC& aAction);
+
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM; // not owned
+
+
+ };
+
+#endif //__PRESENCEACTIONXDM_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/authorization_api/inc/presencetransformxdm.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents Presence Transform
+*
+*/
+
+
+
+
+#ifndef __PRESENCETRANSFORMXDM_H__
+#define __PRESENCETRANSFORMXDM_H__
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CXdmDocumentNode;
+class CPresenceXDM;
+
+// Class declaration
+/**
+* This class should be used in conjunction with an already created CPresenceXDM.
+* The CPresenceXDM deals with the Presence rules as a whole and has communication
+* with the server.
+* TPresenceTransformXDM is used to manipulate the Transformation part of a rule.
+* Remember to call Init function after constructing this object.
+*
+* Here the Presence transforms are classified into three categories according to
+* their xml data types. These three categories are: complex transforms types,
+* boolean transform types and other transform types.
+* Refer to RLSPresXDMConsts.h to find transforms and their categories.
+* Constants from rlspresxdmconsts.h may be used for transform names.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class TPresenceTransformXDM
+ {
+ public:
+
+ /**
+ * C++ Constructor, After contructing Init must be called before using
+ * this object.
+ */
+ IMPORT_C TPresenceTransformXDM();
+
+ /**
+ * Initializes the object with the given pointer to CPresenceXDM.
+ * This function must be called before using other functions.
+ *
+ * @param CPresenceXDM* pointer to created CPresenceXDM
+ */
+ IMPORT_C void Init(CPresenceXDM* const aPresXDM);
+
+ /**
+ * Adds transform's complex child element to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aComplexChild, The childtype of transform. Currently there are
+ * following complex transforms possible: provide-persons, provide-devices,
+ * provide-services. Use the constants from rlspresxdmconsts.h
+ * @param RArray<TTransDataCompo>& aTypeAndValues Type and values for complex child.
+ * The all-devices, all-persons and all-services can not be used in this
+ * function, use AddOrRepProvideAllTransComplex for those. Remember that this
+ * function will delete above provide-all nodes if they found in this child.
+ * Constants from rlspresxdmconsts.h may be used for transform names.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found,
+ * KErrArgument if invalid child element or its arguments
+ */
+ IMPORT_C TInt AddTransComplexL(const TDesC& aRuleID,
+ const TDesC& aComplexChild,
+ const RArray<TTransDataCompo>& aTypeAndValues);
+
+ /**
+ * Adds or replace transform's complex child provide-all element to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aComplexChild, The childtype of transform. Currently there are
+ * following complex transforms possible: provide-persons, provide-devices,
+ * provide-services. Additionally this function can also be used for
+ * provide-all-attributes.
+ * Depending on the complex child this function will
+ * replace the existing complex child with all-devices, all-persons or
+ * all-services. Constants from rlspresxdmconsts.h may be used for
+ * transform names.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found,
+ * KErrArgument if invalid child element
+ */
+ IMPORT_C TInt AddOrRepProvideAllTransComplexL(const TDesC& aRuleID,
+ const TDesC& aComplexChild);
+
+ /**
+ * Gets transform's complex child element from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aComplexChild, The childtype of transform. Currently there are
+ * following complex transforms possible: provide-persons, provide-devices,
+ * provide-services. Use the constants from rlspresxdmconsts.h
+ * @param RArray<TTransDataCompo>& aTypeAndValues Type and values for complex child.
+ * Constants from rlspresxdmconsts.h may be used for transform names.
+ * @return TInt KErrNone, KErrNotFound if rule or transform not found,
+ * KErrArgument if invalid child element.
+ */
+ IMPORT_C TInt GetTransComplexL(const TDesC& aRuleID,
+ const TDesC& aComplexChild,
+ RArray<TTransDataCompo>& aTypeAndValues);
+
+ /**
+ * Adds or replace transform's boolean child element to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aBoolChild, The childtype of transform. Refer to rlspresxdmconsts.h
+ * for a list of supported boolean transforms. Constants from rlspresxdmconsts.h
+ * may be used for transform names.
+ * @param TBool aValue value to add or replace.
+ * @return TInt KErrNone, KErrNotFound if rule not found,
+ * KErrArgument if invalid child element
+ */
+ IMPORT_C TInt AddOrRepTransKnownBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool aValue);
+
+ /**
+ * Gets transform's boolean child element from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aBoolChild, The childtype of transform. Refer to rlspresxdmconsts.h
+ * for a list of supported boolean transforms. Constants from rlspresxdmconsts.h
+ * may be used for transform names.
+ * @param TBool aValue returned value.
+ * @return TInt KErrNone, KErrNotFound if rule or child doesnt found,
+ * KErrArgument if invalid child element
+ */
+ IMPORT_C TInt GetTransKnownBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool& aValue);
+
+ /**
+ * Adds or replace transform's unknown boolean element to a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param const TDesC& aName, Unknown boolean permission name
+ * @param TBool aValue value to add or replace.
+ * @return TInt KErrNone, KErrNotFound if rule doesnt found
+ */
+ IMPORT_C TInt AddOrRepTransUnknownBoolL(const TDesC& aRuleID,
+ const TDesC& aName, TBool aValue);
+
+ /**
+ * Gets transform's unknown boolean child element from a rule
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param const TDesC& aName, Unknown boolean permission name
+ * @param TBool aValue returned value.
+ * @return TInt KErrNone, KErrNotFound if rule or child element
+ * doesnt found
+ */
+ IMPORT_C TInt GetTransUnknownBoolL(const TDesC& aRuleID,
+ const TDesC& aName, TBool& aValue);
+
+ /**
+ * Removes transform's child element from a given rule. If Child Element
+ * is NullDesC, whole transform with all childrens is removed from rule.
+ * This method is applicable to all transform types.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aChildElement, The childtype of transform. Refer to rlspresxdmconsts.h
+ * for a list of supported transforms. Constants from rlspresxdmconsts.h
+ * may be used for transform names.
+ *
+ * @return TInt KErrNone, KErrNotFound if rule or child doesnt found,
+ * KErrArgument if invalid child element.
+ */
+ IMPORT_C TInt RemoveTransformL(const TDesC& aRuleID,
+ const TDesC& aChildElement);
+
+ /**
+ * Finds whether given transform with childelement exists.
+ * This method is applicable for all transform types.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aChildElement, The childtype of transform. Refer to rlspresxdmconsts.h
+ * for a list of supported transforms. Constants from rlspresxdmconsts.h
+ * may be used for transform names.
+ * @return TBool ETrue if transform exist
+ */
+ IMPORT_C TBool IsTransformExistL(const TDesC& aRuleID,
+ const TDesC& aChildElement);
+
+ private:
+
+ /**
+ * Gets the transform's child node
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aTransformChild The childtype of transform.
+ * @param TBool aCreate, if ETrue creates the child in case it doesnt exists
+ * @return CXdmDocumentNode* transfrom's child node or NULL if not found
+ */
+ CXdmDocumentNode* GetTransformChildNodeL(const TDesC& aRuleID,
+ const TDesC& aTransformChild, TBool aCreate);
+
+ /**
+ * Find whether the given transform child and its childrens are valid
+ *
+ * @param TDesC& aComplexChild, complex child of the transform
+ * @param RArray<TTransDataCompo>& aTypeAndValues, children types and their
+ * contents
+ * @return ETrue if valid
+ */
+ TBool AreNodeNamesValid(const TDesC& aComplexChild,
+ const RArray<TTransDataCompo>& aTypeAndValues);
+
+ /**
+ * Find whether the provide-all node exists in given complex child.
+ * the practicality of this is that if provide-all exists then it
+ * should be the only child of given complex child of transform.
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aComplexChild, complex child of the transform
+ * @return ETrue if provide-all node found
+ */
+ TBool IsProvideAllExistL(const TDesC& aRuleID,const TDesC& aComplexChild);
+
+ /**
+ * Find whether the given boolean child is supported or not.
+ *
+ * @param TDesC& aBoolChild
+ * @return ETrue if supported
+ */
+ TBool IsBoolChildSupported(const TDesC& aBoolChild);
+
+ /**
+ * Add or replace the transform's boolean child
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aBoolChild, boolean child of the transform, either known or unknown
+ * @param TBool aValue, value of the boolean child
+ * @return KErrNotFound if rule not found.
+ */
+ TInt AddOrRepTransBoolL(const TDesC& aRuleID, const TDesC& aBoolChild,
+ TBool aValue);
+
+ /**
+ * Gets the transform's boolean child
+ *
+ * @param TDesC& aRuleID rule ID
+ * @param TDesC& aBoolChild, boolean child of the transform, either known or unknown
+ * @param TBool aValue, returned value of the boolean child
+ * @return KErrNotFound if rule or booleanchild not found.
+ */
+ TInt GetTransBoolL(const TDesC& aRuleID, const TDesC& aBoolChild,
+ TBool& aValue);
+
+ private: // data
+
+ // Pointer to CPresenceXDM - not owned
+ CPresenceXDM* iPresXDM;
+
+ };
+
+ #endif //__PRESENCETRANSFORMXDM_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Includes all the Domain API specific bld.inf files, which
+* export files.
+*
+*/
+
+
+
+
+
+#include "../presence_list_api/group/bld.inf"
+#include "../watcher_info_api/group/bld.inf"
+#include "../simple_documents_api/group/bld.inf"
+#include "../authorization_api/group/bld.inf"
+#include "../xdm_protocol_plugin_api/group/bld.inf"
+#include "../watcher_api/group/bld.inf"
+#include "../xdm_api/group/bld.inf"
+#include "../registration_api/group/bld.inf"
+#include "../publisher_api/group/bld.inf"
+#include "../messaging_connection_manager_api/group/bld.inf"
+#include "../xdm_settings_api/group/bld.inf"
+#include "../simple_settings_api/group/bld.inf"
+#include "../simple_instant_msg_api/group/bld.inf"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/messaging_connection_manager_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Messaging Connection Manager API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msgconnmanagerapi.h MW_LAYER_PLATFORM_EXPORT_PATH(msgconnmanagerapi.h)
+../inc/msgbearerobscallback.h MW_LAYER_PLATFORM_EXPORT_PATH(msgbearerobscallback.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/messaging_connection_manager_api/inc/msgbearerobscallback.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager bearer callback
+*
+*/
+
+
+
+
+#ifndef __MSGBEAREROBSCALLBACK__
+#define __MSGBEAREROBSCALLBACK__
+
+#include <e32base.h>
+
+//This must be kept as low as possible
+const TInt KMaxNumberOfSubscribers = 3;
+
+//Possible events
+enum TMsgBearerEvent
+ {
+ EMsgBearerActive = 0,
+ EMsgBearerSuspended,
+ EMsgBearerLost
+ };
+
+// CLASS DECLARATION
+
+class MMsgBearerObsCallback
+ {
+ public:
+
+ /**
+ * A connection manager object uses this callback function to indicate
+ * that a change in the status of the bearer has occurred. It is important
+ * to note that a call to the notification handler (HandleBearerEventL())
+ * takes place inside the RunL() method of a Connection Manager, so the
+ * listening object MUST return the control to the Manager AS SOON AS
+ * POSSIBLE in order not to clog the scheduler.
+ */
+ virtual void HandleBearerEventL( TBool aAuthoritativeClose,
+ TMsgBearerEvent aBearerEvent ) = 0;
+ };
+
+#endif //__MSGBEAREROBSCALLBACK__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/messaging_connection_manager_api/inc/msgconnmanagerapi.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection manager
+*
+*/
+
+
+
+#ifndef __MSGCONNMANAGERAPI__
+#define __MSGCONNMANAGERAPI__
+
+#include "msgbearerobscallback.h"
+
+//Define the CommDb parameters which the Conn Manager must support
+enum TSupportedCommDbRecords
+ {
+ EMsgProxyAddress = 0,
+ EMsgProxyPort
+ };
+
+//FORWARD DECLARATIONS
+class TInetAddr;
+class RConnection;
+class RSocketServ;
+class MMsgBearerObsCallback;
+
+class MMsgConnManager
+ {
+ public: // New functions
+
+ /**
+ * Start a connection. This asynchronous request completes
+ * as soon as a connection has been successfully opened or
+ * an error condition has been detected.
+ *
+ * Completes with:
+ *
+ * - KErrNone if a connection has been succesfully opened
+ * - KErrNotReady if client has called StopConnection()
+ * and attempts to start a new connection before the previous
+ * one has been disconnected.
+ * - KErrAlreadyExists if a client attempts to open a connection
+ * while one is already being opened
+ * - KErrTimedOut if the specified timeout value expires
+ *
+ * @param aStatus Request status of the client.
+ */
+ virtual void StartConnection( TRequestStatus& aStatus ) = 0;
+
+ /**
+ * Stop a connection, synchronous version
+ */
+ virtual void StopConnection() = 0;
+
+ /**
+ * Stop a connection. This asynchronous request completes
+ * as soon as a connection has been closed. Note that it
+ * takes a few seconds for the connection to really wear out.
+ * Thus, when a client calls this function, it should really
+ * mean what it is saying, because a new connection CANNOT BE
+ * OPENED before a previous one has been deactivated.
+ *
+ * The request may complete with
+ * - KErrNone if connection closing is successful
+ * - KErrAbort if call takes place while connection initiation
+ * is ongoing or if there is no active connection that would
+ * require closing. If a connection initiation is ongoing
+ * client should use CancelStartL() method instead.
+ *
+ * @param aStatus Request status of the client
+ */
+ virtual void StopConnection( TRequestStatus& aStatus ) = 0;
+
+ /**
+ * Cancel StartConnection(). The method may leave with
+ * - KErrAbort if the TRequestStatus object the client
+ * supplied is not active, hence, there is no pending
+ * request that would require cancelling.
+ * In normal cases - when RConnection::Start() or its
+ * progress notifications are pending - ConnMan completes
+ * the client's request with the "error" KErrCancel.
+ *
+ * @return void
+ */
+ virtual void CancelStartL() = 0;
+
+ /**
+ * Set the ID of the Access Point to connect to. Note that this
+ * function is effective only when there is no active connection
+ * the start of which has been initiated by the client. In other
+ * words, the ID of the desired Access Point can be changed only
+ * BEFORE calling StartConnection().
+ *
+ * May leave with
+ * - KErrNotFound if the Access Point ID does not exist
+ *
+ * @param TInt aAccessPointID ID of the Accee Point to use
+ */
+ virtual void SetAccessPointIDL( const TInt aAccessPointID ) = 0;
+
+ /**
+ * Returns a reference to the active socket server.
+ *
+ * @return RSocketServ& An opened socket server
+ */
+ virtual RSocketServ& SocketSession() = 0;
+
+ /**
+ * Returns a reference to the currently open connection
+ *
+ * @return RConnection& An opened connection
+ */
+ virtual RConnection& Connection() = 0;
+
+ /**
+ * Returns the number of active connections currently open
+ *
+ * @return TInt Number of active connections on the device
+ */
+ virtual TInt NumberOfActiveConns() = 0;
+
+ /**
+ * Read data from the Comms Database
+ *
+ * @param TMsgSupportedCommDbRecords aParameter The type of the CommDb record
+ * @return HBufC* Value of the requested record
+ */
+ virtual HBufC* ReadFromCommsDbLC( const TSupportedCommDbRecords aParameter ) = 0;
+
+ /**
+ * Add an object to the queue of listeners. The object to be added
+ * must inplement the interface MMsgBearerObsCallback in order
+ * to receive events from the system agent. It is important to note
+ * that the call to the notification handler (HandleBearerEventL())
+ * takes place inside the RunL() method of this Connection Manager,
+ * so the listening object MUST return the control to the Manager
+ * AS SOON AS POSSIBLE in order not to clog the scheduler.
+ *
+ * @param MMsgBearerObserverCallback* aClient A subscribing client
+ * @return void
+ */
+ virtual void AddEventSubscriberL( MMsgBearerObsCallback* aClient ) = 0;
+
+ /**
+ * Remove an object from the queue of listeners. It is not necessary
+ * to call this method at deletion time, as the destructor destroys
+ * the subscriber queue altogether. If, however, a listener object is
+ * destroyed (or is likely to be) before an instance of Connection Manager,
+ * it is mandatory to remove the listener from the queue prior to deleting
+ * the listener.
+ *
+ * @param MMsgBearerObsCallback* aClient The client to be removed
+ * @return void
+ */
+ virtual void RemoveEventSubscriber( MMsgBearerObsCallback* aClient ) = 0;
+
+ /**
+ * Returns the state of this connection manager:
+ *
+ * - ETrue, if a connection is available
+ * - EFalse otherwise; bearer suspended, StartConnection() failed etc.
+ *
+ * A component that wishes to send/receive data is encouraged
+ * to call this function before opening a socket, or reading
+ * from or writing to one. This way it can be assured that
+ * no component prompts up that annoying IAP dialog.
+ *
+ * @return TBool Is the connection OK
+ */
+ virtual TBool Status() const = 0;
+
+ /**
+ * Destructor. Must be called when the services of the
+ * manager are no longer needed. This is merely a
+ * wrapper to the C++ destructor.
+ *
+ * It is highly advisable that a client of this API
+ * ALWAYS Destroy()s the instance it owns only after
+ * it has disposed of all other connection-related
+ * components at its command. This is because the other
+ * components may still be dependent on the RConnection
+ * and RSocketServ instances provided by this object.
+ *
+ * @return void
+ */
+ virtual void Destroy() = 0;
+ };
+
+/**
+* Creates a new Connection Manager
+* @param aDefaultAccessPoint ID of the default Access Point
+*/
+IMPORT_C MMsgConnManager* NewMsgConnManagerL( const TInt aDefaultAccessPoint );
+
+#endif
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/messaging_connection_manager_api/messaging_connection_manager_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="d81dcfdc45b4049561649427711c4d07" dataversion="1.0">
+ <name>Messaging Connection Manager API</name>
+ <description>API for initializing a GPRS connection and monitoring its state.</description>
+ <type>c++</type>
+ <subsystem>msgconnmanager</subsystem>
+ <libs>
+ <lib name="MsgConnectionManager.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/presence_list_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Presence list API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/crlsxdm.h MW_LAYER_PLATFORM_EXPORT_PATH(crlsxdm.h)
+../inc/rlspresxdmconsts.h MW_LAYER_PLATFORM_EXPORT_PATH(rlspresxdmconsts.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/presence_list_api/inc/crlsxdm.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,559 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is class for RLS XDM
+*
+*/
+
+
+
+#ifndef __RLSXDM_H__
+#define __RLSXDM_H__
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <rlspresxdmconsts.h>
+
+// Forward declarations
+class CXdmProtocolInfo;
+class CXdmEngine;
+class CXdmDocument;
+class MRLSPresXDMAsyncHandler;
+class CXdmDocumentNode;
+
+
+// Class declaration
+/**
+* This class is used for RLS XDM. Refer to OMA 'Resource List Server (RLS) XDM
+* Specification'. The class maintains a so called current path information,
+* which can be manipulated using specific functions. The elements adding,
+* removing, getting etc are performed on current path. However, 'service'
+* uri nodes related functions are always treated on document root. The class
+* also applies restrictions on adding elements on certain paths, to comply with
+* OMA specifications. Some servers does not allow empty 'list' or 'service' uri
+* nodes, the class provides functions to delete those from the whole document.
+*
+* @lib rlspresxdm.lib
+* @since S60 3.2
+*/
+class CRLSXDM : public CActive
+ {
+ public:
+
+ /**
+ * Creates CRLSXDM
+ *
+ * @param TInt XDMSettingsList ID
+ * @return Pointer to created CRLSXDM
+ */
+ IMPORT_C static CRLSXDM* NewL( const TInt aSettingId );
+
+ /**
+ * Create CRLSXDM, leaves pointer to stack
+ *
+ * @param TInt XDMSettingsList ID
+ * @return Pointer to created CRLSXDM
+ */
+ IMPORT_C static CRLSXDM* NewLC( const TInt aSettingId );
+
+
+ /**
+ * Updates information (document) to server. This results in
+ * HandleRLSUpdateToServerL on completion.
+ *
+ * @param aHandler, pointer to MRLSPresXDMAsyncHandler callback handler
+ * @return Error code, KErrAlreadyExist if some async already going on
+ */
+ IMPORT_C TInt UpdateToServerL(MRLSPresXDMAsyncHandler* const aHandler);
+
+ /**
+ * Updates all information (document) from server. This results in
+ * HandleRLSUpdateFromServerL on completion.
+ *
+ * @param aHandler, pointer to MRLSPresXDMAsyncHandler callback handler
+ * @return Error code, KErrAlreadyExist if some async already going on
+ */
+ IMPORT_C TInt UpdateAllFromServerL(MRLSPresXDMAsyncHandler* const aHandler);
+
+
+ /**
+ * Cancels document update to/from server if going on. This results in
+ * HandleRLSUpdateCancelL on completion.
+ */
+ IMPORT_C void CancelUpdateL();
+
+ // Service URIs, will always be treated at the root level
+
+ /**
+ * Delete all data by deleting all service uris. It also resets the path.
+ */
+ IMPORT_C void DeleteAll();
+
+ /**
+ * Add a new service URI
+ *
+ * @param TDesC& aServiceURI
+ * @return Error code, KErrNone, KErrAlreadyExist
+ */
+ IMPORT_C TInt AddServiceURIL(const TDesC& aServiceURI);
+
+ /**
+ * Removes a service URI (and all lists/Entries it holds). Current path
+ * will be reset if this service exists in current path
+ *
+ * @param TDesC& aServiceURI to be removed
+ * @return Error code, KErrNone or KErrNotFound
+ */
+ IMPORT_C TInt RemoveServiceURIL(const TDesC& aServiceURI);
+
+ /**
+ * Return ETrue if service URI is exist with given name
+ *
+ * @param TDesC& aServiceURI to be searched
+ * @return ETrue if found
+ */
+ IMPORT_C TBool IsExistServiceURI(const TDesC& aServiceURI);
+
+ /**
+ * Get all Service Uri(s) in current document
+ *
+ * @param CDesCArray& array of Service Uri in current document
+ */
+ IMPORT_C void GetServiceUrisL(CDesCArray& aServiceUris);
+
+ /**
+ * Deletes all service-uris in the document which doesnt have any lists.
+ * This function is very useful with the servers which doesnt accept
+ * empty service uris. Note that as a side effect of this call, the path
+ * information is deleted. If emtpy lists also needed to be deleted,
+ * DeleteAllEmptyListsL must be called before calling this function.
+ */
+ IMPORT_C void DeleteAllEmptyServiceUrisL();
+
+
+ // Methods that apply to current path
+
+ /**
+ * Renames a 'list' element
+ *
+ * @param TDesC& aListName list's current name
+ * @param TDesC& aListNewName list's new name
+ * @return Error code, KErrNone or KErrNotFound
+ */
+ IMPORT_C TInt RenameListL(const TDesC& aListName, const TDesC& aListNewName);
+
+ /**
+ * Async. function. Deletes all lists in the document which doesnt have
+ * any lists or entries.
+ * This function is very useful with the servers which doesnt accept
+ * empty lists. Note that as a side effect of this call, the path
+ * information is deleted. Results in HandleRLSDeleteAllEmptyListsL upon
+ * completion. If empty service-uris also needed to be deleted,
+ * DeleteAllEmptyServiceUrisL must be called after calling this function.
+ *
+ * @param TInt KErrAlreadyExist if some async call already exist
+ */
+ IMPORT_C TInt DeleteAllEmptyLists(MRLSPresXDMAsyncHandler* const aHandler);
+
+ /**
+ * Adds an element to current path, only 'list' and 'resource-list'
+ * elements can be added to the root of ServiceURI, to add any of other
+ * elements current path should be inside an existing list. aDisplayName
+ * is optional and KNullDesC can be provided if display name is not desired.
+ * Note that leaf element type can not have display-name so in that case
+ * display-name is always discarded.
+ *
+ * @param aElementType, an element type to be added, this can be list,
+ * resource-list, entry, external, entry ref. Use constants from
+ * RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements. In case of resource-list this is the link.
+ * @param aDisplayName display name of the element, use KNullDesC if
+ * display-name is not required.
+ * @return Error code, KErrNone, KErrAlreadyExist or KErrPermissionDenied
+ */
+ IMPORT_C TInt AddElementL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName);
+
+ /**
+ * Gets display name of an element. Only applicable to those elements
+ * which can have a display name.
+ *
+ * @param aElementType, this can be list, entry, external and entry ref.
+ * Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @param aDisplayName display name of the element
+ * @return Error code. KErrArgument, KErrNone, KErrNotFound
+ * or KErrPermissionDenied
+ */
+ IMPORT_C TInt GetDisplayName(const TDesC& aElementType,
+ const TDesC& aData, TPtrC8& aDisplayName);
+
+ /**
+ * Updates display name of an element.
+ *
+ * @param aElementType, an element type, this can be list,
+ * entry, external, entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @param aDisplayName display name of the element
+ * @return Error code. KErrArgument, KErrNone, KErrNotFound
+ * or KErrPermissionDenied
+ */
+ IMPORT_C TInt UpdateDisplayNameL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName);
+
+ /**
+ * Get all elements of same type at given node path
+ *
+ * @param aElementType, an element type, this can be list, resource-list
+ * entry, external, or entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aValues array of data values. 'name' in case of list or value of
+ * element's attribute for other element types.
+ */
+ IMPORT_C void GetElementsL(const TDesC& aElementType, CDesCArray& aValues);
+
+ /**
+ * Removes the given element from the current path
+ *
+ * @param aElementType, an element type, this can be list, resource-list
+ * entry, external, or entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @return Error code. KErrArgument, KErrNone, KErrNotFound
+ * or KErrPermissionDenied
+ */
+ IMPORT_C TInt RemoveElementL(const TDesC& aElementType, const TDesC& aData);
+
+ /**
+ * Is element exist on the current path
+ *
+ * @param aElementType, an element type, this can be list, resource-list
+ * entry, external, or entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @return ETrue if element exist.
+ */
+ IMPORT_C TBool IsElementExist(const TDesC& aElementType, const TDesC& aData);
+
+
+ // Methods related to changing the current path
+
+ /**
+ * Switch into given service URI. After this the given ServiceURI
+ * will become currently pointed URI, and all operations will be
+ * performed on this URI. This corresponds to entering into a disk
+ * in DOS
+ *
+ * @param TDesC& name of the ServiceURI
+ * @return Error code, KErrNone or KErrNotFound
+ */
+ IMPORT_C TInt SwitchToServiceURIL(const TDesC& aServiceURI);
+
+ /**
+ * Switch into given list. After this the given list will become
+ * currently pointed list (path), and all operations will be performed
+ * in this path. This corresponds to entering into a directory in DOS
+ *
+ * @param TDesC& name of the list
+ * @return Error code, KErrNone or KErrNotFound
+ */
+ IMPORT_C TInt SwitchToListL(const TDesC& aListName);
+
+ /**
+ * Switch out from current list, if path is already service-uri level
+ * nothing will happed. This corresponds to gettting out from a directory.
+ * The Current path changes if successful
+ */
+ IMPORT_C void SwitchOutFromList();
+
+ /**
+ * This gives complete hierarchy of the current path. The first element
+ * of the array will be ServiceURI, and after that will be child lists,
+ * The current list name is the last element of the array.
+ *
+ * @param CDesC16Array& array of service-uri and list names ordered from
+ * root to the list's own name.
+ */
+ IMPORT_C void GetCurrentPathL(CDesCArray& aPath);
+
+ /**
+ * Set the current path according to given hierarchy. The first element
+ * of the array must be the ServiceURI, with child lists to follow.
+ * The target list name is the last element of the array.
+ * If the list is not found according to the given heirarchy, the current
+ * path will not be changed and KErrNotFound will be returned. An empty
+ * array will cause the path to be completely empty.
+ *
+ * @param MDesCArray& array of service-uri and list names ordered from
+ * root to the list's own name.
+ * @return Error code, KErrNone or KErrNotFound
+ */
+ IMPORT_C TInt SetCurrentpathL(const MDesCArray& aListsNames);
+
+ /**
+ * Accessor for the last negotiated RLS service URI.
+ * URI is Zero length if the last HTTP PUT did not
+ * receive HTTP 409 error or if there was no <alt-value> value
+ * in the response body.
+ *
+ * @return last negotiated RLS service URI.
+ *
+ */
+ IMPORT_C TPtrC NegotiatedServiceUri();
+
+ /**
+ * Destructor
+ *
+ */
+ ~CRLSXDM();
+
+ private:
+
+ /**
+ * Second phase constructor
+ *
+ * @param TInt XDMSettingsList ID
+ * @return none
+ */
+ void ConstructL(const TInt aSettingId );
+
+ /**
+ * C++ constructor
+ *
+ * @param none
+ * @return none
+ */
+ CRLSXDM();
+
+
+ /**
+ * Return pointer to serviceUri and its attribute value
+ *
+ * @param CXdmNodeAttribute attribute value of serviceUri
+ * @param CXdmDocumentNode pointer to root node
+ * @return CXdmDocumentNode* if found, otherwise NULL
+ */
+ CXdmDocumentNode* IsServiceUriExist(const TDesC& aUriAttr,
+ CXdmDocumentNode* aRootNode);
+
+ /**
+ * Get list's non-leaf child. These includes getting of list, entry
+ * external and entry ref.
+ *
+ * @param aChildName, name of non-leaf child
+ * @param aAttrValue value of attribute to match with
+ * @param aTargetNode pointer to target node
+ * @return CXdmDocumentNode* if found, otherwise NULL
+ */
+ CXdmDocumentNode* GetNonLeafChild(const TDesC& aChildName,
+ const TDesC& aAttrValue,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Get list's leaf child. These includes getting of resource-list and
+ * packages
+ *
+ * @param aChildName, name of non-leaf child
+ * @param aValue value to match with
+ * @param aTargetNode pointer to target node
+ * @return CXdmDocumentNode* if found, otherwise NULL
+ */
+ CXdmDocumentNode* GetLeafChild(const TDesC& aChildName,
+ const TDesC& aValue, CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Return the attribute name used for the element.
+ * Only valid for non-leaf elements.
+ *
+ * @param aElementName, name of non-leaf element
+ * @param aAttrName name of the attribute returns here
+ */
+ void GetNonLeafElementAttrName(const TDesC& aElementName,
+ TDes& aAttrName);
+
+ /**
+ * Validates the given non-leaf element.
+ *
+ * @param aElementName, name of non-leaf element
+ * @return ETrue if valid non-leaf element
+ */
+ TBool IsNonLeafElementValid(const TDesC& aElementName);
+
+
+ /**
+ * Adds a non leaf element to current path, only 'list' element can be
+ * added to the root of ServiceURI, to add any of other possible elements
+ * current path should be inside an existing list. This functions doesnt
+ * care whether element already exist or not.
+ *
+ * @param aElementType, an element type to be added, this can be list,
+ * entry, external, entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @param aDisplayName display name of the element
+ * @param aTargetNode pointer to target node
+ */
+ void AddNonLeafElementL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Adds a leaf element to current path, only 'resource-list' element can be
+ * added to the root of ServiceURI. This functions doesnt care whether
+ * element already exist or not.
+ *
+ * @param aElementType, an element type to be added, currently this can be
+ * only resource-list. Use constants from RLSPresXDMConsts.h.
+ * @param aData value of the element
+ * @param aTargetNode pointer to target node
+ */
+ void AddLeafElementL(const TDesC& aElementType, const TDesC& aData,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Gets display name of a non leaf element.
+ *
+ * @param aElementType, an element type, this can be list,
+ * entry, external, entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @param aDisplayName display name of the element
+ * @param aTargetNode pointer to target node
+ * @return Error code. KErrArgument, KErrNone, KErrAlreadyExist
+ * or KErrPermissionDenied
+ */
+ TInt GetDisplayNameInt(const TDesC& aElementType,
+ const TDesC& aData, TPtrC8& aDisplayName,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Updates display name of an element.
+ *
+ * @param aElementType, an element type, this can be list,
+ * entry, external, entry ref. Use constants from RLSPresXDMConsts.h.
+ * @param aData name in case of list, value of element's attribute for
+ * other elements.
+ * @param aDisplayName display name of the element
+ * @param aTargetNode pointer to target node
+ * @return Error code. KErrArgument, KErrNone, KErrAlreadyExist
+ * or KErrPermissionDenied
+ */
+ TInt UpdateDisplayNameIntL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Get all elements of same type at given node path
+ *
+ * @param aElementType, an element type, this can be list,
+ * entry, external, or entry ref. Use constants from
+ * RLSPresXDMConsts.h.
+ * @param aValues array of data values. 'name' in case of list or value of
+ * element's attribute for other element types.
+ * @param aTargetNode pointer to target node
+ */
+ void GetNonLeafElementsL(const TDesC& aElementType,
+ CDesCArray& aValues, CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Get all elements of same type at given node path
+ *
+ * @param aElementType, this can be resource-list
+ * @param aValues array of data values. 'name' in case of list or value of
+ * element's attribute for other element types.
+ * @param aTargetNode pointer to target node
+ * @return none
+ */
+ void GetLeafElementsL(const TDesC& aElementType, CDesCArray& aValues,
+ CXdmDocumentNode* const aTargetNode);
+
+ /**
+ * Internal function for deleting empty lists, keep called by RunL
+ * until all lists are deleted.
+ */
+ void DeleteEmptyListsL();
+
+ /**
+ * Adds the compulsory package node to current service uri
+ * in case no current uri found, does nothing. This function needed
+ * because some servers wants package as the last child node of
+ * service uri node.
+ */
+ void AddPackageL();
+
+ /**
+ * Removes the compulsory package node to current service uri
+ * in case no current uri found, does nothing. This function needed
+ * because some servers wants package as the last child node of
+ * service uri node.
+ */
+ void RemovePackageL();
+
+ /**
+ * Creates the document root if needed
+ */
+ void CreateRootIfNeededL();
+
+ /**
+ * Parse Serice URI negotiation response body and save it into
+ * iNegotiatedServiceUri.
+ * @param aErrorBody HTTP 409 error body
+ */
+ void DoParseNegotiatedServiceUriL( CXdmDocumentNode* aErrorBody );
+
+
+ /**
+ * From CActive
+ *
+ */
+ void DoCancel();
+
+ /**
+ * From CActive
+ *
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ *
+ */
+ TInt RunError(TInt aError);
+
+ private: // Data
+
+ CXdmProtocolInfo* iXDMProtocolInfo;
+ CXdmEngine* iXDMEngine;
+ CXdmDocument* iRLSDocument;
+
+ TInt iAsyncReq;
+ MRLSPresXDMAsyncHandler* iAsyncHandler;
+
+ CDesCArray* iListPath;
+ RPointerArray<CXdmDocumentNode> iListPointerPath;
+
+ /**
+ * Negotiated RLS service URI
+ * Own
+ */
+ HBufC* iNegotiatedServiceUri;
+
+
+ };
+
+#endif //__RLSXDM_H__
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/presence_list_api/inc/rlspresxdmconsts.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, These are exported constants.
+*
+*/
+
+
+
+#ifndef __RLSPRESXDMCONSTS_H__
+#define __RLSPRESXDMCONSTS_H__
+
+const TInt KNodeNameMaxLength = 25;
+const TInt KNodeContentMaxLength = 100;
+
+// for getting and settings complex transforms
+// doesnt need for setting 'provide-all'
+struct TTransDataCompo
+ {
+ TBuf<KNodeNameMaxLength> nodeName;
+ TBuf<KNodeContentMaxLength> nodeContent;
+ };
+
+// for getting and setting condition validity
+struct TTimePeriod
+ {
+ TDateTime from;
+ TDateTime until;
+ };
+
+// The following actions are available
+_LIT( KPresBlock, "block");
+_LIT( KPresConfirm, "confirm");
+_LIT( KPresPoliteBlock, "polite-block");
+_LIT( KPresAllow, "allow");
+
+// These values are only for 'provide-user-input' transform
+_LIT( KPresFalse, "false");
+_LIT( KPresBare, "bare");
+_LIT( KPresThresholds, "thresholds");
+_LIT( KPresFull, "full");
+
+// Supported Presence complex transform types
+_LIT( KPresProvideServices, "provide-services");
+_LIT( KPresProvideDevices, "provide-devices");
+_LIT( KPresProvidePersons, "provide-persons");
+
+//Supported Presence complex transform node names
+_LIT( KPresServiceId, "service-id");
+_LIT( KPresClass, "class");
+_LIT( KPresOccurenceID, "occurrence-id");
+_LIT( KPresDeviceID, "device-id");
+_LIT( KPresServiceUri, "service-uri");
+_LIT( KPresServiceUriScheme, "service-uri-scheme");
+
+// Following node names are only returned in getters, doesnt need in setters
+_LIT( KPresAllDevices, "all-devices");
+_LIT( KPresAllPersons, "all-persons");
+_LIT( KPresAllServices, "all-services");
+
+
+//Supported Presence boolean tranform types (IETF)
+_LIT( KPresProvideActivities, "provide-activities");
+_LIT( KPresProvideClass, "provide-class");
+_LIT( KPresProvideDeviceID, "provide-deviceID");
+_LIT( KPresProvideMood, "provide-mood");
+_LIT( KPresProvidePlaceIs, "provide-place-is");
+_LIT( KPresProvidePlaceType, "provide-place-type");
+_LIT( KPresProvidePrivacy, "provide-privacy");
+_LIT( KPresProvideRelationship, "provide-relationship");
+_LIT( KPresProvideSphere, "provide-sphere");
+_LIT( KPresProvideStatusIcon, "provide-status-icon");
+_LIT( KPresProvideTimeOffset, "provide-time-offset");
+_LIT( KPresProvideNote, "provide-note");
+_LIT( KPresProvideUnknownAttribute, "provide-unknown-attribute");
+
+//Supported Presence boolean tranform types (OMA Extensions)
+_LIT( KPresProvideWillingness, "provide-willingness");
+_LIT( KPresProvideNetworkAvailability, "provide-network-availability");
+_LIT( KPresProvideSessionParticipation, "provide-session-participation");
+_LIT( KPresProvideGeoPriv, "provide-geopriv");
+_LIT( KPresProvideRegistrationState, "provide-registration-state");
+_LIT( KPresProvideBarringState, "provide-barring-state");
+
+//Supported Presence transform other types (IETF)
+_LIT( KPresProvideUserInput, "provide-user-input");
+_LIT( KPresProvideAllAttributes, "provide-all-attributes");
+
+//RLS XDM Elements
+_LIT( KPresList, "list");
+_LIT( KPresEntry, "entry");
+_LIT( KPresExternal, "external");
+_LIT( KPresEntryRef, "entry-ref");
+_LIT( KPresResourceList, "resource-list");
+
+#endif // __RLSPRESXDMCONSTS_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/presence_list_api/presence_list_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<api id="d37a0fa0de27ab68522d660392609ab7" dataversion="1.0">
+ <name>Presence list API</name>
+ <description>API for presence list management. Supports:
+- creating presence lists
+- retrieving of existing presence lists
+- adding, modifying and deleting of contacts on the lists</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="rlspresxdm.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/publisher_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Publisher API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msimpleetagobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpleetagobserver.h)
+../inc/msimplepublisher.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplepublisher.h)
+../inc/msimplepublishobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplepublishobserver.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/publisher_api/inc/msimpleetagobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine publish etag value callback observer
+*
+*/
+
+
+
+
+#ifndef M_simpleetagobserver_H
+#define M_simpleetagobserver_H
+
+#include <e32std.h>
+
+/**
+ * MSimpleETagObserver
+ *
+ * SIMPLE Engine publish ETag value callback observer
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimpleETagObserver
+ {
+
+public:
+
+ /**
+ * Callback for publish request completion
+ *
+ * @since Series60 3.2
+ * @param aVal new ETag value. May be zero length when publication ends or fails.
+ */
+ virtual void NewETagL( const TDesC8& aVal ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/publisher_api/inc/msimplepublisher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine presence data publisher
+*
+*/
+
+
+
+
+#ifndef M_simplepublisher_H
+#define M_simplepublisher_H
+
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class MSimpleDocument;
+class MSimpleConnection;
+class MSimpleETagObserver;
+
+
+/**
+ * MSimplePublisher
+ *
+ * SIMPLE Engine presence data publisher
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimplePublisher
+ {
+
+public:
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 v3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getter for the SIMPLE Engine connection.
+ *
+ * @since S60 3.2
+ * @return the attribute name.
+ */
+ virtual const MSimpleConnection& Connection() = 0;
+
+ /**
+ * Start to publish data.
+ * Leaves with KErrInUse if there is already active publication
+ * in this MSimplePublisher entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE Engine.
+ *
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @param aRefresh whether refresh is made automatically
+ * @return operation id
+ */
+ virtual TInt StartPublishL( MSimpleDocument& aDocument,
+ TBool aRefresh ) = 0;
+
+ /**
+ * Continue data publication
+ * Leaves with KErrInUse if there is already active publication
+ * in this MSimplePublisher entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE Engine.
+ *
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @param aRefresh whether refresh is made automatically
+ * @param aETag SIP ETag header value to be used in SIP-If-Match header.
+ * @return operation id
+ */
+ virtual TInt ContinuePublishL( MSimpleDocument& aDocument,
+ TBool aRefresh, const TDesC8& aETag ) = 0;
+
+ /**
+ * Update published data. This will overwrite the previous
+ * presence data. StartPublishL() must be completed before
+ * calling this method.
+ * Remote URI is not modified but taken from an initial
+ * StartPublishL document.
+ *
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @return operation id
+ */
+ virtual TInt ModifyPublishL( MSimpleDocument& aDocument ) = 0;
+
+ /**
+ * Stop publishing data.
+ *
+ * @since S60 3.2
+ * @return operation id
+ */
+ virtual TInt StopPublishL() = 0;
+
+ /**
+ * Stop publication.
+ *
+ * @since S60 3.2
+ * @param aETag SIP ETag header value to be used in SIP-If-Match header.
+ * @return operation id
+ */
+ virtual TInt StopPublishL( const TDesC8& aETag ) = 0;
+
+ /**
+ * SIP Status code accessor.
+ * Get the status of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ virtual TUint SIPStatus() = 0;
+
+ /**
+ * SIP Retry-after header value accessor.
+ * Get the SIP retry-fater header value of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return retry-after value in seconds, 0 if not available
+ */
+ virtual TUint SIPRetryAfter() = 0;
+
+ /**
+ * SIP ETag header value accessor.
+ * Refer to RFC3903.
+ *
+ * @since S60 3.2
+ * @return Current ETag header value received from a network server.
+ * Zero length if not available.
+ */
+ virtual TPtrC8 SIPETag() = 0;
+
+ /**
+ * SIP ETag header value change observer setter.
+ * Notice that this value may change after each modification or automatic refresh
+ * of publication. Observer is called when the ETag value changes next time.
+ * Refer to RFC3903.
+ *
+ * @since S60 3.2
+ * @param aObs ETag value observer. Can be NULL to stop notification.
+ */
+ virtual void SetSIPETagObserver( MSimpleETagObserver* aObs ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/publisher_api/inc/msimplepublishobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine publish callback observer
+*
+*/
+
+
+
+
+#ifndef M_simplepublishobserver_H
+#define M_simplepublishobserver_H
+
+#include <e32std.h>
+
+/**
+ * MSimplePublishObserver
+ *
+ * SIMPLE Engine publish callback observer
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimplePublishObserver
+ {
+
+public:
+
+ /**
+ * Callback for publish request completion
+ *
+ * @since Series60 3.2
+ * @param aOpid operation id
+ * @param aStatus completion status
+ */
+ virtual void PublishReqCompleteL( TInt aOpid, TInt aStatus) = 0;
+
+ /**
+ * Callback for publish termination
+ *
+ * @since Series60 3.2
+ * @param aOpid operation id
+ */
+ virtual void PublishTerminatedL( TInt aOpid ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/publisher_api/publisher_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<api id="d8a3451a76f3a2c992751946480e70f9" dataversion="1.0">
+ <name>Publisher API</name>
+ <description>API for publishing own presence information. It supports:
+- creating a document for publishing
+- starting the publication
+- terminating the publication.</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="simpleengine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Registration API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msimpleconnection.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpleconnection.h)
+../inc/simpleutils.h MW_LAYER_PLATFORM_EXPORT_PATH(simpleutils.h)
+../inc/simplefactory.h MW_LAYER_PLATFORM_EXPORT_PATH(simplefactory.h)
+../inc/msimpleconnectionobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpleconnectionobserver.h)
+../inc/simpleerrors.h MW_LAYER_PLATFORM_EXPORT_PATH(simpleerrors.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/inc/msimpleconnection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine connection
+*
+*/
+
+
+
+
+#ifndef M_simpleconnection_H
+#define M_simpleconnection_H
+
+#include <e32std.h>
+
+/**
+ * MSimpleConnection
+ *
+ * SIMPLE engine connection
+ *
+ * @lib simpleengine
+ * @since S60 v3.2
+ */
+
+class MSimpleConnection
+ {
+
+public:
+
+enum TSimpleState
+ {
+ /** Connection initializing */
+ EIdle=1,
+ /** Connection active */
+ EActive,
+ /** Connection suspended */
+ ESuspend,
+ /** Connection is inactive */
+ EInactive,
+ /** Connection is permanently unavailable */
+ EUnavailable
+ };
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Login using default SIP Profile settings and SIMPLE Engine default values
+ * instead of given Presence Settings
+ * This method is meant mainly for testing purposes.
+ * Leaves KErrAlreadyExists if this MSimpleConnection
+ * entity is already logged in.
+ * @since S60 3.2
+ * @return operation id
+ */
+ virtual TInt LoginL() = 0;
+
+ /**
+ * Login using specified Presence Settings
+ * Leaves KErrAlreadyExists if this MSimpleConnection
+ * entity is already logged in.
+ * Leaves KErrNotFound if specified settings
+ * are not found.
+ * @since S60 3.2
+ * @param aId Presence Settings id
+ * @return operation id
+ */
+ virtual TInt LoginL( TInt aId ) = 0;
+
+ /**
+ * Getter for the connection staus.
+ *
+ * @since S60 3.2
+ * @return connection staus
+ */
+ virtual TSimpleState ConnectionStatus() = 0;
+
+ /**
+ * Current SIP identity accessor
+ *
+ * @since S60 3.2
+ * @return SIP identity
+ */
+ virtual TPtrC8 CurrentSIPIdentityL() = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/inc/msimpleconnectionobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine connection observer
+*
+*/
+
+
+
+
+#ifndef M_simpleconnectionobserver_H
+#define M_simpleconnectionobserver_H
+
+#include <e32std.h>
+#include <msimpleconnection.h>
+
+/**
+ * MSimpleConnectionObserver
+ *
+ * SIMPLE engine connection observer
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimpleConnectionObserver
+ {
+
+public:
+
+ /**
+ * Connection status change
+ * @since S60 3.2
+ * @param aState new state
+ */
+ virtual void ConnectionStatusL( MSimpleConnection::TSimpleState aState ) = 0;
+
+ /**
+ * Client's request completion.
+ *
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus completion status
+ */
+ virtual void RequestCompleteL( TInt aOpId, TInt aStatus ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/inc/simpleerrors.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE factory
+*
+*/
+
+
+
+
+#ifndef SIMPLEERRORS_H
+#define SIMPLEERRORS_H
+
+// Simple Engine error codes.
+
+/**
+ * Subscribe requets is accepted by server but pending
+ */
+const TInt KSimpleErrPending = -35000;
+
+/**
+ * The subscription has been terminated.
+ * Application SHOULD re-subscribe later.
+ */
+const TInt KSimpleErrDeactivated = -35001;
+
+/**
+ * The subscription has been terminated.
+ * Application SHOULD re-subscribe later.
+ */
+const TInt KSimpleErrProbation = -35002;
+
+/**
+ * The subscription has been terminated due to change in
+ * authorization policy.
+ * Application SHOULD NOT attempt to re-subscribe.
+ */
+const TInt KSimpleErrRejected = -35003;
+
+/**
+ * The subscription has been terminated because it was not
+ * refreshed before it expired. Application MAY re-subscribe
+ * later.
+ */
+const TInt KSimpleErrTimeout = -35004;
+
+/**
+ * The subscription has been terminated because the notifier
+ * could not obtain authorization in a timely fashion.
+ * Application MAY re-subscribe later.
+ */
+const TInt KSimpleErrGiveup = -35005;
+
+/**
+ * The subscription has been terminated because the resource
+ * state which was being monitored no longer exists.
+ * Application SHOULD NOT attempt to re-subscribe.
+ */
+const TInt KSimpleErrNoresource = -35006;
+
+/**
+ * The operation has exceeded SIMPLE Presence Settings limit,
+ * e.g. CLIENT-OBJ-DATA-LIMIT or SOURCE-THROTLLE-PUBLISH.
+ */
+const TInt KSimpleErrSettingsLimit = -35007;
+
+/**
+ * The operation has received SIP error that indicates a
+ * temporary problem and the application MAY retry
+ * the same request later on.
+ */
+const TInt KSimpleErrTemporary = -35008;
+
+/**
+ * The operation has received SIP error that indicates a
+ * permanent problem and the application SHOULD NOT retry
+ * the same request later on.
+ */
+const TInt KSimpleErrPermanent = -35009;
+
+/**
+ * The operation has received SIP error that indicates an
+ * authorization or authentication problem.
+ */
+const TInt KSimpleErrAuthorization = -35010;
+
+/**
+ * The operation has received SIP error that indicates
+ * that the user does not exist at the domain specified
+ * in the Request-URI. This is SIP error 404.
+ */
+const TInt KSimpleErrNotFound = -35011;
+
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/inc/simplefactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Factory class for SIMPLE Engine
+*
+*/
+
+
+
+
+#ifndef simplefactory_H
+#define simplefactory_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+
+// FORWARD DECLARATION
+class MSimpleConnection;
+class MSimplePublisher;
+class MSimpleWatcher;
+class MSimpleWinfoWatcher;
+class MSimpleDocument;
+class MSimpleElement;
+class MSimpleNamespace;
+class MSimpleFilterDocument;
+
+class MSimpleConnectionObserver;
+class MSimplePublishObserver;
+class MSimpleWatcherObserver;
+class MSimpleWinfoObserver;
+class MSimpleContent;
+class MSimpleInstantMsgObserver;
+class MSimpleInstantMessage;
+
+/**
+ * Factory class for SIMPLE Engine
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+class TSimpleFactory
+ {
+
+public:
+
+ /**
+ * Create new simple Element entity.
+ * @since S60 3.2
+ * @param aNsUri the namespace URI for this element.
+ * @param aLocalName the local name for this element.
+ * @return MSimpleElement, ownership is transferred.
+ */
+ IMPORT_C static MSimpleElement* NewElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Create new simple NameSpace entity.
+ * @since S60 3.2
+ * @param aPrefix prefix to be used
+ * @param aUri URI
+ * @return MSimpleNameSpace, ownership is transferred.
+ */
+ IMPORT_C static MSimpleNamespace* NewNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri );
+
+ /**
+ * Create new simple engine Connection entity.
+ * @since S60 3.2
+ * @param aObserver client callback observer
+ * @return MSimpleConnection, ownership is transferred.
+ */
+ IMPORT_C static MSimpleConnection* NewConnectionL(
+ MSimpleConnectionObserver& aObserver );
+
+ /**
+ * Create new Publisher entity.
+ * @since S60 3.2
+ * @paraam aConn simple engine connection
+ * @param aObserver client callback observer
+ * @return MSimplePublisher, ownership is transferred.
+ */
+ IMPORT_C static MSimplePublisher* NewPublisherL(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver );
+
+ /**
+ * Create new InstantMessage entity.
+ * @since S60 5.0
+ * @param aConn simple engine connection
+ * @param aObserver client callback observer
+ * @return MSimpleInstantMessage, ownership is transferred.
+ */
+ IMPORT_C static MSimpleInstantMessage* NewInstantMessageL(
+ MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver );
+
+ /**
+ * Create new Watcher entity.
+ * @since S60 3.2
+ * @paraam aConn simple engine connection
+ * @param aObserver client callback observer
+ * @return MSimpleWatcher, ownership is transferred.
+ */
+ IMPORT_C static MSimpleWatcher* NewWatcherL(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver );
+
+ /**
+ * Create new WinfoWatcher entity.
+ * @since S60 3.2
+ * @paraam aConn simple engine connection
+ * @param aObserver client callback observer
+ * @return MSimpleWinfoWatcher, ownership is transferred.
+ */
+ IMPORT_C static MSimpleWinfoWatcher* NewWinfoWatcherL(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver );
+
+ /**
+ * Create new simple Document entity from scratch.
+ * @since S60 3.2
+ * @return MSimpleDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleDocument* NewDocumentL( );
+
+ /**
+ * Create new simple Document entity from xml-document.
+ * @since S60 3.2
+ * @param aXml a valid XML document containing in PIDF format.
+ * @return MSimpleDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleDocument* NewDocumentL( const TDesC8& aXml );
+
+ /**
+ * Create new simple FilterDocument entity.
+ * @since S60 3.2
+ * @return MSimpleFilterDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleFilterDocument* NewFilterDocumentL();
+
+ /**
+ * Create new simple FilterDocument entity.
+ * @since S60 3.2
+ * @param aXml a valid XML document containing in PIDF format.
+ * @return MSimpleFilterDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleFilterDocument* NewFilterDocumentL( const TDesC8& aXml );
+
+ IMPORT_C static MSimpleContent* NewContentL(
+ const TDesC8& aContentID, const TDesC8& aContentType );
+
+ /**
+ * Create new simple engine Connection entity.
+ * @since S60 3.2
+ * @param aObserver client callback observer
+ * @param aServiceId serviceId of current service
+ * @return MSimpleConnection, ownership is transferred.
+ */
+ IMPORT_C static MSimpleConnection* NewConnectionL(
+ MSimpleConnectionObserver& aObserver, TInt32 aServiceId );
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/inc/simpleutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine data document utilities
+*
+*/
+
+
+
+
+#ifndef simpleutils_H
+#define simpleutils_H
+
+#include <e32std.h>
+
+// Namespaces supported
+_LIT8 ( KSimpleNsDefault, "urn:ietf:params:xml:ns:pidf" );
+_LIT8 ( KSimpleNsPDM, "urn:ietf:params:xml:ns:pidf:data-model" );
+_LIT8 ( KSimpleNsRPID, "urn:ietf:params:xml:ns:pidf:rpid" );
+_LIT8 ( KSimpleNsOP, "urn:ietf:params:xml:ns:pidf:oma-pres" );
+_LIT8 ( KSimpleNsGP, "urn:ietf:params:xml:ns:pidf:gepriv10" );
+_LIT8 ( KSimpleNsCL, "urn:ietf:params:xml:ns:pidf:gepriv10:civilLoc" );
+_LIT8 ( KSimpleNsGML, "urn:opengis:specification:gml:schema-xsd:feature:v3.0" );
+
+_LIT8 ( KSimpleDefault, "" );
+_LIT8 ( KSimplePDM, "pdm" );
+_LIT8 ( KSimpleRPID, "rpid" );
+_LIT8 ( KSimpleOP, "op" );
+_LIT8 ( KSimpleGP, "gp" );
+_LIT8 ( KSimpleCL, "cl" );
+_LIT8 ( KSimpleGML, "gml" );
+
+// Other namespaces, for <filter-set> and <watcherinfo>
+_LIT8 ( KSimpleNsFilter, "urn:ietf:params:xml:ns:simple-filter" );
+_LIT8 ( KSimpleNsWinfo, "urn:ietf:params:xml:ns:watcherinfo" );
+
+_LIT8 ( KSimpleNsRlmi, "urn:ietf:params:xml:ns:rlmi" );
+
+
+/**
+ * SIMPLE Engine data document utility methods
+ *
+ * @lib simpleenine
+ * @since S60 3.2
+ */
+class TSimpleUtils
+ {
+
+public:
+
+ /**
+ * Namespace URI solver
+ * @since S60 3.2
+ * @param aPrefix namespace prefix
+ * @leaves with KErrNotFound if unsupported prefix given
+ * @return namespace URI
+ */
+ IMPORT_C static TPtrC8 NsUriL(
+ const TDesC8& aPrefix );
+
+ /**
+ * Namespace prefix solver
+ * @since S60 3.2
+ * @param aURI namespace URI
+ * @leaves with KErrNotFound if unsupported URI given, see valid ones above.
+ * @return namespace prefix.
+ */
+ IMPORT_C static TPtrC8 NsPrefixL(
+ const TDesC8& aURI );
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/registration_api/registration_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="9c9f435958bcb81eb0cfb0d6d744d2ff" dataversion="1.0">
+ <name>Registration API</name>
+ <description>This API provides the registration and de-registration of SIP profile associated with the provisioned Presence Settings.</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="simpleengine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: SIMPLE Documents API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msimpleattribute.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpleattribute.h)
+../inc/msimplepresencelist.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplepresencelist.h)
+../inc/msimplefilterdocument.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplefilterdocument.h)
+../inc/msimplemeta.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplemeta.h)
+../inc/msimpleelement.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpleelement.h)
+../inc/msimplewinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplewinfo.h)
+../inc/msimplenamespace.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplenamespace.h)
+../inc/msimpledocument.h MW_LAYER_PLATFORM_EXPORT_PATH(msimpledocument.h)
+../inc/msimplecontent.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplecontent.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimpleattribute.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data attribute
+*
+*/
+
+
+
+
+#ifndef M_simpleattribute_H
+#define M_simpleattribute_H
+
+#include <e32std.h>
+
+// FORWARD DECLARATION
+
+
+/**
+ * MSimpleAttribute
+ *
+ * SIMPLE data attribute
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.2
+ */
+
+class MSimpleAttribute
+ {
+
+public:
+
+ /**
+ * Getter for the attribute name.
+ * @since S60 3.2
+ * @return the attribute name.
+ */
+ virtual const TDesC8& Name() = 0;
+
+ /**
+ * Getter for the attribute value.
+ * @since S60 3.1
+ * @return the attribute value, UTF-8
+ */
+ virtual const TDesC8& Value() = 0;
+
+ /**
+ * Getter for the attribute value in UNICODE.
+ * @since S60 3.2
+ * @return the attribute value. Ownership is transferred.
+ */
+ virtual HBufC* ValueUniLC() = 0;
+
+ /**
+ * Setter for the attribute value.
+ *
+ * @since S60 3.2
+ * @param aValue: value to be set, UNICODE
+ */
+ virtual void SetValueL( const TDesC& aValue ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplecontent.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data document
+*
+*/
+
+
+
+
+#ifndef M_simplecontent_H
+#define M_simplecontent_H
+
+#include <e32std.h>
+// #include <S32strm.h>
+
+// FORWARD DECLARATION
+
+
+
+/**
+ * MSimpleContent
+ *
+ * SIMPLE data direct content
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleContent
+ {
+
+public:
+
+ /**
+ * Destructor
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Data accessor
+ *
+ * @since S60 ?S60_version
+ * @return data
+ */
+ virtual TPtrC8 Body() = 0;
+
+ /**
+ * Data accessor
+ *
+ * @since S60 ?S60_version
+ * @return data, ownership is transferred
+ */
+ virtual HBufC8* GiveBodyOwnerShip() = 0;
+
+ /**
+ * Data setter
+ *
+ * @since S60 ?S60_version
+ * @param aData data to be copied
+ */
+ virtual void CopyBodyL( const TDesC8& aData ) = 0;
+
+ /**
+ * Data setter
+ *
+ * @since S60 ?S60_version
+ * @param aData data, ownetship is taken.
+ */
+ virtual void SetBody( HBufC8* aData ) = 0;
+
+ /**
+ * content-id accessor, without "<"...">" characters
+ * @return content-id
+ */
+ virtual TPtrC8 ContentID() = 0;
+
+ /**
+ * content-type accessor
+ * @return content-type
+ */
+ virtual TPtrC8 ContentType() = 0;
+
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimpledocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data document
+*
+*/
+
+
+
+
+#ifndef M_simpledocument_H
+#define M_simpledocument_H
+
+#include <e32std.h>
+#include <S32strm.h>
+#include <msimpleelement.h>
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+class MSimpleContent;
+
+
+/**
+ * MSimpleDocument
+ *
+ * SIMPLE data document
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleDocument : public MSimpleElement
+ {
+
+public:
+
+ /**
+ * Entity's URI getter. URI is specified in a factory method
+ *
+ * @since S60 3.2
+ * @return URI, ownership is not transferred.
+ */
+ virtual const TDesC8* EntityURI() = 0;
+
+ /**
+ * Entity's URI setter.
+ *
+ * @since S60 3.2
+ * @param aValue entity URI
+ * @return URI
+ */
+ virtual void SetEntityURIL( const TDesC8& aValue ) = 0;
+
+ /**
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ virtual TPtrC8 DefaultNamespace() = 0;
+
+ /**
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ virtual void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri) = 0;
+
+ /**
+ * Gets all namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ * AddNamespaceL() modifications are not visible without
+ * new call of this method.
+ */
+ virtual RPointerArray<MSimpleNamespace>& NamespacesL() = 0;
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ virtual void ExternalizeL( RWriteStream& aStream ) = 0;
+
+ /**
+ * Get direct contents
+ * @param aContents array of contents [out].
+ * This is walid till the AddDirectContentL method.
+ */
+ virtual void GetDirectContentsL(
+ RPointerArray<MSimpleContent>& aContents ) = 0;
+
+ /**
+ * Add content
+ * @param aContent content, the data content is copied into document
+ * @param aCopyContent ETrue if buffer of each content is copied or
+ * ownership is transferred just without copy.
+ */
+ virtual void AddDirectContentL( MSimpleContent& aContent, TBool aCopyContent ) = 0;
+
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimpleelement.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data element
+*
+*/
+
+
+
+
+#ifndef M_simpleelement_H
+#define M_simpleelement_H
+
+#include <e32std.h>
+#include <msimpleattribute.h>
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+
+/**
+ * MSimpleDocument
+ *
+ * SIMPLE data document
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleElement
+ {
+
+public:
+
+ /**
+ * Destroy this element entity and all its descendant elements.
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @since S60 3.2
+ * @return KNullDesC8 if not set
+ */
+ virtual const TDesC8& LocalName() = 0;
+
+ /**
+ * Getter for Element's own default namespace.
+ *
+ * @since S60 3.2
+ * @return pointer to the MSimpleNamespace object of this Element.
+ * NULL if not set for this element. Ownership is transferred.
+ */
+ virtual MSimpleNamespace* DefNamespaceL() = 0;
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 3.2
+ * @return ETrue if has content, EFalse if not.
+ */
+ virtual TBool HasContent() = 0;
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 3.2
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ virtual HBufC* ContentUnicodeL()= 0;
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 3.2
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ virtual void SetContentUnicodeL( const TDesC& aContent ) = 0;
+
+ /**
+ * Getting the child elements of this element.
+ * @param aElementArray: Array to be filled with the child elements,
+ * or empty array if no childs.
+ * Any modifications made on the returned items
+ * modify the real childs.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity. New elements are
+ * not attached to the array automatically, so that you have
+ * to re-call this method if you wish to see all the elements
+ * after calling AddSimpleElementL() method.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ virtual TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray ) = 0;
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since S60 3.2
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ virtual HBufC* AttrValueLC( const TDesC8& aName ) = 0;
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ virtual const TDesC8* AttrValue( const TDesC8& aName ) = 0;
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since S60 3.2
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ virtual void AddAttrL( const TDesC8& aName, const TDesC& aValue ) = 0;
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since S60 3.2
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no childs.
+ * Any modifications made on the returned items
+ * modify the real attributes.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity. New attributes are
+ * not attached to the array automatically, so that you have
+ * to re-call this method if you wish to see all the elements
+ * after calling AddAttrL() method.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ virtual TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray ) = 0;
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since S60 3.2
+ * @return the parent element or NULL if no parent set.
+ * Ownership is NOT transferred to the caller.
+ */
+ virtual MSimpleElement* SimpleParentL() = 0;
+
+ /**
+ * Detach the element from its parent.
+ * Notice that the current element instance should not be
+ * used after this method is called successfully.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since S60 3.2
+ */
+ virtual void DetachSimpleL() = 0;
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since S60 3.2
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element.
+ * OWNERSHIP IS TRANSFERRED.
+ * Leave if aLocalName contains illegal characters or
+ * if aLocalName is zero length.
+ */
+ virtual MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName ) = 0;
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since S60 3.2
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave if aLocalName contains illegal characters.
+ */
+ virtual MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName ) = 0;
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since S60 3.2
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ virtual void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplefilterdocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data filter
+*
+*/
+
+
+
+
+#ifndef M_simplefilterdocument_H
+#define M_simplefilterdocument_H
+
+#include <e32std.h>
+#include <msimpleelement.h>
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+
+/**
+ * MSimpleFilterDocument
+ *
+ * SIMPLE Data Filter
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleFilterDocument : public MSimpleElement
+ {
+
+public:
+
+ /**
+ * Filter document default namespace accessor.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ virtual TPtrC8 DefaultNamespace() = 0;
+
+ /**
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ virtual void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri) = 0;
+
+ /**
+ * Gets all extra namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ * AddNamespaceL() modifications are not visible without
+ * new call of this method.
+ */
+ virtual RPointerArray<MSimpleNamespace>& NamespacesL() = 0;
+
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ virtual void ExternalizeL( RWriteStream& aStream ) = 0;
+
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplemeta.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine presence list meta data
+*
+*/
+
+
+
+
+#ifndef M_simplemeta_H
+#define M_simplemeta_H
+
+#include <e32std.h>
+#include <msimpleelement.h>
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+
+/**
+ * MSimpleMeta
+ *
+ * SIMPLE Engine presence list meta data
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleMeta : public MSimpleElement
+ {
+
+public:
+
+ /**
+ * Meta data namespace accessor.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ virtual TPtrC8 DefaultNamespace() = 0;
+
+ /**
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ virtual void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri) = 0;
+ /**
+ * Gets all extra namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ * AddNamespaceL() modifications are not visible without
+ * new call of this method.
+ */
+ virtual RPointerArray<MSimpleNamespace>& NamespacesL() = 0;
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ virtual void ExternalizeL( RWriteStream& aStream ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplenamespace.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE data name space
+*
+*/
+
+
+
+
+#ifndef M_simplenamespace_H
+#define M_simplenamespace_H
+
+#include <e32std.h>
+
+/**
+ * MSimpleNamespace
+ *
+ * SIMPLE data namespace
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleNamespace
+ {
+
+public:
+
+ /**
+ * Destroy this element entity
+ *
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getter for the URI of the namespace object.
+ * @since S60 3.2
+ * @return The URI
+ */
+ virtual TPtrC8 URI() = 0;
+
+ /**
+ * Getter for the prefix of the namespace object.
+ * @since S60 3.2
+ * @return The prefix
+ */
+ virtual TPtrC8 Prefix() = 0;
+
+ /**
+ * Setter for the URI of the namespace object.
+ * @since S60 3.2
+ * @param aUri The URI.
+ */
+ virtual void SetUriL(const TDesC8& aUri) = 0;
+
+ /**
+ * Setter for the prefix of the namespace object.
+ * @since S60 3.2
+ * @param aPrefix The prefix.
+ */
+ virtual void SetPrefixL(const TDesC8& aPrefix) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplepresencelist.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine presence list
+*
+*/
+
+
+
+
+#ifndef M_simplepresencelist_H
+#define M_simplepresencelist_H
+
+#include <e32std.h>
+#include <msimpledocument.h>
+
+// FORWARD DECLARATION
+
+class MSimpleMeta;
+
+/**
+ * MSimplePresenceList
+ *
+ * SIMPLE Engine presence list
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimplePresenceList
+ {
+
+public:
+
+ /**
+ * Destructor.
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getting the child elements of this element.
+ *
+ * @since S60 3.2
+ * @param aDocuments an array of presence entities. This is an empty array if there
+ * are no entities. OUT.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ */
+ virtual void GetDocuments( RPointerArray<MSimpleDocument>& aDocuments ) = 0;
+
+ /**
+ * Getter for the Metadata document.
+ * @since S60 3.2
+ * @return metadata document. Ownership is not transferred.
+ */
+ virtual MSimpleMeta* MetaData() = 0;
+
+ /**
+ * Getting the sub-lists
+ *
+ * @since S60 3.2
+ * @param aLists array of presence sub lists. OUT.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ */
+ virtual void GetSubLists( RPointerArray<MSimplePresenceList>& aLists ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/inc/msimplewinfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine watcher info data (WINFO)
+*
+*/
+
+
+
+
+#ifndef M_simplewinfo_H
+#define M_simplewinfo_H
+
+#include <e32std.h>
+#include <msimpleelement.h>
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+class RWriteStream;
+
+/**
+ * MSimpleWinfo
+ *
+ * SIMPLE Engine watcher info data (WINFO)
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class MSimpleWinfo : public MSimpleElement
+ {
+
+public:
+
+ /**
+ * WINFO's default namespace accessor.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ virtual TPtrC8 DefaultNamespace() = 0;
+
+ /**
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ virtual void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri) = 0;
+
+ /**
+ * Gets all extra namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ * AddNamespaceL() modifications are not visible without
+ * new call of this method.
+ */
+ virtual RPointerArray<MSimpleNamespace>& NamespacesL() = 0;
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ virtual void ExternalizeL( RWriteStream& aStream ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_documents_api/simple_documents_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<api id="835fdb2c66a4e4765cf209fad8720e2a" dataversion="1.0">
+ <name>SIMPLE Documents API</name>
+ <description>This API is used for creating and receiving documents used in SIP/SIMPLE transactions such as:
+- Presence document for presence publishing and presence notifications,
+- Filter document for filtering the presence subsriptions,
+- Watcher info document for receving wathcer list and
+- RLS document for receving RLS notifications.</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="simpleengine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_instant_msg_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to SIMPLE
+* Instant Message API
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/simpleinstantmessage.h MW_LAYER_PLATFORM_EXPORT_PATH(simpleinstantmessage.h)
+../inc/simpleinstantmsgobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(simpleinstantmsgobserver.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_instant_msg_api/inc/simpleinstantmessage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IM API for Simple Engine
+*
+*/
+
+
+#ifndef M_SIMPLEINSTANTMESSAGE_H
+#define M_SIMPLEINSTANTMESSAGE_H
+
+
+#include <e32std.h>
+
+
+/**
+ * Class for sending instant messages.
+ *
+ * @code
+ * MSimpleInstantMessage* im =
+ * TSimpleFactory::NewInstantMessageL( conn, connObs );
+ * TInt result = im->SendInstantMessage( text8, recipientsPtr8 );
+ * @endcode
+ *
+ * @lib simpleengine.lib
+ * @since S60 v5.1
+ */
+class MSimpleInstantMessage
+ {
+
+public:
+
+ /**
+ * Send instant message.
+ *
+ * @since S60 v5.1
+ * @param aMsgContent message content
+ * @param aRecipient recipient ID
+ * @return Operation ID
+ */
+ virtual TInt SendInstantMessage( TPtrC8 aMsgContent,
+ TPtrC8 aRecipient ) = 0;
+
+ /**
+ * Destroy this entity.
+ *
+ * @since S60 v5.1
+ */
+ virtual void Close() = 0;
+ };
+
+
+#endif // M_SIMPLEINSTANTMESSAGE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_instant_msg_api/inc/simpleinstantmsgobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine instant message callback observer
+*
+*/
+
+#ifndef M_SIMPLEINSTANTMSGOBSERVER_H
+#define M_SIMPLEINSTANTMSGOBSERVER_H
+
+
+#include <e32std.h>
+
+
+/**
+ * MSimpleInstantMsgObserver
+ *
+ * SIMPLE Instant Message callback observer
+ *
+ * @lib simpleengine.lib
+ * @since S60 v5.1
+ */
+class MSimpleInstantMsgObserver
+ {
+
+public:
+
+ /**
+ * Callback for completion of Send Instant Message Request
+ *
+ * @since S60 v5.1
+ * @param aOpid Operation ID
+ * @param aStatus Completion status
+ */
+ virtual void SendInstantMsgReqComplete( TInt aOpid, TInt aStatus ) = 0;
+
+ /**
+ * Callback for handling of received text message
+ *
+ * @since S60 v5.1
+ * @param aFrom Message received from
+ * @param aContent Message content
+ */
+ virtual void HandleReceiveTextMessage( TPtrC8 aFrom,
+ TPtrC8 aContent ) = 0;
+
+ };
+
+
+#endif // M_SIMPLEINSTANTMSGOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_settings_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: SIMPLE Settings API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/simpleenginedomaincrkeys.h MW_LAYER_PLATFORM_EXPORT_PATH(simpleenginedomaincrkeys.h)
+../inc/pressettingsset.h MW_LAYER_PLATFORM_EXPORT_PATH(pressettingsset.h)
+../inc/pressettingsapi.h MW_LAYER_PLATFORM_EXPORT_PATH(pressettingsapi.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_settings_api/inc/pressettingsapi.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PresSettingsAPI deals with the Sets of all
+* presence settings.
+*
+*/
+
+
+
+
+#ifndef __PRESSETTINGSAPI__
+#define __PRESSETTINGSAPI__
+
+//includes
+#include <badesca.h>
+
+#include "simpleenginedomaincrkeys.h"
+#include "pressettingsset.h"
+
+// Forward declarations
+class CRepository;
+
+// FOR INTERNAL USE
+// consts related to hex calc.
+const TInt KLastRow = 0x10000;
+const TUint32 KOnlyRowInfo = 0xFFFFFF00;
+const TInt KOnlyColumnInfo = 0x000000FF;
+const TUint KFullValue = 0xFFFFFFFF;
+const TInt KUnitRow = 0x100;
+const TInt KLastUseableRow = KLastRow - 1;
+
+// FOR CLIENTS
+
+/**
+* The list of configurable Presence Settings
+* If change in future match them with pressetttingsapiprivatecrkeys.h
+**/
+enum TPresSettingsProperty
+ {
+ EPresPropSetID = KSimpleSetId, // int, not for client use
+ EPresStatusOfProps = KSimpleStatusofProps, // Integer
+ EPresPropSetName = KSimpleSetName, // Descriptor
+ EPresPropSIPProfile = KSimpleSipProfile, // Integer
+ EPresPropXDMSet = KSimpleXDMSet, // Integer
+ EPresPropObjectSize = KSimpleClientObjDataLimit, // Integer
+ EPresPropContSrvAdd = KSimpleContentSvrAdd, // Descriptor
+ EPresPropPubInterval = KSimpleSourceThrottlePublish, // Integer
+ EPresPropMaxSubs = KSimpleMaxNbrPresenceSubs, // Integer
+ EPresPropMaxCntInList = KSimpleMaxNbrSubsInList, // Integer
+ EPresPropDomainSyntax = KSimpleServiceUriTemplate, // Descriptor
+ EPresPropProviderID = KSimpleProviderID, // Descriptor
+ EPresPropResrv2, // Resevered 2
+ };
+
+/**
+* These are the open/locked/hidden values for each settings item.
+* Masked in a single integer, each set item takes 2 bits.
+**/
+enum TPresPropStatus
+ {
+ EPresSettingOpened = 0,
+ EPresSettingLocked = 1,
+ EPresSettingHidden = 2
+ };
+
+
+/**
+* This is the class which clients need to use for manipulating presence settings.
+**/
+class PresSettingsApi
+ {
+ public:
+
+ /**
+ * Returns the name of all setting sets stored in the repository.
+ * This function is useful for displaying a list of available sets,
+ * elements of RArray can be used to access each set seperately.
+ * Make sure that CDesCArray* didnt allocated any memory before
+ * this method. Caller may also want to reset aSetIds before
+ * calling this method.
+ *
+ * @param RArray<TInt>& a list of available sets Ids
+ * @return CDesCArray* Names of all settings sets
+ */
+ IMPORT_C static CDesCArray* GetAllSetsNamesLC( RArray<TInt>& aSetIds );
+
+ /**
+ * Creates a new set in the repository. This method may leave if some
+ * system error occur while creating new set.
+ *
+ * @param TPresSettingsSet A Set of properties
+ * @return TInt The ID of the newly created Set
+ */
+ IMPORT_C static TInt CreateSetL(TPresSettingsSet aSet );
+
+ /**
+ * Updats a set in the repository
+ *
+ * @param TPresSettingsSet A Set of properties
+ * TInt aSetId, ID of the Set to be updated
+ * @return error code, KErrNotFound if id not found
+ */
+ IMPORT_C static TInt UpdateSetL(TPresSettingsSet aSet, TInt aSetId );
+
+ /**
+ * Removes a settings Set from the Repository
+ *
+ * @param TInt aSetId, ID of the Set to be removed
+ * @return error code, KErrNotFound if set doesnt found.
+ */
+ IMPORT_C static TInt RemoveSetL( TInt aSetId );
+
+ /**
+ * Updates a single integer property in a settings set.
+ * @param TPresSettingsProperty Name of the property
+ * @param TInt aSetId ID of the target property set
+ * @param TInt aPropValueInt Value of the property
+ * @return error code, KErrNotFound if set doesnt found.
+ */
+ IMPORT_C static TInt UpdatePropertyL( TInt aSetId,
+ TPresSettingsProperty aPropertyName,
+ TInt aPropValueInt
+ );
+
+ /**
+ * Updates a single descriptor property in a settings set.
+ * @param TPresSettingsProperty Name of the property
+ * @param TInt aSetId ID of the target property set
+ * @param TDesC& Value for the property to be created
+ * @return error code, KErrNotFound if set doesnt found.
+ */
+ IMPORT_C static TInt UpdatePropertyL( TInt aSetId,
+ TPresSettingsProperty aPropertyName,
+ const TDesC& aPropValueDes
+ );
+
+ /**
+ * Returns a Pres settings set
+ *
+ * @param TInt aSetID, ID of the property set
+ * TPresSettingsSet& aSet, set returns here as reference
+ * @return error code, KErrNotFound if set doesnt found.
+ */
+ IMPORT_C static TInt SettingsSetL(TInt aSetID,
+ TPresSettingsSet& aSet);
+
+ /**
+ * Returns TPresPropStatus for a given property from the given integer.
+ * Use aPropertyName=EPresStatusOfProps to get the status of a set as a whole
+ *
+ * @param TInt aStatusOfProps, integer to decode from
+ * TPresSettingsProperty Name of the property
+ * @return TPresPropStatus for the given property
+ */
+ IMPORT_C static TPresPropStatus DecodePropertyStatus(TInt aStatusOfProps,
+ TPresSettingsProperty aPropertyName);
+
+ /**
+ * Encodes the given TPresPropStatus to the given integer.
+ * Use aPropertyName=EPresStatusOfProps to set the status of a set as a whole
+ *
+ * @param TInt aStatusOfProps, reference integer to be encoded
+ * TPresPropStatus status to be encoded to given integer
+ * TPresSettingsProperty Name of the property
+ * @return none
+ */
+ IMPORT_C static void EncodePropertyStatus(TInt& aStatusOfProps,
+ TPresPropStatus aPropertyStatus,
+ TPresSettingsProperty aPropertyName);
+
+ /**
+ * Find whether the given property is descriptor or not
+ *
+ * @param TPresSettingsProperty aProperty a settings property
+ * @return TBool, ETrue if its an string
+ */
+ IMPORT_C static TBool IsStr( TPresSettingsProperty aProperty );
+
+ private:
+
+ /**
+ * Create a unique ID for a set
+ *
+ * @param CRepository* An opened repository
+ * @param TUint32 aRowInHex, a fresh row
+ * @return TInt created unique ID
+ */
+ static TInt CreateUniqueIdL( CRepository* aRepository, TUint32 aRowInHex );
+
+ /**
+ * Get a fresh (empty) row, which is used for creating a new set
+ *
+ * @param CRepository* An opened repository
+ * @return TUint32 aRowInHex, a fresh row
+ */
+ static TUint32 GetFreshRawInHex( CRepository* aRepository );
+
+ /**
+ * Find the row having given set ID
+ *
+ * @param CRepository* An opened repository
+ * TInt aSetID, ID of the property set
+ * @return TUint32, the row in case found, otherwise this is error code (-ve)
+ */
+ static TUint32 GetRawInHexL( CRepository* aRepository, TInt aSetID );
+
+ };
+
+#endif //__PRESSETTINGSAPI__
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_settings_api/inc/pressettingsset.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class represents the data of a presence settings set.
+* PresSettingsAPI deals with the Sets of all
+* presence settings.
+*
+*/
+
+
+
+
+#ifndef __PRESSETTINGSSET__
+#define __PRESSETTINGSSET__
+
+//includes
+#include <simpleenginedomaincrkeys.h>
+
+// FOR INTERNAL USE
+// constants
+const TInt KPresSetNameMaxLength = 100;
+const TInt KContentSrvrAddMaxLength = 255;
+const TInt KPresDomainSyntxMaxLength = 255;
+const TInt KPresProviderIDMaxLength = 255;
+const TInt KPresNormalListLength = 10;
+
+const TInt KPresIntInit = 0;
+_LIT( KPresStrInit, "None");
+
+/**
+* This is the class representing a settings set data.
+**/
+class TPresSettingsSet
+ {
+ public:
+
+ /**
+ * C++ constructor
+ *
+ * @param none
+ * @return none
+ */
+ IMPORT_C TPresSettingsSet();
+
+ public: // data
+
+ /**
+ * Data members representing a settings set.
+ */
+ TBuf<KPresSetNameMaxLength> iSetName;
+ TInt iSipProfile;
+ TInt iXDMSetting;
+ TInt iObjectSize;
+ TBuf<KContentSrvrAddMaxLength> iContSrvrAdd;
+ TInt iStatusOfProps;
+ TInt iPublicationInt;
+ TInt iMaxSubscriptions;
+ TInt iMaxContactsInList;
+ TBuf<KPresDomainSyntxMaxLength> iDomainSyntax;
+ TBuf<KPresProviderIDMaxLength> iProviderID;
+
+ };
+
+#endif //__PRESSETTINGSSET__
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_settings_api/inc/simpleenginedomaincrkeys.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine CenRep keys
+*
+*/
+
+
+
+#ifndef SIMPLEENGINEDOMAINCRKEYS_H
+#define SIMPLEENGINEDOMAINCRKEYS_H
+
+#include <e32base.h>
+
+const TUid KCRUIDSimpleOTA = {0x10281EEE};
+
+// SIMPLEEngine OMA Presence Client Provisioning
+
+// APPID
+const TUint32 KSimpleAppID = 0x00000001;
+
+// PROVIDER-ID
+const TUint32 KSimpleProviderID = 0x00000002;
+
+// ToConRef (SIP profile id)
+const TUint32 KSimpleSipProfile = 0x00000003;
+
+// NAME
+const TUint32 KSimpleSetName = 0x00000004;
+
+// Identifies a set in Presence Settings UI
+const TUint32 KSimpleSetId = 0x00000005;
+
+// XDM set id
+const TUint32 KSimpleXDMSet = 0x00000006;
+
+// Content Server address
+const TUint32 KSimpleContentSvrAdd = 0x00000007;
+
+// BitMasked status of each property
+const TUint32 KSimpleStatusofProps = 0x00000008;
+
+// CLIENT-OBJ-DATA-LIMIT
+const TUint32 KSimpleClientObjDataLimit = 0x0000000A;
+
+// SOURCE-THROTTLE-PUBLISH
+const TUint32 KSimpleSourceThrottlePublish = 0x0000000B;
+
+// MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS
+const TUint32 KSimpleMaxNbrPresenceSubs = 0x0000000C;
+
+// MAX-NUMBER-OF-SUBSCRIPTIONS-IN-PRESENCE-LIST
+const TUint32 KSimpleMaxNbrSubsInList = 0x0000000D;
+
+// SERVICE-URI-TEMPLATE
+const TUint32 KSimpleServiceUriTemplate = 0x0000000E;
+
+
+#endif // SIMPLEENGINEDOMAINCRKEYS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/simple_settings_api/simple_settings_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="ccfc5f6cbedd2e8d6f0ec39854a3e7c3" dataversion="1.0">
+ <name>SIMPLE Settings API</name>
+ <description>This API is used for managing SIP/SIMPLE settings in Central Repository.</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="presencesettingsapi.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Watcher API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msimplewatcher.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplewatcher.h)
+../inc/msimplewatcherobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplewatcherobserver.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_api/inc/msimplewatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine presence watcher
+*
+*/
+
+
+
+
+#ifndef M_simplewatcher_H
+#define M_simplewatcher_H
+
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class MSimpleConnection;
+class MSimpleFilterDocument;
+
+/**
+ * MSimpleWatcher
+ *
+ * SIMPLE Engine presence watcher
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimpleWatcher
+ {
+
+public:
+
+ /** SIP subscription-state */
+ enum TSimpleSipSubscriptionState
+ {
+ // subscription not complete
+ ESimpleStateNone=0,
+ // subscription is in pending state
+ ESimpleStatePending,
+ // subscription is in active state
+ ESimpleStateActive,
+ // subscription is terminated, either by server or by client.
+ ESimpleStateTerminated
+ };
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getter for the SIMPLE Engine connection.
+ *
+ * @since S60 3.2
+ * @return connection
+ */
+ virtual const MSimpleConnection& Connection() = 0;
+
+ /**
+ * Subscribe presence entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Leaves with KErrInUse if there is already active subscription
+ * in this MSimpleWatcher entity.
+ *
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aRefresh whether refresh is made automatically
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ virtual TInt SubscribeL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous ) = 0;
+
+ /**
+ * Subscribe presence list.
+ * Expiry time is set based on SIMPLE settings.
+ * Leaves with KErrInUse if there is already active subscription
+ * in this MSimpleWatcher entity.
+ *
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aRefresh whether refresh is made automatically
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ virtual TInt SubscribeListL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous ) = 0;
+
+ /**
+ * Get presence data
+ * Leaves with KErrInUse if there is already active subscription
+ * in this MSimpleWatcher entity.
+ *
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ virtual TInt GetPresenceL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aAnonymous ) = 0;
+
+ /**
+ * Unsubscribe.
+ * Leaves with KErrNotFound if there is no active subscription.
+ *
+ * @since S60 3.2
+ * @return operation id
+ */
+ virtual TInt UnsubscribeL( ) = 0;
+
+ /**
+ * SIP Status code accessor.
+ * Get the status of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ virtual TUint SIPStatus() = 0;
+
+ /**
+ * SIP Retry-after header value accessor.
+ * Get the SIP retry-fater header value of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return retry-after value in seconds, 0 if not available
+ */
+ virtual TUint SIPRetryAfter() = 0;
+
+ /**
+ * SIP Subscription-state header value accessor.
+ * Get the SIP Subscription-state header value of the last NOTIFY message or
+ * ESimpleStateTerminated when the subscription is terminated by a client.
+ * Refer to RFC3265
+ *
+ * @since S60 3.2
+ * @return subscription state
+ */
+ virtual TSimpleSipSubscriptionState SipSubscriptionState() = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_api/inc/msimplewatcherobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine watcher callback observer
+*
+*/
+
+
+
+
+#ifndef M_simplewatcherobserver_H
+#define M_simplewatcherobserver_H
+
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class MSimpleConnection;
+class MSimplePresenceList;
+class MSimpleDocument;
+
+/**
+ * MSimpleWatcher
+ *
+ * SIMPLE Engine watcher callback observer
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimpleWatcherObserver
+ {
+
+public:
+
+ /**
+ * Watcher request completion.
+ *
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus completion status.
+ */
+ virtual void WatcherReqCompleteL( TInt aOpId, TInt aStatus ) = 0;
+
+ /**
+ * Watcher notification callback.
+ *
+ * @since S60 3.2
+ * @param aDocument presence entity data
+ */
+ virtual void WatcherNotificationL( MSimpleDocument& aDocument ) = 0;
+
+ /**
+ * Watcher presence list notification callback.
+ *
+ * @since S60 3.2
+ * @param aList presence list
+ */
+ virtual void WatcherListNotificationL( MSimplePresenceList& aList ) = 0;
+
+ /**
+ * Watcher request terminated
+ *
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aReason termination reason. Refer to simpleerrors.h
+ */
+ virtual void WatcherTerminatedL(
+ TInt aOpId, TInt aReason ) = 0;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_api/watcher_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<api id="2c7cef96c089c53501b75e7acd652582" dataversion="1.0">
+ <name>Watcher API</name>
+ <description>API for presence subscription handling. It supports the following functions:
+- subscribing for individual contacts and presence lists
+- terminating subscriptions
+- subscription filter creation
+- notifications functions for arriving presence updates</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="simpleengine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_info_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: Watcher info API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/msimplewinfoobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplewinfoobserver.h)
+../inc/msimplewinfowatcher.h MW_LAYER_PLATFORM_EXPORT_PATH(msimplewinfowatcher.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_info_api/inc/msimplewinfoobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE watcher info callback observer
+*
+*/
+
+
+
+
+#ifndef M_simplewinfoobserver_H
+#define M_simplewinfoobserver_H
+
+#include <e32std.h>
+
+
+// FORWARD DECLARATION
+class MSimpleWinfo;
+
+/**
+ * MSimpleWinfoObserver
+ *
+ * SIMPLE watcher info (WINFO) callback observer
+ *
+ * @lib simpleengine
+ * @since S60 v3.2
+ */
+
+class MSimpleWinfoObserver
+ {
+public:
+
+ /**
+ * Callback for WINFO request completion
+ * @since S60 3.2
+ * @param aOpid operation id
+ * @param aStatus completion status.
+ */
+ virtual void WinfoReqCompleteL( TInt aOpid, TInt aStatus ) = 0;
+
+ /**
+ * Callback for WINFO termination
+ * @since S60 3.2
+ * @param aOpid operation id
+ * @param aReason termination reason. Refer to simpleerrors.h
+ */
+ virtual void WinfoTerminatedL(
+ TInt aOpid, TInt aReason ) = 0;
+
+ /**
+ * Callback for WINFO notification
+ * @since S60 3.2
+ * @param aWinfo WINFO
+ */
+ virtual void WinfoNotificationL(
+ MSimpleWinfo& aWinfo ) = 0;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_info_api/inc/msimplewinfowatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine watcher info subscriber
+*
+*/
+
+
+
+
+#ifndef M_simplewinfowatcher_H
+#define M_simplewinfowatcher_H
+
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class MSimpleFilterDocument;
+class MSimpleWinfo;
+
+/**
+ * MSimpleWinfoWatcher
+ *
+ * SIMPLE Engine watcher info subscriber
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class MSimpleWinfoWatcher
+ {
+
+public:
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ virtual void Close() = 0;
+
+ /**
+ * Getter for the SIMPLE engine connection.
+ *
+ * @since S60 3.2
+ * @return the connection.
+ */
+ virtual const MSimpleConnection& Connection() = 0;
+
+ /**
+ * Subscribe watcher info.
+ *
+ * @since S60 3.2
+ * @param aFilter filter data, may be null and then you'll get all
+ * the changes in WINFO.
+ * @return operation id
+ */
+ virtual TInt SubscribeWatcherListL( MSimpleFilterDocument* aFilter ) = 0;
+
+ /**
+ * Unsubscribe.
+ * Leaves with KErrNotFound if there is no active subscription.
+ *
+ * @since S60 3.2
+ * @return operation id
+ */
+ virtual TInt UnsubscribeL( ) = 0;
+
+ /**
+ * SIP Status code accessor.
+ * Get the status of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ virtual TUint SIPStatus() = 0;
+
+ /**
+ * SIP Retry-after header value accessor.
+ * Get the SIP retry-fater header value of the last completed request.
+ * Refer to RFC3261, RFC3265, RFC3903.
+ *
+ * @since S60 3.2
+ * @return retry-after value in seconds, 0 if not available
+ */
+ virtual TUint SIPRetryAfter() = 0;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/watcher_info_api/watcher_info_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<api id="60a22d1fdbdb394a908191b4e9c00bea" dataversion="1.0">
+ <name>Watcher info API</name>
+ <description>This API is used for managing the watcher list subscriptions by:
+- creating the presence watcher list subscription
+- creating filters for the subscription
+- terminating watcher list subscriptions
+- notifications about watcher list changes</description>
+ <type>c++</type>
+ <subsystem>simpleengine</subsystem>
+ <libs>
+ <lib name="simpleengine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: XDM API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/XdmErrors.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmErrors.h)
+../inc/XdmDirectory.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmDirectory.h)
+../inc/XdmProtocolInfo.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmProtocolInfo.h)
+../inc/XdmCredentials.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmCredentials.h)
+../inc/XdmDocument.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmDocument.h)
+../inc/XdmDocumentNode.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmDocumentNode.h)
+../inc/XdmProtocolUidList.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmProtocolUidList.h)
+../inc/XdmEngine.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmEngine.h)
+../inc/XdmNamespaceContainer.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmNamespaceContainer.h)
+../inc/XdmNodeAttribute.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmNodeAttribute.h)
+../inc/XdmNodeInterface.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmNodeInterface.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmCredentials.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM credentials
+*
+*/
+
+
+
+
+#ifndef __XDMCREDENTIALS__
+#define __XDMCREDENTIALS__
+
+#include <e32base.h>
+
+const TInt KXdmMaxUserNameLength = 256;
+const TInt KXdmMaxPasswordLength = 256;
+
+//CLASS DECLARATION
+class TXdmCredentials
+ {
+ public:
+
+ /**
+ * C++ Defualt Constructor
+ */
+ IMPORT_C TXdmCredentials();
+
+ /**
+ * Constructor with parameters
+ * @param TDesC& Username
+ * @param TDesC& Password
+ */
+ IMPORT_C TXdmCredentials( const TDesC& aUserName,
+ const TDesC& aPassword );
+
+ public: //Data
+
+ TBuf8<KXdmMaxUserNameLength> iUserName;
+ TBuf8<KXdmMaxPasswordLength> iPassword;
+ };
+
+#endif //__XDMCREDENTIALS__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmDirectory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM directory
+*
+*/
+
+
+
+
+#ifndef __XDMDIRECTORY__
+#define __XDMDIRECTORY__
+
+#include <e32base.h>
+#include <XdmDocument.h>
+
+enum TDirUpdatePhase
+ {
+ EDirPhaseIdle = 0,
+ EUpdateDocumentList,
+ ERefreshDocuments
+ };
+
+//FORWARD DECLARATION
+class CXdmEngine;
+class CXdmDocumentNode;
+class CXdmOperationFactory;
+
+class CXdmDirectory : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CXdmDirectory();
+
+ public: //The abstract directory API
+
+ /**
+ * Return the number of documents in this directory
+ * @return TInt Number of documents
+ */
+ virtual TInt DocumentCount() = 0;
+
+ /**
+ * Return the name of the specified document
+ * @param TInt Index of the desired document
+ * @return TPtrC Name of the specified document
+ */
+ virtual TPtrC Document( TInt aIndex ) const = 0;
+
+ /**
+ * Returns the path to this directory
+ * @return TPtrC8 The path to the directory this object models
+ */
+ virtual TPtrC DirectoryPath() const = 0;
+
+ /*
+ * Return the type of the specified document
+ * @param TInt Index of the desired document
+ * @return TXdmDocType Type of the document
+ */
+ virtual TXdmDocType DocumentTypeL( TInt aIndex ) const = 0;
+
+ protected:
+
+ /**
+ * By default Symbian OS constructor is private.
+ * @param TDesC& The directory path
+ * @return void
+ */
+ IMPORT_C void BaseConstructL( const TDesC& aDirectoryPath );
+
+ /**
+ * C++ constructor is protected.
+ */
+ IMPORT_C CXdmDirectory( CXdmEngine& aXdmEngine );
+
+ private: //Methods which need to be accessible from the CXdmEngine
+ //but NOT from the client application => friend class
+
+ /**
+ * Start updating the contents of this directory model
+ * @param TRequestStatus& Request status of the client
+ * @param TDirUpdatePhase Phase of the update
+ * @return void
+ */
+ virtual void StartUpdateL() = 0;
+
+ /**
+ * Cancel a directory update
+ * @return void
+ */
+ virtual void CancelUpdate() = 0;
+
+ /**
+ * Save the client's request status and update status
+ * @param TDirUpdatePhase The update phase
+ * @param TRequestStatus The client's request status
+ * @return void
+ */
+ virtual void SaveRequestData( TDirUpdatePhase aUpdatePhase,
+ TRequestStatus& aClientStatus ) = 0;
+
+ protected:
+
+ TInt iFileCount;
+ HBufC* iDirectoryPath;
+ CXdmEngine& iXdmEngine;
+ TDirUpdatePhase iUpdatePhase;
+ friend class CXdmEngine;
+ };
+
+#endif //__XDMDIRECTORY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmDocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,538 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Document
+*
+*/
+
+
+
+
+#ifndef __XDMDOCUMENT__
+#define __XDMDOCUMENT__
+
+#include <e32cmn.h>
+#include <e32base.h>
+#include <XdmNamespaceContainer.h>
+
+//The supported document types = application usages
+enum TXdmDocType
+ {
+ EXdmDocGeneral = 0,
+ EXdmTestDocType,
+ EXdmPoCGroup,
+ EXdmPoCUserAccessPolicy,
+ EXdmDirectory,
+ EXdmCapabilities,
+ EXdmSharedXdm,
+ EXdmRlsServices,
+ EXdmResourceLists,
+ EXdmIetfCommonPolicy,
+ EXdmOmaCommonPolicy,
+ EXdmIetfPresenceRules,
+ EXdmOmaPresenceRules,
+ EXdmPresContent,
+ EXdmPresContentNSN
+ };
+
+//Helper class for searching documents; 16-bit
+struct SXdmAttribute16
+ {
+ TPtrC iName;
+ TPtrC iValue;
+ };
+
+//Helper class for searching documents; 8-bit
+struct SXdmAttribute8
+ {
+ TPtrC8 iName;
+ TPtrC8 iValue;
+ };
+
+//Constants
+const TInt KXdmPathSeparatorChar = 47;
+
+//Forward declarations
+class CXdmEngine;
+class MXdmOperation;
+class CXdmDocumentNode;
+class CXdmNodeAttribute;
+class CXdmOperationFactory;
+
+// CLASS DECLARATION
+class CXdmDocument : public CActive,
+ public MXdmNamespaceContainer
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns the name of this document
+ * @return TPtrC The name of the document this object models
+ */
+ IMPORT_C TPtrC Name() const;
+
+ /**
+ * Fetch data from the document this object models beginning from the
+ * element the parameter points to. If the parameter is not specified,
+ * the operation applies to the whole of the document.
+ *
+ * @param CXdmDocumentNode* The element (including its descendants) to fetch.
+ * @return void
+ */
+ IMPORT_C void FetchDataL( CXdmDocumentNode* aDocNode = NULL );
+
+ /**
+ * Replace the document this object models
+ *
+ * NOTE: The name of the document MUST remain the same. This is because
+ * the operation first needs to delete the old document and then
+ * store the new one. The risk of creating conflicting document
+ * names is far too great in case this rule is not imposed.
+ *
+ * @return void
+ */
+ IMPORT_C void ReplaceL();
+
+ /**
+ * Replace a named element in the document this object models
+ *
+ * NOTE: Both elements MUST have a common parent element,
+ * which, in effect, must be the element this document
+ * model points to. Also note that the operation will
+ * fail in case the "aOldNode" does not exist in the document.
+ *
+ * @param CXdmDocumentNode* The element to replace
+ * @param CXdmDocumentNode* The replacing element
+ * @return void
+ */
+ IMPORT_C void ReplaceL( CXdmDocumentNode* aOldNode,
+ CXdmDocumentNode* aNewNode );
+
+ /**
+ * Insert the node identified by the parameter. Note that this
+ * method cannot be applied to complete documents. Thus the method
+ * will fail in case the parameter is NULL. If the client needs
+ * to a) add b) replace a document, it needs to do this through
+ * the AppendL() or the ReplaceL() method.
+ *
+ * NOTE: The operation will fail in case the element identified
+ * by the aDocNode parameter already exists in the document.
+ * XDM Engine does not make assumptions in this regard; it
+ * does not, for instance, change some aspects of the
+ * request in order to turn it into a valid insert operation.
+ * Instead, it will re-read the whole document and retry the
+ * insert operation. If the operation still fails, the engine
+ * reports the failure that occurred while performing the
+ * operation. In the latter case, the client can get a hold
+ * of the error report document, provided that the used
+ * protocol supports the feature and that the server included
+ * the document in the response, by fetching the root node of
+ * the error document through ErrorRoot() method.
+ *
+ * @param CXdmDocumentNode* The element (including its descendants) to insert
+ * @return void
+ */
+ IMPORT_C void InsertL( CXdmDocumentNode* aDocNode );
+
+ /**
+ * Append data to the document this object models beginning from the
+ * element the parameter points to. If the parameter is not specified,
+ * the operation applies to the whole of the document.
+ *
+ * NOTE: This is a "blind insert"; no guarantees can be given
+ * as to the success or failure of the operation, since
+ * it includes no checking for existence of the resource
+ * that is to be appended/inserted. It is also worth noticing
+ * that this method may effectively turn into a replace
+ * operation in case the method is invoked on a document that
+ * already exists in the storage endpoint.
+ *
+ * @param CXdmDocumentNode* The element (including its descendants) to append.
+ * @return void
+ */
+ IMPORT_C void AppendL( CXdmDocumentNode* aDocNode = NULL );
+
+ /**
+ * Delete data from the document this object models beginning from the
+ * element the parameter points to. If the parameter is not specified,
+ * the operation applies to the whole of the document.
+ *
+ * @param CXdmDocumentNode* The element (including its descendants) to delete.
+ * @return void
+ */
+ IMPORT_C void DeleteDataL( CXdmDocumentNode* aDocNode = NULL );
+
+ /**
+ * Search for nodes which match the specified name & attributes
+ *
+ * @param CXdmDocumentNode& The node to search for
+ * @param RPointerArray& On completion, contains the nodes
+ * that were found, if any.
+ * @return TInt KErrNotFound if no matching nodes are found.
+ * Otherwise indicates the number of nodes found
+ */
+ IMPORT_C TInt Find( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified name & attributes
+ *
+ * @param TDesC& The name of the node to search for
+ * @param RPointerArray& On completion, contains the nodes
+ * that were found, if any.
+ * @return TInt KErrNotFound if no matching nodes are found.
+ * Otherwise indicates the number of nodes found
+ */
+ IMPORT_C TInt Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for attributes which match the specified name
+ *
+ * @param TDesC& The name of the attribute to search for
+ * @param RPointerArray& On completion, contains the nodes
+ * that were found, if any.
+ * @return TInt KErrNotFound if no matching nodes are found.
+ * Otherwise indicates the number of nodes found
+ */
+ IMPORT_C TInt Find( const TDesC& aAttributeName,
+ RPointerArray<CXdmNodeAttribute>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified name & attributes
+ *
+ * @param TDesC& The name of the node to search for
+ * @param RPointerArray& On completion, contains the nodes
+ * that were found, if any.
+ * @param RPointerArray& The attribute names & values that a
+ matching node must have.
+ * @return TInt KErrNotFound if no matching nodes are found.
+ * Otherwise indicates the number of nodes found
+ */
+ IMPORT_C TInt Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray ) const;
+
+ /**
+ * Comparison operator
+ *
+ * @param CXdmDocument& The document to compare to
+ * @return TBool Are the contents of the two identical
+ */
+ IMPORT_C TBool operator==( CXdmDocument& aDocument ) const;
+
+ /**
+ * Remove an element from the document model
+ *
+ * NOTE: This method cannot be used with document models that
+ * only target a fragment of the document; in practise
+ * this means that if the client has constructed a node
+ * using DocumentSubsetL(), this method leaves with KErrGeneral.
+ * A document subset cannot be treated as an actual document
+ * since only a fraction of the elements and their dependencies
+ * in the document is known. The client must have the whole
+ * document at its disposal in order to be properly able to
+ * make use of this method.
+ *
+ * @param CXdmDocumentNode* The node to be removed
+ * @return void
+ */
+ IMPORT_C void RemoveFromModelL( CXdmDocumentNode* aChileNode );
+
+ /**
+ * Append an element to the document model
+ *
+ * NOTE: This method cannot be used with document models that
+ * only target a fragment of the document; in practise
+ * this means that if the client has constructed a node
+ * using DocumentSubsetL(), this method leaves with KErrGeneral.
+ * A document subset cannot be treated as an actual document
+ * since only a fraction of the elements and their dependencies
+ * in the document is known. The client must have the whole
+ * document at its disposal in order to be properly able to
+ * make use of this method.
+ *
+ * @param The next node in the list
+ * @return void
+ */
+ IMPORT_C void AppendToModelL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Replace an element in the document model
+ *
+ * NOTE: This method cannot be used with document models that
+ * only target a fragment of the document; in practise
+ * this means that if the client has constructed a node
+ * using DocumentSubsetL(), this method leaves with KErrGeneral.
+ * A document subset cannot be treated as an actual document
+ * since only a fraction of the elements and their dependencies
+ * in the document is known. The client must have the whole
+ * document at its disposal in order to be properly able to
+ * make use of this method.
+ *
+ * @param CXdmDocumentNode The new node
+ * @param CXdmDocumentNode The old (target) node
+ * @return void
+ */
+ IMPORT_C void ReplaceInModelL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode );
+
+ /**
+ * Return a subset of the document this object models.
+ * For instance, if the whole (physical) document is
+ * the following:
+ *
+ * <root>
+ * <element1>
+ * <child1>
+ * <leaf1>Foo</leaf1>
+ * </child1>
+ * </element1>
+ * </root>
+ *
+ * calling this method with the parameter "root/element1/child1"
+ * would make this document model model the subset
+ *
+ * <child1>
+ * <leaf1>Foo</leaf1>
+ * </child1>
+ *
+ * It is important to understand that, after calling this method,
+ * the document model only models the document starting from the
+ * node the method returns. The client may traverse the document
+ * all the way to the root node and back, but the way from the root
+ * node to the node this method returns should be regarded merely
+ * as a "path" of elements that has no real content.
+ *
+ * A prime use case for this method is one in which the structure
+ * of the document the client application wants to operate on is
+ * well-known; a typical example would be an XDM directory document.
+ * The schema for this application usage is very simple: the root
+ * element is <xcap-directory> that has a collection of <folder>
+ * elements as its children. Each <folder> element has a mandatory
+ * "auid" parameter that identifies the type of documents that
+ * particular folder contains. Therefore, a client application has
+ * all the necessary information it needs to have in order to be
+ * able to carry out a fetch for a document subset (one folder):
+ *
+ * _LIT( KNodePath, "xcap-directory/folder" );
+ * CXdmDocumentNode* node = iDirectoryDoc->DocumentSubsetL( KNodePath );
+ * CleanupStack::PushL( node );
+ * CXdmNodeAttribute* auid = node->CreateAttributeL( _L( "auid" ) );
+ * CleanupStack::PushL( auid );
+ * auid->SetAttributeValueL( _L( "My document type" ) );
+ * iDirectoryDoc->FetchDataL( node );
+ * CleanupStack::Pop( 2 ); //auid, node
+ *
+ * In this particular case, even after the fetch operation is
+ * complete, the <xcap-directory> element in this document model
+ * would not be a real element, a genuine part of the document, but,
+ * rather, a "virtual" node on the way to the element that is of
+ * real interest to the client application.
+ *
+ * Also note that the instance of CXdmDocument on which this subset
+ * has been created, cannot be used as a container for a whole
+ * document until ResetSubset() has been called.
+ *
+ * The incoming parameter MUST separate each step to the
+ * target element with a slash character ('/').
+ *
+ * @param TDesC8& The path to the target element
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* DocumentSubsetL( const TDesC& aNodePath );
+
+ /*
+ * Reset the document subset.
+ *
+ * See the comments to DocumentSubsetL method for details.
+ * @return void
+ */
+ IMPORT_C virtual void ResetSubset();
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CXdmDocument();
+
+ public: // New functions
+
+ /**
+ * Return the type of this document
+ *
+ * @return TXdmDocType The type of the document
+ */
+ virtual TXdmDocType DocumentType() const = 0;
+
+ /**
+ * Construct an "anonymous" entry point for this document.
+ * This node effectively becomes the root of this document.
+ *
+ * @return CXdmDocumentNode* Document root
+ */
+ virtual CXdmDocumentNode* CreateRootL() = 0;
+
+ /**
+ * Return the root element of this document
+ *
+ * NOTE: The returning node may or may not contain any data,
+ * since, in the case that this document model does not
+ * have content yet, the element is a simple "entry point"
+ * to the whole document. Thus, for instance, if the client
+ * application requests the XDM Engine to fetch a particular
+ * document, the root element points to nothing until the
+ * request has been completed.
+ *
+ * Also note that in case the client has created a document
+ * subset using the DocumentSubsetL() method, this method
+ * will return NULL, since the document is not traversable
+ * from the root; it, by definition, represents only a subset
+ * of this document. In case of a document subset, the path from
+ * the root node to the target node should be considered a simple
+ * linked list that does not necessarily contain all children
+ * for any of the nodes in between.
+ *
+ * @return CXdmDocumentNode* The root element of the document
+ */
+ virtual CXdmDocumentNode* DocumentRoot() const = 0;
+
+ /*
+ * Reset the contents of this document model.
+ *
+ * This method comes into play when client wants to reuse an instance
+ * of this class for, for instance, construction of different content.
+ * Other properties, such as name and the type of the document
+ * do not change.
+ *
+ * @return void
+ */
+ virtual void ResetContents() = 0;
+
+ /**
+ * Return the currently last node in the path.
+ * NOTE: Only works with document subsets!
+ *
+ * @return CXdmDocumentNode*
+ */
+ virtual CXdmDocumentNode* CurrentExtent() const = 0;
+
+ /**
+ * Return the time stamp for this document
+ *
+ * @return TTime Time stamp
+ */
+ virtual TTime TimeStamp() const = 0;
+
+ /**
+ * Return an error document for a failed update
+ *
+ * NOTE: The returning object will be zero in case
+ * the used protocol does not support this feature.
+ *
+ * @return CXdmDocument* The error document
+ */
+ virtual CXdmDocumentNode* ErrorRoot() = 0;
+
+ protected:
+
+ /**
+ * Append an element to the path identifying the
+ * the current document subset
+ *
+ * @param TDesC& The path part to append
+ * @return void
+ */
+ virtual void AppendPathPartL( const TDesC& aString ) = 0;
+
+ private:
+
+ /**
+ * Empty the operation queue
+ */
+ void EmptyOperationQueue();
+
+ /**
+ * Find attributes by name
+ *
+ * @param CXdmDocumentNode* The node to search from
+ * @param TDesC& The name of the attributes to search for
+ * @param RPointerArray& On completion, contains the results
+ * @return TInt The number of attributes found
+ */
+ TInt DoFindAttributes( CXdmDocumentNode* aNode,
+ const TDesC& aAttributeName,
+ RPointerArray<CXdmNodeAttribute>& aResultArray ) const;
+
+ private: //Methods which need to be accessible from the CXdmEngine
+ //but NOT from the client application => friend class
+
+ /**
+ * Start updating the document
+ * @param TRequestStatus& The status of the request
+ * @return void
+ */
+ virtual void StartUpdateL() = 0;
+
+ /**
+ * Cancel a document update
+ * @param TRequestStatus& The status of the request
+ * @return void
+ */
+ virtual void CancelUpdate() = 0;
+
+ /**
+ * Save the client's request status
+ * @param TRequestStatus& The status of the request
+ * @return void
+ */
+ virtual void SaveClientStatus( TRequestStatus& aClientStatus ) = 0;
+
+ protected:
+
+ /**
+ * By default Symbian OS constructor is private.
+ * @return void
+ */
+ IMPORT_C void BaseConstructL( TInt aOperationFactoryUid,
+ const TDesC& aDocumentName );
+
+ /**
+ * By default Symbian OS constructor is private.
+ * @return void
+ */
+ IMPORT_C void BaseConstructL( TInt aOperationFactoryUid,
+ const TDesC8& aDocumentName );
+
+ /**
+ * C++ constructor is private.
+ */
+ IMPORT_C CXdmDocument( CXdmEngine& aXdmEngine );
+
+ protected: //Data
+
+ TBool iDocSubset;
+ HBufC* iDocumentName;
+ TRequestStatus* iClientStatus;
+ TTime iTimeStamp;
+ CXdmEngine& iXdmEngine;
+ friend class CXdmEngine;
+ RPointerArray<MXdmOperation> iChangeRequests;
+ CXdmOperationFactory* iOperationFactory;
+
+ private: // Data
+ };
+
+#endif //__XDMDOCUMENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmDocumentNode.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM document node
+*
+*/
+
+
+
+
+#ifndef __XDMDOCUMENTNODE__
+#define __XDMDOCUMENTNODE__
+
+#include <e32base.h>
+#include "XdmNodeInterface.h"
+
+enum TXdmElementType
+ {
+ EXdmElementNode = 0,
+ EXdmElementAttribute,
+ EXdmElementUnspecified
+ };
+
+class CXdmEngine;
+struct SXdmAttribute8;
+struct SXdmAttribute16;
+class MXdmNodeFactory;
+class CXdmNodeAttribute;
+class CXdmOperationFactory;
+
+//CLASS DECLARATION
+class CXdmDocumentNode : public CBase, public MXdmNodeInterface
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Create a new child element
+ *
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* CreateChileNodeL();
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* CreateChileNodeL( const TDesC& aChildName );
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ IMPORT_C CXdmNodeAttribute* CreateAttributeL();
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ IMPORT_C CXdmNodeAttribute* CreateAttributeL( const TDesC& aAttributeName );
+
+ /**
+ * Set the contents of a leaf node. Fails if this element
+ * is not a leaf element.
+ *
+ * <leaf>leafnodecontent</leaf>
+ *
+ *
+ * @param TDesC8& Content of the leaf element
+ * @return void
+ */
+ IMPORT_C void SetLeafNodeContentL( const TDesC& aLeafContent );
+
+ /**
+ * Set the contents of a leaf node. Fails if this element
+ * is not a leaf element.
+ *
+ * <leaf>leafnodecontent</leaf>
+ *
+ *
+ * @param TDesC8& Content of the leaf element
+ * @return void
+ */
+ IMPORT_C void SetLeafNodeContentL( const TDesC8& aLeafContent );
+
+ /**
+ * Define this node to be a leaf node. Default value is EFalse,
+ * so this method only needs to be called when the client wants to
+ * define a node a leaf node. The operation can, of course, be
+ * reverted if needed.
+ *
+ * @param TBool Define/undefine this node to be a leaf node
+ * @return void
+ */
+ IMPORT_C void SetLeafNode( TBool aIsLeafNode );
+
+ /**
+ * Define this node to be empty. Default value is EFalse,
+ * so this method only needs to be called when the client wants
+ * to indicate that a node does not/will not have children.
+ * The operation can be reverted if needed.
+ *
+ * NOTE: An attempt to create children on an empty node will
+ * result in a panic being raised. Respectively, if a
+ * client application wants to revert the state of a
+ * node from non-empty to empty, all children that may
+ * have been created will be removed.
+ *
+ * @param TBool Define/undefine this node to be empty
+ * @return void
+ */
+ IMPORT_C void SetEmptyNode( TBool aIsEmptyNode );
+
+ /**
+ * Report whether or not this is a leaf element
+ * @return TBool Is this a leaf element
+ */
+ IMPORT_C TBool IsLeafNode() const;
+
+ /**
+ * Report whether or not this element is empty
+ * @return TBool Is this an empty element
+ */
+ IMPORT_C TBool IsEmptyNode() const;
+
+ /**
+ * Return the contents of a leaf element
+ * @return TPtrC8 Contents of the leaf element
+ */
+ IMPORT_C TPtrC8 LeafNodeContent() const;
+
+ /**
+ * Return the contents of a leaf element escape-coded, if needed
+ * @return TPtrC8 Contents of the leaf element
+ */
+ IMPORT_C HBufC8* EscapeLeafNodeContentLC() const;
+
+ /**
+ * Returns the contents of a single element without any brackets
+ * and pushes the buffer onto the CleanupStack.
+ *
+ * For instance:
+ *
+ * 'element attribute1 = "value" attribute2 = "another value"'
+ *
+ * @return HBufC8*
+ */
+ IMPORT_C HBufC8* ElementDataLC() const;
+
+ /**
+ * Return the parent node of this element
+ *
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* Parent() const;
+
+ /**
+ * Name of this element
+ * @return TPtrC8 Name of this element
+ */
+ IMPORT_C TPtrC NodeName() const;
+
+ /**
+ * Name of this element
+ * @return TPtrC8 Name of this element
+ */
+ IMPORT_C HBufC8* EightBitNodeNameLC() const;
+
+ /**
+ * (Re-)Set the name of this element
+ * @param TDesC& Name of this element
+ * @return void
+ */
+ IMPORT_C void SetNameL( const TDesC& aNodeName );
+
+ /**
+ * (Re-)Set the name of this element
+ * @param TDesC& Name of this element
+ * @return void
+ */
+ IMPORT_C void SetNameL( const TDesC8& aNodeName );
+
+ /**
+ * Returns the number of child & lealf elements
+ *
+ * @return TInt Number of descendants
+ */
+ IMPORT_C TInt NodeCount() const;
+
+ /**
+ * Returns the number of attributes of this element
+ *
+ * @return TInt The number of attributes
+ */
+ IMPORT_C TInt AttributeCount() const;
+
+ /**
+ * Returns a child node specified by its position among the
+ * descendants of an element
+ *
+ * @return CXdmDocument*
+ */
+ IMPORT_C CXdmDocumentNode* ChileNode( TInt aPosition ) const;
+
+ /**
+ * Reference an attribute of this element specified by the position
+ * of the attribute
+ *
+ * @return CXdmDocument*
+ */
+ IMPORT_C CXdmNodeAttribute* Attribute( TInt aPosition ) const;
+
+ /**
+ * Reference an attribute of this element specified by the position
+ * of the attribute
+ *
+ * @return CXdmDocument*
+ */
+ IMPORT_C CXdmNodeAttribute* Attribute( const TDesC& aAttributeName ) const;
+
+ /**
+ * Search for nodes which match the specified name
+ *
+ * @param TDesC& The element name to search for
+ * @param RPointerArray<CXdmDocumentNode> Results, if any
+ * @return TInt Error
+ */
+ IMPORT_C TInt Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified node
+ *
+ * @param CXdmDocumentNode& The node to compare to
+ * @return TInt KErrNotFound if no matching nodes are found
+ */
+ IMPORT_C TInt Find( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified name & attributes
+ *
+ * @param TDesC& The element name to search for
+ * @param RPointerArray<CXdmDocumentNode>& Results
+ * @param RPointerArray<SXdmAttribute16>& Attributes to search for
+ * @return TInt KErrNotFound if no matching nodes are found
+ */
+ IMPORT_C TInt Find( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray ) const;
+
+
+ /**
+ * The type of this element: an element or an attribute
+ * @return TXdmElementType*
+ */
+ IMPORT_C TBool Match( const CXdmDocumentNode& aAnotherNode ) const;
+
+ /**
+ * The type of this element: an element or an attribute
+ * @return TXdmElementType*
+ */
+ IMPORT_C TBool Match( const TDesC& aNodeName,
+ const RPointerArray<SXdmAttribute8>& aAttributeArray ) const;
+
+ /**
+ * Comparison operator
+ *
+ * @return TBool Are the contents of this object identical to
+ * the ones in the parameter
+ */
+ IMPORT_C TBool operator==( const CXdmDocumentNode& aNode ) const;
+
+ /**
+ * The type of this element: an element or an attribute
+ * @return TXdmElementType*
+ */
+ IMPORT_C TBool HasAttribute( const TDesC& aAttributeName ) const;
+
+ /**
+ * The type of this element: an element or an attribute
+ * @return TXdmElementType*
+ */
+ IMPORT_C virtual TXdmElementType ElementType() const;
+
+ /**
+ * Remove a child node
+ * @param CXdmDocumentNode The element to be removed
+ * @return void
+ */
+ IMPORT_C void RemoveChileNodeL( CXdmDocumentNode* aChileNode );
+
+ /**
+ * Append a child node
+ * @param CXdmDocumentNode The element to be appended
+ * @return void
+ */
+ IMPORT_C void AppendChileNodeL( CXdmDocumentNode* aChileNode );
+
+ /**
+ * Insert a child node to the given position
+ * @param TInt The position of the new element
+ * @param CXdmDocumentNode The element to be inserted
+ * @return void
+ */
+ IMPORT_C void InsertChileNodeL( TInt aIndex, CXdmDocumentNode* aChileNode );
+
+ /**
+ * Replace a child node
+ * @param CXdmDocumentNode The new node
+ * @param CXdmDocumentNode The node to be replaced
+ * @return void
+ */
+ IMPORT_C void ReplaceChileNodeL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C ~CXdmDocumentNode();
+
+ public:
+
+ /**
+ * Print the contents of this node to the log file
+ *
+ * @return void
+ */
+ IMPORT_C void Print();
+
+ /**
+ * Return the next node in the list
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* NextNode() const;
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ IMPORT_C void SetNextNode( CXdmDocumentNode* aNextNode );
+
+ public:
+
+ /**
+ * Check whether an element has the specified attribute
+ *
+ * @param CXdmNodeAttribute& The specified attribute
+ * @return TBool Does the element have the specified attribute
+ */
+ TBool HasAttribute( const CXdmNodeAttribute& aNode ) const;
+
+ /**
+ * Check whether an element has the specified attribute
+ *
+ * @param SXdmAttribute8& The specified attribute
+ * @return TBool Does the element have the specified attribute
+ */
+ TBool HasAttributeL( const SXdmAttribute8& aAttribute ) const;
+
+ /**
+ * Check whether an element has the specified attribute
+ *
+ * @param SXdmAttribute16& The specified attribute
+ * @return TBool Does the element have the specified attribute
+ */
+ TBool HasAttribute( const SXdmAttribute16& aAttribute ) const;
+
+ protected: // New functions
+
+ /**
+ * Escape-code the specified string
+ *
+ * @param TDesC8& The descriptor to escape-code
+ * @return HBufC8* Escape-coded string
+ */
+ HBufC8* EscapeDescLC( const TDesC8& aDescriptor ) const;
+
+ protected:
+
+ /**
+ * C++ constructor, for derived classes
+ *
+ * @param CXdmEngine* Reference to the engine
+ * @param MXdmNodeFactory* Reference to the node factory
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ IMPORT_C CXdmDocumentNode( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * CC++ constructor, for derived classes
+ *
+ * @param CXdmEngine* Reference to the engine
+ * @param MXdmNodeFactory* Reference to the node factory
+ */
+ IMPORT_C CXdmDocumentNode( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory );
+
+ /**
+ * C++ constructor, for derived classes
+ *
+ * @param CXdmEngine* Is this a leaf element
+ * @param CXdmEngine* Reference to the engine
+ * @param MXdmNodeFactory* Reference to the node factory
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ IMPORT_C CXdmDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Symbian OS constructor for derived classes.
+ *
+ * @param TDesC8& Name of this element
+ * @return void
+ */
+ IMPORT_C void BaseConstructL( const TDesC& aNodeName );
+
+ /**
+ * Copy constructor
+ *
+ * @param CXdmDocumentNode& The element to copy
+ * @param CXdmDocumentNode& The parent of this element
+ * @return void
+ */
+ IMPORT_C virtual void CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode );
+
+ private:
+
+ /**
+ * Search for nodes which match the specified name
+ *
+ * @param TDesC& The element name to search for
+ * @param RPointerArray<CXdmDocumentNode> Results, if any
+ * @return TInt KErrNotFound if no matches were found,
+ * number of matching elements otherwise
+ */
+ TInt DoFind( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified node
+ *
+ * @param CXdmDocumentNode& The node to compare to
+ * @return TInt KErrNotFound if no matching nodes are found
+ */
+ TInt DoFind( const CXdmDocumentNode& aTargetNode,
+ RPointerArray<CXdmDocumentNode>& aResultArray ) const;
+
+ /**
+ * Search for nodes which match the specified name & attributes
+ *
+ * @param TDesC& The element name to search for
+ * @param RPointerArray<CXdmDocumentNode>& Results
+ * @param RPointerArray<SXdmAttribute16>& Attributes to search for
+ * @return TInt KErrNotFound if no matching nodes are found
+ */
+ TInt DoFind( const TDesC& aNodeName,
+ RPointerArray<CXdmDocumentNode>& aResultArray,
+ const RPointerArray<SXdmAttribute16>& aAttributeArray );
+
+ /**
+ * Copy the child nodes of another element.
+ *
+ * @param CXdmDocumentNode& The element the children of which should be copied
+ * @return void
+ */
+ void ConstructChildrenL( const CXdmDocumentNode& aAnotherNode );
+
+ /**
+ * Copy the attributes of another element.
+ *
+ * @param CXdmDocumentNode& The element the attributes of which should be copied
+ * @return void
+ */
+ void ConstructAttributesL( const CXdmDocumentNode& aAnotherNode );
+
+ /**
+ * Remove namespace attributes from this element. Namespaces must
+ * not be used when comparing two elements, which is why these
+ * attributes need to be removed before the comparison.
+ *
+ * @return void
+ */
+ void RemoveNamespaceAttributes();
+
+ protected:
+
+ TInt iPosition;
+ TBool iLeafNode;
+ TBool iEmptyNode;
+ HBufC* iNodeName;
+ HBufC8* iLeafContent;
+ CXdmEngine& iXdmEngine;
+ MXdmNodeFactory& iNodeFactory;
+ friend class CXdmDocument;
+ CXdmDocumentNode* iNextNode;
+ CXdmDocumentNode* iParentNode;
+ RPointerArray<CXdmDocumentNode> iChildren;
+ RPointerArray<CXdmNodeAttribute> iAttributes;
+ };
+
+#endif //__XDMDOCUMENTNODE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmEngine.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Engine
+*
+*/
+
+
+
+
+#ifndef __XDMENGINE__
+#define __XDMENGINE__
+
+// INCLUDES
+#include "e32base.h"
+#include "XdmDocument.h"
+#include "XdmDirectory.h"
+
+enum TXdmEnginePanic
+ {
+ EDocNodeNull = 0,
+ ENodeNotEmpty,
+ EDDocModelNotFound,
+ EDirModelNotFound,
+ EIllegalPosition,
+ EIndexOutOfBounds,
+ };
+
+//CONSTANTS
+_LIT( KXdmEngLogFile, "XdmEngine" );
+_LIT8( KGeneralEqualsAndQuotes, "=\"" );
+_LIT8( KGeneralQuotes, "\"" );
+_LIT8( KGeneralSpace, " ");
+const TInt KXdmEngLogBufferMaxSize = 2000;
+const TInt KXdmEngShutdownDelay = 10;
+
+//FORWARD DECLARATIONS
+class CDesC16Array;
+class CXdmProtocol;
+class CXdmDocument;
+class CXdmDirectory;
+class CXdmLogWriter;
+class CXdmProtocolInfo;
+
+// CLASS DECLARATION
+class CXdmEngine : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Create an instance of the Engine object
+ * @param CXdmProtocolInfo& Reference to a protocol info object
+ * @return CXdmEngine*
+ */
+ IMPORT_C static CXdmEngine* NewL( const CXdmProtocolInfo& aProtocolInfo );
+
+ /**
+ * Fetch the IDs of the XDM Settings which have been
+ * configured to this device.
+ *
+ * @param RArray<TInt> On return, contains the TInt type IDs
+ * which correspond to the names stored
+ * in the returning array object.
+ * @return CDesC16Array* The names of the settings
+ */
+ IMPORT_C static CDesC16Array* XdmSettingsLC( RArray<TInt>& aSettingIds );
+
+ /**
+ * Create a new document model
+ *
+ * @param TDesC8& Name of the document, including path
+ * @param TDesC8& Application usage - an AUID
+ *
+ * NOTE! It is important to keep in mind that the Xdm Engine
+ * DOES NOT maintain the documents created on this engine
+ * object. It is the responsibility of the client application
+ * to deallocate the documents it creates by calling
+ * CXdmEngine::DeleteDocumentModelL( model ). The engine
+ * does keep track of the documents that are constructed
+ * on it, but it does not own them in the sense which would
+ * suggest deallocation of the memory reserved for them.
+ *
+ * @return CXdmDocument instance
+ */
+ IMPORT_C CXdmDocument* CreateDocumentModelL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType );
+
+ /**
+ * Create a new document model
+ *
+ * @param CXdmDocument* The document model to delete
+ * @return void
+ */
+ IMPORT_C void DeleteDocumentModelL( const CXdmDocument* aDocument );
+
+ /**
+ * Create a new document model
+ *
+ * @param CXdmDocument* The document model to delete
+ * @return void
+ */
+ IMPORT_C CXdmDirectory* CreateDirectoryModelL( const TDesC& aDirectoryPath );
+
+ /**
+ * Create a new document model
+ *
+ * @param CXdmDocument* The document model to delete
+ * @return void
+ */
+ IMPORT_C void DeleteDirectoryModelL( const CXdmDirectory* aDocument );
+
+ /**
+ * Create a new element.
+ *
+ * The returning CXdmDocumentNode object does not yet
+ * belong to any document. Therefore it is the responsibility
+ * of the client application to deallocate the memory
+ * reserved for the element.
+ *
+ * The new element can be "attached" to a document by using
+ * AppendToModelL() or ReplaceInModelL(). It is important to
+ * note that even after calling either of these methods, the
+ * ownership of the object does not change.
+ *
+ * @return CXdmDocumentNode*
+ */
+ IMPORT_C CXdmDocumentNode* CreateDocumentNodeL();
+
+ /**
+ * Update the changes to the specified document model
+ *
+ * @param The document to be updated
+ * @param TRequestStatus Request status of the caller
+ * @return void
+ */
+ IMPORT_C void UpdateL( CXdmDocument* aDocument,
+ TRequestStatus& aStatus );
+
+ /**
+ * Update the contents of the specified directory model
+ *
+ * @param The directory to be updated
+ * @param TRequestStatus Request status of the caller
+ * @return void
+ */
+ IMPORT_C void UpdateL( TRequestStatus& aStatus,
+ CXdmDirectory* aDirectory,
+ TDirUpdatePhase aUpdatePhase );
+
+
+ /**
+ * Cancel an update operation on a document
+ *
+ * @param CXdmDocument The document whose update
+ * is being cancelled
+ * @return void
+ */
+ IMPORT_C void CancelUpdate( CXdmDocument* aDocument );
+
+ /**
+ * Cancel an update operation on a directory
+ *
+ * @param CXdmDirectory The directory whose update
+ * is being cancelled
+ * @return void
+ */
+ IMPORT_C void CancelUpdate( CXdmDirectory* aDirectory );
+
+ /**
+ * Get the list of documents created on this instance
+ *
+ * @return RPointerArray The list of document models
+ */
+ IMPORT_C const RPointerArray<CXdmDocument>& DocumentCollection() const;
+
+ /**
+ * Get the list of directories created on this instance
+ *
+ * @return RPointerArray The list of document models
+ */
+ IMPORT_C const RPointerArray<CXdmDirectory>& DirectoryCollection() const;
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXdmEngine();
+
+ public: //New functions
+
+ /**
+ * Return the protocol this engine uses
+ *
+ * @return CXdmProtocol* The protocol instance
+ */
+ CXdmProtocol* XdmProtocol() const;
+
+ /**
+ * Logging function
+ *
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ public: //Static
+
+ /**
+ * Convert data from UNICODE to UTF-8
+ *
+ * @param TDesC& UNICODE descriptor
+ * @return HBufC8* Data converted to UTF-8
+ */
+ static HBufC8* ConvertToUTF8L( const TDesC& aUnicodeDesc );
+
+ private:
+
+ /**
+ * C++ default constructor is private
+ * @return void
+ */
+ CXdmEngine();
+
+ /**
+ * Symbian OS second-phase constructor
+ * @param CXdmProtocolInfo& Protocol information
+ * @return void
+ */
+ void ConstructL( CXdmProtocolInfo& aProtocolInfo );
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ private: //Data
+
+ enum TXdmEngineState
+ {
+ EXdmEngineIdle = 0,
+ EXdmEngineStartDocUpdate,
+ EXdmEngineStartDirUpdate
+ };
+
+ CXdmProtocol* iXdmProtocol;
+ CXdmDocument* iCurrentDoc;
+ CXdmDirectory* iCurrentDir;
+ TRequestStatus* iClientStatus;
+ RPointerArray<CXdmDocument> iDocumentQueue;
+ RPointerArray<CXdmDocument> iDocUpdateQueue;
+ RPointerArray<CXdmDirectory> iDirUpdateQueue;
+ RPointerArray<CXdmDirectory> iDirectoryQueue;
+ CXdmLogWriter* iLogWriter;
+ };
+
+#endif
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmErrors.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM errors
+*
+*/
+
+
+
+
+#ifndef __XDMERRORS__
+#define __XDMERRORS__
+
+
+// Error range -32400 -> -32429 ( first and last number included)
+
+#define XDM_ERROR_BASE -32400
+
+enum
+ {
+ // General error
+ KXcapErrorGeneral = XDM_ERROR_BASE,
+
+/* Errors from the XCAP Application Usages */
+
+ // Invalid element or attribute data value
+ KXcapErrorIllegalDataValue = XDM_ERROR_BASE -1,
+
+ // Mandatory element missing from document
+ KXcapErrorMissingRequiredElement = XDM_ERROR_BASE -2,
+
+ // Mandatory attribute missing from element
+ KXcapErrorMissingRequiredAttribute = XDM_ERROR_BASE -3,
+
+ // Restricted element occurence rule
+ KXcapErrorTooManyOccurencies = XDM_ERROR_BASE -4,
+
+ // Illegal elements, wrong element order, etc
+ KXcapErrorSchemaViolation = XDM_ERROR_BASE -5,
+
+ // Element or attribute value against enumerated values
+ KXcapErrorEnumerationRule = XDM_ERROR_BASE -6,
+
+ // Illegal root element in document
+ KXcapErrorIllegalRootElement = XDM_ERROR_BASE -7,
+
+ // Mandatory value missing from element
+ KXcapErrorMissingRequiredElementValue = XDM_ERROR_BASE -8,
+
+/* Errors from the XCAP Protocol */
+
+ // Could not create a network connection
+ KXcapErrorNetworkNotAvailabe = XDM_ERROR_BASE -9,
+
+ // General HTTP Server Error - 5xx
+ KXcapErrorHttpServer = XDM_ERROR_BASE -10,
+
+ // General HTTP Client Error - 4xx
+ KXcapErrorHttpClient = XDM_ERROR_BASE -11,
+
+ // Bad request - 400
+ KXcapErrorHttpBadRequest = XDM_ERROR_BASE -12,
+
+ // The client was not authoried to use the resource - 401
+ KXcapErrorHttpUnauthorised = XDM_ERROR_BASE -13,
+
+ // Use of the resource has been forbidden - 403
+ KXcapErrorHttpForbidden = XDM_ERROR_BASE -14,
+
+ // The requested resource could not be found - 404
+ KXcapErrorHttpNotFound = XDM_ERROR_BASE -15,
+
+ // The request timed out - 408
+ KXcapErrorHttpRequestTimeout = XDM_ERROR_BASE -16,
+
+ // An HTTP conflict - 409
+ KXcapErrorHttpConflict = XDM_ERROR_BASE -17,
+
+ // Precondition failed - 412
+ KXcapErrorHttpPrecondFailed = XDM_ERROR_BASE -18,
+
+ // An unrecoverable conflict
+ KXcapErrorUnrecoverableConflict = XDM_ERROR_BASE -19,
+
+ // Authentication || user data integrity problems
+ KXcapErrorAuthentication = XDM_ERROR_BASE -20
+ };
+
+
+
+#endif //__XDMERRORS__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmNamespaceContainer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM namespace
+*
+*/
+
+
+
+
+#ifndef __XDMNAMESPACECONTAINER__
+#define __XDMNAMESPACECONTAINER__
+
+//CLASS DECLARATION
+class MXdmNamespaceContainer
+ {
+ public:
+
+ /**
+ * Return the number of namespace declarations
+ *
+ * @return TInt Namespace declaration count
+ */
+ virtual TInt Count() const = 0;
+
+ /**
+ * Append a new namespace to the document
+ *
+ * @param TDesC8& URI of the namespace
+ * @param TDesC8& Prefix of the namespace
+ */
+ virtual void AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix ) = 0;
+
+ /**
+ * Remove a namespace from the document
+ *
+ * @param TDesC8& URI of the namespace
+ * @param TDesC8& Prefix of the namespace
+ */
+ virtual void RemoveNamespace( const TDesC8& aUri ) = 0;
+
+ /**
+ * Fetch the URI that corresponds to the prefix in the parameter
+ *
+ * @param TDesC8 Prefix of the namespace
+ * @return TPtrC URI that corresponds to the prefix in the parameter
+ */
+ virtual TPtrC8 Uri( const TDesC8& aPrefix ) const = 0;
+
+ /**
+ * Fetch the aIndex-th URI
+ *
+ * @param TInt The index of the desired URI string
+ * @return TPtrC URI string
+ */
+ virtual TPtrC8 Uri( TInt aIndex ) const = 0;
+
+ /**
+ * Fetch the aIndex-th prefix
+ *
+ * @param TDesC8 The index of the desired prefix string
+ * @return TPtrC Prefix string
+ */
+ virtual TPtrC8 Prefix( TInt aIndex ) const = 0;
+
+ /**
+ * Resets namespaces from the document
+ *
+ * @return void
+ */
+ virtual void ResetNamespaces( ) = 0;
+ };
+
+#endif //__XDMNAMESPACECONTAINER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmNodeAttribute.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM node attribute
+*
+*/
+
+
+
+
+#ifndef __XDMNODEATTRIBUTE__
+#define __XDMNODEATTRIBUTE__
+
+#include <e32base.h>
+#include "XdmDocumentNode.h"
+
+class CXdmEngine;
+
+//CLASS DECLARATION
+class CXdmNodeAttribute : public CXdmDocumentNode
+ {
+ public:
+
+ /**
+ * Return the value of this attribute
+ *
+ * NOTE! The name of an attribute is retrieved through a call
+ * to the NodeName() member function in the base class.
+ *
+ * @return TPtrC8 The value of this attribute
+ */
+ IMPORT_C TPtrC AttributeValue() const;
+
+ /**
+ * Return the value of this attribute
+ *
+ * @return HBufC8* The value of this attribute
+ */
+ IMPORT_C HBufC8* EightBitValueLC() const;
+
+ /**
+ * Return the escaped value of this attribute
+ *
+ * @return HBufC8* The value of this attribute
+ */
+ IMPORT_C HBufC8* EscapedValueLC() const;
+
+ /**
+ * Set the value of this attribute
+ *
+ * @param TDesC8& Value of the attribute
+ * @return void
+ */
+ IMPORT_C void SetAttributeValueL( const TDesC& aAttributeValue );
+
+ /**
+ * Set the value of this attribute
+ *
+ * @param TDesC8& Value of the attribute
+ * @return void
+ */
+ IMPORT_C void SetAttributeValueL( const TDesC8& aAttributeValue );
+
+ /**
+ * The type of this element: an element or an attribute
+ *
+ * @return TXdmElementType*
+ */
+ IMPORT_C virtual TXdmElementType ElementType() const;
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXdmNodeAttribute();
+
+ protected: //Methods
+
+ /**
+ * Symbian OS constructor for derived classes.
+ *
+ * @param CXdmEngine& Reference to the engine
+ * @param MXdmNodeFactory* Reference to the node factory
+ */
+ IMPORT_C CXdmNodeAttribute( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory );
+
+ /**
+ * Symbian OS constructor for derived classes.
+ *
+ * @param CXdmEngine& Reference to the engine
+ * @param MXdmNodeFactory* Reference to the node factory
+ * @param CXdmDocumentNode* Pointer to the parent element
+ */
+ IMPORT_C CXdmNodeAttribute( CXdmEngine& aXdmEngine,
+ MXdmNodeFactory& aNodeFactory,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Symbian OS base class constructor.
+ *
+ * @param TDesC& Name of the attribute
+ * @return void
+ */
+ IMPORT_C void BaseConstructL( const TDesC& aAttributeName );
+
+ private:
+
+ /**
+ * Set the value of this element
+ *
+ * @param TDesC Attribute name
+ * @return void
+ */
+ void SetValueL( const TDesC& aAttributeName );
+
+ private: //Data
+
+ HBufC* iAttributeValue;
+ };
+
+#endif //__XDMNODEATTRIBUTE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmNodeInterface.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM node interface
+*
+*/
+
+
+
+
+#ifndef __XDMNODEINTERFACE__
+#define __XDMNODEINTERFACE__
+
+#include <e32base.h>
+
+//CLASS DECLARATION
+class MXdmNodeInterface
+ {
+ public:
+
+ /**
+ * Return the prefix for this element
+ * @return TPtrC8 Prefix descriptor
+ */
+ virtual TPtrC8 Prefix() const = 0;
+
+ /**
+ * Set prefix for this element
+ * @param TDesC8& Prefix descriptor
+ * @return void
+ */
+ virtual void SetPrefixL( const TDesC8& aNamespacePrefix ) = 0;
+ };
+
+#endif //__XDMNODEINTERFACE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmProtocolInfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM protocol information
+*
+*/
+
+
+
+
+#ifndef __XDMPROTOCOLINFO__
+#define __XDMPROTOCOLINFO__
+
+#include <e32base.h>
+#include "XdmCredentials.h"
+
+//FORWARD DECLARATION
+class CXdmDocument;
+
+//CLASS DECLARATION
+class CXdmProtocolInfo : public CBase
+ {
+ public:
+
+ /**
+ * Create a new protocol info object
+ *
+ * @param TInt ID of the access point to use
+ * @param TUid The UID of the XDM protocol to use
+ * @param TDesC& Address of the remote host
+ * @return CXdmProtocolInfo The protocol info object
+ */
+ IMPORT_C static CXdmProtocolInfo* NewL( TInt aAccessPoint,
+ TInt aProtocolUid,
+ const TDesC& aRootLocation );
+
+ /**
+ * Create a new protocol info object
+ *
+ * @param TInt ID of the settings collection
+ *
+ * NOTE: In order to be able to use this overload
+ * of the constructor, the client must first
+ * fetch the collection of XDM Settings through
+ * the static method XdmSettingsL() declared in
+ * CXdmEngine API. This method returns an array
+ * of strings, which denote the names of the
+ * settings collections stored for XDM.
+ *
+ * @return CXdmProtocolInfo* The protocol info object
+ */
+ IMPORT_C static CXdmProtocolInfo* NewL( TInt aSettingsId );
+
+ /**
+ * Return the root location of the XDM documents
+ *
+ * @return TPtrC RootURI
+ */
+ IMPORT_C TPtrC Root() const;
+
+ /**
+ * Return the access point
+ *
+ * @return TInt Access point
+ */
+ IMPORT_C TInt AccessPoint() const;
+
+ /**
+ * Return the the UID of the protocol in use
+ *
+ * @return TUid UID of the protocol implementation
+ */
+ IMPORT_C TUid ProtocolUid() const;
+
+ /**
+ * Set appropriate credentials in case the used
+ * resource requires authorization.
+ *
+ * @param TXdmCredentials Credentials for the user
+ * @return void
+ */
+ IMPORT_C void SetCredentials( const TXdmCredentials aCredentials );
+
+ /**
+ * Enable/disable cache
+ *
+ * @param TBool Is cache in use or not
+ * @return void
+ */
+ IMPORT_C void SetCacheUsage( TBool aCacheUsage );
+
+ /**
+ * Enable/disable secure transfer
+ *
+ * @param TBool Is the protocol secure
+ * @return void
+ */
+ IMPORT_C void SetSecurity( TBool aSecure );
+
+ /**
+ * Is secure transfer enabled
+ *
+ * @return TBool Secure or not
+ */
+ IMPORT_C TBool IsSecure() const;
+
+ /**
+ * Check cache usage
+ *
+ * @return TBool Is cache in use
+ */
+ IMPORT_C TBool IsCacheEnabled() const;
+
+ /**
+ * Return the credentials
+ *
+ * @return TXdmCredentials& Credentials for the user
+ */
+ IMPORT_C const TXdmCredentials& Credentials() const;
+
+ /**
+ * Return the ID of the settings
+ *
+ * @return TInt SettingsID
+ */
+ IMPORT_C TInt SettingsID() const;
+
+ /**
+ * Destructor
+ */
+ IMPORT_C virtual ~CXdmProtocolInfo();
+
+ private:
+
+ /**
+ * C++ constructor is private
+ */
+ CXdmProtocolInfo();
+
+ /**
+ * C++ constructor is private
+ *
+ * @param TInt UID of the protocol plugin
+ */
+ CXdmProtocolInfo( TInt aProtocolUid );
+
+ /**
+ * C++ constructor is private
+ *
+ * @param TInt ID of the access point in use
+ * @param TInt UID of the protocol plugin
+ */
+ CXdmProtocolInfo( TInt aAccessPoint,
+ TInt aProtocolUid );
+
+ /**
+ * Symbian OS second-phase constructor
+ *
+ * @param TDesC& Root location
+ * @return void
+ */
+ void ConstructL( const TDesC& aRootLocation );
+
+ /**
+ * Symbian OS non-leaving constructor
+ *
+ * @param TInt Settings ID
+ * @return void
+ */
+ void Construct( TInt aSettingsId );
+
+ private: //Data
+
+ TUid iProtocolUid;
+ TInt iSettingsId;
+ TInt iAccessPoint;
+ TBool iSecure;
+ TBool iUseCache;
+ HBufC* iRootLocation;
+ TXdmCredentials iCredentials;
+ };
+
+#endif //__XDMPROTOCOLINFO__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/inc/XdmProtocolUidList.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM protocols
+*
+*/
+
+
+
+
+#ifndef __XDMPROTOCOLUIDLIST__
+#define __XDMPROTOCOLUIDLIST__
+
+#include <e32base.h>
+
+//Constants
+const TInt KXcapProtocol = 0x10207423;
+const TInt KLocalProtocol = 0x10207424;
+
+// Application usage interface Uid
+const TInt KXdmXcapAppUsageInterfaceUid = 0x10207417;
+
+// Application usage Uids
+const TInt KXdmCapabilityUsageUid = 0x10207418;
+const TInt KXdmDirectoryUsageUid = 0x10207419;
+const TInt KXdmTestAppUsageUid = 0x1020741A;
+const TInt KXdmPocGroupUsageUid = 0x1020741B;
+const TInt KXdmPocUserAccessUsageUid = 0x1020741C;
+const TInt KXdmSharedXDMUsageUid = 0x1020741D;
+const TInt KXdmRlsServicesUsageUid = 0x1020741E;
+const TInt KXdmResourceListsUsageUid = 0x10275080;
+const TInt KXdmIetfCommonPolicyUsageUid = 0x10275081;
+const TInt KXdmOmaCommonPolicyUsageUid = 0x10275082;
+const TInt KXdmIetfPresRulesUsageUid = 0x10275083;
+const TInt KXdmOmaPresRulesUsageUid = 0x102750AB;
+const TInt KXdmUsageUid = 0x20028701;
+const TInt KXdmNSNUsageUid = 0x20028702;
+
+#endif //__XDMPROTOCOLUIDLIST__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_api/xdm_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<api id="1531c6f68bbaa965c4756002ad20e9a8" dataversion="1.0">
+ <name>XDM API</name>
+ <description>Protocol agnostig XML Document Management API. This is the API that is used in handling the documents and directory listings locally.
+This API contains
+- Methods to read documents directory listings
+- Methods to modify documents
+- Methods to delete documents
+- Methods to read documents listed in directory listing</description>
+ <type>c++</type>
+ <subsystem>XDMEngine</subsystem>
+ <libs>
+ <lib name="XdmEngine.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: XDM Protocol Plug-in API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/XdmOperation.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmOperation.h)
+../inc/XdmProtocol.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmProtocol.h)
+../inc/XdmOperationFactory.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmOperationFactory.h)
+../inc/XdmNodeFactory.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmNodeFactory.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/inc/XdmNodeFactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Protocol node factory
+*
+*/
+
+
+
+
+#ifndef __XDMNODEFACTORY__
+#define __XDMNODEFACTORY__
+
+#include <e32cmn.h>
+
+class CXdmDocumentNode;
+class CXdmNodeAttribute;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( MXdmNodeFactory )
+ {
+ public:
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ virtual CXdmDocumentNode* ChileNodeL() = 0;
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ virtual CXdmDocumentNode* ChileNodeL( const TDesC& aChildName ) = 0;
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ virtual CXdmDocumentNode* ChileNodeL( const CXdmDocumentNode* aAnotherNode ) = 0;
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ virtual CXdmNodeAttribute* AttributeL() = 0;
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ virtual CXdmNodeAttribute* AttributeL( const TDesC& aAttributeName ) = 0;
+ };
+
+#endif //__XDMNODEFACTORY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/inc/XdmOperation.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Operation
+*
+*/
+
+
+
+
+#ifndef __XDMOPERATION__
+#define __XDMOPERATION__
+
+#include <e32base.h>
+
+//These are instructions the document element
+//should follow when an operation fails
+const TInt KInsertConflict = 5001;
+
+/**** Option flags ****/
+
+const TInt KXdmOption1 = 0x00000001;
+const TInt KXdmOption2 = 0x00000002;
+const TInt KXdmOption3 = 0x00000004;
+const TInt KXdmOption4 = 0x00000008;
+const TInt KXdmOption5 = 0x00000010;
+const TInt KXdmOption6 = 0x00000020;
+const TInt KXdmOption7 = 0x00000040;
+const TInt KXdmOption8 = 0x00000080;
+
+//The type of the operation
+enum TXdmOperationType
+ {
+ EXdmDocument = 0,
+ EXdmPartialDocument
+ };
+
+//Completion Data
+class TXdmCompletionData
+ {
+ public:
+
+ TInt iCompletion;
+ TInt iHttpStatus;
+ HBufC8* iETag;
+ HBufC8* iStatusText;
+ HBufC8* iResponseData;
+ };
+
+//Forward declaration
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( MXdmOperation )
+ {
+ public:
+
+ /**
+ * Execute this operation synchronously
+ *
+ * @return void
+ */
+ virtual void ExecuteL() = 0;
+
+ /**
+ * Execute this operation asynchronously.
+ *
+ * @param TRequestStatus& Request status of the caller
+ * @param TUint The option flags
+ * @return void
+ */
+ virtual void ExecuteL( TRequestStatus& aStatus, TUint aOptions ) = 0;
+
+ /**
+ * Cancel this operation.
+ *
+ * @return void
+ */
+ virtual void CancelOperation() = 0;
+
+ /**
+ * Get the result of this operation.
+ * @return TInt Result of the operation
+ */
+ virtual TInt Result() const = 0;
+
+ /**
+ * Get the completion data of this operation.
+ * @return TXdmCompletionData Completion data
+ */
+ virtual const TXdmCompletionData& CompletionData() const = 0;
+
+ /**
+ * Check the completion state of this operation.
+ *
+ * @return TBool Has the operation been completed
+ */
+ virtual TBool IsCompleted() const = 0;
+
+ /**
+ * Return the target node of this operation
+ *
+ * @return CXdmDocumentNode* The target node
+ */
+ virtual CXdmDocumentNode* TargetNode() const = 0;
+
+ /**
+ * Destructor
+ *
+ *@return void
+ */
+ virtual void Destroy() = 0;
+ };
+
+
+
+#endif //__XCAPOPERATION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/inc/XdmOperationFactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Protocol operation factory
+*
+*/
+
+
+
+
+#ifndef __XDMOPERATIONFACTORY__
+#define __XDMOPERATIONFACTORY__
+
+#include <ecom.h>
+#include <e32base.h>
+#include "XdmProtocol.h"
+
+//Operation factory UIDs
+const TInt KXcapOperationFactory = 0x10207426;
+const TInt KLocalOperationFactory = 0x10275088;
+
+
+//FORWARD DECLARATION
+class CXdmDocument;
+class MXdmOperation;
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+class CXdmOperationFactory : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TInt UID of the operation factory
+ * @return CXdmOperationFactory*
+ */
+ static CXdmOperationFactory* NewL( TInt aOperationFactory );
+
+ /**
+ * C++ destructor.
+ */
+ virtual ~CXdmOperationFactory();
+
+ public:
+
+ /**
+ * Create a fetch operation
+ *
+ * @param CXdmDocument& Target document
+ * @param CXdmDocumentNode& Target element
+ * @return MXdmOperation* The new operation
+ */
+ virtual MXdmOperation* FetchL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const = 0;
+
+ /**
+ * Create an insert operation
+ *
+ * @param CXdmDocument& Target document
+ * @param CXdmDocumentNode& Target element
+ * @return MXdmOperation* The new operation
+ */
+ virtual MXdmOperation* InsertL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const = 0;
+
+ /**
+ * Create a replace operation
+ *
+ * @param CXdmDocument& Target document
+ * @param CXdmDocumentNode& New element
+ * @param CXdmDocumentNode& Old element
+ * @return MXdmOperation* The new operation
+ */
+ virtual MXdmOperation* ReplaceL( CXdmDocument& aOldDocument,
+ CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aOldNode ) const = 0;
+
+ /**
+ * Create an append operation
+ *
+ * @param CXdmDocument& Target document
+ * @param CXdmDocumentNode& Target element
+ * @return MXdmOperation* The new operation
+ */
+ virtual MXdmOperation* AppendL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const = 0;
+
+ /**
+ * Create a delete operation
+ *
+ * @param CXdmDocument& Target document
+ * @param CXdmDocumentNode& Target element
+ * @return MXdmOperation* The new operation
+ */
+ virtual MXdmOperation* DeletionL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const = 0;
+
+ protected:
+
+ /**
+ * Symbian OS constructor for derived classes.
+ *
+ * @return CXdmOperationFactory
+ */
+ CXdmOperationFactory();
+
+ private: //Data
+
+ TUid iDestructorKey;
+ };
+
+// ----------------------------------------------------
+// MXcapOperationFactory::MXcapOperationFactory
+//
+// ----------------------------------------------------
+//
+inline CXdmOperationFactory::CXdmOperationFactory()
+ {
+ }
+
+// ----------------------------------------------------
+// CXdmProtocol::~CXcapOperationFactory
+//
+// ----------------------------------------------------
+//
+inline CXdmOperationFactory::~CXdmOperationFactory()
+ {
+ REComSession::DestroyedImplementation( iDestructorKey );
+ }
+
+// ----------------------------------------------------
+// CXdmProtocol::NewL
+// Create a new operation factory
+// ----------------------------------------------------
+//
+inline CXdmOperationFactory* CXdmOperationFactory::NewL( TInt aOperationFactory )
+ {
+ TAny* ptr = NULL;
+ TUid KImplemantationUid = { aOperationFactory };
+ ptr = REComSession::CreateImplementationL(
+ KImplemantationUid, _FOFF( CXdmOperationFactory, iDestructorKey ) );
+ return reinterpret_cast<CXdmOperationFactory*>( ptr );
+
+
+ }
+
+#endif //__XCAPOPERATIONFACTORY__
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/inc/XdmProtocol.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Protocol
+*
+*/
+
+
+
+
+#ifndef __XDMPROTOCOL__
+#define __XDMPROTOCOL__
+
+#include <ecom.h>
+#include <e32base.h>
+#include "XdmEngine.h"
+#include "XdmDocument.h"
+#include "XdmProtocolInfo.h"
+
+//Idle timeout value for the protocol implementation in seconds
+const TInt KDefaultIdleTimeout = 10;
+
+/**
+* A helper class for parameter passing from
+* the XDM engine to the protocol implementation
+*/
+NONSHARABLE_CLASS( TXdmProtocolParams )
+ {
+ public:
+
+ /**
+ * C++ constructor
+ *
+ * @param CXdmEngine& Engine handle
+ * @param CXdmProtocolInfo Protocol info handle
+ * @return TXdmProtocolParams
+ */
+ TXdmProtocolParams( const CXdmEngine& aXdmEngine,
+ const CXdmProtocolInfo& aProtocolInfo ) :
+ iXdmEngine( aXdmEngine ),
+ iProtocolInfo( aProtocolInfo ){}
+
+
+ public: //Data
+
+ const CXdmEngine& iXdmEngine;
+ const CXdmProtocolInfo& iProtocolInfo;
+ };
+
+//FORWARD DECLARATION
+class CXdmDocument;
+class CXdmDirectory;
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXdmProtocol ) : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS constructor.
+ *
+ * @param CXdmEngine& Reference to the engine
+ * @param CXdmProtocolInfo& Protocol information
+ * @return CXdmProtocol*
+ */
+ static CXdmProtocol* NewL( const CXdmEngine& aXdmEngine,
+ const CXdmProtocolInfo& aProtocolInfo );
+
+ /**
+ * C++ destructor.
+ *
+ */
+ virtual ~CXdmProtocol();
+
+ public:
+
+ /**
+ * Initialise the media used to transfer XDM data
+ *
+ * @param TInt Idle timeout
+ * @param TRequestStatus& Request status of the caller
+ * @return void
+ */
+ virtual void InitTransferMedium( TInt aIdleTimeout, TRequestStatus& aStatus ) = 0;
+
+ /**
+ * Is the transfer medium ready
+ *
+ * @return TBool Is the medium ready
+ */
+ virtual TBool IsTransferAvailable() const = 0;
+
+ /**
+ * Cancel initialisation of the transfer media.
+ *
+ * @return void
+ */
+ virtual void CancelTransferMediumInit() = 0;
+
+ /**
+ * Create a new document node.
+ *
+ * @return CXdmDocumentNode*
+ */
+ virtual CXdmDocumentNode* CreateDocumentNodeL() = 0;
+
+ /**
+ * Create a new document model
+ *
+ * @param TDesC& Name of the new document model
+ * @param TXdmDocType Type of the new document
+ * @return CXdmDocument*
+ */
+ virtual CXdmDocument* CreateDocumentL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType ) = 0;
+
+ /**
+ * Create a new directory model
+ *
+ * @param TDesC& Directory path
+ * @return CXdmDirectory*
+ */
+ virtual CXdmDirectory* CreateDirectoryL( const TDesC& aDirectoryPath ) = 0;
+
+ protected:
+
+ /**
+ * C++ constructor for derived classes.
+ *
+ * @return CXdmProtocol
+ */
+ CXdmProtocol();
+
+ private: //Data
+
+ TUid iDestructorKey;
+ };
+
+// ----------------------------------------------------
+// CXdmProtocol::CXdmProtocol
+//
+// ----------------------------------------------------
+//
+inline CXdmProtocol::CXdmProtocol()
+ {
+ }
+
+// ----------------------------------------------------
+// CXdmProtocol::~CXdmProtocol
+//
+// ----------------------------------------------------
+//
+inline CXdmProtocol::~CXdmProtocol()
+ {
+ REComSession::DestroyedImplementation( iDestructorKey );
+ }
+
+// ----------------------------------------------------
+// CXdmProtocol::NewL
+// Create a new protocol implementation
+// ----------------------------------------------------
+//
+inline CXdmProtocol* CXdmProtocol::NewL( const CXdmEngine& aXdmEngine,
+ const CXdmProtocolInfo& aProtocolInfo )
+ {
+ TAny* ptr = NULL;
+ TXdmProtocolParams params( aXdmEngine, aProtocolInfo );
+ ptr = REComSession::CreateImplementationL(
+ aProtocolInfo.ProtocolUid(), _FOFF( CXdmProtocol,
+ iDestructorKey ), ( TAny* )¶ms );
+ return ptr != NULL ? reinterpret_cast<CXdmProtocol*>( ptr ) : NULL;
+ }
+
+#endif //__XDMPROTOCOL__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_protocol_plugin_api/xdm_protocol_plugin_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="fda1ce6ba90f95e8669952f81a7abede" dataversion="1.0">
+ <name>XDM Protocol Plug-in API</name>
+ <description>Plug-in API for protocol specific XDM transport implementations.</description>
+ <type>c++</type>
+ <subsystem>XDMEngine</subsystem>
+ <libs>
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: XDM Settings API
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/XdmSettingsProperty.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmSettingsProperty.h)
+../inc/XdmSettingsApi.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmSettingsApi.h)
+../inc/XdmSettingsCollection.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmSettingsCollection.h)
+../inc/XdmEngineDomainCRKeys.h MW_LAYER_PLATFORM_EXPORT_PATH(XdmEngineDomainCRKeys.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/inc/XdmEngineDomainCRKeys.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Settings CenRep keys
+*
+*/
+
+
+
+
+
+#ifndef __XDMENGINEDOMAINCRKEYS__
+#define __XDMENGINEDOMAINCRKEYS__
+
+//Number of possible setting properties
+const TInt KXdmPropertyCount = 10;
+
+//UID of the XDM Settings Central Repository
+const TUid KCRUidXdmEngine = { 0x10207453 };
+
+//UID of the XCAP Protocol variation repository
+const TUid KCRUIDXDMEngineXcapLocal = { 0x10282384 };
+
+/*
+* First column: Identifies a settings collection
+*/
+const TUint32 KXdmSettingsId = 0x00000000;
+
+/*
+* Second column: OMA XDM 1 - Uniquely identifies the application
+*/
+const TUint32 KXDMAppId = 0x00000001;
+
+/*
+* Third column: OMA XDM 2 - User displayable name for the XDM service
+*/
+const TUint32 KXDMAppName = 0x00000002;
+
+/*
+* Fourth column: OMA XDM 3 - Identity of the XDM service provider
+*/
+const TUint32 KXDMProviderId = 0x00000003;
+
+/*
+* Fifth column: OMA XDM 4 - Access point used for the XCAP traffic
+*/
+const TUint32 KXDMNAPID = 0x00000004;
+
+/*
+* Sixth column: OMA XDM 5 - Reference to the SIP/IP core
+*/
+const TUint32 KXDMSipReference = 0x00000005;
+
+/*
+* Seventh column: OMA XDM 6 - The root of all XDM resources
+* (points to the aggregation proxy address)
+*/
+const TUint32 KXDMXcapRootURI = 0x00000006;
+
+/*
+* Eight column: OMA XDM 7 - HTTP digest username
+*/
+const TUint32 KXDMUserName = 0x00000007;
+
+/*
+* Ninth column: OMA XDM 8 - HTTP digest password
+*/
+const TUint32 KXDMPassword = 0x00000008;
+
+/*
+* Tenth column: OMA XDM 9 - Authentication method for XDMS over XCAP
+*/
+const TUint32 KXDMAuthType = 0x00000009;
+
+//************************ Other Settings ******************************
+
+/*
+* Maximum amount of cache data (in KB)
+*/
+const TUint32 KXDMXcapCacheSize = 0x00000000;
+
+#endif // __XDMENGINEDOMAINCRKEYS__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/inc/XdmSettingsApi.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Settings API
+*
+*/
+
+
+
+
+#ifndef __XDMSETTINGSAPI__
+#define __XDMSETTINGSAPI__
+
+#include <badesca.h>
+#include "XdmEngineDomainCRKeys.h"
+
+/**
+* The list of configurable XDM Settings
+**/
+enum TXdmSettingsProperty
+ {
+ EXdmPropSettingsId = KXdmSettingsId,
+ EXdmPropAppId = KXDMAppId,
+ EXdmPropName = KXDMAppName,
+ EXdmPropProvId = KXDMProviderId,
+ EXdmPropToNapId = KXDMNAPID,
+ EXdmPropToAppRef = KXDMSipReference,
+ EXdmPropUri = KXDMXcapRootURI,
+ EXdmPropAuthName = KXDMUserName,
+ EXdmPropAuthSecret = KXDMPassword,
+ EXdmPropAuthType = KXDMAuthType,
+ EXdmPropNotFound = KErrNotFound // for initialization
+ };
+
+//The authentication types = possible values for EXdmPropAuthType
+_LIT( KXdmAuthGaa, "GAA" );
+_LIT( KXdmAuthEarlyIms, "EARLY-IMS" );
+_LIT( KXdmAuthHttpDigest, "HTTP-DIGEST" );
+
+//Logging constants
+_LIT( KXdmSettingsLogDir, "XDM" );
+_LIT( KXdmSettingsLogFile, "SettingsApi.txt" );
+const TInt KXdmSettingsLogBufferMaxSize = 2000;
+
+//Forward declarations
+class CRepository;
+class CXdmSettingsCollection;
+
+//CLASS DECLARATION
+class TXdmSettingsApi
+ {
+ public:
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C static CDesCArray* CollectionNamesLC( RArray<TInt>& aSettingIds );
+
+ /**
+ * Set the XDM properties as a collection of settings
+ *
+ * @param CXdmSettingsCollection A collection of properties
+ * @return TInt The ID of the newly created collection
+ */
+ IMPORT_C static TInt CreateCollectionL( const CXdmSettingsCollection& aCollection );
+
+ /**
+ * Remove a collection from the Central Repository
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrNotFound if a collection of properties
+ * by the specified ID does not exist in the repository.
+ *
+ * @param TInt ID of the collection to be removed
+ * @return void
+ */
+ IMPORT_C static void RemoveCollectionL( TInt aSettingsId );
+
+ /**
+ * Create an individual property to the specified
+ * collection of properties.
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrAlreadyExists, if the property to be
+ * created already exists in the specified collection.
+ *
+ * - Leaves with KErrNotFound, if a property set by the
+ * specified ID cannot be found from the repository
+ *
+ * @param TInt ID of the target property set
+ * @param TDesC& Value for the property to be created
+ * @param TXdmSettingsProperty Name of the property
+ * @return void
+ */
+ IMPORT_C static void CreatePropertyL( TInt aSettingsId,
+ const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Remove an individual property from the specified
+ * collection of properties.
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrNotFound, if a property set by the
+ * specified ID cannot be found from the repository
+ *
+ * @param TInt Name of the target property set
+ * @param TXdmSettingsProperty Name of the property to remove
+ * @return void
+ */
+ IMPORT_C static void RemovePropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Update an individual property in a named property set
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrNotFound, if a property set by the
+ * specified ID cannot be found
+ *
+ * - Also note that an attempt to update a non-existent
+ * property effectively creates a new one.
+ *
+ * @param TInt ID of the target property set
+ * @param TDesC& New value for the property to be updated
+ * @param TXdmSettingsProperty Name of the property
+ * @return void
+ */
+ IMPORT_C static void UpdatePropertyL( TInt aSettingsId,
+ const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Return an XDM property set/collection
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrNotFound, if a property set by the
+ * specified ID cannot be found from the repository.
+ *
+ * @param TInt ID of the property set
+ * @return CDesCArray& Colletion of properties
+ */
+ IMPORT_C static CXdmSettingsCollection* SettingsCollectionL( TInt aSettingsId );
+
+ /**
+ * Return an individual XDM settings property
+ *
+ * NOTE:
+ *
+ * - Leaves with KErrNotFound, if a property set by the
+ * specified ID cannot be found from the repository.
+ *
+ * @param TInt ID of the target property set
+ * @param TXdmSettingsProperty Name of the property
+ * @return HBufC* Value of the property on top of CleanupStack
+ */
+ IMPORT_C static HBufC* PropertyL( TInt aSettingsId,
+ TXdmSettingsProperty aSingleProp );
+
+ private:
+
+ /**
+ * Write to the log file
+ *
+ * @param TRefByValue<const TDesC> Log string
+ * @return void
+ */
+ static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+
+ /**
+ * Find keys by their ID
+ *
+ * @param TInt ID of the desired property set
+ * @param CRepository* An opened repository
+ */
+ static RArray<TUint32> FindByIdL( TInt aSettingsId, CRepository* aRepository );
+
+
+ /**
+ * Find keys by their type
+ *
+ * @param CRepository* An opened repository
+ * @param TXdmSettingsProperty Type of the desired property set
+ */
+ static RArray<TUint32> FindByTypeL( CRepository* aRepository,
+ TXdmSettingsProperty aSingleProp );
+
+ /**
+ * Create a unique ID for a collection of settings
+ *
+ * @param CRepository* An opened repository
+ * @param TInt Number of the target row
+ * @return TInt32 A new Central Repository key
+ */
+ static TInt CreateUniqueIdL( CRepository* aRepository, TInt aRow );
+
+ /**
+ * Find the row for the specified collection of settings
+ *
+ * @param TInt the ID of the desired property set
+ * @param CRepository* An opened repository
+ * @return TInt Row number for the target property set
+ */
+ static TInt FindRowL( TInt aSettingsId, CRepository* aRepository );
+
+ /**
+ * Return the last row from the repository
+ *
+ * @param CRepository* An opened repository
+ * @param TInt32 Column
+ * @return TInt Row number for the last property set
+ */
+ static TInt LastRow( CRepository* aRepository );
+ };
+
+#endif //__XDMSETTINGSAPI__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/inc/XdmSettingsCollection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Settings collection
+*
+*/
+
+
+
+
+#ifndef __XDMSETTINGSCOLLECTION__
+#define __XDMSETTINGSCOLLECTION__
+
+#include <e32base.h>
+#include "XdmSettingsApi.h"
+
+class CXdmSettingsProperty;
+
+//CLASS DECLARATION
+class CXdmSettingsCollection : public CBase
+ {
+ public:
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C CXdmSettingsCollection();
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C void AppendL( const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C void RemoveL( TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C TPtrC Property( TXdmSettingsProperty aProperty ) const;
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C const CXdmSettingsProperty& Property( TInt aIndex ) const;
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C TInt Count() const;
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C virtual ~CXdmSettingsCollection();
+
+ private:
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ CXdmSettingsProperty* Find( TXdmSettingsProperty aProperty ) const;
+
+ private: //Data
+
+ RPointerArray<CXdmSettingsProperty> iPropCollection;
+ };
+
+#endif //__XDMSETTINGSCOLLECTION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/inc/XdmSettingsProperty.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM Settings property
+*
+*/
+
+
+
+
+#ifndef __XDMSETTINGSPROPERTY__
+#define __XDMSETTINGSPROPERTY__
+
+#include <e32base.h>
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS ( CXdmSettingsProperty ) : public CBase
+ {
+ public:
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ static CXdmSettingsProperty* NewL( const TDesC& aPropertyValue,
+ TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C TXdmSettingsProperty PropertyName() const;
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C TPtrC PropertyValue() const;
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ IMPORT_C virtual ~CXdmSettingsProperty();
+
+ private:
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ CXdmSettingsProperty( TXdmSettingsProperty aPropertyName );
+
+ /**
+ * Return the name of each settings collection
+ * stored in the repository
+ *
+ * @return CDesCArray* Names of all settings collections
+ */
+ void ConstructL( const TDesC& aPropertyValue );
+
+ private: //Data
+
+ HBufC* iPropertyValue;
+ TXdmSettingsProperty iPropertyName;
+ };
+
+#endif //__XDMSETTINGSPROPERTY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pressrv_plat/xdm_settings_api/xdm_settings_api.metaxml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="8503a59b7d1168096d466b6127d21284" dataversion="1.0">
+ <name>XDM Settings API</name>
+ <description>API for accessing and creating XDM settings.</description>
+ <type>c++</type>
+ <subsystem>XDMEngine</subsystem>
+ <libs>
+ <lib name="XdmSettingsApi.lib" />
+ </libs>
+ <release category="domain"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>yes</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/group/10275464.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM registery info for SIP/Presence Protocol Plugin
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+#include <ximpprotocolpluginifids.hrh>
+
+#include "presenceplugin_resource.hrh"
+
+
+
+// ---------------------------------------------------------------------------
+// ECOM registery info for Presence Framework ECOM hook
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ dll_uid = PRESENCEPLUGIN_DLL_UID_PRESENCE_PROTOCOL;
+
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // implemented interface
+ interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE;
+
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = PRESENCEPLUGIN_1_IMPLEMENTATION_UID;
+ version_no = PRESENCEPLUGIN_1_VERSION_NO;
+ display_name = PRESENCEPLUGIN_1_DISPLAY_NAME;
+ default_data = PRESENCEPLUGIN_1_DEFAULT_DATA;
+ opaque_data = PRESENCEPLUGIN_1_OPAQUE_DATA;
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for SIP/Simple Protocol Plugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+#ifdef GC_AREA_PARTIAL_INCLUDE_CHANGE_ON
+#else
+#endif
+
+../rom/simpledatamodeladapter.iby CORE_MW_LAYER_IBY_EXPORT_PATH(simpledatamodeladapter.iby)
+
+PRJ_MMPFILES
+presenceplugin.mmp
+#include "../simpleimplugin/group/bld.inf"
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/T_SIMPLEDataModelAdapter.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/group/presenceplugin.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for SIP/Simple Protocol Plugin
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include "presenceplugin_resource.hrh"
+
+TARGET presenceplugin.dll
+TARGETTYPE plugin
+
+UID PRESENCEPLUGIN_DLL_UID_ECOM_PLUGIN PRESENCEPLUGIN_DLL_UID_PRESENCE_PROTOCOL
+VENDORID VID_DEFAULT
+CAPABILITY CAP_ECOM_PLUGIN
+
+// RESOURCE
+START RESOURCE 10275464.rss
+TARGET presenceplugin
+TARGETPATH resource/plugins
+END
+
+SOURCEPATH ../src
+SOURCE presenceplugin.cpp
+SOURCE presencepluginconnection.cpp
+SOURCE presencepluginsession.cpp
+SOURCE presencepluginwinfo.cpp
+SOURCE presencepluginwatcher.cpp
+SOURCE presencepluginauthorization.cpp
+SOURCE presencepluginpublisher.cpp
+SOURCE presencepluginentitywatcher.cpp
+SOURCE presenceplugindata.cpp
+SOURCE presencepluginxdmutils.cpp
+SOURCE presencepluginxdmpresrules.cpp
+SOURCE presenceplugingroup.cpp
+SOURCE presencepluginwatcherinfo.cpp
+SOURCE presencepluginvirtualgroup.cpp
+SOURCE presenceconnectioninfo.cpp
+SOURCE presencepluginutility.cpp
+SOURCE presenceplugincontacts.cpp
+SOURCE presenceplugincontactstatehandler.cpp
+SOURCE presenceplugincontactstate.cpp
+SOURCE presenceplugincontactstateopen.cpp
+SOURCE presenceplugincontactstateresolve.cpp
+SOURCE presenceplugincontactstatesearch.cpp
+SOURCE presenceplugincontactstateend.cpp
+SOURCE presensepluginlocalstore.cpp
+
+USERINCLUDE .
+USERINCLUDE ../inc
+USERINCLUDE ../simpleimplugin/inc
+
+// Default system include paths for middleware layer modules.
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY euser.lib // Base
+LIBRARY ecom.lib
+LIBRARY simpleengine.lib
+LIBRARY estor.lib
+LIBRARY bafl.lib
+LIBRARY charconv.lib
+
+LIBRARY xdmengine.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY presencesettingsapi.lib
+
+LIBRARY efsrv.lib
+LIBRARY edbms.lib
+LIBRARY avkon.lib
+
+//presence cache
+LIBRARY presencecacheclient2.lib
+LIBRARY presencecacheutils.lib
+
+// access to service table
+LIBRARY serviceprovidersettings.lib
+
+// access to uiservicetabsettings
+LIBRARY vimpstsettings.lib
+
+// access to Virtual Phonebook contact database
+LIBRARY vpbkeng.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/group/presenceplugin_resource.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: resource definitions
+*
+*/
+
+#ifndef PRESENCEPLUGIN_RESOURCE_HRH
+#define PRESENCEPLUGIN_RESOURCE_HRH
+
+/**
+ * System wide UID 2:s for ECom plugin dlls.
+ */
+#define PRESENCEPLUGIN_DLL_UID_ECOM_PLUGIN 0x10009D8D
+
+/**
+ * Officially reserved UID 3 for the Presence Framework
+ * PRESENCE protocol dll.
+ */
+#define PRESENCEPLUGIN_DLL_UID_PRESENCE_PROTOCOL 0x10275464
+
+
+/**
+ * Resource file compatible defintions for ximp test protocols.
+ *
+ * This must be kept in-sync with definitions in
+ * "ximptestprotocols.h"
+ */
+
+#define PRESENCEPLUGIN_1_IMPLEMENTATION_UID 0x10282EF2
+#define PRESENCEPLUGIN_1_VERSION_NO 1
+#define PRESENCEPLUGIN_1_DISPLAY_NAME "IETF SIMPLE PRESENCE protocol"
+#define PRESENCEPLUGIN_1_DEFAULT_DATA "PRESENCE"
+
+// Protocol capabilities: "<tag1>value<tag2>value..."
+//
+// <p>Provider
+// <f>Feature id
+// <s>Supported schema
+//
+// Example:
+// "<p>Nokia<f>feat/pres/foo<f>feat/pres/bar<s>sip"
+//
+#define PRESENCEPLUGIN_1_OPAQUE_DATA "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip"
+
+
+#endif // SIMPLEPLUGIN_RESOURCE_HRH
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/mpresencepluginconnectionobs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef MPRESENCEPLUGINCONNECTIONOBS_H
+#define MPRESENCEPLUGINCONNECTIONOBS_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+#include <ximpprotocolpluginhostifids.hrh>
+
+class TXIMPRequestId;
+class MXIMPObjectFactory;
+class CPresencePluginWinfo;
+class MSimpleWinfo;
+class MXIMPProtocolConnectionHost;
+class CPresencePluginXdmUtils;
+class CPresencePluginWatcher;
+class MPresenceObjectFactory;
+class MProtocolPresenceDataHost;
+class MProtocolPresenceAuthorization;
+class CPresencePluginVirtualGroup;
+class CPresencePluginAuthorization;
+class CPresencePluginGroups;
+
+/**
+ * MPresencePluginConnectionObs
+ *
+ * presence engine connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( MPresencePluginConnectionObs )
+ {
+
+public:
+
+ enum TReqType
+ {
+ /** undefined */
+ ENoReq = 0,
+ /** Connection initializing */
+ EOpenSess,
+ /** Connection close */
+ ECloseSess,
+ /** Publish own data */
+ EPublish,
+ /** Subscribe Own data */
+ ESubscribeOwn,
+ /** Subscribe other user */
+ ESubscribeOther
+ };
+
+ /**
+ * CPresencePluginWatcher accessor
+ * @return CPresencePluginWatcher
+ */
+ virtual CPresencePluginWatcher* WatcherHandlerL() = 0;
+
+ /**
+ * Complete the request
+ *
+ * @param aType request type
+ * @param aStatus status
+ */
+ virtual void CompleteReq(TReqType aType, TInt aStatus ) = 0;
+
+ /**
+ * Complete the request
+ *
+ * @param aReqId ximp request id
+ * @param aStatus status
+ */
+ virtual void CompleteReq(TXIMPRequestId aReqId, TInt aStatus ) = 0;
+
+ /**
+ * XIMP Object Factory accessor
+ * @return ximp Object Factory
+ */
+ virtual MXIMPObjectFactory& ObjectFactory()=0;
+
+ /**
+ * XIMP Object Factory accessor
+ * @return PrFw Object Factory
+ */
+ virtual MPresenceObjectFactory& PresenceObjectFactoryOwn()=0;
+
+ /**
+ * XIMP presence authorization accessor
+ * @return PrFw Protocol Presence Authorization
+ */
+ virtual MProtocolPresenceAuthorization& PresenceAuthorization() = 0;
+
+ /**
+ * XIMP presence authorization accessor as own internal type
+ * @return Presence Authorization
+ */
+ virtual CPresencePluginAuthorization& InternalPresenceAuthorization() = 0;
+
+ /**
+ * Gets reference to
+ * MProtocolPresenceDataHost interface.
+ *
+ * Presence protocol connection implementation uses returned
+ * data host interface to manage the Presence connection's
+ * presence auhtorization data.
+ *
+ * @return MProtocolPresenceAuthorizationDataHost interface.
+ * Interface ownership is not returned caller.
+ * Returned interface is guaranteed to remain valid (usable)
+ * as long as this source interface.
+ */
+ virtual MProtocolPresenceDataHost& ProtocolPresenceHost() = 0;
+
+ /**
+ * CPresencePluginWinfo accessor
+ * @return CPresencePluginWinfo, ownership is not transferred.
+ */
+ virtual CPresencePluginWinfo* WinfoHandlerL()=0;
+
+ /**
+ * CPresencePluginWinfoObserver is terminated
+ * @param aReason reason code
+ */
+ virtual void WinfoTerminatedL( TInt aReason )=0;
+
+ /**
+ * Watcher info subscription notification is received
+ * @aWinfo notification content
+ */
+ virtual void WinfoNotification( MSimpleWinfo& aWinfo ) = 0;
+
+ /**
+ * Current registered SIP entity
+ */
+ virtual TPtrC8 CurrentSipPresentity8() = 0;
+
+ /**
+ * Access connection host
+ * @return MximpProtocolConnectionHost
+ */
+ virtual MXIMPProtocolConnectionHost* Host() = 0;
+
+ /**
+ * Current domain syntax accessor
+ */
+ virtual TPtrC16 CurrentDomain() = 0;
+
+ /**
+ * Access CPresencePluginXdmUtils
+ * @return CPresencePluginXdmUtils entity
+ */
+ virtual CPresencePluginXdmUtils* XdmUtilsL() = 0;
+
+ /**
+ * Get ETag
+ * @return TDesC8, etag value
+ */
+ virtual const TDesC8& GetETag() const = 0;
+
+ /**
+ * Set ETag
+ * @return none
+ */
+ virtual void SetETag( const TDesC8& aETag ) = 0;
+
+ /**
+ * Get client session time tupleId
+ * @return TInt, tuple value
+ */
+ virtual TInt GetTupleId() const = 0;
+
+ /**
+ * Set session time tupleId
+ * @return none
+ */
+ virtual void SetTupleId( const TInt aTupleId ) =0;
+
+ /**
+ * Get Stop publish state
+ * @return TBool, stop publish state
+ */
+ virtual TBool GetStopPublishState() = 0;
+
+ /**
+ * Is Stop publish called
+ * @return TBool, stop publish called state
+ */
+ virtual TBool IsStopPublishCalled() = 0;
+
+ /**
+ * Get Stop publish state
+ * @return TBool, stop publish state
+ */
+ virtual void SetStopPublishState( TBool aState ) = 0;
+
+ /**
+ * Get Stop publish state
+ * @return TBool, session status
+ */
+ virtual TBool GetSessionStatus( ) = 0;
+
+ /**
+ * Return instace of subcribed contact
+ * @return TBool, session status
+ */
+ virtual CPresencePluginVirtualGroup* SubscribedContacts( ) = 0;
+
+ /**
+ * Get grand request list subscribe state
+ */
+ virtual TBool GrandListState() = 0;
+
+ /**
+ * Terminate connection
+ */
+ virtual void TerminateConnectionL( ) = 0;
+
+ /**
+ * Return Groups API implemention
+ */
+ virtual CPresencePluginGroups& GroupsL( ) = 0;
+
+ /**
+ * Return service id
+ */
+ virtual TInt& ServiceId( ) = 0;
+ };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/mpresrulesasynchandler.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef __MPRESRULESASYNCHANDLER_H__
+#define __MPRESRULESASYNCHANDLER_H__
+
+class CXdmDocument;
+// Class declaration
+
+NONSHARABLE_CLASS( MPresRulesAsyncHandler )
+ {
+ public:
+
+ /**
+ * This method handles the async.
+ * call to function CPresenceXDM::UpdateToServerL
+ * and CPresenceXDM::UpdateAllFromServerL.
+ * Clients should implement this method to get a callback.
+ *
+ * @param aErrorCode, XDMengine error codes
+ */
+ virtual void HandlePresUpdateDocumentL(
+ TInt aErrorCode ) = 0;
+
+ };
+
+#endif //__MPRESRULESASYNCHANDLER_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceconnectioninfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCECONNECTIONARRAY_H
+#define CPRESENCECONNECTIONARRAY_H
+
+#include <e32base.h>
+#include "presencelogger.h"
+#include "presenceplugincommon.h"
+#include "presencepluginconnection.h"
+
+class MXIMPProtocolConnection;
+
+/**
+ * CPresencePlugin
+ *
+ * Implementation of CXIMPProtocolPluginBase
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+
+
+NONSHARABLE_CLASS( CPresenceConnectionInfo ) : public CBase
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param none
+ */
+ static CPresenceConnectionInfo* NewL(
+ MXIMPProtocolConnection* aConnection );
+
+ /**
+ * SetConnectionStatus()
+ *
+ * @since S60 3.2
+ * @param TConnectionStatus
+ * @return none
+ */
+ void SetConnectionStatus(
+ CPresencePluginConnection::TConnectionStatus aStatus );
+
+ /**
+ * SetConnectionETag()
+ *
+ * @since S60 3.2
+ * @param TDesC8 aETag
+ * @return none
+ */
+ void SetConnectionETag( const TDesC8& aETag );
+
+ /**
+ * GetConnectionStatus()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TConnectionStatus connection status
+ */
+ CPresencePluginConnection::TConnectionStatus GetConnectionStatus();
+
+ /**
+ * GetConnectionEtag()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TDesC8 ETag
+ */
+ TDesC8* GetConnectionEtag();
+
+ /**
+ * GetConnection()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return MXIMPProtocolConnection connection instance
+ */
+ MXIMPProtocolConnection* GetConnection();
+
+ /**
+ * IncreaseClientCount()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void IncreaseClientCount();
+
+ /**
+ * DecreaseClientCount()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DecreaseClientCount();
+
+ /**
+ * GenerateClientId()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt uniqueclient id
+ */
+ TInt GenerateClientId();
+
+ /**
+ * GenerateClientId()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt uniqueclient id
+ */
+ TInt GetClientId();
+
+ /**
+ * GenerateClientId()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt client count
+ */
+ TInt ClientCount();
+
+ /**
+ * Standard C++ destructor
+ */
+ ~CPresenceConnectionInfo();
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ */
+ CPresenceConnectionInfo( MXIMPProtocolConnection* aConnection );
+
+ public: // data
+
+ /**
+ * Connection ETag
+ * Own.
+ */
+ HBufC8* iETag;
+
+ /**
+ * Connection
+ * Own.
+ */
+ MXIMPProtocolConnection* iConnection;
+
+ /**
+ * Connection status
+ * Own.
+ */
+ CPresencePluginConnection::TConnectionStatus iConnectStatus;
+
+ /**
+ * Connection status
+ * Own.
+ */
+ TInt iClientCount;
+
+ /**
+ * Client id
+ * Own.
+ */
+ TUint iClientId;
+
+ SIMPLE_UNIT_TEST( T_CPresenceConnectionInfo )
+
+ };
+
+#endif // CPRESENCEPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencecontactscontextbase.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 20010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef M_MPRESENCECONTACTSCONTEXTBASE_H
+#define M_MPRESENCECONTACTSCONTEXTBASE_H
+
+
+class MVPbkContactLinkArray;
+class MVPbkContactLink;
+
+
+/**
+ * Base class to state context
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v5.0
+ */
+class MPresenceContactsContextBase
+ {
+
+public:
+
+ /**
+ * Open virtual phonebook contact stores
+ *
+ * @since S60 v5.0
+ */
+ virtual void OpenL() = 0;
+
+ /**
+ * Start virtual phonebook contacts search
+ *
+ * @since S60 v5.0
+ */
+ virtual void SearchL() = 0;
+
+ /**
+ * Return virtual phonebook contact links
+ *
+ * @since S60 v5.0
+ * @return virtual phonebook contact links
+ */
+ virtual const MVPbkContactLinkArray& ContactLinkArrayL() = 0;
+
+ /**
+ * Resolve virtual phonebook contact from contact link
+ *
+ * @since S60 v5.0
+ * @param aContactLink contact link to resolve
+ */
+ virtual void RetrieveContactL(
+ const MVPbkContactLink& aContactLink ) = 0;
+
+ };
+
+
+#endif // M_MPRESENCECONTACTSCONTEXTBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencelogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef DATAMODELADAPTERLOGGER_H
+#define DATAMODELADAPTERLOGGER_H
+
+#define DP_TP_PRINT(s) L##s
+#define DP_STRA_PRINT(s) DP_TP_PRINT(s)
+#define DP_STR_PRINT(t) DP_STRA_PRINT("[PrwAdapter]") L##t
+#define DP_LIT_PRINT(s) TPtrC((const TText *) DP_STR_PRINT(s))
+#ifdef _DEBUG
+ #include <e32svr.h>
+ #define _DEBUG_SIMPLE_DATAMODEL_ADAPTER
+#endif
+
+#ifdef _DEBUG_SIMPLE_DATAMODEL_ADAPTER
+ #define DP_SDA(a) {RDebug::Print(DP_LIT_PRINT(a));}
+ #define DP_SDA2(a, b) {RDebug::Print(DP_LIT_PRINT(a),b);}
+ #define DP_SDA3(a, b, c) RDebug::Print(DP_LIT_PRINT(a), b, c);
+#else
+ #define DP_SDA(a);
+ #define DP_SDA2(a, b);
+ #define DP_SDA3(a, b, c);
+#endif
+
+#ifdef SIMPLE_EUNIT
+#define SIMPLE_UNIT_TEST(ClassName) friend class ClassName;
+#else
+#define SIMPLE_UNIT_TEST(ClassName)
+#endif // SIMPLE_EUNIT
+
+#endif //DATAMODELADAPTERLOGGER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugin.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGIN_H
+#define CPRESENCEPLUGIN_H
+
+#include <e32base.h>
+#include <ximpprotocolpluginbase.h>
+
+#include "presencelogger.h"
+
+class CPresencePluginConnection;
+class MXIMPProtocolConnection;
+class MXIMPServiceInfo;
+class CPresenceConnectionInfo;
+
+/**
+ * CPresencePlugin
+ *
+ * Implementation of CXIMPProtocolPluginBase
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePlugin ) : public CXIMPProtocolPluginBase
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param none
+ */
+ static CPresencePlugin* NewL();
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param none
+ */
+ static CPresencePlugin* NewLC();
+
+ /**
+ * Standard C++ destructor
+ */
+ ~CPresencePlugin();
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ */
+ CPresencePlugin();
+
+ /**
+ * Delete connection from arrays
+ * @param TInt aIndex, array index
+ * @return none
+ */
+ void DeleteConnection( TInt aIndex );
+
+ public: // from base class MXIMPProtocolPlugin
+
+ /**
+ * Defined in a base class
+ */
+ void PrimeHost( MXIMPProtocolPluginHost& aHost );
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPProtocolConnection& AcquireConnectionL(
+ const MXIMPServiceInfo& aService,
+ const MXIMPContextClientInfo& aContextClient );
+
+ /**
+ * Defined in a base class
+ */
+ void ReleaseConnection( MXIMPProtocolConnection& aConnection );
+
+ public: // from base class MXIMPBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+ private: // Data
+
+ /**
+ * Prime host
+ * Own.
+ */
+ MXIMPProtocolPluginHost* iHost;
+
+ /**
+ * connection array
+ * Own.
+ */
+ RPointerArray< CPresencePluginConnection > iConnections;
+
+ /**
+ * connection data array
+ * Own.
+ */
+ RPointerArray< CPresenceConnectionInfo > iConnectionArray;
+
+ SIMPLE_UNIT_TEST( T_CPresencePlugin )
+
+ };
+#endif // CPRESENCEPLUGIN_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginauthorization.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,659 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINAUTHORIZATION_H
+#define CPRESENCEPLUGINAUTHORIZATION_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <protocolpresenceauthorization.h>
+#include "mpresencepluginconnectionobs.h"
+#include "presenceplugincontactsobs.h"
+#include "presencelogger.h"
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MPresenceInfoFilter;
+class MProtocolPresenceAuthorizationDataHost;
+class MSimpleWinfo;
+class CPresencePluginData;
+class CPresencePluginContacts;
+
+/**
+ * CPresencePluginAuthorization
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginAuthorization ) :
+ public CActive,
+ public MProtocolPresenceAuthorization,
+ public MPresencePluginContactsObs
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Current operation
+ */
+ enum TPluginAuthOperation
+ {
+ ENoOperation,
+ EGrantPresenceForPresentity,
+ EGrantPresenceForPresentityGroupMembers,
+ EWithdrawFromPresentity,
+ EWithdrawFromGroupMembers,
+ EGrantForEveryone,
+ EWithdrawFromEveryone,
+ ESubscribeBlockList,
+ EUnsubscribeBlockList,
+ EBlockPresentity,
+ EUnblockPresentity
+ };
+
+ /**
+ * Block state
+ */
+ enum TPluginAuthState
+ {
+ EStateIdle,
+ EStateBlocked,
+ EStateDoBlock,
+ EStateIsContactBlockedBuddyRequest,
+ EStateDoUnBlock,
+ EStatePresenceGranted,
+ EStateRemovePresentityFromGranted,
+ EStateAcceptBuddyRequest
+ };
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ */
+ static CPresencePluginAuthorization* NewL(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginAuthorization();
+
+ /**
+ * SetDataHost
+ *
+ * @since S60 3.2
+ * @param aDataHost, XIMP Plugin Authorization Data Host
+ */
+ void SetDataHost( MProtocolPresenceAuthorizationDataHost& aDataHost );
+
+ /**
+ * WinfoTerminatedL
+ *
+ * @since S60 3.2
+ * SIMPLE Winfo watcher sunscription is terminated
+ * @param aReason reason code
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * WINFO received from SIMPLE
+ * @since S60 3.2
+ * @param aWinfo WINFO
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * Return List subscribe state
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBool subscribe state
+ */
+ TBool ReturnListSubsState();
+
+ /**
+ * Returns plugin data handler.
+ *
+ * @since S60 5.0
+ * @param none
+ * @return CPresencePluginData data handler reference
+ */
+ CPresencePluginData& PluginData();
+
+ /**
+ * Internal grant operation for group operation.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, identity to be subscribed
+ * @param aClientStatus, client status to be completed
+ * @return none
+ */
+ void DoPerformGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Internal withdraw grant operation for group operation.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, identity to be ungranted
+ * @param aClientStatus, client status to be completed
+ * @return none
+ */
+ void DoPerformWithdrawPresGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Internal block operation for group operation.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, identity to be blocked
+ * @param aClientStatus, client status to be completed
+ * @return none
+ */
+ void DoPerformBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Internal unblock operation for group operation.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, identity to be unblocked
+ * @param aClientStatus, client status to be completed
+ * @return none
+ */
+ void DoPerformCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Resolve is blocked contact a blocked friend request
+ *
+ * @since S60 5.0
+ * @param aPresenceId, identity to be resolved
+ * @param aObserver, Returns results
+ * @param aStatus, client status
+ */
+ void IsBlockedContactFriendRequestL(
+ const TDesC& aPresenceId,
+ MPresencePluginContactsObs& aObserver,
+ TRequestStatus& aStatus );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aObs callback for complete requests
+ */
+ CPresencePluginAuthorization(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData );
+
+ void ConstructL();
+
+ public: // from base class MXIMPBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+ public: // from base class MXIMPProtocolPresenceAuthorization
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId );
+
+ // Granting presence information access to single presentities
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ // Granting presence information access to presentity group members
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromPresentityGroupMembersL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ // Granting presence information access to everyone
+
+ /**
+ * Defined in a base class
+ */
+ void DoGrantPresenceForEveryoneL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresenceGrantPifForEveryoneL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoWithdrawPresenceGrantFromEveryoneL(
+ TXIMPRequestId aReqId );
+
+ // Subscribe presence block list
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceBlockListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceBlockListL(
+ TXIMPRequestId aReqId );
+
+ // Blocking presence information access from single presentities
+
+ /**
+ * Defined in a base class
+ */
+ void DoBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ public: // MPresencePluginContactsObs
+
+ /**
+ * Request Complete
+ *
+ * @param aResult Result data returned, ownership changed to client.
+ * In operation EOperationIsPresenceStoredToContacts
+ * return type is TBool*.
+ * @param aOperation Operation type
+ * @param aError Completion error code
+ */
+ void RequestComplete( TAny* aResult,
+ TPresenceContactsOperation aOperation, TInt aError );
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * Save presentity id
+ *
+ * @since S60 3.2
+ * @param aPresentityId presentity id
+ * @param aFormatUri, attempt to format URI (set
+ * ETrue is aPresentityId is uri identity)
+ * @return none
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri );
+
+ /**
+ * Complete client request
+ *
+ * @since S60 3.2
+ * @param aStatus
+ * @return none
+ */
+ void CompleteXIMPReq( TInt aStatus );
+
+ /**
+ * Start XDM operation
+ *
+ * @since S60 3.2
+ * @param aId, XIMP identity
+ * @param aReqId, request id
+ * @param aOperation, plugin operation
+ * @return none
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation );
+
+ /**
+ * Start XDM operation
+ *
+ * @since S60 5.0
+ * @param aId, XIMP identity
+ * @param aOperation, plugin operation
+ * @param aClientStatus, client status to complete
+ * @return none
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TPluginAuthOperation aOperation,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Call actual xdm operation from xdm utils
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void CallActualXdmOperationL();
+
+ /**
+ * Subscribe block list
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SubscribeBlockListL( );
+
+ /**
+ * Unsubscribe block list
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UnSubscribeBlockListL();
+
+ /**
+ * Handle full winfo notification
+ *
+ * @since S60 3.2
+ * @param MSimpleWinfo winfo notification
+ * @return none
+ */
+ void HandleFullWinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * Handle partial winfo notification
+ *
+ * @since S60 3.2
+ * @param MSimpleWinfo winfo notification
+ * @return none
+ */
+ void HandlePartialWinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ /**
+ * Handle received grant request
+ *
+ * @since S60 3.2
+ * @param TDesC userid
+ * @return none
+ */
+ void CallHandlePresenceGrantRequestReceivedL( const TDesC& aUserId );
+
+ /**
+ * Handle obsolated grantrequest
+ *
+ * @since S60 3.2
+ * @param TDesC userid
+ * @return none
+ */
+ void CallHandlePresenceGrantRequestObsoletedL( const TDesC& aUserId );
+
+ /**
+ * Grant presence for presentity
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void GrantPresenceForPresentityL();
+
+ /**
+ * Withdraw from presentity
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void WithdrawFromPresentityL();
+
+ /**
+ * Set presentity blocked to XIMP
+ *
+ * @since S60 5.1
+ * @param none
+ * @return none
+ */
+ void SetPresentityBlockedToXIMPL();
+
+ /**
+ * Block presentity
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void BlockPresentityL();
+
+ /**
+ * Unblock presentity
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UnblockPresentityL();
+
+ /**
+ * Unsubscribe presentity presence
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UnsubscribePresentityPresenceL();
+
+ private: // Data
+
+ /**
+ * XIMP Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * XIMP Plugin Authorization Data Host
+ * Not own.
+ */
+ MProtocolPresenceAuthorizationDataHost* iDataHost;
+
+ /**
+ * XDM Settings id
+ * Own.
+ */
+ TInt iSettingsId;
+
+ /**
+ * PrFW request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * PrFW request id for own requests
+ * Own.
+ */
+ TXIMPRequestId iXIMPIdOwn;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed items.
+ * Own.
+ */
+ TBool iSubscribed;
+
+ /**
+ * Current operation
+ * Own.
+ */
+ TPluginAuthOperation iOperation;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * Whether Presence XDM is up-to-date
+ * Own.
+ */
+ TBool iXdmOk;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Authorization complete
+ * Own.
+ */
+ TBool iComplete;
+
+ /**
+ * Presence Data
+ * Not Own
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ /**
+ * Block state.
+ * Own.
+ */
+ TPluginAuthState iAuthState;
+
+ /*
+ * Virtual phone book contact database operations
+ * Own.
+ */
+ CPresencePluginContacts* iContacts;
+
+ /*
+ * Data Returned by CPresencePluginContacts
+ */
+ TBool iContactIsStored;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginAuthorization )
+ SIMPLE_UNIT_TEST( T_CPresencePluginXdmUtils )
+
+ };
+
+#endif // CPresencePluginAuthorization_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincommon.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#ifndef PRESENCEPLUGINCOMMON_H
+#define PRESENCEPLUGINCOMMON_H
+
+#include <e32std.h>
+
+/**
+ * common definitions for Presence Plugin
+ */
+
+//Define max tuple and person id integer
+const TInt KMaxNumber = 99999999;
+
+//Buf size defines
+
+const TInt KBufSize100 = 100;
+const TInt KBufSize200 = 200;
+const TInt KBufSize255 = 255;
+const TInt KBufSize20 = 20;
+const TInt KBufSize10 = 10;
+
+// Presence Plugin specifications
+
+_LIT( KPluginName, "CPresencePlugin");
+
+/** Nothing subscribed */
+const TUint KPresencePluginSubsNone = 0x00000000;
+/** Grant list subscribed */
+const TUint KPresencePluginSubsGrant = 0x00000001;
+/** Block list subscribed */
+const TUint KPresencePluginSubsBlock = 0x00000002;
+/** Winfo list subscribed */
+const TUint KPresencePluginSubsWinfo = 0x00000004;
+
+//XDM Resourcelist
+/** buddy list id */
+_LIT( KPresenceBuddyList, "buddylist");
+/** blocked list id */
+_LIT( KPresenceBlockedList, "blockedcontacts");
+/** for virtual online buddy group */
+_LIT( KPresenceOnlineBuddy ,"online_buddies");
+/** Subscribed buddys */
+_LIT( KPresenceSubcribedBuddys, "subs_buddys");
+
+//XDM Presencerules list
+/** Presence XDM block rule id */
+_LIT( KPresenceXdmBlockRule, "pres_blacklist");
+/** Presence XDM whitelist*/
+_LIT( KPresenceXdmWhiteList, "pres_whitelist");
+/** Presence XDM grant rule id */
+_LIT( KPresenceXdmGrantRule, "pres_whitelist");
+/** S60 Shared XDM list for granted entities */
+_LIT( KPresenceS60GrantedList, "s60_granted_list");
+
+//For localmode check
+_LIT(KLocalhost, "http://localhost");
+
+// when contact goes offline this is content of aBasicElement->ContentUnicodeL()
+_LIT( KClose ,"close");
+
+//For own presence status NOTIFY
+_LIT(KIndent, "t"); // for tupleId
+_LIT(KPersonId, "p"); // for person
+
+// Temporary hard coded values for presence cache 2 support. Common definitions needed!
+_LIT( KDefaultAvailableStatus, "available" );
+
+
+namespace NPresencePlugin
+ {
+ namespace NPresence
+ {
+ _LIT( KPresenceDisplayName, "display-name");
+ _LIT( KPresenceIndex, "index");
+ _LIT( KPresenceResourceLists, "resource-lists");
+ _LIT( KPresenceResourceList, "resource-list.xml");
+ _LIT( KPresenceConditions, "conditions");
+ _LIT( KPresenceIdentity, "identity");
+ _LIT( KPresenceRuleset, "ruleset" );
+ _LIT( KPresenceRule, "rule");
+ _LIT( KPresenceAction, "actions");
+ _LIT( KPresenceAllow, "allow");
+ _LIT8( KPresenceAllow8, "allow");
+ _LIT( KPresenceBlock, "block");
+ _LIT8( KPresenceBlock8, "block");
+ _LIT( KPresenceSub, "sub-handling");
+ _LIT( KPresencePresRules, "presrules");
+ _LIT( KPresenceList, "list");
+ _LIT( KPresenceName, "name");
+ _LIT( KPresenceEntry, "entry");
+ _LIT( KPresenceOne , "one");
+ _LIT( KPresencePerson, "person");
+ _LIT8( KPresencePerson8, "person");
+ _LIT8( KPresenceWatcher8, "watcher");
+ _LIT8( KPresenceWatherInfo8, "watcherinfo");
+ _LIT8( KPresenceWatcherList8, "watcher-list");
+ _LIT8( KPresenceStatus8, "status");
+ _LIT8( KPresenceActive8, "active");
+ _LIT8( KPresenceEvent8, "event");
+ _LIT8( KPresencePending8, "pending");
+ _LIT8( KPresenceBasic8, "basic");
+ _LIT( KPresenceBasic, "basic");
+ _LIT8( KPresenceStatusicon8, "status-icon");
+ _LIT8( KPresenceNote8, "note");
+ _LIT8( KPresenceSubscribe8, "subscribe");
+ _LIT( KPresenceUri, "uri");
+ _LIT8( KPresenceUri8, "uri");
+ _LIT8( KPresenceState8, "state");
+ _LIT8( KPresenceInstance8, "instance");
+ _LIT8( KPresenceTerminated8, "terminated");
+ _LIT8( KPresenceResource8, "resource");
+ _LIT8( KPresenceList8, "list");
+ _LIT8( KPresenceTuple8, "tuple");
+ _LIT( KPresenceTuple, "tuple");
+ _LIT( KPresenceId, "id");
+ _LIT8( KPresenceId8, "id");
+ _LIT( KPresenceActivities, "activities");
+ _LIT8( KPresenceActivities8, "activities");
+ _LIT8( KPresenceFull8, "full");
+ _LIT( KPresencePartial, "partial");
+ _LIT8( KPresencePartial8, "partial");
+ }
+ namespace NPresenceStates
+ {
+ _LIT( KPresenceOpen, "open");
+ _LIT( KPresenceClosed, "closed");
+ _LIT( KPresenceClose, "close");
+ _LIT( KPresenceOffline, "offline");
+ _LIT8( KPresenceOffline8, "offline");
+ _LIT( KPresenceAvailable, "available");
+ _LIT8( KPresenceAvailable8, "available");
+ _LIT( KPresenceUnknow, "unknown");
+ _LIT8( KPresenceUnknow8, "unknown");
+ _LIT( KPresenceBusy, "busy");
+ _LIT8( KPresenceBusy8, "busy");
+ _LIT( KPresenceOnThePhone, "on-the-phone");
+ _LIT8( KPresenceOnThePhone8, "on-the-phone");
+ _LIT( KPresenceAway, "away");
+ _LIT8( KPresenceAway8, "away");
+ _LIT( KPresenceDoNotDisturb, "do-not-disturb");
+ _LIT8( KPresenceDoNotDisturb8, "do-not-disturb");
+ _LIT( KPresencePending, "pending" );
+ }
+ namespace NPresenceTransformations
+ {
+ _LIT( KPresenceTRUE, "TRUE");
+ _LIT( KPresenceFALSE, "FALSE");
+ _LIT( KPresenceTrasformations, "transformations");
+ _LIT( KPresenceProvideServices, "provide-services");
+ _LIT( KPresenceAllServices, "all-services");
+ _LIT( KPresenceProvidePersons, "provide-persons");
+ _LIT( KPresenceAllPersons, "all-persons");
+ _LIT( KPresenceProvidedevices, "provide-devices");
+ _LIT( KPresenceAlldevices, "all-devices");
+ _LIT( KPresenceProvideAllAttributes, "provide-all-attributes");
+ _LIT( KPresenceProvideActivities, "provide-activities");
+ _LIT( KPresenceProvideNote, "provide-note");
+ }
+ }
+
+#endif // PRESENCEPLUGINCOMMON_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginconnection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,642 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef PRESENCEPLUGINCONNECTION_H
+#define PRESENCEPLUGINCONNECTION_H
+
+#include <e32base.h>
+#include <ximpprotocolconnection.h>
+#include <protocolpresencefeatures.h>
+//Connection obs
+#include "mpresencepluginconnectionobs.h"
+#include "simpleimfeatures.h"
+#include "presencelogger.h"
+
+//FORWARD
+class MXIMPServiceInfo;
+class MXIMPObjectFactory;
+class MXIMPProtocolConnectionHost;
+class MProtocolPresenceWatching;
+class MProtocolPresencePublishing;
+class MProtocolPresentityGroups;
+class MProtocolPresenceAuthorization;
+class MProtocolPresenceFeatures;
+class MProtocolPresenceDataHost;
+class CPresencePluginSession;
+class CPresencePluginWinfo;
+class CPresencePluginWatcher;
+class CPresencePluginAuthorization;
+class CPresencePluginPublisher;
+class CPresencePluginXdmUtils;
+class CPresencePluginGroups;
+class CPresencePluginVirtualGroup;
+class CPresencePluginData;
+class CPresenceConnectionInfo;
+class MProtocolImFeatures;
+
+
+/**
+ * CPrecensePluginSession
+ *
+ * presence Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CPresencePluginConnection) : public CActive,
+ public MXIMPProtocolConnection,
+ public MProtocolPresenceFeatures,
+ public MPresencePluginConnectionObs
+ {
+ public:
+
+ enum TConnectionStatus
+ {
+ /** undefined */
+ ENotActive = 0,
+ /** Connection initializing */
+ EActive,
+ /** Connection close */
+ ETerminated
+ };
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aServiceInfo, XIMP service info
+ * @param aClientCtxInfo, XIMP contex client info
+ */
+ static CPresencePluginConnection* NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo );
+
+ /**
+ * Two-phased constructor loaded.
+ *
+ * @param aServiceInfo, XIMP service info
+ * @param aClientCtxInfo, XIMP contex client info
+ */
+ static CPresencePluginConnection* NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo,
+ const TDesC8& aETag );
+
+ /**
+ * Standard C++ destructor
+ */
+ ~CPresencePluginConnection();
+
+ /**
+ * Grand list subscribe state
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBool grand list subscribe state
+ */
+ TBool GrandListState( );
+
+ /**
+ * Set connection info array
+ *
+ * @since S60 3.2
+ * @param connection info
+ * @return none
+ */
+ void SetConnectionArray( CPresenceConnectionInfo* aArray );
+
+ /**
+ * Get connection info array
+ *
+ * @since S60 3.2
+ * @param none
+ * @return return info
+ */
+ CPresenceConnectionInfo* GetConnectionArray( );
+
+
+ /**
+ * Gets protocol interface. In error cases returns NULL
+ *
+ * @since S60 5.0
+ * @param none
+ * @return protocol interface
+ */
+ TAny* GetProtocolInterface( TInt aInterfaceId );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ */
+ CPresencePluginConnection( );
+
+ /**
+ * Performs the 2nd phase of construction.
+ *
+ * @param aService, XIMP service info
+ * @param aClientCtxInfo, XIMP contex client info
+ */
+ void ConstructL(
+ const MXIMPServiceInfo& aService,
+ const MXIMPContextClientInfo& aClientCtxInfo );
+
+ /**
+ * Performs the 2nd phase of construction. Overload
+ *
+ * @param aService, XIMP service info
+ * @param aClientCtxInfo, XIMP contex client info
+ */
+ void ConstructL(
+ const MXIMPServiceInfo& aService,
+ const MXIMPContextClientInfo& aClientCtxInfo,
+ const TDesC8& aETag );
+
+ private: //Own private functions
+
+ /**
+ * DeRegister
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DeRegister( );
+
+ /**
+ * CreateImFeaturesPlugin
+ *
+ * @since S60 5.0
+ * @param none
+ * @return none
+ */
+ void CreateImFeaturesPluginL();
+
+ /**
+ * DeleteImFeaturesPlugin
+ *
+ * @since S60 5.0
+ * @param none
+ * @return none
+ */
+ void DeleteImFeaturesPlugin();
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ public: // from base class MPrFwBase
+
+ TInt32 GetPresenceSetId() const;
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+ public:// from base class MPresencePluginConnectionObs
+
+ /**
+ * Return subscribed buddy virtual group
+ *
+ * @since S60 3.2
+ * @param none
+ * @return CPresencePluginVirtualGroup, virtual group
+ */
+ CPresencePluginVirtualGroup* SubscribedContacts();
+
+ /**
+ * Get Stop Publish state
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBOOL, Stop Publish state
+ */
+ TBool GetStopPublishState();
+
+ /**
+ * Is stop publish called
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBOOL, Stop Publish
+ */
+ TBool IsStopPublishCalled();
+
+ /**
+ * Set Stop Publish state
+ *
+ * @since S60 3.2
+ * @param aState, stop publish state TRUE/FALSE
+ * @return none
+ */
+ void SetStopPublishState( TBool aState );
+
+ /**
+ * Get Tuple id
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt, tupleid
+ */
+ TInt GetTupleId() const;
+
+ /**
+ * Set Tuple id
+ *
+ * @since S60 3.2
+ * @param aTupleId, generated tupleid
+ * @return none
+ */
+ void SetTupleId( const TInt aTupleId );
+
+ /**
+ * Get ETag
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TDesC8, Etag value
+ */
+ const TDesC8& GetETag() const;
+
+ /**
+ * Set ETag
+ *
+ * @since S60 3.2
+ * @param aEtag, Etag value
+ * @return none
+ */
+ void SetETag( const TDesC8& aETag );
+
+ /**
+ * Defined in a base class
+ */
+ void CompleteReq( TReqType aType, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void CompleteReq( TXIMPRequestId aReqId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPObjectFactory& ObjectFactory();
+
+ /**
+ * Defined in a base class
+ */
+ MPresenceObjectFactory& PresenceObjectFactoryOwn();
+
+ /**
+ * Defined in a base class
+ */
+ CPresencePluginWinfo* WinfoHandlerL();
+
+ /**
+ * Defined in a base class
+ */
+ CPresencePluginWatcher* WatcherHandlerL();
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoNotification( MSimpleWinfo& aWinfo );
+
+ /**
+ * Defined in a base class
+ */
+ TPtrC8 CurrentSipPresentity8();
+
+ /**
+ * Defined in a base class
+ */
+ CPresencePluginXdmUtils* XdmUtilsL();
+
+ /**
+ * Defined in a base class
+ */
+ TBool GetSessionStatus( );
+
+ /**
+ * Termiante connection
+ */
+ void TerminateConnectionL( );
+
+ /**
+ * Returns groups api implementation. Leaves if
+ * pointer not available.
+ */
+ CPresencePluginGroups& GroupsL();
+
+ /**
+ * Returns service id
+ */
+ TInt& ServiceId();
+
+ public: // from MXIMPProtocolConnection
+
+ /**
+ * Defined in a base class
+ */
+ MProtocolPresenceDataHost& ProtocolPresenceHost();
+
+ /**
+ * Defined in a base class
+ */
+ MProtocolPresenceFeatures& ProtocolPresenceFeatures();
+
+ /**
+ * PrimeHost
+ *
+ * @since S60 3.2
+ * @param [in] aHost
+ * Reference to host interface, what this MXIMPProtocolConnection
+ * instance must use to communicate back to Presence Framework
+ * direction.
+ */
+ void PrimeHost( MXIMPProtocolConnectionHost& aHost );
+
+ /**
+ * OpenSessionL
+ *
+ * @since S60 3.2
+ * @param [in] aReqId
+ * Request ID identifying the request. Presence protocol
+ * connection implementation must cache here given ID and
+ * use it when completing the request later through the
+ * MXIMPProtocolConnectionHost::HandleRequestCompleted().
+ */
+ void OpenSessionL( const MXIMPContextClientInfo& aClientCtxInfo,
+ TXIMPRequestId aReqId );
+
+ /**
+ * OpenSessionL
+ *
+ * @since S60 3.2
+ * @param [in] aReqId
+ * Request ID identifying the request. Presence protocol
+ * connection implementation must cache here given ID and
+ * use it when completing the request later through the
+ * MXIMPProtocolConnectionHost::HandleRequestCompleted().
+ */
+ void OpenSessionL( const TInt& aSettingsId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * CloseSession
+ *
+ * @since S60 3.2
+ * @param [in] aReqId
+ * Request ID identifying the request. Presence protocol
+ * connection implementation must cache here given ID and
+ * use it when completing the request later through the
+ * MXIMPProtocolConnectionHost::HandleRequestCompleted().
+ */
+ void CloseSession( const MXIMPContextClientInfo& aContextClient,
+ TXIMPRequestId aReqId );
+
+ /**
+ * GetSupportedFeaturesL
+ *
+ * @since S60 3.2
+ * @param [out] aFeatures
+ * Return parameter where to append supported
+ * presence protocol connection features.
+ * Feature IDs are defined in NXIMPFeature namespace.
+ */
+ void GetSupportedFeaturesL( CDesC8Array& aFeatures ) const;
+
+ /**
+ * PresenceWatching
+ *
+ * @since S60 3.2
+ * @return Requested interface.
+ * interface ownership is not returned caller.
+ */
+ MProtocolPresenceWatching& PresenceWatching();
+
+ /**
+ * PresencePublishing
+ *
+ * @since S60 3.2
+ * @return Requested interface.
+ * interface ownership is not returned caller.
+ */
+ MProtocolPresencePublishing& PresencePublishing();
+
+ /**
+ * PresentityGroups
+ *
+ * @since S60 3.2
+ * @return Requested interface.
+ * interface ownership is not returned caller.
+ */
+ MProtocolPresentityGroups& PresentityGroups();
+
+ /**
+ * PresenceAuthorization
+ *
+ * @since S60 3.2
+ * @return Requested interface.
+ * interface ownership is not returned caller.
+ */
+ MProtocolPresenceAuthorization& PresenceAuthorization();
+
+ /**
+ * PresenceAuthorization
+ *
+ * @since S60 3.2
+ * @return Requested interface as own type
+ * interface ownership is not returned caller.
+ */
+ CPresencePluginAuthorization& InternalPresenceAuthorization();
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPProtocolConnectionHost* Host();
+
+ /**
+ * Defined in a base class
+ */
+ TPtrC16 CurrentDomain();
+
+ /**
+ * Defined in a base class
+ */
+ MXIMPServiceInfo& ServiceInfo();
+
+ private: //data
+
+ /**
+ * Presence Engine session
+ * Own.
+ */
+ CPresencePluginSession* iSession;
+
+ /**
+ * CPresencePluginWinfo
+ * Own.
+ */
+ CPresencePluginWinfo* iPluginWinfo;
+
+ /**
+ * CPresencePluginWatcher
+ * Own.
+ */
+ CPresencePluginWatcher* iWatcher;
+
+ /**
+ * current request id
+ * Own
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * Host for connection.
+ * Not own.
+ */
+ MXIMPProtocolConnectionHost* iConnectionHost;
+
+ /**
+ * MXIMPProtocolPresenceauthorization implementation.
+ * Own.
+ */
+ CPresencePluginAuthorization* iAuth;
+
+ /**
+ * CSimplePluginPublisher
+ * Own.
+ */
+ CPresencePluginPublisher* iPublisher;
+
+ /**
+ * CSimplePluginGroups
+ * Own.
+ */
+ CPresencePluginGroups* iGroups;
+
+ /**
+ * CPresencePluginImFeatures
+ * Own.
+ */
+ CSimpleImFeatures* iImFeatures;
+
+ /**
+ * Current user SIP identity
+ * Own.
+ */
+ HBufC16* iSipPresentity;
+
+ /**
+ * XDM utils
+ * Own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * TupleId
+ * Own.
+ */
+ TInt iOwnTupleId;
+
+ /**
+ * Document Etag
+ * Own.
+ */
+ HBufC8* iETag;
+
+ /**
+ * Virtual groups
+ * Own
+ */
+ CPresencePluginVirtualGroup* iSubscribedBuddys;
+
+ /**
+ * Plugin Data
+ * Own.
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * Stop publish state
+ * Own
+ */
+ TBool iStopPublishState;
+
+ /**
+ * Grant list subscribe state
+ * Own
+ */
+ TBool iGrantListSubs;
+
+ /**
+ * Is stop publish called
+ * Own
+ */
+ TBool iStopPublishCall;
+
+ /**
+ * Terminated state called
+ * Own.
+ */
+ TBool iTerminatedCall;
+
+ /**
+ * Connection Array instance
+ * Own.
+ */
+ CPresenceConnectionInfo* iConnectionArray;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginConnection )
+ SIMPLE_UNIT_TEST( T_SIMPLEDataModelAdapter )
+ };
+
+#endif // PRESENCEPLUGINCONNECTION_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontacts.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,344 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTS_H
+#define C_CPRESENCEPLUGINCONTACTS_H
+
+
+#include <e32base.h>
+#include <mvpbkcontactfindobserver.h>
+#include <mvpbksinglecontactoperationobserver.h>
+#include <mvpbkcontactstorelistobserver.h>
+#include "presencecontactscontextbase.h"
+#include "presencelogger.h"
+
+class CVPbkContactManager;
+class MVPbkContactOperationBase;
+class MVPbkContactLinkArray;
+class MVPbkStoreContact;
+class CVPbkFieldTypeRefsList;
+class CPresencePluginContactStateHandler;
+class MPresencePluginContactsObs;
+
+
+/**
+ * CPrecensePluginContacts Operation states
+ */
+enum TPresenceContactsOperation
+ {
+ EOperationIsPresenceStoredToContacts
+ };
+
+
+/**
+ * Access to virtual phonebook contacts database
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CPresencePluginContacts ) :
+ public CActive,
+ public MVPbkContactStoreListObserver,
+ public MVPbkContactFindObserver,
+ public MVPbkSingleContactOperationObserver,
+ public MPresenceContactsContextBase
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aServiceId Service ID.
+ * @param aServiceName Service name
+ * @param aObserver Callback results
+ */
+ static CPresencePluginContacts* NewL(
+ TInt aServiceId,
+ const TDesC& aServiceName,
+ MPresencePluginContactsObs& aObserver );
+
+ /**
+ * Two-phased constructor.
+ * @param aServiceId Service ID.
+ * @param aServiceName Service name
+ * @param aObserver Callback results
+ */
+ static CPresencePluginContacts* NewLC(
+ TInt aServiceId,
+ const TDesC& aServiceName,
+ MPresencePluginContactsObs& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPresencePluginContacts();
+
+ /**
+ * Query to virtual bhonebook contacts database
+ * to ensure is the presence service stored to database
+ *
+ * Calls MPresencePluginContactsObs::RequestComplete() when comlete
+ *
+ * @since S60 v5.0
+ * @param aPresenceId Presence ID.
+ * @param aStatus Client status
+ */
+ void IsPresenceIdStoredL( const TDesC16& aPresenceId,
+ TRequestStatus& aStatus );
+
+protected:
+
+// from base class CActive
+
+ void RunL();
+
+ void DoCancel();
+
+ TInt RunError( TInt aError );
+
+// from base class MVPbkContactStoreListObserver
+
+ /**
+ * Called when the opening process is complete.
+ *
+ * Before this all stores have sent StoreReady or StoreUnavailable
+ * event. The client can not trust that all stores are available
+ * for use when this is called.
+ */
+ void OpenComplete();
+
+// from base class MVPbkContactStoreObserver ( from MVPbkContactStoreListObserver )
+
+ /**
+ * Called when a contact store is ready to use.
+ *
+ * @param aContactStore The store that is ready.
+ */
+ void StoreReady( MVPbkContactStore& aContactStore );
+
+ /**
+ * Called when a contact store becomes unavailable.
+ *
+ * Client may inspect the reason of the unavailability and decide
+ * whether or not it will keep the store opened (ie. listen to
+ * the store events).
+ *
+ * @param aContactStore The store that became unavailable.
+ * @param aReason The reason why the store is unavailable.
+ * This is one of the system wide error codes.
+ */
+ void StoreUnavailable( MVPbkContactStore& aContactStore,
+ TInt aReason );
+
+ /**
+ * Called when changes occur in the contact store.
+ *
+ * @see TVPbkContactStoreEvent
+ * @param aContactStore A store whose event it is.
+ * @param aStoreEvent The event that has occurred.
+ */
+ void HandleStoreEventL(
+ MVPbkContactStore& aContactStore,
+ TVPbkContactStoreEvent aStoreEvent );
+
+// from base class MVPbkContactFindObserver
+
+ /**
+ * Called when find is complete. Caller takes ownership of the results
+ * In case of an error during find, the aResults may contain only
+ * partial results of the find
+ *
+ * @param aResults Array of contact links that matched the find
+ * Callee must take ownership of this object in
+ * the start of the function, ie. in case the
+ * function leaves the results must be destroyed.
+ * The find operation can be destroyed at the end
+ * of this callback.
+ */
+ void FindCompleteL( MVPbkContactLinkArray* aResults );
+
+ /**
+ * Called in case the find fails for some reason. The find operation
+ * can be destroyed at the end of this callback.
+ *
+ * @param aError One of the system wide error codes.
+ * KErrNotReady if store is not ready (not open or unavailable)
+ */
+ void FindFailed( TInt aError );
+
+// from base class MVPbkSingleContactOperationObserver
+
+ /**
+ * Called when the operation is completed.
+ *
+ * A client has the operation as a member and it can delete the operation
+ * instance in this function call. If the implementation of the store
+ * calls the function from the operation instance it must not handle
+ * any member data after calling it.
+ *
+ * @param aOperation The completed operation.
+ * @param aContact The contact returned by the operation.
+ * A client must take the ownership immediately.
+ *
+ * NOTE:
+ * If you use CleanupStack for MVPbkStoreContact
+ * Use MVPbkStoreContact::PushL or
+ * CleanupDeletePushL from e32base.h.
+ * (Do Not Use CleanupStack::PushL(TAny*) because
+ * then the virtual destructor of the M-class
+ * won't be called when the object is deleted).
+ */
+ void VPbkSingleContactOperationComplete(
+ MVPbkContactOperationBase& aOperation,
+ MVPbkStoreContact* aContact );
+
+ /**
+ * Called if the operation fails.
+ *
+ * A client has the operation as a member and it can delete the operation
+ * instance in this function call. If the implementation of the store
+ * calls the function from the operation instance it must not handle
+ * any member data after calling it.
+ *
+ * @param aOperation The failed operation.
+ * @param aError An error code of the failure.
+ */
+ void VPbkSingleContactOperationFailed(
+ MVPbkContactOperationBase& aOperation,
+ TInt aError );
+
+// from base class MPresenceContactsContextBase
+
+ /**
+ * Open virtual phonebook contact stores
+ *
+ * @since S60 v5.0
+ */
+ void OpenL();
+
+ /**
+ * Start virtual phonebook contacts search
+ *
+ * @since S60 v5.0
+ */
+ void SearchL();
+
+ /**
+ * Return virtual phonebook contact links
+ *
+ * @since S60 v5.0
+ * @return virtual phonebook contact links
+ */
+ const MVPbkContactLinkArray& ContactLinkArrayL();
+
+ /**
+ * Resolve virtual phonebook contact from contact link
+ *
+ * @since S60 v5.0
+ * @param aContactLink contact link to resolve
+ */
+ void RetrieveContactL(
+ const MVPbkContactLink& aContactLink );
+
+private:
+
+ CPresencePluginContacts( TInt aServiceId, MPresencePluginContactsObs& aObserver );
+
+ void ConstructL( const TDesC& aServiceName );
+
+ HBufC* ContactStoreNameL();
+
+private: //data
+
+ /**
+ * Service id.
+ */
+ TInt iServiceId;
+
+ /**
+ * Service name.
+ * Own.
+ */
+ HBufC* iServiceName;
+
+ /**
+ * Text used in search
+ * Own.
+ */
+ HBufC* iSearchText;
+
+ /**
+ * Observer.
+ * Not own.
+ */
+ MPresencePluginContactsObs* iObserver;
+
+ /**
+ * Presence Plugin Contacts Operation
+ */
+ TPresenceContactsOperation iOperation;
+
+ /**
+ * Virtual Phonebook field types
+ * Own.
+ */
+ CVPbkFieldTypeRefsList* iFieldTypeRefList;
+
+ /**
+ * Virtual Phonebook contact manager
+ * Own.
+ */
+ CVPbkContactManager* iContactManager;
+
+ /**
+ * VPbk operation
+ * Own.
+ */
+ MVPbkContactOperationBase* iContactOperation;
+
+ /**
+ * VPbk contact links
+ * Own.
+ */
+ MVPbkContactLinkArray* iContactLinkArray;
+
+ /**
+ * VPbk Store contact array
+ * Own.
+ */
+ RPointerArray<MVPbkStoreContact> iStoreContactArray;
+
+ /**
+ * state handler
+ * Own.
+ */
+ CPresencePluginContactStateHandler* iStateHandler;
+
+ /**
+ * Client status
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+
+ SIMPLE_UNIT_TEST( UT_CPresencePluginContacts )
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactsobs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef M_MPRESENCEPLUGINCONTACTSOBS_H
+#define M_MPRESENCEPLUGINCONTACTSOBS_H
+
+
+#include <e32std.h>
+#include "presenceplugincontacts.h"
+
+
+/**
+ * Callback from virtual phonebook contacts handler
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v5.0
+ */
+class MPresencePluginContactsObs
+ {
+
+public:
+
+ /**
+ * Informs the observer that the operation is completed
+ *
+ * @param aResult Result data returned,ownership is
+ * transferred to the client.
+ * In operation EOperationIsPresenceStoredToContacts
+ * return type is TBool*.
+ * @param aOperation Operation type
+ * @param aError Completion error code
+ */
+ virtual void RequestComplete( TAny* aResult,
+ TPresenceContactsOperation aOperation, TInt aError ) = 0;
+
+ };
+
+
+#endif // M_PRESENCEPLUGINCONTACTSOBS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstate.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATE_H
+#define C_CPRESENCEPLUGINCONTACTSTATE_H
+
+#include <e32base.h>
+
+class CPresencePluginContactStateHandler;
+class MPresenceContactsContextBase;
+
+/**
+ * Base class for presenceplugin contacts states
+ *
+ * @lib presenceplugin.dll
+ * @since S60 V5.0
+ */
+class CPresencepluginContactState : public CBase
+ {
+
+public:
+
+ CPresencepluginContactState( MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler );
+
+ virtual ~CPresencepluginContactState();
+
+ virtual void HandleL() = 0;
+
+ virtual void Complete();
+
+ virtual void Error( TInt aError );
+
+protected: // data
+
+ /**
+ * Context
+ * Not own.
+ */
+ MPresenceContactsContextBase* iContext;
+
+ /**
+ * State handler
+ * Not own.
+ */
+ CPresencePluginContactStateHandler* iStateHandler;
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstateend.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATEEND_H
+#define C_CPRESENCEPLUGINCONTACTSTATEEND_H
+
+
+#include "presenceplugincontactstate.h"
+
+/**
+ * CPresencePluginContactStateEnd
+ */
+class CPresencePluginContactStateEnd :
+ public CPresencepluginContactState
+ {
+
+public:
+
+ /**
+ * Constructor
+ */
+ CPresencePluginContactStateEnd( MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler );
+
+ virtual ~CPresencePluginContactStateEnd();
+
+ void HandleL();
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATEEND_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstatehandler.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATEHANDLER_H
+#define C_CPRESENCEPLUGINCONTACTSTATEHANDLER_H
+
+
+#include <e32base.h>
+
+class CPresencepluginContactState;
+
+/**
+ * States handler
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v5.0
+ */
+class CPresencePluginContactStateHandler : public CBase
+ {
+
+public:
+
+ static CPresencePluginContactStateHandler* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPresencePluginContactStateHandler();
+
+ /**
+ * Add states to queue
+ *
+ * @since S60 v5.0
+ * @param aState State to add, ownership is transferred.
+ */
+ void AddStateL( CPresencepluginContactState* aState );
+
+ /**
+ * Start State machine.
+ * States must be added before
+ *
+ * @since S60 v5.0
+ * @param aStatus Client status
+ */
+ void Start( TRequestStatus* aStatus );
+
+ /**
+ * States are progressed to end
+ * or error occured
+ *
+ * @since S60 v5.0
+ * @param aError Possible error
+ */
+ void Complete( TInt aError );
+
+ /**
+ * State getter
+ *
+ * @since S60 v5.0
+ * @return State
+ */
+ CPresencepluginContactState* State();
+
+ /**
+ * Order statehandler to move next state
+ *
+ * @since S60 v5.0
+ */
+ void ProgressToNextState();
+
+private:
+
+ CPresencePluginContactStateHandler();
+
+ void HandleNextState();
+
+private: // data
+
+ /**
+ * Current state index
+ * own.
+ */
+ TInt iCurrentStateIndex;
+
+ /**
+ * States to process
+ * own.
+ */
+ RPointerArray< CPresencepluginContactState > iStateArray;
+
+ /**
+ * Client status
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATEHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstateopen.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATEOPEN_H
+#define C_CPRESENCEPLUGINCONTACTSTATEOPEN_H
+
+
+#include "presenceplugincontactstate.h"
+
+/**
+ * CPresencePluginContactStateOpen
+ *
+ */
+class CPresencePluginContactStateOpen :
+ public CPresencepluginContactState
+ {
+
+public:
+
+ /**
+ * Constructor
+ */
+ CPresencePluginContactStateOpen( MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler );
+
+
+ virtual ~CPresencePluginContactStateOpen();
+
+ void HandleL();
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATEOPEN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstateresolve.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATERESOLVE_H
+#define C_CPRESENCEPLUGINCONTACTSTATERESOLVE_H
+
+
+#include "presenceplugincontactstate.h"
+
+/**
+ * CPresencePluginContactStateResolve
+ *
+ */
+class CPresencePluginContactStateResolve :
+ public CPresencepluginContactState
+ {
+
+public:
+
+ /**
+ * Constructor
+ */
+ CPresencePluginContactStateResolve( MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler );
+
+ virtual ~CPresencePluginContactStateResolve();
+
+ void HandleL();
+
+ void Complete();
+
+private: // Data
+
+ TInt iContactLinkIndex;
+
+ TInt iContactLinkCount;
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATERESOLVE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugincontactstatesearch.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINCONTACTSTATESEARCH_H
+#define C_CPRESENCEPLUGINCONTACTSTATESEARCH_H
+
+
+#include "presenceplugincontactstate.h"
+
+/**
+ * CPresencePluginContactStateSearch
+ *
+ */
+class CPresencePluginContactStateSearch :
+ public CPresencepluginContactState
+ {
+
+public:
+
+ /**
+ * Constructor
+ */
+ CPresencePluginContactStateSearch( MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler );
+
+ virtual ~CPresencePluginContactStateSearch();
+
+ void HandleL();
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINCONTACTSTATESEARCH_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugindata.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,470 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_PRESENCEPLUGINDATA_H
+#define C_PRESENCEPLUGINDATA_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <presenceinfo.h>
+#include <mpresencebuddyinfo2.h>
+
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class MXIMPObjectFactory;
+class MPresenceObjectFactory;
+class MSimpleDocument;
+class MPresenceInfo;
+class MSimplePresenceList;
+class MPresenceInfoFieldCollection;
+class MXIMPObjectCollection;
+class MPersonPresenceInfo;
+class MPresenceInfoField;
+class MSimpleElement;
+class MPresenceCacheWriter2;
+class MPresenceCacheReader2;
+
+/**
+ * CPresencePluginData
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginData ): public CBase
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param none
+ * @param none
+ */
+ static CPresencePluginData* NewL(
+ MPresencePluginConnectionObs& aObs,
+ TInt aServiceId );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param none
+ * @param none
+ */
+ static CPresencePluginData* NewLC(
+ MPresencePluginConnectionObs& aObs,
+ TInt aServiceId );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginData();
+
+ /**
+ * Convert to engine notification to MXIMPPresenceInfo
+ *
+ * @since S60 5.0
+ * @param aPresenceFactory object factory
+ * @param aPrInfo ximp info structure [out]
+ * @param aUnicodeNoteContent note field content [out]
+ */
+ void NotifyToBlockedToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent = KNullDesC );
+
+ /**
+ * Convert to engine notification to MXIMPPresenceInfo
+ *
+ * @since S60 3.2
+ * @param aFactory ximp Factory
+ * @param aPrInfo ximp info structure [out]
+ * @param aUnicodeNoteContent note field content [out]
+ */
+ void NotifyToPendingToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent = KNullDesC );
+
+ /**
+ * Convert to engine notification to MXIMPPresenceInfo
+ *
+ * @since S60 3.2
+ * @param aFactory ximp Factory
+ * @param aPrInfo ximp info structure [out]
+ * @param aUnicodeNoteContent note field content [out]
+ */
+ void NotifyTerminatedToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent = KNullDesC );
+
+ /**
+ * Convert to engine notification to MXIMPPresenceInfo
+ *
+ * @since S60 3.2
+ * @param aFactory ximp Factory
+ * @param aPrInfo ximp info structure [out]
+ * @param aUnicodeNoteContent note field content [out]
+ * @param aAvailability availability value for cache entry [out]
+ */
+ void NotifyToActiveToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent = KNullDesC,
+ NPresenceInfo::TAvailabilityValues aAvailability =
+ NPresenceInfo::EAvailable );
+
+ /**
+ * Convert to engine notification to MximpPresenceInfo
+ *
+ * @since S60 3.2
+ * @param aFactory ximp Factory
+ * @param aDocument notification
+ * @param aPrInfo ximp info structure [out]
+ */
+ void NotifyToPrInfoL(
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleDocument& aDocument,
+ MPresenceInfo& aPrInfo );
+
+ /**
+ * Extracts cache data entries from presence info object.
+ *
+ * @since S60 5.0
+ * @param aPrInfo ximp info structure
+ * @param aAvailability will store cache availability
+ * @param aExtendedAvailability will store extended availability
+ * @param aStatusMessage will store custom status message
+ */
+ void CacheEntriesFromPrInfo(
+ MPresenceInfo& aPrInfo,
+ MPresenceBuddyInfo2::TAvailabilityValues& aAvailability,
+ TPtr& aExtendedAvailability,
+ TPtr& aStatusMessage );
+
+ /**
+ * Convert to engine list notification to MximpPresenceInfo elements
+ *
+ * @since S60 3.2
+ * @param aFactory ximp Factory
+ * @param aList notification
+ * @param aEntities array of ximp info structure [out]
+ * @param aTerminated array of ximp info structure for
+ * terminated entities [out]
+ */
+ void NotifyListToPrInfoL(
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimplePresenceList& aList,
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MXIMPIdentity>& aTerminated );
+
+ /**
+ * AddPrPersToSimpleDocumentL
+ *
+ * @since S60 3.2
+ * Add subscribed or blocked person to document
+ * @param aInfo, presence info
+ * @param aDocument, xml document
+ * @param aSipId, sip identity
+ * @param aTupleId, client tupleId
+ */
+ void AddPrPersToSimpleDocumentL(
+ const MPersonPresenceInfo* aInfo,
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId,
+ TInt aTupleId );
+
+ /**
+ * Creates document.
+ *
+ * @since S60 3.2
+ * @param aDocument XDM document
+ * @param aSipId SIP profile id
+ * @param aStatusField, status enum field
+ * @param aMessageField, message field
+ */
+ void DoCreateDocumentL(
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId,
+ const MPresenceInfoField* aStatusField,
+ const MPresenceInfoField* aMessageField );
+
+ /**
+ * DoCheckBasicStatusValueL
+ *
+ * @since S60 3.2
+ * @param aField
+ * @return TPtrC basic status value
+ */
+ TPtrC DoCheckBasicStatusValueL(
+ const MPresenceInfoField& aField );
+
+ /**
+ * DoCheckActivitiesValueL
+ *
+ * @since S60 3.2
+ * @param aField
+ * @return TPtrC activities value
+ */
+ TPtrC8 DoCheckActivitiesValueL(
+ const MPresenceInfoField& aField );
+
+ /**
+ * DoCheckNoteValueL
+ *
+ * @since S60 3.2
+ * @param aField
+ * @return TPtrC activities value
+ */
+ TPtrC DoCheckNoteValueL(
+ const MPresenceInfoField& aField );
+
+ /**
+ * CreatePresenceUri8LC
+ *
+ * @since S60 3.2
+ * @param aPresentityUri
+ * @return presence URI
+ */
+ HBufC8* CreatePresenceUri8LC(
+ const TDesC8& aPresentityUri );
+
+ /**
+ * GenerateTupleId()
+ * Generate Tuple id for status document
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt, tupleid
+ */
+ TInt GenerateTupleId();
+
+
+ /**
+ * Removes prefix from uri.
+ *
+ * @since S60 3.2
+ * @param aPresentityUri, presentity url
+ * @return HBufC16, URL without prefix
+ */
+ HBufC16* RemovePrefixLC(
+ const TDesC& aPresentityUri );
+
+ /**
+ * Returns service id.
+ *
+ * @since S60 5.0
+ * @return TInt, service id related to this data instance
+ */
+ TInt ServiceId();
+
+ /**
+ * Resolve service name
+ *
+ * @since S60 5.0
+ * @param aServiceId Service Id.
+ * @return resolved service name, ownership returned to caller
+ */
+ HBufC* ServiceNameLC( TInt aServiceId ) const;
+
+ /**
+ * Writes status to presence cache
+ *
+ * @since S60 5.0
+ * @param aPresentityId, identity of status
+ * @param aAvailability, availability value to set
+ * @param aAvailabilityText, text for extended states
+ * @param aStatusMessage, status message from remote party
+ * @return None
+ */
+ void WriteStatusToCacheL(
+ const TDesC& aPresentityId,
+ MPresenceBuddyInfo2::TAvailabilityValues aAvailability,
+ const TDesC& aAvailabilityText,
+ const TDesC& aStatusMessage );
+
+ /**
+ * Removes cache entries for this service.
+ *
+ * @since S60 5.0
+ * @return None
+ */
+ void RemoveCacheL();
+
+ /**
+ * Removes cache entries for certain person.
+ *
+ * @since S60 5.0
+ * @param aIdentity, identity of presence entry
+ * @return None
+ */
+ void DeletePresenceL( const TDesC& aIdentity );
+
+ /**
+ * Stores own presence values to permanent storage.
+ *
+ * @since S60 5.0
+ * @param aServiceId, service id
+ * @param aAvailability, availability enumeration
+ * @param aStatusMessage, custom status message
+ * @return None
+ */
+ void StorePresenceOwnPresenceL(
+ const TUint aServiceId,
+ NPresenceInfo::TAvailabilityValues aAvailability,
+ const TDesC& aStatusMessage );
+
+ /**
+ * Reads document id from permanent storage.
+ *
+ * @since S60 5.0
+ * @param aServiceId, service id
+ * @param aDocumentId, document id
+ * @return None
+ */
+ void ReadDocumentIdL(
+ const TInt aServiceId,
+ TDes8& aDocumentId );
+
+ /**
+ * Deletes permanent data from storage
+ *
+ * @since S60 5.0
+ * @param aServiceId, service id
+ * @return None
+ */
+ void DeletePresenceVariablesL( const TInt aServiceId );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ */
+ CPresencePluginData(
+ MPresencePluginConnectionObs& aObs,
+ TInt aServiceId );
+
+ /**
+ * Standard C++ constructor
+ */
+ void ConstructL();
+
+ /**
+ * UserNoteToXIMPL
+ *
+ * @since S60 3.2
+ * This method not yet used
+ * @param aPresenceFactory ximp Factory
+ * @param aElement Simple elemnt
+ * @param aCollection Field Collection
+ */
+ void UserNoteToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection );
+
+ /**
+ * SingleUserStatusToXIMPL
+ *
+ * @since S60 3.2
+ * @param aPresenceFactory ximp Factory
+ * @param aElement Simple element
+ * @param aActivitiesElement Simple element
+ * @param aNoteElement Simple element for note elems (can be null)
+ * @param aCollection Field Collection
+ */
+ void SingleUserStatusToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aBasicElement,
+ MSimpleElement* aActivitiesElement,
+ MSimpleElement* aNoteElement,
+ MPresenceInfoFieldCollection& aCollection );
+
+ /**
+ * Returns <note> element or NULL if no <note> is found in the given
+ * element list. <note> element which matches best current locale is
+ * returned.
+ *
+ * @since S60 5.1
+ * @param aElements Element array.
+ * @return Best matching <note> or NULL.
+ */
+ MSimpleElement* ResolveNoteElementL(
+ const RPointerArray<MSimpleElement>& aElements ) const;
+
+ /**
+ * Checks if element has language attribute compatible with the
+ * current locale.
+ *
+ * @since S60 5.1
+ * @param aElement Simple element containing language attribute.
+ * @return ETrue if compatible language attribute is found,
+ * EFalse otherwise.
+ */
+ TBool IsElementLanguageValidForCurrentLocaleL(
+ MSimpleElement& aElement ) const;
+
+ /**
+ * Resolve cache used identifier
+ *
+ * @since S60 5.0
+ * @param aIdentity presence id without prefix
+ * @return resolved cache identifier, ownership returned to caller
+ */
+ HBufC* ResolveCacheXspIdentifierL( const TDesC& aIdentity ) const;
+
+
+ private: // data
+
+ /**
+ * Generated tuple/person id
+ * Own.
+ */
+ TInt iNumBuf;
+
+ /**
+ * ximp Plugin connection observer
+ * Not Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * Stores service id.
+ */
+ TInt iServiceId;
+
+ /**
+ * Writes service status to presence cache.
+ * Own.
+ */
+ MPresenceCacheWriter2* iPresenceCacheWriter;
+
+ /**
+ * Reads service status from presence cache.
+ * Own.
+ */
+ MPresenceCacheReader2* iPresenceCacheReader;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginData )
+ };
+
+#endif //C_PRESENCEPLUGINDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugindef.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#ifndef PRESENCEPLUGINDEF_H
+#define PRESENCEPLUGINDEF_H
+
+#include <e32std.h>
+
+
+/**
+ * C++ compatible definitions for XIMP PRESENCE protocol.
+ *
+ * This must be kept in-sync with definitions in
+ * "simpleplugin_resource.hrh"
+ */
+
+//XIMP primary test protocol
+const TInt K_PRESENCEPLUGIN_1_VERSION_NO = 1;
+_LIT( K_PRESENCEPLUGIN_1_DISPLAY_NAME, "XIMP PRESENCE protocol" );
+_LIT( K_PRESENCEPLUGIN_1_DEFAULT_DATA, "PRESENCE" );
+_LIT( K_PRESENCEPLUGIN_1_OPAQUE_DATA , "<p>Nokia<f>feat/pres/pub<f>feat/pres/fetch<f>feat/pres/subs<s>sip" );
+
+
+#endif // PRESENCEPLUGINDEF_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginentitywatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINENTITYWATCHER_H
+#define CPRESENCEPLUGINENTITYWATCHER_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <protocolpresencewatching.h>
+#include <msimplewatcherobserver.h>
+#include "presenceplugincommon.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class TXIMPRequestId;
+class MSimpleDocument;
+class MSimpleWatcher;
+class CPresencePluginWatcher;
+class MSimpleConnection;
+class CPresencePluginData;
+
+/**
+ * CPresencePluginEntityWatcher
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginEntityWatcher ): public CBase,
+ public MSimpleWatcherObserver
+ {
+ private:
+
+ /**
+ * Current operation
+ */
+ enum TPluginEntityWatcherOperation
+ {
+ EPluginIdle,
+ EPluginStop,
+ EPluginStart,
+ EPluginModify,
+ EPluginStartNotifyClient
+ };
+
+ public:
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ * @param aHost XIMP connection host
+ */
+ static CPresencePluginEntityWatcher* NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginWatcher& aWatcher,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginEntityWatcher();
+
+ /**
+ * Access Request id
+ *
+ * @since S60 3.2
+ * @return XIMP request id
+ */
+ TXIMPRequestId XIMPRequestId();
+
+ /**
+ * Access Presentity id
+ *
+ * @since S60 3.2
+ * @return Presentity id
+ */
+ TPtrC8 PresentityId();
+
+ /**
+ * Start subscribe
+ *
+ * @since S60 3.2
+ * @param aPresentityId presentity id
+ */
+ void StartSubscribeL( const TDesC8& aPresentityId );
+
+ /**
+ * Start subscribe
+ *
+ * @since S60 5.0
+ * @param aPresentityId presentity id
+ * @param aClientRequst client status to complete
+ */
+ void StartSubscribeL(
+ const TDesC8& aPresentityId,
+ TRequestStatus& aClientRequst );
+
+ /**
+ * Stop Subscrib
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void StopSubscribeL();
+
+ /**
+ * Stop subscribe
+ *
+ * @since S60 5.0
+ * @param aClientRequst client status to complete
+ */
+ void StopSubscribeL(
+ TRequestStatus& aClientRequst );
+
+ /**
+ * Set active status to XIMP
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SetActiveToXIMPL( const TDesC& aIdentity );
+
+ /**
+ * Set terminated status to XIMP
+ *
+ * @since S60 3.2
+ * @param aIdentity identity
+ * @return none
+ */
+ void SetTerminatedToXIMPL( const TDesC& aIdentity );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ *
+ * @param aObs, connection observer
+ * @param aConn, SIMPLE connection
+ * @param aWatcher, plugin watcher
+ */
+ CPresencePluginEntityWatcher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginWatcher& aWatcher );
+
+ /**
+ * Performs the 2nd phase of construction.
+ *
+ * @since S60 3.2
+ * @param none
+ * @param none
+ */
+ void ConstructL( CPresencePluginData* aPresenceData );
+
+ public: // from base class MSimpleWatcherObserver
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherReqCompleteL( TInt aOpId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherNotificationL( MSimpleDocument& aDocument );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherListNotificationL( MSimplePresenceList& aList );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherTerminatedL(
+ TInt aOpId, TInt aReason );
+
+ private:
+
+ /**
+ * Set active status to XIMP
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SetActiveToXIMPL( MSimpleDocument& aDocument );
+
+ /**
+ * Set terminated status to XIMP
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SetTerminatedToXIMPL( );
+
+ /**
+ * Set pending status to XIMP
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SetPendingToXIMPL( );
+
+ /**
+ * Completes client request
+ *
+ * @since S60 5.0
+ * @param aStatus, complete code
+ * @return none
+ */
+ void CompleteClientReq( TInt aStatus );
+
+ private: // Data
+
+ /**
+ * XIMP Plugin connection observer
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * SIMPLE engine connection
+ * Not Own.
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine watcher
+ * Own.
+ */
+ MSimpleWatcher* iWatcher;
+
+ /**
+ * PrFW request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * Subscribed entity Id.
+ * Own.
+ */
+ HBufC8* iEntityId;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * host class
+ * Own.
+ */
+ CPresencePluginWatcher& iPluginWatcher;
+
+ /**
+ * current pending operation
+ * Own.
+ */
+ TPluginEntityWatcherOperation iOperation;
+
+ /**
+ * instance to Presence data
+ * Own.
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * Client status.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginEntityWatcher )
+ SIMPLE_UNIT_TEST( T_CPresencePluginWatcher )
+ };
+
+#endif // CPRESENCEPLUGINENTITYWATCHER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presenceplugingroup.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINGROUP_H
+#define CPRESENCEPLUGINGROUP_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <protocolpresentitygroups.h>
+
+#include "presenceplugincommon.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPProtocolPresentityGroupsDataHost;
+class MXIMPObjectCollection;
+class CPresencePluginVirtualGroup;
+class CPresencePluginData;
+
+/**
+ * CPresencePluginGroups
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginGroups ) : public CActive,
+ public MProtocolPresentityGroups
+ {
+ public:
+
+ /**
+ * Current operation
+ */
+ enum TPluginGroupsOperation
+ {
+ ENoOperation,
+ ECreatePresentityGroup,
+ EDeletePresentityGroup,
+ EAddPresentityGroupMember,
+ EGrantPresentityGroupMember,
+ ERemovePresentityGroupMember,
+ EWithdrawGrantFromMember,
+ EGetListOfLists,
+ EGetListContent,
+ EBlockPresentityGroupMember,
+ EUnblockPresentityGroupMember
+ };
+
+ /**
+ * Current actibe object state
+ */
+ enum TPluginGroupsState
+ {
+ EPluginIdle,
+ EPluginInitXdm,
+ EPluginFetchRls,
+ EPluginAddGroupMember,
+ EPluginRemoveGroupMember,
+ EPluginCommitRls,
+ EPluginCommitXdm
+ };
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CPresencePluginGroups* NewL(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CPresencePluginGroups* NewLC(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginGroups();
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ */
+ CPresencePluginGroups(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData );
+
+ public: // from base class MXIMPBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+
+ public: // from base class MXIMPProtocolPresentityGroups
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCreatePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoDeletePresentityGroupL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupDisplayNameL(
+ const MXIMPIdentity& aGroupId,
+ const TDesC16& aDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoAddPresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aMemberDisplayName,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoRemovePresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupMemberDisplayNameL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& aMemberDisplayName,
+ TXIMPRequestId aReqId );
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * Save presentity id
+ *
+ * @since S60 3.2
+ * @param aPresentityId presentity id
+ * @param aFormatUri, attempt to format uri
+ * @return none
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri );
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ *
+ * @since S60 3.2
+ * @param aStatus error status
+ * @return none
+ */
+ void CompleteXIMPReq( TInt aStatus );
+
+ /**
+ * Start XDM operation
+ *
+ * @since S60 3.2
+ * @param aReqId, request id
+ * @param aOperation, groups operation
+ * @return none
+ */
+ void StartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ *
+ * @since S60 3.2
+ * @param aReqId, request id
+ * @param aOperation, groups operation
+ * @return none
+ */
+ void StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation );
+
+ /**
+ * Start XDM operation
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void StartXdmOperationL();
+
+ /**
+ * Call actual XDM operation
+ *
+ * @since S60 3.2
+ * @param aCompleteStatus, success or not
+ * @return none
+ */
+ void CallActualXdmOperationL( TInt aCompleteStatus );
+
+ /**
+ * Get List of lists
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void GetListOfListsL();
+
+ /**
+ * Get List content
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void GetListContentL();
+
+ /**
+ * Do Get BuddyList form XDM list
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DoGetBuddyListL();
+
+ /**
+ * Do Get subscribed BuddyList form virtual list
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DoGetSubscribedBuddyListL();
+
+ /**
+ * Removes cache entries for certain person.
+ *
+ * @since S60 5.0
+ * @param none
+ * @return none
+ */
+ void DeletePersonCacheL();
+
+ private: // Data
+
+ /**
+ * XIMP Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * XDM Settings id
+ * Own.
+ */
+ TInt iSettingsId;
+
+ /**
+ * PrFW request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * PrFW request id for own requests
+ * Own.
+ */
+ TXIMPRequestId iXIMPIdOwn;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * Current operation
+ * Own.
+ */
+ TPluginGroupsOperation iOperation;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Display name
+ * Own
+ */
+ HBufC* iDisplayName;
+
+ /**
+ * Active object state
+ * Own.
+ */
+ TPluginGroupsState iState;
+
+ /**
+ * Group request complete
+ * Own.
+ */
+ TBool iCompleted;
+
+ /**
+ * Virtual groups
+ * Not Own
+ */
+ CPresencePluginVirtualGroup* iSubscribedBuddies;
+
+ /**
+ * Plugin data.
+ * Not Own
+ */
+ CPresencePluginData* iPresenceData;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginGroups )
+ };
+
+#endif // CPRESENCEPLUGINGROUP_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginlanguagecodes.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef T_PRESENCEPLUGINLANGUAGECODES_H
+#define T_PRESENCEPLUGINLANGUAGECODES_H
+
+#include <e32base.h>
+
+/** ISO 639-1 language code length. */
+const TInt KIsoLanguageCodeLength = 2;
+
+/**
+ * Maps Symbian and ISO 639 language codes.
+ *
+ * @since S60 v5.1
+ */
+class TLanguageCodeMapping
+ {
+
+public:
+
+ /**
+ * Returns Symbian language code.
+ *
+ * @since S60 5.1
+ * @return Symbian language code.
+ */
+ TInt SymbianLanguageCode() const
+ { return iSymbianLanguageCode; }
+
+ /**
+ * Returns ISO language code.
+ *
+ * @since S60 5.1
+ * @return ISO language code.
+ */
+ TPtrC8 IsoLanguageCode() const
+ { return TPtrC8( iIsoLanguageCode ); }
+
+public: // data
+
+ /**
+ * Symbian language code as specified in e32lang.h.
+ */
+ TInt iSymbianLanguageCode;
+
+ /**
+ * ISO 639 language code.
+ */
+ TText8 iIsoLanguageCode[__Align8( KIsoLanguageCodeLength + sizeof( "" ) )];
+ };
+
+/** Mapping table for Symbian and ISO 639 language codes. */
+static const TLanguageCodeMapping KLanguageCodeMappings[] =
+ {
+ { ELangEnglish, "en" },
+ { ELangFrench, "fr" },
+ { ELangGerman, "de" },
+ { ELangSpanish, "es" },
+ { ELangItalian, "it" },
+ { ELangSwedish, "sv" },
+ { ELangDanish, "da" },
+ { ELangNorwegian, "no" },
+ { ELangFinnish, "fi" },
+ { ELangAmerican, "en" },
+ { ELangSwissFrench, "fr" },
+ { ELangSwissGerman, "de" },
+ { ELangPortuguese, "pt" },
+ { ELangTurkish, "tr" },
+ { ELangIcelandic, "is" },
+ { ELangRussian, "ru" },
+ { ELangHungarian, "hu" },
+ { ELangDutch, "nl" },
+ { ELangBelgianFlemish, "nl" },
+ { ELangAustralian, "en" },
+ { ELangBelgianFrench, "fr" },
+ { ELangAustrian, "de" },
+ { ELangNewZealand, "en" },
+ { ELangInternationalFrench, "fr" },
+ { ELangCzech, "cs" },
+ { ELangSlovak, "sk" },
+ { ELangPolish, "pl" },
+ { ELangSlovenian, "sl" },
+ { ELangTaiwanChinese, "zh" },
+ { ELangHongKongChinese, "zh" },
+ { ELangPrcChinese, "zh" },
+ { ELangJapanese, "ja" },
+ { ELangThai, "th" },
+ { ELangArabic, "ar" },
+ { ELangAfrikaans, "af" },
+ { ELangAlbanian, "sq" },
+ { ELangAmharic, "am" },
+ { ELangArabic, "ar" },
+ { ELangArmenian, "hy" },
+ { ELangTagalog, "tl" },
+ { ELangBelarussian, "be" },
+ { ELangBengali, "bn" },
+ { ELangBulgarian, "bg" },
+ { ELangBurmese, "my" },
+ { ELangCatalan, "ca" },
+ { ELangCroatian, "hr" },
+ { ELangCanadianEnglish, "en" },
+ { ELangInternationalEnglish,"en" },
+ { ELangSouthAfricanEnglish, "en" },
+ { ELangEstonian, "et" },
+ { ELangFarsi, "fa" },
+ { ELangCanadianFrench, "fr" },
+ { ELangScotsGaelic, "gd" },
+ { ELangGeorgian, "ka" },
+ { ELangGreek, "el" },
+ { ELangCyprusGreek, "el" },
+ { ELangGujarati, "gu" },
+ { ELangHebrew, "he" },
+ { ELangHindi, "hi" },
+ { ELangIndonesian, "id" },
+ { ELangIrish, "ga" },
+ { ELangSwissItalian, "it" },
+ { ELangKannada, "kn" },
+ { ELangKazakh, "kk" },
+ { ELangKhmer, "km" },
+ { ELangKorean, "ko" },
+ { ELangLao, "lo" },
+ { ELangLatvian, "lv" },
+ { ELangLithuanian, "lt" },
+ { ELangMacedonian, "mk" },
+ { ELangMalay, "ms" },
+ { ELangMalayalam, "ml" },
+ { ELangMarathi, "mr" },
+ { ELangMoldavian, "mo" },
+ { ELangMongolian, "mn" },
+ { ELangNorwegianNynorsk, "no" },
+ { ELangBrazilianPortuguese, "pt" },
+ { ELangPunjabi, "pa" },
+ { ELangRomanian, "ro" },
+ { ELangSerbian, "sr" },
+ { ELangSinhalese, "si" },
+ { ELangSomali, "so" },
+ { ELangInternationalSpanish,"es" },
+ { ELangLatinAmericanSpanish,"es" },
+ { ELangSwahili, "sw" },
+ { ELangFinlandSwedish, "sv" },
+ { ELangTamil, "ta" },
+ { ELangTelugu, "te" },
+ { ELangTibetan, "bo" },
+ { ELangTigrinya, "ti" },
+ { ELangCyprusTurkish, "tr" },
+ { ELangTurkmen, "tk" },
+ { ELangUkrainian, "uk" },
+ { ELangUrdu, "ur" },
+ { ELangVietnamese, "vi" },
+ { ELangWelsh, "cy" },
+ { ELangZulu, "zu" },
+ { ELangManufacturerEnglish, "en" },
+ { ELangSouthSotho, "st" },
+ { ELangBasque, "eu" },
+ { ELangGalician, "gl" },
+ { ELangEnglish_Apac, "en" },
+ { ELangEnglish_Taiwan, "en" },
+ { ELangEnglish_HongKong, "en" },
+ { ELangEnglish_Prc, "en" },
+ { ELangEnglish_Japan, "en" },
+ { ELangEnglish_Thailand, "en" },
+ { ELangMalay_Apac, "ms" }
+ };
+
+/** Number of language code mappings. */
+static const TInt KLanguageCodeMappingsCount =
+ sizeof ( KLanguageCodeMappings ) / sizeof ( TLanguageCodeMapping );
+
+#endif // T_PRESENCEPLUGINLANGUAGECODES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginlocalstore.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef C_CPRESENCEPLUGINLOCALSTORE_H
+#define C_CPRESENCEPLUGINLOCALSTORE_H
+
+
+#include <e32base.h>
+#include <d32dbms.h>
+#include <s32file.h>
+
+
+/**
+ * Service contacts local store reader
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v5.0
+ */
+class CPresencePluginLocalstore : public CBase
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aServiceName Service name
+ */
+ static CPresencePluginLocalstore* NewL( const TDesC& aServiceName );
+
+ /**
+ * Two-phased constructor.
+ * @param aServiceName Service name
+ */
+ static CPresencePluginLocalstore* NewLC( const TDesC& aServiceName );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPresencePluginLocalstore();
+
+ /**
+ * Seeks given id at contact column
+ *
+ * @since S60 v5.0
+ * @param aIdentifier Id. to search
+ * @return ETrue if found
+ */
+ TBool SeekRowAtContactColL( TInt32& aIdentifier );
+
+private:
+
+ CPresencePluginLocalstore();
+
+ void ConstructL( const TDesC& aServiceName );
+
+ TBool DbExists();
+
+ void OpenDbL();
+
+private: // data
+
+ /**
+ * File stream
+ */
+ RFs iFs;
+
+ /**
+ * Store database
+ */
+ RDbStoreDatabase iDb;
+
+ /**
+ * Table
+ */
+ RDbTable iTable;
+
+ /**
+ * Column definitions
+ * Own.
+ */
+ CDbColSet* iColset;
+
+ /**
+ * DB Store
+ * Own.
+ */
+ CPermanentFileStore* iFileStore;
+
+ /**
+ * Local database name
+ * Own.
+ */
+ HBufC* iLocalDBName;
+
+ };
+
+
+#endif // C_CPRESENCEPLUGINLOCALSTORE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginpublisher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,512 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINPUBLISHER_H
+#define CPRESENCEPLUGINPUBLISHER_H
+
+#include <e32base.h>
+
+#include <ximpbase.h>
+#include <protocolpresencepublishing.h>
+#include <msimplepublishobserver.h>
+#include <msimplewatcherobserver.h>
+#include <mpresencebuddyinfo2.h>
+#include <presenceinfo.h>
+
+#include "presencepluginentitywatcher.h"
+#include "presenceplugincommon.h"
+#include "mpresencepluginconnectionobs.h"
+#include "msimpleetagobserver.h"
+#include "presencelogger.h"
+
+class TXIMPRequestId;
+class MXIMPProtocolConnectionHost;
+class MPersonPresenceInfo;
+class MServicePresenceInfo;
+class MDevicePresenceInfo;
+class MSimplePublisher;
+class MSimpleDocument;
+class MSimpleElement;
+class MSimpleWatcher;
+class CPresencePluginXdmUtils;
+class CPresencePluginData;
+class CPresencePluginWatcherInfo;
+
+/**
+ * CPresencePluginPublisher
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginPublisher ): public CActive,
+ public MSimplePublishObserver,
+ public MSimpleWatcherObserver,
+ public MProtocolPresencePublishing,
+ public MSimpleETagObserver
+ {
+ public:
+
+ /**
+ * Current operation
+ */
+ enum TPluginPublishOperation
+ {
+ ENoOperation,
+ EPublishOwn,
+ ESubscribeOwn,
+ EUnsubscribeOwn,
+ ESubscribeWinfo,
+ EUnsubscribeWinfo,
+ EPublishReq
+ };
+
+ /**
+ * NewL
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CPresencePluginPublisher* NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginPublisher();
+
+ /**
+ * WinfoTerminatedL
+ *
+ * SIMPLE Winfo watcher sunscription is terminated
+ * @param aReason reason code
+ */
+ void WinfoTerminatedL( TInt aReason );
+
+ /**
+ * WINFO received from SIMPLE
+ * @param aWinfo WINFO
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aObs, connection observer
+ * @param aConn, SIMPLE connection
+ */
+ CPresencePluginPublisher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ /**
+ * Performs the 2nd phase of construction.
+ */
+ void ConstructL( CPresencePluginData* aPresenceData );
+
+ public: //Own public methods
+
+ /**
+ * StopPublishL()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void StopPublishL( TRequestStatus& aStatus );
+
+ /**
+ * Published()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ TBool Published();
+
+ public: // from MSimpleETagObserver
+
+ /**
+ * Defined in a base class
+ */
+ void NewETagL( const TDesC8& aVal );
+
+ public: // from base class MSimplePublishObserver
+
+ /**
+ * Defined in a base class
+ */
+ void PublishReqCompleteL( TInt aOpid, TInt aStatus);
+
+ /**
+ * Defined in a base class
+ */
+ void PublishTerminatedL( TInt aOpid );
+
+ public: // from base class MSimpleWatcherObserver
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherReqCompleteL( TInt aOpId, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherNotificationL( MSimpleDocument& aDocument );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherListNotificationL( MSimplePresenceList& aList );
+
+ /**
+ * Defined in a base class
+ */
+ void WatcherTerminatedL(
+ TInt aOpId, TInt aReason );
+
+ public: // from base class MximpBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+ public: // from base class MximpProtocolPresencePublishing
+
+ /**
+ * Defined in a base class
+ */
+ void DoPublishOwnPresenceL(
+ const MPresenceInfo& aOwnPresence,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribeOwnPresenceL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdateOwnPresenceSubscriptionPifL(
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribeOwnPresenceL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId );
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * Calls MximpProtocolConnectionHost callback
+ *
+ * @since S60 3.2
+ * @param aStatus error status
+ */
+ void CompleteXIMPReq( TInt aStatus );
+
+ /**
+ * Complete client request
+ *
+ * @since S60 3.2
+ * @param aStatus error status
+ */
+ void CompleteClientReq( TInt aStatus );
+
+ /**
+ * Initialize a document
+ */
+ void InitializeSimpleDocumentL( );
+
+ /**
+ * Add person information to the document.
+ *
+ * @since S60 3.2
+ * @param aPersInfo personal information
+ */
+ void AddSimpleDocumentPersL(
+ const MPersonPresenceInfo* aInfo );
+
+ /**
+ * Make a publish request
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void MakePublishReqL();
+
+ /**
+ * Start XDM initialization
+ *
+ * @since S60 3.2
+ * @param aReqId, XIMP request id
+ */
+ void StartXdmOperationL( TXIMPRequestId aReqId );
+
+ /**
+ * Delete watcher information
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DeleteWatchers();
+
+ /**
+ * Add Watcher if not exist
+ *
+ * @since S60 3.2
+ * @param aId, watcher identity
+ * @param aSipId, watcher sip URL
+ * @return none
+ */
+ void AddWatcherIfNotExistsL(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+ /**
+ * Remove Watcher if not exist
+ *
+ * @since S60 3.2
+ * @param aId, watcher identity
+ * @param aSipId, watcher sip URL
+ * @return none
+ */
+ void RemoveWatcherIfExists(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+ /**
+ * Make current watcher list
+ *
+ * @since S60 3.2
+ * @param none
+ * @return CDesCArrayFlat, watcher array
+ */
+ CDesCArrayFlat* MakeCurrentWatcherListLC();
+
+ /**
+ * Collect watcher from winfo
+ *
+ * @since S60 3.2
+ * @param aElems element array
+ * @return none
+ */
+ void CollectWatchersL(
+ RPointerArray<MSimpleElement>& aElems );
+
+ /**
+ * CreatePublisherL()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void CreatePublisherL();
+
+ /**
+ * Stores own presence status to presence cache
+ *
+ * @since S60 5.0
+ * @return none
+ */
+ void StoreOwnStatusToCacheL();
+
+ /**
+ * Resolves presence cache values according to provided
+ * unicode string content.
+ *
+ * @since S60 5.0
+ * @param aUnicodeContent, string containing info data
+ * @param aActivities, activities string
+ * @param aCacheAvailability, will store enumerated status
+ * @param aCacheAvailability, will store extended status string
+ * @param aXimpApiAvailability, will store ximp api availabiltiy
+ * @return TBool, was handled or not
+ */
+ TBool ResolveOwnCacheValues(
+ const TDesC& aUnicodeContent,
+ const TDesC& aActivities,
+ MPresenceBuddyInfo2::TAvailabilityValues& aCacheAvailability,
+ TPtr& aExtendedCacheAvailability,
+ NPresenceInfo::TAvailabilityValues& aXimpApiAvailability );
+
+ private: // Data
+
+ /**
+ * ximp Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * ximp Host.
+ * Not Own.
+ */
+ MXIMPProtocolConnectionHost* iHost;
+
+ /**
+ * SIMPLE engine connection
+ * Not Own.
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine publisher
+ * Own.
+ */
+ MSimplePublisher* iPublisher;
+
+ /**
+ * SIMPLE engine watcher
+ * Own.
+ */
+ MSimpleWatcher* iWatcher;
+
+ /**
+ * ximp request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed winfo
+ * Own.
+ */
+ TBool iSubscribed;
+
+ /**
+ * Subscribed own data
+ * Own.
+ */
+ TBool iSubscribedOwn;
+
+ /**
+ * Published own data
+ * Own.
+ */
+ TBool iPublished;
+
+ /**
+ * RePublish status
+ * Own.
+ */
+ TBool iRePublish;
+
+ /**
+ * Current operation
+ * Own.
+ */
+ TPluginPublishOperation iOperation;
+
+ /**
+ * Simple publish document
+ * Own.
+ */
+ MSimpleDocument* iDocument;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * WINFO watchers
+ * Own.
+ */
+ TDblQue<CPresencePluginWatcherInfo> iWatcherList;
+
+ /**
+ * Presence Data
+ * Not Own
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginPublisher )
+
+
+ };
+
+#endif // CPRESENCEPLUGINPUBLISHER_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginsession.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,306 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINSESSION_H
+#define CPRESENCEPLUGINSESSION_H
+
+
+#include <e32base.h>
+#include <msimpleconnectionobserver.h>
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+//FORWARD
+class MXIMPServiceInfo;
+class MPresencePluginConnectionObs;
+
+/**
+ * CPrecensePluginSession
+ *
+ * presence Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginSession ): public CActive,
+ public MSimpleConnectionObserver
+ {
+ public:
+
+ /**
+ * Current operation
+ */
+ enum TPluginSessionOperation
+ {
+ ENoOperation,
+ EInitializeXdm,
+ };
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aService, XIMP Service info
+ * @param aObs, Connection observer
+ */
+ static CPresencePluginSession* NewL(
+ const MXIMPServiceInfo& aService,
+ MPresencePluginConnectionObs& aObs );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginSession();
+
+ public: //New function
+
+ TInt32 GetPresenceSetId( ) const;
+
+ /**
+ * MSimpleConnection accessor
+ *
+ * @since S60 3.2
+ * @return MSImpleConnection instance
+ */
+ MSimpleConnection* SimpleConnection();
+
+ /**
+ * OpenSessionL
+ *
+ * @since S60 3.2
+ * Opens the SIP connection (registers when needed)
+ * @param none
+ * @return none
+ */
+ void OpenSessionL();
+
+ /**
+ * XDMSettings accessor
+ *
+ * @since S60 3.2
+ * @param none
+ * @return XDM Settings ID
+ */
+ TInt XdmSettingsId();
+
+ /**
+ * Current registered SIP entity
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TPrtC8, current sip presentity
+ */
+ TPtrC8 CurrentSipPresentity();
+
+ /**
+ * Domain syntax for current settings
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TPrtC16, current domain
+ */
+ TPtrC16 CurrentDomain();
+
+ /**
+ * Close Connection
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void CloseConnection();
+
+ /**
+ * Connection status
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBool, connection TRUE/FALSE
+ */
+ TBool ConnectionStatus();
+
+ /**
+ * Connection status
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBool, connection TRUE/FALSE
+ */
+ TBool IsXdmLocalmode();
+
+ /**
+ * Check XDM settings valid
+ *
+ * @since S60 5.0
+ * @param aServiceId, service if owning this session
+ * @return none
+ */
+ void CheckXDMSettingsL( TUint aServiceId );
+
+ /**
+ * Accessor to valid XdmUtils
+ *
+ * @since S60 3.2
+ * @param none
+ * @return XdmUtils instance
+ */
+ CPresencePluginXdmUtils* XdmUtilsL();
+
+ /**
+ * Returns service id owning this session.
+ *
+ * @since S60 5.0
+ * @param none
+ * @return TInt, service id
+ */
+ TInt& ServiceId();
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aObs, connection observer.
+ */
+ CPresencePluginSession(
+ MPresencePluginConnectionObs& aObs );
+
+ /**
+ * Performs the 2nd phase of construction.
+ *
+ * @param aService, XIMP service info
+ */
+ void ConstructL( const MXIMPServiceInfo& aService );
+
+ public:// from base class MSimpleConnectionObserver
+
+ /**
+ * Defined in a base class
+ */
+ void ConnectionStatusL(
+ MSimpleConnection::TSimpleState aState );
+
+ /**
+ * Defined in a base class
+ */
+ void RequestCompleteL( TInt aOpId, TInt aStatus );
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private: // Data
+
+ /**
+ * XIMP Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iObs;
+
+ /**
+ * Simple Engine connection.
+ * Own.
+ */
+ MSimpleConnection* iConnection;
+
+ /**
+ * Current Simple Engine operation id
+ * Own.
+ */
+ TInt iOpId;
+
+ /**
+ * Request type
+ * Own.
+ */
+ MPresencePluginConnectionObs::TReqType iType;
+
+ /**
+ * presence settings Id
+ * Own.
+ */
+ TInt iPresSettingId;
+
+ /**
+ * XDM Settings id
+ * Own.
+ */
+ TInt iXdmSetting;
+
+ /**
+ * Domain syntax for current settings
+ * Own,
+ */
+ HBufC16* iDomain;
+
+ /**
+ * Current User ID, User's SIP identity
+ * Own.
+ */
+ HBufC8* iUserId8;
+
+ /**
+ * Whether conncted to network
+ * Own.
+ */
+ TBool iSipConnected;
+
+ /**
+ * Whether conncted to network
+ * Own.
+ */
+ TBool iXdmConnected;
+
+ /**
+ * Xdm local mode
+ * Own.
+ */
+ TBool iXdmLocalMode;
+
+ /**
+ * XDM utils
+ * Own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Session operation.
+ */
+ TPluginSessionOperation iOperation;
+
+ /**
+ * Service id owning this session.
+ */
+ TInt iServiceId;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginSession )
+ SIMPLE_UNIT_TEST( T_CPresencePluginConnection )
+ };
+
+#endif // CPRESENCEPLUGINSESSION_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginutility.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef T_PRESENCEPLUGINUTILITY_H
+#define T_PRESENCEPLUGINUTILITY_H
+
+/**
+* Static utility functions for presence adapter.
+*
+* @lib presenceplugin.dll
+* @since S60 v5.0
+*/
+NONSHARABLE_CLASS( TPresencePluginUtility )
+ {
+
+ public:
+
+ /**
+ * Implementation for cleanup item.
+ * Resets and destroys array of the MXIMPIdentity
+ * entries and closes array.
+ * @param anArray RPointerArray pointer.
+ */
+ static void ResetAndDestroyIdentities( TAny* anArray );
+
+ };
+
+#endif // T_PRESENCEPLUGINUTILITY_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginvirtualgroup.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol, creating virtualgroup
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINVIRTUALGROUP_H
+#define CPRESENCEPLUGINVIRTUALGROUP_H
+
+#include <e32base.h>
+#include <e32std.h>
+#include <ximpbase.h>
+#include <badesca.h>
+
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class MXIMPObjectCollection;
+class CPresencePluginData;
+
+/**
+ * CPresencePluginVirtualGroup
+ *
+ * virtual groups
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginVirtualGroup ): public CBase
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ */
+ static CPresencePluginVirtualGroup* NewL(
+ MPresencePluginConnectionObs& aObs,
+ const TDesC16& aListName,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginVirtualGroup();
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aObs, Presence plugin connection
+ * @param aPresenceData, access to presence data
+ */
+ CPresencePluginVirtualGroup( MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Performs the 2nd phase of construction.
+ */
+ void ConstructL( const TDesC16& aListName );
+
+ /**
+ * IdentityExists()
+ *
+ * @since S60 3.2
+ * @param aIdentityUri, identity url
+ * @return TInt, return KErrNotFound if indentity not exists
+ */
+ TInt IdentityExists( const TDesC& aIdentityUri );
+
+ public:
+
+ /**
+ * GetVirtualIdentityArray()
+ *
+ * @since S60 3.2
+ * @param aColl, XIMP object collection
+ * @return none
+ */
+ CDesCArray* GetVirtualIdentityArray( );
+
+ /**
+ * GetOnlineEntitiesL()
+ *
+ * @since S60 3.2
+ * @param aColl, XIMP object collection
+ * @return none
+ */
+ void GetVirtualEntitiesL( MXIMPObjectCollection& aColl );
+
+ /**
+ * AddOnlineEntity()
+ *
+ * @since S60 3.2
+ * @param aIdentityUri, identity url
+ * @return none
+ */
+ void AddEntityL( const TDesC& aIdentityUri );
+
+ /**
+ * RemoveOnlineEntity()
+ *
+ * @since S60 3.2
+ * @param aIdentityUri, identity url
+ * @return none
+ */
+ void RemoveEntityL( const TDesC& aIdentityUri );
+
+ /**
+ * HandlePresentityGroupMemberAddedL()
+ *
+ * @since S60 5.1
+ * @param aIdentityUri, identity url
+ * @return none
+ */
+ void HandlePresentityGroupMemberAddedL( const TDesC& aIdentityUri );
+
+ private: // data
+
+ /**
+ * XIMP Plugin connection observer
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * Access to presence data.
+ * Not Own.
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * Identities/Uri of online Buddies.
+ */
+ CDesCArray* iVirtualMember;
+
+ /**
+ * list ident
+ * own
+ */
+ HBufC16* iListName;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginVirtualGroup )
+ SIMPLE_UNIT_TEST( T_CPresencePluginXdmUtils )
+
+ };
+
+#endif // CPRESENCEPLUGINVIRTUALGROUP_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginwatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,408 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINWATCHER_H
+#define CPRESENCEPLUGINWATCHER_H
+
+#include <e32base.h>
+#include <s32strm.h>
+#include <ximpbase.h>
+#include <protocolpresencewatching.h>
+
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPProtocolConnectionHost;
+class MSimpleConnection;
+class CPresencePluginEntityWatcher;
+class CPresencePluginData;
+
+/**
+ * CPresencePluginWatcher
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginWatcher ): public CActive,
+ public MProtocolPresenceWatching
+ {
+ public:
+
+ /**
+ * Current operation
+ */
+ enum TPluginWatcherOperation
+ {
+ EPluginUndef,
+ EPluginSubscribeGroup,
+ EPluginUnsubscribeGroup,
+ EPluginSubscribeSingle,
+ EPluginSubscribeByAdding,
+ EPluginUnSubscribeByRemoving
+ };
+
+ /**
+ * Current actibe object state
+ */
+ enum TPluginXdmState
+ {
+ EPluginIdle,
+ EPluginInitXdm,
+ EPluginFetchRls,
+ EPluginAddGroupMember,
+ EPluginRemoveGroupMember
+ };
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CPresencePluginWatcher* NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginData* aPresenceData );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginWatcher();
+
+ /**
+ * SIP Watcher is complets it's task.
+ * @param aStatus error status
+ * @return none
+ */
+ void CompleteWatcher( TInt aStatus );
+
+ /**
+ * Delete a single entity watcher
+ * @param aPresentityid presentity id
+ * @return none
+ */
+ void DeleteWatcher(
+ const TDesC8& aPresentityid );
+
+ /**
+ * SubscribeL()
+ *
+ * @since S60 5.1
+ * @param aIdentity presentity id to subscribe
+ * @return none
+ */
+ void SubscribeL( const TDesC& aIdentity );
+
+ /**
+ * SubscribeAllL()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SubscribeAllL();
+
+ /**
+ * UnSubscribeAllL()
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UnSubscribeAllL();
+
+ /**
+ * Subscribes presentity presence.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, presentity id
+ * @param aStatus, client status to complete
+ * @return none
+ */
+ void DoPerformSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aStatus );
+
+ /**
+ * Unsubscribes presentity presence.
+ *
+ * @since S60 5.0
+ * @param aPresentityId, presentity id
+ * @param aStatus, client status to complete
+ * @return none
+ */
+ void DoPerformUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aStatus );
+
+ /**
+ * Accept watcher to watcher list
+ *
+ * @since S60 5.1
+ * @param aWatcher, watcher
+ * @return none
+ */
+ void AcceptL( const CPresencePluginEntityWatcher* aWatcher );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aObs, Presence plugin connection
+ * @param aConn, SIMPLE connection
+ */
+ CPresencePluginWatcher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginData* aPresenceData );
+
+ public: // from base class MXIMPBase
+
+ /**
+ * Defined in a base class
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps );
+
+ /**
+ * Defined in a base class
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOps ) const;
+
+ /**
+ * Defined in a base class
+ */
+ TInt32 GetInterfaceId() const;
+
+ public: // from base class MXIMPProtocolPresenceWatching
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityPresenceSubscriptionPifL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoSubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& aPif,
+ TXIMPRequestId aReqId );
+
+ /**
+ * Defined in a base class
+ */
+ void DoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId );
+
+ public:
+
+ /**
+ * Save presentity id
+ *
+ * @since S60 3.2
+ * @param aPresentityId presentity id
+ * @param aFormatUri, attempt to format uri
+ * @return none
+ */
+ void SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri );
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback
+ *
+ * @since S60 3.2
+ * @param aStatus error status
+ * @return none
+ */
+ void CompleteXIMPReq( TInt aStatus );
+
+ /**
+ * Set XIMP request id
+ *
+ * @since S60 3.2
+ * @param aId, request id
+ * @return none
+ */
+ void SetXIMPId( TXIMPRequestId aId );
+
+ /**
+ * Check if ID matches with existing watcher
+ *
+ * @since S60 5.1
+ * @param aPresentityId presentity ID
+ * @return ETrue if matching watcher found
+ */
+ TBool MatchWatcherId( const TDesC8& aPresentityId ) const;
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * Match existing watcher
+ *
+ * @since S60 3.2
+ * @param aPresentityId presentity id
+ * @return watcher or NULL when not found
+ */
+ CPresencePluginEntityWatcher* MatchWatcherL(
+ const TDesC8& aPresentityId, TBool aCreate );
+
+ /**
+ * StartXdmOperationL
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void StartXdmOperationL();
+
+ private: // Data
+
+ /**
+ * XIMP Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * XIMP Host.
+ * Not Own.
+ */
+ MXIMPProtocolConnectionHost* iHost;
+
+ /**
+ * SIMPLE engine connection
+ * Not Own.
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine watchers
+ * Own.
+ */
+ RPointerArray<CPresencePluginEntityWatcher> iWatchers;
+
+ /**
+ * Watcher candidates
+ * Own.
+ */
+ RPointerArray<CPresencePluginEntityWatcher> iWatcherCandidates;
+
+ /**
+ * Current PrFW request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * XDM Utils
+ * Not own.
+ */
+ CPresencePluginXdmUtils* iXdmUtils;
+
+ /**
+ * Current presentity in progress
+ * Own.
+ */
+ HBufC16* iPresIdentity;
+
+ /**
+ * Presence data
+ * Own
+ */
+ CPresencePluginData* iPresenceData;
+
+ /**
+ * XDM state
+ */
+ TPluginXdmState iXdmState;
+
+ /**
+ * Whether the request is completed
+ * Own.
+ */
+ TBool iCompleted;
+
+ /**
+ * Current operation
+ * Own.
+ */
+ TPluginWatcherOperation iOperation;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginWatcher )
+ SIMPLE_UNIT_TEST( T_CPresencePluginXdmUtils )
+ };
+
+#endif // CPRESENCEPLUGINWATCHER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginwatcherinfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINWATCHERINFO_H
+#define CPRESENCEPLUGINWATCHERINFO_H
+
+#include <e32std.h>
+#include <ximpbase.h>
+
+#include "presencelogger.h"
+
+/**
+ * CPresencePluginWatcherInfo
+ *
+ * watcher info.
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginWatcherInfo ): public CBase
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ */
+ static CPresencePluginWatcherInfo* NewL(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginWatcherInfo();
+
+ /**
+ * Destructor
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void Destroy();
+
+ /**
+ * Match to given info
+ *
+ * @since S60 3.2
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ * @return ETrue if current entity matches to the parameters
+ */
+ TBool Match( const TDesC8& aId,
+ const TDesC& aSipId );
+ /**
+ * SipId
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TPtrC, sip Uri
+ */
+ TPtrC SipId();
+
+ static TInt LinkOffset();
+
+ private:
+
+ CPresencePluginWatcherInfo( );
+
+ /**
+ * Constructor
+ *
+ * @since S60 3.2
+ * @param aId watcher id
+ * @param aSipId watcher SIP identity
+ */
+ void ConstructL(
+ const TDesC8& aId,
+ const TDesC& aSipId );
+
+ public: // data
+
+ /**
+ * Linked list
+ * own
+ */
+ TDblQueLink iLink;
+
+ private: // data
+
+ /**
+ * ident id
+ * own
+ */
+ HBufC8* iId;
+
+ /**
+ * sip id
+ * own
+ */
+ HBufC* iSipId;
+
+ SIMPLE_UNIT_TEST( T_SIMPLEDataModelAdapter )
+
+ };
+
+#endif // CPRESENCEPLUGINWATCHERINFO_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginwinfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINWINFO_H
+#define CPRESENCEPLUGINWINFO_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <msimplewinfoobserver.h>
+
+#include "mpresencepluginconnectionobs.h"
+#include "presencelogger.h"
+
+class MSimpleWinfo;
+class TximpRequestId;
+class MSimpleWinfoWatcher;
+class MSimpleConnection;
+class MximpProtocolConnectionHost;
+class MPresencePluginConnectionObs;
+
+/**
+ * CPresencePluginWinfo
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginWinfo ): public CBase,
+ public MSimpleWinfoObserver
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param aObs callback for complete requests
+ * @param aConn Simple Engine connection
+ */
+ static CPresencePluginWinfo* NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginWinfo();
+
+ /**
+ * SetHost
+ * Set ximp Host
+ *
+ * @since S60 3.2
+ * @param aHost ximp Host
+ */
+ void SetHost( MXIMPProtocolConnectionHost* aHost );
+
+ /**
+ * SubscribeWinfoListL
+ *
+ * @since S60 3.2
+ * @param aReqId ximp req id
+ */
+ void SubscribeWinfoListL( TXIMPRequestId aReqId );
+
+ /**
+ * UnsubscribeWinfoListL
+ *
+ * @since S60 3.2
+ * @param aReqId ximp req id
+ */
+ void UnsubscribeWinfoListL( TXIMPRequestId aReqId );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ *
+ * @param aObs, plugin connection observer
+ * @param aConn, SIMPLE connection
+ */
+ CPresencePluginWinfo(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn );
+
+ /**
+ * Performs the 2nd phase of construction.
+ */
+ void ConstructL( );
+
+ public: // from base class MSimpleWinfoObserver
+
+ // Subscribe presence grant request list
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoReqCompleteL( TInt aOpid, TInt aStatus );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoTerminatedL(
+ TInt aOpid, TInt aReason );
+
+ /**
+ * Defined in a base class
+ */
+ void WinfoNotificationL( MSimpleWinfo& aWinfo );
+
+ private: // Data
+
+ /**
+ * ximp Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * ximp Host.
+ * Not Own.
+ */
+ MXIMPProtocolConnectionHost* iHost;
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * SIMPLE engine winfo watcher.
+ * Own.
+ */
+ MSimpleWinfoWatcher* iWinfoWatcher;
+
+ /**
+ * ximp request id
+ * Own.
+ */
+ TXIMPRequestId iXIMPId;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * Subscribed
+ * Own.
+ */
+ TBool iSubscribed;
+
+ /**
+ * Winfo subscribe completed
+ * Own.
+ */
+ TBool iWinfoCompleted;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginAuthorization )
+ SIMPLE_UNIT_TEST( T_CPresencePluginWinfo )
+ SIMPLE_UNIT_TEST( CSimpleDataModelAdapterTestObserver )
+ };
+
+#endif // CPRESENCEPLUGINWINFO_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginxdmpresrules.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,413 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINXDMPRESRULES_H
+#define CPRESENCEPLUGINXDMPRESRULES_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+
+#include "presenceplugincommon.h"
+#include "presencelogger.h"
+
+class CXdmEngine;
+class CXdmDocument;
+class CXdmDocumentNode;
+class TRequestStatus;
+class MPresRulesAsyncHandler;
+
+/**
+ * CPresencePluginXdmPresRules
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginXdmPresRules ): public CActive
+ {
+ public: // Constructor and destructor
+
+ /**
+ * XDM presrules state
+ */
+ enum TPluginPresRulesXdmState
+ {
+ EStateIdle,
+ EGetXdmRules,
+ EUpdateXdmRules,
+ ECreateXdmPresrules
+ };
+
+ /**
+ * Operation state for rules update
+ */
+ enum TPluginPresRulesUpdateState
+ {
+ EStateNoOperation,
+ EStateAddToWhiteList,
+ EStateAddToBlockList,
+ EStateRemoveFromWhiteList,
+ EStateRemoveFromBlackList,
+ EStateInitializeRules
+ };
+
+ /**
+ * Current operation
+ */
+ enum TPluginPresRulesXdmOperation
+ {
+ ENoOperation,
+ ECancelDocument,
+ EXdmInit,
+ EXdmDeleteAll,
+ EXdmCancel,
+ EXdmGetRulesFromServer,
+ EXdmInitialPresDoc,
+ EXdmUpdateRules,
+ EXdmUpdateRulesFromServer
+ };
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aXmdId xdm settings id
+ * @param aLocalMode, local or server mode TRUE/FALSE
+ */
+ static CPresencePluginXdmPresRules* NewL( const TInt aXmdId, TBool );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aXmdId xdm settings id
+ * @param aLocalMode, local or server mode TRUE/FALSE
+ */
+ static CPresencePluginXdmPresRules* NewLC(
+ const TInt aSettingId,
+ TBool aLocalMode );
+
+ /**
+ * Standard C++ destructor
+ */
+ virtual ~CPresencePluginXdmPresRules( );
+
+ public: // Own functions
+
+ /**
+ * Updates XDM rules into server
+ *
+ * @since S60 3.2
+ * @param aHandler, MPresRulesAssyncHandler
+ * @return TInt, Error code
+ */
+ TInt UpdateXdmRulesL( MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Add white list tag to presrules document
+ *
+ * @since S60 3.2
+ * @param aRoot, xml document root
+ * @return none
+ */
+ void AddWhiteListL( CXdmDocumentNode* aRoot );
+
+ /**
+ * Add black list tag to presrules document
+ *
+ * @since S60 3.2
+ * @param aRoot, xml document root
+ * @return none
+ */
+ void AddBlackListL( CXdmDocumentNode* aRoot );
+
+ /**
+ * Get presence rules from server
+ *
+ * @since S60 3.2
+ * @param aHandler, PresRules assync handler
+ * @return TInt, error code
+ */
+ TInt GetXdmRulesL( MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Making initial presence rules document
+ *
+ * @since S60 3.2
+ * @param aHandler, PresRules assync handler
+ * @return none
+ */
+ void MakeInitialRulesDocumentL(
+ MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Remove entiry from blocked rules
+ *
+ * @since S60 3.2
+ * @param aUri, entity url
+ * @aHandler, PresRules assync handler
+ * @return none
+ */
+ void RemoveEntityBlockedRulesL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Remove entity from presrules white list
+ *
+ * @since S60 3.2
+ * @param aUri, entity url
+ * @aHandler, PresRules assync handler
+ * @return none
+ */
+ void RemoveEntityFromWhiteListL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Add entity to presrules white list
+ *
+ * @since S60 3.2
+ * @param aUri, entity url
+ * @aHandler, PresRules assync handler
+ * @return none
+ */
+ void AddEntityToWhiteListL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Add entity to blocked rules
+ *
+ * @since S60 3.2
+ * @param aUri, entity url
+ * @aHandler, PresRules assync handler
+ * @return none
+ */
+ void AddEntityToBlockedRulesL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler );
+
+ /**
+ * Remove one from rule list
+ *
+ * @since S60 3.2
+ * @param aRule, presence rule name
+ * @param aUri, entity url
+ * @return none
+ */
+ void RemoveOneFromRuleL(
+ const TDesC& aRule,
+ const TDesC& aUri );
+
+ /**
+ * Add one to rule list
+ *
+ * @since S60 3.2
+ * @param aRule, presence rule name
+ * @param aUri, entity url
+ * @return none
+ */
+ void DoOneAddUserL(
+ const TDesC& aList,
+ const TDesC& aUri );
+
+ /**
+ * Update presence document from server
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TInt, error code
+ */
+ TInt UpdateFromServerL( MPresRulesAsyncHandler* const aHandler );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ * @param aXmdId, XDM settings id
+ */
+ CPresencePluginXdmPresRules( const TInt aXmdId );
+
+ /**
+ * Performs the 2nd phase of construction.
+ *
+ * @param aXmdId, xdm settings id
+ * @param aLocalMode, clinet localmode state
+ */
+ void ConstructL( const TInt aXmdId, TBool aLocalMode );
+
+ private: // own functions
+
+ /**
+ * GetRulesL
+ *
+ * @since S60 3.2
+ * @param aRuleArray, rule array
+ * @return TBool, rules found
+ */
+ CXdmDocumentNode* GetRulesL( const TDesC& aRule,
+ RPointerArray<CXdmDocumentNode>& aRuleArray );
+
+ /**
+ * Remove rule group from pres-rules document
+ *
+ * @since S60 3.2
+ * @param aRule, presence rule name
+ * @return none
+ */
+ void RemoveRuleGroupL( const TDesC& aRule );
+
+ /**
+ * Search list under parent
+ *
+ * @since S60 3.2
+ * @param aParent. document node
+ * @param aName, name of search
+ * @return none
+ */
+ CXdmDocumentNode* SearchListUnderParentL(
+ CXdmDocumentNode* aParent,
+ const TDesC& aName );
+
+ /**
+ * Create root if need
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void CreateRootIfNeededL();
+
+ static void ResetAndDestroy1( TAny* aPointerArray );
+ static void ResetAndDestroy2( TAny* aPointerArray );
+
+ /**
+ * Find rule from presrules xml
+ *
+ * @since S60 3.2
+ * @param aRule, rule name
+ * @return TBool
+ */
+ TBool FindRuleL( const TDesC& aRule, TBool aCreateRule );
+
+ /**
+ * Check if one already exist
+ *
+ * @since S60 3.2
+ * @param aList, listname
+ * @param aUri, entity url
+ * @return TBool
+ */
+ TBool CheckIfOneExistL(
+ const TDesC& aRule,
+ const TDesC& aUri );
+
+ /**
+ * Compare uri to attribute without prefix. Returns ETrue if match.
+ *
+ * @since S60 5.0
+ * @param aUri, entity url
+ * @parram aAttribute url attribute
+ * @return TBool
+ */
+ TBool CompareUriWithoutPrefixL(
+ const TDesC& aUri, const TDesC& aAttribute );
+
+ protected: // from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ private: // Data
+
+ /**
+ * XDM Engine
+ * Own.
+ */
+ CXdmEngine* iXdmEngine;
+
+ /**
+ * XDM Settings id
+ * Own.
+ */
+ TInt iSettingsId;
+
+ /**
+ * Presence rules document
+ * Own
+ */
+ CXdmDocument* iPresRulesDoc;
+
+ /**
+ * Current state
+ * Own.
+ */
+ TPluginPresRulesXdmState iXdmState;
+
+ /**
+ * TPluginPresRulesUpdateState
+ * Own.
+ */
+ TPluginPresRulesUpdateState iRulesUpdateState;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ /**
+ * Whether Presence XDM is up-to-date
+ * Own.
+ */
+ TBool iPresXdmOk;
+
+ /**
+ * Entity uri
+ * own
+ */
+ HBufC* iEntityUri;
+
+ /**
+ * Async request
+ * Own.
+ */
+ TPluginPresRulesXdmOperation iAsyncReq;
+
+ /**
+ * Async handler
+ * Own.
+ */
+ MPresRulesAsyncHandler* iAsyncHandler;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginXdmPresRules )
+ };
+
+#endif // CPRESENCEPLUGINXDMPRESRULES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/inc/presencepluginxdmutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,655 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#ifndef CPRESENCEPLUGINXDMUTILS_H
+#define CPRESENCEPLUGINXDMUTILS_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <protocolpresenceauthorization.h>
+#include "presenceplugincommon.h"
+#include "mpresrulesasynchandler.h"
+#include "presencelogger.h"
+#include "presenceplugincontactsobs.h"
+
+class CPresencePluginXdmPresRules;
+class TXIMPRequestId;
+class MXIMPIdentity;
+class MXIMPObjectCollection;
+class CXdmEngine;
+class CXdmDocument;
+class CXdmDocumentNode;
+class TRequestStatus;
+class MPresencePluginConnectionObs;
+
+/**
+ * CPresencePluginXdmUtils
+ *
+ * Simple Engine Connection
+ *
+ * @lib presenceplugin.dll
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CPresencePluginXdmUtils ) : public CActive,
+ public MPresRulesAsyncHandler,
+ public MPresencePluginContactsObs
+ {
+ public: // Constructor and destructor
+
+ /**
+ * Active object asynch states
+ */
+ enum TPluginXdmState
+ {
+ EStateIdle,
+ /** Get XDM lists 1*/
+ EGetXdmLists,
+ /** Create XDM lists */
+ ECreateXdmLists,
+ /** Get XDM lists only, no rules later */
+ EGetXdmListsOnly,
+ /** Create XDM lists only, no rules later */
+ ECreateXdmListsOnly,
+ /** Get RLS service */
+ EGetRlsServices,
+ /** Create RLS service */
+ ECreateRlsServices,
+ /** Update RLS service */
+ EUpdateRlsServices,
+ /** Get rules from server for GrantPresenceForPresentity */
+ EGetXdmRules,
+ /** Update rules to server for GrantPresenceForPresentity */
+ EUpdateXdmRules,
+ /** Update XDM List */
+ EUpdateXdmList,
+ /** Cancel XDM document operation */
+ ECancelDocument,
+ /** Get Block list */
+ EGetXdmBlockList,
+ /** Create presence rules */
+ ECreateXdmRules,
+ /** Subscripe block list */
+ ESubsBlockList,
+ EGetResourceListFromServer,
+ EUpdateBlockedContactPresenceCache
+ };
+
+ /**
+ * Current operation
+ */
+ enum TPluginXdmOperation
+ {
+ ENoOperation,
+ EXdmInit,
+ EXdmDeleteAll,
+ EXdmCancel,
+ EXdmAddUserToGroup,
+ EXdmAddGroupToGroup,
+ EXdmRemoveUserFromGroup,
+ EXdmRemoveGroupFromGroup,
+ EXdmGrantForAll,
+ EXdmWithdrawFromAll,
+ EXdmGetBlockedList,
+ EXdmCreateGroup,
+ EXdmDeleteGroup,
+ EXdmRlsFetch,
+ EXdmRlsAdd,
+ EXdmRlsRemove,
+ EXdmCommitXdm,
+ EXdmCommitRls,
+ EXdmGetBuddyList,
+ EXdmAddUserToRules,
+ EXdmRemoveUserFromRules
+ };
+
+ /**
+ * Operation state for rules update
+ */
+ enum TPluginPresRulesState
+ {
+ EStateNoOperation,
+ EStateAddToWhiteList,
+ EStateAddToBlockList,
+ EStateRemoveFromWhiteList,
+ EStateRemoveFromBlackList,
+ EStateInitializeRules
+ };
+
+ /**
+ * NewL
+ * @param aObs callback for complete requests
+ * @param aXdmId XDm settings id
+ */
+ static CPresencePluginXdmUtils* NewL(
+ MPresencePluginConnectionObs& aObs,
+ TInt aXmdId,
+ TBool aLocalMode );
+
+ virtual ~CPresencePluginXdmUtils();
+
+ /**
+ * Initialize XDMS and Presence XDM structures in network
+ *
+ * @since S60 3.2
+ * @param aStatus Request status of the caller
+ */
+ void InitializeXdmL( TRequestStatus& aStatus );
+
+ /**
+ * Initialize XDMS in network
+ *
+ * @since S60 3.2
+ * @param aStatus Request status of the caller
+ */
+ void InitializeXdmsOnlyL( TRequestStatus& aStatus );
+
+ /**
+ * Initialize Presence rules document only
+ *
+ * @since S60 3.2
+ * @param aStatus Request status of the caller
+ */
+ void InitializePresRulesL( );
+
+ /**
+ * Add entity to granted list
+ *
+ * @since S60 3.2
+ * @param aUri, entity URL
+ * @param aStatus, request status
+ * @return none
+ */
+ void AddEntityToGrantedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus );
+
+ /**
+ * Remove entity from granted list
+ *
+ * @since S60 3.2
+ * @param aUri, entity URL
+ * @param aStatus, request status
+ * @return none
+ */
+ void RemoveEntityFromGrantedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus );
+
+ /**
+ * Remove entity from blocked list
+ *
+ * @since S60 3.2
+ * @param aName, entity URL
+ * @param aStatus, request status
+ * @return none
+ */
+ void RemoveEntityFromBlockedL(
+ const TDesC& aName,
+ TRequestStatus& aStatus );
+
+ /**
+ * Add entity to blocked list
+ *
+ * @since S60 3.2
+ * @param aUri, entity URL
+ * @param aStatus, request status
+ * @return none
+ */
+ void AddEntityToBlockedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus );
+
+ /**
+ * Get (subscribe) Block List
+ *
+ * @since S60 3.2
+ * @param aMembers, member list array
+ * @return none
+ */
+ void SubscribeBlockListL( RPointerArray<MXIMPIdentity>& aMembers );
+
+ /**
+ * Get (subscribe) Buddy List
+ *
+ * @since S60 3.2
+ * @param aMembers, member list array
+ * @return none
+ */
+ void SubscribeBuddyListL( RPointerArray<MXIMPIdentity>& aMembers );
+
+ /**
+ * GetUserListsL
+ *
+ * @since S60 3.2
+ * @param aList, List name
+ * @param aColl, XIMP object collection
+ */
+ void GetEntitiesInListL(
+ const TDesC& aList, MXIMPObjectCollection& aColl );
+
+ /**
+ * Add identity to virtual list
+ *
+ * @since S60 3.2
+ * @param aList, List name
+ */
+ void AddIdentityToVirtualListL(
+ const TDesC& aList );
+
+ /**
+ * CheckXdmDoc
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TBool, state of xdm documents
+ */
+ TBool CheckXdmDoc();
+
+ public: //From assync
+
+ /**
+ * Defined in a base class
+ */
+ void HandlePresUpdateDocumentL( TInt aErrorCode );
+
+ /**
+ * Defined in a base class
+ */
+ void HandlePresUpdateCancelL( TInt aErrorCode );
+
+ private:
+
+ /**
+ * Standard C++ constructor
+ *
+ * @param aObs, plugin connection observer
+ * @param aXmdId, XDM settings id
+ */
+ CPresencePluginXdmUtils(
+ MPresencePluginConnectionObs& aObs,
+ TInt aXmdId,
+ TBool aLocalmode );
+
+ /**
+ * Performs the 2nd phase of construction.
+ */
+ void ConstructL( );
+
+ protected:// from base class CActive
+
+ /**
+ * Defined in a base class
+ */
+ void RunL();
+
+ /**
+ * Defined in a base class
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Defined in a base class
+ */
+ void DoCancel();
+
+ protected: // from MPresencePluginContactsObs
+
+ /**
+ * Defined in a base class
+ */
+ void RequestComplete( TAny* aResult,
+ TPresenceContactsOperation aOperation, TInt aError );
+
+ private:
+
+ /**
+ * DoUpdateXdmLists
+ *
+ * @since S60 3.2
+ * @param aMyStatus, RunL status
+ * @return aOrigState, xdm state
+ */
+ void DoUpdateXdmListsL( TInt aMyStatus,
+ TPluginXdmState aOrigState );
+
+ /**
+ * DoGetXdmLists
+ *
+ * @since S60 3.2
+ * @param aMyStatus, RunL status
+ * @return aOrigState, xdm state
+ */
+ void DoGetXdmListsL( TInt aMyStatus,
+ TPluginXdmState aOrigState );
+
+ /**
+ * DoCreateXdmLists
+ *
+ * @since S60 3.2
+ * @param aMyStatus, RunL status
+ * @return aOrigState, xdm state
+ */
+ void DoCreateXdmListsL( TInt aMyStatus,
+ TPluginXdmState aOrigState,
+ TBool aOnlyResourceList );
+
+ /**
+ * Search list under parent
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ CXdmDocumentNode* SearchListUnderParentL(
+ CXdmDocumentNode* aParent,
+ const TDesC& aName );
+
+ /**
+ * Complete client request
+ *
+ * @since S60 3.2
+ * @param aStatus, client status
+ * @return none
+ */
+ void CompleteClientReq( TInt aStatus );
+
+ /**
+ * Get XDM lists
+ *
+ * @since S60 3.2
+ * @param aCreateRules, create new rule document
+ * @param aLocalMode, use localmode
+ * @return none
+ */
+ void GetXdmListsL( TBool aCreateRules, TBool aLocalMode );
+
+ /**
+ * Create XDM list document model
+ *
+ * @since S60 3.2
+ * @param aCreateRules, create new rule document
+ * @return none
+ */
+ void CreateXdmListsL( TBool aCreateRules );
+
+ /**
+ * Update document to server
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UpdateXdmToServerL();
+
+ /**
+ * Updates XDMS reource lists into server
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UpdateXdmsL();
+
+ /**
+ * Updates XDM rules
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UpdateXdmRulesL();
+
+ /**
+ * Get XDM rules
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void GetXdmRulesL();
+
+ /**
+ * Handle presence document
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @param aUser, entity name
+ * @return none
+ */
+ void DoHandlePresUpdateDocumentL( TInt aErrorCode );
+
+ /**
+ * Add User to resource list
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @param aName, url
+ */
+ void DoAddUserToListL(
+ const TDesC& aList,
+ const TDesC& aName );
+
+ /**
+ * Remove user from list
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @param aUser, entity name
+ * @return none
+ */
+ void DoRemoveUserFromListL(
+ const TDesC& aList,
+ const TDesC& aName );
+
+ /**
+ * Get member list
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @param aMembers, member array
+ * @return none
+ */
+ void DoGetListMembersL(
+ const TDesC& aList,
+ RPointerArray<MXIMPIdentity>& aMembers );
+
+ /**
+ * Get buddy list
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @return XDM document
+ */
+ CXdmDocumentNode* DoGetBuddyListL( const TDesC& aParent);
+
+ /**
+ * Get buddy list
+ *
+ * @since S60 3.2
+ * @param aList, list name
+ * @parma aBuddyList, xdm document node
+ * @return XDM document
+ */
+ CXdmDocumentNode* DoGetUserListL(
+ const TDesC& aList,
+ CXdmDocumentNode* aBuddyList );
+
+ /**
+ * Check XDM errors
+ *
+ * @since S60 3.2
+ * @param aMyStatus, XDM error code
+ * @return errorcode
+ */
+ TInt CheckIfErrorL( TInt aMyStatus );
+
+ /**
+ * Check if entity already exist
+ *
+ * @since S60 3.2
+ * @param aList, listname
+ * @param aUri, entity url
+ * @return TBool
+ */
+ TBool CheckIfEnityExistL( const TDesC& aList, const TDesC& aUri );
+
+ /**
+ * Update document from server
+ *
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void UpdateFromServerL();
+
+ /**
+ * Compare uri to attribute without prefix. Returns ETrue if match.
+ *
+ * @since S60 5.0
+ * @param aUri, entity url
+ * @parram aAttribute url attribute
+ * @return TBool
+ */
+ TBool CompareUriWithoutPrefixL(
+ const TDesC& aUri, const TDesC& aAttribute );
+
+ /**
+ * Update blocked contact status to Presence Cache
+ *
+ * @since S60 5.0
+ * @param aMyStatus, error status
+ */
+ void DoUpdateBlockedContactPresenceCacheL(
+ TInt aMyStatus );
+
+ private: // Data
+
+ /**
+ * ximp Plugin connection observer
+ * Own.
+ */
+ MPresencePluginConnectionObs& iConnObs;
+
+ /**
+ * XDM Settings id
+ * Own.
+ */
+ TInt iSettingsId;
+
+ /**
+ * ximp request id
+ * Own.
+ */
+ TXIMPRequestId iximpId;
+
+ /**
+ * ximp request id for own requests
+ * Own.
+ */
+ TXIMPRequestId iximpIdOwn;
+
+ /**
+ * Simple Engine request id
+ * Own.
+ */
+ TInt iSimpleId;
+
+ /**
+ * XDM Engine
+ * Own.
+ */
+ CXdmEngine* iXdmEngine;
+
+ /**
+ * XDM document for resource-lists
+ * Own.
+ */
+ CXdmDocument* iXdmDoc;
+
+ /**
+ * Current state
+ * Own.
+ */
+ TPluginXdmState iXdmState;
+
+ /**
+ * Current operation
+ * Own.
+ */
+ TPluginXdmOperation iOperation;
+
+ /**
+ * Whether Presence XDM is up-to-date
+ * Own.
+ */
+ TBool iPresXdmOk;
+
+ /**
+ * Whether XDM is up-to-date
+ * Own.
+ */
+ TBool iXdmOk;
+
+ /**
+ * client statutus.
+ * Not own.
+ */
+ TRequestStatus* iClientStatus;
+
+ /**
+ * XDM presence rules handling
+ * own.
+ */
+ CPresencePluginXdmPresRules* iXdmPresRules;
+
+ /**
+ * Entity uri
+ * Own.
+ */
+ HBufC* iEntityUri;
+
+ /**
+ * TPluginPresRulesUpdateState
+ * Own.
+ */
+ TPluginPresRulesState iRulesUpdateState;
+
+ /**
+ * XDM localmode
+ * Own.
+ */
+ TBool iLocalMode;
+
+ /**
+ * Request results.
+ * Is contact blocked request
+ */
+ TBool iPresenceContactsAsyncReqResult;
+
+ /*
+ * Initial blocked contact list
+ */
+ RPointerArray<HBufC> iBlockedContacts;
+
+ SIMPLE_UNIT_TEST( T_CPresencePluginGroups )
+ SIMPLE_UNIT_TEST( T_CPresencePluginWatcher )
+ SIMPLE_UNIT_TEST( T_CPresencePluginAuthorization )
+ SIMPLE_UNIT_TEST( T_CPresencePluginXdmUtils )
+ };
+
+#endif // CPRESENCEPLUGINXDMUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/install/sis/create_sis.bat Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+createsis create -key H:\RD_RootCA\rd-key.pem -cert H:\RD_RootCA\rd.cer simpledatamodeladapter.pkg
\ No newline at end of file
Binary file simpledatamodeladapter/install/sis/simpledatamodeladapter.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/install/sis/simpledatamodeladapter.pkg Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,61 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+&EN
+
+;Header
+#{"Presence adapter"},(0x10207FE0),1,22,1, TYPE=SA
+
+
+;Series 60 v3.0
+[0x101f7961], 0, 0, 0, {"Series60ProductID"}
+
+;Localised Vendor name
+%{"Nokia"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+;Files to install
+
+
+;ECOM PLUGINS:
+
+; SIMPLE DATAMODEL ADAPTER:
+"\epoc32\release\armv5\udeb\presenceplugin.dll" -"!:\sys\bin\presenceplugin.dll"
+"\epoc32\data\Z\Resource\Plugins\presenceplugin.RSC" -"C:\Resource\Plugins\presenceplugin.RSC"
+
+;test app
+;"\epoc32\release\armv5\urel\HelloWorld.exe" -"!:\sys\bin\HelloWorld.exe"
+;"\epoc32\data\Z\Resource\Apps\HelloWorld.RSC" -"C:\Resource\HelloWorld.RSC"
+
+;UI stuff
+;"\epoc32\release\armv5\udeb\sipvoipcontactsextension.dll" -"C:\sys\bin\sipvoipcontactsextension.dll"
+;"\epoc32\data\Z\Resource\sipvoipcontactsextensionres.Rsc" -"C:\Resource\sipvoipcontactsextensionres.Rsc"
+;"\epoc32\data\Z\Resource\Plugins\sipvoipcontactsextension.RSC" -"C:\Resource\Plugins\sipvoipcontactsextension.RSC"
+;"\epoc32\data\Z\Resource\apps\sipvoipcontactsextensiondefaulticons.mif" -"C:\Resource\Apps\sipvoipcontactsextensiondefaulticons.mif"
+;"\epoc32\data\Z\Resource\apps\svcedefaulticons.mif" -"C:\Resource\Apps\svcedefaulticons.mif"
+
+;Extension manager stuff
+;"\epoc32\release\armv5\udeb\ExtensionManager.dll" -"!:\sys\bin\ExtensionManager.dll"
+;"\epoc32\data\Z\Resource\ExtensionManagerRes.rsc" -"C:\Resource\Plugins\ExtensionManagerRes.rsc"
+
+; sipconnectionprovider
+;"\epoc32\release\armv5\udeb\sipconnectionprovider.dll"-"!:\sys\bin\sipconnectionprovider.dll"
+;"\epoc32\data\Z\resource\plugins\sipconnectionprovider.rsc"-"!:\resource\plugins\sipconnectionprovider.rsc"
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/rom/simpledatamodeladapter.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ROM definition file.
+*
+*/
+
+
+#ifndef SIMPLEDATAMODELADAPTER_IBY
+#define SIMPLEDATAMODELADAPTER_IBY
+
+#ifdef RD_VOIP_REL_2_2
+
+ECOM_PLUGIN(presenceplugin.dll, 10275464.RSC)
+
+#endif // RD_VOIP_REL_2_2
+
+#endif // SIMPLEDATAMODELADAPTER_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/data/20022d58.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for project Simple IM Plugin
+*
+*/
+
+#include <registryinfov2.rh>
+#include <immanagementifids.hrh>
+#include "simpleimpluginuids.hrh"
+
+// ---------------------------------------------------------------------------
+// REGISTRY_INFO
+// ecom plugin resource info
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+ dll_uid = KDllUidSimpleImPlugin;
+
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = IM_IF_ID_PROTOCOL_IM_FEATURES;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = KImplUidSimpleImPlugin;
+ version_no = 1;
+ display_name = "simple im plugin";
+ default_data = 2219;
+ opaque_data = "";
+ rom_only = 0;
+ }
+ };
+ }
+ };
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project simpleimplugin.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/simpleimplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(simpleimplugin.iby)
+
+PRJ_MMPFILES
+simpleimplugin.mmp
+
+PRJ_TESTMMPFILES
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/group/simpleimplugin.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for project simpleimplugin.
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET simpleimplugin.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x20022D58
+
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE simpleimconversation.cpp
+SOURCE simpleimfeatures.cpp
+SOURCE simpleimpluginimplementationproxy.cpp
+
+SOURCEPATH ../data
+START RESOURCE 20022d58.rss
+TARGET simpleimplugin.rsc
+END // RESOURCE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY cch.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY esock.lib
+LIBRARY insock.lib
+LIBRARY charconv.lib
+LIBRARY simpleengine.lib
+LIBRARY serviceprovidersettings.lib
+LIBRARY imcacheclient.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/inc/simpleimconversation.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provides IM sending and receiving services.
+*
+*/
+
+
+#ifndef C_CSIMPLEIMCONVERSATION_H
+#define C_CSIMPLEIMCONVERSATION_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <ximpcontextobserver.h>
+#include <ximprequestcompleteevent.h>
+#include <protocolimconversation.h>
+#include <simpleinstantmsgobserver.h>
+#include <simpleinstantmessage.h>
+
+class CIMCacheFactory;
+class MIMCacheUpdater;
+class MPresencePluginConnectionObs;
+class MSimpleConnection;
+class MProtocolImDataHost;
+class MXIMPIdentity;
+
+/**
+ * This class is used for sending and receiving instant messages.
+ * A client sends the message and waits for notification of send process
+ * success. Client is notified with
+ * MPresencePluginConnectionObs::CompleteReq().
+ *
+ * There can be only one message in the sending que at the time.
+ * Otherwise DoSendMessageL() method leaves with KErrInUse.
+ *
+ * Messages received from the other end are handled in this class and
+ * delivered to the client. Client gets messages through
+ * MProtocolImConversationDataHost::HandleNewTextMessageL().
+ *
+ * @lib simpleimplugin.dll
+ * @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CSimpleImConversation ) : public CBase,
+ public MProtocolImConversation,
+ public MSimpleInstantMsgObserver
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aObs Callback for complete requests.
+ * @param aConn Simple engine connection.
+ */
+ static CSimpleImConversation* NewL(
+ MPresencePluginConnectionObs& aObs, MSimpleConnection& aConn,
+ TUint aServiceId );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleImConversation();
+
+public:
+
+ /**
+ * Sets current IM data host.
+ *
+ * @since S60 v5.1
+ * @param aHost IM data host.
+ */
+ void SetHost( MProtocolImDataHost& aHost );
+
+public: //from MXIMPBase
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions );
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const;
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ TInt32 GetInterfaceId() const;
+
+public: // From MProtocolImConversation
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoSendMessageL(
+ const MImConversationInfo& aImMessage,
+ TXIMPRequestId aReqId );
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoForwardMessageL(
+ const MImConversationInfo& aImMessage,
+ TXIMPRequestId aReqId);
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoSendMessageToGroupL(
+ const MImConversationInfo& aImMessage,
+ const TDesC* aGroupId,TXIMPRequestId aReqId );
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ TXIMPRequestId DoBlockUsersL(
+ const MDesCArray* aUserIds,
+ TXIMPRequestId aReqId);
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ TXIMPRequestId DoUnBlockUsersL(
+ const MDesCArray* aUserIds,
+ TXIMPRequestId aReqId );
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoGetBlockedListRequestL(
+ const MXIMPIdentity& aImMessageId,
+ TXIMPRequestId aReqId );
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoGetMessageListL(
+ const MXIMPIdentity& aImMessageId,
+ const TDesC* aGroupId,
+ const TInt aMessageCount,
+ TBool aDeliveryReportWanted,
+ TXIMPRequestId aReqId);
+
+ /**
+ * From MProtocolImConversation.
+ * @see MProtocolImConversation.
+ */
+ void DoRejectMessageL(
+ const MXIMPIdentity& aImMessageId,
+ const TDesC& aMessageID,
+ TXIMPRequestId aReqId );
+
+public: // From MSimpleInstantMsgObserver
+
+ /**
+ * From MSimpleInstantMsgObserver.
+ * @see MSimpleInstantMsgObserver.
+ */
+ void SendInstantMsgReqComplete( TInt aOpid, TInt aStatus );
+
+ /**
+ * From MSimpleInstantMsgObserver.
+ * @see MSimpleInstantMsgObserver.
+ */
+ void HandleReceiveTextMessage( TPtrC8 aFrom, TPtrC8 aContent );
+
+private: // constructor and the Symbian second-phase constructor
+
+ CSimpleImConversation( MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ TUint aServiceId );
+
+ void ConstructL( );
+
+private:
+
+ /**
+ * Calls MXIMPProtocolConnectionHost callback.
+ *
+ * @since S60 v5.1
+ * @param aStatus Error status.
+ */
+ void CompleteXimpReq( TInt aStatus );
+
+ /**
+ * Leaveable version of HandleReceiveTextMessage.
+ *
+ * @see MSimpleInstantMsgObserver
+ */
+ void DoHandleReceiveTextMessageL( TPtrC8 aFrom, TPtrC8 aContent );
+
+ /**
+ * Resolves username to be used.
+ *
+ * @since S60 v5.1
+ * @param aServiceId Service identifier.
+ * @param aUserName On return contains resolved user name.
+ */
+ void ResolveUsernameL( TUint aServiceId, RBuf& aUserName ) const;
+
+ /**
+ * Creates IM cache updater if not yet created.
+ *
+ * @since S60 v5.1
+ */
+ void CreateImCacheUpdaterIfNeededL();
+
+private: // Data
+
+ /**
+ * XIMP Plugin connection observer.
+ * Not own.
+ */
+ MPresencePluginConnectionObs* iConnectionObs;
+
+ /**
+ * SIMPLE engine connection.
+ * Not Own.
+ */
+ MSimpleConnection* iConnection;
+
+ /**
+ * Instant message handler instance.
+ * Own.
+ */
+ MSimpleInstantMessage* iImHandler;
+
+ /**
+ * Request identifier.
+ */
+ TXIMPRequestId iXimpId;
+
+ /**
+ * Current request status; completed or not.
+ */
+ TBool iCompleted;
+
+ /**
+ * Protocol IM data host.
+ * Not own.
+ */
+ MProtocolImDataHost* iHost;
+
+ /**
+ * IM cache factory.
+ * Own.
+ */
+ CIMCacheFactory* iImCacheFactory;
+
+ /**
+ * IM cache updater.
+ * Owned by factory.
+ */
+ MIMCacheUpdater* iImCacheUpdater;
+
+ /**
+ * ServiceId of current
+ * service
+ */
+ TUint iServiceId;
+
+ };
+
+#endif // C_CSIMPLEIMCONVERSATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/inc/simpleimfeatures.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef C_CSIMPLEIMFEATURES_H
+#define C_CSIMPLEIMFEATURES_H
+
+#include <e32base.h>
+#include <cprotocolimfeatures.h>
+
+class CSimpleImConversation;
+class MPresencePluginConnectionObs;
+class MSimpleConnection;
+
+/**
+ * Main class of XIMP FW plugin providing SIP IM feature.
+ *
+ * @lib simpleimplugin.dll
+ * @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CSimpleImFeatures ) : public CProtocolImFeatures
+{
+public:
+
+ /**
+ * This class encapsulates SIP IM plugin initialization parameters.
+ *
+ * @lib simpleimplugin.dll
+ * @since S60 v5.1
+ */
+ class TSimpleImPluginInitParams
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param aObs Presence plugin connection observer.
+ * @param aConn Simple engine connection.
+ */
+ TSimpleImPluginInitParams( MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn, TUint aServiceId ) : iObserver( aObs ),
+ iConnection( aConn ), iServiceId( aServiceId ) {};
+
+ public:
+
+ /**
+ * Presence plugin connnection observer.
+ * Not own.
+ */
+ MPresencePluginConnectionObs& iObserver;
+
+ /**
+ * Simple engine connection.
+ * Not own.
+ */
+ MSimpleConnection& iConnection;
+
+ /**
+ * Service identifier.
+ */
+ TUint iServiceId;
+ };
+
+ /**
+ * Constructor.
+ * @param aInitParams Plugin initialization parameters.
+ */
+ static CSimpleImFeatures* NewL( TAny* aInitParams );
+
+ /**
+ * Standard C++ destructor.
+ */
+ virtual ~CSimpleImFeatures();
+
+private:
+
+ CSimpleImFeatures();
+
+ void ConstructL( TAny* aInitParams );
+
+public: // From MXIMPBase
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions );
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ const TAny* GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const;
+
+ /**
+ * From MXIMPBase.
+ * @see MXIMPBase.
+ */
+ TInt32 GetInterfaceId() const;
+
+public : // From CProtocolImFeatures
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ MProtocolImGroup& ImGroup();
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ MProtocolImConversation& ImConversation();
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ MProtocolImInvitation& ImInvitation();
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ MProtocolImSearch& ImSearch();
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ void SetHost( MProtocolImDataHost& aHost );
+
+ /**
+ * From CProtocolImFeatures.
+ * @see CProtocolImFeatures.
+ */
+ TInt SupportedSubInterfaces() const;
+
+private : // data members
+
+ /**
+ * IM conversation.
+ * Own.
+ */
+ CSimpleImConversation* iImConversation;
+
+ /**
+ * Protocol IM data host.
+ * Not own.
+ */
+ MProtocolImDataHost* iHost;
+
+ };
+
+#endif // C_CSIMPLEIMFEATURES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/inc/simpleimlogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef SIMPLEIMLOGGER_H
+#define SIMPLEIMLOGGER_H
+
+#ifdef _DEBUG
+ #include <e32svr.h>
+ #define _DEBUG_SIMPLE_IM_PLUGIN
+#endif
+
+#ifdef _DEBUG_SIMPLE_IM_PLUGIN
+ #define DP_IMP( a ) \
+ { _LIT( KFormatString, a ); RDebug::Print( KFormatString ); }
+ #define DP_IMP2( a, b ) \
+ { _LIT( KFormatString, a ); RDebug::Print( KFormatString, b ); }
+ #define DP_IMP3( a, b, c ) \
+ { _LIT( KFormatString, a ); RDebug::Print( KFormatString, b, c ); }
+#else
+ #define DP_IMP( a );
+ #define DP_IMP2( a, b );
+ #define DP_IMP3( a, b, c );
+#endif
+
+#endif // SIMPLEIMLOGGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/inc/simpleimplugindefs.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Common definitions for SIP IM plugin.
+*
+*/
+
+
+#ifndef SIMPLEIMPLUGINDEFS_H
+#define SIMPLEIMPLUGINDEFS_H
+
+#include <e32std.h>
+
+_LIT( KSimpleImPluginName, "SimpleImPlugin" );
+
+#endif // SIMPLEIMPLUGINDEFS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/inc/simpleimpluginuids.hrh Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource headers for project simpleimplugin.
+*
+*/
+
+#ifndef SIMPLEIMPLUGINUIDS_HRH
+#define SIMPLEIMPLUGINUIDS_HRH
+
+/**
+ * Plugin DLL UID
+ */
+#define KDllUidSimpleImPlugin 0x20022D58
+
+/**
+ * Interface Implementation UIDs
+ */
+#define KImplUidSimpleImPlugin 0x20022D59
+
+#endif // SIMPLEIMPLUGINUIDS_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/rom/simpleimplugin.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ROM definition file.
+*
+*/
+
+#ifndef SIMPLEIMPLUGIN_IBY
+#define SIMPLEIMPLUGIN_IBY
+
+#ifdef RD_VOIP_REL_2_2
+
+ECOM_PLUGIN(simpleimplugin.dll, 20022D58.RSC)
+
+#endif // RD_VOIP_REL_2_2
+
+#endif // SIMPLEIMPLUGIN_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/src/simpleimconversation.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,487 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <ximpobjectfactory.h>
+#include <imobjectfactory.h>
+#include <simplefactory.h>
+#include <imconversationinfo.h>
+#include <utf.h>
+#include <ximpprotocolconnectionhost.h>
+#include <protocolimdatahost.h>
+#include <protocolimconversationdatahost.h>
+#include <spsettings.h>
+#include <cch.h>
+#include <cimcachefactory.h>
+#include <mimcacheupdater.h>
+
+#include "simpleimconversation.h"
+#include "presenceplugincommon.h"
+#include "mpresencepluginconnectionobs.h"
+#include "simpleimplugindefs.h"
+#include "simpleimlogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::CPresencePluginGroups
+// ---------------------------------------------------------------------------
+//
+CSimpleImConversation::CSimpleImConversation(
+ MPresencePluginConnectionObs& aObs, MSimpleConnection& aConn,
+ TUint aServiceId ):
+ iConnectionObs( &aObs ),
+ iConnection( &aConn ),
+ iServiceId( aServiceId )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::NewL
+// ---------------------------------------------------------------------------
+//
+CSimpleImConversation* CSimpleImConversation::NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn, TUint aServiceId)
+ {
+ CSimpleImConversation* self =
+ new( ELeave ) CSimpleImConversation ( aObs, aConn, aServiceId );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::ConstructL()
+ {
+ DP_IMP("CSimpleImConversation::ConstructL")
+
+ iImHandler = TSimpleFactory::NewInstantMessageL(
+ *iConnection, *this );
+
+ iImCacheFactory = CIMCacheFactory::InstanceL();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::~CSimpleImConversation
+// ---------------------------------------------------------------------------
+//
+CSimpleImConversation::~CSimpleImConversation()
+ {
+ DP_IMP("CSimpleImConversation::~CSimpleImConversation")
+
+ if ( iImHandler )
+ {
+ DP_IMP("Close the msg handler")
+ iImHandler->Close();
+ }
+
+ // Release the imcache, all the conversation will lost here
+ if ( iImCacheFactory )
+ {
+ DP_IMP("Release IM Cache")
+ CIMCacheFactory::Release();
+ iImCacheFactory = NULL;
+ }
+
+ iImCacheUpdater = NULL;
+ iHost = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::SetHost
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::SetHost( MProtocolImDataHost& aHost )
+ {
+ DP_IMP("CSimpleImConversation::SetHost")
+
+ iHost = &aHost;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimpleImConversation::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ DP_IMP("CSimpleImConversation::GetInterface")
+
+ if ( MProtocolImConversation::KInterfaceId == aInterfaceId )
+ {
+ return this;
+ }
+
+ if ( MXIMPBase::EPanicIfUnknown == aOptions )
+ {
+ User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
+ }
+
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::GetInterface() const
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimpleImConversation::GetInterface(
+ TInt32 aInterfaceId, TIfGetOps aOptions ) const
+ {
+ DP_IMP("CSimpleImConversation::GetInterface")
+
+ if ( MProtocolImConversation::KInterfaceId == aInterfaceId )
+ {
+ // caller wants this interface
+ return const_cast<CSimpleImConversation*>( this );
+ }
+
+ if ( MXIMPBase::EPanicIfUnknown == aOptions )
+ {
+ User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
+ }
+
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::GetInterfaceId() const
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimpleImConversation::GetInterfaceId() const
+ {
+ DP_IMP("CSimpleImConversation::GetInterfaceId")
+
+ return MProtocolImConversation::KInterfaceId;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoSendMessageL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoSendMessageL(
+ const MImConversationInfo& aImMessage,
+ TXIMPRequestId aReqId )
+ {
+ DP_IMP( "CSimpleImConversation::DoSendMessageL" )
+
+ iCompleted = EFalse;
+
+ TPtrC16 msgText16 = aImMessage.TextMessage();
+ DP_IMP2( "CSimpleImConversation::DoSendMessageL, CONTENT: %S",
+ &msgText16 )
+ HBufC8* contentData = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+ msgText16 );
+ CleanupStack::PushL( contentData );
+
+ const MDesCArray& recipients = aImMessage.RecipientL();
+ for ( TInt i = 0; i < recipients.MdcaCount(); i++ )
+ {
+ TPtrC16 recipientsPtr16 = recipients.MdcaPoint( i );
+ HBufC8* recipientsData = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+ recipientsPtr16 );
+ CleanupStack::PushL( recipientsData );
+ DP_IMP2( "CSimpleImConversation::DoSendMessageL, RECIPIENT: %S",
+ &recipientsPtr16 )
+
+ TInt result = iImHandler->SendInstantMessage( *contentData,
+ *recipientsData );
+ CleanupStack::PopAndDestroy( recipientsData );
+
+ if ( KErrInUse == result )
+ {
+ User::Leave( KErrInUse );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( contentData );
+ iXimpId = aReqId;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoForwardMessageL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoForwardMessageL(
+ const MImConversationInfo& /*aImMessage*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoForwardMessageL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoSendMessageToGroupL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoSendMessageToGroupL(
+ const MImConversationInfo& /*aImMessage*/,
+ const TDesC* /*aGroupId*/, TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoSendMessageToGroupL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoBlockUsersL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CSimpleImConversation::DoBlockUsersL(
+ const MDesCArray* /*aUserIds*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoBlockUsersL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ return TXIMPRequestId();
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoUnBlockUsersL()
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CSimpleImConversation::DoUnBlockUsersL(
+ const MDesCArray* /*aUserIds*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoUnBlockUsersL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ return TXIMPRequestId();
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoGetBlockedListRequestL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoGetBlockedListRequestL(
+ const MXIMPIdentity& /*aImMessageId*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoGetBlockedListRequestL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoGetMessageListL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoGetMessageListL(
+ const MXIMPIdentity& /*aImMessageId*/,
+ const TDesC* /*aGroupId*/,
+ const TInt /*aMessageCount*/,
+ TBool /*aDeliveryReportWanted*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoGetMessageListL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MProtocolImConversation.
+// CSimpleImConversation::DoRejectMessageL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoRejectMessageL(
+ const MXIMPIdentity& /*aImMessageId*/,
+ const TDesC& /*aMessageID*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_IMP( "CSimpleImConversation::DoRejectMessageL, NOT SUPPORTED" )
+
+ User::Leave( KErrNotSupported );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MSimpleInstantMsgObserver.
+// CSimpleImConversation::SendInstantMsgReqComplete()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::SendInstantMsgReqComplete(
+ TInt /*aOpid*/, TInt aStatus)
+ {
+ DP_IMP("CSimpleImConversation::SendInstantMsgReqComplete")
+
+ CompleteXimpReq( aStatus );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MSimpleInstantMsgObserver.
+// CSimpleImConversation::HandleReceiveTextMessage()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::HandleReceiveTextMessage(
+ TPtrC8 aFrom, TPtrC8 aContent )
+ {
+ DP_IMP( "CSimpleImConversation::HandleReceiveTextMessage" )
+
+ TRAPD( err, DoHandleReceiveTextMessageL( aFrom, aContent ) )
+
+ if ( KErrNone != err )
+ {
+ // Do nothing
+ DP_IMP2( "CSimpleImConversation::HandleReceiveTextMessage, ERROR: %i",
+ err )
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::CompleteXimpReq()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::CompleteXimpReq( TInt aStatus )
+ {
+ DP_IMP( "CSimpleImConversation::CompleteXimpReq" )
+
+ if ( iCompleted )
+ {
+ DP_IMP("CSimpleImConversation::CompleteXimpReq return")
+ return;
+ }
+
+ iCompleted = ETrue;
+ iConnectionObs->CompleteReq( iXimpId, aStatus );
+ iXimpId = TXIMPRequestId();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::DoHandleReceiveTextMessageL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::DoHandleReceiveTextMessageL( TPtrC8 aFrom,
+ TPtrC8 aContent )
+ {
+ DP_IMP( "CSimpleImConversation::DoHandleReceiveTextMessageL" )
+
+ CreateImCacheUpdaterIfNeededL();
+
+ if ( iHost )
+ {
+ MXIMPObjectFactory& objFact = iConnectionObs->Host()->ObjectFactory();
+ MImObjectFactory& imObjFact = iHost->ImObjectFactory();
+
+ MXIMPIdentity* identity = objFact.NewIdentityLC(); // CS:1
+ MImConversationInfo* convinfo = imObjFact.
+ NewImConversationInfoLC(); // CS:2
+
+ HBufC16* sendername = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ aFrom );
+ CleanupStack::PushL( sendername ); // CS:3
+ identity->SetIdentityL( *sendername );
+ CleanupStack::PopAndDestroy( sendername ); // CS:2
+ convinfo->SetMessageIdL( identity );
+
+ HBufC16* messagecontent = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ aContent );
+ CleanupStack::PushL( messagecontent ); // CS:3
+ convinfo->SetTextMessageL( *messagecontent );
+ CleanupStack::PopAndDestroy( messagecontent ); // CS:2
+
+ iHost->ConversationDataHost().HandleNewTextMessageL( convinfo );
+ TRAP_IGNORE( iImCacheUpdater->AppendReceiveMessageL(
+ identity->Identity(), convinfo->TextMessage() ) );
+
+ CleanupStack::Pop(); // CS:1
+ CleanupStack::Pop(); // CS:0
+ }
+ else
+ {
+ DP_IMP( " --> PROTOCOL IM DATA HOST IS NULL!" )
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::ResolveUsernameL
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::ResolveUsernameL(
+ TUint aServiceId, RBuf& aUserName ) const
+ {
+ DP_IMP( "CSimpleImConversation::ResolveUsernameL" )
+
+ CCch* cchApi = CCch::NewLC();
+ CCchService* service = cchApi->GetService( aServiceId );
+
+ User::LeaveIfError( service->GetConnectionParameter(
+ ECCHUnknown, ECchUsername, aUserName ) );
+
+ DP_IMP2( "CSimpleImConversation::ResolveUsernameL, USERNAME: %S",
+ &aUserName )
+
+ CleanupStack::PopAndDestroy( cchApi );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImConversation::CreateImCacheUpdaterIfNeededL()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImConversation::CreateImCacheUpdaterIfNeededL()
+ {
+ if ( !iImCacheUpdater )
+ {
+ DP_IMP( "CSimpleImConversation::CreateImCacheUpdaterIfNeededL," )
+ DP_IMP( "CREATING UPDATER" )
+
+ RBuf username;
+ CleanupClosePushL( username );
+ const TInt KMaxUserNameLength = 255;
+ username.CreateL( KMaxUserNameLength );
+ ResolveUsernameL( iServiceId, username );
+
+ iImCacheUpdater =
+ iImCacheFactory->CreateUpdaterL( iServiceId, username, EFalse );
+ CleanupStack::PopAndDestroy( &username );
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/src/simpleimfeatures.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "simpleimfeatures.h"
+#include "simpleimconversation.h"
+#include "mpresencepluginconnectionobs.h"
+#include "simpleimplugindefs.h"
+#include "simpleimlogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSimpleImFeatures::CSimpleImFeatures()
+// ---------------------------------------------------------------------------
+//
+CSimpleImFeatures::CSimpleImFeatures() : CProtocolImFeatures()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImFeatures::NewL()
+// ---------------------------------------------------------------------------
+//
+CSimpleImFeatures* CSimpleImFeatures::NewL( TAny* aInitParams )
+ {
+ DP_IMP( "CSimpleImFeatures::NewL()" )
+
+ CSimpleImFeatures* self = new( ELeave ) CSimpleImFeatures();
+ CleanupStack::PushL( self );
+ self->ConstructL( aInitParams );
+ CleanupStack::Pop( self );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImFeatures::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimpleImFeatures::ConstructL( TAny* aInitParams )
+ {
+ DP_IMP( "CSimpleImFeatures::ConstructL()" )
+ __ASSERT_ALWAYS( aInitParams, User::Leave( KErrArgument ) );
+
+ TSimpleImPluginInitParams* initParams =
+ static_cast<TSimpleImPluginInitParams*>( aInitParams );
+
+ iImConversation = CSimpleImConversation::NewL( initParams->iObserver,
+ initParams->iConnection, initParams->iServiceId );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSimpleImFeatures::~CSimpleImFeatures
+// ---------------------------------------------------------------------------
+//
+CSimpleImFeatures::~CSimpleImFeatures()
+ {
+ DP_IMP( "CSimpleImFeatures::~CSimpleImFeatures()" )
+
+ delete iImConversation;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MXIMPBase.
+// CSimpleImFeatures::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CSimpleImFeatures::GetInterface( TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ DP_IMP( "CSimpleImFeatures::GetInterface()" )
+
+ if ( CProtocolImFeatures::KInterfaceId == aInterfaceId )
+ {
+ DP_IMP( "CSimpleImFeatures::GetInterface() - Found" )
+ CProtocolImFeatures* self = this;
+ return self;
+ }
+
+ if ( MXIMPBase::EPanicIfUnknown == aOptions )
+ {
+ User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
+ }
+
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MXIMPBase.
+// CSimpleImFeatures::GetInterface() const
+// ---------------------------------------------------------------------------
+//
+const TAny* CSimpleImFeatures::GetInterface( TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ DP_IMP( "CSimpleImFeatures::GetInterface() const" )
+
+ if ( CProtocolImFeatures::KInterfaceId == aInterfaceId )
+ {
+ DP_IMP( "CSimpleImFeatures::GetInterface() const - Found" )
+ const CProtocolImFeatures* self = this;
+ return self;
+ }
+
+ if ( MXIMPBase::EPanicIfUnknown == aOptions )
+ {
+ User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
+ }
+
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MXIMPBase.
+// CSimpleImFeatures::GetInterfaceId() const
+// ---------------------------------------------------------------------------
+//
+TInt32 CSimpleImFeatures::GetInterfaceId() const
+ {
+ return CProtocolImFeatures::KInterfaceId;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::ImGroup()
+// ---------------------------------------------------------------------------
+//
+MProtocolImGroup& CSimpleImFeatures::ImGroup()
+ {
+ DP_IMP( "CSimpleImFeatures::ImGroup(), NOT SUPPORTED" )
+
+ MProtocolImGroup* dummyGroup = NULL;
+ return *dummyGroup;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::ImConversation()
+// ---------------------------------------------------------------------------
+//
+MProtocolImConversation& CSimpleImFeatures::ImConversation()
+ {
+ DP_IMP( "CSimpleImFeatures::ImConversation()" )
+
+ return *iImConversation;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::ImInvitation()
+// ---------------------------------------------------------------------------
+//
+MProtocolImInvitation& CSimpleImFeatures::ImInvitation()
+ {
+ DP_IMP( "CSimpleImFeatures::ImInvitation(), NOT SUPPORTED" )
+
+ MProtocolImInvitation* dummyInvitation = NULL;
+ return *dummyInvitation;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::ImSearch()
+// ---------------------------------------------------------------------------
+//
+MProtocolImSearch& CSimpleImFeatures::ImSearch()
+ {
+ DP_IMP( "CSimpleImFeatures::ImSearch(), NOT SUPPORTED" )
+
+ MProtocolImSearch* dummySearch = NULL;
+ return *dummySearch;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::SetHost()
+// ---------------------------------------------------------------------------
+//
+void CSimpleImFeatures::SetHost( MProtocolImDataHost& aHost )
+ {
+ DP_IMP( "CSimpleImFeatures::SetHost()" )
+
+ iHost = &aHost ;
+ iImConversation->SetHost( *iHost );
+ }
+
+// ---------------------------------------------------------------------------
+// From CProtocolImFeatures.
+// CSimpleImFeatures::SupportedSubInterfaces()
+// ---------------------------------------------------------------------------
+//
+TInt CSimpleImFeatures::SupportedSubInterfaces() const
+ {
+ return EProtocolImConversation;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/simpleimplugin/src/simpleimpluginimplementationproxy.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECom implementation proxy.
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "simpleimfeatures.h"
+
+// LOCAL CONSTANTS AND MACROS
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x20022D59, CSimpleImFeatures::NewL )
+ };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Function to return the implementation proxy table
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+ TInt& aTableCount )
+ {
+ aTableCount =
+ sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+ return ImplementationTable;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceconnectioninfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#include <e32math.h>
+#include <ximpprotocolconnection.h>
+
+#include "presencepluginconnection.h"
+#include "presenceconnectioninfo.h"
+#include "presenceplugincommon.h"
+#include "presencelogger.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::CPresenceConnectionInfo()
+// ---------------------------------------------------------------------------
+//
+CPresenceConnectionInfo::CPresenceConnectionInfo(
+ MXIMPProtocolConnection* aConnection ):
+ iConnection( aConnection ),
+ iConnectStatus( CPresencePluginConnection::ENotActive )
+ {
+ iClientCount = 0;
+ iClientId = GenerateClientId();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresenceConnectionInfo* CPresenceConnectionInfo::NewL(
+ MXIMPProtocolConnection* aConnection )
+ {
+ DP_SDA("CPresenceConnectionInfo::NewL");
+ CPresenceConnectionInfo* self =
+ new( ELeave ) CPresenceConnectionInfo( aConnection );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::~CPresenceConnectionInfo()
+// ---------------------------------------------------------------------------
+//
+CPresenceConnectionInfo::~CPresenceConnectionInfo()
+ {
+ DP_SDA("CPresenceConnectionInfo::~CPresenceConnectionInfo");
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+
+ delete iETag;
+ iETag = NULL;
+
+ DP_SDA("CPresenceConnectionInfo::~CPresenceConnectionInfo done");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::SetConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConnectionInfo::SetConnectionStatus(
+ CPresencePluginConnection::TConnectionStatus aStatus )
+ {
+ DP_SDA2("CPresenceConnectionInfo::SetConnectionStatus %d", aStatus);
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ iConnectStatus = aStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::SetConnectionETag()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConnectionInfo::SetConnectionETag( const TDesC8& aETag )
+ {
+ DP_SDA("CPresenceConnectionInfo::SetConnectionETag");
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ delete iETag;
+ iETag = NULL;
+ TRAP_IGNORE( ( iETag = aETag.AllocL() ) );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::GetConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginConnection::TConnectionStatus
+ CPresenceConnectionInfo::GetConnectionStatus()
+ {
+ DP_SDA("CPresenceConnectionInfo::GetConnectionStatus");
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ DP_SDA2("CPresenceConnectionInfo:: connection status %d", iConnectStatus);
+ return iConnectStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::GetConnectionEtag()
+// ---------------------------------------------------------------------------
+//
+TDesC8* CPresenceConnectionInfo::GetConnectionEtag()
+ {
+ DP_SDA("CPresenceConnectionInfo::GetConnectionEtag");
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ return iETag;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::GetConnection()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection* CPresenceConnectionInfo::GetConnection()
+ {
+ DP_SDA("CPresenceConnectionInfo::GetConnection");
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ return iConnection;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::IncreaseClientCount()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConnectionInfo::IncreaseClientCount()
+ {
+ iClientCount++;
+ DP_SDA2("CPresenceConnectionInfo::IncreaseClientCount %d", iClientCount );
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::DecreaseClientCount()
+// ---------------------------------------------------------------------------
+//
+void CPresenceConnectionInfo::DecreaseClientCount()
+ {
+ iClientCount--;
+ DP_SDA2("CPresenceConnectionArray::DecreaseClientCount %d", iClientCount );
+ DP_SDA2("CPresenceConnectionArray:: clientID %d", iClientId);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::ClientCount()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceConnectionInfo::ClientCount()
+ {
+ DP_SDA2("CPresenceConnectionInfo::ClientCount %d", iClientCount );
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ return iClientCount;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::GetClientId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceConnectionInfo::GetClientId()
+ {
+ DP_SDA2("CPresenceConnectionInfo::ClientCount %d", iClientCount );
+ DP_SDA2("CPresenceConnectionInfo:: clientID %d", iClientId);
+ return iClientId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceConnectionInfo::GenerateClientId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceConnectionInfo::GenerateClientId()
+ {
+ // Generate unique session client id
+ DP_SDA("CPresenceConnectionInfo::GenerateClientIdstart");
+ const TInt KMaxRand = 9999;
+ TInt64 seed;
+ TTime time;
+ time.HomeTime();
+ seed = time.Int64();
+ TInt random = Math::Rand( seed ) % KMaxRand;
+ DP_SDA("CPresenceConnectionInfo::GenerateClientId 1");
+ return random;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugin.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <badesca.h>
+#include <ecom/implementationproxy.h>
+#include <ximpserviceinfo.h>
+#include <ximpbase.h>
+#include <ximpidentity.h>
+#include <presenceinfo.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpprotocolconnection.h>
+#include <ximpserviceinfo.h>
+#include <ximpcontextclientinfo.h>
+
+#include "presenceplugin.h"
+#include "presenceplugindef.h"
+#include "presencepluginconnection.h"
+#include "presenceplugincommon.h"
+#include "presenceplugin_resource.hrh"
+#include "presenceconnectioninfo.h"
+
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Key value pair table to identify correct constructor
+// function for the requested interface.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+ //Warning in Lint 611
+ IMPLEMENTATION_PROXY_ENTRY( PRESENCEPLUGIN_1_IMPLEMENTATION_UID,
+ CPresencePlugin::NewL )
+ };
+
+// ---------------------------------------------------------------------------
+// Exported function to return the implementation proxy table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+ TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) /
+ sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::CPresencePlugin()
+// ---------------------------------------------------------------------------
+//
+CPresencePlugin::CPresencePlugin()
+ {
+ //empty
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresencePlugin* CPresencePlugin::NewLC()
+ {
+ CPresencePlugin* self = new( ELeave ) CPresencePlugin();
+ CleanupStack::PushL( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePlugin* CPresencePlugin::NewL()
+ {
+ CPresencePlugin* self = CPresencePlugin::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::~CPresencePlugin()
+// ---------------------------------------------------------------------------
+//
+CPresencePlugin::~CPresencePlugin()
+ {
+ DP_SDA("CPresencePlugin::~CPresencePlugin");
+ iConnections.ResetAndDestroy();
+ iConnectionArray.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::~CPresencePlugin()
+// ---------------------------------------------------------------------------
+//
+void CPresencePlugin::PrimeHost( MXIMPProtocolPluginHost& aHost )
+ {
+ DP_SDA("CPresencePlugin::PrimeHost");
+ iHost = &aHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::AcquireConnectionL()
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnection& CPresencePlugin::AcquireConnectionL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aContextClient )
+ {
+ DP_SDA("CPresencePlugin::AcquireConnectionL");
+ MXIMPProtocolConnection* tmp = NULL;
+ CPresenceConnectionInfo* connectionArray = NULL;
+ TBool connected = EFalse;
+
+ //Check if presence is allready connected to id
+ //!!!! IN this adapter that IapID is service id ID!!!!
+
+ DP_SDA2("CPresencePlugin::AcquireConnectionL - service id: %d",
+ aServiceInfo.IapId() );
+
+ TInt presenceId = KErrNotFound;
+ CSPSettings* spSettings = CSPSettings::NewL();
+ CleanupStack::PushL( spSettings );
+
+ CSPProperty* property = CSPProperty::NewLC();
+ spSettings->FindPropertyL( aServiceInfo.IapId(),
+ ESubPropertyPresenceSettingsId,
+ *property );
+ if ( property )
+ {
+ property->GetValue( presenceId );
+ }
+ CleanupStack::PopAndDestroy( property );
+ CleanupStack::PopAndDestroy( spSettings );
+
+ DP_SDA2(" -> presence settings id: %d",presenceId );
+ __ASSERT_ALWAYS( presenceId > 0, User::Leave( KErrArgument ) );
+
+ TInt connectionsCount = iConnections.Count();
+ DP_SDA2("AcquireConnectionL : connectionsCount =%d ", connectionsCount );
+
+ for( TInt i( connectionsCount - 1 ); i >= 0; i-- )
+ {
+ DP_SDA2("AcquireConnectionL connection count %d", connectionsCount);
+ if( iConnections[i]->GetPresenceSetId() == presenceId )
+ {
+ DP_SDA2("AcquireConnectionL RETURN OLD CONNECTION : i = %d " , i );
+ //Check connection status
+ tmp = iConnections[i];
+ connectionArray = iConnections[i]->GetConnectionArray();
+
+ //Check connection status from connectionArray
+ CPresencePluginConnection::TConnectionStatus status =
+ connectionArray->GetConnectionStatus();
+
+ if( CPresencePluginConnection::ENotActive == status )
+ {
+ DP_SDA("AcquireConnectionL ENotActive ");
+ DP_SDA("AcquireConnectionL Del old inactive connection");
+ //Call session CLOSE here!!!!!
+ //Ensure there is no any client to bind this connect
+ //Release this failed connection
+ DeleteConnection(i);
+ }
+ else if ( CPresencePluginConnection::ETerminated == status )
+ {
+ DP_SDA("AcquireConnectionL ETerminated CREATE NEW CONNECTION ");
+ //Roamning try use lates ETag
+ //Delete old terminaded connection and create new with old ETag
+ CPresencePluginConnection* connection =
+ CPresencePluginConnection::NewL(
+ aServiceInfo, aContextClient,
+ *iConnectionArray[i]->GetConnectionEtag() );
+ CleanupStack::PushL( connection );
+
+ DeleteConnection( i );
+
+ //Add this new connection to connectionArray
+ CPresenceConnectionInfo* connectionInfo =
+ CPresenceConnectionInfo::NewL( connection );
+ iConnectionArray.Append( connectionInfo );
+ connection->SetConnectionArray( connectionInfo );
+ iConnections.AppendL( connection );
+ CleanupStack::Pop( connection );
+ tmp = connection;
+ connected = ETrue;
+
+ iConnectionArray[i]->IncreaseClientCount();
+ }
+ else if ( CPresencePluginConnection::EActive == status )
+ {
+ DP_SDA("AcquireConnectionL EActive");
+ // NOTE: Incase there is no reply from XIMP before client is
+ // shutdown , then closeconnection wouldnt be called, reopening
+ // client will increase clientCount which is wrong. ClientCount
+ // should be checked for validity before increasing?
+ // If already connected
+ iConnectionArray[i]->IncreaseClientCount();
+ connected = ETrue;
+ tmp = iConnections[i];
+ DP_SDA("AcquireConnectionL RETURN OLD CONNECTION done");
+ }
+ break;
+ }
+ }
+ if( !connected )
+ {
+ DP_SDA("CPresencePlugin::AcquireConnectionL CREATE NEW CONNECTION");
+ // If not already connected
+ CPresencePluginConnection* connection = CPresencePluginConnection::NewL(
+ aServiceInfo, aContextClient );
+ CleanupStack::PushL( connection );
+
+ //Add this new connection to connectionArray
+ CPresenceConnectionInfo* connectionInfo =
+ CPresenceConnectionInfo::NewL( connection );
+ iConnectionArray.Append( connectionInfo );
+ connection->SetConnectionArray( connectionInfo );
+ //Add on binded client
+ connectionInfo->IncreaseClientCount();
+
+ iConnections.AppendL( connection );
+ CleanupStack::Pop( connection );
+ tmp = connection;
+ DP_SDA("AcquireConnectionL CREATE NEW CONNECTION DONE");
+ }
+ DP_SDA("CPresencePlugin::AcquireConnectionL ret");
+ return *tmp;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::ReleaseConnection()
+// ---------------------------------------------------------------------------
+//
+void CPresencePlugin::ReleaseConnection( MXIMPProtocolConnection& aConnection )
+ {
+ DP_SDA("CPresencePlugin::ReleaseConnection");
+ TInt connectionsCount = iConnections.Count();
+
+ DP_SDA2("ReleaseConnection : connectionsCount =%d ", connectionsCount );
+
+ for ( TInt i=0; i < connectionsCount; i++ )
+ {
+ DP_SDA("CPresencePlugin::ReleaseConnection for start");
+ if ( iConnectionArray[i]->GetConnection() == &aConnection )
+ {
+ //Check how many client is using this connection
+ TInt clientCount = iConnectionArray[i]->ClientCount();
+
+ DP_SDA2("ReleaseConnection : clientCount = %d ", clientCount );
+ DP_SDA2("CPresencePlugin::ReleaseConnection : i = %d", i );
+
+ if ( connectionsCount == 1 && clientCount <= 0 )
+ {
+ DP_SDA("CPresencePlugin::ReleaseConnection Lets start to check");
+ DP_SDA2("CPresencePlugin::ReleaseConnection connect status %d,", iConnections[i]->GetSessionStatus());
+ //Check this connection status
+ if( !(CPresencePluginConnection::ENotActive ==
+ iConnectionArray[i]->GetConnectionStatus() ))
+ {
+ DP_SDA("CPresencePlugin::ReleaseConnection not have clients");
+ DeleteConnection(i);
+ break;
+ }
+ DP_SDA("connectionsCount == 1 && i == 0 && clientCount == 0 ");
+ DP_SDA("ReleaseConnection : Don't delete this connection ");
+ break; //don't delete first connection
+ }
+ DP_SDA("CPresencePlugin::ReleaseConnection for end");
+ }
+ }
+ DP_SDA("CPresencePlugin::ReleaseConnection end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePlugin::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ return this;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePlugin::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ DP_SDA("CPresencePlugin::GetInterface");
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ return const_cast<CPresencePlugin*>(this);
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePlugin::GetInterfaceId() const
+ {
+ return MXIMPProtocolPlugin::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePlugin::DeleteConnection()
+// ---------------------------------------------------------------------------
+//
+void CPresencePlugin::DeleteConnection( TInt aIndex )
+ {
+ //First delete connectionArray where connection is same at connection
+ DP_SDA("CPresencePlugin::DeleteConnection");
+
+ TInt connectionArrayCount = iConnectionArray.Count();
+
+ for ( TInt i=0; i < connectionArrayCount; i++ )
+ {
+ DP_SDA2("CPresencePlugin::DeleteConnection FINDING, con status %d", iConnectionArray[i]->GetConnectionStatus() );
+ if( (iConnections[aIndex] == iConnectionArray[i]->GetConnection()) &&
+ !(CPresencePluginConnection::EActive ==
+ iConnectionArray[i]->GetConnectionStatus() ) )
+ {
+ DP_SDA("CPresencePlugin::DeleteConnection connection Match");
+ delete iConnectionArray[i];
+ iConnectionArray.Remove( i );
+ iConnectionArray.Compress();
+ break;
+ }
+ }
+ delete iConnections[aIndex];
+ iConnections.Remove( aIndex );
+ iConnections.Compress();
+ DP_SDA("CPresencePlugin::DeleteConnection end");
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginauthorization.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1328 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <utf.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresenceauthorizationdatahost.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <ximpstatus.h>
+#include <ximpidentity.h>
+#include <presencegrantrequestinfo.h>
+#include <ximpobjectcollection.h>
+#include <presenceblockinfo.h>
+#include <presenceinfofilter.h>
+#include <msimplewinfo.h>
+#include <msimpleelement.h>
+
+#include <presenceinfo.h>
+#include <presenceinfofieldcollection.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldvalueenum.h>
+#include <avabilitytext.h>
+
+#include "presencepluginauthorization.h"
+#include "presencepluginwinfo.h"
+#include "presenceplugincommon.h"
+#include "presencepluginxdmutils.h"
+#include "presencepluginwatcher.h"
+#include "presenceplugindata.h"
+#include "presencepluginutility.h"
+#include "presenceplugingroup.h"
+#include "presencepluginvirtualgroup.h"
+#include "presenceplugincontacts.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::CPresencePluginAuthorization()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginAuthorization::CPresencePluginAuthorization(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData )
+ : CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iSubscribed( EFalse ),
+ iOperation( ENoOperation ), iXdmOk( EFalse ),
+ iComplete( EFalse ), iPresenceData( aPresenceData ),
+ iContactIsStored( ETrue )
+ {
+ CActiveScheduler::Add(this);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginAuthorization* CPresencePluginAuthorization::NewL(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData )
+ {
+ DP_SDA("CPresencePluginAuthorization::NewL ");
+ CPresencePluginAuthorization* self =
+ new( ELeave ) CPresencePluginAuthorization( aObs, aPresenceData );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::ConstructL()
+ {
+ HBufC* serviceName =
+ iPresenceData->ServiceNameLC( iPresenceData->ServiceId() );
+ iContacts = CPresencePluginContacts::NewL(
+ iPresenceData->ServiceId(), *serviceName, *this );
+ CleanupStack::PopAndDestroy( serviceName );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::~CPresencePluginAuthorization()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginAuthorization::~CPresencePluginAuthorization()
+ {
+ delete iPresIdentity;
+ delete iContacts;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::SetDataHost()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::SetDataHost(
+ MProtocolPresenceAuthorizationDataHost& aDataHost )
+ {
+ DP_SDA("CPresencePluginAuthorization::SetDataHost ");
+ iDataHost = &aDataHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::WinfoTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::WinfoTerminatedL( TInt aReason )
+ {
+ DP_SDA("CPresencePluginAuthorization::WinfoTerminatedL ");
+
+ if ( iSubscribed )
+ {
+ MXIMPDataSubscriptionState* myState =
+ iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+ myStatus->SetResultCode( aReason ? aReason : KErrCompletion );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ // parameters' OWNERSHIP is taken
+ iDataHost->SetPresenceGrantRequestDataSubscriptionStateL(
+ myState,
+ myStatus );
+
+ CleanupStack::Pop( /*myStatus*/ );
+ CleanupStack::Pop( /*myState*/ );
+ }
+
+ DP_SDA("CPresencePluginAuthorization::WinfoTerminatedL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoSubscribePresenceGrantRequestListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoSubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("DoSubscribePresenceGrantRequestListL ");
+ iConnObs.WinfoHandlerL()->SubscribeWinfoListL( aReqId );
+ iSubscribed = ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoUnsubscribePresenceGrantRequestListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoUnsubscribePresenceGrantRequestListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("DoUnsubscribePresenceGrantRequestListL ");
+ iConnObs.WinfoHandlerL()->UnsubscribeWinfoListL( aReqId );
+ iSubscribed = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoGrantPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& /*aPif*/, // notice: pif support
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoGrantPresenceForPresentityL ");
+
+ // Workaround for clients that can only grant when accepting buddy request.
+ // SIMPLE also requires grant + subscribe so do both here even though
+ // it is agains ximp api definitions.
+
+ _LIT( KDefaultBuddyList, "buddylist" );
+
+ iAuthState = EStateAcceptBuddyRequest;
+ MXIMPIdentity* buddyList = iConnObs.ObjectFactory().NewIdentityLC();
+ buddyList->SetIdentityL( KDefaultBuddyList() );
+
+ iConnObs.GroupsL().DoAddPresentityGroupMemberL( *buddyList, aPresentityId,
+ KNullDesC(), aReqId );
+ CleanupStack::PopAndDestroy( 1 ); // buddyList
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoPerformGrantPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoPerformGrantPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoPerformGrantPresenceForPresentityL");
+ StartXdmOperationL( aPresentityId,
+ EGrantPresenceForPresentity, aClientStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoUpdatePresenceGrantPifForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoUpdatePresenceGrantPifForPresentityL(
+ const MXIMPIdentity& /*aPresentityId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ // Notice: later
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoWithdrawPresenceGrantFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoWithdrawPresenceGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginAuth::DoWithdrawPresenceGrantFromPresentityL ");
+ StartXdmOperationL( aPresentityId, aReqId, EWithdrawFromPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoPerformWithdrawPresGrantFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoPerformWithdrawPresGrantFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus )
+ {
+ DP_SDA("CPresencePluginAuthorization");
+ DP_SDA(" -> DoPerformWithdrawPresGrantFromPresentityL");
+ StartXdmOperationL( aPresentityId,
+ EWithdrawFromPresentity, aClientStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoGrantPresenceForPresentityGroupMembersL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoGrantPresenceForPresentityGroupMembersL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoGrantPresenceForPresentityGroupMembersL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::
+// DoUpdatePresenceGrantPifForPresentityGroupMembersL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::
+ DoUpdatePresenceGrantPifForPresentityGroupMembersL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::
+// DoWithdrawPresenceGrantFromPresentityGroupMembersL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::
+ DoWithdrawPresenceGrantFromPresentityGroupMembersL(
+ const MXIMPIdentity& /*aGroupId*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoGrantPresenceForEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoGrantPresenceForEveryoneL(
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoGrantPresenceForEveryoneL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoUpdatePresenceGrantPifForEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoUpdatePresenceGrantPifForEveryoneL(
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoUpdatePresenceGrantPifForEveryoneL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoWithdrawPresenceGrantFromEveryoneL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoWithdrawPresenceGrantFromEveryoneL(
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoWithdrawPresenceGrantFromEveryoneL -not supported");
+
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoSubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoSubscribePresenceBlockListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoSubscribePresenceBlockListL ");
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC();
+ StartXdmOperationL( *nobody, aReqId, ESubscribeBlockList );
+ // Cannot PopAndDestroy by name
+ CleanupStack::PopAndDestroy( );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoUnsubscribePresenceBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoUnsubscribePresenceBlockListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoUnsubscribePresenceBlockListL ");
+ MXIMPIdentity* nobody = iConnObs.ObjectFactory().NewIdentityLC();
+ StartXdmOperationL( *nobody, aReqId, EUnsubscribeBlockList );
+ // Cannot PopAndDestroy by name
+ CleanupStack::PopAndDestroy();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoBlockPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginAuthorization::DoBlockPresenceForPresentityL ");
+ StartXdmOperationL( aPresentityId, aReqId, EBlockPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoPerformBlockPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoPerformBlockPresenceForPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus )
+ {
+ DP_SDA(
+ "CPresencePluginAuthorization::DoPerformBlockPresenceForPresentityL");
+ StartXdmOperationL( aPresentityId, EBlockPresentity, aClientStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoCancelPresenceBlockFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA(" DoCancelPresenceBlockFromPresentityL ");
+ StartXdmOperationL( aPresentityId, aReqId, EUnblockPresentity );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoPerformCancelPresenceBlockFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoPerformCancelPresenceBlockFromPresentityL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aClientStatus )
+ {
+ DP_SDA(" DoPerformCancelPresenceBlockFromPresentityL (list)");
+ StartXdmOperationL( aPresentityId, EUnblockPresentity, aClientStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::DoCancel( )
+ {
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::RunL( )
+ {
+ TInt myStatus = iStatus.Int();
+
+ DP_SDA2( "CPresencePluginAuthorization::RunL mystatus %d ", myStatus );
+ DP_SDA2( "CPresencePluginAuthorization::RunL state %d ",iOperation );
+
+ if ( !iXdmOk && !myStatus )
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL !iXdmOk && !myStatus" );
+ iXdmOk = ETrue;
+ CallActualXdmOperationL();
+ }
+ else if ( iClientStatus )
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - complete client" );
+ TRequestStatus* s = iClientStatus;
+ User::RequestComplete( s, myStatus );
+ iClientStatus = NULL;
+ DP_SDA( "CPresencePluginAuthorization::RunL - complete client ok" );
+ }
+ else if ( !myStatus )
+ {
+ switch ( iAuthState )
+ {
+ case EStateDoBlock:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Block presentity" );
+ BlockPresentityL();
+ iAuthState = EStateRemovePresentityFromGranted;
+ }
+ break;
+
+ case EStateRemovePresentityFromGranted:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Remove presentity from granted" );
+ WithdrawFromPresentityL();
+ iAuthState = EStateBlocked;
+ }
+ break;
+
+ case EStateBlocked:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Blocked" );
+ SetPresentityBlockedToXIMPL();
+ iAuthState = EStateIdle;
+ CompleteXIMPReq( myStatus );
+ }
+ break;
+
+ case EStateIsContactBlockedBuddyRequest:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Resolve contact type" );
+ // resolve is contact blocked friend request
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *iPresIdentity );
+ IsBlockedContactFriendRequestL( *withoutPrefix, *this, iStatus );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ SetActive();
+ iAuthState = EStateDoUnBlock;
+ }
+ break;
+
+ case EStateDoUnBlock:
+ {
+ if ( iContactIsStored )
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Grant presence for presentity" );
+ GrantPresenceForPresentityL();
+ iAuthState = EStatePresenceGranted;
+ }
+ else
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - Complete unblock" );
+ iAuthState = EStateIdle;
+ CompleteXIMPReq( myStatus );
+ }
+ }
+ break;
+
+ case EStatePresenceGranted:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL -Subscribe presentity presence" );
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( iPresIdentity->Des() );
+ iConnObs.WatcherHandlerL()->DoPerformSubscribePresentityPresenceL( *identity, iStatus );
+ CleanupStack::PopAndDestroy( ); //identity
+ iAuthState = EStateIdle;
+ SetActive();
+ }
+ break;
+
+ default:
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL - default case" );
+ CompleteXIMPReq( myStatus );
+ }
+ break;
+ }
+ }
+ else
+ {
+ DP_SDA( "CPresencePluginAuthorization::RunL -error" );
+ CompleteXIMPReq( myStatus );
+ }
+
+ if ( EStateAcceptBuddyRequest == iAuthState && EGrantPresenceForPresentity == iOperation )
+ {
+ iAuthState = EStateIdle;
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *iPresIdentity );
+ CallHandlePresenceGrantRequestObsoletedL( *withoutPrefix );
+ iConnObs.SubscribedContacts()->HandlePresentityGroupMemberAddedL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ }
+
+ DP_SDA( "CPresencePluginAuthorization::RunL - exit" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::CallActualXdmOperationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::CallActualXdmOperationL()
+ {
+ DP_SDA("CPresencePluginAuthorization::CallActualXdmOperationL ");
+ DP_SDA2("CallActualXdmOperationL operation %d", iOperation );
+ iComplete = EFalse;
+ switch ( iOperation )
+ {
+ case EGrantPresenceForPresentity:
+ {
+ DP_SDA("CallActualXdmOperationL EGrantPresenceForPresentity");
+ GrantPresenceForPresentityL();
+ }
+ break;
+
+ case EWithdrawFromPresentity:
+ {
+ DP_SDA("CallActualXdmOperationL EWithdrawFromPresentity");
+ WithdrawFromPresentityL();
+ }
+ break;
+
+ case ESubscribeBlockList:
+ {
+ SubscribeBlockListL( );
+ }
+ break;
+
+ case EUnsubscribeBlockList:
+ {
+ UnSubscribeBlockListL();
+ }
+ break;
+
+ case EBlockPresentity:
+ {
+ DP_SDA( "CallActualXdmOperationL EBlockPresentity" );
+
+ TRAPD( error, UnsubscribePresentityPresenceL() );
+
+ if( error )
+ {
+ DP_SDA2( "Unsubscribe presentity FAIL, error = %d" , error );
+
+ if ( KErrNotFound != error )
+ {
+ User::Leave( error );
+ }
+ BlockPresentityL();
+ iAuthState = EStateBlocked;
+ }
+ else
+ {
+ iAuthState = EStateDoBlock;
+ }
+ }
+ break;
+
+ case EUnblockPresentity:
+ {
+ DP_SDA("CallActualXdmOperationL EUnblockPresentity");
+ UnblockPresentityL();
+ }
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ DP_SDA("CPresencePluginAuthorization::CallActualXdmOperationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginAuthorization::RunError( TInt aError )
+ {
+ // complete the open request
+ CompleteXIMPReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginAuthorization::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ return this;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::GetInterface() const
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePluginAuthorization::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ return const_cast<CPresencePluginAuthorization*>(this);
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginAuthorization::GetInterfaceId() const
+ {
+ return MProtocolPresenceAuthorization::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri )
+ {
+ DP_SDA2("CPresencePluginAuthorization::SetPresIdentityL: %S",
+ &aPresentityId.Identity() );
+
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+
+ if ( aFormatUri )
+ {
+ DP_SDA("CPresencePluginAuthorization::SetPresIdentityL, add prefix");
+
+ HBufC8* identityCopy = HBufC8::NewLC( KBufSize255 );
+ TPtr8 identityCopyPtr( identityCopy->Des() );
+ identityCopyPtr.Copy( aPresentityId.Identity() );
+
+ HBufC8* prefixUri = iPresenceData->CreatePresenceUri8LC(
+ identityCopyPtr );
+
+ HBufC* prefixUri16 = HBufC::NewLC( KBufSize255 );
+ TPtr prefixUri16Ptr( prefixUri16->Des() );
+ prefixUri16Ptr.Copy( *prefixUri );
+
+ iPresIdentity = prefixUri16;
+ CleanupStack::Pop( prefixUri16 );
+ CleanupStack::PopAndDestroy( prefixUri );
+ CleanupStack::PopAndDestroy( identityCopy );
+ }
+ else
+ {
+ DP_SDA(" SetPresIdentityL, use as it is");
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+ DP_SDA( "CPresencePluginAuthorization::SetPresIdentityL -exit" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::WinfoNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ DP_SDA("CPresencePluginAuthorization::WinfoNotificationL");
+ // Ignore notification if not subscribed
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ DP_SDA2("CPresencePluginAuthorization::WinfoNotificationL count %d",
+ count);
+
+ if ( !count )
+ {
+ // stop parsing empty notification
+ DP_SDA("CPresencePluginAuthorization::WinfoNotificationL LEAVE");
+ User::Leave( KErrArgument );
+ }
+
+ const TDesC8* stateVal = aWinfo.AttrValue( KPresenceState8 );
+ if ( stateVal && !stateVal->CompareF( KPresenceFull8 ))
+ {
+ // Call full list method
+ DP_SDA("CPresencePluginAuthorization::WinfoNotificationL FULL winfo");
+ HandleFullWinfoNotificationL( aWinfo );
+ }
+ else
+ {
+ // Indicate changes in WINFO list one by one.
+ DP_SDA("CPresencePluginAuthorization::WinfoNotificationLPARTIAL winfo");
+ HandlePartialWinfoNotificationL( aWinfo );
+ }
+ CleanupStack::PopAndDestroy( &elems );
+ DP_SDA("CPresencePluginAuthorization::WinfoNotificationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::StartXdmOperationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginAuthOperation aOperation )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrNotReady ) );
+ DP_SDA("CPresencePluginAuthorization::StartXdmOperationL 2");
+ SetPresIdentityL( aId, ETrue );
+
+ iXIMPId = aReqId;
+ iOperation = aOperation;
+ if ( !iXdmUtils )
+ {
+ DP_SDA("StartXdmOperationL !iXdmUtils");
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ if ( iXdmUtils->CheckXdmDoc() )
+ {
+ DP_SDA("StartXdmOperationL iXdmOk");
+ iXdmOk = ETrue;
+ CallActualXdmOperationL();
+ }
+ else
+ {
+ DP_SDA("StartXdmOperationL else");
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ }
+ DP_SDA("CPresencePluginAuthorization::StartXdmOperationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::StartXdmOperationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TPluginAuthOperation aOperation,
+ TRequestStatus& aClientStatus )
+ {
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrNotReady ) );
+ DP_SDA("CPresencePluginAuthorization::StartXdmOperationL 3 (list)");
+
+ SetPresIdentityL( aId, EFalse );
+
+ iClientStatus = &aClientStatus;
+ *iClientStatus = KRequestPending;
+
+ iOperation = aOperation;
+
+ if ( !iXdmUtils )
+ {
+ DP_SDA("StartXdmOperationL !iXdmUtils");
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ if ( iXdmUtils->CheckXdmDoc() )
+ {
+ DP_SDA("StartXdmOperationL iXdmOk");
+ iXdmOk = ETrue;
+ CallActualXdmOperationL();
+ }
+ else
+ {
+ DP_SDA("StartXdmOperationL else");
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ }
+ DP_SDA("CPresencePluginAuthorization::StartXdmOperationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::CompleteXIMPReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::CompleteXIMPReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginAuthorization::CompleteXIMPReq");
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iXIMPId, aStatus );
+ iXIMPId = TXIMPRequestId();
+ DP_SDA("CPresencePluginAuthorization::CompleteXIMPReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::SubscribeBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::SubscribeBlockListL()
+ {
+ DP_SDA("CPresencePluginAuthorization::SubscribeBlockList");
+
+ RPointerArray<MXIMPIdentity> blocked;
+ CleanupStack::PushL( TCleanupItem(
+ TPresencePluginUtility::ResetAndDestroyIdentities,
+ &blocked ) );
+
+ iXdmUtils->SubscribeBlockListL( blocked );
+ MXIMPObjectCollection* coll =
+ iConnObs.ObjectFactory().NewObjectCollectionLC(); // << coll
+
+ TInt count = blocked.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MXIMPIdentity* currId = blocked[i];
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( currId->Identity() );
+ currId->SetIdentityL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ MPresenceBlockInfo* bInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceBlockInfoLC();
+ bInfo->SetBlockedEntityIdL( currId ); // ownership is taken
+ blocked.Remove( i ); // remove currId from blocked
+ blocked.InsertL( NULL, i );
+ bInfo->SetBlockedEntityDisplayNameL( currId->Identity() );
+ coll->AddObjectL( bInfo );// ownership is taken
+ CleanupStack::Pop();// >> bInfo
+ }
+
+ DP_SDA("SubscribeBlockList complete request");
+ CompleteXIMPReq( KErrNone );
+
+ MXIMPDataSubscriptionState* myState =
+ iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+
+ // Notice: consider XIMP error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ iDataHost->SetPresenceBlockDataSubscriptionStateL(
+ myState, myStatus );
+
+ iDataHost->HandlePresenceBlockListL( coll );
+ //Callback for subscription result
+ CleanupStack::Pop( 3 ); // >> myState, myStatus, coll
+ CleanupStack::PopAndDestroy( &blocked );
+ DP_SDA("CPresencePluginAuthorization::SubscribeBlockList end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::UnSubscribeBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::UnSubscribeBlockListL()
+ {
+ DP_SDA("CPresencePluginAuthorization::UnSubscribeBlockListL");
+
+ MXIMPObjectCollection* coll =
+ iConnObs.ObjectFactory().NewObjectCollectionLC();
+
+ MXIMPDataSubscriptionState* myState =
+ iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ iDataHost->SetPresenceBlockDataSubscriptionStateL(
+ myState, myStatus );
+
+ iDataHost->HandlePresenceBlockListL( coll );
+
+ CleanupStack::Pop( 3 );
+
+ CompleteXIMPReq( KErrNone );
+
+ DP_SDA("CPresencePluginAuthorization::UnSubscribeBlockListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::ReturnListSubsState()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginAuthorization::ReturnListSubsState()
+ {
+ return iSubscribed;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::PluginData()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginData& CPresencePluginAuthorization::PluginData()
+ {
+ return *iPresenceData;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::HandleFullWinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::HandleFullWinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KPresenceWatcherList8 ); //watcher-list
+ DP_SDA2("HandleFullWinfoNotificationL leave if watcherlist error %d", err);
+ User::LeaveIfError( err );
+
+ err = elem->SimpleElementsL( elems );
+ DP_SDA2("HandleFullWinfoNotificationL error %d", err);
+ User::LeaveIfError( err );
+
+ count = elems.Count();
+ DP_SDA("HandleFullWinfoNotificationL watcher list is valid");
+
+ // Search watchers who are pending (status = pending)
+ HBufC* nodeContent = NULL;
+ MXIMPObjectCollection *pendings =
+ iConnObs.ObjectFactory().NewObjectCollectionLC();
+
+ TBool pendingFound(EFalse);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ elem = elems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KPresenceWatcher8 )))
+ {
+ const TDesC8* pp8 = elem->AttrValue( KPresenceStatus8 );
+ if ( pp8 && !pp8->CompareF( KPresencePending8 ))
+ {
+ DP_SDA("HandleFullWinfoNotificationL least one pending");
+ // Build collection of grant requests
+ // Find the child node containing the SIP entity
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ // create the collection entry here
+ MPresenceGrantRequestInfo* grInfo =
+ iConnObs.PresenceObjectFactoryOwn().
+ NewPresenceGrantRequestInfoLC();
+ MXIMPIdentity* identity =
+ iConnObs.ObjectFactory().NewIdentityLC();
+
+ // Remove prefix to keep client side protocol agnostic
+ HBufC16* withoutPrefix = iPresenceData->RemovePrefixLC(
+ *nodeContent );
+ identity->SetIdentityL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+
+ grInfo->SetRequestorIdL( identity ); // ownership is taken
+
+ pendings->AddObjectL( grInfo ); // ownership is taken
+ pendingFound = ETrue;
+ CleanupStack::Pop( 2 ); //grInfo, identity
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ }
+ }
+
+ if ( pendingFound )
+ {
+ DP_SDA("HandleFullWinfoNotificationL send pending");
+ iXIMPIdOwn = iDataHost->HandlePresenceGrantRequestListL( pendings );
+ CleanupStack::Pop(); // >> pendings
+ }
+ else
+ {
+ DP_SDA("HandleFullWinfoNotificationL pop pending");
+ CleanupStack::PopAndDestroy( ); // >> pendings
+ }
+
+ CleanupStack::PopAndDestroy( &elems );
+ DP_SDA("CPresencePluginAuthorization::HandleFullWinfoNotificationL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::HandlePartialWinfoNotificationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::HandlePartialWinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ DP_SDA("CPresencePluginAuthorization::HandlePartialWinfoNotificationL");
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems );
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KPresenceWatcherList8 );
+ User::LeaveIfError( err );
+
+ err = elem->SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ count = elems.Count();
+
+ HBufC* nodeContent = NULL;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ elem = elems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KPresenceWatcher8 )))
+ {
+ const TDesC8* pp8 = elem->AttrValue( KPresenceStatus8 );
+ if ( pp8 && !pp8->CompareF( KPresencePending8 ))
+ {
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+
+ // Remove prefix to keep client side protocol agnostic
+ HBufC16* withoutPrefix = iPresenceData->RemovePrefixLC(
+ *nodeContent );
+ CallHandlePresenceGrantRequestReceivedL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ else if ( pp8 && !pp8->CompareF( KPresenceTerminated8 ))
+ {
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+
+ // Remove prefix to keep client side protocol agnostic
+ HBufC16* withoutPrefix = iPresenceData->RemovePrefixLC(
+ *nodeContent );
+ CallHandlePresenceGrantRequestObsoletedL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ else if ( pp8 && !pp8->CompareF( KPresenceActive8 ))
+ {
+ DP_SDA( "CPresencePluginAuthorization::HandlePartialWinfoNotificationL presence active" );
+
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ TInt pos( 0 );
+ if ( iConnObs.SubscribedContacts()->
+ GetVirtualIdentityArray()->Find( *nodeContent, pos ) == 0 )
+ {
+ HBufC8* buffer = HBufC8::NewLC( nodeContent->Length() );
+ buffer->Des().Copy( *nodeContent );
+ if ( !iConnObs.WatcherHandlerL()->MatchWatcherId( *buffer ) )
+ {
+ DP_SDA( "CPresencePluginAuthorization::HandlePartialWinfoNotificationL -subscribe presence" );
+ iConnObs.WatcherHandlerL()->SubscribeL( *nodeContent );
+ }
+ CleanupStack::PopAndDestroy( buffer );
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( &elems );
+ DP_SDA("CPresencePluginAuthorization::HandlePartialWinfoNotificationL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::CallHandlePresenceGrantRequestReceivedL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::CallHandlePresenceGrantRequestReceivedL(
+ const TDesC& aUserId )
+ {
+ DP_SDA("PluginAuthorization::CallHandlePresenceGrantRequestReceivedL");
+ // create the collection entry here
+ MPresenceGrantRequestInfo* grInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceGrantRequestInfoLC();
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( aUserId );
+ grInfo->SetRequestorIdL( identity ); // ownership is taken
+ CleanupStack::Pop( ); // -identity
+
+ iDataHost->HandlePresenceGrantRequestReceivedL( grInfo );//ownership taken
+ CleanupStack::Pop( ); // -grInfo
+ DP_SDA("PluginAuthorization::CallHandlePresenceGrantRequestReceivedL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::CallHandlePresenceGrantRequestObsoletedL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::CallHandlePresenceGrantRequestObsoletedL(
+ const TDesC& aUserId )
+ {
+ DP_SDA("PluginAuthorization::CallHandlePresenceGrantRequestObsoletedL");
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( aUserId );
+ iDataHost->HandlePresenceGrantRequestObsoletedL( identity );//taken
+ CleanupStack::Pop( );// >> identity
+ DP_SDA("PluginAuthorization::CallHandlePresenceGrantRequestObsoletedL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::GrantPresenceForPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::GrantPresenceForPresentityL()
+ {
+ iXdmUtils->AddEntityToGrantedL(
+ iPresIdentity->Des(), iStatus );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::WithdrawFromPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::WithdrawFromPresentityL()
+ {
+ iXdmUtils->RemoveEntityFromGrantedL(
+ iPresIdentity->Des(),iStatus );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::UnsubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::UnsubscribePresentityPresenceL()
+ {
+ DP_SDA( "CPresencePluginAuthorization::UnsubscribePresentityPresence" );
+
+ MXIMPIdentity* identity =
+ iConnObs.ObjectFactory().NewIdentityLC();
+ identity->SetIdentityL( iPresIdentity->Des() );
+ iConnObs.WatcherHandlerL()->
+ DoPerformUnsubscribePresentityPresenceL( *identity, iStatus );
+ CleanupStack::PopAndDestroy(); // identity
+ SetActive();
+
+ DP_SDA( "CPresencePluginAuthorization::UnsubscribePresentityPresence -Exit" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::BlockPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::BlockPresentityL()
+ {
+ DP_SDA( "CPresencePluginAuthorization::BlockPresentityL" );
+ // add entity to block list
+ iXdmUtils->AddEntityToBlockedL(
+ iPresIdentity->Des(), iStatus );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::BlockPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::SetPresentityBlockedToXIMPL()
+ {
+ DP_SDA( "CPresencePluginAuthorization::SetPresentityBlockedToXIMPL" );
+
+ MPresenceBlockInfo* bInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceBlockInfoLC();
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *iPresIdentity );
+ identity->SetIdentityL( *withoutPrefix );
+ bInfo->SetBlockedEntityIdL( identity ); // ownership is taken
+ // Write blocked state into the presence cache
+ TBuf<20> buf;
+ buf.Copy( KBlockedExtensionValue );
+ iPresenceData->WriteStatusToCacheL(
+ *withoutPrefix,
+ MPresenceBuddyInfo2::EUnknownAvailability,
+ buf,
+ KNullDesC() );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ iDataHost->HandlePresenceBlockedL( bInfo );
+ CleanupStack::Pop();// >> identity
+ CleanupStack::Pop();// >> bInfo
+
+ DP_SDA( "CPresencePluginAuthorization::SetPresentityBlockedToXIMPL -Exit" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::UnblockPresentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::UnblockPresentityL()
+ {
+ DP_SDA( "CPresencePluginAuthorization::UnblockPresentityL" );
+
+ //remove entity from blocked list
+ iXdmUtils->RemoveEntityFromBlockedL(
+ iPresIdentity->Des(), iStatus );
+ //remove enity from ximp blocked too
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *iPresIdentity );
+ identity->SetIdentityL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ iDataHost->HandlePresenceBlockCanceledL( identity );
+ CleanupStack::Pop();// >> identity
+ iAuthState = EStateIsContactBlockedBuddyRequest;
+ SetActive();
+
+ DP_SDA( "CPresencePluginAuthorization::UnblockPresentityL -Exit" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginAuthorization::IsBlockedContactFriendRequest()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::IsBlockedContactFriendRequestL(
+ const TDesC& aPresenceId,
+ MPresencePluginContactsObs& aObserver,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA( "CPresencePluginAuthorization::IsBlockedContactFriendRequest" );
+
+ delete iContacts;
+ iContacts = NULL;
+
+ HBufC* serviceName =
+ iPresenceData->ServiceNameLC( iPresenceData->ServiceId() );
+
+ iContacts = CPresencePluginContacts::NewL(
+ iPresenceData->ServiceId(), *serviceName, aObserver );
+
+ CleanupStack::PopAndDestroy( serviceName );
+
+ iContacts->IsPresenceIdStoredL( aPresenceId, aStatus );
+
+ DP_SDA( "CPresencePluginAuthorization::IsBlockedContactFriendRequest -exit" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From base class MPresencePluginContactsObs
+// CPresencePluginAuthorization::RequestComplete()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginAuthorization::RequestComplete( TAny* aResult,
+ TPresenceContactsOperation aOperation, TInt aError )
+ {
+ DP_SDA( "CPresencePluginAuthorization::RequestComplete" );
+
+ switch( aOperation )
+ {
+ case EOperationIsPresenceStoredToContacts:
+ if ( aResult != NULL && KErrNone == aError )
+ {
+ iContactIsStored = *static_cast<TBool*>( aResult );
+ }
+ break;
+ default:
+ break;
+ }
+ DP_SDA2( "CPresencePluginAuthorization::RequestComplete - iContactIsStored = %d", iContactIsStored );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginconnection.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,978 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <badesca.h>
+#include <ximpbase.h>
+#include <ximpserviceinfo.h>
+#include <protocolpresencefeatures.h>
+#include <cprotocolimfeatures.h>
+#include <protocolpresencedatahost.h>
+#include <presenceobjectfactory.h>
+
+#include <ximpcontextclientinfo.h>
+#include <protocolpresenceauthorization.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpfeatureinfo.h> //for etc. KPublish
+#include <msimpleconnection.h> //Part of Registration API from SIMPLE engine
+#include <msimpleconnectionobserver.h>//Connection callback methods
+#include <presenceinfo.h>
+
+#include "presencepluginconnection.h"
+#include "presencepluginsession.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presencepluginwatcher.h"
+#include "presencepluginauthorization.h"
+#include "presencepluginwinfo.h"
+#include "presencepluginpublisher.h"
+#include "presenceplugingroup.h"
+#include "presencepluginxdmutils.h"
+#include "presencepluginvirtualgroup.h"
+#include "presenceconnectioninfo.h"
+#include "presenceplugindata.h"
+
+#include "simpleimpluginuids.hrh" //KImplUidSimpleImPlugin
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CPresencePluginConnection()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginConnection::CPresencePluginConnection( ):
+ CActive( CActive::EPriorityHigh ), iSipPresentity(NULL),
+ iStopPublishState( EFalse ), iGrantListSubs( EFalse ), iStopPublishCall( EFalse ),
+ iTerminatedCall( EFalse )
+ {
+ DP_SDA("CPresencePluginConnection::CPresencePluginConnection");
+ CActiveScheduler::Add(this);
+ iOwnTupleId = 0;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginConnection* CPresencePluginConnection::NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo )
+ {
+ DP_SDA("CPresencePluginConnection::NewL");
+ CPresencePluginConnection* self =
+ new( ELeave ) CPresencePluginConnection( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceInfo, aClientCtxInfo );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::NewL() loaded
+// ---------------------------------------------------------------------------
+//
+CPresencePluginConnection* CPresencePluginConnection::NewL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& aClientCtxInfo,
+ const TDesC8& aETag )
+ {
+ DP_SDA("CPresencePluginConnection::NewL loaded");
+ CPresencePluginConnection* self =
+ new( ELeave ) CPresencePluginConnection( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceInfo, aClientCtxInfo, aETag );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::ConstructL() loaded
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::ConstructL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& /*aClientCtxInfo*/,
+ const TDesC8& aETag )
+ {
+ DP_SDA("CPresencePluginConnection::ConstructL loaded");
+
+ iETag = aETag.AllocL();
+
+ iSession = CPresencePluginSession::NewL( aServiceInfo, *this );
+
+ // create instance from data class
+ iPresenceData = CPresencePluginData::NewL( *this,
+ aServiceInfo.IapId() );
+
+ DP_SDA("ConstructL create subscribed buddy list loaded ");
+ // create another virtual group for all subscribed buddyes
+ iSubscribedBuddys =
+ CPresencePluginVirtualGroup::NewL( *this,
+ KPresenceBuddyList(),
+ iPresenceData );
+
+ iAuth = CPresencePluginAuthorization::NewL( *this, iPresenceData );
+
+ iPublisher = CPresencePluginPublisher::NewL(
+ *this,
+ *iSession->SimpleConnection(),
+ iPresenceData );
+
+ iWatcher = CPresencePluginWatcher::NewL(
+ *this,
+ *iSession->SimpleConnection(),
+ iPresenceData );
+
+ iGroups = CPresencePluginGroups::NewL(
+ *this, iSubscribedBuddys, iPresenceData );
+
+ iPluginWinfo = CPresencePluginWinfo::NewL(
+ *this, *(iSession->SimpleConnection() ));
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::ConstructL(
+ const MXIMPServiceInfo& aServiceInfo,
+ const MXIMPContextClientInfo& /*aClientCtxInfo*/ )
+ {
+ DP_SDA("CPresencePluginConnection::ConstructL");
+
+ iETag = KNullDesC8().AllocL();
+
+ iSession = CPresencePluginSession::NewL( aServiceInfo, *this );
+
+ // create instance from data class
+ iPresenceData = CPresencePluginData::NewL( *this,
+ aServiceInfo.IapId() );
+
+ DP_SDA("ConstructL create subscribed buddy list");
+ // create another virtual group for all subscribed buddyes
+ iSubscribedBuddys =
+ CPresencePluginVirtualGroup::NewL(
+ *this, KPresenceBuddyList(), iPresenceData );
+
+ iAuth = CPresencePluginAuthorization::NewL( *this, iPresenceData );
+
+ iPublisher = CPresencePluginPublisher::NewL(
+ *this,
+ *iSession->SimpleConnection(),
+ iPresenceData );
+
+ iWatcher = CPresencePluginWatcher::NewL(
+ *this,
+ *iSession->SimpleConnection(),
+ iPresenceData );
+
+ iGroups = CPresencePluginGroups::NewL(
+ *this, iSubscribedBuddys, iPresenceData );
+
+ iPluginWinfo = CPresencePluginWinfo::NewL(
+ *this, *(iSession->SimpleConnection() ));
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::~CPresencePluginConnection()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginConnection::~CPresencePluginConnection()
+ {
+ DP_SDA("CPresencePluginConnection::~CPresencePluginConnection");
+
+ delete iSipPresentity;
+ iSipPresentity = NULL;
+
+ delete iPluginWinfo;
+ iPluginWinfo = NULL;
+
+ delete iWatcher;
+ iWatcher = NULL;
+
+ delete iPublisher;
+ iPublisher = NULL;
+
+ delete iAuth;
+ iAuth = NULL;
+
+ delete iGroups;
+ iGroups = NULL;
+
+ delete iSession;
+ iSession = NULL;
+
+ delete iImFeatures;
+
+ REComSession::FinalClose();
+
+ delete iSubscribedBuddys;
+ delete iPresenceData;
+
+ delete iETag;
+ iETag = NULL;
+ DP_SDA("CPresencePluginConnection::~CPresencePluginConnection end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PrimeHost
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::PrimeHost(
+ MXIMPProtocolConnectionHost& aHost )
+ {
+ DP_SDA("CPresencePluginConnection::PrimeHost");
+ iConnectionHost = &aHost;
+ iAuth->SetDataHost(
+ iConnectionHost->ProtocolPresenceDataHost().AuthorizationDataHost() );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetOnlineBuddyGroup()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginVirtualGroup* CPresencePluginConnection::SubscribedContacts( )
+ {
+ return iSubscribedBuddys;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetSessionStatus()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginConnection::GetSessionStatus( )
+ {
+ return iSession->ConnectionStatus();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::TupleIdGet()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginConnection::GetTupleId() const
+ {
+ DP_SDA("CPresencePluginConnection::TupleIdGet");
+ return iOwnTupleId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetEtag()
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CPresencePluginConnection::GetETag() const
+ {
+ DP_SDA("CPresencePluginConnection::GetETag");
+
+ if( !iETag )
+ {
+ DP_SDA2("CPresencePluginConnection::GetETag empty ??? %S", iConnectionArray->GetConnectionEtag() );
+ return KNullDesC8();
+ }
+
+ return *iETag;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::SetETag()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::SetETag( const TDesC8& aETag )
+ {
+ DP_SDA("CPresencePluginConnection::SetETag");
+ delete iETag;
+ iETag = NULL;
+
+ TRAP_IGNORE( ( iETag = aETag.AllocL() ) );
+ //Add etag also in connectionArray
+ iConnectionArray->SetConnectionETag( *iETag );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::SetConnectionArray()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::SetConnectionArray(
+ CPresenceConnectionInfo* aArray )
+ {
+ DP_SDA("CPresencePluginConnection::SetConnectionArray");
+ iConnectionArray = aArray;
+ iConnectionArray->SetConnectionStatus( EActive );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetConnectionArray()
+// ---------------------------------------------------------------------------
+//
+CPresenceConnectionInfo* CPresencePluginConnection::GetConnectionArray( )
+ {
+ DP_SDA("CPresencePluginConnection::GetConnectionArray");
+ return iConnectionArray;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::TupleIdGet()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginConnection::GetPresenceSetId() const
+ {
+ DP_SDA("CPresencePluginConnection::GetPresenceSetId");
+ return iSession->GetPresenceSetId();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::TupleIdGet()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::SetTupleId( const TInt aTupleId )
+ {
+ DP_SDA("CPresencePluginConnection::TupleIdSet");
+ iOwnTupleId = aTupleId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetStopPublishState()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginConnection::GetStopPublishState()
+ {
+ DP_SDA2("::GetStopPublishState = %d", (TInt)iStopPublishState );
+ return iStopPublishState;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::SetStopPublishState()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::SetStopPublishState( TBool aState )
+ {
+ DP_SDA2("SetStopPublishState : aState = %d ", (TInt)aState );
+ iStopPublishState = aState;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresenceWatching
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceDataHost& CPresencePluginConnection::ProtocolPresenceHost()
+ {
+ DP_SDA("CPresencePluginConnection::ProtocolPresenceHost");
+ return iConnectionHost->ProtocolPresenceDataHost();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresenceWatching
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceWatching& CPresencePluginConnection::PresenceWatching()
+ {
+ DP_SDA("CPresencePluginConnection::PresenceWatching");
+ return *iWatcher;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresencePublishing
+// ---------------------------------------------------------------------------
+//
+ MProtocolPresencePublishing& CPresencePluginConnection::PresencePublishing()
+ {
+ return *iPublisher;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresentityGroups
+// ---------------------------------------------------------------------------
+//
+MProtocolPresentityGroups& CPresencePluginConnection::PresentityGroups()
+ {
+ return *iGroups;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresenceAuthorization
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceAuthorization&
+ CPresencePluginConnection::PresenceAuthorization()
+ {
+ DP_SDA2("CPresencePluginConnection::PresenceAuthorization %x", iAuth);
+ return *iAuth;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::InternalPresenceAuthorization
+// ---------------------------------------------------------------------------
+//
+CPresencePluginAuthorization&
+ CPresencePluginConnection::InternalPresenceAuthorization()
+ {
+ DP_SDA2("CPresencePluginConnection::InternalPresenceAuthorization %x", iAuth);
+ return *iAuth;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::OpenSessionL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::OpenSessionL(
+ const MXIMPContextClientInfo& /*aClientCtxInfo*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginConnection::OpenSessionL");
+ iGrantListSubs = ETrue;
+ iTerminatedCall = EFalse;
+ iXIMPId = aReqId;
+ iSession->OpenSessionL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::OpenSessionL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::OpenSessionL( const TInt& /*aSettingsId*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginConnection::OpenSessionL 2 ");
+ iXIMPId = aReqId;
+ iGrantListSubs = ETrue;
+ iTerminatedCall = EFalse;
+ iSession->OpenSessionL( );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CloseSession
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::CloseSession(
+ const MXIMPContextClientInfo& /*aContextClient*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginConnection::CloseSession begin");
+
+ TBool completeXimpRequestNow( EFalse );
+ iConnectionArray->DecreaseClientCount();
+ iXIMPId = aReqId;
+
+ // Client count can´t be negative. Increase if goes negative.
+ // This happens for example in network lost case.
+ // This method is called then because connection is terminated and
+ // for all clients which have done unbind. But here we cannot tell
+ // if this method is called by clients unbind or connection termination
+ // therefore this workaround needed.
+ if ( iConnectionArray->ClientCount() < 0 )
+ {
+ completeXimpRequestNow = ETrue;
+ iConnectionArray->IncreaseClientCount();
+ }
+
+ // In case there is no more clients we cannot complete Ximp request
+ // right away. We have to stop publish first, Ximp request completion is
+ // handled in RunL after that is done.
+ if( KErrNone == iConnectionArray->ClientCount() &&
+ (EActive == iConnectionArray->GetConnectionStatus()) )
+ {
+ completeXimpRequestNow = EFalse; // request is completed later in RunL
+ iGrantListSubs = EFalse;
+
+ //Start stopPublish request
+ DeRegister();
+ }
+
+ if ( !iStopPublishCall )
+ {
+ completeXimpRequestNow = ETrue;
+ }
+
+ if ( completeXimpRequestNow )
+ {
+ CompleteReq( iXIMPId, KErrNone );
+ }
+
+ DP_SDA("CPresencePluginConnection::CloseSession end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetSupportedFeaturesL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::GetSupportedFeaturesL(
+ CDesC8Array& aFeatures ) const
+ {
+ DP_SDA("CPresencePluginConnection::GetSupportedFeaturesL");
+ // first empty the whole array
+ aFeatures.Reset();
+ using namespace NXIMPFeature::Presence;
+ aFeatures.AppendL( KPublish );
+ aFeatures.AppendL( KSubscribe );
+ aFeatures.AppendL( KUnsubscribe );
+ aFeatures.AppendL( KAddContact );
+ aFeatures.AppendL( KDeleteContact );
+ aFeatures.AppendL( KFetch );
+ aFeatures.AppendL( KBlock );
+ aFeatures.AppendL( KUnBlock );
+
+ if( iImFeatures )
+ {
+ using namespace NXIMPFeature::InstantMessage;
+ aFeatures.AppendL( KInstantMessage );
+ }
+ }
+
+//*****************************************************************************
+//* FROM MPresencePluginConnectionObs
+//*****************************************************************************
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CompleteReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::CompleteReq( TReqType aType, TInt aStatus )
+ {
+ DP_SDA("CPresencePluginConnection::CompleteReq");
+ // Return immediately if PrimeHost() is not called.
+ if ( !iConnectionHost )
+ {
+ DP_SDA("CPresencePluginConnection::CompleteReq !iConnectionHost");
+ iXIMPId = TXIMPRequestId();
+ return;
+ }
+
+ switch ( aType )
+ {
+ case EOpenSess:
+ {
+ DP_SDA("CPresencePluginConnection::CompleteReq EOpenSess");
+ iConnectionHost->HandleRequestCompleted( iXIMPId, aStatus );
+ iXIMPId = TXIMPRequestId();
+ //Set connection status to connection Array
+ iConnectionArray->SetConnectionStatus( EActive );
+ }
+ break;
+ case ECloseSess:
+ {
+ DP_SDA("CPresencePluginConnection::CompleteReq ECloseSess");
+ iConnectionArray->DecreaseClientCount();
+ CompleteReq( iXIMPId, aStatus );
+ iConnectionArray->SetConnectionStatus( ENotActive );
+ }
+ break;
+ default:
+ DP_SDA("CPresencePluginConnection::CompleteReq DEFAULT");
+ break;
+ };
+ DP_SDA("CPresencePluginConnection::CompleteReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CompleteReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::CompleteReq(
+ TXIMPRequestId aReqId,
+ TInt aStatus )
+ {
+ DP_SDA2("CPresencePluginConnection::CompleteReq status %d", aStatus);
+ // Return immediately if PrimeHost() is not called.
+ if ( !iConnectionHost )
+ {
+ DP_SDA("CPresencePluginConnection::CompleteReq return");
+ return;
+ }
+ DP_SDA("CPresencePluginConnection::CompleteReq complete");
+ iConnectionHost->HandleRequestCompleted( aReqId, aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::ObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MXIMPObjectFactory& CPresencePluginConnection::ObjectFactory()
+ {
+ DP_SDA("CPresencePluginConnection::ObjectFactory");
+ return iConnectionHost->ObjectFactory();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::Host
+// ---------------------------------------------------------------------------
+//
+MXIMPProtocolConnectionHost* CPresencePluginConnection::Host()
+ {
+ DP_SDA("CPresencePluginConnection::Host");
+ return iConnectionHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection:CurrentDomain
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CPresencePluginConnection::CurrentDomain()
+ {
+ return iSession->CurrentDomain();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CurrentSipPresentit8()
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CPresencePluginConnection::CurrentSipPresentity8()
+ {
+ return iSession->CurrentSipPresentity();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection:XdmUtilsL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmUtils* CPresencePluginConnection::XdmUtilsL()
+ {
+ DP_SDA("CPresencePluginConnection::XdmUtilsL");
+ return iSession->XdmUtilsL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::WinfoHandlerL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWinfo* CPresencePluginConnection::WinfoHandlerL()
+ {
+ DP_SDA("CPresencePluginConnection::WinfoHandlerL");
+ if ( !iPluginWinfo )
+ {
+ iPluginWinfo = CPresencePluginWinfo::NewL(
+ *this, *(iSession->SimpleConnection() ));
+ }
+
+ iPluginWinfo->SetHost( iConnectionHost );
+ return iPluginWinfo;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::WatcherHandlerL()
+// ---------------------------------------------------------------------------
+//
+ CPresencePluginWatcher* CPresencePluginConnection::WatcherHandlerL()
+ {
+ DP_SDA("CPresencePluginConnection::WatcherHandlerL");
+ if ( !iWatcher )
+ {
+ DP_SDA("CPresencePluginConnection::WatcherHandlerL: if ( !iWatcher )");
+ iWatcher = CPresencePluginWatcher::NewL(
+ *this,
+ *iSession->SimpleConnection(),
+ iPresenceData );
+ }
+ return iWatcher;
+ }
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::WinfoTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::WinfoTerminatedL( TInt aReason )
+ {
+ DP_SDA("CPresencePluginConnection::WinfoTerminatedL");
+ // Pass the information to iAuth and iPublisher,
+ // so that they can call XIMP Plugin Data Host callbacks.
+ iAuth->WinfoTerminatedL( aReason );
+ iPublisher->WinfoTerminatedL( aReason );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::WinfoNotification()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::WinfoNotification( MSimpleWinfo& aWinfo )
+ {
+ DP_SDA("CPresencePluginConnection::WinfoNotification");
+ TRAP_IGNORE( iPublisher->WinfoNotificationL( aWinfo ));
+ TRAP_IGNORE( iAuth->WinfoNotificationL( aWinfo ));
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginConnection::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface()");
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface()if ");
+ // caller wants this interface
+ return this;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface() panic");
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePluginConnection::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface() const ");
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface()2 ");
+ // caller wants this interface
+ return const_cast<CPresencePluginConnection*>(this);
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ DP_SDA("CPresencePluginConnection::GetInterface()panic 2");
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginConnection::GetInterfaceId() const
+ {
+ DP_SDA("CPresencePluginConnection::GetInterfaceId() const ");
+ return MXIMPProtocolConnection::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::ProtocolPresenceFeatures()
+// ---------------------------------------------------------------------------
+//
+MProtocolPresenceFeatures& CPresencePluginConnection::
+ ProtocolPresenceFeatures()
+ {
+ DP_SDA("CPresencePluginConnection::ProtocolPresenceFeatures() ");
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::PresenceObjectFactory()
+// ---------------------------------------------------------------------------
+//
+MPresenceObjectFactory& CPresencePluginConnection::PresenceObjectFactoryOwn()
+ {
+ DP_SDA("CPresencePluginConnection::PresenceObjectFactoryOwn() ");
+ return iConnectionHost->
+ ProtocolPresenceDataHost().PresenceObjectFactory();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GrandListState()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginConnection::GrandListState( )
+ {
+ DP_SDA2("GrandListState : iGrantListSubs = %d", (TInt)iGrantListSubs );
+ return iGrantListSubs;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::IsStopPublishCalled()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginConnection::IsStopPublishCalled( )
+ {
+ DP_SDA("CPresencePluginConnection::IsStopPublishCalled");
+ return iStopPublishCall;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::TerminateConnectionL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::TerminateConnectionL( )
+ {
+ DP_SDA("CPresencePluginConnection::TerminateConnectionL");
+ iConnectionHost->HandleConnectionTerminated( NULL );
+ iConnectionArray->SetConnectionStatus( ETerminated );
+ DP_SDA("CPresencePluginConnection::TerminateConnectionL Done");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::DeRegister()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::DeRegister( )
+ {
+ DP_SDA("CPresencePluginConnection::Deregister");
+
+ DP_SDA(" -> CloseSession, delete permanent pres data");
+ TRAP_IGNORE( iPresenceData->DeletePresenceVariablesL( ServiceId() ) );
+
+ // Try to stop publish only if we have successfully published
+ if ( iPublisher->Published() )
+ {
+ DP_SDA("CloseSession call stopPublish");
+ TRAP_IGNORE( iPublisher->StopPublishL( iStatus ) );
+ iStopPublishCall = ETrue;
+ SetActive();
+ }
+
+ DP_SDA("CPresencePluginConnection::Deregister Done");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::CreateImFeaturesPlugin()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::CreateImFeaturesPluginL( )
+ {
+ if ( !iImFeatures )
+ {
+ DP_SDA("Creating SimpleImPlugin");
+
+ CSimpleImFeatures::TSimpleImPluginInitParams imPluginInitParams(
+ *this,
+ *iSession->SimpleConnection(),
+ iSession->ServiceId() );
+
+ iImFeatures = static_cast<CSimpleImFeatures*> (
+ CProtocolImFeatures::NewL( TUid::Uid(KImplUidSimpleImPlugin),
+ &imPluginInitParams ) );
+
+ DP_SDA("Creating SimpleImPlugin done");
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::DeleteImFeaturesPlugin()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::DeleteImFeaturesPlugin( )
+ {
+ if ( iImFeatures )
+ {
+ DP_SDA("Deleting SimpleImPlugin");
+
+ delete iImFeatures;
+ iImFeatures = NULL;
+ REComSession::FinalClose();
+
+ DP_SDA("Deleting SimpleImPlugin done");
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::DoCancel( )
+ {
+ DP_SDA("CPresencePluginConnection::DoCancel CANCEL");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginConnection::RunL( )
+ {
+ DP_SDA("CPresencePluginConnection::RunL");
+ TInt status = iStatus.Int();
+ DP_SDA2("CPresencePluginConnection::RunL status %d", status );
+
+ if ( iStopPublishCall )
+ {
+ DP_SDA("CPresencePluginConnection::RunL complete");
+
+ iStopPublishCall = EFalse;
+ CompleteReq( iXIMPId, status );
+
+ DP_SDA("CPresencePluginConnection::RunL --> REMOVE CACHE");
+ iPresenceData->RemoveCacheL();
+
+ DP_SDA("CPresencePluginConnection::RunL --> Delete im plugin");
+ DeleteImFeaturesPlugin();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginConnection::RunError( TInt /*aError*/ )
+ {
+ DP_SDA("CPresencePluginConnection::RunError");
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GroupsL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginGroups& CPresencePluginConnection::GroupsL()
+ {
+ User::LeaveIfNull( iGroups );
+ return *iGroups;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::ServiceId()
+// ---------------------------------------------------------------------------
+//
+TInt& CPresencePluginConnection::ServiceId()
+ {
+ return iSession->ServiceId();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginConnection::GetProtocolInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginConnection::GetProtocolInterface( TInt aInterfaceId )
+ {
+ DP_SDA("CPresencePluginConnection::GetProtocolInterface");
+
+ if( aInterfaceId == CProtocolImFeatures::KInterfaceId )
+ {
+ TInt err( KErrNone );
+
+ if ( !iImFeatures )
+ {
+ DP_SDA(" --> Create im features plugin");
+ TRAP( err, CreateImFeaturesPluginL() );
+ }
+
+ if ( !err )
+ {
+ DP_SDA(" --> get interface");
+
+ return iImFeatures->GetInterface(
+ aInterfaceId, MXIMPBase::EPanicIfUnknown );
+ }
+ else
+ {
+ DP_SDA(" --> Creating im features plugin failed");
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontacts.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,507 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <vpbkcontactstoreuris.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <cvpbkcontactmanager.h>
+#include <cvpbkcontactstoreuriarray.h>
+#include <tvpbkcontactstoreuriptr.h>
+#include <mvpbkcontactoperationbase.h>
+#include <mvpbkcontactstorelist.h>
+#include <mvpbkcontactlinkarray.h>
+#include <mvpbkcontactlink.h>
+#include <mvpbkstorecontact.h>
+#include <mvpbkcontactfielddata.h>
+#include <mvpbkcontactfieldtextdata.h>
+#include <mvpbkcontactfielduridata.h>
+#include <cvpbkcontactidconverter.h>
+#include <mvpbkstorecontactfieldcollection.h>
+#include <cvpbkfieldtyperefslist.h>
+#include <vpbkeng.rsg>
+
+#include "presenceplugincontacts.h"
+#include "presencelogger.h"
+#include "presenceplugincontactsobs.h"
+#include "presenceplugincontactstatehandler.h"
+#include "presencepluginlocalstore.h"
+// States
+#include "presenceplugincontactstate.h"
+#include "presenceplugincontactstateopen.h"
+#include "presenceplugincontactstateresolve.h"
+#include "presenceplugincontactstatesearch.h"
+#include "presenceplugincontactstateend.h"
+
+const TInt KSDMASPSMaxPropertyLength = 512;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::CPresencePluginContacts()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContacts::CPresencePluginContacts( TInt aServiceId,
+ MPresencePluginContactsObs& aObserver )
+ : CActive( CActive::EPriorityStandard ),
+ iServiceId( aServiceId ),
+ iObserver( &aObserver )
+ {
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::ConstructL( const TDesC& aServiceName )
+ {
+ DP_SDA( "CPresencePluginContacts::ConstructL()" );
+
+ iServiceName = aServiceName.AllocL();
+ CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
+ HBufC* storeName = ContactStoreNameL();
+
+ if ( NULL != storeName )
+ {
+ DP_SDA2( "CPresencePluginContacts::ConstructL() %S", storeName );
+ CleanupStack::PushL( storeName );
+ uriArray->AppendL( TVPbkContactStoreUriPtr( *storeName ) );
+ CleanupStack::PopAndDestroy( storeName );
+ }
+ else
+ {
+ DP_SDA( "CPresencePluginContacts::ConstructL() Use default contact store uri" );
+ uriArray->AppendL( TVPbkContactStoreUriPtr(
+ VPbkContactStoreUris::DefaultCntDbUri() ) );
+ }
+ iContactManager = CVPbkContactManager::NewL( *uriArray );
+ CleanupStack::PopAndDestroy( uriArray );
+
+ DP_SDA( "CPresencePluginContacts::ConstructL() -exit" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContacts* CPresencePluginContacts::NewL( TInt aServiceId,
+ const TDesC& aServiceName, MPresencePluginContactsObs& aObserver )
+ {
+ CPresencePluginContacts* self =
+ CPresencePluginContacts::NewLC( aServiceId, aServiceName, aObserver );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContacts* CPresencePluginContacts::NewLC( TInt aServiceId,
+ const TDesC& aServiceName, MPresencePluginContactsObs& aObserver )
+ {
+ CPresencePluginContacts* self =
+ new( ELeave ) CPresencePluginContacts( aServiceId, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceName );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::~CPresencePluginContacts()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContacts::~CPresencePluginContacts()
+ {
+ DP_SDA("CPresencePluginContacts::~CPresencePluginContacts");
+
+ delete iServiceName;
+ delete iSearchText;
+ delete iContactOperation;
+ iStoreContactArray.ResetAndDestroy();
+ delete iStateHandler;
+ delete iFieldTypeRefList;
+ delete iContactLinkArray;
+ if( iContactManager )
+ {
+ TRAP_IGNORE( iContactManager->ContactStoresL().CloseAll( *this ) );
+ }
+ delete iContactManager;
+ iClientStatus = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::PresenceIdStoredL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::IsPresenceIdStoredL(
+ const TDesC16& aPresenceId, TRequestStatus& aStatus )
+ {
+ DP_SDA( "CPresencePluginContacts::IsPresenceIdStoredL -Enter" );
+
+ iOperation = EOperationIsPresenceStoredToContacts;
+
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+
+ iSearchText = HBufC::NewL(
+ iServiceName->Length() + aPresenceId.Length() + 1 );
+ TPtr searchTextPtr = iSearchText->Des();
+ searchTextPtr.Copy( *iServiceName );
+ searchTextPtr.Append( ':' );
+ searchTextPtr.Append( aPresenceId );
+
+ iFieldTypeRefList = CVPbkFieldTypeRefsList::NewL();
+ iFieldTypeRefList->AppendL(
+ *iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_IMPP ) );
+
+ iStateHandler = CPresencePluginContactStateHandler::NewL();
+
+ iStateHandler->AddStateL( new( ELeave ) CPresencePluginContactStateOpen(
+ *this, *iStateHandler ) );
+ iStateHandler->AddStateL( new( ELeave ) CPresencePluginContactStateSearch(
+ *this, *iStateHandler ) );
+ iStateHandler->AddStateL( new( ELeave ) CPresencePluginContactStateResolve(
+ *this, *iStateHandler ) );
+ iStateHandler->AddStateL( new( ELeave ) CPresencePluginContactStateEnd(
+ *this, *iStateHandler ) );
+
+ iStateHandler->Start( &iStatus );
+ SetActive();
+
+ DP_SDA( "CPresencePluginContacts::IsPresenceIdStoredL - exit" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContacts::ContactStoreNameL
+// ---------------------------------------------------------------------------
+//
+HBufC* CPresencePluginContacts::ContactStoreNameL()
+ {
+ DP_SDA( "CPresencePluginContacts::ContactStoreNameL()" );
+
+ HBufC* storeName = NULL;
+ CSPSettings* spSettings = CSPSettings::NewLC();
+ CSPProperty* property = CSPProperty::NewLC();
+
+ TInt err = spSettings->FindPropertyL( iServiceId,
+ EPropertyContactStoreId,
+ *property );
+
+ if ( KErrNone == err )
+ {
+ storeName = HBufC::NewL( KSDMASPSMaxPropertyLength );
+ TPtr16 storeNamePtr = storeName->Des();
+ err = property->GetValue( storeNamePtr );
+ }
+
+ CleanupStack::PopAndDestroy( property );
+ CleanupStack::PopAndDestroy( spSettings );
+
+ return storeName;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceContactsContextBase.
+// CPresencePluginContacts::Open
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::OpenL()
+ {
+ DP_SDA( "CPresencePluginContacts::Open()" );
+ iContactManager->ContactStoresL().OpenAllL( *this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceContactsContextBase.
+// CPresencePluginContacts::Search
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::SearchL()
+ {
+ DP_SDA( "CPresencePluginContacts::Search()" );
+ iContactOperation = iContactManager->FindL(
+ *iSearchText, *iFieldTypeRefList, *this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceContactsContextBase.
+// CPresencePluginContacts::ContactLinkArray
+// ---------------------------------------------------------------------------
+//
+const MVPbkContactLinkArray& CPresencePluginContacts::ContactLinkArrayL()
+ {
+ if ( NULL == iContactLinkArray )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return *iContactLinkArray;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MPresenceContactsContextBase.
+//CPresencePluginContacts::RetrieveContactL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::RetrieveContactL(
+ const MVPbkContactLink& aContactLink )
+ {
+ DP_SDA( "CPresencePluginContacts::RetrieveContactL()" );
+ iContactOperation =
+ iContactManager->RetrieveContactL( aContactLink, *this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactStoreListObserver.
+// CPresencePluginContacts::OpenComplete
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::OpenComplete()
+ {
+ DP_SDA( "CPresencePluginContacts::OpenComplete()" );
+ iStateHandler->State()->Complete();
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactStoreObserver.
+// CPresencePluginContacts::StoreReady
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::StoreReady(
+ MVPbkContactStore& /*aContactStore*/ )
+ {
+ DP_SDA( "CPresencePluginContacts::StoreReady()" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactStoreObserver.
+// CPresencePluginContacts::StoreUnavailable
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::StoreUnavailable(
+ MVPbkContactStore& /*aContactStore*/, TInt /*aReason*/ )
+ {
+ DP_SDA( "CPresencePluginContacts::StoreUnavailable()" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactStoreObserver.
+// CPresencePluginContacts::HandleStoreEventL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::HandleStoreEventL(
+ MVPbkContactStore& /*aContactStore*/,
+ TVPbkContactStoreEvent /*aStoreEvent*/ )
+ {
+ DP_SDA( "CPresencePluginContacts::HandleStoreEventL()" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactFindObserver.
+// CPresencePluginContacts::FindCompleteL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::FindCompleteL( MVPbkContactLinkArray* aResults )
+ {
+ DP_SDA( "CPresencePluginContacts::FindCompleteL()" );
+
+ delete iContactLinkArray;
+ iContactLinkArray = NULL;
+ iContactLinkArray = aResults;
+
+ delete iContactOperation;
+ iContactOperation = NULL;
+
+ iStateHandler->State()->Complete();
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkContactFindObserver.
+// CPresencePluginContacts::FindFailed
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::FindFailed( TInt aError )
+ {
+ DP_SDA( "CPresencePluginContacts::FindFailed()" );
+
+ delete iContactOperation;
+ iContactOperation = NULL;
+
+ iStateHandler->State()->Error( aError );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkSingleContactOperationObserver.
+// CPresencePluginContacts::VPbkSingleContactOperationComplete
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::VPbkSingleContactOperationComplete(
+ MVPbkContactOperationBase& aOperation,
+ MVPbkStoreContact* aContact )
+ {
+ DP_SDA( "CPresencePluginContacts::VPbkSingleContactOperationComplete()" );
+
+ if ( iContactOperation == &aOperation )
+ {
+ delete iContactOperation;
+ iContactOperation = NULL;
+ }
+
+ TInt error = iStoreContactArray.Append( aContact );
+ if ( KErrNone != error )
+ {
+ delete aContact;
+ aContact = NULL;
+ iStateHandler->State()->Error( error );
+ }
+ else
+ {
+ iStateHandler->State()->Complete();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MVPbkSingleContactOperationObserver.
+// CPresencePluginContacts::VPbkSingleContactOperationFailed
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::VPbkSingleContactOperationFailed(
+ MVPbkContactOperationBase& aOperation,
+ TInt aError )
+ {
+ DP_SDA( "CPresencePluginContacts::VPbkSingleContactOperationFailed()" );
+
+ if ( iContactOperation == &aOperation )
+ {
+ delete iContactOperation;
+ iContactOperation = NULL;
+ }
+
+ iStateHandler->State()->Error( aError);
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// CPresencePluginContacts::RunL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::RunL()
+ {
+ DP_SDA2( "CPresencePluginContacts::RunL - status %d", iStatus.Int() );
+
+ TBool result( EFalse );
+ TBool found( EFalse );
+ CPresencePluginLocalstore* localStore = NULL;
+ TInt error = iStatus.Int();
+
+ switch( iOperation )
+ {
+ case EOperationIsPresenceStoredToContacts:
+ DP_SDA( "CPresencePluginContacts::RunL -EOperationIsPresenceStoredToContacts" );
+
+ if ( KErrNone == error )
+ {
+ localStore = CPresencePluginLocalstore::NewLC( *iServiceName );
+
+ for ( TInt i( 0 ); ( i < iStoreContactArray.Count() ) && !found; i++ )
+ {
+ MVPbkContactLink* link = iStoreContactArray[ i ]->CreateLinkLC();
+ CVPbkContactIdConverter* converter =
+ CVPbkContactIdConverter::NewL( link->ContactStore() );
+ CleanupStack::PushL( converter );
+
+ TInt32 id = converter->LinkToIdentifier( *link );
+ if ( localStore->SeekRowAtContactColL( id ) )
+ {
+ found = ETrue;
+ result = ETrue;
+ }
+ CleanupStack::PopAndDestroy( converter );
+ CleanupStack::PopAndDestroy(); // link
+ }
+
+ CleanupStack::PopAndDestroy( localStore );
+ }
+ if ( KErrNotFound == error )
+ {
+ error = KErrNone;
+ }
+ iObserver->RequestComplete( &result, iOperation, error );
+ break;
+ default:
+ break;
+ }
+ // Operation completed.
+ // State handler not needet anymore
+ delete iStateHandler;
+ iStateHandler = NULL;
+ // Close contact stores
+ iContactManager->ContactStoresL().CloseAll( *this );
+
+ User::RequestComplete( iClientStatus, error );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// CPresencePluginContacts::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContacts::DoCancel()
+ {
+ if ( iClientStatus && *iClientStatus == KRequestPending )
+ {
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+ iStateHandler->Complete( KErrCancel );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// CPresencePluginContacts::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginContacts::RunError( TInt aError )
+ {
+ DP_SDA2( "CPresencePluginContacts::RunError - status %d", aError );
+ User::RequestComplete( iClientStatus, aError );
+ return KErrNone;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstate.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include "presenceplugincontactstate.h"
+#include "PresencePluginContactStateHandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencepluginContactState::CPresencepluginContactState
+// ---------------------------------------------------------------------------
+//
+CPresencepluginContactState::CPresencepluginContactState(
+ MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler )
+ : iContext( &aContext ), iStateHandler( &aStateHandler )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencepluginContactState::~CPresencepluginContactState
+// ---------------------------------------------------------------------------
+//
+CPresencepluginContactState::~CPresencepluginContactState()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencepluginContactState::Complete
+// ---------------------------------------------------------------------------
+//
+void CPresencepluginContactState::Complete()
+ {
+ iStateHandler->ProgressToNextState();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencepluginContactState::Complete
+// ---------------------------------------------------------------------------
+//
+void CPresencepluginContactState::Error( TInt aError )
+ {
+ iStateHandler->Complete( aError );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstateend.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include "presenceplugincontactstateend.h"
+#include "presenceplugincontactstatehandler.h"
+#include "presencecontactscontextbase.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateEnd::CPresencePluginContactStateEnd
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateEnd::CPresencePluginContactStateEnd(
+ MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler )
+ : CPresencepluginContactState( aContext, aStateHandler )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateEnd::~CPresencePluginContactStateEnd
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateEnd::~CPresencePluginContactStateEnd()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateEnd::HandleL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateEnd::HandleL()
+ {
+ iStateHandler->Complete( KErrNone );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstatehandler.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include "presenceplugincontactstatehandler.h"
+#include "presenceplugincontactstate.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::CPresencePluginContactStateHandler
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateHandler::CPresencePluginContactStateHandler()
+ : iCurrentStateIndex( 0 )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::~CPresencePluginContactStateHandler
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateHandler::~CPresencePluginContactStateHandler()
+ {
+ iStateArray.ResetAndDestroy();
+ iClientStatus = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateHandler* CPresencePluginContactStateHandler::NewL()
+ {
+ CPresencePluginContactStateHandler* self =
+ new (ELeave) CPresencePluginContactStateHandler();
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::Start
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateHandler::Start( TRequestStatus* aStatus )
+ {
+ iClientStatus = aStatus;
+ *iClientStatus = KRequestPending;
+ iCurrentStateIndex = 0;
+ HandleNextState();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::Complete
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateHandler::Complete( TInt aError )
+ {
+ if( iClientStatus && *iClientStatus == KRequestPending )
+ {
+ User::RequestComplete( iClientStatus, aError );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::ProgressToNextState
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateHandler::ProgressToNextState()
+ {
+ iCurrentStateIndex++;
+ HandleNextState();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::HandleNextState
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateHandler::HandleNextState()
+ {
+ TRAPD( error, State()->HandleL() );
+ if ( KErrNone != error )
+ {
+ Complete( error );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::AddStateL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateHandler::AddStateL(
+ CPresencepluginContactState* aState )
+ {
+ CleanupStack::PushL( aState );
+ iStateArray.AppendL( aState );
+ CleanupStack::Pop( aState );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateHandler::State
+// ---------------------------------------------------------------------------
+//
+CPresencepluginContactState* CPresencePluginContactStateHandler::State()
+ {
+ return iStateArray[ iCurrentStateIndex ];
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstateopen.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include "presenceplugincontactstateopen.h"
+#include "presencecontactscontextbase.h"
+#include "presenceplugincontactstatehandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateOpen::CPresencePluginContactStateOpen
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateOpen::CPresencePluginContactStateOpen(
+ MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler )
+ : CPresencepluginContactState( aContext, aStateHandler )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateOpen::~CPresencePluginContactStateOpen
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateOpen::~CPresencePluginContactStateOpen()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateOpen::HandleL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateOpen::HandleL()
+ {
+ iContext->OpenL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstateresolve.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <mvpbkcontactlinkarray.h>
+#include <mvpbkcontactlink.h>
+#include "presenceplugincontactstateresolve.h"
+#include "presencecontactscontextbase.h"
+#include "presenceplugincontactstatehandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateResolve::PresencePluginContactStateResolve
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateResolve::CPresencePluginContactStateResolve(
+ MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler )
+ : CPresencepluginContactState( aContext, aStateHandler ),
+ iContactLinkIndex( NULL ),
+ iContactLinkCount( NULL )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateResolve::~CPresencePluginContactStateResolve
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateResolve::~CPresencePluginContactStateResolve()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateResolve::HandleL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateResolve::HandleL()
+ {
+ iContactLinkCount = iContext->ContactLinkArrayL().Count();
+ if ( NULL == iContactLinkCount )
+ {
+ Error( KErrNotFound );
+ }
+ else
+ {
+ iContext->RetrieveContactL(
+ iContext->ContactLinkArrayL().At( iContactLinkIndex ) );
+ iContactLinkIndex++;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateResolve::Complete
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateResolve::Complete()
+ {
+ if ( iContactLinkIndex < iContactLinkCount )
+ {
+ TRAPD( error, HandleL() );
+ if ( KErrNone != error )
+ {
+ Error( error );
+ }
+ }
+ else
+ {
+ iStateHandler->ProgressToNextState();
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugincontactstatesearch.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include "presenceplugincontactstatesearch.h"
+#include "presencecontactscontextbase.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateSearch::CPresencePluginContactStateSearch
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateSearch::CPresencePluginContactStateSearch(
+ MPresenceContactsContextBase& aContext,
+ CPresencePluginContactStateHandler& aStateHandler )
+ : CPresencepluginContactState( aContext, aStateHandler )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateSearch::~CPresencePluginContactStateSearch
+// ---------------------------------------------------------------------------
+//
+CPresencePluginContactStateSearch::~CPresencePluginContactStateSearch()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginContactStateSearch::HandleL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginContactStateSearch::HandleL()
+ {
+ iContext->SearchL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugindata.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1824 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <e32base.h>
+#include <s32strm.h>
+#include <e32def.h>
+#include <e32svr.h>
+#include <e32math.h>
+#include <utf.h>
+#include <ximpbase.h>
+#include <ximpobjectfactory.h>
+#include <ximpobjectcollection.h>
+#include <presenceobjectfactory.h>
+#include <presenceinfo.h>
+#include <personpresenceinfo.h>
+#include <presenceinfofieldcollection.h>
+#include <presenceinfofield.h>
+#include <presenceinfofieldvaluetext.h>
+#include <presenceinfofieldvalueenum.h>
+#include <ximpidentity.h>
+#include <msimpledocument.h>
+#include <msimpleelement.h>
+#include <msimplepresencelist.h>
+#include <msimplemeta.h>
+#include <simpleutils.h>
+#include <presencecachewriter2.h>
+#include <presencecachereader2.h>
+#include <presencebuddyinfo.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+#include <avabilitytext.h>
+#include <cvimpstsettingsstore.h>
+
+
+#include "presenceplugindata.h"
+#include "presenceplugincommon.h"
+#include "presencepluginvirtualgroup.h"
+#include "presencepluginlanguagecodes.h"
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::CPresencePluginData
+// ---------------------------------------------------------------------------
+//
+CPresencePluginData::CPresencePluginData(
+ MPresencePluginConnectionObs& aObs,
+ TInt aServiceId ):
+ iConnObs( aObs ),
+ iServiceId( aServiceId ),
+ iPresenceCacheWriter( NULL ),
+ iPresenceCacheReader( NULL )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::~CPresencePluginData
+// ---------------------------------------------------------------------------
+//
+CPresencePluginData::~CPresencePluginData()
+ {
+ DP_SDA("CPresencePluginData::~CPresencePluginData");
+ delete iPresenceCacheWriter;
+ delete iPresenceCacheReader;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NewL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginData* CPresencePluginData::NewL(
+ MPresencePluginConnectionObs& aObs, TInt aServiceId )
+ {
+ CPresencePluginData* self = CPresencePluginData::NewLC(
+ aObs,
+ aServiceId );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::ConstructL()
+ {
+ DP_SDA("CPresencePluginData::ConstructL");
+ iPresenceCacheWriter = MPresenceCacheWriter2::CreateWriterL();
+ iPresenceCacheReader = MPresenceCacheReader2::CreateReaderL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NewLC
+// ---------------------------------------------------------------------------
+//
+CPresencePluginData* CPresencePluginData::NewLC(
+ MPresencePluginConnectionObs& aObs, TInt aServiceId )
+ {
+ CPresencePluginData* self =
+ new( ELeave ) CPresencePluginData( aObs, aServiceId );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyToBlockedToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyToBlockedToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent )
+ {
+ DP_SDA("CPresencePluginData::NotifyToBlockedToXIMPL");
+ MPersonPresenceInfo* persInfo =
+ aPresenceFactory.NewPersonPresenceInfoLC();
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ //Set pending
+ using namespace NPresenceInfo::NFieldType;
+ using namespace NPresencePlugin::NPresenceStates;
+
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailabilityEnum );
+
+ // use mapped enums to pass status
+ MPresenceInfoFieldValueEnum* enumField =
+ aPresenceFactory.NewEnumInfoFieldLC();
+
+ // HOX: BLOCKED ENUM NEEDED TO XIMP
+ enumField->SetValueL( NPresenceInfo::ENotAvailable );
+ field->SetFieldValue( enumField );
+
+ coll.AddOrReplaceFieldL( field );
+ CleanupStack::Pop( 2 ); // >> field, enumField
+
+ // Add status msg field
+ MPresenceInfoField* noteField = aPresenceFactory.NewInfoFieldLC();
+ noteField->SetFieldTypeL( KStatusMessage );
+
+ MPresenceInfoFieldValueText* textField =
+ aPresenceFactory.NewTextInfoFieldLC();
+ textField->SetTextValueL( aUnicodeNoteContent );
+
+ noteField->SetFieldValue( textField );
+
+ coll.AddOrReplaceFieldL( noteField );
+ CleanupStack::Pop( 2 ); // >> noteField, enumField
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+ DP_SDA("CPresencePluginData::NotifyToBlockedToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyToPendingToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyToPendingToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent )
+ {
+ DP_SDA("CPresencePluginData::NotifyToPendingToXIMP");
+ MPersonPresenceInfo* persInfo =
+ aPresenceFactory.NewPersonPresenceInfoLC();
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ //Set pending
+ using namespace NPresenceInfo::NFieldType;
+ using namespace NPresencePlugin::NPresenceStates;
+
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailabilityEnum );
+
+ // use mapped enums to pass status
+ MPresenceInfoFieldValueEnum* enumField =
+ aPresenceFactory.NewEnumInfoFieldLC();
+ enumField->SetValueL( NPresenceInfo::ERemotePending );
+ field->SetFieldValue( enumField );
+
+ coll.AddOrReplaceFieldL( field );
+ CleanupStack::Pop( 2 ); // >> field, enumField
+
+ // Add status msg field
+ MPresenceInfoField* noteField = aPresenceFactory.NewInfoFieldLC();
+ noteField->SetFieldTypeL( KStatusMessage );
+
+ MPresenceInfoFieldValueText* textField =
+ aPresenceFactory.NewTextInfoFieldLC();
+ textField->SetTextValueL( aUnicodeNoteContent );
+
+ noteField->SetFieldValue( textField );
+
+ coll.AddOrReplaceFieldL( noteField );
+ CleanupStack::Pop( 2 ); // >> noteField, enumField
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+ DP_SDA("CPresencePluginData::NotifyToPendingToXIMP end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyActiveToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyToActiveToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent,
+ NPresenceInfo::TAvailabilityValues aAvailability )
+ {
+ DP_SDA("CPresencePluginData::NotifyToActiveToXIMPL");
+ MPersonPresenceInfo* persInfo =
+ aPresenceFactory.NewPersonPresenceInfoLC();
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ //Set pending
+ using namespace NPresenceInfo::NFieldType;
+ using namespace NPresencePlugin::NPresenceStates;
+
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailabilityEnum );
+
+ // use mapped enums to pass status
+ MPresenceInfoFieldValueEnum* enumField =
+ aPresenceFactory.NewEnumInfoFieldLC();
+ enumField->SetValueL( aAvailability );
+ field->SetFieldValue( enumField );
+
+ coll.AddOrReplaceFieldL( field );
+ CleanupStack::Pop( 2 ); // >> field, enumField
+
+ // Add status msg field
+ MPresenceInfoField* noteField = aPresenceFactory.NewInfoFieldLC();
+ noteField->SetFieldTypeL( KStatusMessage );
+
+ MPresenceInfoFieldValueText* textField =
+ aPresenceFactory.NewTextInfoFieldLC();
+ textField->SetTextValueL( aUnicodeNoteContent );
+
+ noteField->SetFieldValue( textField );
+
+ coll.AddOrReplaceFieldL( noteField );
+ CleanupStack::Pop( 2 ); // >> noteField, enumField
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+ DP_SDA("CPresencePluginData::NotifyToActiveToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyTerminatedToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyTerminatedToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MPresenceInfo& aPrInfo,
+ const TDesC& aUnicodeNoteContent )
+ {
+ DP_SDA("CPresencePluginData::NotifyTerminatedToXIMPL");
+ MPersonPresenceInfo* persInfo =
+ aPresenceFactory.NewPersonPresenceInfoLC();
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ //Set pending
+ using namespace NPresenceInfo::NFieldType;
+ using namespace NPresencePlugin::NPresenceStates;
+
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailabilityEnum );
+
+ // use mapped enums to pass status
+ MPresenceInfoFieldValueEnum* enumField =
+ aPresenceFactory.NewEnumInfoFieldLC();
+ enumField->SetValueL( NPresenceInfo::EOffline );
+ field->SetFieldValue( enumField );
+
+ coll.AddOrReplaceFieldL( field );
+ CleanupStack::Pop( 2 ); // >> field, enumField
+
+ // Add status msg field
+ MPresenceInfoField* noteField = aPresenceFactory.NewInfoFieldLC();
+ noteField->SetFieldTypeL( KStatusMessage );
+
+ MPresenceInfoFieldValueText* textField =
+ aPresenceFactory.NewTextInfoFieldLC();
+ textField->SetTextValueL( aUnicodeNoteContent );
+
+ noteField->SetFieldValue( textField );
+
+ coll.AddOrReplaceFieldL( noteField );
+ CleanupStack::Pop( 2 ); // >> noteField, enumField
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+ DP_SDA("CPresencePluginData::NotifyTerminatedToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyToPrInfoL(
+ MXIMPObjectFactory& /*aFactory*/,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleDocument& aDocument,
+ MPresenceInfo& aPrInfo )
+ {
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL");
+ MPersonPresenceInfo* persInfo =
+ aPresenceFactory.NewPersonPresenceInfoLC();
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL persInfo");
+
+ if( !aDocument.EntityURI() )
+ {
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL entity URL not valid");
+ User::Leave( KErrCancel );
+ }
+
+ MPresenceInfoFieldCollection& coll = persInfo->Fields();
+
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL collection");
+ // Search own person info. Notice: Extend supported attributes later
+ TBool basicElementFound = EFalse;
+ TBool activitiesElementFound = EFalse;
+ TBool noteElemFound = EFalse;
+
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL RPointerArray");
+ RPointerArray<MSimpleElement> elems;
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL Push elems");
+ CleanupClosePushL( elems );
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL aDocument");
+ TInt err = aDocument.SimpleElementsL( elems );
+
+ DP_SDA2("CPresencePluginData::NotifyToPrInfoL err %d", err);
+
+ RPointerArray<MSimpleElement> basicElems;
+ CleanupClosePushL( basicElems );
+ MSimpleElement* basicSimpleElem(NULL);
+
+ RPointerArray<MSimpleElement> activitiesElems;
+ CleanupClosePushL( activitiesElems );
+ MSimpleElement* activitiesSimpleElem(NULL);
+ MSimpleElement* noteSimpleElem(NULL);
+
+ if ( !err )
+ {
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL, elements ok");
+ TInt count = elems.Count();
+ DP_SDA2("CPresencePluginData::NotifyToPrInfoL, element count: %d", count );
+
+ using namespace NPresencePlugin::NPresence;
+
+ MSimpleElement* elem = NULL;
+ TPtrC8 p8;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ DP_SDA2("CPresencePluginData::NotifyToPrInfoL, handling elem[%d]", i );
+
+ elem = elems[i];
+ p8.Set( elem->LocalName());
+ if (!( p8.CompareF( KPresencePerson8 )) ||
+ !( p8.CompareF( KPresenceTuple8 )) )
+ {
+ // person element found
+ RPointerArray<MSimpleElement> elems2;
+ CleanupClosePushL( elems2 );
+ elem->SimpleElementsL( elems2 );
+ TInt count2 = elems2.Count();
+ DP_SDA2("CPresencePluginData::NotifyToPrInfoL count2 %d", count2);
+ for ( TInt j = 0; j < count2; j++ )
+ {
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL 4");
+ //
+ MSimpleElement* elem2 = elems2[j];
+
+ //FIND BASIC/ACTIVITIES ELEMENT
+ if ( !elem2->LocalName().CompareF( KPresenceStatus8 ) &&
+ !basicElementFound )
+ {
+ DP_SDA("NotifyToPrInfoL PresenceStatus");
+ //Get elem2 childs
+ elem2->SimpleElementsL( basicElems );
+ TInt count3 = basicElems.Count(); //Child count
+ for ( TInt k = 0; k < count3; k++ )
+ {
+ MSimpleElement* tempElem = basicElems[k];
+ if ( !tempElem->LocalName().CompareF(
+ KPresenceBasic8 ))
+ {
+ DP_SDA("NotifyToPrInfoL basic elem true");
+ basicSimpleElem = basicElems[k];
+ basicElementFound = ETrue;
+ }
+ else if( !tempElem->LocalName().CompareF(
+ KPresenceActivities8 ))
+ {
+ DP_SDA("NotifyToPrInfoL activities under basic");
+ activitiesSimpleElem = basicElems[k];
+ activitiesElementFound = ETrue;
+ }
+ }
+ }
+
+ //FIND ACTIVITIES ELEMENT
+ if ( basicElementFound && !activitiesElementFound &&
+ !elem2->LocalName().CompareF( KPresenceActivities8 ) )
+ {
+ DP_SDA("NotifyToPrInfoL activities found outside basic");
+ elem2->SimpleElementsL( activitiesElems );
+ TInt count4 = activitiesElems.Count();
+ for ( TInt l = 0; l < count4; l++ )
+ {
+ activitiesSimpleElem = activitiesElems[l];
+ activitiesElementFound = ETrue;
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL 6");
+ }
+ }
+ }
+
+ if ( basicElementFound && !noteSimpleElem )
+ {
+ noteSimpleElem = ResolveNoteElementL( elems2 );
+ }
+
+ DP_SDA("NotifyToPrInfoL ALL DONE");
+ CleanupStack::PopAndDestroy( &elems2 );
+
+ if ( basicElementFound && activitiesElementFound && noteElemFound )
+ {
+ DP_SDA("NotifyToPrInfoL ALL DONE break out");
+ //Just handle first status information from document
+ // In future server should support <timestamp>
+ //Also client should be can handle timestaps if there are present
+ break;
+ }
+ }
+ // Check note field
+ else if ( basicElementFound && !( p8.CompareF( KPresenceNote8 )) &&
+ !noteSimpleElem )
+ {
+ DP_SDA("NotifyToPrInfoL note field found outside tuple");
+ noteSimpleElem = elem;
+ }
+ }
+ }
+
+ if ( basicElementFound )
+ {
+ DP_SDA("NotifyToPrInfoL basic proceed to handling");
+ SingleUserStatusToXIMPL(
+ aPresenceFactory, basicSimpleElem,
+ activitiesSimpleElem, noteSimpleElem, coll );
+ }
+ CleanupStack::PopAndDestroy( &activitiesElems );
+ CleanupStack::PopAndDestroy( &basicElems );
+ CleanupStack::PopAndDestroy( &elems );
+
+ aPrInfo.SetPersonPresenceL( persInfo );
+ CleanupStack::Pop(); // >> persInfo
+
+ // TODO2: Notice: the following crashes in old PrFW version
+ /*
+ aPrInfo.AddDevicePresenceL ( NULL );
+ aPrInfo.AddServicePresenceL( NULL );
+ */
+ DP_SDA("CPresencePluginData::NotifyToPrInfoL end");
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::CacheEntriesFromPrInfo
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::CacheEntriesFromPrInfo(
+ MPresenceInfo& aPrInfo,
+ MPresenceBuddyInfo2::TAvailabilityValues& aAvailability,
+ TPtr& aExtendedAvailability,
+ TPtr& aStatusMessage )
+ {
+ DP_SDA("CPresencePluginData::CacheEntriesFromPrInfoL");
+
+ DP_SDA(" -> CacheEntriesFromPrInfoL, fetch status enum field");
+ MPresenceInfoField* statusEnumInfoField = NULL;
+ MPersonPresenceInfo* presInfo = aPrInfo.PersonPresence();
+ if ( presInfo )
+ {
+ DP_SDA(" -> CacheEntriesFromPrInfoL, has person presence, get field");
+ presInfo->Fields().LookupFieldByFieldType(
+ statusEnumInfoField,
+ NPresenceInfo::NFieldType::KAvailabilityEnum );
+ DP_SDA(" -> CacheEntriesFromPrInfoL, fetch status enum field done, check item");
+ if ( statusEnumInfoField )
+ {
+ DP_SDA(" -> status enum field found");
+ const MPresenceInfoFieldValueEnum* availability =
+ TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From(
+ statusEnumInfoField->FieldValue(), MXIMPBase::EPanicIfUnknown );
+ switch( availability->Value() )
+ {
+ case NPresenceInfo::EAvailable:
+ {
+ DP_SDA(" -> status enum field => available");
+ aAvailability = MPresenceBuddyInfo2::EAvailable;
+ aExtendedAvailability.Copy( KDefaultAvailableStatus() );
+ }
+ break;
+
+ case NPresenceInfo::EBusy:
+ {
+ DP_SDA(" -> status enum field => busy");
+ aAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedAvailability.Copy( KDndState() );
+ }
+ break;
+
+ case NPresenceInfo::EOnPhone:
+ {
+ DP_SDA(" -> status enum field => on phone");
+ aAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedAvailability.Copy( KOnPhoneState() );
+ }
+ break;
+
+ case NPresenceInfo::EAway:
+ {
+ DP_SDA(" -> status enum field => away");
+ aAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedAvailability.Copy( KAwayState() );
+ }
+ break;
+
+ case NPresenceInfo::EDoNotDisturb:
+ {
+ DP_SDA(" -> status enum field => dnd");
+ aAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedAvailability.Copy( KDndState() );
+ }
+ break;
+
+ case NPresenceInfo::EOffline:
+ case NPresenceInfo::ENotAvailable:
+ default:
+ {
+ DP_SDA(" -> status enum field => offline/not available/default");
+ aAvailability = MPresenceBuddyInfo2::ENotAvailable;
+ aExtendedAvailability.Copy( KInvisibleState() );
+ }
+ break;
+ }
+ }
+ else
+ {
+ DP_SDA(" -> status enum not found => set unknown");
+ aAvailability = MPresenceBuddyInfo2::EUnknownAvailability;
+ aExtendedAvailability.Copy( KNullDesC() );
+ }
+ DP_SDA(" -> fetch status message field");
+ MPresenceInfoField* statusMsgInfoField = NULL;
+ presInfo->Fields().LookupFieldByFieldType(
+ statusMsgInfoField,
+ NPresenceInfo::NFieldType::KStatusMessage );
+ DP_SDA(" -> CacheEntriesFromPrInfoL, fetch status message field done, check item");
+ if ( statusMsgInfoField )
+ {
+ DP_SDA(" -> status msg field found");
+ const MPresenceInfoFieldValueText* statusMsg =
+ TXIMPGetInterface< const MPresenceInfoFieldValueText >::From(
+ statusMsgInfoField->FieldValue(), MXIMPBase::EPanicIfUnknown );
+ if ( statusMsg && statusMsg->TextValue().Length() )
+ {
+ DP_SDA(" -> status msg field found, copy content");
+ aStatusMessage.Copy( statusMsg->TextValue() );
+ }
+ }
+ else
+ {
+ DP_SDA(" -> status msg field not found, set empty");
+ aStatusMessage.Copy( KNullDesC() );
+ }
+ }
+
+ DP_SDA("CPresencePluginData::CacheEntriesFromPrInfoL out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::SingleUserStatusToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::SingleUserStatusToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aBasicElement,
+ MSimpleElement* aActivitiesElement,
+ MSimpleElement* aNoteElement,
+ MPresenceInfoFieldCollection& aCollection )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL");
+
+ using namespace NPresenceInfo::NFieldType;
+ using namespace NPresencePlugin::NPresenceStates;
+
+ //Get aBasicElem content
+ HBufC* nodeContent = aBasicElement->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+
+ TBuf<KBufSize100> basicContentBuf;
+ basicContentBuf.Copy( *nodeContent );
+ DP_SDA2("SingleUserStatusToXIMPL basicContent %S", &basicContentBuf);
+
+ TBuf<KBufSize100> activitiesContentBuf;
+
+ if ( !aActivitiesElement )
+ {
+ activitiesContentBuf.Copy( KPresenceUnknow );
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL activities NULL");
+ }
+ else
+ {
+ activitiesContentBuf.Copy( aActivitiesElement->LocalName() );
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL else");
+ }
+
+ if ( nodeContent )
+ {
+ using namespace NPresenceInfo::NFieldType;
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KAvailabilityEnum );
+
+ // use mapped enums to pass status
+ MPresenceInfoFieldValueEnum* enumField =
+ aPresenceFactory.NewEnumInfoFieldLC();
+
+ // Busy case
+ if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceBusy ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL open/busy");
+ enumField->SetValueL( NPresenceInfo::EBusy );
+ }
+ // On-The-Phone case
+ else if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceOnThePhone ) )
+ {
+ DP_SDA("CPresencePluginData::SingleUserStatusToXIMPL open/on-the-phone");
+ enumField->SetValueL( NPresenceInfo::EOnPhone );
+ }
+ //Away case
+ else if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceAway ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL open/away");
+ enumField->SetValueL( NPresenceInfo::EAway );
+ }
+ //Dnd case
+ else if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceDoNotDisturb ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL open/dnd");
+ enumField->SetValueL( NPresenceInfo::EDoNotDisturb );
+ }
+ // Unknown open
+ else if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceUnknow ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL open/unknown");
+ enumField->SetValueL( NPresenceInfo::EAvailable );
+ }
+ // availale open
+ else if ( !nodeContent->Des().CompareF( KPresenceOpen ) &&
+ !activitiesContentBuf.CompareF ( KPresenceAvailable ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL open/available");
+ enumField->SetValueL( NPresenceInfo::EAvailable );
+ }
+ //Unknown closed
+ else if ( !nodeContent->Des().CompareF( KPresenceClosed ) &&
+ !activitiesContentBuf.CompareF ( KPresenceUnknow ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL closed/unknown");
+ enumField->SetValueL( NPresenceInfo::EOffline );
+ }
+ //Else set status according to basic status
+ else
+ {
+ if ( !nodeContent->Des().CompareF( KPresenceOpen ) )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL else open");
+ enumField->SetValueL( NPresenceInfo::EAvailable );
+ }
+ else
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL else closed");
+ enumField->SetValueL( NPresenceInfo::ENotAvailable );
+ }
+ }
+
+ field->SetFieldValue( enumField );
+ aCollection.AddOrReplaceFieldL( field );
+
+ CleanupStack::Pop( 2 ); // >> field, enumField
+
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL check for note");
+
+ // Handle note field if found and buddy is "available".
+ if ( aNoteElement &&
+ NPresenceInfo::EOffline != enumField->Value() &&
+ NPresenceInfo::ENotAvailable != enumField->Value() )
+ {
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL note elems found");
+ // consider mapping note text to enum value if value not mapped
+ UserNoteToXIMPL( aPresenceFactory, aNoteElement, aCollection );
+ }
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ DP_SDA(" CPresencePluginData::SingleUserStatusToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::UserNoteToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::UserNoteToXIMPL(
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimpleElement* aElement,
+ MPresenceInfoFieldCollection& aCollection )
+ {
+ DP_SDA(" CPresencePluginData::UserNoteToXIMPL IN");
+ HBufC* nodeContent = aElement->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+ if ( nodeContent )
+ {
+ DP_SDA(" CPresencePluginData::UserNoteToXIMPL - content found");
+ // Save note, convert from unicode
+ // notice: consider xml::lang-attribute
+ // note <-> KStatusMessage
+ // notice: no need to consider namespaces in XML?
+ using namespace NPresenceInfo::NFieldType;
+
+ DP_SDA(" CPresencePluginData::UserNoteToXIMPL - create fields");
+ MPresenceInfoField* field = aPresenceFactory.NewInfoFieldLC();
+ field->SetFieldTypeL( KStatusMessage );
+ MPresenceInfoFieldValueText* text =
+ aPresenceFactory.NewTextInfoFieldLC();
+ text->SetTextValueL( nodeContent->Des() );
+ field->SetFieldValue( text );
+ CleanupStack::Pop(); // >> text
+ aCollection.AddOrReplaceFieldL( field );
+ CleanupStack::Pop(); // >> field
+ DP_SDA(" -> fields added to collection");
+ }
+ CleanupStack::PopAndDestroy( nodeContent );
+ DP_SDA(" CPresencePluginData::UserNoteToXIMPL OUT");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::NotifyListToPrInfoL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::NotifyListToPrInfoL(
+ MXIMPObjectFactory& aFactory,
+ MPresenceObjectFactory& aPresenceFactory,
+ MSimplePresenceList& aList,
+ RPointerArray<MPresenceInfo>& aEntities,
+ RPointerArray<MXIMPIdentity>& aActives,
+ RPointerArray<MXIMPIdentity>& aTerminated )
+ {
+ DP_SDA(" CPresencePluginData::NotifyListToPrInfoL");
+ // Split array into individual prInfos
+
+ aEntities.Reset();
+ RPointerArray<MSimpleDocument> docs;
+ CleanupClosePushL( docs );
+ // get documents, ownership is not transferred.
+ aList.GetDocuments( docs );
+
+ TInt count = docs.Count();
+
+ // active presentities
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MPresenceInfo* info =
+ aPresenceFactory.NewPresenceInfoLC();//<< info
+ aEntities.Append( info );
+ // aEntities may contain entries even this method leaves
+ CleanupStack::Pop();// >> info
+
+ NotifyToPrInfoL( aFactory, aPresenceFactory, *docs[i], *info );
+ // Add SIp identity to active users list
+ MXIMPIdentity* active = aFactory.NewIdentityLC();// << active
+ aActives.Append( active );
+ CleanupStack::Pop();// >> active
+
+ // Convert SIP entity URI from UTF to Unicode.
+ const TDesC8* pUri8 = (docs[i])->EntityURI();
+ HBufC16* uri16 = NULL;
+ uri16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *pUri8 );
+ CleanupStack::PushL( uri16 ); // << uri16
+ active->SetIdentityL( uri16->Des() );
+ CleanupStack::PopAndDestroy( uri16 );// >> uri16
+ }
+
+ using namespace NPresencePlugin::NPresence;
+
+ // Search "terminated" presentities
+ MSimpleMeta* meta = aList.MetaData();
+ // ownership in not transferred
+ if ( meta && !meta->LocalName().CompareF( KPresenceList8 ))
+ {
+ // list element found
+ RPointerArray<MSimpleElement> elems2;
+ CleanupClosePushL( elems2 );
+ meta->SimpleElementsL( elems2);
+ TInt count2 = elems2.Count();
+
+ for ( TInt i = 0; i < count2; i++ )
+ {
+ MSimpleElement* elem2 = elems2[i];
+ if ( !elem2->LocalName().CompareF( KPresenceResource8 ))
+ {
+ // resource element
+ RPointerArray<MSimpleElement> elems3;
+ CleanupClosePushL( elems3 );
+ meta->SimpleElementsL( elems3 );
+ TInt count3 = elems3.Count();
+
+ for ( TInt j=0; j < count3; j++ )
+ {
+ MSimpleElement* elem3 = elems3[i];
+
+ if ( !elem3->LocalName().CompareF( KPresenceInstance8 ))
+ {
+ // instance element
+ const TDesC8* stateVal =
+ elem3->AttrValue( KPresenceState8 );
+ if ( stateVal && stateVal->
+ CompareF( KPresenceTerminated8 ))
+ {
+ // get next entity if this is not state="terminated"
+ break;
+ }
+ // Save resource element URI into list of
+ // "terminated" users.
+ const TDesC8* uri8 = elem2->AttrValue( KPresenceUri8 );
+ MXIMPIdentity* terminated =
+ aFactory.NewIdentityLC();// << terminated
+ aTerminated.Append( terminated );
+ CleanupStack::Pop(); // >> terminated
+
+ // Convert SIP entity URI from UTF to Unicode.
+ HBufC16* uri16 = NULL;
+ uri16 =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L( *uri8 );
+ CleanupStack::PushL( uri16 ); // << uri16
+ terminated->SetIdentityL( uri16->Des() );
+ CleanupStack::PopAndDestroy( uri16 ); // >> uri16
+ }
+ }
+ CleanupStack::PopAndDestroy( &elems3 );
+ } // resource element
+ }// for (i); list element subelement
+ CleanupStack::PopAndDestroy( &elems2 );
+ }
+
+ CleanupStack::PopAndDestroy( &docs );
+ DP_SDA(" CPresencePluginData::NotifyListToPrInfoL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::AddPrPersToSimpleDocumentL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::AddPrPersToSimpleDocumentL(
+ const MPersonPresenceInfo* aInfo,
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId, TInt aTupleId )
+ {
+ DP_SDA("CPresencePluginData::AddPrPersToSimpleDocumentL start");
+ iNumBuf = aTupleId;
+ // notice: later: generate random id.
+
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresenceInfo::NFieldType;
+
+ const MPresenceInfoFieldCollection& coll = aInfo->Fields();
+
+ const MPresenceInfoField* statusEmumField = NULL;
+ const MPresenceInfoField* messageField = NULL;
+
+ TInt myCount = coll.FieldCount();
+ for ( TInt i = 0; i < myCount; i++ )
+ {
+ DP_SDA("CPresencePluginData::AddPrPersToSimpleDocumentL 1");
+
+ const MPresenceInfoField& field = coll.FieldAt( i );
+ const TDesC8& fieldType = field.FieldType();
+ TBuf<KBufSize100> printBuf;
+ printBuf.Copy( fieldType );
+
+ if ( !fieldType.Compare( KAvatar ) )
+ {
+ // Do nothing in sawfis, maybe later?
+ }
+ else if ( !fieldType.Compare( KAvailabilityEnum ) )
+ {
+ DP_SDA("AddPrPersToSimpleDocumentL Avaibility");
+ statusEmumField = &field;
+ DP_SDA("AddPrPersToSimpleDocumentL Avaibility done");
+ }
+ else if ( !fieldType.Compare( KStatusMessage ) )
+ {
+ DP_SDA("AddPrPersToSimpleDocumentL statusmessage");
+ messageField = &field;
+ }
+ }
+ if ( statusEmumField )
+ {
+ DoCreateDocumentL( aDocument, aSipId,
+ statusEmumField, messageField );
+ }
+
+
+ DP_SDA("CPresencePluginData::AddPrPersToSimpleDocumentL end");
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::CreatePresenceUri8LC
+// ---------------------------------------------------------------------------
+//
+HBufC8* CPresencePluginData::CreatePresenceUri8LC(
+ const TDesC8& aPresentityUri )
+ {
+ DP_SDA("CPresencePluginData::CreatePresenceUri8LC ");
+ const TInt KMyLenSipPrefix = 4;
+ const TInt KMyLenSipsPrefix = 5;
+ _LIT8( KMySip8, "sip:" );
+ _LIT8( KMySips8, "sips:" );
+ TInt uriLen = aPresentityUri.Length();
+ DP_SDA2( "CPresencePluginData::CreatePresenceUri8LC - param length: %d ", uriLen );
+
+ //For debugging purposes
+ //TBuf<256> tmpPresentityUri;
+ //tmpPresentityUri.Copy( aPresentityUri );
+ //DP_SDA2( "CPresencePluginData::CreatePresenceUri8LC - URI: %S ", &tmpPresentityUri );
+
+ HBufC8* buf = HBufC8::NewLC( uriLen );
+ TPtr8 pBuf( buf->Des() );
+
+ //SIP uri check
+ if ( !aPresentityUri.Left( KMyLenSipPrefix ).CompareF( KMySip8 ) )
+ {
+ DP_SDA("CPresencePluginData::CreatePresenceUri8LC (sip:) prefix in SIP URI ");
+ pBuf.Append( aPresentityUri );
+ }
+ else if ( !aPresentityUri.Left( KMyLenSipsPrefix ).CompareF( KMySips8 ) )
+ {
+ DP_SDA( "CPresencePluginData::CreatePresenceUri8LC (sips:) prefix in SIP URI " );
+ pBuf.Append( aPresentityUri );
+ }
+ else // No prefix, strange ...
+ {
+ DP_SDA( "CPresencePluginData::CreatePresenceUri8LC NO prefix in SIP URI, adding... " );
+ // Maybe should check which prefix to use,
+ // but assume that no secure is used if prefix missing
+ TInt len = aPresentityUri.Length() + KMyLenSipPrefix;
+ buf = buf->ReAllocL( len );
+ //update pointer after realloc
+ CleanupStack::Pop( 1 );
+ CleanupStack::PushL( buf );
+ // Since realloc may have changed the location in memory
+ // we must also reset ptr
+ pBuf.Set( buf->Des() );
+ pBuf.Append( KMySip8 );
+ pBuf.Append( aPresentityUri );
+ }
+ return buf;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::RemovePrefixLC
+// ---------------------------------------------------------------------------
+//
+HBufC16* CPresencePluginData::RemovePrefixLC(
+ const TDesC& aPresentityUri )
+ {
+ DP_SDA2("CPresencePluginData::RemovePrefixLC, uri: %S", &aPresentityUri );
+
+ HBufC* withouPrefix = HBufC::NewLC( KBufSize255 );
+ TPtr withouPrefixPtr( withouPrefix->Des() );
+
+ TInt prefixLocation = aPresentityUri.Locate( ':' );
+ DP_SDA2("CPresencePluginData::RemovePrefixLC, prefix pos: %d", prefixLocation );
+ if ( KErrNotFound != prefixLocation )
+ {
+ DP_SDA("CPresencePluginData::RemovePrefixLC - has prefix");
+ withouPrefixPtr.Copy( aPresentityUri.Mid( prefixLocation+1 ) );
+ DP_SDA("CPresencePluginData::RemovePrefixLC - copy ok");
+ }
+ else
+ {
+ DP_SDA("CPresencePluginData::RemovePrefixLC - has no prefix");
+ withouPrefixPtr.Copy( aPresentityUri );
+ }
+
+ //DP_SDA2("CPresencePluginData::RemovePrefixLC - returns %S", *withouPrefix );
+ return withouPrefix;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DoCreateDocumentL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::DoCreateDocumentL(
+ MSimpleDocument& aDocument,
+ const TDesC8& aSipId,
+ const MPresenceInfoField* aStatusField,
+ const MPresenceInfoField* aMessageField )
+ {
+ DP_SDA("CPresencePluginData::DoCreateDocumentL ");
+ const TInt KNumBuf = 20;
+ const TInt KTupleBuf = 10;
+
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ TBuf<KNumBuf> numBuf;
+ TBuf<KTupleBuf> tupleBuf;
+
+ tupleBuf.Copy( KIndent );
+ numBuf.Num( iNumBuf );
+ tupleBuf.Append( numBuf );
+ DP_SDA2("CPresencePluginData::DoCreateDocumentL id %d", iNumBuf);
+ DP_SDA("CPresencePluginData::DoCreateDocumentL 2");
+
+ //Add tuple id to document
+ MSimpleElement* tuple = aDocument.AddSimpleElementL( KPresenceTuple8 );
+ CleanupClosePushL( *tuple );
+ tuple->AddAttrL( KPresenceId8, tupleBuf);
+
+ //Presence status field
+ MSimpleElement* status = tuple->AddSimpleElementL( KPresenceStatus8 );
+ CleanupClosePushL( *status );
+
+ //basic field
+ MSimpleElement* basic = status->AddSimpleElementL( KPresenceBasic8 );
+ CleanupClosePushL( *basic );
+
+ basic->SetContentUnicodeL( DoCheckBasicStatusValueL( *aStatusField ) );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Basic ok, check msg");
+
+ if ( aMessageField )
+ {
+ DP_SDA("CPresencePluginData::DoCreateDocumentL message field");
+ //Creating note
+ MSimpleElement* note =
+ aDocument.AddSimpleElementL( KPresenceNote8 );
+ CleanupClosePushL( *note );
+
+ // Get status msg field from info field
+ const MPresenceInfoFieldValueText* textField =
+ TXIMPGetInterface<
+ const MPresenceInfoFieldValueText >::From(
+ aMessageField->FieldValue(),
+ MXIMPBase::EPanicIfUnknown );
+ note->SetContentUnicodeL( textField->TextValue() );
+ CleanupStack::PopAndDestroy( note );
+ }
+
+ /* Basic model example
+ <tuple id="c8dqui">
+ <status>
+ <basic>open</basic>
+ </status>
+ <ts:basic>closed</ts:basic>
+ </ts:timed-status>
+ <contact>sip:someone@example.com</contact>
+ </tuple>
+ <note>sleeping</note>
+ </presence>
+ */
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Rich presence person");
+ //Creatin person presence field
+ MSimpleElement* pers =
+ aDocument.AddSimpleElementL( KSimpleNsPDM, KPresencePerson8 );
+ CleanupClosePushL( *pers );
+ TBuf<KBufSize10> buf;
+ TBuf<KBufSize20> personId;
+ personId.Copy( KPersonId );
+ buf.Num( iNumBuf );
+ personId.Append( buf );
+ pers->AddAttrL( KPresenceId8, personId );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Rich presence person ok");
+
+ HBufC8* urlBuf = CreatePresenceUri8LC( aSipId );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Push urlBuf");
+
+ aDocument.SetEntityURIL( urlBuf->Des() );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL 2");
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentLC Rich presence activities");
+ MSimpleElement* activ = pers->AddSimpleElementL(
+ KSimpleNsRPID, KPresenceActivities8 );
+ CleanupClosePushL( *activ );
+
+ //unknown used if person presence is just open or closed
+ MSimpleElement* unknown = activ->AddSimpleElementL(
+ KSimpleNsRPID, DoCheckActivitiesValueL( *aStatusField ) );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL, unknown/status element created");
+ CleanupClosePushL( *unknown );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy unknown");
+ CleanupStack::PopAndDestroy( unknown );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy activ");
+ CleanupStack::PopAndDestroy( activ );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy urlBuf");
+ CleanupStack::PopAndDestroy( urlBuf );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy pers");
+ CleanupStack::PopAndDestroy( pers );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Rich presence activities ok");
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy basic");
+ CleanupStack::PopAndDestroy( basic );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy status");
+ CleanupStack::PopAndDestroy( status );
+
+ DP_SDA("CPresencePluginData::DoCreateDocumentL Destroy tuple");
+ CleanupStack::PopAndDestroy( tuple );
+ DP_SDA("CPresencePluginData::DoCreateDocumentL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DoCheckBasicStatusValueL()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresencePluginData::DoCheckBasicStatusValueL(
+ const MPresenceInfoField& aField )
+ {
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ TPtrC basicStatus( KPresenceOpen ); //default status open
+ //First check what is person status value
+ const MXIMPBase& storage = aField.FieldValue();
+ const MPresenceInfoFieldValueEnum* enumObject =
+ TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::
+ From( storage,MXIMPBase::EReturnNullIfUnknown );
+
+ __ASSERT_ALWAYS( NULL != enumObject, User::Leave( KErrArgument ) );
+
+ DP_SDA2(" DoCheckBasicStatusValueL - enumValue: %d", enumObject->Value() );
+ switch ( enumObject->Value() )
+ {
+ case NPresenceInfo::EAvailable:
+ {
+ DP_SDA("DoCheckBasicStatusValueL stopPublish false status open");
+ iConnObs.SetStopPublishState( EFalse );
+ basicStatus.Set( KPresenceOpen );
+ }
+ break;
+
+ case NPresenceInfo::EOffline:
+ case NPresenceInfo::EHidden:
+ case NPresenceInfo::ENotAvailable:
+ {
+ //If state is closed we can stop publish
+ //if client is going to offline
+ DP_SDA("DoCheckBasicStatusValueL stopPublish true status Closed");
+ iConnObs.SetStopPublishState( ETrue );
+ basicStatus.Set( KPresenceClosed );
+ }
+ break;
+
+ default:
+ {
+ DP_SDA("DoCheckBasicStatusValueL stopPublish false else open");
+ iConnObs.SetStopPublishState( EFalse );
+ basicStatus.Set( KPresenceOpen );
+ }
+ break;
+ }
+ return basicStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DoCheckActivitiesValueL()
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CPresencePluginData::DoCheckActivitiesValueL(
+ const MPresenceInfoField& aField )
+ {
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ TPtrC8 activities( KPresenceUnknow8 ); //default activities unknown
+
+ const MXIMPBase& storage = aField.FieldValue();
+ const MPresenceInfoFieldValueEnum* enumObject =
+ TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::
+ From( storage,MXIMPBase::EReturnNullIfUnknown );
+
+ __ASSERT_ALWAYS( NULL != enumObject, User::Leave( KErrArgument ) );
+
+ DP_SDA2(" DoCheckActivitiesValueL - enumValue: %d", enumObject->Value() );
+ switch ( enumObject->Value() )
+ {
+ case NPresenceInfo::EAvailable:
+ {
+ DP_SDA("DoCheckActivitiesValueL - available, set publish");
+ iConnObs.SetStopPublishState( EFalse );
+ DP_SDA("DoCheckActivitiesValueL - available, set value");
+ activities.Set( KPresenceUnknow8 );
+ DP_SDA("DoCheckActivitiesValueL - available, ok");
+ }
+ break;
+
+ case NPresenceInfo::EOffline:
+ case NPresenceInfo::ENotAvailable:
+ {
+ DP_SDA("DoCheckActivitiesValueL - offline/not available");
+ iConnObs.SetStopPublishState( ETrue );
+ activities.Set( KPresenceUnknow8 );
+ }
+ break;
+
+ case NPresenceInfo::EBusy:
+ {
+ DP_SDA("DoCheckActivitiesValueL - busy");
+ iConnObs.SetStopPublishState( EFalse );
+ activities.Set( KPresenceBusy8 );
+ }
+ break;
+
+ case NPresenceInfo::EExtAway:
+ case NPresenceInfo::EAway:
+ {
+ DP_SDA("DoCheckActivitiesValueL - away");
+ iConnObs.SetStopPublishState( EFalse );
+ activities.Set( KPresenceAway8 );
+ }
+ break;
+
+ case NPresenceInfo::EOnPhone:
+ {
+ DP_SDA("DoCheckActivitiesValueL - on phone");
+ iConnObs.SetStopPublishState( EFalse );
+ activities.Set( KPresenceOnThePhone8 );
+ }
+ break;
+
+
+ case NPresenceInfo::EDoNotDisturb:
+ {
+ DP_SDA("DoCheckActivitiesValueL - dnd");
+ iConnObs.SetStopPublishState( EFalse );
+ activities.Set( KPresenceDoNotDisturb8 );
+ }
+ break;
+
+ default:
+ {
+ DP_SDA("DoCheckActivitiesValueL default => unknown");
+ iConnObs.SetStopPublishState( EFalse );
+ activities.Set( KPresenceUnknow8 );
+ }
+ break;
+ }
+ DP_SDA("DoCheckActivitiesValueL - done and return");
+ return activities;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DoCheckNoteValueL()
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresencePluginData::DoCheckNoteValueL(
+ const MPresenceInfoField& aField )
+ {
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ TPtrC note( KPresenceUnknow ); //default activities unknown
+ //First check what is person status value
+ const MXIMPBase& storage = aField.FieldValue();
+ const MPresenceInfoFieldValueText* text =
+ TXIMPGetInterface< const MPresenceInfoFieldValueText >::
+ From( storage,MXIMPBase::EReturnNullIfUnknown );
+
+ __ASSERT_ALWAYS( NULL != text, User::Leave( KErrArgument ) );
+
+ TBuf<KBufSize200> buffer;
+ buffer.Copy( text->TextValue() );
+
+ //Check if status is closed
+ if( !buffer.CompareF( KPresenceClosed ) )
+ {
+ //If state is closed we can stop publish
+ //if client is going to offline
+ DP_SDA("DoCheckNoteValueL stopPublish true closed");
+ iConnObs.SetStopPublishState( ETrue );
+ note.Set( KPresenceOffline );
+ }
+ else if( !buffer.CompareF( KPresenceOpen ) )
+ {
+ DP_SDA("DoCheckNoteValueL stopPublish false open");
+ iConnObs.SetStopPublishState( EFalse );
+ note.Set( KPresenceAvailable );
+ }
+ else if( !buffer.CompareF( KPresenceBusy ) )
+ {
+ DP_SDA("DoCheckNoteValueL activities BUSY");
+ iConnObs.SetStopPublishState( EFalse );
+ note.Set( KPresenceBusy );
+ }
+ else if( !buffer.CompareF( KPresenceOnThePhone ) )
+ {
+ DP_SDA("DoCheckNoteValueL activities OnThePhone");
+ iConnObs.SetStopPublishState( EFalse );
+ note.Set( KPresenceOnThePhone );
+ }
+ else if( !buffer.CompareF( KPresenceAway ) )
+ {
+ DP_SDA("DoCheckNoteValueL activities OnThePhone");
+ iConnObs.SetStopPublishState( EFalse );
+ note.Set( KPresenceAway );
+ }
+ else
+ {
+ DP_SDA("DoCheckNoteValueL stopPublish false");
+ iConnObs.SetStopPublishState( EFalse );
+ note.Set( KPresenceUnknow );
+ }
+ return note;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::GenerateTupleId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginData::GenerateTupleId()
+ {
+ // Generate unique session tuple id
+ DP_SDA("CPresencePluginData::GenerateTupleId start");
+ const TInt KMaxRand = KMaxNumber;
+ TInt64 seed;
+ TTime time;
+ time.HomeTime();
+ seed = time.Int64();
+ TInt random = Math::Rand( seed ) % KMaxRand;
+ DP_SDA("CPresencePluginData::GenerateTupleId 1");
+ return random;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ServiceId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginData::ServiceId()
+ {
+ return iServiceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ServiceNameLC()
+// ---------------------------------------------------------------------------
+//
+HBufC* CPresencePluginData::ServiceNameLC( TInt aServiceId ) const
+ {
+ CSPSettings* spSettings = CSPSettings::NewLC();
+ CSPEntry* entry = CSPEntry::NewLC();
+ HBufC* serviceName = NULL;
+
+ User::LeaveIfError( spSettings->FindEntryL( aServiceId, *entry ) );
+
+ serviceName = entry->GetServiceName().AllocL();
+
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( spSettings );
+ CleanupStack::PushL( serviceName );
+ return serviceName;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ResolveCacheXspIdentifierL()
+// ---------------------------------------------------------------------------
+//
+HBufC* CPresencePluginData::ResolveCacheXspIdentifierL(
+ const TDesC& aIdentity ) const
+ {
+ DP_SDA( "CPresencePluginData::ResolveCacheXspIdentifierL" );
+
+ CSPSettings* spSettings = CSPSettings::NewLC();
+ CSPEntry* entry = CSPEntry::NewLC();
+
+ User::LeaveIfError( spSettings->FindEntryL( iServiceId, *entry ) );
+
+ TInt cacheUriLength = ( entry->GetServiceName().Length() +
+ aIdentity.Length() + 1 );
+
+ HBufC* cacheUri = HBufC::NewL( cacheUriLength );
+ TPtr cacheUriPtr( cacheUri->Des() );
+
+ cacheUriPtr.Append( entry->GetServiceName() );
+ cacheUriPtr.Append( ':' );
+ cacheUriPtr.Append( aIdentity );
+
+ CleanupStack::PopAndDestroy( entry );
+ CleanupStack::PopAndDestroy( spSettings );
+
+ DP_SDA2( "CPresencePluginData::ResolveCacheXspIdentifierL returns: %S", cacheUri );
+ return cacheUri;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::WriteBlockItemsToCacheL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::WriteStatusToCacheL(
+ const TDesC& aPresentityId,
+ MPresenceBuddyInfo2::TAvailabilityValues aAvailability,
+ const TDesC& aAvailabilityText,
+ const TDesC& aStatusMessage )
+ {
+ DP_SDA( "CPresencePluginData::WriteStatusToCacheL start" );
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, aStatus: %d",
+ aAvailability );
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, availabilityText: %S",
+ &aAvailabilityText );
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, statusMessage: %S",
+ &aStatusMessage );
+
+ TBool updateCache( ETrue );
+
+ HBufC* cacheUri = ResolveCacheXspIdentifierL( aPresentityId );
+ CleanupStack::PushL( cacheUri );
+
+ DP_SDA(" -> WriteStatusToCacheL - read previous values from cache");
+
+ // Read previous values from cache
+ MPresenceBuddyInfo2* previousPresInfo =
+ iPresenceCacheReader->PresenceInfoLC( *cacheUri );
+
+ if ( previousPresInfo )
+ {
+ DP_SDA(" -> WriteStatusToCacheL - get availability value");
+
+ MPresenceBuddyInfo2::TAvailabilityValues availability =
+ previousPresInfo->Availability();
+
+ DP_SDA(" -> WriteStatusToCacheL - get availability text");
+
+ TPtrC availabilityText = previousPresInfo->AvailabilityText();
+
+ DP_SDA(" -> WriteStatusToCacheL - get status message");
+
+ TPtrC statusMessage = previousPresInfo->StatusMessage();
+ CleanupStack::PopAndDestroy(); //previousPresInfo
+
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, OLD STATUS: %d",
+ availability );
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, OLD AVAILABILITY TEXT: %S",
+ &availabilityText );
+ DP_SDA2( "CPresencePluginData::WriteStatusToCacheL, OLD STATUS MESSAGE: %S",
+ &statusMessage );
+
+ if ( ( aAvailability == availability ) &&
+ ( aAvailabilityText.Compare( availabilityText ) == 0 ) &&
+ ( aStatusMessage.Compare( statusMessage ) == 0 ))
+ {
+ DP_SDA(" -> WriteStatusToCacheL - no need to update cache");
+ updateCache = EFalse;
+ }
+ }
+
+ if ( updateCache )
+ {
+ MPresenceBuddyInfo2* newPresInfo = MPresenceBuddyInfo2::NewLC();
+ newPresInfo->SetIdentityL( *cacheUri );
+
+ DP_SDA(" -> WriteStatusToCacheL - update cache");
+
+ TBuf<KBufSize20> buf;
+ TBool handled = EFalse;
+
+ buf.Copy( KBlockedExtensionValue );
+
+ if( aAvailabilityText.Compare( buf ) == 0 )
+ {
+ DP_SDA( " -> WriteStatusToCacheL - set Blocked" );
+ newPresInfo->SetAnyFieldL( KExtensionKey, KBlockedExtensionValue );
+ handled = ETrue;
+ }
+
+ buf.Copy( KPendingRequestExtensionValue );
+
+ if ( aAvailabilityText.Compare( buf ) == 0 )
+ {
+ DP_SDA( " -> WriteStatusToCacheL - set Pending request" );
+ newPresInfo->SetAnyFieldL( KExtensionKey, KPendingRequestExtensionValue );
+ handled = ETrue;
+ }
+
+ if ( !handled )
+ {
+ DP_SDA2( " -> WriteStatusToCacheL - set availability text: %S", &aAvailabilityText );
+ newPresInfo->SetAvailabilityL( aAvailability, aAvailabilityText );
+ }
+
+ if ( aStatusMessage.Length() )
+ {
+ DP_SDA2( " -> WriteStatusToCacheL - set status message: %S", &aStatusMessage );
+ newPresInfo->SetStatusMessageL( aStatusMessage );
+ }
+
+ DP_SDA( " -> WriteStatusToCacheL - write presence to cache" );
+ TInt cacheError = iPresenceCacheWriter->WritePresenceL( newPresInfo );
+ DP_SDA2( "CPresencePluginEntityWatcher::WriteStatusToCacheL error: %d",
+ cacheError );
+
+ DP_SDA( " -> destroy buddy info" );
+ CleanupStack::PopAndDestroy(); // newPresInfo
+ }
+
+ DP_SDA(" -> destroy uri");
+ CleanupStack::PopAndDestroy( cacheUri );
+
+ DP_SDA("CPresencePluginData::WriteStatusToCacheL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::RemoveCacheL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::RemoveCacheL()
+ {
+ DP_SDA("CPresencePluginData::RemoveCacheL");
+
+ // Resolve service name (cache xsp identifier)
+ CSPSettings* spSettings = CSPSettings::NewL();
+ CleanupStack::PushL( spSettings );
+
+ CSPEntry* entry = CSPEntry::NewLC();
+ DP_SDA2(" -> RemoveCacheL look for service: %d", ServiceId() );
+ spSettings->FindEntryL( ServiceId(), *entry );
+
+ DP_SDA(" -> RemoveCacheL cache xsp identifier found");
+ TInt cacheUriLength = entry->GetServiceName().Length();
+ DP_SDA2(" -> cache uri length: %d", cacheUriLength );
+
+ HBufC* cacheUri = HBufC::NewLC( cacheUriLength );
+ TPtr cacheUriPtr( cacheUri->Des() );
+
+ DP_SDA(" -> RemoveCacheL - form cache entry");
+ cacheUriPtr.Append( entry->GetServiceName() );
+
+ DP_SDA(" -> RemoveCacheL - delete cache entries");
+ TInt error = iPresenceCacheWriter->DeleteService( cacheUriPtr );
+ DP_SDA2(" -> RemoveCacheL - delete error: %d", error );
+ CleanupStack::PopAndDestroy( cacheUri );
+
+ DP_SDA(" -> destroy sp entry");
+ CleanupStack::PopAndDestroy( entry );
+ DP_SDA(" -> destroy sp");
+ CleanupStack::PopAndDestroy( spSettings );
+ DP_SDA("CPresencePluginData::RemoveCacheL out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DeletePresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::DeletePresenceL( const TDesC& aIdentity )
+ {
+ DP_SDA("CPresencePluginData::DeletePresenceL");
+
+ // Resolve service name (cache xsp identifier)
+ CSPSettings* spSettings = CSPSettings::NewL();
+ CleanupStack::PushL( spSettings );
+ CSPEntry* entry = CSPEntry::NewLC();
+ DP_SDA2(" -> DeletePresenceL look for service: %d", ServiceId() );
+ spSettings->FindEntryL( ServiceId(), *entry );
+
+ DP_SDA(" -> DeletePresenceL cache xsp identifier found");
+ TInt cacheUriLength = ( entry->GetServiceName().Length() +
+ aIdentity.Length() + 1 );
+ DP_SDA2(" -> cache uri length: %d", cacheUriLength );
+
+ HBufC* cacheUri = HBufC::NewLC( cacheUriLength );
+ TPtr cacheUriPtr( cacheUri->Des() );
+
+ DP_SDA(" -> DeletePresenceL - form cache entry");
+ cacheUriPtr.Append( entry->GetServiceName() );
+ cacheUriPtr.Append( ':' );
+ cacheUriPtr.Append( aIdentity );
+
+ iPresenceCacheWriter->DeletePresenceL( cacheUriPtr );
+
+ CleanupStack::PopAndDestroy( cacheUri );
+ CleanupStack::PopAndDestroy( entry );
+ DP_SDA(" -> destroy sp");
+ CleanupStack::PopAndDestroy( spSettings );
+ DP_SDA("CPresencePluginData::DeletePresenceL out");
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::StorePresenceOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::StorePresenceOwnPresenceL(
+ const TUint aServiceId,
+ NPresenceInfo::TAvailabilityValues aAvailability,
+ const TDesC& aStatusMessage )
+ {
+ DP_SDA("CPresencePluginData::StorePresenceOwnPresenceL IN");
+ DP_SDA2(" -> aServiceId: %d", aServiceId );
+
+ DP_SDA2(" -> SAVE AVAILABILITY VALUE: %d", aAvailability );
+ DP_SDA2(" -> SAVE STATUS MESSAGE: %S", &aStatusMessage );
+
+ MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+ DP_SDA("CPresencePluginData::StorePresenceOwnPresenceL 1");
+
+ // Store availability value to uiservicetabsettings
+ TInt availabilityInt = ( ( TInt ) aAvailability );
+ User::LeaveIfError( settings->SetL(
+ aServiceId, EServicePresenceAvailablilityValue, availabilityInt ) );
+
+ DP_SDA("CPresencePluginData::StorePresenceOwnPresenceL 2");
+
+ // Store custom status message to uiservicetabsettings
+ User::LeaveIfError( settings->SetL(
+ aServiceId, EServiceCustomStatusMessage, aStatusMessage ) );
+
+ CleanupStack::PopAndDestroy(); //settings
+
+ DP_SDA("CPresencePluginData::StorePresenceOwnPresenceL OUT");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ReadDocumentIdL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::ReadDocumentIdL(
+ const TInt aServiceId,
+ TDes8& aDocumentId )
+ {
+ DP_SDA("CPresencePluginData::ReadDocumentIdL IN");
+
+ DP_SDA2(" -> aServiceId: %d", aServiceId );
+
+ MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+ RBuf8 documentId;
+ CleanupClosePushL( documentId );
+ documentId.CreateL( KBufSize255 );
+
+ TInt error = settings->GetL(
+ aServiceId, EServicePresenceSessionIdentifier, documentId );
+
+ DP_SDA2(" -> ERROR: %d", error );
+ DP_SDA2(" -> DOCUMENT ID LENGTH: %d", documentId.Length() );
+
+ if ( !error && documentId.Length() )
+ {
+ aDocumentId.Copy( documentId );
+
+ TBuf<KBufSize255> printDocumentId;
+ printDocumentId.Copy( aDocumentId );
+ DP_SDA("CPresencePluginData::ReadDocumentIdL - 1");
+ DP_SDA2(" -> READ DOCUMENT ID: %S", &printDocumentId );
+ }
+ else if ( KErrNotFound == error || !documentId.Length() )
+ {
+ DP_SDA("CPresencePluginData::ReadDocumentIdL - 2");
+ // If document id lenght is zero (KNullDesC8) or error
+ // is KErrNotFound leave with KErrNotFound
+ User::Leave( KErrNotFound );
+ }
+ else
+ {
+ User::Leave( error );
+ }
+
+ CleanupStack::PopAndDestroy( &documentId );
+ CleanupStack::PopAndDestroy(); //settings
+
+ DP_SDA("CPresencePluginData::ReadDocumentIdL OUT");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::DeletePresenceVariablesL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginData::DeletePresenceVariablesL( const TInt aServiceId )
+ {
+ DP_SDA("CPresencePluginData::DeletePresenceVariablesL IN");
+ DP_SDA2(" -> aServiceId: %d", aServiceId );
+
+ MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+ // Reset availability value in uiservicetabsettings
+ User::LeaveIfError( settings->SetL(
+ aServiceId, EServicePresenceAvailablilityValue, KErrNotFound ) );
+
+ // Reset status message in uiservicetabsettings
+ User::LeaveIfError( settings->SetL(
+ aServiceId, EServiceCustomStatusMessage, KNullDesC ) );
+
+ // Reset document id value in uiservicetabsettings
+ User::LeaveIfError( settings->SetL(
+ aServiceId, EServicePresenceSessionIdentifier, KNullDesC8 ) );
+
+ CleanupStack::PopAndDestroy(); // settings
+
+ DP_SDA("CPresencePluginData::DeletePresenceVariablesL OUT");
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::ResolveNoteElementL
+// Returns <note> element corresponding current locale or first <note>
+// element if better match is not found.
+// ---------------------------------------------------------------------------
+//
+MSimpleElement* CPresencePluginData::ResolveNoteElementL(
+ const RPointerArray<MSimpleElement>& aElements ) const
+ {
+ DP_SDA("CPresencePluginData::ResolveNoteElementL" )
+
+ MSimpleElement* bestMatch = NULL;
+ MSimpleElement* secondBestMatch = NULL;
+
+ for ( TInt i = aElements.Count() - 1; i >= 0 && NULL == bestMatch; i-- )
+ {
+ MSimpleElement* element = aElements[i];
+
+ using namespace NPresencePlugin::NPresence;
+ if ( 0 == element->LocalName().CompareF( KPresenceNote8 ) )
+ {
+ if ( IsElementLanguageValidForCurrentLocaleL( *element ) )
+ {
+ DP_SDA("CPresencePluginData::ResolveNoteElementL, BEST MATCH.")
+ bestMatch = element;
+ }
+ else
+ {
+ secondBestMatch = element;
+ }
+ }
+ }
+
+ return ( bestMatch ? bestMatch : secondBestMatch );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginData::IsElementLanguageValidForCurrentLocaleL
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginData::IsElementLanguageValidForCurrentLocaleL(
+ MSimpleElement& aElement ) const
+ {
+ DP_SDA( "CPresencePluginData::IsElementLanguageValidForCurrentLocaleL" )
+
+ TBool isLanguageResolved = EFalse;
+ _LIT8( KLanguageAttribute, "xml:lang" );
+
+ TLanguage language = User::Language();
+ RPointerArray<MSimpleAttribute> attributes;
+ CleanupClosePushL( attributes );
+ aElement.SimpleAttributesL( attributes );
+ for ( TInt i = attributes.Count() - 1; i >= 0 && !isLanguageResolved; i-- )
+ {
+ if ( 0 == KLanguageAttribute().CompareF( attributes[i]->Name() ) )
+ {
+ const TDesC8& attributeValue = attributes[i]->Value();
+ for ( TInt index = 0; index < KLanguageCodeMappingsCount; index++ )
+ {
+ if ( language == KLanguageCodeMappings[index].SymbianLanguageCode() &&
+ 0 == attributeValue.CompareF(
+ KLanguageCodeMappings[index].IsoLanguageCode() ) )
+ {
+ isLanguageResolved = ETrue;
+ }
+ }
+ }
+ }
+ CleanupStack::Pop( &attributes );
+
+ return isLanguageResolved;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginentitywatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,689 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#include <e32std.h>
+#include <e32svr.h>
+#include <utf.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresencewatchingdatahost.h>
+#include <ximpobjectfactory.h>
+#include <presenceinfo.h>
+#include <ximpprotocolconnectionhost.h>
+#include <protocolpresencedatahost.h>
+#include <presenceobjectfactory.h>
+#include <ximpstatus.h>
+#include <ximpidentity.h>
+#include <simplefactory.h>
+#include <msimplewatcher.h>
+#include <msimpledocument.h>
+#include <msimpleconnection.h>
+#include <simpleerrors.h>
+#include <avabilitytext.h>
+
+#include "presencepluginentitywatcher.h"
+#include "presenceplugindata.h"
+#include "presencepluginwatcher.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::CPresencePluginEntityWatcher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginEntityWatcher::CPresencePluginEntityWatcher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginWatcher& aWatcher )
+ :iConnObs(aObs), iConnection(aConn),
+ iPluginWatcher(aWatcher), iOperation( EPluginIdle )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::ConstructL(
+ CPresencePluginData* aPresenceData )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::ConstructL - begin");
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ iPresenceData = aPresenceData;
+ DP_SDA("CPresencePluginEntityWatcher::ConstructL - end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginEntityWatcher* CPresencePluginEntityWatcher::NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginWatcher& aWatcher,
+ CPresencePluginData* aPresenceData )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::NewL");
+ CPresencePluginEntityWatcher* self =
+ new( ELeave ) CPresencePluginEntityWatcher( aObs, aConn, aWatcher );
+ CleanupStack::PushL( self );
+ self->ConstructL( aPresenceData );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::~CPresencePluginEntityWatcher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginEntityWatcher::~CPresencePluginEntityWatcher()
+ {
+ DP_SDA("CPresencePluginEntityWatcher::~CPresencePluginEntityWatcher");
+ if ( iWatcher )
+ {
+ iWatcher->Close();
+ }
+ delete iEntityId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::StartSubscribeL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::StartSubscribeL(
+ const TDesC8& aPresentityId )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL");
+ delete iEntityId;
+ iEntityId = NULL;
+ DP_SDA(" StartSubscribeL - entity id deleted");
+
+ TRAPD( error, iSimpleId = iWatcher->SubscribeL(
+ aPresentityId, NULL, ETrue, EFalse ););
+ DP_SDA2("StartSubscribeL subscribe error %d",error);
+
+ if( KErrNone != error )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL ERROR");
+ if( KErrInUse == error )
+ {
+ DP_SDA(" iWatcher is in use try to close and restart");
+ iWatcher->Close();
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ DP_SDA("StartSubscribeL Second try after creating iWatcher again");
+ error = KErrNone;
+ TRAP( error, iSimpleId = iWatcher->GetPresenceL(
+ aPresentityId, NULL, EFalse ););
+ DP_SDA2("iWatcher->GetPresenceL error2 = %d",error );
+ }
+ }
+
+ // Save entity id after successful call
+ DP_SDA("StartSubscribeL - allocate entity id");
+ iEntityId = aPresentityId.AllocL();
+ DP_SDA("StartSubscribeL - new entity id stored");
+
+ iOperation = EPluginStart;
+
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL End");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::StartSubscribeL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::StartSubscribeL(
+ const TDesC8& aPresentityId, TRequestStatus& aClientRequst )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL 2");
+ delete iEntityId;
+ iEntityId = NULL;
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL - entity id deleted");
+
+ iClientStatus = &aClientRequst;
+ *iClientStatus = KRequestPending; // wait for watcher complete
+ iOperation = EPluginStartNotifyClient;
+
+ TRAPD( error, iSimpleId = iWatcher->SubscribeL(
+ aPresentityId, NULL, ETrue, EFalse ););
+ DP_SDA2("StartSubscribeL subscribe error %d",error);
+
+ if( KErrInUse == error )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL ERROR");
+ DP_SDA("StartSubscribeL iWatcher is in use try to close and restart");
+ iWatcher->Close();
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ DP_SDA("StartSubscribeL Second try after creating iWatcher again");
+ error = KErrNone;
+ TRAP( error, iSimpleId = iWatcher->GetPresenceL(
+ aPresentityId, NULL, EFalse ););
+ DP_SDA2("iWatcher->GetPresenceL error2 = %d",error );
+ }
+ User::LeaveIfError( error );
+
+ // Save entity id after successful call
+ DP_SDA("StartSubscribeL - allocate entity id");
+ iEntityId = aPresentityId.AllocL();
+ DP_SDA("StartSubscribeL - new entity id stored");
+
+ DP_SDA("CPresencePluginEntityWatcher::StartSubscribeL End");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::StopSubscribeL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::StopSubscribeL(
+ TRequestStatus& aClientRequst )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StopSubscribeL 2 (list)");
+ iClientStatus = &aClientRequst;
+ *iClientStatus = KRequestPending; // wait for watcher complete
+
+ iSimpleId = iWatcher->UnsubscribeL();
+ iOperation = EPluginStop;
+ DP_SDA("CPresencePluginEntityWatcher::StopSubscribeL 2 end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::StopSubscribeL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::StopSubscribeL( )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::StopSubscribeL");
+ iSimpleId = iWatcher->UnsubscribeL();
+ iOperation = EPluginStop;
+ DP_SDA("CPresencePluginEntityWatcher::StopSubscribeL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::WatcherReqCompleteL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::WatcherReqCompleteL(
+ TInt /*aOpId*/, TInt aStatus )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::WatcherReqCompleteL");
+ DP_SDA2("WatcherReqCompleteL status %d",aStatus );
+ TPluginEntityWatcherOperation orig = iOperation;
+ DP_SDA2("WatcherReqCompleteL orig %d",orig );
+ iOperation = EPluginIdle;
+
+ if( !aStatus )
+ {
+ iPluginWatcher.AcceptL( this );
+ }
+
+ if ( EPluginStartNotifyClient == orig )
+ {
+ orig = EPluginStart;
+ DP_SDA(" WatcherReqCompleteL complete client");
+ CompleteClientReq( aStatus );
+ }
+ else if ( iClientStatus )
+ {
+ DP_SDA(" WatcherReqCompleteL complete client 2");
+ CompleteClientReq( aStatus );
+ }
+
+ MSimpleWatcher::TSimpleSipSubscriptionState subscribeStatus =
+ iWatcher->SipSubscriptionState();
+ DP_SDA2("WatcherReqCompleteL subscribe status %d",subscribeStatus );
+
+ if ( aStatus && ( orig == EPluginStop || orig == EPluginStart &&
+ MSimpleWatcher::ESimpleStateTerminated != subscribeStatus ) )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::WatcherReqCompleteL if");
+ // Delete this entity as useless
+ DP_SDA("WatcherReqCompleteL DELETE WATCHER");
+ iPluginWatcher.DeleteWatcher( iEntityId->Des() );
+ //Do not call anything,
+ //since the method call above deletes this instance.
+ }
+ else if( !aStatus && ( MSimpleWatcher::ESimpleStateActive ==
+ subscribeStatus &&
+ orig == EPluginStop ) )
+ {
+ DP_SDA(" WatcherReqCompleteL state STOP");
+ // Delete this entity as useless
+ DP_SDA("WatcherReqCompleteL DELETE WATCHER 2");
+ iPluginWatcher.DeleteWatcher( iEntityId->Des() );
+ }
+ else if ( MSimpleWatcher::ESimpleStatePending == subscribeStatus )
+ {
+ SetPendingToXIMPL();
+ }
+ DP_SDA("CPresencePluginEntityWatcher::WatcherReqCompleteL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::SetPendingToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::SetPendingToXIMPL()
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetPendingToXIMPL");
+ //check what is grand request list subscribe state
+ if( iConnObs.GrandListState() )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetPendingToXIMPL True");
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.ProtocolPresenceHost().WatchingDataHost();
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();
+
+ //Call set to pending
+ iPresenceData->NotifyToPendingToXIMPL(
+ iConnObs.PresenceObjectFactoryOwn(),
+ *prInfo );
+
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* uniBuffer =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L( iEntityId->Des() );
+ CleanupStack::PushL( uniBuffer );
+
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *uniBuffer );
+ identity2->SetIdentityL( *withoutPrefix );
+
+ //Call presence cache writer too
+ TBuf<20> buf;
+ buf.Copy( KPendingRequestExtensionValue );
+
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix,
+ MPresenceBuddyInfo2::ENotAvailable,
+ buf,
+ KNullDesC() );
+
+ // XIMP Host API callback
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::PopAndDestroy( uniBuffer );
+ CleanupStack::Pop(); // >> identity2
+ CleanupStack::Pop(); // >> prInfo
+ }
+ DP_SDA("CPresencePluginEntityWatcher::SipSubscriptionState end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::SetActiveToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::SetActiveToXIMPL( const TDesC& aIdentity )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL, identity");
+ //check what is grand request list subscribe state
+ if( iConnObs.GrandListState() )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetPendingToXIMPL True");
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.ProtocolPresenceHost().WatchingDataHost();
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();
+
+ //Call set to pending
+ DP_SDA(" SetPendingToXIMPL, notify active");
+ iPresenceData->NotifyToActiveToXIMPL(
+ iConnObs.PresenceObjectFactoryOwn(),
+ *prInfo );
+
+ DP_SDA(" SetActiveToXIMPL, create new identity");
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+
+ DP_SDA(" SetActiveToXIMPL, strip prefix");
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( aIdentity );
+ identity2->SetIdentityL( *withoutPrefix );
+
+ DP_SDA(" SetActiveToXIMPL, write to cache");
+ //Call presence cache writer too
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix,
+ MPresenceBuddyInfo2::ENotAvailable,
+ KDefaultAvailableStatus(),
+ KNullDesC() );
+
+ DP_SDA(" SetActiveToXIMPL, ximp api callback");
+ // XIMP Host API callback
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL, cleanup");
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::Pop(); // >> identity2
+ CleanupStack::Pop(); // >> prInfo
+ }
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::SetTerminatedToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::SetTerminatedToXIMPL(
+ const TDesC& aIdentity )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL");
+ DP_SDA2("CPresencePluginEntityWatcher::SetTerminatedToXIMPL, uri: %S",
+ &aIdentity );
+ //check what is grand request list subscribe state
+ if( iConnObs.GrandListState() )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL True");
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.ProtocolPresenceHost().WatchingDataHost();
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();
+
+ //Call set to pending
+ iPresenceData->NotifyTerminatedToXIMPL(
+ iConnObs.PresenceObjectFactoryOwn(),
+ *prInfo );
+
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( aIdentity );
+ identity2->SetIdentityL( *withoutPrefix );
+
+ DP_SDA("SetTerminatedToXIMPL, write offline status to cache");
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix,
+ MPresenceBuddyInfo2::ENotAvailable,
+ KNullDesC(),
+ KNullDesC() );
+
+ // XIMP Host API callback
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::Pop(); // >> identity2
+ CleanupStack::Pop( ); // >> prInfo
+ }
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::SetActiveToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::SetActiveToXIMPL(
+ MSimpleDocument& aDocument )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL, aDocument");
+ // No need to check the expiration here since WatcherTerminatedL
+ // is called then too.
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.ProtocolPresenceHost().WatchingDataHost();
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();
+
+ DP_SDA(" SetActiveToXIMPL, call NotifyToPrInfoL");
+
+ iPresenceData->NotifyToPrInfoL(
+ iConnObs.ObjectFactory(),
+ iConnObs.PresenceObjectFactoryOwn(),
+ aDocument, *prInfo );
+ DP_SDA(" SetActiveToXIMPL, NotifyToPrInfoL ok");
+
+ // Get variables from presence info object for cache entry
+ MPresenceBuddyInfo2::TAvailabilityValues availability =
+ MPresenceBuddyInfo2::ENotAvailable;
+
+ HBufC* extendedAvailability = HBufC::NewLC( KBufSize255 );
+ TPtr extendedAvailabilityPtr( extendedAvailability->Des() );
+
+ HBufC* statusMessage = HBufC::NewLC( KBufSize255 );
+ TPtr statusMessagePtr( statusMessage->Des() );
+
+ DP_SDA(" SetActiveToXIMPL, NotifyToPrInfoL ok, get cache entries");
+ iPresenceData->CacheEntriesFromPrInfo( *prInfo,
+ availability, extendedAvailabilityPtr, statusMessagePtr );
+
+ DP_SDA(" SetActiveToXIMPL, create identity");
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* uniBuffer =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ *aDocument.EntityURI() );
+ CleanupStack::PushL( uniBuffer );
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL, identity ok");
+
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL, strip prefix");
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *uniBuffer );
+ identity2->SetIdentityL( *withoutPrefix );
+
+ //Call presence cache writer too
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix, availability,
+ extendedAvailabilityPtr, statusMessagePtr );
+
+ // XIMP Host API callback
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::PopAndDestroy( uniBuffer );
+ CleanupStack::Pop(); // >> identity2
+
+ CleanupStack::PopAndDestroy( statusMessage );
+ CleanupStack::PopAndDestroy( extendedAvailability );
+
+ CleanupStack::Pop(); // >> prInfo
+ DP_SDA("CPresencePluginEntityWatcher::SetActiveToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::SetTerminatedToXIMPL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::SetTerminatedToXIMPL( )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL");
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL True");
+
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.ProtocolPresenceHost().WatchingDataHost();
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();
+
+ //Call set to pending
+ iPresenceData->NotifyTerminatedToXIMPL(
+ iConnObs.PresenceObjectFactoryOwn(),
+ *prInfo );
+
+ MXIMPIdentity* identity2 = iConnObs.ObjectFactory().NewIdentityLC();
+ HBufC* uniBuffer =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L( iEntityId->Des() );
+
+ CleanupStack::PushL( uniBuffer );
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *uniBuffer );
+ identity2->SetIdentityL( *withoutPrefix );
+
+ //Call presence cache writer too
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix,
+ MPresenceBuddyInfo2::ENotAvailable,
+ KInvisibleState(),
+ KNullDesC() );
+
+ // XIMP Host API callback
+ watcherHost.HandleSubscribedPresentityPresenceL( identity2, prInfo );
+
+ DP_SDA2("SetTerminatedToXIMPL2: ident %S", &identity2->Identity() );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ CleanupStack::PopAndDestroy( uniBuffer );
+ CleanupStack::Pop(); // >> identity21
+ CleanupStack::Pop(); // >> prInfo
+
+ DP_SDA("CPresencePluginEntityWatcher::SetTerminatedToXIMPL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::WatcherNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::WatcherNotificationL(
+ MSimpleDocument& aDocument )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::WatcherNotificationL");
+
+ MSimpleWatcher::TSimpleSipSubscriptionState subscribeStatus =
+ iWatcher->SipSubscriptionState();
+ DP_SDA2("WatcherNotificationL subscribe status %d",subscribeStatus );
+
+ //If subscribeStatus = pending
+ if( MSimpleWatcher::ESimpleStatePending == subscribeStatus )
+ {
+ // Pending
+ DP_SDA("CPresencePluginEntityWatcher::WatcherNotificationL PENDING");
+ SetPendingToXIMPL();
+ }
+ else if( MSimpleWatcher::ESimpleStateTerminated == subscribeStatus )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::WatcherNotificationL TERMINATED");
+ SetTerminatedToXIMPL( );
+ }
+ else
+ {
+ //Active
+ DP_SDA("WatcherNotificationL normal Case");
+ SetActiveToXIMPL( aDocument );
+ }
+ DP_SDA("CPresencePluginEntityWatcher::WatcherNotificationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::WatcherListNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::WatcherListNotificationL(
+ MSimplePresenceList& aList )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::WatcherListNotificationL");
+ // call all the necessary callbacks, for new data + teminated ones.
+
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().WatchingDataHost();
+
+ RPointerArray<MPresenceInfo> entities;
+ RPointerArray<MXIMPIdentity> terminated;
+ RPointerArray<MXIMPIdentity> actives;
+
+ TRAPD( err, iPresenceData->NotifyListToPrInfoL(
+ iConnObs.ObjectFactory(),iConnObs.PresenceObjectFactoryOwn(),
+ aList, entities, actives, terminated ));
+ if ( err )
+ {
+ entities.ResetAndDestroy();
+ terminated.ResetAndDestroy();
+ actives.ResetAndDestroy();
+ entities.Close();
+ terminated.Close();
+ actives.Close();
+ return;
+ }
+
+ // Start to collect data for HandleSubscribedPresentityPresenceL
+ TInt counter = entities.Count();
+ for ( TInt i = counter-1 ; i>=0; i-- )
+ {
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC(
+ actives[i]->Identity() );
+ actives[i]->SetIdentityL( *withoutPrefix );
+
+ watcherHost.HandleSubscribedPresentityPresenceL(
+ actives[i], entities[i] );
+ // Owenership is transferred
+ actives.Remove(i);
+ entities.Remove(i);
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ }
+
+ entities.ResetAndDestroy();
+ terminated.ResetAndDestroy();
+ actives.ResetAndDestroy();
+
+ entities.Close();
+ terminated.Close();
+ actives.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::WatcherTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::WatcherTerminatedL(
+ TInt /*aOpId*/, TInt aReason )
+ {
+ DP_SDA2("CPresencePluginEntityWatcher::WatcherTerminatedL -reason: %d", aReason );
+
+ MProtocolPresenceWatchingDataHost& watcherHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().WatchingDataHost();
+
+ MXIMPDataSubscriptionState *state =
+ iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+ MXIMPStatus* status = iConnObs.ObjectFactory().NewStatusLC();
+ state->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+ status->SetResultCode( aReason );
+ MXIMPIdentity* identity = iConnObs.ObjectFactory().NewIdentityLC();
+
+ HBufC16* buf16 = HBufC16::NewLC( PresentityId().Length());
+ buf16->Des().Copy( PresentityId() );
+ identity->SetIdentityL( buf16->Des() );
+
+ //Visualize closed state OpenSer
+ SetTerminatedToXIMPL( buf16->Des() );
+
+ CleanupStack::PopAndDestroy( buf16 );
+ watcherHost.SetPresentityPresenceDataSubscriptionStateL(
+ identity, state, status );
+ DP_SDA("CPresencePluginEntityWatcher::WatcherTerminatedL pop");
+ CleanupStack::Pop( 3 );
+
+ iPluginWatcher.DeleteWatcher( iEntityId->Des() );
+
+ DP_SDA("CPresencePluginEntityWatcher::WatcherTerminatedL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::CompleteClientReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginEntityWatcher::CompleteClientReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::CompleteClientReq");
+ iOperation = EPluginIdle;
+ TRequestStatus* s = iClientStatus;
+ User::RequestComplete( s, aStatus );
+ iClientStatus = NULL;
+ DP_SDA("CPresencePluginEntityWatcher::CompleteClientReq out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::PresentityId
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CPresencePluginEntityWatcher::PresentityId( )
+ {
+ DP_SDA("CPresencePluginEntityWatcher::PresentityId");
+ return iEntityId ? iEntityId->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginEntityWatcher::XIMPRequestId
+// ---------------------------------------------------------------------------
+//
+TXIMPRequestId CPresencePluginEntityWatcher::XIMPRequestId( )
+ {
+ return iXIMPId;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presenceplugingroup.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,866 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <protocolpresencedatahost.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <ximpstatus.h>
+#include <ximpidentity.h>
+#include <ximpobjectcollection.h>
+#include <xdmerrors.h>
+#include <presentitygroupinfo.h>
+#include <presentitygroupmemberinfo.h>
+#include <utf.h>
+#include <avabilitytext.h>
+
+#include "mpresencepluginconnectionobs.h"
+#include "presenceplugingroup.h"
+#include "presencepluginxdmutils.h"
+#include "presenceplugincommon.h"
+#include "presencepluginvirtualgroup.h"
+#include "presenceplugindata.h"
+#include "presencepluginwatcher.h"
+#include "presencepluginauthorization.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::CPresencePluginGroups
+// ---------------------------------------------------------------------------
+//
+CPresencePluginGroups::CPresencePluginGroups(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData ):
+ CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs),
+ iOperation( ENoOperation),
+ iState( EPluginIdle ), iCompleted( ETrue ),
+ iSubscribedBuddies( aSubscribedBuddies ),
+ iPresenceData( aPresenceData )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::NewL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginGroups* CPresencePluginGroups::NewL(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData )
+ {
+ CPresencePluginGroups* self =
+ CPresencePluginGroups::NewLC(
+ aObs,
+ aSubscribedBuddies,
+ aPresenceData );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::NewLC
+// ---------------------------------------------------------------------------
+//
+CPresencePluginGroups* CPresencePluginGroups::NewLC(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginVirtualGroup* aSubscribedBuddies,
+ CPresencePluginData* aPresenceData )
+ {
+ CPresencePluginGroups* self =
+ new( ELeave ) CPresencePluginGroups(
+ aObs,
+ aSubscribedBuddies,
+ aPresenceData );
+ CleanupStack::PushL( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::~CPresencePluginGroups
+// ---------------------------------------------------------------------------
+//
+CPresencePluginGroups::~CPresencePluginGroups()
+ {
+ DP_SDA("CPresencePluginGroups::~CPresencePluginGroups");
+ Cancel();
+ delete iPresIdentity;
+ delete iDisplayName;
+ DP_SDA("CPresencePluginGroups::~CPresencePluginGroups end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoSubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoSubscribePresentityGroupListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginGroups::DoSubscribePresentityGroupListL");
+ iCompleted = EFalse;
+ // List of lists under buddylist
+ StartXdmOperationL( aReqId, EGetListOfLists );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoUnsubscribePresentityGroupListL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoUnsubscribePresentityGroupListL(
+ TXIMPRequestId /*aReqId*/ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoCreatePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoCreatePresentityGroupL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const TDesC16& /*aDisplayName*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoDeletePresentityGroupL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoDeletePresentityGroupL(
+ const MXIMPIdentity& /*aGroupId*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoUpdatePresentityGroupDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoUpdatePresentityGroupDisplayNameL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const TDesC16& /*aDisplayName*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ // Notice: later
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoSubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoSubscribePresentityGroupContentL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginGroups::DoSubscribePresentityGroupContentL");
+ iCompleted = EFalse;
+ // List of lists under buddylist
+ StartXdmOperationL( aGroupId, aReqId, EGetListContent );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoUnsubscribePresentityGroupContentL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoUnsubscribePresentityGroupContentL(
+ const MXIMPIdentity& /*aGroupId*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginGroups::DoUnsubscribePresentityGroupContentL");
+
+ iXIMPId = aReqId;
+ iConnObs.WatcherHandlerL()->UnSubscribeAllL();
+ iCompleted = EFalse;
+ CompleteXIMPReq( KErrNone );
+ DP_SDA("CPresencePluginGroups::DoUnsubscribePresentityGroupContentL out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoAddPresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoAddPresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ const TDesC16& /*aMemberDisplayName*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginGroups::DoAddPresentityGroupMemberL");
+ __ASSERT_ALWAYS( !IsActive(), User::Leave( KErrNotReady ) );
+
+ SetPresIdentityL( aMemberId, ETrue );
+
+ iCompleted = EFalse;
+ iXIMPId = aReqId;
+
+ if( !aGroupId.Identity().Compare( KPresenceBuddyList ) )
+ {
+ DP_SDA("CPresencePluginGroups::DoAddPresentityGroupMemberL - buddylist");
+ iOperation = EAddPresentityGroupMember;
+
+ // write pending to presence cache
+ TBuf<20> buf;
+ buf.Copy( KPendingRequestExtensionValue );
+
+ iPresenceData->WriteStatusToCacheL( aMemberId.Identity(),
+ MPresenceBuddyInfo2::ENotAvailable,
+ buf,
+ KNullDesC() );
+
+ iConnObs.WatcherHandlerL()->DoPerformSubscribePresentityPresenceL(
+ aMemberId, iStatus );
+ SetActive();
+ }
+ else if ( !aGroupId.Identity().Compare( KPresenceBlockedList ) )
+ {
+ DP_SDA("CPresencePluginGroups::DoAddPresentityGroupMemberL - blockedlist");
+ iOperation = EBlockPresentityGroupMember;
+ iConnObs.InternalPresenceAuthorization().
+ DoPerformBlockPresenceForPresentityL( aMemberId, iStatus );
+ SetActive();
+ }
+ else
+ {
+ DP_SDA("CPresencePluginGroups::DoAddPresentityGroupMemberL - unknown, leave");
+ User::Leave( KErrNotSupported );
+ }
+
+ DP_SDA("CPresencePluginGroups::DoAddPresentityGroupMemberL out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoRemovePresentityGroupMemberL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoRemovePresentityGroupMemberL(
+ const MXIMPIdentity& aGroupId,
+ const MXIMPIdentity& aMemberId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginGroups::DoRemovePresentityGroupMemberL");
+ __ASSERT_ALWAYS( !IsActive(), User::Leave( KErrNotReady ) );
+
+ SetPresIdentityL( aMemberId, ETrue );
+
+ iCompleted = EFalse;
+ iXIMPId = aReqId;
+ iOperation = ERemovePresentityGroupMember;
+
+ if( !aGroupId.Identity().Compare( KPresenceBuddyList ) )
+ {
+ DP_SDA(" DoRemovePresentityGroupMemberL - buddylist");
+ iConnObs.WatcherHandlerL()->DoPerformUnsubscribePresentityPresenceL(
+ aMemberId, iStatus );
+ SetActive();
+ }
+ else if ( !aGroupId.Identity().Compare( KPresenceBlockedList ) )
+ {
+ DP_SDA(" DoRemovePresentityGroupMemberL - blockedlist");
+ iOperation = EUnblockPresentityGroupMember;
+ iConnObs.InternalPresenceAuthorization().
+ DoPerformCancelPresenceBlockFromPresentityL( aMemberId, iStatus );
+ SetActive();
+ }
+ else
+ {
+ DP_SDA("DoRemovePresentityGroupMemberL - unknown, leave");
+ User::Leave( KErrNotSupported );
+ }
+
+ DP_SDA("CPresencePluginGroups::DoRemovePresentityGroupMemberL out");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoUpdatePresentityGroupMemberDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoUpdatePresentityGroupMemberDisplayNameL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MXIMPIdentity& /*aMemberId*/,
+ const TDesC16& /*aMemberDisplayName*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ DP_SDA("CPresencePluginGroups::DoUpdatePresentityGroupMemberDisplayNameL");
+ // Notice: Later
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoCancel( )
+ {
+ if ( iOperation != ENoOperation )
+ {
+ iXdmUtils->Cancel();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::RunL()
+ {
+ DP_SDA("CPresencePluginGroups::RunL");
+ TInt myStatus = iStatus.Int();
+ DP_SDA2("CPresencePluginGroups::RunL myStatus %d", myStatus );
+
+ if ( !myStatus && !iCompleted )
+ {
+ DP_SDA("CPresencePluginGroups::RunL !myStatus");
+ // OK response
+ CallActualXdmOperationL( myStatus );
+ }
+ else if ( !myStatus && iCompleted )
+ {
+ DP_SDA("CPresencePluginGroups::RunL SEND COMPLETE");
+ CompleteXIMPReq( myStatus );
+ }
+ else
+ {
+ if ( iOperation == EDeletePresentityGroup && iState ==
+ EPluginCommitRls )
+ {
+ DP_SDA("CPresencePluginGroups::RunL CallActualXdmOperation");
+ CallActualXdmOperationL( myStatus );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginGroups::RunL SEND COMPLETE 2");
+ // Other errors terminated the show
+ CompleteXIMPReq( myStatus );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::CallActualXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::CallActualXdmOperationL( TInt aCompleteStatus )
+ {
+ DP_SDA("CPresencePluginGroups::CallActualXdmOperationL");
+
+ DP_SDA2("CallActualXdmOperationL iOperation %d", iOperation);
+ switch ( iOperation )
+ {
+ case EGetListOfLists:
+ {
+ DP_SDA("PluginGroups::CallActualXdmOperationL EGetListOfLists");
+ iOperation = EGetListOfLists;
+ GetListOfListsL();
+ }
+ break;
+
+ case EGetListContent:
+ {
+ DP_SDA("PluginGroups::CallActualXdmOperationL EGetListContent");
+ iOperation = EGetListContent;
+ GetListContentL();
+ }
+ break;
+
+ case EAddPresentityGroupMember:
+ {
+ DP_SDA(" CallActualXdmOperationL EAddPresentityGroupMember");
+
+ iOperation = EGrantPresentityGroupMember;
+ MXIMPIdentity* newIdentity =
+ iConnObs.ObjectFactory().NewIdentityLC();
+ newIdentity->SetIdentityL( *iPresIdentity );
+
+ iConnObs.InternalPresenceAuthorization().
+ DoPerformGrantPresenceForPresentityL( *newIdentity, iStatus );
+ CleanupStack::PopAndDestroy(); // >> newIdentity
+ SetActive();
+ }
+ break;
+
+ case ERemovePresentityGroupMember:
+ {
+ DP_SDA(" CallActualXdmOperationL ERemovePresentityGroupMember");
+ iOperation = EWithdrawGrantFromMember;
+ MXIMPIdentity* newIdentity = iConnObs.ObjectFactory().NewIdentityLC();
+ newIdentity->SetIdentityL( *iPresIdentity );
+ iConnObs.InternalPresenceAuthorization().
+ DoPerformWithdrawPresGrantFromPresentityL(
+ *newIdentity, iStatus );
+ CleanupStack::PopAndDestroy(); // >> newIdentity
+ SetActive();
+ }
+ break;
+
+ case EGrantPresentityGroupMember:
+ {
+ DP_SDA(" CallActualXdmOperationL EGrantPresentityGroupMember");
+ CompleteXIMPReq( aCompleteStatus );
+ }
+ break;
+
+ case EWithdrawGrantFromMember:
+ {
+ DP_SDA(" CallActualXdmOperationL EWithdrawGrantFromMember");
+ if ( !aCompleteStatus )
+ {
+ DP_SDA(" -> succesfully unblocked, store to cache");
+ DeletePersonCacheL();
+ DP_SDA(" -> store info to cache done");
+ }
+ CompleteXIMPReq( aCompleteStatus );
+ }
+ break;
+
+ case EBlockPresentityGroupMember:
+ {
+ DP_SDA(" CallActualXdmOperationL EBlockPresentityGroupMember");
+ if ( !aCompleteStatus )
+ {
+ DP_SDA(" -> succesfully blocked, store to cache");
+
+ DP_SDA(" -> strip prefix from uri");
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC(
+ *iPresIdentity );
+ DP_SDA(" -> store info to cache");
+
+ TBuf<20> buf;
+ buf.Copy( KBlockedExtensionValue );
+
+ iPresenceData->WriteStatusToCacheL( *withoutPrefix,
+ MPresenceBuddyInfo2::EUnknownAvailability,
+ buf,
+ KNullDesC() );
+
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ DP_SDA(" -> store info to cache done");
+ }
+ CompleteXIMPReq( aCompleteStatus );
+ }
+ break;
+
+ case EUnblockPresentityGroupMember:
+ {
+ DP_SDA(" CallActualXdmOperationL EUnblockPresentityGroupMember");
+ if ( !aCompleteStatus )
+ {
+ DP_SDA(" -> succesfully unblocked, store to cache");
+ DeletePersonCacheL();
+ DP_SDA(" -> store info to cache done");
+ }
+ CompleteXIMPReq( aCompleteStatus );
+ }
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ DP_SDA("CPresencePluginGroups::CallActualXdmOperationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginGroups::RunError( TInt aError )
+ {
+ DP_SDA("CPresencePluginGroups::RunError SEND COMPLETE");
+ // complete the open request
+ CompleteXIMPReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginGroups::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresentityGroups* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePluginGroups::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresentityGroups* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginGroups::GetInterfaceId() const
+ {
+ return MProtocolPresentityGroups::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri )
+ {
+ DP_SDA2("CPresencePluginGroups::SetPresIdentityL: %S",
+ &aPresentityId.Identity() );
+
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+
+ if ( aFormatUri )
+ {
+ DP_SDA("CPresencePluginGroups::SetPresIdentityL, format uri");
+
+ HBufC8* identityCopy = HBufC8::NewLC( KBufSize255 );
+ TPtr8 identityCopyPtr( identityCopy->Des() );
+ identityCopyPtr.Copy( aPresentityId.Identity() );
+
+ HBufC8* prefixUri = iPresenceData->CreatePresenceUri8LC(
+ identityCopyPtr );
+
+ HBufC* prefixUri16 = HBufC::NewLC( KBufSize255 );
+ TPtr prefixUri16Ptr( prefixUri16->Des() );
+ prefixUri16Ptr.Copy( *prefixUri );
+
+ iPresIdentity = prefixUri16;
+ CleanupStack::Pop( prefixUri16 );
+ CleanupStack::PopAndDestroy( prefixUri );
+ CleanupStack::PopAndDestroy( identityCopy );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginGroups::SetPresIdentityL, use as it is");
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::StartXdmOperationL(
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ DP_SDA("StartXdmOperationL StartXdmOperationL two param");
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ iXIMPId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ DP_SDA("StartXdmOperationL StartXdmOperationL two param end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::StartXdmOperationL(
+ const MXIMPIdentity& aId,
+ TXIMPRequestId aReqId,
+ TPluginGroupsOperation aOperation )
+ {
+ DP_SDA("StartXdmOperationL StartXdmOperationL three param");
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ SetPresIdentityL( aId, EFalse );
+ iXIMPId = aReqId;
+ iOperation = aOperation;
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::StartXdmOperationL()
+ {
+ if ( !iXdmUtils )
+ {
+ DP_SDA("CPresencePluginGroups::StartXdmOperationL Get xdmUtils");
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ DP_SDA("CPresencePluginGroups::StartXdmOperationL StartXdmOperationL");
+
+ iXdmUtils->InitializeXdmL( iStatus );
+ iState = EPluginInitXdm;
+ DP_SDA("CPresencePluginGroups::StartXdmOperationL SetActive");
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::GetListOfListsL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::GetListOfListsL()
+ {
+ DP_SDA("CPresencePluginGroups::GetListOfListsL");
+
+ RPointerArray<MXIMPIdentity> subscribed;
+ CleanupClosePushL( subscribed );
+
+ iXdmUtils->SubscribeBuddyListL( subscribed );
+ DP_SDA("CPresencePluginGroups::GetListOfListsL SubscribeBudyList Ready");
+
+ MXIMPObjectCollection* coll =
+ iConnObs.ObjectFactory().NewObjectCollectionLC(); // << coll
+
+ TInt count = subscribed.Count();
+ DP_SDA2("CPresencePluginGroups::GetListOfListsL soul count %d", count);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MXIMPIdentity* currId = subscribed[i];
+ MPresentityGroupInfo* sInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresentityGroupInfoLC();
+ sInfo->SetGroupIdL( currId ); // ownership is taken
+ sInfo->SetGroupDisplayNameL( currId->Identity() );
+
+ coll->AddObjectL( sInfo ); // ownership is taken
+ CleanupStack::Pop(); // >> bInfo
+ }
+ DP_SDA("SubscribeBudyList For ready SEND COMPLETE continue");
+
+ CompleteXIMPReq( KErrNone );
+
+ // Callback for subscription state (terminated).
+ MXIMPDataSubscriptionState* myState =
+ iConnObs.ObjectFactory().NewDataSubscriptionStateLC();
+
+ MXIMPStatus* myStatus = iConnObs.ObjectFactory().NewStatusLC();
+
+ // Notice: consider XIMP error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.ProtocolPresenceHost().GroupsDataHost();
+
+ dataHost.SetPresentityGroupListDataSubscriptionStateL(
+ myState, myStatus );
+
+ dataHost.HandlePresentityGroupListL( coll );
+
+ CleanupStack::Pop( 3 ); // >> myState, myStatus, coll
+ CleanupStack::Pop( &subscribed );
+ DP_SDA("CPresencePluginGroups::GetListOfListsL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::GetListContentL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::GetListContentL()
+ {
+ DP_SDA("CPresencePluginGroups::GetListContentL");
+
+ if( !iPresIdentity->Compare( KPresenceBuddyList ) )
+ {
+ DP_SDA("CPresencePluginGroups::GetListContentL - get buddies");
+ DoGetSubscribedBuddyListL();
+
+ // Consider waiting complete for each subscribe before completing
+ CompleteXIMPReq( KErrNone );
+ }
+ else if( !iPresIdentity->Compare( KPresenceSubcribedBuddys ) )
+ {
+ //Subscribe subscribed buddyes virtual group
+ DP_SDA("GetListContentL KPresenceSubcribedBuddys");
+ DoGetSubscribedBuddyListL();
+ }
+ else
+ {
+ DP_SDA("CPresencePluginGroups::GetListContentL Wrong list name");
+ User::Leave( KErrNotFound );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoGetBuddyListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoGetBuddyListL()
+ {
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL KPresenceBuddyList");
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.ProtocolPresenceHost().GroupsDataHost();
+
+ MXIMPObjectCollection* entities =
+ myFactory.NewObjectCollectionLC(); // << entities
+ iXdmUtils->GetEntitiesInListL( iPresIdentity->Des(), *entities );
+ DP_SDA("DoGetBuddyListL entities get ready SEND COMPLETE");
+
+ // callback for data
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL callback data");
+ MXIMPIdentity* id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+ dataHost.HandlePresentityGroupContentL( id, entities );
+ CleanupStack::Pop();// >> id
+ CleanupStack::Pop();// >> entities
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL callback ready");
+
+ // Callback for subscription state (terminated).
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL terminated ");
+ id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+ MXIMPDataSubscriptionState* myState =
+ myFactory.NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = myFactory.NewStatusLC();
+ // Notice: consider XIMP error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ dataHost.SetPresentityGroupContentDataSubscriptionStateL(
+ id, myState, myStatus );
+
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL Pop");
+ CleanupStack::Pop( 3 );
+
+ DP_SDA("CPresencePluginGroups::DoGetBuddyListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DoGetSubscribedBuddyListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DoGetSubscribedBuddyListL()
+ {
+ DP_SDA("CPresencePluginGroups::DoGetSubscribedBuddyListL");
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.ProtocolPresenceHost().GroupsDataHost();
+
+ // Get internal list content
+ MXIMPObjectCollection* entities =
+ myFactory.NewObjectCollectionLC(); // << entities
+ iXdmUtils->GetEntitiesInListL( iPresIdentity->Des(), *entities );
+ DP_SDA("DoGetBuddyListL entities get ready SEND COMPLETE");
+ CleanupStack::PopAndDestroy(); // entities
+
+ // start getting virtualEntities
+ MXIMPObjectCollection* virtualEntities =
+ myFactory.NewObjectCollectionLC();// << virtualEntities
+
+ iSubscribedBuddies->GetVirtualEntitiesL( *virtualEntities );
+
+ DP_SDA("CPresencePluginGroups::DoGetSubscribedBuddyListL - subscribe all");
+ iConnObs.WatcherHandlerL()->SubscribeAllL();
+ DP_SDA("CPresencePluginGroups::DoGetSubscribedBuddyListL - subscribe all ok");
+
+ // callback for data
+ DP_SDA("DoGetSubscribedBuddyListL callback data");
+ MXIMPIdentity* id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+ dataHost.HandlePresentityGroupContentL( id, virtualEntities );
+ CleanupStack::Pop(); // >> id
+ CleanupStack::Pop(); // >> entities
+ DP_SDA("DoGetSubscribedBuddyListL callback ready");
+
+ // Callback for subscription state (terminated).
+ DP_SDA("CPresencePluginGroups::DoGetSubscribedBuddyListL terminated");
+ id = myFactory.NewIdentityLC(); // << id
+ id->SetIdentityL( iPresIdentity->Des() );
+ MXIMPDataSubscriptionState* myState =
+ myFactory.NewDataSubscriptionStateLC();
+ MXIMPStatus* myStatus = myFactory.NewStatusLC();
+ // Notice: consider XIMP error codes
+ myStatus->SetResultCode( KErrNone );
+ myState->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionActive );
+ dataHost.SetPresentityGroupContentDataSubscriptionStateL(
+ id, myState, myStatus );
+
+ CleanupStack::Pop( 3 );
+
+ DP_SDA("DoGetSubscribedBuddyListL - KPresenceOnlineBuddy case end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::CompleteXIMPReq
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::CompleteXIMPReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginGroups::CompleteXIMPReq");
+ if ( iCompleted )
+ {
+ DP_SDA("CPresencePluginGroups::CompleteXIMPReq return");
+ return;
+ }
+
+ iCompleted = ETrue;
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iXIMPId, aStatus );
+ iXIMPId = TXIMPRequestId();
+ DP_SDA("CPresencePluginGroups::CompleteXIMPReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginGroups::DeletePersonCacheL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginGroups::DeletePersonCacheL()
+ {
+ DP_SDA("CPresencePluginGroups::DeletePersonCacheL");
+ DP_SDA(" -> strip prefix from uri");
+ HBufC* withoutPrefix = iPresenceData->RemovePrefixLC( *iPresIdentity );
+ iPresenceData->DeletePresenceL( *withoutPrefix );
+ CleanupStack::PopAndDestroy( withoutPrefix );
+ DP_SDA("CPresencePluginGroups::DeletePersonCacheL out");
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginpublisher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1433 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <utf.h>
+#include <ximpdatasubscriptionstate.h>
+#include <protocolpresencepublishingdatahost.h>
+#include <protocolpresencedatahost.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <presenceinfo.h>
+#include <personpresenceinfo.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpstatus.h>
+#include <ximperrors.hrh>
+#include <ximpidentity.h>
+#include <ximpobjectcollection.h>
+#include <presencewatcherinfo.h>
+#include <simpleutils.h> // For KSimplePDM
+#include <simplefactory.h>
+#include <msimpledocument.h>
+#include <msimplepublisher.h>
+#include <msimplewatcher.h>
+#include <msimplewinfo.h>
+#include <msimpleelement.h>
+#include <msimpleconnection.h>
+#include <simpleerrors.h>
+#include <avabilitytext.h>
+
+#include "presenceplugincommon.h"
+#include "presencepluginpublisher.h"
+#include "presencepluginwinfo.h"
+#include "presenceplugindata.h"
+#include "presencepluginxdmutils.h"
+#include "presencepluginwatcherinfo.h"
+#include "presenceplugincommon.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::CPresencePluginPublisher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginPublisher::CPresencePluginPublisher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ : CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iConnection(aConn),
+ iPublisher( NULL ), iWatcher( NULL ),
+ iSubscribed(EFalse), iSubscribedOwn(EFalse),
+ iPublished(EFalse), iRePublish(EFalse),
+ iWatcherList( CPresencePluginWatcherInfo::LinkOffset() )
+ {
+ DP_SDA("CPresencePluginPublisher::CPresencePluginPublisher ");
+ CActiveScheduler::Add(this);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::ConstructL( CPresencePluginData* aPresenceData )
+ {
+ DP_SDA("CPresencePluginPublisher::ConstructL ");
+ iWatcher = TSimpleFactory::NewWatcherL( iConnection, *this );
+ iPublisher = TSimpleFactory::NewPublisherL( iConnection, *this );
+ iPresenceData = aPresenceData;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginPublisher* CPresencePluginPublisher::NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginData* aPresenceData )
+ {
+ CPresencePluginPublisher* self =
+ new( ELeave ) CPresencePluginPublisher( aObs, aConn );
+ CleanupStack::PushL( self );
+ self->ConstructL( aPresenceData );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::~CPresencePluginPublisher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginPublisher::~CPresencePluginPublisher()
+ {
+ DP_SDA("CPresencePluginPublisher::~CPresencePluginPublisher");
+
+ if ( iDocument )
+ {
+ iDocument->Close();
+ }
+
+ if ( iPublisher )
+ {
+ iPublisher->Close();
+ }
+
+ if ( iWatcher )
+ {
+ iWatcher->Close();
+ }
+
+ DeleteWatchers();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DeleteWatchers
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DeleteWatchers()
+ {
+ DP_SDA("CPresencePluginPublisher::DeleteWatchers");
+ // Delete all buffered transaction requests
+ TDblQueIter<CPresencePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ DP_SDA("CPresencePluginPublisher::DeleteWatchers while");
+ CPresencePluginWatcherInfo* w = rIter;
+ rIter++;
+ // delete wathcer info
+ w->Destroy();
+ }
+ DP_SDA("CPresencePluginPublisher::DeleteWatchers end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::AddWatcherIfNotExistsL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::AddWatcherIfNotExistsL(
+ const TDesC8& aId,
+ const TDesC& aSipId )
+ {
+ DP_SDA("CPresencePluginPublisher::AddWatcherIfNotExistsL");
+ // Delete all buffered transaction requests
+ TDblQueIter<CPresencePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ TBool found(EFalse);
+
+ while ( rIter )
+ {
+ CPresencePluginWatcherInfo* w = rIter;
+ rIter++;
+ found = w->Match( aId, aSipId );
+ if ( found )
+ {
+ DP_SDA("CPresencePluginPublisher::AddWatcherIfNotExistsL found");
+ break;
+ }
+ }
+ if ( !found )
+ {
+ DP_SDA("CPresencePluginPublisher::AddWatcherIfNotExistsL !found");
+ CPresencePluginWatcherInfo* w =
+ CPresencePluginWatcherInfo::NewL( aId, aSipId );
+ iWatcherList.AddLast( *w );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::RemoveWatcherIfExistsL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::RemoveWatcherIfExists(
+ const TDesC8& aId, const TDesC& aSipId )
+ {
+ DP_SDA("CPresencePluginPublisher::RemoveWatcherIfExistsL");
+ // Delete all buffered transaction requests
+ TDblQueIter<CPresencePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ TBool found(EFalse);
+
+ while ( rIter )
+ {
+ CPresencePluginWatcherInfo* w = rIter;
+ rIter++;
+ // delete wathcer info
+ found = w->Match( aId, aSipId );
+ if ( found )
+ {
+ w->Destroy();
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoPublishOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoPublishOwnPresenceL(
+ const MPresenceInfo& aOwnPresence,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::DoPublishOwnPresenceL");
+ const MPersonPresenceInfo* persInfo = aOwnPresence.PersonPresence();
+ if ( !persInfo )
+ {
+ // Notice: error codes
+ CompleteXIMPReq( KErrArgument );
+ return;
+ }
+ InitializeSimpleDocumentL( );
+ AddSimpleDocumentPersL( persInfo );
+
+ StartXdmOperationL( aReqId );
+ iOperation = EPublishOwn;
+ DP_SDA("CPresencePluginPublisher::DoPublishOwnPresenceL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoSubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoSubscribeOwnPresenceL(
+ const MPresenceInfoFilter& /*aPif*/, // notice: later
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::DoSubscribeOwnPresenceL");
+ StartXdmOperationL( aReqId );
+ iOperation = ESubscribeOwn;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoUpdateOwnPresenceSubscriptionPifL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoUpdateOwnPresenceSubscriptionPifL(
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ // Notice: later
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoUnsubscribeOwnPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoUnsubscribeOwnPresenceL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::DoUnsubscribeOwnPresenceL");
+ iSubscribedOwn = EFalse;
+ iSimpleId = iWatcher->UnsubscribeL();
+ iXIMPId = aReqId;
+ iOperation = EUnsubscribeOwn;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoSubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoSubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::DoSubscribePresenceWatcherListL");
+ if ( !iSubscribed )
+ {
+ DP_SDA("DoSubscribePresenceWatcherListL !Subscribed");
+ iConnObs.WinfoHandlerL()->SubscribeWinfoListL( aReqId );
+ iSubscribed = ETrue;
+ iXIMPId = aReqId;
+ iOperation = ESubscribeWinfo;
+ }
+ else
+ {
+ DP_SDA("DoSubscribePresenceWatcherListL else");
+ iXIMPId = aReqId;
+ iOperation = ESubscribeWinfo;
+ CompleteXIMPReq( KErrNone );
+ }
+ DP_SDA("CPresencePluginPublisher::DoSubscribePresenceWatcherListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoUnsubscribePresenceWatcherListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoUnsubscribePresenceWatcherListL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::DoUnsubscribePresenceWatcherListL");
+ if ( iSubscribed )
+ {
+ DP_SDA("DoUnsubscribePresenceWatcherListL: if ( iSubscribed ) - begin");
+ iConnObs.WinfoHandlerL()->UnsubscribeWinfoListL( aReqId );
+ iSubscribed = EFalse;
+ iXIMPId = aReqId;
+ iOperation = EUnsubscribeWinfo;
+ DP_SDA("DoUnsubscribePresenceWatcherListL: if ( iSubscribed ) - end");
+
+ }
+ else
+ {
+ DP_SDA("DoUnsubscribePresenceWatcherListL: iSubscribed ) is false");
+ iXIMPId = aReqId;
+ iOperation = EUnsubscribeWinfo; //hameed
+ CompleteXIMPReq( KErrNone );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::PublishReqCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::PublishReqCompleteL(
+ TInt /*aOpid*/,
+ TInt aStatus )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL");
+ // Notice: make 415 error code conversion here and other
+ //SIP code -> XIMP conversions
+ DP_SDA2("PublishReqCompleteL STATUS %d",aStatus );
+
+ if( iConnObs.GetSessionStatus() )
+ {
+ DP_SDA2("PublishReqComp stopState %d",iConnObs.GetStopPublishState());
+ if ( !aStatus && !iConnObs.GetStopPublishState() )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL ETrue");
+ iPublished = ETrue;
+ iConnObs.SetStopPublishState( ETrue );
+ }
+ // Save E-Tag
+ if( !aStatus )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL Save ETAG");
+ TBuf8<KBufSize255> buf;
+ buf.Copy( iPublisher->SIPETag() );
+ iConnObs.SetETag( buf );
+ }
+ //Do not complete if error republish is true. XIMPFW is not knowing we
+ //are sending republish.
+ if( EFalse == iRePublish && !aStatus )
+ {
+ //Complete Publish request
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL complete");
+ if( !(iConnObs.IsStopPublishCalled()) )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL complete normal");
+ // successfull Online / others: store status to cache
+ StoreOwnStatusToCacheL( );
+ CompleteXIMPReq( aStatus );
+ }
+ //Complete stopPublish and close session if stopPublish is called
+ if( iConnObs.IsStopPublishCalled() )
+ {
+ DP_SDA("PublishReqCompleteL complete closeSession");
+ iPresenceData->DeletePresenceVariablesL( iConnObs.ServiceId() );
+ // successfull Online / others: store status to cache
+ StoreOwnStatusToCacheL( );
+ //Complete close session
+ CompleteClientReq( aStatus );
+ }
+ }
+ if( EFalse == iRePublish && ( KSimpleErrTemporary == aStatus ) )
+ {
+ DP_SDA("PublishReqCompleteL KSimpleErrTemporary");
+ // Make new publish request without ETag
+ CreatePublisherL();
+ iSimpleId = iPublisher->StartPublishL( *iDocument, ETrue );
+ }
+ else if( EFalse == iRePublish && ( KErrTimedOut == aStatus ) )
+ {
+ DP_SDA("PublishReqCompleteL KErrTimedOut");
+ iPublisher->StopPublishL();
+ CompleteXIMPReq( KXIMPErrServicRequestTimeouted );
+ }
+ else
+ {
+ //Set rePublish flag back to false.
+ iRePublish = EFalse;
+ }
+ }
+ else
+ {
+ //Run this case if connection is not good any more
+ DP_SDA("PublishReqCompleteL No connect CANCEL");
+ Cancel();
+ }
+ DP_SDA("CPresencePluginPublisher::PublishReqCompleteL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::PublishTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::PublishTerminatedL( TInt aOpid )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishTerminatedL");
+ DP_SDA2("CPresencePluginPublisher::PublishTerminatedL opID %d",aOpid );
+ DP_SDA2("PublishTerminatedL iSimpleId %d",iSimpleId );
+ DP_SDA2("PublishTerminatedL iStatus %d",iStatus.Int() );
+
+ if ( iSimpleId == aOpid && iConnObs.GetSessionStatus() )
+ {
+ DP_SDA("CPresencePluginPublisher::PublishTerminatedL NewPublish");
+ CreatePublisherL();
+ TRAPD( error , iSimpleId = iPublisher->StartPublishL(
+ *iDocument, ETrue ) );
+ if ( KErrNone == error )
+ {
+ DP_SDA("PublishTerminatedL NewPublish KErrNone");
+ iRePublish = ETrue;
+ iConnObs.SetStopPublishState( EFalse );
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginPublisher::PublishTerminatedL else");
+ iPublished = EFalse;
+ if( iPublisher )
+ {
+ iPublisher->Close();
+ iPublisher = NULL;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WatcherReqCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WatcherReqCompleteL( TInt /*aOpid*/,
+ TInt aStatus )
+ {
+ DP_SDA("CPresencePluginPublisher::WatcherReqCompleteL");
+ if ( !aStatus )
+ {
+ iSubscribedOwn = ETrue;
+ }
+
+ CompleteXIMPReq( aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WatcherNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WatcherNotificationL(
+ MSimpleDocument& aDocument )
+ {
+ // Notice: Do not need to check the expiration here since
+ // WatcherTerminatedL is called then too.
+ DP_SDA("CPresencePluginPublisher::WatcherNotificationL");
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.ProtocolPresenceHost().PublishingDataHost();
+
+ MPresenceInfo* prInfo =
+ iConnObs.PresenceObjectFactoryOwn().NewPresenceInfoLC();// << prInfo
+
+ iPresenceData->NotifyToPrInfoL(
+ iConnObs.ObjectFactory(),
+ iConnObs.PresenceObjectFactoryOwn(),
+ aDocument,
+ *prInfo );
+
+ // XIMP Host API callbacks
+
+ publishHost.HandleSubscribedOwnPresenceL( prInfo );
+ CleanupStack::Pop(); // >> prInfo
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WatcherListNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WatcherListNotificationL(
+ MSimplePresenceList& /*aList*/ )
+ {
+ //Do nothing now
+ DP_SDA("CPresencePluginPublisher::WatcherListNotificationL EMPTY");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WatcherTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WatcherTerminatedL(
+ TInt /*aOpId*/, TInt aReason )
+ {
+ DP_SDA("CPresencePluginPublisher::WatcherTerminatedL");
+
+ iSubscribedOwn = EFalse;
+
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.ProtocolPresenceHost().PublishingDataHost();
+
+ MXIMPDataSubscriptionState *state =
+ myFactory.NewDataSubscriptionStateLC();
+ MXIMPStatus* status = myFactory.NewStatusLC();
+ state->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ status->SetResultCode( aReason );
+ publishHost.SetOwnPresenceDataSubscriptionStateL( state, status );
+ CleanupStack::Pop( 2 ); // status, state
+
+ DP_SDA("CPresencePluginPublisher::WatcherTerminatedL - end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::CompleteXIMPReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::CompleteXIMPReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginPublisher::CompleteXIMPReq");
+ DP_SDA2("CompleteXIMPReq: iOperation = %d",(TInt) iOperation );
+ // Notice: should this yield active scheduler???
+ if ( iOperation != ENoOperation )
+ {
+ DP_SDA("CPresencePluginPublisher::CompleteXIMPReq complete");
+ iOperation = ENoOperation;
+ iConnObs.CompleteReq( iXIMPId, aStatus );
+ iXIMPId = TXIMPRequestId();
+ }
+ DP_SDA("CPresencePluginPublisher::CompleteXIMPReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::CompleteClientReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::CompleteClientReq( TInt aStatus )
+ {
+ DP_SDA2("CPresencePluginPublisher::CompleteClientReq status %d ", aStatus);
+ iOperation = ENoOperation;
+ TRequestStatus* s = iClientStatus;
+ User::RequestComplete( s, aStatus );
+ DP_SDA("CPresencePluginPublisher::CompleteClientReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::DoCancel( )
+ {
+ DP_SDA("CPresencePluginPublisher::DoCancel CANCEL");
+ iXdmUtils->Cancel();
+ iPublisher->Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::RunL( )
+ {
+ DP_SDA("CPresencePluginPublisher::RunL");
+ TInt status = iStatus.Int();
+ DP_SDA2("CPresencePluginPublisher::RunL status %d", status );
+ if ( !status )
+ {
+
+ if ( iOperation == ESubscribeOwn )
+ {
+ DP_SDA("CPresencePluginPublisher::RunL Subscribe Own");
+ iSimpleId = iWatcher->SubscribeL(
+ iConnObs.CurrentSipPresentity8(),
+ NULL, // aFilter <-> aPif
+ ETrue, EFalse );
+ }
+ else if( iOperation == EPublishOwn )
+ {
+ DP_SDA("CPresencePluginPublisher::RunL MakePublishReqL");
+ MakePublishReqL();
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginPublisher::RunL complete");
+ CompleteXIMPReq( status );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginPublisher::RunError( TInt aError )
+ {
+ DP_SDA2("CPresencePluginPublisher::RunError %d",aError );
+
+ CompleteXIMPReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginPublisher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ DP_SDA("CPresencePluginPublisher::GetInterface");
+
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ MProtocolPresencePublishing* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePluginPublisher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ DP_SDA("CPresencePluginPublisher::GetInterface 2 ");
+
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ // caller wants this interface
+ const MProtocolPresencePublishing* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginPublisher::GetInterfaceId() const
+ {
+ DP_SDA("CPresencePluginPublisher::GetInterfaceId");
+
+ return MProtocolPresencePublishing::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::InitializeSimpleDocumentL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::InitializeSimpleDocumentL( )
+ {
+ _LIT8 ( KCipidNS, "urn:ietf:params:xml:ns:pidf:cipid" );
+ _LIT8 ( KCipidCP, "c" );
+ if ( iDocument )
+ {
+ DP_SDA("CPresencePluginPublisher:: deletedocument");
+ iDocument->Close();
+ iDocument = NULL;
+ iDocument = TSimpleFactory::NewDocumentL();
+ }
+ else
+ {
+ DP_SDA("CPresencePluginPublisher:: create document");
+ iDocument = TSimpleFactory::NewDocumentL();
+ }
+ iDocument->AddNamespaceL( KSimplePDM, KSimpleNsPDM );
+ iDocument->AddNamespaceL( KSimpleRPID, KSimpleNsRPID );
+ iDocument->AddNamespaceL( KCipidCP, KCipidNS );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::AddSimpleDocumentPersL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::AddSimpleDocumentPersL(
+ const MPersonPresenceInfo* aInfo )
+ {
+ TInt tupleId = iConnObs.GetTupleId();
+
+ DP_SDA2("AddSimpleDocumentPersL tuple id get: %d", tupleId);
+ if ( tupleId == 0 )
+ {
+ DP_SDA("AddSimpleDocumentPersL tuple generate");
+ tupleId = iPresenceData->GenerateTupleId();
+ iConnObs.SetTupleId(tupleId);
+ }
+
+ iPresenceData->AddPrPersToSimpleDocumentL(
+ aInfo, *iDocument, iConnObs.CurrentSipPresentity8(), tupleId );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::StopPublishL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::StopPublishL( TRequestStatus& aStatus )
+ {
+ DP_SDA2("StopPublish - begin : iPublished= %d ",(TInt) iPublished);
+
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+
+ TInt err1( 0 );
+ TInt err2( 0 );
+
+ // get stored document id if available
+ HBufC8* oldDocumentId = HBufC8::NewLC( KBufSize255 );
+ TPtr8 oldDocumentIdPtr( oldDocumentId->Des() );
+ TRAP( err1, iPresenceData->ReadDocumentIdL(
+ iConnObs.ServiceId(), oldDocumentIdPtr ) );
+
+ if ( iConnObs.GetStopPublishState() && iPublished )
+ {
+ DP_SDA("CPresencePluginPublisher::StopPublish really Stop");
+ if ( !err1 )
+ {
+ TRAP( err2, iPublisher->StopPublishL( oldDocumentIdPtr ) );
+ }
+ else
+ {
+ // if stored document id is not available try with this
+ TRAP( err2, iPublisher->StopPublishL( iConnObs.GetETag() ) );
+ }
+ DP_SDA2("StopPublish iPublisher->StopPublishL : error = %d ", err2 );
+ if ( KErrNone != err2 )
+ {
+ if( iPublisher )
+ {
+ DP_SDA("StopPublish delete and recreate publisher");
+ iPublisher->Close();
+ iPublisher = NULL;
+ DP_SDA("StopPublish really Stop try again 1 ");
+ iPublisher =
+ TSimpleFactory::NewPublisherL( iConnection, *this );
+ DP_SDA("StopPublish really Stop try again 2 ");
+ err2 = KErrGeneral;
+ TRAP( err2, iPublisher->StopPublishL( iConnObs.GetETag() ););
+ DP_SDA2("StopPublishL 2nd try : error = %d ", err2 );
+ if ( KErrNone != err2 )
+ {
+ DP_SDA("StopPublish TWO TIME Error, last try without tag ");
+ TRAP( err2, iPublisher->StopPublishL(); );
+ DP_SDA2("StopPublishL 3rd try : error = %d ", err2 );
+ }
+ }
+ }
+ iConnObs.SetStopPublishState( ETrue );
+ iPublished = EFalse;
+ }
+ CleanupStack::PopAndDestroy( oldDocumentId );
+
+ DP_SDA("CPresencePluginPublisher::StopPublish- end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::Published()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginPublisher::Published()
+ {
+ return iPublished;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::MakePublishReqL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::MakePublishReqL( )
+ {
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL");
+
+ DP_SDA(" -> MakePublishReqL, check for old doc id");
+ HBufC8* oldDocumentId = HBufC8::NewLC( KBufSize255 );
+ TPtr8 oldDocumentIdPtr( oldDocumentId->Des() );
+ TRAPD( error, iPresenceData->ReadDocumentIdL(
+ iConnObs.ServiceId(), oldDocumentIdPtr ) );
+ if ( !iPublished )
+ {
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL 1");
+ CreatePublisherL();
+
+ DP_SDA2(" -> MakePublishReqL, doc id error: %d", error );
+ if ( !error )
+ {
+ DP_SDA(" -> MakePublishReqL, publish with old id");
+ iSimpleId = iPublisher->ContinuePublishL(
+ *iDocument, ETrue, oldDocumentIdPtr );
+ }
+ else
+ {
+ DP_SDA(" -> MakePublishReqL, publish with new id");
+ iSimpleId = iPublisher->StartPublishL( *iDocument, ETrue );
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL 2");
+ CreatePublisherL();
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL Continue Publish");
+ if ( !error )
+ {
+ DP_SDA(" -> MakePublishReqL, publish with stored id");
+ iSimpleId = iPublisher->ContinuePublishL(
+ *iDocument ,ETrue, oldDocumentIdPtr );
+ }
+ else
+ {
+ DP_SDA(" -> MakePublishReqL, stored id not found" );
+ DP_SDA(", publish with old id");
+ iSimpleId = iPublisher->ContinuePublishL(
+ *iDocument ,ETrue, iConnObs.GetETag() );
+ }
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL modifyed");
+ }
+ CleanupStack::PopAndDestroy( oldDocumentId );
+ DP_SDA("CPresencePluginPublisher::MakePublishReqL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::StartXdmOperationL(
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginPublisher::StartXdmOperationL");
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrNotReady ) );
+ iXIMPId = aReqId;
+ if ( !iXdmUtils )
+ {
+ DP_SDA("StartXdmOperationL Initialize XDMUtils");
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+
+ // Allways check those XDM files are ok /
+ //publish seems to be jam if xdm not initialized ?
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ DP_SDA("CPresencePluginPublisher::StartXdmOperationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WinfoNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ DP_SDA("CPresencePluginPublisher::WinfoNotificationL");
+
+ RPointerArray<MSimpleElement> elems;
+ CleanupClosePushL( elems ); // << elems
+ TInt err = aWinfo.SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ TInt count = elems.Count();
+
+ DP_SDA2("WinfoNotificationL elems count%d", count);
+
+ __ASSERT_ALWAYS( count == 1, User::Leave( KErrCorrupt ) );
+
+ using namespace NPresencePlugin::NPresence;
+
+ const TDesC8* stateVal = aWinfo.AttrValue( KPresenceState8 );
+
+ if ( stateVal && !stateVal->CompareF( KPresenceFull8 )) //state full
+ {
+ // full winfo-list is received (New empty list )
+ DP_SDA("CPresencePluginPublisher::WinfoNotificationL full list found");
+ DeleteWatchers();
+ }
+ else
+ {
+ DP_SDA("PluginPublisher: state != full");
+ // Test if state is partitial
+ if ( stateVal && !stateVal->CompareF( KPresencePartial8 ))
+ {
+ DP_SDA("PluginPublisher: state = partitial");
+ }
+ }
+
+ MSimpleElement* elem = elems[0];
+ TPtrC8 p8 = elem->LocalName();
+ err = p8.CompareF( KPresenceWatcherList8 );
+ DP_SDA2("WinfoNotificationL KPresenceWatcherList8 err %d", err);
+ User::LeaveIfError( err );
+ DP_SDA("WinfoNotificationL KPresenceWatcherList8 continue");
+
+ //Get elemets from document
+ err = elem->SimpleElementsL( elems );
+ User::LeaveIfError( err );
+ DP_SDA2("WinfoNotificationL get elems err %d", err);
+ //Make collect from active watchers
+ CollectWatchersL( elems );
+
+ CDesCArrayFlat* watchers = MakeCurrentWatcherListLC();// << watchers
+ MXIMPObjectCollection *actives =
+ iConnObs.ObjectFactory().NewObjectCollectionLC();// << actives
+
+ // Create MXIMPPresenceWatcherInfo entities for
+ // all active watchers and add to actives.
+ TInt wCount = watchers->MdcaCount();
+ DP_SDA2("CPresencePluginPublisher::WinfoNotificationL wCount %d", wCount);
+ for ( TInt j = 0; j < wCount; j++ )
+ {
+ // create MXIMPPresenceWatcherInfo object
+ MPresenceWatcherInfo* wInfo =
+ iConnObs.PresenceObjectFactoryOwn().
+ NewPresenceWatcherInfoLC();// << wInfo
+
+ MXIMPIdentity* identity =
+ iConnObs.ObjectFactory().NewIdentityLC();// << identity
+
+ identity->SetIdentityL( watchers->MdcaPoint( j ) );
+ wInfo->SetWatcherIdL( identity );
+ CleanupStack::Pop( );// >> identity
+
+ wInfo->SetWatcherDisplayNameL( watchers->MdcaPoint( j ) );
+ wInfo->SetWatcherTypeL( MPresenceWatcherInfo::EPresenceSubscriber );
+
+ actives->AddObjectL( wInfo );
+ CleanupStack::Pop( ); // >> wInfo
+ }
+
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+
+ publishHost.HandlePresenceWatcherListL( actives );
+
+ CleanupStack::Pop(); // >> actives
+ CleanupStack::PopAndDestroy( watchers ); // >> watchers
+
+ CleanupStack::PopAndDestroy( &elems ); // >> elems
+ DP_SDA("CPresencePluginPublisher::WinfoNotificationL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::WinfoTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::WinfoTerminatedL( TInt aReason )
+ {
+ DP_SDA("CPresencePluginPublisher::WinfoTerminatedL - begin");
+
+ // call SetPresenceWatcherListDataSubscriptionStateL
+ iSubscribed = EFalse;
+
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresencePublishingDataHost& publishHost =
+ iConnObs.Host()->ProtocolPresenceDataHost().PublishingDataHost();
+ MXIMPDataSubscriptionState *state =
+ myFactory.NewDataSubscriptionStateLC();
+
+ MXIMPStatus* status = myFactory.NewStatusLC();
+ state->SetSubscriptionStateL(
+ MXIMPDataSubscriptionState::ESubscriptionInactive );
+
+ state->SetDataStateL( MXIMPDataSubscriptionState::EDataUnavailable );
+ status->SetResultCode( aReason );
+ publishHost.SetPresenceWatcherListDataSubscriptionStateL( state, status );
+ CleanupStack::Pop( 2 ); // status, state
+ DP_SDA("CPresencePluginPublisher::WinfoTerminatedL - end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::NewETagL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::NewETagL( const TDesC8& aVal )
+ {
+ DP_SDA("CPresencePluginPublisher::NewETagL");
+ // Set ETag value
+ DP_SDA("CPresencePluginPublisher::NewETagL Set ETag");
+ TBuf8<KBufSize255> buf;
+ buf.Copy( aVal );
+ iConnObs.SetETag( buf );
+ buf.Zero();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::MakeCurrentWatcherListLC
+// ---------------------------------------------------------------------------
+//
+CDesCArrayFlat* CPresencePluginPublisher::MakeCurrentWatcherListLC()
+ {
+ DP_SDA("CPresencePluginPublisher::MakeCurrentWatcherListLC - begin");
+ // No one should be added more than once
+ const TInt KMyGran = 10;
+ CDesCArrayFlat* watchers = new (ELeave) CDesCArrayFlat( KMyGran );
+ CleanupStack::PushL( watchers ); // << watchers
+
+ // add user only once here.
+ TDblQueIter<CPresencePluginWatcherInfo> rIter( iWatcherList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CPresencePluginWatcherInfo* w = rIter;
+ rIter++;
+
+ TInt dummy = 0;
+ // Zero -> Found
+ if ( watchers->Find( w->SipId(), dummy ))
+ {
+ watchers->AppendL( w->SipId() );
+ }
+ }
+
+ DP_SDA("CPresencePluginPublisher::MakeCurrentWatcherListLC - end");
+ return watchers;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::CollectWatchers
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::CollectWatchersL(
+ RPointerArray<MSimpleElement>& aElems )
+ {
+ using namespace NPresencePlugin::NPresence;
+ HBufC* nodeContent = NULL;
+
+ TInt count = aElems.Count();
+ DP_SDA2("CPresencePluginPublisher::CollectWatchers elem count %d",count);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MSimpleElement* elem = aElems[i];
+ TPtrC8 p8( elem->LocalName());
+
+ if (!( p8.CompareF( KPresenceWatcher8 )))
+ {
+ DP_SDA("CPresencePluginPublisher::CollectWatchers watchers found");
+ const TDesC8* pp8 = elem->AttrValue( KPresenceStatus8 );
+ // Active wathers here
+ if ( pp8 && !pp8->CompareF( KPresenceActive8 ))
+ {
+ DP_SDA("CollectWatchers: ACTIVE found");
+ // save id since there may be multiple subscriptions
+ // from a single watcher SIP identity.
+ const TDesC8* pId8 = elem->AttrValue( KPresenceId8 );
+
+ // Build collection of grant requests
+ // Find the child node containing the SIP entity
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );// << nodeContent
+
+ AddWatcherIfNotExistsL(
+ pId8 ? *pId8 : KNullDesC8, nodeContent->Des() );
+
+ CleanupStack::PopAndDestroy( nodeContent ); //>> nodeContent
+ }
+ // Terminated wathers here
+ else if ( pp8 && !pp8->CompareF( KPresenceTerminated8 ))
+ {
+ DP_SDA("CollectWatchers: Terminated");
+ const TDesC8* pId8 = elem->AttrValue( KPresenceId8 );
+
+ // Remove terminated from iWatcherList
+ nodeContent = elem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );// << nodeContent
+
+ RemoveWatcherIfExists(
+ pId8 ? *pId8 : KNullDesC8, nodeContent->Des() );
+
+ CleanupStack::PopAndDestroy( nodeContent );// >> nodeContent
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::CreatePublisherL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::CreatePublisherL()
+ {
+ DP_SDA("CPresencePluginPublisher::CreatePublisherL");
+ if( iPublisher )
+ {
+ DP_SDA("CPresencePluginPublisher::CreatePublisherL create");
+ iPublisher->Close();
+ iPublisher = NULL;
+ iPublisher = TSimpleFactory::NewPublisherL( iConnection, *this );
+ }
+ DP_SDA("CPresencePluginPublisher::CreatePublisherL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::StoreOwnStatusToCacheL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginPublisher::StoreOwnStatusToCacheL()
+ {
+ DP_SDA("CPresencePluginPublisher::StoreOwnStatusToCacheL" );
+
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ DP_SDA(" CPresencePluginPublisher -> convert uri" );
+ HBufC* entityUri =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ *iDocument->EntityURI() );
+ CleanupStack::PushL( entityUri );
+
+ DP_SDA(" CPresencePluginPublisher -> strip prefix" );
+ HBufC16* prefixStripped = iPresenceData->RemovePrefixLC(
+ *entityUri );
+
+ DP_SDA(" CPresencePluginPublisher -> fetch simple elements" );
+ RPointerArray<MSimpleElement> simpleElements;
+ CleanupClosePushL( simpleElements );
+ DP_SDA(" CPresencePluginPublisher -> do fetch simple elements" );
+ TInt error = iDocument->SimpleElementsL( simpleElements );
+ DP_SDA2(" CPresencePluginPublisher -> fetch error: %d", error );
+ User::LeaveIfError( error );
+ TBool handled = EFalse;
+ DP_SDA2(" CPresencePluginPublisher -> element count: %d",
+ simpleElements.Count() );
+
+ MSimpleElement* basicSimpleElem(NULL);
+ MSimpleElement* noteSimpleElem(NULL);
+
+ TBuf<KBufSize100> activitiesContentBuf;
+ TBool activitiesHandled( EFalse );
+
+ for( TInt index = 0 ; index < simpleElements.Count() ; index++ )
+ {
+ DP_SDA(" CPresencePluginPublisher -> check for person element" );
+ // Check for person element
+ if (!( simpleElements[index]->LocalName().CompareF( KPresencePerson8 )) ||
+ !( simpleElements[index]->LocalName().CompareF( KPresenceTuple8 )) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> person/tuple element found" );
+ RPointerArray<MSimpleElement> personSubElems;
+ CleanupClosePushL( personSubElems );
+ simpleElements[index]->SimpleElementsL( personSubElems );
+ DP_SDA2(" CPresencePluginPublisher -> person/tuple sub elemen count: %d",
+ personSubElems.Count() );
+
+ for ( TInt j = 0; j < personSubElems.Count(); j++ )
+ {
+ DP_SDA(" CPresencePluginPublisher -> check for status/activities element");
+ if ( !personSubElems[j]->LocalName().CompareF( KPresenceStatus8 ) ||
+ !personSubElems[j]->LocalName().CompareF( KPresenceActivities8 ))
+ {
+ DP_SDA(" CPresencePluginPublisher -> status/activities element found");
+ //Get childs
+ RPointerArray<MSimpleElement> basicElems;
+ CleanupClosePushL( basicElems );
+
+ personSubElems[j]->SimpleElementsL( basicElems );
+ DP_SDA2(" CPresencePluginPublisher -> child elem count: %d",
+ basicElems.Count() );
+ for ( TInt k = 0; k < basicElems.Count(); k++ )
+ {
+ DP_SDA(" CPresencePluginPublisher -> check child elems");
+ if ( !basicElems[k]->LocalName().CompareF(
+ KPresenceBasic8 ))
+ {
+ DP_SDA(" -> basic element found");
+ basicSimpleElem = basicElems[k];
+ }
+ else if ( basicSimpleElem &&
+ !basicElems[k]->LocalName().CompareF( KPresenceActivities8 ) )
+ {
+ DP_SDA(" -> activities found from basic elem");
+ RPointerArray<MSimpleElement> activitiesElems;
+ CleanupClosePushL( activitiesElems );
+
+ DP_SDA(" -> get activities");
+ basicElems[k]->SimpleElementsL( activitiesElems );
+ DP_SDA2(" -> activities count: %d",
+ activitiesElems.Count() );
+ if ( activitiesElems.Count() )
+ {
+ DP_SDA(" -> get activities, multiple, use last");
+ TInt lastActiviesIndex =
+ ( activitiesElems.Count() - 1 );
+ activitiesContentBuf.Copy(
+ activitiesElems[lastActiviesIndex]->LocalName() );
+ activitiesHandled = ETrue;
+ DP_SDA(" -> activity elem ok");
+ }
+ CleanupStack::PopAndDestroy( &activitiesElems );
+ }
+ else if ( basicSimpleElem &&
+ !personSubElems[j]->LocalName().CompareF( KPresenceActivities8 ) )
+ {
+ DP_SDA(" -> activities found from person elem");
+ RPointerArray<MSimpleElement> activitiesElems;
+ CleanupClosePushL( activitiesElems );
+
+ DP_SDA(" -> get activities");
+ personSubElems[j]->SimpleElementsL( activitiesElems );
+ DP_SDA2(" -> activities count: %d",
+ activitiesElems.Count() );
+ if ( activitiesElems.Count() )
+ {
+ DP_SDA(" -> get activities, multiple, use last");
+ TInt lastActiviesIndex =
+ ( activitiesElems.Count() - 1 );
+ activitiesContentBuf.Copy(
+ activitiesElems[lastActiviesIndex]->LocalName() );
+ activitiesHandled = ETrue;
+ DP_SDA2(" -> activities len: %d",
+ activitiesContentBuf.Length() );
+ DP_SDA(" -> activity elem ok");
+ }
+ CleanupStack::PopAndDestroy( &activitiesElems );
+ }
+ }
+ CleanupStack::PopAndDestroy( &basicElems );
+ }
+ }
+ CleanupStack::PopAndDestroy( &personSubElems );
+ }
+ else if ( !simpleElements[index]->LocalName().CompareF( KPresenceNote8 ))
+ {
+ DP_SDA(" CPresencePluginPublisher -> note element found" );
+ noteSimpleElem = simpleElements[index];
+ }
+ }
+ DP_SDA(" CPresencePluginPublisher -> elements handled");
+ __ASSERT_ALWAYS( basicSimpleElem, User::Leave( KErrCorrupt ) );
+
+ if ( !activitiesHandled )
+ {
+ DP_SDA(" -> activities not handled, set unknown");
+ activitiesContentBuf.Copy( KPresenceUnknow );
+ }
+
+ HBufC* nodeContent = basicSimpleElem->ContentUnicodeL();
+ CleanupStack::PushL( nodeContent );
+
+ HBufC* noteContent = NULL;
+ if ( noteSimpleElem )
+ {
+ noteContent = noteSimpleElem->ContentUnicodeL();
+ CleanupStack::PushL( noteContent );
+ }
+ else
+ {
+ noteContent = KNullDesC().AllocLC();
+ }
+
+ MPresenceBuddyInfo2::TAvailabilityValues cacheAvailability =
+ MPresenceBuddyInfo2::ENotAvailable;
+ NPresenceInfo::TAvailabilityValues ximpAvailability =
+ NPresenceInfo::ENotAvailable;
+
+ HBufC* extendedCacheAvailability = HBufC::NewLC( KBufSize255 );
+ TPtr extendedCacheAvailabilityPtr( extendedCacheAvailability->Des() );
+ if ( nodeContent )
+ {
+ handled = ResolveOwnCacheValues( *nodeContent,
+ activitiesContentBuf, cacheAvailability,
+ extendedCacheAvailabilityPtr, ximpAvailability );
+ }
+
+ __ASSERT_ALWAYS( handled, User::Leave( KErrCorrupt ));
+
+ DP_SDA(" CPresencePluginPublisher -> write to cache" );
+
+ DP_SDA2(" CPresencePluginPublisher -> availability: %d",
+ cacheAvailability );
+ DP_SDA2(" CPresencePluginPublisher -> ext availability len: %d",
+ extendedCacheAvailabilityPtr.Length() );
+
+ iPresenceData->WriteStatusToCacheL(
+ *prefixStripped, cacheAvailability,
+ extendedCacheAvailabilityPtr, *noteContent );
+
+ // Store publish variables for republish
+ iPresenceData->StorePresenceOwnPresenceL(
+ iConnObs.ServiceId(), ximpAvailability, *noteContent );
+
+ CleanupStack::PopAndDestroy( extendedCacheAvailability );
+ CleanupStack::PopAndDestroy( noteContent );
+ CleanupStack::PopAndDestroy( nodeContent );
+
+ DP_SDA(" CPresencePluginPublisher -> attributes handled" );
+ CleanupStack::PopAndDestroy( &simpleElements );
+
+ DP_SDA(" CPresencePluginPublisher -> write to cache ok, cleanup" );
+
+ // prefixStripped, entityUri
+ CleanupStack::PopAndDestroy( 2 );
+ DP_SDA("CPresencePluginPublisher::StoreOwnStatusToCacheL out" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginPublisher::ResolveOwnCacheValues
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginPublisher::ResolveOwnCacheValues(
+ const TDesC& aUnicodeContent,
+ const TDesC& aActivities,
+ MPresenceBuddyInfo2::TAvailabilityValues& aCacheAvailability,
+ TPtr& aExtendedCacheAvailability,
+ NPresenceInfo::TAvailabilityValues& aXimpApiAvailability )
+ {
+ DP_SDA("CPresencePluginPublisher::ResolveOwnCacheValuesL" );
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceStates;
+ using namespace NPresenceInfo::NFieldType;
+
+ TBool handled = EFalse;
+ if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceBusy ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> busy");
+ aCacheAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedCacheAvailability.Copy( KDndState() );
+ aXimpApiAvailability = NPresenceInfo::EBusy;
+ handled = ETrue;
+ }
+ // On-The-Phone case
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceOnThePhone ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> on-the-phone");
+ aCacheAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedCacheAvailability.Copy( KOnPhoneState() );
+ aXimpApiAvailability = NPresenceInfo::EOnPhone;
+ handled = ETrue;
+ }
+ //Away case
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceAway ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> away");
+ aCacheAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedCacheAvailability.Copy( KAwayState() );
+ aXimpApiAvailability = NPresenceInfo::EAway;
+ handled = ETrue;
+ }
+ //Dnd case
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceDoNotDisturb ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> dnd");
+ aCacheAvailability = MPresenceBuddyInfo2::EBusy;
+ aExtendedCacheAvailability.Copy( KDndState() );
+ aXimpApiAvailability = NPresenceInfo::EDoNotDisturb;
+ handled = ETrue;
+ }
+ // Unknown open
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceUnknow ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> open");
+ aCacheAvailability = MPresenceBuddyInfo2::EAvailable;
+ aExtendedCacheAvailability.Copy( KDefaultAvailableStatus() );
+ aXimpApiAvailability = NPresenceInfo::EAvailable;
+ handled = ETrue;
+ }
+ // available open
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceAvailable ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> open");
+ aCacheAvailability = MPresenceBuddyInfo2::EAvailable;
+ aExtendedCacheAvailability.Copy( KDefaultAvailableStatus() );
+ aXimpApiAvailability = NPresenceInfo::EAvailable;
+ handled = ETrue;
+ }
+ // available open
+ else if ( !aUnicodeContent.CompareF( KPresenceOpen ) &&
+ !aActivities.CompareF ( KPresenceOpen ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> open/open");
+ aCacheAvailability = MPresenceBuddyInfo2::EAvailable;
+ aExtendedCacheAvailability.Copy( KDefaultAvailableStatus() );
+ aXimpApiAvailability = NPresenceInfo::EAvailable;
+ handled = ETrue;
+ }
+ //Unknown closed
+ else if ( !aUnicodeContent.CompareF( KPresenceClosed ) &&
+ !aActivities.CompareF ( KPresenceUnknow ) )
+ {
+ DP_SDA(" CPresencePluginPublisher -> closed");
+ aCacheAvailability = MPresenceBuddyInfo2::ENotAvailable;
+ aExtendedCacheAvailability.Copy( KInvisibleState() );
+ aXimpApiAvailability = NPresenceInfo::ENotAvailable;
+ handled = ETrue;
+ }
+ //All other states are closed
+ else
+ {
+ DP_SDA(" CPresencePluginPublisher -> else closed");
+ aCacheAvailability = MPresenceBuddyInfo2::ENotAvailable;
+ aExtendedCacheAvailability.Copy( KInvisibleState() );
+ aXimpApiAvailability = NPresenceInfo::ENotAvailable;
+ handled = ETrue;
+ }
+ DP_SDA2("CPresencePluginPublisher::ResolveOwnCacheValuesL out, ret: %d",
+ handled );
+ return handled;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginsession.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,498 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <ximpserviceinfo.h> //For MXIMPServiceInfo
+#include <ximpprotocolconnectionhost.h> //Handle command
+#include <msimpleconnectionobserver.h>//Connection callback methods
+#include <simplefactory.h> //create instances to abstract class
+#include <msimpleconnection.h> //Part of Registration API from SIMPLE engine
+#include <msimpleconnectionobserver.h>
+#include <pressettingsapi.h> //for TPresSettingsSet
+#include <XdmSettingsApi.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+
+#include "presencepluginxdmutils.h"
+#include "presencepluginsession.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presencepluginauthorization.h"
+#include "presenceplugindata.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::CPresencePluginSession()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginSession::CPresencePluginSession(
+ MPresencePluginConnectionObs& aObs )
+ : CActive( CActive::EPriorityStandard ),iObs(aObs),
+ iType( MPresencePluginConnectionObs::ENoReq ),iSipConnected( EFalse ),
+ iXdmConnected( EFalse ), iXdmLocalMode( EFalse ), iOperation( ENoOperation ),
+ iServiceId( KErrNotFound )
+ {
+ CActiveScheduler::Add(this);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::ConstructL( const MXIMPServiceInfo& aService )
+ {
+ DP_SDA2("CPresencePluginSession::ConstructL: service id: %d",
+ aService.IapId() );
+
+ CSPSettings* spSettings = CSPSettings::NewL();
+ CleanupStack::PushL( spSettings );
+
+ CSPProperty* property = CSPProperty::NewLC();
+ spSettings->FindPropertyL( aService.IapId(),
+ ESubPropertyPresenceSettingsId,
+ *property );
+ if ( property )
+ {
+ property->GetValue( iPresSettingId );
+ }
+
+ CleanupStack::PopAndDestroy( property );
+ CleanupStack::PopAndDestroy( spSettings );
+
+ DP_SDA2("PluginSession::ConstructL iPresSettingId %d",iPresSettingId );
+ __ASSERT_ALWAYS( iPresSettingId > 0, User::Leave( KErrArgument ) );
+ iServiceId = aService.IapId();
+
+ //Create connection
+ iConnection = TSimpleFactory::NewConnectionL( *this, aService.IapId() );
+
+ //Check here is xdm settings ok
+ CheckXDMSettingsL( aService.IapId() );
+
+ DP_SDA("CPresencePluginSession::ConstructL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginSession* CPresencePluginSession::NewL(
+ const MXIMPServiceInfo& aService,
+ MPresencePluginConnectionObs& aObs )
+ {
+ DP_SDA("CPresencePluginSession::NewL");
+ CPresencePluginSession* self =
+ new( ELeave ) CPresencePluginSession( aObs );
+ CleanupStack::PushL( self );
+ self->ConstructL( aService );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::~CPresencePluginSession()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginSession::~CPresencePluginSession()
+ {
+ DP_SDA("CPresencePluginSession::~CPresencePluginSession");
+
+ delete iUserId8;
+ delete iDomain;
+ if ( iConnection )
+ {
+ iConnection->Close();
+ }
+
+ DP_SDA("~CPresencePluginSession iXdmUtils");
+ delete iXdmUtils;
+ iXdmUtils = NULL;
+ DP_SDA("CPresencePluginSession::~CPresencePluginSession end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::SimpleConnection()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginSession::GetPresenceSetId( ) const
+ {
+ return iPresSettingId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::SimpleConnection()
+// ---------------------------------------------------------------------------
+//
+MSimpleConnection* CPresencePluginSession::SimpleConnection( )
+ {
+ return iConnection;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::XdmSettingsId()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginSession::XdmSettingsId( )
+ {
+ DP_SDA("CPresencePluginSession::XdmSettingsId");
+ return iXdmSetting;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::CurrentDomain()
+// ---------------------------------------------------------------------------
+//
+TPtrC16 CPresencePluginSession::CurrentDomain( )
+ {
+ return iDomain ? iDomain->Des() : TPtrC16();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::IsXdmLocalmode()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginSession::IsXdmLocalmode()
+ {
+ DP_SDA("CPresencePluginSession::IsXdmLocalmode");
+ return iXdmLocalMode;
+ }
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::OpenSessionL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::OpenSessionL()
+ {
+ DP_SDA("CPresencePluginSession::OpenSessionL");
+ //Check connection status
+ MSimpleConnection::TSimpleState connectionStatus =
+ iConnection->ConnectionStatus();
+ DP_SDA2("OpenSessionL Connection Status %d", connectionStatus);
+
+ if( connectionStatus == MSimpleConnection::EInactive )
+ {
+ DP_SDA("CPresencePluginSession::OpenSessionL Not connected yet");
+ iSipConnected = EFalse;
+ // SIP register using by give presence setting id
+ iOpId = iConnection->LoginL( iPresSettingId );
+ iType = MPresencePluginConnectionObs::EOpenSess;
+ }
+ else if ( connectionStatus == MSimpleConnection::EActive )
+ {
+ DP_SDA(":OpenSessionL already connected complete");
+ iSipConnected = ETrue;
+ iType = MPresencePluginConnectionObs::EOpenSess;
+ RequestCompleteL( iOpId, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::ConnectionStatusL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::ConnectionStatusL(
+ MSimpleConnection::TSimpleState aState )
+ {
+ DP_SDA2("CPresencePluginSession::ConnectionStatusL aState %d", aState );
+
+ if ( (aState == MSimpleConnection::EInactive )
+ && iSipConnected )
+ {
+ DP_SDA("CPresencePluginSession::ConnectionStatusL EInactive");
+
+ DP_SDA("CPresencePluginSession::ConnectionStatusL clear pres cache");
+ iObs.InternalPresenceAuthorization().PluginData().RemoveCacheL();
+ DP_SDA("CPresencePluginSession::ConnectionStatusL clear cache ok");
+
+ // cancel all XDM request
+ iObs.XdmUtilsL()->Cancel();
+ //Set connection Terminated, terminate will be remove all client binds
+ iObs.TerminateConnectionL();
+ iSipConnected = EFalse;
+ iXdmConnected = EFalse;
+ }
+ else if( ( aState == MSimpleConnection::EUnavailable && iSipConnected ) )
+ {
+ //Its seems that SIP connection is unavaible
+ DP_SDA("CPresencePluginSession::ConnectionStatusL EUnavailable");
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::CloseConnection()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::CloseConnection()
+ {
+ DP_SDA("CPresencePluginSession::CloseConnection");
+ if( iConnection )
+ {
+ DP_SDA("CPresencePluginSession::CloseConnection close called");
+ iConnection->Close();
+ iConnection = NULL;
+ }
+ DP_SDA("CPresencePluginSession::CloseConnection end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::ConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginSession::ConnectionStatus()
+ {
+ DP_SDA("CPresencePluginSession::ConnectionStatus");
+ TBool connection = EFalse;
+ if( iXdmConnected && iSipConnected )
+ {
+ connection = ETrue;
+ }
+ return connection;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::RequestCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::RequestCompleteL( TInt /*aOpId*/, TInt aStatus )
+ {
+ DP_SDA("CPresencePluginSession::RequestCompleteL");
+ MPresencePluginConnectionObs::TReqType current = iType;
+
+ if ( !aStatus )
+ {
+ DP_SDA("CPresencePluginSession::RequestCompleteL SIP session is open");
+ iSipConnected = ETrue;
+ if( iXdmConnected )
+ {
+ DP_SDA("CPresencePluginSession::RequestCompleteL xdm IS OK");
+ iType = MPresencePluginConnectionObs::ENoReq;
+ iObs.CompleteReq( current, aStatus );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginSession::RequestCompleteL Initialize XDM");
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrNotReady ) );
+ //Lets test XDM connection before complete
+ iXdmUtils = CPresencePluginXdmUtils::NewL(
+ iObs, iXdmSetting, iXdmLocalMode );
+
+ iOperation = EInitializeXdm;
+ iXdmUtils->InitializeXdmL( iStatus );
+ SetActive();
+ }
+
+ }
+ DP_SDA("CPresencePluginSession::RequestCompleteL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::CurrentSipPresentity()
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CPresencePluginSession::CurrentSipPresentity()
+ {
+ DP_SDA("CPresencePluginSession::CurrentSipPresentity");
+ // Get from Simple engine
+ delete iUserId8;
+ iUserId8 = NULL;
+ TRAPD(err, iUserId8 = iConnection->CurrentSIPIdentityL().AllocL() )
+ if ( err == KErrNone )
+ {
+ return iUserId8 ? iUserId8->Des() : TPtrC8();
+ }
+ else
+ {
+ return iUserId8 ? KNullDesC8() : TPtrC8();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::CheckXDMSettings()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::CheckXDMSettingsL( TUint aServiceId )
+ {
+ //Check if xdm settings not valid or there is text http://localhost
+ //in settings. If not valid or text found client will be save resourcelist
+ //to in phonememory
+
+ TPresSettingsSet mySet;
+ User::LeaveIfError(
+ PresSettingsApi::SettingsSetL( iPresSettingId, mySet ));
+ iXdmSetting = mySet.iXDMSetting;
+ if( iDomain )
+ {
+ delete iDomain;
+ iDomain = NULL;
+ }
+ iDomain = mySet.iDomainSyntax.AllocL();
+
+ DP_SDA(" -> CheckXDMSettings - store domain to service table");
+ // Service table
+ CSPSettings* spsettings = CSPSettings::NewLC();
+ CSPProperty* property = CSPProperty::NewLC();
+
+ DP_SDA(" -> CheckXDMSettings - spsettings and property created");
+ User::LeaveIfError( property->SetName( ESubPropertyPresenceAddrScheme ) );
+ DP_SDA(" -> CheckXDMSettings - property name set");
+
+ TInt atPosInDomain = iDomain->Locate( '@' );
+ DP_SDA2(" -> CheckXDMSettings - @ position in domain: %d", atPosInDomain );
+ if ( KErrNotFound == atPosInDomain )
+ {
+ DP_SDA(" -> CheckXDMSettings - no @ in domain, set");
+ property->SetValue( iDomain->Des() );
+ }
+ else
+ {
+ DP_SDA(" -> CheckXDMSettings - @ found in domain, remove");
+ HBufC* formattedDomain = HBufC::NewLC( iDomain->Length() );
+ TPtr formattedDomainPtr( formattedDomain->Des() );
+ formattedDomainPtr.Copy( iDomain->Mid( ( atPosInDomain + 1 ) ) );
+ property->SetValue( formattedDomainPtr );
+ CleanupStack::PopAndDestroy( formattedDomain );
+ }
+ DP_SDA(" -> CheckXDMSettings - property value set");
+ User::LeaveIfError(
+ spsettings->AddOrUpdatePropertyL( aServiceId, *property ) );
+ DP_SDA(" -> CheckXDMSettings - property added or updated");
+
+ CleanupStack::PopAndDestroy( property );
+ CleanupStack::PopAndDestroy( spsettings );
+
+#ifdef _DEBUG
+ DP_SDA2("XdmSettingsId xdmSetting id %d",iXdmSetting );
+ DP_SDA2("CheckXDMSettings::XdmSettingsId domain %S",iDomain );
+#endif
+
+ //Continue check, add localhost to buf2
+ HBufC* buf2 = KLocalhost().AllocLC();
+
+ //Get Uri from XDM settings
+ HBufC* xcaproot = NULL;
+
+ TRAPD( error, xcaproot =
+ TXdmSettingsApi::PropertyL( iXdmSetting, EXdmPropUri ) );
+ DP_SDA2("CheckXDMSettings Set localmode, err %d", error);
+
+ if( KErrNotFound != error && xcaproot )
+ {
+ //Compare buf2 to xcaproot
+ if ( !xcaproot->Compare( buf2->Des() ) )
+ {
+ DP_SDA("CheckXDMSettings Set localmode");
+ iXdmLocalMode = ETrue;
+ }
+ else
+ {
+ DP_SDA("CheckXDMSettings Set Normal Mode");
+ iXdmLocalMode = EFalse;
+ }
+
+ DP_SDA("CheckXDMSettings PopAndDestroy buf2");
+ }
+ else
+ {
+ //It seems there is no valid XCAP settings, so we try localmode
+ //Shuld we create automaticaly XCAP localhost settings?
+ iXdmLocalMode = ETrue;
+ }
+
+ DP_SDA("CheckXDMSettings PopAndDestroy xcaproot");
+ CleanupStack::PopAndDestroy( buf2 );
+ delete xcaproot;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::XdmUtilsL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmUtils* CPresencePluginSession::XdmUtilsL()
+ {
+ if ( !iXdmUtils )
+ {
+ DP_SDA("CPresencePluginSession::XdmUtilsL !iXdmUtils");
+ iXdmUtils = CPresencePluginXdmUtils::NewL(
+ iObs, iXdmSetting, iXdmLocalMode );
+ }
+
+ return iXdmUtils;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::ServiceId()
+// ---------------------------------------------------------------------------
+//
+TInt& CPresencePluginSession::ServiceId()
+ {
+ return iServiceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::DoCancel( )
+ {
+ DP_SDA("CPresencePluginSession::DoCancel CANCEL");
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginSession::RunL( )
+ {
+ DP_SDA("CPresencePluginSession::RunL");
+ TInt status = iStatus.Int();
+ DP_SDA2("CPresencePluginSession::RunL status %d", status );
+
+ if( ( iOperation == EInitializeXdm ) && !status )
+ {
+ DP_SDA("CPresencePluginSession::RequestCompleteL connection ready");
+ iXdmConnected = ETrue;
+ MPresencePluginConnectionObs::TReqType current = iType;
+ iType = MPresencePluginConnectionObs::ENoReq;
+ iObs.CompleteReq( current, status );
+ }
+ else
+ {
+ DP_SDA("Connection FAIL terminated");
+ iXdmConnected = EFalse;
+ iSipConnected = EFalse;
+ iType = MPresencePluginConnectionObs::ECloseSess;
+ iObs.CompleteReq( iType, status );
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginSession::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginSession::RunError( TInt /*aError*/ )
+ {
+ DP_SDA("CPresencePluginSession::RunError");
+ return KErrNone;
+ }
+
+ // End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginutility.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <ximpidentity.h>
+#include "presencepluginutility.h"
+#include "presencelogger.h"
+
+// -----------------------------------------------------------------------------
+// TPresencePluginUtility::ResetAndDestroyIdentities
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TPresencePluginUtility::ResetAndDestroyIdentities( TAny* anArray )
+ {
+ DP_SDA("TPresencePluginUtility::ResetAndDestroyIdentities");
+
+ RPointerArray<MXIMPIdentity>* array =
+ reinterpret_cast<RPointerArray<MXIMPIdentity>*>( anArray );
+
+ if ( array )
+ {
+ DP_SDA(" -> reset and destroy array items");
+ array->ResetAndDestroy();
+ DP_SDA(" -> close array");
+ array->Close();
+ }
+ DP_SDA("TPresencePluginUtility::ResetAndDestroyIdentities out");
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginvirtualgroup.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#include <e32std.h>
+
+#include <protocolpresentitygroupsdatahost.h>
+#include <presentitygroupmemberinfo.h>
+#include <protocolpresencedatahost.h>
+#include <presenceobjectfactory.h>
+#include <ximpobjectcollection.h>
+#include <ximpobjectfactory.h>
+#include <ximpidentity.h>
+
+#include "presencepluginvirtualgroup.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presenceplugincommon.h"
+#include "presenceplugindata.h"
+
+const TInt KArrayGranularity = 5;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::~CPresencePluginVirtualGroup
+// ---------------------------------------------------------------------------
+CPresencePluginVirtualGroup::CPresencePluginVirtualGroup(
+ MPresencePluginConnectionObs& aObs,
+ CPresencePluginData* aPresenceData )
+ :iConnObs( aObs ),
+ iPresenceData( aPresenceData ),
+ iVirtualMember( NULL )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::CPresencePluginVirtualGroup");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::~CPresencePluginVirtualGroup
+// ---------------------------------------------------------------------------
+CPresencePluginVirtualGroup::~CPresencePluginVirtualGroup()
+ {
+ DP_SDA("CPresencePluginVirtualGroup::~CPresencePluginVirtualGroup1");
+ delete iVirtualMember;
+ delete iListName;
+ DP_SDA("CPresencePluginVirtualGroup::~CPresencePluginVirtualGroup2");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::NewL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginVirtualGroup* CPresencePluginVirtualGroup::NewL(
+ MPresencePluginConnectionObs& aObs,
+ const TDesC16& aListName,
+ CPresencePluginData* aPresenceData )
+ {
+ CPresencePluginVirtualGroup* self =
+ new (ELeave) CPresencePluginVirtualGroup( aObs, aPresenceData );
+ CleanupStack::PushL( self );
+ self->ConstructL( aListName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginVirtualGroup::ConstructL( const TDesC16& aListName )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::ConstructL begin");
+ iVirtualMember = new (ELeave) CDesCArrayFlat( KArrayGranularity );
+ iListName = aListName.AllocL();
+ DP_SDA("CPresencePluginVirtualGroup::ConstructL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::GetVirtualEntities
+// ---------------------------------------------------------------------------
+void CPresencePluginVirtualGroup::GetVirtualEntitiesL(
+ MXIMPObjectCollection& aColl )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::GetVirtualEntities begin");
+ TInt count = iVirtualMember->Count();
+ if ( count )
+ {
+ DP_SDA("CPresencePluginVirtualGroup MXIMPObjectFactory& myFactory");
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ for ( TInt i=0; i < count; i++ )
+ {
+ MXIMPIdentity* member = myFactory.NewIdentityLC();
+ member->SetIdentityL( (*iVirtualMember)[i] );
+ // create here MXIMPPresentityGroupMemberInfo
+ MPresentityGroupMemberInfo* info =
+ iConnObs.PresenceObjectFactoryOwn().
+ NewPresentityGroupMemberInfoLC();
+
+ DP_SDA("CPresencePluginVirtualGroup:: info->SetGroupMemberIdL");
+ info->SetGroupMemberIdL( member ); //ownership taken
+ info->SetGroupMemberDisplayNameL( member->Identity() );
+ aColl.AddObjectL( info );
+ CleanupStack::Pop( 2 ); // >> info, member
+ DP_SDA2("CPresencePluginVirtualGroup:: done= handle next = %d", i);
+ }
+ DP_SDA("CPresencePluginVirtualGroup::GetOnlineEntities all done");
+ }
+ DP_SDA("CPresencePluginVirtualGroup::GetOnlineEntities end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::AddEntityL
+// ---------------------------------------------------------------------------
+void CPresencePluginVirtualGroup::AddEntityL( const TDesC& aIdentityUri )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::AddOnlineEntity - begin");
+ HBufC* prefixStripped = aIdentityUri.AllocLC();
+ if ( KErrNotFound == IdentityExists( aIdentityUri ) )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::ivirtuaBuddys->AddObjectL");
+ iVirtualMember->AppendL( *prefixStripped );
+ }
+ CleanupStack::PopAndDestroy( prefixStripped );
+ DP_SDA("CPresencePluginVirtualGroup::AddOnlineEntity - end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::RemoveOnlineEntity
+// ---------------------------------------------------------------------------
+void CPresencePluginVirtualGroup::RemoveEntityL(
+ const TDesC& aIdentityUri )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::RemoveOnlineEntity - begin");
+ if ( iVirtualMember->Count() )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::RemoveOnlineEntity - find");
+ HBufC* prefixStripped = aIdentityUri.AllocLC();
+ TInt result = IdentityExists( *prefixStripped );
+ if ( KErrNotFound != result && result < iVirtualMember->Count() )
+ {
+ DP_SDA("CPresencePluginVirtualGroup:: - Remove");
+ iVirtualMember->Delete( result );
+ }
+ CleanupStack::PopAndDestroy( prefixStripped );
+ }
+ DP_SDA("CPresencePluginVirtualGroup::RemoveOnlineEntity - end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::IdentityExists
+// ---------------------------------------------------------------------------
+TInt CPresencePluginVirtualGroup::IdentityExists( const TDesC& aIdentityUri )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::IdentityExists - begin");
+
+ TInt result( KErrNotFound );
+
+ for ( TInt i=0; i<iVirtualMember->Count(); i++ )
+ {
+ if ( (*iVirtualMember)[i].CompareF( aIdentityUri ) == 0 )
+ {
+ DP_SDA2("IdentityExists - found at index = %d", i);
+ result = i;
+ break;
+ }
+ }
+
+ DP_SDA("CPresencePluginVirtualGroup::IdentityExists - end");
+ return result;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::GetVirtualIdentityArray
+// ---------------------------------------------------------------------------
+CDesCArray* CPresencePluginVirtualGroup::GetVirtualIdentityArray( )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::GetVirtualIdentityArray - begin");
+ return iVirtualMember;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginVirtualGroup::HandlePresentityGroupMemberAddedL
+// ---------------------------------------------------------------------------
+void CPresencePluginVirtualGroup::HandlePresentityGroupMemberAddedL(
+ const TDesC& aIdentityUri )
+ {
+ DP_SDA("CPresencePluginVirtualGroup::HandlePresentityGroupMemberAddedL");
+
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ MProtocolPresentityGroupsDataHost& dataHost =
+ iConnObs.ProtocolPresenceHost().GroupsDataHost();
+ MXIMPIdentity* groupid = myFactory.NewIdentityLC();
+ groupid->SetIdentityL( iListName->Des() );
+ MXIMPIdentity* member = myFactory.NewIdentityLC();
+ member->SetIdentityL( aIdentityUri );
+ MPresentityGroupMemberInfo* info =
+ iConnObs.PresenceObjectFactoryOwn().NewPresentityGroupMemberInfoLC();
+ info->SetGroupMemberIdL( member ); //ownership taken
+ info->SetGroupMemberDisplayNameL( member->Identity() );
+ dataHost.HandlePresentityGroupMemberAddedL(
+ groupid, info );// ownership taken
+ DP_SDA("CPresencePluginVirtualGroup:: Notify Pop( 3 )");
+ CleanupStack::Pop( 3 ); // groupid, member, info
+
+ DP_SDA("CPresencePluginVirtualGroup::HandlePresentityGroupMemberAddedL End");
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginwatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,778 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <e32svr.h>
+#include <utf.h>
+#include <s32strm.h>
+#include <ximpprotocolconnectionhost.h>
+#include <ximpidentity.h>
+#include <ximperrors.hrh>
+#include <msimpleconnection.h>
+#include <protocolpresentitygroupsdatahost.h>
+#include <protocolpresencedatahost.h>
+#include <ximpobjectcollection.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+
+#include "presencepluginvirtualgroup.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presenceplugincommon.h"
+#include "presencepluginwatcher.h"
+#include "presencepluginentitywatcher.h"
+#include "presencepluginxdmutils.h"
+#include "presenceplugindata.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::CPresencePluginWatcher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWatcher::CPresencePluginWatcher(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn, CPresencePluginData* aPresenceData )
+ : CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iConnection(aConn), iPresenceData( aPresenceData ),
+ iXdmState( EPluginIdle ),iCompleted( ETrue ),
+ iOperation( EPluginUndef )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWatcher* CPresencePluginWatcher::NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn,
+ CPresencePluginData* aPresenceData )
+ {
+ DP_SDA("CPresencePluginWatcher::NewL");
+ CPresencePluginWatcher* self =
+ new( ELeave ) CPresencePluginWatcher( aObs, aConn, aPresenceData );
+ CleanupStack::PushL( self );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::~CPresencePluginWatcher()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWatcher::~CPresencePluginWatcher()
+ {
+ iWatchers.ResetAndDestroy();
+ iWatchers.Close();
+ iWatcherCandidates.ResetAndDestroy();
+ delete iPresIdentity;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoSubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginWatcher::DoSubscribePresentityPresenceL");
+ DP_SDA2(" DoSubscribePresentityPresenceL - identity: %S",
+ &aPresentityId.Identity() );
+
+ iOperation = EPluginSubscribeSingle;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aPresentityId, ETrue );
+
+ //Saving reguestID
+ iXIMPId = aReqId;
+ iCompleted = EFalse;
+
+ HBufC8* pres8 = NULL;
+ pres8 =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CPresencePluginEntityWatcher* watcher =
+ MatchWatcherL( pres8->Des(), ETrue );
+ watcher->StartSubscribeL( pres8->Des() );
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoPerformSubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoPerformSubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA( "CPresencePluginWatcher::DoPerformSubscribePresentityPresenceL ");
+ DP_SDA( " -> From list operation");
+
+ iOperation = EPluginSubscribeByAdding;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aPresentityId, ETrue );
+
+ iCompleted = EFalse;
+
+ HBufC8* pres8 = NULL;
+ pres8 =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CPresencePluginEntityWatcher* watcher =
+ MatchWatcherL( pres8->Des(), ETrue );
+ watcher->StartSubscribeL( pres8->Des(), aStatus );
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoUpdatePresentityPresenceSubscriptionPifL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoUpdatePresentityPresenceSubscriptionPifL(
+ const MXIMPIdentity& /*aPresentityId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ // Notice: later
+ User::Leave( KXIMPErrServiceRequestTypeNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoUnsubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginWatcher::DoUnsubscribePresentityPresenceL");
+ SetPresIdentityL( aPresentityId, ETrue );
+ iXIMPId = aReqId;
+ iCompleted = EFalse;
+
+ HBufC8* pres8 = NULL;
+ pres8 =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CPresencePluginEntityWatcher* watcher =
+ MatchWatcherL( pres8->Des(), EFalse );
+ if ( !watcher )
+ {
+ DP_SDA("DoUnsubscribePresentityPresenceL error");
+ User::Leave( KErrNotFound ); // Notice: error code
+ }
+ else
+ {
+ DP_SDA("DoUnsubscribePresentityPresenceL stop subscripe");
+ watcher->StopSubscribeL();
+ }
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoPerformUnsubscribePresentityPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoPerformUnsubscribePresentityPresenceL(
+ const MXIMPIdentity& aPresentityId,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginWatcher::DoPerformUnsubscribePresentityPresenceL");
+
+ SetPresIdentityL( aPresentityId, ETrue );
+ iCompleted = EFalse;
+
+ iOperation = EPluginUnSubscribeByRemoving;
+
+ HBufC8* pres8 = NULL;
+ pres8 =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( iPresIdentity->Des() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ CPresencePluginEntityWatcher* watcher =
+ MatchWatcherL( pres8->Des(), EFalse );
+ if ( !watcher )
+ {
+ DP_SDA("DoUnsubscribePresentityPresenceL error");
+ User::Leave( KErrNotFound ); // Notice: error code
+ }
+ else
+ {
+ DP_SDA("DoUnsubscribePresentityPresenceL stop subscripe");
+ watcher->StopSubscribeL( aStatus );
+ }
+ CleanupStack::PopAndDestroy( pres8 ); // >> pres8
+
+ DP_SDA("CPresencePluginWatcher::DoPerformUnsubscribePresentityPresenceL -end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoSubscribePresentityGroupMembersPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoSubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("DoSubscribePresentityGroupMembersPresenceL");
+ //Subscribe all buddys from virtual group
+
+ iOperation = EPluginSubscribeGroup;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aGroupId, EFalse );
+ iXIMPId = aReqId;
+ iCompleted = EFalse;
+
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::
+// DoUpdatePresentityGroupMembersPresenceSubscriptionPifL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::
+ DoUpdatePresentityGroupMembersPresenceSubscriptionPifL(
+ const MXIMPIdentity& /*aGroupId*/,
+ const MPresenceInfoFilter& /*aPif*/,
+ TXIMPRequestId /*aReqId*/ )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoUnsubscribePresentityGroupMembersPresenceL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoUnsubscribePresentityGroupMembersPresenceL(
+ const MXIMPIdentity& aGroupId,
+ TXIMPRequestId aReqId )
+ {
+ DP_SDA("DoUnsubscribePresentityGroupMembersPresenceL");
+
+ iOperation = EPluginUnsubscribeGroup;
+ iXdmState = EPluginIdle;
+
+ SetPresIdentityL( aGroupId, EFalse );
+ iXIMPId = aReqId;
+ iCompleted = EFalse;
+
+ StartXdmOperationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::GetInterface()
+// ---------------------------------------------------------------------------
+//
+TAny* CPresencePluginWatcher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions )
+ {
+ DP_SDA("CPresencePluginWatcher::GetInterface (......) ");
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ DP_SDA("GetInterface : aInterfaceId == GetInterfaceId()");
+ // caller wants this interface
+ MProtocolPresenceWatching* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ DP_SDA("GetInterface: aOptions == MXIMPBase::EPanicIfUnknown");
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::GetInterface()
+// ---------------------------------------------------------------------------
+//
+const TAny* CPresencePluginWatcher::GetInterface(
+ TInt32 aInterfaceId,
+ TIfGetOps aOptions ) const
+ {
+ DP_SDA("CPresencePluginWatcher::GetInterface (......) const ");
+ if ( aInterfaceId == GetInterfaceId() )
+ {
+ DP_SDA("GetInterface : aInterfaceId == GetInterfaceId()");
+ // caller wants this interface
+ const MProtocolPresenceWatching* myIf = this;
+ return myIf;
+ }
+ if ( aOptions == MXIMPBase::EPanicIfUnknown )
+ {
+ DP_SDA("GetInterface: aOptions == MXIMPBase::EPanicIfUnknown");
+ User::Panic( KPluginName, KErrExtensionNotSupported );
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::GetInterfaceId()
+// ---------------------------------------------------------------------------
+//
+TInt32 CPresencePluginWatcher::GetInterfaceId() const
+ {
+ DP_SDA("CPresencePluginWatcher::GetInterfaceId() const");
+ return MProtocolPresenceWatching::KInterfaceId;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::MatchWatcherL
+// ---------------------------------------------------------------------------
+//
+CPresencePluginEntityWatcher* CPresencePluginWatcher::MatchWatcherL(
+ const TDesC8& aPresentityid, TBool aCreate )
+ {
+ DP_SDA("CPresencePluginWatcher::MatchWatcherL");
+ DP_SDA2("CPresencePluginWatcher::MatchWatcherL %d", aCreate )
+ TInt count = iWatchers.Count();
+ DP_SDA2( "MatchWatcherL watcher count %d", count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CPresencePluginEntityWatcher* temp = ( iWatchers[i] );
+ //Check if prentity found from watcher
+ if ( !temp->PresentityId().CompareF( aPresentityid ))
+ {
+ DP_SDA("CPresencePluginWatcher::MatchWatcherL return temp");
+ return temp;
+ }
+ }
+ if ( !aCreate )
+ {
+ DP_SDA("CPresencePluginWatcher::MatchWatcherL return NULL");
+ return NULL;
+ }
+ else
+ {
+ // Run this if like create new wathcer
+ DP_SDA("CPresencePluginWatcher::MatchWatcherL Else");
+ CPresencePluginEntityWatcher* watcher =
+ CPresencePluginEntityWatcher::NewL(
+ iConnObs, iConnection, *this, iPresenceData );
+ iWatcherCandidates.Append( watcher );
+ DP_SDA("CPresencePluginWatcher::MatchWatcherL end");
+ return watcher;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DeleteWatcher
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DeleteWatcher(
+ const TDesC8& aPresentityid )
+ {
+ DP_SDA( "CPresencePluginWatcher::DeleteWatcher" );
+ TInt count = iWatchers.Count();
+ DP_SDA2( "CPresencePluginWatcher::DeleteWatcher count %d", count);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CPresencePluginEntityWatcher* temp = ( iWatchers[i] );
+ if ( !temp->PresentityId().CompareF( aPresentityid ) )
+ {
+ DP_SDA2( "CPresencePluginWatcher::DeleteWatcher %d", i );
+ iWatchers.Remove( i );
+ iWatchers.GranularCompress();
+ delete temp;
+ temp = NULL;
+ break; // delete all watchers?
+ }
+ }
+ DP_SDA( "CPresencePluginWatcher::DeleteWatcher end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::SetPresIdentityL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::SetPresIdentityL(
+ const MXIMPIdentity& aPresentityId,
+ TBool aFormatUri )
+ {
+ DP_SDA2("CPresencePluginWatcher::SetPresIdentityL: %S",
+ &aPresentityId.Identity() );
+
+ delete iPresIdentity;
+ iPresIdentity = NULL;
+
+ if( aFormatUri )
+ {
+ HBufC8* identityCopy = HBufC8::NewLC( KBufSize255 );
+ TPtr8 identityCopyPtr( identityCopy->Des() );
+ identityCopyPtr.Copy( aPresentityId.Identity() );
+ DP_SDA2(" SetPresIdentityL, org identity: %S", identityCopy );
+
+ HBufC8* prefixUri = iPresenceData->CreatePresenceUri8LC(
+ identityCopyPtr );
+
+ HBufC* prefixUri16 = HBufC::NewLC( KBufSize255 );
+ TPtr prefixUri16Ptr( prefixUri16->Des() );
+ prefixUri16Ptr.Copy( *prefixUri );
+
+ DP_SDA2("CPresencePluginWatcher::SetPresIdentityL: with prefix: %S",
+ prefixUri16 );
+
+ iPresIdentity = prefixUri16;
+ CleanupStack::Pop( prefixUri16 );
+ CleanupStack::PopAndDestroy( 2, identityCopy );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginWatcher::SetPresIdentityL, use as it is");
+ iPresIdentity = aPresentityId.Identity().AllocL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::CompleteXIMPReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::CompleteXIMPReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginWatcher::CompleteXIMPReq");
+ iXdmState = EPluginIdle;
+ if ( iCompleted )
+ {
+ return;
+ }
+ iCompleted = ETrue;
+ iConnObs.CompleteReq( iXIMPId, aStatus );
+ iXIMPId = TXIMPRequestId();
+ DP_SDA("CPresencePluginWatcher::CompleteXIMPReq END");
+ iOperation = EPluginUndef;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::MatchWatcherId
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginWatcher::MatchWatcherId(
+ const TDesC8& aPresentityId ) const
+ {
+ DP_SDA("CPresencePluginWatcher::MatchWatcherId");
+
+ TBool watcherFound( EFalse );
+ TInt count = iWatchers.Count();
+
+ DP_SDA2("CPresencePluginWatcher::MatchWatcherId watcher count %d", count);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CPresencePluginEntityWatcher* temp = ( iWatchers[i] );
+
+ //Check if ID is found from watcher
+ if ( !temp->PresentityId().CompareF( aPresentityId ) )
+ {
+ DP_SDA("CPresencePluginWatcher::MatchWatcherId - Match!");
+ watcherFound = ETrue;
+ }
+ }
+
+ return watcherFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::CompleteWatcher
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::CompleteWatcher( TInt aStatus )
+ {
+
+ DP_SDA("CPresencePluginWatcher::CompleteWatcher");
+ DP_SDA2("CPresencePluginWatcher::CompleteWatcher status %d", aStatus);
+ // start to remove RLS service when needed.
+ if ( iOperation == EPluginUnsubscribeGroup )
+ {
+ DP_SDA("CompleteWatcher EPluginUnsubscribeGroup");
+ if ( iXdmState == EPluginIdle )
+ {
+ TRAPD( err, iXdmUtils->InitializeXdmsOnlyL( iStatus ));
+ if ( err )
+ {
+ DP_SDA2("CompleteWatcher EPluginUnsubscribeGroup err %d",err);
+ CompleteXIMPReq( err );
+ }
+ else
+ {
+ DP_SDA("CompleteWatcher EPluginUnsubscribeGroup fetch RLS");
+ iXdmState = EPluginFetchRls;
+ if( !IsActive() )
+ {
+ SetActive();
+ }
+ }
+ return;
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginWatcher::CompleteWatcher complete");
+ CompleteXIMPReq( aStatus );
+ }
+ DP_SDA("CPresencePluginWatcher::CompleteWatcher end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::StartXdmOperationL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::StartXdmOperationL()
+ {
+ DP_SDA("CPresencePluginWatcher::StartXdmOperationL");
+ __ASSERT_DEBUG( !IsActive(), User::Leave( KErrCorrupt ) );
+ if ( !iXdmUtils )
+ {
+ iXdmUtils = iConnObs.XdmUtilsL();
+ }
+ iXdmUtils->InitializeXdmsOnlyL( iStatus );
+
+ iXdmState = EPluginInitXdm;
+
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::DoCancel( )
+ {
+ iXdmUtils->Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::RunL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::RunL()
+ {
+
+ TInt status = iStatus.Int();
+
+ DP_SDA2("CPresencePluginWatcher::RunL mystatus %d ", status);
+
+ if ( !status )
+ {
+ if( iOperation == EPluginUnsubscribeGroup )
+ {
+ DP_SDA("CPresencePluginWatcher::RunL EPluginUnsubscribeGroup ");
+ UnSubscribeAllL();
+ }
+ if ( iOperation == EPluginSubscribeGroup )
+ {
+ //First check we have complete buddy list from server
+ if ( iXdmState == EPluginInitXdm )
+ {
+ // get members of the list first
+ SubscribeAllL();
+ return;
+ }
+ }
+ if ( iOperation == EPluginSubscribeSingle )
+ {
+ DP_SDA("CPresencePluginWatcher::RunL EPluginSubscribeSingle ");
+ if ( iXdmState == EPluginIdle )
+ {
+ DP_SDA("RunL EPluginSubscribeSingle complete");
+ iOperation = EPluginUndef;
+ CompleteXIMPReq( status );
+ }
+ else
+ {
+ iOperation = EPluginUndef;
+ CompleteXIMPReq( status );
+ }
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginWatcher::RunL error, complete");
+ CompleteXIMPReq( status );
+ }
+ DP_SDA("CPresencePluginWatcher::RunL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::SubscribeL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::SubscribeL( const TDesC& aIdentity )
+ {
+ DP_SDA2("CPresencePluginWatcher::SubscribeL identity: %S", &aIdentity );
+
+ MXIMPIdentity* member = iConnObs.ObjectFactory().NewIdentityLC();
+ member->SetIdentityL( aIdentity );
+
+ SetPresIdentityL( *member, EFalse );
+
+ HBufC8* pres8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+ member->Identity() );
+ CleanupStack::PushL( pres8 );
+
+ DP_SDA("CPresencePluginWatcher::SubscribeL try to subsribe");
+
+ CPresencePluginEntityWatcher* watcher = MatchWatcherL(
+ pres8->Des(),ETrue );
+ if ( !watcher )
+ {
+ DP_SDA("CPresencePluginWatcher::SubscribeL no watcher, create");
+ watcher = CPresencePluginEntityWatcher::NewL(
+ iConnObs, iConnection, *this, iPresenceData );
+ CleanupStack::PushL( watcher );
+ iWatcherCandidates.AppendL( watcher );
+ CleanupStack::Pop( watcher );
+ }
+ DP_SDA("CPresencePluginWatcher::SubscribeL do subsribe");
+ watcher->StartSubscribeL( pres8->Des() );
+ DP_SDA("CPresencePluginWatcher::SubscribeL do subsribe ok");
+
+ CleanupStack::PopAndDestroy( pres8 );
+ CleanupStack::PopAndDestroy( 1 ); // >> member
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::SubscribeAllL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::SubscribeAllL()
+ {
+ DP_SDA("CPresencePluginWatcher::SubscribeAllL");
+
+ CDesCArray* subsribed =
+ iConnObs.SubscribedContacts()->GetVirtualIdentityArray();
+
+ //Get count
+ TInt count = subsribed->Count();
+ DP_SDA2( "CPresencePluginWatcher::SubscribeAllL contact count %d", count);
+
+ //Subsribe contact one by one
+ if( count > 0 )
+ {
+ for( TInt i = 0;i < count;i++)
+ {
+ DP_SDA2( "SubscribeAllL handle contact no: %d", i );
+ SubscribeL( subsribed->MdcaPoint( i ) );
+ }
+ }
+ DP_SDA( "CPresencePluginWatcher::SubscribeAllL end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::UnSubscribeAllL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::UnSubscribeAllL()
+ {
+ DP_SDA("CPresencePluginWatcher::UnSubscribeAllL");
+ CDesCArray* subsribed =
+ iConnObs.SubscribedContacts()->GetVirtualIdentityArray();
+
+ //Get count
+ TInt count = subsribed->Count();
+ DP_SDA2("CPresencePluginWatcher::UnSubscribeAllL contact count %d",count);
+ //UnSubsribe contact one by one
+
+ for( TInt i = 0;i < count;i++)
+ {
+ DP_SDA2("UnSubscribeAllL handle contact no: %d",i);
+ //Get identity form array
+ MXIMPIdentity* member = iConnObs.ObjectFactory().NewIdentityLC();
+ member->SetIdentityL( (*subsribed)[i] );
+
+ SetPresIdentityL( *member, EFalse );
+
+ HBufC8* pres8 =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( member->Identity() );
+ CleanupStack::PushL( pres8 ); // << pres8
+
+ DP_SDA("CPresencePluginWatcher::UnSubscribeAllL try to unsubsribe");
+ TInt watcherCount = iWatchers.Count();
+ DP_SDA2("UnSubscribeAllL watcher count %d", watcherCount);
+
+ TBool notFound( EFalse );
+ for ( TInt j = 0; j < watcherCount; j++ )
+ {
+ CPresencePluginEntityWatcher* watcher =
+ MatchWatcherL( pres8->Des(), EFalse );
+ if ( !watcher )
+ {
+ DP_SDA("UnSubscribeAllL error not found");
+ notFound = ETrue;
+ }
+ else
+ {
+ DP_SDA("UnSubscribeAllL stop subscripe");
+ watcher->StopSubscribeL();
+ }
+ DP_SDA2("CPresencePluginWatcher: done= handle next = %d", i);
+ }
+ if ( notFound )
+ {
+ DP_SDA("CPresencePluginWatcher::UnSubscribeAllL cotact not found");
+ }
+ CleanupStack::PopAndDestroy( pres8 );
+ CleanupStack::PopAndDestroy( 1 ); // >> member
+ }
+ DP_SDA("CPresencePluginWatcher::UnSubscribeAllL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginWatcher::RunError( TInt aError )
+ {
+ DP_SDA2("CPresencePluginWatcher::RunError = %d", aError);
+ CompleteXIMPReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcher::AcceptL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcher::AcceptL( const CPresencePluginEntityWatcher* aWatcher )
+ {
+ DP_SDA( "CPresencePluginWatcher::AcceptL" );
+
+ if ( KErrNotFound == iWatchers.Find( aWatcher ) )
+ {
+ iWatchers.AppendL( aWatcher );
+
+ TInt index = iWatcherCandidates.Find( aWatcher );
+ if ( KErrNotFound != index )
+ {
+ iWatcherCandidates.Remove( index );
+ }
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginwatcherinfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <utf.h>
+
+#include "presencepluginwatcherinfo.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::CPresencePluginWatcherInfo
+// ---------------------------------------------------------------------------
+CPresencePluginWatcherInfo::CPresencePluginWatcherInfo( )
+ {}
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::~CPresencePluginWatcherInfo
+// ---------------------------------------------------------------------------
+CPresencePluginWatcherInfo::~CPresencePluginWatcherInfo()
+ {
+ delete iId;
+ delete iSipId;
+ }
+
+// ----------------------------------------------------------
+// CPresencePluginWatcherInfo::NewL
+// ----------------------------------------------------------
+//
+CPresencePluginWatcherInfo* CPresencePluginWatcherInfo::NewL(
+ const TDesC8& aId, const TDesC& aSipId )
+ {
+ CPresencePluginWatcherInfo* self =
+ new (ELeave) CPresencePluginWatcherInfo( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aId, aSipId );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWatcherInfo::ConstructL(
+ const TDesC8& aId, const TDesC& aSipId )
+ {
+ iId = aId.AllocL();
+ iSipId = aSipId.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::Destroy
+// ---------------------------------------------------------------------------
+void CPresencePluginWatcherInfo::Destroy()
+ {
+ DP_SDA("CPresencePluginWatcherInfo::Destroy");
+ iLink.Deque();
+ delete this;
+ DP_SDA("CPresencePluginWatcherInfo::Destroy end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::Match
+// ---------------------------------------------------------------------------
+TBool CPresencePluginWatcherInfo::Match(
+ const TDesC8& aId,
+ const TDesC& aSipId )
+ {
+ DP_SDA("CPresencePluginWatcherInfo::Match");
+ if ( (!iId->Des().CompareF( aId )) && (!iSipId->Des().CompareF( aSipId )) )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::SipId
+// ---------------------------------------------------------------------------
+//
+TPtrC CPresencePluginWatcherInfo::SipId( )
+ {
+ DP_SDA("CPresencePluginWatcherInfo::SipId");
+ return iSipId ? iSipId->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWatcherInfo::LinkOffset
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginWatcherInfo::LinkOffset()
+ {
+ return _FOFF(CPresencePluginWatcherInfo, iLink);
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginwinfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <simplefactory.h>
+#include <msimplewinfowatcher.h>
+#include <msimpleconnection.h>
+
+#include "presencepluginwinfo.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::CPresencePluginWinfo()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWinfo::CPresencePluginWinfo(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ :iConnObs( aObs ), iConnection( aConn ),
+ iSubscribed( EFalse ),
+ iWinfoCompleted( EFalse )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::ConstructL( )
+ {
+ iWinfoWatcher = TSimpleFactory::NewWinfoWatcherL( iConnection, *this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWinfo* CPresencePluginWinfo::NewL(
+ MPresencePluginConnectionObs& aObs,
+ MSimpleConnection& aConn )
+ {
+ DP_SDA("CPresencePluginWinfo::NewL");
+ CPresencePluginWinfo* self =
+ new( ELeave ) CPresencePluginWinfo( aObs, aConn );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::~CPresencePluginWinfo()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginWinfo::~CPresencePluginWinfo()
+ {
+ if ( iWinfoWatcher )
+ {
+ iWinfoWatcher->Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::SetHost()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::SetHost(
+ MXIMPProtocolConnectionHost* aHost )
+ {
+ iHost = aHost;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::SubscribeWinfoListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::SubscribeWinfoListL( TXIMPRequestId aReqId )
+ {
+ DP_SDA("CPresencePluginWinfo::SubscribeWinfoListL");
+ iWinfoCompleted = EFalse;
+ if ( !iSubscribed )
+ {
+ DP_SDA("CPresencePluginWinfo::SubscribeWinfoListL !iSubscribed");
+ iSimpleId = iWinfoWatcher->SubscribeWatcherListL( NULL );
+ iSubscribed = ETrue;
+ iXIMPId = aReqId;
+ }
+ else
+ {
+ DP_SDA("CPresencePluginWinfo::SubscribeWinfoListL else ");
+ iSimpleId = 0;
+ iXIMPId = aReqId;
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ }
+ DP_SDA("CPresencePluginWinfo::SubscribeWinfoListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::UnsubscribeWinfoListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::UnsubscribeWinfoListL( TXIMPRequestId aReqId )
+ {
+ if ( iSubscribed )
+ {
+ iSubscribed = EFalse;
+ iSimpleId = iWinfoWatcher->UnsubscribeL();
+ iXIMPId = aReqId;
+ }
+ else
+ {
+ iSimpleId = 0;
+ iXIMPId = aReqId;
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::WinfoReqCompleteL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::WinfoReqCompleteL( TInt aOpId, TInt aStatus )
+ {
+ DP_SDA("CPresencePluginWinfo::WinfoReqCompleteL");
+ if ( iSimpleId == aOpId )
+ {
+ iWinfoCompleted = ETrue;
+ iSimpleId = 0;
+ iConnObs.CompleteReq( iXIMPId, aStatus );
+ // Do not wait MXIMPProtocolConnectionHostObserver callback, this
+ // class is ready to serve the next request now.
+ iXIMPId = TXIMPRequestId();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::WinfoTerminatedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::WinfoTerminatedL(
+ TInt aOpId, TInt aReason )
+ {
+
+ if ( iSimpleId == aOpId )
+ {
+ iSimpleId = 0;
+ iConnObs.WinfoTerminatedL( aReason );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginWinfo::WinfoNotificationL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginWinfo::WinfoNotificationL(
+ MSimpleWinfo& aWinfo )
+ {
+ if ( !iWinfoCompleted )
+ {
+ WinfoReqCompleteL( iSimpleId, KErrNone );
+ }
+ iConnObs.WinfoNotification( aWinfo );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginxdmpresrules.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1155 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+#include <xdmengine.h>
+#include <xdmprotocolinfo.h>
+#include <xdmdocument.h>
+#include <xdmdocumentnode.h>
+#include <xdmnodeattribute.h>
+#include <xdmerrors.h>
+#include <XdmProtocolUidList.h>
+
+#include "presencepluginxdmpresrules.h"
+#include "mpresrulesasynchandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmPresRules* CPresencePluginXdmPresRules::NewLC(
+ const TInt aSettingId, TBool aLocalMode )
+ {
+ CPresencePluginXdmPresRules* self =
+ new (ELeave) CPresencePluginXdmPresRules( aSettingId );
+ CleanupStack::PushL( self );
+ self->ConstructL( aSettingId, aLocalMode );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmPresRules* CPresencePluginXdmPresRules::NewL(
+ const TInt aXmdId, TBool aLocalMode )
+ {
+ CPresencePluginXdmPresRules* self =
+ new( ELeave ) CPresencePluginXdmPresRules( aXmdId );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXmdId, aLocalMode );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::CPresencePluginXdmPresRules()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmPresRules::CPresencePluginXdmPresRules( const TInt aXdmId )
+ :CActive( EPriorityStandard ),
+ iSettingsId( aXdmId ),
+ iXdmState( EStateIdle ), //Listeting xdState
+ iRulesUpdateState(EStateNoOperation),
+ iPresXdmOk( EFalse ),
+ iAsyncReq( ENoOperation )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::ConstructL(
+ const TInt aXmdId,
+ TBool aLocalMode )
+ {
+ DP_SDA2("CPresencePluginXdmPresRules::ConstructL - aXdmId: %d", aXmdId );
+ using namespace NPresencePlugin::NPresence;
+ if ( !aLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL Normal Mode");
+ CXdmProtocolInfo* xdmProtocolInfo = CXdmProtocolInfo::NewL( aXmdId );
+ CleanupStack::PushL( xdmProtocolInfo );
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - protocol info created");
+ xdmProtocolInfo->SetCacheUsage( EFalse );
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - create xdm engine");
+ iXdmEngine = CXdmEngine::NewL( *xdmProtocolInfo );
+ CleanupStack::PopAndDestroy( xdmProtocolInfo );
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - xdm engine created");
+
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - create doc model");
+ //Create empty document model
+ iPresRulesDoc =
+ iXdmEngine->CreateDocumentModelL(
+ KPresencePresRules, EXdmOmaPresenceRules );
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - create doc model ok");
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL LocalMode Mode");
+ //Lets Try localmode
+ CXdmProtocolInfo* xdmProtocolInfo =
+ CXdmProtocolInfo::NewL( 0, KLocalProtocol, KNullDesC );
+ CleanupStack::PushL( xdmProtocolInfo );
+ iXdmEngine = CXdmEngine::NewL( *xdmProtocolInfo );
+ CleanupStack::PopAndDestroy( xdmProtocolInfo );
+
+ //Create empty document model
+ iPresRulesDoc =
+ iXdmEngine->CreateDocumentModelL(
+ KPresencePresRules, EXdmOmaPresenceRules );
+ }
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL create root");
+ CreateRootIfNeededL();
+ DP_SDA("CPresencePluginXdmPresRules::ConstructL - out" );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules()
+ {
+ DP_SDA("CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules");
+
+ if ( iPresRulesDoc )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules 2");
+ if ( iXdmEngine )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules 3");
+ TRAP_IGNORE( iXdmEngine->DeleteDocumentModelL( iPresRulesDoc ));
+ }
+ }
+
+ delete iXdmEngine;
+ delete iEntityUri;
+
+ DP_SDA("CPresencePluginXdmPresRules::~CPresencePluginXdmPresRules Done");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::GetXdmRulesL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmPresRules::GetXdmRulesL(
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::GetXdmRulesL");
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ return KErrAlreadyExists;
+ iAsyncReq = EXdmGetRulesFromServer;
+ iAsyncHandler = aHandler;
+ using namespace NPresencePlugin::NPresence;
+
+ if ( !iPresXdmOk )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::GetXdmRulesL !iPresXdmOk");
+
+
+ iPresRulesDoc->FetchDataL();
+ DP_SDA("CPresencePluginXdmPresRules::GetXdmRulesL !iPresXdmOk end");
+ }
+ else
+ {
+ // Document already exists, no need to search from a server
+ DP_SDA("CPresencePluginXdmPresRules::GetXdmRulesL Already exists");
+ iStatus = KRequestPending;
+ SetActive();
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::UpdateXdmRulesL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmPresRules::UpdateXdmRulesL(
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ {
+ return KErrAlreadyExists;
+ }
+ iAsyncReq = EXdmUpdateRules;
+ iAsyncHandler = aHandler;
+
+ iPresRulesDoc->AppendL();
+ iXdmEngine->UpdateL(iPresRulesDoc, iStatus);
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::MakeInitialRulesDocumentL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::MakeInitialRulesDocumentL(
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::MakeInitialXdmsDocumentL");
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ iAsyncReq = EXdmInitialPresDoc;
+ iAsyncHandler = aHandler;
+
+ CXdmDocumentNode* root = iPresRulesDoc->DocumentRoot();
+ if ( !root )
+ {
+ DP_SDA("CPresencePluginXdmPresRules:: Create root");
+ root = iPresRulesDoc->CreateRootL();
+ }
+
+ using namespace NPresencePlugin::NPresence;
+ root->SetNameL( KPresenceRuleset );
+
+ // send to the server and start wait a response
+ iPresRulesDoc->AppendL( root );
+ DP_SDA("CPresencePluginXdmPresRules::MakeInitialXdmsDocumentL append");
+ iAsyncReq = EXdmInitialPresDoc;
+ DP_SDA("CPresencePluginXdmPresRules::MakeInitialXdmsDocumentL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::AddWhiteListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::AddWhiteListL( CXdmDocumentNode* aRoot )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::AddWhiteList");
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceTransformations;
+
+ if ( aRoot->IsEmptyNode() )
+ {
+ DP_SDA("AddWhiteList is empty node");
+ aRoot->SetEmptyNode( EFalse );
+ }
+ // whitelist
+ CXdmDocumentNode* child2 = aRoot->CreateChileNodeL( KPresenceRule );
+ CleanupStack::PushL( child2 );
+ CXdmNodeAttribute* name2 = child2->CreateAttributeL( KPresenceId );
+ CleanupStack::PushL( name2 );
+ name2->SetAttributeValueL( KPresenceXdmWhiteList );
+ DP_SDA("CPresencePluginXdmPresRules::AddWhiteList 2");
+
+ CXdmDocumentNode* conditionsNode2 =
+ child2->CreateChileNodeL( KPresenceConditions );
+
+ conditionsNode2->CreateChileNodeL( KPresenceIdentity );
+ CXdmDocumentNode* actionNode2 =
+ child2->CreateChileNodeL( KPresenceAction );
+
+ DP_SDA("CPresencePluginXdmPresRules::AddWhiteList 3");
+ CXdmDocumentNode* subNode2 = actionNode2->CreateChileNodeL( KPresenceSub );
+ DP_SDA("CPresencePluginXdmPresRules::MakeInitialXdmsDocumentL 4");
+
+ subNode2->SetLeafNode( ETrue );
+ subNode2->SetLeafNodeContentL( KPresenceAllow8 );
+ DP_SDA("CPresencePluginXdmPresRules::AddWhiteList 5");
+
+ //Add transformations
+ /*<transformations>
+ <pr:provide-services>
+ <pr:all-services/>
+ </pr:provide-services>
+
+ <pr:provide-persons>
+ <pr:all-persons/>
+ </pr:provide-persons>
+
+ <pr:provide-devices>
+ <pr:all-devices/>
+ </pr:provide-devices>
+
+ <pr:provide-all-attributes/>
+ </transformations>*/
+
+ CXdmDocumentNode* trasform2 =
+ child2->CreateChileNodeL( KPresenceTrasformations );
+ CXdmDocumentNode* services2 =
+ trasform2->CreateChileNodeL( KPresenceProvideServices );
+ services2->CreateChileNodeL( KPresenceAllServices );
+ CXdmDocumentNode* person2 =
+ trasform2->CreateChileNodeL( KPresenceProvidePersons );
+ person2->CreateChileNodeL( KPresenceAllPersons );
+ CXdmDocumentNode* devices2 =
+ trasform2->CreateChileNodeL( KPresenceProvidedevices );
+ devices2->CreateChileNodeL( KPresenceAlldevices );
+ trasform2->CreateChileNodeL( KPresenceProvideAllAttributes );
+
+ CleanupStack::Pop( name2 );
+ CleanupStack::Pop( child2 );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::AddBlackList()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::AddBlackListL( CXdmDocumentNode* aRoot )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::AddBlackList");
+ // add all the list nodes
+ // buddylist
+ using namespace NPresencePlugin::NPresence;
+ using namespace NPresencePlugin::NPresenceTransformations;
+ if ( aRoot->IsEmptyNode() )
+ {
+ DP_SDA("AddBlackList is empty node");
+ aRoot->SetEmptyNode( EFalse );
+ }
+ CXdmDocumentNode* child1 = aRoot->CreateChileNodeL( KPresenceRule );
+ CleanupStack::PushL( child1 );
+ CXdmNodeAttribute* name = child1->CreateAttributeL( KPresenceId );
+ CleanupStack::PushL( name );
+
+ name->SetAttributeValueL( KPresenceXdmBlockRule );
+ // add condition
+ CXdmDocumentNode* conditionsNode =
+ child1->CreateChileNodeL( KPresenceConditions );
+ conditionsNode->CreateChileNodeL( KPresenceIdentity );
+
+ CXdmDocumentNode* actionNode =
+ child1->CreateChileNodeL( KPresenceAction );
+
+ DP_SDA("CPresencePluginXdmPresRules::AddBlackList 1");
+ CXdmDocumentNode* subNode =
+ actionNode->CreateChileNodeL( KPresenceSub );
+ DP_SDA("CPresencePluginXdmPresRules::MakeInitialXdmsDocumentL 1/2");
+ subNode->SetLeafNode(ETrue);
+ subNode->SetLeafNodeContentL( KPresenceBlock8 );
+ DP_SDA("CPresencePluginXdmPresRules::AddBlackList 1/3");
+
+ CXdmDocumentNode* trasform =
+ child1->CreateChileNodeL( KPresenceTrasformations );
+ CXdmDocumentNode* services =
+ trasform->CreateChileNodeL( KPresenceProvideServices );
+ services->CreateChileNodeL( KPresenceAllServices );
+
+ CXdmDocumentNode* person =
+ trasform->CreateChileNodeL( KPresenceProvidePersons );
+ person->CreateChileNodeL( KPresenceAllPersons );
+ CXdmDocumentNode* devices =
+ trasform->CreateChileNodeL( KPresenceProvidedevices );
+ devices->CreateChileNodeL( KPresenceAlldevices );
+ trasform->CreateChileNodeL( KPresenceProvideAllAttributes );
+ CleanupStack::Pop( name );
+ CleanupStack::Pop( child1 );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::RunL( )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RunL");
+ TPluginPresRulesXdmOperation origState = iAsyncReq;
+ iAsyncReq = ENoOperation;
+ TInt myStatus = iStatus.Int();
+
+ DP_SDA2("CPresencePluginXdmPresRules::RunL mystatus %d ", myStatus);
+ DP_SDA2("CPresencePluginXdmPresRules::RunL state %d ", origState);
+
+ switch( origState )
+ {
+ case EXdmGetRulesFromServer:
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RunL EXdmGetRulesFromServer");
+ iAsyncHandler->HandlePresUpdateDocumentL(
+ iStatus.Int() );
+ }
+ break;
+ case EXdmInitialPresDoc:
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RunL EXdmInitialPresDoc");
+ iAsyncHandler->HandlePresUpdateDocumentL(
+ iStatus.Int() );
+ }
+ break;
+ case EXdmUpdateRules:
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RunL EXdmUpdateRules");
+ iAsyncHandler->HandlePresUpdateDocumentL(
+ iStatus.Int() );
+ }
+ break;
+ case EXdmUpdateRulesFromServer:
+ {
+ DP_SDA("RunL ExdmUpdateRulesFromServer");
+ CreateRootIfNeededL(); //This check is added for Openser/OpenXcap
+ iAsyncHandler->HandlePresUpdateDocumentL( iStatus.Int() );
+ iRulesUpdateState = EStateNoOperation;
+ }
+ break;
+ case ENoOperation:
+ default:
+ break;
+ }
+ DP_SDA("CPresencePluginXdmPresRules::RunL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::DoCancel( )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::DoCancel");
+ iXdmEngine->CancelUpdate(iPresRulesDoc);
+ iAsyncReq = ECancelDocument;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmPresRules::RunError( TInt /*aError*/ )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RunError");
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::AddEntityToWhiteListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::AddEntityToWhiteListL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::AddEntityToWhiteListL");
+ iEntityUri = aUri.Alloc();
+ DP_SDA2( "AddEntityToWhiteListL entity %S", iEntityUri );
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+
+ iAsyncReq = EXdmUpdateRules;
+ iAsyncHandler = aHandler;
+ iRulesUpdateState = EStateAddToWhiteList;
+ DoOneAddUserL( KPresenceXdmWhiteList, iEntityUri->Des() );
+
+ UpdateXdmRulesL( aHandler );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RemoveEntityFromWhiteListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::RemoveEntityFromWhiteListL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RemoveEntityFromWhiteListL");
+ iEntityUri = aUri.Alloc();
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+
+ iAsyncReq = EXdmUpdateRules;
+ iAsyncHandler = aHandler;
+ iRulesUpdateState = EStateRemoveFromWhiteList;
+ RemoveOneFromRuleL( KPresenceXdmWhiteList, iEntityUri->Des() );
+
+ UpdateXdmRulesL( aHandler );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::AddEntityToBlockedRulesL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::AddEntityToBlockedRulesL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::AddEntityToBlockedRulesL");
+ iEntityUri = aUri.Alloc();
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+
+ iAsyncReq = EXdmUpdateRules;
+ iAsyncHandler = aHandler;
+ iRulesUpdateState = EStateAddToBlockList;
+ DoOneAddUserL( KPresenceXdmBlockRule, iEntityUri->Des() );
+
+ UpdateXdmRulesL( aHandler );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RemoveEntityBlockedRulesL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::RemoveEntityBlockedRulesL(
+ const TDesC& aUri,
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RemoveEntityBlockedRulesL");
+ iEntityUri = aUri.Alloc();
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+
+ iAsyncReq = EXdmUpdateRules;
+ iAsyncHandler = aHandler;
+ iRulesUpdateState = EStateRemoveFromBlackList;
+ RemoveOneFromRuleL( KPresenceXdmBlockRule, iEntityUri->Des() );
+
+ UpdateXdmRulesL( aHandler );
+ DP_SDA("CPresencePluginXdmPresRules::RemoveEntityBlockedRulesL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RemoveOneFromRule()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::RemoveOneFromRuleL(
+ const TDesC& aRule, const TDesC& aUri )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RemoveOneFromRule");
+ CXdmDocumentNode* ruleNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+ TBool found( EFalse );
+ TBool ruleAvaible( EFalse );
+
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<CXdmDocumentNode> rules;
+ CleanupClosePushL( rules );
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ RPointerArray<CXdmDocumentNode> ones;
+ CleanupClosePushL( ones );
+
+ if ( iPresRulesDoc )
+ {
+ DP_SDA("RemoveOneFromRule iPresRulesDoc ok");
+
+ //Check if rule exist
+ ruleAvaible = FindRuleL( aRule, EFalse );
+
+ if ( ruleAvaible )
+ {
+
+ TRAPD( err, ruleNode = GetRulesL( aRule, rules ) );
+ if( !err )
+ {
+ found = ETrue;
+ }
+ }
+ }
+
+ if ( found )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::RemoveOneFromRule found");
+ TInt findErr = ruleNode->Find( KPresenceOne, nodes );
+ if ( !findErr )
+ {
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = ( currNode )->Attribute( KPresenceId );
+
+ TBool uriMatch = CompareUriWithoutPrefixL(
+ aUri, attr->AttributeValue() );
+
+ if ( attr && uriMatch )
+ {
+ DP_SDA("RemoveOneFromRule Remove");
+ //First remove currNode form model
+ iPresRulesDoc->RemoveFromModelL( currNode );
+
+ //Check how many rules are in group now
+ DP_SDA("RemoveOneFromRule Find all one field from rule");
+ User::LeaveIfError( ruleNode->Find( KPresenceOne, ones ) );
+ TInt oneCount = ones.Count();
+ DP_SDA2("RemoveOneFromRule ones count %d", oneCount);
+ //if there is no any ones in rule remove it
+ if( KErrNone == oneCount )
+ {
+ //Remove group
+ DP_SDA("RemoveOneFromRule Remove GROUP");
+ RemoveRuleGroupL( aRule );
+ }
+ // Update model to server
+ iPresRulesDoc->AppendL();
+ break;
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &ones ); // >>> nodes
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &rules ); // >>> lists
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::DoOneAddUserL()
+// ---------------------------------------------------------------------------
+//
+ void CPresencePluginXdmPresRules::DoOneAddUserL(
+ const TDesC& aRule, const TDesC& aUri )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::DoOneAddUserL");
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmDocumentNode* ruleNode = NULL;
+ RPointerArray<CXdmDocumentNode> identityNode;
+ CleanupClosePushL( identityNode );
+
+ TBool found( EFalse );
+ TBool ruleAvaible( EFalse );
+
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<CXdmDocumentNode> rules;
+ CleanupClosePushL( rules );
+
+
+ DP_SDA("CPresencePluginXdmPresRules::DoOneAddUserL iPresRulesDoc");
+ if ( iPresRulesDoc )
+ {
+ DP_SDA("DoOneAddUserL iPresRulesDoc Exist");
+
+ ruleAvaible = FindRuleL( aRule, ETrue );
+
+ if ( ruleAvaible )
+ {
+ TRAPD( err, ruleNode = GetRulesL( aRule, rules ) );
+ if( !err )
+ {
+ found = ETrue;
+ }
+ }
+ }
+
+ //Finaly add entity to rules
+ if ( found )
+ {
+ //Check if enity already in list
+ if( !CheckIfOneExistL( aRule, aUri ) )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::DoOneAddUserL Found");
+ // Find identityNode inside rulenode
+ User::LeaveIfError(
+ ruleNode->Find( KPresenceIdentity, identityNode ) );
+ if ( identityNode[0] )
+ {
+ if ( identityNode[0]->IsEmptyNode() )
+ {
+ DP_SDA("DoOneAddUserL rule node empty");
+ identityNode[0]->SetEmptyNode( EFalse );
+ }
+
+ // create new one node inside identity
+ CXdmDocumentNode* newNode =
+ identityNode[0]->CreateChileNodeL( KPresenceOne );
+ CXdmNodeAttribute* attributeOneId =
+ newNode->CreateAttributeL( KPresenceId );
+
+ attributeOneId->SetAttributeValueL( aUri );
+ iPresRulesDoc->AppendL();
+ DP_SDA("DoOneAddUserL added");
+ }
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmPresRules::DoOneAddUserL error not found");
+ User::Leave( KErrNotFound );
+ }
+ DP_SDA("CPresencePluginXdmPresRules::DoOneAddUserL end");
+ CleanupStack::PopAndDestroy( 2 );
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::GetRulesL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresencePluginXdmPresRules::GetRulesL( const TDesC& aRule,
+ RPointerArray<CXdmDocumentNode>& aRuleArray )
+ {
+ DP_SDA("GetRulesL find Again if rule now exist");
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmDocumentNode* ruleNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+
+ TBool result(EFalse);
+ // find if rule tag is exist
+ User::LeaveIfError( iPresRulesDoc->Find( KPresenceRule, aRuleArray ) );
+
+ // How many rules found
+ TInt count = aRuleArray.Count();
+ DP_SDA2("GetRulesL ruleCount %d ", count);
+
+ // Check is needed rule id exist
+ for ( TInt i=0; i < count; i++ )
+ {
+ ruleNode = aRuleArray[i];
+ TBuf<KBufSize100> buf;
+ buf.Copy(
+ ruleNode->Attribute( KPresenceId )->AttributeValue() );
+ DP_SDA2("GetRulesL ruleNode %S", &buf);
+
+ attr = ruleNode->Attribute( KPresenceId );
+ if ( attr && !attr->AttributeValue().CompareF( aRule ) )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::GetRulesL FOUND");
+ result = ETrue;
+ break;
+ }
+ }
+
+ // Make second compare
+ if( !result )
+ {
+ User::LeaveIfError(iPresRulesDoc->Find( KPresenceRule, aRuleArray ));
+ TInt count2 = aRuleArray.Count();
+
+ for ( TInt i=0; i < count2; i++ )
+ {
+ ruleNode = aRuleArray[i];
+ attr = ruleNode->Attribute( KPresenceId );
+ if ( attr && attr->AttributeValue().CompareF( aRule ) )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::GetRulesL NOT FOUND");
+ User::Leave( KErrNotFound );
+ }
+ }
+ }
+
+ return ruleNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::FindRuleL()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmPresRules::FindRuleL(
+ const TDesC& aRule, TBool aCreateRule )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL");
+ using namespace NPresencePlugin::NPresence;
+
+ if ( iPresRulesDoc )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL pres document exists");
+ RPointerArray<CXdmDocumentNode> rule;
+ CleanupClosePushL( rule );
+
+ CXdmDocumentNode* ruleNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+
+ TBool found = EFalse;
+ //Find all rules from document and but them to array
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL find rule");
+ TInt err = iPresRulesDoc->Find( KPresenceRule, rule );
+ DP_SDA2("FindRuleL find rule error %d", err);
+
+ // There is no any rules yet avaible create
+ if ( err == KErrNotFound && aCreateRule )
+ {
+ DP_SDA("FindRuleL Not any rules exist");
+ if ( iRulesUpdateState == EStateAddToWhiteList )
+ {
+ DP_SDA("FindRuleL add white list");
+ AddWhiteListL( iPresRulesDoc->DocumentRoot() );
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ else if ( iRulesUpdateState == EStateAddToBlockList )
+ {
+ DP_SDA("FindRuleL add black list");
+ AddBlackListL( iPresRulesDoc->DocumentRoot() );
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ }
+
+ // if rule element found find if aRule exist
+ TInt count = rule.Count();
+ for ( TInt i=0; i < count; i++ )
+ {
+ ruleNode = rule[i];
+ TBuf<KBufSize100> buf;
+ buf.Copy(
+ ruleNode->Attribute( KPresenceId )->AttributeValue() );
+ DP_SDA2("FindRuleL ruleNode %S", &buf);
+
+ attr = ruleNode->Attribute( KPresenceId );
+ if ( attr && !attr->AttributeValue().CompareF( aRule ) )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL FOUND");
+ found = ETrue;
+ }
+ }
+
+ if ( !found && aCreateRule)
+ {
+ // if rule not found create it
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL not found");
+ //if rule not found add rule and check again
+ if ( EStateAddToWhiteList == iRulesUpdateState )
+ {
+ DP_SDA("FindRuleL add white list2");
+ AddWhiteListL( iPresRulesDoc->DocumentRoot() );
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ else if ( EStateAddToBlockList == iRulesUpdateState )
+ {
+ DP_SDA("FindRuleL add black list 2");
+ AddBlackListL( iPresRulesDoc->DocumentRoot() );
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ else
+ {
+ // Should we create presrules document
+ DP_SDA("CPresencePluginXdmPresRules::FindRuleL end");
+ return EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::CheckIfOneExistL
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmPresRules::CheckIfOneExistL(
+ const TDesC& aRule,
+ const TDesC& aUri )
+ {
+ using namespace NPresencePlugin::NPresence;
+ DP_SDA("CPresencePluginXdmPresRules::CheckIfOneExistL");
+
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmNodeAttribute* attr = NULL;
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+ TBool state( EFalse );
+
+ CXdmDocumentNode* root = iPresRulesDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aRule );
+
+ if ( foundNode )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::CheckIfOneExistL check nodes");
+ TInt findErr = foundNode->Find( KPresenceOne, nodes );
+ DP_SDA2("CheckIfEnityExist - findErr: %d", findErr );
+
+ if ( findErr )
+ {
+ DP_SDA("CheckIfOneExistL One not exist ");
+ state = EFalse;
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmPresRules::CheckIfOneExistL Else");
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = ( currNode )->Attribute( KPresenceId );
+
+ TBool uriMatch( EFalse );
+ uriMatch = CompareUriWithoutPrefixL(
+ aUri, attr->AttributeValue() );
+
+ if ( attr && uriMatch )
+ {
+ DP_SDA("CheckIfOneExistL entity exists");
+ //Enity is exist
+ state = ETrue;
+ break;
+ }
+ }
+ }
+ }
+ DP_SDA("CPresencePluginXdmPresRules::CheckIfOneExistL Destroy nodes");
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ return state;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::RemoveRuleGroupL( )
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::RemoveRuleGroupL( const TDesC& aRule )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RemoveRuleGroupL");
+ CXdmDocumentNode* ruleNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+ TBool found( EFalse );
+ TBool ruleAvaible( EFalse );
+
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<CXdmDocumentNode> rules;
+ CleanupClosePushL( rules );
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ //Find rules
+ if ( iPresRulesDoc )
+ {
+ DP_SDA("RemoveRuleGroupL iPresRulesDoc ok");
+
+ //Check if rule exist
+ ruleAvaible = FindRuleL( aRule, EFalse );
+
+ if ( ruleAvaible )
+ {
+ // If rule found get count how many rules are in xml
+ TInt findErr = iPresRulesDoc->Find( KPresenceRule, rules );
+ DP_SDA2("RemoveRuleGroupL findError %d", findErr);
+ if ( !findErr )
+ {
+ DP_SDA("RemoveRuleGroupL found EFalse");
+ found = EFalse;
+ }
+ else
+ {
+ TInt count = rules.Count();
+ DP_SDA2("RemoveRuleGroupL rule count %d", count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ ruleNode = rules[i];
+ attr = ruleNode->Attribute( KPresenceId );
+ if ( attr && !attr->AttributeValue().CompareF( aRule ))
+ {
+ found = ETrue;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if ( found )
+ {
+ User::LeaveIfError( iPresRulesDoc->Find( KPresenceRule, nodes ));
+ TInt ruleCount = nodes.Count();
+ DP_SDA2("L node count %d", ruleCount);
+ for ( TInt i = 0; i < ruleCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = currNode->Attribute( KPresenceId );
+ if ( attr && !attr->AttributeValue().CompareF( aRule ))
+ {
+ DP_SDA("RemoveRuleGroupL remove rule");
+ // This is the user we are looking for deletion.
+ iPresRulesDoc->RemoveFromModelL( currNode );
+ //Update
+ iPresRulesDoc->AppendL();
+ break;
+ }
+ }
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &rules ); // >>> rules
+ DP_SDA("CPresencePluginXdmUtils::RemoveRuleGroupL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::UpdateFromServerL()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmPresRules::UpdateFromServerL(
+ MPresRulesAsyncHandler* const aHandler )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::UpdateFromServer");
+ using namespace NPresencePlugin::NPresence;
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+
+ if ( IsActive() )
+ {
+ return KErrAlreadyExists;
+ }
+ iPresRulesDoc->ResetContents();
+ iPresRulesDoc->FetchDataL();
+ iAsyncReq = EXdmUpdateRulesFromServer;
+ iAsyncHandler = aHandler;
+ iXdmEngine->UpdateL( iPresRulesDoc, iStatus );
+ SetActive();
+ DP_SDA("CPresencePluginXdmPresRules::UpdateFromServer end");
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::CreateRootIfNeededL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmPresRules::CreateRootIfNeededL()
+ {
+ DP_SDA("CPresencePluginXdmPresRules::CreateRootIfNeededL");
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmDocumentNode* myRootNode = iPresRulesDoc->DocumentRoot();
+
+ if ( myRootNode )
+ {
+ DP_SDA("CreateRootIfNeededL document root exists");
+ myRootNode->SetEmptyNode(EFalse);
+ return;
+ }
+
+ DP_SDA("CPresencePluginXdmPresRules::CreateRootIfNeededL create root");
+ myRootNode = iPresRulesDoc->CreateRootL();
+ DP_SDA("CreateRootIfNeededL create root pushL");
+ CleanupStack::PushL( myRootNode );
+ myRootNode->SetNameL( KPresenceRuleset );
+ DP_SDA("CPresencePluginXdmPresRules::CreateRootIfNeededL create root POP");
+ CleanupStack::Pop( myRootNode );
+ DP_SDA("CPresencePluginXdmPresRules::CreateRootIfNeededL create root end");
+ }
+
+void CPresencePluginXdmPresRules::ResetAndDestroy1( TAny* aPointerArray )
+ {
+ if ( aPointerArray )
+ {
+ RPointerArray<CXdmDocumentNode>* array =
+ static_cast<RPointerArray<CXdmDocumentNode>*>( aPointerArray );
+ array->ResetAndDestroy();
+ array->Close();
+ }
+ }
+
+void CPresencePluginXdmPresRules::ResetAndDestroy2( TAny* aPointerArray )
+ {
+ if ( aPointerArray )
+ {
+ RPointerArray<SXdmAttribute16>* array =
+ static_cast<RPointerArray<SXdmAttribute16>*>( aPointerArray );
+ array->ResetAndDestroy();
+ array->Close();
+ }
+ }
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::SearchListUnderParentL
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresencePluginXdmPresRules::SearchListUnderParentL(
+ CXdmDocumentNode* aParent,
+ const TDesC& aName )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::SearchListUnderParentL");
+
+ using namespace NPresencePlugin::NPresence;
+
+ if ( !aParent )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::SearchListUnderParentL return NULL");
+ return NULL;
+ }
+
+ RPointerArray<CXdmDocumentNode> resultArray;
+ RPointerArray<SXdmAttribute16> attributeArray;
+
+ CleanupClosePushL( resultArray ); // <<< resultArray
+ CleanupClosePushL( attributeArray ); // <<< attributeArray
+
+ SXdmAttribute16 attr;
+ attr.iName.Set( KPresenceId );
+ attr.iValue.Set( aName );
+ attributeArray.Append( &attr );
+
+ CXdmDocumentNode* currNode = NULL;
+
+ aParent->Find( KPresenceRule, resultArray, attributeArray );
+
+ TInt count = resultArray.Count();
+ DP_SDA2("SearchListUnderParentL node count %d",count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ currNode = resultArray[i];
+ CXdmDocumentNode* parent = currNode->Parent();
+ if ( parent == aParent )
+ {
+ DP_SDA("SearchListUnderParentL parent MATCH");
+ break;
+ }
+ currNode = NULL;
+ }
+
+ CleanupStack::PopAndDestroy(); // clItem
+ CleanupStack::PopAndDestroy(); // clItem2
+ DP_SDA("CPresencePluginXdmPresRules::SearchListUnderParentL return");
+ return currNode;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmPresRules::SearchListUnderParentL
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmPresRules::CompareUriWithoutPrefixL(
+ const TDesC& aUri, const TDesC& aAttribute )
+ {
+ DP_SDA("CPresencePluginXdmPresRules::CompareUriWithoutPrefixL");
+
+ TBool match( EFalse );
+
+ RBuf uriWithoutPrefix;
+ CleanupClosePushL( uriWithoutPrefix );
+ uriWithoutPrefix.CreateL( aUri );
+ TInt prefixLocation = uriWithoutPrefix.Locate( ':' );
+
+ if ( KErrNotFound != prefixLocation )
+ {
+ uriWithoutPrefix.Delete( 0, ( prefixLocation + 1 ) );
+ }
+
+ RBuf attributeWithoutprefix;
+ CleanupClosePushL( attributeWithoutprefix );
+ attributeWithoutprefix.CreateL( aAttribute );
+ prefixLocation = attributeWithoutprefix.Locate( ':' );
+
+ if ( KErrNotFound != prefixLocation )
+ {
+ attributeWithoutprefix.Delete( 0, ( prefixLocation + 1 ) );
+ }
+
+ DP_SDA2(" --> uri without prefix=%S", &uriWithoutPrefix );
+ DP_SDA2(" --> attribute without prefix=%S", &attributeWithoutprefix );
+
+ if ( uriWithoutPrefix.Compare( attributeWithoutprefix ) == 0 )
+ {
+ match = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy( &attributeWithoutprefix );
+ CleanupStack::PopAndDestroy( &uriWithoutPrefix );
+
+ return match;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presencepluginxdmutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1685 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <e32std.h>
+#include <utf.h>
+#include <e32test.h>
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <ximpidentity.h>
+#include <ximpobjectcollection.h>
+#include <presentitygroupinfo.h>
+#include <presentitygroupmemberinfo.h>
+#include <xdmengine.h>
+#include <xdmdocument.h>
+#include <xdmprotocolinfo.h>
+#include <xdmdocumentnode.h>
+#include <xdmnodeattribute.h>
+#include <xdmerrors.h>
+#include <pressettingsapi.h> //for TPresSettingsSet
+#include <XdmSettingsApi.h>
+#include <XdmProtocolUidList.h>
+#include <avabilitytext.h>
+
+#include "presencepluginxdmpresrules.h"
+#include "mpresencepluginconnectionobs.h"
+#include "presenceplugincommon.h"
+#include "presencepluginxdmutils.h"
+#include "presencepluginvirtualgroup.h"
+#include "presencepluginauthorization.h"
+#include "presenceplugindata.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CPresencePluginXdmUtils()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmUtils::CPresencePluginXdmUtils(
+ MPresencePluginConnectionObs& aObs , TInt aXmdId, TBool aLocalmode )
+ : CActive( CActive::EPriorityStandard ),
+ iConnObs(aObs), iSettingsId(aXmdId),
+ iXdmState(EStateIdle), iOperation( ENoOperation ),
+ iPresXdmOk( EFalse ), iXdmOk( EFalse ),
+ iRulesUpdateState(EStateNoOperation), iLocalMode( aLocalmode )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::ConstructL( )
+ {
+
+ //If we are in normalmode we need presence rules too
+ if ( !iLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::ConstructL NormalMode");
+ iXdmPresRules = CPresencePluginXdmPresRules::NewL(
+ iSettingsId, EFalse );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmUtils* CPresencePluginXdmUtils::NewL(
+ MPresencePluginConnectionObs& aObs, TInt aXmdId, TBool aLocalmode )
+ {
+ CPresencePluginXdmUtils* self =
+ new( ELeave ) CPresencePluginXdmUtils( aObs, aXmdId, aLocalmode );
+ CleanupStack::PushL( self );
+ self->ConstructL( );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::~CPresencePluginXdmUtils()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginXdmUtils::~CPresencePluginXdmUtils()
+ {
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils");
+ if ( iXdmDoc )
+ {
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils 1");
+ if (iXdmEngine)
+ {
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils del doc");
+ TRAP_IGNORE( iXdmEngine->DeleteDocumentModelL( iXdmDoc ));
+ }
+ }
+
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils 3");
+ delete iXdmEngine;
+ iXdmEngine = NULL;
+
+
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils 4");
+ delete iXdmPresRules;
+ iXdmPresRules = NULL;
+
+
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils 5");
+ delete iEntityUri;
+ iEntityUri = NULL;
+
+ iBlockedContacts.ResetAndDestroy();
+
+ DP_SDA("CPresencePluginXdmUtils::~CPresencePluginXdmUtils end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::InitializeXdmL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::InitializeXdmL( TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL");
+
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+
+ // if resource-list not ready
+ if ( !iXdmOk )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL !iXdmOk");
+ if ( !iLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL NormalMode");
+ GetXdmListsL( ETrue, EFalse );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL LocalMode");
+ GetXdmListsL( ETrue, ETrue );
+ }
+ }
+ else if ( !iPresXdmOk && !iLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL !iPresXdmOk");
+ GetXdmRulesL();
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL All is OK ");
+ // All is ok
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmL SEND COMPLETE")
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::InitializeXdmL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::InitializePresRulesL( )
+ {
+ DP_SDA("CPresencePluginXdmUtils:: MakeInitialRules");
+ iXdmState = ECreateXdmRules;
+ iRulesUpdateState = EStateInitializeRules;
+ iXdmPresRules->MakeInitialRulesDocumentL( this );
+ UpdateXdmRulesL();
+ DP_SDA("CPresencePluginXdmUtils:: MakeInitialRules done");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::GetXdmRulesL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::GetXdmRulesL()
+ {
+ DP_SDA("CPresencePluginXdmUtils:: GetXdmRulesL");
+
+ if ( !iXdmPresRules )
+ {
+ // get data from a network if not done so yet
+ if ( !iLocalMode )
+ {
+ iXdmPresRules = CPresencePluginXdmPresRules::NewL(
+ iSettingsId, EFalse );
+ }
+ else
+ {
+ /*localmode*/
+ //iXdmPresRules
+ //= CPresencePluginXdmPresRules::NewL( iSettingsId, ETrue );
+ }
+ }
+
+ if( !iLocalMode && iXdmPresRules )
+ {
+ User::LeaveIfError( iXdmPresRules->UpdateFromServerL( this ));
+ }
+ iXdmState = EGetXdmRules;
+ DP_SDA("CPresencePluginXdmUtils:: GetXdmRulesL done");
+ DP_SDA("CPresencePluginXdmUtils::GetXdmRulesL - add buddies to virtual");
+ AddIdentityToVirtualListL( KPresenceBuddyList );
+
+ DP_SDA("CPresencePluginXdmUtils::GetXdmRulesL - add blocked to virtual");
+ AddIdentityToVirtualListL( KPresenceBlockedList );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::InitializeXdmsOnlyL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::InitializeXdmsOnlyL( TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmsOnlyL");
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+
+ if ( !iXdmOk )
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmsOnlyL 1");
+ GetXdmListsL( EFalse, EFalse );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmsOnlyL all ok");
+ // All is ok
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmsOnlyL SEND COMPLETE")
+ CompleteClientReq( KErrNone );
+ }
+ DP_SDA("CPresencePluginXdmUtils::InitializeXdmsOnlyL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CheckXdmDoc()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmUtils::CheckXdmDoc()
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckXdmDoc");
+
+ if ( iXdmDoc )
+ {
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ DP_SDA("CPresencePluginXdmUtils::CheckXdmDoc2");
+ if( root )
+ {
+ TInt count = root->NodeCount();
+ DP_SDA2("CPresencePluginXdmUtils::CheckXdmDoc count %d", count);
+ if ( !count )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckXdmDoc NotFound");
+ iXdmOk = EFalse;
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckXdmDoc file ok");
+ iXdmOk = ETrue;
+ }
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckXdmDoc file False");
+ iXdmOk = EFalse;
+ }
+
+ return iXdmOk;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CheckIfError
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmUtils::CheckIfErrorL( TInt aMyStatus )
+ {
+ TInt myStatus = aMyStatus;
+ DP_SDA2("CPresencePluginXdmUtils::CheckIfError ErrorCode %d ", myStatus);
+ if ( myStatus == KErrTimedOut )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfError TimeOut error");
+ myStatus = KErrTimedOut;
+ User::Leave( KErrTimedOut );
+ }
+ else if ( myStatus == KErrCouldNotConnect ||
+ myStatus == KXcapErrorNetworkNotAvailabe )
+ {
+ DP_SDA("CheckIfError KErrCouldNotConnect error");
+ myStatus = aMyStatus;
+ }
+ else if ( myStatus == KXcapErrorHttpNotFound )
+ {
+ DP_SDA("CheckIfError KXcapErrorHttpNotFound");
+ myStatus = aMyStatus;
+ }
+ else if ( myStatus == KXcapErrorAuthentication )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfError auth error");
+ myStatus = aMyStatus;
+ }
+ else if ( myStatus == KXcapErrorTooManyOccurencies )
+ {
+ DP_SDA("CPresencePluginXdmUtils KXcapErrorTooManyOccurencies");
+ myStatus = 0;
+ }
+ else if( myStatus == KErrDisconnected )
+ {
+ myStatus = aMyStatus;
+ User::Leave( KErrCancel );
+ }
+ else if( myStatus == KXcapErrorHttpPrecondFailed )
+ {
+ DP_SDA("CheckIfError KXcapErrorHttpPrecondFailed");
+ myStatus = aMyStatus;
+ }
+ else if ( KErrNoMemory == myStatus )
+ {
+ DP_SDA("CheckIfError KErrNoMemory");
+ User::Leave( KErrNoMemory );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfError ERROR");
+ myStatus = aMyStatus;
+ }
+ return myStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::RunL( )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RunL");
+ TPluginXdmState origState = iXdmState;
+ iXdmState = EStateIdle;
+ TInt myStatus = iStatus.Int();
+
+ DP_SDA2("CPresencePluginXdmUtils::RunL mystatus %d ", myStatus);
+ DP_SDA2("CPresencePluginXdmUtils::RunL state %d ", origState);
+ DP_SDA2("CPresencePluginXdmUtils:: ClientStatus %d",iClientStatus->Int() );
+
+ if ( myStatus == KErrCancel )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RunL CANCEL SEND COMPLETE")
+ CompleteClientReq( KErrCancel );
+ }
+
+ switch ( origState )
+ {
+ case EGetXdmLists:
+ case EGetXdmListsOnly:
+ {
+ DoGetXdmListsL( myStatus, origState );
+ }
+ break;
+
+ case ECreateXdmLists:
+ {
+ DoCreateXdmListsL( myStatus, origState, EFalse );
+ }
+ break;
+
+ case ECreateXdmListsOnly:
+ {
+ DoCreateXdmListsL( myStatus, origState, ETrue );
+ }
+ break;
+
+ case EGetXdmBlockList:
+ {
+ DP_SDA("RunL EGetXdmBlockList SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ break;
+
+ case EUpdateXdmList:
+ {
+ DoUpdateXdmListsL( myStatus, origState );
+ }
+ break;
+
+ case EUpdateBlockedContactPresenceCache:
+ DoUpdateBlockedContactPresenceCacheL( myStatus );
+ break;
+
+ default:
+ {
+ DP_SDA("CPresencePluginXdmUtils::RunL last else");
+ //check myStatus error
+ myStatus = CheckIfErrorL( myStatus );
+
+ if ( myStatus )
+ {
+ // complete reqular request
+ DP_SDA("CPresencePluginXdmUtils::RunL SEND LAST COMPLETE");
+ CompleteClientReq( myStatus );
+ }
+ DP_SDA("CPresencePluginXdmUtils::RunL default end")
+ }
+ break;
+
+ }
+ DP_SDA("CPresencePluginXdmUtils::RunL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoUpdateXdmLists()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoUpdateXdmListsL(
+ TInt aMyStatus,
+ TPluginXdmState /*aOrigState*/)
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoUpdateXdmLists EUpdateXdmList");
+ if ( !iLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoUpdateXdmLists updaterules");
+ if( aMyStatus )
+ {
+ DP_SDA("DoUpdateXdmLists updaterules error");
+ aMyStatus = CheckIfErrorL( aMyStatus );
+ CompleteClientReq( aMyStatus );
+ }
+ else
+ {
+ DP_SDA("DoUpdateXdmLists updaterules else");
+ UpdateXdmRulesL();
+ }
+ }
+ else
+ {
+ DP_SDA("EUpdateXdmList LOCALMODE SEND COMPLETE");
+ aMyStatus = CheckIfErrorL( aMyStatus );
+ CompleteClientReq( aMyStatus );
+ }
+ iRulesUpdateState = EStateNoOperation;
+ DP_SDA("CPresencePluginXdmUtils::DoUpdateXdmLists EUpdateXdmList end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoCreateXdmLists()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoCreateXdmListsL(
+ TInt aMyStatus,
+ TPluginXdmState /*aOrigState*/,
+ TBool aOnlyResourceList )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoCreateXdmListsL ECreateXdmLists");
+ //check myStatus error
+ aMyStatus = CheckIfErrorL( aMyStatus );
+ if( !aOnlyResourceList )
+ {
+ if ( aMyStatus )
+ {
+ DP_SDA("DoCreateXdmLists ECreateXdmLists SEND COMPLETE");
+ CompleteClientReq( aMyStatus );
+ }
+ else if ( !iLocalMode )
+ {
+ DP_SDA("ECreateXdmLists !myStatus GetXdmRules");
+ iXdmOk = ETrue;
+ GetXdmRulesL();
+ }
+ else if ( iLocalMode )
+ {
+ DP_SDA("DoCreateXdmLists ECreateXdmLists SEND COMPLETE 2");
+ iXdmOk = ETrue;
+ CompleteClientReq( aMyStatus );
+ }
+ }
+ else
+ {
+ //check myStatus error
+ aMyStatus = CheckIfErrorL( aMyStatus );
+ if ( aMyStatus == KErrTimedOut )
+ {
+ DP_SDA("DoCreateXdmLists EGetXdmListsOnly 1");
+ aMyStatus = 0;
+ }
+ if ( !aMyStatus )
+ {
+ DP_SDA("DoCreateXdmLists EGetXdmListsOnly 2");
+ iXdmOk = ETrue;
+ }
+
+ if( !(KXcapErrorNetworkNotAvailabe == aMyStatus ||
+ KErrCouldNotConnect == aMyStatus ) )
+ {
+ DP_SDA("DoCreateXdmLists EGetXdmListsOnly SEND COMPLETE");
+ CompleteClientReq( aMyStatus );
+ }
+ }
+ DP_SDA("CPresencePluginXdmUtils::DoCreateXdmListsL ECreateXdmLists end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoGetXdmLists()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoGetXdmListsL(
+ TInt aMyStatus,
+ TPluginXdmState aOrigState )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists EGetXdmLists");
+ //check myStatus error
+ aMyStatus = CheckIfErrorL( aMyStatus );
+
+ if ( aMyStatus )//Check is file includes nodes
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists CreateXDM");
+ // no resource-list, let's start to create it.
+ CreateXdmListsL( ETrue );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists EGetXdmLists else");
+ if( iLocalMode )
+ {
+ //Check if document empty
+ TBool empty = CheckXdmDoc();
+ if( !empty )
+ {
+ CreateXdmListsL( ETrue );
+ }
+ else
+ {
+ iXdmOk = ETrue;
+ DP_SDA("DoGetXdmLists Localmode SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ }
+ else
+ {
+ iXdmOk = ETrue;
+ if ( !iPresXdmOk && !iLocalMode && aOrigState == EGetXdmLists )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists GetXDM");
+ GetXdmRulesL();
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ }
+ }
+ DP_SDA("CPresencePluginXdmUtils::DoGetXdmLists end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoCancel( )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoCancel");
+ iOperation = EXdmCancel;
+
+ if ( iXdmState == EGetXdmLists || iXdmState == ECreateXdmLists ||
+ iXdmState == EUpdateXdmRules || iXdmState == EUpdateXdmList ||
+ iXdmState == EGetXdmBlockList || iXdmState == ECreateXdmRules ||
+ iXdmState == ESubsBlockList ||
+ iXdmState == EGetResourceListFromServer ||
+ iXdmState == EGetXdmListsOnly || iXdmState == ECreateXdmListsOnly )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoCancel list get or create");
+ iXdmState = ECancelDocument;
+ iXdmEngine->CancelUpdate( iXdmDoc );
+ // cancel presrules too
+ iXdmPresRules->Cancel();
+ }
+ else
+ {
+ iStatus = KRequestPending;
+ TRequestStatus* s= &iStatus;
+ DP_SDA("CPresencePluginXdmUtils::DoCancel SEND COMPLETE");
+ User::RequestComplete( s, KErrCancel );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CPresencePluginXdmUtils::RunError( TInt aError )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RunError");
+ // complete the open request
+ CompleteClientReq( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::AddEntityToGrantedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::AddEntityToGrantedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToGrantedL");
+ DP_SDA2("CPresencePluginXdmUtils::AddEntityToGrantedL, uri: %S", &aUri );
+
+ TRAPD( err, iEntityUri = aUri.AllocL() );
+ DP_SDA2(" AddEntityToGrantedL, uri alloc err: %d", err );
+
+ //Add entity to virtualGroup
+ iConnObs.SubscribedContacts()->AddEntityL( iEntityUri->Des() );
+
+ if ( !err )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToGrantedL !err");
+ iXdmState = EUpdateXdmList;
+ iClientStatus = &aStatus;
+ iOperation = EXdmAddUserToGroup;
+ iRulesUpdateState = EStateAddToWhiteList;
+
+ //add user to resouce-list list
+ DoAddUserToListL( KPresenceBuddyList, aUri );
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToGrantedL 1");
+ UpdateXdmsL();
+
+ *iClientStatus = KRequestPending;
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToGrantedL end");
+ }
+ else
+ {
+ DP_SDA("AddEntityToGrantedL else error SEND COMPLETE");
+ //If error we can complete request
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::AddEntityToBlockedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::AddEntityToBlockedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToBlockedL");
+ iClientStatus = &aStatus;
+
+ if( iLocalMode )
+ {
+ //Block is not used in localmode
+ DP_SDA("AddEntityToBlockedL localmode rules not support");
+ CompleteClientReq( KErrNotSupported );
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToBlockedL !localmode");
+ TRAPD(err, iEntityUri = aUri.AllocL() );
+ //Remove entity form subscribed virtual group
+ iConnObs.SubscribedContacts()->RemoveEntityL( iEntityUri->Des() );
+
+ if ( !err )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToBlockedL no error");
+ iXdmState = EUpdateXdmList;
+ iOperation = EXdmAddUserToGroup;
+ iRulesUpdateState = EStateAddToBlockList;
+
+ DoAddUserToListL( KPresenceBlockedList, aUri );
+ UpdateXdmsL();
+
+ *iClientStatus = KRequestPending;
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToBlockedL ready");
+ }
+ else
+ {
+ //If error we can complete request
+ DP_SDA("AddEntityToBlockedL SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ }
+ DP_SDA("CPresencePluginXdmUtils::AddEntityToBlockedL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoAddUserToListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoAddUserToListL(
+ const TDesC& aList,
+ const TDesC& aUri )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL");
+ DP_SDA2("CPresencePluginXdmUtils::DoAddUserToListL aList: %S", &aList);
+ DP_SDA2("CPresencePluginXdmUtils::DoAddUserToListL aUri: %S", &aUri);
+
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aList );
+
+ if ( foundNode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL found");
+ if ( !CheckIfEnityExistL( aList, aUri ) )
+ {
+ DP_SDA("DoAddUserToListL entity not exist");
+ if ( foundNode->IsEmptyNode() )
+ {
+ DP_SDA("DoAddUserToListL IsEmptyNode");
+ foundNode->SetEmptyNode( EFalse );
+ }
+
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL newNode");
+ CXdmDocumentNode* newNode =
+ foundNode->CreateChileNodeL( KPresenceEntry );
+ DP_SDA("DoAddUserToListL entry attribute");
+ CXdmNodeAttribute* attributeEntryUri =
+ newNode->CreateAttributeL( KPresenceUri );
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL set entry");
+ attributeEntryUri->SetAttributeValueL( aUri );
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL Append");
+ iXdmDoc->AppendL( );
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL leave");
+ User::Leave( KErrNotFound );
+ }
+ DP_SDA("CPresencePluginXdmUtils::DoAddUserToListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CheckIfEnityExistL
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmUtils::CheckIfEnityExistL(
+ const TDesC& aList,
+ const TDesC& aUri )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfEnityExist");
+
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmNodeAttribute* attr = NULL;
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+ TBool state( EFalse );
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aList );
+
+ if ( foundNode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfEnityExist check nodes");
+ TInt findErr = foundNode->Find( KPresenceEntry, nodes );
+ DP_SDA2("CheckIfEnityExist - findErr: %d", findErr );
+
+ if ( findErr )
+ {
+ DP_SDA("CheckIfEnityExist Enity not exist ");
+ state = EFalse;
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::CheckIfEnityExist Else");
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = ( currNode )->Attribute( KPresenceUri );
+
+ TBool uriMatch( EFalse );
+ uriMatch = CompareUriWithoutPrefixL(
+ aUri, attr->AttributeValue() );
+
+ if ( attr && uriMatch )
+ {
+ DP_SDA("CheckIfEnityExist entity exists");
+ //Enity is exist
+ state = ETrue;
+ break;
+ }
+ }
+ }
+ }
+ DP_SDA("CPresencePluginXdmUtils::CheckIfEnityExist Destroy nodes");
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ return state;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::SearchListUnderParentL
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresencePluginXdmUtils::SearchListUnderParentL(
+ CXdmDocumentNode* aParent,
+ const TDesC& aName )
+ {
+ DP_SDA("CPresencePluginXdmUtils::SearchListUnderParentL");
+
+ using namespace NPresencePlugin::NPresence;
+
+ if ( !aParent )
+ {
+ DP_SDA("CPresencePluginXdmUtils::SearchListUnderParentL return NULL");
+ return NULL;
+ }
+
+ RPointerArray<CXdmDocumentNode> resultArray;
+ RPointerArray<SXdmAttribute16> attributeArray;
+
+ CleanupClosePushL( resultArray ); // <<< resultArray
+ CleanupClosePushL( attributeArray ); // <<< attributeArray
+
+ SXdmAttribute16 attr;
+ attr.iName.Set( KPresenceName );
+ attr.iValue.Set( aName );
+ attributeArray.Append( &attr );
+
+ CXdmDocumentNode* currNode = NULL;
+
+ aParent->Find( KPresenceList, resultArray, attributeArray );
+
+ TInt count = resultArray.Count();
+ DP_SDA2("SearchListUnderParentL node count %d",count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ currNode = resultArray[i];
+ CXdmDocumentNode* parent = currNode->Parent();
+ if ( parent == aParent )
+ {
+ DP_SDA("SearchListUnderParentL parent MATCH");
+ break;
+ }
+ currNode = NULL;
+ }
+
+ CleanupStack::PopAndDestroy( &attributeArray); // >>> attributeArray
+ CleanupStack::PopAndDestroy( &resultArray ); // >>> resultArray
+ DP_SDA("CPresencePluginXdmUtils::SearchListUnderParentL return");
+ return currNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::RemoveEntityFromGrantedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::RemoveEntityFromGrantedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RemoveEntityFromGrantedL");
+ TRAPD(err, iEntityUri = aUri.AllocL() );
+
+ iConnObs.SubscribedContacts()->RemoveEntityL( iEntityUri->Des() );
+
+ if ( !err )
+ {
+ iClientStatus = &aStatus;
+ iRulesUpdateState = EStateRemoveFromWhiteList;
+ iOperation = EXdmRemoveUserFromGroup;
+
+ DoRemoveUserFromListL( KPresenceBuddyList, aUri );
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmList;
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ //If error we can complete request
+ DP_SDA("RemoveEntityFromGrantedL SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::RemoveEntityFromBlockedL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::RemoveEntityFromBlockedL(
+ const TDesC& aUri,
+ TRequestStatus& aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::RemoveEntityFromBlockedL");
+ TRAPD(err, iEntityUri = aUri.AllocL() );
+
+ if ( !err )
+ {
+ iClientStatus = &aStatus;
+ iRulesUpdateState = EStateRemoveFromBlackList;
+ iOperation = EXdmRemoveUserFromGroup;
+
+ DoRemoveUserFromListL( KPresenceBlockedList, aUri );
+ // send to the server and start wait a response
+ UpdateXdmsL();
+ iXdmState = EUpdateXdmList;
+ *iClientStatus = KRequestPending;
+ }
+ else
+ {
+ //If error we can complete request
+ DP_SDA("RemoveEntityFromBlockedL SEND COMPLETE");
+ CompleteClientReq( KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoRemoveUserFromListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoRemoveUserFromListL(
+ const TDesC& aList,
+ const TDesC& aUri )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoRemoveUserFromListL");
+ CXdmNodeAttribute* attr = NULL;
+
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists );
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+ CXdmDocumentNode* foundNode = SearchListUnderParentL( root, aList );
+ if ( foundNode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoRemoveUserFromListL Node Found");
+ User::LeaveIfError( foundNode->Find( KPresenceEntry, nodes ));
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ CXdmDocumentNode* currNode = nodes[i];
+ attr = ( currNode )->Attribute( KPresenceUri );
+
+ TBool uriMatch( EFalse );
+ uriMatch = CompareUriWithoutPrefixL(
+ aUri, attr->AttributeValue() );
+
+ if ( attr && uriMatch )
+ {
+ DP_SDA(" DoRemoveUserFromListL Node Found, do delete");
+
+ // This is the user we are looking for deletion.
+ //First remove currNode form model
+ iXdmDoc->RemoveFromModelL( currNode );
+ // Update model to server
+ iXdmDoc->AppendL();
+ break;
+ }
+ }
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoRemoveUserFromListL Leave");
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &lists ); // >>> lists
+ DP_SDA("CPresencePluginXdmUtils::DoRemoveUserFromListL END");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::SubscribeBuddyListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::SubscribeBuddyListL(
+ RPointerArray<MXIMPIdentity>& aMembers )
+ {
+ DP_SDA("CPresencePluginXdmUtils::SubscribeBuddyListL");
+
+ iOperation = EXdmGetBuddyList;
+ DoGetListMembersL( KPresenceBuddyList, aMembers );
+
+ DP_SDA("CPresencePluginXdmUtils::SubscribeBuddyListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::SubscribeBlockListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::SubscribeBlockListL(
+ RPointerArray<MXIMPIdentity>& aMembers )
+ {
+ DP_SDA("CPresencePluginXdmUtils::SubscribeBlockListL");
+
+ if ( !iLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::SubscribeBlockListL !iLocalMode");
+ iOperation = EXdmGetBlockedList;
+ DoGetListMembersL( KPresenceBlockedList, aMembers );
+ }
+ DP_SDA("CPresencePluginXdmUtils::SubscribeBlockListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoGetListMembersL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoGetListMembersL(
+ const TDesC& aList,
+ RPointerArray<MXIMPIdentity>& aMembers )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL");
+ using namespace NPresencePlugin::NPresence;
+
+ aMembers.Reset();
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL( nodes );
+
+ CXdmDocumentNode* listNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+
+ TBool found(EFalse);
+
+ if ( iXdmDoc )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL iXdmDoc");
+ User::LeaveIfError( iXdmDoc->Find( KPresenceList, nodes ) );
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL find ready");
+ TInt count = nodes.Count();
+ DP_SDA2("DoGetListMembersL find Count %d", count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ listNode = nodes[i];
+ attr = listNode->Attribute( KPresenceName );
+ if ( attr && !attr->AttributeValue().CompareF( aList ))
+ {
+ // That's the right list
+ DP_SDA("DoGetListMembersL Target found");
+ found = ETrue;
+ break;
+ }
+ }
+ }
+
+ if ( found )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL found");
+ MXIMPObjectFactory& myFactory = iConnObs.ObjectFactory();
+ nodes.Reset();
+ TInt err = listNode->Find( KPresenceEntry, nodes );
+ DP_SDA2("CPresencePluginXdmUtils::DoGetListMembersL err %d", err);
+ if( !err )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL Entry found");
+ TInt nodeCount = nodes.Count();
+ for ( TInt i = 0; i < nodeCount; i++ )
+ {
+ attr = (nodes[i])->Attribute( KPresenceUri );
+ if ( attr )
+ {
+ DP_SDA("DoGetListMembersL attr check");
+ MXIMPIdentity* entity =
+ myFactory.NewIdentityLC(); // << entity
+ entity->SetIdentityL( attr->AttributeValue() );
+ aMembers.Append( entity );
+ CleanupStack::Pop(); // >> entity
+ }
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( &nodes );
+ DP_SDA("CPresencePluginXdmUtils::DoGetListMembersL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::GetXdmListsL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::GetXdmListsL(
+ TBool aCreateRules,
+ TBool aLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL");
+ //Normal Mode start
+ if ( !iXdmEngine && !aLocalMode )
+ {
+ DP_SDA2("!iXdmEngine settingID = %d", iSettingsId);
+
+#ifdef _DEBUG
+ //Get xdmSettings
+ HBufC* accesPoint = TXdmSettingsApi::PropertyL(
+ iSettingsId, EXdmPropToNapId );
+ CleanupStack::PushL( accesPoint );
+ DP_SDA2("CPresencePluginXdmUtils::GetXdmListsL accesPoint %S",
+ accesPoint);
+#endif
+
+ // get data from a network if not done so yet
+ CXdmProtocolInfo* info = CXdmProtocolInfo::NewL( iSettingsId );
+ CleanupStack::PushL( info );
+
+ // Notice: we do not use cache for XDM
+ info->SetCacheUsage( EFalse ); //False in normal case
+
+ iXdmEngine = CXdmEngine::NewL( *info );
+ CleanupStack::PopAndDestroy( info );
+#ifdef _DEBUG
+ CleanupStack::PopAndDestroy( accesPoint );
+#endif
+ }
+ //LocalMode Start, !!! THERE IS LIMIT !!!
+ //Only one settings can use localmode
+ else if ( !iXdmEngine && aLocalMode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL aLocalMode");
+ CXdmProtocolInfo* info =
+ CXdmProtocolInfo::NewL( 0, KLocalProtocol, KNullDesC );
+ CleanupStack::PushL( info );
+
+ iXdmEngine = CXdmEngine::NewL( *info );
+ CleanupStack::PopAndDestroy( info );
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL aLocalMode end");
+ }
+ if ( !iXdmOk )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL !XdmOK ");
+ using namespace NPresencePlugin::NPresence;
+ // Get data from network
+ DP_SDA("GetXdmListsL Create Document Model ");
+
+ iXdmDoc = iXdmEngine->CreateDocumentModelL(
+ KPresenceResourceList, EXdmResourceLists );
+
+
+ DP_SDA("Create Document Model FetchData");
+ iXdmDoc->FetchDataL();
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL !XdmOK SETACTIVE ");
+ UpdateXdmsL();
+ iXdmState = aCreateRules ? EGetXdmLists : EGetXdmListsOnly;
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL !XdmOK END");
+ }
+ else
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL else");
+ // Document already exists, no need to search from a server
+ iStatus = KRequestPending;
+ TRequestStatus* s= &iStatus;
+ DP_SDA("CPresencePluginXdmUtils::GetXdmListsL SEND COMPLETE");
+ User::RequestComplete( s, KErrNone );
+ iXdmState = aCreateRules ? EGetXdmLists : EGetXdmListsOnly;
+ SetActive();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CreateXdmListsL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::CreateXdmListsL( TBool aCreateRules )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CreateXdmListsL");
+
+ CXdmDocumentNode* root = iXdmDoc->CreateRootL();
+ CleanupStack::PushL( root );
+
+ using namespace NPresencePlugin::NPresence;
+ root->SetNameL( KPresenceResourceLists );
+
+ // add all the list nodes
+ // buddylist
+ using namespace NPresencePlugin::NPresence;
+ if ( root->IsEmptyNode() )
+ {
+ root->SetEmptyNode( EFalse );
+ }
+ //buddy list
+ CXdmDocumentNode* child1 = root->CreateChileNodeL( KPresenceList );
+ CleanupStack::PushL( child1 );
+ CXdmNodeAttribute* name = child1->CreateAttributeL( KPresenceName );
+ CleanupStack::PushL( name );
+ name->SetAttributeValueL( KPresenceBuddyList );
+
+ // blockedcontacts
+ CXdmDocumentNode* child2 = root->CreateChileNodeL( KPresenceList );
+ CleanupStack::PushL( child2 );
+ CXdmNodeAttribute* name2 = child2->CreateAttributeL( KPresenceName );
+ CleanupStack::PushL( name2 );
+ name2->SetAttributeValueL( KPresenceBlockedList );
+
+ // send to the server and start wait a response
+ iXdmDoc->AppendL();
+ UpdateXdmsL();
+ iXdmState = aCreateRules ? ECreateXdmLists : ECreateXdmListsOnly;
+
+ CleanupStack::Pop( name2 );
+ CleanupStack::Pop( child2 );
+ CleanupStack::Pop( name );
+ CleanupStack::Pop( child1 );
+ CleanupStack::Pop( root );
+ DP_SDA("CPresencePluginXdmUtils::CreateXdmListsL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::GetEntitiesInListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::GetEntitiesInListL(
+ const TDesC& aList,
+ MXIMPObjectCollection& aColl )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL ");
+ using namespace NPresencePlugin::NPresence;
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL( aList );
+
+ // make a collection of MXIMPPresentityGroupMemberInfo
+ RPointerArray<CXdmDocumentNode> entries;
+ CleanupClosePushL(entries); // <<< entries
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CleanupClosePushL(nodes); // <<< nodes
+
+ buddylist->Find( KPresenceEntry, entries );
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL entries");
+ TInt count = entries.Count();
+ DP_SDA2("GetEntitiesInListL entries count %d",count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL 1");
+ // create here MXIMPPresentityGroupMemberInfo
+ MPresentityGroupMemberInfo* info =
+ iConnObs.PresenceObjectFactoryOwn().
+ NewPresentityGroupMemberInfoLC();
+
+ // ID
+ CXdmDocumentNode* entry = entries[i];
+ CXdmNodeAttribute* attr = entry->Attribute( KPresenceUri );
+ if ( attr )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL 2");
+ MXIMPIdentity* id =
+ iConnObs.ObjectFactory().NewIdentityLC();//<< id
+ id->SetIdentityL( attr->AttributeValue() );
+ info->SetGroupMemberIdL( id );
+ CleanupStack::Pop(); // >> id
+ }
+
+ // Display name
+ TInt err = entry->Find( KPresenceDisplayName, nodes );
+ // Notice: assume there is only one display-name
+ if ( !err )
+ {
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL display name");
+ CXdmDocumentNode* disName = nodes[0];
+ HBufC16* uri16 = NULL;
+ uri16 =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+ disName->LeafNodeContent() );
+
+ CleanupStack::PushL( uri16 ); // << uri16
+ info->SetGroupMemberDisplayNameL( uri16->Des() );
+ CleanupStack::PopAndDestroy( uri16 ); // >> uri16
+ }
+
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL 3");
+ aColl.AddObjectL( info );
+
+ //if contact is from buddylist add it to virtual subscribed list too
+ if( !aList.CompareF( KPresenceBuddyList ) )
+ {
+ DP_SDA("GetEntitiesInListL add virtualgroup");
+ //Add identity to virtual list
+ iConnObs.SubscribedContacts()->AddEntityL(
+ info->GroupMemberId().Identity() );
+ }
+
+ CleanupStack::Pop(); // >> info
+ }
+
+ CleanupStack::PopAndDestroy( &nodes ); // >>> nodes
+ CleanupStack::PopAndDestroy( &entries ); // >>> entries*/
+ DP_SDA("CPresencePluginXdmUtils::GetEntitiesInListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::AddIdentityToVirtualListL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::AddIdentityToVirtualListL( const TDesC& aList )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddIdentityToVirtualListL ");
+ using namespace NPresencePlugin::NPresence;
+
+ if ( aList.Compare( KPresenceBlockedList ) == NULL )
+ {
+ iBlockedContacts.ResetAndDestroy();
+ }
+
+ CXdmDocumentNode* buddylist = DoGetBuddyListL( aList );
+
+ // make a collection of MXIMPPresentityGroupMemberInfo
+ RPointerArray<CXdmDocumentNode> entries;
+ CleanupClosePushL(entries); // <<< entries
+
+ buddylist->Find( KPresenceEntry, entries );
+ DP_SDA("CPresencePluginXdmUtils::AddIdentityToVirtualListL entries");
+ TInt count = entries.Count();
+ DP_SDA2("AddIdentityToVirtualListL entries count %d",count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ DP_SDA("CPresencePluginXdmUtils::AddIdentityToVirtualListL 1");
+ // ID
+ CXdmDocumentNode* entry = entries[i];
+ CXdmNodeAttribute* attr = entry->Attribute( KPresenceUri );
+ if ( attr )
+ {
+ if( !aList.CompareF( KPresenceBuddyList ) )
+ {
+ DP_SDA("AddIdentityToVirtualListL add to buddies");
+ //Add identity to virtual list
+ iConnObs.SubscribedContacts()->AddEntityL(
+ attr->AttributeValue() );
+ }
+ else if ( !aList.CompareF( KPresenceBlockedList ) )
+ {
+ DP_SDA("AddIdentityToVirtualListL add to blocked");
+ HBufC* withoutPrefix =
+ iConnObs.InternalPresenceAuthorization().
+ PluginData().RemovePrefixLC( attr->AttributeValue() );
+ CleanupStack::Pop( withoutPrefix );
+ iBlockedContacts.AppendL( withoutPrefix );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( &entries ); // >>> entries
+ DP_SDA("CPresencePluginXdmUtils::AddIdentityToVirtualListL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoGetBuddyListL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresencePluginXdmUtils::DoGetBuddyListL(
+ const TDesC& aParent )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetBuddyListL");
+ CXdmDocumentNode* root = iXdmDoc->DocumentRoot();
+
+ CXdmDocumentNode* ret = SearchListUnderParentL( root, aParent );
+ if ( !ret )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetBuddyListL !found");
+ User::Leave( KErrNotFound );
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoGetUserListL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresencePluginXdmUtils::DoGetUserListL(
+ const TDesC& aList, CXdmDocumentNode* aBuddyList )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetUserListL");
+ CXdmDocumentNode* listNode = NULL;
+ CXdmNodeAttribute* attr = NULL;
+ TBool found( EFalse );
+
+ using namespace NPresencePlugin::NPresence;
+
+ RPointerArray<CXdmDocumentNode> lists;
+ CleanupClosePushL( lists );
+
+ User::LeaveIfError( aBuddyList->Find( KPresenceEntry, lists ));
+ TInt count = lists.Count();
+ DP_SDA2("CPresencePluginXdmUtils::DoGetUserListL count %d",count);
+ for ( TInt i=0; i < count; i++ )
+ {
+ listNode = lists[i];
+ attr = listNode->Attribute( KPresenceUri );
+ if ( attr && !attr->AttributeValue().CompareF( aList ))
+ {
+ // List is found
+ found = ETrue;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoGetUserListL !found");
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PopAndDestroy( &lists );
+ DP_SDA("CPresencePluginXdmUtils::DoGetUserListL end");
+ return listNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::UpdateXdmsL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::UpdateXdmsL()
+ {
+ DP_SDA("CPresencePluginXdmUtils::UpdateXdmsL");
+ iXdmEngine->UpdateL( iXdmDoc, iStatus );
+ if ( !IsActive() )
+ {
+ DP_SDA("CPresencePluginXdmUtils::UpdateXdmsL SetActive");
+ SetActive();
+ }
+ DP_SDA("CPresencePluginXdmUtils::UpdateXdmsL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::UpdateXdmRulesL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::UpdateXdmRulesL()
+ {
+ DP_SDA("CPresencePluginXdmUtils::UpdateXdmRulesL");
+ iXdmState = EUpdateXdmRules;
+
+ if( iRulesUpdateState == EStateInitializeRules )
+ {
+ User::LeaveIfError( iXdmPresRules->UpdateXdmRulesL( this ));
+ }
+ //Add entity to presrules too
+ if ( iRulesUpdateState == EStateAddToWhiteList )
+ {
+ DP_SDA("EStateAddToWhiteList");
+ iXdmPresRules->AddEntityToWhiteListL(
+ iEntityUri->Des(), this );
+ }
+ if ( iRulesUpdateState == EStateAddToBlockList )
+ {
+ DP_SDA("EStateAddToBlockList");
+ iXdmPresRules->AddEntityToBlockedRulesL(
+ iEntityUri->Des(), this );
+ }
+ if ( iRulesUpdateState == EStateRemoveFromWhiteList)
+ {
+ DP_SDA("EStateRemoveFromWhiteList");
+ iXdmPresRules->RemoveEntityFromWhiteListL(
+ iEntityUri->Des(), this );
+ }
+ if ( iRulesUpdateState == EStateRemoveFromBlackList)
+ {
+ DP_SDA("EStateRemoveFromBlackList");
+ iXdmPresRules->RemoveEntityBlockedRulesL(
+ iEntityUri->Des(), this );
+ }
+ DP_SDA("CPresencePluginXdmUtils::UpdateXdmRulesL end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoHandlePresUpdateDocumentL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoHandlePresUpdateDocumentL( TInt aErrorCode )
+ {
+ DP_SDA("CPresencePluginXdmUtils::DoHandlePresUpdateDocumentL");
+
+ // check if error
+ CheckIfErrorL( aErrorCode );
+
+ if ( iXdmState == EGetXdmRules )
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL EGetXdmRules");
+ iXdmState = EStateIdle;
+ if ( aErrorCode && aErrorCode == KXcapErrorHttpNotFound )
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL EGetXdmRules ini rules ERROR");
+ InitializePresRulesL();
+ }
+ else
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL EGetXdmRules SEND COMPLETE ");
+ // Complete with ok or error the last initial opreration
+
+ // update presence cache if needed before complete client req.
+ iPresXdmOk = ETrue;
+
+ if ( iBlockedContacts.Count() > 0 )
+ {
+ iConnObs.InternalPresenceAuthorization().
+ IsBlockedContactFriendRequestL(
+ *iBlockedContacts[ iBlockedContacts.Count() - 1 ],
+ *this, iStatus );
+
+ iXdmState = EUpdateBlockedContactPresenceCache;
+ SetActive();
+ }
+ else
+ {
+ CompleteClientReq( aErrorCode );
+ }
+ }
+ }
+ else if ( iXdmState == EUpdateXdmRules )
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL EUpdateXdmRules SEND COMPLETE ");
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( aErrorCode );
+ }
+ else if ( iXdmState == ECreateXdmRules )
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL ECreateXdmRules SEND COMPLETE ");
+ iPresXdmOk = ETrue;
+ CompleteClientReq( aErrorCode );
+ }
+
+ else if ( iXdmState == EUpdateXdmList)
+ {
+ DP_SDA("DoHandlePresUpdateDocumentL EUpdateXdmList SEND COMPLETE");
+ CompleteClientReq( aErrorCode );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::CompleteClientReq()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::CompleteClientReq( TInt aStatus )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CompleteClientReq");
+ DP_SDA2("CPresencePluginXdmUtils::CompleteClientReq status %d ", aStatus);
+ iXdmState = EStateIdle;
+ iOperation = ENoOperation;
+ TRequestStatus* s = iClientStatus;
+ User::RequestComplete( s, aStatus );
+ DP_SDA("CPresencePluginXdmUtils::CompleteClientReq end");
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::HandlePresUpdateDocumentL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::HandlePresUpdateDocumentL(
+ TInt aErrorCode )
+ {
+#ifdef _DEBUG
+ DP_SDA2("HandlePresUpdateDocumentL errorCode %d ", aErrorCode );
+ DP_SDA2("HandlePresUpdateDocumentL mystatus %d ", iStatus.Int());
+ DP_SDA2("HandlePresUpdateDocumentL state %d ", iXdmState);
+ DP_SDA2("HandlePresUpdateDocumentL ClientStatus %d",iClientStatus->Int() );
+#endif
+
+ DP_SDA("CPresencePluginXdmUtils::HandlePresUpdateDocumentL");
+ if ( aErrorCode == KErrTimedOut )
+ {
+ DP_SDA("CPresencePluginXdmUtils::HandlePresUpdateDocumentL TimeOut");
+ aErrorCode = 0;
+ }
+
+ TRAPD( err, DoHandlePresUpdateDocumentL( aErrorCode ));
+ if ( err )
+ {
+ DP_SDA("CPresencePluginXdmUtils::HandlePresUpdateDocumentL complete");
+ // Complete with ok or error the last initial opreration
+ CompleteClientReq( err );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::SearchListUnderParentL
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginXdmUtils::CompareUriWithoutPrefixL(
+ const TDesC& aUri, const TDesC& aAttribute )
+ {
+ DP_SDA("CPresencePluginXdmUtils::CompareUriWithoutPrefixL");
+
+ TBool match( EFalse );
+
+ RBuf uriWithoutPrefix;
+ CleanupClosePushL( uriWithoutPrefix );
+ uriWithoutPrefix.CreateL( aUri );
+ TInt prefixLocation = uriWithoutPrefix.Locate( ':' );
+
+ if ( KErrNotFound != prefixLocation )
+ {
+ uriWithoutPrefix.Delete( 0, ( prefixLocation + 1 ) );
+ }
+
+ RBuf attributeWithoutprefix;
+ CleanupClosePushL( attributeWithoutprefix );
+ attributeWithoutprefix.CreateL( aAttribute );
+ prefixLocation = attributeWithoutprefix.Locate( ':' );
+
+ if ( KErrNotFound != prefixLocation )
+ {
+ attributeWithoutprefix.Delete( 0, ( prefixLocation + 1 ) );
+ }
+
+ DP_SDA2(" --> uri without prefix=%S", &uriWithoutPrefix );
+ DP_SDA2(" --> attribute without prefix=%S", &attributeWithoutprefix );
+
+ if ( uriWithoutPrefix.Compare( attributeWithoutprefix ) == 0 )
+ {
+ match = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy( &attributeWithoutprefix );
+ CleanupStack::PopAndDestroy( &uriWithoutPrefix );
+
+ return match;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginXdmUtils::DoUpdateBlockedContactPresenceCacheL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::DoUpdateBlockedContactPresenceCacheL(
+ TInt aMyStatus )
+ {
+ DP_SDA( "CPresencePluginXdmUtils::DoUpdateBlockedContactPresenceCache" );
+
+ const TInt KTextBufferSize = 10;
+ TInt contactsCount = iBlockedContacts.Count();
+
+ if ( contactsCount > 0 )
+ {
+ if ( iPresenceContactsAsyncReqResult )
+ {
+ DP_SDA(" RunL -write blocked status to cache" );
+ TBuf<KTextBufferSize> buf;
+ buf.Copy( KBlockedExtensionValue );
+ iConnObs.InternalPresenceAuthorization().PluginData().
+ WriteStatusToCacheL( *iBlockedContacts[ contactsCount - 1 ],
+ MPresenceBuddyInfo2::EUnknownAvailability,
+ buf,
+ KNullDesC() );
+ }
+ delete iBlockedContacts[ contactsCount - 1 ];
+ iBlockedContacts.Remove( contactsCount - 1 );
+
+ if ( iBlockedContacts.Count() > 0 )
+ {
+ iConnObs.InternalPresenceAuthorization().
+ IsBlockedContactFriendRequestL(
+ *iBlockedContacts[ iBlockedContacts.Count() - 1 ],
+ *this, iStatus );
+
+ iXdmState = EUpdateBlockedContactPresenceCache;
+ SetActive();
+ }
+ else
+ {
+ CompleteClientReq( aMyStatus );
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MPresencePluginContactsObs
+// CPresencePluginXdmUtils::RequestComplete
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginXdmUtils::RequestComplete( TAny* aResult,
+ TPresenceContactsOperation /*aOperation*/, TInt aError )
+ {
+ iPresenceContactsAsyncReqResult = EFalse;
+ if ( NULL != aResult && KErrNone == aError )
+ {
+ iPresenceContactsAsyncReqResult =
+ *static_cast<TBool*>( aResult );
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpledatamodeladapter/src/presensepluginlocalstore.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IETF SIMPLE Protocol implementation for XIMP Framework
+*
+*/
+
+
+#include <aknutils.h>
+#include "presencepluginlocalstore.h"
+#include "presencelogger.h"
+
+_LIT( KContactId, "ContactId" );
+_LIT( KContactTable, "Contacts" );
+_LIT( KStorageExtn, ".db");
+_LIT( KDbPath, "c:\\" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::CPresencePluginLocalstore
+// ---------------------------------------------------------------------------
+//
+CPresencePluginLocalstore::CPresencePluginLocalstore()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginLocalstore::ConstructL( const TDesC& aServiceName )
+ {
+ DP_SDA( "CPresencePluginLocalstore::ConstructL -Start" );
+
+ iLocalDBName =
+ HBufC::NewL( aServiceName.Length()+ KStorageExtn().Length() );
+ TPtr localDBNamePtr = iLocalDBName->Des();
+ localDBNamePtr.Append( aServiceName );
+
+ _LIT( KSpecialChar, "/\\:*?<>\"" );
+ AknTextUtils::StripCharacters( localDBNamePtr, KSpecialChar );
+ localDBNamePtr.Append( KStorageExtn() );
+
+ DP_SDA2( "CPresencePluginLocalstore::ConstructL -localDBName: %S" , &localDBNamePtr );
+
+ User::LeaveIfError( iFs.Connect() );
+ if ( DbExists() )
+ {
+ DP_SDA( "CPresencePluginLocalstore::ConstructL -DB exists" );
+ OpenDbL();
+ }
+ else
+ {
+ DP_SDA( "CPresencePluginLocalstore::ConstructL -DB does not exists LEAVE!" );
+ User::Leave( KErrNotReady );
+ }
+
+ User::LeaveIfError( iTable.Open( iDb, KContactTable ) );
+ iColset = iDb.ColSetL( KContactTable );
+
+ DP_SDA( "CPresencePluginLocalstore::ConstructL -End" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::NewL()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginLocalstore* CPresencePluginLocalstore::NewL(
+ const TDesC& aServiceName )
+ {
+ CPresencePluginLocalstore* self =
+ CPresencePluginLocalstore::NewLC( aServiceName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::NewLC()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginLocalstore* CPresencePluginLocalstore::NewLC(
+ const TDesC& aServiceName )
+ {
+ CPresencePluginLocalstore* self =
+ new( ELeave ) CPresencePluginLocalstore();
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceName );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::~CPresencePluginLocalstore()
+// ---------------------------------------------------------------------------
+//
+CPresencePluginLocalstore::~CPresencePluginLocalstore()
+ {
+ DP_SDA( "CPresencePluginLocalstore::~CPresencePluginLocalstore -Start" );
+
+ delete iLocalDBName;
+ delete iFileStore;
+ delete iColset;
+
+ iTable.Close();
+ iDb.Close();
+ iFs.Close();
+
+ DP_SDA( "CPresencePluginLocalstore::~CPresencePluginLocalstore -End" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::OpenDbL
+// ---------------------------------------------------------------------------
+//
+void CPresencePluginLocalstore::OpenDbL()
+ {
+ DP_SDA( "CPresencePluginLocalstore::OpenDbL() Start" );
+
+ TBuf< KMaxPath > storagePath;
+ storagePath.Append( KDbPath );
+ storagePath.Append( *iLocalDBName );
+ iFileStore = CPermanentFileStore::OpenL( iFs, storagePath,
+ EFileShareReadersOrWriters|EFileWrite );
+ iFileStore->SetTypeL( iFileStore->Layout() );
+ iDb.OpenL( iFileStore, iFileStore->Root() );
+
+ DP_SDA( "CPresencePluginLocalstore::OpenDbL() End" );
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::DbExists
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginLocalstore::DbExists()
+ {
+ DP_SDA( "CPresencePluginLocalstore::DbExists() Start" );
+
+ TBool ret( ETrue );
+ RFile temp;
+ TBuf< KMaxPath > storagePath;
+ storagePath.Append( KDbPath );
+ storagePath.Append( *iLocalDBName );
+
+ TInt err( temp.Open( iFs, *( &storagePath ),
+ EFileShareReadersOrWriters|EFileRead ) );
+ TInt size( 0 );
+
+ if ( KErrNone == err )
+ {
+ temp.Size( size );
+ }
+
+ temp.Close();
+
+ if ( ( 0 == size ) || ( KErrNone != err ) )
+ {
+ ret = EFalse;
+ }
+
+ DP_SDA( "CPresencePluginLocalstore::DbExists() End" );
+ return ret;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresencePluginLocalstore::SeekRowL()
+// ---------------------------------------------------------------------------
+//
+TBool CPresencePluginLocalstore::SeekRowAtContactColL(
+ TInt32& aIdentifier )
+ {
+ DP_SDA( "CPresencePluginLocalstore::SeekRowAtContactColL() Start" );
+
+ TBool ret( EFalse );
+ TDbColNo colNo = iColset->ColNo( KContactId );
+ iTable.BeginningL();
+
+ while ( iTable.NextL() )
+ {
+ DP_SDA( "CPresencePluginLocalstore::SeekRowAtContactColL() - next found" );
+ iTable.GetL();
+ if ( iTable.ColInt32( colNo ) == aIdentifier )
+ {
+ ret = ETrue;
+ break;
+ }
+ }
+
+ DP_SDA2( "CPresencePluginLocalstore::SeekRowAtContactColL() End - ret = %d", ret );
+ return ret;
+ }
Binary file simpleengine/Conf/simple.confml has changed
Binary file simpleengine/Conf/simple_10281EEE.crml has changed
Binary file simpleengine/Conf/simple_10281EEF.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/cenrep/backup_registration.xml Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+ <proxy_data_manager sid = "0x10202BE9" />
+ <restore requires_reboot = "no"/>
+</backup_registration>
Binary file simpleengine/cenrep/keys_simple.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/BWINS/simpleengineU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,17 @@
+EXPORTS
+ ?NewConnectionL@TSimpleFactory@@SAPAVMSimpleConnection@@AAVMSimpleConnectionObserver@@@Z @ 1 NONAME ; class MSimpleConnection * TSimpleFactory::NewConnectionL(class MSimpleConnectionObserver &)
+ ?NewContentL@TSimpleFactory@@SAPAVMSimpleContent@@ABVTDesC8@@0@Z @ 2 NONAME ; class MSimpleContent * TSimpleFactory::NewContentL(class TDesC8 const &, class TDesC8 const &)
+ ?NewDocumentL@TSimpleFactory@@SAPAVMSimpleDocument@@ABVTDesC8@@@Z @ 3 NONAME ; class MSimpleDocument * TSimpleFactory::NewDocumentL(class TDesC8 const &)
+ ?NewDocumentL@TSimpleFactory@@SAPAVMSimpleDocument@@XZ @ 4 NONAME ; class MSimpleDocument * TSimpleFactory::NewDocumentL(void)
+ ?NewElementL@TSimpleFactory@@SAPAVMSimpleElement@@ABVTDesC8@@0@Z @ 5 NONAME ; class MSimpleElement * TSimpleFactory::NewElementL(class TDesC8 const &, class TDesC8 const &)
+ ?NewFilterDocumentL@TSimpleFactory@@SAPAVMSimpleFilterDocument@@ABVTDesC8@@@Z @ 6 NONAME ; class MSimpleFilterDocument * TSimpleFactory::NewFilterDocumentL(class TDesC8 const &)
+ ?NewFilterDocumentL@TSimpleFactory@@SAPAVMSimpleFilterDocument@@XZ @ 7 NONAME ; class MSimpleFilterDocument * TSimpleFactory::NewFilterDocumentL(void)
+ ?NewNamespaceL@TSimpleFactory@@SAPAVMSimpleNamespace@@ABVTDesC8@@0@Z @ 8 NONAME ; class MSimpleNamespace * TSimpleFactory::NewNamespaceL(class TDesC8 const &, class TDesC8 const &)
+ ?NewPublisherL@TSimpleFactory@@SAPAVMSimplePublisher@@AAVMSimpleConnection@@AAVMSimplePublishObserver@@@Z @ 9 NONAME ; class MSimplePublisher * TSimpleFactory::NewPublisherL(class MSimpleConnection &, class MSimplePublishObserver &)
+ ?NewWatcherL@TSimpleFactory@@SAPAVMSimpleWatcher@@AAVMSimpleConnection@@AAVMSimpleWatcherObserver@@@Z @ 10 NONAME ; class MSimpleWatcher * TSimpleFactory::NewWatcherL(class MSimpleConnection &, class MSimpleWatcherObserver &)
+ ?NewWinfoWatcherL@TSimpleFactory@@SAPAVMSimpleWinfoWatcher@@AAVMSimpleConnection@@AAVMSimpleWinfoObserver@@@Z @ 11 NONAME ; class MSimpleWinfoWatcher * TSimpleFactory::NewWinfoWatcherL(class MSimpleConnection &, class MSimpleWinfoObserver &)
+ ?NsPrefixL@TSimpleUtils@@SA?AVTPtrC8@@ABVTDesC8@@@Z @ 12 NONAME ; class TPtrC8 TSimpleUtils::NsPrefixL(class TDesC8 const &)
+ ?NsUriL@TSimpleUtils@@SA?AVTPtrC8@@ABVTDesC8@@@Z @ 13 NONAME ; class TPtrC8 TSimpleUtils::NsUriL(class TDesC8 const &)
+ ?NewInstantMessageL@TSimpleFactory@@SAPAVMSimpleInstantMessage@@AAVMSimpleConnection@@AAVMSimpleInstantMsgObserver@@@Z @ 14 NONAME ; class MSimpleInstantMessage * TSimpleFactory::NewInstantMessageL(class MSimpleConnection &, class MSimpleInstantMsgObserver &)
+ ?NewConnectionL@TSimpleFactory@@SAPAVMSimpleConnection@@AAVMSimpleConnectionObserver@@J@Z @ 15 NONAME ; class MSimpleConnection * TSimpleFactory::NewConnectionL(class MSimpleConnectionObserver &, long)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/EABI/simpleengineU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+EXPORTS
+ _ZN12TSimpleUtils6NsUriLERK6TDesC8 @ 1 NONAME
+ _ZN12TSimpleUtils9NsPrefixLERK6TDesC8 @ 2 NONAME
+ _ZN14TSimpleFactory11NewContentLERK6TDesC8S2_ @ 3 NONAME
+ _ZN14TSimpleFactory11NewElementLERK6TDesC8S2_ @ 4 NONAME
+ _ZN14TSimpleFactory11NewWatcherLER17MSimpleConnectionR22MSimpleWatcherObserver @ 5 NONAME
+ _ZN14TSimpleFactory12NewDocumentLERK6TDesC8 @ 6 NONAME
+ _ZN14TSimpleFactory12NewDocumentLEv @ 7 NONAME
+ _ZN14TSimpleFactory13NewNamespaceLERK6TDesC8S2_ @ 8 NONAME
+ _ZN14TSimpleFactory13NewPublisherLER17MSimpleConnectionR22MSimplePublishObserver @ 9 NONAME
+ _ZN14TSimpleFactory14NewConnectionLER25MSimpleConnectionObserver @ 10 NONAME
+ _ZN14TSimpleFactory16NewWinfoWatcherLER17MSimpleConnectionR20MSimpleWinfoObserver @ 11 NONAME
+ _ZN14TSimpleFactory18NewFilterDocumentLERK6TDesC8 @ 12 NONAME
+ _ZN14TSimpleFactory18NewFilterDocumentLEv @ 13 NONAME
+ _ZTI13CSimpleClient @ 14 NONAME ; #<TI>#
+ _ZTI14CSimpleWatcher @ 15 NONAME ; #<TI>#
+ _ZTI16CSimplePublisher @ 16 NONAME ; #<TI>#
+ _ZTI17CSimpleConnection @ 17 NONAME ; #<TI>#
+ _ZTI18CSimpleSettingFile @ 18 NONAME ; #<TI>#
+ _ZTI19CSimpleWinfoWatcher @ 19 NONAME ; #<TI>#
+ _ZTI20CSimpleEngineRequest @ 20 NONAME ; #<TI>#
+ _ZTV13CSimpleClient @ 21 NONAME ; #<VT>#
+ _ZTV14CSimpleWatcher @ 22 NONAME ; #<VT>#
+ _ZTV16CSimplePublisher @ 23 NONAME ; #<VT>#
+ _ZTV17CSimpleConnection @ 24 NONAME ; #<VT>#
+ _ZTV18CSimpleSettingFile @ 25 NONAME ; #<VT>#
+ _ZTV19CSimpleWinfoWatcher @ 26 NONAME ; #<VT>#
+ _ZTV20CSimpleEngineRequest @ 27 NONAME ; #<VT>#
+ _ZN14TSimpleFactory18NewInstantMessageLER17MSimpleConnectionR25MSimpleInstantMsgObserver @ 28 NONAME
+ _ZTI22CSimpleEngineImHandler @ 29 NONAME ; #<TI>#
+ _ZTV22CSimpleEngineImHandler @ 30 NONAME ; #<VT>#
+ _ZN14TSimpleFactory14NewConnectionLER25MSimpleConnectionObserverl @ 31 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_EXPORTS
+
+../../internal/installation/simple.ini /epoc32/winscw/c/system/data/simple.ini
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+simpleengine.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/group/simpleengine.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for simpleengine
+*
+*/
+
+
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET simpleengine.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10281EEB
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE simpleenginerequest.cpp
+SOURCE simplefactory.cpp
+SOURCE simpleutils.cpp
+SOURCE simpleconnection.cpp
+SOURCE simpleclient.cpp
+SOURCE simplepublisher.cpp
+SOURCE simplewatcher.cpp
+SOURCE simplewinfowatcher.cpp
+SOURCE simpleengineutils.cpp
+SOURCE simpleengineimhandler.cpp
+
+SOURCEPATH ../../siputils/src
+SOURCE simpledebugutils.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../api
+USERINCLUDE ../../inc
+USERINCLUDE ../../siputils/inc
+USERINCLUDE ../../xmlutils/inc
+
+// default system include paths for middleware layer modules
+MW_LAYER_SYSTEMINCLUDE
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib // file server
+DEBUGLIBRARY apparc.lib
+LIBRARY euser.lib
+LIBRARY estor.lib
+LIBRARY bafl.lib // string pool
+LIBRARY simplesiputils.lib
+LIBRARY simplexmlutils.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simpleclient.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine client base class
+*
+*/
+
+
+
+
+#ifndef simpleclient_H
+#define simpleclient_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimpleconnection.h"
+#include "msimpleowncallback.h"
+#include "msimpleenginerequest.h"
+
+// FORWARD DECLARATION
+class CSimpleEngineRequest;
+class MSimpleWatcherObserver;
+class MSimpleConnectionObserver;
+
+/**
+ * CSimpleClient
+ *
+ * SIMPLE Engine client base class.
+ *
+ * @lib simpleengine
+ * @since S60 v3.2
+ */
+
+class CSimpleClient : public CBase, public MSimpleOwnCallback
+ {
+
+public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleClient();
+
+
+// from base class MSimpleOwnCallback
+
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @param aReq request
+ */
+ void virtual Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq ) = 0;
+
+protected:
+
+ void IncreaseOpId( );
+
+ /**
+ * Delete pending requests
+ */
+ void DeleteRequests();
+
+ /**
+ * Search a specifi request
+ * @param aOpID operation if to be matched
+ * @return request or NULL if a request not found
+ */
+ CSimpleEngineRequest* SearchRequests( TInt aOpId );
+
+ /**
+ * Two-phase constructor
+ */
+ void BaseConstructL( );
+
+ /**
+ * constructor
+ * @param aConn connection
+ */
+ CSimpleClient(
+ MSimpleConnection& aConn );
+
+ /**
+ * Send a request to engine DLL
+ * @param aReq request
+ */
+ void SendReqL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Reason code converter
+ * @param aR request that contains a reason code from NOTIFY
+ * @return reason code
+ */
+ TInt ResponseReason(
+ MSimpleEngineRequest& aR );
+
+ /**
+ * SIP Status accessor
+ * Get the status of the last completed request.
+ * @return SIP status, 0 if not available
+ */
+ TUint DoSIPStatus( );
+
+ /**
+ * SIP retry-fater value accessor
+ * Get the status of the last completed request.
+ * @return SIP retry-after value, 0 if not available
+ */
+ TUint DoRetryAfter( );
+
+ /**
+ * SIP Status getter
+ * Get the SIP status of the specified request.
+ * @param aOpId operation id
+ */
+ void GetSIPStatus( TInt aOpId );
+
+protected: // data
+
+ /**
+ * SIMPLE engine connection
+ */
+ MSimpleConnection& iConn;
+
+ /**
+ * next operation id
+ */
+ TInt iOpId;
+
+ /**
+ * SIP status of last operation completed
+ */
+ TUint iSipStatus;
+
+ /**
+ * SIP retry-after header
+ */
+ TInt iRetryAfterTime;
+
+ /**
+ * Buffer for client requests
+ */
+ TDblQue<CSimpleEngineRequest> iRequestList;
+
+ /**
+ * Last request sent
+ */
+ MSimpleEngineRequest::TSimpleRequest iRequest;
+
+ /**
+ * Pointer to stack variable to detect the deletion of the heap
+ * instance. This case takes place if a client
+ * calls destructor in callback method.
+ * Own.
+ */
+ TBool* iDestroyedPtr;
+
+private: // data
+
+ /**
+ * Lower limit of opid
+ */
+ TInt iLimitLowerValue;
+
+ /**
+ * Upper limit of opid
+ */
+ TInt iLimitUpperValue;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simpleconnection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine core connection
+*
+*/
+
+
+
+
+#ifndef simpleconnection_H
+#define simpleconnection_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimpleconnection.h"
+#include "msimpleowncallback.h"
+
+// FORWARD DECLARATION
+class CSimpleSipConnection;
+class CSimpleEngineRequest;
+class MSimpleConnectionObserver;
+
+/**
+ * CSimpleConnection
+ *
+ * SIMPLE Engine core connection.
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+class CSimpleConnection : public CBase, public MSimpleConnection, public MSimpleOwnCallback
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ *
+ * @since S60 3.2
+ * @param aObserver callback observer
+ * @return CSimpleConnection
+ */
+ static CSimpleConnection* NewL( MSimpleConnectionObserver& aObserver );
+
+ static CSimpleConnection* NewL( MSimpleConnectionObserver& aObserver, TInt32 aServiceId );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleConnection();
+
+ /**
+ * SIP connction accessor from siputils.
+ *
+ * @since S60 3.2
+ * @return SIP utils connection
+ */
+ CSimpleSipConnection* Connection();
+
+
+// from base class MSimpleConnection
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Login using default SIP settings
+ *
+ * @since S60 3.2
+ * @return operation id
+ */
+ TInt LoginL();
+
+ /**
+ * Login using specified SIP settings
+ *
+ * @since S60 3.2
+ * @param aId SIP profile id
+ * @return operation id
+ */
+ TInt LoginL( TInt aId );
+
+ /**
+ * Getter for the connection staus.
+ *
+ * @since S60 3.2
+ * @return connection staus
+ */
+ TSimpleState ConnectionStatus();
+
+ /**
+ * Current SIP identity accessor
+ * @return SIP identity
+ */
+ TPtrC8 CurrentSIPIdentityL();
+
+// from base class MSimpleOwnCallback
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ */
+ void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
+
+private:
+
+ /**
+ * Count new operation id
+ * @since S60 3.2
+ */
+ void IncreaseOpId( );
+
+ /**
+ * Delete pending requests
+ * @since S60 3.2
+ */
+ void DeleteRequests();
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL( TInt32 aServiceId );
+
+ /**
+ * constructor
+ */
+ CSimpleConnection( MSimpleConnectionObserver& aObserver );
+
+ /**
+ * State type converter
+ *
+ * @since S60 3.2
+ * @param aState TSimpleSipState
+ * @return MSimpleConnection::TSimpleState
+ */
+ MSimpleConnection::TSimpleState ConvertState( TSimpleSipState aState );
+
+ /**
+ * Set SIP Connection status
+ *
+ * @since S60 3.2
+ * @param aState connection state
+ */
+ void SetConnectionStatus( TSimpleState aState );
+
+private: // data
+
+ /**
+ * Engine state
+ */
+ TSimpleState iState;
+
+ /**
+ * SIMPLE engine core
+ * Own.
+ */
+ CSimpleSipConnection* iConnection;
+
+ /**
+ * Client API observer for events
+ */
+ MSimpleConnectionObserver& iObserver;
+
+ /**
+ * next operation id
+ */
+ TInt iOpId;
+
+ /**
+ * Buffer for client requests
+ */
+ TDblQue<CSimpleEngineRequest> iRequestList;
+
+ /**
+ * Lower limit of opid
+ */
+ TInt iLimitLowerValue;
+
+ /**
+ * Upper limit of opid
+ */
+ TInt iLimitUpperValue;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simpleengineimhandler.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine IM Handler
+*
+*/
+
+#ifndef C_SIMPLEENGINEIMHANDLER_H
+#define C_SIMPLEENGINEIMHANDLER_H
+
+
+#include <e32std.h>
+
+#include "simpleclient.h"
+#include "simpleinstantmessage.h"
+
+class MSimpleInstantMsgObserver;
+
+
+/**
+ * Class for sending and receiving instant messages.
+ *
+ * @code
+ * MSimpleInstantMessage* im =
+ * TSimpleFactory::NewInstantMessageL( conn, connObs );
+ * TInt result = im->SendInstantMessage( text8, recipientsPtr8 );
+ * @endcode
+ *
+ * @lib simpleengine.lib
+ * @since S60 v5.1
+ */
+class CSimpleEngineImHandler : public CSimpleClient,
+ public MSimpleInstantMessage
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aConn connection
+ * @param aObserver callback observer
+ */
+ static CSimpleEngineImHandler* NewL( MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleEngineImHandler();
+
+// from base class MSimpleInstantMessage
+
+ /**
+ * From MSimpleInstantMessage
+ * Send instant message.
+ *
+ * @since S60 v5.1
+ * @param aMsgContent message content
+ * @param aRecipient recipient ID
+ * @return operation ID
+ */
+ TInt SendInstantMessage( TPtrC8 aMsgContent, TPtrC8 aRecipient );
+
+ /**
+ * From MSimpleInstantMessage
+ * Destroy this entity.
+ *
+ * @since S60 v5.1
+ */
+ void Close();
+
+// from base class CSimpleClient
+
+ /**
+ * From CSimpleClient
+ * Complete the open client request.
+ *
+ * @since S60 v5.1
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @param aReq request
+ */
+ void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
+
+private:
+
+ CSimpleEngineImHandler( MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver );
+
+ void ConstructL();
+
+ /**
+ * Do Send Instant Message request.
+ *
+ * @since S60 v5.1
+ * @param aMsgContent message content
+ * @param aRecipient recipient ID
+ */
+ void DoSendInstantMessageRequestL( TPtrC8 aMsgContent,
+ TPtrC8 aRecipient );
+
+ /**
+ * Receive instant message.
+ *
+ * @since S60 v5.1
+ */
+ void ReceiveInstantMessageL();
+
+private: // data
+
+ /**
+ * Instant Message observer for callbacks
+ */
+ MSimpleInstantMsgObserver& iObserver;
+
+ };
+
+#endif // C_SIMPLEENGINEIMHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simpleenginerequest.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,451 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine request
+*
+*/
+
+
+
+#ifndef CSimpleEngineRequest_H
+#define CSimpleEngineRequest_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "simplecommon.h"
+#include "msimpleenginerequest.h"
+
+
+// FORWARD DECLARATIONS
+class CSimpleSipConnection;
+class MSimpleOwnCallback;
+
+
+// CLASS DECLARATION
+
+/**
+ * CSimpleEngineRequest
+ *
+ * SIMPLE Engine request.
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class CSimpleEngineRequest : public CActive, public MSimpleEngineRequest
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aEngine callback method interface
+ * @param aType request type
+ * @param aOpId client operation id
+ * @since S60 3.2
+ */
+ static CSimpleEngineRequest* NewL(
+ MSimpleOwnCallback& aEngine,
+ MSimpleEngineRequest::TSimpleRequest aType,
+ TInt aOpId );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleEngineRequest();
+
+ /**
+ * Delete this entity
+ */
+ void Destroy();
+
+ /**
+ * Request data setter
+ * @param aData data payload. Data is not copied but ownership is transferred.
+ */
+ void SetRequestData( TPtrC8 aData );
+
+ inline static TInt LinkOffset();
+
+ void SetRequestContentTypeL( const TDesC8& aData );
+
+// from base class MSimpleEngineRequest
+
+ /**
+ * From MSimpleEngineRequest.
+ * Request type accessor
+ * @since S60 3.2
+ * @return request type
+ */
+ MSimpleEngineRequest::TSimpleRequest RequestType();
+
+ /**
+ * Request type accessor
+ * @since S60 3.2
+ * @param aType request type
+ */
+ void ModifyType( MSimpleEngineRequest::TSimpleRequest aType );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Complete the open request
+ * @since S60 3.2
+ * @param aStatus result status
+ */
+ void Complete( TInt aStatus );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Request data type accessor
+ * @since S60 3.2
+ * @return request data content type
+ */
+ TPtrC8 RequestContentType();
+
+ /**
+ * From MSimpleEngineRequest.
+ * Request data accessor
+ * @since S60 3.2
+ * @return request data payload
+ */
+ TPtrC8 RequestData();
+
+ /**
+ * Response data type setter.
+ * @since S60 3.2
+ * @param aData content that is to be copied?
+ */
+ void SetResponseContentType( HBufC8* aData );
+
+ /**
+ * Response data MIME multipart boundary setter.
+ * @since S60 3.2
+ * @param aData boundary
+ */
+ void SetResponseBoundaryL( const TDesC8& aData );
+
+ /**
+ * Response data MIME multipart start content-id setter
+ * @since S60 3.2
+ * @param aData content-id
+ */
+ void SetResponseStartL( const TDesC8& aData );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Response data setter.
+ * @since S60 3.2
+ * @param aData content
+ */
+ void SetResponseDataL( const TDesC8& aData );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Response method setter.
+ * @since S60 3.2
+ * @param aMethod a method
+ */
+ void SetResponseMethod( TSimpleSIPResponse aMethod );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Aux data setter.
+ * @since S60 3.2
+ * @param aData data
+ */
+ void SetAux( TInt aData );
+
+ /**
+ * Server response/request method accessor
+ * @return SIP method
+ */
+ TSimpleSIPResponse ResponseMethod();
+
+ /**
+ * From MSimpleEngineRequest.
+ * Response data type accessor
+ * @since S60 3.2
+ * @return content type
+ */
+ TPtrC8 ResponseContentType();
+
+ /**
+ * Response data MIME multipart boundary getter.
+ * @since S60 3.2
+ * @return data boundary
+ */
+ TPtrC8 ResponseBoundary( );
+
+ /**
+ * Response data MIME multipart start content-id getter
+ * @since S60 3.2
+ * @return start content-id
+ */
+ TPtrC8 ResponseStart( );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Response data accessor
+ * @since S60 3.2
+ * @return response data payload
+ */
+ TPtrC8 ResponseData();
+
+ /**
+ * From MSimpleEngineRequest.
+ * Refresh time accessor
+ * @since S60 3.2
+ * @return refresh time in seconds, 0 means query once
+ */
+ TUint RefreshTime();
+
+ /**
+ * Set refresh time
+ * @param aTime time in seconds
+ */
+ void SetRefreshTime( TUint aTime );
+
+ /**
+ * From MSimpleEngineRequest.
+ * Remote URI accessor
+ * @since S60 3.2
+ * @return remote URI
+ */
+ TPtrC8 RemoteURI();
+
+ /**
+ * Remote URI setter
+ * @since S60 3.2
+ * @param aURI remote URI
+ */
+ void SetRemoteURIL( const TDesC8& aURI );
+
+ /**
+ * Get refresh parameter
+ * @since S60 3.2
+ * @return refresh parameter
+ */
+ TBool IsRefresh();
+
+ /**
+ * Refresh parameter setter
+ * @since S60 3.2
+ * @param aRefresh refresh value
+ */
+ void SetRefresh( TBool aRefresh );
+
+ /**
+ * operation id getter
+ * @since S60 3.2
+ * @return operation id
+ */
+ TInt OpId();
+
+ /**
+ * auxiliary parameter needed sometimes
+ * @since S60 3.2
+ * @return aux number
+ */
+ TInt Aux();
+
+ /**
+ * SIP Response reason setter
+ * @since S60 3.2
+ * @param aReason reason
+ */
+ void SetResponseReason( TSimpleResponseReason aReason );
+
+ /**
+ * SIP Response reason getter
+ * @since S60 3.2
+ * @return aReason reason
+ */
+ TSimpleResponseReason ResponseReason();
+
+ /**
+ * Set SIP-ETag value
+ *
+ * @since S60 3.2
+ * @param aTag tag
+ */
+ void SetETagL( const TDesC8& aTag );
+
+ /**
+ * get SIP-ETag value
+ *
+ * @since S60 3.2
+ * @return SIP-ETag value.
+ */
+ TPtrC8 ETag();
+
+ /**
+ * IM message recipient setter
+ *
+ * @since S60 5.0
+ * @param aRecipientId recipient ID
+ */
+ void SetRecipientL( const TDesC8& aRecipientId );
+
+ /**
+ * IM message recipient getter
+ *
+ * @since S60 5.0
+ * @return recipient ID
+ */
+ TPtrC8 Recipient();
+
+protected:
+
+ /**
+ * C++ default constructor.
+ */
+ CSimpleEngineRequest(
+ MSimpleOwnCallback& aEngine, TSimpleRequest aType, TInt aOpId );
+
+// from base class CActive
+
+ /**
+ * From CActive.
+ * Implements cancellation of an outstanding request.
+ *
+ * @since S60 3.2
+ */
+ void DoCancel( );
+
+ /**
+ * From CActive.
+ * Handles an active object's request completion event.
+ *
+ * @since S60 3.2
+ */
+ void RunL( );
+
+private:
+
+
+private: // Data
+
+ TDblQueLink iLink;
+
+ /**
+ * Request Time
+ */
+ TSimpleRequest iType;
+
+ /**
+ * Refresh Time
+ */
+ TUint iRefreshTime;
+
+ /**
+ * Client request data
+ */
+ TPtrC8 iRequestData;
+
+ /**
+ * IM message recipient ID
+ * Own.
+ */
+ HBufC8* iRecipientId;
+
+ /**
+ * Buffer for server response data
+ * Own.
+ */
+ HBufC8* iResponseData;
+
+ /**
+ * Server response method
+ */
+ TSimpleSIPResponse iResponseMethod;
+
+ /**
+ * Server response reason explanation
+ */
+ TSimpleResponseReason iReason;
+
+ /**
+ * Buffer for remote URI
+ * Own.
+ */
+ HBufC8* iRemoteURI;
+
+ /**
+ * Buffer for request content type
+ * Own.
+ */
+ HBufC8* iRequestContentType;
+
+ /**
+ * Buffer for response content type
+ * Own.
+ */
+ HBufC8* iResponseContentType;
+
+ /**
+ * Buffer for response MIME multipart boundary
+ * Own.
+ */
+ HBufC8* iResponseBoundary;
+
+ /**
+ * Buffer for response MIME multipart start content-id
+ * Own.
+ */
+ HBufC8* iResponseStart;
+
+ /**
+ * operation id
+ */
+ TInt iOpId;
+
+ /**
+ * client callback observer
+ */
+ MSimpleOwnCallback& iEngine;
+
+ /**
+ * whether refresh is made automatically
+ */
+ TBool iRefresh;
+
+ /**
+ * operation id
+ */
+ TInt iAux;
+
+ /**
+ * SIP ETag header
+ * Own.
+ */
+ HBufC8* iETag;
+
+ /**
+ * Pointer to stack variable to detect the deletion of the heap
+ * instance. This case takes place if a client
+ * calls destructor in callback method.
+ * Own.
+ */
+ TBool* iDestroyedPtr;
+
+ };
+
+ TInt CSimpleEngineRequest::LinkOffset()
+ {
+ return _FOFF(CSimpleEngineRequest, iLink);
+ }
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simpleengineutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine utils
+*
+*/
+
+
+
+
+#ifndef simpleengineutils_H
+#define simpleengineutils_H
+
+#include <e32std.h>
+
+//**********************************
+// TSimpleEngineUtils
+//**********************************
+class TSimpleEngineUtils
+ {
+public:
+ static TInt OpIdRange();
+ };
+
+#endif // simpleengineutils_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simplepublisher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine publisher
+*
+*/
+
+
+
+
+#ifndef simplepublisher_H
+#define simplepublisher_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "simpleclient.h"
+#include "msimpleconnection.h"
+#include "msimplepublisher.h"
+#include "msimpleowncallback.h"
+#include "msimpleenginerequest.h"
+
+// FORWARD DECLARATION
+class CSimpleEngineRequest;
+class MSimplePublishObserver;
+class MSimpleConnectionObserver;
+class MSimpleETagObserver;
+
+/**
+ * CSimplePublisher
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class CSimplePublisher : public CSimpleClient, public MSimplePublisher
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aConn connection
+ * @param aObserver callback observer
+ * @return CSimplePublisher
+ */
+ static CSimplePublisher* NewL(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimplePublisher();
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+// from base class MSimplePublisher
+
+ /**
+ * Getter for the SIMPLE engine connection.
+ * @since S60 3.2
+ * @return the attribute name.
+ */
+ const MSimpleConnection& Connection();
+
+ /**
+ * Start to publish data.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE engine.
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @param aRefresh where refresh is made automatically
+ * @return operation id
+ */
+ TInt StartPublishL( MSimpleDocument& aDocument,
+ TBool aRefresh);
+
+ /**
+ * Continue data publication
+ * Leaves with KErrInUse if there is already active publication
+ * in this MSimplePublisher entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE Engine.
+ *
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @param aRefresh whether refresh is made automatically
+ * @param aETag SIP ETag header value to be used in SIP-If-Match header.
+ * @return operation id
+ */
+ TInt ContinuePublishL( MSimpleDocument& aDocument,
+ TBool aRefresh, const TDesC8& aETag );
+
+ /**
+ * Update published data.
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @return operation id
+ */
+ TInt ModifyPublishL( MSimpleDocument& aDocument );
+
+ /**
+ * Stop publishing data.
+ * @since S60 3.2
+ * @return operation id
+ */
+ TInt StopPublishL();
+
+ /**
+ * Stop publication.
+ *
+ * @since S60 3.2
+ * @param aETag SIP ETag header value to be used in SIP-If-Match header.
+ * @return operation id
+ */
+ TInt StopPublishL( const TDesC8& aETag );
+
+ /**
+ * SIP Status accessor
+ * Get the status of the last completed request.
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ TUint SIPStatus( );
+
+ /**
+ * SIP Retry-after accessor
+ * Get the header of the last completed request.
+ * @since S60 3.2
+ * @return retry-after value in seconds, 0 if not available
+ */
+ TUint SIPRetryAfter( );
+
+ /**
+ * SIP ETag header value accessor.
+ * Notice that this value changes after each modification or automatic refresh
+ * of publication.
+ * Refer to RFC3903.
+ *
+ * @since S60 3.2
+ * @return ETag header value received from a network server..
+ * Zero length if not available.
+ */
+ TPtrC8 SIPETag();
+
+ /**
+ * SIP ETag header value change observer setter.
+ * Notice that this value changes after each modification or automatic refresh
+ * of publication. Observer is called when the ETag value changes next time.
+ * Refer to RFC3903.
+ *
+ * @since S60 3.2
+ * @param aObs ETag value observer. Can be NULL to stop notification.
+ */
+ void SetSIPETagObserver( MSimpleETagObserver* aObs );
+
+
+// from base class MSimpleOwnCallback
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @param aReq request
+ */
+ void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL( );
+
+ /**
+ * constructor
+ * @param aConn connection
+ * @param aObserver callback observer
+ */
+ CSimplePublisher(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver );
+
+ /**
+ * Stream document into request
+ *
+ * @since S60 3.2
+ * @param aReq request
+ * @param aDocument document
+ */
+ void StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleDocument& aDocument );
+
+
+ /**
+ * Publish data.
+ * Leaves with KErrInUse if there is already active publication
+ * in this MSimplePublisher entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE Engine.
+ *
+ * @since S60 3.2
+ * @param aDocument data to be published
+ * @param aRefresh whether refresh is made automatically
+ * @param aETag SIP ETag header value to be used in SIP-If-Match header.
+ * Zero length is ignored.
+ * @return operation id
+ */
+ TInt CSimplePublisher::DoStartPublishL( MSimpleDocument& aDocument,
+ TBool aRefresh, const TDesC8& aETag );
+
+
+private: // data
+
+ /**
+ * Publish state
+ */
+ TBool iPublished;
+
+ /**
+ * Client API observer for events
+ */
+ MSimplePublishObserver& iObserver;
+
+ /**
+ * Data buffer for transmission
+ * OWN.
+ */
+ CBufFlat* iBuffer;
+
+ /**
+ * current SIP ETag.
+ * Own.
+ */
+ HBufC8* iETag;
+
+ /**
+ * ETag change callback observer
+ * Not own.
+ **/
+ MSimpleETagObserver* iETagObserver;
+
+ };
+
+#endif // simplepublisher_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simplewatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine watcher
+*
+*/
+
+
+
+
+#ifndef simplewatcher_H
+#define simplewatcher_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "simpleclient.h"
+#include "msimpleconnection.h"
+#include "msimplewatcher.h"
+#include "msimpleowncallback.h"
+
+
+// FORWARD DECLARATION
+class CSimpleEngineRequest;
+class MSimpleWatcherObserver;
+class MSimpleConnectionObserver;
+
+/**
+ * CSimpleWatcher
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+class CSimpleWatcher : public CSimpleClient, public MSimpleWatcher
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aConn connection
+ * @param aObserver callback observer
+ * @return CSimpleWatcher
+ */
+ static CSimpleWatcher* NewL(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleWatcher();
+
+// from base class MSimpleWatcher
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for the SIMPLE engine connection.
+ * @since S60 3.2
+ * @return the connection
+ */
+ const MSimpleConnection& Connection();
+
+ /**
+ * Subscribe presence entity.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE engine.
+ * Leaves with KErrInUse if there is already active subscription.
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aRefresh whether refresh is made automatically
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ TInt SubscribeL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous );
+
+ /**
+ * Subscribe presence list.
+ * Expiry time is set based on SIMPLE settings.
+ * Refreshing is made by SIMPLE engine.
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aRefresh whether refresh is made automatically
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ TInt SubscribeListL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous );
+
+ /**
+ * Get presence data.3
+ * @since S60 3.2
+ * @param aURI URI of entity to be subscribed
+ * @param aFilter filter data, may be NULL.
+ * @param aAnonymous whether anonymous subscription is wanted
+ * @return operation id
+ */
+ TInt GetPresenceL( const TDesC8& aURI, MSimpleFilterDocument* aFilter, TBool aAnonymous );
+
+ /**
+ * Unsubscribe.
+ * Leaves with KErrNotFound if there is no active subscription.
+ * @since S60 3.2
+ * @return operation id
+ */
+ TInt UnsubscribeL();
+
+ /**
+ * SIP Status accessor
+ * Get the status of the last completed request.
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ TUint SIPStatus();
+
+ /**
+ * SIP Retry-after accessor
+ * Get the header of the last completed request.
+ * @since S60 3.2
+ * @return retry-after value in seconds, 0 if not available
+ */
+ TUint SIPRetryAfter();
+
+ /**
+ * SIP Subscription-state header value accessor.
+ * Get the SIP Subscription-state header value of the last NOTIFY message or
+ * ESimpleStateTerminated when the subscription is terminated by a client.
+ * Refer to RFC3265
+ *
+ * @since S60 3.2
+ * @return subscription state
+ */
+ TSimpleSipSubscriptionState SipSubscriptionState();
+
+// from base class MSimpleOwnCallback
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @param aReq request
+ */
+ void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
+
+
+private:
+
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL( );
+
+
+ /**
+ * constructor
+ * @param aConn connection
+ * @param aObserver callback observer
+ */
+ CSimpleWatcher(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver );
+
+ /**
+ * Stream document into request
+ * @param aReq request
+ * @param aFilter document
+ */
+ void StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleFilterDocument& aFilter );
+
+ /**
+ * New Request from server
+ * @since S60 3.2
+ * @param aReq request
+ */
+ void NewRequestL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Complete client request
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @return error when observer has deleted ourself in callback
+ */
+ TInt DoCallReqComplete(
+ TInt aOpId, TInt aStatus );
+
+
+private: // data
+
+ /**
+ * Client API observer for events
+ */
+ MSimpleWatcherObserver& iObserver;
+
+ /**
+ * Subscription id
+ */
+ TInt iSubsId;
+
+ /**
+ * Response counter in error situations, or state. reply + notify
+ */
+ TInt iResCount;
+
+ /**
+ * Whether WatcherReqCompleteL callback method is called
+ */
+ TBool iComplete;
+
+ /**
+ * Data buffer for transmission
+ * OWN.
+ */
+ CBufFlat* iBuffer;
+
+ };
+
+#endif // simplewatcher_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/inc/simplewinfowatcher.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine winfo watcher
+*
+*/
+
+
+
+
+#ifndef simplewinfowatcher_H
+#define simplewinfowatcher_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "simpleclient.h"
+#include "msimpleconnection.h"
+#include "msimplewinfowatcher.h"
+#include "msimpleowncallback.h"
+
+// FORWARD DECLARATION
+class CSimpleEngineRequest;
+class MSimpleWinfoObserver;
+class MSimpleConnectionObserver;
+
+/**
+ * CSimpleWinfoWatcher
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simpleengine
+ * @since S60 3.2
+ */
+
+class CSimpleWinfoWatcher : public CSimpleClient, public MSimpleWinfoWatcher
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aConn connection observer
+ * @param aObserver callback observer
+ * @return CSimpleWinfoWatcher
+ */
+ static CSimpleWinfoWatcher* NewL(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleWinfoWatcher();
+
+// from base class MSimpleWinfoWatcher
+
+ /**
+ * Destroy this entity
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for the SIMPLE engine connection.
+ * @since S60 3.2
+ * @return the connection
+ */
+ const MSimpleConnection& Connection();
+
+ /**
+ * Callback for WINFO termination
+ * @since S60 3.2
+ * @param aFilter filter data, may be null and then you'll get all
+ * the changes in WINFO.
+ */
+ TInt SubscribeWatcherListL( MSimpleFilterDocument* aFilter );
+
+ /**
+ * Unsubscribe.
+ * Leaves with KErrNotFound if there is no active subscription.
+ * @since S60 3.2
+ * @return operation id
+ */
+ TInt UnsubscribeL( );
+
+ /**
+ * SIP Status accessor
+ * Get the status of the last completed request.
+ * @since S60 3.2
+ * @return SIP status, 0 if not available
+ */
+ TUint SIPStatus();
+
+ /**
+ * SIP Retry-after accessor
+ * Get the header of the last completed request.
+ * @return retry-after value in seconds, 0 if not available
+ */
+ TUint SIPRetryAfter();
+
+// from base class MSimpleOwnCallback
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ */
+ void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq );
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL( );
+
+ /**
+ * constructor
+ */
+ CSimpleWinfoWatcher(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver );
+
+ /**
+ * Stream document into request
+ * @since S60 3.2
+ * @param aReq request
+ * @param aFilter document
+ */
+ void StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleFilterDocument& aFilter );
+
+ /**
+ * New Request from server
+ * @since S60 3.2
+ * @return request type
+ */
+ void NewRequestL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Complete client request
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @return error when observer has deleted ourself in callback
+ */
+ TInt DoCallReqComplete(
+ TInt aOpId, TInt aStatus );
+
+
+private: // data
+
+ /**
+ * Client API observer for events
+ */
+ MSimpleWinfoObserver& iObserver;
+
+ /**
+ * Subscription id
+ */
+ TInt iSubsId;
+
+ /**
+ * Response counter in error situations, or state. reply + notify
+ */
+ TInt iResCount;
+
+ /**
+ * Whether completion callback method is called
+ */
+ TBool iComplete;
+
+ /**
+ * Data buffer for transmission
+ * OWN.
+ */
+ CBufFlat* iBuffer;
+
+ };
+
+#endif // simplewinfowatcher_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleclient.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32mem.h>
+
+// own simple
+#include "msimpleconnection.h"
+#include "simpleconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "simplesipconnection.h"
+#include "simpleengineutils.h"
+#include "simpleclient.h"
+#include "simpleerrors.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleClient::CSimpleClient
+// ----------------------------------------------------------
+//
+CSimpleClient::CSimpleClient(
+ MSimpleConnection& aConn )
+: iConn( aConn ),
+ iOpId(0),
+ iSipStatus(0),
+ iRetryAfterTime(0),
+ iRequestList( CSimpleEngineRequest::LinkOffset()),
+ iRequest( MSimpleEngineRequest::ENone ),
+ iDestroyedPtr( NULL )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::~CSimpleClient
+// ----------------------------------------------------------
+//
+CSimpleClient::~CSimpleClient()
+ {
+ DeleteRequests();
+
+ if ( iDestroyedPtr )
+ {
+ // We are called inside callback
+ *iDestroyedPtr = ETrue;
+ iDestroyedPtr = NULL;
+ }
+
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::BaseConstructL
+// ----------------------------------------------------------
+//
+void CSimpleClient::BaseConstructL()
+ {
+ iLimitLowerValue = TSimpleEngineUtils::OpIdRange();
+ iLimitUpperValue = iLimitLowerValue + KRangeSize;
+ iOpId = iLimitLowerValue;
+ }
+
+// ----------------------------------------------------------------------------
+// CSimpleClient::IncreaseOpId
+// ----------------------------------------------------------------------------
+void CSimpleClient::IncreaseOpId( )
+ {
+ iOpId++;
+ if( iOpId >= iLimitUpperValue )
+ {
+ iOpId = iLimitLowerValue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleClient::DeleteRequests
+// -----------------------------------------------------------------------------
+void CSimpleClient::DeleteRequests()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleClient: DeleteRequests this=%d" ), (TInt)this );
+#endif
+ // Delete all buffered transaction requests
+ TDblQueIter<CSimpleEngineRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleEngineRequest* req = rIter;
+ rIter++; //lint !e1757
+ // delete corresponding request from another DLL too.
+ req->ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( SendReqL( *req ) );
+ // delete request from this DLL.
+ req->Destroy();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleClient::SearchRequests
+// -----------------------------------------------------------------------------
+CSimpleEngineRequest* CSimpleClient::SearchRequests( TInt aOpId )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleClient: SearchRequests this=%d" ), (TInt)this );
+#endif
+ // Delete all buffered transaction requests
+ TDblQueIter<CSimpleEngineRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleEngineRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->OpId() == aOpId )
+ {
+ return req;
+ }
+ }
+ return (CSimpleEngineRequest*)NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleClient::SendReqL
+// -----------------------------------------------------------------------------
+void CSimpleClient::SendReqL( MSimpleEngineRequest& aReq )
+ {
+ CSimpleConnection* conn = STATIC_CAST( CSimpleConnection*, &iConn); //lint !e826
+ CSimpleSipConnection* engine = conn->Connection();
+ engine->DispatchReqL( aReq );
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::ResponseReason
+// ----------------------------------------------------------
+//
+TInt CSimpleClient::ResponseReason(
+ MSimpleEngineRequest& aR )
+ {
+ switch ( aR.ResponseReason() )
+ {
+ case MSimpleEngineRequest::ENoReason:
+ return KErrNone;
+
+ case MSimpleEngineRequest::ERejected:
+ return KSimpleErrRejected;
+
+ case MSimpleEngineRequest::ETimeout:
+ return KSimpleErrTimeout;
+
+ case MSimpleEngineRequest::EDeactivated:
+ return KSimpleErrDeactivated;
+
+ case MSimpleEngineRequest::EProbation:
+ return KSimpleErrProbation;
+
+ case MSimpleEngineRequest::ENoresource:
+ return KSimpleErrNoresource;
+
+ case MSimpleEngineRequest::EGiveup:
+ return KSimpleErrGiveup;
+
+ default:
+ return KErrNone;
+ }; //lint !e960
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::DoSIPStatus
+// ----------------------------------------------------------
+//
+TUint CSimpleClient::DoSIPStatus( )
+ {
+ return iSipStatus;
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::DoRetryAfter
+// ----------------------------------------------------------
+//
+TUint CSimpleClient::DoRetryAfter( )
+ {
+ return iRetryAfterTime;
+ }
+
+// ----------------------------------------------------------
+// CSimpleClient::GetSIPStatus
+// ----------------------------------------------------------
+//
+void CSimpleClient::GetSIPStatus( TInt aOpId )
+ {
+ CSimpleConnection* conn = STATIC_CAST( CSimpleConnection*, &iConn); //lint !e826
+ CSimpleSipConnection* engine = conn->Connection();
+ iSipStatus = engine->SIPStatus( aOpId, iRetryAfterTime );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleconnection.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+// own simple
+#include "simplesipconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "msimpleconnectionobserver.h"
+#include "simpleconnection.h"
+#include "simpleengineutils.h"
+#include "msimpleenginerequest.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleConnection::CSimpleConnection
+// ----------------------------------------------------------
+//
+CSimpleConnection::CSimpleConnection( MSimpleConnectionObserver& aObserver )
+: iState( EInactive ),
+ iObserver( aObserver ),
+ iOpId(0),
+ iRequestList( CSimpleEngineRequest::LinkOffset())
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::~CSimpleConnection
+// ----------------------------------------------------------
+//
+CSimpleConnection::~CSimpleConnection()
+ {
+ delete iConnection;
+ DeleteRequests();
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleConnection::ConstructL( TInt32 aServiceId )
+ {
+ // Create CSimpleSipConnection entity in simplesiputils.dll
+ iConnection = CSimpleSipConnection::NewL();
+ // Set operation id ranges
+ iLimitLowerValue = TSimpleEngineUtils::OpIdRange();
+ iLimitUpperValue = iLimitLowerValue + KRangeSize;
+ iOpId = iLimitLowerValue;
+
+ // start to listen to status events
+ IncreaseOpId();
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::EListenEvents, iOpId );
+ CleanupStack::PushL( req );
+ if ( aServiceId )
+ {
+ iConnection->SetServiceId( aServiceId );
+ }
+ iConnection->DispatchReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::NewL
+// ----------------------------------------------------------
+//
+CSimpleConnection* CSimpleConnection::NewL(
+ MSimpleConnectionObserver& aObserver )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: NewL" ));
+#endif
+ CSimpleConnection* self = new (ELeave) CSimpleConnection( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( NULL );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::NewL
+// ----------------------------------------------------------
+//
+CSimpleConnection* CSimpleConnection::NewL(
+ MSimpleConnectionObserver& aObserver, TInt32 aServiceId )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: NewL" ));
+#endif
+ CSimpleConnection* self = new (ELeave) CSimpleConnection( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL( aServiceId );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::Connection
+// ----------------------------------------------------------
+//
+CSimpleSipConnection* CSimpleConnection::Connection()
+ {
+ return iConnection;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::Close
+// ----------------------------------------------------------
+//
+void CSimpleConnection::Close( )
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::LoginL
+// ----------------------------------------------------------
+//
+TInt CSimpleConnection::LoginL( )
+ {
+ return LoginL( 0 );
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::LoginL
+// ----------------------------------------------------------
+//
+TInt CSimpleConnection::LoginL( TInt aId )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: LoginL aId=%d" ), aId);
+#endif
+ // check state
+ if ( iState != EInactive )
+ {
+ User::Leave(KErrNotReady);
+ }
+
+ IncreaseOpId();
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::ERegister, iOpId );
+ req->SetAux( aId );
+ CleanupStack::PushL( req );
+ iConnection->DispatchReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+ SetConnectionStatus( EIdle );
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::ConnectionStatus
+// ----------------------------------------------------------
+//
+MSimpleConnection::TSimpleState CSimpleConnection::ConnectionStatus()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: ConnectionStatus returns %d" ), iState);
+#endif
+ return iState;
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::CurrentSIPIdentityL
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleConnection::CurrentSIPIdentityL()
+ {
+ return iConnection->CurrentSIPIdentityL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleConnection::Complete
+// ----------------------------------------------------------
+//
+void CSimpleConnection::Complete(
+ TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: Complete opid=%d status=%d" ),
+ aOpId, aStatus );
+#endif
+ // check the SIP state from another DLL
+ TSimpleSipState st = iConnection->SIPState();
+ MSimpleConnection::TSimpleState oldState = ConnectionStatus();
+ MSimpleConnection::TSimpleState newState = ConvertState( st );
+ SetConnectionStatus( newState );
+
+ if ( aReq.RequestType() != MSimpleEngineRequest::EListenEvents )
+ {
+ // delete corresponding request from another DLL too.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( iConnection->DispatchReqL( aReq ));
+ // delete request from this DLL.
+ aReq.Destroy();
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: call RequestCompleteL opid=%d status=%d" ),
+ aOpId, aStatus );
+#endif
+ TRAP_IGNORE( iObserver.RequestCompleteL( aOpId, aStatus ) );
+ }
+ else
+ {
+ // This is status event
+ if ( oldState != newState )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: call ConnectionStatusL state=%d" ),
+ newState );
+#endif
+ TRAP_IGNORE( iObserver.ConnectionStatusL( newState ) );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleConnection::DeleteRequests
+// -----------------------------------------------------------------------------
+void CSimpleConnection::DeleteRequests()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: DeleteRequests" ));
+#endif
+ // Delete all buffered transaction requests
+ TDblQueIter<CSimpleEngineRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleEngineRequest* req = rIter;
+ rIter++; //lint !e1757
+ req->Destroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CSimpleConnection::IncreaseOpId
+// ----------------------------------------------------------------------------
+void CSimpleConnection::IncreaseOpId( )
+ {
+ iOpId++;
+ if( iOpId >= iLimitUpperValue )
+ {
+ iOpId = iLimitLowerValue;
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CSimpleConnection::ConvertState
+// ----------------------------------------------------------------------------
+MSimpleConnection::TSimpleState CSimpleConnection::ConvertState( TSimpleSipState aState )
+ {
+ switch( aState )
+ {
+ case ESimpleSipIdle:
+ return MSimpleConnection::EIdle;
+ case ESimpleSipActive:
+ return MSimpleConnection::EActive;
+ case ESimpleSipSuspend:
+ return ESuspend;
+ case ESimpleSipInactive:
+ return EInactive;
+ case ESimpleSipUnavailable:
+ default:
+ return EUnavailable;
+ }; //lint !e960
+ }
+
+// ----------------------------------------------------------------------------
+// CSimpleConnection::SetConnectionStatus
+// ----------------------------------------------------------------------------
+void CSimpleConnection::SetConnectionStatus( TSimpleState aState )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleConnection: SetConnectionStatus %d" ), aState );
+#endif
+ iState = aState;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleengineimhandler.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine IM Handler
+*
+*/
+
+#include "simpleengineimhandler.h"
+#include "simpleenginerequest.h"
+#include "simpleinstantmsgobserver.h"
+#include "simplesipconnection.h"
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CSimpleEngineImHandler::CSimpleEngineImHandler
+// ---------------------------------------------------------------------------
+//
+CSimpleEngineImHandler::CSimpleEngineImHandler( MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver ) : CSimpleClient( aConn ),
+ iObserver( aObserver )
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleEngineImHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimpleEngineImHandler::ConstructL()
+ {
+ BaseConstructL();
+
+ // Enable instant message receiving
+ ReceiveInstantMessageL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleEngineImHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CSimpleEngineImHandler* CSimpleEngineImHandler::NewL(
+ MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver )
+ {
+ CSimpleEngineImHandler* self = new (ELeave) CSimpleEngineImHandler(
+ aConn, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L("CSimpleEngineImHandler::NewL this=%d"),
+ (TInt)self );
+#endif
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleEngineImHandler::~CSimpleEngineImHandler
+// ---------------------------------------------------------------------------
+//
+CSimpleEngineImHandler::~CSimpleEngineImHandler()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L("CSimpleEngineImHandler::~CSimpleEngineImHandler this=%d"),
+ (TInt)this );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// From class MSimpleInstantMessage
+// Send instant message
+// ---------------------------------------------------------------------------
+//
+TInt CSimpleEngineImHandler::SendInstantMessage( TPtrC8 aMsgContent,
+ TPtrC8 aRecipient )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L("CSimpleEngineImHandler::SendInstantMessage") );
+#endif
+
+ IncreaseOpId();
+ TRAPD( error, DoSendInstantMessageRequestL( aMsgContent, aRecipient ) )
+
+ if ( error )
+ {
+ return error;
+ }
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// From class MSimpleInstantMessage
+// CSimpleEngineImHandler::Close
+// ----------------------------------------------------------
+//
+void CSimpleEngineImHandler::Close()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------------------------
+// From class CSimpleClient
+// Complete the open client request
+// ---------------------------------------------------------------------------
+//
+void CSimpleEngineImHandler::Complete( TInt aOpId, TInt aStatus,
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::Complete opid=%d, status=%d - Start"),
+ aOpId, aStatus );
+#endif
+
+ if( MSimpleEngineRequest::EReceiveIM == aReq.RequestType() )
+ {
+ if( !aStatus )
+ {
+ iObserver.HandleReceiveTextMessage( aReq.Recipient(),
+ aReq.ResponseData() );
+ }
+ // Open receive request was already deleted from SIP Utils side
+ // Activate receiving again
+ TRAP_IGNORE( ReceiveInstantMessageL() )
+ }
+ else if( MSimpleEngineRequest::ESendIM == aReq.RequestType() )
+ {
+ iObserver.SendInstantMsgReqComplete( aOpId, aStatus );
+
+ // Delete the request as not needed anymore
+
+ iRequest = MSimpleEngineRequest::ENone;
+ // Delete corresponding request from another DLL too.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( SendReqL( aReq ) );
+ // delete request from this DLL.
+ aReq.Destroy();
+ }
+ else
+ {
+ // Unknown request
+ #ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::Complete - Unknown request") );
+ #endif
+ }
+
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L( "CSimpleEngineImHandler::Complete - End") );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// Do Send Instant Message request
+// ---------------------------------------------------------------------------
+//
+void CSimpleEngineImHandler::DoSendInstantMessageRequestL( TPtrC8 aMsgContent,
+ TPtrC8 aRecipient )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::DoSendInstantMessageRequestL - Start") );
+#endif
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL( *this,
+ MSimpleEngineRequest::ESendIM, iOpId );
+ CleanupStack::PushL( req );
+
+ req->SetRefresh( ETrue );
+ req->SetRequestData( aMsgContent );
+ req->SetRecipientL( aRecipient );
+
+ // send a request to engine DLL
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+ iRequest = MSimpleEngineRequest::ESendIM;
+ iSipStatus = KErrNone;
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::DoSendInstantMessageRequestL - End") );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// Receive instant message
+// ---------------------------------------------------------------------------
+//
+void CSimpleEngineImHandler::ReceiveInstantMessageL()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::ReceiveInstantMessageL - Start") );
+#endif
+ IncreaseOpId();
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL( *this,
+ MSimpleEngineRequest::EReceiveIM, iOpId );
+ CleanupStack::PushL( req );
+
+ req->SetRefresh( ETrue );
+ // Send a request to engine DLL
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+ iRequest = MSimpleEngineRequest::EReceiveIM;
+ iSipStatus = KErrNone;
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleEngineImHandler::ReceiveInstantMessageL - End") );
+#endif
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleenginerequest.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,476 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine request
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+// own simple
+#include "simplesipconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "msimpleenginerequest.h"
+#include "msimpleowncallback.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::CSimpleEngineRequest
+// ----------------------------------------------------------
+//
+CSimpleEngineRequest::CSimpleEngineRequest(
+ MSimpleOwnCallback& aEngine,
+ MSimpleEngineRequest::TSimpleRequest aType,
+ TInt aOpId )
+: CActive( CActive::EPriorityHigh ), iType( aType ),
+ iOpId( aOpId ), iEngine( aEngine ), iRefresh( ETrue ),
+ iAux(0), iDestroyedPtr( NULL )
+ {
+ CActiveScheduler::Add(this);
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::~CSimpleEngineRequest
+// ----------------------------------------------------------
+//
+CSimpleEngineRequest::~CSimpleEngineRequest()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: destructor ereq=%d" ), (TInt)this);
+#endif
+
+ if ( iDestroyedPtr )
+ {
+ // We are called inside callback
+ *iDestroyedPtr = ETrue;
+ iDestroyedPtr = NULL;
+ }
+
+ Cancel();
+ delete iResponseData;
+ delete iRemoteURI;
+ delete iRequestContentType;
+ delete iResponseContentType;
+ delete iResponseBoundary;
+ delete iResponseStart;
+ delete iETag;
+ delete iRecipientId;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleEngineRequest::Destroy
+// -----------------------------------------------------------------------------
+void CSimpleEngineRequest::Destroy()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: Destroy ereq=%d" ), (TInt)this);
+#endif
+ iLink.Deque();
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::NewL
+// ----------------------------------------------------------
+//
+CSimpleEngineRequest* CSimpleEngineRequest::NewL(
+ MSimpleOwnCallback& aEngine,
+ TSimpleRequest aType,
+ TInt aOpId )
+ {
+ CSimpleEngineRequest* self = new (ELeave) CSimpleEngineRequest( aEngine, aType, aOpId );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: NewL ereq=%d" ), (TInt)self);
+#endif
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRequestData
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRequestData( TPtrC8 aData )
+ {
+ iRequestData.Set(aData);
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRefreshTime
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRefreshTime( TUint aTime )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: SetRefreshTime %d" ), aTime);
+#endif
+ iRefreshTime = aTime;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRemoteURIL
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRemoteURIL( const TDesC8& aURI )
+ {
+ delete iRemoteURI;
+ iRemoteURI = NULL;
+ iRemoteURI = aURI.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::RequestType
+// ----------------------------------------------------------
+//
+MSimpleEngineRequest::TSimpleRequest CSimpleEngineRequest::RequestType()
+ {
+ return iType;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ModifyType
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::ModifyType( MSimpleEngineRequest::TSimpleRequest aType )
+ {
+ iType = aType;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::Complete
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::Complete( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: COMPLETE ereq=%d aStatus=%d" ),
+ (TInt)this, aStatus );
+#endif
+ // Yield to scheduler in order to "break" a call stack before
+ // continuing response handling.
+
+ // RunL will handle the response further
+ iStatus = KRequestPending;
+ SetActive();
+ TRequestStatus* s = &iStatus;
+ User::RequestComplete( s, aStatus );
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::RequestContentType
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::RequestContentType()
+ {
+ return iRequestContentType ? iRequestContentType->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRequestContentTypeL
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRequestContentTypeL( const TDesC8& aData )
+ {
+ delete iRequestContentType;
+ iRequestContentType = NULL;
+ iRequestContentType = aData.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::RequestData
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::RequestData()
+ {
+ return iRequestData;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseContentType(
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetResponseContentType( HBufC8* aData )
+ {
+ delete iResponseContentType;
+ iResponseContentType = NULL;
+ iResponseContentType = aData;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseContentType(
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetResponseBoundaryL( const TDesC8& aData )
+ {
+ delete iResponseBoundary;
+ iResponseBoundary = NULL;
+ iResponseBoundary = aData.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseContentType(
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetResponseStartL( const TDesC8& aData )
+ {
+ delete iResponseStart;
+ iResponseStart = NULL;
+ iResponseStart = aData.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseDataL
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetResponseDataL( const TDesC8& aData )
+ {
+ delete iResponseData;
+ iResponseData = NULL;
+ iResponseData = aData.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRecipientL
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRecipientL( const TDesC8& aRecipientId )
+ {
+ delete iRecipientId;
+ iRecipientId = NULL;
+ iRecipientId = aRecipientId.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseMethod
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetResponseMethod( TSimpleSIPResponse aMethod )
+ {
+ iResponseMethod = aMethod;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseMethod
+// ----------------------------------------------------------
+//
+MSimpleEngineRequest::TSimpleSIPResponse CSimpleEngineRequest::ResponseMethod( )
+ {
+ return iResponseMethod;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseContentType
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::ResponseContentType()
+ {
+ return iResponseContentType ? iResponseContentType->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseBoundary
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::ResponseBoundary()
+ {
+ return iResponseBoundary? iResponseBoundary->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseStart
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::ResponseStart()
+ {
+ return iResponseStart ? iResponseStart->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseData
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::ResponseData()
+ {
+ return iResponseData ? iResponseData->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::Recipient
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::Recipient()
+ {
+ return iRecipientId ? iRecipientId->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::RefreshTime
+// ----------------------------------------------------------
+//
+TUint CSimpleEngineRequest::RefreshTime()
+ {
+ return iRefreshTime;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::RemoteURI
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleEngineRequest::RemoteURI()
+ {
+ return iRemoteURI ? iRemoteURI->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::IsRefresh
+// ----------------------------------------------------------
+//
+TBool CSimpleEngineRequest::IsRefresh()
+ {
+ return iRefresh;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetRefresh
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetRefresh( TBool aRefresh )
+ {
+ iRefresh = aRefresh;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::OpId
+// ----------------------------------------------------------
+//
+TInt CSimpleEngineRequest::OpId( )
+ {
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::Aux
+// ----------------------------------------------------------
+//
+TInt CSimpleEngineRequest::Aux( )
+ {
+ return iAux;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetAux
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::SetAux( TInt aData )
+ {
+ iAux = aData;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::SetResponseReason
+// ----------------------------------------------------------
+void CSimpleEngineRequest::SetResponseReason( TSimpleResponseReason aReason )
+ {
+ iReason = aReason;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::ResponseReason
+// ----------------------------------------------------------
+MSimpleEngineRequest::TSimpleResponseReason CSimpleEngineRequest::ResponseReason()
+ {
+ return iReason;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleEngineRequest::SetETagL
+// -----------------------------------------------------------------------------
+void CSimpleEngineRequest::SetETagL( const TDesC8& aTag )
+ {
+ delete iETag;
+ iETag = NULL;
+ iETag = aTag.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleEngineRequest::ETag
+// -----------------------------------------------------------------------------
+TPtrC8 CSimpleEngineRequest::ETag()
+ {
+ return iETag ? iETag->Des() : TPtrC8();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleEngineRequest::RunL
+// -----------------------------------------------------------------------------
+//
+void CSimpleEngineRequest::RunL()
+ {
+ TInt stat = iStatus.Int();
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: RunL type=%d status=%d ereq=%d"),iType,stat, (TInt)this );
+#endif
+
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ // Call client callback method(s)
+ iEngine.Complete( iOpId, stat, *this );
+
+ // Check whether this entity is destroyed in Complete method.
+ if ( destroyed )
+ {
+ return;
+ }
+
+ // Reset response data
+ delete iResponseData;
+ iResponseData = NULL;
+ delete iResponseContentType;
+ iResponseContentType = NULL;
+ delete iResponseBoundary;
+ iResponseBoundary = NULL;
+ delete iResponseStart;
+ iResponseStart = NULL;
+ delete iRecipientId;
+ iRecipientId = NULL;
+ iResponseMethod = EUnknownResponse;
+ iReason = ENoReason;
+
+ iDestroyedPtr = NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleEngineRequest::DoCancel
+// ----------------------------------------------------------
+//
+void CSimpleEngineRequest::DoCancel()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("EngineRequest: DoCancel ereq=%d" ), (TInt)this );
+#endif
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleengineutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine utils
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "simpleengineutils.h"
+#include "simplecommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+//**********************************
+// TSimpleEngineUtils
+//**********************************
+
+// ---------------------------------------------------------
+// TSimpleEngineUtils::OpIdRange
+// ---------------------------------------------------------
+//
+TInt TSimpleEngineUtils::OpIdRange()
+ {
+ // Bit mask to create server OOM error response
+ const TUint KMaxId = 0x40000000;
+ const TInt KMagic2 = 50;
+ TInt limitLowerValue = REINTERPRET_CAST(TInt, Dll::Tls() );
+ TInt limitUpperValue = limitLowerValue + KRangeSize;
+ // Check that counter does not go around
+ if ( limitUpperValue & KMaxId )
+ {
+ // start from 50, if this ever happens
+ limitLowerValue = KMagic2;
+ limitUpperValue = limitLowerValue + KRangeSize;
+ }
+ Dll::SetTls( REINTERPRET_CAST(TAny*, limitUpperValue ) );
+ return limitLowerValue;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simplefactory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simplexmlfactory.h"
+#include "simplefactory.h"
+
+#include "simplenamespace.h"
+#include "simpleelement.h"
+#include "simpledocument.h"
+#include "simplefilter.h"
+#include "simpleconnection.h"
+#include "simplepublisher.h"
+#include "simplewatcher.h"
+#include "simplewinfowatcher.h"
+#include "simpleengineimhandler.h"
+
+#include "msimplenamespace.h"
+#include "msimpleelement.h"
+#include "msimpledocument.h"
+#include "msimplefilterdocument.h"
+#include "msimpleconnection.h"
+#include "msimplepublisher.h"
+#include "msimplewatcher.h"
+#include "msimplewinfowatcher.h"
+#include "simpleinstantmessage.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+class MSimpleConnectionObserver;
+class MSimplePublishObserver;
+class MSimpleWatcherObserver;
+class MSimpleWinfoObserver;
+class MSimplePublishObserver;
+
+class MSimpleContent;
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+EXPORT_C MSimpleNamespace* TSimpleFactory::NewNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ return TSimpleXmlFactory::NewNamespaceL( aPrefix, aUri );
+ }
+
+EXPORT_C MSimpleElement* TSimpleFactory::NewElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return TSimpleXmlFactory::NewElementL( aNsUri, aLocalName );
+ }
+
+EXPORT_C MSimpleDocument* TSimpleFactory::NewDocumentL( )
+ {
+ return TSimpleXmlFactory::NewDocumentL( );
+ }
+
+EXPORT_C MSimpleDocument* TSimpleFactory::NewDocumentL( const TDesC8& aXml )
+ {
+ return TSimpleXmlFactory::NewDocumentL( aXml );
+ }
+
+EXPORT_C MSimpleFilterDocument* TSimpleFactory::NewFilterDocumentL()
+ {
+ return TSimpleXmlFactory::NewFilterDocumentL();
+ }
+
+EXPORT_C MSimpleConnection* TSimpleFactory::NewConnectionL(
+ MSimpleConnectionObserver& aObserver)
+ {
+ #ifdef _DEBUG
+ TSimpleLogger::Log(_L("TSimpleFactory::NewConnectionL" ) );
+ #endif
+ return CSimpleConnection::NewL( aObserver );
+ }
+
+EXPORT_C MSimplePublisher* TSimpleFactory::NewPublisherL(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver )
+ {
+ return CSimplePublisher::NewL( aConn, aObserver );
+ }
+
+EXPORT_C MSimpleInstantMessage* TSimpleFactory::NewInstantMessageL(
+ MSimpleConnection& aConn,
+ MSimpleInstantMsgObserver& aObserver )
+ {
+ return CSimpleEngineImHandler::NewL( aConn, aObserver );
+ }
+
+EXPORT_C MSimpleWatcher* TSimpleFactory::NewWatcherL(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver )
+ {
+ return CSimpleWatcher::NewL( aConn, aObserver );
+ }
+
+EXPORT_C MSimpleWinfoWatcher* TSimpleFactory::NewWinfoWatcherL(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver )
+ {
+ return CSimpleWinfoWatcher::NewL( aConn, aObserver );
+ }
+
+EXPORT_C MSimpleFilterDocument* TSimpleFactory::NewFilterDocumentL( const TDesC8& aXml )
+ {
+ return TSimpleXmlFactory::NewFilterDocumentL( aXml );
+ }
+
+EXPORT_C MSimpleContent* TSimpleFactory::NewContentL(
+ const TDesC8& aContentID, const TDesC8& aContentType )
+ {
+ return TSimpleXmlFactory::NewContentL(
+ aContentID, aContentType );
+ }
+
+EXPORT_C MSimpleConnection* TSimpleFactory::NewConnectionL(
+ MSimpleConnectionObserver& aObserver, TInt32 aServiceId )
+ {
+ return CSimpleConnection::NewL( aObserver, aServiceId );
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simplepublisher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,496 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32mem.h>
+
+// own simple
+#include "msimpleconnection.h"
+#include "simpleconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "msimpledocument.h"
+#include "msimplepublishobserver.h"
+#include "msimpleetagobserver.h"
+#include "simplepublisher.h"
+
+
+#include "simplesipconnection.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+const TInt KSimpleExpandSize = 512;
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimplePublisher::CSimplePublisher
+// ----------------------------------------------------------
+//
+CSimplePublisher::CSimplePublisher(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver )
+: CSimpleClient( aConn ),
+ iPublished( EFalse ),
+ iObserver( aObserver ), iBuffer(NULL), iETagObserver( NULL )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::~CSimplePublisher
+// ----------------------------------------------------------
+//
+CSimplePublisher::~CSimplePublisher()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: Destructor this=%d" ), (TInt)this );
+#endif
+ delete iBuffer;
+ delete iETag;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::ConstructL
+// ----------------------------------------------------------
+//
+void CSimplePublisher::ConstructL()
+ {
+ BaseConstructL();
+ iBuffer = CBufFlat::NewL(KSimpleExpandSize);
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::NewL
+// ----------------------------------------------------------
+//
+CSimplePublisher* CSimplePublisher::NewL(
+ MSimpleConnection& aConn,
+ MSimplePublishObserver& aObserver )
+ {
+ CSimplePublisher* self = new (ELeave) CSimplePublisher(
+ aConn, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: NewL this=%d" ), (TInt)self );
+#endif
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::SIPStatus
+// ----------------------------------------------------------
+//
+TUint CSimplePublisher::SIPStatus()
+ {
+ return DoSIPStatus();
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::SIPRetryAfter
+// ----------------------------------------------------------
+//
+TUint CSimplePublisher::SIPRetryAfter()
+ {
+ return DoRetryAfter();
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::Connection
+// ----------------------------------------------------------
+//
+const MSimpleConnection& CSimplePublisher::Connection()
+ {
+ return iConn;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::StartPublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::StartPublishL( MSimpleDocument& aDocument,
+ TBool aRefresh )
+ {
+
+ IncreaseOpId();
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: StartPublishL opid=%d" ), iOpId );
+#endif
+
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+ User::Leave( KErrInUse );
+ }
+
+ return DoStartPublishL( aDocument, aRefresh, KNullDesC8 );
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::ContinuePublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::ContinuePublishL( MSimpleDocument& aDocument,
+ TBool aRefresh, const TDesC8& aETag )
+ {
+
+ IncreaseOpId();
+
+#ifdef _DEBUG
+ TBuf<100> myETag;
+ myETag.Copy( aETag );
+ TSimpleLogger::Log(_L("Publisher: ContinuePublishL opid=%d ETag=%S" ), iOpId, &myETag );
+#endif
+
+ return DoStartPublishL( aDocument, aRefresh, aETag );
+
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::ModifyPublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::ModifyPublishL( MSimpleDocument& aDocument )
+ {
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: ModifyPublishL opid=%d" ), iOpId );
+#endif
+
+ // use the old opid and request
+ CSimpleEngineRequest* req = SearchRequests( iOpId );
+ if ( !req )
+ {
+ User::Leave( KErrNotFound );
+ }
+ req->ModifyType( MSimpleEngineRequest::EPublishModify );
+
+ // add request data
+ StreamDocumentL( *req, aDocument );
+
+ // Set MIME type of the request
+ RPointerArray<MSimpleContent> contents;
+ CleanupClosePushL( contents );
+ aDocument.GetDirectContentsL( contents );
+ if ( contents.Count() )
+ {
+ req->SetRequestContentTypeL( KSimpleMultipartType );
+ }
+ else
+ {
+ req->SetRequestContentTypeL( KSimpleDocumentType );
+ }
+ CleanupStack::PopAndDestroy( &contents );
+
+ // send a request to engine DLL
+ SendReqL( *req );
+
+ iRequest = MSimpleEngineRequest::EPublishModify;
+ iSipStatus = 0;
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::StopPublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::StopPublishL()
+ {
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: StopPublishL opid=%d" ), iOpId );
+#endif
+
+ // use the old opid and request
+ CSimpleEngineRequest* req = SearchRequests( iOpId );
+ if ( !req )
+ {
+ User::Leave( KErrNotFound );
+ }
+ req->ModifyType( MSimpleEngineRequest::EStopPublish );
+
+ // send a request to engine DLL
+ SendReqL( *req );
+
+ iRequest = MSimpleEngineRequest::EStopPublish;
+ iPublished = EFalse;
+ iSipStatus = 0;
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::StopPublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::StopPublishL( const TDesC8& aETag )
+ {
+
+#ifdef _DEBUG
+ TBuf<100> myETag;
+ myETag.Copy( aETag );
+ TSimpleLogger::Log(_L("Publisher: StopPublishL opid=%d ETag=%S" ), iOpId, &myETag );
+#endif
+
+ // use the old opid and request
+ CSimpleEngineRequest* req = SearchRequests( iOpId );
+
+ if ( iRequest != MSimpleEngineRequest::ENone && !req )
+ {
+ User::Leave( KErrNotFound );
+ }
+ else if ( !req )
+ {
+ IncreaseOpId();
+ // create a new request when starting from scratch
+ req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::EStopPublish, iOpId );
+ iRequestList.AddLast( *req );
+ }
+
+ req->ModifyType( MSimpleEngineRequest::EStopPublish );
+ req->SetETagL( aETag );
+
+ // send a request to engine DLL
+ SendReqL( *req );
+
+ iRequest = MSimpleEngineRequest::EStopPublish;
+ iPublished = EFalse;
+ iSipStatus = 0;
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::SIPETag
+// ----------------------------------------------------------
+TPtrC8 CSimplePublisher::SIPETag()
+ {
+ return iETag ? iETag->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::SetSIPETagObserver
+// ----------------------------------------------------------
+void CSimplePublisher::SetSIPETagObserver( MSimpleETagObserver* aObs )
+ {
+ iETagObserver = aObs;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::Close
+// ----------------------------------------------------------
+//
+void CSimplePublisher::Close( )
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::Complete
+// ----------------------------------------------------------
+//
+void CSimplePublisher::Complete(
+ TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: Complete opid=%d, status=%d" ),
+ aOpId, aStatus );
+#endif
+
+ MSimpleEngineRequest::TSimpleRequest origRequest = iRequest;
+ TBool myTerminated( EFalse );
+
+ GetSIPStatus( aOpId );
+
+ // Allocate ETag when needed and call callback
+ if ( SIPETag().CompareF( aReq.ETag() ))
+ {
+ delete iETag;
+ iETag = NULL;
+ TRAPD( errMem, iETag = aReq.ETag().AllocL() );
+ if ( iETagObserver && !errMem )
+ {
+ TRAP_IGNORE( iETagObserver->NewETagL( iETag->Des() ));
+ }
+ }
+
+ if ( aReq.ResponseMethod() == MSimpleEngineRequest:: EStatusETag )
+ {
+ // If only ETag was updated then all is done this time.
+ return;
+ }
+
+ // Reset data buffer
+ iBuffer->Reset();
+
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ if ( !aStatus && origRequest == MSimpleEngineRequest::EStartPublish )
+ {
+ iPublished = ETrue;
+ }
+
+ // Select the right callback method
+ if ( iPublished &&
+ origRequest == MSimpleEngineRequest::EStartPublish &&
+ aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: call PublishTerminatedL opid=%d" ), aOpId );
+#endif
+ myTerminated = ETrue;
+ TRAP_IGNORE( iObserver.PublishTerminatedL( aOpId ));
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ else
+ {
+ // If modify fails then it does not always mean the whole
+ // publish is failed.
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Publisher: call PublishReqCompleteL opid=%d status=%d" ),
+ aOpId, aStatus );
+#endif
+ TRAP_IGNORE( iObserver.PublishReqCompleteL( aOpId, aStatus ) );
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ if ( aStatus == KErrCompletion || aStatus == KErrDisconnected )
+ {
+ myTerminated = ETrue;
+ // KErrCompletion error code is used when publication is terminated.
+ TRAP_IGNORE( iObserver.PublishTerminatedL( aOpId ) );
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ }
+
+ // Delete a request when not needed anymore.
+ if (( aStatus != KErrNone && origRequest == MSimpleEngineRequest::EStartPublish ) ||
+ origRequest == MSimpleEngineRequest::EStopPublish ||
+ myTerminated )
+ {
+ iRequest = MSimpleEngineRequest::ENone;
+ iPublished = EFalse;
+
+ // delete corresponding request from another DLL too.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( SendReqL( aReq ));
+ // delete request from this DLL.
+ aReq.Destroy();
+ }
+
+ // Set iRequest back to EStartPublish after Modify request.
+ // This helps to handle error situations above.
+ else if ( origRequest == MSimpleEngineRequest::EPublishModify )
+ {
+ iRequest = MSimpleEngineRequest::EStartPublish;
+ aReq.ModifyType( MSimpleEngineRequest::EStartPublish );
+ }
+
+ iDestroyedPtr = NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::StreamDocumentL
+// ----------------------------------------------------------
+//
+void CSimplePublisher::StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleDocument& aDocument )
+ {
+ // add request data
+ // externalize the document a stream
+ iBuffer->Reset();
+ RBufWriteStream stream( *iBuffer );
+ stream.Open( *iBuffer );
+ aDocument.ExternalizeL( stream );
+ stream.Close();
+ aReq.SetRequestData( iBuffer->Ptr(0) );
+ }
+
+// ----------------------------------------------------------
+// CSimplePublisher::DoStartPublishL
+// ----------------------------------------------------------
+//
+TInt CSimplePublisher::DoStartPublishL( MSimpleDocument& aDocument,
+ TBool aRefresh, const TDesC8& aETag )
+ {
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+ User::Leave( KErrInUse );
+ }
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::EStartPublish, iOpId );
+ CleanupStack::PushL( req );
+ req->SetRefresh( aRefresh );
+ // add remote uri
+ const TDesC8* p8 = aDocument.EntityURI();
+ req->SetRemoteURIL( *p8 );
+ // set ETag
+ req->SetETagL( aETag );
+
+ // add request data
+ StreamDocumentL( *req, aDocument );
+
+ // Set MIME type of the request
+ RPointerArray<MSimpleContent> contents;
+ CleanupClosePushL( contents );
+ aDocument.GetDirectContentsL( contents );
+ if ( contents.Count() )
+ {
+ req->SetRequestContentTypeL( KSimpleMultipartType );
+ }
+ else
+ {
+ req->SetRequestContentTypeL( KSimpleDocumentType );
+ }
+ CleanupStack::PopAndDestroy( &contents );
+
+ // send a request to engine DLL
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+
+ iRequest = MSimpleEngineRequest::EStartPublish;
+ iSipStatus = 0;
+ return iOpId;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simpleutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleutils.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+
+EXPORT_C TPtrC8 TSimpleUtils::NsUriL(
+ const TDesC8& aPrefix )
+ {
+ if ( !aPrefix.CompareF( KSimpleDefault ) )
+ {
+ return TPtrC8(KSimpleNsDefault);
+ }
+ else if ( !aPrefix.CompareF( KSimplePDM ) )
+ {
+ return TPtrC8(KSimpleNsPDM);
+ }
+ else if ( !aPrefix.CompareF( KSimpleRPID ) )
+ {
+ return TPtrC8(KSimpleNsRPID);
+ }
+ else if ( !aPrefix.CompareF( KSimpleOP ) )
+ {
+ return TPtrC8(KSimpleNsOP);
+ }
+ else if ( !aPrefix.CompareF( KSimpleCL ) )
+ {
+ return TPtrC8(KSimpleNsCL);
+ }
+ else if ( !aPrefix.CompareF( KSimpleGML ) )
+ {
+ return TPtrC8(KSimpleNsGML);
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+ return TPtrC8();
+ }
+
+EXPORT_C TPtrC8 TSimpleUtils::NsPrefixL(
+ const TDesC8& aURI )
+ {
+ if ( !aURI.CompareF( KSimpleNsDefault ) )
+ {
+ return TPtrC8(KSimpleDefault);
+ }
+ else if ( !aURI.CompareF( KSimpleNsPDM ) )
+ {
+ return TPtrC8(KSimplePDM);
+ }
+ else if ( !aURI.CompareF( KSimpleNsRPID ) )
+ {
+ return TPtrC8(KSimpleRPID);
+ }
+ else if ( !aURI.CompareF( KSimpleNsOP ) )
+ {
+ return TPtrC8(KSimpleOP);
+ }
+ else if ( !aURI.CompareF( KSimpleNsCL ) )
+ {
+ return TPtrC8(KSimpleCL);
+ }
+ else if ( !aURI.CompareF( KSimpleNsGML ) )
+ {
+ return TPtrC8(KSimpleGML);
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+ return TPtrC8();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simplewatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,610 @@
+/*
+* Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32mem.h>
+
+// own simple
+#include "msimpleconnection.h"
+#include "simpleconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "msimpledocument.h"
+#include "msimplefilterdocument.h"
+#include "msimplewatcherobserver.h"
+#include "msimplepresencelist.h"
+#include "simplewatcher.h"
+#include "simpleerrors.h"
+#include "simplexmlfactory.h"
+
+#include "simplesipconnection.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+const TInt KExpandSize = 512;
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleWatcher::CSimpleWatcher
+// ----------------------------------------------------------
+//
+CSimpleWatcher::CSimpleWatcher(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver )
+: CSimpleClient( aConn ),
+ iObserver( aObserver ),
+ iResCount(0), iComplete( EFalse ),
+ iBuffer(NULL)
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::~CSimpleWatcher
+// ----------------------------------------------------------
+//
+CSimpleWatcher::~CSimpleWatcher()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: Destructor this=%d" ), (TInt)this );
+#endif
+ delete iBuffer;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleWatcher::ConstructL()
+ {
+ BaseConstructL();
+ iBuffer = CBufFlat::NewL(KExpandSize);
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::NewL
+// ----------------------------------------------------------
+//
+CSimpleWatcher* CSimpleWatcher::NewL(
+ MSimpleConnection& aConn,
+ MSimpleWatcherObserver& aObserver )
+ {
+ CSimpleWatcher* self = new (ELeave) CSimpleWatcher(
+ aConn, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: NewL this=%d" ), (TInt)self );
+#endif
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::Connection
+// ----------------------------------------------------------
+//
+const MSimpleConnection& CSimpleWatcher::Connection()
+ {
+ return iConn;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::SIPStatus
+// ----------------------------------------------------------
+//
+TUint CSimpleWatcher::SIPStatus()
+ {
+ return DoSIPStatus();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::SIPRetryAfter
+// ----------------------------------------------------------
+//
+TUint CSimpleWatcher::SIPRetryAfter()
+ {
+ return DoRetryAfter();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::SipSubscriptionState
+// ----------------------------------------------------------
+//
+MSimpleWatcher::TSimpleSipSubscriptionState CSimpleWatcher::SipSubscriptionState()
+ {
+ MSimpleWatcher::TSimpleSipSubscriptionState retVal = ESimpleStateNone;
+
+ // get the old request
+ CSimpleEngineRequest* req = SearchRequests( iSubsId );
+ if ( req )
+ {
+ CSimpleConnection* conn = STATIC_CAST( CSimpleConnection*, &iConn); //lint !e826
+ CSimpleSipConnection* engine = conn->Connection();
+ MSimpleEngineRequest::TSimpleSipSubscriptionState intVal = engine->SipSubscriptionState( *req );
+ switch ( intVal )
+ {
+ case MSimpleEngineRequest::ESimpleStateNone:
+ retVal = MSimpleWatcher::ESimpleStateNone;
+ break;
+ case MSimpleEngineRequest::ESimpleStatePending:
+ retVal = MSimpleWatcher::ESimpleStatePending;
+ break;
+ case MSimpleEngineRequest::ESimpleStateActive:
+ retVal = MSimpleWatcher::ESimpleStateActive;
+ break;
+ case MSimpleEngineRequest::ESimpleStateTerminated:
+ default:
+ retVal = MSimpleWatcher::ESimpleStateTerminated;
+ break;
+ }
+ }
+ return retVal;
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleWatcher::Close
+// ----------------------------------------------------------
+//
+void CSimpleWatcher::Close( )
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::NewRequestL
+// ----------------------------------------------------------
+//
+void CSimpleWatcher::NewRequestL( MSimpleEngineRequest& aReq )
+ {
+ TPtrC8 content = aReq.ResponseData();
+ TPtrC8 contType = aReq.ResponseContentType();
+ TPtrC8 p8;
+ p8.Set( KSimpleDocumentType );
+ TInt mySize = p8.Length();
+ p8.Set( KSimpleMultipartType );
+ TInt mySize2 = p8.Length();
+ if (!contType.Left(mySize).CompareF(KSimpleDocumentType))
+ {
+ MSimpleDocument* d = TSimpleXmlFactory::NewDocumentL( content );
+ CleanupClosePushL( *d );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: call WatcherNotificationL"));
+#endif
+ iObserver.WatcherNotificationL( *d );
+ CleanupStack::PopAndDestroy( d );
+ }
+ else if ( !(contType.Left(mySize2).CompareF( KSimpleMultipartType )))
+ {
+ // Detect the difference between multipart/related cases
+ // application/pidf+xml and application/rlmi+xml
+ if ( contType.FindF( KSimpleDocumentType ) > 0 )
+ {
+ // Multipart for a single presentity having a direct content.
+ MSimpleDocument* d = TSimpleXmlFactory::NewDocumentInMultiPartL(
+ content, aReq.ResponseBoundary(), aReq.ResponseStart() );
+ CleanupClosePushL( *d );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: call WatcherNotificationL (content)"));
+#endif
+ iObserver.WatcherNotificationL( *d );
+ CleanupStack::PopAndDestroy( d );
+ }
+ else
+ {
+ // Multipart for a presence list.
+ MSimplePresenceList* l = TSimpleXmlFactory::NewPresenceListL(
+ content, aReq.ResponseBoundary(), aReq.ResponseStart() );
+ CleanupClosePushL( *l );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: call WatcherListNotificationL"));
+#endif
+ iObserver.WatcherListNotificationL( *l );
+ CleanupStack::PopAndDestroy( l );
+ }
+ }
+ else
+ {
+ // Unsupported content type, ignore it.
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::Complete
+// ----------------------------------------------------------
+//
+void CSimpleWatcher::Complete(
+ TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: Complete opid=%d status=%d" ),
+ aOpId, aStatus );
+#endif
+
+ // FUNCTIONALITY
+ // Get
+ // - SIP ok + terminated -> WatcherReqCompleteL(ok) + WatcherNotificationL(terminated)
+ // - terminated + SIP ok -> WatcherNotificationL(terminated) + WatcherReqCompleteL(ok)
+ //
+ // Stop
+ // - terminated + SIP ok -> WatcherReqCompleteL(ok)
+ // - SIP ok + terminated -> WatcherReqCompleteL(ok)
+ //
+ // Subscribe
+ // - SIP error -> WatcherReqCompleteL(error)
+ // - SIP ok + terminated ->
+ // WatcherReqCompleteL(ok) + WatcherNotificationL(terminated) + WatcherTerminated()
+ // - SIP ok + active + terminated ->
+ // WatcherReqCompleteL(ok) + WatcherNotificationL(active) +
+ // WatcherNotificationL(terminated) + WatcherTErminated
+ // - active + SIP ok + terminated ->
+ // WatcherNotificationL(active) + WatcherReqCompleteL(ok) +
+ // WatcherNotificationL(terminated) + WatcherTerminated
+ //
+
+ TBool completeNow( EFalse );
+ MSimpleEngineRequest::TSimpleRequest orig = aReq.RequestType();
+
+ if ( orig == MSimpleEngineRequest::EDestroyStart )
+ {
+ // It's time to delete the request of delayed deletion from both DLLs.
+ // Delete immediately from another DLL.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( SendReqL( aReq ));
+ // Delete from this DLL,
+ aReq.Destroy();
+ return;
+ }
+
+ GetSIPStatus( aOpId );
+
+ // Reset data buffer
+ iBuffer->Reset();
+
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ MSimpleEngineRequest::TSimpleSIPResponse respMet = aReq.ResponseMethod();
+
+ // Convert KSimpleErrPending to OK when needed
+ if ( aStatus == KSimpleErrPending )
+ {
+ aStatus = KErrNone;
+ }
+
+ // Handle SIP notification first
+ if ( respMet == MSimpleEngineRequest::ENotify )
+ {
+ // This is true in notifications. Ignore some responses.
+ if ( aStatus == KErrCompletion )
+ {
+ iResCount++;
+ }
+ if ( orig != MSimpleEngineRequest::ESubscribeStop )
+ {
+ TRAP_IGNORE( NewRequestL( aReq ) );
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ else if ( iResCount > 1 )
+ {
+ // Stop request is not completed until ok + Notify(terminated) received.
+ // Error completes the stop reqest without Notification.
+ completeNow = ETrue;
+ if ( DoCallReqComplete( aOpId, KErrNone ))
+ {
+ return;
+ }
+ }
+ }
+ else
+ {
+ // SIP Status response or client originated cancellation
+ iResCount++;
+ if ( aStatus != KErrNone )
+ {
+ iResCount++;
+ if ( orig == MSimpleEngineRequest::ESubscribeStop )
+ {
+ // Any response to stop subscribe is ok.
+ aStatus = KErrNone;
+ }
+ }
+
+ if ( !iComplete &&
+ ( orig != MSimpleEngineRequest::ESubscribeStop ||
+ orig == MSimpleEngineRequest::ESubscribeStop && iResCount > 1 ) )
+ {
+ // Stop request is not completed until ok + Notify(terminated) received.
+ // Error completes the stop reqest without Notification.
+ completeNow = ETrue;
+ if ( DoCallReqComplete( aOpId, aStatus ))
+ {
+ return;
+ }
+ }
+ }
+
+ // Delete request when not needed
+ if ( iResCount > 1 )
+ {
+ iRequest = MSimpleEngineRequest::ENone;
+ iComplete = EFalse;
+ TInt reason = ResponseReason( aReq );
+ // Delete corresponding request from another DLL with delay. This decreases
+ // the counter of active subscriptions there.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroyStart );
+ TRAP_IGNORE( SendReqL( aReq ));
+ // call WatcherTerminatedL when needed, i.e. no Stop or Get
+ if ( orig != MSimpleEngineRequest::ESubscribeStop &&
+ orig != MSimpleEngineRequest::ESubscribeGet &&
+ !completeNow )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: call WatcherTerminatedL opid=%d"),
+ aOpId );
+#endif
+ TRAP_IGNORE( iObserver.WatcherTerminatedL( aOpId, reason ));
+ // Check whether an application has called destructor in callback method.
+ // Destructor of CSimpleClient base class will handle deletion of
+ // all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ // delete request from this DLL later
+ }
+
+ iDestroyedPtr = NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::SubscribeL
+// ----------------------------------------------------------
+//
+TInt CSimpleWatcher::SubscribeL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous )
+ {
+
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: SubscribeL IN-USE **" ) );
+#endif
+ User::Leave( KErrInUse );
+ }
+
+ IncreaseOpId();
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: SubscribeL opid=%d" ), iOpId );
+#endif
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::ESubscribe, iOpId );
+ CleanupStack::PushL( req );
+ req->SetRemoteURIL( aURI );
+ req->SetRefresh( aRefresh );
+ if ( aAnonymous )
+ {
+ req->SetAux( 1 );
+ }
+
+ // handle optional filter document
+ if ( aFilter )
+ {
+ StreamDocumentL( *req, *aFilter );
+ }
+
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+
+ iRequest = MSimpleEngineRequest::ESubscribe;
+ iResCount = 0;
+ iSubsId = iOpId;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::SubscribeListL
+// ----------------------------------------------------------
+//
+TInt CSimpleWatcher::SubscribeListL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aRefresh,
+ TBool aAnonymous )
+ {
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: SubscribeListL IN-USE **" ) );
+#endif
+ User::Leave( KErrInUse );
+ }
+
+ IncreaseOpId();
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: SubscribeListL opid=%d" ), iOpId);
+#endif
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::ESubscribeLista, iOpId );
+ CleanupStack::PushL( req );
+ req->SetRemoteURIL( aURI );
+ req->SetRefresh( aRefresh );
+ if ( aAnonymous )
+ {
+ req->SetAux( 1 );
+ }
+
+ // handle optional filter document
+ if ( aFilter )
+ {
+ StreamDocumentL( *req, *aFilter );
+ }
+
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+
+ iRequest = MSimpleEngineRequest::ESubscribeLista;
+ iResCount = 0;
+ iSubsId = iOpId;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::GetPresenceL
+// ----------------------------------------------------------
+//
+TInt CSimpleWatcher::GetPresenceL(
+ const TDesC8& aURI,
+ MSimpleFilterDocument* aFilter,
+ TBool aAnonymous )
+ {
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: GetPresenceL IN-USE **" ) );
+#endif
+ User::Leave( KErrInUse );
+ }
+
+ IncreaseOpId();
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: GetPresenceL opid=%d" ), iOpId );
+#endif
+
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::ESubscribeGet, iOpId );
+ CleanupStack::PushL( req );
+ req->SetRemoteURIL( aURI );
+ if ( aAnonymous )
+ {
+ req->SetAux( 1 );
+ }
+
+ // handle optional filter document
+ if ( aFilter )
+ {
+ StreamDocumentL( *req, *aFilter );
+ }
+
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+
+ iRequest = MSimpleEngineRequest::ESubscribeGet;
+ iResCount = 0;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::UnsubscribeL
+// ----------------------------------------------------------
+//
+TInt CSimpleWatcher::UnsubscribeL( )
+ {
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: UnsubscribeL opid=%d" ), iSubsId);
+#endif
+ // use the old opid and request
+ CSimpleEngineRequest* req = SearchRequests( iSubsId );
+ if ( !req )
+ {
+ User::Leave( KErrNotFound );
+ }
+ req->ModifyType( MSimpleEngineRequest::ESubscribeStop );
+
+ SendReqL( *req );
+
+ iRequest = MSimpleEngineRequest::ESubscribeStop;
+ iComplete = EFalse;
+ iResCount = 0;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::StreamDocumentL
+// ----------------------------------------------------------
+//
+void CSimpleWatcher::StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleFilterDocument& aFilter )
+ {
+ // add request data
+ // externalize the document a stream
+ iBuffer->Reset();
+ RBufWriteStream stream( *iBuffer );
+ stream.Open( *iBuffer );
+ aFilter.ExternalizeL( stream );
+ stream.Close();
+ aReq.SetRequestData( iBuffer->Ptr(0) );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWatcher::DoCallReqComplete
+// ----------------------------------------------------------
+//
+TInt CSimpleWatcher::DoCallReqComplete(
+ TInt aOpId, TInt aStatus )
+ {
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ iComplete = ETrue;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("Watcher: call WatcherReqCompleteL opid=%d status=%d"),
+ aOpId, aStatus);
+#endif
+ TRAP_IGNORE( iObserver.WatcherReqCompleteL( aOpId, aStatus ));
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return KErrGeneral;
+ }
+ return KErrNone;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/engine/src/simplewinfowatcher.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,407 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32mem.h>
+
+// own simple
+#include "msimpleconnection.h"
+#include "simplecommon.h"
+#include "simpleenginerequest.h"
+#include "msimplewinfo.h"
+#include "msimplefilterdocument.h"
+#include "msimplewinfoobserver.h"
+#include "simplewinfowatcher.h"
+#include "simplexmlfactory.h"
+#include "simplesipconnection.h"
+#include "simpleerrors.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+const TInt KExpandSize = 512;
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::CSimpleWinfoWatcher
+// ----------------------------------------------------------
+//
+CSimpleWinfoWatcher::CSimpleWinfoWatcher(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver )
+: CSimpleClient( aConn ),
+ iObserver( aObserver ),
+ iResCount(0), iComplete( EFalse ),
+ iBuffer(NULL)
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::~CSimpleWinfoWatcher
+// ----------------------------------------------------------
+//
+CSimpleWinfoWatcher::~CSimpleWinfoWatcher()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: Destructor this=%d" ), (TInt)this );
+#endif
+ delete iBuffer;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleWinfoWatcher::ConstructL()
+ {
+ BaseConstructL();
+ iBuffer = CBufFlat::NewL(KExpandSize);
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::NewL
+// ----------------------------------------------------------
+//
+CSimpleWinfoWatcher* CSimpleWinfoWatcher::NewL(
+ MSimpleConnection& aConn,
+ MSimpleWinfoObserver& aObserver )
+ {
+ CSimpleWinfoWatcher* self = new (ELeave) CSimpleWinfoWatcher(
+ aConn, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: NewL this=%d"), (TInt)self );
+#endif
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::Connection
+// ----------------------------------------------------------
+//
+const MSimpleConnection& CSimpleWinfoWatcher::Connection()
+ {
+ return iConn;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::SIPStatus
+// ----------------------------------------------------------
+//
+TUint CSimpleWinfoWatcher::SIPStatus()
+ {
+ return DoSIPStatus();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::SIPRetryAfter
+// ----------------------------------------------------------
+//
+TUint CSimpleWinfoWatcher::SIPRetryAfter()
+ {
+ return DoRetryAfter();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::Close
+// ----------------------------------------------------------
+//
+void CSimpleWinfoWatcher::Close( )
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::NewRequestL
+// ----------------------------------------------------------
+//
+void CSimpleWinfoWatcher::NewRequestL( MSimpleEngineRequest& aReq )
+ {
+ TPtrC8 content = aReq.ResponseData();
+ TPtrC8 contType = aReq.ResponseContentType();
+ TPtrC8 p8;
+ p8.Set( KSimpleWinfoType );
+ TInt mySize = p8.Length();
+
+ if ( !contType.Left(mySize).CompareF(KSimpleWinfoType))
+ {
+ MSimpleWinfo* d = TSimpleXmlFactory::NewWinfoL( content );
+ CleanupClosePushL( *d );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: call WinfoNotificationL"));
+#endif
+ iObserver.WinfoNotificationL( *d );
+ CleanupStack::PopAndDestroy( d );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::Complete
+// ----------------------------------------------------------
+//
+void CSimpleWinfoWatcher::Complete(
+ TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: Complete opid=%d, status=%d" ),
+ aOpId, aStatus );
+#endif
+
+ TBool completeNow( EFalse );
+ MSimpleEngineRequest::TSimpleRequest orig = aReq.RequestType();
+
+ if ( orig == MSimpleEngineRequest::EDestroyStart )
+ {
+ // It's time to delete the request of delayed deletion from both DLLs.
+ // Delete immediately from another DLL.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroy );
+ TRAP_IGNORE( SendReqL( aReq ));
+ // Delete from this DLL,
+ aReq.Destroy();
+ return;
+ }
+
+ GetSIPStatus( aOpId );
+
+ // Reset data buffer
+ iBuffer->Reset();
+
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ MSimpleEngineRequest::TSimpleSIPResponse respMet = aReq.ResponseMethod();
+
+ // Convert KSimpleErrPending to OK when needed
+ if ( aStatus == KSimpleErrPending )
+ {
+ aStatus = KErrNone;
+ }
+
+ // Handle SIP notification first
+ if ( respMet == MSimpleEngineRequest::ENotify )
+ {
+ // This is true in notifications. Ignore some responses.
+ if ( aStatus == KErrCompletion )
+ {
+ iResCount++;
+ }
+ if ( orig != MSimpleEngineRequest::ESubscribeStop )
+ {
+ TRAP_IGNORE( NewRequestL( aReq ) );
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ else if ( iResCount > 1 )
+ {
+ // Stop request is not completed until ok + Notify(terminated) received.
+ // Error completes the stop reqest without Notification.
+ completeNow = ETrue;
+ if ( DoCallReqComplete( aOpId, KErrNone ))
+ {
+ return;
+ }
+ }
+ }
+ else
+ {
+ // SIP Status response or client originated cancellation
+ iResCount++;
+ if ( aStatus != KErrNone )
+ {
+ iResCount++;
+ if ( orig == MSimpleEngineRequest::ESubscribeStop )
+ {
+ // Any response to stop subscribe is ok.
+ aStatus = KErrNone;
+ }
+ }
+
+ if ( !iComplete &&
+ ( orig != MSimpleEngineRequest::ESubscribeStop ||
+ orig == MSimpleEngineRequest::ESubscribeStop && iResCount > 1 ) )
+ {
+ // Stop request is not completed until ok + Notify(terminated) received.
+ // Error completes the stop reqest without Notification.
+ completeNow = ETrue;
+ if ( DoCallReqComplete( aOpId, aStatus ))
+ {
+ return;
+ }
+ }
+ }
+
+ // Delete request when not needed
+ if ( iResCount > 1 )
+ {
+ iRequest = MSimpleEngineRequest::ENone;
+ iComplete = EFalse;
+ TInt reason = ResponseReason( aReq );
+ // Delete corresponding request from another DLL with delay. This decreases
+ // the counter of active subscriptions there.
+ aReq.ModifyType( MSimpleEngineRequest::EDestroyStart );
+ TRAP_IGNORE( SendReqL( aReq ));
+ // call WinfoTerminatedL when needed, i.e. no Stop
+ if ( orig != MSimpleEngineRequest::ESubscribeStop &&
+ !completeNow )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: call WinfoTerminatedL opid=%d"),
+ aOpId );
+#endif
+ TRAP_IGNORE( iObserver.WinfoTerminatedL( aOpId, reason ) );
+ // Check whether an application has called destructor in callback method.
+ // Destructor of CSimpleClient base class will handle deletion of
+ // all the open requests.
+ if ( destroyed )
+ {
+ return;
+ }
+ }
+ // delete request from this DLL later.
+ }
+
+ iDestroyedPtr = NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::SubscribeWatcherListL
+// ----------------------------------------------------------
+//
+TInt CSimpleWinfoWatcher::SubscribeWatcherListL(
+ MSimpleFilterDocument* aFilter )
+ {
+
+ if ( iRequest != MSimpleEngineRequest::ENone )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("winfoWatcher: SubscribeWatcherListL IN-USE **" ) );
+#endif
+ User::Leave( KErrInUse );
+ }
+
+ IncreaseOpId();
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: SubscribeWatcherListL opid=%d"),iOpId);
+#endif
+ CSimpleEngineRequest* req = CSimpleEngineRequest::NewL(
+ *this, MSimpleEngineRequest::ESubscribeWinfo, iOpId );
+ CleanupStack::PushL( req );
+
+ // handle optional filter document
+ if ( aFilter )
+ {
+ StreamDocumentL( *req, *aFilter );
+ }
+
+ SendReqL( *req );
+ iRequestList.AddLast( *req );
+ CleanupStack::Pop( req );
+
+ iRequest = MSimpleEngineRequest::ESubscribeWinfo;
+ iResCount = 0;
+ iSubsId = iOpId;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::UnsubscribeL
+// ----------------------------------------------------------
+//
+TInt CSimpleWinfoWatcher::UnsubscribeL( )
+ {
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: UnsubscribeL opid=%d" ), iSubsId);
+#endif
+ // use the old opid and request
+ CSimpleEngineRequest* req = SearchRequests( iSubsId );
+ if ( !req )
+ {
+ User::Leave( KErrNotFound );
+ }
+ req->ModifyType( MSimpleEngineRequest::ESubscribeStop );
+
+ SendReqL( *req );
+
+ iRequest = MSimpleEngineRequest::ESubscribeStop;
+ iComplete = EFalse;
+ iResCount = 0;
+
+ return iOpId;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::StreamDocumentL
+// ----------------------------------------------------------
+//
+void CSimpleWinfoWatcher::StreamDocumentL(
+ CSimpleEngineRequest& aReq,
+ MSimpleFilterDocument& aFilter )
+ {
+ // add request data
+ // externalize the document a stream
+ iBuffer->Reset();
+ RBufWriteStream stream( *iBuffer );
+ stream.Open( *iBuffer );
+ aFilter.ExternalizeL( stream );
+ stream.Close();
+ aReq.SetRequestData( iBuffer->Ptr(0) );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfoWatcher::DoCallReqComplete
+// ----------------------------------------------------------
+//
+TInt CSimpleWinfoWatcher::DoCallReqComplete(
+ TInt aOpId, TInt aStatus )
+ {
+ // Set the member to point to stack variable
+ TBool destroyed( EFalse );
+ iDestroyedPtr = &destroyed;
+
+ iComplete = ETrue;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("WinfoWatcher: call WinfoReqCompleteL opid=%d status=%d"),
+ aOpId, aStatus);
+#endif
+ TRAP_IGNORE( iObserver.WinfoReqCompleteL( aOpId, aStatus ));
+ // Check whether an application has called destructor in callback method.
+ // Destructor will handle deletion of all the open requests.
+ if ( destroyed )
+ {
+ return KErrGeneral;
+ }
+ return KErrNone;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project simpleengine
+*
+*/
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// CenRep config files
+../Conf/simple.confml MW_LAYER_CONFML(simple.confml)
+../Conf/simple_10281EEE.crml MW_LAYER_CRML(simple_10281eee.crml)
+../Conf/simple_10281EEF.crml MW_LAYER_CRML(simple_10281eef.crml)
+
+
+// backup registry file
+../cenrep/backup_registration.xml z:/private/10281eeb/backup_registration.xml
+
+// IBYs
+../rom/simpleengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(simpleengine.iby)
+../rom/simpleengineresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(simpleengineresources.iby)
+
+// LOC (note: This would be better in presenceprovisioning's bld.inf, but since it is not used, it is here.)
+../presenceprovisioning/loc/presenceprovadapter.loc MW_LAYER_LOC_EXPORT_PATH(presenceprovadapter.loc)
+
+PRJ_MMPFILES
+../presencesettingsapi/group/presencesettingsapi.mmp
+../siputils/group/simplesiputils.mmp
+../xmlutils/group/simplexmlutils.mmp
+../engine/group/simpleengine.mmp
+../xdmrlspres/group/rlspresxdm.mmp
+../presencedm/group/presencedmadapter.mmp
+../presenceprovisioning/group/presenceprovisioning.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/inc/msimpleenginerequest.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for WV engine service APIs.
+*
+*/
+
+
+
+#ifndef M_simpleenginerequest_H
+#define M_simpleenginerequest_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "simplecommon.h"
+
+
+/**
+ * Abstarct API for request handling in SIMPLE engine core and SIMPLE SIP LIB communication.
+ *
+ * @lib simpleengine
+ * @since S60 v3.2
+ */
+class MSimpleEngineRequest
+ {
+public:
+
+ /** Request type */
+ enum TSimpleRequest
+ {
+ /** None */
+ ENone=0,
+ /** SIP Register */
+ ERegister,
+ /** SIP Publish */
+ EStartPublish,
+ /** SIP modify Publish */
+ EPublishModify,
+ /** SIP Subscribe */
+ ESubscribe,
+ /** SIP list Subscribe */
+ ESubscribeLista,
+ /** SIP Subscribe Get (once) */
+ ESubscribeGet,
+ /** SIP subscribe WINFO */
+ ESubscribeWinfo,
+ /** SIP Unsubscribe */
+ ESubscribeStop,
+ /** SIP Dialog (notify, status) */
+ EDialog,
+ /** SIP Publish stop */
+ EStopPublish,
+ /** Listen to event states */
+ EListenEvents,
+ /** Destroy the object */
+ EDestroy,
+ /** Destroy the object with a delay */
+ EDestroyStart,
+ /** SIP Subscrption-state */
+ ESubscriptionState,
+ /** SIP send IM */
+ ESendIM,
+ /** SIP receive IM */
+ EReceiveIM
+ };
+
+ /** SIP response/request message */
+ enum TSimpleSIPResponse
+ {
+ /** None */
+ EUnknownResponse=0,
+ /** SIP NOTIFY */
+ ENotify,
+ /** SIP status */
+ EStatus,
+ /** ETag update only in status in refresh response */
+ EStatusETag
+ };
+
+ /** NOTIFY response reason */
+ enum TSimpleResponseReason
+ {
+ /** unknown reason */
+ ENoReason,
+ /** Application SHOULD re-subscribe later. */
+ EDeactivated,
+ /** Application SHOULD re-subscribe later. */
+ EProbation,
+ /** The subscription has been terminated due to change in
+ authorization policy.
+ Application SHOULD NOT attempt to re-subscribe. */
+ ERejected,
+ /** The subscription has been terminated because it was not
+ refreshed before it expired. Application MAY re-subscribe
+ later. */
+ ETimeout,
+ /** The subscription has been terminated because the notifier
+ could not obtain authorization in a timely fashion.
+ Application MAY re-subscribe later. */
+ EGiveup,
+ /** The subscription has been terminated because the resource
+ state which was being monitored no longer exists.
+ Application SHOULD NOT attempt to re-subscribe. */
+ ENoresource
+ };
+
+ /** SIP subscription-state */
+ enum TSimpleSipSubscriptionState
+ {
+ ESimpleStateNone=0,
+ ESimpleStatePending,
+ ESimpleStateActive,
+ ESimpleStateTerminated
+ };
+
+
+ /**
+ * Destructor
+ * @since S60 3.2
+ */
+ virtual void Destroy() = 0;
+
+ /**
+ * Request type accessor
+ * @since S60 3.2
+ * @return request type
+ */
+ virtual TSimpleRequest RequestType() = 0;
+
+ /**
+ * Request type accessor
+ * @since S60 3.2
+ * @param aType request type
+ */
+ virtual void ModifyType( TSimpleRequest aType ) = 0;
+
+ /**
+ * Complete the open request
+ * @since S60 3.2
+ * @param aStatus result status
+ */
+ virtual void Complete( TInt aStatus ) = 0;
+
+ /**
+ * Request data type accessor
+ * @since S60 3.2
+ * @return request data content type
+ */
+ virtual TPtrC8 RequestContentType() = 0;
+
+ /**
+ * Request data accessor
+ * @since S60 3.2
+ * @return request data payload
+ */
+ virtual TPtrC8 RequestData() = 0;
+
+ /**
+ * Response data type setter.
+ * @since S60 3.2
+ * @param aData content that is NOT copied, ownership is transferred
+ */
+ virtual void SetResponseContentType( HBufC8* aData ) = 0;
+
+ /**
+ * Response data MIME multipart boundary setter.
+ * @since S60 3.2
+ * @param aData boundary
+ */
+ virtual void SetResponseBoundaryL( const TDesC8& aData ) = 0;
+
+ /**
+ * Response data MIME multipart start content-id setter
+ * @since S60 3.2
+ * @param aData content-id
+ */
+ virtual void SetResponseStartL( const TDesC8& aData ) = 0;
+
+ /**
+ * Response data setter.
+ * @since S60 3.2
+ * @param aData content that is to be copied.
+ */
+ virtual void SetResponseDataL( const TDesC8& aData ) = 0;
+
+ /**
+ * Response method setter.
+ * @since S60 3.2
+ * @param aMethod a method
+ */
+ virtual void SetResponseMethod( TSimpleSIPResponse aMethod ) = 0;
+
+ /**
+ * Aux data setter.
+ * @since S60 3.2
+ * @param aData data
+ */
+ virtual void SetAux( TInt aData ) = 0;
+
+ /**
+ * Server response/request method accessor
+ * @return SIP method
+ */
+ virtual TSimpleSIPResponse ResponseMethod() = 0;
+
+ /**
+ * Response data type accessor
+ * @since S60 3.2
+ * @return content type
+ */
+ virtual TPtrC8 ResponseContentType() = 0;
+
+ /**
+ * Response data MIME multipart boundary getter.
+ * @since S60 3.2
+ * @return data boundary
+ */
+ virtual TPtrC8 ResponseBoundary( ) = 0;
+
+ /**
+ * Response data MIME multipart start content-id getter
+ * @since S60 3.2
+ * @return start content-id
+ */
+ virtual TPtrC8 ResponseStart( ) = 0;
+
+ /**
+ * Response data accessor
+ * @since S60 3.2
+ * @return response data payload
+ */
+ virtual TPtrC8 ResponseData() = 0;
+
+ /**
+ * Refresh time accessor
+ * @since S60 3.2
+ * @return refresh time in seconds, 0 means query once
+ */
+ virtual TUint RefreshTime() = 0;
+
+ /**
+ * Refresh time setter
+ * @since S60 3.2
+ * @param aTime time in seconds, 0 means query once
+ */
+ virtual void SetRefreshTime( TUint aTime) = 0;
+
+ /**
+ * Remote URI accessor
+ * @since S60 3.2
+ * @return remote URI
+ */
+ virtual TPtrC8 RemoteURI() = 0;
+
+ /**
+ * Remote URI setter
+ * @since S60 3.2
+ * @param aURI remote URI
+ */
+ virtual void SetRemoteURIL( const TDesC8& aURI ) = 0;
+
+ /**
+ * Get refresh parameter
+ * @since S60 3.2
+ * return ETrue if refresh
+ */
+ virtual TBool IsRefresh() = 0;
+
+ /**
+ * Refresh parameter setter
+ * @since S60 3.2
+ * @param aRefresh refresh boolean value
+ */
+ virtual void SetRefresh( TBool aRefresh ) = 0;
+
+ /**
+ * Operation id getter
+ * @since S60 3.2
+ * @return operation id
+ */
+ virtual TInt OpId( ) = 0;
+
+ /**
+ * auxiliary parameter needed sometimes
+ * @since S60 3.2
+ * @return aux number
+ */
+ virtual TInt Aux() = 0;
+
+ /**
+ * SIP Response reason setter
+ * @since S60 3.2
+ * @param aReason reason
+ */
+ virtual void SetResponseReason( TSimpleResponseReason aReason ) = 0;
+
+ /**
+ * SIP Response reason getter
+ * @since S60 3.2
+ * @return aReason reason
+ */
+ virtual TSimpleResponseReason ResponseReason() = 0;
+
+ /**
+ * Set SIP-ETag value
+ *
+ * @since S60 3.2
+ * @param aTag tag
+ */
+ virtual void SetETagL( const TDesC8& aTag ) = 0;
+
+ /**
+ * get SIP-ETag value
+ *
+ * @since S60 3.2
+ * @return SIP-ETag value.
+ */
+ virtual TPtrC8 ETag() = 0;
+
+ /**
+ * IM message recipient setter
+ *
+ * @since S60 5.0
+ * @param aRecipientId recipient ID
+ */
+ virtual void SetRecipientL( const TDesC8& aRecipientId ) = 0;
+
+ /**
+ * IM message recipient getter
+ *
+ * @since S60 5.0
+ * @return recipient ID
+ */
+ virtual TPtrC8 Recipient() = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/inc/msimpleowncallback.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for WV engine service APIs.
+*
+*/
+
+
+
+#ifndef M_simpleowncallback_H
+#define M_simpleowncallback_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+class MSimpleEngineRequest;
+
+
+/**
+ * Abstarct API for SIMPLE engine core and SIMPLE SIP LIB communication.
+ *
+ * @lib simpleengine
+ * @since S60 v3.2
+ */
+class MSimpleOwnCallback
+ {
+public:
+
+ /**
+ * Complete the open client request
+ * @since S60 3.2
+ * @param aOpId operation id
+ * @param aStatus result status
+ * @param aReq client request
+ */
+ virtual void Complete( TInt aOpId, TInt aStatus,
+ MSimpleEngineRequest& aReq ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/inc/simplecommon.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for WV engine service APIs.
+*
+*/
+
+
+
+#ifndef SimpleCommon_H
+#define SimpleCommon_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+const TInt KRangeSize = 100; // range of operation ids for each client handle
+
+const TUint KSimpleOK = 200; // return code for SIP
+const TUint KCreatedOK = 201; // return code for SIP
+const TUint KSimpleAccepted = 202; // return code for SIP
+
+_LIT8 ( KSimpleApplicationType, "application");
+_LIT8 ( KSimpleMultiType, "multipart");
+_LIT8 ( KSimplePidfSubType, "pidf+xml");
+_LIT8 ( KSimpleListSubType, "rlmi+xml");
+_LIT8 ( KSimpleMultipartSubType, "related");
+_LIT8 ( KSimpleWinfoSubType, "watcherinfo+xml");
+_LIT8 ( KSimpleDocumentType, "application/pidf+xml");
+_LIT8 ( KSimpleListType, "application/rlmi+xml");
+_LIT8 ( KSimpleWinfoType, "application/watcherinfo+xml");
+_LIT8 ( KSimpleSubscribeSubType, "simple-filter+xml");
+_LIT8 ( KSimpleMultipartType, "multipart/related");
+_LIT8 ( KSimplePRESENCE, "PRESENCE");
+_LIT8 ( KSimplePUBLISH, "PUBLISH" );
+_LIT8 ( KSimpleNOTIFY, "NOTIFY" );
+_LIT8 ( KSimpleSTATUS, "STATUS" );
+_LIT8 ( KSimpleSipIfMatch, "SIP-If-Match");
+_LIT8 ( KSimpleETag, "SIP-ETag");
+_LIT8 ( KSimplePrivacy, "Privacy");
+_LIT8 ( KSimplePIdentity, "P-Preferred-Identity");
+
+_LIT8 ( KSimpleMediaType, "text" ); // the 1st part of content type of IM
+_LIT8 ( KSimpleMediaSubType, "plain" ); // the 2nd part of content type of IM
+
+// OMA data specifications
+_LIT8 ( KSimpleXmlStart, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
+_LIT8 ( KDocumentLocalName, "presence" );
+_LIT8 ( KFilterLocalName, "filter-set" );
+_LIT8 ( KWinfoLocalName, "watcherinfo" );
+_LIT8 ( KRlmiLocalName, "list" );
+
+// DATA TYPES
+
+enum TSimpleSipState
+ {
+ /** Connection initializing */
+ ESimpleSipIdle=1,
+ /** Connection active */
+ ESimpleSipActive,
+ /** Connection suspended */
+ ESimpleSipSuspend,
+ /** Connection is inactive */
+ ESimpleSipInactive,
+ /** Connection is permanently unavailable */
+ ESimpleSipUnavailable
+ };
+
+
+// Notice: Remove the hard coded values later, and values not needed
+namespace NSimpleDocument
+ {
+ _LIT8( KBoundary, "--%S\r\n");
+ _LIT8( KEndBoundary, "--%S--");
+ _LIT8( KSimpleBoundary, "simple-1" ); // Notice: static now.
+ _LIT8( KSimpleAvatarContent8, "simpleavatar.nokia.com" ); // notice: static now, supports only one
+ _LIT8( KSimpleAvatarCID8, "<simpleavatar.nokia.com>" ); // notice: static now, supports only one
+ // const TInt boundarySize = 4;
+ const TInt KSimpleBoundarySize = 8;
+ // const TInt KContentTypeSize_only = 14; // Length of "content-type: "
+ namespace NSimpleMulti
+ {
+ // 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123
+ _LIT8( KContentType, "Content-Type: multipart/related; type=\"application/pidf+xml\"; start=\"<1.simple.nokia.com>\"; boundary=\"%S\"\r\n");
+ _LIT8( KContentTypeFullValue, "multipart/related; type=\"application/pidf+xml\"; start=\"<1.simple.nokia.com>\"; boundary=\"simple-1\"\r\n");
+ _LIT8( KContentTypeValue, "multipart/related; type=\"application/pidf+xml\"; start=\"<1.simple.nokia.com>\"; boundary=\"%S\"\r\n");
+ _LIT8( KBoundaryHeader, "boundary=--%S\r\n");
+ const TInt KContentTypeSize = 85; // 93 - 8 = 85
+ const TInt KBoundaryHeaderSize = 13;
+ }
+ namespace NSimpleRoot
+ { // 12345678901234567890123456789012345678
+ _LIT8( KContentType, "Content-Type: application/pidf+xml\r\n");
+ _LIT8( KCID, "Content-ID: <1.simple.nokia.com>\r\n"); // notice: use tag and not static id
+ // 12345678901234567890123456789012345678
+ const TInt KContentTypeSize = 36; // 38 - 2
+ const TInt KCIDSize = 34; // 36-2
+ }
+ namespace NSimpleContent
+ {
+ _LIT8( KContentType, "Content-Type: %S\r\n");
+ _LIT8( KCID, "Content-ID: <%S>\r\n"); // notice: use tag and not static id
+ _LIT8( KContentEncoding, "Content-Transfer-Encoding: BASE64\r\n");
+ // 12345678901234567890123456789012345678
+ const TInt KContentTypeSize = 16; // 20 - 4
+ const TInt KCIDSize = 16; // 20-4
+ const TInt KContentEncodingSize = 35;
+ }
+ }
+
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/inc/simpleengineprivatecrkeys.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine CenRep keys
+*
+*/
+
+
+
+#ifndef SIMPLEENGINEPRIVATECRKEYS_H
+#define SIMPLEENGINEPRIVATECRKEYS_H
+
+const TUid KCRUIDSimpleVariation = {0x10281EEF};
+
+// Suggested publish refresh time (sec)
+const TUint32 KSimplePublishRefresh = 0x00000001;
+// Suggested subscribe refresh time (sec)
+const TUint32 KSimpleSubscribeRefresh = 0x00000002;
+// Suggested subscribe WINFO refresh time
+const TUint32 KSimpleSubscribeWinfoRefresh = 0x00000003;
+// Expiry time of API requests (sec)
+const TUint32 KSimpleExpiryTime = 0x00000004;
+
+#endif // SIMPLEENGINEPRIVATECRKEYS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/data/10282415.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 1028 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Ecom plugin resource file for Presence Device Management
+*
+*/
+
+
+
+
+#include <registryinfo.rh>
+#define KSmlDMInterfaceUid 0x102018B4
+
+RESOURCE REGISTRY_INFO thePresDMRegistryInfo
+ {
+ dll_uid = 0x10282415; // The DLL's 3rd UID.
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KSmlDMInterfaceUid; // KSmlDMInterfaceUid, DM interface
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10282416; // OMA Presence DM implementation UID
+ version_no = 1;
+ display_name = "";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project PresenceDM.dll
+*
+*/
+
+
+
+
+//--------------------
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+presencedmadapter.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/group/presencedmadapter.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA Presence Device Management adapter's mmp file
+*
+*/
+
+
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET presencedm.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10282415
+VENDORID VID_DEFAULT
+CAPABILITY CAP_ECOM_PLUGIN
+LANGUAGE_IDS
+
+// default system include paths for middleware layer modules
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+USERINCLUDE ../inc
+
+SOURCEPATH ../src
+SOURCE presencedmadapterproxy.cpp
+SOURCE presencedmadapter.cpp
+
+SOURCEPATH ../data
+START RESOURCE 10282415.rss
+TARGET presencedm.rsc
+END
+
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY presencesettingsapi.lib
+LIBRARY charconv.lib
+LIBRARY nsmldmclientserverutils.lib
+LIBRARY commonengine.lib
+LIBRARY bafl.lib
+
+DEBUGLIBRARY flogger.lib
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/inc/presencedmadapter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA Presence Settings Device Management Adapter
+*
+*/
+
+
+
+
+#ifndef __PRESDMADAPTER_H__
+#define __PRESDMADAPTER_H__
+
+// Non-local includes
+#include <e32base.h>
+#include <smldmadapter.h>
+#include <pressettingsapi.h>
+
+// LITERALS
+_LIT8(KPresDMDDFVersion, "1.0");
+
+_LIT8(KPresDMIdentifier, "org.openmobilealliance/1.0/PRESENCE");
+_LIT8(KPresDMNodeName, "OMA_PRESENCE");
+
+// OMA Presence DM leaves
+_LIT8(KPresDMName, "NAME");
+_LIT8(KPresDMProviderId, "PROVIDER-ID");
+_LIT8(KPresDMClientObjDataLim, "CLIENT-OBJ-DATA-LIMIT");
+_LIT8(KPresDMContentSrvUri, "CONTENT-SERVER-URI");
+_LIT8(KPresDMSrcThPublish, "SOURCE-THROTTLE-PUBLISH");
+_LIT8(KPresDMMaxPresSubs, "MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS");
+_LIT8(KPresDMMaxPresSubsInLists, "MAX-NUMBER-OF-SUBSCRIPTIONS-IN-PRESENCE-LIST");
+_LIT8(KPresDMServiceUriTemp, "SERVICE-URI-TEMPLATE");
+
+// For holding additional S60 Presence leaves
+_LIT8(KPresDMToConRef, "ToConRef");
+_LIT8(KPresDMConRef, "ConRef");
+
+// S60 additional leaves
+_LIT8(KPresDMSIPProfile, "SIP-PROFILE");
+_LIT8(KPresDMXDMSet, "XDM-SET");
+
+// Descriptions
+_LIT8(KPresDMNodeNameDescription, "This interior node acts as a placeholder for one or more accounts for a fixed node" );
+_LIT8(KPresDMNameDescription, "User displayable name for the presence enabler");
+_LIT8(KPresDMProviderIdDescription, "An identifier for the Presence application service access point");
+_LIT8(KPresDMClientObjDataLimDescription, "Limits the size of the MIME object data to the specified value in bytes when PUBLISH and NOTIFY methods are used in the presence client");
+_LIT8(KPresDMContentSrvUriDescription, "Defines the HTTP URI of the content server to be used for content indirection");
+_LIT8(KPresDMSrcThPublishDescription, "Defines the minimum time interval (in seconds) between two consecutive publications from a Presence source");
+_LIT8(KPresDMMaxPresSubsDescription, "Limits the total number of presence subscriptions");
+_LIT8(KPresDMMaxPresSubsInListsDescription, "Limits the number of back-end subscriptions allowed for presence list");
+_LIT8(KPresDMServiceUriTempDescription, "Defines the syntax of the service URI, in the form of a URI Template as specified in XDM Core Specification [XDMSPEC] subclause C.1");
+
+_LIT8(KPresDMToConRefDescription, "Refers to a collection of connectivity definitions" );
+_LIT8(KPresDMConRefDescription, "Indicates the linkage to connectivity parameters" );
+
+_LIT8(KPresDMSIPProfileDescription, "SIP profile used");
+_LIT8(KPresDMXDMSetDescription, "XDM settings set used");
+
+_LIT8(KPresDmDynamicDescription, "Placeholder for one or more connectivity parameters");
+
+
+// other constants
+_LIT8(KPresDMTextPlain, "text/plain" );
+_LIT8(KPresDMSeparator, "/" );
+_LIT( KPresDMOpenBrack, "(" );
+_LIT( KPresDMCloseBrack, ")" );
+
+_LIT8(KPresDMSipLinkPrefix, "./SIP");
+_LIT8(KPresDMSipIdPrefix, "SIPId");
+
+_LIT8(KPresDMSipDMNode, "SIP"); // as specified in OMA SIP
+_LIT8(KPresDMXdmDMNode, "OMA_XDM"); // as specified in OMA XDM
+
+// CONSTANTS
+const TInt KPresDMLogBufferMaxSize = 2000;
+const TInt KPresDMDefaultResultSize = 255;
+const TInt KPresDMLevel = 2;
+const TInt KPresDMHexLength = 8;
+const TUint8 KPresDMObjectSizeWidth = 4;
+const TUint8 KPresDMSeparatorDef = 0x2f; // forward slash
+const TInt KPresDMMaxIntLength = 10; // max length of 32bit integer
+const TInt KPresSipIdLinkLength = 19;
+
+/**
+* The main class of the OMA Presence DM adapter. Handles
+* requests of fetching and updating settings sets and
+* settings items.
+*
+* @since S60 3.2
+*/
+class CPresenceDMAdapter : public CSmlDmAdapter
+ {
+ public:
+
+ /**
+ * Symbian first phase constructor
+ *
+ * @since S60 3.2
+ * @param MSmlDmCallback* aDmCallback
+ * @return pointer to newly created CPresenceDMAdapter
+ */
+ static CPresenceDMAdapter* NewL( MSmlDmCallback* aDmCallback );
+
+ /**
+ * Destructor
+ */
+ ~CPresenceDMAdapter();
+
+ // Adapter interface from CSmlDmAdapter, see CSmlDmAdapter
+ void DDFVersionL(CBufBase& aDDFVersion);
+ void DDFStructureL(MSmlDmDDFObject& aDDF);
+ void UpdateLeafObjectL(const TDesC8& aUri, const TDesC8& aLUID,
+ const TDesC8& aObject, const TDesC8& aType,
+ TInt aStatusRef);
+ void DeleteObjectL(const TDesC8& aUri, const TDesC8& aLUID,
+ const TInt aStatusRef);
+ void FetchLeafObjectL(const TDesC8& aUri, const TDesC8& aLUID,
+ const TDesC8& aType, const TInt aResultsRef,
+ const TInt aStatusRef);
+ void ChildURIListL(const TDesC8& aUri, const TDesC8& aLUID,
+ const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
+ const TInt aResultsRef, const TInt aStatusRef);
+ void AddNodeObjectL(const TDesC8& aUri, const TDesC8& aParentLUID,
+ const TInt aStatusRef);
+ void UpdateLeafObjectL(const TDesC8& aUri, const TDesC8& aLUID,
+ RWriteStream*& aStream, const TDesC8& aType,
+ const TInt aStatusRef);
+ void FetchLeafObjectSizeL(const TDesC8& aUri, const TDesC8& aLUID,
+ const TDesC8& aType, const TInt aResultsRef,
+ const TInt aStatusRef);
+ void ExecuteCommandL(const TDesC8& aUri, const TDesC8& aLUID,
+ const TDesC8& aArgument, const TDesC8& aType,
+ const TInt aStatusRef);
+ void ExecuteCommandL(const TDesC8& aUri, const TDesC8& aLUID,
+ RWriteStream*& aStream, const TDesC8& aType,
+ const TInt aStatusRef);
+ void CopyCommandL(const TDesC8& aTargetURI, const TDesC8& aTargetLUID,
+ const TDesC8& aSourceURI, const TDesC8& aSourceLUID,
+ const TDesC8& aType, TInt aStatusRef);
+ void StartAtomicL();
+ void CommitAtomicL();
+ void RollbackAtomicL();
+ TBool StreamingSupport(TInt& aItemSize);
+ void StreamCommittedL();
+ void CompleteOutstandingCmdsL();
+
+ private:
+
+ /**
+ * Default constructor
+ *
+ * @since S60 3.2
+ * @param aDmCallback Pointer to callback interface
+ */
+ CPresenceDMAdapter( MSmlDmCallback* aDmCallback );
+
+ /**
+ * Fetches an object from the given uri
+ *
+ * @since S60 3.2
+ * @param aUri Uri to the fetched object
+ * @param aObject The result is inserted to this buffer
+ * @return Error code
+ */
+ CSmlDmAdapter::TError FetchObjectL(const TDesC8& aUri, CBufBase& aObject);
+
+ /**
+ * Updates the parameters of given DDF node
+ *
+ * @since S60 3.2
+ * @param aNode The node to update.
+ * @param aAccTypes Access types of the node.
+ * @param aOccurrence Occurrance of the node.
+ * @param aScope Scope of the node.
+ * @param aFormat Format of the node.
+ * @param aDescription A description of the node.
+ */
+ void FillNodeInfoL(MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes,
+ MSmlDmDDFObject::TOccurence aOccurrence,
+ MSmlDmDDFObject::TScope aScope,
+ MSmlDmDDFObject::TDFFormat aFormat,
+ const TDesC8& aDescription);
+
+ /**
+ * Get property from settings storage
+ *
+ * @since S60 3.2
+ * @param aSetId unique id of the settings set
+ * @param aProperty type of asked property
+ * @param aObject returns property value
+ * @return CSmlDmAdapter::EOk if successfull
+ */
+ CSmlDmAdapter::TError GetPropertyL( TInt aSetId,
+ TPresSettingsProperty aProperty,
+ CBufBase& aObject );
+
+ /**
+ * Create/update settings property
+ *
+ * @since S60 3.2
+ * @param aSetId unique id of the settings set
+ * @param aProperty type of property
+ * @param aObject property value
+ * @return CSmlDmAdapter::EOk if successfull
+ */
+ CSmlDmAdapter::TError UpdatePropertyL( TInt aSetId,
+ TPresSettingsProperty aProperty,
+ const TDesC8& aObject );
+
+ /**
+ * Compares strings
+ *
+ * @since S60 3.2
+ * @param aLeft first string
+ * @param aRight second string
+ * @return True if the strings are identical
+ */
+ TBool Match( const TDesC8& aLeft, const TDesC8& aRight );
+
+ /**
+ * Finds uri based on SIP id, updates result
+ *
+ * @since S60 3.2
+ * @param aSipID SIP ID
+ * @param aObject object to be updated
+ * @return Ok or Error
+ */
+ CPresenceDMAdapter::TError GetConRefFromSipIDL( TInt aSipID,
+ CBufBase& aObject );
+
+ /**
+ * Finds uri based on XDM id, updates result
+ *
+ * @since S60 3.2
+ * @param aXdmID XDM ID
+ * @param aObject object to be updated
+ * @return Ok or Error
+ */
+ CPresenceDMAdapter::TError GetConRefFromXdmIDL( TInt aXdmID,
+ CBufBase& aObject );
+
+ /**
+ * Find SIP id based on uri
+ *
+ * @since S60 3.2
+ * @param aUri uri of the wanted object
+ * @return SIP id or KErrNotFound
+ */
+ TInt GetSipIdFromConRefL(const TDesC8& aUri );
+
+ /**
+ * Find XDM id based on uri
+ *
+ * @since S60 3.2
+ * @param aUri uri of the wanted object
+ * @return XDM id or KErrNotFound
+ */
+ TInt GetXdmIdFromConRefL(const TDesC8& aUri );
+
+ /**
+ * Finds whether the given persence id is valid or not
+ *
+ * @since S60 3.2
+ * @param aSetId presence id to check
+ * @return ETrue if valid
+ */
+ TBool IsPresIDValidL(TInt aSetId);
+
+ /**
+ * Check presence settings duplicate names, provides alternate name
+ * if necessary
+ *
+ * @since S60 3.2
+ * @param aSetId presence id
+ * @param aSetName presence set name needs to be checked,
+ * alternate name returns here
+ * @return none
+ */
+ void CheckDuplicateNameL(TDes& aSetName, const TInt& aSetId);
+
+ /**
+ * sets the proper length of presence settings discriptor items,
+ * give shorter descriptor if necessary
+ *
+ * @since S60 3.2
+ * @param aValue presence settings descriptor item to be evaluated
+ * @param aProp which property this descriptor belongs to.
+ * @return ETrue if name is validated, EFalse if it cant be validated
+ */
+ TBool SetProperLength(TPresSettingsProperty aProp, TPtr& aValue);
+
+ /**
+ * Checks if there is ordinal numbering at the end of
+ * descriptor and rips it off if there is.
+ *
+ * @param aName pointer to source descriptor
+ * @return HBufC* containing the name ready for the numbering
+ */
+ HBufC* GetPrefixL( HBufC* aName );
+
+ /**
+ * 8 bit descriptor to integer
+ *
+ * @since S60 3.2
+ * @param aLuid Descriptor to convert
+ * @return TInt converted integer
+ */
+ TInt DesToInt( const TDesC8& aLuid ) const;
+
+ /**
+ * Integer to 8 bit descriptor, leaves pointer to stack
+ *
+ * @since S60 3.2
+ * @param aLuid Integer to convert
+ * @return HBufC8* 8 bit heap pointer to descriptor
+ */
+ HBufC8* IntToDes8LC( const TInt aLuid ) const;
+
+ /**
+ * Integer to 16 bit descriptor, leaves pointer to stack
+ *
+ * @since S60 3.2
+ * @param aLuid Integer to convert
+ * @return HBufC* 16 bit heap pointer to descriptor
+ */
+ HBufC* IntToDesLC( const TInt aLuid ) const;
+
+ /**
+ * 16 bit descriptor to 8 bit descriptor, leaves pointer to stack
+ *
+ * @since S60 3.2
+ * @param aSource 16 bit descriptor to convert
+ * @return HBufC8* pointer to 8 bit heap descriptor
+ */
+ HBufC8* ConvertLC(const TDesC& aSource) const;
+
+ /**
+ * 8 bit descriptor to 16 bit descriptor, leaves pointer to stack
+ *
+ * @since S60 3.2
+ * @param aSource 8 bit descriptor to convert
+ * @return HBufC* pointer to 16 bit heap descriptor
+ */
+ HBufC* ConvertLC(const TDesC8& aSource) const;
+
+ private: // Data
+
+ /**
+ * Settings ID of presence set which is in cache
+ */
+ TInt iGetSetID;
+
+ /**
+ * Presence set which is in cache
+ */
+ TPresSettingsSet iGetSet;
+
+ };
+
+#endif // __PRESDMADAPTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/inc/presencedmlogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA Presence Settings Device Management Adapter
+*
+*/
+
+
+
+
+#ifndef _PRESENCE_DM_LOGGER_H
+#define _PRESENCE_DM_LOGGER_H
+
+
+// logging is done only in debug
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+//Logging constants
+_LIT(KPresDMLogDir, "presenceota");
+_LIT(KPresDMLogFile, "presencedmlog.txt");
+
+#define LOG_LIT(s) _L(s)
+#define LOG_LIT8(s) _L8(s)
+#define PRES_DM_LOG DebugWriteFormat
+
+
+/**
+* Log file printing utility function for presence DM
+* @since Series 60 3.2
+*/
+inline void DebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf< 300 > buffer;
+ buffer.FormatList( aFmt, list );
+ RFileLogger::Write( KPresDMLogDir, KPresDMLogFile, EFileLoggingModeAppend, buffer );
+ }
+
+/**
+* Log file printing utility function for presence DM
+* @since Series 60 3.2
+*/
+inline void DebugWriteFormat( TRefByValue<const TDesC8> aFmt,...) //lint !e960
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf8<300> buffer;
+ buffer.FormatList( aFmt, list );
+ RFileLogger::Write( KPresDMLogDir, KPresDMLogFile, EFileLoggingModeAppend, buffer );
+ }
+
+#else // _DEBUG ( For Release code )
+
+struct LogEmptyDebugString { };
+
+#define LOG_LIT(s) LogEmptyDebugString()
+#define LOG_LIT8(s) LogEmptyDebugString()
+
+// Empty debug print functions for release builds.
+inline void PRES_DM_LOG(LogEmptyDebugString)
+ {
+ }
+
+template<class T1>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1)
+ {
+ }
+
+template<class T1,class T2>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2)
+ {
+ }
+
+template<class T1,class T2,class T3>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3,T4)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
+inline void PRES_DM_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
+ {
+ }
+
+#endif // _DEBUG
+
+
+#endif // _PRESENCE_DM_LOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/src/presencedmadapter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1437 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA Presence Settings Device Management Adapter's source file
+*
+*/
+
+#include <implementationproxy.h>
+#include <nsmldmuri.h>
+#include <utf.h>
+#include <badesca.h>
+#include <StringLoader.h>
+
+#include "presencedmadapter.h"
+#include "presencedmlogger.h"
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::NewL()
+// -----------------------------------------------------------------------------
+//
+CPresenceDMAdapter* CPresenceDMAdapter::NewL(MSmlDmCallback* aDmCallback )
+ {
+ PRES_DM_LOG(LOG_LIT("NewL start"));
+ CPresenceDMAdapter* self = new (ELeave) CPresenceDMAdapter( aDmCallback );
+ PRES_DM_LOG(LOG_LIT(" NewL end"));
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::CPresenceDMAdapter()
+// -----------------------------------------------------------------------------
+//
+CPresenceDMAdapter::CPresenceDMAdapter(MSmlDmCallback* aDmCallback) :
+ CSmlDmAdapter( aDmCallback ), iGetSetID(KErrNotFound)
+ {
+ PRES_DM_LOG(LOG_LIT("CPresenceDMAdapter"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::~CPresenceDMAdapter()
+// -----------------------------------------------------------------------------
+//
+CPresenceDMAdapter::~CPresenceDMAdapter()
+ {
+ PRES_DM_LOG(LOG_LIT("~CPresenceDMAdapter"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::DDFVersionL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::DDFVersionL(CBufBase& aDDFVersion)
+ {
+ PRES_DM_LOG(LOG_LIT("DDFVersionL"));
+ aDDFVersion.InsertL( 0, KPresDMDDFVersion );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::DDFStructureL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+ {
+ PRES_DM_LOG(LOG_LIT("DDFStructureL"));
+
+ // For OMA_PRESENCE
+ TSmlDmAccessTypes accessTypeGet;
+ accessTypeGet.SetGet();
+
+ // For OMA_PRESENCE/<X>
+ TSmlDmAccessTypes accessTypeAll;
+ accessTypeAll.SetAdd();
+ accessTypeAll.SetGet();
+ accessTypeAll.SetReplace();
+ accessTypeAll.SetDelete();
+
+ // For leaf nodes
+ TSmlDmAccessTypes accessTypeNoDelete;
+ accessTypeNoDelete.SetAdd();
+ accessTypeNoDelete.SetGet();
+ accessTypeNoDelete.SetReplace();
+
+ // ./OMA_PRESENCE
+ MSmlDmDDFObject& omaPresNode = aDDF.AddChildObjectL( KPresDMNodeName );
+ FillNodeInfoL( omaPresNode, accessTypeGet, MSmlDmDDFObject::EOne,
+ MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode,
+ KPresDMNodeNameDescription );
+
+ // ./OMA_PRESENCE/<X>
+ MSmlDmDDFObject& runTimeNode = omaPresNode.AddChildObjectGroupL();
+ FillNodeInfoL( runTimeNode, accessTypeAll, MSmlDmDDFObject::EZeroOrMore,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KPresDmDynamicDescription );
+
+ // ./OMA_PRESENCE/<X>/NAME
+ MSmlDmDDFObject& nameNode = runTimeNode.AddChildObjectL( KPresDMName );
+ FillNodeInfoL( nameNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KPresDMNameDescription );
+
+ // ./OMA_PRESENCE/<X>/PROVIDER-ID
+ MSmlDmDDFObject& providerIdNode = runTimeNode.AddChildObjectL( KPresDMProviderId );
+ FillNodeInfoL( providerIdNode, accessTypeNoDelete,MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KPresDMProviderIdDescription );
+
+ // ./OMA_PRESENCE/<X>/ToConRef
+ MSmlDmDDFObject& toConRefNode = runTimeNode.AddChildObjectL( KPresDMToConRef );
+ FillNodeInfoL( toConRefNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KPresDMToConRefDescription);
+
+ // ./OMA_PRESENCE/<X>/ToConRef/SIP-PROFILE (Towards SIP ID)
+ MSmlDmDDFObject& napIdSIPNode = toConRefNode.AddChildObjectL( KPresDMSIPProfile );
+ FillNodeInfoL( napIdSIPNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KPresDMSIPProfileDescription );
+
+ // ./OMA_PRESENCE/<X>/ToConRef/SIP-PROFILE/ConRef (The actual SIP ID)
+ MSmlDmDDFObject& conRefSipNode = napIdSIPNode.AddChildObjectL( KPresDMConRef );
+ FillNodeInfoL( conRefSipNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KPresDMConRefDescription );
+
+ // ./OMA_PRESENCE/<X>/ToConRef/XDM-SET (To XDM-ID) (Towards XDM ID)
+ MSmlDmDDFObject& napIdToXDMNode = toConRefNode.AddChildObjectL( KPresDMXDMSet );
+ FillNodeInfoL( napIdToXDMNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode,
+ KPresDMXDMSetDescription );
+
+ // ./OMA_PRESENCE/<X>/ToConRef/XDM-SET/ConRef (actual XDM node)
+ MSmlDmDDFObject& conRefXDMNode = napIdToXDMNode.AddChildObjectL( KPresDMConRef );
+ FillNodeInfoL( conRefXDMNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr,
+ KPresDMConRefDescription );
+
+ // ./OMA_PRESENCE/<X>/CLIENT-DATA-OBJ-LIMIT
+ MSmlDmDDFObject& dataObjNode = runTimeNode.AddChildObjectL( KPresDMClientObjDataLim );
+ FillNodeInfoL( dataObjNode, accessTypeNoDelete, MSmlDmDDFObject::EOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt,
+ KPresDMClientObjDataLimDescription );
+
+ // ./OMA_PRESENCE/<X>/CONTENT-SERVER-URI
+ MSmlDmDDFObject& ContentSrvNode = runTimeNode.AddChildObjectL( KPresDMContentSrvUri );
+ FillNodeInfoL( ContentSrvNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
+ KPresDMContentSrvUriDescription );
+
+ // ./OMA_PRESENCE/<X>/SOURCE-THROTTLE-PUBLISH
+ MSmlDmDDFObject& srcThrotNode = runTimeNode.AddChildObjectL( KPresDMSrcThPublish );
+ FillNodeInfoL( srcThrotNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt,
+ KPresDMSrcThPublishDescription );
+
+ // ./OMA_PRESENCE/<X>/MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS
+ MSmlDmDDFObject& maxSubsNode = runTimeNode.AddChildObjectL( KPresDMMaxPresSubs );
+ FillNodeInfoL( maxSubsNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EInt,
+ KPresDMMaxPresSubsDescription );
+
+ // ./OMA_PRESENCE/<X>/MAX-NUMBER-OF-SUBSCRIPTIONS-IN-PRESENCE-LIST
+ MSmlDmDDFObject& maxSubsListNode = runTimeNode.AddChildObjectL( KPresDMMaxPresSubsInLists );
+ FillNodeInfoL( maxSubsListNode, accessTypeNoDelete, MSmlDmDDFObject::EZeroOrOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EInt,
+ KPresDMMaxPresSubsInListsDescription );
+
+ // ./OMA_PRESENCE/<X>/SERVICE-URI-TEMPLATE
+ MSmlDmDDFObject& serUriTempNode = runTimeNode.AddChildObjectL( KPresDMServiceUriTemp );
+ FillNodeInfoL( serUriTempNode, accessTypeNoDelete, MSmlDmDDFObject::EOne,
+ MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr,
+ KPresDMServiceUriTempDescription );
+
+ PRES_DM_LOG(LOG_LIT(" DDFStructureL end"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::ChildURIListL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::ChildURIListL( const TDesC8& aUri,
+ const TDesC8& /*aLUID*/,
+ const CArrayFix<TSmlDmMappingInfo>&
+ /*aPreviousURISegmentList*/,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT8("ChildURIListL(%S): begin"), &aUri);
+ const TInt KPresDMSegmentNameLen = 50;
+
+ CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+ CBufBase* currentList = CBufFlat::NewL(1);
+ CleanupStack::PushL( currentList ); // << currentList
+
+ const TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+ TBuf8<KPresDMSegmentNameLen> segmentName;
+
+ // ./OMA_PRESENCE
+ if( !lastUriSeg.Compare( KPresDMNodeName ) )
+ {
+ PRES_DM_LOG(LOG_LIT8(" ./OMA_PRESENCE"));
+ RArray<TInt> settingIds;
+ CleanupClosePushL( settingIds ); // << settingIds
+ CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC(settingIds);
+ TInt IdCount = settingIds.Count();
+
+ PRES_DM_LOG(LOG_LIT(" IdCount = %d"), IdCount);
+
+ for( TInt i(0); i < IdCount; i++ )
+ {
+ TInt id = settingIds[i];
+ segmentName.Copy( KNullDesC8 );
+ segmentName.AppendNum( id );
+ currentList->InsertL( currentList->Size(), segmentName);
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+ }
+ CleanupStack::PopAndDestroy(names);
+ CleanupStack::PopAndDestroy(1); // settingIds,
+
+ Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
+ Callback().SetStatusL( aStatusRef, retValue );
+ CleanupStack::PopAndDestroy( currentList ); // >>> currentList
+ currentList = NULL;
+ return;
+ }
+
+ // ./OMA_PRESENCE/X
+ if( NSmlDmURI::NumOfURISegs( aUri ) == KPresDMLevel ) // if Uri segments are 2
+ // we are certainly at x
+ // level
+ {
+ PRES_DM_LOG(LOG_LIT8(" ./OMA_PRESENCE/X"));
+
+ segmentName.Copy( KPresDMName );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMProviderId );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMToConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMClientObjDataLim );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMContentSrvUri );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMSrcThPublish );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMMaxPresSubs );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMMaxPresSubsInLists );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMServiceUriTemp );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+ }
+
+ // ./OMA_PRESENCE/X/ToConRef
+ else if ( !lastUriSeg.Compare( KPresDMToConRef ) )
+ {
+ PRES_DM_LOG(LOG_LIT8(" ./OMA_PRESENCE/X/ToConRef"));
+ segmentName.Copy( KPresDMSIPProfile );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+
+ segmentName.Copy( KPresDMXDMSet );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+ }
+
+ // ./OMA_PRESENCE/X/ToConRef/SIP-ID
+ else if ( !lastUriSeg.Compare( KPresDMSIPProfile ) )
+ {
+ PRES_DM_LOG(LOG_LIT8(" ./OMA_PRESENCE/X/ToConRef/SIP-ID"));
+ segmentName.Copy( KPresDMConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+ }
+
+ // ./OMA_PRESENCE/X/ToConRef/XDM-ID
+ else if ( !lastUriSeg.Compare( KPresDMXDMSet ) )
+ {
+ PRES_DM_LOG(LOG_LIT8(" ./OMA_PRESENCE/X/ToConRef/XDM-ID"));
+ segmentName.Copy( KPresDMConRef );
+ currentList->InsertL( currentList->Size(), segmentName );
+ currentList->InsertL( currentList->Size(), KPresDMSeparator );
+ }
+
+ else
+ {
+ // if none of asked nodes found return error.
+ retValue = CSmlDmAdapter::ENotFound;
+ }
+
+ Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 );
+ Callback().SetStatusL( aStatusRef, retValue );
+ CleanupStack::PopAndDestroy( currentList ); // >>> currentList
+ PRES_DM_LOG(LOG_LIT(" ChildURIListL(): end") );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::FetchLeafObjectL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::FetchLeafObjectL( const TDesC8& aUri,
+ const TDesC8& /*aLUID*/,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT8("FetchLeafObjectL(%S): start"), &aUri );
+ CBufBase* result = CBufFlat::NewL( KPresDMDefaultResultSize );
+ CleanupStack::PushL( result ); // << result
+ CSmlDmAdapter::TError status = FetchObjectL( aUri, *result );
+ if( status == CSmlDmAdapter::EOk )
+ {
+ Callback().SetResultsL( aResultsRef,*result,aType );
+ }
+ Callback().SetStatusL(aStatusRef, status);
+ CleanupStack::PopAndDestroy(result); // >>> result
+
+ PRES_DM_LOG(LOG_LIT(" FetchLeafObjectL(): end") );
+ }
+
+// -----------------------------------------------------------------------------
+// CSmlDmAdapter::TError FetchObjectL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CPresenceDMAdapter::FetchObjectL( const TDesC8& aUri,
+ CBufBase& aObject)
+ {
+ PRES_DM_LOG(LOG_LIT8("FetchObjectL(%S): start"), &aUri);
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+
+ TPresSettingsSet tempSet;
+ TPresSettingsProperty property;
+
+ HBufC8* luid = Callback().GetLuidAllocL( aUri );
+ PRES_DM_LOG(LOG_LIT8(" GetLuidAllocL() => '%S'"), luid );
+ TInt settingsId = DesToInt( *luid );
+
+ PRES_DM_LOG(LOG_LIT(" settingsId after callback:%d"), settingsId);
+
+ // check whether above found id is valid or not
+ if (!IsPresIDValidL(settingsId))
+ {
+ //try to find it another way
+ if( NSmlDmURI::NumOfURISegs( aUri ) > 1 )
+ {
+ TPtrC8 idSegment = NSmlDmURI::URISeg( aUri, 2 );
+ settingsId = DesToInt(idSegment);
+ if(!IsPresIDValidL(settingsId))
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ PRES_DM_LOG(LOG_LIT(" settingsId found local way:%d"), settingsId);
+ }
+ }
+
+ // if previous settings id processing was ok
+ if (status == CSmlDmAdapter::EOk)
+ {
+ TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+ // NAME
+ if( Match(lastUriSeg, KPresDMName ) )
+ {
+ property = EPresPropSetName;
+ }
+ // PROVIDER-ID
+ else if( Match(lastUriSeg, KPresDMProviderId ) )
+ {
+ property = EPresPropProviderID;
+ }
+ // Client object data limit
+ else if( Match(lastUriSeg, KPresDMClientObjDataLim) )
+ {
+ property = EPresPropObjectSize;
+ }
+ // content server Uri
+ else if( Match(lastUriSeg, KPresDMContentSrvUri) )
+ {
+ property = EPresPropContSrvAdd;
+ }
+ // Source throttle publish
+ else if( Match(lastUriSeg, KPresDMSrcThPublish) )
+ {
+ property = EPresPropPubInterval;
+ }
+ // Max pres subs
+ else if( Match(lastUriSeg, KPresDMMaxPresSubs ) )
+ {
+ property = EPresPropMaxSubs;
+ }
+ // max subs in lists
+ else if( Match(lastUriSeg, KPresDMMaxPresSubsInLists ) )
+ {
+ property = EPresPropMaxCntInList;
+ }
+ // service uri template
+ else if( Match(lastUriSeg, KPresDMServiceUriTemp ) )
+ {
+ property = EPresPropDomainSyntax;
+ }
+
+ // ConRef/TO-SIP
+ // ConRef/TO-XDM
+ else if( Match( lastUriSeg, KPresDMConRef) )
+ {
+ TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg( aUri );
+ TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg( conRefUri );
+
+ if( Match( lastConRefSeg, KPresDMSIPProfile ) )
+ {
+ property = EPresPropSIPProfile;
+ }
+ else if( Match( lastConRefSeg, KPresDMXDMSet ) )
+ {
+ property = EPresPropXDMSet;
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ }
+
+ // known property
+ if ( status == CSmlDmAdapter::EOk )
+ {
+ status = GetPropertyL( settingsId, property, aObject ) ;
+ PRES_DM_LOG(LOG_LIT(" GetPropertyL status: %d"), status);
+ }
+
+ PRES_DM_LOG(LOG_LIT(" FetchObjectL: ends"));
+ return status;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::FetchLeafObjectSizeL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::FetchLeafObjectSizeL( const TDesC8& aUri,
+ const TDesC8& /*aLUID*/,
+ const TDesC8& aType,
+ const TInt aResultsRef,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT8("FetchLeafObjectSizeL(%S): begins"), &aUri);
+ CBufBase* result = CBufFlat::NewL( KPresDMDefaultResultSize );
+ CleanupStack::PushL( result );
+ CSmlDmAdapter::TError status = FetchObjectL( aUri, *result );
+ PRES_DM_LOG(LOG_LIT(" FetchObjectL: status = %d"), status);
+ if( status == CSmlDmAdapter::EOk )
+ {
+ TInt objSizeInBytes = result->Size();
+ PRES_DM_LOG(LOG_LIT(" objSizeInBytes = %d"), objSizeInBytes);
+
+ TBuf8<KPresDMObjectSizeWidth> stringObjSizeInBytes;
+ stringObjSizeInBytes.Num( objSizeInBytes );
+
+ result->Reset();
+ result->InsertL( 0, stringObjSizeInBytes );
+
+ Callback().SetResultsL( aResultsRef, *result, aType );
+ }
+
+ Callback().SetStatusL( aStatusRef, status) ;
+ CleanupStack::PopAndDestroy(result);
+ PRES_DM_LOG(LOG_LIT(" FetchLeafObjectSizeL: ends"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::UpdateLeafObjectL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::UpdateLeafObjectL(const TDesC8& aUri,
+ const TDesC8& /*aLUID*/,
+ const TDesC8& aObject,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef)
+ {
+ PRES_DM_LOG(LOG_LIT8("UpdateLeafObjectL(%S): starts"), &aUri);
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+
+ TPresSettingsSet tempSet;
+ TPresSettingsProperty property;
+
+ HBufC8* luid = Callback().GetLuidAllocL( aUri );
+ TInt settingsId = DesToInt( *luid );
+
+ PRES_DM_LOG(LOG_LIT(" settingsId after callback:%d"), settingsId);
+
+ // check whether above found id is valid or not
+ if (!IsPresIDValidL(settingsId))
+ {
+ //try to find it another way
+ if( NSmlDmURI::NumOfURISegs( aUri ) > 1 )
+ {
+ TPtrC8 idSegment = NSmlDmURI::URISeg( aUri, 2 );
+ settingsId = DesToInt(idSegment);
+ if (!IsPresIDValidL(settingsId))
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ PRES_DM_LOG(LOG_LIT(" settingsId found local way:%d"), settingsId);
+ }
+ }
+
+ // if previous settings id processing was ok
+ if (status == CSmlDmAdapter::EOk)
+ {
+ TPtrC8 lastUriSeg = NSmlDmURI::LastURISeg( aUri );
+
+ // NAME
+ if( Match(lastUriSeg, KPresDMName ) )
+ {
+ property = EPresPropSetName;
+ }
+ // PROVIDER-ID
+ else if( Match(lastUriSeg, KPresDMProviderId ) )
+ {
+ property = EPresPropProviderID;
+ }
+ // Client object data limit
+ else if( Match(lastUriSeg, KPresDMClientObjDataLim) )
+ {
+ property = EPresPropObjectSize;
+ }
+ // content server Uri
+ else if( Match(lastUriSeg, KPresDMContentSrvUri) )
+ {
+ property = EPresPropContSrvAdd;
+ }
+ // Source throttle publish
+ else if( Match(lastUriSeg, KPresDMSrcThPublish) )
+ {
+ property = EPresPropPubInterval;
+ }
+ // Max pres subs
+ else if( Match(lastUriSeg, KPresDMMaxPresSubs ) )
+ {
+ property = EPresPropMaxSubs;
+ }
+ // max subs in lists
+ else if( Match(lastUriSeg, KPresDMMaxPresSubsInLists ) )
+ {
+ property = EPresPropMaxCntInList;
+ }
+ // service uri template
+ else if( Match(lastUriSeg, KPresDMServiceUriTemp ) )
+ {
+ property = EPresPropDomainSyntax;
+ }
+
+ // ToConRef/TO-SIP/ConRef
+ // ToConRef/TO-XDM/ConRef
+ else if( Match( lastUriSeg, KPresDMConRef) )
+ {
+ TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg( aUri );
+ TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg( conRefUri );
+
+ if( Match( lastConRefSeg, KPresDMSIPProfile ) )
+ {
+ property = EPresPropSIPProfile;
+ }
+ else if( Match( lastConRefSeg, KPresDMXDMSet ) )
+ {
+ property = EPresPropXDMSet;
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ }
+ else
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+ }
+
+ else // if id is not valid
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+
+ // known property and id is ok
+ if ( status == CSmlDmAdapter::EOk )
+ {
+ status = UpdatePropertyL( settingsId, property, aObject );
+ PRES_DM_LOG(LOG_LIT(" UpdatePropertyL status: %d"), status);
+ }
+
+ Callback().SetStatusL(aStatusRef, status);
+
+ PRES_DM_LOG(LOG_LIT(" UpdateLeafObjectL: ends"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::AddNodeObjectL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::AddNodeObjectL( const TDesC8& aUri,
+ const TDesC8& /*aParentLUID*/,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT8("AddNodeObjectL(%S): begins"), &aUri);
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+ HBufC* lastUriSegment;
+
+ if (!NSmlDmURI::RemoveLastSeg( aUri ).Compare( KPresDMNodeName ))
+ {
+ // Both the Name and provider id of new set, we are setting from
+ // lastUrisegment, they will expectedly changed by the next calls
+ // to this function by the framework
+ lastUriSegment = ConvertLC(NSmlDmURI::LastURISeg(aUri));
+ TPresSettingsSet mySet; // New set to be created
+
+ // Processing for set name
+ if (lastUriSegment->Length() > KPresSetNameMaxLength)
+ (mySet.iSetName).Copy(lastUriSegment->Left(KPresSetNameMaxLength));
+ else
+ (mySet.iSetName).Copy(lastUriSegment->Des());
+ CheckDuplicateNameL(mySet.iSetName, 0);
+
+ // Processing for provider ID
+ if (lastUriSegment->Length() > KPresProviderIDMaxLength)
+ (mySet.iProviderID).Copy(lastUriSegment->Left(KPresProviderIDMaxLength));
+ else
+ (mySet.iProviderID).Copy(lastUriSegment->Des());
+
+ TInt id = PresSettingsApi::CreateSetL(mySet);
+ PRES_DM_LOG(LOG_LIT(" New set id(%d)"), id);
+ HBufC8* luid = IntToDes8LC( id ); // << luid
+ Callback().SetMappingL( aUri, *luid );
+ CleanupStack::PopAndDestroy(luid); // luid
+ CleanupStack::PopAndDestroy(lastUriSegment); //lastUriSegment
+
+
+ if(id>0) // if set is created successfully
+ {
+ status = CSmlDmAdapter::EOk;
+ }
+ }
+ Callback().SetStatusL( aStatusRef, status );
+ PRES_DM_LOG(LOG_LIT(" status(%d)"), status);
+ PRES_DM_LOG(LOG_LIT(" AddNodeObjectL: ends"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::DeleteObjectL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::DeleteObjectL( const TDesC8& aUri,
+ const TDesC8& aLUID,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT8("DeleteObjectL(%S): begins"), &aUri);
+ //only node object deletion is possible
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+ if ( !NSmlDmURI::RemoveLastSeg( aUri ).Compare( KPresDMNodeName ) )
+ {
+ TInt id = DesToInt( aLUID );
+ TInt error = PresSettingsApi::RemoveSetL(id);
+ if ( error == KErrNone )
+ {
+ status = CSmlDmAdapter::EOk;
+ }
+ PRES_DM_LOG(LOG_LIT(" id(%d), error(%d), satus(%d)"), id, error, status);
+ }
+ Callback().SetStatusL( aStatusRef, status );
+ PRES_DM_LOG(LOG_LIT(" DeleteObjectL: ends"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::UpdateLeafObjectL
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::UpdateLeafObjectL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ RWriteStream*& /*aStream*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ PRES_DM_LOG(LOG_LIT("UpdateLeafObjectL: begins"));
+ // Update from stream not used
+ Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError);
+
+ PRES_DM_LOG(LOG_LIT(" UpdateLeafObjectL(stream): end"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::ExecuteCommandL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::ExecuteCommandL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ const TDesC8& /*aArgument*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ // Not supported
+ PRES_DM_LOG(LOG_LIT("ExecuteCommandL"));
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::ExecuteCommandL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::ExecuteCommandL( const TDesC8& /*aUri*/,
+ const TDesC8& /*aLUID*/,
+ RWriteStream*& /*aStream*/,
+ const TDesC8& /*aType*/,
+ const TInt aStatusRef )
+ {
+ // Not supported
+ PRES_DM_LOG(LOG_LIT("ExecuteCommandL"));
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::CopyCommandL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/,
+ const TDesC8& /*aTargetLUID*/,
+ const TDesC8& /*aSourceURI*/,
+ const TDesC8& /*aSourceLUID*/,
+ const TDesC8& /*aType*/,
+ TInt aStatusRef )
+ {
+ // Not supported
+ PRES_DM_LOG(LOG_LIT("CopyCommandL"));
+ Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::StartAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::StartAtomicL()
+ {
+ PRES_DM_LOG(LOG_LIT("StartAtomicL"));
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::CommitAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::CommitAtomicL()
+ {
+ PRES_DM_LOG(LOG_LIT("CommitAtomicL"));
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::RollbackAtomicL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::RollbackAtomicL()
+ {
+ PRES_DM_LOG(LOG_LIT("RollbackAtomicL"));
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::StreamingSupport()
+// -----------------------------------------------------------------------------
+//
+TBool CPresenceDMAdapter::StreamingSupport( TInt& /*aItemSize*/ )
+ {
+ PRES_DM_LOG(LOG_LIT("StreamingSupport"));
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::StreamCommittedL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::StreamCommittedL()
+ {
+ PRES_DM_LOG(LOG_LIT("StreamCommittedL"));
+ // Not supported
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::CompleteOutstandingCmdsL()
+// -----------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::CompleteOutstandingCmdsL()
+ {
+ PRES_DM_LOG(LOG_LIT("CompleteOutstandingCmdsL"));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::GetPropertyL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CPresenceDMAdapter::GetPropertyL( TInt aSetId,
+ TPresSettingsProperty aProperty,
+ CBufBase& aObject )
+ {
+ PRES_DM_LOG(LOG_LIT(" GetPropertyL(%d, %d)"),aSetId,aProperty);
+
+ HBufC* value = NULL;
+ TInt error( KErrNone );
+
+
+ // Get the set only if we dont have it in internal buffer
+ if(iGetSetID != aSetId)
+ {
+ error = PresSettingsApi:: SettingsSetL(aSetId, iGetSet);
+ if(error==KErrNone)
+ iGetSetID = aSetId;
+ PRES_DM_LOG(LOG_LIT(" error(%d)"),error);
+ }
+
+ if (error == KErrNone)
+ {
+ switch (aProperty)
+ {
+ case EPresPropSetName:
+ value = (iGetSet.iSetName).AllocLC();
+ break;
+ case EPresPropProviderID:
+ value = (iGetSet.iProviderID).AllocLC();
+ break;
+ case EPresPropSIPProfile:
+ return GetConRefFromSipIDL(iGetSet.iSipProfile, aObject);
+ case EPresPropXDMSet:
+ return GetConRefFromXdmIDL(iGetSet.iXDMSetting, aObject);
+ case EPresPropObjectSize:
+ value = IntToDesLC(iGetSet.iObjectSize);
+ break;
+ case EPresPropContSrvAdd:
+ value = (iGetSet.iContSrvrAdd).AllocLC();
+ break;
+ case EPresPropPubInterval:
+ value = IntToDesLC(iGetSet.iPublicationInt);
+ break;
+ case EPresPropMaxSubs:
+ value = IntToDesLC(iGetSet.iMaxSubscriptions);
+ break;
+ case EPresPropMaxCntInList:
+ value = IntToDesLC(iGetSet.iMaxContactsInList);
+ break;
+ case EPresPropDomainSyntax:
+ value = (iGetSet.iDomainSyntax).AllocLC();
+ break;
+ default:
+ error = KErrNotFound;
+ break;
+ }
+ }
+
+ PRES_DM_LOG(LOG_LIT(" value = %S"), &(*value));
+
+ if ( error == KErrNone )
+ {
+ HBufC8* utfValue = ConvertLC( *value ); // << utfValue
+ aObject.InsertL( 0, *utfValue );
+ CleanupStack::PopAndDestroy(utfValue); // >>> utfValue
+ CleanupStack::PopAndDestroy(value); // >>> value
+ PRES_DM_LOG(LOG_LIT(" return( EOk )"));
+ return CSmlDmAdapter::EOk;
+ }
+ PRES_DM_LOG(LOG_LIT(" return( ENotFound )"));
+ return CSmlDmAdapter::ENotFound;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::UpdatePropertyL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CPresenceDMAdapter::UpdatePropertyL( TInt aSetId,
+ TPresSettingsProperty aProperty,
+ const TDesC8& aObject )
+ {
+ PRES_DM_LOG(LOG_LIT(" UpdatePropertyL(%d, %d)"),aSetId,aProperty);
+
+ TInt valueInt(KErrNotFound);
+ HBufC* value = ConvertLC(aObject); // value
+ TPtr ptr = value->Des();
+ CSmlDmAdapter::TError result = CSmlDmAdapter::EError;
+ TInt error(KErrNone);
+
+ // we handle SIP and XDM references in a different way
+ if(aProperty == EPresPropSIPProfile)
+ {
+ valueInt = GetSipIdFromConRefL(aObject);
+ }
+
+ else if(aProperty == EPresPropXDMSet)
+ {
+ valueInt = GetXdmIdFromConRefL(aObject);
+ }
+
+ // for all other properties use normal way to get value
+ else
+ {
+ valueInt = DesToInt(aObject);
+ }
+
+ // for str properties
+ if(PresSettingsApi::IsStr(aProperty))
+ {
+ if (SetProperLength(aProperty, ptr))
+ {
+ if(aProperty == EPresPropSetName)
+ {
+ CheckDuplicateNameL(ptr, aSetId);
+ }
+ PRES_DM_LOG(LOG_LIT(" value = %S"),&(*value));
+ error = PresSettingsApi::UpdatePropertyL( aSetId, aProperty, *value);
+ if(error == KErrNone)
+ result = CSmlDmAdapter::EOk;
+
+ }
+ else
+ result = CSmlDmAdapter::EInvalidObject;
+ }
+ // for int properties
+ else if(valueInt > KErrNotFound) // if valid value
+ {
+ PRES_DM_LOG(LOG_LIT(" valueInt = %d"), valueInt);
+ error = PresSettingsApi::UpdatePropertyL( aSetId, aProperty, valueInt);
+ if(error == KErrNone)
+ result = CSmlDmAdapter::EOk;
+ }
+ else
+ result = CSmlDmAdapter::ENotFound;
+
+ CleanupStack::PopAndDestroy(value);
+
+
+ PRES_DM_LOG(LOG_LIT(" error(%d) , result(%d)"), error, result);
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::Match
+// -----------------------------------------------------------------------------
+//
+TBool CPresenceDMAdapter::Match( const TDesC8& aLeft, const TDesC8& aRight )
+ {
+ if ( !aLeft.Compare( aRight ) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+ // -----------------------------------------------------------------------------
+// CPresenceDMAdapter::FillNodeInfoL
+// ------------------------------------------------------------------------------
+//
+void CPresenceDMAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,
+ TSmlDmAccessTypes aAccTypes,
+ MSmlDmDDFObject::TOccurence aOccurrence,
+ MSmlDmDDFObject::TScope aScope,
+ MSmlDmDDFObject::TDFFormat aFormat,
+ const TDesC8& aDescription)
+ {
+ aNode.SetAccessTypesL( aAccTypes );
+ aNode.SetOccurenceL( aOccurrence );
+ aNode.SetScopeL( aScope );
+ aNode.SetDFFormatL( aFormat );
+
+ if( aFormat!= MSmlDmDDFObject::ENode )
+ {
+ aNode.AddDFTypeMimeTypeL( KPresDMTextPlain );
+ }
+ aNode.SetDescriptionL( aDescription );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::ConvertLC
+// -----------------------------------------------------------------------------
+//
+HBufC8* CPresenceDMAdapter::ConvertLC( const TDesC& aSource ) const
+ {
+ HBufC8* destination = HBufC8::NewLC( aSource.Length() );
+ TPtr8 bufferPtr = destination->Des();
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( bufferPtr, aSource );
+ return destination;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::ConvertLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CPresenceDMAdapter::ConvertLC( const TDesC8& aSource ) const
+ {
+ HBufC* destination = HBufC::NewLC(aSource.Length());
+ TPtr bufferPtr = destination->Des();
+ CnvUtfConverter::ConvertToUnicodeFromUtf8( bufferPtr, aSource );
+ return destination;
+ }
+
+// ----------------------------------------------------------------------------
+// CPresenceDMAdapter::DesToInt
+// ----------------------------------------------------------------------------
+TInt CPresenceDMAdapter::DesToInt( const TDesC8& aLuid ) const
+ {
+ TLex8 lex( aLuid );
+ TInt value ( KErrNotFound );
+ lex.Val( value );
+ return value;
+ }
+
+// ----------------------------------------------------------------------------
+// CPresenceDMAdapter::IntToDes8LC
+// ----------------------------------------------------------------------------
+HBufC8* CPresenceDMAdapter::IntToDes8LC( const TInt aLuid ) const
+ {
+ // 10 = max length of 32bit integer
+ HBufC8* buf = HBufC8::NewLC( KPresDMMaxIntLength ); // << buf
+ TPtr8 ptrBuf = buf->Des();
+ ptrBuf.Num( aLuid );
+ return buf;
+ }
+
+// ----------------------------------------------------------------------------
+// CPresenceDMAdapter::IntToDesLC
+// ----------------------------------------------------------------------------
+HBufC* CPresenceDMAdapter::IntToDesLC( const TInt aLuid ) const
+ {
+ // 10 = max length of 32bit integer
+ HBufC* buf = HBufC::NewLC( KPresDMMaxIntLength ); // << buf
+ TPtr ptrBuf = buf->Des();
+ ptrBuf.Num( aLuid );
+ return buf;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::GetConRefFromSipIDL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CPresenceDMAdapter::GetConRefFromSipIDL( TInt aSipID,
+ CBufBase& aObject)
+ {
+ PRES_DM_LOG(LOG_LIT(" GetConRefFromSipIDL(aSipId:%d)"),aSipID);
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
+
+ TBool found(EFalse);
+
+ if( aSipID != KErrNotFound )
+ {
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL(result); // << result
+
+ // Request all the sip settings identifiers
+ Callback().FetchLinkL( KPresDMSipDMNode, *result, status);
+ PRES_DM_LOG(LOG_LIT(" FetchLinkL(SIP) status : %d"), status );
+
+ if( status == EOk )
+ {
+ TPtr8 uriSeg8Ptr = result->Ptr(0);
+
+ HBufC8* uriSegBuffer = uriSeg8Ptr.AllocLC(); // << uriSegBuffer
+ PRES_DM_LOG(LOG_LIT8(" uri : '%S'"), uriSegBuffer );
+
+ TPtr8 uriSegBufferPtr = uriSegBuffer->Des();
+
+ TInt numOfUriSegs = NSmlDmURI::NumOfURISegs(uriSeg8Ptr);
+
+ TBuf8<100> idLinkBuffer;
+
+ TInt foundId(KErrNotFound);
+
+
+ // Check if given SIP set id match with any of found
+ // SIP settings identifiers
+ while( numOfUriSegs > 0 )
+ {
+ idLinkBuffer = NSmlDmURI::LastURISeg(uriSegBufferPtr);
+ uriSegBufferPtr = NSmlDmURI::RemoveLastSeg(uriSegBufferPtr);
+
+ idLinkBuffer.Insert(0, KPresDMSipDMNode);
+ idLinkBuffer.Insert(3, KPresDMSeparator);
+ idLinkBuffer.Append(KPresDMSeparator);
+ idLinkBuffer.Append(KPresDMSipIdPrefix);
+
+ TPtrC8 finalLink = idLinkBuffer;
+
+ //Reqest the ID
+ result->Reset();
+ Callback().FetchLinkL( finalLink, *result, status);
+ PRES_DM_LOG(LOG_LIT8(" FetchLinkL(%S) status : %d"), &idLinkBuffer, status );
+ if( status == EOk )
+ {
+ foundId = DesToInt(result->Ptr(0));
+ PRES_DM_LOG(LOG_LIT(" foundId : %d"), foundId );
+ if (foundId == aSipID)
+ {
+ found = ETrue;
+ aObject.InsertL(0, NSmlDmURI::RemoveLastSeg(finalLink));
+ break;
+ }
+ }
+
+ numOfUriSegs--;
+ }
+ CleanupStack::PopAndDestroy( uriSegBuffer ); // >>> uriSegBuffer
+ }
+
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ }
+ if(found == EFalse)
+ {
+ status = CSmlDmAdapter::ENotFound;
+ }
+
+ PRES_DM_LOG(LOG_LIT(" GetConRefFromSipIDL(%d): ends"), status);
+
+ return status;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::GetConRefFromXdmIDL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CPresenceDMAdapter::GetConRefFromXdmIDL( TInt aXdmID,
+ CBufBase& aObject)
+ {
+ PRES_DM_LOG(LOG_LIT(" GetConRefFromXdmIDL(aXdmId:%d)"),aXdmID);
+
+ CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound;
+
+ if( aXdmID != KErrNotFound )
+ {
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL(result); // << result
+
+ // Request all the XDM settings identifiers
+ Callback().FetchLinkL( KPresDMXdmDMNode, *result, status);
+ PRES_DM_LOG(LOG_LIT(" FetchLinkL(XDM) status : %d"), status );
+ TInt id(KErrNotFound);
+
+ TPtrC8 lastUriSegXdm;
+
+ if( status == EOk )
+ {
+ TPtr8 uriSeg8Ptr = result->Ptr(0);
+
+ HBufC8* uriSegBuffer = uriSeg8Ptr.AllocLC();
+
+ TPtr8 uriSegBufferPtr = uriSegBuffer->Des();
+
+ TInt numOfUriSegs = NSmlDmURI::NumOfURISegs(uriSeg8Ptr);
+
+ // Check if the Presence settings XDM settings id match with one of the found
+ // XDM settings identifiers
+ while( numOfUriSegs > 0)
+ {
+ lastUriSegXdm.Set(NSmlDmURI::LastURISeg(uriSegBufferPtr));
+ uriSegBufferPtr = NSmlDmURI::RemoveLastSeg(uriSegBufferPtr);
+ id = DesToInt(lastUriSegXdm);
+
+ if(id == aXdmID)
+ {
+ // Total length of the sip settings link where one is for
+ // the separator
+ TInt XDMLinkLength = KPresDMXdmDMNode().Length() +
+ KPresDMSeparator().Length() +
+ lastUriSegXdm.Length();
+ HBufC8* XDMLink = HBufC8::NewLC( XDMLinkLength ); // <<< XDMLink
+
+ TPtr8 XDMLinkPtr = XDMLink->Des();
+
+ XDMLinkPtr.Append( KPresDMXdmDMNode );
+ XDMLinkPtr.Append( KPresDMSeparator );
+ XDMLinkPtr.Append( lastUriSegXdm );
+
+ aObject.InsertL( 0, XDMLinkPtr );
+
+ CleanupStack::PopAndDestroy( XDMLink ); // >>> XDMLink
+ status = CSmlDmAdapter::EOk;
+ break;
+ }
+ numOfUriSegs--;
+ }
+ CleanupStack::PopAndDestroy( uriSegBuffer ); // >>> uriSegBuffer
+ }
+ CleanupStack::PopAndDestroy( result ); // >>> result
+ }
+
+ PRES_DM_LOG(LOG_LIT(" GetConRefFromXdmIDL(%d): ends"), status);
+ return status;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::IsPresIDValidL
+// -----------------------------------------------------------------------------
+//
+TBool CPresenceDMAdapter::IsPresIDValidL(TInt aSetId)
+ {
+ TPresSettingsSet tempSet;
+ if ((PresSettingsApi::SettingsSetL(aSetId,tempSet)) == KErrNone)
+ return ETrue;
+ PRES_DM_LOG(LOG_LIT8(" IsPresIDValidL - Invalid settings : %d"), aSetId );
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::GetSipIdFromConRefL
+// -----------------------------------------------------------------------------
+//
+TInt CPresenceDMAdapter::GetSipIdFromConRefL(const TDesC8& aUri )
+ {
+ PRES_DM_LOG(LOG_LIT8(" GetSipIdFromConRefL(%S)"),&aUri);
+
+ CSmlDmAdapter::TError status = EOk;
+ TInt returnId(KErrNotFound);
+
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL(result); // << result
+
+ // make all SIP profiles known
+ Callback().FetchLinkL( KPresDMSipDMNode, *result, status );
+
+ //TBuf8<300> resultBuf;
+ //result->Read(0, resultBuf,result->Size());
+
+ TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
+ TBuf8<50> object = uri;
+
+ object.Append( KPresDMSeparator );
+ object.Append( KPresDMSipIdPrefix );
+
+ result->Reset();
+ Callback().FetchLinkL( object, *result, status);
+
+ //resultBuf.Zero();
+ //result->Read(0, resultBuf,result->Size());
+
+ if( status == EOk )
+ {
+ TUint32 id = DesToInt( result->Ptr( 0 ) );
+ returnId = (TInt)id;
+ }
+ CleanupStack::PopAndDestroy( result ); // >>> result
+
+ PRES_DM_LOG(LOG_LIT(" status(%d), returnId(%d): end"), status, returnId);
+
+ return returnId;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::GetXdmIdFromConRefL
+// -----------------------------------------------------------------------------
+//
+TInt CPresenceDMAdapter::GetXdmIdFromConRefL(const TDesC8& aUri )
+ {
+ PRES_DM_LOG(LOG_LIT8(" GetXdmIdFromConRefL(%S)"),&aUri);
+ const TInt KPresDMIdDesSize = 10;
+
+ CSmlDmAdapter::TError status = EOk;
+ TInt id( KErrNotFound );
+ TBuf8<KPresDMIdDesSize> idDes;
+
+ CBufBase* result = CBufFlat::NewL(1);
+ CleanupStack::PushL(result); // << result
+
+ TPtrC8 uri = NSmlDmURI::RemoveDotSlash( aUri );
+ // Request the xdm settings identifier
+ Callback().FetchLinkL( uri, *result, status);
+
+ if( status == EOk ) // if the link is valid. Wont use result
+ {
+ TPtrC8 idSegment = NSmlDmURI::LastURISeg(aUri);
+ id = DesToInt(idSegment);
+ }
+ CleanupStack::PopAndDestroy( result ); // >>> result
+
+ PRES_DM_LOG(LOG_LIT(" status(%d), id(%d): end"), status, id);
+ return id;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceDMAdapter::GetPrefixL()
+// ---------------------------------------------------------------------------
+//
+HBufC* CPresenceDMAdapter::GetPrefixL( HBufC* aName )
+ {
+ TPtrC prefix = aName->Des();
+ TInt lastBrace = aName->LocateReverse('(');
+ if ( lastBrace != KErrNotFound )
+ {
+ // aName looks like "<prefix><brace><something>".
+ // See if <something> is an integer number and
+ // <something> ends to a brace.
+ TPtrC num = aName->Right( aName->Length() - lastBrace - 1 );
+ TInt val;
+ TLex lex( num );
+ if ( lex.Val( val ) == KErrNone && num.Locate(')') == num.Length() - 1 )
+ {
+ // Yes, the trailer is an integer.
+ prefix.Set( aName->Left( lastBrace ) );
+ }
+ }
+ return prefix.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::CheckDuplicateNameL
+// Checks if duplicate named Presence Settings. Rename if same.
+// -----------------------------------------------------------------------------
+void CPresenceDMAdapter::CheckDuplicateNameL( TDes& aSetName, const TInt& aSetId)
+ {
+ PRES_DM_LOG(LOG_LIT(" CheckDuplicateNameL(%S, %d)"),&aSetName, aSetId);
+
+ _LIT( KPresDMNumbering, "(%N)" );
+ const TInt KPresDMFormatExtraLen = 6;
+
+ HBufC* newName = HBufC::NewLC(KPresSetNameMaxLength);
+ newName->Des().Copy(aSetName);
+
+ RArray<TInt> setIds;
+ CleanupClosePushL( setIds );
+ CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC(setIds);
+ TInt count(setIds.Count());
+
+ newName = newName->ReAlloc(
+ newName->Length() + KPresDMFormatExtraLen );// enough for formatting
+
+ HBufC* tempSetName = NULL;
+ TInt pos = 0;// used as dummy
+ TInt found = 0;
+ TInt index = 1;
+ TPtr ptr = newName->Des();
+
+ // do the actual checking of name
+ found = names->Find( *newName, pos );
+ while ( found == 0 )
+ {
+ if ( !tempSetName )
+ {
+ tempSetName = GetPrefixL( newName );
+ tempSetName = tempSetName->ReAlloc(
+ tempSetName->Length() + KPresDMFormatExtraLen );// enough for formatting
+ CleanupStack::PushL( tempSetName );
+ tempSetName->Des().Append( KPresDMNumbering );
+ }
+ StringLoader::Format( ptr, *tempSetName, -1, index );
+ found = names->Find( *newName, pos );
+ index++;
+ }
+
+ // cleanup
+ if ( tempSetName )
+ {
+ CleanupStack::PopAndDestroy( tempSetName ); //tempSetName
+ }
+
+ CleanupStack::PopAndDestroy(names); // names
+ CleanupStack::PopAndDestroy(1); // setIds
+
+ aSetName.Copy(newName->Des());
+ CleanupStack::PopAndDestroy( newName );
+
+ PRES_DM_LOG(LOG_LIT(" CheckDuplicateNameL(%S): end"),&aSetName);
+ }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::SetProperLength
+// -----------------------------------------------------------------------------
+TBool CPresenceDMAdapter::SetProperLength(TPresSettingsProperty aProp, TPtr& aValue)
+ {
+ PRES_DM_LOG(LOG_LIT(" SetProperLength(%d)"),aProp);
+
+ TBool result(ETrue);
+ switch (aProp)
+ {
+ case EPresPropSetName:
+ if(aValue.Length() > KPresSetNameMaxLength)
+ aValue = aValue.Left(KPresSetNameMaxLength);
+ break;
+
+ case EPresPropContSrvAdd:
+ if(aValue.Length() > KContentSrvrAddMaxLength)
+ result = EFalse;
+ break;
+
+ case EPresPropDomainSyntax:
+ if(aValue.Length() > KPresDomainSyntxMaxLength)
+ result = EFalse;
+ break;
+
+ case EPresPropProviderID:
+ if(aValue.Length() > KPresProviderIDMaxLength)
+ aValue = aValue.Left(KPresProviderIDMaxLength);
+ break;
+ default:
+ break;
+ }
+ PRES_DM_LOG(LOG_LIT(" SetProperLength(%d): end"),result);
+ return result;
+ }
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencedm/src/presencedmadapterproxy.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Table of plugins for ECom
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <implementationproxy.h>
+
+#include "presencedmadapter.h"
+#include "presencedmlogger.h"
+
+const TUint KPresDMAdapterUid = 0x10282416;
+
+// -----------------------------------------------------------------------------
+// TImplementationProxy ImplementationTable[]
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KPresDMAdapterUid, CPresenceDMAdapter::NewL )
+#else
+ { { KPresDMAdapterUid }, CPresenceDMAdapter::NewL },
+#endif
+ };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy()
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt&
+ aTableCount )
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ PRES_DM_LOG(LOG_LIT8("CPresenceDMAdapter:ImplementationGroupProxy"));
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/data/10282417.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 1028 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Ecom resources for Provisioning Adapter to provision Presence Settings
+*
+*/
+
+
+
+
+#include <registryinfo.rh>
+#include "../inc/presenceprovuid.h"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO thePresProvRegistryInfo
+ {
+ dll_uid = KPresProvAdapterDll;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KPresProvAdapterInterface;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = KPresProvAdapterImplementation;
+ version_no = 1;
+ display_name = "Presence Provisioning Plugin||Copyright © 2006 Nokia Corporation. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/data/presenceprovisioningtexts.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource definitions for text visible to user when settings
+* are received.
+*
+*/
+
+
+
+
+// INCLUDES
+#include <badef.rh>
+#include <presenceprovadapter.loc>
+
+// RESOURCE DEFINITIONS
+RESOURCE LBUF r_qtn_op_head_presence
+ {
+ txt = qtn_op_head_presence;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project PresenceProvisioning.dll
+*
+*/
+
+
+
+
+//--------------------
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+PresenceProvisioning.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/group/presenceprovisioning.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMP for Presence Provisioning adapter
+*
+*/
+
+
+
+
+#include <data_caging_paths.hrh>
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET presenceprovisioning.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10282417
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE presenceprovitem.cpp
+SOURCE presenceprovadapter.cpp
+SOURCE presenceprovgroupproxy.cpp
+
+SOURCEPATH ../data
+START RESOURCE 10282417.rss
+ TARGET presenceprovisioning.rsc
+END
+
+
+START RESOURCE presenceprovisioningtexts.rss
+HEADER
+TARGET presenceprovisioningtexts.rsc
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+USERINCLUDE ../inc
+
+// default system include paths for middleware layer modules
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY ecom.lib
+LIBRARY euser.lib
+LIBRARY presencesettingsapi.lib
+LIBRARY provisioningengine.lib
+LIBRARY commonengine.lib
+LIBRARY bafl.lib
+
+DEBUGLIBRARY flogger.lib
+
+
+SOURCEPATH ../loc
+DOCUMENT presenceprovadapter.loc
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/inc/presenceprovadapter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header for main Adapter class
+*
+*/
+
+
+
+
+#ifndef __PRESPROVADAPTER_H__
+#define __PRESPROVADAPTER_H__
+
+// INCLUDES
+#include <CWPAdapter.h>
+
+// FORWARD DECLARATIONS
+class CPresProvItem;
+class CWPCharacteristic;
+
+// CONSTANTS
+
+_LIT8( KPresProvisioningAppId8, "ap0002" );
+_LIT8( KPresProvisioningXdmId, "ap0003" );
+_LIT8( KPresProvisioningSipId, "w9010" );
+
+/**
+* Main Adapter class. Derived from CWPAdapter as recommended by provisioning
+* framework
+*
+* @since S60 3.2
+*/
+class CPresProvAdapter : public CWPAdapter
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPresProvAdapter* NewL();
+
+ /**
+ * Destructor.
+ */
+ ~CPresProvAdapter();
+
+ public: // from CWPAdapter
+
+ TInt ItemCount() const;
+ const TDesC16& SummaryTitle( TInt aIndex ) const;
+ const TDesC16& SummaryText( TInt aIndex ) const;
+ void SaveL( TInt aItem );
+ TBool CanSetAsDefault( TInt aItem ) const;
+ void SetAsDefaultL( TInt aItem );
+ TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+ void VisitL( CWPCharacteristic& aCharacteristic);
+ void VisitL( CWPParameter& aParameter );
+ void VisitLinkL( CWPCharacteristic& aLink );
+ void SettingsSavedL ( const TDesC8& aAppIdOfSavingItem,
+ const TDesC8& aAppRef,
+ const TDesC8& aStorageIdValue);
+ void SavingFinalizedL();
+
+ void GetSavingInfoL( TInt aIndex,
+ RPointerArray<HBufC8>& aSavingInfo );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CPresProvAdapter();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * Des to Int
+ *
+ * @since S60 3.2
+ * @param aSrcDes Descriptor to convert
+ * @return TInt
+ */
+ TInt DesToInt( const TDesC8& aSrcDes ) const;
+
+
+ private:
+
+ // Default name for settings
+ HBufC* iDefaultName;
+
+ // Title for Presence settings
+ HBufC* iTitle;
+
+ // Presence items
+ RPointerArray<CPresProvItem> iProvItems;
+
+ };
+
+#endif // __PRESPROVADAPTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/inc/presenceprovitem.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provisioning item for parsing and saving Presence settings
+*
+*/
+
+
+
+
+#ifndef __PRESPROVITEM_H__
+#define __PRESPROVITEM_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <CWPAdapter.h>
+
+// FORWARD DECLARATIONS
+class CWPCharacteristic;
+class CWPParameter;
+class TPresSettingsSet;
+
+// Constants
+_LIT( KPresProvisioningAppId, "ap0002" );
+_LIT( KPresProvisioningAppRef, "PRS-APPREF");
+_LIT( KPresProvOpenBrack, "(" );
+_LIT( KPresProvCloseBrack, ")" );
+
+_LIT(KPresIAppRef, "APPREF");
+_LIT(KPresIToAppRef, "TO-APPREF");
+_LIT(KPresProvClientObjDataLim, "CLIENT-OBJ-DATA-LIMIT");
+_LIT(KPresProvContentSrvUri, "CONTENT-SERVER-URI");
+_LIT(KPresProvSrcThPublish, "SOURCE-THROTTLE-PUBLISH");
+_LIT(KPresProvMaxPresSubs, "MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS");
+_LIT(KPresProvMaxPresSubsInLists, "MAX-NUMBER-OF-SUBSCRIPTIONS-IN-PRESENCE-LIST");
+_LIT(KPresProvServiceUriTemp, "SERVICE-URI-TEMPLATE");
+
+/**
+* Provisioning item for parsing and saving Presence settings. Derived from
+* MWPVisitor as recommended by provisioning framework
+*
+* @since S60 3.2
+*/
+class CPresProvItem : public CBase, public MWPVisitor
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPresProvItem* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CPresProvItem();
+
+
+ public: // From MWPVisitor
+
+ void VisitL( CWPCharacteristic& aCharacteristic );
+
+ void VisitL( CWPParameter& aParameter );
+
+ void VisitLinkL( CWPCharacteristic& aLink );
+
+ public:
+
+ /**
+ * Validates the provisioning item for mandatory fields
+ *
+ * @since S60 3.2
+ * @return ETrue if correct item
+ */
+ TBool Validate() const;
+
+ /**
+ * Saves the provisioned settings
+ *
+ * @since S60 3.2
+ * @return KErrNone if successfull
+ */
+ TInt SaveL();
+
+ /**
+ * Returns name of the provisioning item
+ *
+ * @since S60 3.2
+ * @return Name or KNullDesC
+ */
+ const TDesC& Name() const;
+
+ /**
+ * Returns application id of the provisioning item
+ *
+ * @since S60 3.2
+ * @return ApplicationId or KNullDesC
+ */
+ const TDesC& ApplicationId() const;
+
+ /**
+ * Returns id of the created settings
+ *
+ * @since S60 3.2
+ * @return The id or KErrNotFound if not yet saved
+ */
+ TInt PresSetId() const;
+
+ /**
+ * Returns value of the APPREF of the provisioning item
+ *
+ * @since S60 3.2
+ * @return iAppRef or KNullDesC
+ */
+ const TDesC& AppReference() const;
+
+ /**
+ * Returns the application references from this item to other
+ * applications
+ *
+ * @since S60 3.2
+ * @return Array of references
+ */
+ const RArray<TPtrC>& ToAppReferences() const;
+
+ /**
+ * Sets SIP settings id
+ *
+ * @since S60 3.2
+ * @param aSipId Settings id
+ */
+ void SetSipSetIdL(TInt aSipId);
+
+ /**
+ * Sets XDM settings id
+ *
+ * @since S60 3.2
+ * @param aXdmId Settings id
+ */
+ void SetXDMSetIdL(TInt aXdmId);
+
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CPresProvItem();
+
+ /**
+ * Determine and save named parameter
+ *
+ * @since S60 3.2
+ * @param aName Name of the parameter
+ * @param aValue Value of the parameter
+ */
+ void DetermineNamedParameter( const TDesC& aName, const TDesC& aValue );
+
+ /**
+ * Check presence settings duplicate names, provide alternate name
+ * if necessary.
+ *
+ * @since S60 3.2
+ * @param aSetId presence id, accepts KErrNotFound for new sets
+ * @param aSetName presence set name, suggested name returns here
+ * @return none
+ */
+ void CheckDuplicateNameL(TDes& aSetName, const TInt& aSetId);
+
+ /**
+ * Des to Int
+ *
+ * @since S60 3.2
+ * @param aSourceDes Descriptor to convert
+ * @return TInt
+ */
+ TInt DesToInt(const TDesC& aSourceDes) const;
+
+ /**
+ * Checks if there is ordinal numbering at the end of
+ * descriptor and rips it off if there is.
+ *
+ * @param aName pointer to source descriptor
+ * @return HBufC* containing the name ready for the numbering
+ */
+ HBufC* GetPrefixL(HBufC* aName);
+
+
+ private:
+
+
+ // The allocated id for the saved settings
+ TInt iPresSetId;
+
+ // Just used for validation, not to save
+ TPtrC iAppId;
+
+ // Set Items to be saved
+ TPtrC iSetName;
+ TInt iSipProfile;
+ TInt iXDMSetting;
+ TInt iObjectSize;
+ TPtrC iContSrvrAdd;
+ TInt iPublicationInt;
+ TInt iMaxSubscriptions;
+ TInt iMaxContactsInList;
+ TPtrC iDomainSyntax;
+ TPtrC iProviderID;
+
+
+ // TO-APPREF
+ TPtrC iAppRef;
+
+ // TO-XDM
+ TPtrC iToXdmSet;
+
+ // TO-SIP
+ TPtrC iToSipProfile;
+
+ // Flag indicating wheather settings are saved
+ TBool iSettingsSaved;
+
+ // Application references
+ RArray<TPtrC> iToAppReferences;
+
+ };
+
+#endif // __PRESPROVITEM_H__
+
+// End of File
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/inc/presenceprovlogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OMA Presence Provisioning Adapter, for presence settings
+*
+*/
+
+
+
+
+
+#ifndef _PRESENCE_PROV_LOGGER_H
+#define _PRESENCE_PROV_LOGGER_H
+
+
+// logging is done only in debug
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+//Logging constants
+_LIT(KLogDir, "presenceota");
+_LIT(KLogFile, "presenceprovlog.txt");
+
+#define LOG_LIT(s) _L(s)
+#define LOG_LIT8(s) _L8(s)
+#define PRES_PROV_LOG DebugWriteFormat
+
+
+/**
+* Log file printing utility function
+* @since Series 60 3.0
+*/
+inline void DebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf< 300 > buffer;
+ buffer.FormatList( aFmt, list );
+ RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, buffer );
+ }
+
+/**
+* Log file printing utility function
+* @since Series 60 3.0
+*/
+inline void DebugWriteFormat( TRefByValue<const TDesC8> aFmt,...) //lint !e960
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf8<300> buffer;
+ buffer.FormatList( aFmt, list );
+ RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, buffer );
+ }
+
+
+#else // _DEBUG
+
+struct LogEmptyDebugString { };
+
+#define LOG_LIT(s) LogEmptyDebugString()
+#define LOG_LIT8(s) LogEmptyDebugString()
+
+/// Empty debug print function for release builds.
+inline void PRES_PROV_LOG(LogEmptyDebugString)
+ {
+ }
+
+template<class T1>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1)
+ {
+ }
+
+template<class T1,class T2>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2)
+ {
+ }
+
+template<class T1,class T2,class T3>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3,T4)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
+inline void PRES_PROV_LOG(LogEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
+ {
+ }
+
+
+#endif // _DEBUG
+
+
+#endif // _PRESENCE_PROV_LOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/inc/presenceprovuid.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: UIDs for Provisioning Adapter to provision Presence Settings
+*
+*/
+
+
+
+
+#ifndef __PRESPROVISIONINGUID__
+#define __PRESPROVISIONINGUID__
+
+//Presence Provisioning Adapter plugin dll UID
+#define KPresProvAdapterDll 0x10282417
+
+//Provisioning Adapter plugin interface
+#define KPresProvAdapterInterface 0x101F84D5
+
+//Presence Provisioning Adapter plugin implementation UID
+#define KPresProvAdapterImplementation 0x10282418
+
+#endif // __PRESPROVISIONINGUID__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/loc/presenceprovadapter.loc Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Localized strings for the text visible to user.
+*
+*/
+
+
+
+
+// LOCALISATION STRINGS
+
+//d: Summary title for Presence Provisioning entries.
+//l: msg_body_pane_t1
+//
+#define qtn_op_head_presence "Presence settings:"
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/src/presenceprovadapter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,338 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation for main Adapter class
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <CWPCharacteristic.h>
+#include <WPAdapterUtil.h>
+#include <presenceprovisioningtexts.rsg>
+#include <pressettingsapi.h>
+
+#include "presenceprovitem.h"
+#include "presenceprovadapter.h"
+#include "presenceprovlogger.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::CPresProvAdapter
+//
+// -----------------------------------------------------------------------------
+//
+CPresProvAdapter::CPresProvAdapter()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::ConstructL()
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::ConstructL"));
+ // AdapterUtil needs the name of the resource file without the prefix and
+ // the path returned by Dll::FileName. Note that Dll::FileName is an
+ // undocumented method.
+ //
+ _LIT( KPresAdapterName, "PresenceProvisioningTexts"); // presenceprovisioningtexts.rss
+ TFileName fileName;
+ Dll::FileName(fileName);
+
+ iTitle = WPAdapterUtil::ReadHBufCL( fileName,
+ KPresAdapterName,
+ R_QTN_OP_HEAD_PRESENCE);
+ iDefaultName = WPAdapterUtil::ReadHBufCL( fileName,
+ KPresAdapterName,
+ R_QTN_OP_HEAD_PRESENCE);
+
+ PRES_PROV_LOG(LOG_LIT8( " iTitle: %S"), &(*iTitle));
+ PRES_PROV_LOG(LOG_LIT8( " iDefaultName: %S"), &(*iDefaultName));
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPresProvAdapter* CPresProvAdapter::NewL()
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::NewL"));
+ CPresProvAdapter* self = new(ELeave) CPresProvAdapter;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::~CPresProvAdapter
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CPresProvAdapter::~CPresProvAdapter()
+ {
+
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::~CPresProvAdapter" ) );
+ delete iTitle;
+ delete iDefaultName;
+ iProvItems.ResetAndDestroy();
+ iProvItems.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::ItemCount
+// -----------------------------------------------------------------------------
+//
+TInt CPresProvAdapter::ItemCount() const
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::ItemCount returns %d" ), iProvItems.Count());
+ return iProvItems.Count();
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SummaryTitle
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CPresProvAdapter::SummaryTitle(TInt /*aIndex*/) const
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SummaryTitle" ) );
+ return *iTitle;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SummaryText
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CPresProvAdapter::SummaryText( TInt aIndex ) const
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SummaryText" ) );
+ if( aIndex < iProvItems.Count() )
+ {
+ if( iProvItems[aIndex]->Name().Length() > 0 )
+ {
+ return iProvItems[aIndex]->Name();
+ }
+ }
+ return *iDefaultName;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SaveL
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::SaveL( TInt aItem )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SaveL done" ) );
+ if ( aItem < iProvItems.Count() - 1 )
+ {
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvAdapter::SaveL leaves with KErrArgument" ) );
+ User::Leave ( KErrArgument );
+ }
+ iProvItems[aItem]->SaveL();
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvAdapter::SaveL done" ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::CanSetAsDefault
+// -----------------------------------------------------------------------------
+//
+TBool CPresProvAdapter::CanSetAsDefault( TInt /*aItem*/ ) const
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::CanSetAsDefault" ) );
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SetAsDefaultL
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::SetAsDefaultL( TInt /*aItem*/ )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SetAsDefaultL" ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::DetailsL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CPresProvAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::DetailsL" ) );
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::VisitL( CWPCharacteristic& aCharacteristic )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::VisitL( CWPCharacteristic& aCharacteristic)" ) );
+ if( aCharacteristic.Type() == KWPApplication )
+ {
+ CPresProvItem* item = CPresProvItem::NewL();
+ CleanupStack::PushL( item );
+ aCharacteristic.AcceptL( *item );
+
+ if( item->Validate() )
+ {
+ iProvItems.AppendL( item );
+ CleanupStack::Pop( item );
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( item );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::VisitL
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::VisitL( CWPParameter& /*aParameter*/ )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::VisitL( CWPParameter& /*aParameter*/" ) );
+ // Not used.
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::VisitLinkL
+// -----------------------------------------------------------------------------
+//
+void CPresProvAdapter::VisitLinkL( CWPCharacteristic& /*aLink*/ )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::VisitLinkL( CWPCharacteristic& aLink" ) );
+ // Not used.
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SettingsSavedL
+// -----------------------------------------------------------------------------
+void CPresProvAdapter::SettingsSavedL( const TDesC8& aAppIdOfSavingItem,
+ const TDesC8& aAppRef,
+ const TDesC8& aStorageIdValue )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SettingsSavedL" ) );
+ PRES_PROV_LOG(LOG_LIT8( " aAppIdOfSavingItem: %S, aAppRef: %S, aStorageIdValue: %S " )
+ ,&aAppIdOfSavingItem, &aAppRef, &aStorageIdValue);
+
+ // Convert aAppRef
+ HBufC* appRef16 = HBufC::NewLC( aAppRef.Length() ); // << aAppRef16
+ appRef16->Des().Copy( aAppRef );
+
+ // Offer application references to all provisioned Pres settings
+ // Only 2 possible, so performance doesnt matter
+ for( TInt i(0); i < iProvItems.Count(); i++ )
+ {
+ CPresProvItem* item = iProvItems[i];
+ const RArray<TPtrC>& toAppRefs = item->ToAppReferences();
+
+ // Find application reference that is being offered
+ for( TInt j(0); j < toAppRefs.Count(); j++ )
+ {
+ const TDesC& toAppRef = toAppRefs[j];
+ if( !toAppRef.Compare( *appRef16 ) )
+ {
+ // Set correct application reference
+ if( !aAppIdOfSavingItem.Compare(KPresProvisioningSipId) )
+ {
+ item->SetSipSetIdL( DesToInt(aStorageIdValue) );
+ }
+ else if( !aAppIdOfSavingItem.Compare(KPresProvisioningXdmId) )
+ {
+ item->SetXDMSetIdL( DesToInt(aStorageIdValue) );
+ }
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( appRef16 ); // >>> appRef16
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::GetSavingInfoL
+// -----------------------------------------------------------------------------
+void CPresProvAdapter::GetSavingInfoL( TInt aIndex,
+ RPointerArray<HBufC8>& aSavingInfo )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::GetSavingInfoL" ) );
+
+ if ( aIndex < iProvItems.Count() - 1 )
+ {
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvAdapter::GetSavingInfoL leaves with KErrArgument" ) );
+
+ User::Leave ( KErrArgument );
+ }
+ TInt length ( iProvItems[aIndex]->AppReference().Length() );
+ // if the APPREF exists
+ if ( length > 0 )
+ {
+ // APPID into place [0].
+ TPtrC8 appId ( KPresProvisioningAppId8 );
+ HBufC8* appIdBuf = appId.AllocLC(); // << appIdBuf
+ aSavingInfo.Append( appIdBuf );
+ CleanupStack::Pop( appIdBuf ); // >> appIdBuf
+ appIdBuf = NULL;
+
+ // APPREF into place [1].
+ HBufC8* appRefBuf = HBufC8::NewLC( length ); // << appRefBuf
+ TPtr8 appRef = appRefBuf->Des();
+ appRef.Copy( iProvItems[aIndex]->AppReference() );
+ aSavingInfo.Append( appRefBuf );
+ CleanupStack::Pop( appRefBuf ); // >> appRefBuf
+ appRefBuf = NULL;
+
+ // Pres settings id into place [2].
+ // 10 = max length of 32bit integer
+ HBufC8* idBuf = HBufC8::NewLC( 10 ); // << idBuf
+ TPtr8 id = idBuf->Des();
+ id.Num( iProvItems[aIndex]->PresSetId() );
+ aSavingInfo.Append( idBuf );
+ CleanupStack::Pop( idBuf ); // >> idBuf
+ idBuf = NULL;
+ }
+
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvAdapter::GetSavingInfoL done" ) );
+
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::SavingFinalizedL()
+//
+// -----------------------------------------------------------------------------
+void CPresProvAdapter::SavingFinalizedL()
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvAdapter::SavingFinalizedL" ) );
+ }
+
+// ----------------------------------------------------------------------------
+// CPresProvAdapter::DesToInt
+// ----------------------------------------------------------------------------
+TInt CPresProvAdapter::DesToInt( const TDesC8& aSrcDes ) const
+ {
+ TLex8 lex( aSrcDes );
+ TInt value ( KErrNotFound );
+ lex.Val( value );
+ return value;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/src/presenceprovgroupproxy.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Table of plugins for ECom
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "presenceprovadapter.h"
+#include "presenceprovuid.h"
+
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KPresProvAdapterImplementation, CPresProvAdapter::NewL )
+#else
+ { { KPresProvAdapterImplementation }, CPresProvAdapter::NewL },
+#endif
+ };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+ return KImplementationTable;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presenceprovisioning/src/presenceprovitem.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,455 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: : Implementation for for presenceprovitem
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <CWPParameter.h>
+#include <CWPCharacteristic.h>
+#include <StringLoader.h>
+#include <badesca.h>
+
+#include "presenceprovitem.h"
+#include "pressettingsapi.h"
+#include "presenceprovlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::CPresProvItem
+// -----------------------------------------------------------------------------
+//
+CPresProvItem::CPresProvItem() :
+ iPresSetId(KErrNotFound),
+ iSettingsSaved( EFalse )
+ {
+ iSetName.Set(KNullDesC);
+ iSipProfile = KErrNotFound;
+ iXDMSetting = KErrNotFound;
+ iObjectSize = KErrNotFound;
+ iContSrvrAdd.Set(KNullDesC);
+ iPublicationInt = KErrNotFound;
+ iMaxSubscriptions = KErrNotFound;
+ iMaxContactsInList = KErrNotFound;
+ iDomainSyntax.Set(KNullDesC);
+ iProviderID.Set(KNullDesC);
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPresProvItem* CPresProvItem::NewL()
+ {
+ CPresProvItem* self = new (ELeave) CPresProvItem();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::~CPresProvItem
+// -----------------------------------------------------------------------------
+//
+CPresProvItem::~CPresProvItem()
+ {
+ iToAppReferences.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::Validate
+// -----------------------------------------------------------------------------
+//
+TBool CPresProvItem::Validate() const
+ {
+ // Validate that compulsory settings are received
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::Validate()"));
+
+ if ( !iAppId.Length() )
+ {
+ PRES_PROV_LOG(LOG_LIT8( " iAppId missing" ) );
+ return EFalse;
+ }
+ else if ( iAppId.Compare( KPresProvisioningAppId) )
+ {
+ PRES_PROV_LOG(LOG_LIT8( " Wrong iAppId" ) );
+ return EFalse;
+ }
+ else if (iSetName == KNullDesC)
+ {
+ PRES_PROV_LOG(LOG_LIT8( " iSetName is missing" ));
+ return EFalse;
+ }
+ else if (iToAppReferences.Count() < 2 ) // if SIP and XDM references are not present
+ {
+ PRES_PROV_LOG(LOG_LIT8( " XDM or SIP reference is missing" ));
+ return EFalse;
+ }
+ else if (iObjectSize < NULL)
+ {
+ PRES_PROV_LOG(LOG_LIT8( " iObjectSize is missing" ));
+ return EFalse;
+ }
+ else if (iDomainSyntax == KNullDesC)
+ {
+ PRES_PROV_LOG(LOG_LIT8( " iDomainSyntax is missing" ));
+ return EFalse;
+ }
+ else if (iProviderID == KNullDesC)
+ {
+ PRES_PROV_LOG(LOG_LIT8( " iProviderID is missing" ));
+ return EFalse;
+ }
+ PRES_PROV_LOG(LOG_LIT8( " return True" ) );
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC& CPresProvItem::Name() const
+ {
+ return iSetName;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::ApplicationId
+// -----------------------------------------------------------------------------
+//
+const TDesC& CPresProvItem::ApplicationId() const
+ {
+ return KPresProvisioningAppId;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::PresSetId
+// -----------------------------------------------------------------------------
+//
+TInt CPresProvItem::PresSetId() const
+ {
+ return iPresSetId;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::AppReference
+// -----------------------------------------------------------------------------
+//
+const TDesC& CPresProvItem::AppReference() const
+ {
+ return iAppRef;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::SaveL
+// -----------------------------------------------------------------------------
+//
+TInt CPresProvItem::SaveL()
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::SaveL" ) );
+
+ TInt id(KErrNone);
+
+ if( !iSettingsSaved )
+ {
+ TPresSettingsSet mySet;
+ (mySet.iSetName).Copy(iSetName);
+ mySet.iSipProfile = iSipProfile;
+ mySet.iXDMSetting = iXDMSetting;
+ mySet.iObjectSize = iObjectSize;
+ (mySet.iContSrvrAdd).Copy(iContSrvrAdd);
+ mySet.iPublicationInt = iPublicationInt;
+ mySet.iMaxSubscriptions = iMaxSubscriptions;
+ mySet.iMaxContactsInList = iMaxContactsInList;
+ (mySet.iDomainSyntax).Copy(iDomainSyntax);
+ (mySet.iProviderID).Copy(iProviderID);
+
+ CheckDuplicateNameL(mySet.iSetName, iPresSetId);
+
+ id = PresSettingsApi::CreateSetL(mySet);
+
+ if(id>KErrNotFound)
+ {
+ iSettingsSaved = ETrue;
+ iPresSetId = id;
+ }
+
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::SaveL with Id:%d" ),id);
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::ToAppReferences
+// -----------------------------------------------------------------------------
+//
+const RArray<TPtrC>& CPresProvItem::ToAppReferences() const
+ {
+ return iToAppReferences;
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::VisitL
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::VisitL( CWPCharacteristic& aCharacteristic )
+ {
+ TInt type = aCharacteristic.Type();
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::VisitL CWPCharacteristic %d" ), type );
+ if (type == KWPResource)
+ {
+ aCharacteristic.AcceptL( *this );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::VisitL
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::VisitL( CWPParameter& aParameter )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::VisitL" ) );
+ PRES_PROV_LOG(LOG_LIT(" aParameter.Value(): %S"), &(aParameter.Value()));
+
+ switch( aParameter.ID() )
+ {
+ case EWPParameterAppID:
+ {
+ iAppId.Set( aParameter.Value() );
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterAppID" ) );
+ }
+ break;
+
+ case EWPParameterProviderID:
+ {
+ iProviderID.Set( aParameter.Value() );
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterProviderID" ) );
+ }
+ break;
+
+ case EWPParameterName:
+ {
+ iSetName.Set( aParameter.Value() );
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterName" ) );
+ }
+ break;
+
+ case EWPParameterToAppRef:
+ {
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterToAppRef"));
+ iToAppReferences.Append( aParameter.Value() );
+ }
+ break;
+
+ case EWPParameterAppRef:
+ {
+ iAppRef.Set( aParameter.Value() );
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterAppRef"));
+ }
+ break;
+
+ case EWPParameterService: // some setting tools put SERVICE-URI-TEMPLATE
+ { // with this id
+ iDomainSyntax.Set(aParameter.Value());
+ PRES_PROV_LOG(LOG_LIT8( " EWPParameterService"));
+ }
+ break;
+
+ default:
+ {
+ DetermineNamedParameter( aParameter.Name(), aParameter.Value() );
+ }
+ break;
+ }
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvItem::VisitL ends" ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::DetermineNamedParameter
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::DetermineNamedParameter( const TDesC& aName, const TDesC& aValue )
+ {
+ PRES_PROV_LOG(LOG_LIT( "DetermineNamedParameter(%S, %S)"), &aName, &aValue);
+ if ( !aName.Compare( KPresProvClientObjDataLim ) )
+ {
+ iObjectSize = DesToInt(aValue);
+ }
+ else if ( !aName.Compare( KPresProvContentSrvUri ) )
+ {
+ iContSrvrAdd.Set( aValue );
+ }
+ else if ( !aName.Compare( KPresProvSrcThPublish ) )
+ {
+ iPublicationInt = DesToInt( aValue );
+ }
+ else if ( !aName.Compare( KPresProvMaxPresSubs ) )
+ {
+ iMaxSubscriptions = DesToInt( aValue );
+ }
+ else if ( !aName.Compare( KPresProvMaxPresSubsInLists ) )
+ {
+ iMaxContactsInList = DesToInt( aValue );
+ }
+ else if ( !aName.Compare( KPresProvServiceUriTemp ) )
+ {
+ iDomainSyntax.Set(aValue);
+ }
+ else if (!aName.Compare(KPresIAppRef))
+ {
+ iAppRef.Set(aValue);
+ }
+ else if (!aName.Compare(KPresIToAppRef))
+ {
+ if(iToAppReferences.Count() < 2) // if any of SIP or XDM id is missing
+ iToAppReferences.Append(aValue);
+ }
+ PRES_PROV_LOG(LOG_LIT8( " CPresProvItem::DetermineNamedParameter ends" ) );
+ }
+// -----------------------------------------------------------------------------
+// CPresProvItem::VisitLinkL
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::VisitLinkL( CWPCharacteristic& /*aLink*/ )
+ {
+ PRES_PROV_LOG(LOG_LIT8( "CPresProvItem::VisitLinkL" ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::SetSipSetIdL
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::SetSipSetIdL(TInt aSipId)
+ {
+ PRES_PROV_LOG(LOG_LIT8( "SetSipSetIdL(%d)" ), aSipId);
+ if (iSipProfile == KErrNotFound)
+ iSipProfile = aSipId;
+ if(iPresSetId>KErrNotFound)
+ PresSettingsApi::UpdatePropertyL( iPresSetId, EPresPropSIPProfile, iSipProfile);
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvItem::SetXDMSetIdL
+// -----------------------------------------------------------------------------
+//
+void CPresProvItem::SetXDMSetIdL(TInt aXdmId)
+ {
+ PRES_PROV_LOG(LOG_LIT8( "SetXDMSetIdL(%d)" ), aXdmId);
+ if (iXDMSetting == KErrNotFound)
+ iXDMSetting = aXdmId;
+ if(iPresSetId>KErrNotFound)
+ PresSettingsApi::UpdatePropertyL( iPresSetId, EPresPropXDMSet, iXDMSetting);
+ }
+
+// ---------------------------------------------------------------------------
+// CPresProvItem::GetPrefixL()
+// ---------------------------------------------------------------------------
+//
+HBufC* CPresProvItem::GetPrefixL( HBufC* aName )
+ {
+ TPtrC prefix = aName->Des();
+ TInt lastBrace = aName->LocateReverse('(');
+ if ( lastBrace != KErrNotFound )
+ {
+ // aName looks like "<prefix><brace><something>".
+ // See if <something> is an integer number and
+ // <something> ends to a brace.
+ TPtrC num = aName->Right( aName->Length() - lastBrace - 1 );
+ TInt val;
+ TLex lex( num );
+ if ( lex.Val( val ) == KErrNone && num.Locate(')') == num.Length() - 1 )
+ {
+ // Yes, the trailer is an integer.
+ prefix.Set( aName->Left( lastBrace ) );
+ }
+ }
+ return prefix.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CPresProvAdapter::CheckDuplicateNameL
+// Checks if duplicate named Presence profiles. Renames if same.
+// -----------------------------------------------------------------------------
+void CPresProvItem::CheckDuplicateNameL( TDes& aSetName, const TInt& aSetId)
+ {
+ PRES_PROV_LOG(LOG_LIT(" CheckDuplicateNameL(%S, %d)"),&aSetName, aSetId);
+
+ _LIT( KPresProvNumbering, "(%N)" );
+ const TInt KPresProvFormatExtraLen = 6;
+
+ HBufC* newName = HBufC::NewLC(KPresSetNameMaxLength);
+ newName->Des().Copy(aSetName);
+
+ RArray<TInt> setIds;
+ CleanupClosePushL( setIds );
+ CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC(setIds);
+ TInt count(setIds.Count());
+
+ newName = newName->ReAlloc(
+ newName->Length() + KPresProvFormatExtraLen );// enough for formatting
+
+ HBufC* tempSetName = NULL;
+ TInt pos = 0;// used as dummy
+ TInt found = 0;
+ TInt index = 1;
+ TPtr ptr = newName->Des();
+
+ // do the actual checking of name
+ found = names->Find( *newName, pos );
+ while ( found == 0 )
+ {
+ if ( !tempSetName )
+ {
+ tempSetName = GetPrefixL( newName );
+ tempSetName = tempSetName->ReAlloc(
+ tempSetName->Length() + KPresProvFormatExtraLen );// enough for formatting
+ CleanupStack::PushL( tempSetName );
+ tempSetName->Des().Append( KPresProvNumbering );
+ }
+ StringLoader::Format( ptr, *tempSetName, -1, index );
+ found = names->Find( *newName, pos );
+ index++;
+ }
+
+ // cleanup
+ if ( tempSetName )
+ {
+ CleanupStack::PopAndDestroy( tempSetName ); //tempSetName
+ }
+
+ CleanupStack::PopAndDestroy(names); // names
+ CleanupStack::PopAndDestroy(1); // setIds
+
+ aSetName.Copy(newName->Des());
+ CleanupStack::PopAndDestroy( newName );
+
+ PRES_PROV_LOG(LOG_LIT(" CheckDuplicateNameL(%S): end"),&aSetName);
+ }
+
+// ----------------------------------------------------------------------------
+// CPresProvItem::DesToInt
+// ----------------------------------------------------------------------------
+TInt CPresProvItem::DesToInt( const TDesC& aSrcDes ) const
+ {
+ TLex16 lex( aSrcDes );
+ TInt value ( KErrNotFound );
+ lex.Val( value );
+ return value;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/bwinscw/presencesettingsapiU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+ ??0TPresSettingsSet@@QAE@XZ @ 1 NONAME ; TPresSettingsSet::TPresSettingsSet(void)
+ ?CreateSetL@PresSettingsApi@@SAHVTPresSettingsSet@@@Z @ 2 NONAME ; int PresSettingsApi::CreateSetL(class TPresSettingsSet)
+ ?DecodePropertyStatus@PresSettingsApi@@SA?AW4TPresPropStatus@@HW4TPresSettingsProperty@@@Z @ 3 NONAME ; enum TPresPropStatus PresSettingsApi::DecodePropertyStatus(int, enum TPresSettingsProperty)
+ ?EncodePropertyStatus@PresSettingsApi@@SAXAAHW4TPresPropStatus@@W4TPresSettingsProperty@@@Z @ 4 NONAME ; void PresSettingsApi::EncodePropertyStatus(int &, enum TPresPropStatus, enum TPresSettingsProperty)
+ ?GetAllSetsNamesLC@PresSettingsApi@@SAPAVCDesC16Array@@AAV?$RArray@H@@@Z @ 5 NONAME ; class CDesC16Array * PresSettingsApi::GetAllSetsNamesLC(class RArray<int> &)
+ ?IsStr@PresSettingsApi@@SAHW4TPresSettingsProperty@@@Z @ 6 NONAME ; int PresSettingsApi::IsStr(enum TPresSettingsProperty)
+ ?RemoveSetL@PresSettingsApi@@SAHH@Z @ 7 NONAME ; int PresSettingsApi::RemoveSetL(int)
+ ?SettingsSetL@PresSettingsApi@@SAHHAAVTPresSettingsSet@@@Z @ 8 NONAME ; int PresSettingsApi::SettingsSetL(int, class TPresSettingsSet &)
+ ?UpdatePropertyL@PresSettingsApi@@SAHHW4TPresSettingsProperty@@ABVTDesC16@@@Z @ 9 NONAME ; int PresSettingsApi::UpdatePropertyL(int, enum TPresSettingsProperty, class TDesC16 const &)
+ ?UpdatePropertyL@PresSettingsApi@@SAHHW4TPresSettingsProperty@@H@Z @ 10 NONAME ; int PresSettingsApi::UpdatePropertyL(int, enum TPresSettingsProperty, int)
+ ?UpdateSetL@PresSettingsApi@@SAHVTPresSettingsSet@@H@Z @ 11 NONAME ; int PresSettingsApi::UpdateSetL(class TPresSettingsSet, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/eabi/presencesettingsapiU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+ _ZN15PresSettingsApi10CreateSetLE16TPresSettingsSet @ 1 NONAME
+ _ZN15PresSettingsApi10RemoveSetLEi @ 2 NONAME
+ _ZN15PresSettingsApi10UpdateSetLE16TPresSettingsSeti @ 3 NONAME
+ _ZN15PresSettingsApi12SettingsSetLEiR16TPresSettingsSet @ 4 NONAME
+ _ZN15PresSettingsApi15UpdatePropertyLEi21TPresSettingsPropertyRK7TDesC16 @ 5 NONAME
+ _ZN15PresSettingsApi15UpdatePropertyLEi21TPresSettingsPropertyi @ 6 NONAME
+ _ZN15PresSettingsApi17GetAllSetsNamesLCER6RArrayIiE @ 7 NONAME
+ _ZN15PresSettingsApi20DecodePropertyStatusEi21TPresSettingsProperty @ 8 NONAME
+ _ZN15PresSettingsApi20EncodePropertyStatusERi15TPresPropStatus21TPresSettingsProperty @ 9 NONAME
+ _ZN15PresSettingsApi5IsStrE21TPresSettingsProperty @ 10 NONAME
+ _ZN16TPresSettingsSetC1Ev @ 11 NONAME
+ _ZN16TPresSettingsSetC2Ev @ 12 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+presencesettingsapi.mmp
+
+PRJ_EXPORTS
+../inc/pressettingsapi.h /epoc32/include/mw/pressettingsapi.h
+../inc/simpleenginedomaincrkeys.h /epoc32/include/mw/simpleenginedomaincrkeys.h
+../inc/pressettingsset.h /epoc32/include/mw/pressettingsset.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/group/presencesettingsapi.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: mmp file for presence settings api
+*
+*/
+
+
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET presencesettingsapi.dll
+UID 0x1000008d 0x10281F98
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+TARGETTYPE DLL
+
+SOURCEPATH ../src
+
+SOURCE pressettingsapi.cpp
+SOURCE pressettingsset.cpp
+
+USERINCLUDE ../inc
+
+// default system include paths for middleware layer modules
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY bafl.lib
+LIBRARY euser.lib
+DEBUGLIBRARY flogger.lib
+LIBRARY centralrepository.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../bwinscw/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/inc/pressettingsapilogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is class is logging purposes.
+*
+*/
+
+
+
+
+
+#ifndef _PRESSETTINGSAPILOGGER_H
+#define _PRESSETTINGSAPILOGGER_H
+
+
+// logging is done only in debug
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+//Logging constants
+_LIT(KLogDir, "pressettingsapi");
+_LIT(KLogFile, "pressettingsapi.txt");
+
+#define D_OPENG_LIT(s) _L(s)
+#define OPENG_DP OPENGDebugWriteFormat
+
+
+/**
+* Log file printing utility function
+* @since Series 60 3.0
+*/
+inline void OPENGDebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960
+ {
+ //Use RFileLogger to write log - no time and date
+ RFileLogger logger;
+ logger.Connect();
+ //use date, use time
+ logger.SetDateAndTime( EFalse, ETrue );
+ logger.CreateLog( KLogDir,
+ KLogFile,
+ EFileLoggingModeAppend );
+
+ TBuf< 256 > buffer;
+
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf< 300 > formatted;
+ formatted.FormatList( aFmt, list );
+ buffer.Append( formatted.Left( buffer.MaxLength() - buffer.Length() ) );
+ }
+
+ logger.Write( buffer );
+ logger.CloseLog();
+ logger.Close();
+ }
+
+
+#else // _DEBUG
+
+struct TOPENGEmptyDebugString { };
+
+#define D_OPENG_LIT(s) TOPENGEmptyDebugString()
+
+/// Empty debug print function for release builds.
+inline void OPENG_DP(TOPENGEmptyDebugString)
+ {
+ }
+
+template<class T1>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1)
+ {
+ }
+
+template<class T1,class T2>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2)
+ {
+ }
+
+template<class T1,class T2,class T3>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
+ {
+ }
+
+
+#endif // _DEBUG
+
+
+#endif // _PRESSETTINGSAPILOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/src/pressettingsapi.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,510 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence Settings API designed for creating and editing
+* setting sets for presence. Usually used by UI components.
+*
+*/
+
+
+
+
+// Includes
+#include <centralrepository.h>
+
+#include "pressettingsapi.h"
+#include "pressettingsapilogger.h"
+
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::GetAllSetsNamesLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CDesCArray* PresSettingsApi::GetAllSetsNamesLC( RArray<TInt>& aSetIds )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::GetAllSetsNamesLC"));
+
+ CDesCArrayFlat* sets = new ( ELeave ) CDesCArrayFlat(KPresNormalListLength);
+ CleanupStack::PushL( sets );
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ RArray<TUint32> idKeys;
+ TInt error = repository->FindL( KSimpleSetId, KOnlyColumnInfo, idKeys );
+ CleanupClosePushL( idKeys );
+
+ TInt idCount = idKeys.Count();
+
+ OPENG_DP(D_OPENG_LIT( " idCount = %d"), idCount);
+
+ TBuf<KPresSetNameMaxLength> setName;
+ TInt setId(NULL);
+
+ TInt errID(KErrNone);
+ TInt errName(KErrNone);
+ TUint32 error2(KErrNone);
+ TUint32 row;
+
+ for( TInt i = 0;i < idCount;i++ )
+ {
+ // avoid the 0th and 256th rows
+ if ((idKeys[i]<KUnitRow) || (idKeys[i]>KLastUseableRow))
+ continue;
+
+ row = idKeys[i] & KOnlyRowInfo;
+
+ errName = repository->Get( row + KSimpleSetName, setName );
+ errID = repository->Get( idKeys[i], setId );
+
+ if( (errName != KErrNone) || (errID != KErrNone)) // if some error in getting
+ {
+ // try deleting the troubled row
+ repository->Delete( row, KOnlyRowInfo, error2);
+ OPENG_DP(D_OPENG_LIT( " Error in Get(name): i = %d"),i);
+ OPENG_DP(D_OPENG_LIT( " Error in Get(id) : i = %d"),i);
+ continue;
+ }
+ else
+ {
+ sets->AppendL(setName);
+ aSetIds.Append(setId);
+ }
+ setName.Zero();
+ }
+
+ CleanupStack::PopAndDestroy(&idKeys); //idKeys
+ CleanupStack::PopAndDestroy(repository); //repository
+ return sets;
+
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::CreateSetL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::CreateSetL(TPresSettingsSet aSet )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::CreateSetL"));
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TUint32 row = GetFreshRawInHex(repository);
+ OPENG_DP(D_OPENG_LIT( " row: %d"),row);
+ TInt error(KErrNone);
+ TUint32 error2(KErrNone);
+
+
+ // Create the set id in different way
+ TInt id = CreateUniqueIdL( repository, row );
+
+ OPENG_DP(D_OPENG_LIT( " id: %d"),id);
+
+ error = error + repository->Create( row+KSimpleSetName, aSet.iSetName);
+ error = error + repository->Create( row+KSimpleSipProfile, aSet.iSipProfile );
+ error = error + repository->Create( row+KSimpleXDMSet, aSet.iXDMSetting );
+ error = error + repository->Create( row+KSimpleClientObjDataLimit, aSet.iObjectSize );
+ error = error + repository->Create( row+KSimpleContentSvrAdd, aSet.iContSrvrAdd );
+ error = error + repository->Create( row+KSimpleStatusofProps, aSet.iStatusOfProps );
+ error = error + repository->Create( row+KSimpleSourceThrottlePublish, aSet.iPublicationInt );
+ error = error + repository->Create( row+KSimpleMaxNbrPresenceSubs, aSet.iMaxSubscriptions );
+ error = error + repository->Create( row+KSimpleMaxNbrSubsInList, aSet.iMaxContactsInList );
+ error = error + repository->Create( row+KSimpleServiceUriTemplate, aSet.iDomainSyntax );
+ error = error + repository->Create( row+KSimpleProviderID, aSet.iProviderID );
+
+ if (error<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ User::Leave(KErrCorrupt);
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+
+ OPENG_DP(D_OPENG_LIT( " id: %d"),id);
+ return id;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::UpdateSetL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::UpdateSetL(TPresSettingsSet aSet, TInt aSetID)
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::UpdateSetL(%d)"),aSetID);
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TInt ret(KErrNotFound);
+ TInt error(KErrNone);
+ TUint32 error2(KErrNone);
+
+ TUint32 row = PresSettingsApi::GetRawInHexL(repository,aSetID);
+ OPENG_DP(D_OPENG_LIT( " row: %d, id: %d"),row, aSetID);
+ if(row>0) // if a valid row is found
+ {
+ error = error + repository->Set( row+KSimpleSetName, aSet.iSetName);
+ error = error + repository->Set( row+KSimpleSipProfile, aSet.iSipProfile );
+ error = error + repository->Set( row+KSimpleXDMSet, aSet.iXDMSetting );
+ error = error + repository->Set( row+KSimpleClientObjDataLimit, aSet.iObjectSize );
+ error = error + repository->Set( row+KSimpleContentSvrAdd, aSet.iContSrvrAdd );
+ error = error + repository->Set( row+KSimpleStatusofProps, aSet.iStatusOfProps );
+ error = error + repository->Set( row+KSimpleSourceThrottlePublish, aSet.iPublicationInt );
+ error = error + repository->Set( row+KSimpleMaxNbrPresenceSubs, aSet.iMaxSubscriptions );
+ error = error + repository->Set( row+KSimpleMaxNbrSubsInList, aSet.iMaxContactsInList );
+ error = error + repository->Set( row+KSimpleServiceUriTemplate, aSet.iDomainSyntax );
+ error = error + repository->Set( row+KSimpleProviderID, aSet.iProviderID );
+
+
+ if (error<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ ret = KErrCorrupt;
+ }
+ else
+ ret = KErrNone;
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::RemoveSetL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::RemoveSetL( TInt aSetID )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::RemoveSetL"));
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TInt ret(KErrNotFound);
+ TUint32 error(KErrNone);
+ TUint32 error2(KErrNone);
+
+ TUint32 row = PresSettingsApi::GetRawInHexL(repository,aSetID);
+ OPENG_DP(D_OPENG_LIT( " row: %d, id: %d"),row, aSetID);
+ if(row>0) // if a valid row is found
+ {
+ //Delete all entries on the row
+ TInt retError = repository->Delete( row, KOnlyRowInfo, error);
+ if (retError<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ ret = KErrCorrupt;
+ }
+ else
+ ret = KErrNone;
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::UpdatePropertyL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::UpdatePropertyL( TInt aSetID,
+ TPresSettingsProperty aPropertyName,
+ TInt aPropValueInt
+ )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::UpdatePropertyL"));
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TInt ret(KErrNotFound);
+ TInt error(KErrNone);
+ TUint32 error2(KErrNone);
+
+ TUint32 row = PresSettingsApi::GetRawInHexL(repository,aSetID);
+ OPENG_DP(D_OPENG_LIT( " row: %d, id: %d"),row, aSetID);
+ if(row>0) // if a valid row is found
+ {
+ if((IsStr(aPropertyName))||(aPropertyName==EPresPropSetID))
+ {
+ // because property and its value doesnt match
+ ret = KErrArgument;
+ }
+ else
+ {
+ error = repository->Set( row+aPropertyName, aPropValueInt );
+ if (error<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ ret = KErrCorrupt;
+ }
+ else
+ ret = KErrNone;
+ }
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::UpdatePropertyL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::UpdatePropertyL( TInt aSetID,
+ TPresSettingsProperty aPropertyName,
+ const TDesC& aPropValueDes
+ )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::UpdatePropertyL"));
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TInt ret(KErrNotFound);
+ TInt error(KErrNone);
+ TUint32 error2(KErrNone);
+
+ TUint32 row = PresSettingsApi::GetRawInHexL(repository,aSetID);
+ OPENG_DP(D_OPENG_LIT( " row: %d, id: %d"),row, aSetID);
+ if(row>0) // if a valid row is found
+ {
+ if((!IsStr(aPropertyName))||(aPropertyName==EPresPropSetID))
+ {
+ // because property and its value doesnt match
+ ret = KErrArgument;
+ }
+ else
+ {
+ error = repository->Set( row+aPropertyName, aPropValueDes );
+ if (error<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ ret = KErrCorrupt;
+ }
+ else
+ ret = KErrNone;
+ }
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::SettingsSetL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt PresSettingsApi::SettingsSetL(TInt aSetID, TPresSettingsSet& aSet)
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::SettingsSetL"));
+
+ CRepository* repository = CRepository::NewL( KCRUIDSimpleOTA );
+ CleanupStack::PushL( repository );
+
+ TInt ret(KErrNotFound);
+ TInt error(KErrNone);
+ TUint32 error2(KErrNone);
+
+ TUint32 row = PresSettingsApi::GetRawInHexL(repository,aSetID);
+ OPENG_DP(D_OPENG_LIT( " row: %d, id: %d"),row, aSetID);
+ if(row>0) // if a valid row is found
+ {
+ error = error + repository->Get( row+KSimpleSetName, aSet.iSetName);
+ error = error + repository->Get( row+KSimpleSipProfile, aSet.iSipProfile );
+ error = error + repository->Get( row+KSimpleXDMSet, aSet.iXDMSetting );
+ error = error + repository->Get( row+KSimpleClientObjDataLimit, aSet.iObjectSize );
+ error = error + repository->Get( row+KSimpleContentSvrAdd, aSet.iContSrvrAdd );
+ error = error + repository->Get( row+KSimpleStatusofProps, aSet.iStatusOfProps );
+ error = error + repository->Get( row+KSimpleSourceThrottlePublish, aSet.iPublicationInt );
+ error = error + repository->Get( row+KSimpleMaxNbrPresenceSubs, aSet.iMaxSubscriptions );
+ error = error + repository->Get( row+KSimpleMaxNbrSubsInList, aSet.iMaxContactsInList );
+ error = error + repository->Get( row+KSimpleServiceUriTemplate, aSet.iDomainSyntax );
+ error = error + repository->Get( row+KSimpleProviderID, aSet.iProviderID );
+
+ if (error<0) // was there one of more errors then try deleting this currupt row
+ {
+ error = repository->Delete( row, KOnlyRowInfo, error2);
+ ret = KErrCorrupt;
+ }
+ else
+ ret = KErrNone;
+ }
+
+ CleanupStack::PopAndDestroy(repository); //repository
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// PresSettingsApi::DecodePropertyStatus
+// ---------------------------------------------------------
+//
+EXPORT_C TPresPropStatus PresSettingsApi::DecodePropertyStatus(TInt aStatusOfProps,
+ TPresSettingsProperty aPropertyName)
+ {
+ TInt shiftNumber = (aPropertyName-1) * 2;
+ TInt maskNumber = 0x3 << shiftNumber;
+ return TPresPropStatus((aStatusOfProps & maskNumber)>>shiftNumber);
+ }
+
+// ---------------------------------------------------------
+// PresSettingsApi::EncodePropertyStatus
+// ---------------------------------------------------------
+//
+EXPORT_C void PresSettingsApi::EncodePropertyStatus(TInt& aStatusOfProps,
+ TPresPropStatus aPropertyStatus,
+ TPresSettingsProperty aPropertyName)
+ {
+ TInt shiftNumber = (aPropertyName-1) * 2;
+ TInt maskNumber = (0x3 << shiftNumber)^KFullValue;
+ aStatusOfProps = (aStatusOfProps & maskNumber) | (aPropertyStatus << shiftNumber);
+ }
+
+// ---------------------------------------------------------
+// PresSettingsApi::IsStr
+// ---------------------------------------------------------
+//
+EXPORT_C TBool PresSettingsApi::IsStr( TPresSettingsProperty aProperty )
+ {
+ OPENG_DP(D_OPENG_LIT( "PresSettingsApi::IsStr"));
+ TBool ret(EFalse);
+ if((aProperty==KSimpleSetName)||(aProperty==KSimpleContentSvrAdd)||
+ (aProperty==KSimpleProviderID)||(aProperty==KSimpleServiceUriTemplate))
+ ret = ETrue;
+
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// PresSettingsApi::GetRawInHexL
+// ---------------------------------------------------------------------------
+//
+TUint32 PresSettingsApi::GetRawInHexL( CRepository* aRepository, TInt aSetID )
+ {
+ OPENG_DP(D_OPENG_LIT( " PresSettingsApi::GetRawInHexL"));
+ TInt error(KErrNone);
+ TInt tempValue(0);
+ TUint32 ret(0);
+
+ // Find all SetId keys
+ RArray<TUint32> idKeys;
+ error = aRepository->FindL( KSimpleSetId, KOnlyColumnInfo, idKeys );
+ CleanupClosePushL( idKeys );
+ User::LeaveIfError(error);
+
+ TInt count = idKeys.Count();
+ OPENG_DP(D_OPENG_LIT( " count: %d"),count);
+
+ // start from 1st row and search the whole range of rows
+ for (TInt i=0; i<count; i++)
+ {
+ // avoid the 0th and 256th rows
+ if ((idKeys[i]<KUnitRow) || (idKeys[i]>KLastUseableRow))
+ continue;
+ error = aRepository->Get(idKeys[i], tempValue);
+ User::LeaveIfError(error);
+
+ if(tempValue == aSetID)
+ {
+ ret = idKeys[i] & KOnlyRowInfo; // remove column info and return
+ break;
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //idKeys
+ OPENG_DP(D_OPENG_LIT( " ret: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// PresSettingsApi::CreateUniqueIdL
+// ---------------------------------------------------------
+//
+TInt PresSettingsApi::CreateUniqueIdL( CRepository* aRepository,
+ TUint32 aRowInHex )
+ {
+ OPENG_DP(D_OPENG_LIT( " PresSettingsApi::CreateUniqueIdL aRowInHex:%d"),aRowInHex);
+
+ TInt error(KErrNone);
+
+ // At row = KLastRow(0x10000), column = KSimpleSetId, we store the Set Ids which have been allocated
+ // each time we +1 to get a fresh Set Id
+ TInt setId(0);
+ error = aRepository->Get(KLastRow+KSimpleSetId, setId);
+ if (error==KErrNotFound) // first time writing
+ {
+ error = aRepository->Create(KLastRow+KSimpleSetId, setId);
+ }
+ //if we cant create nor get then leave
+ User::LeaveIfError(error);
+
+ //increase the id to have the next one
+ setId++;
+
+ // set this id back to allocated ids storage
+ error = aRepository->Set(KLastRow+KSimpleSetId, setId);
+ User::LeaveIfError(error);
+
+ //put id to the provided row
+ error = aRepository->Create( aRowInHex+KSimpleSetId, setId );
+ User::LeaveIfError(error);
+
+ OPENG_DP(D_OPENG_LIT( " setId: %d"),setId);
+ return setId;
+ }
+
+// ---------------------------------------------------------
+// PresSettingsApi::GetFreshRawInHex
+// ---------------------------------------------------------
+//
+TUint32 PresSettingsApi::GetFreshRawInHex( CRepository* aRepository )
+ {
+ OPENG_DP(D_OPENG_LIT( " PresSettingsApi::GetFreshRawInHex"));
+ TInt error(KErrNone);
+ TInt tempValue(NULL);
+ TUint32 i(NULL);
+
+ //search for ids on all rows
+ for (i=KUnitRow+KSimpleSetId; i<KLastRow; i+=KUnitRow)
+ {
+ error = aRepository->Get(i, tempValue);
+
+ // if this value is 0 or row doesnt exists
+ if((tempValue==0)||(error==KErrNotFound))
+ {
+ OPENG_DP(D_OPENG_LIT( " found at, error:%d, i:%d"),error, i);
+ error = KErrNone;
+ break;
+ }
+
+ tempValue = NULL;
+
+ //break if there is any other error
+ if(error<0)
+ return error;
+ }
+ i = i & KOnlyRowInfo; // remove the column info from row
+ OPENG_DP(D_OPENG_LIT( " i: %d"),i);
+ return i;
+ }
+
+//end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/presencesettingsapi/src/pressettingsset.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class represents the data of a presence settings set.
+* PresSettingsAPI deals with the Sets of all
+* presence settings.
+*
+*/
+
+
+
+
+#include "pressettingsset.h"
+
+// -----------------------------------------------------------------------------
+// TPresSettingsSet::TPresSettingsSet( )
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPresSettingsSet::TPresSettingsSet()
+ {
+ iSetName = KNullDesC;
+ iSipProfile = KErrNotFound;
+ iXDMSetting = KErrNotFound;
+ iObjectSize = KErrNotFound;
+ iContSrvrAdd.Copy(KNullDesC);
+ iStatusOfProps = NULL; // All settings are open
+ iPublicationInt = KErrNotFound;
+ iMaxSubscriptions = KErrNotFound;
+ iMaxContactsInList = KErrNotFound;
+ iDomainSyntax = KNullDesC;
+ iProviderID = KNullDesC;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/rom/simpleengine.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file provides the information of creating ROM image.
+*
+*/
+
+
+
+
+#ifndef __SIMPLEENGINE_IBY__
+#define __SIMPLEENGINE_IBY__
+
+#ifdef __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+file=ABI_DIR\BUILD_DIR\simpleengine.dll SHARED_LIB_DIR\simpleengine.dll
+file=ABI_DIR\BUILD_DIR\simplesiputils.dll SHARED_LIB_DIR\simplesiputils.dll
+file=ABI_DIR\BUILD_DIR\simplexmlutils.dll SHARED_LIB_DIR\simplexmlutils.dll
+file=ABI_DIR\BUILD_DIR\rlspresxdm.dll SHARED_LIB_DIR\rlspresxdm.dll
+file=ABI_DIR\BUILD_DIR\presencesettingsapi.dll SHARED_LIB_DIR\presencesettingsapi.dll
+
+ECOM_PLUGIN(PresenceDM.dll, 10282415.rsc)
+ECOM_PLUGIN(PresenceProvisioning.dll, 10282417.rsc)
+
+// backup registry
+data=DATAZ_\private\10281EEB\backup_registration.xml private\10281EEB\backup_registration.xml
+
+#endif // __SIP_SIMPLE_PRESENCE_PROTOCOL
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/rom/simpleengineresources.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file provides the localization text strings for presence provisioning.
+*
+*/
+
+
+
+
+#ifndef __SIMPLEENGINE_RESOURCES_IBY__
+#define __SIMPLEENGINE_RESOURCES_IBY__
+
+#include <bldvariant.hrh>
+#ifdef __SIP_SIMPLE_PRESENCE_PROTOCOL
+
+data=DATAZ_\RESOURCE_FILES_DIR\PresenceProvisioningTexts.RSC RESOURCE_FILES_DIR\PresenceProvisioningTexts.RSC
+
+#endif //__SIP_SIMPLE_PRESENCE_PROTOCOL
+
+#endif //__SIMPLEENGINE_RESOURCES_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/BWINS/simplesiputilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+ ??1CSimpleSipConnection@@UAE@XZ @ 1 NONAME ; CSimpleSipConnection::~CSimpleSipConnection(void)
+ ?CurrentSIPIdentityL@CSimpleSipConnection@@QAE?AVTPtrC8@@XZ @ 2 NONAME ; class TPtrC8 CSimpleSipConnection::CurrentSIPIdentityL(void)
+ ?DispatchReqL@CSimpleSipConnection@@QAEXAAVMSimpleEngineRequest@@@Z @ 3 NONAME ; void CSimpleSipConnection::DispatchReqL(class MSimpleEngineRequest &)
+ ?NewL@CSimpleSipConnection@@SAPAV1@XZ @ 4 NONAME ; class CSimpleSipConnection * CSimpleSipConnection::NewL(void)
+ ?SIPState@CSimpleSipConnection@@QAE?AW4TSimpleSipState@@XZ @ 5 NONAME ; enum TSimpleSipState CSimpleSipConnection::SIPState(void)
+ ?SIPStatus@CSimpleSipConnection@@QAEIHAAH@Z @ 6 NONAME ; unsigned int CSimpleSipConnection::SIPStatus(int, int &)
+ ?SetServiceId@CSimpleSipConnection@@QAEXJ@Z @ 7 NONAME ; void CSimpleSipConnection::SetServiceId(long)
+ ?SipSubscriptionState@CSimpleSipConnection@@QAE?AW4TSimpleSipSubscriptionState@MSimpleEngineRequest@@AAV3@@Z @ 8 NONAME ; enum MSimpleEngineRequest::TSimpleSipSubscriptionState CSimpleSipConnection::SipSubscriptionState(class MSimpleEngineRequest &)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/EABI/simplesiputilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+EXPORTS
+ _ZN20CSimpleSipConnection12DispatchReqLER20MSimpleEngineRequest @ 1 NONAME
+ _ZN20CSimpleSipConnection12SetServiceIdEl @ 2 NONAME
+ _ZN20CSimpleSipConnection19CurrentSIPIdentityLEv @ 3 NONAME
+ _ZN20CSimpleSipConnection20SipSubscriptionStateER20MSimpleEngineRequest @ 4 NONAME
+ _ZN20CSimpleSipConnection4NewLEv @ 5 NONAME
+ _ZN20CSimpleSipConnection8SIPStateEv @ 6 NONAME
+ _ZN20CSimpleSipConnection9SIPStatusEiRi @ 7 NONAME
+ _ZN20CSimpleSipConnectionD0Ev @ 8 NONAME
+ _ZN20CSimpleSipConnectionD1Ev @ 9 NONAME
+ _ZN20CSimpleSipConnectionD2Ev @ 10 NONAME
+ _ZTI14CSimpleRequest @ 11 NONAME ; #<TI>#
+ _ZTI18CSimpleExpiryTimer @ 12 NONAME ; #<TI>#
+ _ZTI18CSimpleSettingFile @ 13 NONAME ; #<TI>#
+ _ZTI19CSimpleRefreshTimer @ 14 NONAME ; #<TI>#
+ _ZTI20CSimpleSipConnection @ 15 NONAME ; #<TI>#
+ _ZTI25CSimpleSipProfileObserver @ 16 NONAME ; #<TI>#
+ _ZTI28CSimpleSipConnectionObserver @ 17 NONAME ; #<TI>#
+ _ZTV14CSimpleRequest @ 18 NONAME ; #<VT>#
+ _ZTV18CSimpleExpiryTimer @ 19 NONAME ; #<VT>#
+ _ZTV18CSimpleSettingFile @ 20 NONAME ; #<VT>#
+ _ZTV19CSimpleRefreshTimer @ 21 NONAME ; #<VT>#
+ _ZTV20CSimpleSipConnection @ 22 NONAME ; #<VT>#
+ _ZTV25CSimpleSipProfileObserver @ 23 NONAME ; #<VT>#
+ _ZTV28CSimpleSipConnectionObserver @ 24 NONAME ; #<VT>#
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIP utils build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+simplesiputils.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/group/simplesiputils.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for simplesiputils
+*
+*/
+
+
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET simplesiputils.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10281EEC
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE simplesipconnection.cpp
+SOURCE simplesipconnectionobserver.cpp
+SOURCE simplesipprofileobserver.cpp
+SOURCE simplerequest.cpp
+SOURCE simplerefreshtimer.cpp
+SOURCE simplesettings.cpp
+SOURCE simpledebugutils.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../api
+USERINCLUDE ../../inc
+
+// default system include paths for middleware layer modules
+APP_LAYER_SYSTEMINCLUDE
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib // file server
+DEBUGLIBRARY apparc.lib
+LIBRARY estor.lib // RReadStream
+LIBRARY euser.lib
+LIBRARY sipclient.lib
+LIBRARY sipprofilecli.lib
+LIBRARY inetprotutil.lib
+LIBRARY sipcodec.lib
+LIBRARY bafl.lib // string pool
+LIBRARY centralrepository.lib
+LIBRARY presencesettingsapi.lib
+// access to uiservicetabsettings
+LIBRARY vimpstsettings.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simpledebugutils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DEBUG utilities, for DEBUG version only
+*
+*/
+
+
+
+
+#ifndef simpledebugutils_H
+#define simpledebugutils_H
+
+#include <e32std.h>
+#include <s32file.h>
+
+// FORWARD DECLARATION
+class RFs;
+class RFileReadStream;
+
+#ifdef _DEBUG
+
+//**********************************
+// TSimpleLogger
+//**********************************
+class TSimpleLogger
+ {
+public:
+ static void Log(TRefByValue<const TDesC> aFmt,...); //lint !e960
+ static void Dump( const TDesC8& aData, RFs& aFs, TInt aMode );
+ };
+
+#endif // _DEBUG
+
+//**********************************
+// CSimpleSettingFile
+// Constructor and destructor must be present in DEBUG version
+// also in order to keep ordinal numbers identical between UDEB
+// and UREL versions, although this class is used in UDEB method only.
+//**********************************
+class CSimpleSettingFile: public CBase
+ {
+public:
+
+ virtual ~CSimpleSettingFile();
+
+#ifdef _DEBUG
+
+ /**
+ * Constructor.
+ */
+ static CSimpleSettingFile* NewL(
+ RFs& aFs );
+
+ /**
+ * Opens a file. It is closed in destructor!
+ */
+ void OpenL( TDesC& aResFile );
+
+ /**
+ * Get the key value. Leave with KErrNotFound if not found.
+ */
+ TPtrC8 KeyValueL( const TDesC8& aKey );
+
+#endif // _DEBUG
+
+private:
+ CSimpleSettingFile( RFs& aFs );
+#ifdef _DEBUG
+ void ReadRowL( TPtrC8& aKey, TPtrC8& aValue );
+#endif // _DEBUG
+
+private:
+ // Data
+ RFs& iFs;
+ RFileReadStream iReader;
+ TBuf8<128> iRowBuffer;
+ TFileName iFileName;
+ TBool iOpen;
+ };
+
+#endif // simpledebugutils_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplerefreshtimer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Refreshtimer.
+*
+*/
+
+
+
+
+#ifndef CSimpleRefreshTimer_H
+#define CSimpleRefreshTimer_H
+
+// INLUCDES
+#include <e32base.h>
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class RTimer;
+class MSimpleSipConnCallback;
+class CSimpleRequest;
+
+/**
+ * Refresh timer
+ *
+ * Triggers SIP PUBLISH requests before they expire.
+ *
+ * @lib siputils
+ * @since S60 3.2
+ */
+class CSimpleRefreshTimer : public CActive
+ {
+
+// friend classes go here:
+
+public:
+
+
+ CSimpleRefreshTimer(
+ MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq );
+
+ virtual ~CSimpleRefreshTimer();
+
+ /**
+ * Start timer.
+ *
+ * @since S60 3.2
+ * @param aSec seconds
+ */
+ void Start( TInt aSec );
+
+protected:
+
+// from base class CActive
+
+ /**
+ * From CActive.
+ * Implements cancellation of an outstanding request.
+ *
+ * @since S60 3.2
+ */
+ void DoCancel( );
+
+ /**
+ * From CActive.
+ * Handles an active object's request completion event.
+ *
+ * @since S60 3.2
+ */
+ void RunL( );
+
+ /**
+ * From CActive.
+ * Error routine for RunL exceptions
+ *
+ * @since S60 3.2
+ * @param aError error code
+ */
+ TInt RunError(TInt aError);
+
+
+private: // data
+
+ /**
+ * The actual timer
+ */
+ RTimer iTimer;
+
+ /**
+ * Seconds to wait
+ */
+ TInt iSeconds;
+
+ /**
+ * Engine core
+ */
+ MSimpleSipConnCallback& iEngine;
+
+ /**
+ * The corresponding client request
+ */
+ CSimpleRequest& iRequest;
+
+#ifdef _DEBUG
+ friend class T_CSimpleRefreshTimer;
+#endif
+ };
+
+/**
+ * Expiry timer
+ *
+ * Triggers requests after they expire.
+ *
+ * @lib ?siputils
+ * @since S60 v3.2
+ */
+class CSimpleExpiryTimer : public CActive
+ {
+
+// friend classes go here:
+
+public:
+
+ CSimpleExpiryTimer(
+ MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq );
+
+ virtual ~CSimpleExpiryTimer();
+
+ /**
+ * Start timer.
+ *
+ * @since S60 3.2
+ * @param aSec seconds
+ */
+ void Start( TInt aSec );
+
+protected:
+
+// from base class CActive
+
+ /**
+ * From CActive.
+ * Implements cancellation of an outstanding request.
+ *
+ * @since S60 3.2
+ */
+ void DoCancel( );
+
+ /**
+ * From CActive.
+ * Handles an active object's request completion event.
+ *
+ * @since S60 3.2
+ */
+ void RunL( );
+
+ /**
+ * From CActive.
+ * Error routine for RunL exceptions
+ *
+ * @since S60 3.2
+ * @param aError error code
+ */
+ TInt RunError(TInt aError);
+
+private: // data
+
+ /**
+ * The actual timer
+ */
+ RTimer iTimer;
+
+ /**
+ * Seconds to wait
+ */
+ TInt iSeconds;
+
+ /**
+ * Engine core
+ */
+ MSimpleSipConnCallback& iEngine;
+
+ /**
+ * The corresponding client request
+ */
+ CSimpleRequest& iRequest;
+
+#ifdef _DEBUG
+ friend class T_CSimpleRefreshTimer;
+#endif
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplerequest.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine request
+*
+*/
+
+
+
+
+#ifndef CSimpleRequest_H
+#define CSimpleRequest_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "simplecommon.h"
+#include "simplesipconncallback.h"
+#include "simplecommon.h"
+#include "msimpleenginerequest.h"
+#include "simplerefreshtimer.h"
+
+// FORWARD DECLARATIONS
+class CSimpleSipProfileObserver;
+class CSIPClientTransaction;
+class CSIPSubscribeDialogAssoc;
+class CSimpleRefreshTimer;
+class CSIPRefresh;
+
+// CLASS DECLARATION
+
+/**
+ * Client request buffer element
+ *
+ * @lib siputils
+ * @since S60 3.2
+ */
+class CSimpleRequest : public CBase
+{
+public:
+
+/** request type */
+enum TSimpleSipReqType
+ {
+ EReqRegister=1,
+ EReqPublish,
+ EReqSubscribe,
+ EReqSubscribeList,
+ EReqSubscribeWinfo,
+ EReqListenEvents,
+ EReqSendIM,
+ EReqReceiveIM
+ };
+
+/** request state */
+enum TSimpleReqState
+ {
+ ESimpleInit=1,
+ ESimplePendingInit,
+ ESimpleRunningInit,
+ ESimpleActive,
+ ESimpleComplete,
+ ESimpleFailed,
+ ESimpleStopping,
+ ESimplePending,
+ ESimpleReTry,
+ ESimpleRunning,
+ ESimpleActiveSubs,
+ ESimpleDialogReCre,
+ ESimpleDeleting
+ };
+
+/** pending state substate */
+enum TSimplePendingSubState
+ {
+ ENoPending=0,
+ EPendingModify,
+ EPendingRefresh,
+ EPendingModifyAndRefresh
+ };
+
+
+ /**
+ * Contructor
+ * @param aEngine engine api callback implementation
+ * @param aReq client request
+ * @param aType request type
+ * @param aExpires SIP expiry time of the request
+ */
+ static CSimpleRequest* NewL(
+ MSimpleSipConnCallback& aEngine,
+ MSimpleEngineRequest& aReq,
+ TSimpleSipReqType aType,
+ TUint aExpires );
+
+ /**
+ * Destructor
+ */
+ void Destroy();
+
+ /**
+ * Destructor
+ */
+ void DestroyStart();
+
+ inline static TInt LinkOffset();
+
+ /**
+ * Client request accessor
+ *
+ * @since S60 3.2
+ * @return client request
+ */
+ MSimpleEngineRequest& Request();
+
+ /**
+ * Client SIP transaction accessor
+ *
+ * @since S60 3.2
+ * @return SIP transaction, may be NULL.
+ */
+ CSIPClientTransaction* Transaction();
+
+ /**
+ * Client SIP transaction setter
+ *
+ * @since S60 3.2
+ * @param aTrans SIP transaction
+ */
+ void SetTransaction( CSIPClientTransaction* aTrans );
+
+ /**
+ * CSIPRefresh entity accessor
+ *
+ * @since S60 3.2
+ * @return CSIPRefresh entity
+ */
+ CSIPRefresh* Refresh();
+
+ /**
+ * If the request matches with the transaction
+ *
+ * @since S60 3.2
+ * @param aTrans transaction
+ * @return ETrue if matches
+ */
+ TBool Match( CSIPClientTransaction& aTrans );
+
+ /**
+ * If the request matches with the transaction
+ *
+ * @since S60 3.2
+ * @param aType transaction type
+ * @return ETrue if matches
+ */
+ TBool Match( TSimpleSipReqType aType ) const;
+
+ /**
+ * If the request matches with the transaction
+ *
+ * @since S60 3.2
+ * @param aDialog dialog
+ * @return ETrue if matches
+ */
+ TBool Match( const CSIPDialog& aDialog ) const;
+
+ /**
+ * If the request matches with client request
+ *
+ * @since S60 3.2
+ * @param aReq client request
+ * @return ETrue if matches
+ */
+ TBool Match( MSimpleEngineRequest& aReq ) const;
+
+ /**
+ * Complete the pending request
+ *
+ * @since S60 3.2
+ * @param aStatus response status
+ */
+ void Complete( TInt aStatus );
+
+ /**
+ * Complete event request
+ *
+ * @since S60 3.2
+ */
+ void CompleteEvent( );
+
+ /**
+ * Set refresh time for the SIP request
+ *
+ * @since S60 3.2
+ * @param aTime time in seconds
+ */
+ void SetRefreshTime( TUint aTime );
+
+ /**
+ * Refresh time accessor
+ *
+ * @since S60 3.2
+ * @return refresh time in seconds
+ */
+ TUint RefreshTime () const;
+
+ /**
+ * Start refresh timer for this request based
+ * on iRefreshTime.
+ *
+ * @since S60 3.2
+ * @param aTime special time, if iRefreshTime not used
+ */
+ void StartRefreshTimer( TUint aTime = 0 );
+
+ /**
+ * Stop refresh timer
+ *
+ * @since S60 3.2
+ */
+ void StopRefreshTimer();
+
+ /**
+ * Start expiry timer for this request
+ *
+ * @since S60 3.2
+ * @param aTime time
+ */
+ void StartExpiryTimer( TUint aTime );
+
+ /**
+ * Stop expiry timer
+ *
+ * @since S60 3.2
+ */
+ void StopExpiryTimer();
+
+ /**
+ * Counts retry time period
+ *
+ * @since S60 3.2
+ * @return time
+ */
+ TUint RetryTime();
+
+ /**
+ * Counts retry expiry time period
+ *
+ * @since S60 3.2
+ * @return time
+ */
+ TInt RetryExpiryTime();
+
+ /**
+ * Set SIP-ETag value
+ *
+ * @since S60 3.2
+ * @param aTag tag, OWNERSHIP IS TRANSFERRED.
+ */
+ void SetETag( HBufC8* aTag );
+
+ /**
+ * get SIP-ETag value
+ *
+ * @since S60 3.2
+ * @return SIP-ETag value.
+ */
+ TPtrC8 ETag() const;
+
+ /**
+ * Status getter
+ *
+ * @since S60 3.2
+ * @return status
+ */
+ TUint Status() const;
+
+ /**
+ * Status setter
+ *
+ * @since S60 3.2
+ * @param aVal status value
+ */
+ void SetStatus( TUint aVal );
+
+ /**
+ * Dialog setter
+ *
+ * @since S60 3.2
+ * @param aDialog dialog
+ */
+ void SetDialog( CSIPSubscribeDialogAssoc* aDialog );
+
+ /**
+ * Dialog getter
+ *
+ * @since S60 3.2
+ * @return dialog
+ */
+ CSIPSubscribeDialogAssoc* Dialog( );
+
+ /**
+ * State accessor
+ *
+ * @since S60 3.2
+ * @return state
+ */
+ TSimpleReqState ReqState() const;
+
+ /**
+ * State setter
+ *
+ * @since S60 3.2
+ * @param aState state
+ */
+ void SetReqState( TSimpleReqState aState );
+
+ /**
+ * SOURCE-THROTTLE-PUBLISH time setter
+ * @param expiry time in seconds
+ */
+ void SetThrottleTime( TUint aSeconds );
+
+ /**
+ * SOURCE-THROTTLE-PUBLISH time getter
+ *
+ * @since S60 3.2
+ * @return expiry time
+ */
+ TTime ThrottleTime( );
+
+ /**
+ * Retry-After SIP header parameter value accessor
+ *
+ * @since S60 3.2
+ * @return Retry-After SIP header parameter, 0 if not present
+ */
+ TUint RetryAfter();
+
+ /**
+ * Retry-After SIP header parameter value setter
+ *
+ * @since S60 3.2
+ * @param aVal Retry-After SIP header parameter, 0 if not present
+ */
+ void SetRetryAfter( TUint aVal );
+
+ /**
+ * Original error reason setter
+ *
+ * @since S60 3.2
+ * @param aVal error code
+ */
+ void SetReason( TInt aVal );
+
+ /**
+ * Original error reason getter
+ *
+ * @since S60 3.2
+ * @param aVal error code
+ */
+ TInt Reason( );
+
+ /**
+ * Error notify counter increse
+ *
+ * @since S60 3.2
+ */
+ void PlusErrCount( );
+
+ /**
+ * Error notify reset
+ *
+ * @since S60 3.2
+ */
+ void ResetErrCount( );
+
+ /**
+ * Error notify getter
+ *
+ * @since S60 3.2
+ */
+ TInt ErrCount( );
+
+ /**
+ * Pending accessor
+ *
+ * @since S60 3.2
+ * return pending substate
+ */
+ TSimplePendingSubState PendingState();
+
+ /**
+ * Pending state setter
+ *
+ * @since S60 3.2
+ * @param aVal state
+ */
+ void SetPendingState( TSimplePendingSubState aVal );
+
+ /**
+ * Add new Pending state to the current state
+ *
+ * @since S60 3.2
+ * @param aVal state
+ */
+ void AddPendingState( TSimplePendingSubState aVal );
+
+ /**
+ * Access iData
+ *
+ * @since S60 3.2
+ * @return data
+ */
+ TPtrC8 Data() const;
+
+ /**
+ * Set iData
+ *
+ * @since S60 3.2
+ * @param aData data
+ */
+ void SetDataL( const TDesC8& aData );
+
+ /**
+ * Access iRecipientId
+ *
+ * @since S60 5.0
+ * @return recipient ID
+ */
+ TPtrC8 RecipientL() const;
+
+ /**
+ * Set iRecipientId
+ *
+ * @since S60 5.0
+ * @param aRecipientId recipient ID
+ */
+ void SetRecipientL( const TDesC8& aRecipientId );
+
+ /**
+ * Accesor for iGivenETag
+ *
+ * @since S60 3.2
+ * @return true if given ETag
+ */
+ TBool GivenETag() const;
+
+ /**
+ * Setter for iGivenETag
+ *
+ * @since S60 3.2
+ * @param aVal true if given ETag
+ */
+ void SetGivenETag( TBool aVal );
+
+ /**
+ * Accesor for request MIME content type
+ *
+ * @since S60 3.2
+ * @return content type
+ */
+ TPtrC8 RequestContentType();
+
+ /**
+ * Setter for request MIME content type
+ *
+ * @since S60 3.2
+ * @param aData content type
+ */
+
+ void SetRequestContentTypeL( const TDesC8& aData );
+
+ /**
+ * Get SIP Subscription-State.
+ * @return Subscription-State
+ */
+ MSimpleEngineRequest::TSimpleSipSubscriptionState SipSubscriptionState();
+
+
+private:
+
+ /**
+ * contructor
+ */
+ CSimpleRequest( MSimpleSipConnCallback& aEngine,
+ MSimpleEngineRequest& aReq,
+ TSimpleSipReqType aType,
+ TUint aExpires );
+
+ /**
+ * contructor
+ */
+ void ConstructL();
+
+ /**
+ * Keep destructor private since it's easier to
+ * find Destroy() methods in the code when
+ * debugging.
+ *
+ * @since S60 3.2
+ */
+ virtual ~CSimpleRequest();
+
+ /**
+ * Handle state machine of subscription
+ *
+ * @since S60 3.2
+ * @param aStatus status
+ */
+ void DoCompleteSubscription( TInt aStatus );
+
+ /**
+ * Handle notification of subscription and update state machine if terminated.
+ *
+ * @since S60 3.2
+ * @param aStatus status
+ */
+ void DoCompleteNotification( TInt aStatus );
+
+ /**
+ * Handle state machine of publication
+ *
+ * @since S60 3.2
+ * @param aStatus status
+ */
+ void DoCompletePublication( TInt aStatus );
+
+
+private: // data
+
+ TDblQueLink iLink;
+
+ /**
+ * Client callback observer
+ */
+ MSimpleSipConnCallback& iEngine;
+
+ /**
+ * Client request
+ */
+ MSimpleEngineRequest& iReq;
+
+ /**
+ * SIP client transaction
+ * Own,
+ */
+ CSIPClientTransaction* iTrans;
+
+ /**
+ * SIP refresher
+ * Own.
+ */
+ CSIPRefresh* iSipRefresh;
+
+ /**
+ * Request type
+ */
+ TSimpleSipReqType iType;
+
+ /**
+ * Current Refresh period
+ */
+ TUint iRefreshTime;
+
+ /**
+ * Request expiry time in IF
+ */
+ TUint iExpirationTime;
+
+ /**
+ * Refresh timer.
+ * Own.
+ */
+ CSimpleRefreshTimer* iRefreshTimer;
+
+ /**
+ * Refresh timer.
+ * Own.
+ */
+ CSimpleExpiryTimer* iExpiryTimer;
+
+ /**
+ * ETag.
+ * Own.
+ */
+ HBufC8* iETag;
+
+ /**
+ * Subscribe dialog
+ * Own.
+ */
+ CSIPSubscribeDialogAssoc* iDialog;
+
+ /**
+ * SIP status (response)
+ */
+ TUint iStatus;
+
+ /**
+ * Current request state
+ */
+ TSimpleReqState iState;
+
+ /**
+ * The expiry time of SOURCE-THROTTLE-PUBLISH
+ */
+ TTime iThrottleTime;
+
+ /**
+ * SIP header retry-after parameter
+ */
+ TUint iRetryAfter;
+
+ /**
+ * Reason code
+ */
+ TInt iReason;
+
+ /**
+ * Error notify counter
+ */
+ TInt iErrNotify;
+
+ /**
+ * Expires
+ */
+ TUint iExpires;
+
+ /**
+ * Pending request state
+ */
+ TSimplePendingSubState iPendingState;
+
+ /**
+ * Request data
+ * Own.
+ */
+ HBufC8* iData;
+
+ /**
+ * IM message recipient ID
+ * Own.
+ */
+ HBufC8* iRecipientId;
+
+ /**
+ * Request Content type
+ * Own.
+ */
+ HBufC8* iRequestContentType;
+
+ /**
+ * If publish stoppig uses given ETag
+ */
+ TBool iGivenETag;
+
+ /**
+ * SIP Subscription-State
+ */
+ MSimpleEngineRequest::TSimpleSipSubscriptionState iSubscriptionState;
+
+ /**
+ * response counter for subscription stop (unsubscribe)
+ */
+ TInt iRespCount;
+
+#ifdef _DEBUG
+ friend class T_CSimpleRequest;
+ friend class T_CSimpleSipConnectionObserver;
+ friend class CSimpleSipConnCallbackStub;
+#endif
+};
+
+ TInt CSimpleRequest::LinkOffset()
+ {
+ return _FOFF(CSimpleRequest, iLink);
+ }
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplesettings.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Refreshtimer.
+*
+*/
+
+
+
+
+#ifndef simplesettings_H
+#define simplesettings_H
+
+#include <e32std.h>
+#include <s32file.h>
+
+// FORWARD DECLARATION
+class RFs;
+class RFileReadStream;
+class CRepository;
+
+
+//**********************************
+// TSimpleSettings
+//**********************************
+class TSimpleSettings
+ {
+
+public:
+
+ /**
+ * Constructor
+ */
+ TSimpleSettings( );
+
+ /**
+ * Publish-expiry accessor
+ * @return expiry in seconds
+ */
+ TUint ExpiryPuhlish();
+
+ /**
+ * Watcher-expiry accessor
+ * @return expiry in seconds
+ */
+ TUint ExpiryWatcher();
+
+ /**
+ * Api request expiry accessor
+ * @return expiry in seconds
+ */
+ TUint ExpiryApi();
+
+ /**
+ * Winfo-expiry accessor
+ * @return expiry in seconds
+ */
+ TUint ExpiryWinfo();
+
+ /**
+ * CLIENT-OBJ-DATA-LIMIT accessor
+ * @return CLIENT-OBJ-DATA-LIMIT
+ */
+ TInt ObjLimit();
+
+ /**
+ * SOURCE-THROTTLE-PUBLISH accessor
+ * @return SOURCE-THROTTLE-PUBLISH
+ */
+ TInt Throttle();
+
+ /**
+ * MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS accessor
+ * @return MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS
+ */
+ TInt MaxSubscriptions();
+
+ /**
+ * SIP Profile Id
+ * @return SIP Profile Id, 0 means default
+ */
+ TInt SipProfileId();
+
+ /**
+ * Read static settings from central repository
+ */
+ void ReadCentRepSettings( );
+
+ /**
+ * Read OTA settings from central repository
+ * @param aSetId SIMPLE settings id
+ */
+ void ReadOTASettingsL( TInt aSetId );
+
+
+#ifdef _DEBUG
+ /**
+ * Read optional ini file
+ * @param aFs file system handle
+ * @leave if file not found
+ */
+ void ReadIniFileL( RFs& aFs );
+#endif
+
+private:
+
+ /**
+ * Get integer value from Central Repository.
+ * @param aRepository repository
+ * @param aId key id
+ * @return value of the key
+ */
+ TInt TSimpleSettings::GetCenRepIntValueL(
+ CRepository* aRepository,
+ TUint32 aId );
+
+private: //data
+
+ /**
+ * Publish expiry time
+ */
+ TUint iExpiryPuhlish;
+
+ /**
+ * Watcher expiry time
+ */
+ TUint iExpiryWatcher;
+
+ /**
+ * Winfo watcher expiry time
+ */
+ TUint iExpiryWinfo;
+
+ /**
+ * API request expiry time
+ */
+ TUint iExpiryApi;
+
+ /**
+ * CLIENT-OBJ-DATA-LIMIT
+ */
+ TInt iObjLimit;
+
+ /**
+ * SOURCE-THROTTLE-PUBLISH
+ */
+ TInt iThrottle;
+
+ /**
+ * MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS
+ */
+ TInt iMaxSubscriptions;
+
+ /**
+ * Sip Profile Id
+ */
+ TInt iSipProfileId;
+
+#ifdef _DEBUG
+ friend class T_TSimpleSettings;
+ friend class T_CSimpleSipConnection;
+#endif
+ };
+
+#endif // simplesettings_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplesipconncallback.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Callback methods used by SIP stack callback implementations
+*
+*/
+
+
+
+
+#ifndef MSimpleSipConnCallback_H
+#define MSimpleSipConnCallback_H
+
+// INCLUDES
+#include <e32base.h>
+#include "simplecommon.h"
+
+// FORWARD DECLARATIONS
+
+class CSIPConnection;
+class CSIPClientTransaction;
+class CSIPDialogAssocBase;
+class CSIPMessageElements;
+class CSimpleRequest;
+class CSIPDialog;
+
+/**
+ * Callback methods used by SIP stack callback implementations.
+ *
+ * @lib simplesiputils
+ * @since S60 3.2
+ */
+class MSimpleSipConnCallback
+ {
+
+public:
+
+ /**
+ * Connection state is changed
+ *
+ * @since S60 3.2
+ * @param aState new SIP state
+ */
+ virtual void ConnectionStateChange(
+ TSimpleSipState aState, TInt aSipError) = 0;
+
+ /**
+ * Connection method has changed (Roaming).
+ *
+ * @since S60 3.2.3
+ */
+ virtual void ConnectionChanged() = 0;
+
+ /**
+ * Time to refresh a request
+ *
+ * @since S60 3.2
+ * @param aReq corresponding engine's request
+ */
+ virtual void StartToRefreshL( CSimpleRequest& aReq ) = 0;
+
+ /**
+ * Time to check expiration
+ * @param aReq corresponding engine's request
+ */
+ virtual void StartToCheckExpiryL( CSimpleRequest& aReq ) = 0;
+
+ /**
+ * Search the corresponding client request
+ *
+ * @since S60 3.2
+ * @param aTrans SIP transaction
+ * @return request or NULL if request not found
+ */
+ virtual CSimpleRequest* GetRequest( CSIPClientTransaction& aTrans ) = 0;
+
+ /**
+ * Search the corresponding client request
+ *
+ * @since S60 3.2
+ * @param aDialog SIP dialog
+ * @return initial SUBSCRIBE request or NULL if request not found
+ */
+ virtual CSimpleRequest* GetdDialogRequest( const CSIPDialog& aDialog ) = 0;
+
+ /**
+ * Handles publish response.
+ * This reads SIP-ETAG and resets refresh timer.
+ *
+ * @since S60 3.2
+ * @param aMesElems SIP message elements
+ * @param aReq corresponding engine's request
+ */
+ virtual void HandlePublishRespL( const CSIPMessageElements& aMesElems, CSimpleRequest* aReq ) = 0;
+
+ /**
+ * Handles server request in a dialog
+ * This resets refresh timer when needed.
+ *
+ * @since S60 3.2
+ * @param aMesElems SIP message elements
+ * @param aReq corresponding engine's request
+ * @param aMethod SIP method
+ */
+ virtual void HandleDialogRequestL(
+ const CSIPMessageElements& aMesElems,
+ CSimpleRequest& aReq,
+ const TDesC8& aMethod ) = 0;
+
+ /**
+ * Retry publication, with a body when pending data exists.
+ *
+ * @since S60 3.2
+ * @param aReq corresponding engine's request
+ * @return error code
+ */
+ virtual TInt DoSendPendingPublish( CSimpleRequest& aReq ) = 0;
+
+ /**
+ * Handle received message
+ *
+ * @since S60 5.0
+ * @param aFrom message received from
+ * @param aContent message content
+ * @return error code
+ */
+ virtual TInt HandleReceivedMessage( const TDesC8& aFrom,
+ const TDesC8& aContent ) = 0;
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplesipconnection.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,655 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine core.
+*
+*/
+
+
+
+
+#ifndef CSimpleSIPConnection_H
+#define CSimpleSIPConnection_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <sip.h>
+#include <sipobserver.h>
+#include "simplecommon.h"
+#include "simplesipconncallback.h"
+#include "simplecommon.h"
+#include "simplerefreshtimer.h"
+#include "simplerequest.h"
+#include "simplesettings.h"
+
+// FORWARD DECLARATIONS
+class CSimpleSipProfileObserver;
+class CSIPClientTransaction;
+class CSimpleRefreshTimer;
+class CSIPMessageElements;
+class CSIPSubscribeDialogAssoc;
+class CSimpleSipConnectionObserver;
+
+// CLASS DECLARATION
+
+
+
+/**
+ * CSimpleSipConnection
+ *
+ * @lib simplesiputils
+ * @since S60 v3.2
+ */
+
+class CSimpleSipConnection : public CBase,
+ public MSIPObserver,
+ public MSimpleSipConnCallback
+ {
+
+public:
+
+ /**
+ * Subscription types
+ */
+ enum TSimpleSubsType
+ {
+ ESubsRegular,
+ ESubsWinfo,
+ ESubsList
+ };
+
+ /**
+ * Two-phased constructor.
+ */
+ IMPORT_C static CSimpleSipConnection* NewL();
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CSimpleSipConnection();
+
+ /**
+ * Dispatch a client request
+ *
+ * @since S60 v3.2
+ * @param aReq client request
+ */
+ IMPORT_C void DispatchReqL( MSimpleEngineRequest& aReq );
+
+ /**
+ * SIP Status accessor
+ *
+ * @since S60 v3.2
+ * @param aOpId operation id
+ * @param aRetryAfter SIP header value, OUTPUT
+ * @return SIP status, 0 if not found
+ */
+ IMPORT_C TUint SIPStatus( TInt aOpId, TInt& aRetryAfter );
+
+ /**
+ * SIP connection state accessor
+ *
+ * @since S60 v3.2
+ * @return SIP state
+ */
+ IMPORT_C TSimpleSipState SIPState();
+
+ /**
+ * current SIP Identity accessor
+ * @return SIP identity
+ */
+ IMPORT_C TPtrC8 CurrentSIPIdentityL();
+
+ /**
+ * SIP Subscription-state accessor
+ * @param aReq corresponding engine's request
+ * @return subscription-state.
+ */
+ IMPORT_C MSimpleEngineRequest::TSimpleSipSubscriptionState SipSubscriptionState(
+ MSimpleEngineRequest& aReq );
+
+ /**
+ * Set service id
+ * @param aServiceId new service id
+ */
+ IMPORT_C void SetServiceId( TInt32 aServiceId );
+
+ /**
+ * Search the corresponding client request
+ *
+ * @since S60 v3.2
+ * @param aTrans SIP transaction
+ * @return request or NULL if request not found
+ */
+ CSimpleRequest* GetRequest( CSIPClientTransaction& aTrans );
+
+ /**
+ * Search the corresponding client request
+ *
+ * @since S60 v3.2
+ * @param aDialog SIP dialog
+ * @return initial SUBSCRIBE request or NULL if request not found
+ */
+ CSimpleRequest* GetdDialogRequest( const CSIPDialog& aDialog );
+
+ /**
+ * Handles publish response.
+ * This reads SIP-ETAG and resets refresh timer.
+ *
+ * @since S60 v3.2
+ * @param aMesElems SIP message elements
+ * @param aReq corresponding engine's request
+ */
+ void HandlePublishRespL(
+ const CSIPMessageElements& aMesElems,
+ CSimpleRequest* aReq );
+
+ /**
+ * Time to refresh a request
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void StartToRefreshL( CSimpleRequest& aReq );
+
+ /**
+ * Time to check expiration
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void StartToCheckExpiryL( CSimpleRequest& aReq );
+
+ /**
+ * Handles server request in a dialog
+ * This resets refresh timer when needed.
+ *
+ * @since S60 v3.2
+ * @param aMesElems SIP message elements
+ * @param aReq corresponding engine's request
+ * @param aMethod SIP method
+ */
+ void HandleDialogRequestL(
+ const CSIPMessageElements& aMesElems,
+ CSimpleRequest& aReq,
+ const TDesC8& aMethod );
+
+ /**
+ * Retry publication, with a body when pending data exists.
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ * @return error code
+ */
+ TInt DoSendPendingPublish( CSimpleRequest& aReq );
+
+// from base class MSIPObserver
+
+ /**
+ * From MSIPObserver.
+ * A SIP request has been received from the network.
+ * This function is called when the SIP request was received using such
+ * an IAP, for which the application has not created a CSIPConnection
+ * object.
+ *
+ * @since S60 v3.2
+ * @pre aTransaction != 0
+ * @param aIapId The IapId from which the SIP request was received.
+ * @param aTransaction contains local address, remote address of a SIP
+ * message, as well as optional SIP message method, headers and
+ * body. The ownership is transferred.
+ */
+ void IncomingRequest( TUint32 aIapId,
+ CSIPServerTransaction* aTransaction );
+
+ /**
+ * From MSIPObserver.
+ * The received SIP request time-outed and it is invalid i.e. cannot be used
+ * anymore.
+ * This will be called if the user fails to create a SIP connection and
+ * does not send an appropriate SIP response.
+ *
+ * @since S60 v3.2
+ * @param aTransaction The time-outed transaction.
+ */
+ void TimedOut( CSIPServerTransaction& aTransaction );
+
+// from base class MSimpleSipConnCallback
+
+ /**
+ * From MSimpleSipConnCallback.
+ * Connection state is changed
+ *
+ * @since S60 v3.2
+ * @param aState new SIP state
+ */
+ void ConnectionStateChange(
+ TSimpleSipState aState, TInt aSipError );
+
+ /**
+ * Handle received message
+ *
+ * @since S60 v5.0
+ * @param aFrom message received from
+ * @param aContent message content
+ * @return error code
+ */
+ TInt HandleReceivedMessage( const TDesC8& aFrom,
+ const TDesC8& aContent );
+
+ /**
+ * Connection method has changed (Roaming).
+ *
+ * @since S60 3.2.3
+ */
+ void ConnectionChanged();
+
+protected:
+
+ /**
+ * C++ default constructor.
+ */
+ CSimpleSipConnection();
+
+private:
+
+ void ConstructL();
+
+ /**
+ * Search the corresponding client request
+ *
+ * @since S60 v3.2
+ * @param aTrans SIP transaction
+ * @return request or NULL if request not found
+ */
+ CSimpleRequest* GetCliRequest( MSimpleEngineRequest& aRequest );
+
+ /**
+ * Read static settings and register SIP profile.
+ * If already registered then uses the current registeration.
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ * @leave KErrNotFound if SIP profile is not found
+ */
+ void RegisterL( MSimpleEngineRequest& aReg );
+
+ /**
+ * Start to listen to status events
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void ListenStatusL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Start publish transaction
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void StartPublishL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Request instant message receiving
+ *
+ * @since S60 v5.0
+ * @param aReq request
+ */
+ void RequestInstantMessageReceivingL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Send instant message
+ *
+ * @since S60 v5.0
+ * @param aReq request
+ */
+ void SendInstantMessageL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Update publish
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void ModifyPublishL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Stop publish
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void StopPublishL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Start subscription
+ * if aReq expiry time is 0 then it means fetch presence once
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void SubscribeL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Start list subscription
+ * if aReq expiry time is 0 then it means fetch presence once
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void SubscribeListL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Start WINFO subscription
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void SubscribeWinfoL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Stop subscription
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void StopSubscribeL( MSimpleEngineRequest& aReq );
+
+ /**
+ * Delete all pending client requests
+ *
+ * @since S60 v3.2
+ */
+ void DeleteRequests();
+
+ /**
+ * Delete all pending specified type of requests.
+ *
+ * @since S60 5.0
+ * @param aRequestType request type
+ */
+ void DeleteRequests( CSimpleRequest::TSimpleSipReqType aRequestType );
+
+ /**
+ * Destroy the request
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void DeleteRequest( MSimpleEngineRequest& aReq );
+
+ /**
+ * Destroy the request with a delay
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void DeleteRequestStart( MSimpleEngineRequest& aReq );
+
+ /**
+ * Complete all pending register client requests
+ *
+ * @since S60 v3.2
+ * @param aStatus status
+ */
+ void CompleteRegisterRequests( TInt aStatus );
+
+ /**
+ * Complete all open regular client requests
+ *
+ * @since S60 v3.2
+ * @param aStatus status
+ */
+ void CompleteRegularRequests( TInt aStatus );
+
+ /**
+ * Complete status event request
+ *
+ * @since S60 v3.2
+ */
+ void CompleteStatusRequest();
+
+ /**
+ * Fill the headers and content for SIP PUBLISH request
+ * and send the SIP request,
+ *
+ * @since S60 v3.2
+ * @param aRemoteURI remote request-URI
+ * @param aExpiry expires time
+ * @param aContent payload data
+ * @param aSipIfMatch sip-if-match/ETag SIP header value
+ * @return SIP transaction
+ */
+ CSIPClientTransaction* DoPublishL(
+ const TDesC8& aRemoteURI, TInt aExpiry,
+ const TDesC8& aContent, const TDesC8& aSipIfMatch,
+ const TDesC8& aContentType );
+
+ /**
+ * Send SIP SUBSCRIBE request
+ *
+ * @since S60 v3.2
+ * @param aRemoteURI remote request-URI
+ * @param aExpiry expires time
+ * @param aContent payload data
+ * @param aSubsDialog subscription dialog, OUT
+ * @param aRefesh ETrue if subscription is refreshed automatically
+ * @param aType subscription use case
+ * @param aAnonymous ETrue if anonymous subscription is wanted
+ * (should be EFalse always when aType is WINFO subscription)
+ * @return SIP transaction
+ */
+ CSIPClientTransaction* DoSubscribeL(
+ const TDesC8& aRemoteURI,
+ TInt aExpiry,
+ const TDesC8& aContent,
+ CSIPSubscribeDialogAssoc*& aSubsDialog,
+ TBool aRefresh,
+ TSimpleSubsType aType,
+ TBool aAnonymous );
+
+ /**
+ * Read static settings and register default SIP profile.
+ * If already registered then uses the current registeration.
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ * @leave KErrNotFound if SIP profile is not found
+ */
+ void RegisterDefaultL( MSimpleEngineRequest& aReg );
+
+ /**
+ * Read static settings and register a specified SIP profile.
+ * If already registered then uses the current registeration.
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ * @leave KErrNotFound if SIP profile is not found
+ */
+ void RegisterAnyL( MSimpleEngineRequest& aReg );
+
+ /**
+ * Set SIP state
+ *
+ * @since S60 v3.2
+ * @param aState SIP state
+ */
+ void SetSipState( TSimpleSipState aState );
+
+ /**
+ * Converts ascii reason string into enum and stores into aR entity
+ *
+ * @since S60 v3.2
+ * @param aReason reason text
+ * @param aR request entity
+ */
+ void DoSetResponseReason(
+ const TDesC8& aReason, CSimpleRequest& aR );
+
+ /**
+ * Converts ascii reason string into enum and stores into aR entity
+ *
+ * @since S60 v3.2
+ * @param aReason reason
+ * @param aR client request entity
+ */
+ void DoSetResponseReason2(
+ TInt aReason, MSimpleEngineRequest& aR );
+
+ /**
+ * Is the reson code permanent reason
+ *
+ * @since S60 v3.2
+ * @param aReason error code
+ * @return TRUE if permanent resason and should not be retried.
+ */
+ TBool IsPermanentReason( TInt aReason );
+
+ /**
+ * Increase iCurrentNbrSubs
+ *
+ * @since S60 v3.2
+ */
+ void IncreaseNbrSubs();
+
+ /**
+ * Decrease iCurrentNbrSubs
+ *
+ * @since S60 v3.2
+ */
+ void DecreaseNbrSubs();
+
+ /**
+ * Refresh or retry to publish
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void DoRefreshPublishL( CSimpleRequest& aReq );
+
+ /**
+ * Retry to subscribe
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void DoRefreshSubscribe( CSimpleRequest& aReq );
+
+ /**
+ * Create a dialog
+ *
+ * @since S60 v3.2
+ * @param aReq request
+ */
+ void DoCreateDialogL( CSimpleRequest& aReq );
+
+ /**
+ * Handle pending operations after network resume
+ *
+ * @since S60 v3.2
+ */
+ void HandlePendings( );
+
+ /**
+ * Update iSipState.
+ * Recognize if both SIP connection and SIP Profile are active.
+ * @param aState SIP state
+ */
+ void RecognizeSipState( TSimpleSipState aState );
+
+ /**
+ * Handle received message
+ *
+ * @since S60 v5.0
+ * @param aFrom message received from
+ * @param aContent message content
+ * @param aRequest SIMPLE request
+ * @return error code
+ */
+ void DoHandleReceivedMessageL( const TDesC8& aFrom,
+ const TDesC8& aContent, CSimpleRequest& aRequest );
+
+ /**
+ * Stores ETag to vimpstsettingstore
+ *
+ * @since S60 5.0
+ */
+ void StoreETagL( HBufC8& aTag );
+
+private: // Data
+
+ /**
+ * SIP Engine connection
+ * Own
+ */
+ CSIP* iSip;
+
+ /**
+ * SIP connection
+ * Own
+ */
+ CSIPConnection* iSipConnection;
+
+ /**
+ * SIP connection observer
+ * Own
+ */
+ CSimpleSipConnectionObserver* iConnectionObserver;
+
+ /**
+ * Engine SIP state.
+ * Active only if both SIP Connection and SIP Profile are active.
+ */
+ TSimpleSipState iSipState;
+
+ /**
+ * SIP profile observer
+ * Own
+ */
+ CSimpleSipProfileObserver* iProfileObserver;
+
+ /**
+ * Queue for client requests
+ */
+ TDblQue<CSimpleRequest> iRequestList;
+
+ /**
+ * Engine settings
+ */
+ TSimpleSettings iSettings;
+
+ /**
+ * File system
+ */
+ RFs iFs;
+
+ /**
+ * Current number of subscriptions
+ */
+ TUint iCurrentNbrSubs;
+
+ /**
+ * Service id of current service
+ */
+ TInt32 iServiceId;
+
+#ifdef _DEBUG
+ friend class T_CSimpleSipConnection;
+#endif
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplesipconnectionobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,367 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of MSIPConnectionObserver.
+*
+*/
+
+
+
+
+#ifndef CSimpleSipConnectionObserver_H
+#define CSimpleSipConnectionObserver_H
+
+// INCLUDES
+#include <e32base.h>
+#include <sipconnectionobserver.h>
+
+#include "simplecommon.h"
+
+
+// FORWARD DECLARATIONS
+class CSIPRegistrationBinding;
+class CSIPClientTransaction;
+class MSimpleSipConnCallback;
+class CSIPDialogAssocBase;
+class CSIPInviteDialogAssoc;
+class MSimpleEngineRequest;
+
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+// INTERNAL TEST SUITE
+class CSimpleLocalModeUtils;
+#endif
+#endif
+
+
+/**
+ * Implementation of MSIPConnectionObserver.
+ *
+ * @lib simplesiputils
+ * since S60 3.2
+ */
+class CSimpleSipConnectionObserver: public CBase,
+ public MSIPConnectionObserver
+ {
+
+public:
+
+ /**
+ * Two phase constructore
+ * @param aCallback status observer
+ */
+ static CSimpleSipConnectionObserver* NewL( MSimpleSipConnCallback& aCallback );
+
+ /**
+ * destructor
+ */
+ virtual ~CSimpleSipConnectionObserver();
+
+public:
+
+ /**
+ * SIP state accesor
+ *
+ * since S60 3.2
+ * @return SIP state
+ */
+ TSimpleSipState SIPState();
+
+ /**
+ * SIP Profile state has changed.
+ *
+ * since S60 3.2
+ * @param aState indicates the current profile state
+ * @param aSipError SIP error code
+ */
+ void ProfileStateChanged(
+ CSIPConnection::TState aState, TInt aSipError );
+
+ /**
+ * SIP Profile has updated.
+ *
+ * @see MSIPProfileRegistryObserver::EProfileUpdated
+ * @since S60 3.2.3
+ */
+ void ProfileUpdated();
+
+// from base class MSIPConnectionObserver
+
+ /**
+ * A SIP request outside a dialog has been received from the network.
+ * @param aTransaction SIP server transaction
+ * The ownership is transferred.
+ */
+ void IncomingRequest( CSIPServerTransaction* aTransaction );
+
+ /**
+ * A SIP request within a dialog has been received from the network.
+ * The client must resolve the actual dialog association to which
+ * this request belongs.
+ * @param aTransaction SIP server transaction
+ * The ownership is transferred.
+ * @param aDialog the dialog that
+ * this transaction belongs to.
+ */
+ void IncomingRequest(
+ CSIPServerTransaction* aTransaction,
+ CSIPDialog& aDialog );
+
+ /**
+ * A SIP response received from the network.
+ * @param aTransaction contains response elements.
+ */
+ void IncomingResponse( CSIPClientTransaction& aTransaction );
+
+ /**
+ * A SIP response that is within a dialog association or creates
+ * a dialog association.
+ * @param aTransaction contains response elements.
+ * The ownership is transferred.
+ * @param aDialogAssoc a dialog association
+ */
+ void IncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPDialogAssocBase& aDialogAssoc );
+
+ /**
+ * A SIP response that is within a Invite association or creates
+ * a dialog association.
+ * @param aTransaction contains response elements.
+ * The ownership is transferred.
+ * @param aDialogAssoc a dialog association
+ */
+ void IncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPInviteDialogAssoc* aDialogAssoc );
+
+ /**
+ * A SIP response creating a registration binding or an error response
+ * that is related to an refreshed registration binding
+ * has been received from the network.
+ * @param aTransaction contains response elements.
+ * The ownership is transferred.
+ * @param aSIPRegistration associated registration
+ */
+ void IncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPRegistrationBinding& aRegistration );
+
+ /**
+ * An asynchronous error has occured related to a periodical refresh
+ * that relates to a registration.
+ * @param aError error code
+ * @param aSIPRegistration associated registration
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPRegistrationBinding& aRegistration );
+ /**
+ * An asynchronous error has occurred in the stack related
+ * to the request indicated by the given transaction.
+ * @param aError error code
+ * @param aTransaction the failed transaction
+ * @param aRegistration the failed registration
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPClientTransaction& aTransaction,
+ CSIPRegistrationBinding& aRegistration );
+
+ /**
+ * An asynchronous error has occurred in the stack related to the
+ * request indicated by the given transaction.
+ * @param aError error code
+ * @param aTransaction failed transaction
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPTransactionBase& aTransaction );
+
+ /**
+ * An asynchronous error has occured related to a request within
+ * an existing dialog.
+ * @param aError error code
+ * @param aTransaction the failed transaction
+ * @param aDialogAssoc the failed dialog associoation
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPTransactionBase& aTransaction,
+ CSIPDialogAssocBase& aDialogAssoc );
+
+ /**
+ * An asynchronous error has occured related to a refresh
+ * @param aError error code
+ * @param aSIPRefresh original refresh object
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPRefresh& aRefresh );
+
+ /**
+ * An asynchronous error has occured related to a periodical refresh
+ * that belongs to SIP dialog association.
+ * @param aError error code
+ * @param aDialogAssoc SIP dialog association
+ */
+ void ErrorOccured(
+ TInt aError,
+ CSIPDialogAssocBase& aDialogAssoc );
+
+ /**
+ * SIP stack has completed UAC core INVITE transaction 64*T1 seconds
+ * after the reception of the first 2xx response. No more 2xx responses
+ * can be received to the issued single INVITE.
+ *
+ * @param aTransaction a complete UAC core INVITE transaction
+ */
+ void InviteCompleted( CSIPClientTransaction& aTransaction );
+
+ /**
+ * Invite was canceled with the CANCEL
+ * @param aTransaction a canceled INVITE UAS transaction
+ */
+ void InviteCanceled( CSIPServerTransaction& aTransaction );
+
+ /**
+ * Connection state has changed.
+ * @param aState indicates the current connection state
+ */
+ void ConnectionStateChanged( CSIPConnection::TState aState );
+
+
+protected:
+
+ /**
+ * Two-phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Default constructor
+ * @param aCallback status observer
+ */
+ CSimpleSipConnectionObserver( MSimpleSipConnCallback& aCallback );
+
+private:
+
+ /**
+ * Handle Server request data content
+ */
+ void DoHandleSrvrReqContentL(
+ const CSIPMessageElements& aElems,
+ MSimpleEngineRequest& aR );
+
+ /**
+ * A SIP request outside a dialog has been received from the network.
+ *
+ * since S60 5.0
+ * @param aTransaction SIP server transaction
+ * The ownership is transferred.
+ */
+ void DoIncomingRequestL( CSIPServerTransaction* aTransaction );
+
+ /**
+ * A SIP request within a dialog has been received from the network.
+ * The client must resolve the actual dialog association to which
+ * this request belongs.
+ * @param aTransaction SIP server transaction
+ * The ownership is transferred.
+ * @param aDialog the dialog that
+ * this transaction belongs to.
+ */
+ void DoIncomingRequestL(
+ CSIPServerTransaction* aTransaction,
+ CSIPDialog& aDialog );
+
+ /**
+ * A SIP response received from the network.
+ * @param aTransaction contains response elements.
+ */
+ void DoIncomingResponse( CSIPClientTransaction& aTransaction );
+
+ /**
+ * A SIP response that is within a dialog association or creates
+ * a dialog association.
+ * @param aTransaction contains response elements.
+ * The ownership is transferred.
+ * @param aDialogAssoc a dialog association
+ */
+ void DoIncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPDialogAssocBase& aDialogAssoc );
+
+ /**
+ * Convert Sip error code to the S60 error code
+ * @param aSip SIP error code
+ * @param aRetryAfter wheter retry-after header is available
+ * @param aPublishModify wheteer publish modify request
+ * @return S60 error code
+ */
+ TInt ConvertSipCode( TUint aSip, TBool aRetryAfter, TBool aPublishModify );
+
+ /**
+ * Convert Sip publish modify error code to the S60 error code
+ * @param aSip SIP error code
+ * @return S60 error code
+ */
+ TInt ConvertSipModifyCode( TUint aSip );
+
+ /**
+ * Get retry-after SIP header value
+ * @param aElems
+ * @return retry-after value
+ */
+ TUint GetRetryAfter( const CSIPResponseElements* aElems );
+
+ /**
+ * Connection state has changed.
+ *
+ * since S60 3.2
+ * @param aState indicates the current connection state
+ * @param aSipError SIP error code
+ */
+ void ConnectionStateChanged2(
+ CSIPConnection::TState aState, TInt aSipError );
+
+
+private: // data
+
+ /**
+ * callback observer
+ */
+ MSimpleSipConnCallback& iCallback;
+
+ /**
+ * Error code from network
+ */
+ TInt iError;
+
+
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ * Own.
+ */
+ CSimpleLocalModeUtils* iLocalModeUtils;
+#endif
+#endif
+
+#ifdef _DEBUG
+ friend class T_CSimpleSipConnectionObserver;
+#endif
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/inc/simplesipprofileobserver.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: profile observer
+*
+*/
+
+
+
+
+#ifndef CSImpleSipProfileObserver_H
+#define CSImpleSipProfileObserver_H
+
+// INCLUDES
+#include <e32base.h>
+#include <sipprofileregistryobserver.h>
+
+#include "simplesipconnectionobserver.h"
+
+// FORWARD DECLARATIONS
+class CSIPProfileRegistry;
+class CSIPProfile;
+
+// CLASS DECLARATIONS
+
+class CSimpleSipProfileObserver: public CBase, public MSIPProfileRegistryObserver
+{
+
+public:
+
+ ~CSimpleSipProfileObserver();
+
+ /**
+ * Two phase constructor
+ * @param aSIP SIP core connection
+ * @param aObs SIP connection observer for callbacks
+ */
+ static CSimpleSipProfileObserver* NewL( CSIP* aSIP, CSimpleSipConnectionObserver& aObs );
+
+ /**
+ * Register default profile
+ * This start the registering and later the GiveConnectionL can be
+ * used to get the ready connection.
+ */
+ void RegisterDefaultProfileL();
+
+ /**
+ * Register specified profile
+ * This start the registering and later the GiveConnectionL can be
+ * used to get the ready connection.
+ * @param aId SIP Profile ID
+ */
+ void RegisterGivenProfileL( TUint32 aID );
+
+ /**
+ * Give the registered connection.
+ * Leaves with KErrNotReady if not ready.
+ * MSimpleSipConnCallback::ConnectionStateChange() is called when
+ * the registeration is ready.
+ * @return SIP connection, ownership is changed
+ */
+ CSIPConnection* GiveConnectionL();
+
+ /**
+ * Is the SIP Profile active
+ * @return ETrue if active.
+ */
+ TBool IsProfileActive();
+
+ /**
+ * Give current registered user's AOR.
+ * Leaves with KErrNotReady if profile is not registered.
+ * @return AOR URI
+ */
+ TPtrC8 GiveUserAorL();
+
+ /**
+ * Current profile accessor
+ */
+ MSIPRegistrationContext* ProfileContext();
+
+public://functions from MSIPProfileObserver
+ /**
+ * An event related to SIP Profile has accorred
+ * @param aProfileId a profile Id
+ * @param aEvent an occurred event
+ **/
+ void ProfileRegistryEventOccurred(TUint32 aProfileId, TEvent aEvent);
+
+ /**
+ * An asynchronous error has occurred related to SIP profile
+ * Event is send to those observers, who have the
+ * corresponding profile instantiated.
+ * @param aProfileId the id of failed profile
+ * @param aError an occurred error
+ */
+ void ProfileRegistryErrorOccurred(TUint32 aProfileId, TInt aError);
+
+protected:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL( CSIP* aSIP );
+
+ CSimpleSipProfileObserver( CSimpleSipConnectionObserver& aObs );
+
+private: // data
+
+ /**
+ * Next observer class where to send the events.
+ */
+ CSimpleSipConnectionObserver& iObs;
+
+ /**
+ * Own. SIP profile registry.
+ */
+ CSIPProfileRegistry* iRegistry;
+
+ /**
+ * Own. SIP profile
+ */
+ CSIPProfile* iProfile;
+
+#ifdef _DEBUG
+ friend class T_CSimpleSipConnection;
+#endif
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simpledebugutils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DEBUG utilities, for DEBUG version only
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+
+#ifdef _DEBUG
+#include <flogger.h>
+#include <e32debug.h>
+#include <apparc.h>
+#include <bautils.h>
+#endif // _DEBUG
+
+#include "simpledebugutils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+#ifdef _DEBUG
+
+//**********************************
+// TSimpleLogger
+//**********************************
+const TInt KLogBufferLength = 256;
+
+// ---------------------------------------------------------
+// TSimpleLogger::Log
+// ---------------------------------------------------------
+//
+void TSimpleLogger::Log(TRefByValue<const TDesC> aFmt,...) //lint !e960
+ {
+ VA_LIST list;
+ VA_START(list, aFmt); //lint !e960
+
+ // Print to log file
+ TBuf<KLogBufferLength> buf;
+ buf.FormatList(aFmt, list);
+
+ _LIT(KLogDir, "simple");
+ _LIT(KLogFile, "simple.txt");
+ // Write to log file
+ RFileLogger::Write(KLogDir, KLogFile, EFileLoggingModeAppend, buf);
+
+ _LIT( KSimplePrefix, "[simple] ");
+ buf.Insert( 0, KSimplePrefix );
+ RDebug::RawPrint( buf );
+
+ }
+
+// ---------------------------------------------------------
+// TSimpleLogger::Dump
+// ---------------------------------------------------------
+//
+void TSimpleLogger::Dump( const TDesC8& aData, RFs& aFs, TInt aMode )
+ {
+ if ( !aData.Length() )
+ {
+ return;
+ }
+
+ _LIT(KLogDir, "c:\\logs\\simple\\");
+
+ TParse myParse;
+
+ // generate unique file name
+ TFileName fileName;
+ fileName = KLogDir;
+ if( BaflUtils::PathExists( aFs, fileName ) )
+ {
+ _LIT( KRelatedRcv, "Receive.xml");
+ _LIT( KRelatedSnt, "Sent.xml");
+ if ( aMode )
+ {
+ myParse.Set( fileName, &KRelatedRcv, NULL );
+ }
+ else
+ {
+ myParse.Set( fileName, &KRelatedSnt, NULL );
+ }
+ fileName = myParse.FullName();
+ if ( CApaApplication::GenerateFileName( aFs, fileName ))
+ {
+ return;
+ }
+
+ // write data into file
+ RFile file;
+ TInt xmlError = file.Create( aFs, fileName, EFileWrite | EFileShareExclusive );
+ if ( xmlError == KErrNone )
+ {
+ file.Write( aData );
+ file.Flush();
+ }
+
+ // done - close file
+ file.Close();
+
+ Log( _L("Dump: LogFile = %S"), &fileName );
+ }
+ }
+#endif // _DEBUG
+
+
+//**********************************
+// CSimpleSettingFile
+//**********************************
+
+CSimpleSettingFile::~CSimpleSettingFile()
+ {
+ if ( iOpen )
+ {
+ iReader.Close();
+ }
+ iOpen = EFalse;
+ }
+
+CSimpleSettingFile::CSimpleSettingFile( RFs& aFs)
+: iFs( aFs ),
+ iOpen( EFalse )
+ {
+ }
+
+#ifdef _DEBUG
+
+CSimpleSettingFile* CSimpleSettingFile::NewL(
+ RFs& aFs )
+ {
+ CSimpleSettingFile* self = new (ELeave) CSimpleSettingFile( aFs );
+ return self;
+ }
+
+void CSimpleSettingFile::OpenL(TDesC& aResFile)
+ {
+ // open a file
+ iFileName = aResFile;
+
+ TInt myError = iReader.Open( iFs,
+ iFileName,
+ EFileShareReadersOnly );
+
+ User::LeaveIfError( myError );
+ iOpen = ETrue;
+ }
+
+TPtrC8 CSimpleSettingFile::KeyValueL( const TDesC8& aKey )
+ {
+
+ TPtrC8 myKey;
+ TPtrC8 myValue;
+ TBool getIt(EFalse);
+ TInt err = 0;
+
+ // Reset the reader
+ OpenL( iFileName );
+
+ // Start to search
+ while ( !getIt)
+ {
+ TRAP ( err, ReadRowL( myKey, myValue ));
+ if ( err != KErrNone )
+ {
+ User::Leave( KErrNotFound );
+ }
+ if ( !myKey.CompareF( aKey ))
+ {
+ return myValue;
+ }
+ }
+ return TPtrC8();
+ }
+
+void CSimpleSettingFile::ReadRowL( TPtrC8& aKey, TPtrC8& aValue )
+ {
+ // READ ONE ROW
+ TChar delim( 10 );
+ iReader.ReadL( iRowBuffer, delim);
+ TInt length = iRowBuffer.Length();
+ if ( length > 2 )
+ {
+ // DROP CR+LF FROM THE END OF LINE
+ iRowBuffer.Delete( length - 2, 2 );
+
+ TInt pos = 0;
+ pos = iRowBuffer.Find( _L8("=") );
+ if ( pos > 0 )
+ {
+ aKey.Set( iRowBuffer.Left( pos ) );
+ // Cut off separator
+ aValue.Set( iRowBuffer.Mid( pos + 1 ) );
+ }
+ }
+ }
+#endif // _DEBUG
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplerefreshtimer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Refresh timer
+*
+*/
+
+
+
+
+
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include "simplerefreshtimer.h"
+#include "simplesipconncallback.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// CONSTANTS
+
+const TInt KUseAfterLimit = 240;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Refresh timer
+// ---------------------------------------------------------------------------
+//
+
+// ======== MEMBER FUNCTIONS ========
+
+CSimpleRefreshTimer::CSimpleRefreshTimer(
+ MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq )
+ : CActive( CActive::EPriorityStandard),
+ iEngine(aEngine), iRequest( aReq )
+
+ {
+ // Add this to the scheduler
+ (void) iTimer.CreateLocal();
+ CActiveScheduler::Add(this);
+ }
+
+CSimpleRefreshTimer::~CSimpleRefreshTimer()
+ {
+ Cancel();
+ iTimer.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRefreshTimer::Start
+// -----------------------------------------------------------------------------
+void CSimpleRefreshTimer::Start( TInt aWaitSeconds )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("RefreshTimer: Start %d sec" ), aWaitSeconds );
+#endif
+
+ // Cancel is needed because of the timer may be reset.
+ Cancel();
+
+ if ( aWaitSeconds <= 0)
+ {
+ return;
+ }
+
+ iSeconds = aWaitSeconds;
+
+ // The At function caused a CUserbase-Panic 46 in very small
+ // time values. 1-4 seconds. Now if the KeepAlive time
+ // is smaller than UseAfterLimit, then we use the After function
+ // If it is larger then use the At function
+ // The reason not to use the After function for every situation is
+ // that the TInt overflows after 35 minutes. 1000000*60*36 > 2^31
+ if( iSeconds <= KUseAfterLimit )
+ {
+ iTimer.After( iStatus, iSeconds * 1000000 );
+ }
+ else
+ {
+ TTime myKeepAlive;
+ myKeepAlive.HomeTime();
+ myKeepAlive += TTimeIntervalSeconds( iSeconds );
+ iTimer.At( iStatus, myKeepAlive );
+ }
+ iStatus = KRequestPending;
+ SetActive();
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRefreshTimer::DoCancel
+// -----------------------------------------------------------------------------
+void CSimpleRefreshTimer::DoCancel( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("RefreshTimer: DoCancel" ));
+#endif
+ iTimer.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRefreshTimer::RunL
+// -----------------------------------------------------------------------------
+void CSimpleRefreshTimer::RunL( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("RefreshTimer: RunL" ));
+#endif
+ // Inside StartToRefreshL this entity may be deleted,
+ // thus after the method call do not do anything in RunL.
+ iEngine. StartToRefreshL( iRequest );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRefreshTimer::RunError
+// -----------------------------------------------------------------------------
+TInt CSimpleRefreshTimer::RunError(TInt /*aError*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("RefreshTimer: RunError" ));
+#endif
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Expiry timer
+// ---------------------------------------------------------------------------
+//
+
+// ======== MEMBER FUNCTIONS ========
+
+CSimpleExpiryTimer::CSimpleExpiryTimer(
+ MSimpleSipConnCallback& aEngine, CSimpleRequest& aReq )
+ : CActive( CActive::EPriorityStandard),
+ iEngine(aEngine), iRequest( aReq )
+
+ {
+ // Add this to the scheduler
+ (void) iTimer.CreateLocal();
+ CActiveScheduler::Add(this);
+ }
+
+CSimpleExpiryTimer::~CSimpleExpiryTimer()
+ {
+ Cancel();
+ iTimer.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleExpiryTimer::Start
+// -----------------------------------------------------------------------------
+void CSimpleExpiryTimer::Start( TInt aWaitSeconds )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("ExpiryTimer: Start %d sec" ), aWaitSeconds );
+#endif
+
+ // Cancel is needed because of the timer may be reset.
+ Cancel();
+
+ if ( aWaitSeconds <= 0 )
+ {
+ return;
+ }
+
+ iSeconds = aWaitSeconds;
+
+ // The At function caused a CUserbase-Panic 46 in very small
+ // time values. 1-4 seconds. Now if the KeepAlive time
+ // is smaller than UseAfterLimit, then we use the After function
+ // If it is larger then use the At function
+ // The reason not to use the After function for every situation is
+ // that the TInt overflows after 35 minutes. 1000000*60*36 > 2^31
+ if( iSeconds <= KUseAfterLimit )
+ {
+ iTimer.After( iStatus, iSeconds * 1000000 );
+ }
+ else
+ {
+ TTime myKeepAlive;
+ myKeepAlive.HomeTime();
+ myKeepAlive += TTimeIntervalSeconds( iSeconds );
+ iTimer.At( iStatus, myKeepAlive );
+ }
+ iStatus = KRequestPending;
+ SetActive();
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleExpiryTimer::DoCancel
+// -----------------------------------------------------------------------------
+void CSimpleExpiryTimer::DoCancel( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("ExpiryTimer: DoCancel" ));
+#endif
+ iTimer.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleExpiryTimer::RunL
+// -----------------------------------------------------------------------------
+void CSimpleExpiryTimer::RunL( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("ExpiryTimer: RunL" ));
+#endif
+ iEngine.StartToCheckExpiryL( iRequest );
+ // Inside StartToCheckExpiryL this entity may be deleted,
+ // thus after the method call do not do anything in RunL.
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleExpiryTimer::RunError
+// -----------------------------------------------------------------------------
+TInt CSimpleExpiryTimer::RunError(TInt /*aError*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("ExpiryTimer: RunError" ));
+#endif
+ return KErrNone;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplerequest.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1056 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: sip request
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+// sip api
+#include <sip.h>
+#include <sipconnection.h>
+#include <sipconnectionobserver.h>
+#include <sipresponseelements.h>
+#include <siprequestelements.h>
+#include <sipclienttransaction.h>
+#include <siprefresh.h>
+#include <sipdialog.h>
+#include <sipsubscribedialogassoc.h>
+
+// simple
+#include "simplesipconnection.h"
+#include "simplerefreshtimer.h"
+#include "simpleerrors.h"
+#include "simplecommon.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+// time limits in seconds
+const TInt KRefreshLimit = 1200; // limit when KRefreshBefore is used
+const TInt KRefreshBefore = 600; // how much before expiration a refresh is done
+const TInt KRetryBefore = 300; // how much before expiration a retry is done
+const TInt KMinorDelay = 5; // garbage collection and retry delay
+const TInt KDeleteDelay = 1; // delay before deleting a subscription request
+const TInt KMinorExpiry = 65; // default expiration time for re-try
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::CSimpleRequest
+// -----------------------------------------------------------------------------
+
+CSimpleRequest::CSimpleRequest(
+ MSimpleSipConnCallback& aEngine,
+ MSimpleEngineRequest& aReq,
+ TSimpleSipReqType aType,
+ TUint aExpires )
+ : iEngine(aEngine), iReq(aReq),
+ iTrans(NULL), iSipRefresh(NULL), iType(aType),
+ iDialog(NULL), iStatus(KErrNone),
+ iState(ESimpleInit), iRetryAfter(0),
+ iReason(KErrNone), iExpires(aExpires),
+ iPendingState(ENoPending), iData(NULL),
+ iGivenETag( EFalse ), iSubscriptionState(MSimpleEngineRequest::ESimpleStateNone),
+ iRespCount(0)
+ {}
+
+CSimpleRequest::~CSimpleRequest()
+ {
+ StopExpiryTimer();
+ StopRefreshTimer();
+ delete iSipRefresh;
+ delete iRefreshTimer;
+ delete iExpiryTimer;
+ delete iETag;
+ delete iDialog;
+ delete iTrans;
+ delete iData;
+ delete iRecipientId;
+ delete iRequestContentType;
+ }
+
+// ----------------------------------------------------------
+// CSimpleRequest::NewL
+// ----------------------------------------------------------
+//
+CSimpleRequest* CSimpleRequest::NewL(
+ MSimpleSipConnCallback& aEngine,
+ MSimpleEngineRequest& aReq,
+ TSimpleSipReqType aType,
+ TUint aExpires )
+ {
+ CSimpleRequest* self = new (ELeave) CSimpleRequest(
+ aEngine,
+ aReq,
+ aType,
+ aExpires );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: NewL this=%d" ), (TInt)self );
+#endif
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleRequest::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleRequest::ConstructL( )
+ {
+ iExpiryTimer = new (ELeave) CSimpleExpiryTimer( iEngine, *this );
+ iRefreshTimer = new (ELeave) CSimpleRefreshTimer( iEngine, *this );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Destroy
+// -----------------------------------------------------------------------------
+void CSimpleRequest::Destroy()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: DESTROY this=%d"), (TInt)this );
+#endif
+ iLink.Deque();
+ delete this;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::DestroyStart
+// -----------------------------------------------------------------------------
+void CSimpleRequest::DestroyStart()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: DestroyStart this=%d"), (TInt)this );
+#endif
+ SetReqState( ESimpleDeleting );
+ // Yield control to active scheduler before deleting a request. The request may have
+ // called multiple callback methods, so it's safer to break the call.
+ StartExpiryTimer( KDeleteDelay );
+ StopRefreshTimer();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Request
+// -----------------------------------------------------------------------------
+MSimpleEngineRequest& CSimpleRequest::Request()
+ {
+ return iReq;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Transaction
+// -----------------------------------------------------------------------------
+CSIPClientTransaction* CSimpleRequest::Transaction()
+ {
+ return iTrans;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetTransaction
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetTransaction( CSIPClientTransaction* aTrans )
+ {
+ delete iTrans;
+ iTrans = aTrans;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Refresh
+// -----------------------------------------------------------------------------
+CSIPRefresh* CSimpleRequest::Refresh()
+ {
+ return iSipRefresh;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Match
+// -----------------------------------------------------------------------------
+TBool CSimpleRequest::Match( CSIPClientTransaction& aTrans )
+ {
+ CSIPClientTransaction* tr = Transaction();
+ return ( tr && aTrans == *tr ? ETrue : EFalse );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Match
+// -----------------------------------------------------------------------------
+TBool CSimpleRequest::Match( TSimpleSipReqType aType ) const
+ {
+ return ( aType == iType ? ETrue : EFalse );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Match
+// -----------------------------------------------------------------------------
+TBool CSimpleRequest::Match( const CSIPDialog& aDialog ) const
+ {
+ return aDialog.IsAssociated( *iDialog );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Match
+// -----------------------------------------------------------------------------
+TBool CSimpleRequest::Match( MSimpleEngineRequest& aReq ) const
+ {
+ if ( aReq.OpId() == iReq.OpId() )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Complete
+// -----------------------------------------------------------------------------
+void CSimpleRequest::Complete( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: Complete %d this=%d"),aStatus, (TInt)this );
+#endif
+
+ if ( iState == ESimpleDeleting )
+ {
+ // Tell to other DLL that this can be deleted now.
+ iReq.Complete( aStatus );
+ return;
+ }
+ if (( aStatus == KErrDisconnected ) ||
+ ( aStatus == KErrTimedOut && iType != EReqPublish ))
+ {
+ // This is a serious network problem
+ SetRetryAfter( 0 );
+ StopExpiryTimer();
+ StopRefreshTimer();
+ SetReqState( ESimpleFailed );
+ iReq.Complete( aStatus );
+ return;
+ }
+
+ if ( iType == EReqRegister )
+ {
+ // stop expiry timer
+ StopExpiryTimer();
+ // Complete the client request
+ iReq.Complete( aStatus );
+ }
+ else if ( iType == EReqPublish )
+ {
+ DoCompletePublication( aStatus );
+ }
+ else if ( EReqSendIM == iType )
+ {
+ iReq.Complete( aStatus );
+ return;
+ }
+ else if ( EReqReceiveIM == iType )
+ {
+ TRAP_IGNORE( iReq.SetResponseDataL( Data() ) )
+ TRAP_IGNORE( iReq.SetRecipientL( RecipientL() ) )
+ iReq.Complete( aStatus );
+ return;
+ }
+ else if ( iType == EReqSubscribe || iType == EReqSubscribeList || iType == EReqSubscribeWinfo )
+ {
+ if ( Request().ResponseMethod( ) == MSimpleEngineRequest::ENotify )
+ {
+ DoCompleteNotification( aStatus );
+ }
+ else
+ {
+ DoCompleteSubscription( aStatus );
+ }
+ }
+ // EReqListEvents will go to CompleteEvent method.
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::CompleteEvent
+// -----------------------------------------------------------------------------
+void CSimpleRequest::CompleteEvent( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: CompleteEvent this=%d"),(TInt)this );
+#endif
+ iReq.Complete( KErrNone );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetRefreshTime
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetRefreshTime( TUint aTime )
+ {
+ iRefreshTime = aTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::RefreshTime
+// -----------------------------------------------------------------------------
+TUint CSimpleRequest::RefreshTime( ) const
+ {
+ return iRefreshTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::StartRefreshTimer
+// -----------------------------------------------------------------------------
+void CSimpleRequest::StartRefreshTimer( TUint aTime )
+ {
+
+ // Refresh a little bit earlier, KRefreshBefore sec
+ // If expiration time is greater than 1200 seconds,
+ // the interval is set to 600 seconds lower than expiration time.
+ // Otherwise, interval is set to half of the expiration time.
+
+ if ( aTime )
+ {
+ // special time used for error recovery
+ iRefreshTimer->Start( aTime );
+ return;
+ }
+
+ // This time is for garbage collection
+ TUint myTime = iRefreshTime + KMinorDelay;
+
+ if ( iReq.IsRefresh() )
+ {
+ // This time is for regular PUBLISH refresh
+ if ( iRefreshTime > KRefreshLimit )
+ {
+ myTime = iRefreshTime - KRefreshBefore;
+ }
+ else
+ {
+ myTime = iRefreshTime / 2 ;
+ }
+ }
+
+ iRefreshTimer->Start( myTime );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::StopRefreshTimer
+// -----------------------------------------------------------------------------
+void CSimpleRequest::StopRefreshTimer()
+ {
+ if ( iRefreshTimer )
+ {
+ iRefreshTimer->Cancel();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::StartExpiryTimer
+// -----------------------------------------------------------------------------
+void CSimpleRequest::StartExpiryTimer( TUint aTime )
+ {
+ iExpiryTimer->Start( aTime );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::StopExpiryTimer
+// -----------------------------------------------------------------------------
+void CSimpleRequest::StopExpiryTimer()
+ {
+ if ( iExpiryTimer )
+ {
+ iExpiryTimer->Cancel();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::RetryTime
+// -----------------------------------------------------------------------------
+TUint CSimpleRequest::RetryTime()
+ {
+ // Retry (refresh) time in error recovery retry.
+
+ // If retry-after SIP header value is present then use it.
+
+ // If retry-after is not available:
+ // A quarter of expires value (=half of the current time until expires),
+ // maximum 300 seconds.
+
+ // This time policy is in line with SIP stack and presence refreshment policy.
+ // Too long time interval is checked outside this method,
+
+ TUint myTime(0);
+
+ if ( iRetryAfter )
+ {
+ // Retry-after header value
+ myTime = iRetryAfter;
+ }
+ else if ( iRefreshTime > KRefreshLimit )
+ {
+ myTime = KRetryBefore;
+ }
+ else
+ {
+ myTime = iRefreshTime / 4 ;
+ }
+ // Minun value is few seconds.
+ return ( myTime > KMinorDelay ? myTime : KMinorDelay );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::RetryExpiryTime
+// -----------------------------------------------------------------------------
+TInt CSimpleRequest::RetryExpiryTime()
+ {
+ // Expiry for retry in error cases, should be calculated at the same time as
+ // retry time above.
+ TInt myTime(0);
+
+ if ( iRefreshTime > KRefreshLimit )
+ {
+ myTime = KRefreshBefore;
+ }
+ else
+ {
+ myTime = iRefreshTime / 2 ;
+ }
+
+ return ( myTime > KMinorExpiry ? myTime : KMinorExpiry );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetETag
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetETag( HBufC8* aTag )
+ {
+ // ownership is transferred
+ delete iETag;
+ iETag = aTag;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::ETag
+// -----------------------------------------------------------------------------
+TPtrC8 CSimpleRequest::ETag() const
+ {
+ return iETag ? iETag->Des(): TPtrC8();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Status
+// -----------------------------------------------------------------------------
+TUint CSimpleRequest::Status() const
+ {
+ return iStatus;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetStatus
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetStatus( TUint aVal )
+ {
+ iStatus = aVal;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Dialog
+// -----------------------------------------------------------------------------
+CSIPSubscribeDialogAssoc* CSimpleRequest::Dialog( )
+ {
+ return iDialog;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetDialog
+// -----------------------------------------------------------------------------
+ void CSimpleRequest::SetDialog( CSIPSubscribeDialogAssoc* aDialog )
+ {
+ delete iDialog;
+ iDialog = NULL;
+ iDialog = aDialog;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::ReqState
+// -----------------------------------------------------------------------------
+CSimpleRequest::TSimpleReqState CSimpleRequest::ReqState() const
+ {
+ return iState;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetReqState
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetReqState( CSimpleRequest::TSimpleReqState aState )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: SetReqState %d->%d this=%d"),
+ iState, aState,(TInt)this );
+#endif
+ iState = aState;
+ if ( aState == ESimpleFailed || aState == ESimpleComplete || aState == ESimpleDeleting )
+ {
+ iSubscriptionState = MSimpleEngineRequest::ESimpleStateTerminated;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetThrottleTime
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetThrottleTime( TUint aSeconds )
+ {
+ TTime myTime;
+ myTime.HomeTime();
+ myTime += TTimeIntervalSeconds( aSeconds );
+ iThrottleTime = myTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::ThrottleTime
+// -----------------------------------------------------------------------------
+TTime CSimpleRequest::ThrottleTime( )
+ {
+ return iThrottleTime;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::RetryAfter
+// -----------------------------------------------------------------------------
+TUint CSimpleRequest::RetryAfter( )
+ {
+ return iRetryAfter;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetRetryAfter
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetRetryAfter( TUint aVal )
+ {
+ iRetryAfter = aVal;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetReason
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetReason( TInt aVal )
+ {
+ iReason = aVal;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Reason
+// -----------------------------------------------------------------------------
+TInt CSimpleRequest::Reason( )
+ {
+ return iReason;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::PlusErrNotify
+// -----------------------------------------------------------------------------
+void CSimpleRequest::PlusErrCount( )
+ {
+ ++iErrNotify;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::ResetErrNotify
+// -----------------------------------------------------------------------------
+void CSimpleRequest::ResetErrCount( )
+ {
+ iErrNotify = 0;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::ErrNotify
+// -----------------------------------------------------------------------------
+TInt CSimpleRequest::ErrCount( )
+ {
+ return iErrNotify;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::PendingState
+// -----------------------------------------------------------------------------
+CSimpleRequest::TSimplePendingSubState CSimpleRequest::PendingState( )
+ {
+ return iPendingState;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::AddPendingState
+// -----------------------------------------------------------------------------
+void CSimpleRequest::AddPendingState( CSimpleRequest::TSimplePendingSubState aVal )
+ {
+ if (( aVal == EPendingModify && iPendingState == EPendingRefresh ) ||
+ ( aVal == EPendingRefresh && iPendingState == EPendingModify ))
+ {
+ SetPendingState( EPendingModifyAndRefresh );
+ }
+ else if ( aVal == EPendingModify && iPendingState == ENoPending )
+ {
+ SetPendingState( EPendingModify );
+ }
+ else if ( aVal == EPendingRefresh && iPendingState == ENoPending )
+ {
+ SetPendingState( EPendingRefresh );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetPendingState
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetPendingState( CSimpleRequest::TSimplePendingSubState aVal )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: iPendingState=%d"), aVal );
+#endif
+ iPendingState = aVal;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::Data
+// -----------------------------------------------------------------------------
+TPtrC8 CSimpleRequest::Data() const
+ {
+ return iData ? iData->Des() : TPtrC8();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetRecipientL
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetRecipientL( const TDesC8& aRecipientId )
+ {
+ delete iRecipientId;
+ iRecipientId = NULL;
+ iRecipientId = aRecipientId.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::RecipientL
+// -----------------------------------------------------------------------------
+TPtrC8 CSimpleRequest::RecipientL() const
+ {
+ return iRecipientId ? iRecipientId->Des() : TPtrC8();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetDataL
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetDataL( const TDesC8& aData )
+ {
+ delete iData;
+ iData = NULL;
+ iData = aData.AllocL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::GivenETag
+// -----------------------------------------------------------------------------
+TBool CSimpleRequest::GivenETag() const
+ {
+ return iGivenETag;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetGivenETag
+// -----------------------------------------------------------------------------
+void CSimpleRequest::SetGivenETag( TBool aVal )
+ {
+ iGivenETag = aVal;
+ }
+
+// ----------------------------------------------------------
+// CSimpleRequest::RequestContentType
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleRequest::RequestContentType()
+ {
+ return iRequestContentType ? iRequestContentType->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CSimpleRequest::SetRequestContentTypeL
+// ----------------------------------------------------------
+//
+void CSimpleRequest::SetRequestContentTypeL( const TDesC8& aData )
+ {
+ delete iRequestContentType;
+ iRequestContentType = NULL;
+ iRequestContentType = aData.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleRequest::SipSubscriptionState
+// ----------------------------------------------------------
+//
+MSimpleEngineRequest::TSimpleSipSubscriptionState CSimpleRequest::SipSubscriptionState()
+ {
+ return iSubscriptionState;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::DoCompleteSubscription
+// -----------------------------------------------------------------------------
+void CSimpleRequest::DoCompleteSubscription( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: DoCompleteSubscription %d"), aStatus);
+#endif
+
+ // This is a part of the the state machine for subscriptions.
+ // Mainly those cases that call API callback
+
+ TSimpleReqState orig = iState;
+
+ // Stop expiry timer always except a stop request is a special case, because of then
+ // both 200 and Notify are required, or an error code alone.
+ if ( orig != ESimpleStopping )
+ {
+ StopExpiryTimer();
+ }
+ // Stop refresh timer used for garbage collection
+ if ( orig != ESimpleRunningInit )
+ {
+ StopRefreshTimer();
+ }
+
+ if ( orig == ESimpleRunningInit )
+ {
+ if ( aStatus == KErrNone || aStatus == KSimpleErrPending )
+ {
+ if ( iExpires )
+ {
+ // OK response [ expires != 0 ]
+ if ( aStatus == KSimpleErrPending )
+ {
+ iSubscriptionState = MSimpleEngineRequest::ESimpleStatePending;
+ }
+ SetReqState( ESimpleActiveSubs );
+ }
+ else
+ {
+ // OK response [ expires == 0 ]
+ SetReqState( ESimpleComplete );
+ }
+ }
+ else
+ {
+ // error
+ SetReqState( ESimpleFailed );
+ }
+ // Complete API callback always in ESimpleRunningInit
+ iReq.Complete( aStatus );
+ }
+ else if ( orig == ESimpleActiveSubs )
+ {
+ // This happens if refresh has failed without response notify
+ TUint retryTime = RetryTime();
+ // If too long interval in the retry-after header then return an error
+ if ( retryTime > KRetryBefore )
+ {
+ SetReqState( ESimpleFailed );
+ iReq.Complete( KErrCompletion );
+ return;
+ }
+ SetReqState( ESimpleReTry );
+ StartRefreshTimer( retryTime );
+ }
+ else if ( orig == ESimpleStopping )
+ {
+ // Stop expiry timer always except a stop request is a special case, because of then
+ // both 200 and Notify are required, or an error code alone.
+ ++iRespCount;
+ if (( aStatus != KErrNone && aStatus != KSimpleErrPending ) ||
+ ( iRespCount == 2 ) )
+ {
+ SetReqState( ESimpleComplete );
+ StopExpiryTimer();
+ }
+ iReq.Complete( aStatus );
+ }
+ else if ( orig == ESimpleDialogReCre && aStatus == KErrNone )
+ {
+ // OK resp
+ SetReqState( ESimpleActiveSubs );
+ }
+ else
+ {
+ // expires or stop / callback
+ // error / callback
+ // Expires or stop /callbc, respectively
+ SetReqState( ESimpleFailed );
+ iReq.Complete( aStatus );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::DoCompleteNotification
+// -----------------------------------------------------------------------------
+void CSimpleRequest::DoCompleteNotification( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: DoCompleteNotification %d"), aStatus);
+#endif
+
+ // This is a part of the the state machine for subscriptions.
+ // Mainly those cases that call API callback
+
+ TSimpleReqState orig = iState;
+
+ if ( aStatus == KErrNone || aStatus == KSimpleErrPending )
+ {
+ if ( KSimpleErrPending == aStatus )
+ {
+ iSubscriptionState = MSimpleEngineRequest::ESimpleStatePending;
+ }
+ else
+ {
+ iSubscriptionState = MSimpleEngineRequest::ESimpleStateActive;
+ }
+
+ if ( orig == ESimpleStopping && aStatus != KErrNone )
+ {
+ // A stop request is a special case, because of then
+ // both 200 and Notify are required, or an error code alone.
+ ++iRespCount;
+ if ( iRespCount == 2 )
+ {
+ SetReqState( ESimpleComplete );
+ StopExpiryTimer();
+ }
+ }
+
+ // Notification without error does not change the state,
+ // just pass the notification thru to the API
+ iReq.Complete( aStatus );
+ return;
+ }
+
+ if ( orig == ESimpleActiveSubs )
+ {
+ // Ensure that Dialog refreshing will be stopped now.
+ SetDialog( NULL );
+ if ( iReq.IsRefresh() && aStatus == KSimpleErrTemporary )
+ {
+ // terminated [ refresh ]
+ StopRefreshTimer();
+ TUint retryTime = RetryTime();
+ // If too long interval in the retry-after header then return an error
+ if ( retryTime > KRetryBefore )
+ {
+ SetReqState( ESimpleFailed );
+ iReq.Complete( KErrCompletion );
+ return;
+ }
+ // Do not send the notification to the client API now, but
+ // go to retry-state and retry later dialog re-creation.
+ SetReqState( ESimpleReTry );
+ StartRefreshTimer( retryTime );
+ }
+ else
+ {
+ // Expires[ no refresh ]
+ // error [ no refresh ]
+ // Timer may stop the request if not refresh.
+ SetReqState( (aStatus==KErrTimedOut || aStatus==KErrCompletion) ?
+ ESimpleComplete : ESimpleFailed );
+ // Complete API callback
+ iReq.Complete( aStatus );
+ }
+ }
+ else
+ {
+ iReq.Complete( aStatus );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::DoCompletePublication
+// -----------------------------------------------------------------------------
+void CSimpleRequest::DoCompletePublication( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SimpleRequest: DoCompletePublication %d"), aStatus);
+#endif
+
+ // This is a part of the the state machine for publications.
+ // Mainly those cases that call API callback
+
+ // SIP error code 412, RFC3903
+ const TUint KMySip412 = 412;
+
+ TSimpleReqState orig = iState;
+ TSimplePendingSubState nextSub = ENoPending;
+
+ // Set ETag that's received from network or reset
+ // when an error has taken a place. If it fails, it is not very serious,
+ // and it is very rare OOM situation.
+ TRAP_IGNORE( iReq.SetETagL( ETag() ));
+
+ // Stop refresh timer and start only when needed.
+ if ( orig != ESimplePending )
+ {
+ StopRefreshTimer();
+ }
+
+ if ( orig == ESimpleRunningInit )
+ {
+ // stop expiry timer
+ StopExpiryTimer();
+ if ( aStatus == KErrNone )
+ {
+ // OK response
+ SetReqState( ESimpleActive );
+ // Ensure API callback when terminated
+ StartRefreshTimer();
+ }
+ else
+ {
+ // error
+ SetReqState( ESimpleFailed );
+ }
+ // Complete API callback always in ESimpleRunningInit
+ iReq.Complete( aStatus );
+ }
+ else if ( orig == ESimpleRunning )
+ {
+ TBool isModify = Request().RequestType() == MSimpleEngineRequest::EPublishModify ? ETrue : EFalse;
+ // Handle pending/running modifify request situation first
+ if ( isModify )
+ {
+ SetReqState( ESimpleActive );
+ // Check SIP status and decide whether publication is terminated or
+ // the modify request failed only.
+ if ( PendingState() != ENoPending )
+ {
+ // The previous refresh request is completed and the next one is the
+ // pending modify request.
+ if ( aStatus )
+ {
+ // error[ callback ]
+ // terminate the publication
+ // stop expiry timer
+ StopExpiryTimer();
+ iReq.Complete( KErrCompletion );
+ SetReqState( ESimpleFailed );
+ }
+ else
+ {
+ StartRefreshTimer();
+ // Send modification request
+ TInt errx = iEngine.DoSendPendingPublish( *this );
+ if ( errx )
+ {
+ // Modify request failed only
+ // stop expiry timer
+ StopExpiryTimer();
+ iReq.Complete( errx );
+ SetReqState( ESimpleActive );
+ }
+ else
+ {
+ // Just wait modify response, do not complete API request.
+ // Do not stop or restart expiry timer
+ }
+ }
+ } // pending
+ else
+ {
+ // This is the actual modify request response.
+ TUint sipStatus = Status();
+ // check if not 412, see RFC3903
+ if ( ( !aStatus || aStatus == KSimpleErrTemporary ) && sipStatus != KMySip412 )
+ {
+ // Modify failed only
+ StartRefreshTimer();
+ // Complete modification in API callback
+ iReq.Complete( aStatus );
+ SetReqState( ESimpleActive );
+ }
+ else
+ {
+ // The whole publication is terminated
+ iReq.Complete( KErrCompletion );
+ SetReqState( ESimpleFailed );
+ }
+ // stop expiry timer
+ StopExpiryTimer();
+ } // not pending
+ } // modify
+ else
+ {
+ // stop expiry timer
+ StopExpiryTimer();
+ // re-freshing publication
+ if ( aStatus == KErrNone )
+ {
+ StartRefreshTimer();
+ SetReqState( ESimpleActive );
+ // Complete the request for ETag observers only
+ iReq.SetResponseMethod( MSimpleEngineRequest::EStatusETag );
+ }
+ else
+ {
+ // error, no recovery
+ SetReqState( ESimpleFailed );
+ iReq.Complete( aStatus );
+ }
+ }
+ }
+ else if ( orig == ESimpleStopping )
+ {
+ // stop expiry timer
+ StopExpiryTimer();
+ // Any kind of response is OK for stopping,
+ // either timeout or OK response except with given ETag the real SIP response
+ // is sent to the client.
+ SetReqState( ESimpleComplete );
+ TInt retVal = GivenETag() ? aStatus : KErrNone;
+ iReq.Complete( retVal );
+ }
+ else if ( orig == ESimplePending &&
+ ( iPendingState==EPendingModify || iPendingState==EPendingModifyAndRefresh ) &&
+ aStatus != KErrCompletion )
+ {
+ // Check if just modify terminates or the entire publication is terminated
+ // stop expiry timer
+ StopExpiryTimer();
+ // Modify failed, automatic refresh continues
+ // Complete modification in API callback
+ iReq.Complete( aStatus );
+ SetReqState( ESimpleActive );
+ if ( iPendingState == EPendingModifyAndRefresh && aStatus )
+ {
+ // The publication may still be alive but automatic refresh is pending
+ SetReqState( ESimplePending );
+ nextSub = EPendingRefresh;
+ }
+ }
+ else // odds and ends like time-out
+ {
+ // stop expiry timer
+ StopExpiryTimer();
+ SetReqState( ESimpleFailed );
+ iReq.Complete( aStatus );
+ }
+ // Reset the request body data
+ delete iData;
+ iData = NULL;
+ // Reset pendig modify request
+ SetPendingState( nextSub );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplesettings.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine settings
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+#include <centralrepository.h>
+#include <pressettingsapi.h>
+#include "simpleenginedomaincrkeys.h"
+#include "simpleengineprivatecrkeys.h"
+
+#ifdef _DEBUG
+#include <bautils.h>
+#include "simpledebugutils.h"
+#endif
+
+#include "simplesettings.h"
+
+#ifdef _DEBUG
+_LIT ( KSimpleIniFile, "\\system\\data\\simple.ini");
+_LIT8 ( KSimpleExpiryPuhlish, "expiry_publish");
+_LIT8 ( KSimpleExpiryWatcher, "expiry_watcher");
+_LIT8 ( KSimpleExpiryWinfo, "expiry_winfo");
+_LIT8 ( KSimpleExpiryAPI, "expiry_api");
+_LIT8 ( KSimpleObjLimit, "obj_limit");
+_LIT8 ( KSimpleThrottle, "throttle");
+_LIT8 ( KSimpleMaxSubs, "max_subs");
+#endif
+
+/** default API expiry time */
+const TInt KMyDefaultAPIExpiry = 60;
+/** default SIP refresh expiry time */
+const TInt KMyDefaultSIPExpiry = 43200;
+/** default OTA settings value */
+const TInt KOTASettingsDefault = 0;
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+
+
+//**********************************
+// TSimpleSettings
+//**********************************
+
+// ---------------------------------------------------------
+// TSimpleSettings::TSimpleSettings
+// ---------------------------------------------------------
+//
+TSimpleSettings::TSimpleSettings( )
+ :
+ iExpiryPuhlish( KMyDefaultSIPExpiry ),
+ iExpiryWatcher( KMyDefaultSIPExpiry ),
+ iExpiryWinfo( KMyDefaultSIPExpiry ),
+ iExpiryApi( KMyDefaultAPIExpiry ),
+ iObjLimit(KOTASettingsDefault),
+ iThrottle(KOTASettingsDefault),
+ iMaxSubscriptions(KOTASettingsDefault),
+ iSipProfileId(KOTASettingsDefault)
+ {}
+
+TUint TSimpleSettings::ExpiryPuhlish()
+ {
+ return iExpiryPuhlish;
+ }
+
+TUint TSimpleSettings::ExpiryWatcher()
+ {
+ return iExpiryWatcher;
+ }
+
+TUint TSimpleSettings::ExpiryWinfo()
+ {
+ return iExpiryWinfo;
+ }
+
+TUint TSimpleSettings::ExpiryApi()
+ {
+ return iExpiryApi;
+ }
+
+TInt TSimpleSettings::ObjLimit()
+ {
+ return iObjLimit;
+ }
+
+TInt TSimpleSettings::Throttle()
+ {
+ return iThrottle;
+ }
+
+TInt TSimpleSettings::MaxSubscriptions()
+ {
+ return iMaxSubscriptions;
+ }
+
+TInt TSimpleSettings::SipProfileId()
+ {
+ return iSipProfileId;
+ }
+
+// ---------------------------------------------------------
+// TSimpleSettings::ReadCentRepSettings
+// ---------------------------------------------------------
+//
+void TSimpleSettings::ReadCentRepSettings( )
+ {
+ // Read Central Repository settings
+ CRepository* repository = NULL;
+ TRAP_IGNORE( repository = CRepository::NewL( KCRUIDSimpleVariation ));
+ if ( repository )
+ {
+ //TRAP_IGNORE( iExpiryPuhlish = GetCenRepIntValueL(
+ // repository, KSimplePublishRefresh ));
+ TRAP_IGNORE( iExpiryWatcher = GetCenRepIntValueL(
+ repository, KSimpleSubscribeRefresh ));
+ TRAP_IGNORE( iExpiryWinfo = GetCenRepIntValueL(
+ repository, KSimpleSubscribeWinfoRefresh ));
+ TRAP_IGNORE( iExpiryApi = GetCenRepIntValueL(
+ repository, KSimpleExpiryTime));
+ delete repository;
+ repository = NULL;
+#ifdef _DEBUG
+#ifdef __WINS__
+ TSimpleLogger::Log(_L("CentRep iExpiryPuhlish=%d iExpiryWatcher=%d iExpiryWinfo=%d iExpiryAPI=%d"),
+ iExpiryPuhlish, iExpiryWatcher, iExpiryWinfo, iExpiryApi);
+#endif
+#endif
+ }
+ }
+
+// ---------------------------------------------------------
+// TSimpleSettings::ReadOTASettings
+// ---------------------------------------------------------
+//
+void TSimpleSettings::ReadOTASettingsL( TInt aSetId )
+ {
+ // Read OTA settings using PresSettingsApi
+
+ TPresSettingsSet set;
+ TInt error( KErrNone );
+ error = PresSettingsApi::SettingsSetL( aSetId, set );
+ User::LeaveIfError( error );
+
+ // convert -1 values (undefined) to default values
+ iObjLimit = set.iObjectSize > KOTASettingsDefault ?
+ set.iObjectSize : KOTASettingsDefault;
+ iMaxSubscriptions = set.iMaxSubscriptions > KOTASettingsDefault ?
+ set.iMaxSubscriptions : KOTASettingsDefault;
+ iThrottle = set.iPublicationInt > KOTASettingsDefault ?
+ set.iPublicationInt : KOTASettingsDefault;
+ iSipProfileId = set.iSipProfile > KOTASettingsDefault ?
+ set.iSipProfile : KOTASettingsDefault;
+
+#ifdef _DEBUG
+#ifdef __WINS__
+ TSimpleLogger::Log(_L("OTAsettings iObjLimit=%d iThrottle=%d iMaxSubs=%d iSip=%d"),
+ iObjLimit, iThrottle, iMaxSubscriptions, iSipProfileId );
+#endif
+#endif
+
+ }
+
+// ---------------------------------------------------------
+// TSimpleSettings:GetCenRepIntValueL
+// ---------------------------------------------------------
+//
+TInt TSimpleSettings::GetCenRepIntValueL(
+ CRepository* aRepository,
+ TUint32 aId )
+ {
+ TInt value( 0 );
+ User::LeaveIfError( aRepository->Get( aId, value ) );
+ return value;
+ }
+
+// ---------------------------------------------------------
+// TSimpleSettings::ReadIniFileL
+// ---------------------------------------------------------
+//
+#ifdef _DEBUG
+
+void TSimpleSettings::ReadIniFileL( RFs& aFs )
+ {
+ // Set few values without reading them from ini file
+ CSimpleSettingFile* configFile = CSimpleSettingFile::NewL( aFs );
+ CleanupStack::PushL( configFile ); // *****
+ // Search current drive
+ TFileName path;
+ Dll::FileName( path );
+ TDriveName drive( TParsePtrC( path ).Drive( ) );
+
+ // In emulator we try to find from c drive
+ // in hardware we try to find from current drive and then from RAM.
+#ifdef __WINS__
+ TFileName fileN( KSimpleIniFile);
+#else
+ TFileName fileN( drive );
+ fileN.Append( KSimpleIniFile );
+#endif
+
+ TInt err = 0;
+
+ // Open temporary config file
+ TRAP( err, configFile->OpenL( fileN ));
+ if ( err && drive.CompareF( _L("c:") ))
+ {
+ err = KErrNone;
+ fileN = _L("c:");
+ fileN.Append( KSimpleIniFile );
+ TRAP( err, configFile->OpenL( fileN ));
+ }
+ if ( err )
+ {
+ err = KErrNone;
+ TSimpleLogger::Log(_L("Config file not found ***"));
+ User::Leave( KErrNotFound );
+ }
+ else
+ {
+ TSimpleLogger::Log(_L("Config file found ***"));
+ }
+
+ TUint32 myUint = 0;
+ TPtrC8 myPtr;
+ TBuf<8> myBuffer;
+
+ // read expiry times
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryPuhlish)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iExpiryPuhlish = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWatcher)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iExpiryWatcher = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWinfo)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iExpiryWinfo = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryAPI)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iExpiryApi = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleObjLimit)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iObjLimit = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleThrottle)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iThrottle = (TInt) myUint;
+ }
+
+ TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleMaxSubs)));
+ if ( !err )
+ {
+ myBuffer.Copy( myPtr );
+ TLex lex;
+ lex.Assign( myBuffer );
+ lex.Val(myUint, EDecimal);
+ iMaxSubscriptions = (TInt) myUint;
+ }
+ CleanupStack::PopAndDestroy(configFile);
+
+ // debug logging
+ TSimpleLogger::Log(_L("ReadFile iExpiryPuhlish=%d iExpiryWatcher=%d iExpiryWinfo=%d iExpiryAPI=%d"),
+ iExpiryPuhlish, iExpiryWatcher, iExpiryWinfo, iExpiryApi);
+ TSimpleLogger::Log(_L("ReadFile iObjLimit=%d iThrottle=%d iMaxSubs=%d"),
+ iObjLimit, iThrottle, iMaxSubscriptions );
+ }
+
+#endif // _DEBUG
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplesipconnection.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,2702 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: sip connection
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#ifdef _DEBUG
+#include <f32file.h>
+#endif
+
+#include <badesca.h>
+
+// sip api
+#include <sip.h>
+#include <sipconnection.h>
+#include <sipconnectionobserver.h>
+#include <sipresponseelements.h>
+#include <siprequestelements.h>
+#include <sipclienttransaction.h>
+#include <siprefresh.h>
+#include <sipmessageelements.h>
+#include <sipsubscribedialogassoc.h>
+#include <sipregistrationcontext.h>
+
+// sip codec api
+#include <sipfromheader.h>
+#include <siptoheader.h>
+#include <sipexpiresheader.h>
+#include <sipeventheader.h>
+#include <sipcontenttypeheader.h>
+#include <sipaddress.h>
+#include <sipstrings.h>
+#include <sipstrconsts.h>
+#include <sipextensionheader.h>
+#include <sipsubscriptionstateheader.h>
+#include <sipsupportedheader.h>
+#include <sipacceptheader.h>
+
+#include <cvimpstsettingsstore.h>
+
+// own simple
+#include "simplesipconnection.h"
+#include "simplesipconnectionobserver.h"
+#include "simplesipprofileobserver.h"
+#include "simplerefreshtimer.h"
+#include "msimpleenginerequest.h"
+#include "simpleerrors.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#ifdef __LOCAL_MODE
+// INTERNAL TEST SUITE
+#include "simplelocalmodeutils.h"
+#endif
+#endif
+
+_LIT8 ( KSimpleWINFO, "winfo");
+_LIT8 ( KSimplePRESENCE_LOW, "presence");
+_LIT8 ( KSimpleEventlist, "eventlist");
+_LIT8 ( KSimpleId, "id");
+_LIT8 ( KSimpleAnonymous, "\"Anonymous\" <sip:anonymous@anonymous.invalid>");
+_LIT8 ( KSimpleDeactivated, "deactivated" );
+_LIT8 ( KSimpleProbation, "probation" );
+_LIT8 ( KSimpleRejected, "rejected" );
+_LIT8 ( KSimpleTimeout, "timeout" );
+_LIT8 ( KSimpleGiveup, "giveup" );
+_LIT8 ( KSimpleNoresource, "Noresource" );
+_LIT8 ( KSipPrefix, "sip:" );
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::CSimpleSipConnection
+// ----------------------------------------------------------
+//
+CSimpleSipConnection::CSimpleSipConnection()
+: iSip(NULL), iSipConnection(NULL), iConnectionObserver(NULL),
+ iSipState( ESimpleSipInactive ),
+ iRequestList(CSimpleRequest::LinkOffset()),
+ iCurrentNbrSubs( 0 )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::~CSimpleSipConnection
+// ----------------------------------------------------------
+//
+EXPORT_C CSimpleSipConnection::~CSimpleSipConnection()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DESTRUCTOR this=%d" ), (TInt)this );
+ iFs.Close();
+#endif
+ delete iSipConnection;
+ delete iProfileObserver;
+ delete iConnectionObserver;
+ delete iSip;
+ DeleteRequests();
+ DeleteRequests( CSimpleRequest::EReqReceiveIM );
+ SIPStrings::Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::NewL
+// ----------------------------------------------------------
+//
+EXPORT_C CSimpleSipConnection* CSimpleSipConnection::NewL()
+ {
+ CSimpleSipConnection* self = new (ELeave) CSimpleSipConnection;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::ConstructL()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L("SipConnection: ConstructL 20-01-07 this=%d" ), (TInt)this );
+#endif
+
+ iConnectionObserver = CSimpleSipConnectionObserver::NewL( *this);
+ SIPStrings::OpenL();
+ // read static cenrep settings
+ iSettings.ReadCentRepSettings();
+
+#ifdef _DEBUG
+ // read ini file for debug version settings
+ (void)iFs.Connect();
+ TRAP_IGNORE(iSettings.ReadIniFileL( iFs ));
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DispatchReqL
+// ----------------------------------------------------------
+//
+EXPORT_C void CSimpleSipConnection::DispatchReqL( MSimpleEngineRequest& aReq )
+ {
+ MSimpleEngineRequest::TSimpleRequest type = aReq.RequestType();
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DispatchReqL type=%d this=%d" ),
+ type, (TInt)this );
+#endif
+
+ switch ( type )
+ {
+ case MSimpleEngineRequest::ERegister:
+ aReq.SetRefreshTime( 0 );
+ RegisterL( aReq );
+ break;
+ case MSimpleEngineRequest::ESendIM:
+ aReq.SetRefreshTime( 0 );
+ SendInstantMessageL( aReq );
+ break;
+ case MSimpleEngineRequest::EReceiveIM:
+ aReq.SetRefreshTime( 0 );
+ RequestInstantMessageReceivingL( aReq );
+ break;
+ case MSimpleEngineRequest::EStartPublish:
+ aReq.SetRefreshTime( iSettings.ExpiryPuhlish() );
+ StartPublishL( aReq );
+ break;
+ case MSimpleEngineRequest::EPublishModify:
+ ModifyPublishL( aReq );
+ break;
+ case MSimpleEngineRequest::ESubscribe:
+ aReq.SetRefreshTime( iSettings.ExpiryWatcher() );
+ SubscribeL( aReq);
+ break;
+ case MSimpleEngineRequest::ESubscribeStop:
+ aReq.SetRefreshTime( 0 );
+ StopSubscribeL( aReq );
+ break;
+ case MSimpleEngineRequest::ESubscribeGet:
+ aReq.SetRefreshTime( 0 );
+ SubscribeL( aReq );
+ break;
+ case MSimpleEngineRequest::ESubscribeWinfo:
+ aReq.SetRefreshTime( iSettings.ExpiryWinfo() );
+ SubscribeWinfoL( aReq );
+ break;
+ case MSimpleEngineRequest::ESubscribeLista:
+ aReq.SetRefreshTime( iSettings.ExpiryWatcher() );
+ SubscribeListL( aReq );
+ break;
+ case MSimpleEngineRequest::EStopPublish:
+ aReq.SetRefreshTime( 0 );
+ StopPublishL( aReq );
+ break;
+ case MSimpleEngineRequest::EListenEvents:
+ aReq.SetRefreshTime( 0 );
+ ListenStatusL( aReq );
+ break;
+ case MSimpleEngineRequest::EDestroy:
+ DeleteRequest( aReq );
+ break;
+ case MSimpleEngineRequest::EDestroyStart:
+ DeleteRequestStart( aReq );
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SIPStatus
+// ----------------------------------------------------------
+//
+EXPORT_C TUint CSimpleSipConnection::SIPStatus(
+ TInt aOpId, TInt& aRetryAfter )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SIPStatus this=%d" ), (TInt)this);
+#endif
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ aRetryAfter = 0;
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ MSimpleEngineRequest& mr = req->Request();
+ if ( mr.OpId( ) == aOpId )
+ {
+ aRetryAfter = req->RetryAfter();
+ return req->Status();
+ }
+ }
+ return 0;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SIPState
+// ----------------------------------------------------------
+//
+EXPORT_C TSimpleSipState CSimpleSipConnection::SIPState( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SIPState returns %d this=%d" ),
+ iSipState, (TInt)this );
+#endif
+ return iSipState;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::CurrentSIPIdentityL
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CSimpleSipConnection::CurrentSIPIdentityL()
+ {
+ return iProfileObserver->GiveUserAorL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SipSubscriptionState
+// ----------------------------------------------------------
+//
+EXPORT_C MSimpleEngineRequest::TSimpleSipSubscriptionState CSimpleSipConnection::SipSubscriptionState(
+ MSimpleEngineRequest& aReq )
+ {
+ MSimpleEngineRequest::TSimpleSipSubscriptionState retVal = MSimpleEngineRequest::ESimpleStateNone;
+
+ CSimpleRequest* r = GetCliRequest( aReq );
+ if ( r )
+ {
+ retVal = r->SipSubscriptionState();
+ }
+ else
+ {
+ }
+
+ return retVal;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::RegisterL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::RegisterL( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: RegisterL" ));
+#endif
+ // Check if already registered
+ switch ( iSipState )
+ {
+ case ESimpleSipInactive:
+ {
+ if ( !aReq.Aux() )
+ {
+ // Default profile used
+ RegisterDefaultL( aReq );
+ }
+ else
+ {
+ RegisterAnyL( aReq );
+ }
+ }
+ break;
+ case ESimpleSipActive:
+ case ESimpleSipSuspend:
+ // The sip connection is already registered,
+ // return the callback.
+ aReq.Complete( KErrNone );
+ break;
+ case ESimpleSipIdle:
+ {
+ // already initiated, just wait
+ // Save the request to wait a response
+ CSimpleRequest* simpleR = CSimpleRequest::NewL(
+ *this, aReq, CSimpleRequest::EReqRegister, aReq.RefreshTime());
+ iRequestList.AddLast( *simpleR );
+ }
+ break;
+ case ESimpleSipUnavailable:
+ default:
+ User::Leave( KErrNotFound );
+ break;
+ }; //lint !e960
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::ListenStatusL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::ListenStatusL( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ListenStatusL" ));
+#endif
+ // Save the request to wait a response
+ CSimpleRequest* simpleR = CSimpleRequest::NewL(
+ *this, aReq, CSimpleRequest::EReqListenEvents, aReq.RefreshTime() );
+ iRequestList.AddLast( *simpleR );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::RequestInstantMessageReceivingL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::RequestInstantMessageReceivingL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L(
+ "CSimpleSipConnection::RequestInstantMessageReceivingL - Start" ) );
+#endif
+
+ // Create the request
+ CSimpleRequest* request = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqReceiveIM, aReq.RefreshTime() );
+
+ // Save the request into queue
+ iRequestList.AddLast( *request );
+
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L(
+ "CSimpleSipConnection::RequestInstantMessageReceivingL - End" ) );
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SendInstantMessageL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::SendInstantMessageL( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleSipConnection::SendInstantMessageL - Start" ) );
+#endif
+
+ // Create the request
+ CSimpleRequest* request = CSimpleRequest::NewL( *this, aReq,
+ CSimpleRequest::EReqSendIM, aReq.RefreshTime() );
+ CleanupStack::PushL( request ); // CS: 1
+
+ request->SetDataL( aReq.RequestData() );
+ request->SetRequestContentTypeL( aReq.RequestContentType() );
+ request->SetRefreshTime( aReq.RefreshTime() );
+
+ if ( ESimpleSipActive == iSipState )
+ {
+ // Set request state
+ request->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ const TDesC8& aContent = request->Data();
+
+ if ( !iSipConnection || ESimpleSipActive != iSipState ||
+ !iProfileObserver )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ MSIPRegistrationContext* regContext = iProfileObserver->
+ ProfileContext();
+
+ if ( !regContext )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // Check CLIENT-OBJ-DATA-LIMIT
+ TUint myLimit = iSettings.ObjLimit();
+
+ if ( myLimit && ( TUint )aContent.Size() > myLimit )
+ {
+ // This is too big mesasge, an error is returned
+ User::Leave( KSimpleErrSettingsLimit );
+ }
+
+ // Get request URI from a request
+ TUriParser8 parser;
+ HBufC8* temp = HBufC8::NewLC( KSipPrefix().Length() +
+ aReq.Recipient().Length() ); // CS: 2
+ temp->Des().Copy( KSipPrefix() );
+ temp->Des().Append( aReq.Recipient() );
+ User::LeaveIfError( parser.Parse( *temp ));
+ CUri8* uri = CUri8::NewL( parser );
+
+ // Start to fill header, Remote URI
+ CSIPRequestElements* elems = CSIPRequestElements::NewL( uri );
+ CleanupStack::PushL( elems ); // CS: 3
+
+ TUriParser8 parser3;
+ User::LeaveIfError( parser3.Parse( iProfileObserver->
+ GiveUserAorL() ));
+ uri = CUri8::NewL( parser3 );
+ CSIPAddress* sipAddress = CSIPAddress::NewL( uri );
+
+ // From Header
+ CSIPFromHeader* fromH = CSIPFromHeader::NewL( sipAddress );
+ elems->SetFromHeaderL( fromH ); // fromH, ownership given to elems
+
+ uri = CUri8::NewL( parser );
+ CSIPAddress* addr = CSIPAddress::NewL( uri );
+ // To Header
+ CSIPToHeader* toHeader = CSIPToHeader::NewL( addr );
+ elems->SetToHeaderL( toHeader );
+
+ CSIPMessageElements& mesElems = elems->MessageElements();
+
+ // Add Expires Header
+ if ( aReq.RefreshTime() )
+ {
+ RPointerArray<CSIPHeaderBase> headers;
+ CleanupClosePushL( headers ); // CS: 4
+
+ CSIPExpiresHeader* exprH = new (ELeave) CSIPExpiresHeader(
+ aReq.RefreshTime() );
+ CleanupStack::PushL( exprH ); // CS: 5
+ User::LeaveIfError( headers.Append( exprH ) );
+ CleanupStack::Pop( exprH ); // CS: 4
+
+ mesElems.SetUserHeadersL( headers );
+ // headers ownership given to mesElems
+ CleanupStack::Pop( &headers ); // CS: 3
+ }
+
+ // Set content type and content
+ HBufC8* buffer = aContent.AllocLC(); // CS: 4
+ CSIPContentTypeHeader* contTypeH = CSIPContentTypeHeader::NewL(
+ KSimpleMediaType, KSimpleMediaSubType );
+ CleanupStack::Pop( buffer ); // CS: 3
+ mesElems.SetContentL( buffer, contTypeH );
+ // buffer ownership given to mesElems
+ // contTypeH ownership given to mesElems
+
+ // Set method
+ elems->SetMethodL( SIPStrings::StringF( SipStrConsts::EMessage ) );
+
+ CleanupStack::Pop( elems ); // CS: 2
+ // Send the request transaction
+ // elems, ownership given
+ CSIPClientTransaction* sipTrans = iSipConnection->SendRequestL( elems,
+ *regContext );
+
+ // Save SIP client transaction
+ request->SetTransaction( sipTrans );
+
+ CleanupStack::PopAndDestroy( temp ); // CS: 1
+
+ // Start refresh timer, it's used for garbage collection too.
+ request->StartRefreshTimer();
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ request->SetReqState( CSimpleRequest::ESimplePendingInit );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // Save the request into queue
+ iRequestList.AddLast( *request );
+ CleanupStack::Pop( request ); // CS: 0
+
+ // Update SOURCE-THROTTLE-PUBLISH time
+ if ( iSettings.Throttle() )
+ {
+ request->SetThrottleTime( iSettings.Throttle() );
+ }
+
+ // Start timer to detect infinite wait situation
+ request->StartExpiryTimer( iSettings.ExpiryApi() );
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L( "CSimpleSipConnection::SendInstantMessageL - End" ) );
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::StartPublishL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::StartPublishL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: StartPublishL" ));
+ TSimpleLogger::Dump( aReq.RequestData(), iFs, 0 );
+#endif
+
+ // create the request
+ CSimpleRequest* r = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqPublish, aReq.RefreshTime() );
+ CleanupStack::PushL( r );
+ r->SetDataL( aReq.RequestData() );
+ r->SetRequestContentTypeL( aReq.RequestContentType() );
+
+ // Set ETag if given
+ if ( aReq.ETag().Length() )
+ {
+ HBufC8* etagBuf = aReq.ETag().AllocL();
+ // Ownership is transferred
+ r->SetETag( etagBuf );
+ }
+
+ // save refresh time
+ r->SetRefreshTime( aReq.RefreshTime() );
+
+ if ( iSipState == ESimpleSipActive )
+ {
+ // set request state
+ r->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ // Do the SIP Publish transaction
+ CSIPClientTransaction* sipTrans = DoPublishL(
+ iProfileObserver->GiveUserAorL(),
+ aReq.RefreshTime(),
+ r->Data(),
+ r->ETag(), r->RequestContentType() );
+ // Save SIP client transaction
+ r->SetTransaction( sipTrans );
+
+ // Start re-fresh timer, it's used for garbage collection too.
+ // expires [ no refresh ]
+ r->StartRefreshTimer();
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ r->SetReqState( CSimpleRequest::ESimplePendingInit );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // Save the request into queue
+ iRequestList.AddLast( *r );
+ CleanupStack::Pop( r );
+
+ // update SOURCE-THROTTLE-PUBLISH time
+ if ( iSettings.Throttle() )
+ {
+ r->SetThrottleTime( iSettings.Throttle() );
+ }
+
+ // Start timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::ModifyPublishL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::ModifyPublishL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ModifyPublishL" ));
+ TSimpleLogger::Dump( aReq.RequestData(), iFs, 0 );
+#endif
+
+ // Get initial SIP transaction in order to get ETag value.
+ CSimpleRequest* r = GetCliRequest( aReq );
+ if ( !r || r->ETag().Length() == 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ // Check the request state is valid
+ CSimpleRequest::TSimpleReqState myState = r->ReqState();
+ if ( myState != CSimpleRequest::ESimpleActive &&
+ myState != CSimpleRequest::ESimplePending &&
+ myState != CSimpleRequest::ESimpleRunning )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // initialize SIP status
+ r->SetStatus( 0 );
+
+ // check SOURCE-THROTTLE-PUBLISH
+ TTime myTime;
+ myTime.HomeTime();
+ if ( iSettings.Throttle() && myTime < r->ThrottleTime() )
+ {
+ // Leave if not enough time elapsed since last publish
+ // for this publication.
+ User::Leave( KSimpleErrSettingsLimit );
+ }
+
+ // send PUBLISH modify transaction if network is available
+ if ( iSipState == ESimpleSipActive &&
+ myState != CSimpleRequest::ESimpleRunning )
+ {
+ // set state
+ r->SetReqState( CSimpleRequest::ESimpleRunning );
+ r->SetDataL( aReq.RequestData() );
+ r->SetRequestContentTypeL( aReq.RequestContentType() );
+
+ CSIPClientTransaction* sipTrans = DoPublishL(
+ iProfileObserver->GiveUserAorL(),
+ aReq.RefreshTime(),
+ r->Data(),
+ r->ETag(), r->RequestContentType() );
+
+ // save latest client transaction
+ r->SetTransaction( sipTrans );
+
+ // Re-fresh timer is started in ok response, not yet here.
+
+ // update SOURCE-THROTTLE-PUBLISH time
+ if ( iSettings.Throttle() )
+ {
+ r->SetThrottleTime( iSettings.Throttle() );
+ }
+ }
+ else if ( iSipState == ESimpleSipActive &&
+ myState == CSimpleRequest::ESimpleRunning )
+ {
+ // not to send the ETag only.
+ r->AddPendingState( CSimpleRequest::EPendingModify );
+ r->SetDataL( aReq.RequestData() );
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ // set state
+ r->SetReqState( CSimpleRequest::ESimplePending );
+ // not to send the ETag only.
+ r->AddPendingState( CSimpleRequest::EPendingModify );
+ r->SetDataL( aReq.RequestData() );
+ }
+ else
+ {
+ // very rare situation
+ User::Leave( KErrNotReady );
+ }
+
+ // start expiry timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+
+#ifdef _DEBUG
+ TBuf<100> myETag;
+ myETag.Copy( r->ETag() );
+ TSimpleLogger::Log(_L("SipConnection: ModifyPublishL ETag=%S" ), &myETag );
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::StartToRefreshL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::StartToRefreshL( CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: StartToRefresh"));
+#endif
+
+ // This refreshes PUBLISH request or makes garbage collection for
+ // subscription without refresh.
+
+ // There are two cases: normal re-publish
+ // or expiration of publication
+
+ if ( aReq.Match( CSimpleRequest::EReqPublish ) )
+ {
+ // refresh[ network ]
+ // time to retry
+ // expires[ no refresh ]
+ // expires
+ DoRefreshPublishL( aReq );
+ }
+ else if ( aReq.Match( CSimpleRequest::EReqSubscribe ) ||
+ aReq.Match( CSimpleRequest::EReqSubscribeList ) ||
+ aReq.Match( CSimpleRequest::EReqSubscribeWinfo ))
+ {
+ DoRefreshSubscribe( aReq );
+ }
+ else
+ {
+ // No other cases
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::StopPublishL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::StopPublishL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: StopPublishL" ));
+#endif
+
+ CSIPClientTransaction* sipTrans = NULL;
+
+ TBool stopETagScratch (EFalse);
+
+ // Get SIP transaction in order to get ETag value.
+ CSimpleRequest* r = GetCliRequest( aReq );
+ if ( !r && aReq.ETag().Length() == 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+ else if ( !r )
+ {
+ // create the request
+ r = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqPublish, aReq.RefreshTime() );
+ CleanupStack::PushL( r );
+ stopETagScratch = ETrue;
+ }
+
+ // Set ETag if given
+ if ( aReq.ETag().Length() )
+ {
+ HBufC8* etagBuf = aReq.ETag().AllocL();
+ // Ownership is transferred
+ r->SetETag( etagBuf );
+ r->SetGivenETag( ETrue );
+ }
+
+ // initialize SIP status
+ r->SetStatus( 0 );
+
+ // refresh timer not needed
+ r->StopRefreshTimer();
+
+ // set state
+ r->SetReqState( CSimpleRequest::ESimpleStopping );
+
+ // Check if the transaction is pending or running
+ if ( r->ETag().Length() == 0 )
+ {
+ r->SetReqState( CSimpleRequest::ESimpleComplete );
+ r->Complete( KErrNone );
+ return;
+ }
+
+ // send PUBLISH transaction
+ TRAPD( errx, sipTrans = DoPublishL(
+ iProfileObserver->GiveUserAorL(),
+ 0, // 0 epiry headers value
+ KNullDesC8, // request data
+ r->ETag(), r->RequestContentType() ));
+ if ( errx )
+ {
+ // In error case complete the request immediately
+ r->Complete( errx );
+ return;
+ }
+
+ // save latest client transaction
+ r->SetTransaction( sipTrans );
+
+ // start expiry timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+
+ if ( stopETagScratch )
+ {
+ // Save the request into queue
+ iRequestList.AddLast( *r );
+ CleanupStack::Pop( r );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SubscribeL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::SubscribeL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SubscribeL" ));
+#endif
+
+ CSIPSubscribeDialogAssoc* subsDialog = NULL;
+
+ // create the request
+ CSimpleRequest* r = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqSubscribe, aReq.RefreshTime() );
+ CleanupStack::PushL( r );
+
+ if ( iSipState == ESimpleSipActive )
+ {
+ r->SetDataL( aReq.RequestData() );
+ r->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ CSIPClientTransaction* sipTrans = DoSubscribeL(
+ aReq.RemoteURI(),
+ aReq.RefreshTime(),
+ r->Data(),
+ subsDialog,
+ aReq.IsRefresh(),
+ ESubsRegular,
+ aReq.Aux() ? ETrue : EFalse );
+ // save SIP Dialog and SIP client transaction
+ r->SetDialog( subsDialog );
+ r->SetTransaction( sipTrans );
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ r->SetReqState( CSimpleRequest::ESimplePendingInit );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ CleanupStack::Pop( r );
+ iRequestList.AddLast( *r );
+
+ // start timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+
+ if ( !aReq.IsRefresh() )
+ {
+ // Start refresh timer for garbage colletion for
+ // subscription not needing refresh.
+ TUint myTime = ( aReq.RefreshTime() > iSettings.ExpiryApi() ?
+ aReq.RefreshTime() : iSettings.ExpiryApi() );
+ r->SetRefreshTime( myTime );
+ r->StartRefreshTimer();
+ }
+ // increase subscription counter
+ IncreaseNbrSubs();
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SubscribeListL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::SubscribeListL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SubscribeListL" ));
+#endif
+
+ CSIPSubscribeDialogAssoc* subsDialog = NULL;
+
+ // create the request
+ CSimpleRequest* r = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqSubscribeList, aReq.RefreshTime() );
+ CleanupStack::PushL( r );
+
+ if ( iSipState == ESimpleSipActive )
+ {
+ r->SetDataL( aReq.RequestData() );
+ r->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ CSIPClientTransaction* sipTrans = DoSubscribeL(
+ aReq.RemoteURI(),
+ aReq.RefreshTime(),
+ r->Data(),
+ subsDialog,
+ aReq.IsRefresh(),
+ ESubsList,
+ aReq.Aux() ? ETrue : EFalse );
+ // save SIP Dialog and SIP client transaction
+ r->SetDialog( subsDialog );
+ r->SetTransaction( sipTrans );
+ }
+ else if ( iSipState == ESimpleSipUnavailable || iSipState == ESimpleSipIdle )
+ {
+ User::Leave( KErrNotReady );
+ }
+ else
+ {
+ r->SetReqState( CSimpleRequest::ESimplePendingInit );
+ }
+
+ CleanupStack::Pop( r );
+ iRequestList.AddLast( *r );
+
+ // Start timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+
+ if ( !aReq.IsRefresh() )
+ {
+ // Start refresh timer for garbage colletion for
+ // subscription not needing refresh.
+ TUint myTime = ( aReq.RefreshTime() > iSettings.ExpiryApi() ?
+ aReq.RefreshTime() : iSettings.ExpiryApi() );
+ r->SetRefreshTime( myTime );
+ r->StartRefreshTimer();
+ }
+ // increase subscription counter
+ IncreaseNbrSubs();
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SubscribeWinfoL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::SubscribeWinfoL(
+ MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SubscribeWinfoL" ));
+#endif
+ // get request-URI from SIP profiles
+ TPtrC8 aor = iProfileObserver->GiveUserAorL();
+ aReq.SetRemoteURIL( aor );
+
+ CSIPSubscribeDialogAssoc* subsDialog = NULL;
+
+ // create the request
+ CSimpleRequest* r = CSimpleRequest::NewL( *this,
+ aReq, CSimpleRequest::EReqSubscribeWinfo, aReq.RefreshTime() );
+ CleanupStack::PushL( r );
+
+ if ( iSipState == ESimpleSipActive )
+ {
+ r->SetDataL( aReq.RequestData() );
+ r->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ CSIPClientTransaction* sipTrans = DoSubscribeL(
+ aReq.RemoteURI(),
+ aReq.RefreshTime(),
+ r->Data(),
+ subsDialog,
+ ETrue,
+ ESubsWinfo,
+ EFalse );
+ // save SIP Dialog and SIP client transaction
+ r->SetDialog( subsDialog );
+ r->SetTransaction( sipTrans );
+ }
+ else if ( iSipState == ESimpleSipUnavailable || iSipState == ESimpleSipIdle )
+ {
+ User::Leave( KErrNotReady );
+ }
+ else
+ {
+ r->SetReqState( CSimpleRequest::ESimplePendingInit );
+ }
+
+ CleanupStack::Pop( r );
+ iRequestList.AddLast( *r );
+
+ // Start timer to detect infinite wait situation
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::StopSubscribeL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::StopSubscribeL(
+ MSimpleEngineRequest& aReq )
+ {
+
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: StopSubscribeL" ));
+#endif
+
+ // Get SIP transaction
+ CSimpleRequest* r = GetCliRequest( aReq );
+ if ( !r )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ CSIPSubscribeDialogAssoc* dialog = r->Dialog();
+ if ( !dialog )
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ if ( r->ReqState() == CSimpleRequest::ESimpleReTry ||
+ r->ReqState() == CSimpleRequest::ESimplePendingInit ||
+ r->ReqState() == CSimpleRequest::ESimplePending )
+ {
+ // There is not active SIP dialog,
+ // therefore real stopping is not needed.
+ r->SetReqState( CSimpleRequest::ESimpleStopping );
+ r->Request().SetResponseMethod( MSimpleEngineRequest::EUnknownResponse );
+ r->Complete( KErrCompletion );
+ return;
+ }
+ else if ( r->ReqState() == CSimpleRequest::ESimpleDeleting )
+ {
+ // there is no active subscription
+ User::Leave( KErrNotFound );
+ }
+
+ // modify the old request entity
+ r->SetTransaction( NULL );
+
+ // create new unsubscribe transaction in the dialog
+ // Add accepted header
+ CSIPMessageElements* mesElems = CSIPMessageElements::NewLC();
+ RPointerArray<CSIPHeaderBase> headers;
+ CleanupClosePushL( headers );
+ // Accept header with application/pidf+xml is
+ // added for reqular subscription and list subscription
+ CSIPAcceptHeader* acceH = NULL;
+ TInt popCount(0);
+
+ if ( r->Match( CSimpleRequest::EReqSubscribe ) ||
+ r->Match( CSimpleRequest::EReqSubscribeList ))
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimplePidfSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ ++popCount;
+ }
+ if ( r->Match( CSimpleRequest::EReqSubscribeList ))
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimpleListSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ ++popCount;
+
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleMultiType, KSimpleMultipartSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ ++popCount;
+
+ // add supported header with value eventlist
+ RPointerArray<CSIPSupportedHeader> suppHs =
+ CSIPSupportedHeader::DecodeL( KSimpleEventlist);
+ for( TInt count=0; count < suppHs.Count(); count++ )
+ {
+ User::LeaveIfError( headers.Append( suppHs[count] ));
+ }
+ suppHs.Close();
+ }
+ if ( r->Match( CSimpleRequest::EReqSubscribeWinfo ))
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimpleWinfoSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ ++popCount;
+ }
+
+ // ---------------------------------------------------------
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ */
+ CSimpleLocalModeUtils::AddTestHeaderL( headers );
+#endif
+#endif
+ // ---------------------------------------------------------
+
+ // add content
+ mesElems->SetUserHeadersL( headers );
+
+ // Pop AccessHeaders
+ CleanupStack::Pop( popCount );
+ CleanupStack::PopAndDestroy( &headers );
+
+ // Send SUBSCRIBE message
+ CSIPClientTransaction* sipTrans = dialog->SendUnsubscribeL( mesElems );
+ CleanupStack::Pop( mesElems );
+
+ // save client transaction
+ r->SetTransaction( sipTrans );
+
+ // Start timer to detect infinite wait situation
+ r->SetReqState( CSimpleRequest::ESimpleStopping );
+ r->StartExpiryTimer( iSettings.ExpiryApi() );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::IncomingRequest
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::IncomingRequest( TUint32 /*aIapId*/,
+ CSIPServerTransaction* /*aTransaction*/)
+ {
+ // Nothing to do.
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: IncomingRequest" ));
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::TimedOut
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::TimedOut( CSIPServerTransaction& /*aTransaction*/)
+ {
+ // Nothing to do.
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: TimeOut" ));
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::ConnectionStateChange
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::ConnectionStateChange(
+ TSimpleSipState aState, TInt aSipError )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ConnectionStateChange %d->%d"),
+ iSipState, aState);
+#endif
+
+ // re-try to get connection
+ TSimpleSipState oldState = iSipState;
+
+ RecognizeSipState( aState );
+
+ // Complete status event
+ if ( oldState != iSipState )
+ {
+ CompleteStatusRequest();
+ }
+
+ // Profile observer gives active event and then the connection can be started to create.
+ if ( oldState == ESimpleSipIdle && aState == ESimpleSipActive )
+ {
+ TRAPD( err, iSipConnection = iProfileObserver->GiveConnectionL() );
+ if ( !err )
+ {
+ SetSipState( ESimpleSipActive );
+ // complete client requests
+ CompleteRegisterRequests( KErrNone );
+ }
+ else if ( err != KErrNotReady )
+ {
+ // error callback to SimpleEngine
+ SetSipState( ESimpleSipInactive );
+ CompleteRegisterRequests( err );
+ }
+ else
+ {
+ // KErrNotReady is a normal error indicating
+ // pending initialization.
+ }
+ }
+ else if ( iSipState == ESimpleSipUnavailable )
+ {
+ iCurrentNbrSubs = 0;
+ // Complete all pending register requests with an error code
+ TInt retErr = aSipError ? aSipError : KErrDisconnected;
+ CompleteRegisterRequests( retErr );
+ // Complete all active subscriptions and publications and
+ // call API callbacks. KErrDisconnected has a special handling
+ // in CSimpleRequest::Complete().
+ CompleteRegularRequests( KErrDisconnected );
+ }
+ else if ( iSipState == ESimpleSipInactive )
+ {
+ iCurrentNbrSubs = 0;
+ // Complete all pending register requests with an error code
+ TInt retErr = aSipError ? aSipError : KErrDisconnected;
+ CompleteRegisterRequests( retErr );
+ // All the dialogs and transactions are lost.
+ // Registeration is done automatically when state is active again.
+ // Complete all active subscriptions and publications and
+ // call API callbacks now. KErrDisconnected has a special handling
+ // in CSimpleRequest::Complete().
+ CompleteRegularRequests( KErrDisconnected );
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ // Wait till the active state
+ }
+ else if ( oldState == ESimpleSipSuspend && iSipState == ESimpleSipActive )
+ {
+ // Scan all the pending requests and start to proceed them
+ HandlePendings();
+ }
+ else
+ {
+ // nothing to do
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::HandleReceivedMessage
+// ----------------------------------------------------------
+//
+TInt CSimpleSipConnection::HandleReceivedMessage( const TDesC8& aFrom,
+ const TDesC8& aContent )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L("CSimpleSipConnection::HandleReceivedMessage") );
+#endif
+ TInt error( KErrNone );
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+
+ if ( req->Match( CSimpleRequest::EReqReceiveIM ) )
+ {
+ TRAP( error, DoHandleReceivedMessageL( aFrom, aContent, *req ) )
+ }
+ }
+
+ // KErrNoMemory is returned here if error occurred when allocating
+ // memory for heap descriptors in DoHandleReceivedMessageL
+ return error;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::ConnectionChanged
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::ConnectionChanged()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged"));
+ if( iSipConnection )
+ {
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged : old conn state %d (internal:%d)"), iSipConnection->State(), iSipState );
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged : old IAP %d"), iSipConnection->IapId() );
+ }
+#endif
+
+ iCurrentNbrSubs = 0;
+ CSIPConnection* conn = NULL;
+ TRAPD( err, conn = iProfileObserver->GiveConnectionL() );
+ if( !err )
+ {
+ delete iSipConnection;
+ iSipConnection = conn;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged : new conn state %d"), iSipConnection->State() );
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged : new IAP %d"), iSipConnection->IapId() );
+#endif
+ }
+#ifdef _DEBUG
+ else
+ {
+ TSimpleLogger::Log(_L("SipConnection: ConnectionChanged : Get SIP connection error %d"), err );
+ }
+#endif
+
+ if( iSipConnection )
+ {
+ if( iSipState != iSipConnection->State() )
+ {
+ iConnectionObserver->ConnectionStateChanged( iSipConnection->State() );
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::StartToCheckExpiryL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::StartToCheckExpiryL( CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: StartToCheckExpiryL"));
+#endif
+
+ // This is expired
+ aReq.Complete( KErrTimedOut );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::GetRequest
+// ----------------------------------------------------------
+//
+CSimpleRequest* CSimpleSipConnection::GetRequest(
+ CSIPClientTransaction& aTrans )
+ {
+ // Search the correspoding request element
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( aTrans ))
+ {
+ return req;
+ }
+ }
+
+ return (CSimpleRequest*)NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::GetCliRequest
+// ----------------------------------------------------------
+//
+CSimpleRequest* CSimpleSipConnection::GetCliRequest(
+ MSimpleEngineRequest& aReq )
+ {
+ // Search the correspoding request element
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( aReq ))
+ {
+ return req;
+ }
+ }
+
+ return (CSimpleRequest*)NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::GetdDialogRequest
+// ----------------------------------------------------------
+//
+CSimpleRequest* CSimpleSipConnection::GetdDialogRequest( const CSIPDialog& aDialog )
+ {
+ // Search the correspoding request element
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( aDialog ))
+ {
+ return req;
+ }
+ }
+
+ return (CSimpleRequest*)NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::DeleteRequests
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::DeleteRequests()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DeleteRequests" ));
+#endif
+ // Delete all buffered transaction requests
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+
+ // open request EReqReceiveIM should not be deleted
+ // will be deleted only when im message received
+ // or destructor is called.
+ if ( !req->Match( CSimpleRequest::EReqReceiveIM ) )
+ {
+ req->Destroy();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::DeleteRequests
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::DeleteRequests(
+ CSimpleRequest::TSimpleSipReqType aRequestType )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DeleteRequests type=%d" ),
+ aRequestType );
+#endif
+ // Delete buffered transaction requests match to the aRequestType
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+
+ if ( req->Match( aRequestType ) )
+ {
+ req->Destroy();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::DeleteRequest
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::DeleteRequest( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DeleteRequest" ));
+#endif
+
+ CSimpleRequest* r = CSimpleSipConnection::GetCliRequest( aReq );
+ if ( r )
+ {
+ if ( r->Match( CSimpleRequest::EReqSubscribe ) ||
+ r->Match( CSimpleRequest::EReqSubscribeList ) )
+ {
+ DecreaseNbrSubs();
+ }
+ r->Destroy();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::DeleteRequestStart
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::DeleteRequestStart( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DeleteRequestStart" ));
+#endif
+
+ CSimpleRequest* r = CSimpleSipConnection::GetCliRequest( aReq );
+ if ( r )
+ {
+ if ( r->Match( CSimpleRequest::EReqSubscribe ) ||
+ r->Match( CSimpleRequest::EReqSubscribeList ))
+ {
+ DecreaseNbrSubs();
+ }
+ r->DestroyStart();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::CompleteRegisterRequests
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::CompleteRegisterRequests( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: CompleteRegisterRequests %d" ), aStatus);
+#endif
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( CSimpleRequest::EReqRegister ))
+ {
+ req->Complete( aStatus );
+ // Open request can be deletetd after completion.
+ req->Destroy();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::CompleteRegularRequests
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::CompleteRegularRequests( TInt aStatus )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: CompleteRegularRequests %d" ), aStatus);
+#endif
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( CSimpleRequest::EReqPublish ) ||
+ req->Match( CSimpleRequest::EReqSubscribe ) ||
+ req->Match( CSimpleRequest::EReqSubscribeList ) ||
+ req->Match( CSimpleRequest::EReqSubscribeWinfo ))
+ {
+ req->SetReason( KErrNone );
+ req->Request().SetResponseMethod( MSimpleEngineRequest::EUnknownResponse );
+ req->Complete( aStatus );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnection::CompleteStatusRequest
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::CompleteStatusRequest( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: CompleteStatusRequest" ) );
+#endif
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+ if ( req->Match( CSimpleRequest::EReqListenEvents ))
+ {
+ req->CompleteEvent( );
+ return;
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoPublishL
+// ----------------------------------------------------------
+//
+CSIPClientTransaction* CSimpleSipConnection::DoPublishL(
+ const TDesC8& aRemoteURI, TInt aExpiry,
+ const TDesC8& aContent, const TDesC8& aSipIfMatch,
+ const TDesC8& aContentType )
+ {
+#ifdef _DEBUG
+ TBuf<100> testBuf;
+ testBuf.Copy( aSipIfMatch );
+ TSimpleLogger::Log(_L("SipConnection: DoPublishL expiry=%d sip-if-match=%S" ),
+ aExpiry, &testBuf);
+#endif
+
+ TBool multi( EFalse );
+
+ if ( aContent.Length() &&
+ aContentType.CompareF( KSimpleDocumentType ))
+ {
+ // content exists and not pidf+xml (not refresh)
+ multi = ETrue;
+ }
+
+ if ( !iSipConnection || iSipState != ESimpleSipActive || !iProfileObserver )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ MSIPRegistrationContext* regContext = iProfileObserver->ProfileContext();
+ if ( !regContext )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // Check CLIENT-OBJ-DATA-LIMIT
+ TUint myLimit = iSettings.ObjLimit();
+ // Breakpoint:
+ if ( myLimit && (TUint)aContent.Size() > myLimit )
+ {
+ // This is too big mesasge, an error is returned
+ User::Leave( KSimpleErrSettingsLimit );
+ }
+
+ // get request uri from a request
+ TUriParser8 parser;
+ User::LeaveIfError( parser.Parse( aRemoteURI ));
+ CUri8* uri = CUri8::NewLC( parser );
+
+ // Start to fill headres, Remote URI
+ CSIPRequestElements* elems = CSIPRequestElements::NewL(uri);
+ CleanupStack::Pop( uri); // ownership given to elems
+ CleanupStack::PushL( elems );
+ // To header not needed when remote uri set
+
+ uri = CUri8::NewLC( parser );
+ CSIPAddress* sipAddress = CSIPAddress::NewL( uri );
+ CleanupStack::Pop( uri ); // ownership given to sipAddress
+ CleanupStack::PushL( sipAddress );
+
+ // From header
+ CSIPFromHeader* fromH = CSIPFromHeader::NewL( sipAddress );
+ CleanupStack::Pop( sipAddress ); // ownership given to FromHeader
+ CleanupStack::PushL( fromH );
+ elems->SetFromHeaderL( fromH );
+ CleanupStack::Pop( fromH ); // fromH, ownership given to elems
+
+ // start to add other headers
+ RPointerArray<CSIPHeaderBase> headers;
+ CleanupClosePushL(headers);
+
+ // Expires header
+ CSIPExpiresHeader* exprH = new (ELeave) CSIPExpiresHeader(aExpiry);
+ CleanupStack::PushL( exprH );
+ User::LeaveIfError( headers.Append( exprH ));
+ CleanupStack::Pop( exprH ); // exprH
+
+ // Event header
+ CSIPEventHeader* eventH = CSIPEventHeader::NewLC( KSimplePRESENCE_LOW );
+ User::LeaveIfError( headers.Append( eventH ));
+ CleanupStack::Pop( eventH ); // eventH
+
+ // create SIP-ETAG header with CSIPExtensionHeader
+ if ( aSipIfMatch.Length() )
+ {
+ CSIPExtensionHeader* etagH = CSIPExtensionHeader::NewLC(
+ KSimpleSipIfMatch, aSipIfMatch );
+ User::LeaveIfError( headers.Append( etagH ));
+ CleanupStack::Pop( etagH ); // etagH
+ }
+
+ // ---------------------------------------------------------
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ */
+ CSimpleLocalModeUtils::AddTestHeaderL( headers );
+#endif
+#endif
+ // ---------------------------------------------------------
+
+ CSIPMessageElements& mesElems = elems->MessageElements();
+ mesElems.SetUserHeadersL( headers );
+ CleanupStack::PopAndDestroy( &headers );
+
+ // set Content type and content
+
+ CSIPContentTypeHeader* contTypeH = NULL;
+ if ( aContent.Length() ) //lint !e830
+ {
+ if ( multi )
+ {
+ // Set CID and Boundary parameters as well
+ // ***************************************
+ /*
+ HBufC8* contentTypeB = HBufC8::NewLC(
+ NSimpleDocument::NSimpleMulti::KContentTypeSize +
+ NSimpleDocument::KSimpleBoundarySize ); // << contentTypeB
+ TPtr8 typeAppend( contentTypeB->Des() );
+ TBuf8<10> temppi;
+ temppi.Copy( NSimpleDocument::KSimpleBoundary );
+ typeAppend.Format( NSimpleDocument::NSimpleMulti::KContentType, &temppi );
+ */
+
+ TBuf8<200> temppi;
+ temppi.Copy( NSimpleDocument::NSimpleMulti::KContentTypeFullValue );
+
+ contTypeH = CSIPContentTypeHeader::DecodeL( temppi );
+ // CleanupStack::PopAndDestroy( contentTypeB ); // >> contentTypeB
+ CleanupStack::PushL( contTypeH ); // << contTypeH
+ }
+ else
+ {
+ contTypeH = CSIPContentTypeHeader::NewLC(
+ KSimpleApplicationType, KSimplePidfSubType ); // // << contTypeH
+ }
+
+ // copy content from a request parameter
+ HBufC8* buffer = aContent.AllocLC();
+ mesElems.SetContentL( buffer, contTypeH ); // >> contTypeH
+ // buffer ownership given to mesElems
+ CleanupStack::Pop( buffer );
+ // contTypeH ownership given to mesElems
+ CleanupStack::Pop( contTypeH );
+ }
+ else
+ {
+ // No need to insert content, there wasn't any.
+ }
+
+ // set method
+ RStringF method = SIPStrings::Pool().OpenFStringL( KSimplePUBLISH );
+ CleanupClosePushL( method );
+ elems->SetMethodL( method );
+
+ // Send the request transaction
+ CSIPClientTransaction* sipTrans = iSipConnection->SendRequestL( elems, *regContext );
+ // PopAndDestroy calls method.Close()
+ CleanupStack::PopAndDestroy( &method );
+ CleanupStack::Pop( elems ); // elems, ownership given
+ return sipTrans;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::HandlePublishRespL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::HandlePublishRespL(
+ const CSIPMessageElements& aMesElems, CSimpleRequest* aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: HandlePublishRespL" ));
+#endif
+ TBool ETagReceived(EFalse);
+ RStringF extensionName = SIPStrings::Pool().OpenFStringL( KSimpleETag );
+ CleanupClosePushL( extensionName );
+ const RPointerArray<CSIPHeaderBase>& userHs = aMesElems.UserHeaders();
+ for ( TInt i = 0; i < userHs.Count(); i++ )
+ {
+ const CSIPHeaderBase* header = userHs[ i ];
+ if ( header->Name() == extensionName )
+ {
+ HBufC8* hValue = header->ToTextValueL();
+ // hValue ownership is transferred
+ aReq->SetETag( hValue );
+ // store etag to vimpstsettingstore
+ StoreETagL( *hValue );
+ ETagReceived = ETrue;
+ }
+ else if ( header->Name() == SIPStrings::StringF( SipStrConsts::EExpiresHeader))
+ {
+ // Save the new refresh time.
+ // Start the timer later in CSimplerequest::Complete()
+ CSIPExpiresHeader* eH = (CSIPExpiresHeader*)header;
+ TUint expires = eH->Value();
+ aReq->SetRefreshTime( expires );
+ }
+ else
+ {
+ // We igonre other than Expires and ETag headers
+ }
+ }
+ if ( !ETagReceived || !aReq->RefreshTime() )
+ {
+ // Remove old ETag if nore received or if the expires header was 0 in our request.
+ aReq->SetETag( NULL );
+ //TPtrC8 nullETag = nullETag.Alloc( KNullDesC8 );
+ TBufC8<1> nullETag( KNullDesC8 );
+ HBufC8* buf;
+ buf = nullETag.Alloc();
+ StoreETagL( *buf );
+ delete buf;
+ }
+ // PopAndDestroy calls extensionName.Close()
+ CleanupStack::PopAndDestroy( &extensionName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::HandleDialogRequestL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::HandleDialogRequestL(
+ const CSIPMessageElements& aMesElems, CSimpleRequest& aReq,
+ const TDesC8& aMethod )
+ {
+#ifdef _DEBUG
+ TBuf<20> myBuf;
+ myBuf.Copy( aMethod );
+ TSimpleLogger::Log(_L("SipConnection: HandleDialogRequestL %S" ), &myBuf);
+ CSIPRefresh* sipR = aReq.Refresh();
+ if ( sipR )
+ {
+ TSimpleLogger::Log(_L("SIPREFRESH STATE = %d" ), sipR->State() );
+ }
+#endif
+
+ _LIT8( KMyActive, "active");
+ _LIT8( KMyPending, "pending");
+
+ if ( aMethod.CompareF( KSimpleNOTIFY ))
+ {
+ // Only NOTIFY is handled.
+ return;
+ }
+
+ aReq.Request().SetResponseMethod( MSimpleEngineRequest::ENotify );
+ aReq.SetReason( KErrNone );
+
+ // Start to search subscription-state header
+ const RPointerArray<CSIPHeaderBase>& userHs = aMesElems.UserHeaders();
+ for ( TInt i = 0; i < userHs.Count(); i++ )
+ {
+ const CSIPHeaderBase* header = userHs[ i ];
+ if ( header->Name() == SIPStrings::StringF( SipStrConsts::ESubscriptionStateHeader))
+ {
+ CSIPSubscriptionStateHeader* stateH =
+ (CSIPSubscriptionStateHeader*)header;
+ TPtrC8 p = stateH->SubStateValue();
+#ifdef _DEBUG
+ myBuf.Copy( p);
+ TSimpleLogger::Log(_L("SipConnection: Subscription-State = %S" ), &myBuf);
+#endif
+ if ( !p.CompareF( KMyActive ))
+ {
+ // "active" Notification received
+ aReq.ResetErrCount();
+ aReq.Complete( KErrNone );
+ }
+ else if ( !p.CompareF( KMyPending ))
+ {
+ // "pending" Notification received
+ aReq.ResetErrCount();
+ aReq.Complete( KSimpleErrPending );
+ }
+ else // KMyTerminated
+ {
+ // "terminated"
+
+ aReq.PlusErrCount();
+
+ // Get the value of reason parameter if any exists.
+ RStringF value;
+ value = stateH->ParamValue( SIPStrings::StringF(
+ SipStrConsts::EReason ));
+ DoSetResponseReason( value.DesC(), aReq );
+
+ // Get retry-after parameter
+ TInt retryAfter = stateH->RetryAfterParameter();
+ if ( retryAfter < 0 )
+ {
+ retryAfter = 0;
+ }
+ aReq.SetRetryAfter( retryAfter );
+
+ // Retry in certain situations and do not send
+ // the final error to the client yet.
+
+ // Detect an error loop if server always returns "terminated"
+ // Certain errors are serious, and no reason to retry.
+ if ( aReq.ErrCount() > 1 ||
+ IsPermanentReason( aReq.Reason() ) ||
+ !(aReq.Request().IsRefresh()) ||
+ aReq.ReqState() != CSimpleRequest::ESimpleActiveSubs )
+ {
+ // Complete the client request.
+ // KErrCompletion has a special handling in a client observer.
+ // Set the reason code too.
+ DoSetResponseReason2( aReq.Reason(), aReq.Request() );
+ aReq.Complete( KErrCompletion );
+ }
+ else // ESimpleActiveSubs, no fatal error
+ {
+ // terminated[ refresh ]
+ // Retry later
+ // Notice that permanent reason is handled above
+ // also for ESimpleActiveSubs
+ //
+ DoSetResponseReason2( aReq.Reason(), aReq.Request() );
+ // CSimpleRequest::Complete handles this case even when re-tried
+ // without API callback..
+ aReq.Complete( KSimpleErrTemporary );
+ }
+ }
+ // No need to scan rest of the SIP headers
+ return;
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoSubscribeL
+// ----------------------------------------------------------
+//
+CSIPClientTransaction* CSimpleSipConnection::DoSubscribeL(
+ const TDesC8& aRemoteURI, TInt aExpiry,
+ const TDesC8& aContent,
+ CSIPSubscribeDialogAssoc*& aSubsDialog,
+ TBool aRefresh,
+ TSimpleSubsType aType,
+ TBool aAnonymous )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoSubscribeL expiry=%d" ), aExpiry);
+#endif
+
+ // array grow granularity
+ const TInt KMyGran = 10;
+
+ if ( !iSipConnection || iSipState != ESimpleSipActive )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoSubscribeL LEAVES **" ));
+#endif
+ User::Leave( KErrNotReady );
+ }
+
+ TUint myLimit = iSettings.MaxSubscriptions();
+ // Breakpoint:
+ if ( myLimit && iCurrentNbrSubs >= myLimit && aType != ESubsWinfo )
+ {
+ User::Leave( KSimpleErrSettingsLimit );
+ }
+
+ // get request (remote) uri from a request
+ TUriParser8 parser;
+ User::LeaveIfError( parser.Parse( aRemoteURI ));
+ CUri8* uri = CUri8::NewLC( parser );
+
+ // Event header
+ CSIPEventHeader* eventH = NULL;
+ if ( aType == ESubsRegular || aType == ESubsList )
+ {
+ eventH = CSIPEventHeader::NewLC( KSimplePRESENCE_LOW );
+ }
+ else // if ( aType == ESubsWinfo )
+ {
+ eventH = CSIPEventHeader::NewLC( KSimplePRESENCE_LOW );
+ CDesC8ArrayFlat* flat = new (ELeave) CDesC8ArrayFlat( KMyGran );
+ CleanupStack::PushL( flat );
+ flat->AppendL( KSimpleWINFO );
+ eventH->SetEventTemplatesL( *flat );
+ CleanupStack::PopAndDestroy( flat );
+ }
+
+ // From header
+ // Create is if anonymous request, otherwise use SIP Profile AOR
+ CSIPFromHeader* fromH = NULL;
+
+ if ( aAnonymous )
+ {
+ // Generate From header
+ fromH = CSIPFromHeader::DecodeL( KSimpleAnonymous );
+ }
+ CleanupStack::PushL( fromH );
+
+ // Subscribe Dialog
+ CSIPSubscribeDialogAssoc* sda = CSIPSubscribeDialogAssoc::NewL(
+ *iSipConnection, uri, *iProfileObserver->ProfileContext(),
+ eventH, fromH );
+
+ CleanupStack::Pop( fromH );
+ CleanupStack::Pop( eventH );
+ CleanupStack::Pop( uri );
+ CleanupStack::PushL( sda );
+
+ // start to add other headers
+ CSIPMessageElements* mesElems = CSIPMessageElements::NewLC();
+ RPointerArray<CSIPHeaderBase> headers;
+ CleanupClosePushL( headers );
+
+ // Expires header
+ CSIPExpiresHeader* exprH = new (ELeave) CSIPExpiresHeader(aExpiry);
+ CleanupStack::PushL( exprH );
+ User::LeaveIfError( headers.Append( exprH ));
+
+ // Accept header with application/pidf+xml is
+ // added for reqular subscription and list subscription
+ CSIPAcceptHeader* acceH = NULL;
+ if ( aType != ESubsWinfo )
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimplePidfSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+
+ // notice: allow multipart/related always!
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleMultiType, KSimpleMultipartSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ }
+
+ if ( aType == ESubsList )
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimpleListSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+
+ // add supported header with value eventlist
+ RPointerArray<CSIPSupportedHeader> suppHs =
+ CSIPSupportedHeader::DecodeL( KSimpleEventlist);
+ for( TInt count=0; count < suppHs.Count(); count++ )
+ {
+ User::LeaveIfError( headers.Append( suppHs[count] ));
+ }
+ suppHs.Close();
+ }
+
+ if ( aType == ESubsWinfo )
+ {
+ acceH = CSIPAcceptHeader::NewLC(
+ KSimpleApplicationType, KSimpleWinfoSubType );
+ User::LeaveIfError( headers.Append( acceH ));
+ }
+
+ // For anonymous request add Privacy and P-Preferred-Identity headers
+ CSIPExtensionHeader* privacyH = NULL;
+ CSIPExtensionHeader* pPIH = NULL;
+ HBufC8* myBuffer = NULL;
+ if ( aAnonymous )
+ {
+ privacyH = CSIPExtensionHeader::NewLC(
+ KSimplePrivacy, KSimpleId );
+ User::LeaveIfError( headers.Append( privacyH ));
+ TInt aorLength = iProfileObserver->GiveUserAorL().Length();
+ myBuffer = HBufC8::NewLC( aorLength + 2 ); // room for brackets
+ *myBuffer = _L8("<");
+ myBuffer->Des().Append( iProfileObserver->GiveUserAorL() );
+ myBuffer->Des().Append( _L8(">"));
+ pPIH = CSIPExtensionHeader::NewLC(
+ KSimplePIdentity, myBuffer->Des() );
+ User::LeaveIfError( headers.Append( pPIH ));
+ }
+
+ // ---------------------------------------------------------
+
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ */
+ CSimpleLocalModeUtils::AddTestHeaderL(headers);
+#endif
+#endif
+ // ---------------------------------------------------------
+
+ // add content and create refresh entity
+ mesElems->SetUserHeadersL( headers );
+ // ownership of elements is given to mesElems
+ if ( aAnonymous )
+ {
+ CleanupStack::Pop( pPIH );
+ CleanupStack::PopAndDestroy( myBuffer );
+ CleanupStack::Pop( privacyH );
+ }
+ if ( aType == ESubsList )
+ {
+ CleanupStack::Pop( 3 ); // 3 * acceH
+ }
+ else if ( aType == ESubsRegular )
+ {
+ CleanupStack::Pop( 2 ); // 2 * acceH
+ }
+ else // ESubsWinfo
+ {
+ CleanupStack::Pop( 1 ); // 1 * acceH
+ }
+ CleanupStack::Pop( exprH );
+ CleanupStack::PopAndDestroy( &headers );
+
+ // set Content type and content
+ if ( aContent.Length() )
+ {
+ CSIPContentTypeHeader* contTypeH = CSIPContentTypeHeader::NewLC(
+ KSimpleApplicationType, KSimpleSubscribeSubType );
+ // copy content from a request parameter
+ HBufC8* buffer = aContent.AllocLC();
+ mesElems->SetContentL( buffer, contTypeH );
+ // buffer ownership given to mesElems
+ CleanupStack::Pop( buffer );
+ // contTypeH ownership given to mesElems
+ CleanupStack::Pop( contTypeH );
+ }
+
+ CSIPRefresh* refresh = NULL;
+ if ( aExpiry && aRefresh )
+ {
+ refresh = CSIPRefresh::NewLC();
+ }
+ // Refresh gets its value from expires header.
+ CSIPClientTransaction* sipTrans = sda->SendSubscribeL( mesElems, refresh );
+ if ( refresh )
+ {
+ CleanupStack::Pop( refresh );
+ }
+ CleanupStack::Pop( mesElems );
+ // CSIPSubscribeDialogAssoc must not be deleted until it is ubsubscribed
+ CleanupStack::Pop( sda );
+ aSubsDialog = sda;
+
+ return sipTrans;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::RegisterDefaultL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::RegisterDefaultL( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: RegisterDefaultL" ));
+#endif
+ iProfileObserver->RegisterDefaultProfileL();
+ SetSipState( ESimpleSipIdle );
+ TRAPD( err, iSipConnection = iProfileObserver->GiveConnectionL() );
+ if ( !err )
+ {
+ SetSipState( ESimpleSipActive );
+ aReq.Complete( KErrNone );
+ }
+ else if ( err != KErrNotReady )
+ {
+ // KErrNotReady is a normal error indicating
+ // pending initialization
+ User::Leave( err );
+ }
+ else
+ {
+ // KErrNotReady situation
+ }
+ // Save the request to wait a response
+ CSimpleRequest* simpleR = CSimpleRequest::NewL(
+ *this, aReq, CSimpleRequest::EReqRegister, aReq.RefreshTime() );
+ iRequestList.AddLast( *simpleR );
+ // Start timer to detect infinite wait situation
+ simpleR->StartExpiryTimer( iSettings.ExpiryApi() );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::RegisterAnyL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::RegisterAnyL( MSimpleEngineRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: RegisterAnyL" ));
+#endif
+
+ iSettings.ReadOTASettingsL( aReq.Aux() );
+
+ TInt32 uniqueId = iSettings.SipProfileId();
+ TUid uniqueUid;
+ uniqueUid.iUid = uniqueId;
+
+ if ( !iSip && !iProfileObserver )
+ {
+ iSip = CSIP::NewL( uniqueUid, *this );
+
+ iProfileObserver = CSimpleSipProfileObserver::NewL(
+ iSip, *iConnectionObserver);
+ }
+
+ iProfileObserver->RegisterGivenProfileL( iSettings.SipProfileId() );
+ SetSipState( ESimpleSipIdle );
+ TRAPD( err, iSipConnection = iProfileObserver->GiveConnectionL() );
+ if ( !err )
+ {
+ SetSipState( ESimpleSipActive );
+ aReq.Complete( KErrNone );
+ }
+ else if ( err != KErrNotReady )
+ {
+ // KErrNotReady is a normal error indicating
+ // pending initialization
+ User::Leave( err );
+ }
+ else
+ {
+ // KErrNotReady situation
+ }
+ // Save the request to wait a response
+ CSimpleRequest* simpleR = CSimpleRequest::NewL(
+ *this, aReq, CSimpleRequest::EReqRegister, aReq.RefreshTime() );
+ iRequestList.AddLast( *simpleR );
+ // Start timer to detect infinite wait situation
+ simpleR->StartExpiryTimer( iSettings.ExpiryApi() );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::SetSipState
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::SetSipState( TSimpleSipState aState )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: SetSipState %d this=%d" ), aState, (TInt)this );
+#endif
+ iSipState = aState;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoSetResponseReason
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoSetResponseReason(
+ const TDesC8& aReason, CSimpleRequest& aR )
+ {
+ if ( aReason.Length() == 0 )
+ {
+ aR.SetReason( KErrNone );
+ }
+ else if ( !aReason.CompareF( KSimpleRejected ))
+ {
+ aR.SetReason( KSimpleErrRejected );
+ }
+ else if ( !aReason.CompareF( KSimpleTimeout ))
+ {
+ aR.SetReason( KSimpleErrTimeout );
+ }
+ else if ( !aReason.CompareF( KSimpleDeactivated ))
+ {
+ aR.SetReason( KSimpleErrDeactivated );
+ }
+ else if ( !aReason.CompareF( KSimpleProbation ))
+ {
+ aR.SetReason( KSimpleErrProbation );
+ }
+ else if ( !aReason.CompareF( KSimpleNoresource ))
+ {
+ aR.SetReason( KSimpleErrNoresource );
+ }
+ else if ( !aReason.CompareF( KSimpleGiveup ))
+ {
+ aR.SetReason( KSimpleErrGiveup);
+ }
+ else
+ {
+ aR.SetReason( KErrNone );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoSetResponseReason2
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoSetResponseReason2(
+ TInt aReason, MSimpleEngineRequest& aR )
+ {
+ switch ( aReason )
+ {
+ case KSimpleErrRejected:
+ aR.SetResponseReason( MSimpleEngineRequest::ERejected );
+ break;
+ case KSimpleErrTimeout:
+ aR.SetResponseReason( MSimpleEngineRequest::ETimeout );
+ break;
+ case KSimpleErrDeactivated:
+ aR.SetResponseReason( MSimpleEngineRequest::EDeactivated );
+ break;
+ case KSimpleErrProbation:
+ aR.SetResponseReason( MSimpleEngineRequest::EProbation );
+ break;
+ case KSimpleErrNoresource:
+ aR.SetResponseReason( MSimpleEngineRequest::ENoresource );
+ break;
+ case KSimpleErrGiveup:
+ aR.SetResponseReason( MSimpleEngineRequest::EGiveup );
+ break;
+ default:
+ aR.SetResponseReason( MSimpleEngineRequest::ENoReason );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::IsPermanentReason
+// ----------------------------------------------------------
+//
+TBool CSimpleSipConnection::IsPermanentReason( TInt aReason )
+ {
+ switch ( aReason )
+ {
+ case KSimpleErrPending:
+ case KSimpleErrDeactivated:
+ case KSimpleErrProbation:
+ case KSimpleErrTimeout:
+ case KSimpleErrGiveup:
+ case KSimpleErrTemporary:
+ return EFalse;
+ default:
+ return ETrue;
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::IncreaseNbrSubs
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::IncreaseNbrSubs()
+ {
+ ++iCurrentNbrSubs;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: ++iCurrentNbrSubs %d" ),
+ iCurrentNbrSubs );
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DecreaseNbrSubs
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DecreaseNbrSubs()
+ {
+ if ( iCurrentNbrSubs )
+ {
+ --iCurrentNbrSubs;
+ }
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: --iCurrentNbrSubs %d" ),
+ iCurrentNbrSubs );
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoRefreshPublishL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoRefreshPublishL( CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoRefreshPublishL"));
+#endif
+
+ CSimpleRequest::TSimpleReqState orig = aReq.ReqState();
+
+ // First, handle
+ // expires [ no refresh ]
+ if ( !aReq.Request().IsRefresh() && orig==CSimpleRequest::ESimpleActive )
+ {
+ aReq.SetStatus( 0 );
+ aReq.Complete( KErrTimedOut );
+ return;
+ }
+ if ( orig == CSimpleRequest::ESimpleRunningInit )
+ {
+ // This might happen with short expiry time when there is no response
+ // from a network.
+ aReq.SetStatus( 0 );
+ aReq.Complete( KErrTimedOut );
+ return;
+ }
+ else if ( orig == CSimpleRequest::ESimplePending )
+ {
+ // If refresh is already once set to pending,then this publication is terminated (expired)
+ if ( aReq.PendingState() == CSimpleRequest::EPendingRefresh ||
+ aReq.PendingState() == CSimpleRequest::EPendingModifyAndRefresh )
+ {
+ // special error code that terminates the whole publication.
+ aReq.Complete( KErrCompletion );
+ return;
+ }
+
+ }
+ else if ( orig != CSimpleRequest::ESimpleActive )
+ {
+ // special error code that terminates the whole publication.
+ aReq.Complete( KErrCompletion );
+ return;
+ }
+
+ if ( iSipState == ESimpleSipActive )
+ {
+ // set request state
+ aReq.SetReqState( CSimpleRequest::ESimpleRunning );
+ TInt errx = DoSendPendingPublish( aReq );
+ if ( errx )
+ {
+ // Error changes the state and calls API callback when needed
+ aReq.Complete( errx );
+ }
+ else
+ {
+ // start refresh timer to detect expiry of publication
+ aReq.StartRefreshTimer( aReq.RetryExpiryTime() );
+ // Do not start expiry timer
+ }
+ }
+ else if ( iSipState == ESimpleSipSuspend )
+ {
+ // no network available
+ // refresh [ no network ]
+ // start refresh timer to detect expiry of publication
+ aReq.StartRefreshTimer( aReq.RetryExpiryTime() );
+ // Do not start expiry timer
+ aReq.SetReqState( CSimpleRequest::ESimplePending );
+ aReq.AddPendingState( CSimpleRequest::EPendingRefresh );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // DO NOT update SOURCE-THROTTLE-PUBLISH time
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoRefreshSubscribe
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoRefreshSubscribe( CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoRefreshSubscribe"));
+#endif
+
+ if ( !aReq.Request().IsRefresh() )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: Refresh EXPIRED **"));
+#endif
+ // This is expired and no need to refresh
+ aReq.Complete( KErrTimedOut );
+ }
+
+ aReq.StartExpiryTimer( aReq.RetryExpiryTime() );
+
+ if ( iSipState != ESimpleSipActive )
+ {
+ if ( aReq.ReqState() == CSimpleRequest::ESimpleReTry )
+ {
+ // time to retry [ no network ]
+ aReq.SetReqState( CSimpleRequest::ESimplePending );
+ // expiry timer i already runnig
+ }
+ }
+ else
+ {
+ if ( aReq.ReqState() == CSimpleRequest::ESimplePending ||
+ aReq.ReqState() == CSimpleRequest::ESimpleReTry )
+ {
+ // time to retry / SIP req
+ // recreate a dialog
+ aReq.SetReqState( CSimpleRequest::ESimpleDialogReCre );
+ TRAPD( errx, DoCreateDialogL( aReq ) );
+ if ( errx )
+ {
+ // error
+ // This will call API callback
+ // Original error has been SIP error
+ aReq.SetReqState( CSimpleRequest::ESimpleFailed );
+ aReq.Complete( KSimpleErrTemporary );
+ }
+ else
+ {
+ // waiting OK resp
+ }
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoCreateDialogL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoCreateDialogL( CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoCreateDialogL"));
+#endif
+
+ CSIPSubscribeDialogAssoc* subsDialog = NULL;
+ CSIPClientTransaction* sipTrans = NULL;
+
+ // Check whether regular subscription or WINFO subscription is needed.
+ MSimpleEngineRequest::TSimpleRequest reqType= aReq.Request().RequestType();
+ TSimpleSubsType subsType = ESubsRegular;
+ if ( reqType == MSimpleEngineRequest::ESubscribeLista )
+ {
+ subsType = ESubsList;
+ }
+ else if ( reqType == MSimpleEngineRequest::ESubscribeWinfo )
+ {
+ subsType = ESubsWinfo;
+ }
+
+ // send SIP request
+ sipTrans = DoSubscribeL(
+ aReq.Request().RemoteURI(),
+ aReq.Request().RefreshTime(),
+ aReq.Data(),
+ subsDialog,
+ aReq.Request().IsRefresh(),
+ subsType,
+ aReq.Request().Aux() ? ETrue : EFalse );
+
+ // save SIP Dialog and SIP client transaction
+ aReq.SetDialog( subsDialog );
+ aReq.SetTransaction( sipTrans );
+
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoSendPendingPublish
+// ----------------------------------------------------------
+//
+TInt CSimpleSipConnection::DoSendPendingPublish(
+ CSimpleRequest& aReq )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnection: DoSendPendingPublish" ));
+#endif
+
+ // Do the SIP Publish transaction
+ TBool sendData = aReq.PendingState() == CSimpleRequest::EPendingModify ||
+ aReq.PendingState() == CSimpleRequest::EPendingModifyAndRefresh ?
+ ETrue : EFalse;
+ TPtrC8 myData = sendData ? aReq.Data() : TPtrC8();
+ CSIPClientTransaction* sipTrans = NULL;
+ TRAPD( errx, sipTrans = DoPublishL(
+ iProfileObserver->GiveUserAorL(),
+ aReq.Request().RefreshTime(),
+ myData,
+ aReq.ETag(), aReq.RequestContentType() ));
+ if ( errx )
+ {
+ return errx;
+ }
+ // Save SIP client transaction
+ aReq.SetTransaction( sipTrans );
+
+ aReq.SetPendingState( CSimpleRequest::ENoPending );
+
+ // Do not update SOURCE-THROTTLE-PUBLISH time
+
+ // Expiry timer is already running
+
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::HandlePendings
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::HandlePendings( )
+ {
+ TInt errx( KErrNone );
+ TDblQueIter<CSimpleRequest> rIter( iRequestList );
+ rIter.SetToFirst();
+
+ while ( rIter )
+ {
+ CSimpleRequest* req = rIter;
+ rIter++; //lint !e1757
+
+ if ( req->Match( CSimpleRequest::EReqSubscribe ) ||
+ req->Match( CSimpleRequest::EReqSubscribeList ) ||
+ req->Match( CSimpleRequest::EReqSubscribeWinfo ))
+ {
+ // Subscritions
+ // Set new request state
+ if ( req->ReqState() == CSimpleRequest::ESimplePendingInit )
+ {
+ req->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ }
+ else if ( req->ReqState() == CSimpleRequest::ESimplePending )
+ {
+ req->SetReqState( CSimpleRequest::ESimpleDialogReCre );
+ }
+ else
+ {
+ // other states do not need network recovery
+ break;
+ }
+
+ // create new dialog
+ TRAP( errx, DoCreateDialogL( *req ) );
+ if ( errx )
+ {
+ // error
+ // This will call API callback
+ req->SetReqState( CSimpleRequest::ESimpleFailed );
+ req->Complete( errx );
+ }
+ else
+ {
+ // Start to wait response from SIP stack.
+ // Expiry timer is already runnig to detect infinite wait situation
+ }
+ }
+ else if ( req->Match( CSimpleRequest::EReqPublish ) )
+ {
+ // Publications
+ if ( req->ReqState() == CSimpleRequest::ESimplePendingInit )
+ {
+ req->SetReqState( CSimpleRequest::ESimpleRunningInit );
+ }
+ else if ( req->ReqState() == CSimpleRequest::ESimplePending )
+ {
+ req->SetReqState( CSimpleRequest::ESimpleRunning );
+ }
+ else
+ {
+ // other states do not need network recovery
+ break;
+ }
+ // retry publication
+ if ( DoSendPendingPublish( *req ) )
+ {
+ // error
+ // This will call API callback
+ req->SetReqState( CSimpleRequest::ESimpleFailed );
+ req->Complete( errx );
+ }
+ else
+ {
+ // Start to wait response from SIP stack.
+ // Expiry timer is already runnig to detect infinite wait situation
+ }
+ }
+ } // while
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::RecognizeSipState
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::RecognizeSipState(
+ TSimpleSipState aState )
+ {
+ if ( aState == ESimpleSipActive )
+ {
+ // Check that both SIP Profile and SIP connection are ready.
+ // iProfileObserver is created in ConstructL.
+ if ( iProfileObserver->IsProfileActive() &&
+ iSipConnection &&
+ iSipConnection->State() == CSIPConnection::EActive )
+ {
+ SetSipState( aState );
+ }
+ }
+ else
+ {
+ SetSipState( aState );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnection::DoHandleReceivedMessageL
+// ----------------------------------------------------------
+//
+void CSimpleSipConnection::DoHandleReceivedMessageL( const TDesC8& aFrom,
+ const TDesC8& aContent, CSimpleRequest& aRequest )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L(
+ "CSimpleSipConnection::DoHandleReceivedMessageL - Start" ) );
+#endif
+ aRequest.SetReason( KErrNone );
+ aRequest.SetRecipientL( aFrom );
+ aRequest.SetDataL( aContent );
+ aRequest.Complete( KErrNone );
+ // Open request can be deleted after completion.
+ aRequest.Destroy();
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L(
+ "CSimpleSipConnection::DoHandleReceivedMessageL - End" ) );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::SetServiceId
+// -----------------------------------------------------------------------------
+EXPORT_C void CSimpleSipConnection::SetServiceId( TInt32 aServiceId )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log( _L(
+ "CSimpleSipConnection::SetServiceId old serviceId = %d, new serviceId = %d" ),
+ iServiceId, aServiceId );
+#endif
+ iServiceId = aServiceId;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleRequest::StoreETag
+// -----------------------------------------------------------------------------
+void CSimpleSipConnection::StoreETagL( HBufC8& aETag )
+ {
+#ifdef _DEBUG
+ TBuf<255> printDocumentId;
+ printDocumentId.Copy( aETag );
+ TSimpleLogger::Log(_L("CSimpleSipConnection: StoreETag ETag = %S, serviceId = %d" ),
+ &printDocumentId, iServiceId );
+#endif
+ MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+ // Store ETag to uiservicetabsettings
+ User::LeaveIfError( settings->SetL(
+ iServiceId, EServicePresenceSessionIdentifier, aETag ) );
+
+ CleanupStack::PopAndDestroy(); //settings
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplesipconnectionobserver.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,909 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: sip connection
+*
+*/
+
+
+
+
+
+#include <sipconnectionobserver.h>
+#include <sipmessageelements.h>
+#include <sipresponseelements.h>
+#include <sipregistrationbinding.h>
+#include <sipconnection.h>
+#include <siprefresh.h>
+#include <sipdialog.h>
+#include <sipdialogassocbase.h>
+#include <sipsubscribedialogassoc.h>
+#include <sipstrings.h>
+#include <sipstrconsts.h>
+#include <sipclienttransaction.h>
+#include <sipservertransaction.h>
+#include <siprequestelements.h>
+
+#include <sipretryafterheader.h>
+#include <sipextensionheader.h>
+#include <sipcontenttypeheader.h>
+
+#include <siperr.h>
+#include <sipaddress.h>
+#include <sipfromheader.h>
+
+#include "simplecommon.h"
+#include "simplesipconnectionobserver.h"
+#include "simplesipconncallback.h"
+#include "simplerequest.h"
+#include "simpleerrors.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+// SIP response Call/Transaction does not exists
+const TUint KSimple481 = 481;
+
+_LIT8 ( KSimpleBoundary, "boundary" );
+_LIT8 ( KSimpleStart, "start");
+_LIT8 ( KAt, "@" );
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#ifdef __LOCAL_MODE
+// INTERNAL TEST SUITE
+#include "simplelocalmodeutils.h"
+#endif
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::CSimpleSipConnectionObserver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSimpleSipConnectionObserver::CSimpleSipConnectionObserver(
+ MSimpleSipConnCallback& aCallback )
+ : iCallback( aCallback )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::~CSimpleSipConnectionObserver
+// -----------------------------------------------------------------------------
+//
+CSimpleSipConnectionObserver::~CSimpleSipConnectionObserver()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: DESTRUCTOR this=%d"), (TInt)this);
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ */
+ delete iLocalModeUtils;
+#endif
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::NewL
+// -----------------------------------------------------------------------------
+//
+CSimpleSipConnectionObserver* CSimpleSipConnectionObserver::NewL(
+ MSimpleSipConnCallback& aCallback )
+ {
+ CSimpleSipConnectionObserver* self = new (ELeave) CSimpleSipConnectionObserver( aCallback );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: NewL this=%d"), (TInt)self);
+#endif
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ConstructL()
+ {
+#ifdef _DEBUG
+#ifdef __LOCAL_MODE
+ /**
+ * INTERNAL TEST SUITE
+ */
+ iLocalModeUtils = CSimpleLocalModeUtils::NewL( );
+ iLocalModeUtils->SubscribeNetworkStateL( this );
+#endif
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ConnectionStateChanged
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ConnectionStateChanged(
+ CSIPConnection::TState aState )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ConnectionStateChanged state=%d sip=%d"), aState );
+#endif
+ ConnectionStateChanged2( aState, KErrNone );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ProfileStateChanged
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ProfileStateChanged(
+ CSIPConnection::TState aState, TInt aSipError )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ProfileStateChanged state=%d sip=%d"), aState );
+#endif
+ ConnectionStateChanged2( aState, aSipError );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ProfileUpdated
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ProfileUpdated()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ProfileUpdated"));
+#endif
+ iCallback.ConnectionChanged();
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ConnectionStateChanged2
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ConnectionStateChanged2(
+ CSIPConnection::TState aState, TInt aSipError )
+ {
+ TInt retErr = aSipError ? ConvertSipCode( aSipError, EFalse, EFalse ) : KErrNone;
+ switch ( aState )
+ {
+ // Here is a logic, how to tell active state upward after waiting both
+ // connection and profile to be ok.
+ case CSIPConnection::EInit:
+ iCallback.ConnectionStateChange( ESimpleSipIdle, retErr );
+ break;
+ case CSIPConnection::EActive:
+ iCallback.ConnectionStateChange( ESimpleSipActive, retErr );
+ break;
+ case CSIPConnection::ESuspended:
+ iCallback.ConnectionStateChange( ESimpleSipSuspend, retErr);
+ break;
+ case CSIPConnection::EInactive:
+ iCallback.ConnectionStateChange( ESimpleSipInactive, retErr );
+ break;
+ case CSIPConnection::EUnavailable:
+ iCallback.ConnectionStateChange( ESimpleSipUnavailable, retErr );
+ break;
+ default:
+ break;
+ };
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::IncomingResponse
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingResponse (
+ CSIPClientTransaction& /*aTransaction*/,
+ CSIPRegistrationBinding& /*aRegistration*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingResponse" ));
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt aError,
+ CSIPClientTransaction& /*aTransaction*/,
+ CSIPRegistrationBinding& /*aRegistration*/)
+ {
+ iError = aError;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 1 err=%d"), aError );
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt aError,
+ CSIPRegistrationBinding& /*aRegistration*/)
+ {
+ iError = aError;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 2 err=%d" ), aError);
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// This is mainly for Publish errors, no dialog.
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt aError,
+ CSIPTransactionBase& aTransaction )
+ {
+ iError = aError;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 3 err=%d" ), aError);
+#endif
+ if ( aTransaction.IsSIPClientTransaction() )
+ {
+ CSIPTransactionBase::TState sipState = CSIPTransactionBase::ETrying;
+ TRAP_IGNORE( sipState = aTransaction.StateL() );
+ CSimpleRequest* r = iCallback.GetRequest(
+ STATIC_CAST( CSIPClientTransaction&, aTransaction) );
+ if ( r && sipState == CSIPTransactionBase::ETerminated )
+ {
+ TInt retCode = aError == KErrSIPForbidden ? KErrAccessDenied : KErrCommsBreak;
+ r->SetStatus( 0 );
+ // update response method
+ r->Request().SetResponseMethod( MSimpleEngineRequest::EUnknownResponse );
+ r->Complete( retCode );
+ }
+ else
+ {
+ // nothing to do
+ }
+ }
+ else
+ {
+ // nothing to do
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// Dialog refresh has failed, a transaction has been deleted.
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt aError,
+ CSIPDialogAssocBase& aDialogAssoc )
+ {
+ // This is called when SUBSCRIBE refresh fails with
+ // an error response from a remote server.
+ iError = aError;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 4 err=%d" ), aError );
+#endif
+
+ TInt retCode = aError == KErrSIPForbidden ? KErrAccessDenied : KErrCommsBreak;
+ TUint status(0);
+ TUint myRefresh(0);
+
+ CSIPSubscribeDialogAssoc& myDialogA = STATIC_CAST( CSIPSubscribeDialogAssoc&, aDialogAssoc );
+ const CSIPDialog& myDialog = myDialogA.Dialog();
+ CSimpleRequest* r = iCallback.GetdDialogRequest( myDialog );
+ if ( !r )
+ {
+ // request not found
+ return;
+ }
+
+ if ( aError == KErrSIPTerminatedWithResponse )
+ {
+ // It's subscription's response with data
+ const CSIPRefresh* refresh = myDialogA.SIPRefresh();
+ if ( refresh )
+ {
+ // This instance is not the initial transaction but
+ // the refresh transaction instance.
+ // Ownership is not transferred. May be NULL.
+ const CSIPClientTransaction* trans = refresh->SIPTransaction();
+ if ( trans )
+ {
+ // ownership isn't transferred.
+ // Elems must exist with KErrSIPTerminatedWithResponse
+ const CSIPResponseElements* elems = trans->ResponseElements();
+ // Get retry-after header value
+ myRefresh = GetRetryAfter( elems );
+ // Get SIP Status
+ status = elems->StatusCode();
+ if ( status >= KSimpleOK )
+ {
+ retCode = ConvertSipCode( status, myRefresh ? ETrue: EFalse, EFalse );
+ }
+ }
+ }
+ }
+
+ // Update the request entity and complete it.
+ r->SetRetryAfter( myRefresh );
+ r->SetStatus( status );
+ r->Request().SetResponseMethod( MSimpleEngineRequest::EUnknownResponse );
+ r->Complete( retCode );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// Sending of either request or response failed, dialog specific.
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt aError,
+ CSIPTransactionBase& aTransaction,
+ CSIPDialogAssocBase& /*aDialogAssoc*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 5 err=%d" ), aError);
+#endif
+
+ TInt retCode = aError == KErrSIPForbidden ? KErrAccessDenied : KErrCommsBreak;
+ TUint status = 0;
+
+ if ( aTransaction.IsSIPClientTransaction() )
+ {
+ // This is an initial SUBSCRIBE transaction that has failed.
+ CSimpleRequest* r2 = iCallback.GetRequest(
+ STATIC_CAST( CSIPClientTransaction&, aTransaction ));
+ if ( !r2 )
+ {
+ // request not found
+ return;
+ }
+ // This instance is the initial transaction.
+ CSIPClientTransaction& trans = STATIC_CAST( CSIPClientTransaction&, aTransaction );
+ // ownership isn't transferred.
+ const CSIPResponseElements* elems = trans.ResponseElements();
+ if ( elems )
+ {
+ status = elems->StatusCode();
+ }
+ // convert SIP status code
+ if ( status >= KSimpleOK )
+ {
+ retCode = ConvertSipCode( status, EFalse, EFalse );
+ }
+ r2->SetStatus( status );
+ // update response method
+ r2->Request().SetResponseMethod( MSimpleEngineRequest::EUnknownResponse );
+ r2->Complete( retCode );
+ }
+ else
+ {
+ // Server transactions are not handled.
+ // An error in responding to NOTIFY request comes here.
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::ErrorOccured
+// This is not really needed because of engine does not use standalone CSIPRefesh
+// requests.
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::ErrorOccured (
+ TInt /*aError*/,
+ CSIPRefresh& /*aRefresh*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: ErrorOccured 6" ));
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// A SIP request outside a dialog has been received from the network.
+// CSimpleSipConnectionObserver::IncomingRequest
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingRequest(
+ CSIPServerTransaction* aTransaction )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(
+ _L("CSimpleSipConnectionObserver::IncomingRequest" ) );
+#endif
+
+ TRAP_IGNORE( DoIncomingRequestL( aTransaction ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::IncomingRequest
+// Dialog specific request from server..
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingRequest (
+ CSIPServerTransaction* aTransaction,
+ CSIPDialog& aDialog )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingRequest (dialog)" ));
+#endif
+
+ TRAP_IGNORE( DoIncomingRequestL( aTransaction, aDialog ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::IncomingResponse
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingResponse(
+ CSIPClientTransaction& aTransaction)
+ {
+#ifdef _DEBUG
+ TInt status = aTransaction.ResponseElements()->StatusCode();
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingResponse status=%d" ), status);
+#endif
+
+ DoIncomingResponse( aTransaction );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::IncomingResponse
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPDialogAssocBase& aDialogAssoc)
+ {
+#ifdef _DEBUG
+ TInt status( KErrNone );
+ status = aTransaction.ResponseElements()->StatusCode();
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingResponse (dialog) status=%d"), status);
+#endif
+
+ DoIncomingResponse( aTransaction, aDialogAssoc );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::IncomingResponse
+// Invite not supported by SIMPLE
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::IncomingResponse (
+ CSIPClientTransaction& /*aTransaction*/,
+ CSIPInviteDialogAssoc* /*aDialogAssoc*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingResponse (invite)" ));
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::InviteCompleted
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::InviteCompleted (
+ CSIPClientTransaction& /*aTransaction*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: InviteCompleted" ));
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::InviteCanceled
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::InviteCanceled (
+ CSIPServerTransaction& /*aTransaction*/)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: InviteCanceled" ));
+#endif
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::DoHandleSrvrReqContentL
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::DoHandleSrvrReqContentL(
+ const CSIPMessageElements& aElems,
+ MSimpleEngineRequest& aR )
+ {
+ RStringF boundary = SIPStrings::Pool().OpenFStringL( KSimpleBoundary );
+ CleanupClosePushL( boundary );
+ RStringF start = SIPStrings::Pool().OpenFStringL( KSimpleStart );
+ CleanupClosePushL( start );
+ RStringF value;
+
+ // ownership of typeHeader is not transferred and it may be NULL.
+ const CSIPContentTypeHeader* typeHeader = aElems.ContentType();
+ if ( typeHeader )
+ {
+ // buffer ownership is transferred
+ HBufC8* buffer = typeHeader->ToTextValueL();
+ aR.SetResponseContentType( buffer );
+ aR.SetResponseDataL( aElems.Content() );
+ // set boundary
+ if ( typeHeader->HasParam( boundary ) )
+ {
+ value = typeHeader->ParamValue( boundary );
+ aR.SetResponseBoundaryL( value.DesC() );
+ }
+ // set start-content-id
+ if ( typeHeader->HasParam( start ) )
+ {
+ value = typeHeader->ParamValue( start );
+ aR.SetResponseStartL( value.DesC() );
+ }
+#ifdef _DEBUG
+ RFs myFs;
+ (void)myFs.Connect();
+ TSimpleLogger::Dump( aR.ResponseData(), myFs, 1 );
+ myFs.Close();
+#endif
+ }
+ CleanupStack::PopAndDestroy( &start );
+ CleanupStack::PopAndDestroy( &boundary );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::DoIncomingRequestL
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::DoIncomingRequestL(
+ CSIPServerTransaction* aTransaction )
+ {
+ const CSIPRequestElements* elems = aTransaction->RequestElements();
+ const CSIPContentTypeHeader* contentType = elems->MessageElements().
+ ContentType();
+
+ if( KSimpleMediaType() == contentType->MediaType() &&
+ KSimpleMediaSubType() == contentType->MediaSubtype() )
+ {
+ const CSIPFromHeader* fromHeader = elems->FromHeader();
+ const TDesC8& content = elems->MessageElements().Content();
+ const TDesC8& user = fromHeader->SIPAddress().Uri8().Uri().
+ Extract( EUriUserinfo );
+ const TDesC8& host = fromHeader->SIPAddress().Uri8().Uri().
+ Extract( EUriHost );
+
+ CleanupStack::PushL( aTransaction ); // CS: 1
+
+ HBufC8* from = HBufC8::NewLC( user.Length() + KAt().Length() +
+ host.Length() ); // CS: 1
+ from->Des().Copy( user );
+ from->Des().Append( KAt() );
+ from->Des().Append( host );
+
+ CSIPResponseElements* respElem = CSIPResponseElements::NewLC( // CS: 3
+ KSimpleOK, SIPStrings::StringF( SipStrConsts::EPhraseOk ) );
+
+ // Use the transaction to send 200 OK
+ aTransaction->SendResponseL( respElem );
+
+ CleanupStack::Pop( respElem ); // CS: 2
+
+ iCallback.HandleReceivedMessage( *from, content );
+ CleanupStack::PopAndDestroy( from ); // CS: 1
+ CleanupStack::Pop( aTransaction ); // CS: 0
+ }
+
+ // We no longer need aTransaction. Just delete it.
+ delete aTransaction;
+ aTransaction = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::DoIncomingRequestL
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::DoIncomingRequestL (
+ CSIPServerTransaction* aTransaction,
+ CSIPDialog& aDialog )
+ {
+ // Ownership of aTransaction is transferred.
+ CleanupStack::PushL( aTransaction );
+
+ const CSIPRequestElements* reqE = aTransaction->RequestElements();
+ TPtrC8 method = reqE->Method().DesC();
+
+ // search the right request
+ CSimpleRequest* req = iCallback.GetdDialogRequest( aDialog );
+ if ( ! req )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: IncomingRequest ERROR **" ));
+#endif
+
+ // This is unknown response, send response 481 in order to unsubscribe the dialog.
+ // See RFC3265
+ CSIPResponseElements* resE = CSIPResponseElements::NewLC( KSimple481,
+ SIPStrings::StringF( SipStrConsts::EPhraseCallTransactionDoesNotExist ) );
+ aTransaction->SendResponseL( resE );
+ // resE ownership is transferred
+ CleanupStack::Pop( resE );
+ CleanupStack::PopAndDestroy( aTransaction );
+ return;
+ }
+
+ // send a response to PA in NOTIFY
+ if ( aTransaction->ResponseAllowed() )
+ {
+ if ( !method.CompareF( KSimpleNOTIFY ))
+ {
+ CSIPResponseElements* resE = CSIPResponseElements::NewLC( KSimpleOK,
+ SIPStrings::StringF( SipStrConsts::EPhraseOk ) );
+ aTransaction->SendResponseL( resE );
+ // resE ownership is transferred
+ CleanupStack::Pop( resE );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: response sent *" ));
+#endif
+ }
+ }
+
+ // Fill the data of the request
+ const CSIPMessageElements& elems = reqE->MessageElements();
+ TRAPD( err, DoHandleSrvrReqContentL( elems, req->Request() ));
+ // Update expires when necessary
+ if ( !err )
+ {
+ // This completes the client request when needed
+ TRAP( err, iCallback.HandleDialogRequestL( elems, *req, method ));
+ }
+
+ CleanupStack::PopAndDestroy( aTransaction );
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::DoIncomingResponse
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::DoIncomingResponse(
+ CSIPClientTransaction& aTransaction)
+ {
+ const CSIPResponseElements* elems = aTransaction.ResponseElements();
+ // elems ownership is not transferred
+ TUint status = elems->StatusCode();
+
+ if ( status >= KSimpleOK )
+ {
+ // Final response received
+
+ // Search the right request
+ CSimpleRequest* req = iCallback.GetRequest( aTransaction );
+
+ if ( req )
+ {
+ if( req->Match( CSimpleRequest::EReqSendIM ) )
+ {
+ TBool isModify = MSimpleEngineRequest::ESendIM ==
+ req->Request().RequestType() ? ETrue : EFalse;
+
+ // Get retry-after header value
+ TUint myRefresh = GetRetryAfter( elems );
+ req->SetRetryAfter( myRefresh );
+
+ TInt retCode = ConvertSipCode( status, myRefresh ?
+ ETrue: EFalse, isModify );
+ req->SetStatus( status );
+ req->Request().SetResponseMethod(
+ MSimpleEngineRequest::EStatus );
+ TInt err( KErrNone );
+
+ // Complete the client request and change the request state
+ req->Complete( err ? err : retCode );
+ }
+ else if ( req->Match( CSimpleRequest::EReqPublish ) )
+ {
+ TBool isModify = req->Request().RequestType() ==
+ MSimpleEngineRequest::EPublishModify ? ETrue : EFalse;
+
+ // Get retry-after header value
+ TUint myRefresh = GetRetryAfter( elems );
+ req->SetRetryAfter( myRefresh );
+
+ TInt retCode = ConvertSipCode( status, myRefresh ?
+ ETrue: EFalse, isModify );
+ req->SetStatus( status );
+ req->Request().SetResponseMethod(
+ MSimpleEngineRequest::EStatus );
+
+ // Make response to a client when necessary, i.e. response to
+ // the first PUBLISH.
+ // This handles STOP publish also, since it's
+ // actually a new publish request with expires=0 and ETag.
+ const CSIPMessageElements& mElems = elems->MessageElements();
+ TInt err( KErrNone );
+ TRAP( err, iCallback.HandlePublishRespL( mElems, req ) );
+ // Complete the client request and change the request state
+ req->Complete( err ? err : retCode );
+ }
+ else
+ {
+ // This is unknown response
+ #ifdef _DEBUG
+ TSimpleLogger::Log( _L("SipConnectionObserver: IncomingResponse IGNORED") );
+ #endif
+ }
+ }
+ else
+ {
+ // Request not found
+ #ifdef _DEBUG
+ TSimpleLogger::Log( _L("SipConnectionObserver: IncomingResponse IGNORED") );
+ #endif
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSimpleSipConnectionObserver::DoIncomingResponse
+// -----------------------------------------------------------------------------
+//
+void CSimpleSipConnectionObserver::DoIncomingResponse(
+ CSIPClientTransaction& aTransaction,
+ CSIPDialogAssocBase& /*aDialogAssoc*/)
+ {
+ // ownership of elems is not transferred.
+ const CSIPResponseElements* elems = aTransaction.ResponseElements();
+ if ( !elems )
+ {
+ return;
+ }
+ // elems ownership is not transferred
+ TUint status = elems->StatusCode();
+
+ if ( status >= KSimpleOK )
+ {
+ // Final response received
+
+ // search the right request
+ CSimpleRequest* req = iCallback.GetRequest( aTransaction );
+ if ( ! req )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipConnectionObserver: Unknown response **" ));
+#endif
+ // This is unknown response
+ return;
+ }
+
+ req->SetStatus( status );
+
+ // update response method
+ req->Request().SetResponseMethod( MSimpleEngineRequest::EStatus );
+ req->Complete( ConvertSipCode( status, EFalse, EFalse ) );
+
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnectionObserver::ConvertSipCode
+// ----------------------------------------------------------
+//
+TInt CSimpleSipConnectionObserver::ConvertSipCode(
+ TUint aSip, TBool aRetryAfter, TBool aPublishModify )
+ {
+ // The SIP status codes are converted to engine error codes
+ if ( aSip < KSimpleOK )
+ {
+ return KErrNone;
+ }
+ if ( aPublishModify )
+ {
+ return ConvertSipModifyCode( aSip );
+ }
+ switch ( aSip )
+ {
+ case KSimpleOK: // 200
+ return KErrNone;
+ case KSimpleAccepted: // 202
+ return KSimpleErrPending;
+ case 404: // Not Found
+ return KSimpleErrNotFound;
+ case 401: // Unauthorized
+ case 407: // Proxy Authentication Required
+ return KSimpleErrAuthorization;
+ case 302: // Moved Temporarily
+ case 408: // Request Timeout
+ case 412: // Conditional Request Failed, RFC3903
+ case 480: // Temporarily Unavailable
+ case 481: // Call/Transaction Does Not Exist
+ case 482: // Loop Detected
+ case 483: // Too Many Hops
+ case 486: // Busy Here
+ case 487: // Request Terminated (BYE/CANCEL) ** should not happen
+ case 491: // Request Pending
+ case 503: // Service Unavailable
+ case 504: // Server Time-out
+ return KSimpleErrTemporary;
+ case 413: // Request Entity Too Large
+ if ( aRetryAfter )
+ {
+ return KSimpleErrTemporary;
+ }
+ else
+ {
+ return KSimpleErrPermanent;
+ }
+ default:
+ return KSimpleErrPermanent;
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipConnectionObserver::ConvertSipModifyCode
+// ----------------------------------------------------------
+//
+TInt CSimpleSipConnectionObserver::ConvertSipModifyCode(
+ TUint aSip )
+ {
+ // The SIP status codes are converted to engine error codes
+ if ( aSip < KSimpleOK )
+ {
+ return KErrNone;
+ }
+ switch ( aSip )
+ {
+ case KSimpleOK: // 200
+ return KErrNone;
+ case KSimpleAccepted: // 202
+ return KSimpleErrPending;
+ case 404: // Not Found
+ return KSimpleErrNotFound;
+ case 401: // Unauthorized
+ case 407: // Proxy Authentication Required
+ return KSimpleErrAuthorization;
+ case 400: // Bad request
+ case 408: // Request Time Out
+ case 415: // Unsupported media type
+ case 508: // Server Timed-Out
+ return KSimpleErrTemporary;
+ default:
+ return KSimpleErrPermanent;
+ }
+ }
+// ----------------------------------------------------------
+// CSimpleSipConnectionObserver::GetRetryAfter
+// ----------------------------------------------------------
+//
+TUint CSimpleSipConnectionObserver::GetRetryAfter( const CSIPResponseElements* aElems )
+ {
+ TUint ret(0);
+
+ // aElems must exist
+ const CSIPMessageElements& mes = aElems->MessageElements();
+
+ // Scan user headers
+ const RPointerArray<CSIPHeaderBase>& userHs = mes.UserHeaders();
+ for ( TInt i = 0; i < userHs.Count(); i++ )
+ {
+ const CSIPHeaderBase* header = userHs[ i ];
+ if ( header->Name() == SIPStrings::StringF( SipStrConsts::ERetryAfterHeader ))
+ {
+ CSIPRetryAfterHeader* retryH = (CSIPRetryAfterHeader*)header;
+ ret = retryH->RetryAfter();
+ }
+ else
+ {
+ // We ignore other than Retry-After header
+ }
+ }
+
+ return ret;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/siputils/src/simplesipprofileobserver.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: sip connection
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <sip.h>
+#include <sipconnection.h>
+#include <sipconnectionobserver.h>
+#include <sipresponseelements.h>
+#include <sipclienttransaction.h>
+#include <sipprofile.h>
+#include <sipprofileregistry.h>
+#include "simplesipprofileobserver.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::CSimpleSipProfileObserver
+// ----------------------------------------------------------
+//
+CSimpleSipProfileObserver::CSimpleSipProfileObserver( CSimpleSipConnectionObserver& aObs )
+: iObs(aObs)
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::~CSimpleSipProfileObserver
+// ----------------------------------------------------------
+//
+CSimpleSipProfileObserver::~CSimpleSipProfileObserver()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: DESTRUCTOR start" ));
+#endif
+ if ( iProfile && iRegistry )
+ {
+ iRegistry->Disable( *iProfile );
+ }
+ delete iProfile;
+ delete iRegistry;
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: DESTRUCTOR end" ));
+#endif
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::NewL
+// ----------------------------------------------------------
+//
+CSimpleSipProfileObserver* CSimpleSipProfileObserver::NewL(
+ CSIP* aSIP,
+ CSimpleSipConnectionObserver& aObs )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: NewL" ));
+#endif
+ CSimpleSipProfileObserver* self = new (ELeave) CSimpleSipProfileObserver( aObs );
+ CleanupStack::PushL( self );
+ self->ConstructL( aSIP );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleSipProfileObserver::ConstructL( CSIP* aSIP )
+ {
+ iRegistry = CSIPProfileRegistry::NewL( *aSIP, *this );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::RegisterDefaultProfileL
+// ----------------------------------------------------------
+//
+void CSimpleSipProfileObserver::RegisterDefaultProfileL( )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: RegisterDefaultProfileL" ));
+#endif
+ if ( iProfile )
+ {
+ User::Leave( KErrAlreadyExists );
+ }
+
+ // Get the default profile.
+ iProfile = iRegistry->DefaultProfileL();
+
+ // Safety check that DefaultProfileL() didn't return NULL pointer.
+ if ( !iProfile )
+ {
+ User::Leave( KErrNotFound );
+ }
+ if ( !iRegistry->IsEnabled( *iProfile ))
+ {
+ // Ask Profile API to enable the retrieved profile for our use.
+ iRegistry->EnableL( *iProfile, iObs );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::RegisterGivenProfileL
+// ----------------------------------------------------------
+//
+void CSimpleSipProfileObserver::RegisterGivenProfileL( TUint32 aID )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: RegisterGivenProfileL id=%d" ), aID);
+#endif
+
+ RPointerArray<CSIPProfile> profiles;
+
+ if ( iProfile )
+ {
+ User::Leave( KErrAlreadyExists );
+ }
+
+ // Search the profiles until the proper one is found.
+ iRegistry->ProfilesL( profiles );
+
+ TInt count = profiles.Count();
+ TUint32 val = 0;
+ CSIPProfile* sippro = NULL;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ sippro = profiles[i];
+ TInt err = sippro->GetParameter( KSIPProfileId, val );
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: Profile id=%d" ), val);
+#endif
+ if ( !err && val == aID)
+ {
+ // The profile matches for the given search criteria
+ iProfile = sippro;
+ }
+ else
+ {
+ // delete unnecessary profile entity,
+ // the ownership was transferred to us.
+ delete sippro;
+ }
+ }
+
+ // reset array, unnecessary profiles are already deleted
+ profiles.Reset();
+
+ // Safety check that DefaultProfileL() didn't return NULL pointer.
+ if ( !iProfile )
+ {
+ User::Leave( KErrNotFound );
+ }
+ if ( !iRegistry->IsEnabled( *iProfile ))
+ {
+ // Ask Profile API to enable the retrieved profile for our use.
+ iRegistry->EnableL( *iProfile, iObs );
+ }
+
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::GiveConnectionL
+// ----------------------------------------------------------
+//
+CSIPConnection* CSimpleSipProfileObserver::GiveConnectionL()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: GiveConnectionL" ));
+#endif
+ // Check if the SIP connection is already enabled or should we
+ // wait it for.
+ TBool val( EFalse );
+ TInt err = iProfile->GetParameter( KSIPProfileRegistered, val );
+ User::LeaveIfError( err );
+ // The pameter val indicates if the profile can be immediately used
+ if ( val )
+ {
+ // get the SIP connection used by the profile
+ return iRegistry->ConnectionL( *iProfile );
+ }
+ else
+ {
+ User::Leave( KErrNotReady );
+ }
+ return (CSIPConnection*) NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::IsProfileActive
+// ----------------------------------------------------------
+//
+TBool CSimpleSipProfileObserver::IsProfileActive()
+ {
+ // Check if the SIP profile is active
+ // wait it for.
+ TBool val( EFalse );
+ // Profile is created in ConstructL, so it exists.
+ if ( iProfile )
+ {
+ iProfile->GetParameter( KSIPProfileRegistered, val );
+ }
+ return val;
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::GiveUserAorL
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleSipProfileObserver::GiveUserAorL()
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: GiveUserAorL" ));
+#endif
+ // Check first if registered
+ TBool val( EFalse );
+ TInt err = iProfile->GetParameter( KSIPProfileRegistered, val );
+ User::LeaveIfError( err );
+ if ( !val)
+ {
+ User::Leave( KErrNotReady );
+ }
+ // Get the first element in the array
+ const MDesC8Array* aors = 0;
+ err= iProfile->GetParameter( KSIPRegisteredAors, aors );
+ User::LeaveIfError(err);
+ if ( !aors || aors->MdcaCount() == 0 )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return aors->MdcaPoint(0);
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::ProfileRegistryEventOccurred
+// ----------------------------------------------------------
+//
+void CSimpleSipProfileObserver::ProfileRegistryEventOccurred(
+ TUint32 /*aProfileId*/, TEvent aEvent)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: ProfileRegistryEventOccurred event=%d" ), aEvent );
+#endif
+ if ( aEvent == EProfileRegistered )
+ {
+ iObs.ProfileStateChanged( CSIPConnection::EActive, KErrNone );
+ }
+ else if ( aEvent == EProfileDeregistered )
+ {
+ iObs.ProfileStateChanged( CSIPConnection::EInactive, KErrNone );
+ }
+ else if ( aEvent == EProfileUpdated )
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: EProfileUpdated - ProfileEnabled : %d" ), iRegistry->IsEnabled( *iProfile ) );
+ TSimpleLogger::Log(_L("SipProfileObserver: EProfileUpdated - Profile reg er : %d" ), iRegistry->LastRegistrationError( *iProfile ) );
+ TSimpleLogger::Log(_L("SipProfileObserver: EProfileUpdated - IsContextActive : %d" ), iProfile->IsContextActive() );
+#endif
+
+ // Notify observer to refresh SIP connection.
+ iObs.ProfileUpdated();
+ }
+ else if ( aEvent == EProfileDestroyed )
+ {
+ iObs.ProfileStateChanged( CSIPConnection::EUnavailable, KErrNone );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::ProfileRegistryErrorOccurred
+// ----------------------------------------------------------
+//
+void CSimpleSipProfileObserver::ProfileRegistryErrorOccurred(
+ TUint32 /*aProfileId*/, TInt aError)
+ {
+#ifdef _DEBUG
+ TSimpleLogger::Log(_L("SipProfileObserver: ProfileRegistryErrorOccurred" ));
+#endif
+ iObs.ProfileStateChanged( CSIPConnection::EUnavailable, aError );
+ }
+
+// ----------------------------------------------------------
+// CSimpleSipProfileObserver::ProfileContext
+// ----------------------------------------------------------
+//
+MSIPRegistrationContext* CSimpleSipProfileObserver::ProfileContext()
+ {
+ return iProfile;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/bwinscw/rlspresxdmU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,100 @@
+EXPORTS
+ ??0TPresCondIdentityMany@@QAE@XZ @ 1 NONAME ; TPresCondIdentityMany::TPresCondIdentityMany(void)
+ ??0TPresCondIdentityOne@@QAE@XZ @ 2 NONAME ; TPresCondIdentityOne::TPresCondIdentityOne(void)
+ ??0TPresCondMisc@@QAE@XZ @ 3 NONAME ; TPresCondMisc::TPresCondMisc(void)
+ ??0TPresCondSphere@@QAE@XZ @ 4 NONAME ; TPresCondSphere::TPresCondSphere(void)
+ ??0TPresCondValidity@@QAE@XZ @ 5 NONAME ; TPresCondValidity::TPresCondValidity(void)
+ ??0TPresenceActionXDM@@QAE@XZ @ 6 NONAME ; TPresenceActionXDM::TPresenceActionXDM(void)
+ ??0TPresenceTransformXDM@@QAE@XZ @ 7 NONAME ; TPresenceTransformXDM::TPresenceTransformXDM(void)
+ ?AddAnonymousRequestL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 8 NONAME ; int TPresCondMisc::AddAnonymousRequestL(class TDesC16 const &)
+ ?AddElementL@CRLSXDM@@QAEHABVTDesC16@@00@Z @ 9 NONAME ; int CRLSXDM::AddElementL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?AddExternListL@TPresCondMisc@@QAEHABVTDesC16@@0@Z @ 10 NONAME ; int TPresCondMisc::AddExternListL(class TDesC16 const &, class TDesC16 const &)
+ ?AddIdentitiesInManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@ABVCDesC16Array@@0@Z @ 11 NONAME ; int TPresCondIdentityMany::AddIdentitiesInManyExceptL(class TDesC16 const &, class CDesC16Array const &, class TDesC16 const &)
+ ?AddIdentitiesL@TPresCondIdentityOne@@QAEHABVTDesC16@@ABVMDesC16Array@@@Z @ 12 NONAME ; int TPresCondIdentityOne::AddIdentitiesL(class TDesC16 const &, class MDesC16Array const &)
+ ?AddIdentityInManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@00@Z @ 13 NONAME ; int TPresCondIdentityMany::AddIdentityInManyExceptL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?AddIdentityL@TPresCondIdentityOne@@QAEHABVTDesC16@@0@Z @ 14 NONAME ; int TPresCondIdentityOne::AddIdentityL(class TDesC16 const &, class TDesC16 const &)
+ ?AddManyIdentityL@TPresCondIdentityMany@@QAEHABVTDesC16@@0@Z @ 15 NONAME ; int TPresCondIdentityMany::AddManyIdentityL(class TDesC16 const &, class TDesC16 const &)
+ ?AddOrRepProvideAllTransComplexL@TPresenceTransformXDM@@QAEHABVTDesC16@@0@Z @ 16 NONAME ; int TPresenceTransformXDM::AddOrRepProvideAllTransComplexL(class TDesC16 const &, class TDesC16 const &)
+ ?AddOrRepTransKnownBoolL@TPresenceTransformXDM@@QAEHABVTDesC16@@0H@Z @ 17 NONAME ; int TPresenceTransformXDM::AddOrRepTransKnownBoolL(class TDesC16 const &, class TDesC16 const &, int)
+ ?AddOrRepTransUnknownBoolL@TPresenceTransformXDM@@QAEHABVTDesC16@@0H@Z @ 18 NONAME ; int TPresenceTransformXDM::AddOrRepTransUnknownBoolL(class TDesC16 const &, class TDesC16 const &, int)
+ ?AddOrReplaceActionL@TPresenceActionXDM@@QAEHABVTDesC16@@0@Z @ 19 NONAME ; int TPresenceActionXDM::AddOrReplaceActionL(class TDesC16 const &, class TDesC16 const &)
+ ?AddOrReplaceSphereL@TPresCondSphere@@QAEHABVTDesC16@@0@Z @ 20 NONAME ; int TPresCondSphere::AddOrReplaceSphereL(class TDesC16 const &, class TDesC16 const &)
+ ?AddOtherIdentityL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 21 NONAME ; int TPresCondMisc::AddOtherIdentityL(class TDesC16 const &)
+ ?AddServiceURIL@CRLSXDM@@QAEHABVTDesC16@@@Z @ 22 NONAME ; int CRLSXDM::AddServiceURIL(class TDesC16 const &)
+ ?AddTransComplexL@TPresenceTransformXDM@@QAEHABVTDesC16@@0ABV?$RArray@UTTransDataCompo@@@@@Z @ 23 NONAME ; int TPresenceTransformXDM::AddTransComplexL(class TDesC16 const &, class TDesC16 const &, class RArray<struct TTransDataCompo> const &)
+ ?AddValidityL@TPresCondValidity@@QAEHABVTDesC16@@UTTimePeriod@@@Z @ 24 NONAME ; int TPresCondValidity::AddValidityL(class TDesC16 const &, struct TTimePeriod)
+ ?CancelUpdateL@CPresenceXDM@@QAEXXZ @ 25 NONAME ; void CPresenceXDM::CancelUpdateL(void)
+ ?CancelUpdateL@CRLSXDM@@QAEXXZ @ 26 NONAME ; void CRLSXDM::CancelUpdateL(void)
+ ?CreateNewRuleL@CPresenceXDM@@QAEHAAVTDes16@@@Z @ 27 NONAME ; int CPresenceXDM::CreateNewRuleL(class TDes16 &)
+ ?DeleteAll@CRLSXDM@@QAEXXZ @ 28 NONAME ; void CRLSXDM::DeleteAll(void)
+ ?DeleteAllEmptyLists@CRLSXDM@@QAEHPAVMRLSPresXDMAsyncHandler@@@Z @ 29 NONAME ; int CRLSXDM::DeleteAllEmptyLists(class MRLSPresXDMAsyncHandler *)
+ ?DeleteAllEmptyServiceUrisL@CRLSXDM@@QAEXXZ @ 30 NONAME ; void CRLSXDM::DeleteAllEmptyServiceUrisL(void)
+ ?DeleteAllExternalListsL@TPresCondMisc@@QAEXABVTDesC16@@@Z @ 31 NONAME ; void TPresCondMisc::DeleteAllExternalListsL(class TDesC16 const &)
+ ?DeleteAllIdentitiesFromManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@0@Z @ 32 NONAME ; int TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL(class TDesC16 const &, class TDesC16 const &)
+ ?DeleteAllIdentitiesL@TPresCondIdentityOne@@QAEXABVTDesC16@@@Z @ 33 NONAME ; void TPresCondIdentityOne::DeleteAllIdentitiesL(class TDesC16 const &)
+ ?DeleteAllRules@CPresenceXDM@@QAEXXZ @ 34 NONAME ; void CPresenceXDM::DeleteAllRules(void)
+ ?DeleteAllValidityL@TPresCondValidity@@QAEHABVTDesC16@@@Z @ 35 NONAME ; int TPresCondValidity::DeleteAllValidityL(class TDesC16 const &)
+ ?DeleteEmptyRulesL@CPresenceXDM@@QAEXXZ @ 36 NONAME ; void CPresenceXDM::DeleteEmptyRulesL(void)
+ ?DeleteExternalListL@TPresCondMisc@@QAEHABVTDesC16@@0@Z @ 37 NONAME ; int TPresCondMisc::DeleteExternalListL(class TDesC16 const &, class TDesC16 const &)
+ ?DeleteExternalListsL@TPresCondMisc@@QAEXABVTDesC16@@ABVMDesC16Array@@@Z @ 38 NONAME ; void TPresCondMisc::DeleteExternalListsL(class TDesC16 const &, class MDesC16Array const &)
+ ?DeleteIdentitiesL@TPresCondIdentityOne@@QAEXABVTDesC16@@ABVMDesC16Array@@@Z @ 39 NONAME ; void TPresCondIdentityOne::DeleteIdentitiesL(class TDesC16 const &, class MDesC16Array const &)
+ ?DeleteIdentityL@TPresCondIdentityOne@@QAEHABVTDesC16@@0@Z @ 40 NONAME ; int TPresCondIdentityOne::DeleteIdentityL(class TDesC16 const &, class TDesC16 const &)
+ ?DeleteRuleL@CPresenceXDM@@QAEHABVTDesC16@@@Z @ 41 NONAME ; int CPresenceXDM::DeleteRuleL(class TDesC16 const &)
+ ?DeleteSphereL@TPresCondSphere@@QAEHABVTDesC16@@@Z @ 42 NONAME ; int TPresCondSphere::DeleteSphereL(class TDesC16 const &)
+ ?GetActionL@TPresenceActionXDM@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 43 NONAME ; int TPresenceActionXDM::GetActionL(class TDesC16 const &, class TDes16 &)
+ ?GetAllRulesL@CPresenceXDM@@QAEXAAVCDesC16Array@@@Z @ 44 NONAME ; void CPresenceXDM::GetAllRulesL(class CDesC16Array &)
+ ?GetCurrentPathL@CRLSXDM@@QAEXAAVCDesC16Array@@@Z @ 45 NONAME ; void CRLSXDM::GetCurrentPathL(class CDesC16Array &)
+ ?GetDisplayName@CRLSXDM@@QAEHABVTDesC16@@0AAVTPtrC8@@@Z @ 46 NONAME ; int CRLSXDM::GetDisplayName(class TDesC16 const &, class TDesC16 const &, class TPtrC8 &)
+ ?GetElementsL@CRLSXDM@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 47 NONAME ; void CRLSXDM::GetElementsL(class TDesC16 const &, class CDesC16Array &)
+ ?GetExternalListsL@TPresCondMisc@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 48 NONAME ; void TPresCondMisc::GetExternalListsL(class TDesC16 const &, class CDesC16Array &)
+ ?GetIdentitiesFromManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@AAVCDesC16Array@@0@Z @ 49 NONAME ; int TPresCondIdentityMany::GetIdentitiesFromManyExceptL(class TDesC16 const &, class CDesC16Array &, class TDesC16 const &)
+ ?GetIdentitiesL@TPresCondIdentityOne@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 50 NONAME ; void TPresCondIdentityOne::GetIdentitiesL(class TDesC16 const &, class CDesC16Array &)
+ ?GetManyIdentityElementsL@TPresCondIdentityMany@@QAEHABVTDesC16@@AAVCDesC16Array@@@Z @ 51 NONAME ; int TPresCondIdentityMany::GetManyIdentityElementsL(class TDesC16 const &, class CDesC16Array &)
+ ?GetServiceUrisL@CRLSXDM@@QAEXAAVCDesC16Array@@@Z @ 52 NONAME ; void CRLSXDM::GetServiceUrisL(class CDesC16Array &)
+ ?GetSphereL@TPresCondSphere@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 53 NONAME ; int TPresCondSphere::GetSphereL(class TDesC16 const &, class TPtrC16 &)
+ ?GetTransComplexL@TPresenceTransformXDM@@QAEHABVTDesC16@@0AAV?$RArray@UTTransDataCompo@@@@@Z @ 54 NONAME ; int TPresenceTransformXDM::GetTransComplexL(class TDesC16 const &, class TDesC16 const &, class RArray<struct TTransDataCompo> &)
+ ?GetTransKnownBoolL@TPresenceTransformXDM@@QAEHABVTDesC16@@0AAH@Z @ 55 NONAME ; int TPresenceTransformXDM::GetTransKnownBoolL(class TDesC16 const &, class TDesC16 const &, int &)
+ ?GetTransUnknownBoolL@TPresenceTransformXDM@@QAEHABVTDesC16@@0AAH@Z @ 56 NONAME ; int TPresenceTransformXDM::GetTransUnknownBoolL(class TDesC16 const &, class TDesC16 const &, int &)
+ ?GetValidityL@TPresCondValidity@@QAEHABVTDesC16@@AAV?$RArray@UTTimePeriod@@@@@Z @ 57 NONAME ; int TPresCondValidity::GetValidityL(class TDesC16 const &, class RArray<struct TTimePeriod> &)
+ ?Init@TPresCondIdentityMany@@QAEXPAVCPresenceXDM@@@Z @ 58 NONAME ; void TPresCondIdentityMany::Init(class CPresenceXDM *)
+ ?Init@TPresCondIdentityOne@@QAEXPAVCPresenceXDM@@@Z @ 59 NONAME ; void TPresCondIdentityOne::Init(class CPresenceXDM *)
+ ?Init@TPresCondMisc@@QAEXPAVCPresenceXDM@@@Z @ 60 NONAME ; void TPresCondMisc::Init(class CPresenceXDM *)
+ ?Init@TPresCondSphere@@QAEXPAVCPresenceXDM@@@Z @ 61 NONAME ; void TPresCondSphere::Init(class CPresenceXDM *)
+ ?Init@TPresCondValidity@@QAEXPAVCPresenceXDM@@@Z @ 62 NONAME ; void TPresCondValidity::Init(class CPresenceXDM *)
+ ?Init@TPresenceActionXDM@@QAEXPAVCPresenceXDM@@@Z @ 63 NONAME ; void TPresenceActionXDM::Init(class CPresenceXDM *)
+ ?Init@TPresenceTransformXDM@@QAEXPAVCPresenceXDM@@@Z @ 64 NONAME ; void TPresenceTransformXDM::Init(class CPresenceXDM *)
+ ?IsAnonymousRequestExistL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 65 NONAME ; int TPresCondMisc::IsAnonymousRequestExistL(class TDesC16 const &)
+ ?IsElementExist@CRLSXDM@@QAEHABVTDesC16@@0@Z @ 66 NONAME ; int CRLSXDM::IsElementExist(class TDesC16 const &, class TDesC16 const &)
+ ?IsExistServiceURI@CRLSXDM@@QAEHABVTDesC16@@@Z @ 67 NONAME ; int CRLSXDM::IsExistServiceURI(class TDesC16 const &)
+ ?IsExternListExistL@TPresCondMisc@@QAEHABVTDesC16@@0@Z @ 68 NONAME ; int TPresCondMisc::IsExternListExistL(class TDesC16 const &, class TDesC16 const &)
+ ?IsIdentityExistL@TPresCondIdentityOne@@QAEHABVTDesC16@@0@Z @ 69 NONAME ; int TPresCondIdentityOne::IsIdentityExistL(class TDesC16 const &, class TDesC16 const &)
+ ?IsIdentityExistsInManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@00@Z @ 70 NONAME ; int TPresCondIdentityMany::IsIdentityExistsInManyExceptL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?IsManyExistsL@TPresCondIdentityMany@@QAEHABVTDesC16@@0@Z @ 71 NONAME ; int TPresCondIdentityMany::IsManyExistsL(class TDesC16 const &, class TDesC16 const &)
+ ?IsOtherIdentityExistL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 72 NONAME ; int TPresCondMisc::IsOtherIdentityExistL(class TDesC16 const &)
+ ?IsRuleExist@CPresenceXDM@@QAEHABVTDesC16@@@Z @ 73 NONAME ; int CPresenceXDM::IsRuleExist(class TDesC16 const &)
+ ?IsTimeValidL@TPresCondValidity@@QAEHABVTDesC16@@UTTimePeriod@@@Z @ 74 NONAME ; int TPresCondValidity::IsTimeValidL(class TDesC16 const &, struct TTimePeriod)
+ ?IsTransformExistL@TPresenceTransformXDM@@QAEHABVTDesC16@@0@Z @ 75 NONAME ; int TPresenceTransformXDM::IsTransformExistL(class TDesC16 const &, class TDesC16 const &)
+ ?NewL@CPresenceXDM@@SAPAV1@H@Z @ 76 NONAME ; class CPresenceXDM * CPresenceXDM::NewL(int)
+ ?NewL@CRLSXDM@@SAPAV1@H@Z @ 77 NONAME ; class CRLSXDM * CRLSXDM::NewL(int)
+ ?NewLC@CPresenceXDM@@SAPAV1@H@Z @ 78 NONAME ; class CPresenceXDM * CPresenceXDM::NewLC(int)
+ ?NewLC@CRLSXDM@@SAPAV1@H@Z @ 79 NONAME ; class CRLSXDM * CRLSXDM::NewLC(int)
+ ?RemoveActionL@TPresenceActionXDM@@QAEHABVTDesC16@@@Z @ 80 NONAME ; int TPresenceActionXDM::RemoveActionL(class TDesC16 const &)
+ ?RemoveAnonymousRequestL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 81 NONAME ; int TPresCondMisc::RemoveAnonymousRequestL(class TDesC16 const &)
+ ?RemoveElementL@CRLSXDM@@QAEHABVTDesC16@@0@Z @ 82 NONAME ; int CRLSXDM::RemoveElementL(class TDesC16 const &, class TDesC16 const &)
+ ?RemoveIdentityFromManyExceptL@TPresCondIdentityMany@@QAEHABVTDesC16@@00@Z @ 83 NONAME ; int TPresCondIdentityMany::RemoveIdentityFromManyExceptL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?RemoveManyIdentityL@TPresCondIdentityMany@@QAEHABVTDesC16@@0@Z @ 84 NONAME ; int TPresCondIdentityMany::RemoveManyIdentityL(class TDesC16 const &, class TDesC16 const &)
+ ?RemoveOtherIdentityL@TPresCondMisc@@QAEHABVTDesC16@@@Z @ 85 NONAME ; int TPresCondMisc::RemoveOtherIdentityL(class TDesC16 const &)
+ ?RemoveServiceURIL@CRLSXDM@@QAEHABVTDesC16@@@Z @ 86 NONAME ; int CRLSXDM::RemoveServiceURIL(class TDesC16 const &)
+ ?RemoveTransformL@TPresenceTransformXDM@@QAEHABVTDesC16@@0@Z @ 87 NONAME ; int TPresenceTransformXDM::RemoveTransformL(class TDesC16 const &, class TDesC16 const &)
+ ?RenameListL@CRLSXDM@@QAEHABVTDesC16@@0@Z @ 88 NONAME ; int CRLSXDM::RenameListL(class TDesC16 const &, class TDesC16 const &)
+ ?SetCurrentpathL@CRLSXDM@@QAEHABVMDesC16Array@@@Z @ 89 NONAME ; int CRLSXDM::SetCurrentpathL(class MDesC16Array const &)
+ ?SwitchOutFromList@CRLSXDM@@QAEXXZ @ 90 NONAME ; void CRLSXDM::SwitchOutFromList(void)
+ ?SwitchToListL@CRLSXDM@@QAEHABVTDesC16@@@Z @ 91 NONAME ; int CRLSXDM::SwitchToListL(class TDesC16 const &)
+ ?SwitchToServiceURIL@CRLSXDM@@QAEHABVTDesC16@@@Z @ 92 NONAME ; int CRLSXDM::SwitchToServiceURIL(class TDesC16 const &)
+ ?UpdateAllFromServerL@CPresenceXDM@@QAEHPAVMRLSPresXDMAsyncHandler@@@Z @ 93 NONAME ; int CPresenceXDM::UpdateAllFromServerL(class MRLSPresXDMAsyncHandler *)
+ ?UpdateAllFromServerL@CRLSXDM@@QAEHPAVMRLSPresXDMAsyncHandler@@@Z @ 94 NONAME ; int CRLSXDM::UpdateAllFromServerL(class MRLSPresXDMAsyncHandler *)
+ ?UpdateDisplayNameL@CRLSXDM@@QAEHABVTDesC16@@00@Z @ 95 NONAME ; int CRLSXDM::UpdateDisplayNameL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+ ?UpdateToServerL@CPresenceXDM@@QAEHPAVMRLSPresXDMAsyncHandler@@@Z @ 96 NONAME ; int CPresenceXDM::UpdateToServerL(class MRLSPresXDMAsyncHandler *)
+ ?UpdateToServerL@CRLSXDM@@QAEHPAVMRLSPresXDMAsyncHandler@@@Z @ 97 NONAME ; int CRLSXDM::UpdateToServerL(class MRLSPresXDMAsyncHandler *)
+ ?NegotiatedServiceUri@CRLSXDM@@QAE?AVTPtrC16@@XZ @ 98 NONAME ; class TPtrC16 CRLSXDM::NegotiatedServiceUri(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/eabi/rlspresxdmU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,111 @@
+EXPORTS
+ _ZN12CPresenceXDM11DeleteRuleLERK7TDesC16 @ 1 NONAME
+ _ZN12CPresenceXDM11IsRuleExistERK7TDesC16 @ 2 NONAME
+ _ZN12CPresenceXDM12GetAllRulesLER12CDesC16Array @ 3 NONAME
+ _ZN12CPresenceXDM13CancelUpdateLEv @ 4 NONAME
+ _ZN12CPresenceXDM14CreateNewRuleLER6TDes16 @ 5 NONAME
+ _ZN12CPresenceXDM14DeleteAllRulesEv @ 6 NONAME
+ _ZN12CPresenceXDM15UpdateToServerLEP23MRLSPresXDMAsyncHandler @ 7 NONAME
+ _ZN12CPresenceXDM17DeleteEmptyRulesLEv @ 8 NONAME
+ _ZN12CPresenceXDM20UpdateAllFromServerLEP23MRLSPresXDMAsyncHandler @ 9 NONAME
+ _ZN12CPresenceXDM4NewLEi @ 10 NONAME
+ _ZN12CPresenceXDM5NewLCEi @ 11 NONAME
+ _ZN13TPresCondMisc14AddExternListLERK7TDesC16S2_ @ 12 NONAME
+ _ZN13TPresCondMisc17AddOtherIdentityLERK7TDesC16 @ 13 NONAME
+ _ZN13TPresCondMisc17GetExternalListsLERK7TDesC16R12CDesC16Array @ 14 NONAME
+ _ZN13TPresCondMisc18IsExternListExistLERK7TDesC16S2_ @ 15 NONAME
+ _ZN13TPresCondMisc19DeleteExternalListLERK7TDesC16S2_ @ 16 NONAME
+ _ZN13TPresCondMisc20AddAnonymousRequestLERK7TDesC16 @ 17 NONAME
+ _ZN13TPresCondMisc20DeleteExternalListsLERK7TDesC16RK12MDesC16Array @ 18 NONAME
+ _ZN13TPresCondMisc20RemoveOtherIdentityLERK7TDesC16 @ 19 NONAME
+ _ZN13TPresCondMisc21IsOtherIdentityExistLERK7TDesC16 @ 20 NONAME
+ _ZN13TPresCondMisc23DeleteAllExternalListsLERK7TDesC16 @ 21 NONAME
+ _ZN13TPresCondMisc23RemoveAnonymousRequestLERK7TDesC16 @ 22 NONAME
+ _ZN13TPresCondMisc24IsAnonymousRequestExistLERK7TDesC16 @ 23 NONAME
+ _ZN13TPresCondMisc4InitEP12CPresenceXDM @ 24 NONAME
+ _ZN13TPresCondMiscC1Ev @ 25 NONAME
+ _ZN13TPresCondMiscC2Ev @ 26 NONAME
+ _ZN15TPresCondSphere10GetSphereLERK7TDesC16R7TPtrC16 @ 27 NONAME
+ _ZN15TPresCondSphere13DeleteSphereLERK7TDesC16 @ 28 NONAME
+ _ZN15TPresCondSphere19AddOrReplaceSphereLERK7TDesC16S2_ @ 29 NONAME
+ _ZN15TPresCondSphere4InitEP12CPresenceXDM @ 30 NONAME
+ _ZN15TPresCondSphereC1Ev @ 31 NONAME
+ _ZN15TPresCondSphereC2Ev @ 32 NONAME
+ _ZN17TPresCondValidity12AddValidityLERK7TDesC1611TTimePeriod @ 33 NONAME
+ _ZN17TPresCondValidity12GetValidityLERK7TDesC16R6RArrayI11TTimePeriodE @ 34 NONAME
+ _ZN17TPresCondValidity12IsTimeValidLERK7TDesC1611TTimePeriod @ 35 NONAME
+ _ZN17TPresCondValidity18DeleteAllValidityLERK7TDesC16 @ 36 NONAME
+ _ZN17TPresCondValidity4InitEP12CPresenceXDM @ 37 NONAME
+ _ZN17TPresCondValidityC1Ev @ 38 NONAME
+ _ZN17TPresCondValidityC2Ev @ 39 NONAME
+ _ZN18TPresenceActionXDM10GetActionLERK7TDesC16R6TDes16 @ 40 NONAME
+ _ZN18TPresenceActionXDM13RemoveActionLERK7TDesC16 @ 41 NONAME
+ _ZN18TPresenceActionXDM19AddOrReplaceActionLERK7TDesC16S2_ @ 42 NONAME
+ _ZN18TPresenceActionXDM4InitEP12CPresenceXDM @ 43 NONAME
+ _ZN18TPresenceActionXDMC1Ev @ 44 NONAME
+ _ZN18TPresenceActionXDMC2Ev @ 45 NONAME
+ _ZN20TPresCondIdentityOne12AddIdentityLERK7TDesC16S2_ @ 46 NONAME
+ _ZN20TPresCondIdentityOne14AddIdentitiesLERK7TDesC16RK12MDesC16Array @ 47 NONAME
+ _ZN20TPresCondIdentityOne14GetIdentitiesLERK7TDesC16R12CDesC16Array @ 48 NONAME
+ _ZN20TPresCondIdentityOne15DeleteIdentityLERK7TDesC16S2_ @ 49 NONAME
+ _ZN20TPresCondIdentityOne16IsIdentityExistLERK7TDesC16S2_ @ 50 NONAME
+ _ZN20TPresCondIdentityOne17DeleteIdentitiesLERK7TDesC16RK12MDesC16Array @ 51 NONAME
+ _ZN20TPresCondIdentityOne20DeleteAllIdentitiesLERK7TDesC16 @ 52 NONAME
+ _ZN20TPresCondIdentityOne4InitEP12CPresenceXDM @ 53 NONAME
+ _ZN20TPresCondIdentityOneC1Ev @ 54 NONAME
+ _ZN20TPresCondIdentityOneC2Ev @ 55 NONAME
+ _ZN21TPresCondIdentityMany13IsManyExistsLERK7TDesC16S2_ @ 56 NONAME
+ _ZN21TPresCondIdentityMany16AddManyIdentityLERK7TDesC16S2_ @ 57 NONAME
+ _ZN21TPresCondIdentityMany19RemoveManyIdentityLERK7TDesC16S2_ @ 58 NONAME
+ _ZN21TPresCondIdentityMany24AddIdentityInManyExceptLERK7TDesC16S2_S2_ @ 59 NONAME
+ _ZN21TPresCondIdentityMany24GetManyIdentityElementsLERK7TDesC16R12CDesC16Array @ 60 NONAME
+ _ZN21TPresCondIdentityMany26AddIdentitiesInManyExceptLERK7TDesC16RK12CDesC16ArrayS2_ @ 61 NONAME
+ _ZN21TPresCondIdentityMany28GetIdentitiesFromManyExceptLERK7TDesC16R12CDesC16ArrayS2_ @ 62 NONAME
+ _ZN21TPresCondIdentityMany29IsIdentityExistsInManyExceptLERK7TDesC16S2_S2_ @ 63 NONAME
+ _ZN21TPresCondIdentityMany29RemoveIdentityFromManyExceptLERK7TDesC16S2_S2_ @ 64 NONAME
+ _ZN21TPresCondIdentityMany34DeleteAllIdentitiesFromManyExceptLERK7TDesC16S2_ @ 65 NONAME
+ _ZN21TPresCondIdentityMany4InitEP12CPresenceXDM @ 66 NONAME
+ _ZN21TPresCondIdentityManyC1Ev @ 67 NONAME
+ _ZN21TPresCondIdentityManyC2Ev @ 68 NONAME
+ _ZN21TPresenceTransformXDM16AddTransComplexLERK7TDesC16S2_RK6RArrayI15TTransDataCompoE @ 69 NONAME
+ _ZN21TPresenceTransformXDM16GetTransComplexLERK7TDesC16S2_R6RArrayI15TTransDataCompoE @ 70 NONAME
+ _ZN21TPresenceTransformXDM16RemoveTransformLERK7TDesC16S2_ @ 71 NONAME
+ _ZN21TPresenceTransformXDM17IsTransformExistLERK7TDesC16S2_ @ 72 NONAME
+ _ZN21TPresenceTransformXDM18GetTransKnownBoolLERK7TDesC16S2_Ri @ 73 NONAME
+ _ZN21TPresenceTransformXDM20GetTransUnknownBoolLERK7TDesC16S2_Ri @ 74 NONAME
+ _ZN21TPresenceTransformXDM23AddOrRepTransKnownBoolLERK7TDesC16S2_i @ 75 NONAME
+ _ZN21TPresenceTransformXDM25AddOrRepTransUnknownBoolLERK7TDesC16S2_i @ 76 NONAME
+ _ZN21TPresenceTransformXDM31AddOrRepProvideAllTransComplexLERK7TDesC16S2_ @ 77 NONAME
+ _ZN21TPresenceTransformXDM4InitEP12CPresenceXDM @ 78 NONAME
+ _ZN21TPresenceTransformXDMC1Ev @ 79 NONAME
+ _ZN21TPresenceTransformXDMC2Ev @ 80 NONAME
+ _ZN7CRLSXDM11AddElementLERK7TDesC16S2_S2_ @ 81 NONAME
+ _ZN7CRLSXDM11RenameListLERK7TDesC16S2_ @ 82 NONAME
+ _ZN7CRLSXDM12GetElementsLERK7TDesC16R12CDesC16Array @ 83 NONAME
+ _ZN7CRLSXDM13CancelUpdateLEv @ 84 NONAME
+ _ZN7CRLSXDM13SwitchToListLERK7TDesC16 @ 85 NONAME
+ _ZN7CRLSXDM14AddServiceURILERK7TDesC16 @ 86 NONAME
+ _ZN7CRLSXDM14GetDisplayNameERK7TDesC16S2_R6TPtrC8 @ 87 NONAME
+ _ZN7CRLSXDM14IsElementExistERK7TDesC16S2_ @ 88 NONAME
+ _ZN7CRLSXDM14RemoveElementLERK7TDesC16S2_ @ 89 NONAME
+ _ZN7CRLSXDM15GetCurrentPathLER12CDesC16Array @ 90 NONAME
+ _ZN7CRLSXDM15GetServiceUrisLER12CDesC16Array @ 91 NONAME
+ _ZN7CRLSXDM15SetCurrentpathLERK12MDesC16Array @ 92 NONAME
+ _ZN7CRLSXDM15UpdateToServerLEP23MRLSPresXDMAsyncHandler @ 93 NONAME
+ _ZN7CRLSXDM17IsExistServiceURIERK7TDesC16 @ 94 NONAME
+ _ZN7CRLSXDM17RemoveServiceURILERK7TDesC16 @ 95 NONAME
+ _ZN7CRLSXDM17SwitchOutFromListEv @ 96 NONAME
+ _ZN7CRLSXDM18UpdateDisplayNameLERK7TDesC16S2_S2_ @ 97 NONAME
+ _ZN7CRLSXDM19DeleteAllEmptyListsEP23MRLSPresXDMAsyncHandler @ 98 NONAME
+ _ZN7CRLSXDM19SwitchToServiceURILERK7TDesC16 @ 99 NONAME
+ _ZN7CRLSXDM20UpdateAllFromServerLEP23MRLSPresXDMAsyncHandler @ 100 NONAME
+ _ZN7CRLSXDM26DeleteAllEmptyServiceUrisLEv @ 101 NONAME
+ _ZN7CRLSXDM4NewLEi @ 102 NONAME
+ _ZN7CRLSXDM5NewLCEi @ 103 NONAME
+ _ZN7CRLSXDM9DeleteAllEv @ 104 NONAME
+ _ZTI12CPresenceXDM @ 105 NONAME ; #<TI>#
+ _ZTI7CRLSXDM @ 106 NONAME ; #<TI>#
+ _ZTV12CPresenceXDM @ 107 NONAME ; #<VT>#
+ _ZTV7CRLSXDM @ 108 NONAME ; #<VT>#
+ _ZN7CRLSXDM20NegotiatedServiceUriEv @ 109 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM presence build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+rlspresxdm.mmp
+
+PRJ_EXPORTS
+../inc/rlspresxdmconsts.h /epoc32/include/mw/rlspresxdmconsts.h
+../inc/cpresencexdm.h /epoc32/include/mw/cpresencexdm.h
+../inc/mrlspresxdmasynchandler.h /epoc32/include/mw/mrlspresxdmasynchandler.h
+../inc/presenceactionxdm.h /epoc32/include/mw/presenceactionxdm.h
+../inc/prescondidentityone.h /epoc32/include/mw/prescondidentityone.h
+../inc/prescondidentitymany.h /epoc32/include/mw/prescondidentitymany.h
+../inc/prescondvalidity.h /epoc32/include/mw/prescondvalidity.h
+../inc/prescondsphere.h /epoc32/include/mw/prescondsphere.h
+../inc/presencetransformxdm.h /epoc32/include/mw/presencetransformxdm.h
+../inc/crlsxdm.h /epoc32/include/mw/crlsxdm.h
+../inc/prescondmisc.h /epoc32/include/mw/prescondmisc.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/group/rlspresxdm.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMP File
+*
+*/
+
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET rlspresxdm.dll
+UID 0x1000008d 0x1028190F
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+TARGETTYPE DLL
+
+SOURCEPATH ../src
+
+SOURCE presenceactionxdm.cpp
+SOURCE presencetransformxdm.cpp
+SOURCE cpresencexdm.cpp
+SOURCE crlsxdm.cpp
+SOURCE prescondidentitymany.cpp
+SOURCE prescondidentityone.cpp
+SOURCE prescondsphere.cpp
+SOURCE prescondvalidity.cpp
+SOURCE prescondmisc.cpp
+//SOURCE cresourcelistxdm.cpp
+
+USERINCLUDE ../inc
+
+// default system include paths for middleware layer modules
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY bafl.lib
+LIBRARY euser.lib
+DEBUGLIBRARY flogger.lib
+LIBRARY xdmengine.lib
+LIBRARY charconv.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../bwinscw/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/inc/rlspresxdmconstsint.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is internal constants.
+*
+*/
+
+
+
+#ifndef __RLSPRESXDMCONSTSINT_H__
+#define __RLSPRESXDMCONSTSINT_H__
+
+#include <xcapappusagedef.h>
+
+// this is total length of rule id i.e. KPresRuleIDPrefix + random number
+const TInt KPresRuleIDLength(7);
+const TInt KPresRuleIDPrefixLength(3);
+const TInt KPresRuleIDNumLength(4);
+const TInt KPresRuleIdCalc(16770000); // basically we want only last four digits
+
+const TInt KPresDateTimeBufLength(60);
+const TInt KPresTransCompAttrLength = 25;
+const TInt KPresRLSElemAttrNameLen = 10;
+
+const TInt KPresRLSDesArrayInitlVal = 10;
+const TInt KPresRLSChildConstBufLen = 5;
+
+//Validity constants
+const TInt KPresDTWithoutUTCLength = 24;
+const TInt KPresDTSeperatorPos = 10;
+
+
+// document names
+_LIT(KRLSDocumentName, "index");
+_LIT(KPresDocumentName, "pres-rules");
+
+// directory model names
+_LIT(KRLSDirectoryModel, "rls-services");
+_LIT(KPresRulesDirectoryModel, "org.openmobilealliance.pres-rules");
+
+//Logging constants
+_LIT(KPresRLSLogDir, "rlspresxdmapi");
+_LIT(KPresRLSLogFile, "rlspresxdm.txt");
+
+// Time formatting strings
+_LIT(KPresDateTimeFormatString, "%Y%M%D%/0%1%/1%2%/2%3%/3%J%:1%T%:2%S%.%*C3%:3");
+_LIT(KPresUTCFormatString, "%J%:1%T");
+_LIT(KPresSpaceString, " ");
+
+
+// Async operation states for RlsXDM
+enum ERLSXDMAsyncOperation
+ {
+ ERLSXDMNoRequestMade = 0,
+ ERLSXDMUpdateToServer,
+ ERLSXDMUpdateFromServer,
+ ERLSXDMDeletingEmptyLists,
+ ERLSXDMDeletedEmptyLists,
+ ERLSXDMRequestCancelling
+ };
+
+// Async operation states for PresXDM
+enum EPresXDMAsyncOperation
+ {
+ EPresXDMNoRequestMade = 0,
+ EPresXDMUpdateToServer,
+ EPresXDMUpdateFromServer,
+ EPresXDMRequestCancelling
+ };
+
+// The first rule id from which random generation begins
+_LIT( KPresRuleIDPrefix, "nok0000");
+
+
+#endif // __RLSPRESXDMCONSTSINT_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/inc/rlspresxdmlogger.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header is for logging purposes, only in debug.
+*
+*/
+
+
+
+
+
+#ifndef _RLSPRESXDMLOGGER_H
+#define _RLSPRESXDMLOGGER_H
+
+
+// logging is done only in debug
+#ifdef _DEBUG
+
+#include <flogger.h>
+#include "rlspresxdmconstsint.h"
+
+#define D_OPENG_LIT(s) _L(s)
+#define OPENG_DP OPENGDebugWriteFormat
+
+
+/**
+* Log file printing utility function
+* @since Series 60 3.0
+*/
+inline void OPENGDebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960
+ {
+ //Use RFileLogger to write log - no time and date
+ RFileLogger logger;
+ logger.Connect();
+ //use date, use time
+ logger.SetDateAndTime( EFalse, ETrue );
+ logger.CreateLog( KPresRLSLogDir,
+ KPresRLSLogFile,
+ EFileLoggingModeAppend );
+
+ TBuf< 256 > buffer;
+
+ {
+ VA_LIST list;
+ VA_START (list, aFmt); //lint !e960
+ TBuf< 300 > formatted;
+ formatted.FormatList( aFmt, list );
+ buffer.Append( formatted.Left( buffer.MaxLength() - buffer.Length() ) );
+ }
+
+ logger.Write( buffer );
+ logger.CloseLog();
+ logger.Close();
+ }
+
+
+#else // _DEBUG
+
+struct TOPENGEmptyDebugString { };
+
+#define D_OPENG_LIT(s) TOPENGEmptyDebugString()
+
+/// Empty debug print function for release builds.
+inline void OPENG_DP(TOPENGEmptyDebugString)
+ {
+ }
+
+template<class T1>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1)
+ {
+ }
+
+template<class T1,class T2>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2)
+ {
+ }
+
+template<class T1,class T2,class T3>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
+ {
+ }
+
+template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
+inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
+ {
+ }
+
+
+#endif // _DEBUG
+
+
+#endif // _RLSPRESXDMLOGGER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/cpresencexdm.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,531 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is primary class for Presence XDM
+*
+*/
+
+
+
+
+// Includes
+#include <XdmProtocolInfo.h>
+#include <XdmEngine.h>
+#include <XdmDocument.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <e32math.h>
+#include <xcapappusagedef.h>
+
+#include "cpresencexdm.h"
+#include "mrlspresxdmasynchandler.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceXDM* CPresenceXDM::NewL( const TInt aSettingId )
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::NewL" ) );
+ CPresenceXDM* self = CPresenceXDM::NewLC(aSettingId);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPresenceXDM* CPresenceXDM::NewLC( const TInt aSettingId )
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::NewLC" ) );
+ CPresenceXDM* self = new (ELeave) CPresenceXDM();
+ CleanupStack::PushL( self );
+ self->ConstructL( aSettingId );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::ConstructL(const TInt aSettingId )
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::ConstructL" ) );
+ iXDMProtocolInfo = CXdmProtocolInfo::NewL(aSettingId);
+ iXDMEngine = CXdmEngine::NewL( *iXDMProtocolInfo);
+ iPresDocument = iXDMEngine->CreateDocumentModelL(KPresDocumentName,
+ EXdmOmaPresenceRules);
+
+ // put this to some other function
+ CreateRootIfNeededL();
+
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::CPresenceXDM()
+// ---------------------------------------------------------------------------
+//
+CPresenceXDM::CPresenceXDM() : CActive( EPriorityStandard ),
+ iAsyncReq(EPresXDMNoRequestMade)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::CPresenceXDM" ) );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::~CPresenceXDM()
+// ---------------------------------------------------------------------------
+//
+CPresenceXDM::~CPresenceXDM()
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::~CPresenceXDM" ) );
+ if(IsActive())
+ Cancel();
+ delete iPresDocument;
+ delete iXDMEngine;
+ delete iXDMProtocolInfo;
+ iPresDocument = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::CreateRootIfNeededL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::CreateRootIfNeededL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::CreateRootIfNeededL" ) );
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (myRootNode)
+ {
+ myRootNode->SetEmptyNode(EFalse);// allow new data to be created, for xdmengine bug
+ return;
+ }
+ myRootNode = iPresDocument->CreateRootL();
+ myRootNode->SetNameL( KXdmRuleset );
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::UpdateToServerL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceXDM::UpdateToServerL
+ (MRLSPresXDMAsyncHandler* const aHandler)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::UpdateToServerL(%d)" ),aHandler );
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ return KErrAlreadyExists;
+ iAsyncReq = EPresXDMUpdateToServer;
+ iAsyncHandler = aHandler;
+
+ iPresDocument->AppendL();
+ iXDMEngine->UpdateL(iPresDocument, iStatus);
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::UpdateAllFromServerL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceXDM::UpdateAllFromServerL
+ (MRLSPresXDMAsyncHandler* const aHandler)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::UpdateAllFromServerL(%d)" ),aHandler );
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ return KErrAlreadyExists;
+ iPresDocument->ResetContents();
+ iPresDocument->FetchDataL();
+ iAsyncReq = EPresXDMUpdateFromServer;
+ iAsyncHandler = aHandler;
+ iXDMEngine->UpdateL(iPresDocument, iStatus);
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::CancelUpdateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceXDM::CancelUpdateL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::CancelUpdateL" ));
+ if (IsActive())
+ {
+ DoCancel();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::GetAllRulesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceXDM::GetAllRulesL(CDesCArray& aRuleIds)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::GetAllRulesL" ) );
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (!myRootNode)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* idAttribute(NULL);
+
+ // Find all rules under root
+ if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
+ { // go through all found rules
+ TInt ruleCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " ruleCountInNode = %d" ),ruleCountInNode );
+ for (TInt i=0;i<ruleCountInNode;i++)
+ { // get the id attribute
+ idAttribute = (nodes[i])->Attribute(KXdmId);
+ // push it to given discriptor array
+ aRuleIds.AppendL(idAttribute->AttributeValue());
+ }
+ }
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::DeleteRuleL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceXDM::DeleteRuleL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::DeleteRuleL(%S)" ),&aRuleId );
+ CXdmDocumentNode* ruleNode = IsRuleExistInt(aRuleId);
+ if (ruleNode)
+ {
+ iPresDocument->RemoveFromModelL(ruleNode);
+ OPENG_DP(D_OPENG_LIT( " removed" ) );
+ return KErrNone;
+ }
+ return KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::CreateNewRuleL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPresenceXDM::CreateNewRuleL(TDes& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::CreateNewRuleL(%S)" ),&aRuleId );
+ CreateRootIfNeededL();
+
+ if(aRuleId==KNullDesC) // create rule id if needed
+ GetUniqueRuleId(aRuleId);
+ else if(IsRuleExist(aRuleId)) // if rule id already exist, check it
+ return KErrAlreadyExists;
+
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (myRootNode)
+ {
+ CXdmDocumentNode* ruleNode = myRootNode->CreateChileNodeL(KXdmRule);
+ CXdmNodeAttribute* attributeRuleId = ruleNode->CreateAttributeL(KXdmId);
+ attributeRuleId->SetAttributeValueL(aRuleId);
+ return KErrNone;
+ }
+ return KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::IsRuleExist()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPresenceXDM::IsRuleExist(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::IsRuleExist(%S)" ),&aRuleId );
+ CXdmDocumentNode* ruleNode = IsRuleExistInt(aRuleId);
+ if(ruleNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " True"));
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::DeleteAllRules()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceXDM::DeleteAllRules()
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::DeleteAllRules" ));
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (!myRootNode)
+ return; // return if no rule exists
+
+ myRootNode->SetEmptyNode(ETrue); // delete all data
+ myRootNode->SetEmptyNode(EFalse);// allow new data to be created
+
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::DeleteEmptyRules()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPresenceXDM::DeleteEmptyRulesL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CPresenceXDM::DeleteEmptyRules" ));
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (!myRootNode)
+ return; // return if no rule exists
+
+ RPointerArray<CXdmDocumentNode> nodes;
+
+ // Find all rules under root Node
+ if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
+ { // go through all found rules
+ TInt ruleCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " ruleCountInNode = %d" ),ruleCountInNode );
+
+ for (TInt i=0;i<ruleCountInNode;i++)
+ {
+ if ( ((nodes[i])->NodeCount()) == 0)// if rule is empty
+ {
+ iPresDocument->RemoveFromModelL(nodes[i]);
+ OPENG_DP(D_OPENG_LIT( " delete at i = %d" ), i);
+ }
+ }
+ }
+ nodes.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::IsRuleExistInt()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresenceXDM::IsRuleExistInt(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::IsRuleExistInt(%S)" ),&aRuleId );
+ CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
+ if (!myRootNode)
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* desiredNode(NULL);
+ CXdmNodeAttribute* idAttribute(NULL);
+
+ // Find all rules under root Node
+ if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
+ { // go through all found rules
+ TInt ruleCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " ruleCountInNode = %d" ),ruleCountInNode );
+ for (TInt k=0;k<ruleCountInNode;k++)
+ { // get the id attribute
+ idAttribute = (nodes[k])->Attribute(KXdmId);
+ // match it with given attr
+ if (idAttribute->AttributeValue() == aRuleId)
+ {
+ desiredNode = nodes[k];
+ break;
+ }
+ }
+ }
+ nodes.Close();
+ return desiredNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::GetRuleChildNodeL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresenceXDM::GetRuleChildNodeL(const TDesC& aRuleId,
+ const TDesC& aRuleChild, TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetRuleChildNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aRuleChild = %S, aCreate = %d"),
+ &aRuleId, &aRuleChild, aCreate);
+
+ CXdmDocumentNode* myRuleNode = IsRuleExistInt(aRuleId);
+ if (!myRuleNode)
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* ruleChildNode(NULL);
+
+ // Finding rule child node
+ myRuleNode->Find(aRuleChild, nodes);
+ TInt childCount = myRuleNode->NodeCount();
+ TInt position;
+ OPENG_DP(D_OPENG_LIT( " GetruleChildNodeL nodeCount = %d"),nodes.Count());
+ if(nodes.Count()) // if rule child node exist
+ {
+ ruleChildNode = nodes[0]; // only one rule child node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ ruleChildNode = iXDMEngine->CreateDocumentNodeL();
+ ruleChildNode->SetNameL(aRuleChild);
+
+ if(aRuleChild==KXdmConditions) // if we need to add conditions
+ { // add always to the first position
+ myRuleNode->InsertChileNodeL(0, ruleChildNode);
+ position = 0;
+ }
+
+ else if(aRuleChild==KXdmActions) // if we need to add actions
+ {
+ myRuleNode->Find(KXdmConditions, nodes);
+ if (nodes.Count())
+ {
+ myRuleNode->InsertChileNodeL(1, ruleChildNode);//if conditions exists add after it
+ position = 1;
+ }
+ else
+ {
+ myRuleNode->InsertChileNodeL(0, ruleChildNode);
+ position = 0;
+ }
+ }
+
+ else // to add transformations
+ {
+ myRuleNode->InsertChileNodeL(childCount, ruleChildNode);
+ position = childCount;
+ }
+ delete ruleChildNode;
+ ruleChildNode = myRuleNode->ChileNode(position);
+ OPENG_DP(D_OPENG_LIT( " position = %d"),position);
+ }
+
+ nodes.Close();
+ return ruleChildNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::GetConditionChildNodeL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CPresenceXDM::GetConditionChildNodeL(const TDesC& aRuleId,
+ const TDesC& aCondChild, TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetConditionChildNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aCondChild = %S, aCreate = %d"),
+ &aRuleId, &aCondChild, aCreate);
+
+ CXdmDocumentNode* conditionNode = GetRuleChildNodeL(aRuleId, KXdmConditions,
+ aCreate);
+ if (!conditionNode)
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* condChildNode(NULL);
+
+
+ // Finding condition child node
+ conditionNode->Find(aCondChild, nodes);
+ OPENG_DP(D_OPENG_LIT( " GetcondChildNodeL nodeCount = %d"),nodes.Count());
+ if(nodes.Count()) // if condition child node exist
+ {
+ condChildNode = nodes[0]; // only one condition child node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ condChildNode = conditionNode->CreateChileNodeL(aCondChild);
+ }
+
+ nodes.Close();
+ return condChildNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::GetUniqueRuleId()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::GetUniqueRuleId(TDes& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetUniqueRuleId" ));
+ aRuleId.Copy(KPresRuleIDPrefix);
+ TInt myNumber;
+
+ // make sure that newly created rule id doesnt exist in the document
+ while (IsRuleExist(aRuleId))
+ {
+ aRuleId.Delete(KPresRuleIDPrefixLength, KPresRuleIDNumLength);
+ myNumber = Math::Random() - KPresRuleIdCalc;
+ aRuleId.AppendNumFixedWidth(myNumber,EDecimal,KPresRuleIDNumLength);
+ }
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S" ), &aRuleId);
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::DoCancel()
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::DoCancel" ));
+ iXDMEngine->CancelUpdate(iPresDocument);
+ iAsyncReq = EPresXDMRequestCancelling;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::RunL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::RunL()
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::RunL" ));
+ OPENG_DP(D_OPENG_LIT( " iAsyncReq = %d, iStatus.Int() = %d" ),
+ iAsyncReq,iStatus.Int());
+ TInt orig = iAsyncReq;
+ iAsyncReq = EPresXDMNoRequestMade;
+
+ switch (orig)
+ {
+ case EPresXDMUpdateToServer:
+ iAsyncHandler->HandlePresUpdateDocumentL(iStatus.Int());
+ break;
+ case EPresXDMUpdateFromServer:
+ CreateRootIfNeededL();
+ iAsyncHandler->HandlePresUpdateDocumentL(iStatus.Int());
+ break;
+ case EPresXDMRequestCancelling:
+ iAsyncHandler->HandlePresUpdateCancelL(iStatus.Int());
+ break;
+ case EPresXDMNoRequestMade:
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CPresenceXDM::RunError(TInt aError)
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::RunError" ));
+ OPENG_DP(D_OPENG_LIT( " RunError iAsyncReq(%d), aError(%d)" ),iAsyncReq,
+ aError);
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CPresenceXDM::RemoveFromModelL()
+// ---------------------------------------------------------------------------
+//
+void CPresenceXDM::RemoveFromModelL( CXdmDocumentNode* aNode )
+ {
+ OPENG_DP(D_OPENG_LIT( " CPresenceXDM::RemoveFromModelL(%d)" ),aNode);
+ iPresDocument->RemoveFromModelL(aNode);
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/crlsxdm.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1359 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This is class for RLS XDM
+*
+*/
+
+
+
+
+// Includes
+#include <utf.h>
+#include <XdmProtocolInfo.h>
+#include <XdmEngine.h>
+#include <XdmDocument.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <XdmErrors.h>
+#include <xcapappusagedef.h>
+
+#include "crlsxdm.h"
+#include "mrlspresxdmasynchandler.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::NewL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRLSXDM* CRLSXDM::NewL( const TInt aSettingId )
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::NewL" ));
+ CRLSXDM* self = CRLSXDM::NewLC(aSettingId);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::NewLC()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRLSXDM* CRLSXDM::NewLC( const TInt aSettingId )
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::NewLC" ));
+ CRLSXDM* self = new (ELeave) CRLSXDM();
+ CleanupStack::PushL( self );
+ self->ConstructL( aSettingId );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::ConstructL(const TInt aSettingId)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::ConstructL(%d)" ), aSettingId);
+ iXDMProtocolInfo = CXdmProtocolInfo::NewL(aSettingId);
+ iXDMEngine = CXdmEngine::NewL( *iXDMProtocolInfo);
+ iRLSDocument = iXDMEngine->CreateDocumentModelL(KRLSDocumentName,
+ EXdmRlsServices);
+
+ CreateRootIfNeededL();
+
+ iListPath = new(ELeave)CDesCArraySeg(KPresRLSDesArrayInitlVal);
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::CreateRootIfNeededL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::CreateRootIfNeededL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::CreateRootIfNeededL" ));
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ if (myRootNode)
+ {
+ myRootNode->SetEmptyNode(EFalse);// allow new data to be created, for xdmengine bug
+ return;
+ }
+ myRootNode = iRLSDocument->CreateRootL();
+ myRootNode->SetNameL( KXdmRlsServices );
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::CRLSXDM()
+// ---------------------------------------------------------------------------
+//
+CRLSXDM::CRLSXDM() : CActive( EPriorityStandard ),
+ iAsyncReq(ERLSXDMNoRequestMade)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::CRLSXDM" ));
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::~CRLSXDM()
+// ---------------------------------------------------------------------------
+//
+CRLSXDM::~CRLSXDM()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::~CRLSXDM()" ));
+ if(IsActive())
+ Cancel();
+
+ delete iRLSDocument;
+ delete iXDMEngine;
+ delete iXDMProtocolInfo;
+ iRLSDocument = NULL;
+
+ if(iListPath)
+ iListPath->Reset();
+ delete iListPath;
+
+ iListPointerPath.Reset();
+
+ delete iNegotiatedServiceUri;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::UpdateToServerL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::UpdateToServerL(MRLSPresXDMAsyncHandler* const aHandler)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::UpdateToServerL(%d)" ), aHandler);
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ return KErrAlreadyExists;
+ iAsyncReq = ERLSXDMUpdateToServer;
+ iAsyncHandler = aHandler;
+ iRLSDocument->AppendL();
+ iXDMEngine->UpdateL(iRLSDocument, iStatus);
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::CancelUpdateL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::CancelUpdateL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::CancelUpdateL" ));
+ if (IsActive())
+ {
+ DoCancel();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::UpdateAllFromServerL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::UpdateAllFromServerL(MRLSPresXDMAsyncHandler* const aHandler)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::UpdateAllFromServerL(%d)" ));
+ __ASSERT_ALWAYS(aHandler, User::Leave(KErrArgument));
+ if (IsActive())
+ return KErrAlreadyExists;
+
+ iAsyncHandler = aHandler;
+ iRLSDocument->ResetContents();
+ iRLSDocument->FetchDataL();
+ iAsyncReq = ERLSXDMUpdateFromServer;
+
+ iXDMEngine->UpdateL(iRLSDocument, iStatus);
+
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DeleteAll()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::DeleteAll()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::DeleteAllL"));
+
+ // resetting current path
+ iListPath->Reset();
+ iListPointerPath.Reset();
+
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ if (myRootNode==NULL)
+ return;
+
+ myRootNode->SetEmptyNode(ETrue); // delete all data
+ myRootNode->SetEmptyNode(EFalse);// allow new data to be created
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::AddServiceURIL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::AddServiceURIL(const TDesC& aServiceURI)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::AddServiceURIL(%S)" ),&aServiceURI);
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ if (myRootNode==NULL)
+ return KErrNotFound;
+
+ //check if already exist
+ if (IsServiceUriExist(aServiceURI, myRootNode) != NULL)
+ return KErrAlreadyExists;
+
+ //workaround
+ myRootNode->SetEmptyNode(EFalse);// allow new data to be created
+
+ CXdmDocumentNode* listServNode = myRootNode->CreateChileNodeL(KXdmService);
+ CXdmNodeAttribute* attributeUri = listServNode->CreateAttributeL(KXdmUri);
+ attributeUri->SetAttributeValueL(aServiceURI);
+
+ // now add the packages
+ CXdmDocumentNode* packagesNode = listServNode->CreateChileNodeL(KXdmPackages);
+ CXdmDocumentNode* packageNode = packagesNode->CreateChileNodeL(KXdmPackage);
+ packageNode->SetLeafNode(ETrue);
+ packageNode->SetLeafNodeContentL(KXdmPresence);
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RemoveServiceURIL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::RemoveServiceURIL(const TDesC& aServiceURI)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::RemoveServiceURIL(%S)" ),&aServiceURI);
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ TInt err(KErrNotFound);
+ if (myRootNode!=NULL)
+ {
+ CXdmDocumentNode* serviceNode = IsServiceUriExist(aServiceURI, myRootNode);
+ if(serviceNode) // if exist
+ {
+ iRLSDocument->RemoveFromModelL(serviceNode);
+ err = KErrNone;
+ }
+ }
+ // check valdity of path if operation is successful
+ if(iListPath->Count() && (err==KErrNone))
+ {
+ if( (iListPath->MdcaPoint(0)) == aServiceURI)
+ {
+ // resetting current path
+ iListPath->Reset();
+ iListPointerPath.Reset();
+ }
+ }
+
+ OPENG_DP(D_OPENG_LIT( " returned: %d" ),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::IsExistServiceURI()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CRLSXDM::IsExistServiceURI(const TDesC& aServiceURI)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::IsExistServiceURI(%S)" ),&aServiceURI);
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ TBool isExist(EFalse);
+ if (myRootNode!=NULL)
+ {
+ CXdmDocumentNode* serviceNode = IsServiceUriExist(aServiceURI, myRootNode);
+ if(serviceNode) // if exist
+ {
+ isExist = ETrue;
+ }
+ }
+
+ OPENG_DP(D_OPENG_LIT( " returned: %d" ),isExist);
+ return isExist;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetServiceUris()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::GetServiceUrisL(CDesCArray& aServiceUris)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::GetServiceUris" ));
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* uriAttribute(NULL);
+
+ if (myRootNode!=NULL)
+ {
+ // Find all Service Uris under root Node
+ if ((myRootNode->Find(KXdmService, nodes)) == KErrNone)
+ { // go through all found Uris
+ TInt uriCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " uriCountInNode(%d)" ),uriCountInNode);
+ for (TInt k=0;k<uriCountInNode;k++)
+ { // get the uri attribute
+ uriAttribute = (nodes[k])->Attribute(KXdmUri);
+ // push it to given discriptor array
+ aServiceUris.AppendL(uriAttribute->AttributeValue());
+ }
+ }
+ }
+ nodes.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DeleteAllEmptyServiceUrisL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::DeleteAllEmptyServiceUrisL()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::DeleteAllEmptyServiceUrisL" ));
+ RPointerArray<CXdmDocumentNode> uriNodes;
+
+ // resetting current path
+ iListPath->Reset();
+ iListPointerPath.Reset();
+
+ TInt found = iRLSDocument->Find( KXdmService, uriNodes);
+ OPENG_DP(D_OPENG_LIT( " total Uris: %d" ), found);
+
+ for (TInt i=0;i<found;i++)
+ {
+ if ( ((uriNodes[i])->NodeCount()) <= 1)// if Uri have only package node
+ {
+ iRLSDocument->RemoveFromModelL(uriNodes[i]);
+ OPENG_DP(D_OPENG_LIT( " delete at i = %d" ), i);
+ }
+ }
+ uriNodes.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RenameListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::RenameListL(const TDesC& aListName,
+ const TDesC& aListNewName)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::RenameListL(%S)" ),&aListName);
+ TInt err(KErrNotFound);
+ TInt count = iListPointerPath.Count();
+ if (count)
+ {
+ CXdmDocumentNode* list = GetNonLeafChild(KXdmList,aListName,
+ iListPointerPath[count-1]);
+ if (list!=NULL) // if found
+ { // if new name already exist
+ CXdmDocumentNode* newList = GetNonLeafChild(KXdmList, aListNewName,
+ iListPointerPath[count-1]);
+ if (newList)
+ err = KErrAlreadyExists;
+ else
+ {
+ CXdmNodeAttribute* myAttribute = list->Attribute(KXdmName);
+ myAttribute->SetAttributeValueL(aListNewName);
+ err = KErrNone;
+ }
+ }
+ }
+ OPENG_DP(D_OPENG_LIT( " returned: %d" ),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DeleteAllEmptyLists()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::DeleteAllEmptyLists(MRLSPresXDMAsyncHandler* const aHandler)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::DeleteAllEmptyListsL(%d)" ), aHandler);
+
+ if(aHandler==NULL)
+ return KErrArgument;
+
+ if (IsActive())
+ return KErrAlreadyExists;
+
+ // resetting current path
+ iListPath->Reset();
+ iListPointerPath.Reset();
+
+ iAsyncReq = ERLSXDMDeletingEmptyLists;
+ iAsyncHandler = aHandler;
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete(status,KErrNone);
+ SetActive();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::AddElementL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::AddElementL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::AddElementL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S), aDisplayName(%S)"),
+ &aElementType, &aData, &aDisplayName);
+ TInt err(KErrNone);
+ TInt count = iListPointerPath.Count();
+
+ if(aElementType==KXdmResourceList)
+ {
+ if (count) // should be atleast 1, so that resource-list reside inside serviceUri
+ {
+ CXdmDocumentNode* list = GetLeafChild(aElementType, aData,
+ iListPointerPath[count-1]);
+ if (!list) // if not found
+ {
+ if(count==1)// if the package on same level
+ RemovePackageL();
+ AddLeafElementL(KXdmResourceList, aData, iListPointerPath[count-1]);
+ if(count==1)// if the package on same level
+ AddPackageL(); // so that package is the last element on service-uri
+ err = KErrNone;
+ }
+ else
+ err = KErrAlreadyExists;
+ }
+ else
+ err = KErrPermissionDenied; // path is not suitable
+ }
+ else if(IsNonLeafElementValid(aElementType))
+ {
+ if( (count>1) || ((aElementType==KXdmList)&&(count)) )
+ {
+ CXdmDocumentNode* element = GetNonLeafChild(aElementType, aData,
+ iListPointerPath[count-1]);
+ if(!element) // if element doesnt exist
+ {
+ if(count==1)// if the package on same level
+ RemovePackageL();
+ AddNonLeafElementL(aElementType, aData, aDisplayName, iListPointerPath[count-1]);
+ if(count==1)// if the package on same level
+ AddPackageL(); // so that package is the last element on service-uri
+ err = KErrNone;
+ }
+ else
+ err = KErrAlreadyExists;
+ }
+ else
+ err = KErrPermissionDenied; // path is not suitable
+ }
+ else
+ err = KErrArgument;
+
+ OPENG_DP(D_OPENG_LIT( " return: err(%d)" ), err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetDisplayName()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::GetDisplayName(const TDesC& aElementType,
+ const TDesC& aData, TPtrC8& aDisplayName)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::GetDisplayName" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S)"),
+ &aElementType, &aData);
+
+ TInt err(KErrNotFound);
+
+ TInt count = iListPointerPath.Count();
+ if (count) // if there is atleast service uri
+ {
+ if(IsNonLeafElementValid(aElementType))
+ {
+ err = GetDisplayNameInt(aElementType, aData, aDisplayName,
+ iListPointerPath[count-1]);
+ }
+ else
+ err = KErrArgument;
+ }
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::UpdateDisplayNameL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::UpdateDisplayNameL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::UpdateDisplayNameL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S), aDisplayName(%S)"),
+ &aElementType, &aData, &aDisplayName);
+
+ TInt err(KErrNotFound);
+
+ TInt count = iListPointerPath.Count();
+ if (count) // if there is atleast service uri
+ {
+ if(IsNonLeafElementValid(aElementType))
+ {
+ err = UpdateDisplayNameIntL(aElementType, aData, aDisplayName,
+ iListPointerPath[count-1]);
+ }
+ else
+ err = KErrArgument;
+ }
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetElementsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::GetElementsL(const TDesC& aElementType,
+ CDesCArray& aValues)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::GetElementsL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S)"),&aElementType);
+
+ TInt count = iListPointerPath.Count();
+ if (count) // if there is atleast service uri
+ {
+ if(IsNonLeafElementValid(aElementType))
+ GetNonLeafElementsL(aElementType, aValues, iListPointerPath[count-1]);
+ else if(aElementType==KXdmResourceList)
+ GetLeafElementsL(aElementType, aValues, iListPointerPath[count-1]);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RemoveElementL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::RemoveElementL(const TDesC& aElementType,
+ const TDesC& aData)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::RemoveElementL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S)"),
+ &aElementType, &aData);
+ TInt err(KErrNotFound);
+ TInt count = iListPointerPath.Count();
+ CXdmDocumentNode* myNode(NULL);
+
+ if(count)
+ {
+ if(aElementType==KXdmResourceList)
+ myNode = GetLeafChild(aElementType,aData,iListPointerPath[count-1]);
+ else if(IsNonLeafElementValid(aElementType))
+ myNode = GetNonLeafChild(aElementType,aData,iListPointerPath[count-1]);
+ else
+ err = KErrArgument;
+ }
+
+ if (myNode) // if found
+ {
+ iRLSDocument->RemoveFromModelL(myNode);
+ err = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: err(%d)" ), err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::IsElementExist()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CRLSXDM::IsElementExist(const TDesC& aElementType,
+ const TDesC& aData)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::IsElementExist" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S)"),
+ &aElementType, &aData);
+ TBool ret(EFalse);
+ TInt count = iListPointerPath.Count();
+ CXdmDocumentNode* myNode(NULL);
+
+ if(count)
+ {
+ if(aElementType==KXdmResourceList)
+ myNode = GetLeafChild(aElementType,aData,iListPointerPath[count-1]);
+ else if(IsNonLeafElementValid(aElementType))
+ myNode = GetNonLeafChild(aElementType,aData,iListPointerPath[count-1]);
+ }
+
+ if (myNode) // if found
+ {
+ ret = ETrue;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: err(%d)" ), ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::SwitchToServiceURI()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::SwitchToServiceURIL(const TDesC& aServiceURI)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::SwitchToServiceURI(%S)" ),&aServiceURI);
+ TInt err(KErrNotFound);
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ if (myRootNode==NULL)
+ return err;
+
+ CXdmDocumentNode* serviceUriNode = IsServiceUriExist( aServiceURI, myRootNode);
+ if (serviceUriNode==NULL)
+ return KErrNotFound;
+
+ iListPointerPath.Reset();
+ iListPath->Reset();
+
+ iListPointerPath.Append(serviceUriNode); // append pointer to node
+ iListPath->AppendL(aServiceURI); // append new list path
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::SwitchToList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::SwitchToListL(const TDesC& aListName)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::SwitchToList(%S)" ),&aListName);
+ TInt err(KErrNotFound);
+ TInt count = iListPointerPath.Count();
+ if (count)
+ {
+ CXdmDocumentNode* list = GetNonLeafChild(KXdmList,aListName,
+ iListPointerPath[count-1]);
+ if (list) // if found
+ {
+ iListPointerPath.Append(list); // append pointer to node
+ iListPath->AppendL(aListName); // append new list path
+ err = KErrNone;
+ }
+ }
+ OPENG_DP(D_OPENG_LIT( " returned: %d" ),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::SwitchOutFromList()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::SwitchOutFromList()
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::SwitchOutFromList" ));
+ TInt count = iListPath->Count();
+ if(count) // if some path exist
+ {
+ iListPath->Delete(count-1); // remove last list name
+ iListPointerPath.Remove(count-1); // remove last node pointer
+ OPENG_DP(D_OPENG_LIT( " switched out" ));
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetCurrentPathL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CRLSXDM::GetCurrentPathL(CDesCArray& aPath)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::GetCurrentPath" ));
+ aPath.Reset();
+ TInt count = iListPath->Count();
+ for (TInt i=0;i<count;i++)
+ {
+ aPath.AppendL(iListPath->MdcaPoint(i));
+ }
+ OPENG_DP(D_OPENG_LIT( " aPathCount = %d" ),aPath.Count());
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::SetCurrentpath()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRLSXDM::SetCurrentpathL(const MDesCArray& aLists)
+ {
+ OPENG_DP(D_OPENG_LIT( "CRLSXDM::SetCurrentpath" ));
+ CXdmDocumentNode* myRootNode = iRLSDocument->DocumentRoot();
+ if (myRootNode==NULL)
+ return KErrNotFound;
+
+ CXdmDocumentNode* serviceUriNode(NULL);
+
+ TInt count = aLists.MdcaCount();
+
+ if(count) // if there is atleast one element(service-uri) in path info
+ {
+ serviceUriNode = IsServiceUriExist( aLists.MdcaPoint(0), myRootNode);
+ if (serviceUriNode==NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( " service-uri doesnt exist:%d" ),KErrNotFound);
+ return KErrNotFound;
+ }
+ }
+
+ RPointerArray<CXdmDocumentNode> confirmedNodes;
+
+ CXdmDocumentNode* currentNode = serviceUriNode;
+ confirmedNodes.Append(currentNode);
+
+ if(count>1) // if some list(s) exist in path info
+ {
+ for (TInt i=1; i<count; i++)
+ {
+ currentNode = GetNonLeafChild(KXdmList, aLists.MdcaPoint(i),
+ currentNode);
+ if (currentNode==NULL)
+ {
+ confirmedNodes.Close();
+ OPENG_DP(D_OPENG_LIT( " path incorrect at i:%d" ),i);
+ return KErrNotFound;
+ }
+ confirmedNodes.Append(currentNode);
+ }
+ }
+
+ // since path is verified, update local path variables
+ OPENG_DP(D_OPENG_LIT( " pathFound" ));
+ iListPath->Reset();
+ iListPointerPath.Reset();
+ for (TInt j=0;j<count;j++)
+ {
+ iListPath->AppendL(aLists.MdcaPoint(j));
+ iListPointerPath.Append(confirmedNodes[j]);
+ }
+
+ confirmedNodes.Close();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::IsServiceUriExist()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CRLSXDM::IsServiceUriExist(const TDesC& uriAttr,
+ CXdmDocumentNode* aRootNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::IsServiceUriExist" ));
+ // Find all service nodes in this root
+ RPointerArray<CXdmDocumentNode> serviceNodes;
+ TInt err= aRootNode->Find( KXdmService, serviceNodes);
+ if (err != KErrNone) // return if no service nodes found
+ {
+ serviceNodes.Close();
+ return NULL;
+ }
+
+ TInt serviceNodesCounts = serviceNodes.Count();
+ CXdmDocumentNode* desiredNode(NULL);
+ // Go through all service nodes
+ for(TInt i=0; i<serviceNodesCounts;i++)
+ {
+ CXdmNodeAttribute* UriAttr = (serviceNodes[i])->Attribute(KXdmUri);
+ // if URI value is same
+ if (UriAttr->AttributeValue() == uriAttr)
+ {
+ desiredNode = serviceNodes[i];
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM: Found" ));
+ break;
+ }
+ }
+ serviceNodes.Close();
+ return desiredNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetNonLeafChild()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CRLSXDM::GetNonLeafChild(const TDesC& aChildName,
+ const TDesC& aAttrValue,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::GetNonLeafChild" ));
+ OPENG_DP(D_OPENG_LIT( " aChildName:%S, aAttrValue:%S"),
+ &aChildName, &aAttrValue);
+ CXdmDocumentNode* currentNode = aTargetNode;
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* desiredNode(NULL);
+ CXdmNodeAttribute* attr(NULL);
+ TBuf<KPresRLSElemAttrNameLen> attrName;
+
+ GetNonLeafElementAttrName(aChildName, attrName);
+
+ // Find all childs under currentNode
+ if ((currentNode->Find(aChildName, nodes)) == KErrNone)
+ { // go through all found childs
+ TInt givenChildCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " GetNonLeafChild: givenChildCountInNode = %d" ),
+ givenChildCountInNode);
+ for (TInt k=0;k<givenChildCountInNode;k++)
+ { // get the attribute
+ attr = (nodes[k])->Attribute(attrName);
+ // match it with given attr
+ if (attr->AttributeValue() == aAttrValue)
+ {
+ desiredNode = nodes[k];
+ break;
+ }
+ }
+ }
+ nodes.Close();
+ return desiredNode;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetLeafChild()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* CRLSXDM::GetLeafChild(const TDesC& aChildName,
+ const TDesC& aValue, CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::IsResListExist" ));
+ OPENG_DP(D_OPENG_LIT( " aChildName:%S, aValue:%S" ), &aChildName, &aValue);
+ CXdmDocumentNode* currentNode = aTargetNode;
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* desiredNode(NULL);
+ HBufC* nodeContents(NULL);
+
+ // Find all leaf children under currentNode
+ if ((currentNode->Find(aChildName, nodes)) == KErrNone)
+ { // go through all found children
+ TInt childCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " GetLeafChild: childCountInNode = %d" ),
+ childCountInNode);
+ for (TInt k=0;k<childCountInNode;k++)
+ { // get the leaf node content
+ nodeContents = CnvUtfConverter::ConvertToUnicodeFromUtf8L
+ ((nodes[k])->LeafNodeContent());
+ // match it with given contents
+ if (nodeContents->Des() == aValue)
+ {
+ desiredNode = nodes[k];
+ delete nodeContents;
+ break;
+ }
+ delete nodeContents;
+ }
+ }
+ nodes.Close();
+ return desiredNode;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::AddNonLeafElementL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::AddNonLeafElementL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::AddNonLeafElementL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S), aDisplayName(%S)"),
+ &aElementType,&aData,&aDisplayName);
+
+ TBuf<KPresRLSElemAttrNameLen> attrName;
+
+ GetNonLeafElementAttrName(aElementType, attrName);
+
+
+ CXdmDocumentNode* myNode = aTargetNode->CreateChileNodeL(aElementType);
+ CXdmNodeAttribute* myAttribute = myNode->CreateAttributeL(attrName);
+ myAttribute->SetAttributeValueL(aData);
+
+ if (aDisplayName!=KNullDesC) // if a display name is provided
+ {
+ CXdmDocumentNode* myDispName = myNode->CreateChileNodeL(KXdmDisplayName);
+ myDispName->SetLeafNode(ETrue);
+ myDispName->SetLeafNodeContentL(aDisplayName);
+ }
+ OPENG_DP(D_OPENG_LIT( " NonLeafElement added" ));
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::AddLeafElementL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::AddLeafElementL(const TDesC& aElementType, const TDesC& aData,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::AddLeafElementL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S), aData(%S)"),
+ &aElementType, &aData);
+
+ CXdmDocumentNode* myNode = aTargetNode->CreateChileNodeL(aElementType);
+ myNode->SetLeafNode(ETrue);
+ myNode->SetLeafNodeContentL(aData);
+ OPENG_DP(D_OPENG_LIT( " AddLeafElementL added" ));
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetDisplayNameInt()
+// ---------------------------------------------------------------------------
+//
+TInt CRLSXDM::GetDisplayNameInt(const TDesC& aElementType,
+ const TDesC& aData, TPtrC8& aDisplayName,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::GetDisplayName" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S),aData(%S)" )
+ ,&aElementType, &aData);
+
+ TInt err(KErrNotFound);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ TBuf<KPresRLSElemAttrNameLen> attrName;
+
+ GetNonLeafElementAttrName(aElementType, attrName);
+
+ CXdmDocumentNode* myNode = GetNonLeafChild(aElementType, aData,
+ aTargetNode);
+ if (myNode) // if found
+ {
+ // Find display name node
+ if ( (myNode->Find(KXdmDisplayName, nodes)) == KErrNone)
+ {
+ TInt nodeCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodeCountInNode(%d)" ),nodeCountInNode);
+ if(nodeCountInNode==1)// should be one node that of dispname
+ {
+ CXdmDocumentNode* dispNameNode = myNode->ChileNode(0);
+ dispNameNode->SetLeafNode(ETrue);
+ aDisplayName.Set(dispNameNode->LeafNodeContent());
+ err = KErrNone;
+ }
+ }
+ }
+
+ nodes.Close();
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::UpdateDisplayNameIntL()
+// ---------------------------------------------------------------------------
+//
+TInt CRLSXDM::UpdateDisplayNameIntL(const TDesC& aElementType,
+ const TDesC& aData, const TDesC& aDisplayName,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::UpdateDisplayNameL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S),aData(%S),aDisplayName(%S)" )
+ ,&aElementType,&aData, &aDisplayName);
+
+ TBuf<KPresRLSElemAttrNameLen> attrName;
+
+ GetNonLeafElementAttrName(aElementType, attrName);
+
+ CXdmDocumentNode* myNode = GetNonLeafChild(aElementType, aData, aTargetNode);
+ if (myNode==NULL) // if found
+ return KErrNotFound;
+
+
+ myNode->SetEmptyNode(ETrue); // delete all children from this
+ myNode->SetEmptyNode(EFalse);
+ CXdmDocumentNode* myDispName = myNode->CreateChileNodeL(KXdmDisplayName);
+ myDispName->SetLeafNode(ETrue);
+ myDispName->SetLeafNodeContentL(aDisplayName);
+ OPENG_DP(D_OPENG_LIT( " updated" ));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetNonLeafElementsL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::GetNonLeafElementsL(const TDesC& aElementType,
+ CDesCArray& aValues, CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::GetNonLeafElementsL" ));
+ OPENG_DP(D_OPENG_LIT( " aElementType(%S)"),&aElementType);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* attribute(NULL);
+
+ TBuf<KPresRLSElemAttrNameLen> attrName;
+ GetNonLeafElementAttrName(aElementType, attrName);
+
+ // Find all elements under currentNode
+ if ((aTargetNode->Find(aElementType, nodes)) == KErrNone)
+ { // go through all found nodes
+ TInt nodeCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodeCountInNode(%d)" ),nodeCountInNode);
+ for (TInt k=0;k<nodeCountInNode;k++)
+ { // get the aAttr attribute
+ attribute = (nodes[k])->Attribute(attrName);
+ // push it to given discriptor array
+ aValues.AppendL(attribute->AttributeValue());
+ }
+ }
+
+ nodes.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::GetLeafElementsL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::GetLeafElementsL(const TDesC& aElementType, CDesCArray& aValues,
+ CXdmDocumentNode* const aTargetNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::GetLeafElementsL(%S)" ), &aElementType);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ HBufC* nodeContents(NULL);
+
+ // Find all leaf children under currentNode
+ if ((aTargetNode->Find(aElementType, nodes)) == KErrNone)
+ { // go through all found children
+ TInt childCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " GetLeafElementsL: childCountInNode = %d" ),
+ childCountInNode);
+ for (TInt k=0;k<childCountInNode;k++)
+ { // get the leaf node content
+ nodeContents = CnvUtfConverter::ConvertToUnicodeFromUtf8L
+ ((nodes[k])->LeafNodeContent());
+ CleanupStack::PushL(nodeContents);
+ aValues.AppendL(nodeContents->Des());
+ CleanupStack::PopAndDestroy(nodeContents);
+ }
+ }
+ nodes.Close();
+ }
+
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::ValidateAndGetAttrName()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::GetNonLeafElementAttrName(const TDesC& aElementName,
+ TDes& aAttrName)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::ValidateAndGetAttrName" ));
+ OPENG_DP(D_OPENG_LIT( " aElementName:%S, aAttrName:%S" ),
+ &aElementName, &aAttrName);
+ if (aElementName == KPresList)
+ {
+ aAttrName.Copy(KXdmName);
+ }
+ else if (aElementName == KPresEntry)
+ {
+ aAttrName.Copy(KXdmUri);
+ }
+ else if (aElementName == KPresExternal)
+ {
+ aAttrName.Copy(KXdmAnchor);
+ }
+ else if (aElementName == KPresEntryRef)
+ {
+ aAttrName.Copy(KXdmRef);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::IsNonLeafElementValid()
+// ---------------------------------------------------------------------------
+//
+TBool CRLSXDM::IsNonLeafElementValid(const TDesC& aElementName)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::IsNonLeafElementValid" ));
+ OPENG_DP(D_OPENG_LIT( " aElementName:%S"), &aElementName);
+ TBool err(EFalse);
+
+ if ( (aElementName == KPresList)||(aElementName == KPresEntry)||
+ (aElementName == KPresExternal)||(aElementName == KPresEntryRef))
+ err = ETrue;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d" ), err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::AddPackageL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::AddPackageL()
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::AddPackage()" ));
+ RPointerArray<CXdmDocumentNode> nodes;
+ TInt count = iListPointerPath.Count();
+ if (count)
+ {
+ // now add the packages
+ CXdmDocumentNode* packagesNode = iListPointerPath[0]->CreateChileNodeL(KXdmPackages);
+ CXdmDocumentNode* packageNode = packagesNode->CreateChileNodeL(KXdmPackage);
+ packageNode->SetLeafNode(ETrue);
+ packageNode->SetLeafNodeContentL(KXdmPresence);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RemovePackageL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::RemovePackageL()
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::RemovePackage()" ));
+ RPointerArray<CXdmDocumentNode> nodes;
+ TInt count = iListPointerPath.Count();
+ if (count)
+ {
+ if (((iListPointerPath[0])->Find(KXdmPackages, nodes)) == KErrNone)
+ {
+ TInt nodeCount = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " RemovePackage: nodeCount = %d" ), nodeCount);
+ if(nodeCount) //if package found
+ {
+ iRLSDocument->RemoveFromModelL(nodes[0]);
+ OPENG_DP(D_OPENG_LIT( " removed" ));
+ }
+ }
+ }
+ nodes.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DeleteEmptyListsL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::DeleteEmptyListsL()
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::DeleteEmptyLists" ));
+ RPointerArray<CXdmDocumentNode> listNodes;
+
+ TInt found = iRLSDocument->Find( KXdmList, listNodes);
+ OPENG_DP(D_OPENG_LIT( " total Uris: %d" ), found);
+ for (TInt i=0;i<found;i++)
+ {
+ if ( ((listNodes[i])->NodeCount()) < 2)// one child can be of display-name
+ // otherwise list is empty
+ {
+ if ( ((listNodes[i])->NodeCount()) == 1) // if possibly disp-name present
+ {
+ if (((listNodes[i])->ChileNode(0)->NodeName()) != KXdmDisplayName)
+ continue; // if the one found node is not display name
+ // then the list is not empty
+ }
+ iRLSDocument->RemoveFromModelL(listNodes[i]);
+ OPENG_DP(D_OPENG_LIT( " delete at i = %d" ), i);
+ listNodes.Close();
+ return; // we are deleting one by one because we dont know
+ // the hirarchy
+ }
+ }
+ listNodes.Close();
+ iAsyncReq = ERLSXDMDeletedEmptyLists;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::DoCancel()
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::DoCancel" ));
+ iXDMEngine->CancelUpdate(iRLSDocument);
+ iAsyncReq = ERLSXDMRequestCancelling;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RunL()
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::RunL()
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::RunL" ));
+ OPENG_DP(D_OPENG_LIT( " RunL iAsyncReq(%d), iStatus(%d)" ),iAsyncReq,
+ iStatus.Int());
+
+ TRequestStatus* status = &iStatus;
+ TInt origStatus = iStatus.Int();
+
+ switch (iAsyncReq)
+ {
+ case ERLSXDMUpdateToServer:
+
+ if ( origStatus == KXcapErrorHttpConflict )
+ {
+ TRAP_IGNORE( DoParseNegotiatedServiceUriL( iRLSDocument->ErrorRoot() ));
+ }
+ else
+ {
+ delete iNegotiatedServiceUri;
+ iNegotiatedServiceUri = NULL;
+ }
+
+ iAsyncReq = ERLSXDMNoRequestMade;
+ TRAP_IGNORE( iAsyncHandler->HandleRLSUpdateDocumentL( origStatus ));
+ break;
+ case ERLSXDMUpdateFromServer:
+ CreateRootIfNeededL();
+ iAsyncReq = ERLSXDMNoRequestMade;
+ if( origStatus == KXcapErrorHttpNotFound) // if doc not on server
+ {
+ TRAP_IGNORE (iAsyncHandler->HandleRLSUpdateDocumentL(KErrNotFound));
+ }
+ else
+ {
+ TRAP_IGNORE( iAsyncHandler->HandleRLSUpdateDocumentL( origStatus ));
+ }
+ break;
+
+ case ERLSXDMDeletingEmptyLists:
+ DeleteEmptyListsL();
+ User::RequestComplete(status,KErrNone);
+ SetActive();
+ break;
+
+ case ERLSXDMDeletedEmptyLists:
+ iAsyncReq = ERLSXDMNoRequestMade;
+ TRAP_IGNORE( iAsyncHandler->HandleRLSDeleteAllEmptyListsL( origStatus ));
+ break;
+
+ case ERLSXDMRequestCancelling:
+ iAsyncReq = ERLSXDMNoRequestMade;
+ TRAP_IGNORE( iAsyncHandler->HandleRLSUpdateCancelL( origStatus ));
+ break;
+
+ case ERLSXDMNoRequestMade:
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::RunError()
+// ---------------------------------------------------------------------------
+//
+TInt CRLSXDM::RunError(TInt aError)
+ {
+ OPENG_DP(D_OPENG_LIT( " CRLSXDM::RunError" ));
+ OPENG_DP(D_OPENG_LIT( " RunError iAsyncReq(%d), aError(%d)" ),iAsyncReq,
+ aError);
+ // A show must go on, we coomplete the failed current client request.
+ TRequestStatus* status = &iStatus;
+ iAsyncReq = ERLSXDMNoRequestMade;
+ User::RequestComplete( status, aError );
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::NegotiatedServiceUri()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPtrC CRLSXDM::NegotiatedServiceUri()
+ {
+ return iNegotiatedServiceUri ? iNegotiatedServiceUri->Des() : TPtrC();
+ }
+
+// ---------------------------------------------------------------------------
+// CRLSXDM::DoParseNegotiatedServiceUriL
+// ---------------------------------------------------------------------------
+//
+void CRLSXDM::DoParseNegotiatedServiceUriL( CXdmDocumentNode* aErrorBody )
+ {
+ _LIT( KMyXcapError, "xcap-error");
+ _LIT( KMyUniquenessFailure, "uniqueness-failure");
+ _LIT( KMyExists, "exists");
+ _LIT( KMyField, "field");
+ _LIT( KMyAltValue, "alt-value");
+
+ delete iNegotiatedServiceUri;
+ iNegotiatedServiceUri = NULL;
+
+ if ( !aErrorBody )
+ {
+ return;
+ }
+
+ // Parse the content
+ // For example
+ // ------------
+ /*
+ <?xml version="1.0" encoding="UTF-8"?>
+ <xcap-error xmlns="urn:oma:xml:xdm:xcap-error">
+ <uniqueness-failure>
+ <exists field="rls-services/service%5b1%5d/@uri">
+ <alt-value>sip:tu30@poc.nokia.com;omapresencer1rls=5425</alt-value>
+ </exists>
+ </uniqueness-failure>
+ </xcap-error>
+ // ------------
+ */
+
+ if ( aErrorBody->NodeName().Compare( KMyXcapError ))
+ {
+ return;
+ }
+
+ RPointerArray<CXdmDocumentNode> resultArray;
+ CleanupClosePushL( resultArray ); // <<< resultArray
+
+ CXdmDocumentNode* currNode = aErrorBody;
+ resultArray.Reset();
+
+ resultArray.Reset();
+ currNode->Find( KMyUniquenessFailure, resultArray );
+ if ( resultArray.Count() > 0)
+ {
+ currNode = resultArray[0];
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ resultArray.Reset();
+ currNode->Find( KMyExists, resultArray );
+ if ( resultArray.Count() > 0)
+ {
+ currNode = resultArray[0];
+ if ( !(currNode->HasAttribute( KMyField ) ))
+ {
+ // notice: We do not check the content of "field" attribute,
+ // we trust that it is ok and refers to the last modified data.
+ User::Leave( KErrNotFound );
+ }
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ resultArray.Reset();
+ currNode->Find( KMyAltValue, resultArray );
+ if ( resultArray.Count() > 0)
+ {
+ currNode = resultArray[0];
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ TPtrC8 pCon = currNode->LeafNodeContent();
+
+ // Convert <alt-value> value to Unicode.
+ iNegotiatedServiceUri = CnvUtfConverter::ConvertToUnicodeFromUtf8L( pCon );
+
+ CleanupStack::PopAndDestroy( &resultArray ); // >>> resultArray
+
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/prescondidentitymany.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents 'many' identity
+* part of a Presence Condition in a rule
+*
+*/
+
+
+
+
+// Includes
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+#include <utf.h>
+
+#include "prescondidentitymany.h"
+#include "cpresencexdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::TPresCondIdentityMany()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresCondIdentityMany::TPresCondIdentityMany(): iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::TPresCondIdentityMany()" ));
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondIdentityMany::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::Init(%d)" ), aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::AddManyIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::AddManyIdentityL(const TDesC& aRuleID,
+ const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddManyIdentityL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
+
+ TInt err(KErrAlreadyExists);
+
+ if(!(IsManyExistsL(aRuleID,aDomain)))
+ {
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, ETrue, aDomain);
+ if(manyNode==NULL)
+ err = KErrNotFound;
+ else
+ err = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::IsManyExistsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondIdentityMany::IsManyExistsL(const TDesC& aRuleID,
+ const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::IsManyExists()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
+
+ TBool ret(ETrue);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode==NULL)
+ ret = EFalse;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::RemoveManyIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::RemoveManyIdentityL(const TDesC& aRuleID,
+ const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::RemoveManyIdentityL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( " Removed"));
+ iPresXDM->RemoveFromModelL(manyNode);
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::GetManyIdentityElementsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::GetManyIdentityElementsL(const TDesC& aRuleID,
+ CDesCArray& aDomains)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetManyIdentityElementsL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S" ),&aRuleID);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return 0;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* domainAttr(NULL);
+
+ // finding 'many' nodes
+ TInt err = identityNode->Find(KXdmMany, nodes);
+
+ // extracting entities from id nodes
+ TInt manyCountInNode = nodes.Count();
+
+ OPENG_DP(D_OPENG_LIT( " manyCountInNode = %d" ),manyCountInNode);
+
+ for (TInt i=0;i<manyCountInNode;i++)
+ { // get the domain attribute
+ domainAttr = (nodes[i])->Attribute(KXdmDomain);
+ if(domainAttr)
+ // push it to given discriptor array
+ aDomains.AppendL(domainAttr->AttributeValue());
+ }
+
+ nodes.Close();
+ return manyCountInNode;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::AddIdentityInManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::AddIdentityInManyExceptL(const TDesC& aRuleID,
+ const TDesC& aId, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddIdentityInManyExceptL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S,aId:%S"),
+ &aRuleID, &aDomain, &aId);
+
+ TInt ret(KErrAlreadyExists);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* exceptNode(NULL);
+ CXdmNodeAttribute* idattr(NULL);
+
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ // if id doesnt exists in except
+ if (!(IsIdentityExistsInManyExceptL(aRuleID, aId, aDomain)))
+ {
+ exceptNode = manyNode->CreateChileNodeL(KXdmExcept);
+ idattr = exceptNode->CreateAttributeL(KXdmId);
+ idattr->SetAttributeValueL(aId);
+ ret = KErrNone;
+ }
+ }
+ else
+ ret = KErrNotFound;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::AddIdentitiesInManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::AddIdentitiesInManyExceptL(const TDesC& aRuleID,
+ const CDesCArray& aIds, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddIdentitiesInManyExceptL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S"),
+ &aRuleID, &aDomain);
+
+ TInt ret(KErrNotFound);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* exceptNode(NULL);
+ CXdmNodeAttribute* idattr(NULL);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ TInt entitiesCount = aIds.MdcaCount();
+ if(manyNode!=NULL)
+ {
+ for (TInt i = 0; i<entitiesCount; i++)
+ {
+ // if id doesnt exists in except
+ if (!(IsIdentityExistsInManyExceptL(aRuleID, aIds.MdcaPoint(i), aDomain)))
+ {
+ exceptNode = manyNode->CreateChileNodeL(KXdmExcept);
+ idattr = exceptNode->CreateAttributeL(KXdmId);
+ idattr->SetAttributeValueL(aIds.MdcaPoint(i));
+ ret = KErrNone;
+ }
+ }
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::GetIdentitiesFromManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::GetIdentitiesFromManyExceptL(const TDesC& aRuleID,
+ CDesCArray& aIds, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetIdentitiesFromManyExceptL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S"),&aRuleID, &aDomain);
+
+ TInt ret(KErrNotFound);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* attrId(NULL);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ TInt err = manyNode->Find(KXdmExcept, nodes);
+ TInt exceptNodeCount = nodes.Count();
+
+ // go through all 'except' nodes
+ for(TInt i=0;i<exceptNodeCount;i++)
+ {
+ attrId = (nodes[i])->Attribute(KXdmId);
+
+ // for now we are supposing that except has only 1 id
+ if(attrId!=NULL)
+ {
+ aIds.AppendL(attrId->AttributeValue());
+ }
+ attrId = NULL;
+ }
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::RemoveIdentityFromManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::RemoveIdentityFromManyExceptL(
+ const TDesC& aRuleID, const TDesC& aId, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::RemoveIdentityFromManyExceptL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S,aId:%S"),
+ &aRuleID, &aDomain, &aId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* attrId(NULL);
+
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ TInt err = manyNode->Find(KXdmExcept, nodes);
+ TInt exceptNodeCount = nodes.Count();
+
+ //go through all except nodes
+ for (TInt i=0;i<exceptNodeCount;i++)
+ {
+ attrId = (nodes[i])->Attribute(KXdmId);
+
+ // for now we are supposing that except has only 1 id
+ if(attrId!=NULL)
+ {
+ if (aId==(attrId->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL: i=%d" ),i);
+ iPresXDM->RemoveFromModelL(attrId);
+
+ //if except node is empty after this
+ if( (nodes[i])->AttributeCount() == 0)
+ {
+ // remove except node also
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ }
+ ret = KErrNone;
+ break;
+ }
+ }
+ attrId = NULL;
+ }
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ nodes.Close();
+ return ret;
+ }
+
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL(
+ const TDesC& aRuleID, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S"),&aRuleID, &aDomain);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* attrId(NULL);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ TInt err = manyNode->Find(KXdmExcept, nodes);
+ TInt exceptNodeCount = nodes.Count();
+
+ //go through all except nodes
+ for (TInt i=0;i<exceptNodeCount;i++)
+ {
+ attrId = (nodes[i])->Attribute(KXdmId);
+
+ // for now we are supposing that except has only 1 id
+ if(attrId!=NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL: i=%d" ),i);
+ iPresXDM->RemoveFromModelL(attrId);
+
+ //if except node is empty after this
+ if( (nodes[i])->AttributeCount() == 0)
+ {
+ // remove except node also
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ }
+ }
+ attrId = NULL;
+ }
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::IsIdentityExistsInManyExceptL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondIdentityMany::IsIdentityExistsInManyExceptL(const TDesC& aRuleID,
+ const TDesC& aId, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::IsIdentityExistsInManyExcept()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID:%S,aDomain:%S,aId:%S"),
+ &aRuleID, &aDomain, &aId);
+
+ TBool ret(EFalse);
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* attrId(NULL);
+
+ CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
+ if(manyNode!=NULL)
+ {
+ TInt err = manyNode->Find(KXdmExcept, nodes);
+ TInt exceptNodeCount = nodes.Count();
+
+ //go through all except nodes
+ for (TInt i=0;i<exceptNodeCount;i++)
+ {
+ attrId = (nodes[i])->Attribute(KXdmId);
+
+ // for now we are supposing that except has only 1 id
+ if(attrId!=NULL)
+ {
+ if (aId==(attrId->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " Found: i=%d" ),i);
+ ret = ETrue;
+ break;
+ }
+ }
+ attrId = NULL;
+ }
+ }
+
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::GetManyNodeL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* TPresCondIdentityMany::GetManyNodeL(const TDesC& aRuleID,
+ TBool aCreate, const TDesC& aDomain)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondIdentityMany::GetManyNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " GetManyNodeL aRuleID:%S, aDomain:%S, aCreate:%d"),
+ &aRuleID, &aDomain, aCreate);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, aCreate);
+ if (identityNode==NULL)
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* manyNode(NULL);
+ CXdmNodeAttribute* domainNameAttr(NULL);
+
+ // Finding many node
+ identityNode->Find(KXdmMany, nodes);
+ TInt manyNodesCount = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " manyNodesCount = %d"), manyNodesCount);
+ TBool found(EFalse);
+ if(manyNodesCount) // if some nodes exists
+ {
+ for (TInt i=0;i<manyNodesCount;i++)
+ {
+ domainNameAttr = (nodes[i])->Attribute(KXdmDomain);
+ // for the case when no domain specified
+ if (aDomain==KNullDesC)
+ {
+ if(domainNameAttr == NULL)
+ {
+ found = ETrue;
+ manyNode = nodes[i];
+ break;
+ }
+ }
+ // for the case when domain is specified
+ else if(domainNameAttr!=NULL)
+ {
+ if( (domainNameAttr->AttributeValue()) == aDomain)
+ {
+ found = ETrue;
+ manyNode = nodes[i];
+ break;
+ }
+ }
+ }
+ }
+
+ if (aCreate && (!found)) // if asked to create and still doesnt found
+ {
+ manyNode = identityNode->CreateChileNodeL(KXdmMany);
+ if(aDomain!=KNullDesC)
+ {
+ domainNameAttr = manyNode->CreateAttributeL(KXdmDomain);
+ domainNameAttr->SetAttributeValueL(aDomain);
+ }
+ }
+
+ nodes.Close();
+ return manyNode;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityMany::IsEntityExistInNodeArray()
+// ---------------------------------------------------------------------------
+//
+TBool TPresCondIdentityMany::IsEntityExistInNodeArray(
+ const RPointerArray<CXdmDocumentNode>& nodes,
+ const TDesC& aId)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondIdentityMany::IsEntityExistInNodeArray()" ) );
+ OPENG_DP(D_OPENG_LIT( " IsEntityExistInNodeArray aId = %S"), &aId);
+
+ TInt idsCountInNode = nodes.Count();
+ CXdmNodeAttribute* idAttr(NULL);
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmEntity);
+ if (aId==(idAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " IsEntityExistInNodeArray True"));
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/prescondidentityone.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,362 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents 'one' identity part
+* of a Presence Condition in a rule
+*
+*/
+
+
+
+
+// Includes
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+#include <utf.h>
+
+#include "prescondidentityone.h"
+#include "cpresencexdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::TPresCondIdentityOne()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresCondIdentityOne::TPresCondIdentityOne(): iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::TPresCondIdentityOne()" ));
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondIdentityOne::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::Init(%d)" ), aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::AddIdentitiesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityOne::AddIdentitiesL(const TDesC& aRuleID,
+ const MDesCArray& aIds)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::AddIdentitiesL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aIdsCount = %d" ),&aRuleID,
+ aIds.MdcaCount() );
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, ETrue);
+ if(identityNode==NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( " return: KErrNotFound" ));
+ return KErrNotFound;
+ }
+
+ CXdmDocumentNode* oneNode(NULL);
+ CXdmNodeAttribute* idAttr(NULL);
+ RPointerArray<CXdmDocumentNode> nodes;
+
+ // finding 'one' nodes
+ TInt err = identityNode->Find(KXdmOne, nodes);
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),nodes.Count());
+
+ // putting ids to identity node
+ TInt entitiesCount = aIds.MdcaCount();
+ for(TInt i=0;i<entitiesCount;i++)
+ {
+ // find whether its already exist
+ if(IsIdExistInNodeArray(nodes, aIds.MdcaPoint(i)) )
+ continue;
+ oneNode = identityNode->CreateChileNodeL(KXdmOne);
+ idAttr = oneNode->CreateAttributeL(KXdmId);
+ idAttr->SetAttributeValueL(aIds.MdcaPoint(i));
+ }
+
+ nodes.Close();
+ OPENG_DP(D_OPENG_LIT( " return: KErrNone" ));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::GetIdentitiesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondIdentityOne::GetIdentitiesL(const TDesC& aRuleID,
+ CDesCArray& aIds)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::GetIdentitiesL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S" ),&aRuleID);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* idAttr(NULL);
+
+ // finding 'one' nodes
+ TInt err = identityNode->Find(KXdmOne, nodes);
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),nodes.Count());
+
+ // extracting ids from ones nodes
+ TInt idsCountInNode = nodes.Count();
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmId);
+ // push it to given discriptor array
+ aIds.AppendL(idAttr->AttributeValue());
+ }
+
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::DeleteIdentitiesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondIdentityOne::DeleteIdentitiesL(const TDesC& aRuleID,
+ const MDesCArray& aIds)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::DeleteIdentitiesL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aIdsCount = %d" ),&aRuleID,
+ aIds.MdcaCount() );
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* idAttr(NULL);
+
+ // finding 'one' nodes
+ TInt err = identityNode->Find(KXdmOne, nodes);
+
+ // extracting ids from ones nodes
+ TInt idsCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),idsCountInNode);
+
+ TInt entitiesCount = aIds.MdcaCount();
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmId);
+ // match it with all given entries
+ for (TInt j=0;j<entitiesCount ; j++)
+ {
+ if ((aIds.MdcaPoint(j))==(idAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL i=%d,j=%d" ),i,j);
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ break;
+ }
+ }
+ }
+
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::DeleteAllIdentitiesL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondIdentityOne::DeleteAllIdentitiesL(const TDesC& aRuleID)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::DeleteAllIdentitiesL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+
+ // finding 'one' nodes
+ TInt err = identityNode->Find(KXdmOne, nodes);
+
+ // extracting ids from ones nodes
+ TInt idsCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),idsCountInNode);
+
+ for (TInt i=0;i<idsCountInNode;i++)
+ {
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ }
+
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::AddIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityOne::AddIdentityL(const TDesC& aRuleID,
+ const TDesC& aId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::AddIdentityL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aId = %S"),&aRuleID, &aId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, ETrue);
+ if(identityNode==NULL)
+ return KErrNotFound;
+
+ if(IsIdentityExistL(aRuleID,aId))
+ return KErrAlreadyExists;
+
+ CXdmDocumentNode* oneNode(NULL);
+ CXdmNodeAttribute* idAttr(NULL);
+
+ oneNode = identityNode->CreateChileNodeL(KXdmOne);
+ idAttr = oneNode->CreateAttributeL(KXdmId);
+ idAttr->SetAttributeValueL(aId);
+
+ OPENG_DP(D_OPENG_LIT( " return: KErrNone"));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::DeleteIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondIdentityOne::DeleteIdentityL(const TDesC& aRuleID,
+ const TDesC& aId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::DeleteIdentityL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aId = %S"),&aRuleID, &aId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return ret;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* idAttr(NULL);
+
+ // finding 'one' nodes
+ if ( (identityNode->Find(KXdmOne, nodes))==KErrNone)
+ {
+ // extracting ids from ones nodes
+ TInt idsCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),idsCountInNode);
+
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmId);
+ if (aId==(idAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL: i=%d" ),i);
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ ret = KErrNone;
+ break;
+ }
+ }
+ }
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::IsIdentityExistL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondIdentityOne::IsIdentityExistL(const TDesC& aRuleID,
+ const TDesC& aId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondIdentityOne::IsIdentityExist()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aId = %S"),&aRuleID, &aId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID,
+ KXdmIdentity, EFalse);
+ if(identityNode==NULL)
+ return EFalse;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* idAttr(NULL);
+
+ // finding 'one' nodes
+ TInt err = identityNode->Find(KXdmOne, nodes);
+
+ // extracting ids from ones nodes
+ TInt idsCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),idsCountInNode);
+
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmId);
+ if (aId==(idAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " ETrue"));
+ nodes.Close();
+ return ETrue;
+ }
+ }
+
+ nodes.Close();
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondIdentityOne::IsIdExistInNodeArray()
+// ---------------------------------------------------------------------------
+//
+TBool TPresCondIdentityOne::IsIdExistInNodeArray(
+ const RPointerArray<CXdmDocumentNode>& nodes,
+ const TDesC& aId)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondIdentityOne::IsIdExistInNodeArray()" ) );
+ OPENG_DP(D_OPENG_LIT( " IsIdExistInNodeArray aId = %S"), &aId);
+
+ TInt idsCountInNode = nodes.Count();
+ CXdmNodeAttribute* idAttr(NULL);
+ for (TInt i=0;i<idsCountInNode;i++)
+ { // get the id attribute
+ idAttr = (nodes[i])->Attribute(KXdmId);
+ if (aId==(idAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " IsIdExistInNodeArray True"));
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/prescondmisc.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,420 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents those parts of
+* presence identity which are not present in any other class.
+*
+*/
+
+
+
+
+// Includes
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+#include <utf.h>
+
+#include "prescondmisc.h"
+#include "cpresencexdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::TPresCondMisc()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresCondMisc::TPresCondMisc(): iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::TPresCondMisc()" ));
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondMisc::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::Init(%d)" ), aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::AddOtherIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::AddOtherIdentityL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::AddOtherIdentityL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* otherIdentityNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmOtherIdentity, ETrue);
+ if(otherIdentityNode)
+ ret = KErrNone;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::IsOtherIdentityExistL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondMisc::IsOtherIdentityExistL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::IsOtherIdentityExistL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TBool ret(EFalse);
+
+ CXdmDocumentNode* otherIdentityNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmOtherIdentity, EFalse);
+ if(otherIdentityNode)
+ ret = ETrue;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::RemoveOtherIdentityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::RemoveOtherIdentityL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::RemoveOtherIdentityL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* otherIdentityNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmOtherIdentity,EFalse);
+ if(otherIdentityNode)
+ {
+ iPresXDM->RemoveFromModelL(otherIdentityNode);
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::AddAnonymousRequestL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::AddAnonymousRequestL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::AddAnonymousRequestL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* anonymousReqNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmAnonymousRequest, ETrue);
+ if(anonymousReqNode)
+ ret = KErrNone;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::IsAnonymousRequestExistL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondMisc::IsAnonymousRequestExistL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::IsAnonymousRequestExistL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TBool ret(EFalse);
+
+ CXdmDocumentNode* anonymousReqNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmAnonymousRequest, EFalse);
+ if(anonymousReqNode)
+ ret = ETrue;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::RemoveAnonymousRequestL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::RemoveAnonymousRequestL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::RemoveAnonymousRequestL(%S)"), &aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* anonymousReqNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmAnonymousRequest,EFalse);
+ if(anonymousReqNode)
+ {
+ iPresXDM->RemoveFromModelL(anonymousReqNode);
+ ret = KErrNone;
+ }
+
+ OPENG_DP(D_OPENG_LIT( " return: %d"),ret);
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::AddExternListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::AddExternListL(const TDesC& aRuleId,
+ const TDesC& aUri)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::AddExternListL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aUri = %S"),&aRuleId, &aUri);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, ETrue);
+ if(extListNode==NULL)
+ return KErrNotFound;
+
+ if(IsExternListExistL(aRuleId,aUri))
+ return KErrAlreadyExists;
+
+ CXdmDocumentNode* entryNode(NULL);
+ CXdmNodeAttribute* ancAttr(NULL);
+
+ entryNode = extListNode->CreateChileNodeL(KXdmEntry);
+ ancAttr = entryNode->CreateAttributeL(KXdmAnc);
+ ancAttr->SetAttributeValueL(aUri);
+
+ OPENG_DP(D_OPENG_LIT( " return: KErrNone"));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::IsExternListExistL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondMisc::IsExternListExistL(const TDesC& aRuleId,
+ const TDesC& aUri)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::IsExternListExistL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aUri = %S"),&aRuleId, &aUri);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, EFalse);
+ if(extListNode==NULL)
+ return EFalse;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* ancAttr(NULL);
+
+ // finding entry nodes
+ TInt err = extListNode->Find(KXdmEntry, nodes);
+
+ // extracting lists from entry nodes
+ TInt entriesCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),entriesCountInNode);
+
+ for (TInt i=0;i<entriesCountInNode;i++)
+ { // get the anc attribute
+ ancAttr = (nodes[i])->Attribute(KXdmAnc);
+ if (aUri==(ancAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " ETrue"));
+ nodes.Close();
+ return ETrue;
+ }
+ }
+
+ nodes.Close();
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::GetExternalListsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondMisc::GetExternalListsL(const TDesC& aRuleId,
+ CDesCArray& aUris)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::GetExternalListsL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S" ),&aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, EFalse);
+ if(extListNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* ancAttr(NULL);
+
+ // finding entry nodes
+ TInt err = extListNode->Find(KXdmEntry, nodes);
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),nodes.Count());
+
+ // extracting lists from entry nodes
+ TInt entriesCountInNode = nodes.Count();
+ for (TInt i=0;i<entriesCountInNode;i++)
+ { // get the anc attribute
+ ancAttr = (nodes[i])->Attribute(KXdmAnc);
+ // push it to given discriptor array
+ aUris.AppendL(ancAttr->AttributeValue());
+ }
+
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::DeleteExternalListL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondMisc::DeleteExternalListL(const TDesC& aRuleId,
+ const TDesC& aUri)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::DeleteExternalListL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aUri = %S"),&aRuleId, &aUri);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt ret(KErrNotFound);
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, EFalse);
+ if(extListNode==NULL)
+ return ret;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* ancAttr(NULL);
+
+ // finding entry nodes
+ if ( (extListNode->Find(KXdmEntry, nodes))==KErrNone)
+ {
+ // extracting lists from entry nodes
+ TInt entriesCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),entriesCountInNode);
+
+ for (TInt i=0;i<entriesCountInNode;i++)
+ { // get the anc attribute
+ ancAttr = (nodes[i])->Attribute(KXdmAnc);
+ if (aUri==(ancAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL: i=%d" ),i);
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ ret = KErrNone;
+ break;
+ }
+ }
+ }
+ nodes.Close();
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::DeleteAllExternalListsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondMisc::DeleteAllExternalListsL(const TDesC& aRuleId)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::DeleteAllExternalListsL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S"),&aRuleId);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, EFalse);
+ if(extListNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+
+ // finding entry nodes
+ TInt err = extListNode->Find(KXdmEntry, nodes);
+
+ // extracting lists from entry nodes
+ TInt entriesCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),entriesCountInNode);
+
+ for (TInt i=0;i<entriesCountInNode;i++)
+ {
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ }
+
+ nodes.Close();
+ return;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondMisc::DeleteAllExternalListsL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondMisc::DeleteExternalListsL(const TDesC& aRuleId,
+ const MDesCArray& aUris)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondMisc::DeleteExternalListsL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleId = %S, aUrisCount = %d" ),&aRuleId,
+ aUris.MdcaCount() );
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* extListNode = iPresXDM->GetConditionChildNodeL(aRuleId,
+ KXdmExternalList, EFalse);
+ if(extListNode==NULL)
+ return;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmNodeAttribute* ancAttr(NULL);
+
+ // finding entry nodes
+ TInt err = extListNode->Find(KXdmEntry, nodes);
+
+ // extracting lists from entry nodes
+ TInt entriesCountInNode = nodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),entriesCountInNode);
+
+ TInt entitiesCount = aUris.MdcaCount();
+ for (TInt i=0;i<entriesCountInNode;i++)
+ { // get the anc attribute
+ ancAttr = (nodes[i])->Attribute(KXdmAnc);
+ // match it with all given entries
+ for (TInt j=0;j<entitiesCount ; j++)
+ {
+ if ((aUris.MdcaPoint(j))==(ancAttr->AttributeValue()))
+ {
+ OPENG_DP(D_OPENG_LIT( " RemoveFromModelL i=%d,j=%d" ),i,j);
+ iPresXDM->RemoveFromModelL(nodes[i]);
+ break;
+ }
+ }
+ }
+
+ nodes.Close();
+ return;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/prescondsphere.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents sphere in a
+* Presence Condition
+*
+*/
+
+
+
+
+// Includes
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+#include <utf.h>
+
+#include "prescondsphere.h"
+#include "cpresencexdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::TPresCondSphere()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresCondSphere::TPresCondSphere(): iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondSphere::TPresCondSphere()" ));
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondSphere::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondSphere::Init(%d)" ), aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::AddOrReplaceSphereL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondSphere::AddOrReplaceSphereL(const TDesC& aRuleID,
+ const TDesC& aSphere)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondSphere::AddOrReplaceSphereL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aSphere = %S"),&aRuleID, &aSphere);
+
+ CXdmDocumentNode* sphereNode = GetSphereNodeL(aRuleID, ETrue);
+ if(sphereNode==NULL)
+ return KErrNotFound;
+
+ CXdmNodeAttribute* valueAttr(NULL);
+ valueAttr = sphereNode->Attribute(KXdmValue);
+ // if Value attribute is not found
+ if (valueAttr==NULL)
+ {
+ valueAttr = sphereNode->CreateAttributeL(KXdmValue);
+ }
+
+ valueAttr->SetAttributeValueL(aSphere);
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::GetSphereL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondSphere::GetSphereL(const TDesC& aRuleID,
+ TPtrC& aSphere)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondSphere::GetSphere()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+
+ CXdmDocumentNode* sphereNode = GetSphereNodeL(aRuleID, EFalse);
+ if(sphereNode==NULL)
+ return KErrNotFound;
+
+ CXdmNodeAttribute* valueAttr = sphereNode->Attribute(KXdmValue);
+
+ if(valueAttr)
+ {
+ aSphere.Set(valueAttr->AttributeValue());
+ return KErrNone;
+ }
+
+ return KErrNotFound;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::DeleteSphereL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondSphere::DeleteSphereL(const TDesC& aRuleID)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondSphere::DeleteSphereL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* sphereNode = GetSphereNodeL(aRuleID, EFalse);
+ if(sphereNode==NULL)
+ return KErrNotFound;
+
+ iPresXDM->RemoveFromModelL(sphereNode);
+
+ OPENG_DP(D_OPENG_LIT( " removed"));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondSphere::GetSphereNode()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* TPresCondSphere::GetSphereNodeL(const TDesC& aRuleID,
+ TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondSphere::GetSphereNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " GetSphereNodeL aRuleID = %S, aCreate = %d"),
+ &aRuleID, aCreate);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* conditionNode = iPresXDM->GetRuleChildNodeL(aRuleID,
+ KXdmConditions, aCreate);
+ if (conditionNode==NULL)
+ return conditionNode;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* sphereNode(NULL);
+
+ // Finding sphere node
+ conditionNode->Find(KXdmSphere, nodes);
+ OPENG_DP(D_OPENG_LIT( " GetSphereNodeL nodeCount = %d"),nodes.Count());
+ if(nodes.Count()) // if identity node exist
+ {
+ sphereNode = nodes[0]; // only one sphere node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ sphereNode = conditionNode->CreateChileNodeL(KXdmSphere);
+ }
+
+ nodes.Close();
+ return sphereNode;
+ }
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/prescondvalidity.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,465 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents validity part of
+* a Presence Condition
+*
+*/
+
+
+
+
+// Includes
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+#include <utf.h>
+
+#include "prescondvalidity.h"
+#include "cpresencexdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::TPresCondValidity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresCondValidity::TPresCondValidity(): iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::TPresCondValidity()" ));
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresCondValidity::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::Init(%d)" ), aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::GetValidity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondValidity::GetValidityL(const TDesC& aRuleID,
+ RArray<TTimePeriod>& aValidTimes)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::GetValidity()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+
+ CXdmDocumentNode* validityNode = GetValidityNodeL(aRuleID, EFalse);
+ if(validityNode==NULL)
+ return KErrNotFound;
+
+ TInt nodeCount = validityNode->NodeCount();
+ OPENG_DP(D_OPENG_LIT( " validityNode->NodeCount() = %d"),nodeCount);
+ if(!nodeCount)
+ return KErrNotFound;
+
+ RPointerArray<CXdmDocumentNode> fromNodes;
+ RPointerArray<CXdmDocumentNode> untilNodes;
+
+ HBufC* fromPtr(NULL);
+ HBufC* untilPtr(NULL);
+
+ TTime fromTime(0);
+ TTime untilTime(0);
+
+
+ TTimePeriod myTimePeriod;
+
+ // Get all the <from> nodes
+ validityNode->Find(KXdmFrom, fromNodes);
+ validityNode->Find(KXdmUntil, untilNodes);
+
+ if((fromNodes.Count()) != (untilNodes.Count()))
+ {
+ fromNodes.Close();
+ untilNodes.Close();
+ return KErrGeneral;
+ }
+
+
+ nodeCount = fromNodes.Count();
+ OPENG_DP(D_OPENG_LIT( " nodesCount = %d" ),nodeCount);
+
+ for(TInt i=0; i<nodeCount; i++)
+ {
+ aValidTimes.Append(myTimePeriod);
+
+ // processing from
+ (fromNodes[i])->SetLeafNode(ETrue);
+ fromPtr = CnvUtfConverter::ConvertToUnicodeFromUtf8L((fromNodes[i])->LeafNodeContent());
+ CleanupStack::PushL(fromPtr);
+ OPENG_DP(D_OPENG_LIT( " from string at i(%d): %S" ),i,&(*fromPtr));
+ ParseFromXMLTimeString(fromPtr->Des(), fromTime);
+ CleanupStack::PopAndDestroy(fromPtr);
+ ConvertToLocal(fromTime);
+ ((aValidTimes[i]).from).Set(fromTime.DateTime().Year(),fromTime.DateTime().Month(),
+ fromTime.DateTime().Day(),fromTime.DateTime().Hour(),fromTime.DateTime().Minute(),
+ fromTime.DateTime().Second(), fromTime.DateTime().MicroSecond());
+ OPENG_DP(D_OPENG_LIT( " from at i = %d" ),i);
+ LogDateTime((aValidTimes[i]).from);
+
+
+ // processing until
+ (untilNodes[i])->SetLeafNode(ETrue);
+ untilPtr = CnvUtfConverter::ConvertToUnicodeFromUtf8L((untilNodes[i])->LeafNodeContent());
+ CleanupStack::PushL(untilPtr);
+ OPENG_DP(D_OPENG_LIT( " until string at i(%d): %S" ),i,&(*untilPtr));
+ ParseFromXMLTimeString(untilPtr->Des(), untilTime);
+ CleanupStack::PopAndDestroy(untilPtr);
+ ConvertToLocal(untilTime);
+ (aValidTimes[i]).until.Set(untilTime.DateTime().Year(),untilTime.DateTime().Month(),
+ untilTime.DateTime().Day(),untilTime.DateTime().Hour(),untilTime.DateTime().Minute(),
+ untilTime.DateTime().Second(),untilTime.DateTime().MicroSecond());
+ OPENG_DP(D_OPENG_LIT( " until at i = %d" ),i);
+ LogDateTime((aValidTimes[i]).until);
+
+ }
+
+ fromNodes.Close();
+ untilNodes.Close();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::DeleteAllValidity()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondValidity::DeleteAllValidityL(const TDesC& aRuleID)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::DeleteAllValidity()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* validityNode = GetValidityNodeL(aRuleID, EFalse);
+ if(validityNode==NULL)
+ return KErrNotFound;
+
+ iPresXDM->RemoveFromModelL(validityNode);
+
+ OPENG_DP(D_OPENG_LIT( " removed"));
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::AddValidityL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresCondValidity::AddValidityL(const TDesC& aRuleID,
+ const TTimePeriod aValidTime)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::AddValidityL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+ OPENG_DP(D_OPENG_LIT( " from:"));
+ LogDateTime(aValidTime.from);
+ OPENG_DP(D_OPENG_LIT( " until:"));
+ LogDateTime(aValidTime.until);
+
+ CXdmDocumentNode* validityNode = GetValidityNodeL(aRuleID, ETrue);
+ if(validityNode==NULL)
+ return KErrNotFound;
+
+ TBuf<KPresDateTimeBufLength> fromString;
+ TBuf<KPresDateTimeBufLength> untilString;
+
+
+ TTime fromTTime(aValidTime.from);
+ TTime untilTTime(aValidTime.until);
+
+ // convert to universal times
+ ConvertToUniversal(fromTTime);
+ ConvertToUniversal(untilTTime);
+
+ // get the xml strings
+ FormatToXMLTimeStringL(fromString, fromTTime);
+ FormatToXMLTimeStringL(untilString, untilTTime);
+
+ OPENG_DP(D_OPENG_LIT( " from: %S"), &fromString);
+ OPENG_DP(D_OPENG_LIT( " until: %S"), &untilString);
+
+ // make the nodes
+ CXdmDocumentNode* fromNode = validityNode->CreateChileNodeL(KXdmFrom);
+ CXdmDocumentNode* untilNode = validityNode->CreateChileNodeL(KXdmUntil);
+
+ // make the leaf and put contents
+ fromNode->SetLeafNode(ETrue);
+ fromNode->SetLeafNodeContentL(fromString);
+
+ untilNode->SetLeafNode(ETrue);
+ untilNode->SetLeafNodeContentL(untilString);
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::IsTimeValidL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresCondValidity::IsTimeValidL(const TDesC& aRuleID,
+ const TTimePeriod aTime)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresCondValidity::IsTimeValid()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S"),&aRuleID);
+ OPENG_DP(D_OPENG_LIT( " from:"));
+ LogDateTime(aTime.from);
+ OPENG_DP(D_OPENG_LIT( " until:"));
+ LogDateTime(aTime.until);
+
+
+ CXdmDocumentNode* validityNode = GetValidityNodeL(aRuleID, EFalse);
+ if (validityNode==NULL)
+ return ETrue; // because all times are valid if no validity node
+
+ TBool result(EFalse);
+
+ RArray<TTimePeriod> validTimes;
+ GetValidityL(aRuleID, validTimes);
+
+ TTime givenfromTime(aTime.from);
+ TTime givenuntilTime(aTime.until);
+
+ TInt validTimeCounts = validTimes.Count();
+ for(TInt i=0; i<validTimeCounts; i++)
+ {
+ TTime fromTime((validTimes[i]).from);
+ TTime untilTime((validTimes[i]).until);
+
+ if( (givenfromTime>=fromTime) && (givenuntilTime<=untilTime) )
+ {
+ result = ETrue;
+ break;
+ }
+ }
+
+ validTimes.Close();
+ OPENG_DP(D_OPENG_LIT( " result = %d"),result);
+ return result;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::GetValidityNode()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* TPresCondValidity::GetValidityNodeL(const TDesC& aRuleID,
+ TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondValidity::GetValidityNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " GetValidityNodeL aRuleID = %S, aCreate = %d"),
+ &aRuleID, aCreate);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* conditionNode = iPresXDM->GetRuleChildNodeL(aRuleID,
+ KXdmConditions, aCreate);
+ if (conditionNode==NULL)
+ return conditionNode;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* validityNode(NULL);
+
+ // Finding sphere node
+ conditionNode->Find(KXdmValidity, nodes);
+ OPENG_DP(D_OPENG_LIT( " GetValidityNodeL nodeCount = %d"),nodes.Count());
+ if(nodes.Count()) // if identity node exist
+ {
+ validityNode = nodes[0]; // only one sphere node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ validityNode = conditionNode->CreateChileNodeL(KXdmValidity);
+ }
+
+ nodes.Close();
+ return validityNode;
+ }
+
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::ParseFromXMLTimeString()
+// ---------------------------------------------------------------------------
+//
+TInt TPresCondValidity::ParseFromXMLTimeString(const TDesC& aXMLTimeString,
+ TTime& aUTCDateTime)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ParseFromXMLTimeString()" ) );
+ OPENG_DP(D_OPENG_LIT( " ParseFromXMLTimeString aXMLTimeString = %S"),
+ &aXMLTimeString);
+
+ TInt err(KErrNone);
+
+ // Initializing the locale
+ TLocale myLocale, systemLocale;
+ myLocale.Refresh();
+ systemLocale.Refresh();
+ myLocale.SetDateFormat(EDateJapanese);
+ myLocale.SetDateSeparator('-',1);
+ myLocale.SetDateSeparator('-',2);
+ myLocale.SetDateSeparator('T',3);
+
+ myLocale.SetTimeFormat(ETime24);
+ myLocale.SetTimeSeparator(':',1);
+ myLocale.SetTimeSeparator(':',2);
+ myLocale.SetTimeSeparator(' ',3);
+ myLocale.Set();
+
+ TTime myTime;
+ TTime myUTCtime;
+ TChar uTCtimeSign(aXMLTimeString[23]); // 23 is ascii T
+
+
+ // parsing main time
+ TBuf<KPresDateTimeBufLength> dateTimeBuffer(aXMLTimeString);
+ dateTimeBuffer.Delete(KPresDTWithoutUTCLength-1,6);
+ dateTimeBuffer.Replace(KPresDTSeperatorPos,1,KPresSpaceString);
+ myTime.Parse(dateTimeBuffer);
+
+ // parsing utc time
+ TBuf<KPresDateTimeBufLength> uTCbuffer(aXMLTimeString);
+ uTCbuffer.Delete(0,KPresDTWithoutUTCLength);
+ myUTCtime.Parse(uTCbuffer);
+ TDateTime uTCDateTime = myUTCtime.DateTime();
+
+ // adding or substracting utc from main time
+ if(uTCtimeSign=='+') // if diff is positive
+ {
+ aUTCDateTime = myTime - TTimeIntervalHours(uTCDateTime.Hour());
+ aUTCDateTime = aUTCDateTime - TTimeIntervalMinutes(uTCDateTime.Minute());
+ }
+ else if(uTCtimeSign=='-')
+ {
+ aUTCDateTime = myTime + TTimeIntervalHours(uTCDateTime.Hour());
+ aUTCDateTime = aUTCDateTime + TTimeIntervalMinutes(uTCDateTime.Minute());
+ }
+ else
+ err = KErrArgument;
+
+ // putting the system locale back
+ systemLocale.Set();
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::FormatToXMLTimeStringL()
+// ---------------------------------------------------------------------------
+//
+TInt TPresCondValidity::FormatToXMLTimeStringL(TDes& aXMLTimeString,
+ const TTime aUTCDateTime)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondValidity::FormatToXMLTimeString()" ) );
+ OPENG_DP(D_OPENG_LIT( " FormatToXMLTimeString aUTCDateTime:"));
+ LogDateTime(aUTCDateTime.DateTime());
+
+ // Initializing the locale
+ TLocale myLocale, systemLocale;
+ myLocale.Refresh();
+ systemLocale.Refresh();
+ myLocale.SetDateFormat(EDateJapanese);
+ myLocale.SetDateSeparator('-',1);
+ myLocale.SetDateSeparator('-',2);
+ myLocale.SetDateSeparator('T',3);
+
+ myLocale.SetTimeFormat(ETime24);
+ myLocale.SetTimeSeparator(':',1);
+ myLocale.SetTimeSeparator(':',2);
+ myLocale.SetTimeSeparator(' ',3);
+ myLocale.Set();
+
+ // getting UTC difference
+ TTimeIntervalSeconds uTCseconds = systemLocale.UniversalTimeOffset();
+
+ // processing main time and date component
+ TTime mainTTime = aUTCDateTime + uTCseconds;
+ mainTTime.FormatL(aXMLTimeString, KPresDateTimeFormatString);
+
+ // Processing for time difference
+ TChar uTCtimeSign('+');
+ TDateTime myUTCtime(0,EJanuary,0,0,0,0,0);
+ TTime uTCTTime(myUTCtime);
+ if(uTCseconds.Int()<0)
+ {
+ uTCtimeSign = '-';
+ uTCseconds = (uTCseconds.Int())*(-1);
+ }
+ uTCTTime = uTCTTime + uTCseconds;
+ TBuf<KPresDateTimeBufLength> dateTimeUTCBuffer;
+ uTCTTime.FormatL(dateTimeUTCBuffer, KPresUTCFormatString);
+
+
+ // Appending the time difference to main string
+ aXMLTimeString.Append(dateTimeUTCBuffer);
+
+ // put time difference sign to main string
+ aXMLTimeString[23] = uTCtimeSign;
+
+ // putting the system locale back
+ systemLocale.Set();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::ConvertToUniversal()
+// ---------------------------------------------------------------------------
+//
+void TPresCondValidity::ConvertToUniversal(TTime& aDateTime)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ConvertToUniversal()" ) );
+ OPENG_DP(D_OPENG_LIT( " ConvertToUniversal aDateTime:"));
+ LogDateTime(aDateTime.DateTime());
+
+ TLocale myLocale;
+ myLocale.Refresh();
+
+ // getting UTC difference
+ TTimeIntervalSeconds uTCseconds = myLocale.UniversalTimeOffset();
+ aDateTime = aDateTime - uTCseconds;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::ConvertToLocal()
+// ---------------------------------------------------------------------------
+//
+void TPresCondValidity::ConvertToLocal(TTime& aDateTime)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ConvertToLocal()" ) );
+ OPENG_DP(D_OPENG_LIT( " ConvertToLocal aDateTime:"));
+ LogDateTime(aDateTime.DateTime());
+
+ TLocale myLocale;
+ myLocale.Refresh();
+
+ // getting UTC difference
+ TTimeIntervalSeconds uTCseconds = myLocale.UniversalTimeOffset();
+ aDateTime = aDateTime + uTCseconds;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresCondValidity::LogDateTime()
+// ---------------------------------------------------------------------------
+//
+void TPresCondValidity::LogDateTime(TDateTime aDateTime)
+ {
+ OPENG_DP(D_OPENG_LIT( " %d, %d, %d, %d, %d, %d, %d"),
+ aDateTime.Year(), aDateTime.Month()+1, aDateTime.Day()+1,
+ aDateTime.Hour(), aDateTime.Minute(), aDateTime.Second(),
+ aDateTime.MicroSecond() );
+ }
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/presenceactionxdm.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents Presence Action
+*
+*/
+
+
+
+
+// Includes
+#include <utf.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+
+#include "cpresencexdm.h"
+#include "presenceactionxdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::TPresenceActionXDM()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresenceActionXDM::TPresenceActionXDM():iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceActionXDM::TPresenceActionXDM()" ) );
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresenceActionXDM::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceActionXDM::Init(aPresXDM=%d)"),aPresXDM );
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::AddOrReplaceAction()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceActionXDM::AddOrReplaceActionL(const TDesC& aRuleID,
+ const TDesC& aAction)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceActionXDM::AddOrReplaceActionL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S, aAction = %S" ),&aRuleID, &aAction);
+
+ TInt err(KErrNone);
+
+ CXdmDocumentNode* subHandlingNode = GetSubHandlingNodeL(aRuleID, ETrue);
+ if(subHandlingNode!=NULL)
+ {
+ if(IsValidAction(aAction))
+ {
+ subHandlingNode->SetLeafNode(ETrue);
+ subHandlingNode->SetLeafNodeContentL(aAction);
+ err = KErrNone;
+ }
+ else
+ err = KErrArgument;
+ }
+ else
+ err = KErrNotFound;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d" ),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::RemoveAction()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceActionXDM::RemoveActionL(const TDesC& aRuleID)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceActionXDM::RemoveActionL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S" ),&aRuleID );
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ TInt err(KErrNone);
+ CXdmDocumentNode* subHandlingNode = GetSubHandlingNodeL(aRuleID, EFalse);
+ if(subHandlingNode!=NULL)
+ iPresXDM->RemoveFromModelL(subHandlingNode);
+ else
+ err = KErrNotFound;
+
+ OPENG_DP(D_OPENG_LIT( " return: %d" ),err);
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::GetAction()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceActionXDM::GetActionL(const TDesC& aRuleID, TDes& aAction)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceActionXDM::GetActionL()" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID = %S" ),&aRuleID );
+
+ TInt err(KErrNone);
+
+ CXdmDocumentNode* subHandlingNode = GetSubHandlingNodeL(aRuleID, EFalse);
+ if(subHandlingNode==NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( " return: KErrNotFound" ));
+ return KErrNotFound;
+ }
+
+ HBufC* nodeContents(NULL);
+
+ subHandlingNode->SetLeafNode(ETrue);
+ nodeContents = CnvUtfConverter::ConvertToUnicodeFromUtf8L
+ (subHandlingNode->LeafNodeContent());
+ //Check given string length
+ if((nodeContents->Des()).Length() > aAction.MaxLength())
+ err = KErrArgument;
+ else
+ aAction = nodeContents->Des();
+
+ delete nodeContents;
+
+ OPENG_DP(D_OPENG_LIT( " return: err" ));
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::GetSubHandlingNode()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* TPresenceActionXDM::GetSubHandlingNodeL(const TDesC& aRuleID,
+ TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceActionXDM::GetSubHandlingNodeL()" ) );
+ OPENG_DP(D_OPENG_LIT( " GetSubHandlingNodeL aRuleID = %S, aCreate = %d" ),
+ &aRuleID,aCreate);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* actionNode = iPresXDM->GetRuleChildNodeL(aRuleID,
+ KXdmActions, aCreate);
+ if ( (!aCreate) && (actionNode==NULL))
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* subHandling(NULL);
+
+ // Finding subhandling node
+ actionNode->Find(KXdmSubHandling, nodes);
+ OPENG_DP(D_OPENG_LIT( " GetSubHandlingNodeL nodesCount = %d" ),nodes.Count());
+ if(nodes.Count()) // if action node exist
+ {
+ subHandling = nodes[0]; // only one sub-handling node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ subHandling = actionNode->CreateChileNodeL(KXdmSubHandling);
+ }
+
+ nodes.Close();
+ return subHandling;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceActionXDM::IsValidAction()
+// ---------------------------------------------------------------------------
+//
+TBool TPresenceActionXDM::IsValidAction(const TDesC& aAction)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceActionXDM::IsValidAction()" ) );
+ if((aAction==KPresBlock)||(aAction==KPresConfirm)||(aAction==KPresPoliteBlock)||(aAction==KPresAllow))
+ return ETrue;
+ return EFalse;
+ }
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xdmrlspres/src/presencetransformxdm.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,521 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RLS and Presence XDM, This class represents Presence Transform
+*
+*/
+
+
+
+
+//Includes
+#include <utf.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <xcapappusagedef.h>
+
+#include "cpresencexdm.h"
+#include "presencetransformxdm.h"
+#include "rlspresxdmlogger.h"
+#include "rlspresxdmconstsint.h"
+
+
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::TPresenceTransformXDM()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPresenceTransformXDM::TPresenceTransformXDM():iPresXDM(NULL)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::TPresenceTransformXDM()" ) );
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::Init()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TPresenceTransformXDM::Init(CPresenceXDM* const aPresXDM)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::Init(%d)"),aPresXDM);
+ iPresXDM = aPresXDM;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::~TPresenceTransformXDM()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::AddTransComplexL(const TDesC& aRuleID,
+ const TDesC& aComplexChild,
+ const RArray<TTransDataCompo>& aTypeAndValues)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddTransComplexL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aComplexChild(%S), aTypeAndValuesCount(%d)"),
+ &aRuleID, &aComplexChild, aTypeAndValues.Count());
+
+ // check validity of input data
+ if (!((aComplexChild==KXdmProvidePersons)||(aComplexChild==KXdmProvideServices)||
+ (aComplexChild==KXdmProvideDevices)))
+ return KErrArgument;
+
+ if(!AreNodeNamesValid(aComplexChild, aTypeAndValues))
+ return KErrArgument;
+
+ CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID,
+ aComplexChild, ETrue);
+ if(complexChildNode==NULL)
+ return KErrNotFound;
+
+ // delete the provide all if they exist
+ if (IsProvideAllExistL(aRuleID, aComplexChild))
+ {
+ complexChildNode->SetEmptyNode(ETrue);
+ complexChildNode->SetEmptyNode(EFalse);
+ }
+
+ CXdmDocumentNode* childNode(NULL);
+ TInt childCount = aTypeAndValues.Count();
+ TBuf<KNodeNameMaxLength> nodeName;
+ for(TInt i=0;i<childCount;i++)
+ {
+ nodeName = (aTypeAndValues[i]).nodeName;
+ childNode = complexChildNode->CreateChileNodeL(nodeName);
+ childNode->SetLeafNode(ETrue);
+ childNode->SetLeafNodeContentL((aTypeAndValues[i]).nodeContent);
+ OPENG_DP(D_OPENG_LIT( " i(%d), nodeName(%S)"), i, &nodeName);
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::AddOrRepProvideAllTransComplexL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::AddOrRepProvideAllTransComplexL(
+ const TDesC& aRuleID, const TDesC& aComplexChild)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepProvideAllTransComplexL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aComplexChild(%S)"),
+ &aRuleID, &aComplexChild);
+
+ TBuf<KNodeContentMaxLength> nodeName;
+ if (aComplexChild==KXdmProvideServices)
+ nodeName = KPresAllServices;
+ else if (aComplexChild==KXdmProvidePersons)
+ nodeName = KPresAllPersons;
+ else if (aComplexChild==KXdmProvideDevices)
+ nodeName = KPresAllDevices;
+ else if (aComplexChild==KPresProvideAllAttributes)
+ nodeName = KPresProvideAllAttributes;
+ else
+ return KErrArgument;
+
+ CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID,
+ aComplexChild, ETrue);
+ if(complexChildNode==NULL)
+ return KErrNotFound;
+
+ if (aComplexChild!=KPresProvideAllAttributes)
+ {
+ // delete all children from this node
+ complexChildNode->SetEmptyNode(ETrue);
+ complexChildNode->SetEmptyNode(EFalse);
+
+ CXdmDocumentNode* emptyNode = complexChildNode->CreateChileNodeL(nodeName);
+ emptyNode->SetEmptyNode(ETrue);
+ }
+ else
+ complexChildNode->SetEmptyNode(ETrue);
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::GetTransComplexL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::GetTransComplexL(const TDesC& aRuleID,
+ const TDesC& aComplexChild,
+ RArray<TTransDataCompo>& aTypeAndValues)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransComplexL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aComplexChild(%S)"),
+ &aRuleID, &aComplexChild);
+
+ // check validity of input data
+ if (!((aComplexChild==KXdmProvidePersons)||(aComplexChild==KXdmProvideServices)||
+ (aComplexChild==KXdmProvideDevices)))
+ return KErrArgument;
+
+ CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID,
+ aComplexChild, EFalse);
+
+ if (complexChildNode==NULL)
+ return KErrNotFound;
+
+ CXdmDocumentNode* childNode(NULL);
+ TBuf<KNodeNameMaxLength> nodeName;
+ HBufC* nodeContents(NULL);
+ TTransDataCompo myDataCompo;
+
+ TInt childCount = complexChildNode->NodeCount();
+ OPENG_DP(D_OPENG_LIT( " childCount(%d)" ),childCount );
+
+ for (TInt i=0; i<childCount; i++)
+ {
+ childNode = complexChildNode->ChileNode(i);
+ nodeName.Copy(childNode->NodeName());
+ (myDataCompo.nodeName).Copy(nodeName);
+
+ // get attribute if nodeType support attribute
+ if ((nodeName==KPresAllDevices)||(nodeName==KPresAllPersons)||
+ (nodeName==KPresAllServices))
+ {
+ aTypeAndValues.Append(myDataCompo);
+ break;
+ }
+
+ childNode->SetLeafNode(ETrue);
+ nodeContents = CnvUtfConverter::ConvertToUnicodeFromUtf8L
+ (childNode->LeafNodeContent());
+ (myDataCompo.nodeContent).Copy(nodeContents->Des());
+ aTypeAndValues.Append(myDataCompo);
+ delete nodeContents;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::AddOrRepTransKnownBoolL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::AddOrRepTransKnownBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepTransKnownBoolL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aBoolChild(%S)"),
+ &aRuleID, &aBoolChild);
+ if (!IsBoolChildSupported(aBoolChild))
+ return KErrArgument;
+
+ return AddOrRepTransBoolL(aRuleID, aBoolChild, aValue);
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::GetTransKnownBoolL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::GetTransKnownBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool& aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransKnownBoolL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S)"), &aRuleID);
+ if (!IsBoolChildSupported(aBoolChild))
+ return KErrArgument;
+
+ return GetTransBoolL(aRuleID, aBoolChild, aValue);
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::AddOrRepTransUnknownBoolL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::AddOrRepTransUnknownBoolL(
+ const TDesC& aRuleID, const TDesC& aChildName, TBool aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepTransUnknownBoolL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aChildName(%S)"), &aRuleID, &aChildName);
+ return AddOrRepTransBoolL(aRuleID, aChildName, aValue);
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::GetTransUnknownBoolL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::GetTransUnknownBoolL(const TDesC& aRuleID,
+ const TDesC& aChildName, TBool& aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransUnknownBoolL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aChildName(%S)"), &aRuleID, &aChildName);
+ return GetTransBoolL(aRuleID, aChildName, aValue);
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::RemoveTransformL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TPresenceTransformXDM::RemoveTransformL(const TDesC& aRuleID,
+ const TDesC& aChildElement)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::RemoveTransformL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aChildElement(%S)"), &aRuleID,
+ &aChildElement);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* myNode(NULL);
+ if(aChildElement==KNullDesC) // remove whole transform
+ {
+ myNode = iPresXDM->GetRuleChildNodeL(aRuleID, KXdmTransformations, EFalse);
+ }
+ else
+ {
+ myNode = GetTransformChildNodeL(aRuleID, aChildElement, EFalse);
+ }
+ if(myNode==NULL)
+ return KErrNotFound;
+ iPresXDM->RemoveFromModelL(myNode);
+ OPENG_DP(D_OPENG_LIT( " removed" ) );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::IsTransformExistL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TPresenceTransformXDM::IsTransformExistL(const TDesC& aRuleID,
+ const TDesC& aChildElement)
+ {
+ OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::IsTransformExist" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aChildElement(%S)"), &aRuleID,
+ &aChildElement);
+
+ CXdmDocumentNode* myNode = GetTransformChildNodeL(aRuleID, aChildElement, EFalse);
+ if(myNode)
+ {
+ OPENG_DP(D_OPENG_LIT( " True" ) );
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::GetTransformChildNodeL()
+// ---------------------------------------------------------------------------
+//
+CXdmDocumentNode* TPresenceTransformXDM::GetTransformChildNodeL( const TDesC& aRuleID,
+ const TDesC& aChild, TBool aCreate)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::GetTransformChildNodeL" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aChild(%S), aCreate(%d)"), &aRuleID,
+ &aChild, aCreate);
+
+ __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
+
+ CXdmDocumentNode* transformNode = iPresXDM->GetRuleChildNodeL(aRuleID,
+ KXdmTransformations, aCreate);
+ if ( (!aCreate) && (transformNode==NULL))
+ return NULL;
+
+ RPointerArray<CXdmDocumentNode> nodes;
+ CXdmDocumentNode* childNode(NULL);
+
+ // Finding transform node
+ transformNode->Find(aChild, nodes);
+ OPENG_DP(D_OPENG_LIT( " nodeCount(%d)" ), nodes.Count());
+ if(nodes.Count()) // if transform node exist
+ {
+ childNode = nodes[0]; // only one complex child node can exist
+ }
+ else if (aCreate) // if asked to create
+ {
+ childNode = transformNode->CreateChileNodeL(aChild);
+ }
+
+ nodes.Close();
+ return childNode;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::AreNodeNamesValid()
+// ---------------------------------------------------------------------------
+//
+TBool TPresenceTransformXDM::AreNodeNamesValid(const TDesC& aComplexChild,
+ const RArray<TTransDataCompo>& aTypeAndValues)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::AreNodeNamesValid" ) );
+ OPENG_DP(D_OPENG_LIT( " aComplexChild(%S)"), &aComplexChild);
+
+ TInt nodeCount = aTypeAndValues.Count();
+ TBuf<KNodeNameMaxLength> myNodeName;
+ TInt i(0);
+
+ if(aComplexChild == KXdmProvideDevices)
+ {
+ for(i=0;i<nodeCount;i++)
+ {
+ myNodeName = (aTypeAndValues[i]).nodeName;
+ if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID)&&
+ (myNodeName!=KPresDeviceID))
+ return EFalse;
+ }
+ }
+
+ else if (aComplexChild == KXdmProvidePersons)
+ {
+ for(i=0;i<nodeCount;i++)
+ {
+ myNodeName = (aTypeAndValues[i]).nodeName;
+ if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID))
+ return EFalse;
+ }
+ }
+
+ else if (aComplexChild == KXdmProvideServices)
+ {
+ for(i=0;i<nodeCount;i++)
+ {
+ myNodeName = (aTypeAndValues[i]).nodeName;
+ if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID)
+ &&(myNodeName!=KPresServiceUri)&&(myNodeName!=KPresServiceUriScheme)
+ &&(myNodeName!=KPresServiceId) )
+ return EFalse;
+ }
+ }
+
+ else
+ return EFalse;
+
+ OPENG_DP(D_OPENG_LIT( " True"));
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::IsProvideAllExistL()
+// ---------------------------------------------------------------------------
+//
+TBool TPresenceTransformXDM::IsProvideAllExistL(const TDesC& aRuleID,
+ const TDesC& aComplexChild)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::IsProvideAllExist" ) );
+ OPENG_DP(D_OPENG_LIT( " aRuleID(%S), aComplexChild(%S)"),
+ &aRuleID, &aComplexChild);
+
+ CXdmDocumentNode* myComplexChild = GetTransformChildNodeL(aRuleID,
+ aComplexChild, EFalse);
+ if(myComplexChild==NULL)
+ return EFalse;
+
+ TBuf<KNodeNameMaxLength> nodeName;
+ if (aComplexChild==KXdmProvideServices)
+ nodeName = KPresAllServices;
+ else if (aComplexChild==KXdmProvidePersons)
+ nodeName = KPresAllPersons;
+ else if (aComplexChild==KXdmProvideDevices)
+ nodeName = KPresAllDevices;
+ else
+ return EFalse;
+
+ if ((myComplexChild->NodeCount()) == 1)
+ {
+ CXdmDocumentNode* provideAllNode = myComplexChild->ChileNode(0);
+ if ((provideAllNode->NodeName()) == nodeName)
+ {
+ OPENG_DP(D_OPENG_LIT( " True"));
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::IsBoolChildSupported()
+// ---------------------------------------------------------------------------
+//
+TBool TPresenceTransformXDM::IsBoolChildSupported(const TDesC& aBoolChild)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::IsBoolChildSupported" ) );
+
+ if( (aBoolChild==KPresProvideActivities)||
+ (aBoolChild==KPresProvideClass)||
+ (aBoolChild==KPresProvideDeviceID)||
+ (aBoolChild==KPresProvideMood)||
+ (aBoolChild==KPresProvidePlaceIs)||
+ (aBoolChild==KPresProvidePlaceType)||
+ (aBoolChild==KPresProvidePrivacy)||
+ (aBoolChild==KPresProvideRelationship)||
+ (aBoolChild==KPresProvideSphere)||
+ (aBoolChild==KPresProvideStatusIcon)||
+ (aBoolChild==KPresProvideTimeOffset)||
+ (aBoolChild==KPresProvideNote)||
+ (aBoolChild==KPresProvideUnknownAttribute)||
+
+ (aBoolChild==KPresProvideWillingness)||
+ (aBoolChild==KPresProvideNetworkAvailability)||
+ (aBoolChild==KPresProvideSessionParticipation)||
+ (aBoolChild==KPresProvideGeoPriv)||
+ (aBoolChild==KPresProvideRegistrationState)||
+ (aBoolChild==KPresProvideBarringState) )
+ return ETrue;
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::AddOrRepTransBoolL()
+// ---------------------------------------------------------------------------
+//
+TInt TPresenceTransformXDM::AddOrRepTransBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::AddOrRepTransBoolL" ) );
+
+ CXdmDocumentNode* childNode = GetTransformChildNodeL(aRuleID,
+ aBoolChild, ETrue);
+ if(childNode==NULL)
+ return KErrNotFound;
+
+ TBuf8<KPresRLSChildConstBufLen> childContents;
+ if(aValue)
+ childContents = KXdmTrue;
+ else
+ childContents = KXdmFalse;
+
+ childNode->SetLeafNode(ETrue);
+ childNode->SetLeafNodeContentL(childContents);
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TPresenceTransformXDM::GetTransBoolL()
+// ---------------------------------------------------------------------------
+//
+TInt TPresenceTransformXDM::GetTransBoolL(const TDesC& aRuleID,
+ const TDesC& aBoolChild, TBool& aValue)
+ {
+ OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::GetTransBoolL" ) );
+
+ CXdmDocumentNode* childNode = GetTransformChildNodeL(aRuleID,
+ aBoolChild, EFalse);
+ if (childNode==NULL)
+ return KErrNotFound;
+
+ TInt err(KErrNone);
+
+ childNode->SetLeafNode(ETrue);
+
+ TPtrC8 nodeContents = childNode->LeafNodeContent();
+
+ if(nodeContents == KXdmTrue)
+ aValue = ETrue;
+ else if (nodeContents == KXdmFalse)
+ aValue = EFalse;
+ else
+ err = KErrNotFound;
+
+ return err;
+ }
+
+//end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/BWINS/simplexmlutilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+ ?NewContentL@TSimpleXmlFactory@@SAPAVMSimpleContent@@ABVTDesC8@@0@Z @ 1 NONAME ; class MSimpleContent * TSimpleXmlFactory::NewContentL(class TDesC8 const &, class TDesC8 const &)
+ ?NewDocumentInMultiPartL@TSimpleXmlFactory@@SAPAVMSimpleDocument@@ABVTDesC8@@00@Z @ 2 NONAME ; class MSimpleDocument * TSimpleXmlFactory::NewDocumentInMultiPartL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+ ?NewDocumentL@TSimpleXmlFactory@@SAPAVMSimpleDocument@@ABVTDesC8@@@Z @ 3 NONAME ; class MSimpleDocument * TSimpleXmlFactory::NewDocumentL(class TDesC8 const &)
+ ?NewDocumentL@TSimpleXmlFactory@@SAPAVMSimpleDocument@@XZ @ 4 NONAME ; class MSimpleDocument * TSimpleXmlFactory::NewDocumentL(void)
+ ?NewElementL@TSimpleXmlFactory@@SAPAVMSimpleElement@@ABVTDesC8@@0@Z @ 5 NONAME ; class MSimpleElement * TSimpleXmlFactory::NewElementL(class TDesC8 const &, class TDesC8 const &)
+ ?NewFilterDocumentL@TSimpleXmlFactory@@SAPAVMSimpleFilterDocument@@ABVTDesC8@@@Z @ 6 NONAME ; class MSimpleFilterDocument * TSimpleXmlFactory::NewFilterDocumentL(class TDesC8 const &)
+ ?NewFilterDocumentL@TSimpleXmlFactory@@SAPAVMSimpleFilterDocument@@XZ @ 7 NONAME ; class MSimpleFilterDocument * TSimpleXmlFactory::NewFilterDocumentL(void)
+ ?NewNamespaceL@TSimpleXmlFactory@@SAPAVMSimpleNamespace@@ABVTDesC8@@0@Z @ 8 NONAME ; class MSimpleNamespace * TSimpleXmlFactory::NewNamespaceL(class TDesC8 const &, class TDesC8 const &)
+ ?NewPresenceListL@TSimpleXmlFactory@@SAPAVMSimplePresenceList@@ABVTDesC8@@00@Z @ 9 NONAME ; class MSimplePresenceList * TSimpleXmlFactory::NewPresenceListL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+ ?NewWinfoL@TSimpleXmlFactory@@SAPAVMSimpleWinfo@@ABVTDesC8@@@Z @ 10 NONAME ; class MSimpleWinfo * TSimpleXmlFactory::NewWinfoL(class TDesC8 const &)
+ ?NewWinfoL@TSimpleXmlFactory@@SAPAVMSimpleWinfo@@XZ @ 11 NONAME ; class MSimpleWinfo * TSimpleXmlFactory::NewWinfoL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/EABI/simplexmlutilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+EXPORTS
+ _ZN17TSimpleXmlFactory11NewContentLERK6TDesC8S2_ @ 1 NONAME
+ _ZN17TSimpleXmlFactory11NewElementLERK6TDesC8S2_ @ 2 NONAME
+ _ZN17TSimpleXmlFactory12NewDocumentLERK6TDesC8 @ 3 NONAME
+ _ZN17TSimpleXmlFactory12NewDocumentLEv @ 4 NONAME
+ _ZN17TSimpleXmlFactory13NewNamespaceLERK6TDesC8S2_ @ 5 NONAME
+ _ZN17TSimpleXmlFactory16NewPresenceListLERK6TDesC8S2_S2_ @ 6 NONAME
+ _ZN17TSimpleXmlFactory18NewFilterDocumentLERK6TDesC8 @ 7 NONAME
+ _ZN17TSimpleXmlFactory18NewFilterDocumentLEv @ 8 NONAME
+ _ZN17TSimpleXmlFactory23NewDocumentInMultiPartLERK6TDesC8S2_S2_ @ 9 NONAME
+ _ZN17TSimpleXmlFactory9NewWinfoLERK6TDesC8 @ 10 NONAME
+ _ZN17TSimpleXmlFactory9NewWinfoLEv @ 11 NONAME
+ _ZTI11CSimpleMeta @ 12 NONAME ; #<TI>#
+ _ZTI12CSimpleWinfo @ 13 NONAME ; #<TI>#
+ _ZTI13CSimpleFilter @ 14 NONAME ; #<TI>#
+ _ZTI14CSimpleContent @ 15 NONAME ; #<TI>#
+ _ZTI14CSimpleElement @ 16 NONAME ; #<TI>#
+ _ZTI15CSimpleDocument @ 17 NONAME ; #<TI>#
+ _ZTI16CSimpleAttribute @ 18 NONAME ; #<TI>#
+ _ZTI16CSimpleNamespace @ 19 NONAME ; #<TI>#
+ _ZTI19CSimpleBaseDocument @ 20 NONAME ; #<TI>#
+ _ZTI19CSimplePresenceList @ 21 NONAME ; #<TI>#
+ _ZTV11CSimpleMeta @ 22 NONAME ; #<VT>#
+ _ZTV12CSimpleWinfo @ 23 NONAME ; #<VT>#
+ _ZTV13CSimpleFilter @ 24 NONAME ; #<VT>#
+ _ZTV14CSimpleContent @ 25 NONAME ; #<VT>#
+ _ZTV14CSimpleElement @ 26 NONAME ; #<VT>#
+ _ZTV15CSimpleDocument @ 27 NONAME ; #<VT>#
+ _ZTV16CSimpleAttribute @ 28 NONAME ; #<VT>#
+ _ZTV16CSimpleNamespace @ 29 NONAME ; #<VT>#
+ _ZTV19CSimpleBaseDocument @ 30 NONAME ; #<VT>#
+ _ZTV19CSimplePresenceList @ 31 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML utils build file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_EXPORTS
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+simplexmlutils.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/group/simplexmlutils.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for simplexmlutils
+*
+*/
+
+
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET simplexmlutils.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10281EED
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE simplecontent.cpp
+SOURCE simplebasedocument.cpp
+SOURCE simpledocument.cpp
+SOURCE simpleelement.cpp
+SOURCE simpleattribute.cpp
+SOURCE simplenamespace.cpp
+SOURCE simplefilter.cpp
+SOURCE simplewinfo.cpp
+SOURCE simplemeta.cpp
+SOURCE simplepresencelist.cpp
+SOURCE simplexmlfactory.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../api
+USERINCLUDE ../../inc
+USERINCLUDE ../../siputils/inc
+
+// default system include paths for middleware layer modules
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/libc
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib // file server
+DEBUGLIBRARY apparc.lib
+LIBRARY euser.lib
+LIBRARY estor.lib
+LIBRARY senxml.lib
+LIBRARY bafl.lib // string pool
+LIBRARY multipartparser.lib
+LIBRARY imut.lib // BASE64
+LIBRARY estlib.lib
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simpleattribute.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE attribute
+*
+*/
+
+
+
+
+#ifndef simpleattribute_H
+#define simpleattribute_H
+
+#include <e32std.h>
+// #include "simplecommon.h"
+#include "msimpleattribute.h"
+
+// FORWARD DECLARATION
+class CSenBaseAttribute;
+
+
+/**
+ * CSimpleAttribute
+ *
+ * SIMPLE attribute.
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.1
+ */
+
+class CSimpleAttribute : public CBase, public MSimpleAttribute
+ {
+
+public:
+
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ * @param aName: Name of the attribute
+ * @param aValue: Attribute's value.
+ * @return CSimpleAttribute
+ */
+ static CSimpleAttribute* NewL(
+ const TDesC8& aName,
+ const TDesC8& aValue );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ */
+ static CSimpleAttribute* NewL(
+ CSenBaseAttribute* aAttr );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleAttribute();
+
+ /**
+ * @return Base class implementation
+ */
+ CSenBaseAttribute* BaseElement();
+
+// from base class MSimpleAttribute
+
+ /**
+ * From MSimpleAttribute
+ * Getter for the attribute name.
+ * @since Series60 3.1
+ * @return the attribute name.
+ */
+ const TDesC8& Name();
+
+ /**
+ * From MSimpleAttribute
+ * Getter for the attribute value.
+ * @since Series60 3.1
+ * @return the attribute value.
+ */
+ const TDesC8& Value();
+
+ /**
+ * From MSimpleAttribute
+ * Getter for the attribute value in UNICODE.
+ * @since Series60 3.1
+ * @return the attribute value. Ownership is transferred.
+ */
+ HBufC* ValueUniLC();
+
+ /**
+ * From MSimpleAttribute
+ * Setter for the attribute value.
+ * This makes conversion from 16-bit to 8-bit.
+ *
+ * @since Series60 3.1
+ * @param aValue: value to be set
+ */
+ void SetValueL( const TDesC& aValue );
+
+private:
+
+ /**
+ * Two-phase constructor
+ * @param aName: Name of the attribute
+ * @param aValue: Attribute's value.
+ */
+ void ConstructL(
+ const TDesC8& aName,
+ const TDesC8& aValue );
+
+ /**
+ * Two-phase constructor
+ * @param aAttr: Base element
+ */
+ void ConstructL(
+ CSenBaseAttribute* aAttr );
+
+ /**
+ * constructor
+ */
+ CSimpleAttribute();
+
+
+private: // data
+
+ /**
+ * Base element when created from scratch
+ * Own.
+ */
+ CSenBaseAttribute* iBase;
+
+ /**
+ * Base element when only reference to base element
+ * Not own.
+ */
+ CSenBaseAttribute* iRef;
+
+ };
+
+#endif // simpleattribute_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplebasedocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE document base
+*
+*/
+
+
+
+
+#ifndef simplebasedocument_H
+#define simplebasedocument_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimpledocument.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+class CSimpleElement;
+
+
+/**
+ * CSimpleBaseDocument
+ *
+ * SIMPLE Engine document base class.
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.2
+ */
+
+class CSimpleBaseDocument : public CBase
+ {
+
+public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleBaseDocument();
+
+ /**
+ * Validates root element name
+ * Leaves if not valid
+ * @param aName element name
+ */
+ virtual void ValidateXmlL( const TDesC8& aName ) = 0;
+
+
+// from base class MSimpleDocument
+
+
+ /**
+ * From MSimpleDocument
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ TPtrC8 DefaultNamespace();
+
+ /**
+ * From MSimpleDocument
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * From MSimpleDocument
+ * Gets all namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ */
+ RPointerArray<MSimpleNamespace>& NamespacesL();
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ void ExternalizeL( RWriteStream& aStream );
+
+// from base class MSimpleEntity
+
+ /**
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * Getter for Element's default namespace.
+ *
+ * @since S60 3.2
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 3.2
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 3.2
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 3.2
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+
+ /**
+ * Getting the child elements of this element matching the given criteria.
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since S60 3.2
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since S60 3.2
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since S60 3.2
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since S60 3.2
+ * @return the parent element or NULL if no parent set.
+ * Ownership NOT transferred to the caller.
+ */
+ MSimpleElement* SimpleParentL();
+
+ /**
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since S60 3.2
+ */
+ void DetachSimpleL();
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since S60 3.2
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since S60 3.2
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since S60 3.2
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+protected:
+
+ /**
+ * Two-phase constructor, for derived classes
+ */
+ void BaseConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Contructor for deriveed classes
+ * @since S60 3.2
+ * @param aXml XML document.
+ */
+ void BaseConstructL(
+ const TDesC8& aXml );
+
+ CSimpleElement* Root();
+
+
+ /**
+ * constructor
+ */
+ CSimpleBaseDocument();
+
+private:
+
+ /**
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ TPtrC8 DoDefaultNamespaceL();
+
+
+
+private: // data
+
+ /**
+ * Root element.
+ * Own.
+ */
+ CSimpleElement* iRoot;
+
+ /**
+ * Extra namespaces
+ */
+ RPointerArray<CSimpleNamespace> iNsps;
+
+ /**
+ * Extra namespaces, M-classes
+ */
+ RPointerArray<MSimpleNamespace> iMNsps;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplecontent.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Data container for a single MIME multipart part.
+*
+*/
+
+
+
+
+#ifndef C_SIMPLECONTENT2_H
+#define C_SIMPLECONTENT2_H
+
+
+// Includes
+#include <e32std.h>
+#include <e32base.h>
+
+#include "msimplecontent.h"
+#include "simplecommon.h"
+
+/**
+ * CSimpleContent
+ *
+ * Data container for a single MIME multipart part.
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.2
+ */
+class CSimpleContent : public CBase, public MSimpleContent
+ {
+public:
+
+ static CSimpleContent* NewL(
+ const TDesC8& aContentID, const TDesC8& aContentType );
+
+ static CSimpleContent* NewLC(
+ const TDesC8& aContentID, const TDesC8& aContentType );
+
+ virtual ~CSimpleContent();
+
+// from base class MSimpleContent
+
+ /**
+ * Destructor
+ */
+ void Close();
+
+ /**
+ * Data accessor
+ *
+ * @since S60 ?S60_version
+ * @return data
+ */
+ TPtrC8 Body();
+
+ /**
+ * Data accessor
+ *
+ * @since S60 ?S60_version
+ * @return data, ownership is transferred
+ */
+ HBufC8* GiveBodyOwnerShip();
+
+ /**
+ * Data setter
+ *
+ * @since S60 ?S60_version
+ * @param aData data to be copied
+ */
+ void CopyBodyL( const TDesC8& aData );
+
+ /**
+ * Data setter
+ *
+ * @since S60 ?S60_version
+ * @param aData data, ownetship is taken.
+ */
+ void SetBody( HBufC8* aData );
+
+ /**
+ * content-id accessor
+ * @return content-id
+ */
+ TPtrC8 ContentID();
+
+ /**
+ * content-type accessor
+ * @return content-type
+ */
+ TPtrC8 ContentType();
+
+
+private:
+
+ CSimpleContent();
+
+ void ConstructL(
+ const TDesC8& aContentID, const TDesC8& aContentType );
+
+
+private: // data
+
+ /**
+ * ContentID
+ * Own.
+ */
+ HBufC8* iContentID;
+
+ /**
+ * ContentType
+ * Own.
+ */
+ HBufC8* iContentType;
+
+ /**
+ * Body
+ * Own.
+ */
+ HBufC8* iBody;
+};
+
+
+
+#endif // ? C_CLASSNAME_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simpledocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE document
+*
+*/
+
+
+
+
+#ifndef simpledocument_H
+#define simpledocument_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimpledocument.h"
+#include "simplebasedocument.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+class CSimpleContent;
+class CBodyPart;
+class MSimpleContent;
+// class RPointerArray;
+
+
+
+
+
+
+/**
+ * CSimpleDocument
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class CSimpleDocument : public CSimpleBaseDocument, public MSimpleDocument
+ {
+
+public:
+
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @return CSimpleDocument
+ */
+ static CSimpleDocument* NewL( );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aXml XML document
+ * @return CSimpleDocument
+ */
+ static CSimpleDocument* NewL( const TDesC8& aXml );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aData MIME multipart data
+ * @param aBoundary MIME multipart boundary
+ * @param aStart MIME multipart start content-id
+ * @return CSimpleDocument
+ */
+ static CSimpleDocument* NewInMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleDocument();
+
+ /**
+ * Validates root element name
+ * Leaves if not valid
+ * @param aName element name
+ */
+ void ValidateXmlL( const TDesC8& aName );
+
+// from base class MSimpleDocument
+
+
+ /**
+ * From MSimpleDocument
+ * Entity's URI getter. URI is specified in a factory method
+ *
+ * @since S60 3.2
+ * @return URI
+ */
+ const TDesC8* EntityURI();
+
+ /**
+ * From MSimpleDocument
+ * Entity's URI setter.
+ *
+ * @since S60 3.2
+ * @return URI
+ */
+ void SetEntityURIL( const TDesC8& aValue );
+
+ /**
+ * From MSimpleDocument
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ TPtrC8 DefaultNamespace();
+
+ /**
+ * From MSimpleDocument
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * From MSimpleDocument
+ * Gets all namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ * Any modifications made on the returned items
+ * DOES NOT modify the real childs.
+ * Do NOT call ResetAndDestroy() for the array,
+ * you may call Reset() only. The array is valid only till
+ * the next call of this method in this entity.
+ */
+ RPointerArray<MSimpleNamespace>& NamespacesL();
+
+ /**
+ * Copies content from given element to this element appending to the
+ * existing content if there is any.
+ * @since S60 3.2
+ * @param aSource The source element.
+ */
+ void CopyFromL( MSimpleDocument& aSource );
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ void ExternalizeL( RWriteStream& aStream );
+
+ /**
+ * Get direct contents
+ * @param aContents array of contents [out].
+ * This is walid till the AddDirectContentL method.
+ */
+ void GetDirectContentsL( RPointerArray<MSimpleContent>& aContents );
+
+ /**
+ * Add content
+ * @param aContent content, the data content is copied into document.
+ * @param aCopyContent ETrue if buffer of each content is copied or
+ * ownership is transferred just without copy.
+ */
+ void AddDirectContentL( MSimpleContent& aContent, TBool aCopyContent );
+
+
+// from base class MSimpleEntity
+
+ /**
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * Getter for Element's default namespace.
+ *
+ * @since S60 3.2
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 3.2
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 3.2
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 3.2
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+
+ /**
+ * Getting the child elements of this element matching the given criteria.
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since S60 3.2
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since S60 3.2
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since S60 3.2
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since S60 3.2
+ * @return the parent element or NULL if no parent set.
+ * Ownership IS TRANSFERRED to the caller.
+ */
+ MSimpleElement* SimpleParentL();
+
+ /**
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since S60 3.2
+ */
+ void DetachSimpleL();
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since S60 3.2
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since S60 3.2
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since S60 3.2
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+
+protected:
+
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aXml );
+
+ /**
+ * constructor
+ */
+ CSimpleDocument();
+
+ /**
+ * ClenupStack operation
+ * aPtrArray RPointerArray<CBodyPart>
+ */
+ static void ResetAndDestroy( TAny* aPtrArray );
+
+ /**
+ * DoConstructL
+ * Handles XML parsing of MIME multiparts
+ * @param aParts MIME multipart parts
+ * @param aStart MIME multipart start content-id
+ */
+ void DoConstructL( RPointerArray<CBodyPart>& aParts, const TDesC8& aStart );
+
+ HBufC8* DoComposeMultiPartL( RPointerArray<CBodyPart>& aBodyArray,
+ const TDesC8& aBoundary);
+
+ void DoExternalizeMultiPartL(
+ RPointerArray<CBodyPart>& aBodies,
+ RPointerArray<HBufC8>& aBuffers,
+ RWriteStream& aStream );
+
+
+private: // data
+
+ /**
+ * Direct contents in MIME multipart
+ */
+ RPointerArray<CSimpleContent> iContents;
+
+ };
+
+
+#endif // simpledocument_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simpleelement.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE element
+*
+*/
+
+
+
+
+#ifndef simpleelement_H
+#define simpleelement_H
+
+#include <e32std.h>
+#include <SenBaseElement.h>
+#include "msimpleelement.h"
+#include "msimpleattribute.h"
+
+// FORWARD DECLARATION
+class MSimpleNamespace;
+class CSenElement;
+class CSimpleAttribute;
+class CSimpleElement;
+
+/**
+ * CSimpleElement
+ *
+ * SIMPLE element.
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.1
+ */
+
+class CSimpleElement : public CBase, public MSimpleElement
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ */
+ static CSimpleElement* NewL( const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ * @param aElement base element
+ * @param aOwn whethre ownership is transferred
+ */
+ static CSimpleElement* NewL(
+ CSenElement* aElement,
+ TBool aOwn );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleElement();
+
+ /**
+ * @return Base class implementation
+ */
+ CSenElement* BaseElement();
+
+ /**
+ * From MSimpleElement
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since Series60 3.1
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttr8L(const TDesC8& aName, const TDesC8& aValue);
+
+// from base class MSimpleElement
+
+
+ /**
+ * From MSimpleElement
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 v3.1
+ */
+ void Close();
+
+ /**
+ * From MSimpleElement
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * From MSimpleElement
+ * Getter for Element's default namespace.
+ *
+ * @since S60 v3.1
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * From MSimpleElement
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 v3.1
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * From MSimpleElement
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 v3.1
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * From MSimpleElement
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 v3.1
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+ /**
+ * From MSimpleElement
+ * Getting the child elements of this element.
+ *
+ * @since Series60 3.1
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * From MSimpleElement
+ * Gets the value of the given attribute.
+ *
+ * @since Series60 3.1
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * From MSimpleElement
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since Series60 3.1
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since Series60 3.1
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * From MSimpleElement
+ * Gets the parent element of this element.
+ *
+ * @since Series60 3.1
+ * @return the parent element or NULL if no parent set.
+ * Ownership is IS TRANSFERRED to the caller.
+ */
+ CSimpleElement* SimpleParentL();
+
+ /**
+ * From MSimpleElement
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since Series60 3.1
+ */
+ void DetachSimpleL();
+
+ /**
+ * From MSimpleElement
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * From MSimpleElement
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since Series60 3.1
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+
+ /**
+ * From MSimpleElement
+ * Remove an element from the childs.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement( const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+protected:
+
+ /**
+ * Two-phase constructor
+ * @param aNsUri Namespace URI
+ * @param aLocalName local name
+ */
+ void ConstructL( const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ void CSimpleElement::ConstructL(
+ CSenElement* aElem,
+ TBool aOwn );
+
+ /**
+ * constructor
+ */
+ CSimpleElement();
+
+private: // data
+
+ /**
+ * Base element when created from scratch
+ * Own.
+ */
+ CSenElement* iBase;
+
+ /**
+ * Base element when only reference to base element
+ * Not own.
+ */
+ CSenElement* iRef;
+
+ /**
+ * Attributes.
+ */
+ RPointerArray<CSimpleAttribute> iAttributes;
+
+ /**
+ * Attributes.
+ */
+ RPointerArray<CSimpleElement> iElements;
+
+ };
+
+
+
+
+#endif // ?INCLUDE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplefilter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE filter
+*
+*/
+
+
+
+
+#ifndef simplefilter_H
+#define simplefilter_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimplefilterdocument.h"
+#include "simplebasedocument.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+
+
+/**
+ * CSimpleFilter
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class CSimpleFilter : public CSimpleBaseDocument, public MSimpleFilterDocument
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @return CSimpleFilter
+ */
+ static CSimpleFilter* NewL( );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aXml XML document
+ * @return CSimpleFilter
+ */
+ static CSimpleFilter* NewL( const TDesC8& aXml );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleFilter();
+
+ /**
+ * Validates root element name
+ * Leaves if not valid
+ * @param aName element name
+ */
+ void ValidateXmlL( const TDesC8& aName );
+
+// from base class MSimpleFilterDocument
+
+
+ /**
+ * From MSimpleFilterDocument
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ TPtrC8 DefaultNamespace();
+
+ /**
+ * From MSimpleFilterDocument
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * From MSimpleFilterDocument
+ * Gets namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ */
+ RPointerArray<MSimpleNamespace>& NamespacesL();
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ void ExternalizeL( RWriteStream& aStream );
+
+// from base class MSimpleEntity
+
+ /**
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * Getter for Element's default namespace.
+ *
+ * @since S60 3.2
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 3.2
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 3.2
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 3.2
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+ /**
+ * Getting the child elements of this element matching the given criteria.
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since S60 3.2
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since S60 3.2
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since S60 3.2
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since S60 3.2
+ * @return the parent element or NULL if no parent set.
+ * Ownership IS TRANSFERRED to the caller.
+ */
+ MSimpleElement* SimpleParentL();
+
+ /**
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since S60 3.2
+ */
+ void DetachSimpleL();
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since S60 3.2
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since S60 3.2
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since S60 3.2
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+
+protected:
+
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aXml );
+
+ /**
+ * constructor
+ */
+ CSimpleFilter();
+
+
+private: // data
+
+ };
+
+#endif // simplefilter_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplemeta.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE metadata
+*
+*/
+
+
+
+
+#ifndef simplemeta_H
+#define simplemeta_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimplemeta.h"
+#include "simplebasedocument.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+
+
+/**
+ * CSimpleMeta
+ *
+ * SIMPLE Engine core.
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.1
+ */
+
+class CSimpleMeta : public CSimpleBaseDocument, public MSimpleMeta
+ {
+
+public:
+
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ * @param aXml XML document
+ * @return CSimpleMeta
+ */
+ static CSimpleMeta* NewL( const TDesC8& aXml );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleMeta();
+
+ /**
+ * Validates root element name
+ * Leaves if not valid
+ * @param aName element name
+ */
+ void ValidateXmlL( const TDesC8& aName );
+
+// from base class MSimpleMeta
+
+
+ /**
+ * From MSimpleMeta
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 v3.1
+ * @return default namespace URI
+ */
+ TPtrC8 DefaultNamespace();
+
+ /**
+ * From MSimpleMeta
+ * Add new newspace
+ *
+ * @since S60 v3.1
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * From MSimpleMeta
+ * Gets all namespaces of this element in an array.
+ *
+ * @since S60 v3.1
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ */
+ RPointerArray<MSimpleNamespace>& NamespacesL();
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 v3.1
+ * @param aStream write stream
+ */
+ void ExternalizeL( RWriteStream& aStream );
+
+// from base class MSimpleEntity
+
+ /**
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 v3.1
+ */
+ void Close();
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * Getter for Element's default namespace.
+ *
+ * @since S60 v3.1
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 v3.1
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 v3.1
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 v3.1
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+
+ /**
+ * Getting the child elements of this element matching the given criteria.
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since Series60 3.1
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since Series60 3.1
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since Series60 3.1
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since Series60 3.1
+ * @return the parent element or NULL if no parent set.
+ * Ownership IS TRANSFERRED to the caller.
+ */
+ MSimpleElement* SimpleParentL();
+
+ /**
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since Series60 3.1
+ */
+ void DetachSimpleL();
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since Series60 3.1
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aXml );
+
+ /**
+ * constructor
+ */
+ CSimpleMeta();
+
+ };
+
+#endif // simplemeta_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplenamespace.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE namespace
+*
+*/
+
+
+
+
+#ifndef simplenamespace_H
+#define simplenamespace_H
+
+#include <e32std.h>
+#include "msimplenamespace.h"
+
+/**
+ * CSimpleNamespace
+ *
+ * SIMPLE data namespacw
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class CSimpleNamespace : public CBase, public MSimpleNamespace
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ */
+ static CSimpleNamespace* NewL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleNamespace();
+
+// from base class MSimpleNamespace
+
+ /**
+ * From MSimpleNamespace
+ * Destroy this element entity
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * From MSimpleNamespace
+ * Getter for the URI of the namespace object.
+ *
+ * @since S60 3.2
+ * @return The URI
+ */
+ TPtrC8 URI();
+
+ /**
+ * From MSimpleNamespace
+ * Getter for the prefix of the namespace object.
+ *
+ * @since S60 3.2
+ * @return The prefix
+ */
+ TPtrC8 Prefix();
+
+ /**
+ * From MSimpleNamespace
+ * Setter for the URI of the namespace object.
+ *
+ * @since S60 3.2
+ * @param aUri The URI.
+ */
+ void SetUriL(const TDesC8& aUri);
+
+ /**
+ * From MSimpleNamespace
+ * Setter for the prefix of the namespace object.
+ *
+ * @since S60 3.2
+ * @param aPrefix The prefix.
+ */
+ void SetPrefixL(const TDesC8& aPrefix);
+
+private:
+
+ void ConstructL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * contructor
+ */
+ CSimpleNamespace( );
+
+private:
+
+ /**
+ * The actual namespace entity.
+ * Own.
+ */
+ HBufC8* iPrefix;
+
+ /**
+ * URI.
+ * Own.
+ */
+ HBufC8* iUri;
+
+ };
+
+#endif // simplenamespace_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplepresencelist.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine presencelist
+*
+*/
+
+
+
+
+#ifndef simplepresencelist_H
+#define simplepresencelist_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimplepresencelist.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+class CSimpleMeta;
+class CBodyPart;
+
+/**
+ * CSimplePresenceList
+ *
+ * SIMPLE Engine presence list
+ *
+ * @lib simplexmlutils
+ * @since S60 v3.1
+ */
+
+class CSimplePresenceList : public CBase, public MSimplePresenceList
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 v3.1
+ * @param aData MIME multipart data
+ * @param aBoundary MIME multipart boundary
+ * @param aStart MIME multipart start content-id
+ * @return CSimplePresenceList
+ */
+ static CSimplePresenceList* NewL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimplePresenceList();
+
+
+// from base class MSimplePresenceList
+
+
+ /**
+ * Destructor.
+ * @since Series60 3.1
+ */
+ void Close();
+
+
+ /**
+ * Getter for the Metadata document.
+ * @since Series60 3.1
+ * @return metadata document.
+ */
+ MSimpleMeta* MetaData();
+
+ /**
+ * Getting the child elements of this element.
+ *
+ * @since Series60 3.1
+ * @param aDocuments an array of presence entities. This is an empty array if there
+ * are no entities. OUT.
+ */
+ void GetDocuments( RPointerArray<MSimpleDocument>& aDocuments );
+
+ /**
+ * Getting the sub-lists
+ *
+ * @since Series60 3.1
+ * @param aLists array of presence sub lists. OUT.
+ */
+ void GetSubLists( RPointerArray<MSimplePresenceList>& aLists );
+
+
+protected:
+
+
+private:
+
+ /**
+ * ClenupStack operation
+ * aPtrArray RPointerArray<CBodyPart>
+ */
+ static void ResetAndDestroy( TAny* aPtrArray );
+
+ /**
+ * DoConstructL
+ * Handles XML parsing of MIME multiparts
+ * @param aParts MIME multipart parts
+ * @param aStart MIME multipart start content-id
+ */
+ void DoConstructL( RPointerArray<CBodyPart>& aParts, const TDesC8& aStart );
+
+ /**
+ * Two-phase constructor
+ * @param aData MIME multipart data
+ * @param aBoundary MIME multipart boundary
+ * @param aStart MIME multipart start content-id
+ */
+ void ConstructL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * constructor
+ */
+ CSimplePresenceList();
+
+private: // data
+
+ /**
+ * Meta data of RLMI
+ * Own.
+ */
+ CSimpleMeta* iMeta;
+
+ /**
+ * Sub presence lists
+ */
+ RPointerArray<CSimplePresenceList> iPresList;
+
+ /**
+ * Presence documents in root level
+ */
+ RPointerArray<CSimpleDocument> iDocuments;
+ };
+
+#endif // simplepresencelist_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplewinfo.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE engine WINFO document
+*
+*/
+
+
+
+#ifndef simplewinfo_H
+#define simplewinfo_H
+
+#include <e32std.h>
+#include "simplecommon.h"
+#include "msimplewinfo.h"
+#include "simplebasedocument.h"
+
+// FORWARD DECLARATION
+class CSimpleNamespace;
+
+
+/**
+ * CSimpleWinfo
+ *
+ * SIMPLE engine WINFO document
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+
+class CSimpleWinfo : public CSimpleBaseDocument, public MSimpleWinfo
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @return CSimpleWinfo
+ */
+ static CSimpleWinfo* NewL( );
+
+ /**
+ * Two-phased constructor.
+ * @since S60 3.2
+ * @param aXml XML document
+ * @return CSimpleWinfo
+ */
+ static CSimpleWinfo* NewL( const TDesC8& aXml );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSimpleWinfo();
+
+ /**
+ * Validates root element name
+ * Leaves if not valid
+ * @param aName element name
+ */
+ void ValidateXmlL( const TDesC8& aName );
+
+// from base class MSimpleWinfo
+
+
+ /**
+ * From MSimpleWinfo
+ * Document's default namespace accessor. It is PIDF namespace.
+ *
+ * @since S60 3.2
+ * @return default namespace URI
+ */
+ TPtrC8 DefaultNamespace();
+
+ /**
+ * From MSimpleWinfo
+ * Add new newspace
+ *
+ * @since S60 3.2
+ * @param aPrefix: Namespace prefix
+ * @param aUri: Namespace URI
+ */
+ void AddNamespaceL( const TDesC8& aPrefix,
+ const TDesC8& aUri);
+
+ /**
+ * From MSimpleWinfo
+ * Gets all namespaces of this element in an array.
+ *
+ * @since S60 3.2
+ * @return array of namespaces. Array will be empty if element has
+ * no namespaces.
+ */
+ RPointerArray<MSimpleNamespace>& NamespacesL();
+
+ /**
+ * Externalize the document into write stream.
+ *
+ * @since S60 3.2
+ * @param aStream write stream
+ */
+ void ExternalizeL( RWriteStream& aStream );
+
+// from base class MSimpleEntity
+
+ /**
+ * Destroy this element entity and all its descendant elements
+ *
+ * @since S60 3.2
+ */
+ void Close();
+
+ /**
+ * Getter for Element's local name.
+ * LocalName and Namespace are given in factory method.
+ * @return KNullDesC if not set
+ */
+ const TDesC8& LocalName();
+
+ /**
+ * Getter for Element's default namespace.
+ *
+ * @since S60 3.2
+ * @return const pointer to the CSenNamespace object of this Element.
+ * NULL if not set. Ownership is transferred.
+ */
+ MSimpleNamespace* DefNamespaceL();
+
+ /**
+ * Method for checking if the element has any content within.
+ *
+ * @since S60 3.2
+ * @return ETrue if has content, EFalse if not.
+ */
+ TBool HasContent();
+
+ /**
+ * Getter for the content of the element, unicode version.
+ *
+ * @since S60 3.2
+ * @return content as unicode. Ownership IS TRANSFERRED to the caller.
+ */
+ HBufC* ContentUnicodeL();
+
+ /**
+ * Sets the content to the element. Old content is overwritten.
+ *
+ * @since S60 3.2
+ * @param aContent: The content to be set. Can be KNullDesC
+ */
+ void SetContentUnicodeL(const TDesC& aContent);
+
+
+ /**
+ * Getting the child elements of this element matching the given criteria.
+ * @param aElementArray: Array to be filled with the matching elements,
+ * or empty array if no matching found.
+ * Any modifications made on the returned items
+ * modify the real childs too.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray );
+
+ /**
+ * Gets the value of the given attribute.
+ *
+ * @since Series60 3.1
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * TRANSFERRED.
+ */
+ HBufC* AttrValueLC( const TDesC8& aName );
+
+ /**
+ * Gets the value of the given attribute.
+ * @param aName: Name of the attribute in question.
+ * @return the value of the attribute, or NULL if not found. Ownership is
+ * NOT TRANSFERRED.
+ */
+ const TDesC8* AttrValue(const TDesC8& aName);
+
+ /**
+ * Adds an attribute. If attribute is already existing,
+ * the value of the attribute will be replaced.
+ *
+ * @since Series60 3.1
+ * @param aName Name of the attribute to be added.
+ * @param aValue Value of the attribute to be added.
+ */
+ void AddAttrL(const TDesC8& aName, const TDesC& aValue);
+
+ /**
+ * From MSimpleElement
+ * Gets all the attributes of this element in an array.
+ *
+ * @since Series60 3.1
+ * @param aArray: Array to be filled with the attributes,
+ * or empty array if no matching found.
+ * @return KErrNone ok
+ * KErrNotFound No child elements exist.
+ */
+ TInt SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray );
+
+ /**
+ * Gets the parent element of this element.
+ *
+ * @since Series60 3.1
+ * @return the parent element or NULL if no parent set.
+ * Ownership NOT transferred to the caller.
+ */
+ MSimpleElement* SimpleParentL();
+
+ /**
+ * Detach the element from its parent.
+ * If the element, or one of its children, is dependent
+ * on a namespace declared in the scope of the parent
+ * copy those namespace declarations to this element.
+ * Leaves with KErrNotFound if parent was not set and
+ * nothing to detach.
+ *
+ * @since Series60 3.1
+ */
+ void DetachSimpleL();
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: namespace URI of the new element
+ * @param aLocalName: local name of the new element
+ * @return the added Element
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+ /**
+ * Constructs and adds a new element to the children elements.
+ * Sets this element to be the new parent of the given element.
+ * Note: Element is created with no specific namespace, default namespace
+ * of some of the upper level elements are in effect if there is such a
+ * namespace.
+ *
+ * @since Series60 3.1
+ * @param aLocalName: local name of the new element
+ * @return the added Element. OWNERSHIP IS TRANSFERRED.
+ * Leave codes:
+ * KErrSenInvalidCharacters if aLocalName contains illegal characters.
+ * KErrSenZeroLengthDescriptor if aLocalName is zero length.
+ */
+ MSimpleElement* AddSimpleElementL(
+ const TDesC8& aLocalName );
+
+ /**
+ * Remove an element from the childs.
+ *
+ * @since Series60 3.1
+ * @param aNsUri: the namespace URI of the element to be removed.
+ * @param aLocalName: the local name of the element to be removed.
+ */
+ void RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName);
+
+private:
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(
+ const TDesC8& aXml );
+
+ /**
+ * constructor
+ */
+ CSimpleWinfo();
+
+ };
+
+#endif // simplewinfo_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/inc/simplexmlfactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine XML utils factory
+*
+*/
+
+
+
+
+#ifndef simplexmlfactory_H
+#define simplexmlfactory_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+// FORWARD DECLARATION
+class MSimpleDocument;
+class MSimpleWinfo;
+class MSimpleElement;
+class MSimpleNamespace;
+class MSimpleFilterDocument;
+class MSimplePresenceList;
+class MSimpleContent;
+
+/**
+ * SIMPLE Engine XML utils factory
+ *
+ * @lib simplexmlutils
+ * @since S60 3.2
+ */
+class TSimpleXmlFactory
+ {
+
+public:
+
+ /**
+ * Create new simple Element entity.
+ * @since S60 3.2
+ * @return MSimpleElement, ownership is transferred.
+ */
+ IMPORT_C static MSimpleElement* NewElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName );
+
+ /**
+ * Create new simple NameSpace entity.
+ * @since S60 3.2
+ * @param aPrefix prefix to be used
+ * @param aUri URI
+ * @return MSimpleNameSpace, ownership is transferred.
+ */
+ IMPORT_C static MSimpleNamespace* NewNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri );
+
+ /**
+ * Create new simple Document entity from scratch.
+ * @since S60 3.2
+ * @return MSimpleDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleDocument* NewDocumentL( );
+
+ /**
+ * Create new simple Document entity from xml-document.
+ * @since S60 3.2
+ * @param aXml a valid XML document in PIDF format.
+ * @return MSimpleDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleDocument* NewDocumentL( const TDesC8& aXml );
+
+ /**
+ * Create new simple Document entity from MIME multipart
+ * @since S60 3.2
+ * @param aData MIME multipart data
+ * @param aBoundary MIME multipart boundary
+ * @param aStart MIME multipart start content-id
+ * @return MSimpleDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleDocument* NewDocumentInMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * Create new simple FilterDocument entity.
+ * @since S60 3.2
+ * @return MSimpleFilterDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleFilterDocument* NewFilterDocumentL();
+
+ /**
+ * Create new simple FilterDocument entity.
+ * @since S60 3.2
+ * @param aXml a valid XML document in PIDF format.
+ * @return MSimpleFilterDocument, ownership is transferred.
+ */
+ IMPORT_C static MSimpleFilterDocument* NewFilterDocumentL( const TDesC8& aXml );
+
+ /**
+ * Create new presence list (resource list)
+ * @since S60 3.2
+ * @param aData MIME multipart data
+ * @param aBoundary MIME multipart boundary
+ * @param aStart MIME multipart start content-id
+ * @return MSimplePresenceList, ownership is transferred.
+ */
+ IMPORT_C static MSimplePresenceList* NewPresenceListL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart );
+
+ /**
+ * Create new winfo document
+ * @since S60 3.2
+ * @return MSimpleWinfo, ownership is transferred.
+ */
+ IMPORT_C static MSimpleWinfo* NewWinfoL();
+
+ /**
+ * Create new winfo document
+ * @since S60 3.2
+ * @param aXml XML document
+ * @return MSimpleWinfo, ownership is transferred.
+ */
+ IMPORT_C static MSimpleWinfo* NewWinfoL( const TDesC8& aXml );
+
+ IMPORT_C static MSimpleContent* NewContentL(
+ const TDesC8& aContentID, const TDesC8& aContentType );
+ };
+
+
+#endif // simplexmlfactory_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simpleattribute.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include "simpleattribute.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleAttribute::CSimpleAttribute
+// ----------------------------------------------------------
+//
+CSimpleAttribute::CSimpleAttribute( )
+: iBase( NULL )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::~CSimpleAttribute
+// ----------------------------------------------------------
+//
+CSimpleAttribute::~CSimpleAttribute()
+ {
+ delete iBase;
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::NewL
+// ----------------------------------------------------------
+//
+CSimpleAttribute* CSimpleAttribute::NewL(
+ const TDesC8& aName,
+ const TDesC8& aValue )
+ {
+ CSimpleAttribute* self = new (ELeave) CSimpleAttribute( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aName, aValue );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::NewL
+// ----------------------------------------------------------
+//
+CSimpleAttribute* CSimpleAttribute::NewL(
+ CSenBaseAttribute* aAttr )
+ {
+ CSimpleAttribute* self = new (ELeave) CSimpleAttribute( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aAttr );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleAttribute::ConstructL(
+ const TDesC8& aName,
+ const TDesC8& aValue )
+ {
+ iBase = CSenBaseAttribute::NewL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleAttribute::ConstructL(
+ CSenBaseAttribute* aAttr )
+ {
+ iRef = aAttr;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::BaseElement
+// ----------------------------------------------------------
+//
+CSenBaseAttribute* CSimpleAttribute::BaseElement()
+ {
+ return iBase ? iBase : iRef;
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::Name
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleAttribute::Name()
+ {
+ return BaseElement()->Name();
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::Value
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleAttribute::Value()
+ {
+ return BaseElement()->Value();
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::ValueUniLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleAttribute::ValueUniLC()
+ {
+ // UTF-8 -> Unicode conversion
+ // new buffer is created, ownership is transferred
+ HBufC16* b16 = SenXmlUtils::ToUnicodeLC( BaseElement()->Value( ) );
+ return b16;
+ }
+
+// ----------------------------------------------------------
+// CSimpleAttribute::SetValueL
+// ----------------------------------------------------------
+//
+void CSimpleAttribute::SetValueL( const TDesC& aValue )
+ {
+ HBufC8* b8 = SenXmlUtils::ToUtf8LC( aValue);
+ BaseElement()->SetValueL( b8->Des() );
+ CleanupStack::PopAndDestroy( b8 );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplebasedocument.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "simplebasedocument.h"
+#include "simpleutils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::CSimpleBaseDocument
+// ----------------------------------------------------------
+//
+CSimpleBaseDocument::CSimpleBaseDocument( )
+: iRoot( NULL )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::~CSimpleBaseDocument
+// ----------------------------------------------------------
+//
+CSimpleBaseDocument::~CSimpleBaseDocument()
+ {
+ // Reset and delete namespace C-class entities.
+ iNsps.ResetAndDestroy();
+ // Just reset array of M-class entities,
+ // do not try to delete entities.
+ iMNsps.Reset();
+ // Delete root entity.
+ delete iRoot;
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::BaseConstructL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::BaseConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ iRoot = CSimpleElement::NewL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::BaseConstructL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::BaseConstructL(
+ const TDesC8& aXml )
+ {
+ CSenXmlReader* reader = CSenXmlReader::NewL();
+ CleanupStack::PushL(reader);
+ //create a CSenDomFragment
+ CSenDomFragment* pBase = CSenDomFragment::NewL();
+ CleanupStack::PushL( pBase );
+
+ //must set the content handler
+ reader->SetContentHandler( *pBase );
+ // and the reader
+ pBase->SetReader( *reader );
+ //do the parsing
+ reader->ParseL( aXml );
+
+ // Get the root element
+ // OWNERSHIP IS TRANSFERRED
+ //
+ CSenElement* e = pBase->ExtractElement();
+ const TDesC8& p8 = e->LocalName();
+ ValidateXmlL( p8 );
+ // This is a document root
+ iRoot = CSimpleElement::NewL( e, ETrue );
+
+ CleanupStack::PopAndDestroy( pBase );
+ CleanupStack::PopAndDestroy( reader );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::DefaultNamespace
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleBaseDocument::DefaultNamespace()
+ {
+ TInt err(KErrNone);
+ TPtrC8 p8;
+ TRAP( err, p8.Set( DoDefaultNamespaceL() ));
+ if ( err )
+ {
+ return TPtrC8();
+ }
+ return p8;
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AddNamespaceL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::AddNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ iRoot->BaseElement()->AddNamespaceL( aPrefix, aUri );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::NamespacesL
+// ----------------------------------------------------------
+//
+RPointerArray<MSimpleNamespace>& CSimpleBaseDocument::NamespacesL()
+ {
+ // Notice:
+ // We have to maintain two arrays, one for C-classes and another
+ // for M-classes, since deletion of M-classes does not work.
+ // This is not very good design to return RpointerArray of
+ // M-classes, but let's not change API for this minor drawback.
+
+ // reset old stuff
+ iNsps.ResetAndDestroy();
+ iMNsps.Reset();
+
+ RPointerArray<CSenNamespace>& nsa = iRoot->BaseElement()->NamespacesL();
+
+ TInt elemCount = nsa.Count();
+ for ( TInt i = 0; i < elemCount; i++ )
+ {
+ CSenNamespace* ns = nsa[i];
+ CSimpleNamespace* simpleNs = CSimpleNamespace::NewL( ns->Prefix(), ns->URI() );
+ User::LeaveIfError( iNsps.Append( simpleNs ) );
+ User::LeaveIfError( iMNsps.Append( simpleNs ) );
+ }
+
+ return iMNsps;
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::ExternalizeL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::ExternalizeL( RWriteStream& aStream )
+ {
+ aStream.WriteL( KSimpleXmlStart );
+ iRoot->BaseElement()->WriteAsXMLToL( aStream);
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::Close
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::Close()
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleBaseDocument::LocalName()
+ {
+ return iRoot->LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleBaseDocument::DefNamespaceL()
+ {
+ return iRoot->DefNamespaceL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleBaseDocument::HasContent()
+ {
+ return iRoot->HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleBaseDocument::ContentUnicodeL()
+ {
+ return iRoot->ContentUnicodeL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::SetContentUnicodeL( const TDesC& aContent )
+ {
+ iRoot->SetContentUnicodeL( aContent );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleBaseDocument::SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray )
+ {
+ return iRoot->SimpleElementsL( aElementArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleBaseDocument::AttrValueLC( const TDesC8& aName )
+ {
+ return iRoot->AttrValueLC( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleBaseDocument::AttrValue( const TDesC8& aName )
+ {
+ return iRoot->AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ iRoot->AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleBaseDocument::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ return iRoot->SimpleAttributesL( aArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::SimpleParentL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleBaseDocument::SimpleParentL()
+ {
+ return iRoot->SimpleParentL( );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::DetachSimpleL()
+ {
+ return iRoot->DetachSimpleL( );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleBaseDocument::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return iRoot->AddSimpleElementL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleBaseDocument::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ return iRoot->AddSimpleElementL( aLocalName );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleBaseDocument::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ iRoot->RemoveSimpleElement( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::Root
+// ----------------------------------------------------------
+//
+CSimpleElement* CSimpleBaseDocument::Root()
+ {
+ return iRoot;
+ }
+
+// ----------------------------------------------------------
+// CSimpleBaseDocument::DoDefaultNamespaceL
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleBaseDocument::DoDefaultNamespaceL()
+ {
+ RPointerArray<CSenNamespace>& nsa = iRoot->BaseElement()->NamespacesL();
+ TInt elemCount = nsa.Count();
+ if ( !elemCount )
+ {
+ User::Leave( KErrNotFound );
+ }
+ CSenNamespace* ns = nsa[0];
+ return ns->URI();
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplecontent.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SIMPLE Engine simple content
+*
+*/
+
+
+
+
+
+// *** system include files go here:
+#include <e32std.h>
+#include <s32strm.h>
+#include "simplecontent.h"
+#include "simplecommon.h"
+
+
+// *** local constants go here:
+
+
+// ----------------------------------------------------------
+// CSimpleContent::CSimpleContent
+// ----------------------------------------------------------
+//
+CSimpleContent::CSimpleContent( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::~CSimpleContent
+// ---------------------------------------------------------------------------
+//
+CSimpleContent::~CSimpleContent()
+ {
+ delete iContentID;
+ delete iContentType;
+ delete iBody;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::NewL
+// ---------------------------------------------------------------------------
+//
+CSimpleContent* CSimpleContent::NewL(
+ const TDesC8& aContentID, const TDesC8& aContentType )
+ {
+ CSimpleContent* self = CSimpleContent::NewLC(
+ aContentID, aContentType );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::NewLC
+// ---------------------------------------------------------------------------
+//
+CSimpleContent* CSimpleContent::NewLC(
+ const TDesC8& aContentID, const TDesC8& aContentType )
+ {
+ CSimpleContent* self = new( ELeave ) CSimpleContent;
+ CleanupStack::PushL( self );
+ self->ConstructL( aContentID, aContentType );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::Body
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimpleContent::Body()
+ {
+ return iBody ? iBody->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::GiveBodyOwnerShip
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSimpleContent::GiveBodyOwnerShip()
+ {
+ HBufC8* body = iBody;
+ iBody = NULL;
+ return body;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::Close
+// ---------------------------------------------------------------------------
+//
+void CSimpleContent::Close()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSimpleContent::ConstructL(
+ const TDesC8& aContentID, const TDesC8& aContentType )
+ {
+ iContentID = aContentID.AllocL();
+ iContentType = aContentType.AllocL();
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::CopyBodyL
+// ---------------------------------------------------------------------------
+//
+void CSimpleContent::CopyBodyL( const TDesC8& aData )
+ {
+ delete iBody;
+ iBody = NULL;
+ iBody = aData.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::SetBody
+// ---------------------------------------------------------------------------
+//
+void CSimpleContent::SetBody( HBufC8* aData )
+ {
+ delete iBody;
+ iBody = aData;
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::ContentID
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimpleContent::ContentID()
+ {
+ return iContentID ? iContentID->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------------------------
+// CSimpleContent::ContentType
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CSimpleContent::ContentType()
+ {
+ return iContentType ? iContentType->Des() : TPtrC8();
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simpledocument.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,745 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32def.h> // First to avoid NULL redefine warning (no #ifndef NULL).
+#include <e32std.h>
+#include <string.h>
+
+#include <imcvcodc.h>
+
+// #include <e32std.h>
+#include <s32strm.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+#include <multipartparser.h>
+#include <bodypart.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "simpledocument.h"
+#include "simplebasedocument.h"
+#include "simpleutils.h"
+#include "simplecontent.h"
+
+
+_LIT8 ( KSimpleEntity, "entity");
+
+// Multipart CONSTANTS
+
+const char Multipart_CRLF_Text[] = {"\r\n"};
+const char Multipart_DoubleCRLF_Text[] = {"\r\n\r\n"};
+
+// MACROS
+#define MULTIPART_CONTENT_LOCATION_LENGTH 17
+#define MULTIPART_CONTENT_TYPE_LENGTH 13
+#define MULTIPART_CONTENT_TRANSFER_ENCODING_LENGTH 26
+// violates RFC2045; but upon vodafone request
+#define MULTIPART_CONTENT_ENCODING_LENGTH 17
+#define MULTIPART_CONTENT_LENGTH_LENGTH 15
+#define MULTIPART_LAST_MODIFIED_LENGTH 14
+#define MULTIPART_CONTENT_ID_LENGTH 11
+
+#define MULTIPART_CONTENT_LOCATION 2
+#define MULTIPART_CONTENT_TRANSFER_ENCODING 3
+#define MULTIPART_CONTENT_TYPE 4
+#define MULTIPART_CONTENT_ID 5
+
+#define MULTIPART_INTERNET_DATE_STRING_LENGTH 29
+
+#define SLASH_CHAR '/'
+#define DOT_CHAR '.'
+#define AT_CHAR '@'
+#define COLON_CHAR ':'
+// <scheme>://
+// #define SCHEME_SEPARATOR_LENGTH 3
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleDocument::CSimpleDocument
+// ----------------------------------------------------------
+//
+CSimpleDocument::CSimpleDocument( )
+: CSimpleBaseDocument()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::~CSimpleDocument
+// ----------------------------------------------------------
+//
+CSimpleDocument::~CSimpleDocument()
+ {
+ iContents.ResetAndDestroy();
+ iContents.Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ BaseConstructL(aNsUri, aLocalName);
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ConstructMultiPartL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ConstructMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ _LIT(KUrl, "http://dummy.com/d1/d.html");
+
+ // body part array
+ RPointerArray<CBodyPart> bodyPartArray;
+ TCleanupItem clItem( ResetAndDestroy, &bodyPartArray );
+ CleanupStack::PushL( clItem );
+
+ // remove "..." characters from boundary if needed
+ TPtrC8 pUnQuoted = aBoundary;
+ TInt quoted = aBoundary.Locate('"');
+ if (!quoted)
+ {
+ pUnQuoted.Set( aBoundary.Mid( 1, aBoundary.Length() - 2 ));
+ }
+ // parse
+ MultipartParser::ParseL( aData, KSimpleMultipartType, pUnQuoted, KUrl, bodyPartArray );
+ DoConstructL( bodyPartArray, aStart );
+
+ CleanupStack::PopAndDestroy( ); // bodyPartArray
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ConstructL(
+ const TDesC8& aXml )
+ {
+ BaseConstructL( aXml );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::NewL
+// ----------------------------------------------------------
+//
+CSimpleDocument* CSimpleDocument::NewL( )
+ {
+ CSimpleDocument* self = new (ELeave) CSimpleDocument( );
+ CleanupStack::PushL( self );
+ self->ConstructL( KSimpleNsDefault, KDocumentLocalName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::NewL
+// ----------------------------------------------------------
+//
+CSimpleDocument* CSimpleDocument::NewL( const TDesC8& aXml )
+ {
+ CSimpleDocument* self = new (ELeave) CSimpleDocument( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXml );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::NewInMultiPartL
+// ----------------------------------------------------------
+//
+CSimpleDocument* CSimpleDocument::NewInMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ CSimpleDocument* self = new (ELeave) CSimpleDocument( );
+ CleanupStack::PushL( self );
+ self->ConstructMultiPartL( aData, aBoundary, aStart );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::GetDirectContentsL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::GetDirectContentsL(
+ RPointerArray<MSimpleContent>& aContents )
+ {
+ aContents.Reset();
+ TInt myCount = iContents.Count();
+ for ( TInt i = 0; i<myCount; i++ )
+ {
+ User::LeaveIfError( aContents.Append( iContents[i] ));
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::AddDirectContentL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::AddDirectContentL(
+ MSimpleContent& aContent,
+ TBool aCopyContent )
+ {
+ CSimpleContent* content = CSimpleContent::NewLC(
+ aContent.ContentID(), aContent.ContentType());
+ User::LeaveIfError( iContents.Append( content ));
+ CleanupStack::Pop( content );
+
+ if ( aCopyContent )
+ {
+ content->CopyBodyL( aContent.Body() );
+ }
+ else
+ {
+ content->SetBody( aContent.GiveBodyOwnerShip() );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ValidateXmlL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ValidateXmlL( const TDesC8& aName )
+ {
+ if ( aName.CompareF( KDocumentLocalName ) )
+ {
+ User::Leave( KErrCorrupt );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::EntityURI
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleDocument::EntityURI()
+ {
+ return Root()->AttrValue( KSimpleEntity );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::SetEntityURIL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::SetEntityURIL( const TDesC8& aValue )
+ {
+ Root()->AddAttr8L( KSimpleEntity, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::DefaultNamespace
+// ----------------------------------------------------------
+//
+
+TPtrC8 CSimpleDocument::DefaultNamespace()
+ {
+ return CSimpleBaseDocument::DefaultNamespace();
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleDocument::AddNamespaceL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::AddNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ CSimpleBaseDocument::AddNamespaceL( aPrefix, aUri );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::NamespacesL
+// ----------------------------------------------------------
+//
+RPointerArray<MSimpleNamespace>& CSimpleDocument::NamespacesL()
+ {
+ return CSimpleBaseDocument::NamespacesL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ExternalizeL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ExternalizeL( RWriteStream& aStream )
+ {
+
+ // notice: check the max message size
+
+ if ( !iContents.Count() )
+ {
+ // single pidf+xml
+ CSimpleBaseDocument::ExternalizeL( aStream );
+ }
+ else
+ {
+ RPointerArray<CBodyPart> bodyPartsArray;
+ RPointerArray<HBufC8> bufferArray;
+
+ TRAPD( err, DoExternalizeMultiPartL( bodyPartsArray, bufferArray, aStream ) );
+
+ bufferArray.ResetAndDestroy();
+ bodyPartsArray.ResetAndDestroy();
+ bufferArray.Close();
+ bodyPartsArray.Close();
+
+ User::LeaveIfError( err );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::Close
+// ----------------------------------------------------------
+//
+void CSimpleDocument::Close()
+ {
+ CSimpleBaseDocument::Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleDocument::LocalName()
+ {
+ return CSimpleBaseDocument::LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleDocument::DefNamespaceL()
+ {
+ return CSimpleBaseDocument::DefNamespaceL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleDocument::HasContent()
+ {
+ return CSimpleBaseDocument::HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleDocument::ContentUnicodeL()
+ {
+ return CSimpleBaseDocument::ContentUnicodeL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::SetContentUnicodeL( const TDesC& aContent )
+ {
+ CSimpleBaseDocument::SetContentUnicodeL( aContent );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleDocument::SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray )
+ {
+ return CSimpleBaseDocument::SimpleElementsL( aElementArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleDocument::AttrValueLC( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValueLC( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleDocument::AttrValue( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ CSimpleBaseDocument::AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleDocument::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ return CSimpleBaseDocument::SimpleAttributesL( aArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::SimpleParentL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleDocument::SimpleParentL()
+ {
+ return NULL;
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::DetachSimpleL()
+ {
+ User::Leave( KErrNotFound );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleDocument::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleDocument::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleDocument::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aLocalName );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleDocument::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleDocument::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSimpleBaseDocument::RemoveSimpleElement( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::ResetAndDestroy
+// ----------------------------------------------------------
+//
+void CSimpleDocument::ResetAndDestroy( TAny* aPtrArray )
+ {
+ RPointerArray<CBodyPart>* array =
+ static_cast<RPointerArray<CBodyPart>*>( aPtrArray );
+ array->ResetAndDestroy();
+ array->Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleDocument::DoConstructL
+// ----------------------------------------------------------
+//
+void CSimpleDocument::DoConstructL(
+ RPointerArray<CBodyPart>& aParts, const TDesC8& aStart )
+ {
+ // Handle body parts one by one
+ TInt size = aParts.Count();
+ TInt i;
+ CBodyPart* cp = NULL;
+ TPtrC8 boundary;
+ TPtrC8 start;
+
+ TBool pidfOk ( EFalse );
+
+
+ for (i = 0; i < size; i++)
+ {
+ cp = aParts[i];
+
+ if ( (( aStart.Length() > 0 && !aStart.Compare( cp->ContentID()) ) ||
+ !pidfOk ) &&
+ !cp->ContentType().Left(sizeof(KSimpleDocumentType)).CompareF( KSimpleDocumentType ))
+ {
+ // Multipart root is in the pidf+xml format
+ BaseConstructL( cp->Body() );
+ pidfOk = ETrue;
+ }
+ else
+ {
+ // Direct contents, as a separate MIME multipart parts
+ CSimpleContent* cd = CSimpleContent::NewL(
+ cp->ContentID(), cp->ContentType() );
+ cd->CopyBodyL( cp->Body() );
+ CleanupStack::PushL( cd );
+ User::LeaveIfError( iContents.Append( cd ) );
+ CleanupStack::Pop( cd );
+ }
+ }
+ }
+
+// -------------------------------------------------------------------------
+// CSimpleDocument::DoComposeMultiPartL
+// -------------------------------------------------------------------------
+HBufC8* CSimpleDocument::DoComposeMultiPartL( RPointerArray<CBodyPart>& aBodyArray,
+ const TDesC8& aBoundary )
+ {
+ // --(aBoundary)
+ using namespace NSimpleDocument;
+ HBufC8* boundary = HBufC8::NewLC( aBoundary.Length() + 4 );
+ boundary->Des().Format( KBoundary, &aBoundary );
+
+ // CALCULATE the size of this document.
+ TInt bodySize = 0;
+ // a. for each CBodyPart
+ // boundaries + CRLF between headers and body (constant addition)
+ bodySize += (boundary->Length() + strlen(Multipart_CRLF_Text)) * aBodyArray.Count() ;
+ TInt bodyCounter = aBodyArray.Count();
+ for (TInt i = 0; i < bodyCounter; i++)
+ {
+ if (!(aBodyArray[i]->Headers().Length() +
+ aBodyArray[i]->Body().Length()))
+ {
+ // one less boundary
+ bodySize -= boundary->Length() + strlen(Multipart_CRLF_Text);
+ // skip empty bodypart
+ continue;
+ }
+ bodySize += aBodyArray[i]->Headers().Length();
+ // ensure there are only 2 CRLFs between header and body
+ if (aBodyArray[i]->Headers().Length() > 0)
+ {
+ TPtrC8 bodyHeaders(aBodyArray[i]->Headers().Ptr(), aBodyArray[i]->Headers().Length());
+ TUint newEnd = bodyHeaders.Length() - 1;
+ while( bodyHeaders[ newEnd ] == '\r' || bodyHeaders[ newEnd ] == '\n' )
+ {
+ --newEnd;
+ --bodySize;
+ }
+ // two CRLFs
+ bodySize += strlen(Multipart_CRLF_Text);
+ }
+ bodySize += aBodyArray[i]->Body().Length();
+ // CRLF (end of body, add one only if there is body AND does not end with CRLF)
+ TPtrC8 bodyBody(aBodyArray[i]->Body().Ptr(), aBodyArray[i]->Body().Length());
+ if (bodyBody.Length() > 0
+ && bodyBody.Right(2) != TPtrC8((TUint8*)Multipart_CRLF_Text, strlen(Multipart_CRLF_Text)))
+ {
+ bodySize += strlen(Multipart_CRLF_Text);
+ }
+ }
+ // end boundary (boundary - '\r\n' + "--")
+ bodySize += boundary->Length();
+ TInt docSize = bodySize;
+
+ // CALCULATE the size of Headers
+ using namespace NSimpleDocument::NSimpleMulti;
+
+ // extra CRLF for separating header and body
+ docSize += strlen(Multipart_CRLF_Text);
+ // CALCULATION COMPLETE
+ // at this point, bodySize contains the size of bodyparts, i.e. Content-Length:
+ // and docSize contains the size of the entire document (use it to create HBufC8*
+ // of appropriate size)
+
+ // CONSTRUCT MULTIPART DOCUMENT
+ HBufC8* document = HBufC8::NewLC(docSize);
+
+ TPtr8 docAppend(document->Des());
+
+ // BODYPARTS
+ for (TInt i = 0; i < aBodyArray.Count(); i++)
+ {
+ if (!(aBodyArray[i]->Headers().Length() +
+ aBodyArray[i]->Body().Length()))
+ {
+ // skip empty bodypart
+ continue;
+ }
+ docAppend.Append( *boundary );
+ TInt headerLength = aBodyArray[i]->Headers().Length() - 1;
+ while ( headerLength > 0 &&
+ (aBodyArray[i]->Headers()[headerLength] == '\r'
+ || aBodyArray[i]->Headers()[headerLength] == '\n' ))
+ {
+ --headerLength;
+ }
+ docAppend.Append( aBodyArray[i]->Headers().Ptr(), headerLength + 1 );
+
+ if ( headerLength > 0 )
+ {
+ docAppend.Append((TUint8*)Multipart_DoubleCRLF_Text, strlen(Multipart_DoubleCRLF_Text));
+ }
+ else
+ {
+ docAppend.Append((TUint8*)Multipart_CRLF_Text, strlen(Multipart_CRLF_Text));
+ }
+ // body
+ TPtrC8 opa = aBodyArray[i]->Body();
+ docAppend.Append(aBodyArray[i]->Body());
+ // CRLF only if body exists and doesn't end with CRLF
+ TPtrC8 bodyBody(aBodyArray[i]->Body().Ptr(), aBodyArray[i]->Body().Length());
+ if (bodyBody.Length() > 0
+ && bodyBody.Right(2) != TPtrC8((TUint8*)Multipart_CRLF_Text, strlen(Multipart_CRLF_Text)))
+ {
+ docAppend.Append((TUint8*)Multipart_CRLF_Text, strlen(Multipart_CRLF_Text));
+ }
+ }
+ // end boundary
+ docAppend.AppendFormat(KEndBoundary, &aBoundary);
+ CleanupStack::Pop( document );
+ CleanupStack::PopAndDestroy( boundary );
+ return document;
+ }
+
+// -------------------------------------------------------------------------
+// CSimpleDocument::DoExternalizeMultiPartL
+// -------------------------------------------------------------------------
+void CSimpleDocument::DoExternalizeMultiPartL(
+ RPointerArray<CBodyPart>& aBodies,
+ RPointerArray<HBufC8>& aBuffers,
+ RWriteStream& aStream )
+ {
+ const TReal KB64Expand = 1.5; // reserve room for Base64 encoding
+ const TInt KBufferSize = 500;
+
+ // Convert all the multipart into CBodyPart.
+
+ // Let's convert first ROOT element into CBodyPart
+ CBodyPart* root = CBodyPart::NewL();
+ // Add into cleanup array
+ aBodies.Append( root );
+ CSenElement* e = Root()->BaseElement();
+
+ // externalize the document into stream
+ CBufFlat* myBuffer = CBufFlat::NewL( KBufferSize );
+ CleanupStack::PushL( myBuffer );
+ myBuffer->Reset();
+
+ RBufWriteStream stream( *myBuffer );
+ stream.Open( *myBuffer );
+ CSimpleBaseDocument::ExternalizeL( stream );
+ stream.Close();
+
+ // Add content, no need to transfer encode
+ TPtrC8 body ( myBuffer->Ptr(0) );
+ root->SetBody( body );
+
+ // Handle the headers of the ROOT part
+ using namespace NSimpleDocument::NSimpleRoot;
+
+ // calculate the size of headers
+ TInt headerSize = KContentTypeSize + KCIDSize;
+ HBufC8* headers = HBufC8::NewL( headerSize );
+ aBuffers.Append( headers );
+ TPtr8 pH(headers->Des());
+ // append to MIME headers for the root part
+ pH.Append( NSimpleDocument::NSimpleRoot::KContentType );
+ pH.Append( NSimpleDocument::NSimpleRoot::KCID );
+ root->SetHeaders( pH );
+
+ // handle the direct contents one by one
+ TInt contCount = iContents.Count();
+ for ( TInt i=0; i<contCount; i++ )
+ {
+ // Let's convert next element into CBodyPart
+ CBodyPart* cp = CBodyPart::NewL();
+ aBodies.Append( cp );
+
+ // Set Headers
+ headerSize = NSimpleDocument::NSimpleContent::KContentTypeSize +
+ NSimpleDocument::NSimpleContent::KCIDSize +
+ NSimpleDocument::NSimpleContent::KContentEncodingSize;
+ headerSize += (iContents[i])->ContentID().Length();
+ headerSize += (iContents[i])->ContentType().Length();
+
+ headers = HBufC8::NewL( headerSize );
+ // Append to cleanup array
+ aBuffers.Append( headers );
+ pH.Set( headers->Des() );
+
+ // _LIT8( KMyContentType, "Content-Type: %S\r\n");
+ TPtrC8 myValue = (iContents[i])->ContentType();
+ pH.Format( NSimpleDocument::NSimpleContent::KContentType, &myValue );
+ myValue.Set((iContents[i])->ContentID() );
+ pH.AppendFormat( NSimpleDocument::NSimpleContent::KCID, &myValue );
+ pH.Append( NSimpleDocument::NSimpleContent::KContentEncoding );
+ // append to MIME headers
+ cp->SetHeaders( pH );
+
+ // Body
+
+ // BASE64 encode
+ HBufC8* body64 = HBufC8::NewL( (iContents[i])->Body().Length() * KB64Expand );
+ aBuffers.Append( body64 );
+ TImCodecB64 codec64;
+ codec64.Initialise();
+ TPtr8 desti8 = body64->Des();
+
+ // notice: leave if error?
+ TInt err = codec64.Encode( (iContents[i])->Body(), desti8 );
+
+ cp->SetBody( body64->Des() );
+ }
+
+ // Compose the multipart MIME flat data
+ HBufC8* entireMsg = NULL;
+ entireMsg = DoComposeMultiPartL( aBodies, NSimpleDocument::KSimpleBoundary );
+ CleanupStack::PushL( entireMsg );
+ // Finally stream entireMsg,
+ // Notice: later DoComposeMultiPartL could stream directly?
+ aStream.WriteL( entireMsg->Des() );
+ CleanupStack::PopAndDestroy( entireMsg );
+ CleanupStack::PopAndDestroy( myBuffer );
+
+ }
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simpleelement.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+
+// own simple
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "msimplenamespace.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleElement::CSimpleElement
+// ----------------------------------------------------------
+//
+CSimpleElement::CSimpleElement( )
+: iBase(NULL), iRef(NULL)
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::~CSimpleElement
+// ----------------------------------------------------------
+//
+CSimpleElement::~CSimpleElement()
+ {
+ iAttributes.ResetAndDestroy();
+ iElements.ResetAndDestroy();
+ delete iBase;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleElement::ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ if ( aNsUri.Length() )
+ {
+ iBase = CSenBaseElement::NewL( aNsUri, aLocalName);
+ }
+ else
+ {
+ iBase = CSenBaseElement::NewL( aLocalName );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleElement::ConstructL(
+ CSenElement* aElem, TBool aOwn )
+ {
+ if ( aOwn )
+ {
+ iBase = aElem;
+ }
+ else
+ {
+ iRef = aElem;
+ }
+
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::NewL
+// ----------------------------------------------------------
+//
+CSimpleElement* CSimpleElement::NewL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSimpleElement* self = new (ELeave) CSimpleElement( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aNsUri, aLocalName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::NewL
+// ----------------------------------------------------------
+//
+CSimpleElement* CSimpleElement::NewL(
+ CSenElement* aElement, TBool aOwn )
+ {
+ CSimpleElement* self = new (ELeave) CSimpleElement( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElement, aOwn );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::BaseElement
+// ----------------------------------------------------------
+//
+CSenElement* CSimpleElement::BaseElement()
+ {
+ return iBase ? iBase : iRef;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::Close
+// ----------------------------------------------------------
+//
+void CSimpleElement::Close()
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleElement::LocalName()
+ {
+ return BaseElement()->LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleElement::DefNamespaceL()
+ {
+ const CSenNamespace* ns = BaseElement()->Namespace();
+ if ( !ns )
+ {
+ return NULL;
+ }
+ CSimpleNamespace* simpleNs = CSimpleNamespace::NewL( ns->Prefix(), ns->URI() );
+ return simpleNs;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleElement::HasContent()
+ {
+ return BaseElement()->HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleElement::ContentUnicodeL()
+ {
+ // UTF-8 -> Unicode conversion
+ TRAPD( errx, SenXmlUtils::LeaveOnXmlEscapesL( BaseElement()->Content()));
+ if ( errx )
+ {
+ HBufC8* b8 = SenXmlUtils::DecodeHttpCharactersLC( BaseElement()->Content());
+ HBufC16* uniB = SenXmlUtils::ToUnicodeLC( b8->Des() );
+ CleanupStack::Pop( uniB );
+ CleanupStack::PopAndDestroy( b8 );
+ return uniB;
+ }
+ else
+ {
+ return BaseElement()->ContentUnicodeL();
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleElement::SetContentUnicodeL( const TDesC& aContent )
+ {
+ // Unicode -> UTF-8 conversion
+ HBufC8* b8 = SenXmlUtils::ToUtf8LC( aContent);
+ TRAPD( errx, SenXmlUtils::LeaveOnXmlEscapesL( b8->Des()));
+ if ( errx )
+ {
+ HBufC8* b8escaped = SenXmlUtils::EncodeHttpCharactersLC( b8->Des());
+ BaseElement()->SetContentL( b8escaped->Des() );
+ CleanupStack::PopAndDestroy( b8escaped );
+ }
+ else
+ {
+ BaseElement()->SetContentL( b8->Des() );
+ }
+ CleanupStack::PopAndDestroy( b8);
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleElement::SimpleElementsL(
+ RPointerArray<MSimpleElement>& aElementArray )
+ {
+ // Reset the output array first.
+ aElementArray.Reset();
+ iElements.ResetAndDestroy();
+
+ // Go through CSenElements and convert them one by one and
+ // add to the output array.
+ RPointerArray<CSenElement>& elems = BaseElement()->ElementsL();
+ TInt elemCount = elems.Count();
+ for ( TInt i = 0; i < elemCount; i++ )
+ {
+ CSenElement* pElement = elems[i];
+ CSimpleElement* simple = CSimpleElement::NewL( pElement, EFalse );
+ CleanupStack::PushL( simple );
+ User::LeaveIfError( aElementArray.Append( simple ));
+ CleanupStack::Pop( simple );
+ User::LeaveIfError( iElements.Append( simple ) );
+ }
+ return elemCount ? KErrNone : KErrNotFound;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleElement::AttrValueLC( const TDesC8& aName )
+ {
+ // Get 8-bit data, ownership is not transferred
+ const TDesC8* p8 = BaseElement()->AttrValue( aName );
+ // UTF-8 -> Unicode conversion
+ // new buffer is created
+ HBufC16* b16 = SenXmlUtils::ToUnicodeLC( *p8 );
+ return b16;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleElement::AttrValue( const TDesC8& aName )
+ {
+ // Get 8-bit data, ownership is not transferred
+ return BaseElement()->AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleElement::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ // Unicode -> UTF-8 conversion
+ HBufC8* b8 = SenXmlUtils::ToUtf8LC( aValue);
+ BaseElement()->AddAttrL( aName, b8->Des() );
+ CleanupStack::PopAndDestroy( b8 );
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AddAttr8L
+// ----------------------------------------------------------
+//
+void CSimpleElement::AddAttr8L( const TDesC8& aName, const TDesC8& aValue )
+ {
+ BaseElement()->AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleElement::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ // Reset the output array first.
+ aArray.Reset();
+ iAttributes.ResetAndDestroy();
+
+ // Go through CSenAttributes and convert them one by one and add to the output array.
+ RPointerArray<CSenBaseAttribute>& elems = BaseElement()->AttributesL();
+ TInt elemCount = elems.Count();
+ for ( TInt i = 0; i < elemCount; i++ )
+ {
+ CSenBaseAttribute* pAttr = elems[i];
+ CSimpleAttribute* attr = CSimpleAttribute::NewL( pAttr );
+ CleanupStack::PushL( attr );
+ User::LeaveIfError(iAttributes.Append( attr ));
+ CleanupStack::Pop( attr );
+ User::LeaveIfError(aArray.Append( attr ));
+ }
+ return elemCount ? KErrNone : KErrNotFound;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::SimpleParentL
+// OWNERSHIP IS TRANSFERRED
+// ----------------------------------------------------------
+//
+CSimpleElement* CSimpleElement::SimpleParentL()
+ {
+ CSenElement* el = BaseElement()->Parent();
+ if ( !el )
+ {
+ return NULL;
+ }
+ CSimpleElement* simple = CSimpleElement::NewL( el, ETrue );
+ return simple;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleElement::DetachSimpleL()
+ {
+ // Ownership in not transferred.
+ CSenElement* e = BaseElement()->DetachL();
+ if (!e)
+ {
+ User::Leave( KErrNotFound );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleElement::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSenElement& e = BaseElement()->AddElementL( aNsUri, aLocalName );
+ CSimpleElement* simple = CSimpleElement::NewL( &e, EFalse );
+ return simple;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleElement::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ CSenElement& e = BaseElement()->AddElementL( aLocalName );
+ CSimpleElement* simple = CSimpleElement::NewL( &e, EFalse );
+ return simple;
+ }
+
+// ----------------------------------------------------------
+// CSimpleElement::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleElement::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSenElement* e = BaseElement()->RemoveElement( aNsUri, aLocalName );
+ delete e;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplefilter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "simplebasedocument.h"
+#include "simpleutils.h"
+#include "simplefilter.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleFilter::CSimpleFilter
+// ----------------------------------------------------------
+//
+CSimpleFilter::CSimpleFilter( )
+: CSimpleBaseDocument()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::~CSimpleFilter
+// ----------------------------------------------------------
+//
+CSimpleFilter::~CSimpleFilter()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ BaseConstructL(aNsUri, aLocalName);
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::ConstructL(
+ const TDesC8& aXml )
+ {
+ BaseConstructL( aXml );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::NewL
+// ----------------------------------------------------------
+//
+CSimpleFilter* CSimpleFilter::NewL( )
+ {
+ CSimpleFilter* self = new (ELeave) CSimpleFilter( );
+ CleanupStack::PushL( self );
+ self->ConstructL( KSimpleNsFilter, KFilterLocalName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::NewL
+// ----------------------------------------------------------
+//
+CSimpleFilter* CSimpleFilter::NewL( const TDesC8& aXml )
+ {
+ CSimpleFilter* self = new (ELeave) CSimpleFilter( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXml );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::ValidateXmlL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::ValidateXmlL( const TDesC8& aName )
+ {
+ if ( aName.CompareF( KFilterLocalName ) )
+ {
+ User::Leave( KErrCorrupt );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::DefaultNamespace
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleFilter::DefaultNamespace()
+ {
+ return CSimpleBaseDocument::DefaultNamespace();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AddNamespaceL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::AddNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ CSimpleBaseDocument::AddNamespaceL( aPrefix, aUri );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::NamespacesL
+// ----------------------------------------------------------
+//
+RPointerArray<MSimpleNamespace>& CSimpleFilter::NamespacesL()
+ {
+ return CSimpleBaseDocument::NamespacesL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::ExternalizeL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::ExternalizeL( RWriteStream& aStream )
+ {
+ CSimpleBaseDocument::ExternalizeL( aStream );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::Close
+// ----------------------------------------------------------
+//
+void CSimpleFilter::Close()
+ {
+ CSimpleBaseDocument::Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleFilter::LocalName()
+ {
+ return CSimpleBaseDocument::LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleFilter::DefNamespaceL()
+ {
+ return CSimpleBaseDocument::DefNamespaceL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleFilter::HasContent()
+ {
+ return CSimpleBaseDocument::HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleFilter::ContentUnicodeL()
+ {
+ return CSimpleBaseDocument::ContentUnicodeL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::SetContentUnicodeL( const TDesC& aContent )
+ {
+ CSimpleBaseDocument::SetContentUnicodeL( aContent );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleFilter::SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray )
+ {
+ return CSimpleBaseDocument::SimpleElementsL( aElementArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleFilter::AttrValueLC( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValueLC( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleFilter::AttrValue( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ CSimpleBaseDocument::AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleFilter::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ return CSimpleBaseDocument::SimpleAttributesL( aArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::SimpleParentL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleFilter::SimpleParentL()
+ {
+ return CSimpleBaseDocument::SimpleParentL( );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleFilter::DetachSimpleL()
+ {
+ User::Leave( KErrNotFound );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleFilter::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleFilter::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleFilter::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleFilter::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSimpleBaseDocument::RemoveSimpleElement( aNsUri, aLocalName );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplemeta.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "simplemeta.h"
+#include "simplebasedocument.h"
+#include "simpleutils.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleMeta::CSimpleMeta
+// ----------------------------------------------------------
+//
+CSimpleMeta::CSimpleMeta( )
+: CSimpleBaseDocument()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::~CSimpleMeta
+// ----------------------------------------------------------
+//
+CSimpleMeta::~CSimpleMeta()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ BaseConstructL(aNsUri, aLocalName);
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::ConstructL(
+ const TDesC8& aXml )
+ {
+ BaseConstructL( aXml );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::NewL
+// ----------------------------------------------------------
+//
+CSimpleMeta* CSimpleMeta::NewL( const TDesC8& aXml )
+ {
+ CSimpleMeta* self = new (ELeave) CSimpleMeta( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXml );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::ValidateXmlL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::ValidateXmlL( const TDesC8& aName )
+ {
+ if ( aName.CompareF( KRlmiLocalName ) )
+ {
+ User::Leave( KErrCorrupt );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::DefaultNamespace
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleMeta::DefaultNamespace()
+ {
+ return CSimpleBaseDocument::DefaultNamespace();
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleMeta::AddNamespaceL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::AddNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ CSimpleBaseDocument::AddNamespaceL( aPrefix, aUri );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::NamespacesL
+// ----------------------------------------------------------
+//
+RPointerArray<MSimpleNamespace>& CSimpleMeta::NamespacesL()
+ {
+ return CSimpleBaseDocument::NamespacesL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::ExternalizeL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::ExternalizeL( RWriteStream& aStream )
+ {
+ CSimpleBaseDocument::ExternalizeL( aStream );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::Close
+// ----------------------------------------------------------
+//
+void CSimpleMeta::Close()
+ {
+ CSimpleBaseDocument::Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleMeta::LocalName()
+ {
+ return CSimpleBaseDocument::LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleMeta::DefNamespaceL()
+ {
+ return CSimpleBaseDocument::DefNamespaceL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleMeta::HasContent()
+ {
+ return CSimpleBaseDocument::HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleMeta::ContentUnicodeL()
+ {
+ return CSimpleBaseDocument::ContentUnicodeL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::SetContentUnicodeL( const TDesC& aContent )
+ {
+ CSimpleBaseDocument::SetContentUnicodeL( aContent );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleMeta::SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray )
+ {
+ return CSimpleBaseDocument::SimpleElementsL( aElementArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleMeta::AttrValueLC( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValueLC( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleMeta::AttrValue( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ CSimpleBaseDocument::AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleMeta::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ return CSimpleBaseDocument::SimpleAttributesL( aArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::SimpleParentL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleMeta::SimpleParentL()
+ {
+ return CSimpleBaseDocument::SimpleParentL( );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleMeta::DetachSimpleL()
+ {
+ User::Leave( KErrNotFound );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleMeta::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleMeta::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleMeta::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleMeta::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aLocalName );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleMeta::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleMeta::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSimpleBaseDocument::RemoveSimpleElement( aNsUri, aLocalName );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplenamespace.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+#include <SenNameSpace.h>
+#include "simplenamespace.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleNamespace::CSimpleNamespace
+// ----------------------------------------------------------
+//
+CSimpleNamespace::CSimpleNamespace( )
+: iPrefix( NULL ), iUri(NULL)
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::~CSimpleNamespace
+// ----------------------------------------------------------
+//
+CSimpleNamespace::~CSimpleNamespace()
+ {
+ delete iPrefix;
+ delete iUri;
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::NewL
+// ----------------------------------------------------------
+//
+CSimpleNamespace* CSimpleNamespace::NewL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri)
+ {
+ CSimpleNamespace* self = new (ELeave) CSimpleNamespace( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aPrefix, aUri );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleNamespace::ConstructL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri)
+ {
+ iUri = aUri.AllocL();
+ iPrefix = aPrefix.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::Close
+// ----------------------------------------------------------
+//
+void CSimpleNamespace::Close()
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::URI
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleNamespace::URI()
+ {
+ if ( iUri )
+ {
+ return TPtrC8(*iUri);
+ }
+ else
+ {
+ return TPtrC8();
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::Prefix
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleNamespace::Prefix()
+ {
+ if ( iPrefix )
+ {
+ return TPtrC8(*iPrefix);
+ }
+ else
+ {
+ return TPtrC8();
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::SetUriL
+// ----------------------------------------------------------
+//
+void CSimpleNamespace::SetUriL(const TDesC8& aUri)
+ {
+ delete iUri;
+ iUri = NULL;
+ iUri = aUri.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleNamespace::SetPrefixL
+// ----------------------------------------------------------
+//
+void CSimpleNamespace::SetPrefixL(const TDesC8& aPrefix)
+ {
+ delete iPrefix;
+ iPrefix = NULL;
+ iPrefix = aPrefix.AllocL();
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplepresencelist.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <e32base.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+#include <multipartparser.h>
+#include <bodypart.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpledocument.h"
+#include "simplemeta.h"
+#include "simpleutils.h"
+#include "simplepresencelist.h"
+
+#include "simplecommon.h"
+
+#ifdef _DEBUG
+#include "simpledebugutils.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimplePresenceList::CSimplePresenceList
+// ----------------------------------------------------------
+//
+CSimplePresenceList::CSimplePresenceList( )
+: iMeta( NULL )
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::~CSimplePresenceList
+// ----------------------------------------------------------
+//
+CSimplePresenceList::~CSimplePresenceList()
+ {
+ delete iMeta;
+ iPresList.ResetAndDestroy();
+ iDocuments.ResetAndDestroy();
+ iPresList.Close();
+ iDocuments.Close();
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::ConstructL
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::ConstructL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ _LIT(KUrl, "http://dummy.com/d1/d.html");
+
+ // body part array
+ RPointerArray<CBodyPart> bodyPartArray;
+ // Cleanup-routine
+ TCleanupItem clItem( ResetAndDestroy, &bodyPartArray );
+ CleanupStack::PushL( clItem );
+
+ // remove "..." characters from boundary if needed
+ TPtrC8 pUnQuoted = aBoundary;
+ TInt quoted = aBoundary.Locate('"');
+ if (!quoted)
+ {
+ pUnQuoted.Set( aBoundary.Mid( 1, aBoundary.Length() - 2 ));
+ }
+
+
+ // parse
+ MultipartParser::ParseL( aData, KSimpleMultipartType, pUnQuoted, KUrl, bodyPartArray );
+ DoConstructL( bodyPartArray, aStart );
+
+ CleanupStack::PopAndDestroy( ); // bodyPartArray
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::NewL
+// ----------------------------------------------------------
+//
+CSimplePresenceList* CSimplePresenceList::NewL( const TDesC8& aXml,
+ const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ CSimplePresenceList* self = new (ELeave) CSimplePresenceList( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXml, aBoundary, aStart );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::Close
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::Close()
+ {
+ delete this;
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::ResetAndDestroy
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::ResetAndDestroy( TAny* aPtrArray )
+ {
+ RPointerArray<CBodyPart>* array =
+ static_cast<RPointerArray<CBodyPart>*>( aPtrArray );
+ array->ResetAndDestroy();
+ array->Close();
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::GetDocuments
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::GetDocuments( RPointerArray<MSimpleDocument>& aDocs )
+ {
+ aDocs.Reset();
+ TInt size = iDocuments.Count();
+ for ( TInt i = 0; i<size ; i++ )
+ {
+ (void)aDocs.Append( iDocuments[i] );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::MetaData
+// ----------------------------------------------------------
+//
+MSimpleMeta* CSimplePresenceList::MetaData()
+ {
+ return iMeta;
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::GetSubLists
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::GetSubLists( RPointerArray<MSimplePresenceList>& aLists )
+ {
+ aLists.Reset();
+ TInt size = iPresList.Count();
+ for ( TInt i = 0; i<size ; i++ )
+ {
+ (void)aLists.Append( iPresList[i] );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimplePresenceList::DoConstructL
+// ----------------------------------------------------------
+//
+void CSimplePresenceList::DoConstructL(
+ RPointerArray<CBodyPart>& aParts, const TDesC8& aStart )
+ {
+
+ _LIT8( KMyContentType, "Content-Type: multipart/related;");
+ _LIT8( KMyBoundary, "boundary=");
+
+ const TInt myBoundaryLen = 9; // boundary= 9 characters
+
+ // Handle body parts one by one
+ TInt size = aParts.Count();
+ TInt i;
+ CBodyPart* cp = NULL;
+ TPtrC8 boundary;
+ TPtrC8 start;
+
+ // remove "..." quoted marks when needed
+ TPtrC8 pStartUnquoted( KNullDesC8 );
+ if ( aStart.Locate( '"') == 0 )
+ {
+ pStartUnquoted.Set( aStart.Mid( 1, aStart.Length() - 2 ));
+ }
+ else
+ {
+ pStartUnquoted.Set( aStart );
+ }
+
+ // remove <...> marks when needed
+ if ( pStartUnquoted.Locate( '<') == 0 )
+ {
+ pStartUnquoted.Set( pStartUnquoted.Mid( 1, pStartUnquoted.Length() - 2 ));
+ }
+
+ TPtrC8 p8;
+ p8.Set( KSimpleDocumentType );
+ TInt mySize = p8.Length();
+ p8.Set( KSimpleMultipartType );
+ TInt mySize2 = p8.Length();
+
+#ifdef _DEBUG
+ TPtrC p16b; // notice: for debug
+ TPtrC8 p8b;
+#endif
+
+// Make this handle direct content too in the RLMI list, i.e.
+// content-type: multipart/related; type="application/pidf+xml"; boundary=...;
+ for (i = 0; i < size; i++)
+ {
+ cp = aParts[i];
+ // inline const TDesC8& Headers() { return iHeaders; }
+ TPtrC8 allHeaders = cp->Headers();
+ HBufC8* headersBuff = allHeaders.AllocL();
+ CleanupStack::PushL( headersBuff );
+
+#ifdef _DEBUG
+ p16b.Set( cp->Url() ); // debug only
+ p8b.Set( cp->ContentType() ); // debug only
+ p8b.Set( cp->ContentID() ); // debug only
+#endif
+ if ( !pStartUnquoted.Compare( cp->ContentID()) &&
+ !cp->ContentType().Left(sizeof(KSimpleListType)).CompareF( KSimpleListType ))
+ {
+ // Meta data is the root
+ iMeta = CSimpleMeta::NewL( cp->Body() );
+ }
+ else if ( !cp->ContentType().CompareF( KSimpleDocumentType ))
+ {
+ // Ordinary presence element
+ CSimpleDocument* cd = CSimpleDocument::NewL( cp->Body() );
+ CleanupStack::PushL( cd );
+ User::LeaveIfError( iDocuments.Append( cd ) );
+ CleanupStack::Pop( cd );
+ }
+ else if ( (!cp->ContentType().Left(mySize2).CompareF( KSimpleMultipartType )))
+ {
+ // multipart for user's direct content data
+ // get boundary from headers
+ TPtrC8 pStart(KNullDesC8);
+ TPtrC8 pBoundary(KNullDesC8);
+
+ TPtrC8 pHeaders = headersBuff->Des();
+ TPtrC8 pContentType;
+ TInt pos1 = pHeaders.Find( KMyContentType );
+ if ( pos1 >= 0 )
+ {
+ TPtrC8 h2 = pHeaders.Mid( pos1 );
+ TInt pos2 = h2.Locate( '\r');
+ if ( pos2 < 0 )
+ {
+ pContentType.Set( h2 );
+ }
+ else
+ {
+ pContentType.Set( h2.Left( h2.Length() - pos2 ));
+ }
+
+ // search boundary
+ TInt posx = pContentType.Find( KMyBoundary );
+ if ( posx >= 0 )
+ {
+ TPtrC8 h5 = pContentType.Mid( posx );
+ TInt pos5 = h5.Locate( ';');
+ if ( pos5 < 0 )
+ {
+ // There are no more parameters
+ pBoundary.Set( h5.Mid( myBoundaryLen ));
+ }
+ else
+ {
+ // There are more in the line, has to cut off
+ pBoundary.Set( h5.Mid( myBoundaryLen, pos5 - myBoundaryLen ));
+ }
+ }
+ }
+
+ // "..." characters are removed later from boundary in NewInMultiPartL(
+ CSimpleDocument* cd = CSimpleDocument::NewInMultiPartL( cp->Body(), pBoundary, pStart );
+ CleanupStack::PushL( cd );
+ User::LeaveIfError( iDocuments.Append( cd ) );
+ CleanupStack::Pop( cd );
+
+ }
+ /* notice: later nested multiparts if type = rlmi */
+ else
+ {
+ // This is something that should not be in the document.
+ // Ignore it.
+ }
+ CleanupStack::PopAndDestroy( headersBuff );
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplewinfo.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <s32strm.h>
+#include <SenBaseElement.h>
+#include <SenBaseAttribute.h>
+#include <SenXmlUtils.h>
+#include <SenXmlReader.h>
+#include <SenDomFragment.h>
+
+// own simple
+#include "simplecommon.h"
+#include "simpleelement.h"
+#include "simplenamespace.h"
+#include "simpleattribute.h"
+#include "simplebasedocument.h"
+#include "simpleutils.h"
+#include "simplewinfo.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CSimpleWinfo::CSimpleWinfo
+// ----------------------------------------------------------
+//
+CSimpleWinfo::CSimpleWinfo( )
+: CSimpleBaseDocument()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::~CSimpleWinfo
+// ----------------------------------------------------------
+//
+CSimpleWinfo::~CSimpleWinfo()
+ {
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::ConstructL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ BaseConstructL(aNsUri, aLocalName);
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::ConstructL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::ConstructL(
+ const TDesC8& aXml )
+ {
+ BaseConstructL( aXml );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::NewL
+// ----------------------------------------------------------
+//
+CSimpleWinfo* CSimpleWinfo::NewL( )
+ {
+ CSimpleWinfo* self = new (ELeave) CSimpleWinfo( );
+ CleanupStack::PushL( self );
+ self->ConstructL( KSimpleNsWinfo, KWinfoLocalName );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::NewL
+// ----------------------------------------------------------
+//
+CSimpleWinfo* CSimpleWinfo::NewL( const TDesC8& aXml )
+ {
+ CSimpleWinfo* self = new (ELeave) CSimpleWinfo( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aXml );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::ValidateXmlL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::ValidateXmlL( const TDesC8& aName )
+ {
+ if ( aName.CompareF( KWinfoLocalName ) )
+ {
+ User::Leave( KErrCorrupt );
+ }
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::DefaultNamespace
+// ----------------------------------------------------------
+//
+TPtrC8 CSimpleWinfo::DefaultNamespace()
+ {
+ return CSimpleBaseDocument::DefaultNamespace();
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AddNamespaceL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::AddNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ CSimpleBaseDocument::AddNamespaceL( aPrefix, aUri );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::NamespacesL
+// ----------------------------------------------------------
+//
+RPointerArray<MSimpleNamespace>& CSimpleWinfo::NamespacesL()
+ {
+ return CSimpleBaseDocument::NamespacesL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::ExternalizeL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::ExternalizeL( RWriteStream& aStream )
+ {
+ CSimpleBaseDocument::ExternalizeL( aStream );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::Close
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::Close()
+ {
+ CSimpleBaseDocument::Close();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::LocalName
+// ----------------------------------------------------------
+//
+const TDesC8& CSimpleWinfo::LocalName()
+ {
+ return CSimpleBaseDocument::LocalName();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::DefNamespaceL
+// ----------------------------------------------------------
+//
+MSimpleNamespace* CSimpleWinfo::DefNamespaceL()
+ {
+ return CSimpleBaseDocument::DefNamespaceL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::HasContent
+// ----------------------------------------------------------
+//
+TBool CSimpleWinfo::HasContent()
+ {
+ return CSimpleBaseDocument::HasContent();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::ContentUnicodeL
+// ----------------------------------------------------------
+//
+HBufC* CSimpleWinfo::ContentUnicodeL()
+ {
+ return CSimpleBaseDocument::ContentUnicodeL();
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::SetContentUnicodeL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::SetContentUnicodeL( const TDesC& aContent )
+ {
+ CSimpleBaseDocument::SetContentUnicodeL( aContent );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::SimpleElementsL
+// ----------------------------------------------------------
+//
+TInt CSimpleWinfo::SimpleElementsL( RPointerArray<MSimpleElement>& aElementArray )
+ {
+ return CSimpleBaseDocument::SimpleElementsL( aElementArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AttrValueLC
+// ----------------------------------------------------------
+//
+HBufC* CSimpleWinfo::AttrValueLC( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValueLC( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AttrValue
+// ----------------------------------------------------------
+//
+const TDesC8* CSimpleWinfo::AttrValue( const TDesC8& aName )
+ {
+ return CSimpleBaseDocument::AttrValue( aName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AddAttrL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::AddAttrL( const TDesC8& aName, const TDesC& aValue )
+ {
+ CSimpleBaseDocument::AddAttrL( aName, aValue );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::SimpleAttributesL
+// ----------------------------------------------------------
+//
+TInt CSimpleWinfo::SimpleAttributesL( RPointerArray<MSimpleAttribute>& aArray )
+ {
+ return CSimpleBaseDocument::SimpleAttributesL( aArray );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::SimpleParentL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleWinfo::SimpleParentL()
+ {
+ return CSimpleBaseDocument::SimpleParentL( );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::DetachSimpleL
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::DetachSimpleL()
+ {
+ User::Leave( KErrNotFound );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleWinfo::AddSimpleElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aNsUri, aLocalName );
+ }
+
+// ----------------------------------------------------------
+// CSimpleWinfo::AddSimpleElementL
+// ----------------------------------------------------------
+//
+MSimpleElement* CSimpleWinfo::AddSimpleElementL(
+ const TDesC8& aLocalName )
+ {
+ return CSimpleBaseDocument::AddSimpleElementL( aLocalName );
+ }
+
+
+// ----------------------------------------------------------
+// CSimpleWinfo::RemoveSimpleElement
+// ----------------------------------------------------------
+//
+void CSimpleWinfo::RemoveSimpleElement(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ CSimpleBaseDocument::RemoveSimpleElement( aNsUri, aLocalName );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/simpleengine/xmlutils/src/simplexmlfactory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple Engine
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+
+// own simple
+#include "simplexmlfactory.h"
+
+#include "simplenamespace.h"
+#include "simpleelement.h"
+#include "simpledocument.h"
+#include "simplefilter.h"
+#include "simplepresencelist.h"
+#include "simplewinfo.h"
+#include "simplecontent.h"
+
+#include "msimplenamespace.h"
+#include "msimpleelement.h"
+#include "msimpledocument.h"
+#include "msimplefilterdocument.h"
+#include "msimplepresencelist.h"
+#include "msimplewinfo.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+EXPORT_C MSimpleNamespace* TSimpleXmlFactory::NewNamespaceL(
+ const TDesC8& aPrefix,
+ const TDesC8& aUri )
+ {
+ return CSimpleNamespace::NewL( aPrefix, aUri );
+ }
+
+EXPORT_C MSimpleElement* TSimpleXmlFactory::NewElementL(
+ const TDesC8& aNsUri,
+ const TDesC8& aLocalName )
+ {
+ return CSimpleElement::NewL( aNsUri, aLocalName );
+ }
+
+EXPORT_C MSimpleDocument* TSimpleXmlFactory::NewDocumentL( )
+ {
+ return CSimpleDocument::NewL( );
+ }
+
+EXPORT_C MSimpleDocument* TSimpleXmlFactory::NewDocumentL( const TDesC8& aXml )
+ {
+ return CSimpleDocument::NewL( aXml );
+ }
+
+EXPORT_C MSimpleDocument* TSimpleXmlFactory::NewDocumentInMultiPartL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ return CSimpleDocument::NewInMultiPartL( aData, aBoundary, aStart );
+ }
+
+EXPORT_C MSimpleFilterDocument* TSimpleXmlFactory::NewFilterDocumentL()
+ {
+ return CSimpleFilter::NewL();
+ }
+
+EXPORT_C MSimplePresenceList* TSimpleXmlFactory::NewPresenceListL(
+ const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
+ {
+ return CSimplePresenceList::NewL( aData, aBoundary, aStart );
+ }
+
+EXPORT_C MSimpleWinfo* TSimpleXmlFactory::NewWinfoL( )
+ {
+ return CSimpleWinfo::NewL( );
+ }
+
+EXPORT_C MSimpleWinfo* TSimpleXmlFactory::NewWinfoL( const TDesC8& aXml )
+ {
+ return CSimpleWinfo::NewL( aXml );
+ }
+
+EXPORT_C MSimpleFilterDocument* TSimpleXmlFactory::NewFilterDocumentL( const TDesC8& aXml )
+ {
+ return CSimpleFilter::NewL( aXml );
+ }
+
+EXPORT_C MSimpleContent* TSimpleXmlFactory::NewContentL(
+ const TDesC8& aContentID, const TDesC8& aContentType )
+ {
+ return CSimpleContent::NewL( aContentID, aContentType );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/BWINSCW/LocalOperationsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/eabi/LocalOperationsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/group/LocalOperations.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocalOperations.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET localoperations.dll
+UID 0x10009D8D 0x10275086
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+TARGETTYPE PLUGIN
+
+SOURCEPATH ../src
+
+START RESOURCE 10275086.rss
+
+ TARGET localoperations.rsc
+
+END
+
+SOURCE LocalAddition.cpp
+SOURCE LocalDeletion.cpp
+SOURCE LocalRetrieval.cpp
+SOURCE LocalReplacement.cpp
+SOURCE LocalOperationBase.cpp
+SOURCE LocalOperationFactory.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../../inc
+
+//Parser
+USERINCLUDE ../../../XdmXmlParser/inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/xml
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../../inc
+
+LIBRARY hal.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY xdmengine.lib
+LIBRARY xdmxmlparser.lib
+LIBRARY localprotocol.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../BWINSCW/
+#elif defined (WINS )
+deffile ../BWINS/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocalOperations bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+LocalOperations.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalAddition.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalAddition
+*
+*/
+
+
+
+
+#ifndef __LOCALADDITION__
+#define __LOCALADDITION__
+
+#include <e32base.h>
+#include "XdmOperation.h"
+#include "LocalOperationBase.h"
+
+//FORWARD DECLARATIONS
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalAddition ) : public CLocalOperationBase
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalAddition* NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalAddition();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalAddition( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandlePartialUpdateL( TInt aDataLength );
+
+ private: //From MXdmOperation
+
+ /**
+ * Execute this operation synchronously
+ */
+ void ExecuteL();
+
+ /**
+ * Set this operation to completed state.
+ */
+ void Destroy();
+
+ private: //Data
+
+
+ TXdmOperationType iOperationType;
+ CXdmDocumentNode* iDocumentSubset;
+ };
+
+#endif //__LOCALADDITION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalDeletion.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDeletion
+*
+*/
+
+
+
+
+#ifndef __LOCALDELETION__
+#define __LOCALDELETION__
+
+#include <e32base.h>
+#include "XdmOperation.h"
+#include "LocalOperationBase.h"
+
+//FORWARD DECLARATIONS
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalDeletion ) : public CLocalOperationBase
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalDeletion* NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalDeletion();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalDeletion( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandlePartialDeletionL( TInt aDataLength );
+
+ private: //From MXdmOperation
+
+ /**
+ * Execute this operation synchronously
+ */
+ void ExecuteL();
+
+ /**
+ * Set this operation to completed state.
+ */
+ void Destroy();
+
+ private: //Data
+
+ CLocalDocumentNode* iDocumentSubset;
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__LOCALDELETION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalOperationBase.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalOperationBase
+*
+*/
+
+
+
+
+#ifndef __LOCALOPERATIONBASE__
+#define __LOCALOPERATIONBASE__
+
+#include <e32base.h>
+#include "XdmOperation.h"
+
+//FORWARD DECLARATIONS
+class CXdmXmlParser;
+class CLocalDocument;
+class CXdmDocumentNode;
+class CLocalDocumentNode;
+class CLocalOperationFactory;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalOperationBase ) : public CBase,
+ public MXdmOperation
+ {
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalOperationBase();
+
+ protected: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalOperationBase( const CLocalDocument& aTargetDoc,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void BaseConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void WriteFileL( const CXdmDocumentNode* aRootNode );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ HBufC8* FetchXmlDataL( TInt aFileSize );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ReplaceDataFileL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void DeleteDataFileL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TInt OpenDataFileL( const TDesC& aFilePath );
+
+ private:
+
+ /**
+ * Execute this operation asynchronously.
+ */
+ void ExecuteL( TRequestStatus& aStatus, TUint aOptions );
+
+ /**
+ * Cancel this operation.
+ */
+ void CancelOperation();
+
+ /**
+ * Get the result of this operation.
+ */
+ TInt Result() const;
+
+ /**
+ * Get the completion data of this operation.
+ */
+ const TXdmCompletionData& CompletionData() const;
+
+ /**
+ * Set this operation to completed state.
+ */
+ TBool IsCompleted() const;
+
+ /**
+ * Set this operation to completed state.
+ */
+ CXdmDocumentNode* TargetNode() const;
+
+ /**
+ * Set this operation to completed state.
+ */
+ void GenerateTimeStampL();
+
+ HBufC* ConstructTimestampNameL();
+
+ /**
+ * Set this operation to completed state.
+ */
+ HBufC8* TimeLC();
+
+ protected: //Data
+
+ RFile iXmlFile;
+ TPtrC iFullPath;
+ CFileMan* iFileManager;
+ CLocalDocument& iTargetDoc;
+ CXdmXmlParser* iXmlParser;
+ TXdmOperationType iOperationType;
+ TXdmCompletionData iCompletionData;
+ CLocalOperationFactory& iOperationFactory;
+ };
+
+#endif //__LOCALOPERATIONBASE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalOperationFactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalOperationFactory
+*
+*/
+
+
+
+
+#ifndef __LOCALOPERATIONFACTORY__
+#define __LOCALOPERATIONFACTORY__
+
+#include <e32base.h>
+#include "XdmOperationFactory.h"
+
+_LIT( KLocalOpLogFile, "LocalOperations" );
+const TInt KLocalProtLogBufferMaxSize = 2000;
+
+//FORWARD DECLARATION
+class CXdmDocument;
+class MXdmOperation;
+class CXdmLogWriter;
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalOperationFactory ) : public CXdmOperationFactory
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ * @param CXdmProtocolInfo Protocol info
+ * @return CXdmProtocol
+ */
+ static CLocalOperationFactory* NewL();
+
+ /**
+ * Destructor. A simple wrapper to the C++ destructor.
+ *
+ */
+ virtual ~CLocalOperationFactory();
+
+ private: //From CXdmoperationFactory
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * whole documents
+ */
+ MXdmOperation* FetchL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode = NULL ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* InsertL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* ReplaceL( CXdmDocument& aOldDocument,
+ CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aOldNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* AppendL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* DeletionL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ public:
+
+ /**
+ * Logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+
+ private:
+
+ /**
+ * C++ constructor
+ * @return CImpsTcpCirWatcher
+ */
+ void ConstructL();
+
+ /**
+ * C++ constructor
+ * @return CImpsTcpCirWatcher
+ */
+ CLocalOperationFactory();
+
+ private: //Data
+
+ CXdmLogWriter* iLogWriter;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalReplacement.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalReplacement
+*
+*/
+
+
+
+
+#ifndef __LOCALREPLACEMENT__
+#define __LOCALREPLACEMENT__
+
+#include <e32base.h>
+#include "XdmOperation.h"
+#include "LocalOperationBase.h"
+
+//FORWARD DECLARATIONS
+class CLocalDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalReplacement ) : public CLocalOperationBase
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalReplacement* NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aOldNode,
+ CLocalDocumentNode* aNewNode,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalReplacement();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalReplacement( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aOldNode,
+ CLocalDocumentNode* aNewNode,
+ CLocalOperationFactory& aOperationFactory );
+
+ private: //From MXdmOperation
+
+ /**
+ * Execute this operation synchronously
+ */
+ void ExecuteL();
+
+ /**
+ * Execute this operation synchronously
+ */
+ void HandlePartialReplacementL( TInt aDataLength );
+
+ /**
+ * Set this operation to completed state.
+ */
+ void Destroy();
+
+ private: //Data
+
+ CLocalDocumentNode* iNewNode;
+ CLocalDocumentNode* iTargetNode;
+ TXdmOperationType iOperationType;
+
+ };
+
+#endif //__LOCALREPLACEMENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/inc/LocalRetrieval.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalRetrieval
+*
+*/
+
+
+
+
+#ifndef __LOCALRETRIEVAL__
+#define __LOCALRETRIEVAL__
+
+#include <e32base.h>
+#include "LocalOperationBase.h"
+
+class CLocalDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalRetrieval ) : public CLocalOperationBase
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalRetrieval* NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aTargetNode,
+ CLocalOperationFactory& aOperationFactory );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalRetrieval();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalRetrieval( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory );
+
+ private: //From MXdmOperation
+
+ /**
+ * Execute this operation synchronously
+ */
+ void ExecuteL();
+
+ /**
+ * Set this operation to completed state.
+ */
+ void Destroy();
+
+ private: //Data
+
+ CLocalDocumentNode* iDocumentSubset;
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__LOCALRETRIEVAL__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/10275086.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmOperationInfo
+*
+*/
+
+
+// 10275086.RSS
+//
+#include "registryinfo.rh"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XdmOperationInfo
+ {
+ dll_uid = 0x10275086;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207425;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10275088;
+ version_no = 1;
+ display_name = "Local Operation API||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalAddition.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalAddition
+*
+*/
+
+
+
+
+// INCLUDES
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalAddition.h"
+#include "XdmXmlParser.h"
+#include "LocalDocumentNode.h"
+#include "LocalNodeAttribute.h"
+#include "LocalOperationFactory.h"
+
+// ---------------------------------------------------------
+// CLocalAddition::CLocalAddition
+//
+// ---------------------------------------------------------
+//
+CLocalAddition::CLocalAddition( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory ) :
+ CLocalOperationBase( aParentDoc, aOperationFactory ),
+ iOperationType( aDocumentSubset == NULL ?
+ EXdmDocument : EXdmPartialDocument ),
+ iDocumentSubset( aDocumentSubset )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalAddition::NewL
+//
+// ---------------------------------------------------------
+//
+CLocalAddition* CLocalAddition::NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory )
+ {
+ CLocalAddition* self = new ( ELeave ) CLocalAddition( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CLocalAddition::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CLocalAddition::ExecuteL()
+ {
+ TPtrC fileName = iTargetDoc.XmlFilePath();
+ TInt size = OpenDataFileL( fileName );
+ if( size > 0 ) //The document already exists
+ {
+ //Only a subset of a document
+ if( iTargetDoc.IsSubset() && iDocumentSubset != NULL )
+ HandlePartialUpdateL( size );
+ else WriteFileL( iTargetDoc.DocumentRoot() );
+ }
+ else WriteFileL( iTargetDoc.DocumentRoot() );
+ iXmlFile.Close();
+ }
+
+// ---------------------------------------------------------
+// CLocalAddition::HandlePartialUpdateL
+//
+// ---------------------------------------------------------
+//
+void CLocalAddition::HandlePartialUpdateL( TInt aDataLength )
+ {
+ HBufC8* data = FetchXmlDataL( aDataLength );
+ CleanupStack::PushL( data );
+ CLocalDocument* copy = iTargetDoc.TempCopyL();
+ CleanupStack::PushL( copy );
+ iXmlParser->ParseDocumentL( copy, *data );
+ RPointerArray<CXdmDocumentNode> results;
+ CleanupClosePushL( results );
+ RPointerArray<SXdmAttribute16> attributes;
+ CleanupClosePushL( attributes );
+ TInt attrCount = iDocumentSubset->AttributeCount();
+ if( attrCount > 0 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < attrCount;i++ )
+ {
+ attribute.iName.Set( iDocumentSubset->Attribute( i )->NodeName() );
+ attribute.iValue.Set( iDocumentSubset->Attribute( i )->AttributeValue() );
+ }
+ User::LeaveIfError( attributes.Append( &attribute ) );
+ }
+ copy->Find( iDocumentSubset->NodeName(), results, attributes );
+ if( results.Count() == 1 )
+ {
+ iXmlFile.Close();
+ ReplaceDataFileL();
+ CLocalDocumentNode* node = ( CLocalDocumentNode* )results[0];
+ node->AppendLocalL( ( CLocalDocumentNode* )iDocumentSubset );
+ WriteFileL( copy->DocumentRoot() );
+ }
+ else User::Leave( KErrGeneral );
+ CleanupStack::PopAndDestroy( 4 ); //attributes, results, copy, data
+ }
+
+// ---------------------------------------------------------
+// CLocalAddition::Destroy
+//
+// ---------------------------------------------------------
+//
+void CLocalAddition::Destroy()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CLocalAddition::~CLocalAddition()
+ {
+
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalDeletion.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDeletion
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalDeletion.h"
+#include "LocalDocumentNode.h"
+#include "LocalNodeAttribute.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CLocalDeletion::CLocalDeletion( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory ) :
+ CLocalOperationBase( aTargetDoc, aOperationFactory ),
+ iDocumentSubset( aDocumentSubset ),
+ iOperationType( aDocumentSubset == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalDeletion::NewL
+//
+// ---------------------------------------------------------
+//
+CLocalDeletion* CLocalDeletion::NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory )
+ {
+ CLocalDeletion* self = new ( ELeave ) CLocalDeletion( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CLocalDeletion::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CLocalDeletion::ExecuteL()
+ {
+ TPtrC fileName = iTargetDoc.XmlFilePath();
+ TInt size = OpenDataFileL( fileName );
+ if( size > 0 )
+ {
+ //Only a subset of a document
+ if( iTargetDoc.IsSubset() )
+ HandlePartialDeletionL( size );
+ else if( iDocumentSubset != NULL )
+ {
+ iTargetDoc.RemoveData( ( CLocalDocumentNode* )iDocumentSubset );
+ iXmlFile.Close();
+ ReplaceDataFileL();
+ WriteFileL( iTargetDoc.DocumentRoot() );
+ }
+ else
+ {
+ iXmlFile.Close();
+ DeleteDataFileL(); //Delete the whole document
+ }
+ }
+ else User::Leave( KErrNotFound );
+ iXmlFile.Close();
+ }
+
+// ---------------------------------------------------------
+// CLocalAddition::HandlePartialUpdateL
+//
+// ---------------------------------------------------------
+//
+void CLocalDeletion::HandlePartialDeletionL( TInt aDataLength )
+ {
+ TInt error = KErrNone;
+ HBufC8* data = FetchXmlDataL( aDataLength );
+ CleanupStack::PushL( data );
+ TRAP( error, iXmlParser->ParseDocumentL( &iTargetDoc, *data ) );
+ CXdmDocumentNode* parent = iDocumentSubset->Parent();
+ RPointerArray<CXdmDocumentNode> parentResults;
+ CleanupClosePushL( parentResults );
+ RPointerArray<SXdmAttribute16> parentAttributes;
+ CleanupClosePushL( parentAttributes );
+ RPointerArray<CXdmDocumentNode> nodeResults;
+ CleanupClosePushL( nodeResults );
+ RPointerArray<SXdmAttribute16> nodeAttributes;
+ CleanupClosePushL( nodeAttributes );
+ TInt pAttrCount = parent->AttributeCount();
+ TInt dAttrCount = iDocumentSubset->AttributeCount();
+ if( pAttrCount > 0 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < pAttrCount;i++ )
+ {
+ attribute.iName.Set( parent->Attribute( i )->NodeName() );
+ attribute.iValue.Set( parent->Attribute( i )->AttributeValue() );
+ }
+ User::LeaveIfError( parentAttributes.Append( &attribute ) );
+ }
+ if( dAttrCount > 0 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < dAttrCount;i++ )
+ {
+ attribute.iName.Set( iDocumentSubset->Attribute( i )->NodeName() );
+ attribute.iValue.Set( iDocumentSubset->Attribute( i )->AttributeValue() );
+ }
+ User::LeaveIfError( nodeAttributes.Append( &attribute ) );
+ }
+ iTargetDoc.Find( parent->NodeName(), parentResults, parentAttributes );
+ iTargetDoc.Find( iDocumentSubset->NodeName(), nodeResults, nodeAttributes );
+ if( parentResults.Count() == 1 && nodeResults.Count() == 1 )
+ {
+ iXmlFile.Close();
+ ReplaceDataFileL();
+ CLocalDocumentNode* p = ( CLocalDocumentNode* )parentResults[0];
+ CLocalDocumentNode* r = ( CLocalDocumentNode* )nodeResults[0];
+ p->RemoveLocalL( r );
+ WriteFileL( iTargetDoc.DocumentRoot() );
+ }
+ else User::Leave( KErrGeneral );
+ CleanupStack::PopAndDestroy( 5 ); //nodeAttributes, nodeResults,
+ //parentAttributes, parentResults, data
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+void CLocalDeletion::Destroy()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CLocalDeletion::~CLocalDeletion()
+ {
+
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalOperationBase.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalOperationBase
+*
+*/
+
+
+
+
+
+// INCLUDES
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalOperationBase.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CLocalOperationBase::CLocalOperationBase( const CLocalDocument& aTargetDoc,
+ CLocalOperationFactory& aOperationFactory ) :
+ iTargetDoc( CONST_CAST( CLocalDocument&, aTargetDoc ) ),
+ iOperationFactory( aOperationFactory )
+ {
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CLocalOperationBase::~CLocalOperationBase()
+ {
+ iXmlFile.Close();
+ delete iXmlParser;
+ delete iFileManager;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::BaseConstructL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::BaseConstructL()
+ {
+ iXmlParser = CXdmXmlParser::NewL();
+ iFileManager = CFileMan::NewL( CLocalProtocol::FileSession() );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::WriteFileL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::WriteFileL( const CXdmDocumentNode* aRootNode )
+ {
+ __ASSERT_DEBUG( aRootNode != NULL, User::Panic( _L( "CLocalOperationBase" ), 1 ) );
+ HBufC8* data = iXmlParser->FormatToXmlLC( ETrue, &iTargetDoc, aRootNode );
+ User::LeaveIfError( iXmlFile.Write( data->Des() ) );
+ CleanupStack::PopAndDestroy(); //data
+ GenerateTimeStampL();
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::GenerateTimeStampL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::GenerateTimeStampL()
+ {
+ RFile timeStamp;
+ HBufC8* time = TimeLC();
+ HBufC* timeStampName = ConstructTimestampNameL();
+ CleanupStack::PushL( timeStampName );
+ User::LeaveIfError( timeStamp.Replace( CLocalProtocol::FileSession(), timeStampName->Des(), EFileWrite ) );
+ User::LeaveIfError( timeStamp.Write( time->Des() ) );
+ timeStamp.Close();
+ CleanupStack::PopAndDestroy( 2 ); //timeStampName, time
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::ConstructTimestampNameL
+//
+// ---------------------------------------------------------
+//
+HBufC* CLocalOperationBase::ConstructTimestampNameL()
+ {
+ const TChar backSlash = 92;
+ const TChar idSeparator = 46;
+ TInt index = iFullPath.LocateReverse( backSlash );
+ TPtrC path = iFullPath.Left( index + 1 );
+ HBufC* fileName = HBufC::NewLC( iTargetDoc.Name().Length() + KTimeStampFileExt().Length() );
+ HBufC* fullPath = HBufC::NewLC( path.Length() + fileName->Des().MaxLength() );
+ TPtr ptr( fileName->Des() );
+ ptr.Copy( iTargetDoc.Name() );
+ index = ptr.LocateReverse( idSeparator );
+ TPtrC tmspName = index > 0 ? ptr.Left( index ) : ptr;
+ fullPath->Des().Copy( path );
+ fullPath->Des().Append( tmspName );
+ fullPath->Des().Append( KTimeStampFileExt );
+ CleanupStack::Pop(); //fullPath
+ CleanupStack::PopAndDestroy(); //fileName
+ return fullPath;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::Time
+//
+// ---------------------------------------------------------
+//
+HBufC8* CLocalOperationBase::TimeLC()
+ {
+ TTime time;
+ TBuf<KDateBufferMaxSize> dateBuffer;
+ time.HomeTime();
+ time.FormatL( dateBuffer, KDateFormat );
+ TBuf<KDateBufferMaxSize> timeBuffer;
+ time.HomeTime();
+ time.FormatL( timeBuffer, KTimeFormat );
+ TBuf<KDateTimeMaxSize> buffer;
+ buffer.SetLength( 0 );
+ buffer.Copy( dateBuffer );
+ buffer.Append( _L( " " ) );
+ buffer.Append( timeBuffer );
+ HBufC8* ret = HBufC8::NewLC( buffer.Length() );
+ ret->Des().Copy( buffer );
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::FetchXmlDataL
+//
+// ---------------------------------------------------------
+//
+HBufC8* CLocalOperationBase::FetchXmlDataL( TInt aFileSize )
+ {
+ HBufC8* data = HBufC8::NewLC( aFileSize );
+ TPtr8 desc( data->Des() );
+ User::LeaveIfError( iXmlFile.Read( desc ) );
+ CleanupStack::Pop(); //data
+ return data;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::FetchXmlDataL
+//
+// ---------------------------------------------------------
+//
+TInt CLocalOperationBase::OpenDataFileL( const TDesC& aFilePath )
+ {
+ TInt length = 0;
+ iFullPath.Set( aFilePath );
+ TInt error = iXmlFile.Open( CLocalProtocol::FileSession(), iFullPath,
+ EFileRead | EFileWrite | EFileShareExclusive );
+ if( error != KErrNone )
+ {
+ if( error == KErrPathNotFound )
+ User::LeaveIfError( CLocalProtocol::FileSession().MkDirAll( CLocalProtocol::RootFolder() ) );
+ error = iXmlFile.Create( CLocalProtocol::FileSession(), iFullPath,
+ EFileRead | EFileWrite | EFileShareExclusive );
+ }
+ error = error == KErrNone ? iXmlFile.Size( length ) : KErrUnknown;
+ return error == KErrNone ? length : error;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::ReplaceDataFileL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::ReplaceDataFileL()
+ {
+ User::LeaveIfError( iXmlFile.Replace( CLocalProtocol::FileSession(), iFullPath,
+ EFileRead | EFileWrite | EFileShareExclusive ) );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::DeleteDataFileL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::DeleteDataFileL()
+ {
+ User::LeaveIfError( CLocalProtocol::FileSession().Delete( iFullPath ) );
+ HBufC* timeStampName = ConstructTimestampNameL();
+ CleanupStack::PushL( timeStampName );
+ User::LeaveIfError( CLocalProtocol::FileSession().Delete( timeStampName->Des() ) );
+ CleanupStack::PopAndDestroy(); //timeStampName
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::ExecuteL( TRequestStatus& /*aStatus*/, TUint /*aOptions*/ )
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::CancelOperation
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationBase::CancelOperation()
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::CompletionData
+//
+// ---------------------------------------------------------
+//
+const TXdmCompletionData& CLocalOperationBase::CompletionData() const
+ {
+ return iCompletionData;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::IsCompleted
+//
+// ---------------------------------------------------------
+//
+TBool CLocalOperationBase::IsCompleted() const
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::TargetNode
+//
+// ---------------------------------------------------------
+//
+CXdmDocumentNode* CLocalOperationBase::TargetNode() const
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationBase::Result
+//
+// ---------------------------------------------------------
+//
+TInt CLocalOperationBase::Result() const
+ {
+ return KErrNone;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalOperationFactory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalOperationFactory
+*
+*/
+
+
+
+#include <ecom.h>
+#include <e32debug.h>
+#include <xdmlogwriter.h>
+#include <implementationproxy.h>
+#include "XdmOperation.h"
+#include "LocalRetrieval.h"
+#include "LocalAddition.h"
+#include "LocalReplacement.h"
+#include "LocalDeletion.h"
+#include "LocalProtocol.h"
+#include "LocalOperationFactory.h"
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::CLocalOperationFactory
+//
+// ---------------------------------------------------------
+//
+CLocalOperationFactory::CLocalOperationFactory()
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::NewL
+//
+// ---------------------------------------------------------
+//
+CLocalOperationFactory* CLocalOperationFactory::NewL()
+ {
+ CLocalOperationFactory* self = new ( ELeave ) CLocalOperationFactory();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CLocalOperationFactory::ConstructL()
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KLocalOpLogFile );
+ WriteToLog( _L8( "CLocalOperationFactory::ConstructL()" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::~CLocalOperationFactory
+//
+// ---------------------------------------------------------
+//
+CLocalOperationFactory::~CLocalOperationFactory()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CLocalOperationFactory::~CLocalOperationFactory()" ) );
+ #endif
+ delete iLogWriter;
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::FetchL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CLocalOperationFactory::FetchL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CLocalRetrieval::NewL( ( CLocalDocument& )aTargetDocument,
+ ( CLocalDocumentNode* )aTargetNode,
+ const_cast<CLocalOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::InsertL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CLocalOperationFactory::InsertL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CLocalAddition::NewL( ( CLocalDocument& )aTargetDocument,
+ ( CLocalDocumentNode* )aTargetNode,
+ const_cast<CLocalOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::ReplaceL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CLocalOperationFactory::ReplaceL( CXdmDocument& aOldDocument,
+ CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aOldNode ) const
+ {
+ return CLocalReplacement::NewL( ( CLocalDocument& )aOldDocument,
+ ( CLocalDocumentNode* )aNewNode,
+ ( CLocalDocumentNode* )aOldNode,
+ const_cast<CLocalOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::AppendL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CLocalOperationFactory::AppendL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CLocalAddition::NewL( ( CLocalDocument& )aTargetDocument,
+ ( CLocalDocumentNode* )aTargetNode,
+ const_cast<CLocalOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CLocalOperationFactory::PartialDeletionL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CLocalOperationFactory::DeletionL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CLocalDeletion::NewL( ( CLocalDocument& )aTargetDocument,
+ ( CLocalDocumentNode* )aTargetNode,
+ const_cast<CLocalOperationFactory&>( *this ) );
+ }
+
+// ----------------------------------------------------------
+// CLocalOperationFactory::WriteToLog
+//
+// ----------------------------------------------------------
+//
+void CLocalOperationFactory::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ---------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+//
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KLocalOperationFactory, CLocalOperationFactory::NewL )
+#else
+ { { KLocalOperationFactory }, CLocalOperationFactory::NewL }
+#endif
+ };
+
+// ---------------------------------------------------------
+// Return the implementation table & number of implementations
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalReplacement.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalReplacement
+*
+*/
+
+
+
+
+// INCLUDES
+#include <XdmDocumentNode.h>
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalReplacement.h"
+#include "LocalDocumentNode.h"
+#include "LocalNodeAttribute.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CLocalReplacement::CLocalReplacement( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aOldNode,
+ CLocalDocumentNode* aNewNode,
+ CLocalOperationFactory& aOperationFactory ) :
+ CLocalOperationBase( aTargetDoc, aOperationFactory ),
+ iNewNode( ( CLocalDocumentNode* )aNewNode ),
+ iTargetNode( ( CLocalDocumentNode* )aOldNode ),
+ iOperationType( iTargetNode == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+ {
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CLocalReplacement* CLocalReplacement::NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aOldNode,
+ CLocalDocumentNode* aNewNode,
+ CLocalOperationFactory& aOperationFactory )
+ {
+ CLocalReplacement* self = new ( ELeave ) CLocalReplacement( aParentDoc, aOldNode, aNewNode, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CLocalReplacement::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CLocalReplacement::ExecuteL()
+ {
+ TPtrC fileName = iTargetDoc.XmlFilePath();
+ TInt size = OpenDataFileL( fileName );
+ if( size > 0 )
+ {
+ //Only a subset of a document
+ if( iTargetDoc.IsSubset() )
+ HandlePartialReplacementL( size );
+ else if( iTargetNode != NULL )
+ {
+ CLocalDocumentNode* parent = ( CLocalDocumentNode* )iTargetNode->Parent();
+ parent->ReplaceLocalL( iNewNode, iTargetNode );
+ }
+ else
+ {
+ iXmlFile.Close();
+ ReplaceDataFileL();
+ WriteFileL( iTargetDoc.DocumentRoot() );
+ }
+ }
+ else WriteFileL( iTargetDoc.DocumentRoot() );
+ iXmlFile.Close();
+ }
+
+// ---------------------------------------------------------
+// CLocalReplacement::HandlePartialReplacementL
+//
+// ---------------------------------------------------------
+//
+void CLocalReplacement::HandlePartialReplacementL( TInt aDataLength )
+ {
+ TInt error = KErrNone;
+ HBufC8* data = FetchXmlDataL( aDataLength );
+ CleanupStack::PushL( data );
+ TRAP( error, iXmlParser->ParseDocumentL( &iTargetDoc, *data ) );
+ CXdmDocumentNode* parent = iTargetNode->Parent();
+ RPointerArray<CXdmDocumentNode> parentResults;
+ CleanupClosePushL( parentResults );
+ RPointerArray<SXdmAttribute16> parentAttributes;
+ CleanupClosePushL( parentAttributes );
+ RPointerArray<CXdmDocumentNode> targetResults;
+ CleanupClosePushL( targetResults );
+ RPointerArray<SXdmAttribute16> targetAttributes;
+ CleanupClosePushL( targetAttributes );
+ TInt pAttrCount = parent->AttributeCount();
+ TInt tAttrCount = iTargetNode->AttributeCount();
+ if( pAttrCount > 0 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < pAttrCount;i++ )
+ {
+ attribute.iName.Set( parent->Attribute( i )->NodeName() );
+ attribute.iValue.Set( parent->Attribute( i )->AttributeValue() );
+ }
+ User::LeaveIfError( parentAttributes.Append( &attribute ) );
+ }
+ if( tAttrCount > 0 )
+ {
+ SXdmAttribute16 attribute;
+ for( TInt i = 0;i < tAttrCount;i++ )
+ {
+ attribute.iName.Set( iTargetNode->Attribute( i )->NodeName() );
+ attribute.iValue.Set( iTargetNode->Attribute( i )->AttributeValue() );
+ }
+ User::LeaveIfError( targetAttributes.Append( &attribute ) );
+ }
+ iTargetDoc.Find( parent->NodeName(), parentResults, parentAttributes );
+ iTargetDoc.Find( iTargetNode->NodeName(), targetResults, targetAttributes );
+ if( parentResults.Count() == 1 && targetResults.Count() == 1 )
+ {
+ iXmlFile.Close();
+ ReplaceDataFileL();
+ CLocalDocumentNode* node = ( CLocalDocumentNode* )parentResults[0];
+ CLocalDocumentNode* target = ( CLocalDocumentNode* )targetResults[0];
+ node->ReplaceLocalL( iNewNode, target );
+ WriteFileL( iTargetDoc.DocumentRoot() );
+ }
+ else User::Leave( KErrGeneral );
+ CleanupStack::PopAndDestroy( 5 ); //targetAttributes, targetResults,
+ //parentAttributes, parentResults, data
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+void CLocalReplacement::Destroy()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CLocalReplacement::~CLocalReplacement()
+ {
+
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/LocalOperations/src/LocalRetrieval.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalRetrieval
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalRetrieval.h"
+#include "LocalDocumentNode.h"
+#include "LocalOperationFactory.h"
+
+// ---------------------------------------------------------
+// CLocalRetrieval::CLocalRetrieval
+//
+// ---------------------------------------------------------
+//
+CLocalRetrieval::CLocalRetrieval( CLocalDocument& aTargetDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory ) :
+ CLocalOperationBase( aTargetDoc, aOperationFactory ),
+ iDocumentSubset( aDocumentSubset ),
+ iOperationType( aDocumentSubset == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CLocalRetrieval::NewL
+//
+// ---------------------------------------------------------
+//
+CLocalRetrieval* CLocalRetrieval::NewL( CLocalDocument& aParentDoc,
+ CLocalDocumentNode* aDocumentSubset,
+ CLocalOperationFactory& aOperationFactory )
+ {
+ CLocalRetrieval* self = new ( ELeave ) CLocalRetrieval( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CLocalRetrieval::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CLocalRetrieval::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CLocalRetrieval::ExecuteL()" ) );
+ #endif
+ HBufC8* data = NULL;
+ TInt error = KErrNone;
+ TInt length = OpenDataFileL( iTargetDoc.XmlFilePath() );
+ TRAP( error, data = FetchXmlDataL( length ) );
+ CleanupStack::PushL( data );
+ if( data != NULL )
+ {
+ if( iDocumentSubset == NULL )
+ {
+ TRAP( error, iXmlParser->ParseDocumentL( &iTargetDoc, *data ) );
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Document fetch complete - Error: %d" ), error );
+ #endif
+ }
+ else
+ {
+ iDocumentSubset->SetEmptyNode( ETrue );
+ iDocumentSubset->SetEmptyNode( EFalse );
+ TRAP( error, iXmlParser->ParseDocumentL( &iTargetDoc, *data, ( CXdmDocumentNode* )iDocumentSubset ) );
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Document fetch complete: %d" ), error );
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Reading of the document data failed: %d" ), error );
+ #endif
+ User::Leave( error );
+ }
+ CleanupStack::PopAndDestroy(); //data
+ iXmlFile.Close();
+ }
+
+// ---------------------------------------------------------
+// CLocalRetrieval::Destroy
+//
+// ---------------------------------------------------------
+//
+void CLocalRetrieval::Destroy()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------
+// CLocalRetrieval::~CLocalRetrieval
+//
+// ---------------------------------------------------------
+//
+CLocalRetrieval::~CLocalRetrieval()
+ {
+
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/bwinscw/LocalProtocolU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,18 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+ ??1CLocalDocumentNode@@UAE@XZ @ 2 NONAME ; CLocalDocumentNode::~CLocalDocumentNode(void)
+ ??1CXdmNamespace@@UAE@XZ @ 3 NONAME ; CXdmNamespace::~CXdmNamespace(void)
+ ?AppendLocalL@CLocalDocumentNode@@QAEXPAVCXdmDocumentNode@@@Z @ 4 NONAME ; void CLocalDocumentNode::AppendLocalL(class CXdmDocumentNode *)
+ ?FileSession@CLocalProtocol@@SAAAVRFs@@XZ @ 5 NONAME ; class RFs & CLocalProtocol::FileSession(void)
+ ?IsSubset@CLocalDocument@@QBEHXZ @ 6 NONAME ; int CLocalDocument::IsSubset(void) const
+ ?NewL@CXdmNamespace@@SAPAV1@ABVTDesC8@@0@Z @ 7 NONAME ; class CXdmNamespace * CXdmNamespace::NewL(class TDesC8 const &, class TDesC8 const &)
+ ?Prefix@CXdmNamespace@@QBE?AVTPtrC8@@XZ @ 8 NONAME ; class TPtrC8 CXdmNamespace::Prefix(void) const
+ ?RemoveData@CLocalDocument@@QAEXPAVCLocalDocumentNode@@@Z @ 9 NONAME ; void CLocalDocument::RemoveData(class CLocalDocumentNode *)
+ ?RemoveLocalL@CLocalDocumentNode@@QAEXPAVCXdmDocumentNode@@@Z @ 10 NONAME ; void CLocalDocumentNode::RemoveLocalL(class CXdmDocumentNode *)
+ ?ReplaceLocalL@CLocalDocumentNode@@QAEXPAVCXdmDocumentNode@@0@Z @ 11 NONAME ; void CLocalDocumentNode::ReplaceLocalL(class CXdmDocumentNode *, class CXdmDocumentNode *)
+ ?ResetSubset@CLocalDocument@@UAEXXZ @ 12 NONAME ; void CLocalDocument::ResetSubset(void)
+ ?RootFolder@CLocalProtocol@@SA?AVTPtrC16@@XZ @ 13 NONAME ; class TPtrC16 CLocalProtocol::RootFolder(void)
+ ?TempCopyL@CLocalDocument@@QAEPAV1@XZ @ 14 NONAME ; class CLocalDocument * CLocalDocument::TempCopyL(void)
+ ?Uri@CXdmNamespace@@QBE?AVTPtrC8@@XZ @ 15 NONAME ; class TPtrC8 CXdmNamespace::Uri(void) const
+ ?XmlFilePath@CLocalDocument@@QBE?AVTPtrC16@@XZ @ 16 NONAME ; class TPtrC16 CLocalDocument::XmlFilePath(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/eabi/LocalProtocolU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,26 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZN13CXdmNamespace4NewLERK6TDesC8S2_ @ 2 NONAME
+ _ZN13CXdmNamespaceD0Ev @ 3 NONAME
+ _ZN13CXdmNamespaceD1Ev @ 4 NONAME
+ _ZN13CXdmNamespaceD2Ev @ 5 NONAME
+ _ZN14CLocalDocument10RemoveDataEP18CLocalDocumentNode @ 6 NONAME
+ _ZN14CLocalDocument11ResetSubsetEv @ 7 NONAME
+ _ZN14CLocalDocument9TempCopyLEv @ 8 NONAME
+ _ZN14CLocalProtocol10RootFolderEv @ 9 NONAME
+ _ZN14CLocalProtocol11FileSessionEv @ 10 NONAME
+ _ZN18CLocalDocumentNode12AppendLocalLEP16CXdmDocumentNode @ 11 NONAME
+ _ZN18CLocalDocumentNode12RemoveLocalLEP16CXdmDocumentNode @ 12 NONAME
+ _ZN18CLocalDocumentNode13ReplaceLocalLEP16CXdmDocumentNodeS1_ @ 13 NONAME
+ _ZN18CLocalDocumentNodeD0Ev @ 14 NONAME
+ _ZN18CLocalDocumentNodeD1Ev @ 15 NONAME
+ _ZN18CLocalDocumentNodeD2Ev @ 16 NONAME
+ _ZNK13CXdmNamespace3UriEv @ 17 NONAME
+ _ZNK13CXdmNamespace6PrefixEv @ 18 NONAME
+ _ZNK14CLocalDocument11XmlFilePathEv @ 19 NONAME
+ _ZNK14CLocalDocument8IsSubsetEv @ 20 NONAME
+ _ZTI14CLocalDocument @ 21 NONAME ; #<TI>#
+ _ZTI14CLocalProtocol @ 22 NONAME ; #<TI>#
+ _ZTV14CLocalDocument @ 23 NONAME ; #<VT>#
+ _ZTV14CLocalProtocol @ 24 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/group/LocalProtocol.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocalProtocol.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET localprotocol.dll
+UID 0x10009D8D 0x10207458
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+TARGETTYPE PLUGIN
+
+SOURCEPATH ../src
+
+START RESOURCE 10207458.rss
+
+TARGET localprotocol.rsc
+
+END
+
+SOURCE LocalProtocol.cpp
+SOURCE LocalDocument.cpp
+SOURCE LocalDirectory.cpp
+SOURCE LocalDocumentNode.cpp
+SOURCE LocalNodeAttribute.cpp
+SOURCE LocalDirectoryEntry.cpp
+
+//Sources common to all protocols
+SOURCEPATH ../../src
+SOURCE XdmNamespace.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../XdmXmlParser/inc
+
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/xml
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY hal.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY flogger.lib
+LIBRARY charconv.lib
+LIBRARY xdmengine.lib
+LIBRARY xdmxmlparser.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../bwinscw/
+#elif defined (WINS )
+deffile ../bwins/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocalProtocol bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+LocalProtocol.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalDirectory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDirectory
+*
+*/
+
+
+
+
+#ifndef __LOCALDIRECTORY__
+#define __LOCALDIRECTORY__
+
+#include <e32base.h>
+#include "XdmDirectory.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONS
+class CXdmDocument;
+class CLocalProtocol;
+class CLocalDirectoryEntry;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalDirectory ) : public CXdmDirectory
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalDirectory* NewL( const TDesC& aFilePath,
+ CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ //void CancelUpdate();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalDirectory();
+
+ private: //From CXdmDirectory
+
+ /**
+ * Start updating the contents of this directory model
+ * @param TRequestStatus& Request status of the client
+ * @param TDirUpdatePhase Phase of the update
+ * @return void
+ */
+ void StartUpdateL();
+
+ /**
+ * Cancel a directory update
+ * @return void
+ */
+ void CancelUpdate();
+
+ /**
+ * Save the client's request status and update status
+ * @param TDirUpdatePhase The update phase
+ * @param TRequestStatus The client's request status
+ * @return void
+ */
+ void SaveRequestData( TDirUpdatePhase aUpdatePhase,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * Return the root element of this document
+ */
+ TInt DocumentCount();
+
+ /**
+ * Return the root element of this document
+ */
+ TPtrC Document( TInt aIndex ) const;
+
+ /**
+ * Returns the path to this directory
+ *
+ * @return TPtrC8 The path to the directory this object models
+ */
+ TPtrC DirectoryPath() const;
+
+ /**
+ * Returns the path to this directory
+ *
+ * @return TPtrC8 The path to the directory this object models
+ */
+ TXdmDocType DocumentTypeL( TInt aIndex ) const;
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalDirectory( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void FindTimeStampFilesL( const CDir* aDirectory );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void MatchWithStampFilesL( const CDir* aDirectory );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ TInt OfferEntryL( const TDesC& aEntryName );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void RefreshEntryArrayL();
+
+ private: //Data
+
+ TRequestStatus* iClientStatus;
+ TDirUpdatePhase iUpdatePhase;
+ CLocalProtocol& iLocalProtocol;
+ RPointerArray<CLocalDirectoryEntry> iEntryArray;
+ };
+
+#endif //__LOCALDIRECTORY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalDirectoryEntry.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDirectoryEntry
+*
+*/
+
+
+
+
+#ifndef __LOCALDIRECTORYENTRY__
+#define __LOCALDIRECTORYENTRY__
+
+#include <e32base.h>
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalDirectoryEntry ) : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalDirectoryEntry* NewL( const TDesC& aFileName );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TPtrC EntryName() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TBool OfferEntryL( const TDesC& aEntryName );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalDirectoryEntry();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalDirectoryEntry();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL( const TDesC& aFilePath );
+
+ private: //Data
+
+ HBufC* iXmlEntryName;
+ HBufC* iTimeStampEntryName;
+ };
+
+#endif //__LOCALDIRECTORYENTRY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalDocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,336 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDocument
+*
+*/
+
+
+
+
+#ifndef __LOCALDOCUMENT__
+#define __LOCALDOCUMENT__
+
+#include <e32base.h>
+#include "XdmDocument.h"
+
+_LIT( KTimeStampFileExt, ".tmsp");
+_LIT( KDateFormat, "%1-%2-%3");
+_LIT( KTimeFormat, "%H:%T:%S");
+const TInt KDateTimeMaxSize = 200;
+const TInt KDateBufferMaxSize = 50;
+
+//FORWARD DECLARATIONS
+class CXdmNamespace;
+class MXdmOperation;
+class CLocalProtocol;
+class CLocalDocumentNode;
+class CXdmOperationFactory;
+
+//CLASS DECLARATION
+class CLocalDocument : public CXdmDocument
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalDocument* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aDocumentName,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ //static CLocalDocument* NewL( const TDesC8& aDocumentName );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void StartInternalL( TRequestStatus& aStatus );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void CancelUpdate();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalDocument();
+
+ public: //Exported methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C CLocalDocument* TempCopyL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C TPtrC XmlFilePath() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C TBool IsSubset() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C virtual void ResetSubset();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C void RemoveData( CLocalDocumentNode* aDocumentNode );
+
+ public: //From CXdmDocument
+
+ /**
+ * Return the root element of this document
+ *
+ * @return CXdmDocumentNode The root element of the document
+ *
+ * NOTE: The returning node may or may not contain any data,
+ * since, in the case that this document model does not
+ * have content yet, the element is a simple "entry point"
+ * to the whole document. Thus, for instance, if the client
+ * application requests the Xdm Engine to fetch a particular
+ * document, the root element points to nothing until the
+ * request has been completed.
+ *
+ */
+ CXdmDocumentNode* DocumentRoot() const;
+
+ private: //From CXdmDocument
+
+ /**
+ * Construct an "anonymous" entry point for this document.
+ * This node effectively becomes the root of this document.
+ *
+ */
+ CXdmDocumentNode* CreateRootL();
+
+ /*
+ * Reset the contents of this document model.
+ */
+ void ResetContents();
+
+ /**
+ * Return the time stamp for this document
+ *
+ * @return TTime
+ */
+ TTime TimeStamp() const;
+
+ /**
+ * Return an error document for a failed update
+ *
+ * NOTE: Error document is not supported in this
+ * protocol. The returning pointer will be NULL.
+ *
+ * @return CXdmDocument* The error document
+ */
+ CXdmDocumentNode* ErrorRoot();
+
+ /**
+ * Append an element to the path identifying the
+ * the current document subset
+ * @return void
+ */
+ void AppendPathPartL( const TDesC& aString );
+
+ /**
+ * Return the current document subset (including descendants)
+ * @return void
+ */
+ CXdmDocumentNode* CurrentExtent() const;
+
+ /**
+ * Construct an "anonymous" entry point for this document.
+ * This node effectively becomes the root of this document.
+ */
+ TXdmDocType DocumentType() const;
+
+ private: //From MXdmNamespaceContainer
+
+ /**
+ * Return the number of namespace declarations
+ * @return TInt Namespace declaration count
+ */
+ TInt Count() const;
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ /**
+ * Remove a namespace from the document
+ * @param TDesC8& URI of the namespace
+ * @param TDesC8& Prefix of the namespace
+ */
+ void RemoveNamespace( const TDesC8& aUri );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TPtrC8 Uri( const TDesC8& aPrefix ) const;
+
+ /**
+ * Fetch the aIndex-th URI
+ * @param TInt The index of the desired URI string
+ * @return TPtrC URI string
+ */
+ TPtrC8 Uri( TInt aIndex ) const;
+
+ /**
+ * Fetch the aIndex-th prefix
+ * @param TDesC8 The index of the desired prefix string
+ * @return TPtrC Prefix string
+ */
+ TPtrC8 Prefix( TInt aIndex ) const;
+
+ /**
+ * Resets namespaces from the document
+ */
+ void ResetNamespaces( );
+
+ private:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalDocument( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void FinaliseOperation( TInt aIndex );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void StartUpdateL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void SaveClientStatus( TRequestStatus& aStatus );
+
+ /**
+ * _DEBUG
+ */
+ void DumpResponseBodyL( const TDesC8& aResponseBody ) const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL( const TDesC8& aDocumentName );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void FetchTimeStampL();
+
+ private: //Data
+
+ enum TLocalOperation
+ {
+ EFetch = 0,
+ EReplace,
+ EInsert,
+ EFetchPartial,
+ EInsertPartial,
+ EReplacePartial,
+ };
+
+ enum TLocalDocumentState
+ {
+ EXdmDocIdle = 0,
+ EXdmDocUpdating,
+ EResolvingAsyncConflict,
+ };
+
+ TInt iDataLength;
+ TInt iUpdateIndex;
+ TInt iOperationCount;
+ TInt iOperationError;
+ TTime iLastAccess;
+ TTime iLastModification;
+ TBool iWholeDoc;
+ HBufC* iFullPath;
+ HBufC* iDocSubsetPath;
+ TLocalOperation iOperationType;
+ CLocalProtocol& iLocalProtocol;
+ CLocalDocumentNode* iDocumentRoot;
+ TLocalDocumentState iDocumentState;
+ RPointerArray<CXdmNamespace> iNamespaces;
+ };
+
+#endif //__XCAPDOCUMENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalDocumentNode.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDocumentNode
+*
+*/
+
+
+
+
+#ifndef __LOCALDOCUMENTNODE__
+#define __LOCALDOCUMENTNODE__
+
+#include "XdmNodeFactory.h"
+#include "XdmDocumentNode.h"
+
+class CLocalProtocol;
+class CXdmNodeAttribute;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalDocumentNode ) : public CXdmDocumentNode,
+ public MXdmNodeFactory
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CLocalDocumentNode();
+
+ public: // New functions
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol,
+ const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TBool Leaf node indicator
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TBool Leaf node indicator
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CLocalDocumentNode* NewL( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ void SetParentNode( CLocalDocumentNode*& aParentNode );
+
+ public:
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ IMPORT_C void RemoveLocalL( CXdmDocumentNode* aChileNode );
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ IMPORT_C void AppendLocalL( CXdmDocumentNode* aChileNode );
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ IMPORT_C void ReplaceLocalL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode );
+
+ private:
+
+ /**
+ * C++ constructor, private version.
+ */
+ CLocalDocumentNode( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * C++ constructor, protected version.
+ *
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ CLocalDocumentNode( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * C++ constructor, another private version.
+ */
+ CLocalDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * By default Symbian OS constructor is private.
+ *
+ * @param TDesC8& Name of this node
+ * @return void
+ */
+ virtual void CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode );
+
+ private: //From MXdmNodeFactory
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL();
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL( const TDesC& aChildName );
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL( const CXdmDocumentNode* aAnotherNode );
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ CXdmNodeAttribute* AttributeL();
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ CXdmNodeAttribute* AttributeL( const TDesC& aAttributeName );
+
+ private: //From MXdmNodeInterface
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TPtrC8 Prefix() const;
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void SetPrefixL( const TDesC8& aNamespacePrefix );
+
+ private:
+
+ HBufC8* iPrefix;
+ CLocalProtocol& iLocalProtocol;
+ CLocalDocumentNode* iNextNode;
+ };
+
+#endif //__LOCALDOCUMENTNODE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalNodeAttribute.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalNodeAttribute
+*
+*/
+
+
+
+
+#ifndef __LOCALNODEATTRIBUTE__
+#define __LOCALNODEATTRIBUTE__
+
+#include "XdmNodeAttribute.h"
+
+class CLocalProtocol;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CLocalNodeAttribute ) : public CXdmNodeAttribute
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of this attribute
+ * @param CXdmDocumentNode* Parent of this attribute
+ *
+ * NOTE! "Parent", in this case, denotes the
+ * element this attribute attributes.
+ *
+ * @return CXdmNodeAttribute*
+ */
+ static CLocalNodeAttribute* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aAttributeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param CXdmDocumentNode* Parent of this attribute
+ *
+ * NOTE! "Parent", in this case, denotes the
+ * element this attribute attributes.
+ *
+ * @return CXdmNodeAttribute*
+ */
+ static CLocalNodeAttribute* NewL( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalNodeAttribute();
+
+ public: // New functions
+
+
+
+ private:
+
+ /**
+ * C++ constructor, private version.
+ */
+ CLocalNodeAttribute( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * C++ constructor, protected version.
+ *
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ CLocalNodeAttribute( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol );
+
+ /**
+ * By default Symbian OS constructor is private.
+ *
+ * @param TDesC8& Name of this node
+ * @return void
+ */
+ void ConstructL( const TDesC& aNodeName );
+
+ /**
+ * C++ constructor, another private version.
+ */
+ CLocalNodeAttribute( const TBool aLeafNode,
+ CXdmDocumentNode* aParentNode );
+
+ private: //From MXdmNodeInterface
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TPtrC8 Prefix() const;
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void SetPrefixL( const TDesC& aNamespacePrefix );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void SetPrefixL( const TDesC8& aNamespacePrefix );
+
+ private:
+
+ CLocalProtocol& iLocalProtocol;
+ };
+
+#endif //__LOCALNODEATTRIBUTE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/inc/LocalProtocol.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalProtocol
+*
+*/
+
+
+
+
+#ifndef __LOCALPROTOCOL__
+#define __LOCALPROTOCOL__
+
+#include <e32base.h>
+#include "XdmEngine.h"
+#include "XdmProtocol.h"
+#include "XdmShutdownSwitch.h"
+
+//CONSTANTS
+_LIT( KLocalEngLogFile, "LocalProtocol" );
+_LIT( KLocalEngPrivateRoot, "C:\\private\\" );
+const TInt KLocalEngLogBufferMaxSize = 2000;
+
+//FORWARD DECLARATIONS
+class CXdmXmlParser;
+class CXdmLogWriter;
+class CXdmOperationFactory;
+
+//CLASS DECLARATION
+class CLocalProtocol : public CXdmProtocol
+ {
+
+ public:
+
+ /**
+ * Fetch the capabilities for this protocol. May require
+ * network operations.
+ */
+ IMPORT_C static RFs& FileSession();
+
+
+ /**
+ * A Global logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ IMPORT_C static TPtrC RootFolder();
+
+ private: //From CXdmProtocol
+
+ /**
+ * Initialise the media used to transfer Xdm data
+ */
+ void InitTransferMedium( TInt aIdleTimeout,
+ TRequestStatus& aStatus );
+
+ /**
+ * Cancel initialisation of the transfer media.
+ */
+ void CancelTransferMediumInit();
+
+ /**
+ * Is the transfer medium ready
+ */
+ TBool IsTransferAvailable() const;
+
+ /**
+ * Create a new document node.
+ */
+ CXdmDocumentNode* CreateDocumentNodeL();
+
+ /**
+ * Create a new protocol dependent document model
+ */
+ CXdmDocument* CreateDocumentL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType );
+
+ /**
+ * Create a new protocol dependent document model
+ */
+ CXdmDirectory* CreateDirectoryL( const TDesC& aDirectoryPath );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CLocalProtocol();
+
+ public: //Static
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CLocalProtocol* NewL( const TXdmProtocolParams& aProtocolInfo );
+
+ /**
+ * A Global logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ RFs& RFSession();
+
+ /**
+ * A Global logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ TPtrC Root();
+
+ public:
+
+ /**
+ * A logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CLocalProtocol( const CXdmEngine& aXdmEngine,
+ const CXdmProtocolInfo& aProtocolInfo );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void SetRootDirectoryL( const TDesC& aRootPath );
+
+ private:
+
+ /**
+ * From MXdmShutdownSwitch
+ * @return void
+ */
+ //void SwitchOff();
+
+ private: //Data
+
+ RFs iFileSession;
+ TBool iTransferMediaOpen;
+ HBufC* iRootFolder;
+ CXdmEngine& iXdmEngine;
+ CXdmLogWriter* iLogWriter;
+ CXdmXmlParser* iXmlParser;
+ const CXdmProtocolInfo& iProtocolInfo;
+ };
+
+#endif //__LOCALPROTOCOL__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/10207458.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmLocalProtocolInfo
+*
+*/
+
+
+// 10207458.RSS
+//
+#include "registryinfo.rh"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XdmLocalProtocolInfo
+ {
+ dll_uid = 0x10207458;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207422;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207424;
+ version_no = 1;
+ display_name = "XDM Engine Local Protocol||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalDirectory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDirectory
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <utf.h>
+#include <f32file.h>
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalDirectory.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+#include "LocalDirectoryEntry.h"
+
+
+// ----------------------------------------------------------
+// CLocalDirectory::CLocalDirectory
+//
+// ----------------------------------------------------------
+//
+CLocalDirectory::CLocalDirectory( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmDirectory( aXdmEngine ),
+ iLocalProtocol( aLocalProtocol )
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDirectory* CLocalDirectory::NewL( const TDesC& aFilePath,
+ CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalDirectory* self = new ( ELeave ) CLocalDirectory( aXdmEngine, aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aFilePath );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------
+// CLocalDirectory::~CLocalDirectory
+//
+// ----------------------------------------------------
+//
+CLocalDirectory::~CLocalDirectory()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::~CLocalDirectory()" ) );
+ #endif
+ Cancel();
+ iEntryArray.ResetAndDestroy();
+ iEntryArray.Close();
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::ConstructL()
+ {
+ RefreshEntryArrayL();
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::RefreshEntryArrayL
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::RefreshEntryArrayL()
+ {
+ CDir* directory = NULL;
+ iEntryArray.ResetAndDestroy();
+ TPtrC path = iDirectoryPath->Des();
+ RFs& session = CLocalProtocol::FileSession();
+ User::LeaveIfError( session.GetDir( path, KEntryAttNormal, ESortByExt, directory ) );
+ CleanupStack::PushL( directory );
+ TInt count = directory->Count();
+ FindTimeStampFilesL( directory );
+ MatchWithStampFilesL( directory );
+ CleanupStack::PopAndDestroy(); //directory
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::FindTimeStampFilesL
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::FindTimeStampFilesL( const CDir* aDirectory )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::FindTimeStampFilesL()" ) );
+ #endif
+ TBool ready = EFalse;
+ TInt count = aDirectory->Count();
+ for( TInt i = 0;!ready && i < count;i++ )
+ {
+ TPtrC name = ( *aDirectory )[i].iName;
+ TInt index = name.Find( KTimeStampFileExt );
+ if( index > 0 )
+ {
+ TInt stampIndex = i;
+ CLocalDirectoryEntry* entry = NULL;
+ while( !ready )
+ {
+ entry = CLocalDirectoryEntry::NewL( name );
+ CleanupStack::PushL( entry );
+ User::LeaveIfError( iEntryArray.Append( entry ) );
+ CleanupStack::Pop(); //entry
+ stampIndex++;
+ if( stampIndex < count )
+ {
+ name.Set( ( *aDirectory )[stampIndex].iName );
+ index = name.Find( KTimeStampFileExt );
+ if( index <= 0 )
+ ready = ETrue;
+ }
+ else ready = ETrue;
+ }
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::MatchWithStampFilesL
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::MatchWithStampFilesL( const CDir* aDirectory )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::MatchWithStampFilesL()" ) );
+ #endif
+ TInt count = aDirectory->Count();
+ for( TInt i = 0;i < count;i++ )
+ {
+ TPtrC name = ( *aDirectory )[i].iName;
+ TInt index = name.Find( KTimeStampFileExt );
+ if( index > 0 )
+ continue;
+ else
+ {
+ TBool ready = EFalse;
+ TInt count = iEntryArray.Count();
+ for( TInt i = 0;!ready && i < count;i++ )
+ ready = iEntryArray[i]->OfferEntryL( name );
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::DocumentCount
+//
+// ----------------------------------------------------------
+//
+TInt CLocalDirectory::DocumentCount()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::DocumentCount()" ) );
+ #endif
+ RefreshEntryArrayL();
+ return iEntryArray.Count();
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::DocumentTypeL
+//
+// ----------------------------------------------------
+//
+TXdmDocType CLocalDirectory::DocumentTypeL( TInt /*aIndex*/ ) const
+ {
+ return EXdmDocGeneral;
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::Document
+//
+// ----------------------------------------------------------
+//
+TPtrC CLocalDirectory::Document( TInt aIndex ) const
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::Document()" ) );
+ #endif
+ return aIndex < 0 || aIndex > iEntryArray.Count() ? TPtrC() :
+ iEntryArray[aIndex]->EntryName();
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::ConstructL
+//
+// ----------------------------------------------------------
+//
+TPtrC CLocalDirectory::DirectoryPath() const
+ {
+ return iDirectoryPath != NULL ? iDirectoryPath->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------------
+// CXcapDirectory::SaveRequestData
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::SaveRequestData( TDirUpdatePhase aUpdatePhase,
+ TRequestStatus& aClientStatus )
+ {
+ iUpdatePhase = aUpdatePhase;
+ iClientStatus = &aClientStatus;
+ }
+
+// ----------------------------------------------------------
+// CLocalDirectory::StartUpdateL
+//
+// ----------------------------------------------------------
+//
+void CLocalDirectory::StartUpdateL()
+
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::StartUpdateL()" ) );
+ #endif
+ switch( iUpdatePhase )
+ {
+ case EUpdateDocumentList:
+ RefreshEntryArrayL();
+ User::RequestComplete( iClientStatus, KErrNone );
+ break;
+ case ERefreshDocuments:
+ User::RequestComplete( iClientStatus, KErrNone );
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CLocalDirectory::RunL()
+//
+// ---------------------------------------------------------
+//
+void CLocalDirectory::RunL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::RunL() - Request: %d" ), iStatus.Int() );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CLocalDirectory::CancelUpdate
+//
+// ----------------------------------------------------
+//
+void CLocalDirectory::CancelUpdate()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::CancelUpdate()" ) );
+ #endif
+ Cancel();
+ }
+
+// ---------------------------------------------------------
+// CLocalDirectory::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CLocalDirectory::DoCancel()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDirectory::DoCancel()" ) );
+ #endif
+ switch( iUpdatePhase )
+ {
+ case EDirPhaseIdle:
+ break;
+ case EUpdateDocumentList:
+ break;
+ case ERefreshDocuments:
+ break;
+ default:
+ break;
+ }
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalDirectoryEntry.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDirectoryEntry
+*
+*/
+
+
+
+
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalDirectoryEntry.h"
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::CLocalDirectoryEntry
+//
+// ----------------------------------------------------
+//
+CLocalDirectoryEntry::CLocalDirectoryEntry()
+ {
+ }
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::CLocalDirectoryEntry
+//
+// ----------------------------------------------------
+//
+CLocalDirectoryEntry* CLocalDirectoryEntry::NewL( const TDesC& aFileName )
+ {
+ CLocalDirectoryEntry* self = new ( ELeave ) CLocalDirectoryEntry();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFileName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::ConstructL
+//
+// ----------------------------------------------------
+//
+void CLocalDirectoryEntry::ConstructL( const TDesC& aFileName )
+ {
+ TChar comma = 46;
+ TInt index = aFileName.LocateReverse( comma );
+ TPtrC temp = aFileName.Left( index );
+ iTimeStampEntryName = HBufC::NewL( temp.Length() );
+ iTimeStampEntryName->Des().Copy( temp );
+ }
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::EntryName
+//
+// ----------------------------------------------------
+//
+TPtrC CLocalDirectoryEntry::EntryName() const
+ {
+ return iXmlEntryName != NULL ? iXmlEntryName->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::CLocalDirectoryEntry
+//
+// ----------------------------------------------------
+//
+TBool CLocalDirectoryEntry::OfferEntryL( const TDesC& aEntryName )
+ {
+ TChar comma = 46;
+ TInt index = aEntryName.LocateReverse( comma );
+ TPtrC name( index > 0 ? aEntryName.Left( index ) : aEntryName );
+ if( iTimeStampEntryName->Des().Compare( name ) == 0 )
+ {
+ iXmlEntryName = HBufC::NewL( aEntryName.Length() );
+ iXmlEntryName->Des().Copy( aEntryName );
+ return ETrue;
+ }
+ else return EFalse;
+ }
+
+// ----------------------------------------------------
+// CLocalDirectoryEntry::CLocalDirectoryEntry
+//
+// ----------------------------------------------------
+//
+CLocalDirectoryEntry::~CLocalDirectoryEntry()
+ {
+ delete iXmlEntryName;
+ delete iTimeStampEntryName;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalDocument.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDocument
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include "XdmProtocol.h"
+#include "XdmNamespace.h"
+#include "XdmOperation.h"
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalDocumentNode.h"
+#include "XdmOperationFactory.h"
+
+// ----------------------------------------------------
+// CLocalDocument::CLocalDocument
+//
+// ----------------------------------------------------
+//
+CLocalDocument::CLocalDocument( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmDocument( aXdmEngine ),
+ iLocalProtocol( aLocalProtocol )
+ {
+ }
+
+
+// ----------------------------------------------------------
+// CLocalDocument::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocument* CLocalDocument::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aDocumentName,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalDocument* self = new ( ELeave ) CLocalDocument( aXdmEngine, aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( KLocalOperationFactory, aDocumentName );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalDocument::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CLocalDocument::ConstructL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::ConstructL()" ) );
+ #endif
+ TPtrC name = iDocumentName->Des();
+ TPtrC root = iLocalProtocol.RootFolder();
+ iFullPath = HBufC::NewL( name.Length() + root.Length() );
+ iFullPath->Des().Copy( root );
+ iFullPath->Des().Append( name );
+ FetchTimeStampL();
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------
+// CLocalDocument::ResetContents
+//
+// ----------------------------------------------------------
+//
+void CLocalDocument::ResetContents()
+ {
+ delete iDocumentRoot;
+ iDocumentRoot = NULL;
+ iNamespaces.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------
+// CLocalDocument::FetchTimeStampL
+//
+// ----------------------------------------------------------
+//
+void CLocalDocument::FetchTimeStampL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::FetchTimeStampL()" ) );
+ #endif
+ RFile timeStamp;
+ TBuf8<KDateTimeMaxSize> buf;
+ TBuf<KDateTimeMaxSize> buf16;
+ const TChar idSeparator = 46;
+ TPtrC fullPath( iFullPath->Des() );
+ HBufC* path = HBufC::NewLC( fullPath.Length() + KTimeStampFileExt().Length() );
+ TInt index = fullPath.LocateReverse( idSeparator );
+ TPtrC tmspName( index > 0 ? fullPath.Left( index ) : fullPath );
+ path->Des().Copy( tmspName );
+ path->Des().Append( KTimeStampFileExt );
+ TInt error = timeStamp.Open( CLocalProtocol::FileSession(), path->Des(), EFileRead );
+ if( error == KErrNone )
+ {
+ CleanupClosePushL( timeStamp );
+ User::LeaveIfError( timeStamp.Read( buf ) );
+ buf16.Copy( buf );
+ buf.Zero();
+ User::LeaveIfError( iLastModification.Parse( buf16 ) );
+ CleanupStack::PopAndDestroy(); //timeStamp
+ }
+ CleanupStack::PopAndDestroy(); //path
+ }
+// ----------------------------------------------------
+// CLocalDocument::~CLocalDocument
+//
+// ----------------------------------------------------
+//
+CLocalDocument::~CLocalDocument()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::~CLocalDocument()" ) );
+ #endif
+ Cancel();
+ delete iFullPath;
+ delete iDocumentRoot;
+ iNamespaces.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::CreateRootL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocument::CreateRootL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::DocumentSubsetL()" ) );
+ #endif
+ iDocumentRoot = CLocalDocumentNode::NewL( iXdmEngine, iLocalProtocol );
+ return iDocumentRoot;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::TempCopyL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CLocalDocument* CLocalDocument::TempCopyL()
+ {
+ return CLocalDocument::NewL( iXdmEngine, Name(), iLocalProtocol );
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::DocumentRoot
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocument::DocumentRoot() const
+ {
+ return iDocumentRoot;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::ErrorRoot
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocument::ErrorRoot()
+ {
+ return NULL;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::ErrorRoot
+//
+// ----------------------------------------------------
+//
+TXdmDocType CLocalDocument::DocumentType() const
+ {
+ return EXdmDocGeneral;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::IsSubset
+//
+// ----------------------------------------------------
+//
+EXPORT_C TBool CLocalDocument::IsSubset() const
+ {
+ return iDocSubset;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::ResetSubset
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CLocalDocument::ResetSubset()
+ {
+ CXdmDocument::ResetSubset();
+ delete iDocumentRoot;
+ iDocumentRoot = NULL;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::XmlFilePath
+//
+// ------------------------------ ----------------------
+//
+EXPORT_C TPtrC CLocalDocument::XmlFilePath() const
+ {
+ return iFullPath != NULL ? iFullPath->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::RemoveData
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CLocalDocument::RemoveData( CLocalDocumentNode* /*aDocumentNode*/ )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::RemoveData()" ) );
+ #endif
+
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::StartUpdateL
+//
+// ----------------------------------------------------
+//
+void CLocalDocument::StartUpdateL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::StartUpdateL()" ) );
+ #endif
+ TBool keepGoing = ETrue;
+ TInt completion = KErrNone;
+ TInt count = iChangeRequests.Count();
+ for( TInt i = 0;keepGoing && i < count;i++ )
+ {
+ //"First in, first served"
+ TRAPD( error, iChangeRequests[0]->ExecuteL() );
+ if( error == KErrNone )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( " Execution of the operation no. %d was successful" ), i );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( " Execution of the operation no. %d failed with %d" ), i, error );
+ #endif
+ completion = error;
+ keepGoing = EFalse;
+ }
+ FinaliseOperation( 0 );
+ }
+ User::RequestComplete( iClientStatus, completion );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::AppendPathPartL
+//
+// ----------------------------------------------------
+//
+void CLocalDocument::AppendPathPartL( const TDesC& aString )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::PathPartL()" ) );
+ #endif
+ if( iDocumentRoot != NULL )
+ {
+ CXdmDocumentNode* node = NULL;
+ CXdmDocumentNode* parent = iDocumentRoot;
+ while( parent->NextNode() != NULL )
+ parent = parent->NextNode();
+ node = CLocalDocumentNode::NewL( iXdmEngine, aString, parent, iLocalProtocol );
+ parent->SetNextNode( node );
+ }
+ else
+ iDocumentRoot = CLocalDocumentNode::NewL( iXdmEngine, aString, iLocalProtocol );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::CurrentExtent
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocument::CurrentExtent() const
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::CurrentExtent()" ) );
+ #endif
+ CXdmDocumentNode* ret = NULL;
+ if( iDocumentRoot != NULL )
+ {
+ CXdmDocumentNode* node = iDocumentRoot;
+ while( node->NextNode() != NULL )
+ node = node->NextNode();
+ ret = node;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( " This document does not yet have a root, leave with KErrGeneral" ) );
+ #endif
+ User::Leave( KErrGeneral );
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::StartUpdateL
+//
+// ----------------------------------------------------
+//
+void CLocalDocument::StartInternalL( TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::StartInternalL()" ) );
+ #endif
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+ StartUpdateL();
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::CancelUpdate
+//
+// ----------------------------------------------------
+//
+void CLocalDocument::CancelUpdate()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::CancelUpdate()" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::RunL()
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::RunL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::RunL()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CLocalDocument::FinaliseOperation
+//
+// ----------------------------------------------------
+//
+void CLocalDocument::FinaliseOperation( TInt aIndex )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::FinaliseOperation()" ) );
+ #endif
+ TInt count = iChangeRequests.Count();
+ if( count > 0 && ( aIndex >= 0 && aIndex < count ) )
+ {
+ MXdmOperation* operation = NULL;
+ operation = iChangeRequests[aIndex];
+ iChangeRequests.Remove( aIndex );
+ operation->Destroy();
+ operation = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::AppendNamespaceL
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ CXdmNamespace* ns = CXdmNamespace::NewL( aUri, aPrefix );
+ CleanupStack::PushL( ns );
+ User::LeaveIfError( iNamespaces.Append( ns ) );
+ CleanupStack::Pop(); //ns
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::RemoveNamespace
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::RemoveNamespace( const TDesC8& aUri )
+ {
+ TBool found = EFalse;
+ CXdmNamespace* ns = NULL;
+ TInt count = iNamespaces.Count();
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ ns = iNamespaces[i];
+ if( ns->Uri().Compare( aUri ) == 0 )
+ {
+ found = ETrue;
+ iNamespaces.Remove( i );
+ delete ns;
+ ns = NULL;
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::Uri
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CLocalDocument::Uri( const TDesC8& aPrefix ) const
+ {
+ TPtrC8 uri( _L8( "" ) );
+ TBool found = EFalse;
+ TInt count = iNamespaces.Count();
+ for( TInt i = 0;i < count && !found;i++ )
+ {
+ if( iNamespaces[i]->Prefix().Compare( aPrefix ) == 0 )
+ {
+ uri.Set( iNamespaces[i]->Uri() );
+ found = ETrue;
+ }
+ }
+ return uri;
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::Count
+//
+// ---------------------------------------------------------
+//
+TInt CLocalDocument::Count() const
+ {
+ return iNamespaces.Count();
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::Prefix
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CLocalDocument::Prefix( TInt aIndex ) const
+ {
+ TInt count = iNamespaces.Count();
+ if( count > 0 && ( aIndex >= 0 && aIndex < count ) )
+ return iNamespaces[aIndex]->Prefix();
+ else return TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::Uri
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CLocalDocument::Uri( TInt aIndex ) const
+ {
+ TInt count = iNamespaces.Count();
+ if( count > 0 && ( aIndex >= 0 && aIndex < count ) )
+ return iNamespaces[aIndex]->Uri();
+ else return TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::ResetNamespaces
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::ResetNamespaces( )
+ {
+ iNamespaces.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::TimeStamp
+//
+// ---------------------------------------------------------
+//
+TTime CLocalDocument::TimeStamp() const
+ {
+ return iLastModification;
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::SaveClientStatus
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::SaveClientStatus( TRequestStatus& aStatus )
+ {
+ iClientStatus = &aStatus;
+ }
+
+// ---------------------------------------------------------
+// CLocalDocument::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CLocalDocument::DoCancel()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocument::DoCancel()" ) );
+ #endif
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalDocumentNode.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalDocumentNode
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XdmDocument.h"
+#include "LocalProtocol.h"
+#include "LocalDocumentNode.h"
+#include "LocalNodeAttribute.h"
+
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::CLocalDocumentNode
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode::CLocalDocumentNode( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmDocumentNode( aXdmEngine, ( MXdmNodeFactory& )*this ),
+ iLocalProtocol( aLocalProtocol )
+ {
+ }
+
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::CLocalDocumentNode
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode::CLocalDocumentNode( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmDocumentNode( aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode ),
+ iLocalProtocol( aLocalProtocol )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::CLocalDocumentNode
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode::CLocalDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmDocumentNode( aLeafNode, aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode ),
+ iLocalProtocol( aLocalProtocol )
+ {
+
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol )
+ {
+ return new ( ELeave ) CLocalDocumentNode( aXdmEngine, aLocalProtocol );
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalDocumentNode* self = new ( ELeave ) CLocalDocumentNode( aXdmEngine, aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol,
+ const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode )
+ {
+ CLocalDocumentNode* self = new ( ELeave ) CLocalDocumentNode( aXdmEngine, aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aAnotherNode.NodeName() );
+ self->CopyConstructL( aAnotherNode, aParentNode );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalDocumentNode* self = new ( ELeave ) CLocalDocumentNode( aXdmEngine, aParentNode,
+ aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalDocumentNode* self = new ( ELeave ) CLocalDocumentNode( aLeafNode, aXdmEngine,
+ aParentNode, aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CLocalDocumentNode* CLocalDocumentNode::NewL( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol )
+ {
+ return new ( ELeave ) CLocalDocumentNode( aLeafNode, aXdmEngine,
+ aParentNode, aLocalProtocol );
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::CopyConstructL
+//
+// ----------------------------------------------------------
+//
+void CLocalDocumentNode::CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode )
+ {
+ CXdmDocumentNode::CopyConstructL( aAnotherNode, aParentNode );
+ //TODO: Write the protocol specific copy operations
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::~CLocalDocumentNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C CLocalDocumentNode::~CLocalDocumentNode()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::~CLocalDocumentNode(): %x" ), this );
+ #endif
+ delete iPrefix;
+ delete iNextNode;
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::RemoveLocalL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CLocalDocumentNode::RemoveLocalL( CXdmDocumentNode* aChileNode )
+ {
+ RemoveChileNodeL( aChileNode );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::AppendLocalL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CLocalDocumentNode::AppendLocalL( CXdmDocumentNode* aChileNode )
+ {
+ if( aChileNode->Match( *this ) )
+ {
+ const TInt count = aChileNode->NodeCount();
+ for( TInt i = 0;i < count;i++ )
+ AppendChileNodeL( aChileNode->ChileNode( i ) );
+ }
+ else AppendChileNodeL( aChileNode );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::ReplaceLocalL
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CLocalDocumentNode::ReplaceLocalL( CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aTargetNode )
+ {
+ ReplaceChileNodeL( aNewNode, aTargetNode );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::CreateChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocumentNode::ChileNodeL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::CreateChileNodeL()" ) );
+ #endif
+ return CLocalDocumentNode::NewL( EFalse, iXdmEngine, this, iLocalProtocol );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::CreateChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocumentNode::ChileNodeL( const TDesC& aChildName )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::CreateChileNodeL() - Name: %S" ), &aChildName );
+ #endif
+ return CLocalDocumentNode::NewL( EFalse, iXdmEngine, aChildName, this, iLocalProtocol );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::CreateChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalDocumentNode::ChileNodeL( const CXdmDocumentNode* aAnotherNode )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::ChileNodeL() - Object: %x" ), aAnotherNode );
+ #endif
+ return CLocalDocumentNode::NewL( iXdmEngine, iLocalProtocol, *aAnotherNode, *this );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+CXdmNodeAttribute* CLocalDocumentNode::AttributeL()
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::CreateAttributeL()" ) );
+ #endif
+ return CLocalNodeAttribute::NewL( iXdmEngine, this, iLocalProtocol );
+ }
+
+// ----------------------------------------------------
+// CLocalDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+CXdmNodeAttribute* CLocalDocumentNode::AttributeL( const TDesC& aAttributeName )
+ {
+ #ifdef _DEBUG
+ iLocalProtocol.WriteToLog( _L8( "CLocalDocumentNode::CreateAttributeL() - Name: %S" ), &aAttributeName );
+ #endif
+ return CLocalNodeAttribute::NewL( iXdmEngine, aAttributeName, this, iLocalProtocol );
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::SetParentNode
+//
+// ----------------------------------------------------------
+//
+void CLocalDocumentNode::SetParentNode( CLocalDocumentNode*& aParentNode )
+ {
+ iParentNode = aParentNode;
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NamespacePrefix
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CLocalDocumentNode::Prefix() const
+ {
+ return iPrefix != NULL ? iPrefix->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::SetNamespacePrefixL
+//
+// ----------------------------------------------------------
+//
+void CLocalDocumentNode::SetPrefixL( const TDesC8& aPrefix )
+ {
+ delete iPrefix;
+ iPrefix = NULL;
+ iPrefix = HBufC8::NewL( aPrefix.Length() );
+ iPrefix->Des().Copy( aPrefix );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalNodeAttribute.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalNodeAttribute
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "LocalProtocol.h"
+#include "LocalNodeAttribute.h"
+
+// ----------------------------------------------------------
+// CLocalNodeAttribute::CLocalNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CLocalNodeAttribute::CLocalNodeAttribute( CXdmEngine& aXdmEngine,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmNodeAttribute( aXdmEngine,
+ ( MXdmNodeFactory& )*this ),
+ iLocalProtocol( aLocalProtocol )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalNodeAttribute::CLocalNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CLocalNodeAttribute::CLocalNodeAttribute( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol ) :
+ CXdmNodeAttribute( aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode ),
+ iLocalProtocol( aLocalProtocol )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalNodeAttribute::CLocalNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CLocalNodeAttribute* CLocalNodeAttribute::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aAttributeName,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalNodeAttribute* self = new ( ELeave ) CLocalNodeAttribute( aXdmEngine, aParentNode,aLocalProtocol );
+ CleanupStack::PushL( self );
+ self->CXdmNodeAttribute::BaseConstructL( aAttributeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalNodeAttribute::CLocalNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CLocalNodeAttribute* CLocalNodeAttribute::NewL( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode,
+ CLocalProtocol& aLocalProtocol )
+ {
+ CLocalNodeAttribute* self = new ( ELeave ) CLocalNodeAttribute( aXdmEngine, aParentNode, aLocalProtocol );
+ /*CleanupStack::PushL( self );
+ self->BaseConstructL();
+ CleanupStack::Pop();*/
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalNodeAttribute::~CLocalNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CLocalNodeAttribute::~CLocalNodeAttribute()
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::NamespacePrefix
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CLocalNodeAttribute::Prefix() const
+ {
+ return TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::SetNamespacePrefixL
+//
+// ----------------------------------------------------------
+//
+void CLocalNodeAttribute::SetPrefixL( const TDesC& /*aNamespacePrefix*/ )
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalDocumentNode::SetNamespacePrefixL
+//
+// ----------------------------------------------------------
+//
+void CLocalNodeAttribute::SetPrefixL( const TDesC8& /*aNamespacePrefix*/ )
+ {
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/LocalProtocol/src/LocalProtocol.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,287 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CLocalProtocol
+*
+*/
+
+
+
+#include <hal.h>
+#include <f32file.h>
+#include <xdmlogwriter.h>
+#include <implementationproxy.h>
+#include "XdmXmlParser.h"
+#include "LocalProtocol.h"
+#include "LocalDocument.h"
+#include "LocalDocumentNode.h"
+#include "LocalDirectory.h"
+#include "XdmCredentials.h"
+#include "XdmProtocolInfo.h"
+#include "XdmOperationFactory.h"
+
+// ----------------------------------------------------------
+// CLocalProtocol::CLocalProtocol
+//
+// ----------------------------------------------------------
+//
+CLocalProtocol::CLocalProtocol( const CXdmEngine& aXdmEngine,
+ const CXdmProtocolInfo& aProtocolInfo ) :
+ iTransferMediaOpen( EFalse ),
+ iXdmEngine( CONST_CAST( CXdmEngine&, aXdmEngine ) ),
+ iProtocolInfo( aProtocolInfo )
+ {
+ }
+
+// ----------------------------------------------------------
+// CLocalProtocol::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+CLocalProtocol* CLocalProtocol::NewL( const TXdmProtocolParams& aProtocolParams )
+ {
+ CLocalProtocol* self = new ( ELeave ) CLocalProtocol( aProtocolParams.iXdmEngine,
+ aProtocolParams.iProtocolInfo );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CLocalProtocol::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+CLocalProtocol::~CLocalProtocol()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CLocalProtocol::~CLocalProtocol()" ) );
+ #endif
+ delete iRootFolder;
+ delete iXmlParser;
+ delete iLogWriter;
+ iFileSession.Close();
+ Dll::FreeTls();
+ }
+
+// ----------------------------------------------------------
+// CLocalProtocol::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CLocalProtocol::ConstructL()
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KLocalEngLogFile );
+ WriteToLog( _L8( "CLocalProtocol::ConstructL() " ) );
+ #endif
+ iXmlParser = CXdmXmlParser::NewL();
+ SetRootDirectoryL( iProtocolInfo.Root() );
+ User::LeaveIfError( iFileSession.Connect() );
+ Dll::SetTls( this );
+ }
+
+// ----------------------------------------------------------
+// CLocalProtocol::SetRootDirectoryL
+//
+// ----------------------------------------------------------
+//
+void CLocalProtocol::SetRootDirectoryL( const TDesC& aRootPath )
+ {
+ TUid id = RProcess().Identity();
+ TBuf<32> processId;
+ processId.Zero();
+ processId.Format( _L( "%x" ), id );
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CLocalProtocol::SetRootDirectoryL()" ) );
+ #endif
+ if( aRootPath.Length() > 0 )
+ {
+ iRootFolder = HBufC::NewL( aRootPath.Length() +
+ processId.Length() +
+ TPtrC( KLocalEngPrivateRoot ).Length() + 4 );
+ iRootFolder->Des().Copy( KLocalEngPrivateRoot );
+ iRootFolder->Des().Append( processId );
+ iRootFolder->Des().Append( _L( "\\" ) );
+ iRootFolder->Des().Append( aRootPath );
+ iRootFolder->Des().Append( _L( "\\" ) );
+ }
+ else
+ {
+ iRootFolder = HBufC::NewL( processId.Length() +
+ KLocalEngPrivateRoot().Length() + 2 );
+ iRootFolder->Des().Copy( KLocalEngPrivateRoot );
+ iRootFolder->Des().Append( processId );
+ iRootFolder->Des().Append( _L( "\\" ) );
+ }
+ #ifdef _DEBUG
+ TBuf8<256> eight;
+ eight.Copy( iRootFolder->Des() );
+ WriteToLog( _L8( " Path: %S" ), &eight );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CLocalProtocol::.WriteToLog
+//
+// ----------------------------------------------------------
+//
+void CLocalProtocol::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::InitTransferMedia
+//
+// ----------------------------------------------------
+//
+void CLocalProtocol::InitTransferMedium( TInt /*aIdleTimeout*/,
+ TRequestStatus& aStatus )
+ {
+ TRequestStatus* status = &aStatus;
+ User::RequestComplete( status, KErrNone );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::CancelTransferMediaInit
+//
+// ----------------------------------------------------
+//
+void CLocalProtocol::CancelTransferMediumInit()
+ {
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::IsTransferAvailable
+//
+// ----------------------------------------------------
+//
+TBool CLocalProtocol::IsTransferAvailable() const
+ {
+ return ETrue;
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::RFSession
+//
+// ----------------------------------------------------
+//
+RFs& CLocalProtocol::RFSession()
+ {
+ return iFileSession;
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::Root
+//
+// ----------------------------------------------------
+//
+TPtrC CLocalProtocol::Root()
+ {
+ return iRootFolder != NULL ? iRootFolder->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------------
+// void CXcapProtocol::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C RFs& CLocalProtocol::FileSession()
+ {
+ TAny* ptr = Dll::Tls();
+ CLocalProtocol* self = ( CLocalProtocol* )ptr;
+ return self->RFSession();
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::RootFolder
+//
+// ----------------------------------------------------
+//
+EXPORT_C TPtrC CLocalProtocol::RootFolder()
+ {
+ TAny* ptr = Dll::Tls();
+ CLocalProtocol* self = ( CLocalProtocol* )ptr;
+ return self->Root();
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::CreateDocumentNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CLocalProtocol::CreateDocumentNodeL()
+ {
+ return CLocalDocumentNode::NewL( iXdmEngine, *this );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::CreateDocumentL
+//
+// ----------------------------------------------------
+//
+CXdmDocument* CLocalProtocol::CreateDocumentL( const TDesC& aDocumentName,
+ const TXdmDocType /*aDocumentType*/ )
+ {
+ return CLocalDocument::NewL( iXdmEngine, aDocumentName, *this );
+ }
+
+// ----------------------------------------------------
+// CLocalProtocol::CreateDirectoryL
+//
+// ----------------------------------------------------
+//
+CXdmDirectory* CLocalProtocol::CreateDirectoryL( const TDesC& aDirectoryPath )
+ {
+ TPtrC root = iRootFolder->Des();
+ HBufC* fullName = HBufC::NewLC( root.Length() + aDirectoryPath.Length() );
+ fullName->Des().Copy( root );
+ fullName->Des().Append( aDirectoryPath );
+ CXdmDirectory* dir = CLocalDirectory::NewL( fullName->Des(), iXdmEngine, *this );
+ CleanupStack::PopAndDestroy(); //fullName
+ return dir;
+ }
+
+// ---------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+//
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+ #ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( 0x10207424, CLocalProtocol::NewL )
+ #else
+ { { 0x10207424 }, CLocalProtocol::NewL }
+ #endif
+ };
+
+// ---------------------------------------------------------
+// Return the implementation table & number of implementations
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/BWINSCW/XcapAppUsageU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+ ?NewL@CXcapAppUsage@@QAEPAV1@ABVCXdmEngine@@H@Z @ 2 NONAME ; class CXcapAppUsage * CXcapAppUsage::NewL(class CXdmEngine const &, int)
+ ?Validate@CXcapAppUsage@@QAEHAAVCXdmDocument@@H@Z @ 3 NONAME ; int CXcapAppUsage::Validate(class CXdmDocument &, int)
+ ?Validate@CXcapAppUsage@@QAEHAAVCXdmDocumentNode@@PAVMXcapUriInterface@@H@Z @ 4 NONAME ; int CXcapAppUsage::Validate(class CXdmDocumentNode &, class MXcapUriInterface *, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapCommonPolicyCapsUsage/inc/XcapIetfCommonPolicyUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapIetfCommonPolicyUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPIETFCOMMONPOLICYUSAGE__
+#define __XCAPIETFCOMMONPOLICYUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapIetfCommonPolicyUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapIetfCommonPolicyUsage*
+ */
+ static CXcapIetfCommonPolicyUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapIetfCommonPolicyUsage();
+
+ public: //From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapIetfCommonPolicyUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+
+ };
+
+#endif //__XCAPIETFCOMMONPOLICYUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapCommonPolicyCapsUsage/inc/XcapOmaCommonPolicyUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOmaCommonPolicyUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPOMACOMMONPOLICYUSAGE__
+#define __XCAPOMACOMMONPOLICYUSAGE__
+
+#include <e32base.h>
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapOmaCommonPolicyUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapOmaCommonPolicyUsage*
+ */
+ static CXcapOmaCommonPolicyUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapOmaCommonPolicyUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapOmaCommonPolicyUsage( const CXdmEngine& aXdmEngine );
+ };
+
+#endif //__XCAPOMACOMMONPOLICYUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapCommonPolicyCapsUsage/src/XcapIetfCPUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapIetfCommonPolicyUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapIetfCommonPolicyUsage.h"
+
+// Used specifications
+// draft-ietf-geopriv-common-policy-08, 05 March 2006, expires 06 September 2006
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::CXcapIetfCommonPolicyUsage
+//
+// ----------------------------------------------------
+//
+CXcapIetfCommonPolicyUsage::CXcapIetfCommonPolicyUsage( const CXdmEngine& aXdmEngine )
+:CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapIetfCommonPolicyUsage* CXcapIetfCommonPolicyUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapIetfCommonPolicyUsage* self = new ( ELeave ) CXcapIetfCommonPolicyUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::~CXcapIetfCommonPolicyUsage
+//
+// ----------------------------------------------------
+//
+CXcapIetfCommonPolicyUsage::~CXcapIetfCommonPolicyUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfCommonPolicyUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfCommonPolicyUsage::AUID() const
+ {
+ return TPtrC8( KXdmIetfCommonPolicyUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfCommonPolicyUsage::ContentType() const
+ {
+ return TPtrC8( KXdmIetfCommonPolicyUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfCommonPolicyUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmIetfCommonPolicyNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapIetfCommonPolicyUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <ruleset>
+ if ( Match( element, KXdmRuleset ) )
+ {
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ // ruleset should not contain any other type elements
+ // than <rule>
+ if ( !Match( aXdmNode.ChileNode(i)->NodeName(), KXdmRule ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // <rule>
+ else if ( Match( element, KXdmRule ) )
+ {
+ // required attribute id
+ if ( !aXdmNode.HasAttribute( KXdmId ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <conditions>
+ else if ( Match( element, KXdmConditions ) )
+ {
+ found = ETrue;
+ }
+ // <actions>
+ else if ( Match( element, KXdmActions ) )
+ {
+ found = ETrue;
+ }
+ // <transformations>
+ else if ( Match( element, KXdmTransformations ) )
+ {
+ found = ETrue;
+ }
+ // <validity>
+ else if ( Match( element, KXdmValidity ) )
+ {
+ // <validity> should contain <from> and <until>
+ TBool from( EFalse );
+ TBool until( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmFrom ) )
+ {
+ from = ETrue;
+ }
+ else if ( Match( childName, KXdmUntil ) )
+ {
+ until = ETrue;
+ }
+ }
+ if ( !from || !until )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredElement );
+ }
+ found = ETrue;
+ }
+ // <from>
+ else if ( Match( element, KXdmFrom ) )
+ {
+ dataType = EDataTypeDateTime;
+ found = ETrue;
+ }
+ // <to>
+ else if ( Match( element, KXdmTo ) )
+ {
+ dataType = EDataTypeDateTime;
+ found = ETrue;
+ }
+ // <identity>
+ else if ( Match( element, KXdmIdentity ) )
+ {
+ // <identity> should contain either <one> or <many>
+ // elements, not both
+ TBool one( EFalse );
+ TBool many( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmOne ) )
+ {
+ one = ETrue;
+ }
+ else if ( Match( childName, KXdmMany ) )
+ {
+ many = ETrue;
+ }
+ }
+ if ( one && many )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ found = ETrue;
+ }
+ // <id>
+ else if ( Match( element, KXdmId ) )
+ {
+ // required attribute entity
+ if ( !aXdmNode.HasAttribute( KXdmEntity ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <any-identity>
+ else if ( Match( element, KXdmAnyIdentity ) )
+ {
+ found = ETrue;
+ }
+ // <except>
+ else if ( Match( element, KXdmExcept ) )
+ {
+ found = ETrue;
+ }
+ // <sphere>
+ else if ( Match( element, KXdmSphere ) )
+ {
+ // required attribute value
+ if ( !aXdmNode.HasAttribute( KXdmValue ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <one>
+ else if ( Match( element, KXdmOne ) )
+ {
+ // required attribute id
+ if ( !aXdmNode.HasAttribute( KXdmId ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <many>
+ else if ( Match( element, KXdmMany) )
+ {
+ found = ETrue;
+ }
+ // <until>
+ else if ( Match( element, KXdmUntil ) )
+ {
+ dataType = EDataTypeDateTime;
+ found = ETrue;
+ }
+
+ // if the node is some of the basic types,
+ // pass it to the base class for data validation
+ if ( dataType != EDataTypeUndefined )
+ {
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfCommonPolicyUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC attribute = aXdmNodeAttr.NodeName();
+
+ // id
+ if ( Match( attribute, KXdmId ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // domain
+ else if ( Match( attribute, KXdmDomain ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // value
+ else if ( Match( attribute, KXdmValue ) )
+ {
+ dataType = EDataTypeString;
+ }
+
+ // pass to base class for data validation
+ ValidateDataL( dataType, aXdmNodeAttr );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfCommonPolicyUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfCommonPolicyUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapCommonPolicyCapsUsage/src/XcapOmaCPUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOmaCommonPolicyUsage
+*
+*/
+
+
+
+
+// Used specifications
+// OMA-TS-XDM_Core-V1_0-20060612, 12 June 2006
+
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapOmaCommonPolicyUsage.h"
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::CXcapOmaCommonPolicyUsage
+//
+// ----------------------------------------------------
+//
+CXcapOmaCommonPolicyUsage::CXcapOmaCommonPolicyUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapOmaCommonPolicyUsage* CXcapOmaCommonPolicyUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapOmaCommonPolicyUsage* self = new ( ELeave ) CXcapOmaCommonPolicyUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::~CXcapOmaCommonPolicyUsage
+//
+// ----------------------------------------------------
+//
+CXcapOmaCommonPolicyUsage::~CXcapOmaCommonPolicyUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaCommonPolicyUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaCommonPolicyUsage::AUID() const
+ {
+ return TPtrC8( KXdmOmaCommonPolicyUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaCommonPolicyUsage::ContentType() const
+ {
+ return TPtrC8( KXdmOmaCommonPolicyUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaCommonPolicyUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmOmaCommonPolicyNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapOmaCommonPolicyUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <other-identity>
+ if ( Match( element, KXdmOtherIdentity ) )
+ {
+ dataType = EDataTypeEmpty;
+ found = ETrue;
+ }
+ // <external-list>
+ else if ( Match( element, KXdmExternalList ) )
+ {
+ found = ETrue;
+ }
+ // <entry>
+ else if ( Match( element, KXdmEntry ) )
+ {
+ // should we check the parent's namespace here
+ found = ETrue;
+ }
+ // <anonymous-request>
+ else if ( Match( element, KXdmAnonymousRequest ) )
+ {
+ dataType = EDataTypeEmpty;
+ found = ETrue;
+ }
+
+ // if the node is some of the basic types,
+ // pass it to the base class for data validation
+ if ( dataType != EDataTypeUndefined )
+ {
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaCommonPolicyUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // anc
+ if ( Match( aXdmNodeAttr.NodeName(), KXdmAnc ) )
+ {
+ // pass to base class for data validation
+ ValidateDataL( EDataTypeAnyURI, aXdmNodeAttr );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapOmaCommonPolicyUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaCommonPolicyUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmOmaCommonPolicyNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapPocUserAccessUsage/inc/XcapPocUserAccessUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapPocUserAccessUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPPOCUSERACCESSUSAGE__
+#define __XCAPPOCUSERACCESSUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapPocUserAccessUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapPocUserAccessUsage*
+ */
+ static CXcapPocUserAccessUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapPocUserAccessUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapPocUserAccessUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iIetfCommonPolicies;
+ CXcapAppUsage* iOmaCommonPolicies;
+ };
+
+#endif //__XCAPPOCGROUPUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XCapPocUserAccessUsage/src/XcapPocUserAccessUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapPocUserAccessUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapPocUserAccessUsage.h"
+
+// Used specification
+// OMA-TS-PoC_XDM-V1_0-20050317-C, 17 March 2005
+// OMA-TS-PoC_XDM-V1_0-20060127-C, 27 January 2006
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::CXcapPocUserAccessUsage
+//
+// ----------------------------------------------------
+//
+CXcapPocUserAccessUsage::CXcapPocUserAccessUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine ),
+iIetfCommonPolicies( NULL ),
+iOmaCommonPolicies( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapPocUserAccessUsage* CXcapPocUserAccessUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapPocUserAccessUsage* self = new ( ELeave ) CXcapPocUserAccessUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::~CXcapPocUserAccessUsage
+//
+// ----------------------------------------------------
+//
+CXcapPocUserAccessUsage::~CXcapPocUserAccessUsage()
+ {
+ delete iIetfCommonPolicies;
+ delete iOmaCommonPolicies;
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapPocUserAccessUsage::ConstructL()
+ {
+ iIetfCommonPolicies = CXcapAppUsage::NewL( iXdmEngine, EXdmIetfCommonPolicy );
+ iOmaCommonPolicies = CXcapAppUsage::NewL( iXdmEngine, EXdmOmaCommonPolicy );
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocUserAccessUsage::AUID() const
+ {
+ return TPtrC8( KXdmPocUserAccessUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocUserAccessUsage::ContentType() const
+ {
+ return TPtrC8( KXdmPocUserAccessUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocUserAccessUsage::DefaultNamespace() const
+ {
+// return TPtrC8( KXdmPocUserAccessNamespace );
+ // NOTE the default namespace is IetfCommonPolicy
+ return TPtrC8( KXdmIetfCommonPolicyNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapPocUserAccessUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TPtrC element = aXdmNode.NodeName();
+
+ // there is restriction for the value
+ // of <allow-invite>
+ // check that value is either "reject", "accept" or "pass"
+ // 0 (reject), 1 (pass), 2 (accept)
+ if ( Match( element, KXdmAllowInvite ) )
+ {
+ TPtrC8 data = aXdmNode.LeafNodeContent();
+ if ( data.CompareF( KXdmReject )
+ && data.CompareF( KXdmAccept )
+ && data.CompareF( KXdmPass ) )
+ {
+ LeaveWithErrorL( KXcapErrorEnumerationRule );
+ }
+ found = ETrue;
+ // NOTE the default namespace is IetfCommonPolicy
+ SetPrefixL( aXdmNode, KXdmPocUserAccessNsPrefix );
+ }
+ // urn:ietf:params:xml:ns:common-policy
+ if ( !found )
+ {
+ found = iIetfCommonPolicies->ValidateNodeL( aXdmNode );
+ // NOTE the default namespace is IetfCommonPolicy
+ /*if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmIetfCommonPolicyNsPrefix );
+ }*/
+ }
+ // urn:oma:params:xml:ns:common-policy
+ if ( !found )
+ {
+ found = iOmaCommonPolicies->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmOmaCommonPolicyNsPrefix );
+ }
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapPocUserAccessUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapPocUserAccessUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr)
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // there aren't any attributes, all attributes are
+ // either from urn:ietf:params:xml:ns:common-policy
+ // or from urn:oma:params:xml:ns:common-policy
+
+ // add parent element namespace checking when available,
+ // now we don't know the attribute's namespace
+ iIetfCommonPolicies->ValidateAttributeL( aXdmNodeAttr );
+ iOmaCommonPolicies->ValidateAttributeL( aXdmNodeAttr );
+ }
+
+
+ // ----------------------------------------------------
+// CXcapPocUserAccessUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapPocUserAccessUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmPocUserAccessNamespace, KXdmPocUserAccessNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmOmaCommonPolicyNamespace, KXdmOmaCommonPolicyNsPrefix );
+/* aXdmDocument.AppendNamespaceL( KXdmPocUserAccessNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KXdmIetfCommonPolicyNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmOmaCommonPolicyNamespace, KXdmOmaCommonPolicyNsPrefix );*/
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapC4/inc/XcapC4.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapC4
+*
+*/
+
+#ifndef __XCAPRESCONTENT__
+#define __XCAPRESCONTENT__
+
+#include "XcapAppUsage.h"
+
+// CONSTANTS
+#define KC4SettingsCenRepUID 0x20021391
+
+
+// CLASS DECLARATION
+class CXcapC4 : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapC4*
+ */
+ static CXcapC4* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapC4();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapC4( const CXdmEngine& aXdmEngine );
+
+ private: // member data
+ /// RCS Global: Old content type setting
+ TInt iRCSGlobalOldContentType;
+ };
+
+#endif //__XCAPPRESCONTENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapC4/src/XcapC4.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapC4
+*
+*/
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include <centralrepository.h>
+#ifdef _DEBUG
+#include <flogger.h>
+#endif
+
+#include "XcapC4.h"
+//#include "pasvariation.hrh"
+
+
+// Used specification
+// Presence Content XDM Specification, draft 1.0
+
+// ----------------------------------------------------
+// CXcapC4::CXcapC4
+//
+// ----------------------------------------------------
+//
+CXcapC4::CXcapC4( const CXdmEngine& aXdmEngine ) :
+ CXcapAppUsage( aXdmEngine )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapC4 initialized!" ) );
+#endif
+ }
+
+// ----------------------------------------------------
+// CXcapC4::NewL
+//
+// ----------------------------------------------------
+//
+CXcapC4* CXcapC4::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapC4* self = new ( ELeave ) CXcapC4( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapC4::~CXcapC4
+//
+// ----------------------------------------------------
+//
+CXcapC4::~CXcapC4()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapC4::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapC4::ConstructL()
+ {
+ CRepository* cenRepRCSGlobal;
+ cenRepRCSGlobal = CRepository::NewL( TUid::Uid( KC4SettingsCenRepUID ) );
+ CleanupStack::PushL( cenRepRCSGlobal );
+
+ // 0x06 is the index in central repository for content type setting
+ User::LeaveIfError( cenRepRCSGlobal->Get( 0x06, iRCSGlobalOldContentType ) );
+ CleanupStack::PopAndDestroy( ); // cenRepRCSGlobal
+ }
+
+// ----------------------------------------------------
+// CXcapC4::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapC4::AUID() const
+ {
+ return TPtrC8( KXdmPresContentAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapC4::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapC4::ContentType() const
+ {
+ if ( iRCSGlobalOldContentType )
+ {
+ return TPtrC8( KXdmPresContentContTypeOld );
+ }
+ else
+ {
+ return TPtrC8( KXdmPresContentContType );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapC4::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapC4::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmPresContentNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapC4::ValidateL
+//
+// ----------------------------------------------------
+//
+TBool CXcapC4::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapC4::ValidateNodeL" ) );
+#endif
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TPtrC element = aXdmNode.NodeName();
+
+ // mime-type
+ if ( Match( element, KXdmMimeType ) )
+ {
+ found = ETrue;
+ }
+ else if ( Match( element, KXdmEncoding ) )
+ {
+ found = ETrue;
+ }
+ else if ( Match( element, KXdmDescription ) )
+ {
+ found = ETrue;
+ }
+ else if ( Match( element, KXdmData ) )
+ {
+ found = ETrue;
+ }
+
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapC4::ValidateNodeL - found: %d" ), found );
+#endif
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapC4::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapC4::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // there should not be any attributes in pres-content document
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapC4::ValidateAttributeL" ) );
+#endif
+// User::Leave( KErrNotSupported );
+ }
+
+// ----------------------------------------------------
+// CXcapC4::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapC4::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapC4::AddNamespaceInformationL" ) );
+#endif
+ aXdmDocument.AppendNamespaceL( KXdmPresContentNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapCapabilityUsage/inc/XcapCapabilityUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCapabilityUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPCAPABILITYUSAGE__
+#define __XCAPCAPABILITYUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapCapabilityUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapCapabilityUsage*
+ */
+ static CXcapCapabilityUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapCapabilityUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapCapabilityUsage( const CXdmEngine& aXdmEngine );
+ };
+
+#endif //__XCAPCAPABILITYUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapCapabilityUsage/src/XcapCapabilityUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCapabilityUsage
+*
+*/
+
+
+
+
+#include <XdmDocumentNode.h>
+#include "XcapCapabilityUsage.h"
+
+// Used specification
+// OMA-TS-XDM_Core-V1_0-20051103-C, 03 November 2005
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::CXcapCapabilityUsage
+//
+// ----------------------------------------------------
+//
+CXcapCapabilityUsage::CXcapCapabilityUsage( const CXdmEngine& aXdmEngine ) :
+ CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapCapabilityUsage* CXcapCapabilityUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapCapabilityUsage* self = new ( ELeave ) CXcapCapabilityUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::~CXcapCapabilityUsage
+//
+// ----------------------------------------------------
+//
+CXcapCapabilityUsage::~CXcapCapabilityUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapCapabilityUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapCapabilityUsage::AUID() const
+ {
+ return TPtrC8( KXdmCapabilityUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapCapabilityUsage::ContentType() const
+ {
+ return TPtrC8( KXdmCapabilityUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapCapabilityUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmCapabilityNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapCapabilityUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <auids>
+ if ( Match( element, KXdmAuids ) )
+ {
+ found = ETrue;
+ }
+ // <auid>
+ else if ( Match( element, KXdmAuid ) )
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+ // <extensions>
+ else if ( Match( element, KXdmExtensions ) )
+ {
+ found = ETrue;
+ }
+ // <extension>
+ else if ( Match( element, KXdmExtension ) )
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+ // <namespaces>
+ else if ( Match( element, KXdmNamespace ) )
+ {
+ found = ETrue;
+ }
+ // <namespace>
+ else if ( Match( element, KXdmNamespace ) )
+ {
+ dataType = EDataTypeAnyURI;
+ found = ETrue;
+ }
+
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to the base class for data validation
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapCapabilityUsage::ValidateAttributeL( const CXdmNodeAttribute& /*aXdmNodeAttr*/ )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // There aren't any attributes in
+ // capability usage schema.
+ }
+
+// ----------------------------------------------------
+// CXcapCapabilityUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapCapabilityUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmCapabilityNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapDirectoryUsage/inc/XcapDirectoryUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDirectoryUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPDIRECTORYUSAGE__
+#define __XCAPDIRECTORYUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapDirectoryUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapDirectoryUsage*
+ */
+ static CXcapDirectoryUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapDirectoryUsage();
+
+ public:
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapDirectoryUsage( const CXdmEngine& aXdmEngine );
+ };
+
+#endif //__XCAPDIRECTORYUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapDirectoryUsage/src/XcapDirectoryUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDirectoryUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapDirectoryUsage.h"
+
+
+// Used specification
+// OMA-TS-XDM_Core-V1_0-20051103-C, 03 November 2005
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::CXcapDirectoryUsage
+//
+// ----------------------------------------------------
+//
+CXcapDirectoryUsage::CXcapDirectoryUsage( const CXdmEngine& aXdmEngine ) :
+ CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapDirectoryUsage* CXcapDirectoryUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapDirectoryUsage* self = new ( ELeave ) CXcapDirectoryUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::~CXcapDirectoryUsage
+//
+// ----------------------------------------------------
+//
+CXcapDirectoryUsage::~CXcapDirectoryUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectoryUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapDirectoryUsage::AUID() const
+ {
+ return TPtrC8( KXdmDirectoryUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapDirectoryUsage::ContentType() const
+ {
+ return TPtrC8( KXdmDirectoryUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapDirectoryUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmDirectoryNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapDirectoryUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found( EFalse );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <xcap-directory>
+ if ( Match( element, KXdmXcapDirectory ) )
+ {
+ found = ETrue;
+ }
+ // <folder>
+ else if ( Match( element, KXdmFolder ) )
+ {
+ // required attribute auid
+ if ( !aXdmNode.HasAttribute( KXdmAuid ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ // there should be either <entry> or <error-code>
+ // element, not both
+ TBool entry( EFalse );
+ TBool errorcode( EFalse ) ;
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( childName.CompareF( KXdmEntry ) )
+ {
+ entry = ETrue;
+ }
+ else if ( childName.CompareF( KXdmErrorCode ) )
+ {
+ errorcode = ETrue;
+ }
+ }
+ if ( entry && errorcode )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ found = ETrue;
+ }
+ // <entry>
+ else if ( Match( element, KXdmEntry ) )
+ {
+ // required attributes uri and etag
+ if ( !aXdmNode.HasAttribute( KXdmUri ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ if ( !aXdmNode.HasAttribute( KXdmEtag ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute);
+ }
+ found = ETrue;
+ }
+ // <error-code>
+ else if ( Match( element, KXdmErrorCode ) )
+ {
+ ValidateDataL( EDataTypeString, aXdmNode );
+ found = ETrue;
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectoryUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC attribute = aXdmNodeAttr.NodeName();
+ // uri
+ if ( Match( attribute, KXdmUri ) )
+ {
+ dataType = EDataTypeAnyURI;
+ }
+ // etag
+ else if ( Match( attribute, KXdmEtag ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // last-modified
+ else if ( Match( attribute, KXdmLastModified ) )
+ {
+ dataType = EDataTypeDateTime;
+ }
+ // size
+ else if ( Match( attribute, KXdmSize ) )
+ {
+ dataType = EDataTypeNonNegativeInteger;
+ }
+ // auid
+ else if ( Match( attribute, KXdmAuid ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // pass to base class for data validation
+ ValidateDataL( dataType, aXdmNodeAttr );
+ }
+
+// ----------------------------------------------------
+// CXcapDirectoryUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectoryUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmDirectoryNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPocGroupUsage/inc/XcapPocGroupUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapPocGroupUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPPOCGROUPUSAGE__
+#define __XCAPPOCGROUPUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapPocGroupUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapPocGroupUsage*
+ */
+ static CXcapPocGroupUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapPocGroupUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapPocGroupUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iIetfCommonPolicies;
+ CXcapAppUsage* iOmaCommonPolicies;
+ CXcapAppUsage* iResourceLists;
+ };
+
+#endif //__XCAPPOCGROUPUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPocGroupUsage/src/XcapPocGroupUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapPocGroupUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapPocGroupUsage.h"
+
+
+
+// Used specification
+// OMA-TS-PoC_XDM-V1_0-20060609-A, 09 June 2006
+// ----------------------------------------------------
+// CXcapPocGroupUsage::CXcapPocGroupUsage
+//
+// ----------------------------------------------------
+//
+CXcapPocGroupUsage::CXcapPocGroupUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine ),
+iIetfCommonPolicies( NULL ),
+iOmaCommonPolicies( NULL ),
+iResourceLists( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapPocGroupUsage* CXcapPocGroupUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapPocGroupUsage* self = new ( ELeave ) CXcapPocGroupUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::~CXcapPocGroupUsage
+//
+// ----------------------------------------------------
+//
+CXcapPocGroupUsage::~CXcapPocGroupUsage()
+ {
+ delete iIetfCommonPolicies;
+ delete iOmaCommonPolicies;
+ delete iResourceLists;
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapPocGroupUsage::ConstructL()
+ {
+ iIetfCommonPolicies = CXcapAppUsage::NewL( iXdmEngine, EXdmIetfCommonPolicy );
+ iOmaCommonPolicies = CXcapAppUsage::NewL( iXdmEngine, EXdmOmaCommonPolicy );
+ iResourceLists = CXcapAppUsage::NewL( iXdmEngine, EXdmResourceLists );
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocGroupUsage::AUID() const
+ {
+ return TPtrC8( KXdmPocGroupUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocGroupUsage::ContentType() const
+ {
+ return TPtrC8( KXdmPocGroupUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapPocGroupUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmPocGroupNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapPocGroupUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <group>
+ if ( Match( element, KXdmGroup ) )
+ {
+ // no other elements than <list-service>
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ if ( !Match( aXdmNode.ChileNode(i)->NodeName(), KXdmListService ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // <list-service>
+ else if ( Match( element, KXdmListService ) )
+ {
+ // required attribute uri
+ if ( !aXdmNode.HasAttribute( KXdmUri ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <display-name>
+ else if ( Match( element, KXdmDisplayName ) )
+ {
+ CXdmDocumentNode* parent = aXdmNode.Parent();
+ if ( parent && !parent->NodeName().CompareF( KXdmEntry ) )
+ {
+ found = iResourceLists->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmResourceListsNsPrefix );
+ }
+ }
+ else
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+ }
+ // <invite-members>
+ else if ( Match( element, KXdmInviteMembers ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <max-participant-count>
+ else if ( Match( element, KXdmMaxParticipantCount ) )
+ {
+ dataType = EDataTypeNonNegativeInteger;
+ found = ETrue;
+ }
+ // <is-list-member>
+ else if ( Match( element, KXdmIsListMember ) )
+ {
+ // dataType = EDataTypeBoolean; // OMA-TS-PoC_XDM-V1_0-20050317-C, 17 March 2005
+ // changed 4-Nov-2005 PoC XDM
+ dataType = EDataTypeEmpty;
+ found = ETrue;
+ }
+ // <allow-conference-state>
+ else if ( Match( element, KXdmAllowConfState ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <allow-invite-users-dynamically>
+ else if ( Match( element, KXdmAllowInvUsersDyn ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <join-handling>
+ else if ( Match( element, KXdmJoinHandling ) )
+ {
+ // OMA-TS-PoC_XDM-V1_0-20050317-C, 17 March 2005
+ // the value must be "allow" or "block"
+ // 0 (block) and 1 (allow)
+ /* TPtrC8 data = aXdmNode.LeafNodeContent();
+ if ( data.CompareF( KXdmAllow )
+ && data.CompareF( KXdmBlock ) )
+ {
+ LeaveWithErrorL( KXcapErrorEnumerationRule );
+ }
+ */
+ // changed OMA-TS-PoC_XDM-V1_0-20060127-C, 27 January 2006
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <allow-initiate-conference>
+ else if ( Match( element, KXdmAllowInitiateConf ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <allow-anonymity>
+ else if ( Match( element, KXdmAllowAnonymity ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <is-key-participant>
+ else if ( Match( element, KXdmIsKeyParticipant ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <external>
+ // type = rl:externalType from urn:ietf:params:xml:ns:resource-lists
+ // pass to the appropriate usage for validation
+ // but use default namespace
+ else if ( Match( element, KXdmExternal ) )
+ {
+ found = iResourceLists->ValidateNodeL( aXdmNode );
+ }
+ // <entry>
+ // type = rl:entryType from urn:ietf:params:xml:ns:resource-lists
+ // pass to the appropriate usage for validation
+ // but use default namespace
+ else if ( Match( element, KXdmEntry ) )
+ {
+ found = iResourceLists->ValidateNodeL( aXdmNode );
+ }
+
+ // urn:ietf:params:xml:ns:common-policy
+ if ( !found )
+ {
+ found = iIetfCommonPolicies->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmIetfCommonPolicyNsPrefix );
+ }
+ }
+ // urn:oma:params:xml:ns:common-policy
+ if ( !found )
+ {
+ found = iOmaCommonPolicies->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmOmaCommonPolicyNsPrefix );
+ }
+ }
+
+ // if the node is some of the basic types,
+ // pass it to the base class for data validation
+ if ( dataType != EDataTypeUndefined )
+ {
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapPocGroupUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ TPtrC attribute = aXdmNodeAttr.NodeName();
+
+ // uri
+ if ( Match( attribute, KXdmUri ) )
+ {
+ // pass to base class for data validation
+ // check if this should be SIP uri
+ ValidateDataL( EDataTypeAnyURI, aXdmNodeAttr );
+ }
+ else
+ {
+ // add parent element namespace checking when available,
+ // now we don't know the attribute's namespace
+ iIetfCommonPolicies->ValidateAttributeL( aXdmNodeAttr );
+ iOmaCommonPolicies->ValidateAttributeL( aXdmNodeAttr );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapPocGroupUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapPocGroupUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmPocGroupNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmResourceListsNamespace, KXdmResourceListsNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KXdmIetfCommonPolicyNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmOmaCommonPolicyNamespace, KXdmOmaCommonPolicyNsPrefix );
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPresenceRulesUsage/inc/XcapIetfPresRulesUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapIetfPresRulesUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPIETFPRESRULESUSAGE__
+#define __XCAPIETFPRESRULESUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+
+// CLASS DECLARATION
+class CXcapIetfPresRulesUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapIetfPresRulesUsage*
+ */
+ static CXcapIetfPresRulesUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapIetfPresRulesUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapIetfPresRulesUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iIetfCommonPolicy;
+ };
+
+#endif //__XCAPIETFPRESRULESUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPresenceRulesUsage/inc/XcapOmaPresRulesUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOmaPresRulesUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPOMAPRESRULESUSAGE__
+#define __XCAPOMAPRESRULESUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapOmaPresRulesUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapOmaPresRulesUsage*
+ */
+ static CXcapOmaPresRulesUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapOmaPresRulesUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapOmaPresRulesUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iIetfPresRules;
+ CXcapAppUsage* iIetfCommonPolicy;
+ CXcapAppUsage* iOmaCommonPolicy;
+ };
+
+#endif //__XCAPOMAPRESRULESUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPresenceRulesUsage/src/XcapIetfPresRulesUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,520 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapIetfPresRulesUsage
+*
+*/
+
+
+
+
+#include "XcapIetfPresRulesUsage.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+#include "XdmErrors.h"
+
+// Used specification
+// draft-ietf-simple-presence-rules-03, 18 July 2005
+// expires 19 January, 2006
+// draft-ietf-simple-presence-rules-05, 06 March 2006
+// expires 07 September, 2006
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::CXcapIetfPresRulesUsage
+//
+// ----------------------------------------------------
+//
+CXcapIetfPresRulesUsage::CXcapIetfPresRulesUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine ),
+iIetfCommonPolicy( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapIetfPresRulesUsage* CXcapIetfPresRulesUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapIetfPresRulesUsage* self = new ( ELeave ) CXcapIetfPresRulesUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::~CXcapIetfPresRulesUsage
+//
+// ----------------------------------------------------
+//
+CXcapIetfPresRulesUsage::~CXcapIetfPresRulesUsage()
+ {
+ delete iIetfCommonPolicy;
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfPresRulesUsage::ConstructL()
+ {
+ iIetfCommonPolicy = CXcapAppUsage::NewL( iXdmEngine, KXdmIetfCommonPolicyUsageUid );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfPresRulesUsage::AUID() const
+ {
+ return TPtrC8( KXdmIetfPresRulesUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfPresRulesUsage::ContentType() const
+ {
+ return TPtrC8( KXdmIetfPresRulesUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapIetfPresRulesUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmIetfPresRulesNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::ValidateL
+//
+// ----------------------------------------------------
+//
+TBool CXcapIetfPresRulesUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <service-uri-scheme>
+ if ( Match( element, KXdmServiceUriScheme ) )
+ {
+ dataType = EDataTypeToken;
+ found = ETrue;
+ }
+ // <class>
+ else if ( Match( element, KXdmClass ) )
+ {
+ dataType = EDataTypeToken;
+ found = ETrue;
+ }
+ // <occurence-id>
+ else if ( Match( element, KXdmOccurenceId ) )
+ {
+ dataType = EDataTypeToken;
+ found = ETrue;
+ }
+ // <service-uri>
+ else if ( Match( element, KXdmServiceUri ) )
+ {
+ dataType = EDataTypeAnyURI;
+ found = ETrue;
+ }
+ // <all-services>
+ else if ( Match( element, KXdmAllServices ) )
+ {
+ found = ETrue;
+ }
+ // <provide-services>
+ else if ( Match( element, KXdmProvideServices ) )
+ {
+ // type = provideServicePermissions
+ // here we should have either <all-services>
+ // or sequence of other elements
+ TBool allServices( EFalse );
+ TBool sequence( EFalse );
+ TBool serviceUri( EFalse );
+ TBool serviceUriScheme( EFalse );
+ TBool occurenceId( EFalse );
+ TBool prclass( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmAllServices ) )
+ {
+ allServices = ETrue;
+ }
+ else
+ {
+ sequence = ETrue;
+ // in sequence should be either <service-uri>,
+ // <service-uri-scheme>, <occurence-id> or <class>
+ if ( Match( childName, KXdmServiceUri ) )
+ {
+ serviceUri = ETrue;
+ }
+ else if ( Match( childName, KXdmServiceUriScheme ) )
+ {
+ serviceUriScheme = ETrue;
+ }
+ else if ( Match( childName, KXdmOccurenceId ) )
+ {
+ occurenceId = ETrue;
+ }
+ else if ( Match( childName, KXdmClass ) )
+ {
+ prclass = ETrue;
+ }
+ }
+ }
+ if ( allServices && sequence )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( sequence )
+ {
+ if ( serviceUri && ( serviceUriScheme || occurenceId || prclass ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( serviceUriScheme && ( occurenceId || prclass ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( occurenceId && prclass )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // used in presence-rules-03
+ // <device-id>
+ else if ( Match( element, KXdmDeviceId ) )
+ {
+ dataType = EDataTypeAnyURI;
+ found = ETrue;
+ }
+ // used in presence-rules-05
+ // <deviceID>
+ else if ( Match( element, KXdmDeviceID ) )
+ {
+ dataType = EDataTypeAnyURI;
+ found = ETrue;
+ }
+ // <all-devices>
+ else if ( Match( element, KXdmAllDevices ) )
+ {
+ found = ETrue;
+ }
+ // <provide-devices>
+ else if ( Match( element, KXdmProvideDevices ) )
+ {
+ // type = provideDevicePermissions
+ // here we should have either <all-devices>
+ // or sequence of other elements
+ TBool allDevices( EFalse );
+ TBool sequence( EFalse );
+ TBool deviceId( EFalse );
+ TBool occurenceId( EFalse );
+ TBool prclass( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmAllDevices ) )
+ {
+ allDevices = ETrue;
+ }
+ else
+ {
+ sequence = ETrue;
+ // in sequence should be either pres-rules-03 <device-id> pres-rules-05 <deviceID>,
+ // <occurence-id> or <class>
+ if ( Match( childName, KXdmDeviceId )
+ || Match( childName, KXdmDeviceID ) )
+ {
+ deviceId = ETrue;
+ }
+ else if ( Match( childName, KXdmOccurenceId ) )
+ {
+ occurenceId = ETrue;
+ }
+ else if ( Match( childName, KXdmClass ) )
+ {
+ prclass = ETrue;
+ }
+ }
+ }
+ if ( allDevices && sequence )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( sequence )
+ {
+ if ( deviceId && ( occurenceId || prclass ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( occurenceId && prclass )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // <all-persons>
+ else if ( Match( element, KXdmAllPersons ) )
+ {
+ found = ETrue;
+ }
+ // <provide-persons>
+ else if ( !element.CompareF( KXdmProvidePersons ) )
+ {
+ // type = providePersonPermissions
+ // here we should have either <all-devices>
+ // or sequence of other elements
+ TBool allPersons( EFalse );
+ TBool sequence( EFalse );
+ TBool occurenceId( EFalse );
+ TBool prclass( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmAllPersons ) )
+ {
+ allPersons = ETrue;
+ }
+ else
+ {
+ sequence = ETrue;
+ // in sequence should be either
+ // <occurence-id> or <class>
+ if ( Match( childName, KXdmOccurenceId ) )
+ {
+ occurenceId = ETrue;
+ }
+ else if ( Match( childName, KXdmClass ) )
+ {
+ prclass = ETrue;
+ }
+ }
+ }
+ if ( allPersons && sequence )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ if ( sequence )
+ {
+ if ( occurenceId && prclass )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // <provide-activities>
+ else if ( Match( element, KXdmProvideActivities ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-class>
+ else if ( Match( element, KXdmProvideClass ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-device-id>
+ else if ( Match( element, KXdmProvideDeviceId ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-mood>
+ else if ( Match( element, KXdmProvideMood ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-place-is>
+ else if ( Match( element, KXdmProvidePlaceIs ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-place-type>
+ else if ( Match( element, KXdmProvidePlaceType ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-privacy>
+ else if ( Match( element, KXdmProvidePrivacy ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-relationship>
+ else if ( Match( element, KXdmProvideRelationship ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-status-icon>
+ else if ( Match( element, KXdmProvideStatusIcon ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-sphere>
+ else if ( Match( element, KXdmProvideSphere ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-time-offset>
+ else if ( Match( element, KXdmProvideTimeOffset ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-user-input>
+ else if ( Match( element, KXdmProvideUserInput ) )
+ {
+ // value is restricted, allowed values
+ // are "false", "bare", "thresholds" and "full"
+ TPtrC8 data = aXdmNode.LeafNodeContent();
+ if ( data.CompareF( KXdmFalse )
+ && data.CompareF( KXdmBare )
+ && data.CompareF( KXdmThresholds )
+ && data.CompareF( KXdmFull ) )
+ {
+ LeaveWithErrorL( KXcapErrorEnumerationRule );
+ }
+ found = ETrue;
+ }
+ // <provide-note>
+ else if ( Match( element, KXdmProvideNote ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-unknown-attribute>
+ else if ( Match( element, KXdmProvideUnknownAttribute ) )
+ {
+ // required attribute name
+ if ( !aXdmNode.HasAttribute( KXdmName ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <provide-all-attributes>
+ else if ( Match( element, KXdmProvideAllAttributes ) )
+ {
+ found = ETrue;
+ }
+ // <sub-handling>
+ else if ( Match( element, KXdmSubHandling ) )
+ {
+ found = ETrue;
+ // value is restricted, allowed values
+ // are "block", "confirm", "polite-block" and "allow"
+ TPtrC8 data = aXdmNode.LeafNodeContent();
+ if ( data.CompareF( KXdmBlock )
+ && data.CompareF( KXdmConfirm )
+ && data.CompareF( KXdmPoliteBlock )
+ && data.CompareF( KXdmAllow ) )
+ {
+ LeaveWithErrorL( KXcapErrorEnumerationRule );
+ }
+ }
+ // urn:ietf:params:xml:ns:common-policy
+ if ( !found )
+ {
+ found = iIetfCommonPolicy->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmIetfCommonPolicyNsPrefix );
+ }
+ }
+
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to the base class for data validation
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfPresRulesUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // name
+ if ( Match( aXdmNodeAttr.NodeName(), KXdmName ) )
+ {
+ // pass to base class for data validation
+ ValidateDataL( EDataTypeString, aXdmNodeAttr );
+ }
+ // the rest are from urn:ietf:params:xml:ns:common-policy
+ else
+ {
+ iIetfCommonPolicy->ValidateAttributeL( aXdmNodeAttr );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapIetfPresRulesUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapIetfPresRulesUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmIetfPresRulesNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmIetfPresRulesNamespace, KXdmIetfPresRulesNsPrefix ); // ESTI-7AY95P
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KXdmIetfCommonPolicyNsPrefix ); // ESTI-7AY95P
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapPresenceRulesUsage/src/XcapOmaPresRulesUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOmaPresRulesUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include "XcapOmaPresRulesUsage.h"
+
+// Used specification
+// OMA-TS-Presence_SIMPLE_XDM-V1_0-20060110-C, 10 January 2006
+// OMA-TS-Presence_SIMPLE_XDM-V1_0-20060418-C, 18 April 2006
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::CXcapOmaPresRulesUsage
+//
+// ----------------------------------------------------
+//
+CXcapOmaPresRulesUsage::CXcapOmaPresRulesUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine ),
+iIetfPresRules( NULL ),
+iIetfCommonPolicy( NULL ),
+iOmaCommonPolicy( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapOmaPresRulesUsage* CXcapOmaPresRulesUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapOmaPresRulesUsage* self = new ( ELeave ) CXcapOmaPresRulesUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::~CXcapOmaPresRulesUsage
+//
+// ----------------------------------------------------
+//
+CXcapOmaPresRulesUsage::~CXcapOmaPresRulesUsage()
+ {
+ delete iIetfPresRules;
+ delete iIetfCommonPolicy;
+ delete iOmaCommonPolicy;
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaPresRulesUsage::ConstructL()
+ {
+ iIetfPresRules = CXcapAppUsage::NewL( iXdmEngine, KXdmIetfPresRulesUsageUid );
+ iIetfCommonPolicy = CXcapAppUsage::NewL( iXdmEngine, KXdmIetfCommonPolicyUsageUid );
+ iOmaCommonPolicy = CXcapAppUsage::NewL( iXdmEngine, KXdmOmaCommonPolicyUsageUid );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaPresRulesUsage::AUID() const
+ {
+ return TPtrC8( KXdmOmaPresRulesUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaPresRulesUsage::ContentType() const
+ {
+ return TPtrC8( KXdmOmaPresRulesUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapOmaPresRulesUsage::DefaultNamespace() const
+ {
+ //return TPtrC8( KXdmOmaPresRulesNamespace );
+ // NOTE the default namespace is IetfCommonPolicy
+ return TPtrC8( KXdmIetfCommonPolicyNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::ValidateL
+//
+// ----------------------------------------------------
+//
+TBool CXcapOmaPresRulesUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <provide-willigness>
+ if ( Match( element, KXdmProvideWillingness ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-network-availability>
+ else if ( Match( element, KXdmProvideNetworkAvailability ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-session-participation>
+ else if ( Match( element, KXdmProvideSessionParticipation ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-registration-state>
+ else if ( Match( element, KXdmProvideRegistrationState ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-barring-state>
+ else if ( Match( element, KXdmProvideBarringState ) )
+ {
+ dataType = EDataTypeBoolean;
+ found = ETrue;
+ }
+ // <provide-geopriv>
+ else if ( Match( element, KXdmProvideGeopriv ) )
+ {
+ // value must be "false" or "full"
+ // 0 (false), 1 (full)
+ TPtrC8 data = aXdmNode.LeafNodeContent();
+ if ( data.CompareF( KXdmFalse )
+ && data.CompareF( KXdmFull ) )
+ {
+ LeaveWithErrorL( KXcapErrorEnumerationRule );
+ }
+ found = ETrue;
+ }
+ // <service-id>
+ else if ( Match( element, KXdmServiceId ) )
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+
+ // NOTE the default namespace is IetfCommonPolicy
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmOmaPresRulesNsPrefix );
+ }
+
+ // urn:ietf:params:xml:ns:pres-rules
+ // urn:ietf:params:xml:ns:common-policy
+ // urn:oma:xml:xdm:common-policy
+ else
+ {
+ // urn:ietf:params:xml:ns:common-policy
+ found = iIetfCommonPolicy->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ // this means that this belongs to urn:ietf:params:xml:ns:common-policy,
+ // there may be the prefix already
+ // NOTE the default namespace is IetfCommonPolicy
+ SetPrefixL( aXdmNode, KNullDesC8 );
+ }
+ else
+ {
+ // urn:ietf:params:xml:ns:pres-rules
+ found = iIetfPresRules->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmIetfPresRulesNsPrefix );
+ }
+ else
+ {
+ // urn:oma:xml:xdm:common-policy
+ found = iOmaCommonPolicy->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmOmaCommonPolicyNsPrefix );
+ }
+ }
+ }
+ }
+
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to the base class for data validation
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaPresRulesUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // there aren't any attributes in
+ // oma presence rules usage schema
+ // urn:ietf:params:xml:ns:pres-rules
+ // urn:ietf:params:xml:ns:common-policy
+ iIetfPresRules->ValidateAttributeL( aXdmNodeAttr );
+ }
+
+// ----------------------------------------------------
+// CXcapOmaPresRulesUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapOmaPresRulesUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ // NOTE the default namespace is IetfCommonPolicy
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmOmaCommonPolicyNamespace, KXdmOmaCommonPolicyNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmOmaPresRulesNamespace, KXdmOmaPresRulesNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmIetfPresRulesNamespace, KXdmIetfPresRulesNsPrefix );
+/* aXdmDocument.AppendNamespaceL( KXdmOmaPresRulesNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmIetfPresRulesNamespace, KXdmIetfPresRulesNsPrefix );
+ aXdmDocument.AppendNamespaceL( KXdmIetfCommonPolicyNamespace, KXdmIetfCommonPolicyNsPrefix );*/
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapResourceListsUsage/inc/XcapResourceListsUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapResourceListsUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPRESOURCELISTSUSAGE__
+#define __XCAPRESOURCELISTSUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapResourceListsUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapResourceListsUsage*
+ */
+ static CXcapResourceListsUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapResourceListsUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapResourceListsUsage( const CXdmEngine& aXdmEngine );
+ };
+
+#endif //__XCAPRESOURCELISTSUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapResourceListsUsage/src/XcapResourceListsUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapResourceListsUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapResourceListsUsage.h"
+
+// Used specification
+// draft-ietf-simple-xcap-list-usage-05, 7 February 2005
+// expires 8 August 2005
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::CXcapResourceListsUsage
+//
+// ----------------------------------------------------
+//
+CXcapResourceListsUsage::CXcapResourceListsUsage( const CXdmEngine& aXdmEngine ) :
+ CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapResourceListsUsage* CXcapResourceListsUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapResourceListsUsage* self = new ( ELeave ) CXcapResourceListsUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::~CXcapResourceListsUsage
+//
+// ----------------------------------------------------
+//
+CXcapResourceListsUsage::~CXcapResourceListsUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapResourceListsUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapResourceListsUsage::AUID() const
+ {
+ return TPtrC8( KXdmResourceListsUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapResourceListsUsage::ContentType() const
+ {
+ return TPtrC8( KXdmResourceListsUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapResourceListsUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmResourceListsNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::ValidateL
+//
+// ----------------------------------------------------
+//
+TBool CXcapResourceListsUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <resource-lists>
+ if ( Match( element, KXdmResourceLists) )
+ {
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ // there should not be any other elements than <list>
+ if ( !Match( aXdmNode.ChileNode(i)->NodeName(), KXdmList ) )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ }
+ found = ETrue;
+ }
+ // <list>
+ else if ( Match( element, KXdmList ) )
+ {
+ found = ETrue;
+ }
+ // <entry>
+ else if ( Match( element, KXdmEntry ) )
+ {
+ // required attribute uri
+ if ( !aXdmNode.HasAttribute( KXdmUri ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <entry-ref>
+ else if ( Match( element, KXdmEntryRef ) )
+ {
+ if ( !aXdmNode.HasAttribute( KXdmRef ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+ found = ETrue;
+ }
+ // <display-name>
+ else if ( Match( element, KXdmDisplayName ) )
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to the base class for data validation
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapResourceListsUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC attribute = aXdmNodeAttr.NodeName();
+
+ // name
+ if ( Match( attribute, KXdmName ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // uri
+ else if ( Match( attribute, KXdmUri ) )
+ {
+ dataType = EDataTypeString;
+ }
+ // ref
+ else if ( Match( attribute, KXdmRef ) )
+ {
+ dataType = EDataTypeAnyURI;
+ }
+ // anchor
+ else if ( Match( attribute, KXdmAnchor ) )
+ {
+ dataType = EDataTypeAnyURI;
+ }
+
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to base class for data validation
+ ValidateDataL( dataType, aXdmNodeAttr );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapResourceListsUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapResourceListsUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmResourceListsNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapRlsServicesUsage/inc/XcapRlsServicesUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapRlsServicesUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPRLSSERVICESUSAGE__
+#define __XCAPRLSSERVICESUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapRlsServicesUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapRlsServicesUsage*
+ */
+ static CXcapRlsServicesUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapRlsServicesUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapRlsServicesUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iResourceLists;
+ };
+
+#endif //__XCAPRLSSERVICESUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapRlsServicesUsage/src/XcapRlsServicesUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapRlsServicesUsage
+*
+*/
+
+
+
+
+#include <XdmErrors.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapRlsServicesUsage.h"
+
+// Used specification
+// OMA-RLS_XDM_Specification-V1_0-20060214-C, 14 February 2006
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::CXcapRlsServicesUsage
+//
+// ----------------------------------------------------
+//
+CXcapRlsServicesUsage::CXcapRlsServicesUsage( const CXdmEngine& aXdmEngine ) :
+CXcapAppUsage( aXdmEngine ),
+iResourceLists( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapRlsServicesUsage* CXcapRlsServicesUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapRlsServicesUsage* self = new ( ELeave ) CXcapRlsServicesUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::~CXcapRlsServicesUsage
+//
+// ----------------------------------------------------
+//
+CXcapRlsServicesUsage::~CXcapRlsServicesUsage()
+ {
+ delete iResourceLists;
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapRlsServicesUsage::ConstructL()
+ {
+ iResourceLists = CXcapAppUsage::NewL( iXdmEngine, KXdmResourceListsUsageUid );
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapRlsServicesUsage::AUID() const
+ {
+ return TPtrC8( KXdmRlsServicesUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapRlsServicesUsage::ContentType() const
+ {
+ return TPtrC8( KXdmRlsServicesUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapRlsServicesUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmRlsServicesNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapRlsServicesUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+
+ TBool found( EFalse );
+ TDataType dataType ( EDataTypeUndefined );
+ TPtrC element = aXdmNode.NodeName();
+ // <rls-services>
+ if ( Match( element, KXdmRlsServices ) )
+ {
+ found = ETrue;
+ }
+ // <service>
+ else if ( Match( element, KXdmService ) )
+ {
+ // required attribute uri
+ if ( !aXdmNode.HasAttribute( KXdmUri ) )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ }
+
+ // there should be either <resource-list> or
+ // <list> element and mandatory <packages> element
+ TBool resourcelist( EFalse );
+ TBool list( EFalse );
+ TBool packages( EFalse );
+ // go through all childs
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ TPtrC childName = aXdmNode.ChileNode(i)->NodeName();
+ if ( Match( childName, KXdmResourceList ) )
+ {
+ resourcelist = ETrue;
+ }
+ else if ( Match( childName, KXdmList ) )
+ {
+ list = ETrue;
+ }
+ else if ( Match( childName, KXdmPackages ) )
+ {
+ packages = ETrue;
+ }
+ }
+ // <resource-list> or <list>, not both
+ if ( resourcelist && list )
+ {
+ LeaveWithErrorL( KXcapErrorSchemaViolation );
+ }
+ // each <service> must have at least one <packages> element
+ if ( !packages )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredElement );
+ }
+ found = ETrue;
+ }
+ // <resource-list>
+ else if ( Match( element, KXdmResourceList ) )
+ {
+ dataType = EDataTypeAnyURI;
+ found = ETrue;
+ }
+ // <packages>
+ else if ( Match( element, KXdmPackages ) )
+ {
+ // each <packages> shall specify at least presence event package,
+ // go through all childs
+ TBool presence ( EFalse );
+ TInt count( aXdmNode.NodeCount() );
+ for ( TInt i(0); i < count; i++ )
+ {
+ if ( Match( aXdmNode.ChileNode(i)->NodeName(), KXdmPackage ) )
+ {
+ TPtrC8 data = aXdmNode.ChileNode(i)->LeafNodeContent();
+ if ( !data.CompareF( KXdmPresence ) )
+ {
+ presence = ETrue;
+ }
+ }
+ }
+ // check that the <package>presence<package> exists
+ if ( !presence )
+ {
+ LeaveWithErrorL( KXcapErrorMissingRequiredElementValue );
+ }
+ found = ETrue;
+ }
+ // <package>
+ else if ( Match( element, KXdmPackage ) )
+ {
+ dataType = EDataTypeString;
+ found = ETrue;
+ }
+ // <list> type=rl:listType from urn:ietf:params:xml:ns:resource-lists
+ // however belongs to the default namespace
+ // ( btw, there is mistake in specification example )
+ else if ( Match( element, KXdmList ) )
+ {
+ found = iResourceLists->ValidateNodeL( aXdmNode );
+ }
+ // <entry>,<display-name> from urn:ietf:params:xml:ns:resource-lists
+ if ( !found )
+ {
+ found = iResourceLists->ValidateNodeL( aXdmNode );
+ if ( found )
+ {
+ SetPrefixL( aXdmNode, KXdmResourceListsNsPrefix );
+ }
+ }
+ if ( dataType != EDataTypeUndefined )
+ {
+ // pass to the base class for data validation
+ ValidateDataL( dataType, aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapRlsServicesUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // uri
+ if ( Match( aXdmNodeAttr.NodeName(), KXdmUri ) )
+ {
+ ValidateDataL( EDataTypeAnyURI, aXdmNodeAttr );
+ }
+ // the rest are rom urn:ietf:params:xml:ns:resource-lists
+ else
+ {
+ iResourceLists->ValidateAttributeL( aXdmNodeAttr );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapRlsServicesUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapRlsServicesUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ aXdmDocument.AppendNamespaceL( KXdmRlsServicesNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmResourceListsNamespace, KXdmResourceListsNsPrefix );
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapSharedXDMUsage/inc/XcapSharedXDMUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapSharedXDMUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPSHAREDXDMUSAGE__
+#define __XCAPSHAREDXDMUSAGE__
+
+#include "XcapAppUsage.h"
+
+
+// CLASS DECLARATION
+class CXcapSharedXDMUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapSharedXDMUsage*
+ */
+ static CXcapSharedXDMUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapSharedXDMUsage();
+
+ public: // From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapSharedXDMUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ CXcapAppUsage* iResListUsage;
+
+ };
+
+#endif //__XCAPSHAREDXDMUSAGE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapSharedXDMUsage/src/XcapSharedXDMUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapSharedXDMUsage
+*
+*/
+
+
+
+
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapSharedXDMUsage.h"
+
+// Used spesifications
+// OMA-TS-XDM_Core-V1_0-20051103-C, 03 November 2005
+// OMA-TS-XDM_Shared-V1_0-20051006-C, 12 June 2006
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::CXcapSharedXDMUsage
+//
+// ----------------------------------------------------
+//
+CXcapSharedXDMUsage::CXcapSharedXDMUsage(
+const CXdmEngine& aXdmEngine ) : CXcapAppUsage( aXdmEngine ),
+iResListUsage( NULL )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapSharedXDMUsage* CXcapSharedXDMUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapSharedXDMUsage* self = new ( ELeave ) CXcapSharedXDMUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::~CXcapSharedXDMUsage
+//
+// ----------------------------------------------------
+//
+CXcapSharedXDMUsage::~CXcapSharedXDMUsage()
+ {
+ delete iResListUsage;
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapSharedXDMUsage::ConstructL()
+ {
+ iResListUsage = CXcapAppUsage::NewL( iXdmEngine, KXdmResourceListsUsageUid );
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapSharedXDMUsage::AUID() const
+ {
+ return TPtrC8( KXdmSharedXDMUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapSharedXDMUsage::ContentType() const
+ {
+ return TPtrC8( KXdmSharedXDMUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapSharedXDMUsage::DefaultNamespace() const
+ {
+ // we use urn:ietf:params:xml:ns:resource-lists
+ // as a default namespace
+ return TPtrC8( KXdmResourceListsNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapSharedXDMUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+ TBool found ( EFalse );
+ TPtrC element = aXdmNode.NodeName();
+
+ // <uriusages>
+ if ( Match( element, KXdmUriUsages ) )
+ {
+ SetPrefixL( aXdmNode, KXdmSharedXDMUriUsageNsPrefix );
+ found = ETrue;
+ }
+ // <uriusage>
+ else if ( Match( element, KXdmUriUsage ) )
+ {
+ SetPrefixL( aXdmNode, KXdmSharedXDMUriUsageNsPrefix );
+ found = ETrue;
+ }
+ // the rest are from urn:ietf:params:xml:ns:resource-lists
+ else
+ {
+ // do not append the namespace prefix here,
+ // since the used default namespace is
+ // urn:ietf:params:xml:ns:resource-lists
+ found = iResListUsage->ValidateNodeL( aXdmNode );
+ }
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapSharedXDMUsage::ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // this usage doesn't have any attributes,
+ // all attributes are from urn:ietf:params:xml:ns:resource-lists
+ iResListUsage->ValidateAttributeL( aXdmNodeAttr );
+
+ }
+
+// ----------------------------------------------------
+// CXcapSharedXDMUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapSharedXDMUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ // we use urn:ietf:params:xml:ns:resource-lists
+ // as a default namespace
+ aXdmDocument.AppendNamespaceL( KXdmResourceListsNamespace, KNullDesC8 );
+ aXdmDocument.AppendNamespaceL( KXdmSharedXDMUriUsageNamespace, KXdmSharedXDMUriUsageNsPrefix );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapTestAppUsage/inc/XcapTestAppUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapTestAppUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPTESTAPPUSAGE__
+#define __XCAPTESTAPPUSAGE__
+
+#include "XcapAppUsage.h"
+
+// CONSTANTS
+// Define here literals for element names if they
+// aren't already defined in AppUsageDef.h
+// _LIT( KExample, "example" );
+// _LIT( KExampleElement, "example-element" );
+// _LIT( KExampleElement2, "example-element2" );
+// _LIT( KExampleElement3, "example-element3" );
+// _LIT( KExampleAttr1, "exampleAttr1" );
+// _LIT( KExampleAttr2, "exampleAttr2" );
+
+// CLASS DECLARATION
+class CXcapTestAppUsage : public CXcapAppUsage
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param TXcapAppUsageParams Parameters
+ * @return CXcapTestAppUsage*
+ */
+ static CXcapTestAppUsage* NewL( const TXcapAppUsageParams& aParameters );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapTestAppUsage();
+
+ public: //From CXcapAppUsage
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ TPtrC8 AUID() const;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ TPtrC8 ContentType() const;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ TPtrC8 DefaultNamespace() const;
+
+ /**
+ * Validate the node in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmDocumentNode& reference to the node
+ * @return ETrue, if the node belongs to the appusage's namespace
+ */
+ TBool ValidateNodeL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validate the attribute in the parameter
+ * Leaves with system wide error codes or
+ * with error defined in XdmErrors.h
+ * @param CXdmNodeAttribute& reference to the attribute
+ */
+ void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param CXdmDocument& reference to the document
+ */
+ void AddNamespaceInformationL( CXdmDocument& aXdmDocument );
+
+ private:
+
+ /**
+ * Second phase construction
+ */
+ void ConstructL();
+
+ /**
+ * Prohibit copy costructor
+ */
+ CXcapTestAppUsage( const CXdmEngine& aXdmEngine );
+
+ private: // Data
+
+ };
+
+#endif //__XCAPTESTAPPUSAGE__
+
+ // End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/XcapTestAppUsage/src/XcapTestAppUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapTestAppUsage
+*
+*/
+
+
+
+
+#include "XcapTestAppUsage.h"
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::CXcapTestAppUsage
+//
+// ----------------------------------------------------
+//
+CXcapTestAppUsage::CXcapTestAppUsage( const CXdmEngine& aXdmEngine ) :
+ CXcapAppUsage( aXdmEngine )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::NewL
+//
+// ----------------------------------------------------
+//
+CXcapTestAppUsage* CXcapTestAppUsage::NewL( const TXcapAppUsageParams& aParameters )
+ {
+ CXcapTestAppUsage* self = new ( ELeave ) CXcapTestAppUsage( aParameters.iXdmEngine );
+ CleanupStack::PushL( self ); // << self
+ self->ConstructL();
+ CleanupStack::Pop( self ); // >> self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::~CXcapTestAppUsage
+//
+// ----------------------------------------------------
+//
+CXcapTestAppUsage::~CXcapTestAppUsage()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapTestAppUsage::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::AUID
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapTestAppUsage::AUID() const
+ {
+ return TPtrC8( KXdmTestAppUsageAUID );
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::ContentType
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapTestAppUsage::ContentType() const
+ {
+ return TPtrC8( KXdmTestAppUsageContType );
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::DefaultNamespace
+//
+// ----------------------------------------------------
+//
+TPtrC8 CXcapTestAppUsage::DefaultNamespace() const
+ {
+ return TPtrC8( KXdmTestAppUsageDefaultNamespace );
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::ValidateNodeL
+//
+// ----------------------------------------------------
+//
+TBool CXcapTestAppUsage::ValidateNodeL( CXdmDocumentNode& /*aXdmNode*/ )
+ {
+ // This method is called by base class for each element
+ // in document, here we have to declare every element, check element
+ // datatype, restrictions for values and also do all checking that concerns
+ // the structure of the element. If the datatype is some of
+ // the common datatypes defined in xcapappusage.h, the node
+ // can pe passed to the base class for value validation.
+ // If the node belongs to this namespace, the return value
+ // should be true, false otherwise.
+
+
+ // TBool found ( EFalse );
+ // TDataType dataType ( EDataTypeUndefined );
+ // TPtrC element = aXdmNode.NodeName();
+
+ // <example-element>
+ // if ( Match( element, KExampleElement ) )
+ // {
+ // supported data types are defined in AppUsageDef
+ // dataType = EDataTypeBoolean;
+ // found = ETrue;
+ // }
+ // <example-element2>
+ // else if ( Match( element, KExampleElement2 ) )
+ // {
+ // required attribute attribute
+ // if ( !aXdmNode.HasAttribute( KAttribute ) )
+ // {
+ // LeaveWithErrorL( KXcapErrorMissingRequiredAttribute );
+ // }
+ // found = ETrue;
+ // }
+ // <example-element3>
+ // else if ( Match( element, KExampleElement3 ) )
+ // {
+ // TInt count( aXdmNode.NodeCount() );
+ // for ( TInt i(0); i < count; i++ )
+ // {
+ // there should not be any other elements than <example>
+ // if ( !Match( aXdmNode.ChileNode(i)->NodeName(), KExample ) )
+ // {
+ // LeaveWithErrorL( KXcapErrorSchemaViolation );
+ // }
+ // }
+ // found = ETrue;
+ // }
+
+ // if ( dataType != EDataTypeUndefined )
+ // {
+ // pass to the base class for data validation
+ // ValidateDataL( dataType, aXdmNode );
+ // }
+ // return found;
+
+ return EFalse;
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::ValidateAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapTestAppUsage::ValidateAttributeL( const CXdmNodeAttribute& /*aXdmNodeAttr*/ )
+ {
+ // This method is called by base class for each attribute
+ // in document, here we have to define data types
+ // for attributes, and pass them to the base class
+ // for the actual data checking.
+
+ // TDataType dataType ( EDataTypeUndefined );
+ // TPtrC attribute = aXdmNodeAttr.NodeName();
+
+ // exampleAttr1
+ // if ( Match( attribute, KExampleAttr1 ) )
+ // {
+ // dataType = EDataTypeString;
+ // }
+ // exampleAttr2
+ // else if ( Match( attribute, KExampleAttr2 ) )
+ // {
+ // dataType = EDataTypeString;
+ // }
+
+ // if ( dataType != EDataTypeUndefined )
+ // {
+ // pass to base class for data validation
+ // ValidateDataL( dataType, aXdmNodeAttr );
+ // }
+ }
+
+// ----------------------------------------------------
+// CXcapTestAppUsage::AddNamespaceInformationL
+//
+// ----------------------------------------------------
+//
+void CXcapTestAppUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
+ {
+ // default namespace prefix should be empty
+ aXdmDocument.AppendNamespaceL( KXdmTestAppUsageDefaultNamespace, KNullDesC8 );
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/eabi/XcapAppUsageU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZN13CXcapAppUsage4NewLERK10CXdmEnginei @ 2 NONAME
+ _ZN13CXcapAppUsage8ValidateER12CXdmDocumenti @ 3 NONAME
+ _ZN13CXcapAppUsage8ValidateER16CXdmDocumentNodeP17MXcapUriInterfacei @ 4 NONAME
+ _ZTI13CXcapAppUsage @ 5 NONAME
+ _ZTI18CXcapPocGroupUsage @ 6 NONAME
+ _ZTI19CXcapDirectoryUsage @ 7 NONAME
+ _ZTI19CXcapSharedXDMUsage @ 8 NONAME
+ _ZTI20CXcapCapabilityUsage @ 9 NONAME
+ _ZTI21CXcapRlsServicesUsage @ 10 NONAME
+ _ZTI22CXcapOmaPresRulesUsage @ 11 NONAME
+ _ZTI23CXcapIetfPresRulesUsage @ 12 NONAME
+ _ZTI23CXcapPocUserAccessUsage @ 13 NONAME
+ _ZTI23CXcapResourceListsUsage @ 14 NONAME
+ _ZTI25CXcapOmaCommonPolicyUsage @ 15 NONAME
+ _ZTI26CXcapIetfCommonPolicyUsage @ 16 NONAME
+ _ZTI7CXcapC4 @ 17 NONAME
+ _ZTV13CXcapAppUsage @ 18 NONAME
+ _ZTV18CXcapPocGroupUsage @ 19 NONAME
+ _ZTV19CXcapDirectoryUsage @ 20 NONAME
+ _ZTV19CXcapSharedXDMUsage @ 21 NONAME
+ _ZTV20CXcapCapabilityUsage @ 22 NONAME
+ _ZTV21CXcapRlsServicesUsage @ 23 NONAME
+ _ZTV22CXcapOmaPresRulesUsage @ 24 NONAME
+ _ZTV23CXcapIetfPresRulesUsage @ 25 NONAME
+ _ZTV23CXcapPocUserAccessUsage @ 26 NONAME
+ _ZTV23CXcapResourceListsUsage @ 27 NONAME
+ _ZTV25CXcapOmaCommonPolicyUsage @ 28 NONAME
+ _ZTV26CXcapIetfCommonPolicyUsage @ 29 NONAME
+ _ZTV7CXcapC4 @ 30 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/group/XcapAppUsage.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapAppUsage.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcapappusage.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x10207416
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE XcapAppUsage.cpp
+
+START RESOURCE 10207416.rss
+ TARGET xcapappusage.rsc
+END
+
+//Capability application usage
+SOURCEPATH ../XcapCapabilityUsage/src
+SOURCE XcapCapabilityUsage.cpp
+
+//Directory application usage
+SOURCEPATH ../XcapDirectoryUsage/src
+SOURCE XcapDirectoryUsage.cpp
+
+//PocGroup application usage
+SOURCEPATH ../XcapPocGroupUsage/src
+SOURCE XcapPocGroupUsage.cpp
+
+//PocUserAccessPolicy application usage
+SOURCEPATH ../XCapPocUserAccessUsage/src
+SOURCE XcapPocUserAccessUsage.cpp
+
+// SharedXDM application usage
+SOURCEPATH ../XcapSharedXDMUsage/src
+SOURCE XcapSharedXDMUsage.cpp
+
+//RlsServices application usage
+SOURCEPATH ../XcapRlsServicesUsage/src
+SOURCE XcapRlsServicesUsage.cpp
+
+//ResourceLists application usage
+SOURCEPATH ../XcapResourceListsUsage/src
+SOURCE XcapResourceListsUsage.cpp
+
+//CommonPolicyCaps application usage
+SOURCEPATH ../XCapCommonPolicyCapsUsage/src
+SOURCE XcapOmaCPUsage.cpp
+SOURCE XcapIetfCPUsage.cpp
+
+// PresenceRules application usage
+SOURCEPATH ../XcapPresenceRulesUsage/src
+SOURCE XcapIetfPresRulesUsage.cpp
+SOURCE XcapOmaPresRulesUsage.cpp
+
+// Example application usage
+// SOURCEPATH ../XcapTestAppUsage/src
+// SOURCE XcapTestAppUsage.cpp
+
+// PRES-CONTENT STARTS
+SOURCEPATH ../XcapC4/src
+SOURCE XcapC4.cpp
+// PRES-CONTENT ENDS
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../XcapCapabilityUsage/inc
+USERINCLUDE ../XcapDirectoryUsage/inc
+USERINCLUDE ../XcapPocGroupUsage/inc
+USERINCLUDE ../XCapPocUserAccessUsage/inc
+USERINCLUDE ../XcapSharedXDMUsage/inc
+USERINCLUDE ../XcapRlsServicesUsage/inc
+USERINCLUDE ../XcapResourceListsUsage/inc
+USERINCLUDE ../XCapCommonPolicyCapsUsage/inc
+USERINCLUDE ../XcapPresenceRulesUsage/inc
+// USERINCLUDE ../XcapTestAppUsage/inc
+
+USERINCLUDE ../../../../inc
+// PRES-CONTENT STARTS
+USERINCLUDE ../XcapC4/inc
+// PRES-CONTENT ENDS
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../../inc
+
+LIBRARY ecom.lib
+LIBRARY euser.lib
+LIBRARY XdmEngine.lib
+LIBRARY centralrepository.lib
+
+DEBUGLIBRARY efsrv.lib
+DEBUGLIBRARY flogger.lib
+
+
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+ deffile ../BWINSCW/
+#elif defined (WINS )
+ deffile ../BWINS/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapAppUsage bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_EXPORTS
+//--------------------
+
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+XcapAppUsage.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/inc/XcapAppUsage.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,498 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapAppUsage
+*
+*/
+
+
+
+
+#ifndef __XCAPAPPUSAGE__
+#define __XCAPAPPUSAGE__
+
+// INCLUDES
+#include <ecom.h>
+
+#include <XdmEngine.h>
+#include <XdmProtocolUidList.h>
+#include "XcapAppUsageDef.h"
+
+// CONSTANTS
+#ifdef _DEBUG
+_LIT( KXdmAppUsageLogDir, "Xdm" );
+_LIT( KXdmAppUsageLogFile, "XcapAppUsage.txt" );
+const TInt KAppUsageLogBufferMaxSize = 2000;
+#endif
+
+_LIT( KXdmDefaultNsAttrName, "xmlns");
+_LIT( KXdmNonDefaultNsAttrName, "xmlns:");
+const TInt KXdmMaxPrefixLength = 10;
+
+// FORWARD DECLARATIONS
+class CXdmDocument;
+class MXcapUriInterface;
+
+// NOTE
+// If _NAMESPACES_TO_NODE_SELECTOR flag is defined, used namespaces will be added to the node selector
+// when updating partial documents.
+// The default namespace of the usage will not be added.
+#define _NAMESPACES_TO_NODE_SELECTOR
+
+// If _ADD_NAMESPACE_ATTRIBUTES flag is defined, namespace information is
+// added as an node atttribute when updating partial documents.
+// The default namespace of the usage will not be added.
+#define _ADD_NAMESPACE_ATTRIBUTES
+
+/**
+* A helper class for parameter passing from
+* the XCAP protocol to the application usage
+*
+* NOTE: There will most probably be more than one parameter!
+*
+*/
+class TXcapAppUsageParams
+ {
+ public:
+
+ /**
+ * @param CXdmEngine& XDM Engine
+ * @return TXcapAppUsageParams
+ */
+ TXcapAppUsageParams( const CXdmEngine& aXdmEngine ) :
+ iXdmEngine( aXdmEngine ){}
+
+ public:
+
+ const CXdmEngine& iXdmEngine;
+ };
+
+// CLASS DECLARATION
+/**
+* Application usage base class
+*/
+class CXcapAppUsage : public CBase
+ {
+ public:
+
+ /**
+ * Symbian OS constructor
+ * @param aXdmEngine XdmEngine reference
+ * @param aDocumentType Type of the document
+ * @return CXcapAppUsage*
+ * REMOVE THIS WHEN USAGE IN ENGINE CHANGED!!!
+ */
+ static CXcapAppUsage* NewL( const CXdmEngine& aXdmEngine,
+ const TXdmDocType aDocumentType );
+
+ /**
+ * Symbian OS constructor
+ * @param aXdmEngine XdmEngine reference
+ * @param aDocumentType Type of the document
+ * @return CXcapAppUsage*
+ */
+ IMPORT_C CXcapAppUsage* NewL( const CXdmEngine& aXdmEngine,
+ const TInt aDocumentType );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXcapAppUsage();
+
+ /**
+ * Validate the document in the parameter.
+ * Calls ValidateNodeL( aXdmNode ) method from derived class
+ * for each node in document and ValidateAttributeL( aXdmNodeAttr )
+ * for each attribute in document. If the document is outgoing,
+ * calls also AddNamespaceInformationL method from derived class.
+ * @param aXdmDocument document reference
+ * @param aAddNamespaces if true, the namespaces will be added
+ * @return KErrNone or error code.
+ */
+ IMPORT_C TInt Validate( CXdmDocument& aXdmDocument, TBool aAddNamespaces ) ;
+
+ /**
+ * Validate the node in the parameter.
+ * Calls ValidateNodeL( aXdmNode ) method from derived class for
+ * current node and it's descendants and ValidateAttributeL( aXdmNodeAttr )
+ * for each attribute. Stores the uri of the node.
+ * @param aXdmNode node reference
+ * @param TBool aIsGetOrDelete indication of http get or delete
+ * @return KErrNone or error code.
+ */
+ IMPORT_C TInt Validate( CXdmDocumentNode& aXdmNode,
+ MXcapUriInterface* aUriInterface,
+ TBool aIsGetOrDelete ) ;
+
+
+
+ public: // Application Usage API
+
+ /**
+ * AUID for this usage
+ * @return AUID
+ */
+ virtual TPtrC8 AUID() const = 0;
+
+ /**
+ * MIME type for this usage
+ * @return MIME type
+ */
+ virtual TPtrC8 ContentType() const = 0;
+
+ /**
+ * Default namespace for this usage
+ * @return Default namespace definition
+ */
+ virtual TPtrC8 DefaultNamespace() const = 0;
+
+ /**
+ * Validate the node in the parameter
+ * This method is called by base class for each node
+ * in document, here we have to check element datatype,
+ * restrictions for values and also do all checking that concerns
+ * the structure of the element. If the datatype is some of
+ * the common datatypes defined in xcapappusage.h, the node
+ * can pe passed to the base class for value validation.
+ * @param CXdmDocumentNode& node reference
+ * @return True, if the node belongs to the current namespace
+ */
+ virtual TBool ValidateNodeL( CXdmDocumentNode& aXdmNode ) = 0;
+
+ /**
+ * Validate the attribute in the parameter
+ * This method is called by base class for each attribute
+ * in document, here we have to define data types
+ * for attributes, and pass them to the base class
+ * for the actual data checking.
+ * @param aXdmNodeAttr attribute reference
+ */
+ virtual void ValidateAttributeL( const CXdmNodeAttribute& aXdmNodeAttr ) = 0;
+
+ /**
+ * Add namespaces and namespace prefixes used in document
+ * @param aXdmDocument document reference
+ */
+ virtual void AddNamespaceInformationL( CXdmDocument& aXdmDocument ) = 0;
+
+
+ protected:
+
+ /**
+ * C++ constructor
+ */
+ CXcapAppUsage( const CXdmEngine& aXdmEngine );
+
+ /**
+ * Validates basic data types
+ * @param aDataType type of the data
+ * @param aXdmNode node reference
+ */
+ void ValidateDataL ( TDataType aDataType, CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Validates basic data types
+ * @param aDataType type of the data
+ * @param aXdmNodeAttr attribute reference
+ */
+ void ValidateDataL ( TDataType aDataType, const CXdmNodeAttribute& aXdmNodeAttr );
+
+ /**
+ * If outgoing document, adds namespacePrefix
+ * to the node in parameter
+ * @param aXdmNode node reference
+ * @param aPrefix namespace prefix
+ */
+ void SetPrefixL( CXdmDocumentNode& aXdmNode, const TDesC8& aPrefix );
+
+ /**
+ * Helper method for string comparison
+ * @param aLeft first string
+ * @param aRight second string
+ * @return ETrue, if the strings are equal
+ */
+ TBool Match( const TDesC& aLeft, const TDesC& aRight );
+
+ /**
+ * Helper method for string comparison
+ * @param aLeft first string
+ * @param aRight second string
+ * @return ETrue, if the strings are equal
+ */
+ TBool Match( const TDesC8& aLeft, const TDesC8& aRight );
+
+ /**
+ * To be used when an error occurs, however if the node is
+ * for http get or delete request, this do not leave
+ * @param aErrorCode function will leave with this error code
+ */
+ void LeaveWithErrorL( TInt aErrorCode );
+
+#ifdef _DEBUG
+ /**
+ * Writes logs to file.
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+#endif
+
+ private:
+
+ /**
+ * Validate the document in the parameter.
+ * @param aXdmDocument document reference
+ */
+ void DoValidateL( CXdmDocument& aXdmDocument ) ;
+
+ /**
+ * Validate the node in the parameter.
+ * @param aXdmNode node reference
+ */
+ void DoValidateL( CXdmDocumentNode& aXdmNode ) ;
+
+ /**
+ * Validates basic data types
+ * @param aDataType type of the data
+ * @param aData validated data
+ */
+ void ValidateDataL ( TDataType aDataType, TDesC8& aData );
+
+ /**
+ * Updates member variables for used namespaces
+ * @param aPrefix prefix of the namespace
+ */
+ void AddUsedNamespace( const TDesC8& aPrefix ) ;
+
+ /**
+ * Resets member variables for used namespaces
+ */
+ void ResetUsedNamespaces( );
+
+ /**
+ * Appends namespace information to the node's uri interface.
+ * Called if _NAMESPACES_TO_NODE_SELECTOR defined.
+ * @param aUriInterface interface for storing the uri
+ */
+ void AppendUsedNamespacesL( MXcapUriInterface* aUriInterface );
+
+ /**
+ * Creates namespace attribute for the node.
+ * Called if _ADD_NAMESPACE_ATTRIBUTES is defined
+ * and validating partial document.
+ * @param aXdmNode node for storing the uri
+ */
+ void CreateNamespaceAttributesL( CXdmDocumentNode& aXdmNode, MXcapUriInterface* aUriInterface );
+
+ /**
+ * Removes namespace attributes from the node
+ * and it's child nodes
+ * @param aXdmNode
+ */
+ void RemoveNamespaceAttributesL( CXdmDocumentNode& aXdmNode );
+
+ /**
+ * Adds namespace attributes that are used in
+ * partial document
+ * @param aXdmNode
+ */
+ void AppendNamespaceAttributesL( CXdmDocumentNode& aXdmNode ) ;
+
+ /**
+ * Creates namespace attribute for node
+ * @param aXdmNode
+ * @param aPrefix prefix of the namespace
+ * @param aNamespace namespace definition
+ */
+ void CreateNamespaceAttributeL( CXdmDocumentNode& aXdmNode, const TDesC8& aPrefix, const TDesC8& aNamespace );
+
+
+ /**
+ * Goes through all nodes and checks if
+ * default namespace is used in document fragment
+ * the namespace given in parameter
+ * @param aXdmNode
+ * @return ETrue or EFalse
+ */
+ TBool DefaultNamespaceUsed( CXdmDocumentNode& aXdmNode );
+
+ protected: // Data
+
+ CXdmEngine& iXdmEngine;
+
+ private: // Data
+
+ TBool iAddNamespaces;
+ TBool iNsToNodeSelector;
+ TBool iAddNsAttributes;
+ TBool iIsGetOrDelete;
+ TUid iDestructorKey;
+ // Variables for used namespaces
+ // Add new one here if needed
+ TBool iRL;
+ TBool iCR;
+ TBool iCP ;
+ TBool iPR;
+ TBool iLS;
+ TBool iPOC;
+ TBool iOPR;
+ TBool iRLS;
+ TBool iOU;
+ // add new prefix definitions here
+
+
+ };
+
+
+// ----------------------------------------------------
+// CXcapAppUsage::NewL
+// Create a new application usage implementation
+// REMOVE THIS WHEN USAGE IN ENGINE CHANGED!!!
+// ----------------------------------------------------
+//
+inline CXcapAppUsage* CXcapAppUsage::NewL( const CXdmEngine& aXdmEngine,
+ const TXdmDocType aDocumentType )
+ {
+ TAny* ptr = NULL;
+ TXcapAppUsageParams params( aXdmEngine );
+ switch( aDocumentType )
+ {
+ case EXdmCapabilities:
+ {
+ TUid KDefaultImplementationUid = { 0x10207418 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmDirectory:
+ {
+ TUid KDefaultImplementationUid = { 0x10207419 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmTestDocType:
+ {
+ TUid KDefaultImplementationUid = { 0x1020741A };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmPoCGroup:
+ {
+ TUid KDefaultImplementationUid = { 0x1020741B };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmPoCUserAccessPolicy:
+ {
+ TUid KDefaultImplementationUid = { 0x1020741C };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmSharedXdm:
+ {
+ TUid KDefaultImplementationUid = { 0x1020741D };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmRlsServices:
+ {
+ TUid KDefaultImplementationUid = { 0x1020741E };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmResourceLists:
+ {
+ TUid KDefaultImplementationUid = { 0x10275080 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmIetfCommonPolicy:
+ {
+ TUid KDefaultImplementationUid = { 0x10275081 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmOmaCommonPolicy:
+ {
+ TUid KDefaultImplementationUid = { 0x10275082 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmIetfPresenceRules:
+ {
+ TUid KDefaultImplementationUid = { 0x10275083 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+ case EXdmOmaPresenceRules:
+ {
+ TUid KDefaultImplementationUid = { 0x102750AB };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+// PRES-CONTENT STARTS
+ case EXdmPresContent:
+ {
+ TUid KDefaultImplementationUid = { 0x20028701 };
+ TRAPD( error, ptr = REComSession::CreateImplementationL(
+ KDefaultImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms ) );
+ }
+ break;
+// PRES-CONTENT ENDS
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ return reinterpret_cast<CXcapAppUsage*>( ptr );
+ }
+
+
+#endif //__XCAPAPPUSAGE__
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/inc/XcapAppUsageDef.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapAppUsage enumerations
+*
+*/
+
+
+
+
+#ifndef __XCAPAPPUSAGEDEF__
+#define __XCAPAPPUSAGEDEF__
+
+// Supported data types
+enum TDataType
+ {
+ EDataTypeUndefined = 0,
+ EDataTypeString,
+ EDataTypeNonNegativeInteger,
+ EDataTypeAnyURI,
+ EDataTypeDateTime,
+ EDataTypeBoolean,
+ EDataTypeToken,
+ EDataTypeEmpty
+ };
+
+// AUIDs
+_LIT8( KXdmResourceListsUsageAUID, "/resource-lists/" );
+_LIT8( KXdmCapabilityUsageAUID, "/xcap-caps/" );
+_LIT8( KXdmDirectoryUsageAUID, "/org.openmobilealliance.xcap-directory/" );
+_LIT8( KXdmIetfCommonPolicyUsageAUID, "/policy-capabilities/" );
+_LIT8( KXdmOmaCommonPolicyUsageAUID, "/org.openmobilealliance.policy-capabilities/" );
+_LIT8( KXdmPocUserAccessUsageAUID, "/org.openmobilealliance.poc-rules/" );
+_LIT8( KXdmIetfPresRulesUsageAUID, "/pres-rules/" );
+_LIT8( KXdmRlsServicesUsageAUID, "/rls-services/" );
+_LIT8( KXdmSharedXDMUsageAUID, "/resource-lists/" );
+_LIT8( KXdmOmaPresRulesUsageAUID, "/org.openmobilealliance.pres-rules/" );
+_LIT8( KXdmPocGroupUsageAUID, "/org.openmobilealliance.poc-groups/" );
+// add new AUID definitions here
+//_LIT8( KXdmTestAppUsageAUID, "/org.foo.bar/" );
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentAUID, "/org.openmobilealliance.pres-content/" );
+// PRES-CONTENT ends
+
+// ContentTypes
+_LIT8( KXdmResourceListsUsageContType, "application/resource-lists+xml" );
+_LIT8( KXdmCapabilityUsageContType, "application/xcap-caps+xml" );
+_LIT8( KXdmDirectoryUsageContType, "application/oma-directory+xml" );
+_LIT8( KXdmIetfCommonPolicyUsageContType, "application/policy-caps+xml" );
+_LIT8( KXdmOmaCommonPolicyUsageContType, "application/policy-caps+xml" );
+_LIT8( KXdmSharedXDMUsageContType, "application/resource-lists+xml" );
+_LIT8( KXdmIetfPresRulesUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmPocUserAccessUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmOmaPresRulesUsageContType, "application/auth-policy+xml" );
+_LIT8( KXdmRlsServicesUsageContType, "application/rls-services+xml" );
+_LIT8( KXdmPocGroupUsageContType, "application/vnd.oma.poc.groups+xml" );
+// add new content types here
+//_LIT8( KXdmTestAppUsageContType, "application/test-type+xml" );
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentContType, "application/vnd.oma.pres-content+xml" );
+_LIT8( KXdmPresContentContTypeOld, "application/vnd.oma.content+xml" );
+// PRES-CONTENT ends
+
+// Namespaces
+_LIT8( KXdmResourceListsNamespace, "urn:ietf:params:xml:ns:resource-lists" );
+_LIT8( KXdmCapabilityNamespace, "urn:ietf:params:xml:ns:xcap-caps" );
+_LIT8( KXdmDirectoryNamespace, "urn:oma:params:xml:ns:xcap-directory" );
+_LIT8( KXdmIetfCommonPolicyNamespace, "urn:ietf:params:xml:ns:common-policy" );
+_LIT8( KXdmOmaCommonPolicyNamespace, "urn:oma:xml:xdm:common-policy" );
+_LIT8( KXdmOmaPresRulesNamespace, "urn:oma:xml:prs:pres-rules" );
+_LIT8( KXdmIetfPresRulesNamespace, "urn:ietf:params:xml:ns:pres-rules" );
+_LIT8( KXdmRlsServicesNamespace, "urn:ietf:params:xml:ns:rls-services" );
+_LIT8( KXdmSharedXDMUriUsageNamespace, "urn:oma:params:xml:ns:resource-list:oma-uriusage" );
+_LIT8( KXdmPocUserAccessNamespace, "urn:oma:xml:poc:poc-rules" );
+_LIT8( KXdmPocGroupNamespace, "urn:oma:xml:poc:list-service" );
+// add new namespace definitions here
+// PRES-CONTENT starts
+_LIT8( KXdmPresContentNamespace, "urn:oma:xml:prs:pres-content" );
+// PRES-CONTENT ends
+
+// Namespace prefixes
+_LIT8( KXdmSharedXDMUriUsageNsPrefix, "ou" );
+_LIT8( KXdmResourceListsNsPrefix, "rl" );
+_LIT8( KXdmIetfCommonPolicyNsPrefix, "cr" );
+_LIT8( KXdmOmaCommonPolicyNsPrefix, "ocp" );
+_LIT8( KXdmIetfPresRulesNsPrefix, "pr" );
+_LIT8( KXdmTestAppUsageDefaultNamespace, "ta" );
+_LIT8( KXdmPocUserAccessNsPrefix, "poc" );
+_LIT8( KXdmOmaPresRulesNsPrefix, "opr" );
+_LIT8( KXdmRlsServicesNsPrefix, "rls" );
+_LIT8( KXdmPocGroupNsPrefix, "ls" );
+// add new namespace prefix definitions here
+
+// Common literals
+_LIT( KXdmAuid, "auid" );
+_LIT( KXdmUri, "uri" );
+_LIT( KXdmEtag, "etag" );
+_LIT( KXdmName, "name" );
+_LIT( KXdmRef, "ref" );
+_LIT( KXdmUse, "use" );
+_LIT( KXdmRuleset, "ruleset" );
+_LIT( KXdmEntry, "entry" );
+_LIT( KXdmEntity, "entity" );
+_LIT( KXdmId, "id" );
+_LIT( KXdmAnyIdentity, "any-identity" );
+_LIT( KXdmIdentity, "identity" );
+_LIT( KXdmDomain, "domain" );
+_LIT( KXdmAnc, "anc" );
+_LIT( KXdmDisplayName, "display-name" );
+_LIT( KXdmAnchor, "anchor" );
+_LIT( KXdmExternal, "external" );
+_LIT( KXdmList, "list" );
+_LIT( KXdmServiceId, "service-id" );
+_LIT8( KXdmZero, "0" );
+_LIT8( KXdmOneNbr, "1" );
+_LIT8( KXdmTrue, "true" );
+_LIT8( KXdmFalse, "false");
+_LIT8( KXdmFull, "full" );
+_LIT8( KXdmAllow, "allow" );
+_LIT8( KXdmBlock, "block" );
+
+// Literals for capability
+_LIT( KXdmExtensions, "extensions" );
+_LIT( KXdmExtension, "extension" );
+_LIT( KXdmAuids, "auids" );
+_LIT( KXdmNamespaces, "namespaces" );
+_LIT( KXdmNamespace, "namespace");
+
+// Literals for directory
+_LIT( KXdmXcapDirectory, "xcap-directory" );
+_LIT( KXdmFolder, "folder" );
+_LIT( KXdmErrorCode, "error-code" );
+_LIT( KXdmLastModified, "last-modified" );
+_LIT( KXdmSize, "size" );
+
+// Literals for presence
+_LIT( KXdmServiceUriScheme, "service-uri-scheme" );
+_LIT( KXdmClass, "class" );
+_LIT( KXdmOccurenceId, "occurence-id" );
+_LIT( KXdmServiceUri, "service-uri" );
+_LIT( KXdmAllServices, "all-services" );
+_LIT( KXdmProvideServices, "provide-services" );
+// pres-rules-03
+_LIT( KXdmDeviceId, "device-id" );
+// pres-rules-05
+_LIT( KXdmDeviceID, "deviceID" );
+_LIT( KXdmAllDevices, "all-devices" );
+_LIT( KXdmProvideDevices, "provide-devices" );
+_LIT( KXdmAllPersons, "all-persons" );
+_LIT( KXdmProvidePersons, "provide-persons" );
+_LIT( KXdmProvideActivities, "provide-activities" );
+_LIT( KXdmProvideClass, "provide-class" );
+_LIT( KXdmProvideDeviceId, "provide-device-id" );
+_LIT( KXdmProvideMood, "provide-mood" );
+_LIT( KXdmProvidePlaceIs, "provide-place-is" );
+_LIT( KXdmProvidePlaceType, "provide-place-type" );
+_LIT( KXdmProvidePrivacy, "provide-privacy" );
+_LIT( KXdmProvideRelationship, "provide-relationship" );
+_LIT( KXdmProvideStatusIcon, "provide-status-icon" );
+_LIT( KXdmProvideSphere, "provide-sphere" );
+_LIT( KXdmProvideTimeOffset, "provide-time-offset" );
+_LIT( KXdmProvideUserInput, "provide-user-input" );
+_LIT( KXdmProvideNote, "provide-note" );
+_LIT( KXdmProvideUnknownAttribute, "provide-unknown-attribute" );
+_LIT( KXdmProvideAllAttributes, "provide-all-attributes" );
+_LIT( KXdmSubHandling, "sub-handling" );
+_LIT( KXdmProvideWillingness, "provide-willingness" );
+_LIT( KXdmProvideNetworkAvailability, "provide-network-availability" );
+_LIT( KXdmProvideSessionParticipation, "provide-session-participation" );
+_LIT( KXdmProvideGeopriv, "provide-geopriv" );
+_LIT( KXdmProvideRegistrationState, "provide-registration-state" );
+_LIT( KXdmProvideBarringState, "provide-barring-state" );
+_LIT8( KXdmBare, "bare" );
+_LIT8( KXdmThresholds, "thresholds" );
+_LIT8( KXdmRandomize, "randomize" );
+_LIT8( KXdmObfuscate, "obfuscate" );
+_LIT8( KXdmConfirm, "confirm" );
+_LIT8( KXdmPoliteBlock, "polite-block" );
+
+// Literals for commonpolicy
+_LIT( KXdmOtherIdentity, "other-identity" );
+_LIT( KXdmExternalList, "external-list" );
+_LIT( KXdmAnonymousRequest, "anonymous-request" );
+_LIT( KXdmRule, "rule" );
+_LIT( KXdmExceptDomain, "except-domain" );
+_LIT( KXdmExcept, "except" );
+_LIT( KXdmFrom, "from" );
+_LIT( KXdmTo, "to" );
+_LIT( KXdmValue, "value" );
+_LIT( KXdmSphere, "sphere" );
+_LIT( KXdmValidity, "validity" );
+_LIT( KXdmConditions, "conditions" );
+_LIT( KXdmActions, "actions" );
+_LIT( KXdmTransformations, "transformations" );
+_LIT( KXdmMany, "many" );
+_LIT( KXdmUntil, "until" );
+_LIT( KXdmOne, "one" );
+_LIT( KXdmScheme, "scheme" );
+
+// Literals for poc
+_LIT( KXdmGroup, "group");
+_LIT( KXdmListService, "list-service" );
+_LIT( KXdmInviteMembers, "invite-members" );
+_LIT( KXdmMaxParticipantCount, "max-participant-count" );
+_LIT( KXdmIsListMember, "is-list-member" );
+_LIT( KXdmAllowConfState, "allow-conference-state" );
+_LIT( KXdmAllowInvUsersDyn, "allow-invite-users-dynamically" );
+_LIT( KXdmJoinHandling, "join-handling" );
+_LIT( KXdmAllowInitiateConf, "allow-initiate-conference" );
+_LIT( KXdmAllowAnonymity, "allow-anonymity");
+_LIT( KXdmIsKeyParticipant, "list-service" );
+_LIT( KXdmAllowInvite, "allow-invite" );
+_LIT8( KXdmReject, "reject" );
+_LIT8( KXdmAccept, "accept" );
+_LIT8( KXdmPass, "pass" );
+
+// Literals for resource list
+_LIT( KXdmEntryRef, "entry-ref");
+_LIT( KXdmResourceLists, "resource-lists");
+
+// Literals for shared
+_LIT( KXdmUriUsages, "uriusages");
+_LIT( KXdmUriUsage, "uriusage");
+
+// Literals for rls
+_LIT( KXdmRlsServices, "rls-services" );
+_LIT( KXdmService, "service");
+_LIT( KXdmResourceList, "resource-list" );
+_LIT( KXdmPackages, "packages" );
+_LIT( KXdmPackage, "package" );
+_LIT8( KXdmPresence, "presence" );
+
+// PRES-CONTENT starts
+_LIT( KXdmMimeType, "mime-type");
+_LIT( KXdmEncoding, "encoding");
+_LIT( KXdmDescription, "description");
+_LIT( KXdmData, "data");
+_LIT( KXdmSvg, "svg");
+_LIT( KXdmRect, "rect");
+// PRES-CONTENT ends
+
+#endif //__XCAPAPPUSAGEDEF__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/src/10207416.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Part of XCAP Protocol Application Usage API
+*
+*/
+
+
+
+
+#include "registryinfo.rh"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XcapAppUsageInfo
+ {
+ dll_uid = 0x10207416;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207417;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207418;
+ version_no = 1;
+ display_name = "XCAP Capability Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207419;
+ version_no = 1;
+ display_name = "XCAP Directory Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020741A;
+ version_no = 1;
+ display_name = "XCAP Test Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020741B;
+ version_no = 1;
+ display_name = "XCAP PocGroup Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020741C;
+ version_no = 1;
+ display_name = "XCAP PocUserAccessPolicy Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020741D;
+ version_no = 1;
+ display_name = "XCAP SharedXDM Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x1020741E;
+ version_no = 1;
+ display_name = "XCAP RlsServicesApplication Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10275080;
+ version_no = 1;
+ display_name = "XCAP ResourceLists Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10275081;
+ version_no = 1;
+ display_name = "XCAP IetfCommonPolicy Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10275082;
+ version_no = 1;
+ display_name = "XCAP OmaCommonPolicy Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10275083;
+ version_no = 1;
+ display_name = "XCAP IetfPresenceRules Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ },
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x102750AB;
+ version_no = 1;
+ display_name = "XCAP OmaPresenceRules Application Usage||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data ="";
+ },
+ // PRES-CONTENT STARTS
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x20028701;
+ version_no = 1;
+ display_name = "XCAP Pres-Content Application Usage||Copyright © 2008 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data ="";
+ }
+ // PRES-CONTENT ENDS
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapAppUsage/src/XcapAppUsage.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,756 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapAppUsage
+*
+*/
+
+
+
+
+
+// INCLUDE FILES
+#ifdef _DEBUG
+#include <flogger.h>
+#endif
+
+#include <implementationproxy.h>
+
+#include "XcapAppUsageDef.h"
+
+#include "XcapDirectoryUsage.h"
+#include "XcapCapabilityUsage.h"
+#include "XcapPocGroupUsage.h"
+#include "XcapPocUserAccessUsage.h"
+#include "XcapSharedXDMUsage.h"
+#include "XcapRlsServicesUsage.h"
+#include "XcapResourceListsUsage.h"
+#include "XcapIetfCommonPolicyUsage.h"
+#include "XcapOmaCommonPolicyUsage.h"
+#include "XcapIetfPresRulesUsage.h"
+#include "XcapOmaPresRulesUsage.h"
+// Add the header of the new app usage here
+// #include "XcapTestAppUsage.h"
+// PRES-CONTENT STARTS
+#include "XcapC4.h"
+// PRES-CONTENT ENDS
+
+#include <XdmErrors.h>
+#include <XdmProtocolUidList.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XcapUriInterface.h"
+
+
+
+// CONSTANTS
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KXdmCapabilityUsageUid, CXcapCapabilityUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmDirectoryUsageUid, CXcapDirectoryUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmPocGroupUsageUid, CXcapPocGroupUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmPocUserAccessUsageUid, CXcapPocUserAccessUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmSharedXDMUsageUid, CXcapSharedXDMUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmRlsServicesUsageUid, CXcapRlsServicesUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmResourceListsUsageUid, CXcapResourceListsUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmIetfCommonPolicyUsageUid, CXcapIetfCommonPolicyUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmOmaCommonPolicyUsageUid, CXcapOmaCommonPolicyUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmIetfPresRulesUsageUid, CXcapIetfPresRulesUsage::NewL ),
+ IMPLEMENTATION_PROXY_ENTRY( KXdmOmaPresRulesUsageUid, CXcapOmaPresRulesUsage::NewL ),
+ // add new usages here
+ // IMPLEMENTATION_PROXY_ENTRY( KXdmTestAppUsageUid, CXcapTestAppUsage::NewL ),
+// PRES-CONTENT STARTS
+ IMPLEMENTATION_PROXY_ENTRY( KXdmUsageUid, CXcapC4::NewL )
+// PRES-CONTENT ENDS
+#else
+ { { KXdmCapabilityUsageUid }, CXcapCapabilityUsage::NewL },
+ { { KXdmDirectoryUsageUid }, CXcapDirectoryUsage::NewL },
+ { { KXdmPocGroupUsageUid }, CXcapPocGroupUsage::NewL },
+ { { KXdmPocUserAccessUsageUid }, CXcapPocUserAccessUsage::NewL },
+ { { KXdmSharedXDMUsageUid }, CXcapSharedXDMUsage::NewL },
+ { { KXdmRlsServicesUsageUid }, CXcapRlsServicesUsage::NewL },
+ { { KXdmResourceListsUsageUid }, CXcapResourceListsUsage::NewL },
+ { { KXdmIetfCommonPolicyUsageUid }, CXcapIetfCommonPolicyUsage::NewL },
+ { { KXdmOmaCommonPolicyUsageUid }, CXcapOmaCommonPolicyUsage::NewL },
+ { { KXdmIetfPresRulesUsageUid }, CXcapIetfPresRulesUsage::NewL },
+ { { KXdmOmaPresRulesUsageUid }, CXcapOmaPresRulesUsage::NewL },
+ // add new usages here
+ // { { KXdmTestAppUsageUid }, CXcapTestAppUsage::NewL },
+// PRES-CONTENT STARTS
+ { { KXdmUsageUid }, CXcapC4::NewL }
+// PRES-CONTENT ENDS
+#endif
+ };
+
+// ----------------------------------------------------
+// ImplementationGroupProxy
+//
+// ----------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
+
+// ----------------------------------------------------
+// CXcapAppUsage::CXcapAppUsage
+//
+// ----------------------------------------------------
+//
+CXcapAppUsage::CXcapAppUsage( const CXdmEngine& aXdmEngine ) :
+iXdmEngine( CONST_CAST( CXdmEngine&, aXdmEngine ) ),
+iAddNamespaces( EFalse ),
+iNsToNodeSelector( EFalse ),
+iAddNsAttributes( EFalse ),
+iIsGetOrDelete( EFalse )
+ {
+#ifdef _NAMESPACES_TO_NODE_SELECTOR
+ iNsToNodeSelector = ETrue;
+#endif
+
+#ifdef _ADD_NAMESPACE_ATTRIBUTES
+ iAddNsAttributes = ETrue;
+#endif
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::~CXcapAppUsage
+//
+// ----------------------------------------------------
+//
+CXcapAppUsage::~CXcapAppUsage()
+ {
+ REComSession::DestroyedImplementation( iDestructorKey );
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::NewL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapAppUsage* CXcapAppUsage::NewL( const CXdmEngine& aXdmEngine,
+ const TInt aDocumentType )
+ {
+ TAny* ptr = NULL;
+ TXcapAppUsageParams params( aXdmEngine );
+ switch( aDocumentType )
+ {
+ case KXdmCapabilityUsageUid:
+ case KXdmDirectoryUsageUid:
+ case KXdmTestAppUsageUid:
+ case KXdmPocGroupUsageUid:
+ case KXdmPocUserAccessUsageUid:
+ case KXdmSharedXDMUsageUid:
+ case KXdmRlsServicesUsageUid:
+ case KXdmResourceListsUsageUid:
+ case KXdmIetfCommonPolicyUsageUid:
+ case KXdmOmaCommonPolicyUsageUid:
+ case KXdmIetfPresRulesUsageUid:
+ case KXdmOmaPresRulesUsageUid:
+ case KXdmUsageUid:
+ {
+ TUid KImplementationUid = { aDocumentType };
+ ptr = REComSession::CreateImplementationL(
+ KImplementationUid,
+ _FOFF( CXcapAppUsage, iDestructorKey ),
+ ( TAny* )¶ms );
+ }
+ break;
+
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ return reinterpret_cast<CXcapAppUsage*>( ptr );
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::Validate
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXcapAppUsage::Validate( CXdmDocument& aXdmDocument, TBool aAddNamespaces )
+ {
+ iAddNamespaces = aAddNamespaces;
+ iIsGetOrDelete = EFalse;
+ // catch leaves here and return the error code
+ TInt error ( KErrNone );
+ TRAP( error, DoValidateL( aXdmDocument ) );
+ // add namespace information for outgoing document
+ if ( error == KErrNone && iAddNamespaces )
+ {
+ aXdmDocument.ResetNamespaces();
+ TRAP( error, AddNamespaceInformationL( aXdmDocument ) );
+ }
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::Validate document returns %d" ), error );
+#endif
+ return error;
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::Validate
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXcapAppUsage::Validate( CXdmDocumentNode& aXdmNode,
+ MXcapUriInterface* aUriInterface,
+ TBool aIsGetOrDelete )
+ {
+ iAddNamespaces = ETrue;
+ iIsGetOrDelete = aIsGetOrDelete;
+ ResetUsedNamespaces();
+ // catch leaves here and return the error code
+ TInt error( KErrNone );
+ TRAP( error, DoValidateL( aXdmNode ) );
+
+ // add namespace if defined
+ if ( error == KErrNone && iAddNsAttributes )
+ {
+ TRAP( error, CreateNamespaceAttributesL( aXdmNode, aUriInterface ) );
+ }
+
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::Validate node returns %d" ), error );
+#endif
+ return error;
+ }
+
+
+// ----------------------------------------------------
+// CXcapAppUsage::DoValidateL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::DoValidateL( CXdmDocumentNode& aXdmNode )
+ {
+ // call method from derived class
+ ValidateNodeL( aXdmNode );
+
+ // go through all attributes
+ TInt attrCount( aXdmNode.AttributeCount() );
+ for ( TInt i( 0 ); i < attrCount; i++ )
+ {
+ CXdmNodeAttribute* attr = aXdmNode.Attribute( i );
+ ValidateAttributeL( *attr );
+ }
+
+ // go through all descendants
+ TInt count( aXdmNode.NodeCount( ) );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ DoValidateL ( *aXdmNode.ChileNode( i ) );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::DoValidateL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::DoValidateL ( CXdmDocument& aXdmDocument )
+ {
+ DoValidateL( *aXdmDocument.DocumentRoot() );
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::ValidateDataL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::ValidateDataL ( TDataType aDataType, TDesC8& aData )
+ {
+ if ( iIsGetOrDelete )
+ {
+ return;
+ }
+ switch ( aDataType )
+ {
+ case EDataTypeString:
+ {
+ // TODO
+ }
+ break;
+ case EDataTypeNonNegativeInteger:
+ {
+ TInt value( 0 );
+ TLex8 lex( aData );
+ lex.Val( value );
+ if ( value < 0 )
+ {
+ User::Leave( KXcapErrorIllegalDataValue );
+ }
+ }
+ break;
+ case EDataTypeAnyURI:
+ {
+ // TODO
+ }
+ break;
+ case EDataTypeDateTime:
+ {
+ // TODO
+ }
+ break;
+ case EDataTypeBoolean:
+ {
+ if ( aData.CompareF( KXdmTrue )
+ && aData.CompareF( KXdmFalse )
+ && aData.CompareF( KXdmZero )
+ && aData.CompareF( KXdmOneNbr ) )
+ {
+ User::Leave( KXcapErrorIllegalDataValue );
+ }
+ }
+ break;
+ case EDataTypeToken:
+ {
+ // elements that are using datatype token
+ // scheme, class, occurence-id
+ }
+ break;
+ case EDataTypeEmpty:
+ {
+ if ( aData.Length() > 0 )
+ {
+ User::Leave( KXcapErrorIllegalDataValue );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::ValidateDataL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::ValidateDataL ( TDataType aDataType, CXdmDocumentNode& aXdmNode )
+ {
+ TPtrC8 data = aXdmNode.LeafNodeContent();
+ ValidateDataL( aDataType, data );
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::ValidateDataL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::ValidateDataL ( TDataType aDataType, const CXdmNodeAttribute& aXdmNodeAttr )
+ {
+ HBufC8* dataBuf = aXdmNodeAttr.EightBitValueLC(); // << dataBuf
+ TPtrC8 data = dataBuf->Des();
+ ValidateDataL( aDataType, data );
+ CleanupStack::PopAndDestroy( dataBuf ); // >>> dataBuf
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::SetPrefixL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::SetPrefixL( CXdmDocumentNode& aXdmNode, const TDesC8& aPrefix )
+ {
+ if ( iAddNamespaces )
+ {
+ aXdmNode.SetPrefixL( aPrefix );
+ AddUsedNamespace( aPrefix );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::AddUsedNamespace
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::AddUsedNamespace( const TDesC8& aPrefix )
+ {
+ // rl
+ if ( Match( aPrefix, KXdmResourceListsNsPrefix ) )
+ {
+ iRL = ETrue;
+ }
+ // cr
+ else if ( Match( aPrefix, KXdmIetfCommonPolicyNsPrefix ) )
+ {
+ iCR = ETrue;
+ }
+ // cp
+ else if ( Match( aPrefix, KXdmOmaCommonPolicyNsPrefix ) )
+ {
+ iCP = ETrue;
+ }
+ // pr
+ else if ( Match( aPrefix, KXdmIetfPresRulesNsPrefix ) )
+ {
+ iPR = ETrue;
+ }
+ // ls
+ else if ( Match( aPrefix, KXdmPocGroupNsPrefix ) )
+ {
+ iLS = ETrue;
+ }
+ // poc
+ else if ( Match( aPrefix, KXdmPocUserAccessNsPrefix ) )
+ {
+ iPOC = ETrue;
+ }
+ // opr
+ else if ( Match( aPrefix, KXdmOmaPresRulesNsPrefix ) )
+ {
+ iOPR = ETrue;
+ }
+ // rls
+ else if ( Match( aPrefix, KXdmRlsServicesNsPrefix ) )
+ {
+ iRLS = ETrue;
+ }
+ // ou
+ else if ( Match( aPrefix, KXdmSharedXDMUriUsageNsPrefix ) )
+ {
+ iOU = ETrue;
+ }
+ // add new prefix definitions here
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::ResetUsedNamespaces
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::ResetUsedNamespaces()
+ {
+ iRL = EFalse;
+ iCR = EFalse;
+ iCP = EFalse;
+ iPR = EFalse;
+ iLS = EFalse;
+ iPOC = EFalse;
+ iOPR = EFalse;
+ iRLS = EFalse;
+ iOU = EFalse;
+ // add new prefix definitions here
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::AppendUsedNamespacesL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::AppendUsedNamespacesL( MXcapUriInterface* aUriInterface )
+ {
+ if( iRL )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmResourceListsNamespace, KXdmResourceListsNsPrefix );
+ }
+ if( iCR )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmIetfCommonPolicyNamespace, KXdmIetfCommonPolicyNsPrefix );
+ }
+ if( iCP )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmOmaCommonPolicyNamespace, KXdmOmaCommonPolicyNsPrefix );
+ }
+ if( iPR )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmIetfPresRulesNamespace, KXdmIetfPresRulesNsPrefix );
+ }
+ if( iLS )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmPocGroupNamespace, KXdmPocGroupNsPrefix );
+ }
+ if( iPOC )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmPocUserAccessNamespace, KXdmPocUserAccessNsPrefix );
+ }
+ if( iOPR )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmOmaPresRulesNamespace, KXdmOmaPresRulesNsPrefix );
+ }
+ if( iRLS )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmRlsServicesNamespace, KXdmRlsServicesNsPrefix );
+ }
+ if( iOU )
+ {
+ aUriInterface->AddNamespaceMappingL( KXdmSharedXDMUriUsageNamespace, KXdmSharedXDMUriUsageNsPrefix );
+ }
+ // add new prefix definitions here
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::CreateNamespaceAttributesL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::CreateNamespaceAttributesL( CXdmDocumentNode& aXdmNode, MXcapUriInterface* aUriInterface )
+ {
+ // First remove all existing xmlns attributes
+ RemoveNamespaceAttributesL( aXdmNode );
+
+ TPtrC8 nameSpace;
+ TPtrC8 prefix = aXdmNode.Prefix();
+
+ // if the root node belongs to the default namespace,
+ // it's enough that we add attribute for it and also
+ // attributes for all other used namespaces
+ if ( Match( prefix, KNullDesC8 ) )
+ {
+ CXdmNodeAttribute* ns = aXdmNode.CreateAttributeL( KXdmDefaultNsAttrName );
+ ns->SetAttributeValueL( DefaultNamespace() );
+ AppendNamespaceAttributesL( aXdmNode );
+
+ if ( iNsToNodeSelector )
+ {
+ //aUriInterface->AddNamespaceMappingL( DefaultNamespace(), KNullDesC8 );
+ CXdmDocumentNode* parent = aXdmNode.Parent();
+ while ( parent )
+ {
+ AddUsedNamespace ( parent->Prefix() );
+ parent = parent->Parent();
+ }
+ AppendUsedNamespacesL( aUriInterface );
+ }
+ // we are done
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::CreateNamespaceAttributesL root belongs to default" ) );
+#endif
+ return;
+ }
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::CreateNamespaceAttributesL root doesn't belong to default" ) );
+#endif
+ // if the default namespace is used in fragment,
+ // the attribute for it has to be added
+ if ( DefaultNamespaceUsed( aXdmNode ) )
+ {
+ CXdmNodeAttribute* ns = aXdmNode.CreateAttributeL( KXdmDefaultNsAttrName );
+ ns->SetAttributeValueL( DefaultNamespace() );
+ }
+ // finally, create new xmlns attributes
+ AppendNamespaceAttributesL( aXdmNode );
+ if ( iNsToNodeSelector )
+ {
+ //aUriInterface->AddNamespaceMappingL( DefaultNamespace(), KNullDesC8 );
+ CXdmDocumentNode* parent = aXdmNode.Parent();
+ while ( parent )
+ {
+ AddUsedNamespace ( parent->Prefix() );
+ parent = parent->Parent();
+ }
+ AppendUsedNamespacesL( aUriInterface );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::RemoveNamespaceAttributesL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::RemoveNamespaceAttributesL( CXdmDocumentNode& aXdmNode )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::RemoveNamespaceAttributesL begin" ) );
+#endif
+ // go through all attributes
+ for ( TInt i( aXdmNode.AttributeCount() - 1 ); i > KErrNotFound; i-- )
+ {
+ CXdmNodeAttribute* attr = aXdmNode.Attribute( i );
+ if ( attr->NodeName().FindF( KXdmDefaultNsAttrName ) != KErrNotFound )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::RemoveNamespaceAttributesL AttrCount=%d i=%d" ), aXdmNode.AttributeCount(), i );
+#endif
+ aXdmNode.RemoveChileNodeL( attr );
+ }
+ }
+
+ // go through all descendants
+ TInt count( aXdmNode.NodeCount( ) );
+ for ( TInt i(0); i < count; i++ )
+ {
+ RemoveNamespaceAttributesL ( *aXdmNode.ChileNode( i ) );
+ }
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::RemoveNamespaceAttributesL done" ) );
+#endif
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::DefaultNamespaceUsed
+//
+// ----------------------------------------------------
+//
+TBool CXcapAppUsage::DefaultNamespaceUsed( CXdmDocumentNode& aXdmNode )
+ {
+ if ( Match( aXdmNode.Prefix(), KNullDesC8 ) )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::DefaultNamespaceUsed returns true" ) );
+#endif
+ return ETrue;
+ }
+ // go through all descendants
+ TInt count( aXdmNode.NodeCount( ) );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ if ( DefaultNamespaceUsed ( *aXdmNode.ChileNode( i ) ) )
+ {
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::DefaultNamespaceUsed returns true" ) );
+#endif
+ return ETrue;
+ }
+ }
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::DefaultNamespaceUsed returns false" ) );
+#endif
+ return EFalse;
+ }
+// ----------------------------------------------------
+// CXcapAppUsage::AppendNamespaceAttributesL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::AppendNamespaceAttributesL( CXdmDocumentNode& aXdmNode )
+ {
+ if( iRL )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmResourceListsNsPrefix, KXdmResourceListsNamespace );
+ }
+ if( iCR )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmIetfCommonPolicyNsPrefix, KXdmIetfCommonPolicyNamespace );
+ }
+ if( iCP )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmOmaCommonPolicyNsPrefix, KXdmOmaCommonPolicyNamespace );
+ }
+ if( iPR )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmIetfPresRulesNsPrefix, KXdmIetfPresRulesNamespace );
+ }
+ if( iLS )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmPocGroupNsPrefix, KXdmPocGroupNamespace );
+ }
+ if( iPOC )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmPocUserAccessNsPrefix, KXdmPocUserAccessNamespace );
+ }
+ if( iOPR )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmOmaPresRulesNsPrefix, KXdmOmaPresRulesNamespace );
+ }
+ if( iRLS )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmRlsServicesNsPrefix, KXdmRlsServicesNamespace );
+ }
+ if( iOU )
+ {
+ CreateNamespaceAttributeL( aXdmNode, KXdmSharedXDMUriUsageNsPrefix, KXdmSharedXDMUriUsageNamespace );
+ }
+ // add new prefix definitions here
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::AppendNamespaceAttributesL done" ) );
+#endif
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::CreateNamespaceAttributeL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::CreateNamespaceAttributeL( CXdmDocumentNode& aXdmNode, const TDesC8& aPrefix, const TDesC8& aNamespace )
+ {
+ TBuf8<KXdmMaxPrefixLength> name;
+ name.Copy( KXdmNonDefaultNsAttrName );
+ name.Append( aPrefix );
+ HBufC8* attrName = name.AllocLC(); // << attrName
+ CXdmNodeAttribute* ns = aXdmNode.CreateAttributeL( );
+ CleanupStack::PushL( ns ); // << ns
+ ns->SetNameL( *attrName );
+ ns->SetAttributeValueL( aNamespace );
+ CleanupStack::Pop( ns ); // >> ns
+ CleanupStack::PopAndDestroy(); // >>> attrName
+#ifdef _DEBUG
+ WriteToLog( _L8( "CXcapAppUsage::CreateNamespaceAttributeL done" ) );
+#endif
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::Match
+//
+// ----------------------------------------------------
+//
+TBool CXcapAppUsage::Match( const TDesC& aLeft, const TDesC& aRight )
+ {
+ if ( !aLeft.CompareF( aRight ) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::Match
+//
+// ----------------------------------------------------
+//
+TBool CXcapAppUsage::Match( const TDesC8& aLeft, const TDesC8& aRight )
+ {
+ if ( !aLeft.CompareF( aRight ) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ----------------------------------------------------
+// CXcapAppUsage::LeaveWithErrorL
+//
+// ----------------------------------------------------
+//
+void CXcapAppUsage::LeaveWithErrorL( TInt aErrorCode )
+ {
+ if ( !iIsGetOrDelete )
+ {
+ User::Leave( aErrorCode );
+ }
+ }
+
+
+// ----------------------------------------------------
+// CXcapAppUsage::WriteToLog
+// _DEBUG only
+// ----------------------------------------------------
+//
+#ifdef _DEBUG
+void CXcapAppUsage::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KAppUsageLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KXdmAppUsageLogDir, KXdmAppUsageLogFile, EFileLoggingModeAppend, buf );
+ }
+#endif
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/BWINSCW/XcapCacheClientU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+ ??0RXcapCache@@QAE@XZ @ 1 NONAME ; RXcapCache::RXcapCache(void)
+ ??1RXcapCache@@QAE@XZ @ 2 NONAME ; RXcapCache::~RXcapCache(void)
+ ?Connect@RXcapCache@@QAEHXZ @ 3 NONAME ; int RXcapCache::Connect(void)
+ ?Delete@RXcapCache@@QAEHABVTDesC16@@ABVTDesC8@@@Z @ 4 NONAME ; int RXcapCache::Delete(class TDesC16 const &, class TDesC8 const &)
+ ?FetchDocumentContent@RXcapCache@@QAEXAAVTDes8@@ABVTDesC16@@ABVTDesC8@@@Z @ 5 NONAME ; void RXcapCache::FetchDocumentContent(class TDes8 &, class TDesC16 const &, class TDesC8 const &)
+ ?FetchDocumentInfo@RXcapCache@@QAEHAAVTDes8@@ABVTDesC16@@ABVTDesC8@@AAVTCacheEntryInfo@@@Z @ 6 NONAME ; int RXcapCache::FetchDocumentInfo(class TDes8 &, class TDesC16 const &, class TDesC8 const &, class TCacheEntryInfo &)
+ ?Flush@RXcapCache@@QAEXXZ @ 7 NONAME ; void RXcapCache::Flush(void)
+ ?IsCurrent@RXcapCache@@QAEHABVTDesC8@@ABVTDesC16@@0@Z @ 8 NONAME ; int RXcapCache::IsCurrent(class TDesC8 const &, class TDesC16 const &, class TDesC8 const &)
+ ?Store@RXcapCache@@QAEXABVTDesC8@@ABVTDesC16@@00@Z @ 9 NONAME ; void RXcapCache::Store(class TDesC8 const &, class TDesC16 const &, class TDesC8 const &, class TDesC8 const &)
+ ?Version@RXcapCache@@QBE?AVTVersion@@XZ @ 10 NONAME ; class TVersion RXcapCache::Version(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/eabi/XcapCacheClientU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+ _ZN10RXcapCache17FetchDocumentInfoER5TDes8RK7TDesC16RK6TDesC8R15TCacheEntryInfo @ 1 NONAME
+ _ZN10RXcapCache20FetchDocumentContentER5TDes8RK7TDesC16RK6TDesC8 @ 2 NONAME
+ _ZN10RXcapCache5FlushEv @ 3 NONAME
+ _ZN10RXcapCache5StoreERK6TDesC8RK7TDesC16S2_S2_ @ 4 NONAME
+ _ZN10RXcapCache6DeleteERK7TDesC16RK6TDesC8 @ 5 NONAME
+ _ZN10RXcapCache7ConnectEv @ 6 NONAME
+ _ZN10RXcapCache9IsCurrentERK6TDesC8RK7TDesC16S2_ @ 7 NONAME
+ _ZN10RXcapCacheC1Ev @ 8 NONAME
+ _ZN10RXcapCacheC2Ev @ 9 NONAME
+ _ZN10RXcapCacheD1Ev @ 10 NONAME
+ _ZN10RXcapCacheD2Ev @ 11 NONAME
+ _ZNK10RXcapCache7VersionEv @ 12 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/group/XcapCacheClient.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCacheClient.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcapcacheclient.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10207413
+VENDORID VID_DEFAULT
+CAPABILITY CAP_CLIENT_DLL
+
+SOURCEPATH ../src
+USERINCLUDE ../../inc
+
+SOURCE XcapCache.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+DEBUGLIBRARY flogger.lib
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../BWINSCW/
+#elif defined (WINS )
+ deffile ../bwins/
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCacheClient bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XcapCacheClient.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/src/XcapCache.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RXcapCache
+*
+*/
+
+
+
+#include "XcapCache.h"
+#include "CommonDefines.h"
+
+
+//CLASS DECLARATION
+EXPORT_C RXcapCache::RXcapCache() : iConnected( EFalse )
+ {
+ }
+
+// ----------------------------------------------------
+// RXcapCache::Store
+//
+// ----------------------------------------------------
+//
+EXPORT_C void RXcapCache::Store( const TDesC8& aETag,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation,
+ const TDesC8& aResponseData )
+ {
+ SendReceive( EXcapCacheStore, TIpcArgs( &aDocumentName, &aRootLocation, &aETag, &aResponseData ) );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::Delete
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt RXcapCache::Delete( const TDesC& aDocumentName,
+ const TDesC8& aRootLocation )
+ {
+ TCacheEntryInfo entryInfo;
+ entryInfo.iRootUri = CONST_CAST( TDesC8*, &aRootLocation );
+ entryInfo.iDocumentUri = CONST_CAST( TDesC*, &aDocumentName );
+ TPckgC<TCacheEntryInfo> package( entryInfo );
+ return SendReceive( EXcapCacheDelete, TIpcArgs( &package ) );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::FetchDocumentInfo
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt RXcapCache::FetchDocumentInfo( TDes8& aETagDescriptor,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation,
+ TCacheEntryInfo& aEntryInfo )
+ {
+ TPckg<TCacheEntryInfo> package( aEntryInfo );
+ return SendReceive( EXcapCacheFetchInfo, TIpcArgs( &package, &aETagDescriptor,
+ &aDocumentName, &aRootLocation ) );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::FetchDocumentContent
+//
+// ----------------------------------------------------
+//
+EXPORT_C void RXcapCache::FetchDocumentContent( TDes8& aContentDescriptor,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation )
+ {
+ SendReceive( EXcapCacheFetchData, TIpcArgs(
+ &aDocumentName, &aRootLocation, &aContentDescriptor ) );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::IsCurrent
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt RXcapCache::IsCurrent( const TDesC8& aETag,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation )
+ {
+ return SendReceive( EXcapCacheCheckValidity, TIpcArgs(
+ &aETag, &aDocumentName, &aRootLocation ) );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::Flush
+//
+// ----------------------------------------------------
+//
+EXPORT_C void RXcapCache::Flush()
+ {
+ SendReceive( EXcapCacheFlush );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::Version
+//
+// ----------------------------------------------------
+//
+EXPORT_C TVersion RXcapCache::Version() const
+ {
+ return TVersion( KCacheServerMajorVersionNumber,
+ KCacheServerMinorVersionNumber,
+ KCacheServerBuildVersionNumber );
+ }
+
+// ----------------------------------------------------
+// RXcapCache::~RXcapCache
+//
+// ----------------------------------------------------
+//
+EXPORT_C RXcapCache::~RXcapCache()
+ {
+ }
+
+// ----------------------------------------------------
+// RXcapCache::Connect()
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt RXcapCache::Connect()
+ {
+ TInt ret = KErrNone;
+ if( !iConnected )
+ {
+ ret = StartServer();
+ if( ret == KErrNone || ret == KErrAlreadyExists )
+ {
+ ret = CreateSession( KXcapCacheServerLib, Version(), KTTDefaultMessageSlots );
+ iConnected = ( ret == KErrNone );
+ }
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------
+// RXcapCache::StartServer
+//
+// ----------------------------------------------------
+//
+TInt RXcapCache::StartServer()
+ {
+ TInt ret = KErrNone;
+ TRequestStatus status = KRequestPending;
+ if ( !IsRunning() )
+ {
+ RProcess server;
+ ret = server.Create( KXcapCacheServerExe, KNullDesC );
+ if( ret != KErrNone )
+ return ret;
+ server.Rendezvous( status );
+ status != KRequestPending ? server.Kill( 0 ) : server.Resume();
+ //Wait for start or death
+ User::WaitForRequest( status );
+ ret = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
+ server.Close();
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------
+// RXcapCache::IsRunning
+//
+// ----------------------------------------------------
+//
+TBool RXcapCache::IsRunning()
+ {
+ TFindServer findServer( KXcapCacheServerName );
+ TFullName name;
+ return ( findServer.Next( name ) == KErrNone );
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Client/src/XcapCacheClient.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheClient
+*
+*/
+
+
+
+#include <e32std.h>
+#include "XcapCache.h"
+#include "CommonDefines.h"
+#include "XcapCacheClient.h"
+
+//CLASS DECLARATION
+CXcapCacheClient::CXcapCacheClient( RXcapCache& aCacheMain ) :
+ CActive( EPriorityStandard ),
+ iClientMain( aCacheMain )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------
+// CXcapCacheClient::Store
+//
+// ----------------------------------------------------
+//
+void CXcapCacheClient::Reset()
+ {
+ #ifdef _DEBUG
+ RXcapCache::WriteToLog( _L8( "CXcapCacheClient::Reset()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CXcapCacheClient::SendMessageL
+//
+// ----------------------------------------------------
+//
+void CXcapCacheClient::ReceiveAsync( TRequestStatus& aStatus )
+ {
+ iClientStatus = &aStatus;
+ aStatus = KRequestPending;
+ SetActive();
+ }
+
+// ----------------------------------------------------
+// CXcapCacheClient::RunL
+//
+// ----------------------------------------------------
+//
+void CXcapCacheClient::RunL()
+ {
+
+ }
+
+// ----------------------------------------------------
+// CXcapCacheClient::DoCancel
+//
+// ----------------------------------------------------
+//
+void CXcapCacheClient::DoCancel()
+ {
+
+ }
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/BWINSCW/XcapCacheServerU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+ ?StartThread@CXcapCacheServer@@SAHXZ @ 1 NONAME ; int CXcapCacheServer::StartThread(void)
+ ?WriteToLog@CXcapCacheServer@@SAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 2 NONAME ; void CXcapCacheServer::WriteToLog(class TRefByValue<class TDesC8 const >, ...)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/eabi/XcapCacheServerU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+ _ZN16CXcapCacheServer10WriteToLogE11TRefByValueIK6TDesC8Ez @ 1 NONAME
+ _ZN16CXcapCacheServer11StartThreadEv @ 2 NONAME
+ _ZTI16CXcapCacheServer @ 3 NONAME ; #<TI>#
+ _ZTV16CXcapCacheServer @ 4 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/group/XcapCache.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCache.mmp
+* XcapCache.exe from XcapCache.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcapcache.exe
+TARGETTYPE exe
+UID 0 0x10207421
+CAPABILITY CAP_SERVER
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE XcapCacheIndex.cpp
+SOURCE XcapCacheServer.cpp
+SOURCE XcapCacheSession.cpp
+SOURCE XcapShutdownTimer.cpp
+SOURCE XcapCacheIndexAdmin.cpp
+SOURCE XcapCacheIndexEntry.cpp
+SOURCE XcapCacheServerMain.cpp
+SOURCE XcapCacheEntryProperty.cpp
+SOURCE XcapCacheIndexTableEntry.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY bafl.lib
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY flogger.lib
+LIBRARY centralrepository.lib
+
+EPOCSTACKSIZE 0x8000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCache bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XcapCache.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/ServerDefines.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XCapServerDefines
+*
+*/
+
+
+
+
+#ifndef __SERVERDEFINES_H__
+#define __SERVERDEFINES_H__
+
+#include <e32base.h>
+
+const TInt KPageFilePosSeparator = 32;
+_LIT8( KPageFileSeparator, " " );
+_LIT8( KIndexFileEndOfLine, "\r\n" );
+_LIT8( KIndexFileEndOfEntry, "\r\n\r\n" );
+_LIT8( KValuePropertySeparator, "=" );
+_LIT8( KValueFieldSeparator, ";" );
+
+//Array of characters available for random string creation
+const TInt KRandomStringCharArray[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x30, 0x31,
+ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
+ 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A };
+
+const TReal KDefaultCompression = 0.75;
+const TInt KRandStringLength = 20;
+const TInt KDateMaxSize = 100;
+const TInt KDateTimeMaxSize = 200;
+_LIT( KDateFormatFileName, "%1%2%3");
+_LIT( KTimeFormatFileName, "%H%T%S");
+_LIT( KCacheDateFormat, "%1-%2-%3");
+_LIT( KCacheTimeFormat, "%H:%T:%S");
+_LIT( KDateTimeFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S");
+
+
+
+#endif // #ifndef __SERVERDEFINES_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheEntryProperty.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheEntryProperty
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHEINDEXPROPERTY_H__
+#define __XCAPCACHEINDEXPROPERTY_H__
+
+// INCLUDES
+#include <e32std.h>
+#include "CommonDefines.h"
+
+//FORWARD DECLARATIONs
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheEntryProperty ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheEntryProperty* NewL( TInt aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt IntValue() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TTime TimeValue() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC DesValue16() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC8 DesValue8() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt Name() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheEntryProperty();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( const TDesC8& aPropertyValue );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheEntryProperty( TInt aPropertyName );
+
+ private: // Data
+
+ HBufC* iPropertyValue16;
+ HBufC8* iPropertyValue8;
+ const TInt iPropertyName;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheIndex.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndex
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHEINDEX_H__
+#define __XCAPCACHEINDEX_H__
+
+// INCLUDES
+#include <s32file.h>
+#include <e32std.h>
+#include "CommonDefines.h"
+
+//FORWARD DECLARATIONs
+class CXcapCacheIndexEntry;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheIndex ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns Cache Index
+ * @return Created Cache Index
+ */
+ static CXcapCacheIndex* NewL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static TInt Compare( const CXcapCacheIndexEntry& aFirst,
+ const CXcapCacheIndexEntry& aSecond );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt UpdateIndexL( const CXcapCacheIndexEntry* aEntry );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexEntry* Entry( TInt aIndex ) const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt EntryCount() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void SortEntriesL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void RemoveEntry( TInt aIndex );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void StoreCacheDataL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheIndex();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndex();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ RFile InitialiseIndexL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ReadEntriesL( TPtr8& aIndexData );
+
+ private: // Data
+
+ RPointerArray<CXcapCacheIndexEntry> iEntryList;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheIndexAdmin.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexAdmin
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHEINDEXADMIN_H__
+#define __XCAPCACHEINDEXADMIN_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <s32file.h>
+#include "CommonDefines.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONs
+class CXcapCacheIndexTableEntry;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheIndexAdmin ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexAdmin* NewL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void UpdateIndexTableL( TInt aIndex, const TCacheEntryInfo* aStorageHeader );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexTableEntry* FindL( TInt& aTableIndex,
+ const TDesC8& aRootUri,
+ const TDesC& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt ReadIndexL( const CXcapCacheIndexTableEntry& aEntry );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void RemoveTableIndex( TInt aIndex );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void StoreIndexTableL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheIndexAdmin();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexAdmin();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ RFile InitialisePageFileL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ReadEntriesL( TPtr8& aDataDesc );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexTableEntry* ParseOneEntryL( const TDesC8& aEntryData );
+
+ private: // Data
+
+ RPointerArray<CXcapCacheIndexTableEntry> iEntryList;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheIndexEntry.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexEntry
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHEINDEXENTRY_H__
+#define __XCAPCACHEINDEXENTRY_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <s32file.h>
+//#include "XcapCacheClient.h"
+
+//CONSTANTS
+const TUint KCacheEntryETag = 0;
+const TUint KCacheXmlSize = 1;
+const TUint KCacheXmlFile = 2;
+const TUint KCacheLastAccess = 3;
+const TUint KCacheLastModified = 4;
+
+//ENUMS
+enum TCacheIndexEntry
+ {
+ EEntryETag = KCacheEntryETag,
+ EEntryXmlSize = KCacheXmlSize,
+ EEntryXmlFile = KCacheXmlFile,
+ EEntryLastAccess = KCacheLastAccess,
+ EEntryLastModified = KCacheLastModified
+ };
+
+//Specifies the cache file "protocol"
+const TText8* const KCacheEntryArray[] = { _S8( "etag" ),
+ _S8( "size" ),
+ _S8( "file" ),
+ _S8( "access" ),
+ _S8( "modify" )
+ };
+
+//FORWARD DECLARATIONs
+class CXcapCacheEntryProperty;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheIndexEntry ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexEntry* NewL( const TCacheEntryInfo* aHeader );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexEntry* NewL( TPtr8& aEntryData );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void UpdateEntryL( const TCacheEntryInfo* aHeader );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TTime LastAccess() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TTime LastModified() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt XmlSize() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC8 ETag() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC8 FileNameL() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC FileName16L() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ HBufC8* PrintLC() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheIndexEntry();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( const TCacheEntryInfo* aHeader );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( TPtr8& aEntryData );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexEntry();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheEntryProperty* CreatePropertyL( const TInt aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void CreateFromHeaderL( const TCacheEntryInfo* aHeader );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ const CXcapCacheEntryProperty& FindProperty( const TInt aPropId ) const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt FindPropNameId( const TDesC8& aNameString ) const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ HBufC8* HourStringLC();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void DeleteFileL( const TDesC8& aFileName );
+
+ /**
+ * Second-phase constructor.
+ */
+ HBufC8* StoreXmlFileLC( const TDesC8& aXmlData );
+
+ private: // Data
+
+ RPointerArray<CXcapCacheEntryProperty> iPropertyList;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheIndexTableEntry.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexTableEntry
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHEINDEXTABLEENTRY_H__
+#define __XCAPCACHEINDEXTABLEENTRY_H__
+
+// INCLUDES
+#include <e32std.h>
+#include "CommonDefines.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONs
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheIndexTableEntry ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexTableEntry* NewL( const TInt aEntryIndex,
+ const TDesC8& aRootUri,
+ const TDesC& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexTableEntry* NewL( const TInt aEntryIndex,
+ const TDesC8& aRootUri,
+ const TDesC8& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CXcapCacheIndexTableEntry* NewL( const TDesC8& aRootUri,
+ const TDesC& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC8 RootUri() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TPtrC8 DocumentUri() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void Increase();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void Decrease();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TBool operator==( const CXcapCacheIndexTableEntry& aEntry ) const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt Index() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheIndexTableEntry();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexTableEntry();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( const TDesC8& aRootUri,
+ const TDesC& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( const TDesC8& aRootUri,
+ const TDesC8& aDocumentUri );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheIndexTableEntry( const TInt aEntryIndex );
+
+ private: // Data
+
+ TInt iEntryIndex;
+ HBufC8* iRootUri;
+ HBufC8* iDocumentUri;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheServer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheServer
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHESERVER_H__
+#define __XCAPCACHESERVER_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <s32file.h>
+#include "ServerDefines.h"
+#include "CommonDefines.h"
+#include "XcapShutdownTimer.h"
+
+//CONSTANTS
+_LIT( KCacheServerRoot, "C:\\private\\10207421\\" );
+_LIT( KCacheServerIndex, "C:\\private\\10207421\\index.ch" );
+_LIT( KCacheServerPageFile, "C:\\private\\10207421\\pagefile.ch" );
+_LIT( KCacheServerIndexF, "index.ch" );
+_LIT( KCacheServerPageFileF, "pagefile.ch" );
+
+_LIT( KCacheServerLogDir, "XDM" );
+_LIT( KCacheServerLogFile, "CacheServer.txt" );
+const TUint KAppDefaultHeapSize = 0x10000;
+
+//FORWARD DECLARATIONs
+class CXcapCacheIndex;
+class CXcapCacheIndexAdmin;
+
+// CLASS DECLARATION
+class CXcapCacheServer : public CServer2
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Returns KErrNone
+ * @return TInt System wide error code
+ */
+ IMPORT_C static TInt StartThreadL();
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ IMPORT_C static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ static CServer2* NewLC( void );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ virtual CSession2* NewSessionL( const TVersion& aVersion,
+ const RMessage2& /*aMessage*/ ) const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ RFs* Session();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt CacheSize( TInt& aEntryCount );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ TInt MaxCacheSize() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ ~CXcapCacheServer();
+
+ public: //static
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static RFs& FileSession();
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static CXcapCacheIndex* Index();
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static CXcapCacheIndexAdmin* IndexAdmin();
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static TInt ConvertDesc( const TDesC8& aNumberDesc );
+
+ /**
+ * A function to handle descriptor data.
+ * @return Date in heap descriptor
+ */
+ static HBufC* DateL();
+
+ /**
+ * A function to handle descriptor data.
+ * @return Time in heap descriptor
+ */
+ static HBufC* TimeL();
+
+ /**
+ * A function to handle descriptor data.
+ * @return Random string heap descriptor
+ */
+ static HBufC* RandomStringL();
+
+ /**
+ * A function to handle descriptor data.
+ * @return Date and time heap descriptor
+ */
+ static HBufC* DateTimeL();
+
+ /**
+ * A function to handle descriptor data.
+ * @return Date and time heap descriptor
+ */
+ static HBufC* DateTimeL( const TTime& aTime );
+
+ /**
+ * A function to handle descriptor data.
+ * @param aCommand command to be handled
+ */
+ static TPtr8 DescriptorCast( const TDesC8& aConstData );
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapCacheServer( TInt aPriority );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ReadMaxCacheSizeL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void AddSession();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void DropSession();
+
+ private: // Data
+
+ RFs iFileSession;
+ TInt iMaxCacheSize;
+ TUint iSessionCount;
+ CDir* iCacheDirectory;
+ CXcapShutdownTimer iShutdownTimer;
+ friend class CXcapCacheSession;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheServerMain.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCacheServerMain
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHESERVERMAIN_H__
+#define __XCAPCACHESERVERMAIN_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+
+class CXcapCacheIndex;
+class CXcapCacheIndexAdmin;
+
+RFs FsSession;
+CXcapCacheIndex* CacheIndex = NULL;
+CXcapCacheIndexAdmin* CacheIndexAdmin = NULL;
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapCacheSession.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheSession
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHESESSION_H__
+#define __XCAPCACHESESSION_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <e32cons.h>
+#include <s32file.h>
+#include <e32base.h>
+#include "XcapCacheServer.h"
+
+class MDesC16Array;
+class CXcapCacheIndex;
+class CXcapCacheIndexAdmin;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapCacheSession ) : public CSession2
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor
+ *
+ * @param CXcapCacheServer Pointer to the server object
+ * @return CXcapCacheSession* New session object
+ */
+ static CXcapCacheSession* NewL( CXcapCacheServer* aServer );
+
+ /**
+ * Service a request
+ *
+ * @param RMessage& Kernel message
+ * @return void
+ */
+ virtual void ServiceL ( const RMessage2& aMessage );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapCacheSession();
+
+ private:
+
+ /**
+ * Second-phase constructor
+ *
+ * @return void
+ */
+ void ConstructL();
+
+ /**
+ * C++ default constructor is private.
+ *
+ * @param CXcapCacheServer Pointer to the server object
+ * @return CXcapCacheSession New session object
+ */
+ CXcapCacheSession( CXcapCacheServer* aServer );
+
+ /**
+ * Check the capabilities of the connecting client
+ *
+ * @param RMessage2& Kernel message
+ * @return TBool Does the client have proper capabilities
+ */
+ TBool Capabilities( const RMessage2& aMessage );
+
+ /**
+ * Panic the client
+ *
+ * @param TInt Panic code
+ * @return void
+ */
+ void PanicClient( TInt aPanic );
+
+ /**
+ * Dispatch the client's request
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void DispatchMessageL( const RMessage2& aMessage );
+
+ /**
+ * Fetch the meta information for a document
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void FetchDocumentInfoL( const RMessage2& aMessage );
+
+ /**
+ * Fetch the contents of a document
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void FetchDocumentContentsL( const RMessage2& aMessage );
+
+ /**
+ * Store a document
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void CacheXcapDataL( const RMessage2& aMessage );
+
+ /**
+ * Delete a document from the cache
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void DeleteCacheDataL( const RMessage2& aMessage );
+
+ /**
+ * Check the currency of a document
+ *
+ * @param RMessage2& Kernel message
+ * @return void
+ */
+ void CheckValidityL( const RMessage2& aMessage );
+
+ /**
+ * Externalize the meta information
+ *
+ * @return void
+ */
+ void FlushCacheDataL();
+
+ /**
+ * Delete unindexed documents from the cache
+ *
+ * @param MDesC16Array Indexed documents
+ * @return void
+ */
+ void DeleteExcessL( const MDesC16Array& aIndexedEntries );
+
+ /**
+ * Check for unindexed entries in the cache
+ *
+ * @param TInt Total number of documents in the cache
+ * @return void
+ */
+ void CheckUnindexedEntriesL( TInt aTotalCount );
+
+ /**
+ * Check whether the "aFileName" document is indexed
+ *
+ * @param MDesC16Array& The indexed entries
+ * @param TDesC& Name of the dile to be checked
+ * @return TBool Is the document indexed
+ */
+ TBool IsIndexed( const MDesC16Array& aIndexedEntries, const TDesC& aFileName );
+
+ /**
+ * Read the specified parameter from the kernel message
+ *
+ * @param TInt The parameter to be read
+ * @param RMessage2& Kernel message
+ * @return HBufC* The parameter data (16-bit)
+ */
+ HBufC* ReadMsgParam16LC( TInt aMsgIndex, const RMessage2& aMessage );
+
+ /**
+ * Read the specified parameter from the kernel message
+ *
+ * @param TInt The parameter to be read
+ * @param RMessage2& Kernel message
+ * @return HBufC8* The parameter data (8-bit)
+ */
+ HBufC8* ReadMsgParam8LC( TInt aMsgIndex, const RMessage2& aMessage );
+
+ /**
+ * Check the temporary buffer for data
+ *
+ * @return void
+ */
+ void CheckTempBuffer();
+
+ /**
+ * Delete a named document from the store
+ *
+ * @param TDesC& Name of the document to be deleted
+ * @return TInt Error code
+ */
+ TInt DeleteFromStorageL( const TDesC& aFileName );
+
+ /**
+ * Read a named document from the store
+ *
+ * @param TDesC& Name of the document to be deleted
+ * @return HBufC* The contents of the document
+ */
+ HBufC8* ReadFromStorageL( const TDesC& aFileName );
+
+ private: //Data
+
+ HBufC8* iTempBuffer;
+ CFileMan* iFileManager;
+ CXcapCacheServer* iCacheServer;
+ CXcapCacheIndex& iCacheIndex;
+ CXcapCacheIndexAdmin& iCacheIndexAdmin;
+ };
+
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/inc/XcapShutdownTimer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapShutdownTimer
+*
+*/
+
+
+
+
+#ifndef __XCAPSHUTDOWNTIMER__
+#define __XCAPSHUTDOWNTIMER__
+
+NONSHARABLE_CLASS( CXcapShutdownTimer ) : public CTimer
+ {
+ public:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXcapShutdownTimer();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void Start();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void RunL();
+
+ private:
+
+ enum { KXcapCacheShutdownDelay = 0x200000 };
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheEntryProperty.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheEntryPropertyProperty from XcapCacheIndexProperty.cpp
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapCacheServer.h"
+#include "XcapCacheEntryProperty.h"
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::CXcapCacheEntryProperty
+//
+// ----------------------------------------------------------
+//
+CXcapCacheEntryProperty::CXcapCacheEntryProperty( TInt aPropertyName ) :
+ iPropertyName( aPropertyName )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheEntryProperty* CXcapCacheEntryProperty::NewL( TInt aPropertyName,
+ const TDesC8& aPropertyValue )
+ {
+ CXcapCacheEntryProperty* self = new( ELeave ) CXcapCacheEntryProperty( aPropertyName );
+ CleanupStack::PushL( self );
+ self->ConstructL( aPropertyValue );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheEntryProperty::ConstructL( const TDesC8& aPropertyValue )
+ {
+ iPropertyValue8 = aPropertyValue.AllocL();
+ iPropertyValue16 = HBufC::NewL( aPropertyValue.Length() );
+ iPropertyValue16->Des().Copy( aPropertyValue );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::~CXcapCacheEntryProperty
+//
+// ----------------------------------------------------------
+//
+CXcapCacheEntryProperty::~CXcapCacheEntryProperty()
+ {
+ delete iPropertyValue8;
+ delete iPropertyValue16;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheEntryProperty::Name() const
+ {
+ return iPropertyName;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheEntryProperty::IntValue() const
+ {
+ return CXcapCacheServer::ConvertDesc( iPropertyValue8->Des() );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+TTime CXcapCacheEntryProperty::TimeValue() const
+ {
+ TTime ret;
+ ret.Parse( iPropertyValue16->Des() );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+TPtrC CXcapCacheEntryProperty::DesValue16() const
+ {
+ return iPropertyValue16 != NULL ? iPropertyValue16->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheEntryProperty::ConstructL
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapCacheEntryProperty::DesValue8() const
+ {
+ return iPropertyValue8 != NULL ? iPropertyValue8->Des() : TPtrC8();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheIndex.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndex
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "ServerDefines.h"
+#include "XcapCacheIndex.h"
+#include "XcapCacheServer.h"
+#include "XcapCacheIndexEntry.h"
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::CXcapCacheIndex
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndex::CXcapCacheIndex()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndex* CXcapCacheIndex::NewL()
+ {
+ CXcapCacheIndex* self = new( ELeave ) CXcapCacheIndex();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndex::ConstructL()
+ {
+ TInt length = 0;
+ RFile index = InitialiseIndexL();
+ CleanupClosePushL( index );
+ User::LeaveIfError( index.Size( length ) );
+ if( length > 0 )
+ {
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 pointer( data->Des() );
+ User::LeaveIfError( index.Read( pointer ) );
+ ReadEntriesL( pointer );
+ CleanupStack::PopAndDestroy(); //data
+ }
+ CleanupStack::PopAndDestroy(); //index
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::InitialiseIndexL
+//
+// ----------------------------------------------------------
+//
+RFile CXcapCacheIndex::InitialiseIndexL()
+ {
+ RFile ret;
+ TUid process = RProcess().Identity();
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheIndex::InitialiseIndexL() - Process: %x" ), process ) ;
+ #endif
+ TInt error = ret.Open( CXcapCacheServer::FileSession(), KCacheServerIndex,
+ EFileShareExclusive | EFileRead | EFileWrite );
+ if( error != KErrNone )
+ {
+ if( error == KErrPathNotFound )
+ User::LeaveIfError( CXcapCacheServer::FileSession().MkDirAll( KCacheServerRoot ) );
+ User::LeaveIfError( ret.Create( CXcapCacheServer::FileSession(), KCacheServerIndex,
+ EFileShareExclusive | EFileRead | EFileWrite ) );
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::~CXcapCacheIndex
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndex::~CXcapCacheIndex()
+ {
+ iEntryList.ResetAndDestroy();
+ iEntryList.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::ConstructL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheIndex::UpdateIndexL( const CXcapCacheIndexEntry* aEntry )
+ {
+ if( aEntry != NULL )
+ {
+ User::LeaveIfError( iEntryList.Append( aEntry ) );
+ return iEntryList.Find( aEntry );
+ }
+ else return KErrNotFound;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::Entry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexEntry* CXcapCacheIndex::Entry( TInt aIndex ) const
+ {
+ TInt count = iEntryList.Count();
+ CXcapCacheIndexEntry* entry = NULL;
+ if( count > 0 && aIndex >= 0 && aIndex < count )
+ entry = iEntryList[aIndex];
+ return entry;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::EntryCount
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheIndex::EntryCount() const
+ {
+ return iEntryList.Count();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::Compare
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheIndex::Compare( const CXcapCacheIndexEntry& aFirst,
+ const CXcapCacheIndexEntry& aSecond )
+ {
+ if( aFirst.LastModified() == aSecond.LastModified() )
+ return 0;
+ else if( aFirst.LastModified() > aSecond.LastModified() )
+ return 1;
+ else return -1;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::SortEntries
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndex::SortEntriesL()
+ {
+ TLinearOrder<CXcapCacheIndexEntry> order( CXcapCacheIndex::Compare );
+ iEntryList.Sort( order );
+ #ifdef _DEBUG
+ TPtrC8 entryDesc;
+ TInt count = iEntryList.Count();
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheIndex::SortEntriesL()" ) );
+ CXcapCacheServer::WriteToLog( _L8( "------------------------------------------" ) );
+ CXcapCacheServer::WriteToLog( _L8( " Sorted list:" ) );
+ for( TInt i = 0;i < count;i++ )
+ {
+ HBufC* buffer = NULL;
+ buffer = CXcapCacheServer::DateTimeL( iEntryList[i]->LastModified() );
+ TBuf8<KDateTimeMaxSize> printBuffer( _L8( " " ) );
+ printBuffer.AppendFormat( _L8( "%d: " ), i );
+ printBuffer.Append( *buffer );
+ CXcapCacheServer::WriteToLog( printBuffer );
+ }
+ CXcapCacheServer::WriteToLog( _L8( "------------------------------------------" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::RemoveEntry
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndex::RemoveEntry( TInt aIndex )
+ {
+ TInt count = iEntryList.Count();
+ if( count > 0 && aIndex >= 0 && aIndex < count )
+ {
+ CXcapCacheIndexEntry* entry = iEntryList[aIndex];
+ iEntryList.Remove( aIndex );
+ delete entry;
+ entry = NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::ReadEntriesL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndex::ReadEntriesL( TPtr8& aIndexData )
+ {
+ TBool finished = EFalse;
+ while( !finished && aIndexData.Length() > 0 )
+ {
+ //If we find that there is still more data, but no \r\n
+ //to denote the end of an entry, simply quit. The data
+ //format has most probably been corrupted at some point.
+ TInt entryIndex = aIndexData.FindF( KIndexFileEndOfLine );
+ if( entryIndex > 0 )
+ {
+ TPtr8 entryData = CXcapCacheServer::DescriptorCast(
+ aIndexData.Left( entryIndex ) );
+ CXcapCacheIndexEntry* entry = CXcapCacheIndexEntry::NewL( entryData );
+ CleanupStack::PushL( entry );
+ User::LeaveIfError( iEntryList.Append( entry ) );
+ CleanupStack::Pop();
+ aIndexData.Delete( 0, entryIndex + 2 );
+ }
+ else finished = ETrue;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndex::StoreCacheDataL()
+ {
+ RFile index;
+ TInt count = iEntryList.Count();
+ if( count > 0 )
+ {
+ User::LeaveIfError( index.Replace( CXcapCacheServer::FileSession(),
+ KCacheServerIndex, EFileWrite ) );
+ CleanupClosePushL( index );
+ for( TInt i = 0;i < count;i++ )
+ {
+ CXcapCacheIndexEntry* entry = iEntryList[i];
+ HBufC8* entryData = entry->PrintLC();
+ if( entryData )
+ {
+ User::LeaveIfError( index.Write( entryData->Des() ) );
+ CleanupStack::PopAndDestroy(); //entryData
+ }
+ }
+ CleanupStack::PopAndDestroy(); //index
+ }
+ else
+ {
+ CFileMan* manager = CFileMan::NewL( CXcapCacheServer::FileSession() );
+ manager->Delete( KCacheServerIndex );
+ delete manager;
+ manager = NULL;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheIndexAdmin.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexAdmin
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "ServerDefines.h"
+#include "XcapCacheServer.h"
+#include "XcapCacheIndexAdmin.h"
+#include "XcapCacheIndexTableEntry.h"
+
+// ----------------------------------------------------------
+// CXcapCacheIndexAdmin::CXcapCacheIndexAdmin
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexAdmin::CXcapCacheIndexAdmin()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexAdmin::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexAdmin* CXcapCacheIndexAdmin::NewL()
+ {
+ CXcapCacheIndexAdmin* self = new( ELeave ) CXcapCacheIndexAdmin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexAdmin::~CXcapCacheIndexAdmin
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexAdmin::~CXcapCacheIndexAdmin()
+ {
+ iEntryList.ResetAndDestroy();
+ iEntryList.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexAdmin::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexAdmin::ConstructL()
+ {
+ TInt length = 0;
+ RFile indexTable = InitialisePageFileL();
+ CleanupClosePushL( indexTable );
+ User::LeaveIfError( indexTable.Size( length ) );
+ if( length > 0 )
+ {
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 pointer( data->Des() );
+ User::LeaveIfError( indexTable.Read( pointer ) );
+ ReadEntriesL( pointer );
+ CleanupStack::PopAndDestroy(); //data
+ }
+ CleanupStack::PopAndDestroy(); //index
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndex::InitialisePageFileL
+//
+// ----------------------------------------------------------
+//
+RFile CXcapCacheIndexAdmin::InitialisePageFileL()
+ {
+ RFile ret;
+ TInt error = ret.Open( CXcapCacheServer::FileSession(), KCacheServerPageFile,
+ EFileShareExclusive | EFileRead | EFileWrite );
+ //No need to check the path at this time, because needed
+ //directories have already been created by the CacheIndex
+ //object if they didn't exist before the server was launched
+ if( error != KErrNone )
+ User::LeaveIfError( ret.Create( CXcapCacheServer::FileSession(), KCacheServerPageFile,
+ EFileShareExclusive | EFileRead | EFileWrite ) );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexAdmin::UpdateIndexTableL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexAdmin::UpdateIndexTableL( TInt aIndex, const TCacheEntryInfo* aHeader )
+ {
+ CXcapCacheIndexTableEntry* entry =
+ CXcapCacheIndexTableEntry::NewL( aIndex, *aHeader->iRootUri,
+ *aHeader->iDocumentUri );
+ CleanupStack::PushL( entry );
+ User::LeaveIfError( iEntryList.Append( entry ) );
+ CleanupStack::Pop(); //entry
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ReadIndexL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheIndexAdmin::ReadIndexL( const CXcapCacheIndexTableEntry& aEntry )
+ {
+ TBool found = EFalse;
+ TInt ret = KErrNotFound;
+ TInt count = iEntryList.Count();
+ CXcapCacheIndexTableEntry* entry = NULL;
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ entry = iEntryList[i];
+ if( *entry == aEntry )
+ {
+ ret = entry->Index();
+ found = ETrue;
+ }
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::FindL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry* CXcapCacheIndexAdmin::FindL( TInt& aTableIndex,
+ const TDesC8& aRootUri,
+ const TDesC& aDocumentUri )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheIndexAdmin::FindL()" ) );
+ #endif
+ TBool found = EFalse;
+ TInt count = iEntryList.Count();
+ CXcapCacheIndexTableEntry* entry = NULL;
+ if( count > 0 )
+ {
+ CXcapCacheIndexTableEntry* newEntry = CXcapCacheIndexTableEntry::NewL(
+ aRootUri, aDocumentUri );
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ CXcapCacheIndexTableEntry* listEntry = iEntryList[i];
+ if( *newEntry == *listEntry )
+ {
+ aTableIndex = i;
+ entry = iEntryList[i];
+ found = ETrue;
+ }
+ }
+ delete newEntry;
+ newEntry = NULL;
+ }
+ return entry;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::RemoveTableIndexL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexAdmin::RemoveTableIndex( TInt aIndex )
+ {
+ TInt count = iEntryList.Count();
+ if( count > 0 && aIndex >= 0 && aIndex < count )
+ {
+ CXcapCacheIndexTableEntry* entry = iEntryList[aIndex];
+ iEntryList.Remove( aIndex );
+ delete entry;
+ entry = NULL;
+ for( TInt i = aIndex;i < count - 1;i++ )
+ {
+ CXcapCacheIndexTableEntry* z = iEntryList[i];
+ z->Decrease();
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::StoreIndexTableL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexAdmin::StoreIndexTableL()
+ {
+ RFile indexTable;
+ TInt count = iEntryList.Count();
+ if( count > 0 )
+ {
+ TBuf8<7> numBuf;
+ User::LeaveIfError( indexTable.Replace( CXcapCacheServer::FileSession(),
+ KCacheServerPageFile, EFileWrite ) );
+ CleanupClosePushL( indexTable );
+ for( TInt i = 0;i < count;i++ )
+ {
+ numBuf.AppendNum( iEntryList[i]->Index() );
+ indexTable.Write( iEntryList[i]->RootUri() );
+ indexTable.Write( KValueFieldSeparator );
+ indexTable.Write( iEntryList[i]->DocumentUri() );
+ indexTable.Write( KPageFileSeparator );
+ indexTable.Write( numBuf );
+ indexTable.Write( KIndexFileEndOfLine );
+ numBuf.Zero();
+ }
+ CleanupStack::PopAndDestroy(); //indexTable
+ }
+ else
+ {
+ CFileMan* manager = CFileMan::NewL( CXcapCacheServer::FileSession() );
+ manager->Delete( KCacheServerPageFile );
+ delete manager;
+ manager = NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::UpdatePageFileL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexAdmin::ReadEntriesL( TPtr8& aDataDesc )
+ {
+ TBool finished = EFalse;
+ while( !finished && aDataDesc.Length() > 0 )
+ {
+ //If we find that there is still more data, but no \r\n
+ //to denote the end of an entry, simply quit. The data
+ //format has most probably been corrupted at some point.
+ TInt entryIndex = aDataDesc.FindF( KIndexFileEndOfLine );
+ if( entryIndex > 0 )
+ {
+ TPtrC8 one = aDataDesc.Left( entryIndex );
+ CXcapCacheIndexTableEntry* entry = ParseOneEntryL( one );
+ CleanupStack::PushL( entry );
+ User::LeaveIfError( iEntryList.Append( entry ) );
+ CleanupStack::Pop();
+ aDataDesc.Delete( 0, entryIndex + 2 );
+ }
+ else finished = ETrue;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ParseOneEntryL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry* CXcapCacheIndexAdmin::ParseOneEntryL( const TDesC8& aEntryData )
+ {
+ CXcapCacheIndexTableEntry* ret = NULL;
+ TInt rootIndex = aEntryData.FindF( KValueFieldSeparator );
+ if( rootIndex > 0 )
+ {
+ TPtrC8 root( aEntryData.Left( rootIndex ) );
+ TInt docIndex = aEntryData.FindF( KPageFileSeparator );
+ TPtrC8 doc( aEntryData.Mid( rootIndex + 1, docIndex - ( rootIndex + 1 ) ) );
+ TPtrC8 pos( aEntryData.Mid( docIndex + 1, aEntryData.Length() - ( docIndex + 1 ) ) );
+ TInt index( CXcapCacheServer::ConvertDesc( pos ) );
+ ret = CXcapCacheIndexTableEntry::NewL( index, root, doc );
+ }
+ return ret;
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheIndexEntry.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexEntry
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "ServerDefines.h"
+#include "XcapCacheServer.h"
+#include "XcapCacheIndexEntry.h"
+#include "XcapCacheEntryProperty.h"
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::CXcapCacheIndexEntry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexEntry::CXcapCacheIndexEntry()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexEntry* CXcapCacheIndexEntry::NewL( const TCacheEntryInfo* aHeader )
+ {
+ CXcapCacheIndexEntry* self = new( ELeave ) CXcapCacheIndexEntry();
+ CleanupStack::PushL( self );
+ self->ConstructL( aHeader );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexEntry* CXcapCacheIndexEntry::NewL( TPtr8& aEntryData )
+ {
+ CXcapCacheIndexEntry* self = new( ELeave ) CXcapCacheIndexEntry();
+ CleanupStack::PushL( self );
+ self->ConstructL( aEntryData );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::~CXcapCacheIndexEntry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexEntry::~CXcapCacheIndexEntry()
+ {
+ iPropertyList.ResetAndDestroy();
+ iPropertyList.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexEntry::ConstructL( TPtr8& aEntryData )
+ {
+ while( aEntryData.Length() > 0 )
+ {
+ CXcapCacheEntryProperty* prop = NULL;
+ TInt index = aEntryData.FindF( KValueFieldSeparator );
+ if( index > 0 )
+ {
+ TPtrC8 propData = aEntryData.Left( index );
+ TInt separator = propData.FindF( KValuePropertySeparator );
+ if( separator > 0 )
+ {
+ TPtrC8 name = propData.Left( separator );
+ TPtrC8 value = propData.Right( propData.Length() - separator - 1 );
+ const TInt nameId = FindPropNameId( name );
+ __ASSERT_DEBUG( nameId != KErrNotFound, User::Leave( KErrCorrupt ) );
+ prop = CreatePropertyL( nameId, value );
+ CleanupStack::PushL( prop );
+ User::LeaveIfError( iPropertyList.Append( prop ) );
+ CleanupStack::Pop(); //prop
+ }
+ aEntryData.Delete( 0, index + 1 );
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexEntry::ConstructL( const TCacheEntryInfo* aHeader )
+ {
+ CreateFromHeaderL( aHeader );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::FindPropNameId
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheIndexEntry::FindPropNameId( const TDesC8& aNameString ) const
+ {
+ TBool found = EFalse;
+ TInt ret = KErrNotFound;
+ TInt arrayLength = sizeof( KCacheEntryArray ) /
+ sizeof( KCacheEntryArray[0] );
+ for( TInt i = 0;!found && i < arrayLength;i++ )
+ {
+ if( aNameString.CompareF( TPtrC8( KCacheEntryArray[i] ) ) == 0 )
+ {
+ ret = i;
+ found = ETrue;
+ }
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::UpdateEntryL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexEntry::UpdateEntryL( const TCacheEntryInfo* aHeader )
+ {
+ TTime access = LastAccess();
+ DeleteFileL( FileNameL() );
+ iPropertyList.ResetAndDestroy();
+ CreateFromHeaderL( aHeader );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::DeleteFileL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexEntry::DeleteFileL( const TDesC8& aFileName )
+ {
+ HBufC* buf = HBufC::NewLC( aFileName.Length() );
+ buf->Des().Copy( aFileName );
+ CFileMan* manager = CFileMan::NewL( CXcapCacheServer::FileSession() );
+ CleanupStack::PushL( manager );
+ TInt error = manager->Delete( buf->Des() );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::DeleteFileL() - Error: %d" ), error );
+ #endif
+ CleanupStack::PopAndDestroy( 2 ); //manager, buf
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::CreatePropertyL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheEntryProperty* CXcapCacheIndexEntry::CreatePropertyL( const TInt aPropertyName,
+ const TDesC8& aPropertyValue )
+ {
+ return CXcapCacheEntryProperty::NewL( aPropertyName, aPropertyValue );
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::FindProperty
+//
+// ---------------------------------------------------------
+//
+const CXcapCacheEntryProperty& CXcapCacheIndexEntry::FindProperty( const TInt aPropId ) const
+ {
+ TBool found = EFalse;
+ TInt count = iPropertyList.Count();
+ CXcapCacheEntryProperty* property = NULL;
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ property = iPropertyList[i];
+ if( property->Name() == aPropId )
+ found = ETrue;
+ }
+ return *property;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::LastAccess
+//
+// ---------------------------------------------------------
+//
+TTime CXcapCacheIndexEntry::LastAccess() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheLastAccess );
+ return property.TimeValue();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::LastModified
+//
+// ---------------------------------------------------------
+//
+TTime CXcapCacheIndexEntry::LastModified() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheLastModified );
+ return property.TimeValue();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::XmlSize
+//
+// ---------------------------------------------------------
+//
+TInt CXcapCacheIndexEntry::XmlSize() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheXmlSize );
+ return property.IntValue();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::FileNameL
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapCacheIndexEntry::FileNameL() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheXmlFile );
+ return property.DesValue8();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::FileName16L
+//
+// ---------------------------------------------------------
+//
+TPtrC CXcapCacheIndexEntry::FileName16L() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheXmlFile );
+ return property.DesValue16();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::ETag
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapCacheIndexEntry::ETag() const
+ {
+ const CXcapCacheEntryProperty& property = FindProperty( KCacheEntryETag );
+ return property.DesValue8();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::CreateFromHeaderL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexEntry::CreateFromHeaderL( const TCacheEntryInfo* aHeader )
+ {
+ TInt arrayLength = sizeof( KCacheEntryArray ) /
+ sizeof( KCacheEntryArray[0] );
+ HBufC8* hour = HourStringLC();
+ for( TInt i = 0;i < arrayLength;i++ )
+ {
+ CXcapCacheEntryProperty* prop = NULL;
+ switch( i )
+ {
+ case KCacheEntryETag:
+ prop = CreatePropertyL( KCacheEntryETag, *aHeader->iEtag );
+ break;
+ case KCacheXmlSize:
+ {
+ TBuf8<10> sizeBuf;
+ sizeBuf.AppendNum( aHeader->iDataLength );
+ prop = CreatePropertyL( KCacheXmlSize, sizeBuf );
+ }
+ break;
+ case KCacheXmlFile:
+ {
+ HBufC8* fileName = StoreXmlFileLC( *aHeader->iRespData );
+ prop = CreatePropertyL( KCacheXmlFile, fileName->Des() );
+ CleanupStack::PopAndDestroy(); //fileName
+ }
+ break;
+ case KCacheLastAccess:
+ prop = CreatePropertyL( KCacheLastAccess, hour->Des() );
+ break;
+ case KCacheLastModified:
+ prop = CreatePropertyL( KCacheLastModified, hour->Des() );
+ break;
+ default:
+ break;
+ }
+ if( prop != NULL )
+ User::LeaveIfError( iPropertyList.Append( prop ) );
+ }
+ CleanupStack::PopAndDestroy(); //hour
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::HourStringLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapCacheIndexEntry::HourStringLC()
+ {
+ HBufC8* hourString = NULL;
+ HBufC* date = CXcapCacheServer::DateL();
+ HBufC* time = CXcapCacheServer::TimeL();
+ hourString = HBufC8::NewLC( date->Length() + time->Length() + 1 );
+ TPtr8 pointer( hourString->Des() );
+ pointer.Copy( *date );
+ pointer.Append( KPageFileSeparator );
+ pointer.Append( *time );
+ delete date;
+ date = NULL;
+ delete time;
+ time = NULL;
+ return hourString;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::StoreXmlFileLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapCacheIndexEntry::StoreXmlFileLC( const TDesC8& aXmlData )
+ {
+ RFile file;
+ HBufC* nameBuf = NULL;
+ HBufC* randomString = NULL;
+ TPtrC randomName( _L( "" ) );
+ TInt error = KErrAlreadyExists;
+ //It is extremely unlikely that the random string generator
+ //creates two exact same patterns, but let's check for it, anyway.
+ while( error == KErrAlreadyExists )
+ {
+ randomString = CXcapCacheServer::RandomStringL();
+ randomName.Set( *randomString );
+ nameBuf = HBufC::NewLC( KCacheServerRoot().Length() + randomName.Length() );
+ nameBuf->Des().Copy( KCacheServerRoot );
+ nameBuf->Des().Append( randomName );
+ error = file.Create( CXcapCacheServer::FileSession(),
+ nameBuf->Des(), EFileWrite );
+ if( error != KErrNone )
+ CleanupStack::PopAndDestroy(); //nameBuf
+ }
+ file.Write( aXmlData );
+ file.Close();
+ __ASSERT_ALWAYS( nameBuf != NULL, User::Leave( KErrCorrupt ) );
+ HBufC8* ret = HBufC8::NewLC( nameBuf->Des().Length() );
+ ret->Des().Copy( nameBuf->Des() );
+ CleanupStack::Pop(); //ret
+ CleanupStack::PopAndDestroy(); //nameBuf
+ CleanupStack::PushL( ret );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexEntry::PrintLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapCacheIndexEntry::PrintLC() const
+ {
+ TInt position = 0;
+ CBufFlat* buffer = NULL;
+ HBufC8* entryString = NULL;
+ TInt count = iPropertyList.Count();
+ if( count > 0 )
+ {
+ buffer = CBufFlat::NewL( 50 );
+ CleanupStack::PushL( buffer );
+ for( TInt i = 0;i < count;i++ )
+ {
+ TPtrC8 name = TPtrC8( KCacheEntryArray[iPropertyList[i]->Name()] );
+ TPtrC8 value = iPropertyList[i]->DesValue8();
+ buffer->InsertL( position, name );
+ position = position + name.Length();
+ buffer->InsertL( position, KValuePropertySeparator );
+ position = position + KValuePropertySeparator().Length();
+ buffer->InsertL( position, value );
+ position = position + value.Length();
+ buffer->InsertL( position, KValueFieldSeparator );
+ position = position + KValueFieldSeparator().Length();
+ }
+ buffer->InsertL( position, KIndexFileEndOfLine );
+ TPtr8 pointer( buffer->Ptr( 0 ) );
+ entryString = HBufC8::NewL( pointer.Length() );
+ entryString->Des().Copy( pointer );
+ CleanupStack::PopAndDestroy(); //buffer
+ CleanupStack::PushL( entryString );
+ }
+ return entryString;
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheIndexTableEntry.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheIndexTableEntry
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "ServerDefines.h"
+#include "XcapCacheServer.h"
+#include "XcapCacheIndexTableEntry.h"
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::CXcapCacheIndexTableEntry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry::CXcapCacheIndexTableEntry() : iEntryIndex( KErrNotFound )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::CXcapCacheIndexTableEntry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry::CXcapCacheIndexTableEntry( const TInt aEntryIndex ) :
+ iEntryIndex( aEntryIndex )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry* CXcapCacheIndexTableEntry::NewL( const TInt aEntryIndex,
+ const TDesC8& aRootUri,
+ const TDesC& aDocumentUri )
+ {
+ CXcapCacheIndexTableEntry* self = new( ELeave ) CXcapCacheIndexTableEntry( aEntryIndex );
+ CleanupStack::PushL( self );
+ self->ConstructL( aRootUri, aDocumentUri );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry* CXcapCacheIndexTableEntry::NewL( const TInt aEntryIndex,
+ const TDesC8& aRootUri,
+ const TDesC8& aDocumentUri )
+ {
+ CXcapCacheIndexTableEntry* self = new( ELeave ) CXcapCacheIndexTableEntry( aEntryIndex );
+ CleanupStack::PushL( self );
+ self->ConstructL( aRootUri, aDocumentUri );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry* CXcapCacheIndexTableEntry::NewL( const TDesC8& aRootUri,
+ const TDesC& aDocumentUri )
+ {
+ CXcapCacheIndexTableEntry* self = new( ELeave ) CXcapCacheIndexTableEntry();
+ CleanupStack::PushL( self );
+ self->ConstructL( aRootUri, aDocumentUri );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::~CXcapCacheIndexTableEntry
+//
+// ----------------------------------------------------------
+//
+CXcapCacheIndexTableEntry::~CXcapCacheIndexTableEntry()
+ {
+ delete iRootUri;
+ delete iDocumentUri;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexTableEntry::ConstructL( const TDesC8& aRootUri,
+ const TDesC& aDocumentUri )
+ {
+ #ifdef _DEBUG
+ HBufC8* eightBuffer = HBufC8::NewLC( aDocumentUri.Length() );
+ TPtr8 desc( eightBuffer->Des() );
+ desc.Copy( aDocumentUri );
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheIndexTableEntry::ConstructL" ) );
+ CXcapCacheServer::WriteToLog( _L8( " Root: %S" ), &aRootUri );
+ CXcapCacheServer::WriteToLog( _L8( " Document: %S" ), &desc );
+ CleanupStack::PopAndDestroy(); //eightBuffer
+ #endif
+ iRootUri = aRootUri.AllocL();
+ iDocumentUri = HBufC8::NewL( aDocumentUri.Length() );
+ iDocumentUri->Des().Copy( aDocumentUri );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheIndexTableEntry::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheIndexTableEntry::ConstructL( const TDesC8& aRootUri,
+ const TDesC8& aDocumentUri )
+ {
+ #ifdef _DEBUG
+ HBufC8* eightBuffer = HBufC8::NewLC( aDocumentUri.Length() );
+ TPtr8 desc( eightBuffer->Des() );
+ desc.Copy( aDocumentUri );
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheIndexTableEntry::ConstructL" ) );
+ CXcapCacheServer::WriteToLog( _L8( " Root: %S" ), &aRootUri );
+ CXcapCacheServer::WriteToLog( _L8( " Document: %S" ), &desc );
+ CleanupStack::PopAndDestroy(); //eightBuffer
+ #endif
+ iRootUri = aRootUri.AllocL();
+ iDocumentUri = HBufC8::NewL( aDocumentUri.Length() );
+ iDocumentUri->Des().Copy( aDocumentUri );
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::EntryData
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapCacheIndexTableEntry::RootUri() const
+ {
+ return iRootUri != NULL ? iRootUri->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::EntryData
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapCacheIndexTableEntry::DocumentUri() const
+ {
+ return iDocumentUri != NULL ? iDocumentUri->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::EntryData
+//
+// ---------------------------------------------------------
+//
+void CXcapCacheIndexTableEntry::Increase()
+ {
+ iEntryIndex++;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::EntryData
+//
+// ---------------------------------------------------------
+//
+void CXcapCacheIndexTableEntry::Decrease()
+ {
+ iEntryIndex--;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::operator++
+//
+// ---------------------------------------------------------
+//
+TBool CXcapCacheIndexTableEntry::operator==( const CXcapCacheIndexTableEntry& aEntry ) const
+ {
+ return ( iRootUri != NULL && iDocumentUri != NULL ) &&
+ ( iRootUri->Des().CompareF( aEntry.RootUri() ) == 0 ) &&
+ ( iDocumentUri->Des().CompareF( aEntry.DocumentUri() ) == 0 );
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheIndexTableEntry::operator++
+//
+// ---------------------------------------------------------
+//
+TInt CXcapCacheIndexTableEntry::Index() const
+ {
+ return iEntryIndex;
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheServer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,387 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheServer
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32math.h>
+#include <flogger.h>
+#include <centralrepository.h>
+#include <XdmEngineDomainCRKeys.h>
+#include "XcapCacheIndex.h"
+#include "XcapCacheServer.h"
+#include "XcapCacheSession.h"
+#include "XcapCacheIndexAdmin.h"
+#include "XcapCacheServerMain.h"
+
+GLDEF_C void PanicServer( TXcapCacheServerPanic aPanic )
+ {
+ _LIT( KCacheServerPanic, "XcapCacheServer");
+ User::Panic( KCacheServerPanic, aPanic );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::New
+//
+// ----------------------------------------------------------
+//
+CServer2* CXcapCacheServer::NewLC()
+ {
+ CXcapCacheServer* self = new CXcapCacheServer( EPriorityHigh );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::New
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheServer::ConstructL()
+ {
+ ReadMaxCacheSizeL();
+ User::LeaveIfError( iFileSession.Connect() );
+ StartL( KXcapCacheServerLib );
+ iShutdownTimer.ConstructL();
+ iShutdownTimer.Start();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::NewSessionL
+//
+// ----------------------------------------------------------
+//
+CSession2* CXcapCacheServer::NewSessionL( const TVersion& aVersion,
+ const RMessage2& /*aMessage*/ ) const
+ {
+ // Check version number of API against our known version number.
+ TVersion thisVersion( KCacheServerMajorVersionNumber,
+ KCacheServerMinorVersionNumber,
+ KCacheServerBuildVersionNumber );
+ if( !User::QueryVersionSupported( thisVersion, aVersion ) )
+ User::Leave( KErrNotSupported );
+ return CXcapCacheSession::NewL( ( CXcapCacheServer* )this );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::CXcapCacheServer
+//
+// ----------------------------------------------------------
+//
+CXcapCacheServer::~CXcapCacheServer()
+ {
+ iFileSession.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::ReadMaxCacheSizeL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheServer::ReadMaxCacheSizeL()
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::ReadMaxCacheSizeL()" ) );
+ #endif
+ CRepository* repository = CRepository::NewL( KCRUIDXDMEngineXcapLocal );
+ CleanupStack::PushL( repository );
+ TInt error = repository->Get( KXDMXcapCacheSize, iMaxCacheSize );
+ //If something went wrong, just use 30 KB as a default value
+ if( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "Reading from CenRep failed: %d => Default to 30 KB" ), error );
+ #endif
+ iMaxCacheSize = 30000;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Max cache size is %d KB" ), iMaxCacheSize );
+ #endif
+ iMaxCacheSize = iMaxCacheSize * 1000;
+ }
+ CleanupStack::PopAndDestroy(); //repository
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::CXcapCacheServer
+//
+// ----------------------------------------------------------
+//
+CXcapCacheServer::CXcapCacheServer( TInt aPriority ) : CServer2( aPriority )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::AddSession
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheServer::AddSession()
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::AddSession()" ) );
+ #endif
+ ++iSessionCount;
+ iShutdownTimer.Cancel();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::DropSession
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheServer::DropSession()
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::DropSession()" ) );
+ #endif
+ if( --iSessionCount == 0 )
+ CActiveScheduler::Stop();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::ConvertDesc
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheServer::ConvertDesc( const TDesC8& aNumberDesc )
+ {
+ TInt ret = 0;
+ TLex8 lex( aNumberDesc );
+ TInt error = lex.Val( ret );
+ return error == KErrNone ? ret : error;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::DateL
+//
+// ---------------------------------------------------------
+//
+HBufC* CXcapCacheServer::DateL()
+ {
+ TTime time;
+ TBuf<KDateMaxSize> dateBuffer;
+ dateBuffer.SetLength( 0 );
+ time.HomeTime();
+ time.FormatL( dateBuffer, KCacheDateFormat );
+ HBufC* heapDate = dateBuffer.AllocL();
+ return heapDate;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::DateTimeL
+//
+// ---------------------------------------------------------
+//
+HBufC* CXcapCacheServer::DateTimeL()
+ {
+ TTime time;
+ TBuf<KDateMaxSize> dateBuffer;
+ time.HomeTime();
+ time.FormatL( dateBuffer, KDateFormatFileName );
+ TBuf<KDateMaxSize> timeBuffer;
+ time.HomeTime();
+ time.FormatL( timeBuffer, KTimeFormatFileName );
+ TBuf<KDateTimeMaxSize> buffer;
+ buffer.SetLength( 0 );
+ buffer.Copy( dateBuffer );
+ buffer.Append( timeBuffer );
+ HBufC* ret = HBufC::NewL( buffer.Length() );
+ ret->Des().Copy( buffer );
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::DateTimeL
+//
+// ---------------------------------------------------------
+//
+HBufC* CXcapCacheServer::DateTimeL( const TTime& aTime )
+ {
+ TBuf<KDateTimeMaxSize> dateTimeBuffer;
+ aTime.FormatL( dateTimeBuffer, KDateTimeFormat );
+ HBufC* heapDateTime = dateTimeBuffer.AllocL();
+ return heapDateTime;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheServer::MaxCacheSize
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheServer::MaxCacheSize() const
+ {
+ return iMaxCacheSize;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::CacheSize
+//
+// ---------------------------------------------------------
+//
+TInt CXcapCacheServer::CacheSize( TInt& aEntryCount )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::CacheSize()" ) );
+ #endif
+ TInt total = 0;
+ TInt entryCount = 0;
+ CDir* directory = NULL;
+ User::LeaveIfError( iFileSession.GetDir( KCacheServerRoot, KEntryAttNormal,
+ ESortNone, directory ) );
+ CleanupStack::PushL( directory );
+ entryCount = directory->Count();
+ for( TInt i = 0;i < entryCount;i++ )
+ total = total + ( *directory )[i].iSize;
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Entries: %d " ), entryCount );
+ CXcapCacheServer::WriteToLog( _L8( " Total size: %d bytes" ), total );
+ #endif
+ CleanupStack::PopAndDestroy();
+ aEntryCount = entryCount;
+ return total;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::RandomStringL
+//
+// ---------------------------------------------------------
+//
+HBufC* CXcapCacheServer::RandomStringL()
+ {
+ const TInt charCount( sizeof( KRandomStringCharArray ) / sizeof( TInt ) );
+ TBuf<KRandStringLength> buffer;
+ buffer.Zero();
+ for( TInt i = 0; i < KRandStringLength;i++ )
+ {
+ TInt index = Math::Random() % charCount;
+ buffer.Append( ( TChar )KRandomStringCharArray[index] );
+ }
+ HBufC* randomHeapBuffer = buffer.AllocL();
+ return randomHeapBuffer;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::TimeL
+//
+// ---------------------------------------------------------
+//
+HBufC* CXcapCacheServer::TimeL()
+ {
+ TTime time;
+ TBuf<KDateMaxSize> timeBuffer;
+ timeBuffer.SetLength( 0 );
+ time.HomeTime();
+ time.FormatL( timeBuffer, KCacheTimeFormat );
+ HBufC* heapTime = timeBuffer.AllocL();
+ return heapTime;
+ }
+
+// ---------------------------------------------------------
+// CXcapCacheServer::DescriptorCast
+//
+// ---------------------------------------------------------
+//
+TPtr8 CXcapCacheServer::DescriptorCast( const TDesC8& aConstData )
+ {
+ TInt length = aConstData.Length();
+ TPtr8 constCast( CONST_CAST( TUint8*, aConstData.Ptr() ), length, length );
+ constCast.TrimAll();
+ return constCast;
+ }
+
+// ----------------------------------------------------
+// CXcapCacheServer::FileSession
+//
+// ----------------------------------------------------
+//
+RFs& CXcapCacheServer::FileSession()
+ {
+ return FsSession;
+ }
+
+// ----------------------------------------------------
+// CXcapCacheServer::FileSession
+//
+// ----------------------------------------------------
+//
+CXcapCacheIndex* CXcapCacheServer::Index()
+ {
+ return CacheIndex;
+ }
+
+// ----------------------------------------------------
+// CXcapCacheServer::FileSession
+//
+// ----------------------------------------------------
+//
+CXcapCacheIndexAdmin* CXcapCacheServer::IndexAdmin()
+ {
+ return CacheIndexAdmin;
+ }
+
+// ----------------------------------------------------
+// CXcapCacheServer::StartThreadL
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXcapCacheServer::StartThreadL()
+ {
+ User::LeaveIfError( User::RenameThread( KXcapCacheServerName ) );
+ CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+ CleanupStack::PushL( scheduler );
+ CActiveScheduler::Install( scheduler );
+ User::LeaveIfError( FsSession.Connect() );
+ CleanupClosePushL( FsSession );
+ CXcapCacheServer::NewLC();
+ CacheIndex = CXcapCacheIndex::NewL();
+ CleanupStack::PushL( CacheIndex );
+ CacheIndexAdmin = CXcapCacheIndexAdmin::NewL();
+ CleanupStack::PushL( CacheIndexAdmin );
+ RProcess::Rendezvous( KErrNone );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "XcapCacheServer fully running" ) );
+ #endif
+ CActiveScheduler::Start();
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "XcapCacheServer closing..." ) );
+ #endif
+ CleanupStack::PopAndDestroy( 5 ); //CacheIndexAdmin, CacheIndex, server, FsSession, scheduler
+ return KErrNone;
+ }
+
+// ----------------------------------------------------
+// CXcapCacheServer::WriteToLog
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXcapCacheServer::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KServerLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KCacheServerLogDir, KCacheServerLogFile, EFileLoggingModeAppend, buf );
+ RDebug::RawPrint( buf );
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheServerMain.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCacheServerMain.cpp
+*
+*/
+
+
+
+#include "XcapCacheServer.h"
+
+// ----------------------------------------------------------
+// DeleteLogFiles
+//
+// ----------------------------------------------------------
+//
+TInt DeleteLogFileL()
+ {
+ RFs session;
+ TInt error = session.Connect();
+ if( error == KErrNone )
+ {
+ CFileMan* manager = CFileMan::NewL( session );
+ error = manager->Delete( _L( "C:\\logs\\XDM\\CacheServer.txt" ) );
+ session.Close();
+ delete manager;
+ manager = NULL;
+ }
+ return error;
+ }
+
+// ----------------------------------------------------------
+// E32Main
+//
+// ----------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ TInt error = KErrNoMemory;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ #ifdef _DEBUG
+ TRAPD( logErr, DeleteLogFileL() );
+ TBuf8<KMaxFileName> exe;
+ TFileName name( RProcess().FileName() );
+ exe.Copy( name );
+ CXcapCacheServer::WriteToLog( _L8( "*** E32Main(): Exe loaded from %S - Log deletion: %d"),
+ &exe, logErr );
+ #endif
+ if( cleanup )
+ {
+ TRAP( error, CXcapCacheServer::StartThreadL() );
+ delete cleanup;
+ }
+ __UHEAP_MARKEND;
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "*** E32Main() completes: %d" ), error );
+ #endif
+ return error;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapCacheSession.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,588 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapCacheSession
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <f32file.h>
+#include <badesca.h>
+#include "XcapCacheIndex.h"
+#include "XcapCacheSession.h"
+#include "XcapCacheIndexAdmin.h"
+#include "XcapCacheIndexEntry.h"
+#include "XcapCacheIndexTableEntry.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapCacheSession::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapCacheSession* CXcapCacheSession::NewL( CXcapCacheServer* aServer )
+ {
+ CXcapCacheSession* self = new( ELeave ) CXcapCacheSession( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::~CXcapCacheSession
+//
+// ----------------------------------------------------------
+//
+CXcapCacheSession::~CXcapCacheSession()
+ {
+ delete iFileManager;
+ //Reduce number of active clients within server
+ if( iCacheServer )
+ iCacheServer->DropSession();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ServiceL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::ServiceL( const RMessage2& aMessage )
+ {
+ TInt ret = KErrNone;
+ if( Capabilities( aMessage ) )
+ {
+ CheckTempBuffer();
+ TRAPD( err, DispatchMessageL( aMessage ) );
+ if( err != KErrNone )
+ ret = err;
+ }
+ else ret = KErrPermissionDenied;
+ aMessage.Complete( ret );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** Message completed - Error: %d" ), ret );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::Capabilities
+//
+// ----------------------------------------------------------
+//
+TBool CXcapCacheSession::Capabilities( const RMessage2& aMessage )
+ {
+ return aMessage.HasCapability( ECapabilityReadUserData ) &&
+ aMessage.HasCapability( ECapabilityWriteUserData );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::CheckTempBuffer
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::CheckTempBuffer()
+ {
+ if( iTempBuffer )
+ {
+ delete iTempBuffer;
+ iTempBuffer = NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::CXcapCacheSession
+//
+// ----------------------------------------------------------
+//
+CXcapCacheSession::CXcapCacheSession( CXcapCacheServer* aServer ) :
+ iCacheServer( aServer ),
+ iCacheIndex( *CXcapCacheServer::Index() ),
+ iCacheIndexAdmin( *CXcapCacheServer::IndexAdmin() )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::ConstructL()
+ {
+ iCacheServer->AddSession();
+ iFileManager = CFileMan::NewL( iCacheServer->FileSession() );
+ #ifdef _DEBUG
+ TInt count = 0;
+ iCacheServer->CacheSize( count );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::PanicClient
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::PanicClient( TInt aPanic )
+ {
+ _LIT( KTxtSessionPanic,"Test Server Session panic");
+ User::Panic( KTxtSessionPanic, aPanic );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::DispatchMessageL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::DispatchMessageL( const RMessage2& aMessage )
+ {
+ switch( aMessage.Function() )
+ {
+ case EXcapCacheFetchInfo:
+ FetchDocumentInfoL( aMessage );
+ break;
+ case EXcapCacheFetchData:
+ FetchDocumentContentsL( aMessage );
+ break;
+ case EXcapCacheStore:
+ {
+ TInt entryCount = 0;
+ CacheXcapDataL( aMessage );
+ TInt size = iCacheServer->CacheSize( entryCount );
+ CheckUnindexedEntriesL( entryCount );
+ //Recheck the size
+ size = iCacheServer->CacheSize( entryCount );
+ const TInt maxSize = iCacheServer->MaxCacheSize();
+ //If there's only one document filling the
+ //whole data area, there's not much to be done
+ //NOTE: Index & pagefile are always there => 3
+ if( size >= maxSize && entryCount > 3 )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Cache too large: %d bytes" ), size );
+ #endif
+ iCacheIndex.SortEntriesL();
+ const TInt compression( iCacheServer->MaxCacheSize() * KDefaultCompression );
+ //NOTE: Index & pagefile are always there -> 3
+ TBool ready = EFalse;
+ while( entryCount > 3 && size > compression && !ready )
+ {
+ //The entries have been sorted => FIFO
+ CXcapCacheIndexEntry* entry = iCacheIndex.Entry( 0 );
+ if( entry )
+ {
+ DeleteFromStorageL( entry->FileName16L() );
+ iCacheIndex.RemoveEntry( 0 );
+ iCacheIndexAdmin.RemoveTableIndex( 0 );
+ FlushCacheDataL();
+ size = iCacheServer->CacheSize( entryCount );
+ }
+ else ready = ETrue;
+ }
+ }
+ }
+ break;
+ case EXcapCacheDelete:
+ DeleteCacheDataL( aMessage );
+ break;
+ case EXcapCacheCheckValidity:
+ CheckValidityL( aMessage );
+ break;
+ case EXcapCacheFlush:
+ FlushCacheDataL();
+ break;
+ default:
+ PanicClient( EBadRequest );
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::CheckUnindexedEntriesL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::CheckUnindexedEntriesL( TInt aTotalCount )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheSession::CheckUnindexedEntriesL()" ) );
+ CXcapCacheServer::WriteToLog( _L8( " Total count: %d" ), aTotalCount );
+ #endif
+ const TInt indexed = iCacheIndex.EntryCount();
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Indexed entries: %d" ), indexed );
+ #endif
+ if( aTotalCount > indexed + 2 ) //index + pagefile = 2
+ {
+ CDesC16ArraySeg* array = new ( ELeave ) CDesC16ArraySeg( indexed );
+ CleanupStack::PushL( array );
+ array->AppendL( KCacheServerIndexF() );
+ array->AppendL( KCacheServerPageFileF() );
+ for( TInt i = 0;i < indexed;i++ )
+ {
+ const TChar delimiter = 92;
+ TPtrC temp( iCacheIndex.Entry( i )->FileName16L() );
+ TPtrC entry( temp.Right( temp.LocateReverse( delimiter ) + 1 ) );
+ array->AppendL( entry );
+ }
+ DeleteExcessL( *array );
+ array->Reset();
+ CleanupStack::PopAndDestroy(); //array
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::DeleteExcessL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::DeleteExcessL( const MDesC16Array& aIndexedEntries )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheSession::DeleteExcessL()" ) );
+ #endif
+ CDir* directory = NULL;
+ RFs& session = CXcapCacheServer::FileSession();
+ User::LeaveIfError( session.GetDir( KCacheServerRoot, KEntryAttNormal,
+ ESortNone, directory ) );
+ CleanupStack::PushL( directory );
+ const TInt count = directory->Count();
+ for( TInt i = 0;i < count;i++ )
+ {
+ TPtrC targetName( ( *directory )[i].iName );
+ if( !IsIndexed( aIndexedEntries, targetName ) )
+ {
+ HBufC* fileName = HBufC::NewLC( targetName.Length() +
+ KCacheServerRoot().Length() );
+ fileName->Des().Copy( KCacheServerRoot );
+ fileName->Des().Append( targetName );
+ TPtrC name( fileName->Des() );
+ User::LeaveIfError( iFileManager->Delete( name ) );
+ CleanupStack::PopAndDestroy(); //fileName
+ }
+ }
+ CleanupStack::PopAndDestroy(); //directory
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::IsIndexed
+//
+// ----------------------------------------------------------
+//
+TBool CXcapCacheSession::IsIndexed( const MDesC16Array& aIndexedEntries, const TDesC& aFileName )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheSession::IsIndexed()" ) );
+ #endif
+ TBool indexed = EFalse;
+ const TInt count = aIndexedEntries.MdcaCount();
+ for( TInt i = 0;!indexed && i < count;i++ )
+ {
+ if( aIndexedEntries.MdcaPoint( i ).Compare( aFileName ) == 0 )
+ {
+ indexed = ETrue;
+ }
+ }
+ return indexed;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ReadMsgParamLC
+//
+// ----------------------------------------------------------
+//
+HBufC* CXcapCacheSession::ReadMsgParam16LC( TInt aMsgIndex, const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::ReadMsgParam16LC()" ) );
+ #endif
+ TInt length = aMessage.GetDesLength( aMsgIndex );
+ HBufC* buffer = HBufC::NewLC( length );
+ TPtr descriptor( buffer->Des() );
+ aMessage.ReadL( aMsgIndex, descriptor );
+ return buffer;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::ReadMsgParam8LC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapCacheSession::ReadMsgParam8LC( TInt aMsgIndex, const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::ReadMsgParam8LC()" ) );
+ #endif
+ TInt length = aMessage.GetDesLength( aMsgIndex );
+ HBufC8* buffer = HBufC8::NewLC( length );
+ TPtr8 descriptor( buffer->Des() );
+ aMessage.ReadL( aMsgIndex, descriptor );
+ return buffer;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::CheckValidityL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::CheckValidityL( const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** CXcapCacheServer::CheckValidityL()" ) );
+ #endif
+ TPtrC8 etag( ReadMsgParam8LC( 0, aMessage )->Des() );
+ TPtrC name( ReadMsgParam16LC( 1, aMessage )->Des() );
+ TPtrC8 root( ReadMsgParam8LC( 2, aMessage )->Des() );
+ TInt tableIndex = KErrNotFound;
+ CXcapCacheIndexTableEntry* tableEntry = iCacheIndexAdmin.FindL( tableIndex, root, name );
+ if( tableEntry != NULL )
+ {
+ CXcapCacheIndexEntry* entry = iCacheIndex.Entry( tableEntry->Index() );
+ User::Leave( entry->ETag().Compare( etag ) == 0 ? KErrNone : KErrGeneral );
+ }
+ else User::Leave( KErrNotFound );
+ CleanupStack::PopAndDestroy( 3 ); //root, name, etag
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::DeleteCacheDataL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::DeleteCacheDataL( const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** CXcapCacheServer::DeleteCacheDataL()" ) );
+ #endif
+ TCacheEntryInfo header;
+ TPckg<TCacheEntryInfo> pack( header );
+ aMessage.ReadL( 0, pack );
+ TInt tableIndex = KErrNotFound;
+ CXcapCacheIndexTableEntry* tableEntry =
+ iCacheIndexAdmin.FindL( tableIndex, *header.iRootUri, *header.iDocumentUri );
+ if( tableEntry )
+ {
+ TInt error = KErrNone;
+ TInt index( tableEntry->Index() );
+ CXcapCacheIndexEntry* entry = iCacheIndex.Entry( index );
+ error = DeleteFromStorageL( entry->FileName16L() );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog(
+ _L8( "CXcapCacheSession::DeleteCacheDataL() - error: %d"), error );
+ #endif
+ iCacheIndex.RemoveEntry( index );
+ iCacheIndexAdmin.RemoveTableIndex( tableIndex );
+ FlushCacheDataL();
+ }
+ else User::Leave( KErrNotFound );
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::FetchDocumentInfoL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::FetchDocumentInfoL( const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** CXcapCacheServer::FetchDocumentInfoL()" ) );
+ #endif
+ TInt error = KErrNone;
+ //Read info header
+ TCacheEntryInfo header;
+ TPckg<TCacheEntryInfo> pack( header );
+ aMessage.ReadL( 0, pack );
+ TPtrC name( ReadMsgParam16LC( 2, aMessage )->Des() );
+ TPtrC8 root( ReadMsgParam8LC( 3, aMessage )->Des() );
+ TInt tableIndex = KErrNotFound;
+ #ifdef _DEBUG
+ HBufC8* temp = HBufC8::NewLC( name.Length() );
+ TPtr8 tempDesc( temp->Des() );
+ tempDesc.Copy( name );
+ CXcapCacheServer::WriteToLog( _L8( " Root: %S" ), &root );
+ CXcapCacheServer::WriteToLog( _L8( " Document: %S" ), &tempDesc );
+ CleanupStack::PopAndDestroy(); //temp
+ #endif
+ CXcapCacheIndexTableEntry* tableEntry = iCacheIndexAdmin.FindL( tableIndex, root, name );
+ if( tableEntry != NULL )
+ {
+ TInt index = tableEntry->Index();
+ CXcapCacheIndexEntry* entry = iCacheIndex.Entry( index );
+ TPtrC8 eTag = entry->ETag();
+ header.iDataLength = entry->XmlSize();
+ header.iLastAccess = entry->LastAccess();
+ header.iLastUpdate = entry->LastModified();
+ TPckgC<TCacheEntryInfo> package( header );
+ TRAP( error, aMessage.WriteL( 0, package ) );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Write header: %d" ), error );
+ #endif
+ TRAP( error, aMessage.WriteL( 1, eTag ) );
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( " Write ETag: %d" ), error );
+ #endif
+ }
+ else User::Leave( KErrNotFound );
+ CleanupStack::PopAndDestroy( 2 ); //root, name
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::FetchDocumentContentsL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::FetchDocumentContentsL( const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** CXcapCacheServer::FetchDocumentContentsL()" ) );
+ #endif
+ TPtrC name( ReadMsgParam16LC( 0, aMessage )->Des() );
+ TPtrC8 root( ReadMsgParam8LC( 1, aMessage )->Des() );
+ #ifdef _DEBUG
+ HBufC8* document = HBufC8::NewLC( name.Length() );
+ TPtr8 docDesc( document->Des() );
+ docDesc.Copy( name );
+ CXcapCacheServer::WriteToLog( _L8( " Document: %S" ), &docDesc );
+ CXcapCacheServer::WriteToLog( _L8( " Root URI: %S" ), &root );
+ CleanupStack::PopAndDestroy(); //document
+ #endif
+ TInt tableIndex = KErrNotFound;
+ CXcapCacheIndexTableEntry* tableEntry = iCacheIndexAdmin.FindL( tableIndex, root, name );
+ if( tableEntry != NULL )
+ {
+ CXcapCacheIndexEntry* entry = iCacheIndex.Entry( tableEntry->Index() );
+ iTempBuffer = ReadFromStorageL( entry->FileName16L() );
+ TPtrC8 dataDesc = iTempBuffer->Des();
+ aMessage.Write( 2, dataDesc );
+ }
+ else User::Leave( KErrNotFound );
+ CleanupStack::PopAndDestroy( 2 ); //name, root
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::CacheXcapData
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::CacheXcapDataL( const RMessage2& aMessage )
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "** CXcapCacheServer::CacheXcapDataL()" ) );
+ #endif
+ TPtrC doc( ReadMsgParam16LC( 0, aMessage )->Des() );
+ TPtrC8 root( ReadMsgParam8LC( 1, aMessage )->Des() );
+ TPtrC8 etag( ReadMsgParam8LC( 2, aMessage )->Des() );
+ TPtrC8 data( ReadMsgParam8LC( 3, aMessage )->Des() );
+ #ifdef _DEBUG
+ HBufC8* document = HBufC8::NewLC( doc.Length() );
+ TPtr8 docDesc( document->Des() );
+ docDesc.Copy( doc );
+ CXcapCacheServer::WriteToLog( _L8( " Document: %S" ), &docDesc );
+ CXcapCacheServer::WriteToLog( _L8( " ETag: %S" ), &etag );
+ CXcapCacheServer::WriteToLog( _L8( " Root URI: %S" ), &root );
+ CXcapCacheServer::WriteToLog( _L8( " Data: %d bytes" ), data.Length() );
+ CleanupStack::PopAndDestroy(); //document
+ #endif
+ TInt tableIndex = KErrNotFound;
+ TCacheEntryInfo header;
+ header.iEtag = &etag;
+ header.iRootUri = &root;
+ header.iRespData = &data;
+ header.iDocumentUri = &doc;
+ header.iDataLength = data.Length();
+ CXcapCacheIndexTableEntry* tableEntry = iCacheIndexAdmin.FindL( tableIndex, root, doc );
+ CXcapCacheIndexEntry* entry = NULL;
+ if( tableEntry != NULL )
+ {
+ entry = iCacheIndex.Entry( tableEntry->Index() );
+ entry->UpdateEntryL( &header );
+ }
+ else
+ {
+ entry = CXcapCacheIndexEntry::NewL( &header );
+ CleanupStack::PushL( entry );
+ TInt index = iCacheIndex.UpdateIndexL( entry );
+ CleanupStack::Pop(); //entry
+ iCacheIndexAdmin.UpdateIndexTableL( index, &header );
+ }
+ CleanupStack::PopAndDestroy( 4 ); //data, etag, root, name
+ FlushCacheDataL();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::FlushCacheDataL
+//
+// ----------------------------------------------------------
+//
+void CXcapCacheSession::FlushCacheDataL()
+ {
+ #ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::FlushCacheDataL()" ) );
+ #endif
+ iCacheIndex.StoreCacheDataL();
+ iCacheIndexAdmin.StoreIndexTableL();
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::DeleteFromStorageL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapCacheSession::DeleteFromStorageL( const TDesC& aFileName )
+ {
+ #ifdef _DEBUG
+ HBufC8* name = HBufC8::NewLC( aFileName.Length() );
+ TPtr8 nameDesc( name->Des() );
+ nameDesc.Copy( aFileName );
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::DeleteFromStorageL() - Filename: %S" ), &nameDesc );
+ CleanupStack::PopAndDestroy(); //name
+ #endif
+ TInt error = iFileManager->Delete( aFileName );
+ return error;
+ }
+
+// ----------------------------------------------------------
+// CXcapCacheSession::FlushCacheDataL
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapCacheSession::ReadFromStorageL( const TDesC& aFileName )
+ {
+ #ifdef _DEBUG
+ HBufC8* name = HBufC8::NewLC( aFileName.Length() );
+ TPtr8 nameDesc( name->Des() );
+ nameDesc.Copy( aFileName );
+ CXcapCacheServer::WriteToLog( _L8( "CXcapCacheServer::ReadFromStorageL() - Filename: %S" ), &nameDesc );
+ CleanupStack::PopAndDestroy(); //name
+ #endif
+ RFile file;
+ HBufC8* data = NULL;
+ User::LeaveIfError( file.Open( CXcapCacheServer::FileSession(), aFileName, EFileRead ) );
+ CleanupClosePushL( file );
+ TInt size = 0;
+ User::LeaveIfError( file.Size( size ) );
+ data = HBufC8::NewL( size );
+ TPtr8 pointer( data->Des() );
+ file.Read( pointer );
+ CleanupStack::PopAndDestroy(); //file
+ return data;
+ }
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/Server/src/XcapShutdownTimer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapShutdownTimer
+*
+*/
+
+
+
+#include "XcapCacheServer.h"
+#include "XcapShutdownTimer.h"
+
+// ----------------------------------------------------
+// CXcapShutdownTimer::CXcapShutdownTimer
+//
+// ----------------------------------------------------
+//
+CXcapShutdownTimer::CXcapShutdownTimer() : CTimer( -1 )
+ {
+ /*#ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapShutdownTimer::CXcapShutdownTimer()" ) );
+ #endif*/
+ CActiveScheduler::Add(this);
+ }
+
+// ----------------------------------------------------
+// CXcapShutdownTimer::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapShutdownTimer::ConstructL()
+ {
+ /*#ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapShutdownTimer::ConstructL()" ) );
+ #endif*/
+ CTimer::ConstructL();
+ }
+
+// ----------------------------------------------------
+// CXcapShutdownTimer::Start
+//
+// ----------------------------------------------------
+//
+void CXcapShutdownTimer::Start()
+ {
+ /*#ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapShutdownTimer::Start()" ) );
+ #endif*/
+ After( KXcapCacheShutdownDelay );
+ }
+
+// ----------------------------------------------------
+// CXcapShutdownTimer::RunL
+//
+// ----------------------------------------------------
+//
+void CXcapShutdownTimer::RunL()
+ {
+ /*#ifdef _DEBUG
+ CXcapCacheServer::WriteToLog( _L8( "CXcapShutdownTimer::RunL() - Closing down server" ) );
+ #endif*/
+ CActiveScheduler::Stop();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/inc/CommonDefines.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapCache common defines
+*
+*/
+
+
+
+
+#ifndef __COMMONDEFINES_H__
+#define __COMMONDEFINES_H__
+
+#include <e32base.h>
+
+//Information about the data in the cache
+class TCacheEntryInfo
+ {
+ public:
+
+ TTime iLastUpdate;
+ TTime iLastAccess;
+ TInt32 iDataLength;
+ const TDesC* iDocumentUri;
+ const TDesC8* iEtag;
+ const TDesC8* iRootUri;
+ const TDesC8* iRespData;
+ };
+
+// server name
+_LIT( KXcapCacheServerName, "!CXcapCacheServer" );
+_LIT( KXcapCacheServerLib, "XcapCacheServer" );
+_LIT( KXcapCacheServerExe, "XcapCache.exe");
+
+// A version must be specifyed when creating a session with the server
+const TUint KCacheServerMajorVersionNumber = 0;
+const TUint KCacheServerMinorVersionNumber = 1;
+const TUint KCacheServerBuildVersionNumber = 1;
+
+// Server panic codes
+enum TXcapCacheServerPanic
+ {
+ ECacheCreateServer = 0,
+ ECacheStartServer,
+ ECacheFileServerConnect,
+ ECacheIndexFileOpen,
+ ECachePageFileOpen,
+ EMainSchedulerError,
+ EBadRequest
+ };
+
+//Opcodes used in message passing between client and server
+enum TTransportServerRequest
+ {
+ EXcapCacheFetchInfo = 0,
+ EXcapCacheFetchData,
+ EXcapCacheStore,
+ EXcapCacheDelete,
+ EXcapCacheCheckValidity,
+ EXcapCacheFlush
+ };
+
+//Number of asynchronous requests
+const TUint KTTMaxAsyncRequests = 4;
+
+//Number of data transfer requests
+const TUint KTTDataTransferRequests = 3;
+
+//Default number of message slots per session
+const TUint KTTDefaultMessageSlots = KTTMaxAsyncRequests + 2;
+
+const TInt KServerLogBufferMaxSize = 2000;
+
+const TInt KMaxCacheSize = 30000;
+
+#endif // #ifndef __COMMONDEFINES_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapCache/inc/XcapCache.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RXcapCache
+*
+*/
+
+
+
+
+#ifndef __XCAPCACHE_H__
+#define __XCAPCACHE_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+
+//Constants
+#ifdef _DEBUG
+ _LIT( KCacheClientLogDir, "XDM" );
+ _LIT( KCacheClientLogFile, "CacheClient.txt" );
+#endif
+
+//FORWARD DECLARATIONS
+class TCacheEntryInfo;
+class CXcapCacheClient;
+
+//CLASS DECLARATION
+class RXcapCache : public RSessionBase
+ {
+ public: // New functions
+
+ /**
+ * C++ Constructor.
+ */
+ IMPORT_C RXcapCache();
+
+ /**
+ * Return the version of this component
+ *
+ * @return TVersion The version number
+ */
+ IMPORT_C TVersion Version() const;
+
+ /**
+ * Connect to the server side session object
+ *
+ * @return TInt Error code
+ */
+ IMPORT_C TInt Connect();
+
+ /**
+ * Destructor
+ */
+ IMPORT_C ~RXcapCache();
+
+ /**
+ * Store a new document
+ *
+ * @param TDesC8& ETag of the new document
+ * @param TDesC& Name of the document
+ * @param TDesC8& Root location of the document
+ * @param TDesC8& The document content
+ * @return void
+ */
+ IMPORT_C void Store( const TDesC8& aETag,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation,
+ const TDesC8& aResponseData );
+
+ /**
+ * Remove a named document from the cache
+ *
+ * @param TDesC& Name of the document
+ * @param TDesC8& Root location of the document
+ * @return TInt Error code
+ */
+ IMPORT_C TInt Delete( const TDesC& aDocumentName,
+ const TDesC8& aRootLocation );
+
+ /**
+ * Fetch information on a named document
+ *
+ * @param TDes8& Contains the ETag string on completion
+ * @param TCacheEntryInfo& Encapsulates root & name
+ * @return TInt Error code
+ */
+ IMPORT_C TInt FetchDocumentInfo( TDes8& aETagDescriptor,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation,
+ TCacheEntryInfo& aEntryInfo );
+
+ /**
+ * Fetch content for the named document
+ *
+ * @param TRequestStatus& Request status of the client
+ * @param TDes8& Contains the document contents on completion
+ * @param TCacheEntryInfo& Encapsulates root & name
+ * @return TInt Error code
+ */
+ IMPORT_C void FetchDocumentContent( TDes8& aContentDescriptor,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation );
+
+ /**
+ * Check validity of the named document
+ *
+ * @param TDesC8& ETag of the document
+ * @param TDesC& Name of the document
+ * @param TDesC8& Root location of the document
+ * @return TInt Error code
+ */
+ IMPORT_C TInt IsCurrent( const TDesC8& aETag,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation );
+
+ /**
+ * Flush (externalise) cache metadata to disk
+ *
+ * @return void
+ */
+ IMPORT_C void Flush();
+
+ public: //Not exported
+
+ /**
+ * Start the server
+ *
+ * @return TInt Error code
+ */
+ TInt StartServer();
+
+ /**
+ * Check whether the server is already running
+ *
+ * @return TBool Is the server running
+ */
+ TBool IsRunning();
+
+
+ private: //Data
+
+ TBool iConnected;
+ };
+
+#endif //__XCAPCACHE_H__
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/BWINSCW/XcapHttpTransportU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,24 @@
+EXPORTS
+ ??1CXcapHttpRequest@@UAE@XZ @ 1 NONAME ; CXcapHttpRequest::~CXcapHttpRequest(void)
+ ??1CXcapHttpTransport@@UAE@XZ @ 2 NONAME ; CXcapHttpTransport::~CXcapHttpTransport(void)
+ ?CancelRequest@CXcapHttpRequest@@QAEXXZ @ 3 NONAME ; void CXcapHttpRequest::CancelRequest(void)
+ ?DeleteL@CXcapHttpTransport@@QAEPAVCXcapHttpReqDelete@@ABVTDesC16@@@Z @ 4 NONAME ; class CXcapHttpReqDelete * CXcapHttpTransport::DeleteL(class TDesC16 const &)
+ ?DispatchRequestL@CXcapHttpRequest@@QAEXAAVTRequestStatus@@@Z @ 5 NONAME ; void CXcapHttpRequest::DispatchRequestL(class TRequestStatus &)
+ ?GetL@CXcapHttpTransport@@QAEPAVCXcapHttpReqGet@@ABVTDesC16@@@Z @ 6 NONAME ; class CXcapHttpReqGet * CXcapHttpTransport::GetL(class TDesC16 const &)
+ ?HeadL@CXcapHttpTransport@@QAEPAVCXcapHttpReqHead@@ABVTDesC16@@@Z @ 7 NONAME ; class CXcapHttpReqHead * CXcapHttpTransport::HeadL(class TDesC16 const &)
+ ?HeaderValue@CXcapHttpRequest@@QBE?AVTPtrC8@@W4TStrings@HTTP@@@Z @ 8 NONAME ; class TPtrC8 CXcapHttpRequest::HeaderValue(enum HTTP::TStrings) const
+ ?MkcolL@CXcapHttpTransport@@QAEPAVCXcapHttpReqMkcol@@ABVTDesC16@@@Z @ 9 NONAME ; class CXcapHttpReqMkcol * CXcapHttpTransport::MkcolL(class TDesC16 const &)
+ ?NewL@CXcapHttpTransport@@SAPAV1@ABVTDesC16@@AAVMMsgConnManager@@ABVTXdmCredentials@@@Z @ 10 NONAME ; class CXcapHttpTransport * CXcapHttpTransport::NewL(class TDesC16 const &, class MMsgConnManager &, class TXdmCredentials const &)
+ ?PutL@CXcapHttpTransport@@QAEPAVCXcapHttpReqPut@@ABVTDesC16@@@Z @ 11 NONAME ; class CXcapHttpReqPut * CXcapHttpTransport::PutL(class TDesC16 const &)
+ ?ReleaseResponseData@CXcapHttpRequest@@QAEXXZ @ 12 NONAME ; void CXcapHttpRequest::ReleaseResponseData(void)
+ ?RequestBody@CXcapHttpContSupplier@@QBE?AVTPtrC8@@XZ @ 13 NONAME ; class TPtrC8 CXcapHttpContSupplier::RequestBody(void) const
+ ?RequestUriL@CXcapHttpRequest@@QBE?AVTPtrC8@@XZ @ 14 NONAME ; class TPtrC8 CXcapHttpRequest::RequestUriL(void) const
+ ?ResetUriL@CXcapHttpRequest@@QAEXABVTDesC16@@@Z @ 15 NONAME ; void CXcapHttpRequest::ResetUriL(class TDesC16 const &)
+ ?ResponseData@CXcapHttpRequest@@QAEPAVTXdmCompletionData@@XZ @ 16 NONAME ; class TXdmCompletionData * CXcapHttpRequest::ResponseData(void)
+ ?RootUri@CXcapHttpTransport@@QAE?AVTPtrC8@@XZ @ 17 NONAME ; class TPtrC8 CXcapHttpTransport::RootUri(void)
+ ?SetExpiryTimeL@CXcapHttpRequest@@QAEXPAVMXcapHttpRequestTimerCallback@@VTTimeIntervalMicroSeconds32@@@Z @ 18 NONAME ; void CXcapHttpRequest::SetExpiryTimeL(class MXcapHttpRequestTimerCallback *, class TTimeIntervalMicroSeconds32)
+ ?SetHeaderL@CXcapHttpRequest@@QAEXABVTDesC8@@0@Z @ 19 NONAME ; void CXcapHttpRequest::SetHeaderL(class TDesC8 const &, class TDesC8 const &)
+ ?SetRequestBodyL@CXcapHttpContSupplier@@QAEXABVTDesC8@@@Z @ 20 NONAME ; void CXcapHttpContSupplier::SetRequestBodyL(class TDesC8 const &)
+ ?SetRootUriL@CXcapHttpTransport@@QAEXABVTDesC16@@@Z @ 21 NONAME ; void CXcapHttpTransport::SetRootUriL(class TDesC16 const &)
+ ?UpdateRequestUriL@CXcapHttpRequest@@QAEXABVTDesC8@@@Z @ 22 NONAME ; void CXcapHttpRequest::UpdateRequestUriL(class TDesC8 const &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/eabi/XcapHttpTransportU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,32 @@
+EXPORTS
+ _ZN16CXcapHttpRequest10SetHeaderLERK6TDesC8S2_ @ 1 NONAME
+ _ZN16CXcapHttpRequest12ResponseDataEv @ 2 NONAME
+ _ZN16CXcapHttpRequest13CancelRequestEv @ 3 NONAME
+ _ZN16CXcapHttpRequest14SetExpiryTimeLEP29MXcapHttpRequestTimerCallback27TTimeIntervalMicroSeconds32 @ 4 NONAME
+ _ZN16CXcapHttpRequest16DispatchRequestLER14TRequestStatus @ 5 NONAME
+ _ZN16CXcapHttpRequest17UpdateRequestUriLERK6TDesC8 @ 6 NONAME
+ _ZN16CXcapHttpRequest19ReleaseResponseDataEv @ 7 NONAME
+ _ZN16CXcapHttpRequest9ResetUriLERK7TDesC16 @ 8 NONAME
+ _ZN18CXcapHttpTransport11SetRootUriLERK7TDesC16 @ 9 NONAME
+ _ZN18CXcapHttpTransport4GetLERK7TDesC16 @ 10 NONAME
+ _ZN18CXcapHttpTransport4NewLERK7TDesC16R15MMsgConnManagerRK15TXdmCredentials @ 11 NONAME
+ _ZN18CXcapHttpTransport4PutLERK7TDesC16 @ 12 NONAME
+ _ZN18CXcapHttpTransport5HeadLERK7TDesC16 @ 13 NONAME
+ _ZN18CXcapHttpTransport6MkcolLERK7TDesC16 @ 14 NONAME
+ _ZN18CXcapHttpTransport7DeleteLERK7TDesC16 @ 15 NONAME
+ _ZN18CXcapHttpTransport7RootUriEv @ 16 NONAME
+ _ZN21CXcapHttpContSupplier15SetRequestBodyLERK6TDesC8 @ 17 NONAME
+ _ZNK16CXcapHttpRequest11HeaderValueEN4HTTP8TStringsE @ 18 NONAME
+ _ZNK16CXcapHttpRequest11RequestUriLEv @ 19 NONAME
+ _ZNK21CXcapHttpContSupplier11RequestBodyEv @ 20 NONAME
+ _ZTI16CXcapHttpRequest @ 21 NONAME ; #<TI>#
+ _ZTI18CXcapHttpTransport @ 22 NONAME ; #<TI>#
+ _ZTI20CXcapHttpAuthManager @ 23 NONAME ; #<TI>#
+ _ZTI21CXcapHttpContSupplier @ 24 NONAME ; #<TI>#
+ _ZTV16CXcapHttpRequest @ 25 NONAME ; #<VT>#
+ _ZTV18CXcapHttpTransport @ 26 NONAME ; #<VT>#
+ _ZTV20CXcapHttpAuthManager @ 27 NONAME ; #<VT>#
+ _ZTV21CXcapHttpContSupplier @ 28 NONAME ; #<VT>#
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/group/XcapHttpTransport.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapHttpTransport.dll from XcapHttpTransport.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcaphttptransport.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10207411
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE XcapHttpTransport.cpp
+SOURCE XcapHttpReqGet.cpp
+SOURCE XcapHttpReqPut.cpp
+SOURCE XcapHttpRequest.cpp
+SOURCE XcapHttpResponse.cpp
+SOURCE XcapHttpReqDelete.cpp
+SOURCE XcapHttpHeaderModel.cpp
+SOURCE XcapHttpAuthManager.cpp
+SOURCE XcapHttpContSupplier.cpp
+SOURCE XcapHttpRequestTimer.cpp
+// SONERA SOLUTION
+SOURCE XcapHttpReqHead.cpp
+SOURCE XcapHttpReqMkcol.cpp
+
+//Internal
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../XcapOperations/inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/http
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../../inc
+
+
+LIBRARY hal.lib
+LIBRARY bafl.lib
+LIBRARY http.lib
+LIBRARY ecom.lib
+LIBRARY hash.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY xdmengine.lib
+LIBRARY inetprotutil.lib
+DEBUGLIBRARY flogger.lib
+
+
+
+#if defined( ARMCC )
+ deffile ../eabi/
+#elif defined ( WINSCW )
+ deffile ../BWINSCW/
+#elif defined ( WINS )
+ deffile ../bwins/
+#endif
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapHttpTransport bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+XcapHttpTransport.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpAuthManager.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpAuthManager
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPTAUTHMANAGER__
+#define __XCAPHTTPTAUTHMANAGER__
+
+// INCLUDES
+#include <XdmCredentials.h>
+#include <http/mhttpauthenticationcallback.h>
+#include "XcapHttpConsts.h"
+
+//FORWARD DECLARATION
+class CMD5;
+
+//CLASS DECLARATION
+class CXcapHttpAuthManager : public CBase
+
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ static CXcapHttpAuthManager* NewL( RHTTPSession& iHttpSession,
+ CXcapHttpTransport& aTransportMain,
+ const TXdmCredentials& aDigestCredentials );
+
+ /**
+ * Symbian OS default constructor.
+ */
+ void SetAuthorized( TBool aAuthorized );
+
+ /**
+ * Symbian OS default constructor.
+ */
+ TBool IsAuthorized() const;
+
+ /**
+ * Symbian OS default constructor.
+ */
+ TBool ParseHeaderL( RHTTPTransaction& aTransaction, TInt aAuthType );
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ HBufC8* AuthorizationL( CXcapHttpRequest& aHttpRequest );
+
+ /**
+ * Symbian OS default constructor.
+ */
+ TBool ConsumeAuthInfoParamL( TAuthInfoParam aName, const TDesC8& aValue );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpAuthManager();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CXcapHttpAuthManager( RHTTPSession& iHttpSession,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void ConstructL( const TXdmCredentials& aDigestCredentials );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void Unquote( TPtr8& aParamValue );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void ConstructHA1L( TDes8& aResult );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void ConstructHA2L( TDes8& aResult, CXcapHttpRequest& aHttpRequest );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void Hash( const TDesC8& aMessage, TDes8& aHash );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ HBufC8* RequestDigestLC( CXcapHttpRequest& aHttpRequest );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void SetNextNonceL( const TDesC8& aNextnonce );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void GenerateClientNonce();
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void ParseQopL( const TDesC8& aQopString );
+
+ private: //Data
+
+ TInt iNonceCount;
+ TBool iAuthorized;
+ TBool iUnauthReceived;
+ TBool iNextnonce;
+ CMD5* iMD5;
+ TInt64 iSeed;
+ HBufC8* iOpaque;
+ HBufC8* iServerNonce;
+ HBufC8* iRealm;
+ HBufC8* iDomain;
+ HBufC8* iAlgorithm;
+ HBufC8* iQopString;
+ TXcapAuthQop iQop;
+ RHTTPSession iHttpSession;
+ CXcapHttpTransport& iTransportMain;
+ TBuf8<KXcapHashLength> iClientNonce;
+ TBuf8<KXdmMaxUserNameLength> iUserName;
+ TBuf8<KXdmMaxPasswordLength> iPassword;
+ RStringPool iStringPool;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpConsts.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapHttpConsts
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPCONSTS__
+#define __XCAPHTTPCONSTS__
+
+#include <e32base.h>
+
+const TInt KXcapHashLength = 32;
+const TInt KXcapRawHashLength = 16;
+
+_LIT8( KAuthHeaderParamEnd, "," );
+_LIT8( KAuthHeaderParamEndQ, "\"," );
+_LIT8( KAuthHeaderParamQuote, "\"" );
+_LIT8( KAuthHeaderStart, "Digest username=\"" );
+_LIT8( KAuthHeaderRealm, "realm=\"" );
+_LIT8( KAuthHeaderNonce, "nonce=\"" );
+_LIT8( KAuthHeaderUri, "uri=\"" );
+_LIT8( KAuthHeaderResponse, "response=\"" );
+_LIT8( KAuthHeaderCNonce, "cnonce=\"" );
+_LIT8( KAuthHeaderOpaque, "opaque=\"" );
+_LIT8( KAuthHeaderNonceCount, "nc=" );
+_LIT8( KAuthHeaderQop, "qop=" );
+
+const TText8* const KAuthInfoParamArray[] =
+ {
+ _S8( "Authentication-Info" ),
+ _S8( "Proxy-Authentication-Info" ),
+ _S8( "nextnonce" ),
+ _S8( "rspauth" ),
+ _S8( "cnonce" ),
+ _S8( "nc" ),
+ _S8( "qop" ),
+ };
+
+enum TAuthInfoParam
+ {
+ ENfoAuthInfo = 0,
+ ENfoPrxAuthInfo,
+ ENfoNextnonce,
+ ENfoRspauth,
+ ENfoCnonce,
+ ENfoNc,
+ ENfoQop,
+ };
+enum TXcapAuthQop
+ {
+ EXcapAuth = 0,
+ EXcapAuthInt,
+ EXcapAuthNone
+ };
+
+#endif //__XCAPHTTPCONSTS__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpContSupplier.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpContSupplier
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPCONTSUPPLIER__
+#define __XCAPHTTPCONTSUPPLIER__
+
+// INCLUDES
+#include "XcapHttpRequest.h"
+
+//FORWARD DECLARATIONS
+class CXdmHttpResponse;
+
+// CLASS DECLARATION
+class CXcapHttpContSupplier : public CXcapHttpRequest,
+ public MHTTPDataSupplier
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C void SetRequestBodyL( const TDesC8& aRequestBody );
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C TPtrC8 RequestBody() const;
+
+ protected:
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpContSupplier( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpContSupplier();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ TBool GetNextDataPart( TPtrC8& aDataPart );
+
+ /**
+ * Second-phase constructor.
+ */
+ void ReleaseData();
+
+ /**
+ * Second-phase constructor.
+ */
+ TInt Reset();
+
+ /**
+ * Second-phase constructor.
+ */
+ TInt OverallDataSize();
+
+ protected: //Data
+
+ private: //Data
+
+ HBufC8* iRequestBody;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpHeaderModel.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpHeaderModel
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPHEADERMODEL__
+#define __XCAPHTTPHEADERMODEL__
+
+// INCLUDES
+#include "XcapHttpRequest.h"
+
+//FORWARD DECLARATIONS
+class CXcapHttpResponse;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpHeaderModel ) : public CBase
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpHeaderModel* NewL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * C++ default constructor is private.
+ */
+ TPtrC8 HeaderValue() const;
+
+ /**
+ * C++ default constructor is private.
+ */
+ TPtrC8 HeaderName() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpHeaderModel();
+
+ private:
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpHeaderModel( CXcapHttpTransport& aTransportMain );
+
+ /**
+ * C++ default constructor is private.
+ */
+ void ConstructL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue );
+
+ protected: //Data
+
+ private: //Data
+
+ HBufC8* iHeaderName;
+ HBufC8* iHeaderValue;
+ CXcapHttpTransport& iTransportMain;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpReqDelete.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqDelete
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQDELETE__
+#define __XCAPHTTPREQDELETE__
+
+// INCLUDES
+#include "http.h"
+#include "XcapHttpRequest.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONS
+class CXcapHttpResponse;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpReqDelete ) : public CXcapHttpRequest
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpReqDelete* NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpReqDelete();
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpReqDelete( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL();
+
+ private: //Data
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpReqGet.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqGet
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQGET__
+#define __XCAPHTTPREQGET__
+
+// INCLUDES
+#include "http.h"
+#include "XcapHttpRequest.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONS
+class CXdmHttpResponse;
+class CXcapHttpAuthManager;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpReqGet ) : public CXcapHttpRequest
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpReqGet* NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpReqGet();
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpReqGet( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL();
+
+ private: //Data
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpReqHead.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqHead
+*
+*/
+
+#ifndef __XCAPHTTPREQHEAD__
+#define __XCAPHTTPREQHEAD__
+
+// INCLUDES
+#include "http.h"
+#include "XcapHttpRequest.h"
+
+//CONSTANTS
+_LIT8( KXcapRequestHead, "HEAD" );
+
+//FORWARD DECLARATIONS
+class CXdmHttpResponse;
+class CXcapHttpAuthManager;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpReqHead ) : public CXcapHttpRequest
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpReqHead* NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpReqHead();
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpReqHead( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL();
+
+ private: //Data
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpReqMkcol.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqMkcol
+*
+*/
+
+#ifndef __XCAPHTTPREQMKCOL__
+#define __XCAPHTTPREQMKCOL__
+
+// INCLUDES
+#include "http.h"
+#include "XcapHttpContSupplier.h"
+
+//CONSTANTS
+_LIT8( KXcapRequestMkcol, "MKCOL" );
+
+//FORWARD DECLARATIONS
+class CXcapHttpResponse;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpReqMkcol ) : public CXcapHttpContSupplier
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpReqMkcol* NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpReqMkcol();
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpReqMkcol( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL();
+
+ private: //Data
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpReqPut.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqPut
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQPUT__
+#define __XCAPHTTPREQPUT__
+
+// INCLUDES
+#include "http.h"
+#include "XcapHttpContSupplier.h"
+
+//CONSTANTS
+
+//FORWARD DECLARATIONS
+class CXcapHttpResponse;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpReqPut ) : public CXcapHttpContSupplier
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ static CXcapHttpReqPut* NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpReqPut();
+
+ private: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpReqPut( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL();
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL();
+
+ private: //Data
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpRequest.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpRequest
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQUEST__
+#define __XCAPHTTPREQUEST__
+
+// INCLUDES
+#include <http.h>
+#include "XdmOperation.h"
+#include "XcapHttpRequestTimerCallback.h"
+
+//CONSTANTS
+//const TInt KMaxNumberOfRetries = 3;
+const TInt KAuthTypeProxy = 407;
+const TInt KAuthTypeNormal = 401;
+
+_LIT8( KXcapRequestPost, "POST" );
+_LIT8( KXcapRequestGet, "GET" );
+_LIT8( KXcapRequestPut, "PUT" );
+_LIT8( KXcapRequestDelete, "DELETE" );
+
+_LIT8( KHttpHeaderAccept, "Accept" );
+_LIT8( KHttpHeaderIfMatch, "If-Match" );
+_LIT8( KHttpHeaderIfNoneMatch, "If-None-Match" );
+_LIT8( KHttpHeaderContentType, "Content-Type" );
+_LIT8( KHttpHeaderIntIdentity, "X-3GPP-Intended-Identity" );
+
+//FORWARD DECLARATIONS
+class TXdmCredentials;
+class CXcapHttpResponse;
+class CXcapHttpTransport;
+class CXcapHttpHeaderModel;
+class CXcapHttpAuthManager;
+class CXcapHttpRequestTimer;
+
+// CLASS DECLARATION
+class CXcapHttpRequest : public CBase,
+ public MXcapHttpRequestTimerCallback
+
+ {
+ public:
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C void SetHeaderL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue );
+
+ /**
+ * Sets the expiry time of this transaction
+ * @param aExpiryTime Time period after which this transaction expires
+ * @param aCallback Handle to the receiver of the expiry event
+ */
+ IMPORT_C void SetExpiryTimeL( MXcapHttpRequestTimerCallback* aCallback,
+ const TTimeIntervalMicroSeconds32 aExpiryTime );
+
+ /**
+ * Cancel this transaction
+ */
+ IMPORT_C void CancelRequest();
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C void DispatchRequestL( TRequestStatus& aClientStatus );
+
+ /**
+ * Sets the expiry time of this transaction
+ * @param aExpiryTime Time period after which this transaction expires
+ * @param aCallback Handle to the receiver of the expiry event
+ */
+ IMPORT_C void ResetUriL( const TDesC& aNewUri );
+
+ /**
+ * Sets the expiry time of this transaction
+ * @param aExpiryTime Time period after which this transaction expires
+ * @param aCallback Handle to the receiver of the expiry event
+ */
+ IMPORT_C void UpdateRequestUriL( const TDesC8& aUpdatedUri );
+
+ /**
+ * Sets the expiry time of this transaction
+ * @param aExpiryTime Time period after which this transaction expires
+ * @param aCallback Handle to the receiver of the expiry event
+ */
+ IMPORT_C TPtrC8 RequestUriL() const;
+
+ /**
+ * Sets the expiry time of this transaction
+ * @param aExpiryTime Time period after which this transaction expires
+ * @param aCallback Handle to the receiver of the expiry event
+ */
+ IMPORT_C TPtrC8 HeaderValue( const HTTP::TStrings aHeaderName ) const;
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C TXdmCompletionData* ResponseData();
+
+ /**
+ * C++ default constructor is private.
+ */
+ IMPORT_C void ReleaseResponseData();
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXcapHttpRequest();
+
+ public:
+
+ /**
+ * Try to resend this request
+ * @return TBool Resent or not
+ */
+ TPtrC8 RelativeUri() const;
+
+ /**
+ * Try to resend this request
+ * @return TBool Resent or not
+ */
+ void ResendWithAuthL( TInt aAuthtype );
+
+ /**
+ * Has this transaction been cancelled.
+ * @return TBool
+ */
+ CXcapHttpAuthManager& AuthManager();
+
+ /**
+ * C++ default constructor is private.
+ */
+ RHTTPSession& Session();
+
+ /**
+ * Return the HTTP transaction associated with this transaction
+ * @return RHTTPTransaction
+ */
+ RHTTPTransaction& Transaction();
+
+ /**
+ * C++ default constructor is private.
+ */
+ void AppendDataL( const TPtrC8& aBodyPart );
+
+ /**
+ * Complete this request
+ * @param aErrorCode The completion code
+ */
+ void FinaliseRequestL( TInt aErrorCode );
+
+
+ protected: // Constructors and destructor
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapHttpRequest( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void BaseConstructL( const TDesC& aRequestUri );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual void ConstructRequestL();
+
+ /**
+ * Append data to the response buffer.
+ */
+ virtual RStringF ConstructMethodStringL() = 0;
+
+ /**
+ * Sets the status of this transaction
+ * @param aSent Has this transaction been sent or not
+ */
+ void SetStatus( const TBool aSent );
+
+ /**
+ * Has this transaction been cancelled.
+ * @return TBool
+ */
+ TBool IsCancelled();
+
+ /**
+ * Has this transaction been sent
+ * @return TBool
+ */
+ TBool Status() const;
+
+ /**
+ * Return the time stamp of this transaction
+ * @return TInt
+ */
+ const TInt SendTime() const;
+
+ /**
+ * Get the current time (System tick count)
+ */
+ TInt TimeL() const;
+
+ private:
+
+ /**
+ * Second-phase constructor.
+ */
+ void ConstructL( const TDesC8& aRequestBody );
+
+ /**
+ * Second-phase constructor.
+ */
+ void DoSetHeadersL();
+
+ /**
+ * Second-phase constructor.
+ */
+ void RemoveDuplicateAuth();
+
+ /**
+ * Append authorization header
+ */
+ void AppendAuthorizationHeaderL( RHTTPHeaders& aHeaderCollection, TInt aAuthType );
+
+ /**
+ * Second-phase constructor.
+ */
+ void SetRequestUriL( const TDesC& aRequestUri );
+
+ /**
+ * Second-phase constructor.
+ */
+ void PrepareResponseBodyL();
+
+ #ifdef _DEBUG
+
+ /**
+ * Second-phase constructor.
+ */
+ void DumpResponseL( const TDesC8& aRespData, const TDesC& aDumpName );
+
+ #endif
+
+ /**
+ * Second-phase constructor.
+ */
+ void CompileResponseDataL( TInt aErrorCode );
+
+ /**
+ * Second-phase constructor.
+ */
+ TInt ReinterpretErrorCode( const TInt aHttpStatus ) const;
+
+ /**
+ * Second-phase constructor.
+ */
+ virtual void HandleTimerEventL();
+
+ protected: //Data
+
+ RHTTPSession& iHttpSession;
+ RHTTPTransaction iHttpTransaction;
+ CXcapHttpTransport& iTransportMain;
+
+ private: //Data
+
+ HBufC8* iFlatResponse;
+ HBufC8* iRequestUriBuf;
+ HBufC8* iWholeUri;
+ CXcapHttpResponse* iHttpResponse;
+ CBufSeg* iResponseBuffer;
+ TRequestStatus* iClientStatus;
+ CXcapHttpRequestTimer* iExpiryTimer;
+ TUriParser8 iRequestUri;
+ TInt iCurrentDataLength;
+ TInt iNumberOfRetries;
+ TInt iSendTime;
+ TBool iSent;
+ TBool iActive;
+ TBool iCancelled;
+ TBool iConstructed;
+ TXdmCompletionData iRespData;
+ CXcapHttpAuthManager& iAuthManager;
+ TTimeIntervalMicroSeconds32 iExpiryTime;
+ RPointerArray<CXcapHttpHeaderModel> iHeaderCollection;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpRequestTimer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpRequestTimer
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQUESTTIMER__
+#define __XCAPHTTPREQUESTTIMER__
+
+// INCLUDES
+#include <e32base.h>
+#include "XcapHttpRequestTimerCallback.h"
+
+class CXcapHttpTransport;
+
+NONSHARABLE_CLASS( CXcapHttpRequestTimer ) : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aCallback A pointer to MMmsViewerTimerCallback class
+ */
+ static CXcapHttpRequestTimer* NewL( CXcapHttpTransport& aTransportMain,
+ MXcapHttpRequestTimerCallback* aCallback );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpRequestTimer();
+
+ public: // New functions
+
+ /**
+ * Request to activate timer
+ * @param aDelay Time in microsecoXcap after which
+ * the callback function is called.
+ */
+ void ActivateTimer( TTimeIntervalMicroSeconds32 aDelay );
+
+ private:
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * C++ constructor.
+ * @param aCallback A pointer to MImpsTransportTimerCallback class
+ * @param aRequester Who constructed and/or activated the timer
+ * @param aLogging Trace or not
+ */
+ CXcapHttpRequestTimer( CXcapHttpTransport& aTransportMain,
+ MXcapHttpRequestTimerCallback* aCallback );
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ private: // Data
+
+ RTimer iTimer;
+ CXcapHttpTransport& iTransportMain;
+ MXcapHttpRequestTimerCallback* iCallback;
+ };
+
+#endif //__XcapHTTPREQUESTTIMER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpRequestTimerCallback.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MXcapHttpRequestTimerCallback
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPREQUESTTIMERCALLBACK__
+#define __XCAPHTTPREQUESTTIMERCALLBACK__
+
+// CLASS DECLARATION
+
+/**
+* A callback class for the timer class of IMPS Transport layer
+*/
+NONSHARABLE_CLASS( MXcapHttpRequestTimerCallback )
+ {
+ public:
+
+ /**
+ * Pure virtual callback function to be implemented in the
+ * derived class. This function is called when timer has
+ * compeleted.
+ * @param aStatus The integer value of iStatus of the timer class
+ */
+ virtual void HandleTimerEventL() = 0;
+ };
+
+#endif //__XCAPHTTPREQUESTTIMERCALLBACK__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpResponse.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpResponse
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPRESPONSE__
+#define __XCAPHTTPRESPONSE__
+
+// INCLUDES
+#include <http.h>
+#include "XcapHttpConsts.h"
+
+//FORWARD DECLARATIONs
+class CXcapHttpRequest;
+class CXcapHttpAuthManager;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpResponse ) : public CBase,
+ public MHTTPTransactionCallback
+ {
+ public: // Constructors and destructor
+
+ /**
+ * A global logging function for 16 bit data.
+ * @param aCommand command to be handled
+ */
+ static CXcapHttpResponse* CXcapHttpResponse::NewL( CXcapHttpRequest* aHttpRequest,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpResponse();
+
+ public: //New functions
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ TInt ContentLengthL() const;
+
+ private:
+
+ /**
+ * A global logging function for 16 bit data.
+ * @param aCommand command to be handled
+ */
+ CXcapHttpResponse( CXcapHttpRequest* aHttpRequest,
+ CXcapHttpTransport& aTransportMain );
+
+ /**
+ * A global logging function for 16 bit data.
+ * @param aCommand command to be handled
+ */
+ void ConstructL();
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ RHTTPHeaders ResponseHeaderCollection() const;
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ RHTTPHeaders RequestHeaderCollection() const;
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ TBool HandleReceivedBodyDataL( const RHTTPTransaction aTransaction );
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ TBool IsUnauthRequest( RHTTPTransaction aTransaction, TInt& aAuthType );
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ TBool ParseAuthInfoParam( TInt& aLength, TAuthInfoParam& aName,
+ TPtrC8& aValue, TPtr8& aParam );
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ TBool CheckAuthInfoHeaderL( RHTTPHeaders aHeaders );
+
+ #ifdef _DEBUG
+
+ /**
+ * Convert undefined HTTP stack errors
+ */
+ void DumpHeadersL( RHTTPHeaders aHeaders, TInt aId );
+
+ #endif
+
+ private: //From MHTTPTransactionCallback
+
+ /**
+ * Handles all responses
+ * coming from the remote host
+ * @param aTransaction The finished transaction
+ * @param aEvent Type of the event
+ */
+ void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent );
+
+ /**
+ * From MHTTPTransactionCallback, called when the RunL() of a transaction leaves
+ * @param aInt The error the HTTP framework left with
+ * @param aTransaction The failed transaction
+ * @param aEvent The event that was being processed
+ * @return KErrNone (HTTP framework panics if client returns any other error)
+ */
+ TInt MHFRunError( TInt aInt, RHTTPTransaction aTransaction, const THTTPEvent& aEvent );
+
+ private: //Data
+
+ TBool iAuthPending;
+ CXcapHttpRequest* iHttpRequest;
+ CXcapHttpTransport& iTransportMain;
+ CXcapHttpAuthManager& iAuthManager;
+ TInt iUnauthRequestCounter;
+ };
+
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/inc/XcapHttpTransport.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpTransport
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPTRANSPORT__
+#define __XCAPHTTPTRANSPORT__
+
+// INCLUDES
+#include <http.h>
+#include <XdmCredentials.h>
+
+//COMMON CONSTANTS
+_LIT( KTransportLogFile, "HttpTransport" );
+const TInt KTransportLogBufMaxSize = 2000;
+_LIT( KTransportDateFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S.%C%:3");
+const TInt KMaxSubmitSize = 1024;
+const TInt KMaxHeaderNameLen = 32;
+const TInt KMaxHeaderValueLen = 128;
+const TInt KBufferMaxSize = 2048;
+
+//FORWARD DECLARATIONS
+class CXdmLogWriter;
+class MMsgConnManager;
+class CXcapHttpReqGet;
+class CXcapHttpReqPut;
+class CXcapHttpReqDelete;
+class CXcapHttpAuthManager;
+class CXcapHttpReqMkcol;
+class CXcapHttpReqHead;
+
+// CLASS DECLARATION
+class CXcapHttpTransport : public CBase
+
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ */
+ IMPORT_C static CXcapHttpTransport* NewL( const TDesC& aRootUri,
+ MMsgConnManager& aConnManager,
+ const TXdmCredentials& aDigestCredentials );
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ IMPORT_C TPtrC8 RootUri();
+
+ /**
+ * Send one IMPS message.
+ */
+ IMPORT_C CXcapHttpReqGet* GetL( const TDesC& aUri );
+
+ /**
+ * Send one IMPS message.
+ */
+ IMPORT_C CXcapHttpReqPut* PutL( const TDesC& aUri );
+
+ /**
+ * Send one IMPS message.
+ */
+ IMPORT_C CXcapHttpReqMkcol* MkcolL( const TDesC& aUri );
+
+ /**
+ * Send one IMPS message.
+ */
+ IMPORT_C CXcapHttpReqHead* HeadL( const TDesC& aUri );
+
+ /**
+ * Send one IMPS message.
+ */
+ IMPORT_C CXcapHttpReqDelete* DeleteL( const TDesC& aUri );
+
+ /**
+ * Stores the address of the proxy currently in use
+ * @param aProxy Address of the HTTP proxy server
+ */
+ IMPORT_C void SetRootUriL( const TDesC& aRootUri );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXcapHttpTransport();
+
+ public: //New functions
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static TXdmCredentials& Credentials();
+
+ #ifdef _DEBUG
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ /**
+ * A global logging function for 16 bit data.
+ * @param aCommand command to be handled
+ */
+ void WriteToLog( TRefByValue<const TDesC> aFmt,... ) const;
+
+ #endif //_DEBUG
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CXcapHttpTransport( MMsgConnManager& aConnManager );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ void ConstructL( const TDesC& aRootUri, const TXdmCredentials& aDigestCredentials );
+
+ /**
+ * Symbian OS default constructor.
+ * @param aMimeType MIME type of the messages
+ */
+ HBufC8* ConstructRequestUriLC( const TDesC& aDocumentSelector );
+
+ /**
+ * Initialises an HTTP session
+ */
+ void InitialiseSessionL();
+
+ private: //Data
+
+ TBool iCredValidity;
+ TBool iSessionClosed;
+ HBufC8* iRootUri;
+ HBufC8* iProxyBuffer;
+ RHTTPSession iHttpSession;
+ CXdmLogWriter* iLogWriter;
+ MMsgConnManager& iConnManager;
+ CXcapHttpAuthManager* iAuthManager;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpAuthManager.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,576 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpAuthManager
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <hash.h>
+#include <e32math.h>
+#include "XcapHttpRequest.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpAuthManager.h"
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::CXcapHttpAuthManager
+//
+// ----------------------------------------------------------
+//
+CXcapHttpAuthManager::CXcapHttpAuthManager( RHTTPSession& aHttpSession,
+ CXcapHttpTransport& aTransportMain ) :
+ iNonceCount( 1 ),
+ iAuthorized( EFalse ),
+ iHttpSession( aHttpSession ),
+ iTransportMain( aTransportMain ),
+ iStringPool( aHttpSession.StringPool() )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpAuthManager* CXcapHttpAuthManager::NewL( RHTTPSession& aHttpSession,
+ CXcapHttpTransport& aTransportMain,
+ const TXdmCredentials& aDigestCredentials )
+ {
+ CXcapHttpAuthManager* self = new ( ELeave ) CXcapHttpAuthManager( aHttpSession, aTransportMain );
+ CleanupStack::PushL( self );
+ self->ConstructL( aDigestCredentials );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapHttpAuthManager::~CXcapHttpAuthManager
+//
+// ----------------------------------------------------
+//
+CXcapHttpAuthManager::~CXcapHttpAuthManager()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::~CXcapHttpAuthManager()" ) );
+ #endif
+ delete iMD5;
+ delete iRealm;
+ delete iOpaque;
+ delete iDomain;
+ delete iQopString;
+ delete iAlgorithm;
+ delete iServerNonce;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::ConstructL( const TXdmCredentials& aDigestCredentials )
+ {
+ iMD5 = CMD5::NewL();
+ iUserName.Copy( aDigestCredentials.iUserName );
+ iPassword.Copy( aDigestCredentials.iPassword );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::SetAuthorized
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::SetAuthorized( TBool aAuthorized )
+ {
+ iAuthorized = aAuthorized;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::IsAuthorized
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpAuthManager::IsAuthorized() const
+ {
+ return iAuthorized;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::AuthorizationL
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapHttpAuthManager::AuthorizationL( CXcapHttpRequest& aHttpRequest )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::AuthorizationL()" ) );
+ #endif
+ if( !iUnauthReceived )
+ return NULL;
+ TInt bufPtr = 0;
+ HBufC8* ret = NULL;
+ THTTPHdrVal requestUri;
+ //All these strings should have been defined - except for
+ //"opaque", maybe - in the WWW-Authentication header that
+ //the server sent. In case some of them were not, let's just
+ //keep going as if they were there, but were empty. The request
+ //will then fail & be completed in the next MHFRunL() call.
+ TPtrC8 realm( iRealm ? iRealm->Des() : TPtrC8() );
+ TPtrC8 qop( iQopString ? iQopString->Des() : TPtrC8() );
+ TPtrC8 opaque( iOpaque ? iOpaque->Des() : TPtrC8() );
+ TPtrC8 nonce( iServerNonce ? iServerNonce->Des() : TPtrC8() );
+ TPtrC8 uri( aHttpRequest.RelativeUri() );
+ TBuf8<8> nonceCount;
+ nonceCount.AppendFormat( _L8( "%08x" ), iNonceCount );
+ CBufFlat* buffer = CBufFlat::NewL( 128 );
+ CleanupStack::PushL( buffer );
+ buffer->InsertL( bufPtr, KAuthHeaderStart );
+ bufPtr = bufPtr + KAuthHeaderStart().Length();
+ buffer->InsertL( bufPtr, iUserName );
+ bufPtr = bufPtr + iUserName.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderRealm );
+ bufPtr = bufPtr + KAuthHeaderRealm().Length();
+ buffer->InsertL( bufPtr, realm );
+ bufPtr = bufPtr + realm.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderNonce );
+ bufPtr = bufPtr + KAuthHeaderNonce().Length();
+ buffer->InsertL( bufPtr, nonce );
+ bufPtr = bufPtr + nonce.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderUri );
+ bufPtr = bufPtr + KAuthHeaderUri().Length();
+ buffer->InsertL( bufPtr, uri );
+ bufPtr = bufPtr + uri.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderQop );
+ bufPtr = bufPtr + KAuthHeaderQop().Length();
+ buffer->InsertL( bufPtr, qop );
+ bufPtr = bufPtr + qop.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEnd );
+ bufPtr = bufPtr + KAuthHeaderParamEnd().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderNonceCount );
+ bufPtr = bufPtr + KAuthHeaderNonceCount().Length();
+ buffer->InsertL( bufPtr, nonceCount );
+ bufPtr = bufPtr + nonceCount.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEnd );
+ bufPtr = bufPtr + KAuthHeaderParamEnd().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderCNonce );
+ bufPtr = bufPtr + KAuthHeaderCNonce().Length();
+ buffer->InsertL( bufPtr, iClientNonce );
+ bufPtr = bufPtr + iClientNonce.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ buffer->InsertL( bufPtr, KAuthHeaderResponse );
+ bufPtr = bufPtr + KAuthHeaderResponse().Length();
+ TPtrC8 respDigest( RequestDigestLC( aHttpRequest )->Des() );
+ buffer->InsertL( bufPtr, respDigest );
+ bufPtr = bufPtr + respDigest.Length();
+ CleanupStack::PopAndDestroy(); //RequestDigestLC()
+ buffer->InsertL( bufPtr, KAuthHeaderParamEndQ );
+ bufPtr = bufPtr + KAuthHeaderParamEndQ().Length();
+ if( opaque.Length() > 0 )
+ {
+ buffer->InsertL( bufPtr, KAuthHeaderOpaque );
+ bufPtr = bufPtr + KAuthHeaderOpaque().Length();
+ buffer->InsertL( bufPtr, opaque );
+ bufPtr = bufPtr + opaque.Length();
+ buffer->InsertL( bufPtr, KAuthHeaderParamQuote );
+ }
+ ret = HBufC8::NewL( buffer->Size() );
+ ret->Des().Copy( buffer->Ptr( 0 ) );
+ buffer->Reset();
+ iNonceCount++;
+ CleanupStack::PopAndDestroy(); //buffer
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ConsumeAuthInfoParamL
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpAuthManager::ConsumeAuthInfoParamL( TAuthInfoParam aName, const TDesC8& aValue )
+ {
+ //For the time being, always return ETrue
+ TBool ret = ETrue;
+ TInt length = aValue.Length();
+ TPtr8 value( CONST_CAST( TUint8*, aValue.Ptr() ), length, length );
+ Unquote( value );
+ #ifdef _DEBUG
+ TPtrC8 name( KAuthInfoParamArray[aName] );
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::ConsumeAuthInfoParamL()" ) );
+ iTransportMain.WriteToLog( _L8( " Name: %S" ), &name );
+ iTransportMain.WriteToLog( _L8( " Value: %S" ), &value );
+ #endif
+ switch( aName )
+ {
+ case ENfoNextnonce:
+ {
+ SetNextNonceL( value );
+ #ifdef _DEBUG
+ TPtrC8 nonce( iServerNonce->Des() );
+ iTransportMain.WriteToLog( _L8( " -> Nonce set to %S" ), &nonce );
+ #endif
+ }
+ break;
+ case ENfoRspauth:
+ /* TODO */
+ break;
+ case ENfoCnonce:
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " -> Current cnonce %S" ), &iClientNonce );
+ #endif
+ break;
+ //ret = value.Compare( iClientNonce ) == 0;
+ case ENfoNc:
+ {
+ TBuf8<8> nonceCount;
+ nonceCount.AppendFormat( _L8( "%08x" ), iNonceCount );
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " -> Current nonce count %S" ), &nonceCount );
+ #endif
+ //ret = nonceCount.Compare( value ) == 0;
+ break;
+ }
+ case ENfoQop:
+ ret = ETrue;
+ break;
+ default:
+ ret = ETrue;
+ break;
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::GenerateClientNonce
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::SetNextNonceL( const TDesC8& aNextnonce )
+ {
+ delete iServerNonce;
+ iServerNonce = NULL;
+ iServerNonce = aNextnonce.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::Unquote
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::Unquote( TPtr8& aParamValue )
+ {
+ TInt index = aParamValue.Locate( '"' );
+ while( index >= 0 )
+ {
+ aParamValue.Delete( index, 1 );
+ index = aParamValue.Locate( '\"');
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::RequestDigestLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapHttpAuthManager::RequestDigestLC( CXcapHttpRequest& aHttpRequest )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::RequestDigestLC()" ) );
+ #endif
+ HBufC8* ret = NULL;
+ TPtrC8 nonce( iServerNonce->Des() );
+ if( iQop == EXcapAuth || iQop == EXcapAuthInt )
+ {
+ TBuf8<8> nonceCount;
+ TBuf8<KXcapHashLength> hashBush;
+ nonceCount.AppendFormat( _L8( "%08x" ), iNonceCount );
+ TPtrC8 nonce( iServerNonce->Des() );
+ TPtrC8 qop( iQop == EXcapAuth ? _L8( "auth" ) : _L8( "auth-int" ) );
+ HBufC8* stringToHash = HBufC8::NewLC( nonce.Length() + qop.Length() +
+ 3 * KXcapHashLength + 8 + 5 );
+ TPtr8 desc( stringToHash->Des() );
+ ConstructHA1L( desc );
+ desc.Append( ':' );
+ desc.Append( nonce );
+ desc.Append( ':' );
+ desc.Append( nonceCount );
+ desc.Append( ':' );
+ desc.Append( iClientNonce );
+ desc.Append(':');
+ desc.Append( qop );
+ desc.Append(':');
+ ConstructHA2L( hashBush, aHttpRequest );
+ desc.Append( hashBush );
+ hashBush.Zero();
+ ret = HBufC8::NewL( KXcapHashLength );
+ Hash( *stringToHash, hashBush );
+ ret->Des().Copy( hashBush );
+ CleanupStack::PopAndDestroy(); //stringToHash
+ CleanupStack::PushL( ret );
+ }
+ else
+ {
+ /*
+ * This case is for compatibility with RFC 2069:
+ * request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
+ */
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Qop not defined, ignore" ) );
+ #endif
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::GenerateClientNonce
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::GenerateClientNonce()
+ {
+ TTime time;
+ TBuf8<33> key;
+ time.UniversalTime();
+ TInt64 randomNumber = Math::Rand( iSeed );
+ randomNumber <<= 32;
+ randomNumber += Math::Rand( iSeed );
+ key.Zero();
+ key.AppendNum( time.Int64(), EHex );
+ key.Append( _L8( ":" ) );
+ key.AppendNum( randomNumber, EHex );
+ Hash( key, iClientNonce );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::Hash
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::Hash( const TDesC8& aMessage, TDes8& aHash )
+ {
+ TBuf8<2> buf;
+ aHash.Zero();
+ iMD5->Reset();
+ TPtrC8 hash = iMD5->Hash( aMessage );
+ _LIT8( formatStr, "%02x" );
+ for( TInt i = 0;i < KXcapRawHashLength;i++ )
+ {
+ buf.Zero();
+ buf.Format( formatStr, hash[i] );
+ aHash.Append( buf );
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ParseQopL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::ParseQopL( const TDesC8& aQopString )
+ {
+ _LIT8( KXcapAuthInt, "auth-int" );
+ iQop = aQopString.FindF( KXcapAuthInt ) == 0 ? EXcapAuthInt : EXcapAuth;
+ delete iQopString;
+ iQopString = NULL;
+ iQopString = HBufC8::NewL( 8 );
+ iQopString->Des().Copy( iQop == EXcapAuth ? _L8( "auth" ) : _L8( "auth-int" ) );
+ #ifdef _DEBUG
+ TPtrC8 qop( iQopString->Des() );
+ iTransportMain.WriteToLog( _L8( " Qop: %S" ), &qop );
+ #endif
+ GenerateClientNonce();
+ iNonceCount = 1;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ParseHeaderL
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpAuthManager::ParseHeaderL( RHTTPTransaction& aTransaction, TInt aAuthType )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::ParseHeaderL()" ) );
+ #endif
+ TBool ret = EFalse;
+ THTTPHdrVal fieldVal;
+ RHTTPHeaders headers = aTransaction.Response().GetHeaderCollection();
+ RStringF auth = aAuthType == KAuthTypeNormal ?
+ iStringPool.StringF( HTTP::EWWWAuthenticate, RHTTPSession::GetTable() ) :
+ iStringPool.StringF( HTTP::EProxyAuthenticate, RHTTPSession::GetTable() );
+ headers.GetField( auth, 0, fieldVal );
+ if( fieldVal.StrF() == iStringPool.StringF( HTTP::EDigest, RHTTPSession::GetTable() ) )
+ {
+ ret = ETrue;
+ TInt error = headers.GetParam( auth, iStringPool.StringF( HTTP::ERealm, RHTTPSession::GetTable() ), fieldVal );
+ if( KErrNone == error )
+ {
+ delete iRealm;
+ iRealm = NULL;
+ iRealm = fieldVal.Str().DesC().AllocL();
+ #ifdef _DEBUG
+ TPtrC8 realm( fieldVal.Str().DesC() );
+ iTransportMain.WriteToLog( _L8( " Realm: %S" ), &realm );
+ #endif
+ }
+ //In a proper WWW-Authentication request there SHOULD have been
+ //a qop value. In case there was not, call the whole thing off
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::EQop, RHTTPSession::GetTable() ), fieldVal );
+ if( KErrNone == error )
+ ParseQopL( fieldVal.Str().DesC() );
+ else
+ {
+ delete iQopString;
+ iQopString = NULL;
+ ret = EFalse;
+ }
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::ENonce, RHTTPSession::GetTable() ), fieldVal );
+ if( ret && KErrNone == error )
+ {
+ SetNextNonceL( fieldVal.Str().DesC() );
+ #ifdef _DEBUG
+ TPtrC8 nonce( iServerNonce->Des() );
+ iTransportMain.WriteToLog( _L8( " Nonce: %S" ), &nonce );
+ #endif
+ }
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::EOpaque, RHTTPSession::GetTable() ), fieldVal );
+ if( ret && KErrNone == error )
+ {
+ delete iOpaque;
+ iOpaque = NULL;
+ iOpaque = fieldVal.Str().DesC().AllocL();
+ #ifdef _DEBUG
+ TPtrC8 opaque( iOpaque->Des() );
+ iTransportMain.WriteToLog( _L8( " Opaque: %S" ), &opaque );
+ #endif
+ }
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::EStale, RHTTPSession::GetTable() ), fieldVal );
+ if( ret && KErrNone == error )
+ {
+ #ifdef _DEBUG
+ TPtrC8 stale( fieldVal.Str().DesC() );
+ iTransportMain.WriteToLog( _L8( " Stale: %S" ), &stale );
+ #endif
+ }
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::EDomain, RHTTPSession::GetTable() ), fieldVal );
+ if( ret && KErrNone == error )
+ {
+ delete iDomain;
+ iDomain = NULL;
+ iDomain = fieldVal.Str().DesC().AllocL();
+ #ifdef _DEBUG
+ TPtrC8 domain( iDomain->Des() );
+ iTransportMain.WriteToLog( _L8( " Domain: %S" ), &domain );
+ #endif
+ }
+ error = headers.GetParam( auth, iStringPool.StringF( HTTP::EAlgorithm, RHTTPSession::GetTable() ), fieldVal );
+ if( ret && KErrNone == error )
+ {
+ delete iAlgorithm;
+ iAlgorithm = NULL;
+ iAlgorithm = fieldVal.Str().DesC().AllocL();
+ #ifdef _DEBUG
+ TPtrC8 algorithm( iAlgorithm->Des() );
+ iTransportMain.WriteToLog( _L8( " Algorithm: %S" ), &algorithm );
+ #endif
+ }
+ }
+ iUnauthReceived = ETrue;
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ConstructHA1L
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::ConstructHA1L( TDes8& aResult )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::ConstructHA1L()" ) );
+ #endif
+ HBufC8* buffer = HBufC8::NewLC( iUserName.Length() +
+ iPassword.Length() + iRealm->Des().Length() + 2 );
+ TPtr8 desc( buffer->Des() );
+ desc.Copy( iUserName );
+ desc.Append(':');
+ desc.Append( iRealm->Des() );
+ desc.Append(':');
+ desc.Append( iPassword );
+ Hash( *buffer, aResult );
+ CleanupStack::PopAndDestroy(); //buffer
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ConstructHA2L
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpAuthManager::ConstructHA2L( TDes8& aResult, CXcapHttpRequest& aHttpRequest )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpAuthManager::ConstructHA2L()" ) );
+ #endif
+ TPtrC8 uri( aHttpRequest.RelativeUri() );
+ TPtrC8 method( aHttpRequest.Transaction().Request().Method().DesC() );
+ switch( iQop )
+ {
+ case EXcapAuth:
+ case EXcapAuthNone:
+ {
+ HBufC8* buffer = HBufC8::NewLC( uri.Length() + method.Length() + 1 );
+ TPtr8 desc( buffer->Des() );
+ desc.Copy( method );
+ desc.Append( ':' );
+ desc.Append( uri );
+ Hash( desc, aResult );
+ CleanupStack::PopAndDestroy(); //buffer
+ }
+ break;
+ case EXcapAuthInt:
+ {
+ TPtrC8 body( _L8( "" ) );
+ TBuf8<KXcapHashLength> bodyHash;
+ if( aHttpRequest.Transaction().Request().HasBody() )
+ aHttpRequest.Transaction().Request().Body()->GetNextDataPart( body );
+ bodyHash.Zero();
+ Hash( body, bodyHash );
+ HBufC8* buffer = HBufC8::NewLC( uri.Length() + method.Length() +
+ KXcapHashLength + 2 );
+ TPtr8 desc( buffer->Des() );
+ desc.Copy( method );
+ desc.Append( ':' );
+ desc.Append( uri );
+ desc.Append( ':' );
+ desc.Append( bodyHash );
+ Hash( desc, aResult );
+ CleanupStack::PopAndDestroy(); //buffer
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpContSupplier.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpContSupplier
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapHttpTransport.h"
+#include "XcapHttpContSupplier.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::CXcapHttpContSupplier
+//
+// ----------------------------------------------------------
+//
+CXcapHttpContSupplier::CXcapHttpContSupplier( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpRequest( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::~CXcapHttpContSupplier
+//
+// ----------------------------------------------------------
+//
+CXcapHttpContSupplier::~CXcapHttpContSupplier()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpContSupplier::~CXcapHttpContSupplier()" ) );
+ #endif
+ delete iRequestBody;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::SetRequestBodyL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpContSupplier::SetRequestBodyL( const TDesC8& aRequestBody )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpContSupplier::SetRequestBodyL" ) );
+ #endif
+ delete iRequestBody;
+ iRequestBody = NULL;
+ iRequestBody = HBufC8::NewL( aRequestBody.Length() );
+ iRequestBody->Des().Copy( aRequestBody );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::RequestBody
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapHttpContSupplier::RequestBody() const
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpContSupplier::RequestBody" ) );
+ #endif
+ return iRequestBody != NULL ? iRequestBody->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::GetNextDataPart
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpContSupplier::GetNextDataPart( TPtrC8& aDataPart )
+ {
+ aDataPart.Set( iRequestBody->Des() );
+ return ETrue;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::ReleaseData
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpContSupplier::ReleaseData()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpContSupplier::ReleaseData()" ) );
+ #endif
+ //Not just yet, lets see if the server accepts the data.
+ //If it does, the data needs to be cached and this is
+ //probably - and hopefully - the only copy of the raw
+ //data still available at that point in time
+ //delete iRequestBody;
+ //iRequestBody = NULL;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::Reset
+//
+// ----------------------------------------------------------
+//
+TInt CXcapHttpContSupplier::Reset()
+ {
+ //This method is called when client Cancel()s a request.
+ //There's nothing to reset in our case, because all needed
+ //resources are destructed in the destructor.
+ //NOTE: Never EVER set this method to return anything but
+ //KErrNone, since values < 0 will result in practically
+ //untraceable errors thanks to Symbian's lack of proper
+ //documentation on the issue.
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpContSupplier::GetNextDataPart
+//
+// ----------------------------------------------------------
+//
+TInt CXcapHttpContSupplier::OverallDataSize()
+ {
+ return iRequestBody != NULL ? iRequestBody->Length() : 0;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpHeaderModel.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpHeaderModel
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapHttpTransport.h"
+#include "XcapHttpHeaderModel.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::CXcapHttpHeaderModel
+//
+// ----------------------------------------------------------
+//
+CXcapHttpHeaderModel::CXcapHttpHeaderModel( CXcapHttpTransport& aTransportMain ) :
+ iTransportMain( aTransportMain)
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpHeaderModel* CXcapHttpHeaderModel::NewL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpHeaderModel* self = new ( ELeave ) CXcapHttpHeaderModel( aTransportMain );
+ CleanupStack::PushL( self );
+ self->ConstructL( aHeaderName, aHeaderValue );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::HeaderValue
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpHeaderModel::ConstructL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue )
+ {
+ delete iHeaderName;
+ iHeaderName = NULL;
+ iHeaderName = aHeaderName.AllocL();
+ delete iHeaderValue;
+ iHeaderValue = NULL;
+ iHeaderValue = aHeaderValue.AllocL();
+
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::HeaderValue
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapHttpHeaderModel::HeaderValue() const
+ {
+ return iHeaderValue != NULL ? iHeaderValue->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::HeaderValue
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapHttpHeaderModel::HeaderName() const
+ {
+ return iHeaderName != NULL ? iHeaderName->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpHeaderModel::~CXcapHttpHeaderModel
+//
+// ----------------------------------------------------------
+//
+CXcapHttpHeaderModel::~CXcapHttpHeaderModel()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpHeaderModel::~CXcapHttpHeaderModel()" ) );
+ #endif
+ delete iHeaderName;
+ delete iHeaderValue;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpReqDelete.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqDelete
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapHttpReqDelete.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpReqDelete::CXcapHttpReqDelete
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqDelete::CXcapHttpReqDelete( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpRequest( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqDelete::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqDelete* CXcapHttpReqDelete::NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpReqDelete* self = new ( ELeave ) CXcapHttpReqDelete( aHttpSession, aAuthManager, aTransportMain );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aRequestUri );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqDelete::~CXcapHttpReqDelete
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqDelete::~CXcapHttpReqDelete()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqDelete::~CXcapHttpReqDelete()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqDelete::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpReqDelete::ConstructRequestL()
+ {
+ CXcapHttpRequest::ConstructRequestL();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqDelete::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+RStringF CXcapHttpReqDelete::ConstructMethodStringL()
+ {
+ return iHttpSession.StringPool().OpenFStringL( KXcapRequestDelete );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpReqGet.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqGet
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapHttpReqGet.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpReqGet::CXcapHttpReqGet
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqGet::CXcapHttpReqGet( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpRequest( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqGet::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqGet* CXcapHttpReqGet::NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpReqGet* self = new ( ELeave ) CXcapHttpReqGet( aHttpSession, aAuthManager, aTransportMain );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aRequestUri );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqGet::~CXcapHttpReqGet
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqGet::~CXcapHttpReqGet()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqGet::~CXcapHttpReqGet()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqGet::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpReqGet::ConstructRequestL()
+ {
+ CXcapHttpRequest::ConstructRequestL();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqGet::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+RStringF CXcapHttpReqGet::ConstructMethodStringL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqGet::ConstructMethodStringL()" ) );
+ #endif
+ return iHttpSession.StringPool().OpenFStringL( KXcapRequestGet );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpReqHead.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* ============================================================================
+* Name : CXcapHttpReqHead from XcapHttpReqHead.cpp
+* Part of : Transport Adapter of the Symbian OS WV Engine
+*
+* Description:
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqHead
+*
+*/
+
+// INCLUDE FILES
+#include "XcapHttpReqHead.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpReqHead::CXcapHttpReqHead
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqHead::CXcapHttpReqHead( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpRequest( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqHead::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqHead* CXcapHttpReqHead::NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpReqHead* self = new ( ELeave ) CXcapHttpReqHead( aHttpSession, aAuthManager, aTransportMain );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aRequestUri );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqHead::~CXcapHttpReqHead
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqHead::~CXcapHttpReqHead()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqHead::~CXcapHttpReqHead()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqHead::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpReqHead::ConstructRequestL()
+ {
+ CXcapHttpRequest::ConstructRequestL();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqHead::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+RStringF CXcapHttpReqHead::ConstructMethodStringL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqHead::ConstructMethodStringL()" ) );
+ #endif
+ return iHttpSession.StringPool().OpenFStringL( KXcapRequestHead );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpReqMkcol.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* ============================================================================
+* Name : CXcapHttpReqHead from XcapHttpReqHead.cpp
+* Part of : Transport Adapter of the Symbian OS WV Engine
+*
+* Description:
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqMkcol
+*
+*/
+
+// INCLUDE FILES
+#include "XcapHttpReqMkcol.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpReqMkcol::CXcapHttpReqMkcol
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqMkcol::CXcapHttpReqMkcol( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpContSupplier( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqMkcol::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqMkcol* CXcapHttpReqMkcol::NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpReqMkcol* self = new ( ELeave ) CXcapHttpReqMkcol( aHttpSession, aAuthManager, aTransportMain );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aRequestUri );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqMkcol::~CXcapHttpReqMkcol
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqMkcol::~CXcapHttpReqMkcol()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqMkcol::~CXcapHttpReqMkcol()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqMkcol::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpReqMkcol::ConstructRequestL()
+ {
+ CXcapHttpRequest::ConstructRequestL();
+ iHttpTransaction.Request().SetBody( *this );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqMkcol::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+RStringF CXcapHttpReqMkcol::ConstructMethodStringL()
+ {
+ return iHttpSession.StringPool().OpenFStringL( KXcapRequestMkcol );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpReqPut.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpReqPut
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapHttpReqPut.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpReqPut::CXcapHttpReqPut
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqPut::CXcapHttpReqPut( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ CXcapHttpContSupplier( aHttpSession, aAuthManager, aTransportMain )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqPut::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqPut* CXcapHttpReqPut::NewL( const TDesC& aRequestUri,
+ RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain )
+
+ {
+ CXcapHttpReqPut* self = new ( ELeave ) CXcapHttpReqPut( aHttpSession, aAuthManager, aTransportMain );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aRequestUri );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqPut::~CXcapHttpReqPut
+//
+// ----------------------------------------------------------
+//
+CXcapHttpReqPut::~CXcapHttpReqPut()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpReqPut::~CXcapHttpReqPut()" ) );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqPut::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpReqPut::ConstructRequestL()
+ {
+ CXcapHttpRequest::ConstructRequestL();
+ iHttpTransaction.Request().SetBody( *this );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpReqPut::ConstructRequestL
+//
+// ----------------------------------------------------------
+//
+RStringF CXcapHttpReqPut::ConstructMethodStringL()
+ {
+ return iHttpSession.StringPool().OpenFStringL( KXcapRequestPut );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpRequest.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,681 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpRequest
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <hal.h>
+#include <e32math.h>
+#include "XdmCredentials.h"
+#include "XcapHttpRequest.h"
+#include "XcapHttpResponse.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpHeaderModel.h"
+#include "XcapHttpAuthManager.h"
+#include "XcapHttpRequestTimer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::CXcapHttpRequest
+//
+// ----------------------------------------------------------
+//
+CXcapHttpRequest::CXcapHttpRequest( RHTTPSession& aHttpSession,
+ CXcapHttpAuthManager& aAuthManager,
+ CXcapHttpTransport& aTransportMain ) :
+ iHttpSession( aHttpSession ),
+ iTransportMain( aTransportMain ),
+ iSent( EFalse ),
+ iActive( EFalse ),
+ iCancelled( EFalse ),
+ iConstructed( EFalse ),
+ iAuthManager( aAuthManager )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::BaseConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::BaseConstructL( const TDesC& aRequestUri )
+ {
+ SetRequestUriL( aRequestUri );
+ iHttpResponse = CXcapHttpResponse::NewL( this, iTransportMain );
+ iResponseBuffer = CBufSeg::NewL( 250 );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::~CXcapHttpRequest
+//
+// ----------------------------------------------------------
+//
+CXcapHttpRequest::~CXcapHttpRequest()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::~CXcapHttpRequest()" ) );
+ #endif
+ delete iExpiryTimer;
+ delete iHttpResponse;
+ delete iRequestUriBuf;
+ ReleaseResponseData();
+ delete iResponseBuffer;
+ delete iWholeUri;
+ iHeaderCollection.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::DispatchRequestL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::DispatchRequestL( TRequestStatus& aClientStatus )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::DispatchMessageL()" ) );
+ iSendTime = TimeL();
+ #endif
+ ConstructRequestL();
+ DoSetHeadersL();
+ iCurrentDataLength = 0;
+ aClientStatus = KRequestPending;
+ iClientStatus = &aClientStatus;
+ iHttpTransaction.SubmitL();
+ SetStatus( ETrue );
+ iActive = ETrue;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::ConstructRequest
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::ConstructRequestL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::ConstructRequestL() - Constructed: %d" ), iConstructed );
+ #endif
+ if( !iConstructed )
+ {
+ RStringF method = ConstructMethodStringL();
+ CleanupClosePushL( method );
+ iHttpTransaction = iHttpSession.OpenTransactionL( iRequestUri, *iHttpResponse, method );
+ CleanupStack::PopAndDestroy(); //method
+ RHTTPHeaders hdrs = iHttpTransaction.Request().GetHeaderCollection();
+ iConstructed = ETrue;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::UpdateRequestUriL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::UpdateRequestUriL( const TDesC8& aUpdatedUri )
+ {
+ HBufC* temp = HBufC::NewLC( aUpdatedUri.Length() );
+ temp->Des().Copy( aUpdatedUri );
+ SetRequestUriL( temp->Des() );
+ CleanupStack::PopAndDestroy();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::ResetUriL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::ResetUriL( const TDesC& aNewUri )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::ResetUriL()" ) );
+ #endif
+ delete iRequestUriBuf;
+ iRequestUriBuf = NULL;
+ delete iWholeUri;
+ iWholeUri = NULL;
+ iWholeUri = HBufC8::NewL( aNewUri.Length() );
+ iWholeUri->Des().Copy( aNewUri );
+ iRequestUri.Parse( iWholeUri->Des() );
+ #ifdef _DEBUG
+ TPtrC8 address( iRequestUri.UriDes() );
+ iTransportMain.WriteToLog( _L8( " New URI %S"), &address );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::RequestUriL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapHttpRequest::RequestUriL() const
+ {
+ return iRequestUriBuf != NULL ? iRequestUriBuf->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::ResendL
+//
+// ----------------------------------------------------------
+//
+CXcapHttpAuthManager& CXcapHttpRequest::AuthManager()
+ {
+ return iAuthManager;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::ResendWithAuthL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::ResendWithAuthL( TInt aAuthType )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::ResendWithAuthL() - Auth type: %d" ), aAuthType );
+ #endif
+ iHttpTransaction.Cancel();
+ if( iExpiryTimer != NULL && iExpiryTimer->IsActive() )
+ iExpiryTimer->Cancel();
+ RHTTPHeaders hdrs = iHttpTransaction.Request().GetHeaderCollection();
+ AppendAuthorizationHeaderL( hdrs, aAuthType );
+ iHttpTransaction.SubmitL();
+ SetStatus( ETrue );
+ iActive = ETrue;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::Transaction
+//
+// ----------------------------------------------------------
+//
+RHTTPTransaction& CXcapHttpRequest::Transaction()
+ {
+ return iHttpTransaction;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::RelativeUri
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapHttpRequest::RelativeUri() const
+ {
+ TPtrC8 absolute( iRequestUri.UriDes() );
+ TPtrC8 temp( absolute.Mid( absolute.FindF( _L8( "//" ) ) + 2 ) );
+ return temp.Mid( temp.LocateF( '/' ) );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetStatus
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::SetRequestUriL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::SetRequestUriL()") );
+ #endif
+ delete iRequestUriBuf;
+ iRequestUriBuf = NULL;
+ iRequestUriBuf = HBufC8::NewL( aRequestUri.Length() );
+ iRequestUriBuf->Des().Copy( aRequestUri );
+ TPtrC8 document = iRequestUriBuf->Des();
+ TPtrC8 root = iTransportMain.RootUri();
+ delete iWholeUri;
+ iWholeUri = NULL;
+ iWholeUri = HBufC8::NewL( root.Length() + document.Length() );
+ iWholeUri->Des().Copy( root );
+ iWholeUri->Des().Append( document );
+ iRequestUri.Parse( iWholeUri->Des() );
+ #ifdef _DEBUG
+ TPtrC8 address( iRequestUri.UriDes() );
+ iTransportMain.WriteToLog( _L8( " URI %S"), &address );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetStatus
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::SetStatus( const TBool aSent )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::SetStatus()" ) );
+ #endif
+ iSent = aSent;
+ if( iSent )
+ {
+ if( iExpiryTimer != NULL && !iExpiryTimer->IsActive() )
+ iExpiryTimer->ActivateTimer( iExpiryTime );
+ }
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::SetStatus(): Status %d"), iSent );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetHeaderL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::SetHeaderL( const TDesC8& aHeaderName,
+ const TDesC8& aHeaderValue )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::SetHeaderL()" ) );
+ iTransportMain.WriteToLog( _L8( " Header name: %S" ), &aHeaderName );
+ iTransportMain.WriteToLog( _L8( " Header value: %S" ), &aHeaderValue );
+ #endif
+ CXcapHttpHeaderModel* model = CXcapHttpHeaderModel::NewL( aHeaderName, aHeaderValue, iTransportMain );
+ CleanupStack::PushL( model );
+ User::LeaveIfError( iHeaderCollection.Append( model ) );
+ CleanupStack::Pop(); //model
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::HeaderValue
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapHttpRequest::HeaderValue( const HTTP::TStrings aHeaderName ) const
+ {
+ THTTPHdrVal value;
+ RStringPool stringPool = iHttpSession.StringPool();
+ RHTTPHeaders headerCollection = iHttpTransaction.Response().GetHeaderCollection();
+ RStringF hdrName = stringPool.StringF( aHeaderName, RHTTPSession::GetTable() );
+ headerCollection.GetField( hdrName, 0, value );
+ hdrName.Close();
+ if( value.Type() == THTTPHdrVal::KStrVal )
+ return value.Str().DesC();
+ else if( value.Type() == THTTPHdrVal::KStrFVal )
+ return value.StrF().DesC();
+ else return TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::DoSetHeadersL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::DoSetHeadersL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::DoSetHeadersL()" ) );
+ #endif
+ TInt count = iHeaderCollection.Count();
+ RHTTPHeaders hdrs = iHttpTransaction.Request().GetHeaderCollection();
+ if( iAuthManager.IsAuthorized() )
+ AppendAuthorizationHeaderL( hdrs, KAuthTypeNormal );
+ if( iConstructed && count > 0 )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "--------------------" ) );
+ iTransportMain.WriteToLog( _L8( "User-set headers:" ) );
+ #endif
+ for( TInt i = 0;i < count;i++ )
+ {
+ TPtrC8 name = iHeaderCollection[i]->HeaderName();
+ TPtrC8 value = iHeaderCollection[i]->HeaderValue();
+ RStringF nameString = iHttpSession.StringPool().OpenFStringL( name );
+ CleanupClosePushL( nameString );
+ RStringF valueString = iHttpSession.StringPool().OpenFStringL( value );
+ CleanupClosePushL( valueString );
+ hdrs.SetFieldL( nameString, valueString );
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "* %S: %S" ), &name, &value );
+ #endif
+ CleanupStack::PopAndDestroy( 2 ); //valueString, nameString
+ }
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "--------------------" ) );
+ #endif
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::AppendAuthorizationHeaderL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::AppendAuthorizationHeaderL( RHTTPHeaders& aHeaderCollection, TInt aAuthType )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::AppendAuthorizationHeaderL()" ) );
+ #endif
+ HBufC8* authorization = iAuthManager.AuthorizationL( *this );
+ if( authorization != NULL )
+ {
+ RemoveDuplicateAuth();
+ CleanupStack::PushL( authorization );
+ RStringF valStr = iHttpSession.StringPool().OpenFStringL( *authorization );
+ CleanupClosePushL( valStr );
+ switch( aAuthType )
+ {
+ case KAuthTypeNormal:
+ aHeaderCollection.SetFieldL( iHttpSession.StringPool().StringF(
+ HTTP::EAuthorization, RHTTPSession::GetTable() ), valStr );
+ break;
+ case KAuthTypeProxy:
+ aHeaderCollection.SetFieldL( iHttpSession.StringPool().StringF(
+ HTTP::EProxyAuthorization, RHTTPSession::GetTable() ), valStr );
+ break;
+ default:
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Default case: %d" ), aAuthType );
+ #endif
+ break;
+ }
+ CleanupStack::PopAndDestroy( 2 ); //valStr, authorization
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::RemoveDuplicateAuth
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::RemoveDuplicateAuth()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::RemoveDuplicateAuth()" ) );
+ #endif
+ RStringPool spool = iHttpSession.StringPool();
+ RHTTPHeaders requestHeaders( iHttpTransaction.Request().GetHeaderCollection() );
+ //Check for existence of the header is not needed, remove both if they're there
+ requestHeaders.RemoveField( spool.StringF( HTTP::EAuthorization, RHTTPSession::GetTable() ) );
+ requestHeaders.RemoveField( spool.StringF( HTTP::EProxyAuthorization, RHTTPSession::GetTable() ) );
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::AppendDataL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::AppendDataL( const TPtrC8& aBodyPart )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::AppendDataL() - Current: %d" ),
+ iCurrentDataLength );
+ #endif
+ iResponseBuffer->ResizeL( iCurrentDataLength + aBodyPart.Length() );
+ iResponseBuffer->Write( iCurrentDataLength, aBodyPart );
+ iCurrentDataLength = iCurrentDataLength + aBodyPart.Length();
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Current: %d" ), iCurrentDataLength );
+ iTransportMain.WriteToLog( _L8( " Buffer size: %d" ), iResponseBuffer->Size() );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetStatus
+//
+// ----------------------------------------------------------
+//
+RHTTPSession& CXcapHttpRequest::Session()
+ {
+ return iHttpSession;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetStatus
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TXdmCompletionData* CXcapHttpRequest::ResponseData()
+ {
+ return &iRespData;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::ReleaseResponseData
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::ReleaseResponseData()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::ReleaseResponseData()" ) );
+ #endif
+ if( iRespData.iETag != NULL )
+ {
+ delete iRespData.iETag;
+ iRespData.iETag = NULL;
+ }
+ if( iRespData.iStatusText != NULL )
+ {
+ delete iRespData.iStatusText;
+ iRespData.iStatusText = NULL;
+ }
+ if( iRespData.iResponseData != NULL )
+ {
+ delete iRespData.iResponseData;
+ iRespData.iResponseData = NULL;
+ }
+ if( iConstructed )
+ {
+ iConstructed = EFalse;
+ iHttpTransaction.Close();
+ }
+ iHeaderCollection.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::SetExpiryTimeL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::SetExpiryTimeL( MXcapHttpRequestTimerCallback* /*aCallback*/,
+ const TTimeIntervalMicroSeconds32 aExpiryTime )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::SetExpiryTimeL()" ) );
+ #endif
+ if( iExpiryTimer == NULL )
+ iExpiryTimer = CXcapHttpRequestTimer::NewL( iTransportMain, this );
+ iExpiryTime = aExpiryTime;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::FinaliseRequestL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::FinaliseRequestL( TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::FinaliseRequestL()" ) );
+ iTransportMain.WriteToLog( _L8( " Error: %d" ), aErrorCode );
+ iTransportMain.WriteToLog( _L8( " Active: %d" ), iActive );
+ #endif
+ if( iActive )
+ {
+ iActive = EFalse;
+ if( iExpiryTimer )
+ iExpiryTimer->Cancel();
+ PrepareResponseBodyL();
+ CompileResponseDataL( aErrorCode );
+ User::RequestComplete( iClientStatus, aErrorCode );
+ delete iWholeUri;
+ iWholeUri = NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::CancelRequest
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapHttpRequest::CancelRequest()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::CancelRequest()" ) );
+ #endif
+ if( iActive )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Request is active, cancelling..." ) );
+ #endif
+ if( iExpiryTimer )
+ iExpiryTimer->Cancel();
+ iActive = EFalse;
+ iConstructed = EFalse;
+ iHttpTransaction.Close();
+ iRespData.iETag = NULL;
+ iRespData.iStatusText = NULL;
+ iRespData.iResponseData = NULL;
+ iRespData.iCompletion = KErrCancel;
+ iRespData.iHttpStatus = KErrCancel;
+ User::RequestComplete( iClientStatus, KErrCancel );
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Request completed with KErrCancel" ) );
+ #endif
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::CompileResponseData
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::CompileResponseDataL( TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L( "CXcapHttpRequest::CompileResponseData()" ) );
+ #endif
+ RHTTPResponse response = iHttpTransaction.Response();
+ TInt statusInt = response.StatusCode();
+ RStringF statusStr = response.StatusText();
+ HBufC8* statusBuf = statusStr.DesC().AllocLC();
+ TPtrC8 etagDesc( HeaderValue( HTTP::EETag ) );
+ HBufC8* eTag = etagDesc.Length() > 0 ? etagDesc.AllocL() : NULL;
+ iRespData.iETag = eTag;
+ iRespData.iHttpStatus = statusInt;
+ iRespData.iStatusText = statusBuf;
+ iRespData.iCompletion = aErrorCode;
+ iRespData.iResponseData = iFlatResponse;
+ CleanupStack::Pop(); //statusBuf
+ #ifdef _DEBUG
+ if( iRespData.iResponseData != NULL )
+ {
+ TBuf<32> response( _L( "response" ) );
+ response.AppendNum( iHttpTransaction.Id() );
+ response.Append( _L( ".xml" ) );
+ DumpResponseL( *iRespData.iResponseData, response );
+ }
+ #endif
+ }
+
+#ifdef _DEBUG
+// ---------------------------------------------------------
+// CXcapHttpRequest::DumpResponseL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpRequest::DumpResponseL( const TDesC8& aRespData, const TDesC& aDumpName )
+ {
+ RFile file;
+ RFs session;
+ TBuf<512> path( _L( "C:\\logs\\XDM\\" ) );
+ path.Append( aDumpName );
+ User::LeaveIfError( session.Connect() );
+ TInt error( file.Replace( session, path, EFileWrite ) );
+ if( error == KErrNone )
+ {
+ file.Write( aRespData );
+ file.Close();
+ }
+ session.Close();
+ }
+#endif
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::PrepareResponseBodyL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::PrepareResponseBodyL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::PrepareResponseBodyL()" ) );
+ #endif
+ iResponseBuffer->Compress();
+ TInt dataLength = iResponseBuffer->Size();
+ #ifdef _DEBUG
+ TInt contentLength = iHttpResponse->ContentLengthL();
+ if( contentLength >= 0 && contentLength < KMaxTInt )
+ {
+ TPtrC8 result;
+ contentLength == dataLength ? result.Set( _L8( "Correct" ) ) :
+ result.Set( _L8( "Values do not match!" ) );
+ iTransportMain.WriteToLog( _L8( " Actual length: %d *** Content-Length: %d => %S" ),
+ dataLength, contentLength, &result );
+ }
+ #endif
+ if( dataLength > 0 )
+ {
+ iFlatResponse = HBufC8::NewL( dataLength );
+ TPtr8 pointer( iFlatResponse->Des() );
+ iResponseBuffer->Read( 0, pointer, dataLength );
+ //pointer.Copy( iResponseBuffer->Ptr( 0 ) );
+ iResponseBuffer->Reset();
+ iCurrentDataLength = 0;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpRequest::HandleTimerEventL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpRequest::HandleTimerEventL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequest::HandleTimerEventL()" ) );
+ #endif
+ iHttpTransaction.Close();
+ iActive = EFalse;
+ iConstructed = EFalse;
+ iRespData.iETag = NULL;
+ iRespData.iStatusText = NULL;
+ iRespData.iResponseData = NULL;
+ iRespData.iCompletion = KErrTimedOut;
+ iRespData.iHttpStatus = KErrTimedOut;
+ User::RequestComplete( iClientStatus, KErrTimedOut );
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Request completed with KErrTimedOut" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequest::TimeL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapHttpRequest::TimeL() const
+ {
+ TInt period = 0;
+ User::LeaveIfError( HAL::Get( HALData::ESystemTickPeriod, period ) );
+ TInt millisecsPerTick = period / 1000;
+ return User::TickCount() * millisecsPerTick;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpRequestTimer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpRequestTimer
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XcapHttpTransport.h"
+#include "XcapHttpRequestTimer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapHttpRequestTimer::CXcapHttpRequestTimer( CXcapHttpTransport& aTransportMain,
+ MXcapHttpRequestTimerCallback* aCallback ) :
+ CActive( 0 ),
+ iTransportMain( aTransportMain ),
+ iCallback( aCallback )
+
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::ConstructL()
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpRequestTimer::ConstructL()
+ {
+ User::LeaveIfError( iTimer.CreateLocal() );
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::NewL
+//
+// ---------------------------------------------------------
+//
+CXcapHttpRequestTimer* CXcapHttpRequestTimer::NewL( CXcapHttpTransport& aTransportMain,
+ MXcapHttpRequestTimerCallback* aCallback )
+ {
+ CXcapHttpRequestTimer* self = new ( ELeave ) CXcapHttpRequestTimer( aTransportMain, aCallback );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::~CXcapHttpRequestTimer()
+//
+// ---------------------------------------------------------
+//
+CXcapHttpRequestTimer::~CXcapHttpRequestTimer()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequestTimer::~CXcapHttpRequestTimer()" ) );
+ #endif
+ Cancel();
+ iTimer.Close();
+ }
+
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::ActivateTimer
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpRequestTimer::ActivateTimer( TTimeIntervalMicroSeconds32 aDelay )
+ {
+ __ASSERT_ALWAYS( !IsActive(), User::Panic( _L( "CXcapHttpRequestTimer" ), 1 ) );
+ iTimer.After( iStatus, aDelay );
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequestTimer activated." ) );
+ #endif
+ SetActive();
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::RunL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpRequestTimer::RunL()
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequestTimer::RunL()." ) );
+ #endif
+ iCallback->HandleTimerEventL();
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpRequestTimer::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpRequestTimer::DoCancel()
+ {
+ iTimer.Cancel();
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpRequestTimer cancelled." ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpResponse.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,442 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpResponse
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <XdmErrors.h>
+#include "XdmCredentials.h"
+#include "XcapHttpRequest.h"
+#include "XcapHttpResponse.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpAuthManager.h"
+
+const TUint KMaxRetryCount = 3;
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+
+// ----------------------------------------------------------
+// CXcapHttpResponse::CXcapHttpResponse
+//
+// ----------------------------------------------------------
+//
+CXcapHttpResponse::CXcapHttpResponse( CXcapHttpRequest* aHttpRequest,
+ CXcapHttpTransport& aTransportMain ) :
+ iAuthPending( EFalse ),
+ iHttpRequest( aHttpRequest ),
+ iTransportMain( aTransportMain ),
+ iAuthManager( iHttpRequest->AuthManager() )
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::NewL
+//
+// ----------------------------------------------------
+//
+CXcapHttpResponse* CXcapHttpResponse::NewL( CXcapHttpRequest* aHttpRequest,
+ CXcapHttpTransport& aTransportMain )
+ {
+ CXcapHttpResponse* self = new ( ELeave ) CXcapHttpResponse( aHttpRequest, aTransportMain );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXcapHttpResponse::ConstructL()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::~CXcapHttpResponse()
+// Destructor
+// ----------------------------------------------------
+//
+CXcapHttpResponse::~CXcapHttpResponse()
+ {
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::MHFRunL
+//
+// ----------------------------------------------------
+//
+void CXcapHttpResponse::MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent )
+ {
+ TInt status = aTransaction.Response().StatusCode();
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpResponse::MHFRunL()" ) );
+ iTransportMain.WriteToLog( _L8( " HTTP status: %d" ), status );
+ iTransportMain.WriteToLog( _L8( " Event status: %d" ), aEvent.iStatus );
+ iTransportMain.WriteToLog( _L8( " TransID: %d " ), aTransaction.Id() );
+ #endif
+ switch( aEvent.iStatus )
+ {
+ case THTTPEvent::EGotResponseHeaders:
+ #ifdef _DEBUG
+ DumpHeadersL( aTransaction.Response().GetHeaderCollection(), aTransaction.Id() );
+ //DumpHeadersL( aTransaction.Request().GetHeaderCollection(), aTransaction.Id() );
+ #endif
+ TInt authType;
+ if( IsUnauthRequest( aTransaction, authType ) )
+ {
+ // If server keeps on sending 401 resposenses. Will stop
+ // sending new requests after 3 trys.
+ if ( KMaxRetryCount == iUnauthRequestCounter )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog(
+ _L8( " Max retry count. Stop sending auth requests to server." ) );
+ #endif
+ iHttpRequest->FinaliseRequestL( KErrCancel );
+ aTransaction.Cancel();
+ }
+ //We only support Digest => If Basic is defined, stop.
+ else if( iAuthManager.ParseHeaderL( aTransaction, authType ) )
+ {
+ iHttpRequest->ResendWithAuthL( authType );
+ iAuthPending = ETrue;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Basic authentication not supported" ) );
+ #endif
+ iHttpRequest->FinaliseRequestL( KXcapErrorAuthentication );
+ aTransaction.Cancel();
+ }
+ }
+ else if( iAuthPending && ( status != 401 && status != 403 ) )
+ {
+ iAuthPending = EFalse;
+ iAuthManager.SetAuthorized( ETrue );
+ }
+ else if( !CheckAuthInfoHeaderL( aTransaction.Response().GetHeaderCollection() ) )
+ {
+ //This means that something was wrong with the Authentication-Info header
+ //the server returned. Do not take any chances here, but stop.
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " Something's wrong with Authentication-Info => STOP" ) );
+ #endif
+ iHttpRequest->FinaliseRequestL( KXcapErrorAuthentication );
+ aTransaction.Cancel();
+ }
+ break;
+ case THTTPEvent::EGotResponseBodyData:
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "MHFRunL() - A body part received" ) );
+ #endif
+ HandleReceivedBodyDataL( aTransaction );
+ break;
+ case THTTPEvent::EResponseComplete:
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " * Transaction complete") );
+ #endif
+ break;
+ case THTTPEvent::ESucceeded:
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " * Transaction succeeded") );
+ #endif
+ iHttpRequest->FinaliseRequestL( KErrNone );
+ break;
+ case THTTPEvent::EFailed:
+ {
+ TInt completion = aEvent.iStatus < 0 ? aEvent.iStatus : KErrNone;
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " * Transaction failed - Completion: %d"), completion );
+ #endif
+ iHttpRequest->FinaliseRequestL( completion );
+ }
+ break;
+ case THTTPEvent::ERedirectedPermanently:
+ break;
+ case THTTPEvent::ERedirectedTemporarily:
+ break;
+ default:
+ {
+ if( aEvent.iStatus < KErrNone )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " * Transaction failed, stop" ) );
+ #endif
+ iHttpRequest->FinaliseRequestL( aEvent.iStatus );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( " * Unknown status, stop" ) );
+ #endif
+ iHttpRequest->FinaliseRequestL( KErrUnknown );
+ }
+ }
+ break;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::CheckAuthInfoHeaderL
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpResponse::CheckAuthInfoHeaderL( RHTTPHeaders aHeaders )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpResponse::CheckAuthInfoHeaderL()" ) );
+ #endif
+ THTTPHdrVal fieldVal;
+ TBool authOk = ETrue;
+ TPtrC8 rawData( _L8( "" ) );
+ RStringPool spool = iHttpRequest->Session().StringPool();
+ RStringF authInfo = spool.OpenFStringL( TPtrC8( KAuthInfoParamArray[ENfoAuthInfo] ) );
+ CleanupClosePushL( authInfo );
+ RStringF prxAuthInfo = spool.OpenFStringL( TPtrC8( KAuthInfoParamArray[ENfoPrxAuthInfo] ) );
+ CleanupClosePushL( prxAuthInfo );
+ if( aHeaders.GetRawField( authInfo, rawData ) == KErrNone ||
+ aHeaders.GetRawField( prxAuthInfo, rawData ) == KErrNone )
+ {
+ TInt length = 0;
+ HBufC8* tempCopy = rawData.AllocLC();
+ TPtr8 modDesc( tempCopy->Des() );
+ while( authOk && modDesc.Length() > 0 )
+ {
+ TPtrC8 value;
+ TAuthInfoParam name = ( TAuthInfoParam )-1;
+ if( ParseAuthInfoParam( length, name, value, modDesc ) )
+ authOk = iAuthManager.ConsumeAuthInfoParamL( name, value );
+ modDesc.Delete( 0, length );
+ modDesc.TrimLeft();
+ }
+ CleanupStack::PopAndDestroy(); //tempCopy
+ }
+ CleanupStack::PopAndDestroy( 2 ); //prxAuthInfo, authInfo
+ return authOk;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpAuthManager::ParseAuthInfoParam
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpResponse::ParseAuthInfoParam( TInt& aLength, TAuthInfoParam& aName, TPtrC8& aValue, TPtr8& aParam )
+ {
+ TBool found = EFalse;
+ TInt delim = aParam.Locate( ',' );
+ TPtrC8 param( delim > 0 ? aParam.Left( delim ) : aParam );
+ TInt index = param.Locate( '=' );
+ if( index > 0 )
+ {
+ TPtrC8 name( param.Left( index ) );
+ TPtrC8 value( param.Mid( index + 1 ) );
+ const TInt count = sizeof( KAuthInfoParamArray ) / sizeof( KAuthInfoParamArray[0] );
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ if( name.CompareF( TPtrC8( KAuthInfoParamArray[i] ) ) == 0 )
+ {
+ aValue.Set( value );
+ aName = ( TAuthInfoParam )i;
+ found = ETrue;
+ }
+ }
+ }
+ aLength = delim > 0 ? delim + 1 : aParam.Length();
+ return found;
+ }
+
+
+// ----------------------------------------------------------
+// CXcapHttpResponse::IsUnauthRequest
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpResponse::IsUnauthRequest( RHTTPTransaction aTransaction, TInt& aAuthType )
+ {
+ iUnauthRequestCounter++;
+ TInt status = aTransaction.Response().StatusCode();
+ switch( status )
+ {
+ case 401: //Normal authentication
+ aAuthType = 401;
+ return ETrue;
+ case 407: //Proxy authentication
+ aAuthType = 407;
+ return ETrue;
+ default:
+ return EFalse;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpResponse::HandleReceivedBodyDataL
+//
+// ----------------------------------------------------------
+//
+TBool CXcapHttpResponse::HandleReceivedBodyDataL( const RHTTPTransaction aTransaction )
+ {
+ #ifdef _DEBUG
+ iTransportMain.WriteToLog( _L8( "CXcapHttpResponse::HandleReceivedBodyDataL()") );
+ #endif
+ TPtrC8 bodyData;
+ MHTTPDataSupplier* respBody = aTransaction.Response().Body();
+ TBool lastChunk = respBody->GetNextDataPart( bodyData );
+ iHttpRequest->AppendDataL( bodyData );
+ respBody->ReleaseData();
+ return lastChunk;
+ }
+
+// ----------------------------------------------------------
+// CImpsHttpTransactionSender::ContentLengthL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapHttpResponse::ContentLengthL() const
+ {
+ TInt retVal = KMaxTInt;
+ THTTPHdrVal fieldValue;
+ _LIT8( KContentLength, "Content-Length" );
+ RHTTPHeaders headers = ResponseHeaderCollection();
+ RStringPool stringPool = iHttpRequest->Session().StringPool();
+ RStringF lengthString = stringPool.OpenFStringL( KContentLength );
+ headers.GetField( lengthString, 0, fieldValue );
+ lengthString.Close();
+ if( fieldValue.Type() == THTTPHdrVal::KTIntVal )
+ retVal = fieldValue.Int();
+ return retVal;
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::HeaderCollection
+//
+// ----------------------------------------------------
+//
+RHTTPHeaders CXcapHttpResponse::ResponseHeaderCollection() const
+ {
+ return iHttpRequest->Transaction().Response().GetHeaderCollection();
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::HeaderCollection
+//
+// ----------------------------------------------------
+//
+RHTTPHeaders CXcapHttpResponse::RequestHeaderCollection() const
+ {
+ return iHttpRequest->Transaction().Request().GetHeaderCollection();
+ }
+
+// ----------------------------------------------------
+// CXcapHttpResponse::MHFRunError
+// HTTP Stack callback interface
+// ----------------------------------------------------
+//
+TInt CXcapHttpResponse::MHFRunError( TInt /*aInt*/, RHTTPTransaction /*aTransaction*/,
+ const THTTPEvent& /*aEvent*/ )
+ {
+ return KErrNone;
+ }
+
+#ifdef _DEBUG
+// ----------------------------------------------------
+// CXcapHttpResponse::DumpHeadersL
+//
+// ----------------------------------------------------
+//
+void CXcapHttpResponse::DumpHeadersL( RHTTPHeaders aHeaders, TInt aId )
+ {
+ iTransportMain.WriteToLog( _L( "--------------------") );
+ iTransportMain.WriteToLog( _L( "Headers of the transaction %d: "), aId );
+ RStringPool strP = iHttpRequest->Session().StringPool();
+ THTTPHdrFieldIter it = aHeaders.Fields();
+ TBuf<KMaxHeaderNameLen> fieldName16;
+ TBuf<KMaxHeaderValueLen> fieldVal16;
+
+ while( it.AtEnd() == EFalse )
+ {
+ RStringTokenF fieldName = it();
+ RStringF fieldNameStr = strP.StringF( fieldName );
+ THTTPHdrVal fieldVal;
+ if( aHeaders.GetField( fieldNameStr, 0, fieldVal ) == KErrNone )
+ {
+ const TDesC8& fieldNameDesC = fieldNameStr.DesC();
+ fieldName16.Copy( fieldNameDesC.Left( KMaxHeaderNameLen ) );
+ switch( fieldVal.Type() )
+ {
+ case THTTPHdrVal::KTIntVal:
+ iTransportMain.WriteToLog( _L("%S: %d"), &fieldName16, fieldVal.Int() );
+ break;
+ case THTTPHdrVal::KStrFVal:
+ {
+ RStringF fieldValStr = strP.StringF( fieldVal.StrF() );
+ const TDesC8& fieldValDesC = fieldValStr.DesC();
+ fieldVal16.Copy( fieldValDesC.Left( KMaxHeaderValueLen ) );
+ iTransportMain.WriteToLog( _L( "%S: %S" ), &fieldName16, &fieldVal16 );
+ }
+ break;
+ case THTTPHdrVal::KStrVal:
+ {
+ RString fieldValStr = strP.String(fieldVal.Str());
+ const TDesC8& fieldValDesC = fieldValStr.DesC();
+ fieldVal16.Copy( fieldValDesC.Left( KMaxHeaderValueLen ) );
+ iTransportMain.WriteToLog( _L( "%S: %S" ), &fieldName16, &fieldVal16 );
+ }
+ break;
+ case THTTPHdrVal::KDateVal:
+ {
+ TDateTime date = fieldVal.DateTime();
+ TBuf<40> dateTimeString;
+ TTime t(date);
+ t.FormatL( dateTimeString,KTransportDateFormat );
+ iTransportMain.WriteToLog( _L( "%S: %S" ), &fieldName16, &dateTimeString );
+ }
+ break;
+ default:
+ iTransportMain.WriteToLog( _L( "%S: <unrecognised value type>" ), &fieldName16 );
+ break;
+ }
+ // Display realm for WWW-Authenticate header
+ RStringF wwwAuth = strP.StringF( HTTP::EWWWAuthenticate, RHTTPSession::GetTable() );
+ if( fieldNameStr == wwwAuth )
+ {
+ // check the auth scheme is 'basic'
+ RStringF basic = strP.StringF( HTTP::EBasic,RHTTPSession::GetTable() );
+ RStringF realm = strP.StringF( HTTP::ERealm,RHTTPSession::GetTable() );
+ THTTPHdrVal realmVal;
+ if ( (fieldVal.StrF() == basic ) &&
+ ( !aHeaders.GetParam(wwwAuth, realm, realmVal) ) )
+ {
+ RStringF realmValStr = strP.StringF( realmVal.StrF() );
+ fieldVal16.Copy( realmValStr.DesC() );
+ iTransportMain.WriteToLog( _L( "Realm is: %S" ), &fieldVal16 );
+ }
+ }
+ }
+ ++it;
+ }
+ iTransportMain.WriteToLog( _L( "--------------------") );
+ }
+ #endif
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpTransport.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,287 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpTransport
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <in_iface.h>
+#include <xdmlogwriter.h>
+#include <deflatefilterinterface.h>
+#include <msgconnmanagerapi.h>
+#include "XdmCredentials.h"
+#include "XcapHttpReqGet.h"
+#include "XcapHttpReqPut.h"
+#include "XcapHttpReqMkcol.h"
+#include "XcapHttpReqHead.h"
+#include "XcapHttpRequest.h"
+#include "XcapHttpReqDelete.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpAuthManager.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+
+// ----------------------------------------------------------
+// CXcapHttpTransport::CXcapHttpTransport
+//
+// ----------------------------------------------------------
+//
+CXcapHttpTransport::CXcapHttpTransport( MMsgConnManager& aConnManager) :
+ iCredValidity( EFalse ),
+ iSessionClosed( ETrue ),
+ iConnManager( aConnManager )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpTransport::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXcapHttpTransport* CXcapHttpTransport::NewL( const TDesC& aRootUri,
+ MMsgConnManager& aConnManager,
+ const TXdmCredentials& aDigestCredentials )
+ {
+ CXcapHttpTransport* self = new ( ELeave ) CXcapHttpTransport( aConnManager );
+ CleanupStack::PushL( self );
+ self->ConstructL( aRootUri, aDigestCredentials );
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::~CXcapHttpTransport
+//
+// ----------------------------------------------------
+//
+CXcapHttpTransport::~CXcapHttpTransport()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::~CXcapHttpTransport()" ) );
+ #endif
+ delete iRootUri;
+ delete iAuthManager;
+ iHttpSession.Close();
+ iSessionClosed = ETrue;
+ delete iProxyBuffer;
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Destructor ends." ) );
+ #endif
+ delete iLogWriter;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpTransport::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapHttpTransport::ConstructL( const TDesC& aRootUri, const TXdmCredentials& aDigestCredentials )
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KTransportLogFile );
+ WriteToLog( _L8( "CXcapHttpTransport::ConstructL" ) );
+ #endif
+ SetRootUriL( aRootUri );
+ InitialiseSessionL();
+ iAuthManager = CXcapHttpAuthManager::NewL( iHttpSession, *this, aDigestCredentials );
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpTransport::SetRootUriL
+//
+// ---------------------------------------------------------
+//
+EXPORT_C void CXcapHttpTransport::SetRootUriL( const TDesC& aRootUri )
+ {
+ delete iRootUri;
+ iRootUri = NULL;
+ iRootUri = HBufC8::NewL( aRootUri.Length() );
+ iRootUri->Des().Copy( aRootUri );
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::GetL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapHttpReqGet* CXcapHttpTransport::GetL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::GetRequestL()" ) );
+ #endif
+ if( !iSessionClosed )
+ return CXcapHttpReqGet::NewL( aRequestUri, iHttpSession, *iAuthManager, *this );
+ else
+ {
+ User::Leave( KErrNotReady );
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::PutL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapHttpReqPut* CXcapHttpTransport::PutL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::PutRequestL()" ) );
+ #endif
+ if( !iSessionClosed )
+ return CXcapHttpReqPut::NewL( aRequestUri, iHttpSession, *iAuthManager, *this );
+ else
+ {
+ User::Leave( KErrNotReady );
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::Mkcol
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapHttpReqMkcol* CXcapHttpTransport::MkcolL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::MkcolRequestL()" ) );
+ #endif
+ if( !iSessionClosed )
+ return CXcapHttpReqMkcol::NewL( aRequestUri, iHttpSession, *iAuthManager, *this );
+ else
+ {
+ User::Leave( KErrNotReady );
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::Head
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapHttpReqHead* CXcapHttpTransport::HeadL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::HeadRequestL()" ) );
+ #endif
+ if( !iSessionClosed )
+ return CXcapHttpReqHead::NewL( aRequestUri, iHttpSession, *iAuthManager, *this );
+ else
+ {
+ User::Leave( KErrNotReady );
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::DeleteL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapHttpReqDelete* CXcapHttpTransport::DeleteL( const TDesC& aRequestUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::DeleteRequestL()" ) );
+ #endif
+ if( !iSessionClosed )
+ return CXcapHttpReqDelete::NewL( aRequestUri, iHttpSession, *iAuthManager, *this );
+ else
+ {
+ User::Leave( KErrNotReady );
+ return NULL;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpTransport::RootUri
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapHttpTransport::RootUri()
+ {
+ return iRootUri != NULL ? iRootUri->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::InitialiseSessionL
+//
+// ----------------------------------------------------
+//
+void CXcapHttpTransport::InitialiseSessionL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapHttpTransport::InitialiseSessionL()" ) );
+ #endif
+ iHttpSession.OpenL();
+ RSocketServ& session = iConnManager.SocketSession();
+ RConnection& connection = iConnManager.Connection();
+ RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
+ RStringPool stringPool = iHttpSession.StringPool();
+ TInt conn = reinterpret_cast <TInt> ( &connection );
+ connInfo.SetPropertyL( stringPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
+ THTTPHdrVal( session.Handle() ) );
+ connInfo.SetPropertyL( stringPool.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ),
+ THTTPHdrVal( conn ) );
+ connInfo.SetPropertyL( stringPool.StringF( HTTP::EHTTPVersion, RHTTPSession::GetTable() ),
+ THTTPHdrVal( stringPool.StringF( HTTP::EHttp11, RHTTPSession::GetTable() ) ) );
+ connInfo.SetPropertyL( stringPool.StringF( HTTP::ESecureDialog, RHTTPSession::GetTable() ),
+ THTTPHdrVal( stringPool.StringF( HTTP::EDialogPrompt, RHTTPSession::GetTable() ) ) );
+ //CHttpDeflateFilter::InstallFilterL( iHttpSession );
+ iSessionClosed = EFalse;
+ #ifdef _DEBUG
+ WriteToLog( _L8( "InitialiseSessionL() ends." ) );
+ #endif
+ }
+
+#ifdef _DEBUG
+// ----------------------------------------------------
+// CXcapHttpTransport::WriteToLog
+// Writes to the log, 8-bit version
+// ----------------------------------------------------
+//
+void CXcapHttpTransport::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ----------------------------------------------------
+// CXcapHttpTransport::WriteToLog
+// Writes to the log, 16-bit version
+// ----------------------------------------------------
+//
+void CXcapHttpTransport::WriteToLog( TRefByValue<const TDesC> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+#endif //_DEBUG
+
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/BWINSCW/XcapOperationsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/eabi/XcapOperationsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/group/XcapOperations.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapOperations.dll from XcapOperations.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcapoperations.dll
+UID 0x10009D8D 0x10207410
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+TARGETTYPE PLUGIN
+
+SOURCEPATH ../src
+
+START RESOURCE 10207410.rss
+
+TARGET xcapoperations.rsc
+
+END
+
+SOURCE XcapAddition.cpp
+SOURCE XcapDeletion.cpp
+SOURCE XcapRetrieval.cpp
+SOURCE XcapInsertion.cpp
+SOURCE XcapUriParser.cpp
+SOURCE XcapReplacement.cpp
+SOURCE XcapHttpOperation.cpp
+SOURCE XcapOperationFactory.cpp
+
+//Internal
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../XcapCache/inc
+USERINCLUDE ../../XcapUtils/inc
+USERINCLUDE ../../XcapAppUsage/inc
+USERINCLUDE ../../XcapHttpTransport/inc
+
+//Common
+USERINCLUDE ../../../XdmXmlParser/inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/xml
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../../inc
+
+LIBRARY hal.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+
+LIBRARY inetprotutil.lib
+
+LIBRARY flogger.lib
+LIBRARY xdmengine.lib
+LIBRARY xdmxmlparser.lib
+LIBRARY xcapprotocol.lib
+LIBRARY xcapappusage.lib
+LIBRARY xcapcacheclient.lib
+LIBRARY xcaphttptransport.lib
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../BWINSCW/
+#elif defined (WINS )
+deffile ../BWINS/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapOperations bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XcapOperations.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapAddition.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapAddition
+*
+*/
+
+
+
+
+#ifndef __XCAPADDITION__
+#define __XCAPADDITION__
+
+#include <e32base.h>
+#include "XcapHttpOperation.h"
+
+//FORWARD DECLARATIONS
+class CXcapHttpReqPut;
+class CXcapDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapAddition ) : public CXcapHttpOperation
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapAddition* NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Handle a successful operation
+ */
+ virtual void OperationCompleteL();
+
+ /**
+ * Handle a failed operation
+ */
+ virtual void OperationFailedL();
+
+ /**
+ * Destructor.
+ */
+ virtual TBool Result() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapAddition();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapAddition( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ExecuteL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TXdmOperationType DetermineOperationType();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void UpdatePartialToCacheL( RXcapCache* aCache, const TDesC8& aNewData );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual TInt FormatModRequestL( const CXdmDocumentNode* aDocumentNode );
+
+ private: //Data
+
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__XCAPPARTIALADDITION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapDeletion.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDeletion
+*
+*/
+
+
+
+
+#ifndef __XCAPDELETION__
+#define __XCAPDELETION__
+
+#include <e32base.h>
+#include "XcapHttpOperation.h"
+
+//FORWARD DECLARATIONS
+class CXcapDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapDeletion ) : public CXcapHttpOperation
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapDeletion* NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Handle a successful operation
+ */
+ virtual void OperationCompleteL();
+
+ /**
+ * Handle a failed operation
+ */
+ virtual void OperationFailedL();
+
+ /**
+ * Destructor.
+ */
+ virtual TBool Result() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapDeletion();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapDeletion( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ExecuteL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandleDocDeletion();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandlePartialDeletion();
+
+ private: //Data
+
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__XCAPDELETION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapHttpOperation.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,264 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpOperation
+*
+*/
+
+
+
+
+#ifndef __XCAPHTTPOPERATION__
+#define __XCAPHTTPOPERATION__
+
+#include <e32base.h>
+#include "XdmOperation.h"
+#include "XcapOperationFactory.h"
+#include "XcapHttpRequestTimerCallback.h"
+
+//The default timout for HTTP requests in seconds
+const TInt KDefaultHttpRequestTimeout = 30;
+
+//Set, if document should be fetched from cache when processing a doc subset
+const TInt KFetchMasterFromCache = KXdmOption1;
+
+//Set, if rules concerning document subsets should be applied when processing responses
+const TInt KDocumentSubset = KXdmOption2;
+
+//Set, if the document an operation targets should not be cached (a directory document, for example)
+const TInt KNoCache = KXdmOption3;
+
+//Set, if EARLY-IMS is in use => add the public ID in X-3GPP-Intended-Identity header
+const TInt KUseIntendedIdentity = KXdmOption4;
+
+//FORWARD DECLARATION
+class RXcapCache;
+class CXdmDocument;
+class CXcapDocument;
+class CXdmXmlParser;
+class CXcapUriParser;
+class CXcapHttpRequest;
+class CXdmDocumentNode;
+class CXcapDocumentNode;
+class CXcapHttpTransport;
+
+//Override application usage validation
+//Must ONLY be used for testing, comment out before release
+//#define __OVERRIDE_VALIDATION__
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapHttpOperation ) : public CActive,
+ public MXdmOperation
+
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static void EscapeLC( CXdmDocumentNode& aRootNode );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static HBufC8* EscapeLC( const TDesC8& aDescriptor );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static HBufC8* Escape2LC( const TDesC& aDescriptor );
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ void ExecuteL( TRequestStatus& aStatus, TUint aOptions );
+
+ /**
+ * Destructor.
+ */
+ TInt Result() const;
+
+ /**
+ * Destructor.
+ */
+ const TXdmCompletionData& CompletionData() const;
+
+ /**
+ * Destructor.
+ */
+ TBool IsCompleted() const;
+
+ /**
+ * Set this operation to completed state.
+ */
+ void Destroy();
+
+ /**
+ * Set this operation to completed state.
+ */
+ virtual CXdmDocumentNode* TargetNode() const;
+
+ /**
+ * Destructor.
+ */
+ CXcapHttpRequest* HttpRequest() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapHttpOperation();
+
+ protected: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapHttpOperation( const CXdmDocument& aTargetDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void BaseConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TPtrC8 Descriptor( HBufC8* aBuffer );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TInt ReinterpretStatus( const TInt aHttpStatus ) const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapHttpTransport& Transport() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual void OperationCompleteL() = 0;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual void OperationFailedL() = 0;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual void ExecuteL() = 0;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual void ExecuteL( CXcapHttpRequest* aHttpRequest,
+ CXdmDocumentNode* aDocumentNode );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual TInt FormatModRequestL( const CXdmDocumentNode* aDocumentNode );
+
+ private:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void RunL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void DoCancel();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TBool StartOperationL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void CancelOperation();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandleTimerEventL();
+
+ protected:
+
+ TInt iResult;
+ TInt iCurrentIndex;
+ TBool iCompleted;
+ TBool iPartial;
+ TUint iOptionFlags;
+ CXdmXmlParser* iXmlParser;
+ TXdmCompletionData iFailureData;
+ TXdmCompletionData* iRequestData;
+ TRequestStatus* iClientStatus;
+ CXcapUriParser* iUriParser;
+ CXcapHttpRequest* iActiveRequest;
+ CXcapDocumentNode* iDocumentSubset;
+ CXcapDocument& iTargetDoc;
+ CXcapOperationFactory& iOperationFactory;
+ RPointerArray<CXcapHttpRequest> iRequestQueue;
+
+ private: //Data
+ };
+
+#endif //__XCAPHTTPOPERATION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapInsertion.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapInsertion
+*
+*/
+
+
+
+
+#ifndef __XCAPINSERTION__
+#define __XCAPINSERTION__
+
+#include <e32base.h>
+#include "XcapHttpOperation.h"
+
+//FORWARD DECLARATIONS
+class CXcapHttpReqPut;
+class CXcapDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapInsertion ) : public CXcapHttpOperation
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapInsertion* NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentExtents,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Handle a successful operation
+ */
+ virtual void OperationCompleteL();
+
+ /**
+ * Handle a failed operation
+ */
+ virtual void OperationFailedL();
+
+ /**
+ * Destructor.
+ */
+ virtual TBool Result() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapInsertion();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapInsertion( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ExecuteL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ virtual TInt FormatModRequestL( const CXdmDocumentNode* aDocumentNode );
+
+ private: //Data
+
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__XCAPINSERTION__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapOperationFactory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOperationFactory
+*
+*/
+
+
+
+
+#ifndef __XCAPOPERATIONFACTORY__
+#define __XCAPOPERATIONFACTORY__
+
+#include <e32base.h>
+#include "XdmOperationFactory.h"
+
+_LIT( KOperationsLogFile, "XcapOperations" );
+const TInt KOpLogBufferMaxSize = 2000;
+
+//FORWARD DECLARATION
+class CXdmDocument;
+class CXdmDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapOperationFactory ) : public CXdmOperationFactory
+ {
+ public:
+
+ /**
+ * Two-phased constructor.
+ * @param CXdmProtocolInfo Protocol info
+ * @return CXdmProtocol
+ */
+ static CXcapOperationFactory* NewL();
+
+ /**
+ * Destructor. A simple wrapper to the C++ destructor.
+ *
+ */
+ virtual ~CXcapOperationFactory();
+
+ public:
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * whole documents
+ */
+ MXdmOperation* FetchL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode = NULL ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* InsertL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* ReplaceL( CXdmDocument& aOldDocument,
+ CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aOldNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* AppendL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ MXdmOperation* DeletionL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const;
+
+ public:
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ private:
+
+ /**
+ * C++ constructor
+ * @return CImpsTcpCirWatcher
+ */
+ void ConstructL();
+
+ /**
+ * Write here something meaningful
+ */
+ void WriteTraceLog( const TDesC8& aLogDescriptor );
+
+ /**
+ * C++ constructor
+ * @return CImpsTcpCirWatcher
+ */
+ CXcapOperationFactory();
+
+ private: //Data
+
+ CXdmLogWriter* iLogWriter;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapReplacement.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapReplacement
+*
+*/
+
+
+
+
+#ifndef __XCAPREPLACEMENT__
+#define __XCAPREPLACEMENT__
+
+#include <e32base.h>
+#include "XcapHttpOperation.h"
+
+//FORWARD DECLARATIONS
+
+class CXcapHttpReqPut;
+class CXcapDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapReplacement ) : public CXcapHttpOperation
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapReplacement* NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aOldNode,
+ CXcapDocumentNode* aNewNode,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Handle a successful operation
+ */
+ virtual void OperationCompleteL();
+
+ /**
+ * Handle a failed operation
+ */
+ virtual void OperationFailedL();
+
+ /**
+ * Destructor.
+ */
+ virtual TBool Result() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapReplacement();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapReplacement( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aOldNode,
+ CXcapDocumentNode* aNewNode,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Destructor.
+ */
+ void ExecuteL();
+
+ /**
+ * Destructor.
+ */
+ virtual TInt FormatModRequestL( const CXcapDocumentNode* aDocumentNode );
+
+ private: //Data
+
+ enum TXcapReplacementState
+ {
+ EHttpIdle = 0,
+ EHttpDeleting,
+ EHttpPutting
+ };
+
+ CXcapDocumentNode* iNewNode;
+ TXdmOperationType iOperationType;
+ TXcapReplacementState iOperationPhase;
+
+ };
+
+#endif //__XCAPREPLACEMENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapRetrieval.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapRetrieval
+*
+*/
+
+
+
+
+#ifndef __XCAPRETRIEVAL__
+#define __XCAPRETRIEVAL__
+
+#include <e32base.h>
+#include "CommonDefines.h"
+#include "XcapHttpOperation.h"
+
+class CXcapDocumentNode;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapRetrieval ) : public CXcapHttpOperation
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapRetrieval* NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aTargetNode,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Handle a successful operation
+ */
+ virtual void OperationCompleteL();
+
+ /**
+ * Handle a failed operation
+ */
+ virtual void OperationFailedL();
+
+ /**
+ * Destructor.
+ */
+ virtual TInt Result() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapRetrieval();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapRetrieval( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aTargetNode,
+ CXcapOperationFactory& iOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ExecuteL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandleCacheOperationL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void HandleNetworkOperationL();
+
+ private: //Data
+
+ TBool iCacheOperation;
+ TCacheEntryInfo iCacheEntryInfo;
+ TXdmOperationType iOperationType;
+ };
+
+#endif //__XCAPRETRIEVAL__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/inc/XcapUriParser.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapUriParser
+*
+*/
+
+
+
+
+#ifndef __XCAPURIPARSER__
+#define __XCAPURIPARSER__
+
+#include <e32base.h>
+#include "XcapDocumentNode.h"
+#include "XcapUriInterface.h"
+
+//Constants
+_LIT8( KXcapUriColon, ":" );
+_LIT8( KXcapUriQMark, "?" );
+_LIT8( KXcapUriXmlns, "xmlns(" );
+_LIT8( KXcapUriEquals, "=\"" );
+_LIT8( KXcapUriQuote, "\"" );
+_LIT8( KXcapParenthClose, ")" );
+
+class CXdmDocument;
+class CXdmDocumentNode;
+class CXcapOperationFactory;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS ( CXcapUriParser ) : public CBase, public MXcapUriInterface
+ {
+ public:
+
+ /**
+ * Destructor.
+ */
+ static CXcapUriParser* NewL( CXdmDocument& aTargetDoc,
+ CXcapOperationFactory& aOperationFactory );
+
+ /**
+ * Destructor.
+ */
+ void SetDocumentSubset( const CXdmDocumentNode* aDocumentSubset );
+
+ /**
+ * Destructor.
+ */
+ void ParseL( const TPtrC8& aHttpUri );
+
+ /**
+ * Destructor.
+ */
+ TPtrC8 DesC8() const;
+
+ /**
+ * Destructor.
+ */
+ TXdmElementType NodeType() const;
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapUriParser();
+
+ private: //From MXcapUriInterface
+
+ /**
+ * Add new namespace mapping
+ * @param TDesC8& Namespace URI
+ * @param TDesC8& Namespace prefix
+ * @return void
+ */
+ void AddNamespaceMappingL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapUriParser( CXdmDocument& aTargetDoc,
+ CXcapOperationFactory& aOperationFactory );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ TInt CreateBasicNodeUriL( HBufC8* aNodePath );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ HBufC8* DocSubsetPathL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void AppendPredicatesL( TInt& aPosition,
+ CBufBase* aBuffer,
+ const CXdmDocumentNode* aPathElement );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ HBufC8* FormatOnePathElementLC( const CXdmDocumentNode* aPathElement );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void FormatAttributeUriL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void FormatNodeUriL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void AppendNamespaceMappingsL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void FinaliseL();
+
+ #ifdef _DEBUG
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXcapDocOperation*
+ */
+ void DumpUriL( HBufC8* aNodePath );
+
+ #endif
+
+ private: //Data
+
+ TInt iBufferPosition;
+ TPtrC8* iHttpUri;
+ HBufC8* iCompleteUri;
+ CBufFlat* iUriBuffer;
+ CXdmDocument& iTargetDoc;
+ TXdmElementType iNodeType;
+ CXdmDocumentNode* iDocumentSubset;
+ CXcapOperationFactory& iOperationFactory;
+ RPointerArray<CXdmNamespace> iNamespaceMappings;
+ };
+
+#endif //__XCAPURIPARSER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/10207410.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmProtocolInfo
+*
+*/
+
+
+// 10207410.RSS
+//
+#include "registryinfo.rh"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XdmProtocolInfo
+ {
+ dll_uid = 0x10207410;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207425;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207426;
+ version_no = 1;
+ display_name = "XCAP Operation API||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapAddition.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapAddition
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XcapCache.h"
+#include "XcapAppUsage.h"
+#include "XcapProtocol.h"
+#include "XcapDocument.h"
+#include "XcapAddition.h"
+#include "XdmXmlParser.h"
+#include "XcapUriParser.h"
+#include "CommonDefines.h"
+#include "XcapHttpReqPut.h"
+#include "XcapHttpOperation.h"
+#include "XcapHttpTransport.h"
+#include "XcapOperationFactory.h"
+
+// ---------------------------------------------------------
+// CXcapAddition::CXcapAddition
+//
+// ---------------------------------------------------------
+//
+CXcapAddition::CXcapAddition( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory ) :
+ CXcapHttpOperation( aParentDoc, aDocumentSubset, aOperationFactory ),
+ iOperationType( aDocumentSubset == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::NewL
+//
+// ---------------------------------------------------------
+//
+CXcapAddition* CXcapAddition::NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapAddition* self = new ( ELeave ) CXcapAddition( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapAddition::ConstructL()
+ {
+ CXcapHttpReqPut* request = Transport().PutL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Append( request ) );
+ request->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ CleanupStack::Pop(); //request
+ //If they point to the same node, we're dealing with a complete document
+ if( iDocumentSubset != NULL && iTargetDoc.DocumentRoot() != iDocumentSubset )
+ iUriParser->SetDocumentSubset( iDocumentSubset );
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::FormatModRequestL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapAddition::FormatModRequestL( const CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::FormatModRequestL()" ) );
+ iOperationFactory.WriteToLog( _L8( " Operation type: %d" ), iOperationType );
+ iOperationFactory.WriteToLog( _L8( " Document subset: %x" ), iDocumentSubset );
+ #endif
+ TInt validation = CXcapHttpOperation::FormatModRequestL( aDocumentNode );
+ if( validation == KErrNone )
+ {
+ //Then set the properties particular to this type of request
+ iOperationType = DetermineOperationType();
+ if( iOperationType == EXdmDocument )
+ iActiveRequest->SetHeaderL( KHttpHeaderContentType, iTargetDoc.ApplicationUsage().ContentType() );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " AppUsage reported the following error: %d" ), validation );
+ #endif
+ }
+ return validation;
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::DetermineOperationType
+//
+// ---------------------------------------------------------
+//
+TXdmOperationType CXcapAddition::DetermineOperationType()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::DetermineDocType()" ) );
+ iOperationFactory.WriteToLog( _L8( " Operation type: %d" ), iOperationType );
+ iOperationFactory.WriteToLog( _L8( " Document subset: %x" ), iDocumentSubset );
+ iOperationFactory.WriteToLog( _L8( " Document root: %x" ), iTargetDoc.DocumentRoot() );
+ #endif
+ return iOperationType == EXdmDocument || ( EXdmPartialDocument &&
+ iDocumentSubset == iTargetDoc.DocumentRoot() ) ?
+ EXdmDocument : EXdmPartialDocument;
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapAddition::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::ExecuteL()" ) );
+ #endif
+ CXcapHttpOperation::ExecuteL( iActiveRequest, iDocumentSubset );
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::OperationCompleteL
+//
+// ---------------------------------------------------------
+//
+void CXcapAddition::OperationCompleteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::OperationCompleteL()" ) );
+ #endif
+ TPtrC8 root = Transport().RootUri();
+ iRequestData = iActiveRequest->ResponseData();
+ TPtrC name = iTargetDoc.Name();
+ switch( iRequestData->iHttpStatus )
+ {
+ case 200: //Replaced, the document was already there
+ case 201: //"Created" -> Put operation was successful
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status %d" ), iRequestData->iHttpStatus );
+ #endif
+ iResult = KErrNone;
+ TPtrC8 eTag = Descriptor( iRequestData->iETag );
+ iTargetDoc.SetETag( eTag );
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache != NULL )
+ {
+ CXcapHttpContSupplier* request = ( CXcapHttpContSupplier* )iActiveRequest;
+ TPtrC8 payload = request->RequestBody();
+ iOperationType == EXdmDocument ? cache->Store( eTag, name, root, payload ) :
+ UpdatePartialToCacheL( cache, payload );
+ }
+ iCompleted = ETrue;
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Default case - Status: %d" ),
+ iRequestData->iHttpStatus );
+ #endif
+ TInt status = iRequestData->iHttpStatus;
+ iResult = ReinterpretStatus( status );
+ iCompleted = ETrue;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::UpdatePartialToCacheL
+//
+// ---------------------------------------------------------
+//
+void CXcapAddition::UpdatePartialToCacheL( RXcapCache* aCache, const TDesC8& aNewData )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::UpdatePartialToCacheL()" ) );
+ #endif
+ HBufC8* newData = NULL;
+ TPtrC name = iTargetDoc.Name();
+ TPtrC8 root = Transport().RootUri();
+ if( iOptionFlags & KFetchMasterFromCache )
+ {
+ TInt length = iTargetDoc.DataLength();
+ //Do nothing, if the document is not in cache
+ if( length > 0 )
+ {
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 desc( data->Des() );
+ aCache->FetchDocumentContent( desc, name, root );
+ CXcapDocument* copy = iTargetDoc.TempCopyL();
+ CleanupStack::PushL( copy );
+ iXmlParser->ParseDocumentL( copy, desc );
+ RPointerArray<CXdmDocumentNode> array;
+ CleanupClosePushL( array );
+ copy->Find( *iDocumentSubset, array );
+ //If the element the subset points to is not present
+ //in the original document, the new data must be
+ //appended to the the subset element parent, instead.
+ CXdmDocumentNode* node = array.Count() > 0 ?
+ iDocumentSubset : iDocumentSubset->Parent();
+ newData = iXmlParser->FormatToXmlLC( aNewData, copy, node );
+ CleanupStack::Pop(); //newData
+ CleanupStack::PopAndDestroy( 3 ); //array, tempCopy, data
+ CleanupStack::PushL( newData );
+ }
+ }
+ else
+ {
+ CXdmDocumentNode* root = iTargetDoc.DocumentRoot();
+ newData = iXmlParser->FormatToXmlLC( ETrue, &iTargetDoc, root );
+ }
+ if( newData )
+ {
+ aCache->Store( iTargetDoc.ETag(), name, root, newData->Des() );
+ CleanupStack::PopAndDestroy(); //newData
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::OperationFailedL
+//
+// ---------------------------------------------------------
+//
+void CXcapAddition::OperationFailedL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::OperationFailedL() - Error: %d" ),
+ iStatus.Int() );
+ #endif
+ if( iStatus.Int() >= KErrNone )
+ {
+ TInt status = iActiveRequest->ResponseData()->iHttpStatus;
+ TInt completion = iActiveRequest->ResponseData()->iCompletion;
+ iResult = status < KErrNone || completion < KErrNone ? status : ReinterpretStatus( status );
+ }
+ else iResult = iStatus.Int();
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::Result
+//
+// ---------------------------------------------------------
+//
+TBool CXcapAddition::Result() const
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::~CXcapAddition
+//
+// ---------------------------------------------------------
+//
+CXcapAddition::~CXcapAddition()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::~CXcapAddition()" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapDeletion.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDeletion
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XcapCache.h"
+#include "XcapProtocol.h"
+#include "XcapDeletion.h"
+#include "XcapAppUsage.h"
+#include "XcapDocument.h"
+#include "XcapUriParser.h"
+#include "XdmXmlParser.h"
+#include "XcapDocumentNode.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpOperation.h"
+#include "XcapHttpReqDelete.h"
+#include "XcapOperationFactory.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CXcapDeletion::CXcapDeletion
+//
+// ---------------------------------------------------------
+//
+CXcapDeletion::CXcapDeletion( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory ) :
+ CXcapHttpOperation( aParentDoc, aDocumentSubset, aOperationFactory ),
+ iOperationType( iDocumentSubset == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::NewL
+//
+// ---------------------------------------------------------
+//
+CXcapDeletion* CXcapDeletion::NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapDeletion* self = new ( ELeave ) CXcapDeletion( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::ConstructL()
+ {
+ CXcapHttpReqDelete* request = Transport().DeleteL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Append( request ) );
+ request->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ CleanupStack::Pop(); //request
+ if( iOperationType != EXdmDocument && iDocumentSubset != NULL )
+ {
+ iUriParser->SetDocumentSubset( iDocumentSubset );
+ //Add namespace mappings
+ User::LeaveIfError( iTargetDoc.ApplicationUsage().Validate(
+ *iDocumentSubset, iUriParser, ETrue ) );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::ExecuteL()" ) );
+ #endif
+ TPtrC8 eTag = iTargetDoc.ETag();
+ if( eTag.Length() > 0 )
+ iActiveRequest->SetHeaderL( KHttpHeaderIfMatch, eTag );
+ TRAPD( error, iUriParser->ParseL( iActiveRequest->RequestUriL() ) );
+ if( error == KErrNone )
+ {
+ TPtrC8 uri = iUriParser->DesC8();
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " New URI: %S" ), &uri );
+ #endif
+ HBufC8* escape = CXcapHttpOperation::EscapeLC( uri );
+ iActiveRequest->UpdateRequestUriL( escape->Des() );
+ CleanupStack::PopAndDestroy(); //escape
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::OperationCompleteL
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::OperationCompleteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::OperationCompleteL()" ) );
+ #endif
+ switch( iRequestData->iHttpStatus )
+ {
+ case 200: //Document was deleted
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status 200 - Document deleted" ) );
+ #endif
+ iOperationType == EXdmDocument ?
+ HandleDocDeletion() :
+ HandlePartialDeletion();
+ iCompleted = ETrue;
+ }
+ break;
+ case 404: //Document was not found
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status 404 - Document not found" ) );
+ #endif
+ iCompleted = ETrue;
+ iResult = KErrNotFound;
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Default case - Status: %d" ),
+ iRequestData->iHttpStatus );
+ #endif
+ iCompleted = ETrue;
+ break;
+ }
+ iResult = ReinterpretStatus( iRequestData->iHttpStatus );
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::HandleDocDeletion
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::HandleDocDeletion()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::HandleDocDeletion()" ) );
+ #endif
+ TPtrC name = iTargetDoc.Name();
+ TPtrC8 root = Transport().RootUri();
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache != NULL )
+ {
+ TInt error = cache->Delete( name, root );
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Document deleted from the cache" ) );
+ #endif
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::HandlePartialDeletion
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::HandlePartialDeletion()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::HandlePartialDeletion()" ) );
+ #endif
+ TPtrC name = iTargetDoc.Name();
+ TPtrC8 root = Transport().RootUri();
+ iTargetDoc.RemoveFromModelL( iDocumentSubset );
+ TPtrC8 eTag = Descriptor( iRequestData->iETag );
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache != NULL )
+ {
+ HBufC8* newDoc = iXmlParser->FormatToXmlLC( ETrue, &iTargetDoc, iTargetDoc.DocumentRoot() );
+ cache->Store( eTag, name, root, newDoc->Des() );
+ CleanupStack::PopAndDestroy(); //newDoc
+ }
+ iTargetDoc.SetETag( eTag );
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::OperationFailedL
+//
+// ---------------------------------------------------------
+//
+void CXcapDeletion::OperationFailedL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::OperationFailedL() - Error: %d" ),
+ iStatus.Int() );
+ #endif
+ if( iStatus.Int() >= KErrNone )
+ {
+ TInt status = iActiveRequest->ResponseData()->iHttpStatus;
+ TInt completion = iActiveRequest->ResponseData()->iCompletion;
+ iResult = status < KErrNone || completion < KErrNone ? status : ReinterpretStatus( status );
+ }
+ else iResult = iStatus.Int();
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::Result
+//
+// ---------------------------------------------------------
+//
+TBool CXcapDeletion::Result() const
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapDeletion::~CXcapDeletion
+//
+// ---------------------------------------------------------
+//
+CXcapDeletion::~CXcapDeletion()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapDeletion::~CXcapDeletion()" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapHttpOperation.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapHttpOperation
+*
+*/
+
+
+
+#include <XdmErrors.h>
+#include <escapeutils.h>
+#include "XcapDocument.h"
+#include "XcapProtocol.h"
+#include "XcapAppUsage.h"
+#include "XcapUriParser.h"
+#include "XdmXmlParser.h"
+#include "XcapHttpRequest.h"
+#include "XdmNodeAttribute.h"
+#include "XcapEngineDefines.h"
+#include "XcapHttpOperation.h"
+#include "XcapHttpContSupplier.h"
+#include "XcapOperationFactory.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapHttpOperation::CXcapHttpOperation( const CXdmDocument& aTargetDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory ) :
+ CActive( EPriorityStandard ),
+ iDocumentSubset( aDocumentSubset ),
+ iTargetDoc( ( CXcapDocument& )aTargetDoc ),
+ iOperationFactory( aOperationFactory )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::BaseConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::BaseConstructL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "-> CXcapHttpOperation::BaseConstructL" ) );
+ #endif
+ iXmlParser = &iTargetDoc.Protocol().Parser();
+ iUriParser = CXcapUriParser::NewL( iTargetDoc, iOperationFactory );
+ #ifdef _DEBUG
+ TPtrC8 contType( iTargetDoc.ApplicationUsage().ContentType() );
+ iOperationFactory.WriteToLog( _L8( " Content-Type: %S" ), &contType );
+ #endif
+ CActiveScheduler::Add( this );
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "<- CXcapHttpOperation::BaseConstructL" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CXcapHttpOperation::~CXcapHttpOperation()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::~CXcapHttpOperation()" ) );
+ #endif
+ delete iUriParser;
+ iRequestQueue.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationBase::IsCompleted
+//
+// ---------------------------------------------------------
+//
+TBool CXcapHttpOperation::IsCompleted() const
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapOperationBase::IsCompleted()" ) );
+ #endif
+ return iCompleted;
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationBase::CompletionData
+//
+// ---------------------------------------------------------
+//
+const TXdmCompletionData& CXcapHttpOperation::CompletionData() const
+ {
+ return *iRequestData;
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationBase::CompletionData
+//
+// ---------------------------------------------------------
+//
+CXdmDocumentNode* CXcapHttpOperation::TargetNode() const
+ {
+ return iDocumentSubset;
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationBase::CompletionData
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::Destroy()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::Result
+//
+// ---------------------------------------------------------
+//
+TInt CXcapHttpOperation::Result() const
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::Result()" ) );
+ #endif
+ return iRequestData != NULL ? iRequestData->iHttpStatus : KErrUnknown;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::ExecuteL( TRequestStatus& aStatus, TUint aOptions )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::ExecuteL( &status )" ) );
+ #endif
+ iOptionFlags = aOptions;
+ iClientStatus = &aStatus;
+ aStatus = KRequestPending;
+ if( !IsActive() )
+ {
+ iActiveRequest = iRequestQueue[iCurrentIndex];
+ TRAPD( error, ExecuteL() );
+ if( error == KErrNone )
+ {
+ if( StartOperationL() )
+ SetActive();
+ else
+ {
+ iFailureData.iCompletion = KXcapErrorNetworkNotAvailabe;
+ User::RequestComplete( iClientStatus, KXcapErrorNetworkNotAvailabe );
+ iRequestData = &iFailureData;
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Execution failed with %d" ), error );
+ #endif
+ iFailureData.iCompletion = error;
+ User::RequestComplete( iClientStatus, error );
+ iRequestData = &iFailureData;
+ }
+ }
+ else //This is a re-run of a previously failed request
+ {
+ if( !StartOperationL() )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Execution succeeded, network not ready" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KXcapErrorNetworkNotAvailabe );
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::ExecuteL( CXcapHttpRequest* aHttpRequest,
+ CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapAddition::ExecuteL()" ) );
+ #endif
+ CXdmDocumentNode* node = aDocumentNode == NULL ?
+ iTargetDoc.DocumentRoot() : aDocumentNode;
+ __ASSERT_ALWAYS( node != NULL, User::Panic( _L( "CXcapAddition" ), 1 ) );
+ User::LeaveIfError( FormatModRequestL( node ) );
+ TRAPD( error, iUriParser->ParseL( aHttpRequest->RequestUriL() ) );
+ if( error == KErrNone )
+ {
+ TPtrC8 uri = iUriParser->DesC8();
+ HBufC8* escape = CXcapHttpOperation::EscapeLC( uri );
+ aHttpRequest->UpdateRequestUriL( escape->Des() );
+ CleanupStack::PopAndDestroy(); //escape
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::StartOperationL
+//
+// ---------------------------------------------------------
+//
+TBool CXcapHttpOperation::StartOperationL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::StartOperationL()" ) );
+ #endif
+ if( iTargetDoc.Protocol().IsNetworkAvailable() )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " All set, dispatch request to transport" ) );
+ #endif
+ if( iOptionFlags & KUseIntendedIdentity )
+ {
+ TPtrC8 identity( iTargetDoc.Protocol().PublicID() );
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Early-IMS set, add X-3GPP-Intended-Identity header" ) );
+ iOperationFactory.WriteToLog( _L8( " Public ID: %S" ), &identity );
+ #endif
+ iActiveRequest->SetHeaderL( KHttpHeaderIntIdentity, identity );
+ }
+ iActiveRequest->DispatchRequestL( iStatus );
+ return ETrue;
+ }
+ else return EFalse;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::RunL
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::RunL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8(
+ "CXcapHttpOperation::RunL() - Status: %d" ), iStatus.Int() );
+ #endif
+ TInt count = iRequestQueue.Count();
+ iRequestData = iActiveRequest->ResponseData();
+ __ASSERT_DEBUG( iRequestData != NULL, User::Panic( _L( "CXcapHttpOperation" ), 1 ) );
+ TRAPD( error, iStatus != KErrNone ? OperationFailedL() : OperationCompleteL() );
+ if( error == KErrNone && !iCompleted )
+ SetActive();
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8(
+ " ** Operation completed - Result: %d Error: %d **" ), iResult, error );
+ #endif
+ iCurrentIndex = 0;
+ iResult = error < KErrNone ? error : iResult;
+ iRequestData->iCompletion = iResult;
+ User::RequestComplete( iClientStatus, iResult );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::CancelOperation
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::CancelOperation()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::CancelOperation()" ) );
+ #endif
+ if( IsActive() )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "Active, cancel HTTP request" ) );
+ #endif
+ Cancel();
+ iRequestData = &iFailureData;
+ iFailureData.iCompletion = KErrCancel;
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::CancelOperation
+//
+// ---------------------------------------------------------
+//
+void CXcapHttpOperation::DoCancel()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::DoCancel()" ) );
+ #endif
+ iRequestQueue[iCurrentIndex]->CancelRequest();
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::Descriptor
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapHttpOperation::Descriptor( HBufC8* aBuffer )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::Descriptor()" ) );
+ #endif
+ if( aBuffer != NULL )
+ {
+ TPtrC8 descriptor( aBuffer->Des() );
+ return descriptor.Length() > 0 ? descriptor : TPtrC8();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Buffer is NULL, return empty descriptor" ) );
+ #endif
+ return TPtrC8();
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::Transport
+//
+// ---------------------------------------------------------
+//
+CXcapHttpTransport& CXcapHttpOperation::Transport() const
+ {
+ return iTargetDoc.Protocol().Transport();
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::FormatModRequestL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapHttpOperation::FormatModRequestL( const CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::FormatModRequestL()" ) );
+ #endif
+ HBufC8* body = NULL;
+ TInt error = KErrNone;
+ CXcapAppUsage& usage = iTargetDoc.ApplicationUsage();
+ CXcapHttpContSupplier* request = ( CXcapHttpContSupplier* )iActiveRequest;
+ switch( iUriParser->NodeType() )
+ {
+ case EXdmElementAttribute:
+ {
+ CXdmNodeAttribute* attribute = ( CXdmNodeAttribute* )aDocumentNode;
+ body = attribute->EightBitValueLC();
+ request->SetRequestBodyL( body->Des() );
+ CleanupStack::PopAndDestroy(); //body
+ request->SetHeaderL( KHttpHeaderAccept, _L8( "application/xcap-diff+xml" ) );
+ request->SetHeaderL( KHttpHeaderContentType, _L8( "application/xcap-att+xml" ) );
+ }
+ break;
+ case EXdmElementNode:
+ {
+ #ifndef __OVERRIDE_VALIDATION__
+ error = usage.Validate( CONST_CAST( CXdmDocumentNode&, *aDocumentNode ), iUriParser, EFalse );
+ #endif
+ if( error == KErrNone )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Validation of a partial document OK" ) );
+ #endif
+ body = iXmlParser->FormatToXmlLC( EFalse, &iTargetDoc, aDocumentNode );
+ request->SetRequestBodyL( body->Des() );
+ CleanupStack::PopAndDestroy(); //body
+ request->SetHeaderL( KHttpHeaderAccept, _L8( "application/xcap-diff+xml" ) );
+ request->SetHeaderL( KHttpHeaderContentType, _L8( "application/xcap-el+xml" ) );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Validation failed: %d" ), error );
+ #endif
+ }
+ }
+ break;
+ default:
+ #ifndef __OVERRIDE_VALIDATION__
+ error = usage.Validate( iTargetDoc, ETrue );
+ #endif
+ if( error == KErrNone )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Validation OK" ) );
+ #endif
+ body = iXmlParser->FormatToXmlLC( ETrue, &iTargetDoc, aDocumentNode );
+ request->SetRequestBodyL( body->Des() );
+ CleanupStack::PopAndDestroy(); //body
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Validation failed: %d" ), error );
+ #endif
+ }
+ break;
+ }
+ return error;
+ }
+
+// ----------------------------------------------------------
+// CXcapHttpOperation::ReinterpretStatus
+//
+// ----------------------------------------------------------
+//
+TInt CXcapHttpOperation::ReinterpretStatus( const TInt aHttpStatus ) const
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::ReinterpretStatus()" ) );
+ #endif
+ switch( aHttpStatus )
+ {
+ case 500: //Internal Server Error
+ case 501: //Not Implemented
+ case 502: //Bad Gateway
+ case 503: //Service Unavailable
+ case 504: //Gateway Timeout
+ case 505: //HTTP Version Not Supported
+ case 405: //Method Not Allowed
+ case 408: //Request Timeout
+ case 410: //Gone
+ case 411: //Length Required
+ case 413: //Request Entity Too Large
+ case 414: //Request-URI Too Long
+ case 415: //Unsupported Media Type
+ case 416: //Requested Range Not Satisfiable
+ case 417: //Expectation Failed
+ return KXcapErrorHttpServer;
+ case 400:
+ return KXcapErrorHttpBadRequest;
+ case 401:
+ return KXcapErrorHttpUnauthorised;
+ case 403:
+ return KXcapErrorHttpForbidden;
+ case 404:
+ return KXcapErrorHttpNotFound;
+ case 409:
+ return KXcapErrorHttpConflict;
+ case 412:
+ return KXcapErrorHttpPrecondFailed;
+ default:
+ return KErrNone;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::Escape2LC
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXcapHttpOperation::Escape2LC( const TDesC& aDescriptor )
+ {
+ HBufC8* eight = EscapeUtils::ConvertFromUnicodeToUtf8L( aDescriptor );
+ CleanupStack::PushL( eight );
+ HBufC8* buf = EscapeUtils::EscapeEncodeL( eight->Des(), EscapeUtils::EEscapeNormal );
+ CleanupStack::PopAndDestroy(); //eight
+ CleanupStack::PushL( buf );
+ return buf;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::EscapeLC
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXcapHttpOperation::EscapeLC( const TDesC8& aDescriptor )
+ {
+ CBufFlat* buffer = CBufFlat::NewL( 50 );
+ CleanupStack::PushL( buffer );
+ TInt bufPos = 0;
+ TBuf8<10> format;
+ for( TInt i = 0;i < aDescriptor.Length();i++ )
+ {
+ TUint8 byte = aDescriptor[i];
+ if( byte < 0x7F ) //US-ASCII
+ {
+ switch( byte )
+ {
+ case 0x20: // ' '
+ case 0x22: // '"'
+ case 0x3B: // ';'
+ case 0x26: // '&'
+ case 0x3C: // '<'
+ case 0x3E: // '>'
+ case 0x5B: // '['
+ case 0x5D: // ']'
+ format.Append( _L8( "%" ) );
+ format.AppendFormat( _L8( "%x" ), byte );
+ break;
+ default:
+ format.Append( byte );
+ break;
+ }
+ }
+ else
+ {
+ format.Append( _L8( "%" ) ); //UNICODE
+ format.AppendFormat( _L8( "%x" ), byte );
+ }
+ buffer->InsertL( bufPos, format );
+ bufPos = bufPos + format.Length();
+ format.Zero();
+ }
+ HBufC8* ret = HBufC8::NewL( buffer->Size() );
+ TPtr8 pointer( ret->Des() );
+ buffer->Read( 0, pointer, buffer->Size() );
+ CleanupStack::PopAndDestroy(); //buffer
+ CleanupStack::PushL( ret );
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXcapHttpOperation::HttpRequest
+//
+// ---------------------------------------------------------
+//
+CXcapHttpRequest* CXcapHttpOperation::HttpRequest() const
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapHttpOperation::HttpRequest()" ) );
+ #endif
+ return iActiveRequest;
+ }
+
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapInsertion.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapInsertion
+*
+*/
+
+
+
+
+// INCLUDES
+//This is only for logging
+#include <XdmErrors.h>
+#include "XcapProtocol.h"
+#include "XcapDocument.h"
+#include "XcapUriParser.h"
+#include "XcapInsertion.h"
+#include "XdmXmlParser.h"
+#include "XcapHttpReqPut.h"
+#include "XdmNodeAttribute.h"
+#include "XcapHttpTransport.h"
+#include "XcapEngineDefines.h"
+#include "XcapOperationFactory.h"
+
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapInsertion::CXcapInsertion( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory ) :
+ CXcapHttpOperation( aParentDoc, aDocumentSubset, aOperationFactory ),
+ iOperationType( EXdmPartialDocument )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CXcapInsertion* CXcapInsertion::NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aDocumentSubset,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapInsertion* self = new ( ELeave ) CXcapInsertion( aParentDoc, aDocumentSubset, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapInsertion::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapInsertion::ConstructL()
+ {
+ CXcapHttpReqPut* request = Transport().PutL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Append( request ) );
+ request->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ CleanupStack::Pop(); //request
+ iUriParser->SetDocumentSubset( iDocumentSubset );
+ }
+
+// ---------------------------------------------------------
+// CXcapAddition::FormatModRequestL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapInsertion::FormatModRequestL( const CXdmDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapInsertion::FormatModRequestL()" ) );
+ iOperationFactory.WriteToLog( _L8( " Operation type: %d" ), iOperationType );
+ iOperationFactory.WriteToLog( _L8( " Document subset: %x" ), iDocumentSubset );
+ #endif
+ return CXcapHttpOperation::FormatModRequestL( aDocumentNode );
+ }
+
+// ---------------------------------------------------------
+// CXcapInsertion::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapInsertion::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapInsertion::ExecuteL()" ) );
+ #endif
+ CXcapHttpOperation::ExecuteL( iActiveRequest, iDocumentSubset );
+ iActiveRequest->SetHeaderL( KHttpHeaderIfMatch, _L8( "*" ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapInsertion::OperationCompleteL
+//
+// ---------------------------------------------------------
+//
+void CXcapInsertion::OperationCompleteL()
+ {
+
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapInsertion::OperationCompleteL()" ) );
+ #endif
+ TPtrC8 root = Transport().RootUri();
+ iRequestData = iActiveRequest->ResponseData();
+ TPtrC name = iTargetDoc.Name();
+ TPtrC8 eTag = Descriptor( iRequestData->iETag );
+ switch( iRequestData->iHttpStatus )
+ {
+ case 201: //"Created" -> Put operation was succesful
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status 201 - Created" ) );
+ #endif
+ iResult = KErrNone;
+ iTargetDoc.SetETag( eTag );
+ CXcapHttpContSupplier* request = ( CXcapHttpContSupplier* )iActiveRequest;
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache != NULL && iOperationType == EXdmDocument )
+ {
+ TPtrC8 payload = request->RequestBody();
+ cache->Store( eTag, name, root, payload );
+ }
+ iCompleted = ETrue;
+ }
+ break;
+ case 412: //"Precondition failed" -> Cache out of date
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status 412 - Precondition failed" ) );
+ #endif
+ iResult = KXcapErrorHttpPrecondFailed;
+ //RXcapCache* cache = CXcapProtocol::Cache();
+ //if( cache != NULL && iOperationType == EXcapDocument )
+ // cache->Delete( name, root );
+ iCompleted = ETrue;
+ iActiveRequest->ResetUriL( _L( "" ) );
+ iActiveRequest->ReleaseResponseData();
+ iRequestData->iCompletion = KInsertConflict;
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Default case - Status: %d" ),
+ iRequestData->iHttpStatus );
+ #endif
+ TInt status = iRequestData->iHttpStatus;
+ iResult = ReinterpretStatus( status );
+ iCompleted = ETrue;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+void CXcapInsertion::OperationFailedL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapInsertion::OperationFailedL() - Error: %d" ),
+ iStatus.Int() );
+ #endif
+ if( iStatus.Int() >= KErrNone )
+ {
+ TInt status = iActiveRequest->ResponseData()->iHttpStatus;
+ TInt completion = iActiveRequest->ResponseData()->iCompletion;
+ iResult = status < KErrNone || completion < KErrNone ? status : ReinterpretStatus( status );
+ }
+ else iResult = iStatus.Int();
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+TBool CXcapInsertion::Result() const
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CXcapInsertion::~CXcapInsertion()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapInsertion::~CXcapInsertion()" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapOperationFactory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapOperationFactory
+*
+*/
+
+
+
+#include <ecom.h>
+#include <flogger.h>
+#include <implementationproxy.h>
+#include "XcapAddition.h"
+#include "XcapDeletion.h"
+#include "XdmOperation.h"
+#include "XcapRetrieval.h"
+#include "XcapInsertion.h"
+#include "XcapReplacement.h"
+#include "xdmlogwriter.h"
+#include "XcapOperationFactory.h"
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::CXcapOperationFactory
+//
+// ---------------------------------------------------------
+//
+CXcapOperationFactory::CXcapOperationFactory()
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::NewL
+//
+// ---------------------------------------------------------
+//
+CXcapOperationFactory* CXcapOperationFactory::NewL()
+ {
+ CXcapOperationFactory* self = new ( ELeave ) CXcapOperationFactory();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapOperationFactory::ConstructL()
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KOperationsLogFile );
+ WriteToLog( _L8( "-> CXcapOperationFactory::ConstructL" ) );
+ WriteToLog( _L8( "<- CXcapOperationFactory::ConstructL" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::~CXcapOperationFactory
+//
+// ---------------------------------------------------------
+//
+CXcapOperationFactory::~CXcapOperationFactory()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "-> CXcapOperationFactory::~CXcapOperationFactory()" ) );
+ #endif
+ #ifdef _DEBUG
+ WriteToLog( _L8( "<- CXcapOperationFactory::~CXcapOperationFactory()" ) );
+ #endif
+ delete iLogWriter;
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::FetchL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CXcapOperationFactory::FetchL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CXcapRetrieval::NewL( ( CXcapDocument& )aTargetDocument,
+ ( CXcapDocumentNode* )aTargetNode,
+ const_cast<CXcapOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::InsertL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CXcapOperationFactory::InsertL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CXcapInsertion::NewL( ( CXcapDocument& )aTargetDocument,
+ ( CXcapDocumentNode* )aTargetNode,
+ const_cast<CXcapOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::ReplaceL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CXcapOperationFactory::ReplaceL( CXdmDocument& aOldDocument,
+ CXdmDocumentNode* aNewNode,
+ CXdmDocumentNode* aOldNode ) const
+ {
+ return CXcapReplacement::NewL( ( CXcapDocument& )aOldDocument,
+ ( CXcapDocumentNode* )aNewNode,
+ ( CXcapDocumentNode* )aOldNode,
+ const_cast<CXcapOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::AppendL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CXcapOperationFactory::AppendL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CXcapAddition::NewL( ( CXcapDocument& )aTargetDocument,
+ ( CXcapDocumentNode* )aTargetNode,
+ const_cast<CXcapOperationFactory&>( *this ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapOperationFactory::PartialDeletionL
+//
+// ---------------------------------------------------------
+//
+MXdmOperation* CXcapOperationFactory::DeletionL( CXdmDocument& aTargetDocument,
+ CXdmDocumentNode* aTargetNode ) const
+ {
+ return CXcapDeletion::NewL( ( CXcapDocument& )aTargetDocument,
+ ( CXcapDocumentNode* )aTargetNode,
+ const_cast<CXcapOperationFactory&>( *this ) );
+ }
+
+// ----------------------------------------------------
+// CXcapOperationFactory::WriteToLog
+//
+// ----------------------------------------------------
+//
+void CXcapOperationFactory::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ---------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+//
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( KXcapOperationFactory, CXcapOperationFactory::NewL )
+#else
+ { { KXcapOperationFactory }, CXcapOperationFactory::NewL }
+#endif
+ };
+
+// ---------------------------------------------------------
+// Return the implementation table & number of implementations
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapReplacement.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapReplacement
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XcapAppUsage.h"
+#include "XcapDocument.h"
+#include "XcapUriParser.h"
+#include "XdmXmlParser.h"
+#include "XcapHttpReqPut.h"
+#include "XcapReplacement.h"
+#include "XcapHttpReqDelete.h"
+#include "XcapHttpTransport.h"
+#include "XcapHttpOperation.h"
+#include "XdmNodeAttribute.h"
+#include "XcapEngineDefines.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that might leave.
+//
+// ---------------------------------------------------------
+//
+CXcapReplacement::CXcapReplacement( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aOldNode,
+ CXcapDocumentNode* aNewNode,
+ CXcapOperationFactory& aOperationFactory ) :
+ CXcapHttpOperation( aParentDoc, aOldNode, aOperationFactory ),
+ iNewNode( ( CXcapDocumentNode* )aNewNode ),
+ iOperationType( aOldNode == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CXcapReplacement* CXcapReplacement::NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aOldNode,
+ CXcapDocumentNode* aNewNode,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapReplacement* self = new ( ELeave ) CXcapReplacement( aParentDoc, aOldNode, aNewNode, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapReplacement::ConstructL()
+ {
+ CXcapHttpReqPut* request = Transport().PutL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Append( request ) );
+ request->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ CleanupStack::Pop(); //request
+ //If they point to the same node, we're dealing with a complete document
+ if( iDocumentSubset != NULL && iTargetDoc.DocumentRoot() != iDocumentSubset )
+ iUriParser->SetDocumentSubset( iDocumentSubset );
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::FormatModRequestL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapReplacement::FormatModRequestL( const CXcapDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapReplacement::FormatModRequestL()" ) );
+ iOperationFactory.WriteToLog( _L8( " Operation type: %d" ), iOperationType );
+ iOperationFactory.WriteToLog( _L8( " Document subset: %x" ), iDocumentSubset );
+ #endif
+ return CXcapHttpOperation::FormatModRequestL( aDocumentNode );
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapReplacement::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapReplacement::ExecuteL()" ) );
+ #endif
+ User::LeaveIfError( FormatModRequestL( iNewNode ) );
+ if( iOperationType == EXdmPartialDocument )
+ {
+ TPtrC8 eTag = iTargetDoc.ETag();
+ if( eTag.Length() > 0 )
+ iActiveRequest->SetHeaderL( KHttpHeaderIfMatch, eTag );
+ //If they match semantically, there's no need for DELETE operation
+ if( iDocumentSubset->Match( *iNewNode ) )
+ iOperationPhase = EHttpPutting;
+ else
+ {
+ CXcapHttpReqDelete* request = Transport().DeleteL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Insert( request, 0 ) );
+ CleanupStack::Pop(); //request
+ if( eTag.Length() > 0 )
+ request->SetHeaderL( KHttpHeaderIfMatch, eTag );
+ request->SetHeaderL( KHttpHeaderAccept, _L8( "application/xcap-diff+xml" ) );
+ iActiveRequest = request;
+ iOperationPhase = EHttpDeleting;
+ }
+ TRAPD( error, iUriParser->ParseL( iActiveRequest->RequestUriL() ) );
+ if( error == KErrNone )
+ {
+ TPtrC8 uri = iUriParser->DesC8();
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " New URI: %S" ), &uri );
+ #endif
+ HBufC8* escape = CXcapHttpOperation::EscapeLC( uri );
+ iActiveRequest->UpdateRequestUriL( escape->Des() );
+ CleanupStack::PopAndDestroy(); //escape
+ }
+ }
+ else
+ {
+
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::OperationCompleteL
+//
+// ---------------------------------------------------------
+//
+void CXcapReplacement::OperationCompleteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog(
+ _L8( "CXcapReplacement::OperationCompleteL() - Phase: %d" ), iOperationPhase );
+ #endif
+ switch( iOperationPhase )
+ {
+ case EHttpDeleting:
+ break;
+ case EHttpPutting:
+ break;
+ default:
+ iCompleted = ETrue;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::OperationFailedL
+//
+// ---------------------------------------------------------
+//
+void CXcapReplacement::OperationFailedL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapReplacement::OperationFailedL() - Error: %d" ),
+ iStatus.Int() );
+ TInt httpStatus = iRequestData == NULL ? KErrUnknown :
+ iRequestData->iHttpStatus;
+ #endif
+
+ switch( iOperationPhase )
+ {
+ case EHttpDeleting:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog(
+ _L8( "DELETE failed - Error: %d Status: %d" ), iStatus.Int(), httpStatus );
+ #endif
+ break;
+ case EHttpPutting:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog(
+ _L8( "PUT failed - Error: %d Status: %d" ), iStatus.Int(), httpStatus );
+ #endif
+ break;
+ default:
+ break;
+ }
+ iResult = iStatus.Int();
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::Result
+//
+// ---------------------------------------------------------
+//
+TBool CXcapReplacement::Result() const
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapReplacement::~CXcapReplacement
+//
+// ---------------------------------------------------------
+//
+CXcapReplacement::~CXcapReplacement()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapReplacement::~CXcapReplacement()" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapRetrieval.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapRetrieval
+*
+*/
+
+
+
+
+// INCLUDES
+#include "XcapCache.h"
+#include "XcapAppUsage.h"
+#include "XcapDocument.h"
+#include "XcapProtocol.h"
+#include "XcapRetrieval.h"
+#include "XcapUriParser.h"
+#include "XdmXmlParser.h"
+#include "XcapHttpReqGet.h"
+#include "XcapHttpTransport.h"
+#include "XcapOperationFactory.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapRetrieval::CXcapRetrieval( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aTargetNode,
+ CXcapOperationFactory& aOperationFactory ) :
+ CXcapHttpOperation( aParentDoc, aTargetNode, aOperationFactory ),
+ iCacheOperation( EFalse ),
+ iOperationType( aTargetNode == NULL ?
+ EXdmDocument : EXdmPartialDocument )
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::NewL
+//
+// ---------------------------------------------------------
+//
+CXcapRetrieval* CXcapRetrieval::NewL( CXcapDocument& aParentDoc,
+ CXcapDocumentNode* aTargetNode,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapRetrieval* self = new ( ELeave ) CXcapRetrieval( aParentDoc, aTargetNode, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->BaseConstructL();
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::ConstructL()
+ {
+#ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "-> CXcapRetrieval::ConstructL" ) );
+#endif
+ CXcapHttpReqGet* request = Transport().GetL( iTargetDoc.Name() );
+ CleanupStack::PushL( request );
+ User::LeaveIfError( iRequestQueue.Append( request ) );
+ request->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ CleanupStack::Pop(); //request
+ if( iOperationType != EXdmDocument && iDocumentSubset != NULL )
+ {
+ iUriParser->SetDocumentSubset( iDocumentSubset );
+ //Add namespace mappings
+ User::LeaveIfError( iTargetDoc.ApplicationUsage().Validate(
+ *iDocumentSubset, iUriParser, ETrue ) );
+ }
+#ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "<- CXcapRetrieval::ConstructL" ) );
+#endif
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::ExecuteL
+//
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::ExecuteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::ExecuteL()" ) );
+ #endif
+ TPtrC8 eTag = iTargetDoc.ETag();
+ if( eTag.Length() > 0 )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Using ETag \"%S\" - Length: %d" ),
+ &eTag, eTag.Length() );
+ #endif
+ //iActiveRequest->SetHeaderL( KHttpHeaderIfNoneMatch, eTag );
+ }
+ TRAPD( error, iUriParser->ParseL( iActiveRequest->RequestUriL() ) );
+ if( error == KErrNone )
+ {
+ TPtrC8 uri = iUriParser->DesC8();
+ HBufC8* escape = CXcapHttpOperation::EscapeLC( uri );
+ iActiveRequest->UpdateRequestUriL( escape->Des() );
+ CleanupStack::PopAndDestroy(); //escape
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " New URI: %S" ), &uri );
+ #endif
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::OperationCompleteL
+//
+/* const TDesC8& aETag,
+ const TDesC& aDocumentName,
+ const TDesC8& aRootLocation,
+ const TDesC8& aResponseData*/
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::OperationCompleteL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::OperationCompleteL()" ) );
+ #endif
+ TInt generalErr = ReinterpretStatus( iRequestData->iHttpStatus );
+ if( generalErr == KErrNone )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " No general errors found" ) );
+ #endif
+ iCacheOperation ? HandleCacheOperationL() : HandleNetworkOperationL();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " General errors found - Status: %d Error: %d" ),
+ iRequestData->iHttpStatus, generalErr );
+ #endif
+ iCompleted = ETrue;
+ iResult = generalErr;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::HandleCacheOperationL
+//
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::HandleCacheOperationL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::HandleCacheOperationL() - Operation type: %d Target node: %x" ),
+ iOperationType, iDocumentSubset );
+ #endif
+ TPtrC8 responseData = Descriptor( iRequestData->iResponseData );
+ iOperationType == EXdmDocument && iDocumentSubset == NULL ?
+ iXmlParser->ParseDocumentL( &iTargetDoc, responseData ) :
+ iXmlParser->ParseDocumentL( &iTargetDoc, responseData, iDocumentSubset );
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::HandleNetworkOperationL
+//
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::HandleNetworkOperationL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::HandleNetworkOperationL()" ) );
+ #endif
+ TPtrC name = iTargetDoc.Name();
+ TPtrC8 root = Transport().RootUri();
+ switch( iRequestData->iHttpStatus )
+ {
+ case 200: //ETag was stale
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Status 200 - ETag was stale" ) );
+ #endif
+ TPtrC8 responseData = Descriptor( iRequestData->iResponseData );
+ if( responseData.Length() <= 0 )
+ break;
+ if( iOperationType == EXdmDocument )
+ {
+ TPtrC8 eTag = Descriptor( iRequestData->iETag );
+ //If the ETag has not changed, server should return
+ //304 (Not modified), but just in case, let's check the
+ //ETag value, anyway.
+ if( eTag.Length() > 0 && eTag.Compare( iTargetDoc.ETag() ) != 0 )
+ {
+ iTargetDoc.SetETag( eTag );
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache && !( iOptionFlags & KNoCache ) )
+ cache->Store( iTargetDoc.ETag(), name, root, responseData );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " ETag values match, do not update cache" ) );
+ #endif
+ }
+ iXmlParser->ParseDocumentL( &iTargetDoc, responseData );
+ }
+ else if( iOperationType == EXdmPartialDocument )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Parse a partial document" ) );
+ #endif
+ //The target node must be emptied before inserting new content
+ iDocumentSubset->SetEmptyNode( ETrue );
+ iDocumentSubset->SetEmptyNode( EFalse );
+ iXmlParser->ParseDocumentL( responseData, iDocumentSubset );
+ }
+ iCompleted = ETrue;
+ }
+ break;
+ case 304:
+ {
+ RXcapCache* cache = iTargetDoc.Protocol().Cache();
+ if( cache )
+ {
+ #ifdef _DEBUG //ETag is up to date - cache still valid
+ iOperationFactory.WriteToLog( _L8( " Status 304 - Cached version is valid" ) );
+ #endif
+ TInt length = iTargetDoc.DataLength();
+ __ASSERT_DEBUG( length > 0, User::Panic( _L( "CXcapRetrieval" ), 1 ) );
+ delete iRequestData->iResponseData;
+ iRequestData->iResponseData = NULL;
+ iRequestData->iResponseData = HBufC8::NewL( length );
+ TPtr8 desc( iRequestData->iResponseData->Des() );
+ cache->FetchDocumentContent( desc, name, root );
+ if( iOperationType == EXdmDocument && !iTargetDoc.DocumentRoot() )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " No content => parse cached document" ) );
+ #endif
+ iXmlParser->ParseDocumentL( &iTargetDoc, desc );
+ }
+ else if( iOperationType == EXdmPartialDocument )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Parse a partial document" ) );
+ #endif
+ iXmlParser->ParseDocumentL( &iTargetDoc, desc, iDocumentSubset );
+ }
+ }
+ iCompleted = ETrue;
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Default case - Status: %d" ),
+ iRequestData->iHttpStatus );
+ #endif
+ iCompleted = ETrue;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::OperationFailedL
+//
+// ---------------------------------------------------------
+//
+void CXcapRetrieval::OperationFailedL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::OperationFailedL() - Error: %d" ),
+ iStatus.Int() );
+ #endif
+ if( iStatus.Int() >= KErrNone )
+ {
+ TInt status = iActiveRequest->ResponseData()->iHttpStatus;
+ TInt completion = iActiveRequest->ResponseData()->iCompletion;
+ iResult = status < KErrNone || completion < KErrNone ? status : ReinterpretStatus( status );
+ }
+ else iResult = iStatus.Int();
+ iCompleted = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::Result
+//
+// ---------------------------------------------------------
+//
+TInt CXcapRetrieval::Result() const
+ {
+ return iRequestData->iCompletion;
+ }
+
+// ---------------------------------------------------------
+// CXcapRetrieval::~CXcapRetrieval
+//
+// ---------------------------------------------------------
+//
+CXcapRetrieval::~CXcapRetrieval()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapRetrieval::~CXcapRetrieval()" ) );
+ #endif
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapOperations/src/XcapUriParser.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,448 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapUriParser
+*
+*/
+
+
+
+
+// INCLUDES
+#include <f32file.h>
+#include "XdmNamespace.h"
+#include "XcapUriParser.h"
+#include "XcapHttpOperation.h"
+#include "XcapEngineDefines.h"
+#include "XdmNodeAttribute.h"
+#include "XcapOperationFactory.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapUriParser::CXcapUriParser( CXdmDocument& aTargetDoc,
+ CXcapOperationFactory& aOperationFactory ) :
+ iTargetDoc( aTargetDoc ),
+ iNodeType( EXdmElementUnspecified ),
+ iOperationFactory( aOperationFactory )
+ {
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CXcapUriParser* CXcapUriParser::NewL( CXdmDocument& aTargetDoc,
+ CXcapOperationFactory& aOperationFactory )
+ {
+ CXcapUriParser* self = new ( ELeave ) CXcapUriParser( aTargetDoc, aOperationFactory );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CXcapUriParser::~CXcapUriParser()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapUriParser::~CXcapUriParser()" ) );
+ #endif
+ delete iUriBuffer;
+ delete iCompleteUri;
+ iNamespaceMappings.ResetAndDestroy();
+ iNamespaceMappings.Close();
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::AddNamespaceMappingL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::AddNamespaceMappingL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ CXdmNamespace* ns = CXdmNamespace::NewL( aUri, aPrefix );
+ CleanupStack::PushL( ns );
+ User::LeaveIfError( iNamespaceMappings.Append( ns ) );
+ CleanupStack::Pop(); //ns
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::AppendNamespaceMappingsL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::AppendNamespaceMappingsL()
+ {
+ CXdmNamespace* ns = NULL;
+ const TInt count = iNamespaceMappings.Count();
+ iUriBuffer->InsertL( iBufferPosition, KXcapUriQMark );
+ iBufferPosition = iBufferPosition + KXcapUriQMark().Length();
+ for( TInt i = 0;i < count;i++ )
+ {
+ ns = iNamespaceMappings[i];
+ iUriBuffer->InsertL( iBufferPosition, KXcapUriXmlns );
+ iBufferPosition = iBufferPosition + KXcapUriXmlns().Length();
+ TPtrC8 prefix( ns->Prefix() );
+ iUriBuffer->InsertL( iBufferPosition, prefix );
+ iBufferPosition = iBufferPosition + prefix.Length();
+ iUriBuffer->InsertL( iBufferPosition, KXcapUriEquals );
+ iBufferPosition = iBufferPosition + KXcapUriEquals().Length();
+ TPtrC8 uri( ns->Uri() );
+ iUriBuffer->InsertL( iBufferPosition, uri );
+ iBufferPosition = iBufferPosition + uri.Length();
+ iUriBuffer->InsertL( iBufferPosition, KXcapUriQuote );
+ iBufferPosition = iBufferPosition + KXcapUriQuote().Length();
+ iUriBuffer->InsertL( iBufferPosition, KXcapParenthClose );
+ iBufferPosition = iBufferPosition + KXcapParenthClose().Length();
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::FinaliseL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::FinaliseL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapUriParser::FinaliseL()" ) );
+ #endif
+ delete iCompleteUri;
+ iCompleteUri = NULL;
+ iCompleteUri = HBufC8::NewL( iUriBuffer->Size() );
+ TPtr8 pointer( iCompleteUri->Des() );
+ iUriBuffer->Read( 0, pointer, iUriBuffer->Size() );
+ iUriBuffer->Reset();
+ delete iUriBuffer;
+ iUriBuffer = NULL;
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::ParseL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::ParseL( const TPtrC8& aHttpUri )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapUriParser::ParseL()" ) );
+ #endif
+ iHttpUri = CONST_CAST( TPtrC8*, &aHttpUri );
+ if( iNodeType != EXdmElementUnspecified )
+ {
+ HBufC8* path = DocSubsetPathL();
+ CleanupStack::PushL( path );
+ iBufferPosition = CreateBasicNodeUriL( path );
+ CleanupStack::PopAndDestroy(); //path
+ iNodeType == EXdmElementAttribute ? FormatAttributeUriL() : FormatNodeUriL();
+ if( iNamespaceMappings.Count() > 0 )
+ AppendNamespaceMappingsL();
+ FinaliseL();
+ #ifdef _DEBUG
+ TPtr8 desc( iCompleteUri->Des() );
+ iOperationFactory.WriteToLog( _L8( " Context: %S" ), &desc );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " Context is a whole document" ) );
+ #endif
+ iCompleteUri = HBufC8::NewL( iHttpUri->Length() );
+ iCompleteUri->Des().Copy( *iHttpUri );
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::DocSubsetPathL
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXcapUriParser::DocSubsetPathL()
+ {
+ HBufC8* ret = NULL;
+ CXdmDocumentNode* current = iDocumentSubset->Parent();
+ CBufFlat* buffer = CBufFlat::NewL( 256 );
+ CleanupStack::PushL( buffer );
+ while( current != NULL )
+ {
+ buffer->InsertL( 0, FormatOnePathElementLC( current )->Des() );
+ CleanupStack::PopAndDestroy(); //FormatOnePathElementLC
+ current = current->Parent();
+ }
+ TInt length = buffer->Size();
+ ret = HBufC8::NewL( length );
+ TPtr8 pointer( ret->Des() );
+ buffer->Read( 0, pointer, length );
+ CleanupStack::PopAndDestroy(); //buffer
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::FormatAttributeUriL
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXcapUriParser::FormatOnePathElementLC( const CXdmDocumentNode* aPathElement )
+ {
+ #ifdef _DEBUG
+ HBufC8* name8 = aPathElement->EightBitNodeNameLC();
+ TPtrC8 elemName( name8->Des() );
+ TPtrC8 elemPref( aPathElement->Prefix() );
+ iOperationFactory.WriteToLog( _L8( "CXcapUriParser::FormatOnePathElementL()" ) );
+ if( elemPref.Length() > 0 )
+ iOperationFactory.WriteToLog( _L8( " Prefix: %S" ), &elemName );
+ iOperationFactory.WriteToLog( _L8( " Name: %S" ), &elemName );
+ CleanupStack::PopAndDestroy(); //name8
+ #endif
+ TInt position = 0;
+ CBufFlat* buffer = CBufFlat::NewL( 50 );
+ CleanupStack::PushL( buffer );
+ buffer->InsertL( position, KXCAPPathSeparator );
+ position = position + KXCAPPathSeparator().Length();
+ TPtrC8 prefix = aPathElement->Prefix();
+ if( prefix.Length() > 0 )
+ {
+ buffer->InsertL( position, prefix );
+ position = position + prefix.Length();
+ buffer->InsertL( position, KXcapUriColon );
+ position = position + KXcapUriColon().Length();
+ }
+ TPtrC8 name = aPathElement->EightBitNodeNameLC()->Des();
+ buffer->InsertL( position, name );
+ position = position + name.Length();
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC
+ if( aPathElement->AttributeCount() > 0 &&
+ !( iNodeType == EXdmElementAttribute && aPathElement == iDocumentSubset->Parent() ) )
+ AppendPredicatesL( position, buffer, aPathElement );
+ HBufC8* retBuf = HBufC8::NewL( buffer->Size() );
+ TPtr8 pointer( retBuf->Des() );
+ buffer->Read( 0, pointer, buffer->Size() );
+ CleanupStack::PopAndDestroy(); //buffer
+ CleanupStack::PushL( retBuf );
+ return retBuf;
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::FormatAttributeUriL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::FormatAttributeUriL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " CXcapUriParser::FormatAttributeUriL()" ) );
+ #endif
+ iUriBuffer->InsertL( iBufferPosition, KXCAPAttributeIdentifier );
+ iBufferPosition = iBufferPosition + KXCAPAttributeIdentifier().Length();
+ iUriBuffer->InsertL( iBufferPosition, iDocumentSubset->EightBitNodeNameLC()->Des() );
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC
+ HBufC8* newUri = HBufC8::NewLC( iUriBuffer->Size() );
+ TPtr8 pointer( newUri->Des() );
+ iUriBuffer->Read( 0, pointer, iUriBuffer->Size() );
+ #ifdef _DEBUG
+ DumpUriL( newUri );
+ #endif
+ CleanupStack::PopAndDestroy(); //newUri
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::FormatNodeUriL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::FormatNodeUriL()
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " CXcapUriParser::FormatNodeUriL()" ) );
+ #endif
+ iNodeType = EXdmElementNode;
+ TPtrC8 prefix = iDocumentSubset->Prefix();
+ if( prefix.Length() > 0 )
+ {
+ iUriBuffer->InsertL( iBufferPosition, prefix );
+ iBufferPosition = iBufferPosition + prefix.Length();
+ iUriBuffer->InsertL( iBufferPosition, KXcapUriColon );
+ iBufferPosition = iBufferPosition + KXcapUriColon().Length();
+ }
+ TPtrC8 name = iDocumentSubset->EightBitNodeNameLC()->Des();
+ iUriBuffer->InsertL( iBufferPosition, name );
+ iBufferPosition = iBufferPosition + name.Length();
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC
+ if( iDocumentSubset->AttributeCount() > 0 )
+ AppendPredicatesL( iBufferPosition, iUriBuffer, iDocumentSubset );
+ //For now, do not put a trailing '/' to the node path. This may have to be changed, though.
+ //iUriBuffer->InsertL( iBufferPosition, KXCAPPathSeparator );
+ //iBufferPosition = iBufferPosition + TPtrC8( KXCAPPathSeparator ).Length();
+ HBufC8* newUri = HBufC8::NewLC( iUriBuffer->Size() );
+ TPtr8 pointer2( newUri->Des() );
+ iUriBuffer->Read( 0, pointer2, iUriBuffer->Size() );
+ #ifdef _DEBUG
+ DumpUriL( newUri );
+ #endif
+ CleanupStack::PopAndDestroy(); //newUri
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::AppendPredicatesL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::AppendPredicatesL( TInt& aPosition,
+ CBufBase* aBuffer,
+ const CXdmDocumentNode* aPathElement )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " CXcapUriParser::AppendPredicatesL()" ) );
+ #endif
+ TInt count = aPathElement->AttributeCount();
+ for( TInt i = 0;i < count;i++ )
+ {
+ CXdmNodeAttribute* attribute = aPathElement->Attribute( i );
+ //Namespaces cannot be used as attributes
+ if( attribute->NodeName().Find( _L( "xmlns" ) ) < 0 )
+ {
+ aBuffer->InsertL( aPosition, KHTTPBracketOpen );
+ aPosition = aPosition + KHTTPBracketOpen().Length();
+ aBuffer->InsertL( aPosition, KXCAPAttributeIdentifier );
+ aPosition = aPosition + KXCAPAttributeIdentifier().Length();
+ TPtrC8 name = attribute->EightBitNodeNameLC()->Des();
+ aBuffer->InsertL( aPosition, name );
+ aPosition = aPosition + name.Length();
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC
+ aBuffer->InsertL( aPosition, KXCAPEquality );
+ aPosition = aPosition + KXCAPEquality().Length();
+ aBuffer->InsertL( aPosition, KHTTPQuotationMark );
+ aPosition = aPosition + KHTTPQuotationMark().Length();
+ TPtrC8 value = attribute->EightBitValueLC()->Des();
+ aBuffer->InsertL( aPosition, value );
+ aPosition = aPosition + value.Length();
+ CleanupStack::PopAndDestroy(); //EightBitValueLC
+ aBuffer->InsertL( aPosition, KHTTPQuotationMark );
+ aPosition = aPosition + KHTTPQuotationMark().Length();
+ aBuffer->InsertL( aPosition, KHTTPBracketClose );
+ aPosition = aPosition + KHTTPBracketClose().Length();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::CreateBasicNodeUriL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapUriParser::CreateBasicNodeUriL( HBufC8* aNodePath )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( " CXcapUriParser::CreateBasicNodeUriL()" ) );
+ #endif
+ TInt position = 0;
+ TPtr8 pointer( aNodePath->Des() );
+ iUriBuffer = CBufFlat::NewL( 256 );
+ iUriBuffer->InsertL( position, *iHttpUri );
+ position = iHttpUri->Length();
+ if( iHttpUri->LocateReverseF( KXcapPathSeparatorChar ) != iHttpUri->Length() - 1 )
+ {
+ iUriBuffer->InsertL( position, KXCAPPathSeparator );
+ position = position + KXCAPPathSeparator().Length();
+ }
+ iUriBuffer->InsertL( position, KXCAPNodeSeparator ); //"~~"
+ position = position + KXCAPNodeSeparator().Length();
+ iUriBuffer->InsertL( position, pointer );
+ position = position + pointer.Length();
+ iUriBuffer->InsertL( position, KXCAPPathSeparator );
+ position = position + KXCAPPathSeparator().Length();
+ return position;
+ }
+
+
+
+// ---------------------------------------------------------
+// CXcapUriParser::SetDocumentSubset
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::SetDocumentSubset( const CXdmDocumentNode* aDocumentSubset )
+ {
+ #ifdef _DEBUG
+ iOperationFactory.WriteToLog( _L8( "CXcapUriParser::SetDocumentSubset() - Type: %d" ),
+ aDocumentSubset->ElementType() );
+ #endif
+ __ASSERT_DEBUG( aDocumentSubset != NULL, User::Panic( _L( "CXcapUriParser" ), 1 ) );
+ iDocumentSubset = CONST_CAST( CXdmDocumentNode*, aDocumentSubset );
+ iNodeType = iDocumentSubset->ElementType();
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::DesC8
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapUriParser::DesC8() const
+ {
+ return iCompleteUri != NULL ? iCompleteUri->Des() : TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CXcapUriParser::NodeType
+//
+// ---------------------------------------------------------
+//
+TXdmElementType CXcapUriParser::NodeType() const
+ {
+ return iNodeType;
+ }
+
+#ifdef _DEBUG
+// ---------------------------------------------------------
+// CXcapUriParser::DumpUriL
+//
+// ---------------------------------------------------------
+//
+void CXcapUriParser::DumpUriL( HBufC8* aNodePath )
+ {
+ RFile file;
+ RFs session;
+ TPtr8 pointer( aNodePath->Des() );
+ _LIT( KFilePath, "C:\\logs\\XDM\\Dump.txt" );
+ User::LeaveIfError( session.Connect() );
+ TInt error = file.Replace( session, KFilePath, EFileWrite );
+ if( error == KErrNone )
+ {
+ file.Write( pointer );
+ file.Close();
+ }
+ session.Close();
+ }
+#endif
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/bwinscw/XcapUtilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+ ??1CXcapEarlyIms@@UAE@XZ @ 1 NONAME ; CXcapEarlyIms::~CXcapEarlyIms(void)
+ ?CheckFileExistsL@XcapStaticUtils@@SAHAAVRFs@@ABVTDesC16@@@Z @ 2 NONAME ; int XcapStaticUtils::CheckFileExistsL(class RFs &, class TDesC16 const &)
+ ?GenerateFileNameLC@XcapStaticUtils@@SAPAVHBufC16@@AAVRFs@@ABVTDesC16@@1@Z @ 3 NONAME ; class HBufC16 * XcapStaticUtils::GenerateFileNameLC(class RFs &, class TDesC16 const &, class TDesC16 const &)
+ ?NewL@CXcapEarlyIms@@SAPAV1@XZ @ 4 NONAME ; class CXcapEarlyIms * CXcapEarlyIms::NewL(void)
+ ?PublicIDL@CXcapEarlyIms@@QAE?AVTPtrC8@@XZ @ 5 NONAME ; class TPtrC8 CXcapEarlyIms::PublicIDL(void)
+ ?RequestSimDataL@CXcapEarlyIms@@QAEXPAVMXcapEarlyImsObs@@@Z @ 6 NONAME ; void CXcapEarlyIms::RequestSimDataL(class MXcapEarlyImsObs *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/eabi/XcapUtilsU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+ _ZN13CXcapEarlyIms15RequestSimDataLEP16MXcapEarlyImsObs @ 1 NONAME
+ _ZN13CXcapEarlyIms4NewLEv @ 2 NONAME
+ _ZN13CXcapEarlyIms9PublicIDLEv @ 3 NONAME
+ _ZN15XcapStaticUtils16CheckFileExistsLER3RFsRK7TDesC16 @ 4 NONAME
+ _ZN15XcapStaticUtils18GenerateFileNameLCER3RFsRK7TDesC16S4_ @ 5 NONAME
+ _ZTI13CXcapEarlyIms @ 6 NONAME ; #<TI>#
+ _ZTV13CXcapEarlyIms @ 7 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/group/XcapUtils.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapUtils.dll from XcapUtils.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcaputils.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10207453
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE XcapEarlyIms.cpp
+SOURCE XcapStaticUtils.cpp
+
+//Internal
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY etel.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY etelmm.lib
+LIBRARY commsdat.lib
+DEBUGLIBRARY flogger.lib
+
+#if defined( ARMCC )
+ deffile ../eabi/
+#elif defined ( WINSCW )
+ deffile ../bwinscw/
+#elif defined ( WINS )
+ deffile ../bwins/
+#endif
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapUtils bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+
+XcapUtils.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/inc/XcapEarlyIms.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapEarlyIms
+*
+*/
+
+
+
+
+#ifndef __XCAPEARLYIMS__
+#define __XCAPEARLYIMS__
+
+#include <etelmm.h>
+
+//COMMON CONSTANTS
+_LIT( KUtilsLogDir, "XDM" );
+_LIT( KUtilsLogFile, "XcapUtils.txt" );
+_LIT8( KXcapFakeImpu, "IMSI@FakeImpu.ims.3gpp.invalid" );
+const TInt KUtilsLogBufMaxSize = 2000;
+
+
+//For testing of EarlyIms in WINSCW
+//#define __FAKE_IMPU__
+
+//FORWARD DECLARATIONS
+class MXcapEarlyImsObs;
+class CAsyncRetrieveAuthorizationInfo;
+
+// CLASS DECLARATION
+class CXcapEarlyIms : public CActive
+
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS default constructor.
+ * @return CXcapEarlyIms New instance
+ */
+ IMPORT_C static CXcapEarlyIms* NewL();
+
+ /**
+ * Symbian OS default constructor.
+ * @return CXcapEarlyIms New instance
+ */
+ IMPORT_C void RequestSimDataL( MXcapEarlyImsObs* aObserver );
+
+ /**
+ * Symbian OS default constructor.
+ * @return CXcapEarlyIms New instance
+ */
+ IMPORT_C TPtrC8 PublicIDL();
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXcapEarlyIms();
+
+ #ifdef _DEBUG
+
+ /**
+ * Clean the log file
+ * @return void
+ */
+ void CXcapEarlyIms::DeleteLogFileL();
+
+ /**
+ * A global logging function for 8 bit data.
+ * @param aCommand command to be handled
+ */
+ static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
+
+ #endif //_DEBUG
+
+ private:
+
+ /**
+ * C++ default constructor is private.
+ */
+ CXcapEarlyIms();
+
+ /**
+ * Symbian OS second-phase constructor.
+ * @return void
+ */
+ void ConstructL();
+
+ /**
+ * From CActive
+ * A request has completed
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ * Cancel an outstanding request.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * Get the module name
+ * @param TDes& Module name on return
+ * @return void
+ */
+ void ModuleNameL( TDes& aModuleName ) const;
+
+ /**
+ * Find out the type of the SIM card
+ * and its application
+ * @return void
+ */
+ void SelectSimTypeL();
+
+ /**
+ * Derive IMPU and IMPI from the values
+ * retrieved from the SIM card
+ * @return TPtrC8 User's Public ID
+ */
+ TPtrC8 DeriveL();
+
+ private: //Data
+
+
+ enum TRequestPhase
+ {
+ TRequestIdle = 0,
+ TRequestAuth,
+ TRequestNetwork,
+ TRequestUsimAuth
+ };
+
+ enum TXcapSimType
+ {
+ ESimTypeGsm = 0,
+ ESimTypeCdma,
+ ESimTypeWcdma,
+ ESimTypeUnknown
+ };
+
+ TBool iRequestComplete;
+ HBufC8* iImpu;
+ HBufC8* iImpi;
+ RTelServer iServer;
+ RMobilePhone iPhone;
+ TXcapSimType iSimType;
+ TRequestPhase iRequestPhase;
+ MXcapEarlyImsObs* iObserver;
+ CAsyncRetrieveAuthorizationInfo* iRetriever;
+ RMobilePhone::CImsAuthorizationInfoV5* iAuthData;
+ RMobilePhone::TMobilePhoneSubscriberId iImsi;
+ RMobilePhone::TMobilePhoneNetworkCountryCode iCountryCode;
+ RMobilePhone::TMobilePhoneNetworkIdentity iNetworkCode;
+ TPckgBuf<RMobilePhone::TMobilePhoneNetworkInfoV1> iNetworkInfoPckg;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/inc/XcapStaticUtils.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapStaticUtils
+*
+*/
+
+
+
+
+#ifndef __XCAPSTATICUTILS__
+#define __XCAPSTATICUTILS__
+
+#include <e32base.h>
+
+class RFs;
+
+// CLASS DECLARATION
+class XcapStaticUtils
+
+ {
+ public:
+
+ /**
+ * Check whether a file already exists.
+ *
+ * @param TDesC& The file name to check
+ * @return TBool Is the file already there
+ */
+ IMPORT_C static TBool CheckFileExistsL( RFs& aFileSession, const TDesC& aFileName );
+
+ /**
+ * Generate a new file name unique in the context
+ * of the folder in which it resides
+ *
+ * @param TDesC& The file name to check
+ * @return TBool Is the file already there
+ */
+ IMPORT_C static HBufC* GenerateFileNameLC( RFs& aFileSession, const TDesC& aFileName,
+ const TDesC& aExtension );
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/inc/XcapUtilsInterface.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MXcapEarlyImsObs
+*
+*/
+
+
+
+
+#ifndef __XCAPUTILSINTERFACE__
+#define __XCAPUTILSINTERFACE__
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+class MXcapEarlyImsObs
+ {
+ public: // Constructors and destructor
+
+ /**
+ * IMS parameters have been resolved.
+ * @return void
+ */
+ virtual void RequestComplete( TInt aError ) = 0;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/src/XcapEarlyIms.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,444 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapEarlyIms
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#ifdef _DEBUG
+ #include <f32file.h>
+ #include <flogger.h>
+ #include <e32debug.h>
+#endif
+#include <cdblen.h>
+#include <commsdat.h>
+#include <metadatabase.h>
+#include <commsdattypesv1_1.h>
+#include <mmretrieve.h>
+#include "XcapEarlyIms.h"
+#include "XcapUtilsInterface.h"
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::CXcapEarlyIms
+//
+// ----------------------------------------------------------
+//
+CXcapEarlyIms::CXcapEarlyIms() : CActive( EPriorityNormal ),
+ iRequestComplete( EFalse ),
+ iSimType( ESimTypeUnknown )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXcapEarlyIms* CXcapEarlyIms::NewL()
+ {
+ CXcapEarlyIms* self = new ( ELeave ) CXcapEarlyIms();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(); //self
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapEarlyIms::~CXcapEarlyIms
+//
+// ----------------------------------------------------
+//
+CXcapEarlyIms::~CXcapEarlyIms()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::~CXcapEarlyIms()" ) );
+ #endif
+ delete iImpu;
+ delete iImpi;
+ delete iAuthData;
+ delete iRetriever;
+ iPhone.Close();
+ iServer.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::ConstructL()
+ {
+ #ifdef _DEBUG
+ DeleteLogFileL();
+ WriteToLog( _L8( "CXcapEarlyIms::ConstructL()" ) );
+ #endif
+ #ifndef __FAKE_IMPU__
+ TName tsyName;
+ TInt numPhone = 0;
+ TBool found = EFalse;
+ RTelServer::TPhoneInfo phoneInfo;
+ User::LeaveIfError( iServer.Connect() );
+ TBuf<KCommsDbSvrMaxFieldLength> tsyModuleName;
+ ModuleNameL( tsyModuleName );
+ User::LeaveIfError( iServer.LoadPhoneModule( tsyModuleName ) );
+ User::LeaveIfError( iServer.EnumeratePhones( numPhone ) );
+ for( TInt i = 0;!found && i < numPhone;i++ )
+ {
+ User::LeaveIfError( iServer.GetTsyName( i, tsyName ) );
+ User::LeaveIfError( iServer.GetPhoneInfo( i, phoneInfo ) );
+ if( tsyName.CompareF( tsyModuleName ) == 0 )
+ found = ETrue;
+ }
+ __ASSERT_ALWAYS( found, User::Leave( KErrNotFound ) );
+ User::LeaveIfError( iPhone.Open( iServer, phoneInfo.iName ) );
+ SelectSimTypeL();
+ #endif
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::RequestSimDataL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXcapEarlyIms::RequestSimDataL( MXcapEarlyImsObs* aObserver )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::RequestSimDataL()" ) );
+ #endif
+ #ifdef __FAKE_IMPU__
+ iStatus = KRequestPending;
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ #else
+ if( !IsActive() )
+ {
+ TUint32 caps( 0 );
+ User::LeaveIfError( iPhone.GetIdentityCaps( caps ) );
+ if( !( caps & RMobilePhone::KCapsGetSubscriberId ) )
+ User::Leave( KErrNotSupported );
+ iPhone.GetSubscriberId( iStatus, iImsi );
+ iRequestPhase = TRequestAuth;
+ iRequestComplete = EFalse;
+ SetActive();
+ }
+ #endif
+ iObserver = aObserver;
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::PublicIDL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapEarlyIms::PublicIDL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::PublicIDL()" ) );
+ #endif
+ #ifdef __FAKE_IMPU__
+ return KXcapFakeImpu();
+ #else
+ if( iRequestComplete && iRequestPhase == TRequestIdle )
+ {
+ switch( iSimType )
+ {
+ case ESimTypeWcdma:
+ return iAuthData->iIMPUArray[0];
+ case ESimTypeGsm:
+ return DeriveL();
+ default:
+ return TPtrC8();
+ }
+ }
+ else return TPtrC8();
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::DeriveL
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapEarlyIms::DeriveL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::DeriveL()" ) );
+ #endif
+ _LIT8( KImsMnc, "ims.mnc" );
+ _LIT8( KMcc, ".mcc" );
+ _LIT8( K3gppnetwork, ".3gppnetwork.org");
+ _LIT8( KAt, "@");
+ _LIT8( KSip, "sip:");
+ _LIT8( KZero, "0");
+ TPtrC networkDesc( iNetworkInfoPckg().iNetworkId );
+ TPtrC countryDesc( iNetworkInfoPckg().iCountryCode );
+ TInt nwlength = networkDesc.Length() + countryDesc.Length();
+ if( networkDesc.Length() == 2 )
+ nwlength = nwlength + 1;
+ //private user identity
+ TInt impiLength = iImsi.Length() + KAt().Length() + KImsMnc().Length() +
+ nwlength + KMcc().Length() + K3gppnetwork().Length();
+ iImpi = HBufC8::NewL( impiLength );
+ TPtr8 impiDesc( iImpi->Des() );
+ impiDesc.Append( iImsi );
+ impiDesc.Append( KAt );
+ impiDesc.Append( KImsMnc );
+ if( networkDesc.Length() == 2 )
+ impiDesc.Append( KZero );
+ impiDesc.Append( networkDesc );
+ impiDesc.Append( KMcc );
+ impiDesc.Append( countryDesc );
+ impiDesc.Append( K3gppnetwork );
+ //public user identity
+ TInt impuLength = KSip().Length() + impiDesc.Length();
+ iImpu = HBufC8::NewL( impuLength );
+ TPtr8 impuDesc( iImpu->Des() );
+ impuDesc.Append( KSip );
+ impuDesc.Append( impiDesc );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " IMPI: %S" ), &impiDesc );
+ WriteToLog( _L8( " IMPU: %S" ), &impuDesc );
+ #endif
+ return impuDesc;
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::SelectSimTypeL
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::SelectSimTypeL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::SelectSimTypeL()" ) );
+ #endif
+ TUint32 caps;
+ User::LeaveIfError( iPhone.GetIccAccessCaps( caps ) );
+ if( caps & RMobilePhone::KCapsSimAccessSupported )
+ {
+ if( caps & RMobilePhone::KCapsUSimAccessSupported )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " USIM Card" ) );
+ #endif
+ iSimType = ESimTypeWcdma;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " 2G SIM Card" ) );
+ #endif
+ iSimType = ESimTypeGsm;
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " No SIM Card" ) );
+ #endif
+ iSimType = ESimTypeUnknown;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::RunL
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::RunL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::RunL()" ) );
+ WriteToLog( _L8( " Status: %d" ), iStatus.Int() );
+ WriteToLog( _L8( " Request phase: %d" ), iRequestPhase );
+ #endif
+ #ifdef __FAKE_IMPU__
+ iObserver->RequestComplete( KErrNone );
+ #else
+ if( iStatus.Int() == KErrNone )
+ {
+ switch( iRequestPhase )
+ {
+ case TRequestIdle:
+ break;
+ case TRequestAuth:
+ {
+ #ifdef _DEBUG
+ HBufC8* buf = HBufC8::NewLC( iImsi.Length() );
+ TPtr8 desc( buf->Des() );
+ desc.Copy( iImsi );
+ WriteToLog( _L8( " IMSI retrieved: %S" ), &desc );
+ CleanupStack::PopAndDestroy(); //buf
+ #endif
+ iPhone.GetHomeNetwork( iStatus, iNetworkInfoPckg );
+ iRequestPhase = TRequestNetwork;
+ SetActive();
+ }
+ break;
+ case TRequestNetwork:
+ {
+ #ifdef _DEBUG
+ HBufC8* nwid = HBufC8::NewLC( iNetworkInfoPckg().iNetworkId.Length() );
+ HBufC8* country = HBufC8::NewLC( iNetworkInfoPckg().iCountryCode.Length() );
+ TPtr8 desc1( nwid->Des() );
+ TPtr8 desc2( country->Des() );
+ desc1.Copy( iNetworkInfoPckg().iNetworkId );
+ desc2.Copy( iNetworkInfoPckg().iCountryCode );
+ WriteToLog( _L8( " Home network info retrieved" ) );
+ WriteToLog( _L8( " Network ID: %S" ), &desc1 );
+ WriteToLog( _L8( " Country code: %S" ), &desc2 );
+ CleanupStack::PopAndDestroy( 2 ); //country, nwid
+ #endif
+ if( iSimType == ESimTypeWcdma )
+ {
+ iAuthData = RMobilePhone::CImsAuthorizationInfoV5::NewL();
+ iRetriever = CAsyncRetrieveAuthorizationInfo::NewL( iPhone, *iAuthData );
+ iRequestPhase = TRequestUsimAuth;
+ iRetriever->Start( iStatus );
+ SetActive();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Request complete" ) );
+ #endif
+ iObserver->RequestComplete( KErrNone );
+ iRequestPhase = TRequestIdle;
+ iRequestComplete = ETrue;
+ }
+ }
+ break;
+ case TRequestUsimAuth:
+ {
+ #ifdef _DEBUG
+ RMobilePhone::TAuthorizationDataSource source(
+ iAuthData->iAuthenticationDataSource );
+ TBuf8<4> sourceDesc( source == RMobilePhone::EFromUSIM
+ ? _L8( "USIM" ) : _L8( "ISIM" ) );
+ WriteToLog( _L8( " USIM auth retrieved" ) );
+ WriteToLog( _L8( " IMPI: %S" ), &iAuthData->iIMPI );
+ WriteToLog( _L8( " IMPU: %S" ), &iAuthData->iIMPUArray[0] );
+ WriteToLog( _L8( " Domain: %S" ), &iAuthData->iHomeNetworkDomainName );
+ WriteToLog( _L8( " AuthDataSource: %S" ), &sourceDesc );
+ #endif
+ iObserver->RequestComplete( KErrNone );
+ iRequestPhase = TRequestIdle;
+ iRequestComplete = ETrue;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else iObserver->RequestComplete( iStatus.Int() );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::DoCancel
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::DoCancel()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapEarlyIms::DoCancel() - State: %d" ), iRequestPhase );
+ #endif
+ switch( iRequestPhase )
+ {
+ case TRequestIdle:
+ break;
+ case TRequestAuth:
+ iPhone.CancelAsyncRequest( EMobilePhoneGetSubscriberId );
+ break;
+ case TRequestNetwork:
+ iPhone.CancelAsyncRequest( EMobilePhoneGetHomeNetwork );
+ break;
+ case TRequestUsimAuth:
+ delete iRetriever;
+ iRetriever = NULL;
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::ModuleNameL
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::ModuleNameL( TDes& aModuleName ) const
+ {
+ __ASSERT_ALWAYS( aModuleName.MaxSize() >= KCommsDbSvrMaxFieldLength, User::Leave( KErrArgument ) );
+ using namespace CommsDat;
+ CMDBSession* db = CMDBSession::NewLC( KCDLatestVersion );
+ CMDBField<TUint32>* field = new ( ELeave ) CMDBField<TUint32>( KCDTIdModemPhoneServicesSMS );
+ CleanupStack::PushL( field );
+ field->SetRecordId( 1 );
+ field->LoadL( *db );
+ TUint32 modemId = *field;
+ CMDBField<TDesC>* tsyField = new ( ELeave ) CMDBField<TDesC>( KCDTIdTsyName );
+ CleanupStack::PushL( tsyField );
+ tsyField->SetRecordId( modemId );
+ tsyField->LoadL( *db );
+ aModuleName = *tsyField;
+ CleanupStack::PopAndDestroy( 3 ); //tsyField, field, db
+ }
+
+#ifdef _DEBUG
+// ----------------------------------------------------
+// CXcapEarlyIms::WriteToLog
+//
+// ----------------------------------------------------
+//
+void CXcapEarlyIms::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KUtilsLogBufMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ RFileLogger::Write( KUtilsLogDir, KUtilsLogFile, EFileLoggingModeAppend, buf );
+ }
+
+// ----------------------------------------------------------
+// CXcapEarlyIms::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+void CXcapEarlyIms::DeleteLogFileL()
+ {
+ RFs session;
+ TBuf<32> log( _L( "C:\\logs\\XDM\\" ) );
+ User::LeaveIfError( session.Connect() );
+ CFileMan* manager = CFileMan::NewL( session );
+ log.Append( KUtilsLogFile );
+ manager->Delete( log );
+ session.Close();
+ delete manager;
+ manager = NULL;
+ }
+#endif //_DEBUG
+
+
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/XcapUtils/src/XcapStaticUtils.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapStaticUtils
+*
+*/
+
+
+
+
+#include <f32file.h>
+#include "XcapStaticUtils.h"
+
+// ----------------------------------------------------------
+// XcapStaticUtils::CheckFileExistsL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool XcapStaticUtils::CheckFileExistsL( RFs& aFileSession, const TDesC& aFileName )
+ {
+ TBool found = EFalse;
+ CDir* directory = NULL;
+ const TInt KBackSlash = 92;
+ TInt index = aFileName.LocateReverse( KBackSlash );
+ TPtrC dir( aFileName.Left( index + 1 ) );
+ TPtrC name( aFileName.Right( aFileName.Length() - index - 1 ) );
+ User::LeaveIfError( aFileSession.GetDir( dir, KEntryAttNormal, ESortNone, directory ) );
+ CleanupStack::PushL( directory );
+ const TInt count = directory->Count();
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ if( name.CompareF( ( *directory )[i].iName ) == 0 )
+ found = ETrue;
+ }
+ CleanupStack::PopAndDestroy(); //directory
+ return found;
+ }
+
+// ----------------------------------------------------------
+// XcapStaticUtils::GenerateFileNameLC
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC* XcapStaticUtils::GenerateFileNameLC( RFs& aFileSession, const TDesC& aFileName,
+ const TDesC& aExtension )
+ {
+ TBuf<KMaxFileName> name;
+ name.Copy( aFileName );
+ name.Append( aExtension );
+ TBool exists = XcapStaticUtils::CheckFileExistsL( aFileSession, name );
+ for( TInt i = 1;exists;i++ )
+ {
+ name.Zero();
+ name.Copy( aFileName );
+ name.AppendNum( i );
+ name.Append( aExtension );
+ exists = XcapStaticUtils::CheckFileExistsL( aFileSession, name );
+ }
+ return name.AllocLC();
+ }
+
+
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/bwinscw/XcapProtocolU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,22 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+ ??1CXcapDocumentNode@@UAE@XZ @ 2 NONAME ; CXcapDocumentNode::~CXcapDocumentNode(void)
+ ??1CXdmNamespace@@UAE@XZ @ 3 NONAME ; CXdmNamespace::~CXdmNamespace(void)
+ ?ApplicationUsage@CXcapDocument@@QBEAAVCXcapAppUsage@@XZ @ 4 NONAME ; class CXcapAppUsage & CXcapDocument::ApplicationUsage(void) const
+ ?Cache@CXcapProtocol@@QAEPAVRXcapCache@@XZ @ 5 NONAME ; class RXcapCache * CXcapProtocol::Cache(void)
+ ?DataLength@CXcapDocument@@QBEHXZ @ 6 NONAME ; int CXcapDocument::DataLength(void) const
+ ?ETag@CXcapDocument@@QAEAAVTDesC8@@XZ @ 7 NONAME ; class TDesC8 & CXcapDocument::ETag(void)
+ ?IsNetworkAvailable@CXcapProtocol@@QAEHXZ @ 8 NONAME ; int CXcapProtocol::IsNetworkAvailable(void)
+ ?NewL@CXdmNamespace@@SAPAV1@ABVTDesC8@@0@Z @ 9 NONAME ; class CXdmNamespace * CXdmNamespace::NewL(class TDesC8 const &, class TDesC8 const &)
+ ?Parser@CXcapProtocol@@QAEAAVCXdmXmlParser@@XZ @ 10 NONAME ; class CXdmXmlParser & CXcapProtocol::Parser(void)
+ ?Prefix@CXdmNamespace@@QBE?AVTPtrC8@@XZ @ 11 NONAME ; class TPtrC8 CXdmNamespace::Prefix(void) const
+ ?Protocol@CXcapDocument@@QBEAAVCXcapProtocol@@XZ @ 12 NONAME ; class CXcapProtocol & CXcapDocument::Protocol(void) const
+ ?PublicID@CXcapProtocol@@QAE?AVTPtrC8@@XZ @ 13 NONAME ; class TPtrC8 CXcapProtocol::PublicID(void)
+ ?RemoveData@CXcapDocument@@QAEXPAVCXcapDocumentNode@@@Z @ 14 NONAME ; void CXcapDocument::RemoveData(class CXcapDocumentNode *)
+ ?ResetSubset@CXcapDocument@@UAEXXZ @ 15 NONAME ; void CXcapDocument::ResetSubset(void)
+ ?SetETag@CXcapDocument@@QAEXABVTDesC8@@@Z @ 16 NONAME ; void CXcapDocument::SetETag(class TDesC8 const &)
+ ?TempCopyL@CXcapDocument@@QAEPAV1@XZ @ 17 NONAME ; class CXcapDocument * CXcapDocument::TempCopyL(void)
+ ?Transport@CXcapProtocol@@QAEAAVCXcapHttpTransport@@XZ @ 18 NONAME ; class CXcapHttpTransport & CXcapProtocol::Transport(void)
+ ?Uri@CXdmNamespace@@QBE?AVTPtrC8@@XZ @ 19 NONAME ; class TPtrC8 CXdmNamespace::Uri(void) const
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/eabi/XcapProtocolU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,30 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZN13CXcapDocument10RemoveDataEP17CXcapDocumentNode @ 2 NONAME
+ _ZN13CXcapDocument11ResetSubsetEv @ 3 NONAME
+ _ZN13CXcapDocument4ETagEv @ 4 NONAME
+ _ZN13CXcapDocument7SetETagERK6TDesC8 @ 5 NONAME
+ _ZN13CXcapDocument9TempCopyLEv @ 6 NONAME
+ _ZN13CXcapProtocol18IsNetworkAvailableEv @ 7 NONAME
+ _ZN13CXcapProtocol5CacheEv @ 8 NONAME
+ _ZN13CXcapProtocol6ParserEv @ 9 NONAME
+ _ZN13CXcapProtocol8PublicIDEv @ 10 NONAME
+ _ZN13CXcapProtocol9TransportEv @ 11 NONAME
+ _ZN13CXdmNamespace4NewLERK6TDesC8S2_ @ 12 NONAME
+ _ZN13CXdmNamespaceD0Ev @ 13 NONAME
+ _ZN13CXdmNamespaceD1Ev @ 14 NONAME
+ _ZN13CXdmNamespaceD2Ev @ 15 NONAME
+ _ZN17CXcapDocumentNodeD0Ev @ 16 NONAME
+ _ZN17CXcapDocumentNodeD1Ev @ 17 NONAME
+ _ZN17CXcapDocumentNodeD2Ev @ 18 NONAME
+ _ZNK13CXcapDocument10DataLengthEv @ 19 NONAME
+ _ZNK13CXcapDocument16ApplicationUsageEv @ 20 NONAME
+ _ZNK13CXcapDocument8ProtocolEv @ 21 NONAME
+ _ZNK13CXdmNamespace3UriEv @ 22 NONAME
+ _ZNK13CXdmNamespace6PrefixEv @ 23 NONAME
+ _ZTI13CXcapDocument @ 24 NONAME ; #<TI>#
+ _ZTI13CXcapProtocol @ 25 NONAME ; #<TI>#
+ _ZTV13CXcapDocument @ 26 NONAME ; #<VT>#
+ _ZTV13CXcapProtocol @ 27 NONAME ; #<VT>#
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/group/XcapProtocol.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmProtocol.dll from XdmProtocol.mmp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xcapprotocol.dll
+UID 0x10009D8D 0x1020740F
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+TARGETTYPE PLUGIN
+
+SOURCEPATH ../src
+
+START RESOURCE 1020740F.rss
+
+TARGET xcapprotocol.rsc
+
+END
+
+SOURCE XcapProtocol.cpp
+SOURCE XcapDocument.cpp
+SOURCE XcapDirectory.cpp
+SOURCE XcapDocumentNode.cpp
+SOURCE XcapNodeAttribute.cpp
+
+//Sources common to all protocols
+SOURCEPATH ../../src
+SOURCE XdmNamespace.cpp
+SOURCE XdmShutdownTimer.cpp
+
+//Internal XCAP includes
+USERINCLUDE ../XcapUtils/inc
+USERINCLUDE ../XcapCache/inc
+USERINCLUDE ../XcapAppUsage/inc
+USERINCLUDE ../XcapOperations/inc
+USERINCLUDE ../XcapHttpTransport/inc
+
+//Common XDM includes
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../XdmXmlParser/inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/xml
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY hal.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY charconv.lib
+LIBRARY xdmengine.lib
+LIBRARY xdmxmlparser.lib
+LIBRARY xdmsettingsapi.lib
+LIBRARY msgconnmanager.lib
+LIBRARY xcapcacheclient.lib
+LIBRARY xcaphttptransport.lib
+LIBRARY xcaputils.lib
+DEBUGLIBRARY flogger.lib
+
+
+#if defined( ARMCC )
+DEFFILE ../eabi/
+#elif defined ( WINSCW )
+deffile ../bwinscw/
+#elif defined (WINS )
+deffile ../bwins/
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapProtocol bld.inf
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XcapProtocol.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapDirectory.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDirectory
+*
+*/
+
+
+
+
+#ifndef __XCAPDIRECTORY__
+#define __XCAPDIRECTORY__
+
+#include <e32base.h>
+#include "XdmDirectory.h"
+#include "XdmDocument.h"
+
+//CONSTANTS
+_LIT( KDirectoryEntry, "entry" );
+_LIT( KAuidAttribute, "auid" );
+_LIT( KDocumentUri, "uri" );
+_LIT( KDocumentETag, "etag" );
+
+//AUIDs
+_LIT( KCapabilities, "/services/org.openmobilealliance.xcap-caps/" );
+_LIT( KPocRules, "/services/org.openmobilealliance.poc-rules" );
+_LIT( KPocGroup, "/services/org.openmobilealliance.poc-groups" );
+_LIT( KResourceLists, "/services/org.openmobilealliance.resource-lists/" );
+_LIT( KPresenceRules, "/services/org.openmobilealliance.pres-rules/" );
+_LIT( KDirectoryUsage, "/services/org.openmobilealliance.xcap-directory/" );
+_LIT( KSharedXDMS, "/services/org.openmobilealliance.resource-lists/" );
+_LIT( KRlsServices, "/services/org.openmobilealliance.rls-services/" );
+
+//FORWARD DECLARATIONS
+class CXdmDocument;
+class CXcapProtocol;
+class CXcapRetrieval;
+class CXcapHttpReqGet;
+class CXcapOperationFactory;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapDirectory ) : public CXdmDirectory
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapDirectory* NewL( const TDesC& aAUID,
+ CXdmEngine& aXdmEngine,
+ CXdmDocument*& aDirectoryDoc,
+ CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void CancelUpdate();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapDirectory();
+
+ private: //From CXdmDirectory
+
+ /**
+ * Destructor.
+ */
+ TInt DocumentCount();
+
+ /**
+ * Return the root element of this document
+ */
+ TPtrC Document( TInt aIndex ) const;
+
+ /**
+ * Returns the path to this directory
+ *
+ * @return TPtrC8 The path to the directory this object models
+ */
+ TPtrC DirectoryPath() const;
+
+ /**
+ * Returns the path to this directory
+ *
+ * @return TPtrC8 The path to the directory this object models
+ */
+ TXdmDocType DocumentTypeL( TInt aIndex ) const;
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapDirectory( CXdmDocument*& aDirectoryDoc,
+ CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL( const TDesC& aAUID );
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void StartUpdateL();
+
+ /**
+ * Save the client's request status and update status
+ * @param TDirUpdatePhase The update phase
+ * @param TRequestStatus The client's request status
+ * @return void
+ */
+ void SaveRequestData( TDirUpdatePhase aUpdatePhase,
+ TRequestStatus& aClientStatus );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void HandleDocumentListRequestL();
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void HandleRefreshRequestL();
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ void UpdateNextDocumentL();
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ TBool CheckLocalCopyL( const CXdmDocumentNode* aDocumentNode );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ TPtrC ExtractDocumentUriL( const TDesC8& aRootUri,
+ const CXdmDocumentNode* aDocumentNode );
+
+ /**
+ * From CXdmDirectory.
+ * @return void
+ */
+ TXdmDocType FindAUID( const CXdmDocumentNode& aEntryNode ) const;
+
+ private: //Data
+
+ TInt iUpdateIndex;
+ TInt iDocumentCount;
+ HBufC* iAUID;
+ CXcapDocument* iDirectoryDoc;
+ TRequestStatus* iClientStatus;
+ TDirUpdatePhase iUpdatePhase;
+ CXcapHttpReqGet* iHttpRetrieval;
+ CXcapProtocol& iXcapProtocol;
+ RPointerArray<CXdmDocumentNode> iUpdateList;
+ RPointerArray<CXdmDocumentNode> iDocumentList;
+ };
+
+#endif //__XCAPDIRECTORY__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapDocument.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,440 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDocument
+*
+*/
+
+
+
+
+#ifndef __XCAPDOCUMENT__
+#define __XCAPDOCUMENT__
+
+#include <e32base.h>
+#include <XdmDocument.h>
+
+//CONSTANTS
+const TUint KETagBufferMaxLength = 64;
+_LIT8( KSlash, "/" );
+_LIT8( KUserDirName, "users/" );
+_LIT8( KGlobalDirName, "global/" );
+_LIT8( KXcapGlobalDocName, "index" );
+
+//FORWARD DECLARATIONS
+class RXcapCache;
+class CXdmEngine;
+class CXdmNamespace;
+class CXcapProtocol;
+class CXcapAppUsage;
+class MXdmOperation;
+class CXcapDocumentNode;
+class CXdmOperationFactory;
+
+//CLASS DECLARATION
+class CXcapDocument : public CXdmDocument
+ {
+ public:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapDocument* NewL( TXdmDocType aDocumentType,
+ const TDesC& aDocumentName,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapDocument* NewL( TXdmDocType aDocumentType,
+ const TDesC8& aDocumentName,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Set one option
+ * @return void
+ * @param The completed update operation
+ */
+ void SetOption( TInt aOption );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TXdmDocType DocumentType() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void NotifyResolverCompleteL( TInt aError );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void StartInternalL( TRequestStatus& aStatus );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void CancelUpdate();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapDocument();
+
+ public: //Exported methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C TDesC8& ETag();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C void SetETag( const TDesC8& aETagDesc );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C TInt DataLength() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C CXcapAppUsage& ApplicationUsage() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C CXcapDocument* TempCopyL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C void RemoveData( CXcapDocumentNode* aDocumentNode );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ IMPORT_C CXcapProtocol& Protocol() const;
+
+ /**
+ * Reset the document subset
+ */
+ IMPORT_C virtual void ResetSubset();
+
+ private: //From CXdmDocument
+
+ /**
+ * Construct an "anonymous" entry point for this document.
+ * This node effectively becomes the root of this document.
+ *
+ */
+ CXdmDocumentNode* CreateRootL();
+
+ /**
+ * Return the time stamp for this document
+ *
+ * @return TTime
+ */
+ TTime TimeStamp() const;
+
+ /**
+ * Return an error document for a failed update
+ *
+ * NOTE: The returning object will be NULL in case
+ * the used protocol does not support this feature.
+ *
+ * @return CXdmDocument* The error document
+ */
+ CXdmDocumentNode* ErrorRoot();
+
+ /*
+ * Reset the contents of this document model.
+ */
+ void ResetContents();
+
+ public: //From CXdmDocument
+
+ /**
+ * Return the root element of this document
+ *
+ * @return CXdmDocumentNode The root element of the document
+ *
+ * NOTE: The returning node may or may not contain any data,
+ * since, in the case that this document model does not
+ * have content yet, the element is a simple "entry point"
+ * to the whole document. Thus, for instance, if the client
+ * application requests the Xdm Engine to fetch a particular
+ * document, the root element points to nothing until the
+ * request has been completed.
+ *
+ */
+ CXdmDocumentNode* DocumentRoot() const;
+
+ private: //From MXdmNamespaceContainer
+
+ /**
+ * Return the number of namespace declarations
+ * @return TInt Namespace declaration count
+ */
+ TInt Count() const;
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ /**
+ * Remove a namespace from the document
+ * @param TDesC8& URI of the namespace
+ * @param TDesC8& Prefix of the namespace
+ */
+ void RemoveNamespace( const TDesC8& aUri );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TPtrC8 Uri( const TDesC8& aPrefix ) const;
+
+ /**
+ * Fetch the aIndex-th URI
+ * @param TInt The index of the desired URI string
+ * @return TPtrC URI string
+ */
+ TPtrC8 Uri( TInt aIndex ) const;
+
+ /**
+ * Fetch the aIndex-th prefix
+ * @param TDesC8 The index of the desired prefix string
+ * @return TPtrC Prefix string
+ */
+ TPtrC8 Prefix( TInt aIndex ) const;
+
+ /**
+ * Resets namespaces from the document
+ *
+ * @return void
+ */
+ void ResetNamespaces();
+
+ private:
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapDocument( TXdmDocType aDocumentType,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol );
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * @return void
+ */
+ void DoCancel();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void InstallAppUsageL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void UpdateDocumentInfoL( RXcapCache* aCacheClient );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void StartUpdateL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void SaveClientStatus( TRequestStatus& aClientStatus );
+
+ /**
+ * Handle a failed update operation
+ * @return void
+ * @param CXdmDocOperation* The failed operation
+ */
+ void HandleErrorL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void HandleRequestCompletionL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void ResolveAsyncConflictL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void CreateTempCopyL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void ActivateOperationL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void CheckOperationQueueL();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void DequeueOperation( MXdmOperation* aOperation );
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ void DequeueAll();
+
+ /**
+ * Append an element to the path identifying the
+ * the current document subset
+ * @return void
+ */
+ void AppendPathPartL( const TDesC& aString );
+
+ /**
+ * Return the current document subset (including descendants)
+ * @return void
+ */
+ CXdmDocumentNode* CurrentExtent() const;
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ HBufC8* EightBitNameLC();
+
+ /**
+ * Handle a successful update operation
+ * @return void
+ * @param The completed update operation
+ */
+ TBool IsGlobalTree( const TDesC8& aAuid );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL( const TDesC8& aDocumentName );
+
+ private: //Data
+
+ enum TXcapDocumentState
+ {
+ EXdmDocIdle = 0,
+ EXdmDocUpdating,
+ EResolvingAsyncConflict,
+ ERetryingFailedOperation
+ };
+
+ TInt iDataLength;
+ TInt iUpdateIndex;
+ TInt iOperationCount;
+ TUint iOptions;
+ TTime iLastAccess;
+ TTime iLastModification;
+ HBufC8* iEightBitName;
+ TXdmDocType iDocumentType;
+ CXcapDocument* iTempCopy;
+ CXcapAppUsage* iAppUsage;
+ CXcapDocumentNode* iDocumentRoot;
+ CXdmDocumentNode* iErrorRoot;
+ TXcapDocumentState iDocumentState;
+ CXcapProtocol& iXcapProtocol;
+ TBuf8<KETagBufferMaxLength> iETagBuffer;
+ RPointerArray<CXdmNamespace> iNamespaces;
+ };
+
+#endif //__XCAPDOCUMENT__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapDocumentNode.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDocumentNode
+*
+*/
+
+
+
+
+#ifndef __XCAPDOCUMENTNODE__
+#define __XCAPDOCUMENTNODE__
+
+#include "XdmNodeFactory.h"
+#include "XdmDocumentNode.h"
+
+class CXdmEngine;
+class CXcapProtocol;
+class CXcapProtocol;
+class CXdmNodeAttribute;
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapDocumentNode ) : public CXdmDocumentNode, public MXdmNodeFactory
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapDocumentNode();
+
+ public: // New functions
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXcapProtocol& aXcapProtocol );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TBool Leaf node indicator
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine, TBool aLeafNode,
+ const TDesC& aNodeName, CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TBool Leaf node indicator
+ * @param TDesC8& Name of the new element
+ * @param CXdmDocumentNode* The parent of the new node
+ * @return CXdmDocumentNode*
+ */
+ static CXcapDocumentNode* NewL( CXdmEngine& aXdmEngine,
+ const TBool aLeafNode,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Set the next node in the list
+ * @param The next node in the list
+ * @return void
+ */
+ void RemoveNode( CXcapDocumentNode* aChileNode );
+
+ private:
+
+ /**
+ * C++ constructor, private version.
+ */
+ CXcapDocumentNode( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol );
+
+ /**
+ * C++ constructor, protected version.
+ *
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ CXcapDocumentNode( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * C++ constructor, another private version.
+ */
+ CXcapDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * By default Symbian OS constructor is private.
+ *
+ * @param TDesC8& Name of this node
+ * @return void
+ */
+ void CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode );
+
+ private: //From MXdmNodeFactory
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL();
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL( const TDesC& aChildName );
+
+ /**
+ * Create a new child element
+ *
+ * @param TDesC8& Name of the new element
+ * @return CXdmDocumentNode*
+ */
+ CXdmDocumentNode* ChileNodeL( const CXdmDocumentNode* aAnotherNode );
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ CXdmNodeAttribute* AttributeL();
+
+ /**
+ * Create a new attribute
+ *
+ * @param TDesC8& Name of the new attribute
+ * @return CXdmNodeAttribute*
+ */
+ CXdmNodeAttribute* AttributeL( const TDesC& aAttributeName );
+
+ private: //From MXdmNodeInterface
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC& Namespace prefix string
+ * @return void
+ */
+ void SetPrefixL( const TDesC8& aNamespace );
+
+ /**
+ * Returns the namespace string for this element
+ *
+ * @return TPtrC Namespace string of this element
+ */
+ TPtrC8 Prefix() const;
+
+ private:
+
+ HBufC8* iPrefix;
+ CXcapProtocol& iXcapProtocol;
+ };
+
+#endif //__XCAPDOCUMENTNODE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapEngineDefines.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XcapEngine literals
+*
+*/
+
+
+
+
+#ifndef __XCAPENGINEDEFINES__
+#define __XCAPENGINEDEFINES__
+
+#include <e32base.h>
+
+//Xdm specific defines
+const TInt KXcapPathSeparatorChar = 47;
+
+//XCAP specific defines
+_LIT8( KXCAPEquality, "=" );
+_LIT8( KXCAPNodeSeparator, "~~" );
+_LIT8( KXCAPPathSeparator, "/" );
+_LIT8( KXCAPAttributeIdentifier, "@" );
+_LIT8( KHTTPBracketOpen, "[");
+_LIT8( KHTTPBracketClose, "]");
+_LIT8( KHTTPQuotationMark, "\"");
+
+//Escape coded HTTP specific defines
+_LIT8( KHTTPBracketOpenEsc, "%5b");
+_LIT8( KHTTPBracketCloseEsc, "%5d");
+_LIT8( KHTTPQuotationMarkEsc, "%22");
+
+//XML specific defines
+_LIT8( KXmlSpace, " ");
+#endif //__XCAPENGINEDEFINES__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapNodeAttribute.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapNodeAttribute
+*
+*/
+
+
+
+
+#ifndef __XCAPNODEATTRIBUTE__
+#define __XCAPNODEATTRIBUTE__
+
+#include "XdmNodeAttribute.h"
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( CXcapNodeAttribute ) : public CXdmNodeAttribute
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param TDesC8& Name of this attribute
+ * @param CXdmDocumentNode* Parent of this attribute
+ *
+ * NOTE! "Parent", in this case, denotes the
+ * element this attribute attributes.
+ *
+ * @return CXdmNodeAttribute*
+ */
+ static CXcapNodeAttribute* NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aAttributeName,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param CXdmDocumentNode* Parent of this attribute
+ *
+ * NOTE! "Parent", in this case, denotes the
+ * element this attribute attributes.
+ *
+ * @return CXdmNodeAttribute*
+ */
+ static CXcapNodeAttribute* NewL( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapNodeAttribute();
+
+ public: // New functions
+
+
+
+ private:
+
+ /**
+ * C++ constructor, private version.
+ */
+ CXcapNodeAttribute( CXdmEngine& aXdmEngine );
+
+ /**
+ * C++ constructor, protected version.
+ *
+ * @param CXdmDocumentNode* The parent node of this element
+ */
+ CXcapNodeAttribute( CXdmEngine& aXdmEngine, CXdmDocumentNode* aParentNode );
+
+ /**
+ * By default Symbian OS constructor is private.
+ *
+ * @param TDesC8& Name of this node
+ * @return void
+ */
+ void ConstructL( const TDesC& aNodeName );
+
+ /**
+ * C++ constructor, another private version.
+ */
+ CXcapNodeAttribute( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode );
+
+ private: //From MXdmNodeInterface
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TPtrC8 Prefix() const;
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void SetPrefixL( const TDesC& aNamespacePrefix );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void SetPrefixL( const TDesC8& aNamespacePrefix );
+
+
+ private:
+ };
+
+#endif //__XCAPNODEATTRIBUTE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapProtocol.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,337 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapProtocol
+*
+*/
+
+
+
+
+#ifndef __XCAPPROTOCOL__
+#define __XCAPPROTOCOL__
+
+#include <e32base.h>
+#include <XdmEngine.h>
+#include <msgbearerobscallback.h>
+#include "XcapCache.h"
+#include "XdmProtocol.h"
+#include "XdmShutdownSwitch.h"
+#include "XcapUtilsInterface.h"
+
+enum TXcapAuthType
+ {
+ EXcapAuthGaa = 0,
+ EXcapAuthEarlyIms,
+ EXcapAuthHttpDigest
+ };
+
+//CONSTANTS
+_LIT( KHttp, "http://" );
+_LIT( KHttps, "https://" );
+_LIT( KHostSeparator, "/" );
+_LIT( KXcapEngLogDir, "XDM" );
+_LIT( KXcapEngLogFile, "XcapProtocol" );
+const TInt KXcapEngLogBufferMaxSize = 2000;
+
+//FORWARD DECLARATIONS
+class CXdmLogWriter;
+class CXcapDocument;
+class CXdmXmlParser;
+class CXcapEarlyIms;
+class MMsgConnManager;
+class CXdmShutdownTimer;
+class CXcapHttpTransport;
+class CXdmOperationFactory;
+class CXdmSettingsCollection;
+
+//CLASS DECLARATION
+class CXcapProtocol : public CXdmProtocol,
+ public MXcapEarlyImsObs,
+ public MXdmShutdownSwitch,
+ public MMsgBearerObsCallback
+ {
+
+ public:
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ IMPORT_C TPtrC8 PublicID();
+
+ /**
+ * Return a pointer to the cache client interface
+ * @return RXcapCache* Pointer to the cache interface
+ */
+ IMPORT_C RXcapCache* Cache();
+
+ /**
+ * Return a reference to the XML Parser
+ * @return CXdmXmlParser& Reference to XML Parser
+ */
+ IMPORT_C CXdmXmlParser& Parser();
+
+ /**
+ * Return a reference to the XML Parser
+ * @return CXdmXmlParser& Reference to XML Parser
+ */
+ IMPORT_C CXcapHttpTransport& Transport();
+
+ /**
+ * Check whether network is available
+ * @return TBool Is network available
+ */
+ IMPORT_C TBool IsNetworkAvailable();
+
+ public: //Not exported
+
+ /**
+ * Check whether there are requests being carried out
+ * and start the idle timer if appropriate
+ *
+ * @return void
+ */
+ void CheckActivity();
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ TPtrC8 UserName() const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ TXcapAuthType AuthType() const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ TBool IsSimRequestPending( TInt& aError ) const;
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ void AppendNotifyeeL( CXcapDocument* aPendingDoc );
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ void CancelImsResolver();
+
+ /**
+ * Logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ private: //From CXdmProtocol
+
+ /**
+ * Initialise the media used to transfer Xdm data
+ */
+ void InitTransferMedium( TInt aIdleTimeout, TRequestStatus& aStatus );
+
+ /**
+ * Cancel initialisation of the transfer media.
+ */
+ void CancelTransferMediumInit();
+
+ /**
+ * Cancel initialisation of the transfer media.
+ */
+ TBool IsTransferAvailable() const;
+
+ /**
+ * Create a new document node.
+ */
+ CXdmDocumentNode* CreateDocumentNodeL();
+
+ /**
+ * Create a new protocol dependent document model
+ */
+ CXdmDocument* CreateDocumentL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType );
+
+ /**
+ * Create a new protocol dependent document model
+ */
+ CXdmDirectory* CreateDirectoryL( const TDesC& aDirectoryPath );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXcapProtocol();
+
+ private:
+
+ /**
+ * From MXdmShutdownSwitch
+ * @return void
+ */
+ void SwitchOff();
+
+ /**
+ * From MXcapEarlyImsObs.
+ * @param TInt Error
+ * @return void
+ */
+ void RequestComplete( TInt aError );
+
+ public: //Static
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ static CXcapProtocol* NewL( const TXdmProtocolParams& aProtocolInfo );
+
+ /**
+ * A Global logging function
+ * @param TRefByValue<const TDesC8> aFmt,...
+ * @return void
+ */
+ static TInt GenerateUniqueIdL();
+
+ private: //Methods
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ CXcapProtocol();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void ConstructL( const TXdmProtocolParams& aProtocolParams );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ void DeleteLogFileL();
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ TInt SaveSettingsL();
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ void SaveFromCollectionL( const CXdmSettingsCollection& aSettings );
+
+ /**
+ * Return an operation object that knows how to manipulate
+ * partial document
+ */
+ void ResolveIdentityL();
+
+ /**
+ * Select the type of the authentication
+ */
+ void SelectAuthTypeL( const CXdmSettingsCollection& aSettings );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ RXcapCache* CacheHandle();
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ TPtrC8 Impu() const;
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ HBufC* ParseRootLocationLC( const TBool aSecurity,
+ const TDesC& aRootLocation );
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ HBufC* CheckProtocolPrefixL( const TDesC& aRootLocation );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ HBufC* ConstructSecureUriL( const TDesC& aBasicUri );
+
+ /**
+ * Symbian OS default constructor.
+ * @param TInt Default Access Point ID
+ * @return CXdmDocOperation*
+ */
+ HBufC* ConstructStandardUriL( const TDesC& aBasicUri );
+
+ /**
+ * Handle a bearer event
+ * @param TMsgBearerEvent The type of the event
+ */
+ void HandleBearerEventL( TBool aAuthoritativeClose,
+ TMsgBearerEvent aBearerEvent );
+
+ private: //Data
+
+ TInt iIdleTimeout;
+ TInt iAccessPoint;
+ TInt iImsResolverError;
+ TBool iSuspend;
+ TBool iCacheUsage;
+ TBool iTransferMediaOpen;
+ TBool iSimRequestPending;
+ HBufC* iRootUri;
+ HBufC8* iPublicId;
+ RXcapCache iCacheClient;
+ CXdmEngine* iXdmEngine;
+ CXdmDocument* iCapabilities;
+ CXdmLogWriter* iLogWriter;
+ TXcapAuthType iAuthType;
+ CXdmXmlParser* iXmlParser;
+ CXcapEarlyIms* iImsResolver;
+ TXdmCredentials iCredentials;
+ MMsgConnManager* iConnectionManager;
+ CXdmShutdownTimer* iIdleTimer;
+ CXcapHttpTransport* iHttpTransport;
+ const CXdmProtocolInfo* iProtocolInfo;
+ TBuf8<KXdmMaxUserNameLength> iUserName;
+ RPointerArray<CXcapDocument> iNotifyeeQueue;
+ };
+
+#endif //__XCAPPROTOCOL__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/inc/XcapUriInterface.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MXcapUriInterface
+*
+*/
+
+
+
+
+#ifndef __XCAPURIINTERFACE__
+#define __XCAPURIINTERFACE__
+
+#include <e32base.h>
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS( MXcapUriInterface )
+ {
+ public:
+
+ /**
+ * Add new namespace mapping
+ * @param TDesC8& Namespace URI
+ * @param TDesC8& Namespace prefix
+ * @return void
+ */
+ virtual void AddNamespaceMappingL( const TDesC8& aUri, const TDesC8& aPrefix ) = 0;
+ };
+
+
+
+#endif //__XCAPURIINTERFACE__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/1020740F.rss Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmProtocolInfo
+*
+*/
+
+
+// 1020740F.RSS
+//
+#include "registryinfo.rh"
+
+//Declares the interface implementations provided
+RESOURCE REGISTRY_INFO XdmProtocolInfo
+ {
+ dll_uid = 0x1020740F;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x10207422;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x10207423;
+ version_no = 1;
+ display_name = "XDM Engine XCAP Protocol||Copyright © 2005 Nokia Ltd. All rights reserved.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapDirectory.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,501 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDirectory
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <utf.h>
+#include <f32file.h>
+#include "XcapAppUsageDef.h"
+#include "XdmProtocol.h"
+#include "XcapDocument.h"
+#include "XcapProtocol.h"
+#include "XcapAppUsage.h"
+#include "XcapRetrieval.h"
+#include "XcapDirectory.h"
+#include "XdmXmlParser.h"
+#include "XcapHttpReqGet.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+#include "XcapHttpTransport.h"
+#include "XdmOperationFactory.h"
+
+// ----------------------------------------------------------
+// CXcapDirectory::CXcapDirectory
+//
+// ----------------------------------------------------------
+//
+CXcapDirectory::CXcapDirectory( CXdmDocument*& aDirectoryDoc,
+ CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol ) :
+ CXdmDirectory( aXdmEngine ),
+ iDirectoryDoc( ( CXcapDocument* )aDirectoryDoc ),
+ iXcapProtocol( aXcapProtocol )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapDirectory::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDirectory* CXcapDirectory::NewL( const TDesC& aAUID,
+ CXdmEngine& aXdmEngine,
+ CXdmDocument*& aDirectoryDoc,
+ CXcapProtocol& aXcapProtocol )
+ {
+ CXcapDirectory* self = new ( ELeave ) CXcapDirectory( aDirectoryDoc, aXdmEngine, aXcapProtocol );
+ CleanupStack::PushL( self );
+ self->ConstructL( aAUID );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::~CXcapDirectory
+//
+// ----------------------------------------------------
+//
+CXcapDirectory::~CXcapDirectory()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::~CXcapDirectory()" ) );
+ #endif
+ Cancel();
+ delete iAUID;
+ delete iDirectoryDoc;
+ delete iHttpRetrieval;
+ iUpdateList.Close();
+ iDocumentList.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapDirectory::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapDirectory::ConstructL( const TDesC& aAUID )
+ {
+ if( aAUID.Length() > 0 )
+ {
+ _LIT( KNodePath, "xcap-directory/folder" );
+ iAUID = HBufC::NewL( aAUID.Length() );
+ iAUID->Des().Copy( aAUID );
+ CXdmDocumentNode* node = iDirectoryDoc->DocumentSubsetL( KNodePath );
+ CleanupStack::PushL( node );
+ CXdmNodeAttribute* auid = node->CreateAttributeL( KAuidAttribute );
+ CleanupStack::PushL( auid );
+ auid->SetAttributeValueL( aAUID );
+ iDirectoryDoc->FetchDataL( node );
+ //Set the option that prohibits caching
+ iDirectoryDoc->SetOption( KXdmOption3 );
+ CleanupStack::Pop( 2 ); //auid, node
+ }
+ else iDirectoryDoc->FetchDataL();
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------------
+// CXcapDirectory::StartUpdateL
+//
+// ----------------------------------------------------------
+//
+void CXcapDirectory::StartUpdateL()
+
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::StartUpdateL()" ) );
+ #endif
+ switch( iUpdatePhase )
+ {
+ case EDirPhaseIdle:
+ User::RequestComplete( iClientStatus, KErrArgument );
+ break;
+ case EUpdateDocumentList:
+ HandleDocumentListRequestL();
+ break;
+ case ERefreshDocuments:
+ HandleRefreshRequestL();
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------------
+// CXcapDirectory::SaveRequestData
+//
+// ----------------------------------------------------------
+//
+void CXcapDirectory::SaveRequestData( TDirUpdatePhase aUpdatePhase,
+ TRequestStatus& aClientStatus )
+ {
+ iUpdatePhase = aUpdatePhase;
+ iClientStatus = &aClientStatus;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::HandleDocumentListRequestL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectory::HandleDocumentListRequestL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::HandleDocumentListRequestL()" ) );
+ #endif
+ if( !IsActive() )
+ {
+ CXcapDocument* doc = ( CXcapDocument* )iDirectoryDoc;
+ doc->StartInternalL( iStatus );
+ iUpdatePhase = EUpdateDocumentList;
+ SetActive();
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::HandleRefreshRequestL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectory::HandleRefreshRequestL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::HandleRefreshRequestL()" ) );
+ #endif
+ if( iUpdatePhase == EUpdateDocumentList )
+ {
+ if( iUpdateList.Count() > 0 )
+ {
+ iUpdateIndex = -1;
+ iHttpRetrieval = iXcapProtocol.Transport().GetL( TPtrC() );
+ UpdateNextDocumentL();
+ iUpdatePhase = ERefreshDocuments;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " All documents are up to date" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNone );
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Wrong state [%d]" ), iUpdatePhase );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNotReady );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::UpdateNextDocumentL
+//
+// ----------------------------------------------------
+//
+void CXcapDirectory::UpdateNextDocumentL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::UpdateNextDocumentL()" ) );
+ #endif
+ iUpdateIndex++;
+ if( iUpdateIndex < iUpdateList.Count() )
+ {
+ CXdmDocumentNode* node = iUpdateList[iUpdateIndex];
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Index: %d Document: %x" ), iUpdateIndex, node );
+ #endif
+ TPtrC8 root = iXcapProtocol.Transport().RootUri();
+ TPtrC docUri( ExtractDocumentUriL( root, node ) );
+ HBufC* uri = HBufC::NewLC( root.Length() + docUri.Length() );
+ uri->Des().Copy( root );
+ uri->Des().Append( docUri );
+ iHttpRetrieval->ResetUriL( uri->Des() );
+ iHttpRetrieval->SetExpiryTimeL( NULL, KDefaultHttpRequestTimeout * 1000000 );
+ iHttpRetrieval->DispatchRequestL( iStatus );
+ CleanupStack::PopAndDestroy(); //uri
+ SetActive();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Directory sync complete" ) );
+ #endif
+ User::RequestComplete( iClientStatus, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDirectory::RunL()
+//
+// ---------------------------------------------------------
+//
+void CXcapDirectory::RunL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::RunL() - Request: %d" ), iStatus.Int() );
+ #endif
+ if( iStatus == KErrNone )
+ {
+ switch( iUpdatePhase )
+ {
+ case EUpdateDocumentList:
+ {
+ iDocumentCount = iDirectoryDoc->Find( KDirectoryEntry, iDocumentList );
+ if( iDocumentCount > 0 )
+ {
+ TInt index = 0;
+ while( index < iDocumentCount )
+ {
+ TBool uptodate = CheckLocalCopyL( iDocumentList[index] );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Cache: %d" ), uptodate );
+ #endif
+ if( !uptodate )
+ User::LeaveIfError( iUpdateList.Append( iDocumentList[index] ) );
+ index++;
+ }
+ }
+ User::RequestComplete( iClientStatus, iStatus.Int() );
+ }
+ break;
+ case ERefreshDocuments:
+ {
+ CXdmDocumentNode* node = iUpdateList[iUpdateIndex];
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Index: %d" ), iUpdateIndex );
+ iXcapProtocol.WriteToLog( _L8( " Document: %x" ), node );
+ iXcapProtocol.WriteToLog( _L8( " Error: %d" ), iStatus.Int() );
+ #endif
+ TPtrC8 root = iXcapProtocol.Transport().RootUri();
+ TPtrC docName = ExtractDocumentUriL( root, node );
+ TXdmCompletionData* data = iHttpRetrieval->ResponseData();
+ TPtrC8 responseData( data->iResponseData->Des() );
+ TPtrC8 eTag( data->iETag->Des() );
+ RXcapCache* cache = iXcapProtocol.Cache();
+ cache->Store( eTag, docName, root, responseData );
+ iHttpRetrieval->ReleaseResponseData();
+ UpdateNextDocumentL();
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Default case, unknown state %d - Status: %d" ),
+ iUpdatePhase, iStatus.Int() );
+ #endif
+ if( iClientStatus != NULL )
+ User::RequestComplete( iClientStatus, KErrUnknown );
+ break;
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Operation failed with %d" ), iStatus.Int() );
+ #endif
+ User::RequestComplete( iClientStatus, iStatus.Int() );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDirectory::CheckLocalCopyL
+//
+// ---------------------------------------------------------
+//
+TBool CXcapDirectory::CheckLocalCopyL( const CXdmDocumentNode* aDocumentNode )
+ {
+ /*#ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::CheckLocalCopyL()" ) );
+ #endif*/
+ TBool ret = EFalse;
+ TPtrC8 root = iXcapProtocol.Transport().RootUri();
+ TPtrC docName = ExtractDocumentUriL( root, aDocumentNode );
+ TPtrC etag( aDocumentNode->Attribute( KDocumentETag )->AttributeValue() );
+ HBufC8* etag8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( etag );
+ CleanupStack::PushL( etag8 );
+ RXcapCache* cache = iXcapProtocol.Cache();
+ ret = cache != NULL ? cache->IsCurrent( etag8->Des(), docName, root ) == KErrNone : ETrue;
+ CleanupStack::PopAndDestroy(); //etag8
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXcapDirectory::ExtractDocumentUriL
+//
+// ---------------------------------------------------------
+//
+TPtrC CXcapDirectory::ExtractDocumentUriL( const TDesC8& aRootUri,
+ const CXdmDocumentNode* aDocumentNode )
+ {
+ /*#ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::ExtractDocumentUri()" ) );
+ #endif*/
+ const TUint8 KHttpHostSeparator = 47;
+ _LIT8( KHttpDoubleHostSeparator, "//" );
+ TPtrC uri( aDocumentNode->Attribute( KDocumentUri )->AttributeValue() );
+ if( uri[0] == KHttpHostSeparator ) //Relative URI
+ return uri;
+ else
+ {
+ TInt index = aRootUri.Find( KHttpDoubleHostSeparator );
+ TPtrC8 root( aRootUri.Right( aRootUri.Length() - index - 2 ) );
+ HBufC8* uri8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( uri );
+ CleanupStack::PushL( uri8 );
+ TPtr8 desc( uri8->Des() );
+ index = desc.Find( root );
+ CleanupStack::PopAndDestroy(); //uri8
+ return index >= 0 ? uri.Right( uri.Length() - root.Length() - index ) : TPtrC();
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::DocumentCount
+//
+// ----------------------------------------------------
+//
+TInt CXcapDirectory::DocumentCount()
+ {
+ return iDocumentCount;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::DocumentType
+//
+// ----------------------------------------------------
+//
+TXdmDocType CXcapDirectory::DocumentTypeL( TInt aIndex ) const
+ {
+ TXdmDocType type = EXdmDocGeneral;
+ if( iUpdatePhase <= EDirPhaseIdle )
+ User::Leave( KErrNotReady );
+ else if( iDocumentCount > 0 && ( aIndex >= 0 && aIndex < iDocumentCount ) )
+ type = FindAUID( *iDocumentList[aIndex] );
+ return type;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::FindAUID
+//
+// ----------------------------------------------------
+//
+TXdmDocType CXcapDirectory::FindAUID( const CXdmDocumentNode& aEntryNode ) const
+ {
+ TXdmDocType documentType = EXdmDocGeneral;
+ HBufC8* buf = aEntryNode.Attribute( KDocumentUri )->EightBitValueLC();
+ if( buf )
+ {
+ TPtrC8 uri( buf->Des() );
+ if( uri.Find( KXdmCapabilityUsageAUID ) >= 0 )
+ documentType = EXdmCapabilities;
+ else if( uri.Find( KXdmPocUserAccessUsageAUID ) >= 0 )
+ documentType = EXdmPoCUserAccessPolicy;
+ else if( uri.Find( KXdmPocGroupUsageAUID ) >= 0 )
+ documentType = EXdmPoCGroup;
+ else if( uri.Find( KXdmResourceListsUsageAUID ) >= 0 )
+ documentType = EXdmResourceLists;
+ else if( uri.Find( KXdmOmaPresRulesUsageAUID ) >= 0 )
+ documentType = EXdmIetfPresenceRules;
+ else if( uri.Find( KXdmDirectoryUsageAUID ) >= 0 )
+ documentType = EXdmDirectory;
+ else if( uri.Find( KXdmSharedXDMUsageAUID ) >= 0 )
+ documentType = EXdmSharedXdm;
+ else if( uri.Find( KXdmRlsServicesUsageAUID ) >= 0 )
+ documentType = EXdmRlsServices;
+ CleanupStack::PopAndDestroy(); //EightBitValueLC()
+ }
+ return documentType;
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::Document
+//
+// ----------------------------------------------------
+//
+TPtrC CXcapDirectory::Document( TInt aIndex ) const
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::Document() - Index: %d" ), aIndex );
+ #endif
+ TChar slash = 47;
+ if( aIndex >= 0 && aIndex < iDocumentList.Count() )
+ {
+ TPtrC ret;
+ TPtrC uri = iDocumentList[aIndex]->Attribute( KDocumentUri )->AttributeValue();
+ TInt index = uri.LocateReverse( slash );
+ index > 0 ? ret.Set( uri.Right( uri.Length() - index - 1 ) ) : ret.Set( uri );
+ return ret;
+ }
+ else return TPtrC();
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::DirectoryPath
+//
+// ----------------------------------------------------
+//
+TPtrC CXcapDirectory::DirectoryPath() const
+ {
+ return iAUID != NULL ? iAUID->Des() : TPtrC();
+ }
+
+// ----------------------------------------------------
+// CXcapDirectory::CancelUpdate
+//
+// ----------------------------------------------------
+//
+void CXcapDirectory::CancelUpdate()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::CancelUpdate()" ) );
+ #endif
+ Cancel();
+ }
+
+// ---------------------------------------------------------
+// CXcapDirectory::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CXcapDirectory::DoCancel()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDirectory::DoCancel()" ) );
+ #endif
+ switch( iUpdatePhase )
+ {
+ case EDirPhaseIdle:
+ break;
+ case EUpdateDocumentList:
+ {
+ CXcapDocument* doc = ( CXcapDocument* )iDirectoryDoc;
+ doc->CancelUpdate();
+ }
+ break;
+ case ERefreshDocuments:
+ iHttpRetrieval->CancelRequest();
+ break;
+ default:
+ break;
+ }
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapDocument.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,1097 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDocument
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <XdmErrors.h>
+#include "XdmOperationFactory.h"
+#include "XcapProtocol.h"
+#include "XcapDocument.h"
+#include "XcapAppUsage.h"
+#include "XdmXmlParser.h"
+#include "XdmNamespace.h"
+#include "CommonDefines.h"
+#include "XcapDocumentNode.h"
+#include "XcapHttpRequest.h"
+#include "XcapHttpOperation.h"
+#include "XcapHttpTransport.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+
+// ----------------------------------------------------------
+// CXcapDocument::CXcapDocument
+//
+// ----------------------------------------------------------
+//
+CXcapDocument::CXcapDocument( TXdmDocType aDocumentType,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol ) :
+ CXdmDocument( CONST_CAST( CXdmEngine&, aXdmEngine ) ),
+ iDocumentType( aDocumentType ),
+ iXcapProtocol( CONST_CAST( CXcapProtocol&, aXcapProtocol ) )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocument* CXcapDocument::NewL( TXdmDocType aDocumentType,
+ const TDesC& aDocumentName,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol )
+ {
+ CXcapDocument* self = new ( ELeave ) CXcapDocument( aDocumentType, aXdmEngine, aXcapProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( KXcapOperationFactory, aDocumentName );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocument* CXcapDocument::NewL( TXdmDocType aDocumentType,
+ const TDesC8& aDocumentName,
+ const CXdmEngine& aXdmEngine,
+ const CXcapProtocol& aXcapProtocol )
+ {
+ CXcapDocument* self = new ( ELeave ) CXcapDocument( aDocumentType, aXdmEngine, aXcapProtocol );
+ CleanupStack::PushL( self );
+ self->ConstructL( aDocumentName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapDocument::ConstructL( const TDesC8& aDocumentName )
+ {
+ BaseConstructL( KXcapOperationFactory, aDocumentName );
+ ConstructL();
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapDocument::ConstructL()
+ {
+ InstallAppUsageL();
+ iErrorRoot = CXcapDocumentNode::NewL( iXdmEngine, iXcapProtocol );
+ TPtrC8 root( iXcapProtocol.Transport().RootUri() );
+ #ifdef _DEBUG
+ HBufC8* buf = HBufC8::NewLC( iDocumentName->Des().Length() );
+ buf->Des().Copy( iDocumentName->Des() );
+ TPtr8 nameDesc( buf->Des() );
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::ConstructL()" ) );
+ iXcapProtocol.WriteToLog( _L8( " Root URI: %S" ), &root );
+ iXcapProtocol.WriteToLog( _L8( " Document: %S" ), &nameDesc );
+ CleanupStack::PopAndDestroy(); //buf
+ #endif
+ RXcapCache* cache = iXcapProtocol.Cache();
+ if( cache )
+ UpdateDocumentInfoL( cache );
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Cache disabled, no info for the document" ) );
+ #endif
+ }
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::~CXcapDocument
+//
+// ----------------------------------------------------
+//
+CXcapDocument::~CXcapDocument()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::~CXcapDocument()" ) );
+ #endif
+ Cancel();
+ delete iTempCopy;
+ delete iEightBitName;
+ delete iDocumentRoot;
+ delete iErrorRoot;
+ delete iAppUsage;
+ iNamespaces.ResetAndDestroy();
+ iNamespaces.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::ResetContents
+//
+// ----------------------------------------------------------
+//
+void CXcapDocument::ResetContents()
+ {
+ iOptions = 0;
+ delete iDocumentRoot;
+ iDocumentRoot = NULL;
+ delete iErrorRoot;
+ iErrorRoot = NULL;
+ delete iTempCopy;
+ iTempCopy = NULL;
+ iNamespaces.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------
+// CXcapDocument::UpdateDocumentInfoL
+//
+// ----------------------------------------------------------
+//
+void CXcapDocument::UpdateDocumentInfoL( RXcapCache* aCacheClient )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::UpdateDocumentInfo()" ) );
+ #endif
+ iETagBuffer.Zero();
+ TCacheEntryInfo cacheEntryInfo;
+ TPtrC8 root( iXcapProtocol.Transport().RootUri() );
+ TInt error = aCacheClient->FetchDocumentInfo(
+ iETagBuffer, iDocumentName->Des(), root, cacheEntryInfo );
+ if( error == KErrNone )
+ {
+ iLastAccess = cacheEntryInfo.iLastAccess;
+ iLastModification = cacheEntryInfo.iLastUpdate;
+ iDataLength = cacheEntryInfo.iDataLength;
+ #ifdef _DEBUG
+ const TInt KDateTimeMaxSize = 100;
+ TBuf8<KDateTimeMaxSize> printBuffer;
+ TBuf<KDateTimeMaxSize> dateTimeBuffer;
+ _LIT( KDateTimeFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S");
+ iLastModification.FormatL( dateTimeBuffer, KDateTimeFormat );
+ printBuffer.Copy( dateTimeBuffer );
+ iXcapProtocol.WriteToLog( _L8( " ETag: %S" ), &iETagBuffer );
+ iXcapProtocol.WriteToLog( _L8( " Size: %d bytes" ), iDataLength );
+ iXcapProtocol.WriteToLog( _L8( " Time stamp: %S" ), &printBuffer );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Cache read complete - Error: %d" ), error );
+ #endif
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::InstallAppUsageL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::InstallAppUsageL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::InstallAppUsageL()" ) );
+ #endif
+ HBufC8* docName = NULL;
+ iAppUsage = CXcapAppUsage::NewL( iXdmEngine, iDocumentType );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::InstallAppUsageL() type = %d" ), iDocumentType );
+ #endif
+ TPtrC8 auid = iAppUsage->AUID();
+ if( IsGlobalTree( auid ) )
+ {
+ docName = HBufC8::NewLC( auid.Length() + KGlobalDirName().Length() +
+ KXcapGlobalDocName().Length() );
+ docName->Des().Copy( auid );
+ docName->Des().Append( KGlobalDirName );
+ docName->Des().Append( KXcapGlobalDocName );
+ delete iDocumentName;
+ iDocumentName = NULL;
+ iDocumentName = HBufC::NewL( docName->Des().Length() );
+ iDocumentName->Des().Copy( docName->Des() );
+ CleanupStack::PopAndDestroy(); //docName
+ }
+ else
+ {
+ TPtrC8 user = iXcapProtocol.UserName();
+ docName = HBufC8::NewLC( auid.Length() + user.Length() +
+ KUserDirName().Length() + 1 /*'/'*/ +
+ iDocumentName->Des().Length() );
+ docName->Des().Copy( auid );
+ docName->Des().Append( KUserDirName );
+ docName->Des().Append( user );
+ docName->Des().Append( KSlash );
+ docName->Des().Append( iDocumentName->Des() );
+ delete iDocumentName;
+ iDocumentName = NULL;
+ iDocumentName = HBufC::NewL( docName->Des().Length() );
+ iDocumentName->Des().Copy( docName->Des() );
+ CleanupStack::PopAndDestroy(); //docName
+ }
+
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::IsGlobalTree
+//
+// ----------------------------------------------------
+//
+TBool CXcapDocument::IsGlobalTree( const TDesC8& aAuid )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::IsGlobalTree()" ) );
+ #endif
+ TBool found = EFalse;
+ //Update this array when necessary
+ const TPtrC8 KGlobalTreeAuids[] = { TPtrC8( KXdmCapabilityUsageAUID ) };
+ const TInt count = sizeof( KGlobalTreeAuids ) / sizeof( KGlobalTreeAuids[0] );
+ for( TInt i = 0;!found && i < count;i++ )
+ found = aAuid.Compare( KGlobalTreeAuids[i] ) == 0;
+ return found;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::CreateTempCopyL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::CreateTempCopyL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::CreateTempCopyL()" ) );
+ #endif
+ CXdmDocument* copy = iXdmEngine.CreateDocumentModelL( Name(), iDocumentType );
+ iTempCopy = ( CXcapDocument* )copy;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::TempCopyL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapDocument* CXcapDocument::TempCopyL()
+ {
+ return CXcapDocument::NewL( iDocumentType, Name(), iXdmEngine, iXcapProtocol );
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::CreateRootL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocument::CreateRootL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXdmDocument::CreateRootL()" ) );
+ #endif
+ delete iDocumentRoot;
+ iDocumentRoot = NULL;
+ iDocumentRoot = CXcapDocumentNode::NewL( iXdmEngine, iXcapProtocol );
+ return iDocumentRoot;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::AppendPathPartL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::AppendPathPartL( const TDesC& aString )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::PathPartL()" ) );
+ #endif
+ if( iDocumentRoot != NULL )
+ {
+ CXdmDocumentNode* node = NULL;
+ CXdmDocumentNode* parent = iDocumentRoot;
+ while( parent->NextNode() != NULL )
+ parent = parent->NextNode();
+ node = CXcapDocumentNode::NewL( iXdmEngine, aString, iXcapProtocol, parent );
+ parent->SetNextNode( node );
+ }
+ else iDocumentRoot = CXcapDocumentNode::NewL( iXdmEngine, aString, iXcapProtocol );
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::CurrentExtent
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocument::CurrentExtent() const
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXdmDocument::CurrentExtent()" ) );
+ #endif
+ CXdmDocumentNode* ret = NULL;
+ if( iDocumentRoot != NULL )
+ {
+ CXdmDocumentNode* node = iDocumentRoot;
+ while( node->NextNode() != NULL )
+ node = node->NextNode();
+ ret = node;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " This document does not yet have a root, leave with KErrGeneral" ) );
+ #endif
+ User::Leave( KErrGeneral );
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::DocumentRoot
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocument::DocumentRoot() const
+ {
+ return iDocumentRoot;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::ErrorRoot
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocument::ErrorRoot()
+ {
+ if( !iErrorRoot )
+ {
+ iErrorRoot = CXcapDocumentNode::NewL( iXdmEngine, iXcapProtocol );
+ }
+ return iErrorRoot;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::ResetSubset
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXcapDocument::ResetSubset()
+ {
+ CXdmDocument::ResetSubset();
+ delete iDocumentRoot;
+ iDocumentRoot = NULL;
+ iOptions = 0;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::ETag
+//
+// ----------------------------------------------------
+//
+EXPORT_C TDesC8& CXcapDocument::ETag()
+ {
+ return iETagBuffer;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::SetETag
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXcapDocument::SetETag( const TDesC8& aETagDesc )
+ {
+ iETagBuffer.Zero();
+ iETagBuffer.Copy( aETagDesc );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::SetETag()" ) );
+ iXcapProtocol.WriteToLog( _L8( " New ETag: %S" ), &iETagBuffer );
+ #endif
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::DataLength
+//
+// ----------------------------------------------------
+//
+EXPORT_C TInt CXcapDocument::DataLength() const
+ {
+ return iDataLength;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::ApplicationUsage
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapAppUsage& CXcapDocument::ApplicationUsage() const
+ {
+ return *iAppUsage;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::Protocol
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapProtocol& CXcapDocument::Protocol() const
+ {
+ return iXcapProtocol;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::RemoveData
+//
+// ----------------------------------------------------
+//
+EXPORT_C void CXcapDocument::RemoveData( CXcapDocumentNode* aDocumentNode )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::RemoveData()" ) );
+ #endif
+ CXcapDocumentNode* parent = ( CXcapDocumentNode* )aDocumentNode->Parent();
+ if( parent != NULL )
+ parent->RemoveNode( aDocumentNode );
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::StartUpdateL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::StartUpdateL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::StartUpdateL()" ) );
+ #endif
+ TInt resolverError = 0;
+ if( iXcapProtocol.IsSimRequestPending( resolverError ) )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " IMS Resolver pending => add to queue" ) );
+ #endif
+ iXcapProtocol.AppendNotifyeeL( this );
+ }
+ else
+ {
+ if( resolverError == KErrNone && !IsActive() && iChangeRequests.Count() > 0 )
+ {
+ iUpdateIndex = 0;
+ iDocumentState = EXdmDocUpdating;
+ iOperationCount = iChangeRequests.Count();
+ ActivateOperationL();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8(
+ " Already active, no operations or IMS resolver failed => complete with error" ) );
+ #endif
+ TInt error = resolverError == KErrNone ? KErrNotReady : resolverError;
+ User::RequestComplete( iClientStatus, error );
+ }
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::StartInternalL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::StartInternalL( TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::StartInternalL()" ) );
+ #endif
+ aStatus = KRequestPending;
+ iClientStatus = &aStatus;
+ StartUpdateL();
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::NotifyResolverCompleteL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::NotifyResolverCompleteL( TInt aError )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::NotifyResolverCompleteL()" ) );
+ #endif
+ if( aError == KErrNone )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " IMS Resolver ready" ) );
+ #endif
+ StartUpdateL();
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " IMS Resolver failed => complete with %d" ), aError );
+ #endif
+ DequeueAll();
+ User::RequestComplete( iClientStatus, aError );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::ActivateOperationL
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::ActivateOperationL()
+ {
+ MXdmOperation* request = iChangeRequests[iUpdateIndex];
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::ActivateOperation() - Operation: %x" ), request );
+ #endif
+ if( iDocSubset )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Document subset => set KXdmOption1 and KXdmOption2" ) );
+ #endif
+ SetOption( KXdmOption1 );
+ SetOption( KXdmOption2 );
+ }
+ if( iXcapProtocol.AuthType() == EXcapAuthEarlyIms )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " EarlyIMS is in use => set KXdmOption4" ) );
+ #endif
+ SetOption( KXdmOption4 );
+ }
+ request->ExecuteL( iStatus, iOptions );
+ SetActive();
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::SetOption
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::SetOption( TInt aOption )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::SetOption()" ) );
+ #endif
+ iOptions |= aOption;
+ }
+
+// ----------------------------------------------------
+// CXcapDocument::CancelUpdate
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::CancelUpdate()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::CancelUpdate()" ) );
+ #endif
+ TInt resolverError = 0;
+ if( iXcapProtocol.IsSimRequestPending( resolverError ) )
+ {
+ iXcapProtocol.CancelImsResolver();
+ }
+ else
+ {
+ switch( iDocumentState )
+ {
+ case EResolvingAsyncConflict:
+ iTempCopy->CancelUpdate();
+ break;
+ default:
+ {
+ TInt count = iChangeRequests.Count();
+ if( count > 0 )
+ {
+ MXdmOperation* request = iChangeRequests[iUpdateIndex];
+ request->CancelOperation();
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Operation %x cancelled" ), request );
+ #endif
+ }
+ }
+ }
+ }
+ User::RequestComplete( iClientStatus, KErrCancel );
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::RunL()
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::RunL()
+ {
+ #ifdef _DEBUG
+ HBufC8* buf = HBufC8::NewLC( iDocumentName->Des().Length() );
+ buf->Des().Copy( iDocumentName->Des() );
+ TPtr8 nameDesc( buf->Des() );
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::RunL()" ) );
+ iXcapProtocol.WriteToLog( _L8( " Name: %S" ), &nameDesc );
+ iXcapProtocol.WriteToLog( _L8( " Error: %d" ), iStatus.Int() );
+ iXcapProtocol.WriteToLog( _L8( " Update index: %d" ), iUpdateIndex );
+ CleanupStack::PopAndDestroy(); //buf
+ #endif
+ if( iStatus == KErrNone )
+ {
+ switch( iDocumentState )
+ {
+ case EXdmDocUpdating:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Document state: EXdmDocUpdating" ) );
+ #endif
+ HandleRequestCompletionL();
+ break;
+ case EResolvingAsyncConflict:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Document state: EResolvingAsyncConflict" ) );
+ #endif
+ ResolveAsyncConflictL();
+ break;
+ case ERetryingFailedOperation:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Document state: ERetryingFailedOperation" ) );
+ #endif
+ ResolveAsyncConflictL();
+ break;
+ default:
+ break;
+ }
+ }
+ else HandleErrorL();
+ #ifdef _DEBUG
+ TInt biggestBlock( 0 );
+ TInt memory( User::Available( biggestBlock ) );
+ iXcapProtocol.WriteToLog( _L8( "** RunL() completes - Available memory: %d" ), memory );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::HandleRequestCompletionL
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::HandleRequestCompletionL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::HandleRequestCompletionL()" ) );
+ #endif
+ MXdmOperation* request = iChangeRequests[iUpdateIndex];
+ const TXdmCompletionData& data = request->CompletionData();
+ switch( data.iCompletion )
+ {
+ case KInsertConflict:
+ ResolveAsyncConflictL();
+ break;
+ default:
+ {
+ RXcapCache* cache = iXcapProtocol.Cache();
+ if( cache )
+ UpdateDocumentInfoL( cache );
+ DequeueOperation( request );
+ CheckOperationQueueL();
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::ResolveAsyncConflictL
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::ResolveAsyncConflictL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::ResolveAsyncConflictL()" ) );
+ #endif
+ switch( iDocumentState )
+ {
+ //This means the cached version of this document
+ //is out-of-date and that it needs to be updated.
+ case EXdmDocUpdating:
+ {
+ CreateTempCopyL();
+ iTempCopy->SetETag( iETagBuffer );
+ iTempCopy->FetchDataL();
+ iTempCopy->SaveClientStatus( iStatus );
+ iTempCopy->StartUpdateL();
+ iDocumentState = EResolvingAsyncConflict;
+ SetActive();
+ }
+ break;
+ case EResolvingAsyncConflict:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Async conflict resolved, retry insert" ) );
+ #endif
+ //CheckOperationQueueL() will increment the index
+ iUpdateIndex--;
+ SetETag( iTempCopy->ETag() );
+ iDocumentState = ERetryingFailedOperation;
+ CheckOperationQueueL();
+ break;
+ case ERetryingFailedOperation:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Operation retry ready" ) );
+ #endif
+ //Nothing can be done now but instruct the
+ //client to re-fetch the whole document and
+ //retry the failed operation.
+ User::RequestComplete( iClientStatus, KErrPathNotFound );
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::HandleErrorL
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::HandleErrorL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::HandleErrorL()" ) );
+ #endif
+ TInt clientCode = KErrGeneral;
+ MXdmOperation* request = request = iChangeRequests[iUpdateIndex];
+ //The TXdmCompletionData is guaranteed to point at something
+ const TXdmCompletionData& data = request->CompletionData();
+ switch( data.iCompletion )
+ {
+ case KErrCancel:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Update cancelled" ) );
+ #endif
+ clientCode = KErrCancel;
+ break;
+ case ERetryingFailedOperation:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Operation retry failed" ) );
+ #endif
+ //Nothing can be done now but instruct the
+ //client to re-fetch the whole document and
+ //retry the failed operation.
+ User::RequestComplete( iClientStatus, KXcapErrorUnrecoverableConflict );
+ break;
+ case KXcapErrorHttpConflict:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Conflict, parse error document if available" ) );
+ #endif
+ if( data.iResponseData != NULL )
+ {
+ TInt error = KErrNone;
+ TPtrC8 errorData( data.iResponseData->Des() );
+ TRAP( error, iXcapProtocol.Parser().ParseDocumentL( errorData, ErrorRoot() ) );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Parsing completed: %d" ), error );
+ ErrorRoot()->Print();
+ #endif
+ //Suppress build warning
+ error = KErrNone;
+ }
+ User::RequestComplete( iClientStatus, KXcapErrorHttpConflict );
+ break;
+ case KXcapErrorNetworkNotAvailabe:
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Network not available, check cache" ) );
+ #endif
+ if( iDataLength > 0 )
+ {
+ RXcapCache* cache = iXcapProtocol.Cache();
+ if( cache != NULL )
+ {
+ TPtrC name( Name() );
+ TInt error = KErrNone;
+ TPtrC8 root = iXcapProtocol.Transport().RootUri();
+ HBufC8* data = HBufC8::NewLC( iDataLength );
+ TPtr8 dataPtr( data->Des() );
+ cache->FetchDocumentContent( dataPtr, name, root );
+ TRAP( error, iXcapProtocol.Parser().ParseDocumentL( this, dataPtr ) );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Parsing completed: %d" ), error );
+ #endif
+ //Suppress build warning
+ error = KErrNone;
+ CleanupStack::PopAndDestroy(); //data
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " No data in cache, nothing to do" ) );
+ #endif
+ }
+ User::RequestComplete( iClientStatus, KXcapErrorNetworkNotAvailabe );
+ }
+ break;
+ default:
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Default case - Result: %d" ), data.iCompletion );
+ #endif
+ clientCode = iStatus.Int();
+ User::RequestComplete( iClientStatus, clientCode );
+ }
+ DequeueOperation( request );
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::CheckOperationQueueL
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::CheckOperationQueueL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::CheckOperationQueueL()" ) );
+ #endif
+ iUpdateIndex++;
+ if( iUpdateIndex < iOperationCount )
+ ActivateOperationL();
+ else
+ {
+ DequeueAll();
+ iUpdateIndex = 0;
+ iXcapProtocol.CheckActivity();
+ User::RequestComplete( iClientStatus, KErrNone );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::DequeueOperation
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::DequeueOperation( MXdmOperation* aOperation )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::DequeueOperation()" ) );
+ #endif
+ TInt index = iChangeRequests.Find( aOperation );
+ if( index >= 0 )
+ {
+ iChangeRequests.Remove( index );
+ aOperation->Destroy();
+ aOperation = NULL;
+ }
+ iOperationCount = iChangeRequests.Count();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::DequeueAll
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::DequeueAll()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::DequeueAll()" ) );
+ #endif
+ TInt count = iChangeRequests.Count();
+ for( TInt i = 0;i < count;i++ )
+ {
+ MXdmOperation* request = iChangeRequests[i];
+ iChangeRequests.Remove( i );
+ request->Destroy();
+ request = NULL;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::EightBitNameLC
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXcapDocument::EightBitNameLC()
+ {
+ /*#ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::EightBitNameLC()" ) );
+ #endif*/
+ __ASSERT_DEBUG( Name().Length() > 0, User::Panic( _L( "CXcapDocument" ), 1 ) );
+ HBufC8* buf = HBufC8::NewLC( Name().Length() );
+ buf->Des().Copy( Name() );
+ return buf;
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::DocumentType
+//
+// ---------------------------------------------------------
+//
+TXdmDocType CXcapDocument::DocumentType() const
+ {
+ return iDocumentType;
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::AppendNamespaceL
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ CXdmNamespace* ns = CXdmNamespace::NewL( aUri, aPrefix );
+ CleanupStack::PushL( ns );
+ User::LeaveIfError( iNamespaces.Append( ns ) );
+ CleanupStack::Pop(); //ns
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::RemoveNamespace
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::RemoveNamespace( const TDesC8& aUri )
+ {
+ TBool found = EFalse;
+ CXdmNamespace* ns = NULL;
+ TInt count = iNamespaces.Count();
+ for( TInt i = 0;!found && i < count;i++ )
+ {
+ ns = iNamespaces[i];
+ if( ns->Uri().Compare( aUri ) == 0 )
+ {
+ found = ETrue;
+ iNamespaces.Remove( i );
+ delete ns;
+ ns = NULL;
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::Uri
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapDocument::Uri( const TDesC8& aPrefix ) const
+ {
+ TPtrC8 uri( _L8( "" ) );
+ TBool found = EFalse;
+ TInt count = iNamespaces.Count();
+ for( TInt i = 0;!found && i < count ;i++ )
+ {
+ if( iNamespaces[i]->Prefix().Compare( aPrefix ) == 0 )
+ {
+ uri.Set( iNamespaces[i]->Uri() );
+ found = ETrue;
+ }
+ }
+ return uri;
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::Count
+//
+// ---------------------------------------------------------
+//
+TInt CXcapDocument::Count() const
+ {
+ return iNamespaces.Count();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::Prefix
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapDocument::Prefix( TInt aIndex ) const
+ {
+ TInt count = iNamespaces.Count();
+ if( count > 0 && ( aIndex >= 0 && aIndex < count ) )
+ return iNamespaces[aIndex]->Prefix();
+ else return TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::Uri
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXcapDocument::Uri( TInt aIndex ) const
+ {
+ TInt count = iNamespaces.Count();
+ if( count > 0 && ( aIndex >= 0 && aIndex < count ) )
+ return iNamespaces[aIndex]->Uri();
+ else return TPtrC8();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::ResetNamespaces
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::ResetNamespaces( )
+ {
+ iNamespaces.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::TimeStamp
+//
+// ---------------------------------------------------------
+//
+TTime CXcapDocument::TimeStamp() const
+ {
+ return iLastModification;
+ }
+
+// ----------------------------------------------------
+// CXdmDocument::SaveClientStatus
+//
+// ----------------------------------------------------
+//
+void CXcapDocument::SaveClientStatus( TRequestStatus& aClientStatus )
+ {
+ iClientStatus = &aClientStatus;
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::DoCancel
+//
+// ---------------------------------------------------------
+//
+void CXcapDocument::DoCancel()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocument::DoCancel()" ) );
+ #endif
+ if( iClientStatus )
+ {
+ User::RequestComplete( iClientStatus, KErrCancel );
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " Request completed" ) );
+ #endif
+ }
+ else
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( " iClientStatus == NULL => do nothing" ) );
+ #endif
+ }
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapDocumentNode.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,281 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapDocumentNode
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XdmDocument.h"
+#include "XcapProtocol.h"
+#include "XcapDocumentNode.h"
+#include "XcapNodeAttribute.h"
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::CXcapDocumentNode
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode::CXcapDocumentNode( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol ) :
+ CXdmDocumentNode( aXdmEngine, ( MXdmNodeFactory& )*this ),
+ iXcapProtocol( aXcapProtocol )
+
+ {
+ }
+
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::CXcapDocumentNode
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode::CXcapDocumentNode( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode ) :
+ CXdmDocumentNode( aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode ),
+ iXcapProtocol( aXcapProtocol )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::CXcapDocumentNode
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode::CXcapDocumentNode( const TBool aLeafNode,
+ CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode ) :
+ CXdmDocumentNode( aLeafNode, aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode ),
+ iXcapProtocol( aXcapProtocol )
+ {
+
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol )
+ {
+ return new ( ELeave ) CXcapDocumentNode( aXdmEngine, aXcapProtocol );
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXcapProtocol& aXcapProtocol )
+ {
+ CXcapDocumentNode* self = new ( ELeave ) CXcapDocumentNode( aXdmEngine, aXcapProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ CXcapProtocol& aXcapProtocol,
+ const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode )
+ {
+ CXcapDocumentNode* self = new ( ELeave ) CXcapDocumentNode( aXdmEngine, aXcapProtocol );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aAnotherNode.NodeName() );
+ self->CopyConstructL( aAnotherNode, aParentNode );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aNodeName,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode )
+ {
+ CXcapDocumentNode* self = new ( ELeave ) CXcapDocumentNode( aXdmEngine, aXcapProtocol, aParentNode );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TBool aLeafNode,
+ const TDesC& aNodeName,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode )
+ {
+ CXcapDocumentNode* self = new ( ELeave ) CXcapDocumentNode( aLeafNode, aXdmEngine, aXcapProtocol, aParentNode );
+ CleanupStack::PushL( self );
+ self->BaseConstructL( aNodeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmDocumentNode::NewL
+//
+// ----------------------------------------------------------
+//
+CXcapDocumentNode* CXcapDocumentNode::NewL( CXdmEngine& aXdmEngine,
+ const TBool aLeafNode,
+ CXcapProtocol& aXcapProtocol,
+ CXdmDocumentNode* aParentNode )
+ {
+ return new ( ELeave ) CXcapDocumentNode( aLeafNode, aXdmEngine, aXcapProtocol, aParentNode );
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::CopyConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapDocumentNode::CopyConstructL( const CXdmDocumentNode& aAnotherNode,
+ const CXdmDocumentNode& aParentNode )
+ {
+ CXdmDocumentNode::CopyConstructL( aAnotherNode, aParentNode );
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::~CXcapDocumentNode
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXcapDocumentNode::~CXcapDocumentNode()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocumentNode::~CXcapDocumentNode()" ) );
+ #endif
+ delete iPrefix;
+ iPrefix = NULL;
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::ChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocumentNode::ChileNodeL()
+ {
+ return CXcapDocumentNode::NewL( iXdmEngine, EFalse, iXcapProtocol, this );
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::ChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocumentNode::ChileNodeL( const TDesC& aChildName )
+ {
+ return CXcapDocumentNode::NewL( iXdmEngine, EFalse, aChildName, iXcapProtocol, this );
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::ChileNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapDocumentNode::ChileNodeL( const CXdmDocumentNode* aAnotherNode )
+ {
+ return CXcapDocumentNode::NewL( iXdmEngine, iXcapProtocol, *aAnotherNode, *this );
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+CXdmNodeAttribute* CXcapDocumentNode::AttributeL()
+ {
+ return CXcapNodeAttribute::NewL( iXdmEngine, this );
+ }
+
+// ----------------------------------------------------
+// CXcapDocumentNode::CreateAttributeL
+//
+// ----------------------------------------------------
+//
+CXdmNodeAttribute* CXcapDocumentNode::AttributeL( const TDesC& aAttributeName )
+ {
+ return CXcapNodeAttribute::NewL( iXdmEngine, aAttributeName, this );
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::RemoveNode
+//
+// ----------------------------------------------------------
+//
+void CXcapDocumentNode::RemoveNode( CXcapDocumentNode* aChileNode )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXcapDocumentNode::RemoveNode()" ) );
+ #endif
+ CXdmDocumentNode* remove = NULL;
+ TInt index = iChildren.Find( aChileNode );
+ __ASSERT_DEBUG( index >= 0, User::Panic( _L( "CXcapDocumentNode" ), 0 ) );
+ remove = iChildren[index];
+ iChildren.Remove( index );
+ delete remove;
+ remove = NULL;
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::SetPrefix
+//
+// ----------------------------------------------------------
+//
+void CXcapDocumentNode::SetPrefixL( const TDesC8& aPrefix )
+ {
+ delete iPrefix;
+ iPrefix = NULL;
+ iPrefix = aPrefix.AllocL();
+ }
+
+// ----------------------------------------------------------
+// CXcapDocumentNode::NamespacePrefix
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapDocumentNode::Prefix() const
+ {
+ return iPrefix != NULL ? iPrefix->Des() : TPtrC8();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapNodeAttribute.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapNodeAttribute
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "XcapProtocol.h"
+#include "XcapNodeAttribute.h"
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CXcapNodeAttribute::CXcapNodeAttribute( CXdmEngine& aXdmEngine ) :
+ CXdmNodeAttribute( aXdmEngine, ( MXdmNodeFactory& )*this )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CXcapNodeAttribute::CXcapNodeAttribute( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode ) :
+ CXdmNodeAttribute( aXdmEngine,
+ ( MXdmNodeFactory& )*this, aParentNode )
+
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CXcapNodeAttribute* CXcapNodeAttribute::NewL( CXdmEngine& aXdmEngine,
+ const TDesC& aAttributeName,
+ CXdmDocumentNode* aParentNode )
+ {
+ CXcapNodeAttribute* self = new ( ELeave ) CXcapNodeAttribute( aXdmEngine, aParentNode );
+ CleanupStack::PushL( self );
+ self->CXdmNodeAttribute::BaseConstructL( aAttributeName );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CXcapNodeAttribute* CXcapNodeAttribute::NewL( CXdmEngine& aXdmEngine,
+ CXdmDocumentNode* aParentNode )
+ {
+ CXcapNodeAttribute* self = new ( ELeave ) CXcapNodeAttribute( aXdmEngine, aParentNode );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::~CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+CXcapNodeAttribute::~CXcapNodeAttribute()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::~CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapNodeAttribute::Prefix() const
+ {
+ return TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::~CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+void CXcapNodeAttribute::SetPrefixL( const TDesC& /*aNamespacePrefix*/ )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapNodeAttribute::~CXcapNodeAttribute
+//
+// ----------------------------------------------------------
+//
+void CXcapNodeAttribute::SetPrefixL( const TDesC8& /*aNamespacePrefix*/ )
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapNodeSelector.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapNodeSelector
+*
+*/
+
+
+
+
+// INCLUDES
+//This is only for logging
+#include "XcapProtocol.h"
+#include "XcapNodeSelector.h"
+
+// ---------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CXcapNodeSelector::CXcapNodeSelector()
+ {
+ }
+
+// ---------------------------------------------------------
+// Two-phased constructor.
+//
+// ---------------------------------------------------------
+//
+CXcapNodeSelector* CXcapNodeSelector::NewL()
+ {
+ CXcapNodeSelector* self = new ( ELeave ) CXcapNodeSelector();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// Symbian OS default constructor may leave.
+//
+// ---------------------------------------------------------
+//
+void CXcapNodeSelector::ConstructL()
+ {
+
+ }
+
+// ---------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------
+//
+CXcapNodeSelector::~CXcapNodeSelector()
+ {
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( "CXcapNodeSelector::~CXcapNodeSelector()" ) );
+ #endif
+ delete iSelectorString;
+ }
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XcapProtocol/src/XcapProtocol.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,765 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXcapProtocol
+*
+*/
+
+
+
+#include <hal.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <XdmSettingsApi.h>
+#include <XdmSettingsProperty.h>
+#include <XdmSettingsCollection.h>
+#include <implementationproxy.h>
+#include <msgconnmanagerapi.h>
+#include "XcapAppUsage.h"
+#include "XcapEarlyIms.h"
+#include "XcapProtocol.h"
+#include "XcapDocument.h"
+#include "xdmlogwriter.h"
+#include "XcapDocumentNode.h"
+#include "XcapDirectory.h"
+#include "XdmXmlParser.h"
+#include "XdmCredentials.h"
+#include "XcapHttpReqGet.h"
+#include "XdmProtocolInfo.h"
+#include "XdmShutdownTimer.h"
+#include "XcapHttpTransport.h"
+#include "XdmOperationFactory.h"
+
+// ----------------------------------------------------------
+// CXcapProtocol::CXcapProtocol
+//
+// ----------------------------------------------------------
+//
+CXcapProtocol::CXcapProtocol() : iSuspend( EFalse ),
+ iCacheUsage( EFalse ),
+ iTransferMediaOpen( EFalse ),
+ iSimRequestPending( EFalse ),
+ iAuthType( EXcapAuthHttpDigest )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+CXcapProtocol* CXcapProtocol::NewL( const TXdmProtocolParams& aProtocolParams )
+ {
+ CXcapProtocol* self = new ( ELeave ) CXcapProtocol();
+ CleanupStack::PushL( self );
+ self->ConstructL( aProtocolParams );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::DeleteLogFileL
+//
+// ----------------------------------------------------------
+//
+CXcapProtocol::~CXcapProtocol()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::~CXcapProtocol()" ) );
+ #endif
+ delete iRootUri;
+ delete iPublicId;
+ delete iXmlParser;
+ delete iCapabilities;
+ delete iImsResolver;
+ delete iHttpTransport;
+ delete iIdleTimer;
+ if( iCacheUsage )
+ {
+ iCacheClient.Flush();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Cache flushed" ) );
+ #endif
+ iCacheClient.Close();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Cache closed" ) );
+ #endif
+ }
+ if( iConnectionManager != NULL )
+ iConnectionManager->Destroy();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " ConnMan destroyed" ) );
+ #endif
+ #ifdef _DEBUG
+ WriteToLog( _L8( " All finished, about to delete file logger" ) );
+ #endif
+ delete iLogWriter;
+ iNotifyeeQueue.Close();
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::ConstructL( const TXdmProtocolParams& aProtocolParams )
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KXcapEngLogFile );
+ WriteToLog( _L8( "CXcapProtocol::ConstructL()" ) );
+ #endif
+ iXdmEngine = CONST_CAST( CXdmEngine*, &aProtocolParams.iXdmEngine );
+ iProtocolInfo = &aProtocolParams.iProtocolInfo;
+ TInt error = SaveSettingsL();
+ if( error == KErrNone )
+ {
+ iXmlParser = CXdmXmlParser::NewL();
+ iIdleTimer = new ( ELeave ) CXdmShutdownTimer( *this, this );
+ iIdleTimer->ConstructL();
+ if( iProtocolInfo->IsCacheEnabled() )
+ {
+ iCacheUsage = ETrue;
+ TInt error = iCacheClient.Connect();
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Cache start: %d" ), error );
+ #endif
+ __ASSERT_DEBUG( ( error == KErrNone || error == KErrAlreadyExists ),
+ User::Panic( _L( "CXcapProtocol" ), 1 ) );
+ }
+ iUserName.Copy( iCredentials.iUserName );
+ iConnectionManager = NewMsgConnManagerL( iAccessPoint );
+ __ASSERT_DEBUG( iRootUri->Des().Length() > 0, User::Panic( _L( "CXcapProtocol" ), 1 ) );
+ TBool secure = iProtocolInfo->IsSecure() || iRootUri->Des().FindF( KHttps ) == 0;
+ HBufC* root = ParseRootLocationLC( secure, iRootUri->Des() );
+ __ASSERT_ALWAYS( root != NULL, User::Panic( _L( "CXcapProtocol" ), 1 ) );
+ iHttpTransport = CXcapHttpTransport::NewL( root->Des(), *iConnectionManager, iCredentials );
+ CleanupStack::PopAndDestroy(); //root
+ }
+ else User::Leave( error );
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::PublicID
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TPtrC8 CXcapProtocol::PublicID()
+ {
+ return iPublicId != NULL ? iPublicId->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::Cache
+//
+// ----------------------------------------------------------
+//
+EXPORT_C RXcapCache* CXcapProtocol::Cache()
+ {
+ return iCacheUsage ? &iCacheClient : NULL;
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::Parser
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CXdmXmlParser& CXcapProtocol::Parser()
+ {
+ return *iXmlParser;
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::Transport
+//
+// ---------------------------------------------------------
+//
+EXPORT_C CXcapHttpTransport& CXcapProtocol::Transport()
+ {
+ return *iHttpTransport;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::IsNetworkAvailable
+//
+// ----------------------------------------------------------
+//
+EXPORT_C TBool CXcapProtocol::IsNetworkAvailable()
+ {
+ return iConnectionManager->Status();
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::SaveSettingsL
+//
+// ----------------------------------------------------------
+//
+TInt CXcapProtocol::SaveSettingsL()
+ {
+ TInt settingsId = iProtocolInfo->SettingsID();
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::SaveSettingsL() - ID: %d" ), settingsId );
+ #endif
+ CXdmSettingsCollection* settings = NULL;
+ TRAPD( error, settings = TXdmSettingsApi::SettingsCollectionL( settingsId ) );
+ if( error == KErrNone && settings != NULL )
+ {
+ CleanupStack::PushL( settings );
+ SaveFromCollectionL( *settings );
+ CleanupStack::PopAndDestroy(); //settings
+ }
+ else //Default to HTTP-DIGEST
+ {
+ iAuthType = EXcapAuthHttpDigest;
+ iAccessPoint = iProtocolInfo->AccessPoint();
+ iCredentials = iProtocolInfo->Credentials();
+ iRootUri = iProtocolInfo->Root().AllocL();
+ error = iRootUri->Des().Length() > 0 &&
+ iCredentials.iUserName.Length() > 0 &&
+ iCredentials.iPassword.Length() > 0 ?
+ KErrNone : KErrArgument;
+ }
+ return error;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::SelectAuthType
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::SelectAuthTypeL( const CXdmSettingsCollection& aSettings )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::SelectAuthTypeL()" ) );
+ #endif
+ TPtrC authType( aSettings.Property( EXdmPropAuthType ) );
+ if( authType.Compare( KXdmAuthGaa ) == 0 )
+ {
+ iAuthType = EXcapAuthGaa;
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " GAA" ) );
+ #endif
+ }
+ else if( authType.Compare( KXdmAuthEarlyIms ) == 0 )
+ {
+ #ifndef __WINSCW__
+ iAuthType = EXcapAuthEarlyIms;
+ ResolveIdentityL();
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " EARLY-IMS" ) );
+ #endif
+ #endif
+ #ifdef __FAKE_IMPU__
+ iAuthType = EXcapAuthEarlyIms;
+ ResolveIdentityL();
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " EARLY-IMS" ) );
+ #endif
+ #else
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " WINS, cannot authenticate without SIM card => ignore" ) );
+ #endif
+ iAuthType = EXcapAuthHttpDigest;
+ #endif
+ }
+ else
+ {
+ iAuthType = EXcapAuthHttpDigest;
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " HTTP-DIGEST" ) );
+ #endif
+ }
+ //Fallback position: in case the server challenges us even though EXcapAuthEarlyIms
+ //has been defined, use the credentials the client supplied regardless of what they are.
+ TPtrC authName( aSettings.Property( EXdmPropAuthName ) );
+ TPtrC authSecret( aSettings.Property( EXdmPropAuthSecret ) );
+ //But they must not exceed the stipulated length
+ __ASSERT_ALWAYS( authName.Length() <= KXdmMaxUserNameLength, User::Leave( KErrCorrupt ) );
+ __ASSERT_ALWAYS( authSecret.Length() <= KXdmMaxPasswordLength, User::Leave( KErrCorrupt ) );
+ iCredentials = TXdmCredentials( authName, authSecret );
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::SaveFromCollectionL
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::SaveFromCollectionL( const CXdmSettingsCollection& aSettings )
+ {
+ #ifdef _DEBUG
+ for( TInt i = 0;i < aSettings.Count();i++ )
+ {
+ const CXdmSettingsProperty& prop = aSettings.Property( i );
+ HBufC8* value = HBufC8::NewLC( prop.PropertyValue().Length() );
+ value->Des().Copy( prop.PropertyValue() );
+ TPtrC8 valueDes( value->Des() );
+ WriteToLog( _L8( " Property %d - Name: %d Value: %S" ), i, prop.PropertyName(), &valueDes );
+ CleanupStack::PopAndDestroy(); //value
+ }
+ #endif
+ SelectAuthTypeL( aSettings );
+ __ASSERT_DEBUG( aSettings.Property( EXdmPropToNapId ).Length() > 0, User::Leave( KErrCorrupt ) );
+ __ASSERT_DEBUG( aSettings.Property( EXdmPropUri ).Length() > 0, User::Leave( KErrCorrupt ) );
+ TLex accessPoint( aSettings.Property( EXdmPropToNapId ) );
+ TInt error = accessPoint.Val( iAccessPoint );
+ __ASSERT_DEBUG( error == KErrNone, User::Leave( KErrCorrupt ) );
+ iRootUri = aSettings.Property( EXdmPropUri ).AllocL();
+ #ifdef _DEBUG
+ TBuf8<KXdmMaxUserNameLength> name( iCredentials.iUserName );
+ TBuf8<KXdmMaxPasswordLength> password( iCredentials.iPassword );
+ HBufC8* rootUri = HBufC8::NewLC( iRootUri->Des().Length() );
+ rootUri->Des().Copy( iRootUri->Des() );
+ TPtrC8 uriDes( rootUri->Des() );
+ WriteToLog( _L8( " Finished - Error: %d" ), error );
+ WriteToLog( _L8( " Access point: %d" ), iAccessPoint );
+ WriteToLog( _L8( " URI: %S" ), &uriDes );
+ WriteToLog( _L8( " User name: %S" ), &name );
+ WriteToLog( _L8( " Password: %S" ), &password );
+ CleanupStack::PopAndDestroy(); //rootUri
+ #endif
+ iUserName.Copy( iCredentials.iUserName );
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::ParseRootLocationLC
+//
+// ----------------------------------------------------------
+//
+HBufC* CXcapProtocol::ParseRootLocationLC( const TBool aSecurity,
+ const TDesC& aRootLocation )
+ {
+ #ifdef _DEBUG
+ TBuf8<1024> root;
+ root.Copy( aRootLocation );
+ WriteToLog( _L8( "CXcapProtocol::ParseRootLocationLC()" ) );
+ WriteToLog( _L8( " Security: %d" ), aSecurity );
+ WriteToLog( _L8( " Provided URI: %S" ), &root );
+ #endif
+ HBufC* ret = NULL;
+ HBufC* temp = CheckProtocolPrefixL( aRootLocation );
+ if( temp != NULL )
+ {
+ CleanupStack::PushL( temp );
+ ret = aSecurity ? ConstructSecureUriL( temp->Des() ) :
+ ConstructStandardUriL( temp->Des() );
+ CleanupStack::PopAndDestroy(); //temp
+ }
+ else
+ ret = aSecurity ? ConstructSecureUriL( aRootLocation ) :
+ ConstructStandardUriL( aRootLocation );
+ TPtr desc( ret->Des() );
+ if( desc[desc.Length() - 1] == '/' )
+ desc.Delete( desc.Length() - 1, 1 );
+ CleanupStack::PushL( ret );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::CheckProtocolPrefixLC
+//
+// ----------------------------------------------------------
+//
+HBufC* CXcapProtocol::CheckProtocolPrefixL( const TDesC& aRootLocation )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::CheckProtocolPrefixL()" ) );
+ #endif
+ HBufC* buffer = NULL;
+ if( aRootLocation.FindF( KHttp ) == 0 || aRootLocation.FindF( KHttps ) == 0 )
+ {
+ TInt length = aRootLocation.FindF( KHttp ) == 0 ?
+ KHttp().Length() : KHttps().Length();
+ buffer = HBufC::NewL( aRootLocation.Length() - length );
+ TPtrC desc( aRootLocation );
+ TPtrC temp = desc.Right( aRootLocation.Length() - length );
+ buffer->Des().Copy( temp );
+ }
+ return buffer;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::ConstructStandardUriL
+//
+// ----------------------------------------------------------
+//
+HBufC* CXcapProtocol::ConstructStandardUriL( const TDesC& aBasicUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::ConstructStandardUriLC()" ) );
+ #endif
+ HBufC* ret = HBufC::NewL( aBasicUri.Length() +
+ TPtrC( KHttp ).Length() );
+ TPtr desc( ret->Des() );
+ desc.Copy( KHttp );
+ desc.Append( aBasicUri );
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::ConstructSecureUriL
+//
+// ----------------------------------------------------------
+//
+HBufC* CXcapProtocol::ConstructSecureUriL( const TDesC& aBasicUri )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::ConstructSecureUriLC()" ) );
+ #endif
+ TInt index = aBasicUri.FindF( KHostSeparator );
+ HBufC* ret = HBufC::NewL( aBasicUri.Length() +
+ TPtrC( KHttps ).Length() );
+ TPtr uriDesc( ret->Des() );
+ if( index > 0 )
+ {
+ TPtrC basic( aBasicUri.Left( index ) );
+ TPtrC theRest( aBasicUri.Mid( index ) );
+ uriDesc.Copy( KHttps );
+ uriDesc.Append( basic );
+ uriDesc.Append( theRest );
+ }
+ else
+ {
+ uriDesc.Copy( KHttps );
+ uriDesc.Append( aBasicUri );
+ }
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::ResolveIdentityL
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::ResolveIdentityL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::ResolveIdentityL()" ) );
+ #endif
+ iImsResolver = CXcapEarlyIms::NewL();
+ iImsResolver->RequestSimDataL( this );
+ iSimRequestPending = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::CheckActivity
+//
+// ---------------------------------------------------------
+//
+void CXcapProtocol::CheckActivity()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::CheckActivity()" ) );
+ #endif
+ TBool activity = EFalse;
+ const RPointerArray<CXdmDocument>& documents = iXdmEngine->DocumentCollection();
+ const RPointerArray<CXdmDirectory>& directories = iXdmEngine->DirectoryCollection();
+ TInt docCount = documents.Count();
+ TInt dirCount = directories.Count();
+ if( docCount > 0 || dirCount > 0 )
+ {
+ TInt i = 0;
+ for( ;!activity && i < docCount;i++ )
+ activity = documents[i]->IsActive();
+ for( i = 0 && !activity;!activity && i < dirCount;i++ )
+ activity = directories[i]->IsActive();
+ }
+ if( !activity )
+ {
+ //Just in case...
+ iIdleTimer->Cancel();
+ iIdleTimer->Start( iIdleTimeout * 1000000 );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::SimRequestPending
+//
+// ---------------------------------------------------------
+//
+TBool CXcapProtocol::IsSimRequestPending( TInt& aError ) const
+ {
+ aError = iSimRequestPending ? KErrNotReady : iImsResolverError;
+ return iSimRequestPending;
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::AppendNotifyeeL
+//
+// ---------------------------------------------------------
+//
+void CXcapProtocol::AppendNotifyeeL( CXcapDocument* aPendingDoc )
+ {
+ User::LeaveIfError( iNotifyeeQueue.Append( aPendingDoc ) );
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::CancelImsResolver
+//
+// ---------------------------------------------------------
+//
+void CXcapProtocol::CancelImsResolver()
+ {
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( "CXcapDocument::CancelImsResolver()" ) );
+ #endif
+ if( iImsResolver )
+ iImsResolver->Cancel();
+ }
+
+// ---------------------------------------------------------
+// CXcapDocument::RequestComplete
+//
+// ---------------------------------------------------------
+//
+void CXcapProtocol::RequestComplete( TInt aError )
+ {
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( "CXcapDocument::RequestComplete()" ) );
+ #endif
+ if( aError == KErrNone )
+ {
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " Public ID retrieved successfully" ) );
+ #endif
+ iPublicId = iImsResolver->PublicIDL().AllocL();
+ delete iImsResolver;
+ iImsResolver = NULL;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ CXcapProtocol::WriteToLog( _L8( " Public ID retrieval failed - Status: %d" ), aError );
+ #endif
+ iImsResolverError = aError;
+ }
+ for( TInt i = 0;i < iNotifyeeQueue.Count();i++ )
+ {
+ CXcapDocument* document = iNotifyeeQueue[i];
+ if( document )
+ document->NotifyResolverCompleteL( aError );
+ }
+ iSimRequestPending = EFalse;
+ iNotifyeeQueue.Reset();
+ }
+
+// ----------------------------------------------------------
+// CXcapProtocol::WriteToLog
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+// ----------------------------------------------------
+// CXcapProtocol::InitTransferMedium
+//
+// ----------------------------------------------------
+//
+void CXcapProtocol::InitTransferMedium( TInt aIdleTimeout, TRequestStatus& aStatus )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::InitTransferMedium()" ) );
+ #endif
+ iIdleTimer->Cancel();
+ iIdleTimeout = aIdleTimeout;
+ if( !IsNetworkAvailable() )
+ iConnectionManager->StartConnection( aStatus );
+ else //Already open
+ {
+ TRequestStatus* status = &aStatus;
+ User::RequestComplete( status, KErrNone );
+ }
+ }
+
+// ----------------------------------------------------
+// CXcapProtocol::CancelTransferMediumInit
+//
+// ----------------------------------------------------
+//
+void CXcapProtocol::CancelTransferMediumInit()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::CancelTransferMediumInit()" ) );
+ #endif
+ TInt error = KErrNone;
+ TRAP( error, iConnectionManager->CancelStartL() );
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Transfer media cancel completed - Error: %d" ), error );
+ #endif
+ //Suppress build warning
+ error = KErrNone;
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::IsTransferAvailable
+//
+// ---------------------------------------------------------
+//
+TBool CXcapProtocol::IsTransferAvailable() const
+ {
+ return iConnectionManager->Status();
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::AuthType
+//
+// ---------------------------------------------------------
+//
+TXcapAuthType CXcapProtocol::AuthType() const
+ {
+ return iAuthType;
+ }
+
+// ---------------------------------------------------------
+// CXdmEngine::XdmProtocol
+//
+// ---------------------------------------------------------
+//
+void CXcapProtocol::SwitchOff()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::SwitchOff()" ) );
+ #endif
+ iConnectionManager->StopConnection();
+ }
+
+// ----------------------------------------------------
+// CXcapProtocol::CreateDocumentL
+//
+// ----------------------------------------------------
+//
+CXdmDocument* CXcapProtocol::CreateDocumentL( const TDesC& aDocumentName,
+ const TXdmDocType aDocumentType )
+ {
+ return CXcapDocument::NewL( aDocumentType, aDocumentName, *iXdmEngine, *this );
+ }
+
+// ----------------------------------------------------
+// CXcapProtocol::CreateDirectoryL
+//
+// ----------------------------------------------------
+//
+CXdmDirectory* CXcapProtocol::CreateDirectoryL( const TDesC& aDirectoryPath )
+ {
+ _LIT( KDirectoryDocName, "directory.xml" );
+ CXdmDocument* document = iXdmEngine->CreateDocumentModelL( KDirectoryDocName, EXdmDirectory );
+ CleanupStack::PushL( document );
+ CXdmDirectory* directory = CXcapDirectory::NewL( aDirectoryPath, *iXdmEngine, document, *this );
+ CleanupStack::Pop(); //document
+ return directory;
+ }
+
+// ----------------------------------------------------
+// CXcapProtocol::CreateDocumentNodeL
+//
+// ----------------------------------------------------
+//
+CXdmDocumentNode* CXcapProtocol::CreateDocumentNodeL()
+ {
+ return CXcapDocumentNode::NewL( *iXdmEngine, *this );
+ }
+
+// ---------------------------------------------------------
+// CXcapProtocol::GenerateUniqueIdL
+//
+// ---------------------------------------------------------
+//
+TInt CXcapProtocol::GenerateUniqueIdL()
+ {
+ TInt period = 0;
+ User::LeaveIfError( HAL::Get( HALData::ESystemTickPeriod, period ) );
+ TInt millisecsPerTick = period / 1000;
+ return User::TickCount() * millisecsPerTick;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocol::UserName
+//
+// ----------------------------------------------------------
+//
+TPtrC8 CXcapProtocol::UserName() const
+ {
+ return iUserName;
+ }
+
+// ----------------------------------------------------------
+// CXdmProtocol::HandleBearerEventL
+//
+// ----------------------------------------------------------
+//
+void CXcapProtocol::HandleBearerEventL( TBool aAuthoritativeClose,
+ TMsgBearerEvent aBearerEvent )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXcapProtocol::HandleBearerEventL(): %d" ), aBearerEvent );
+ #endif
+ switch( aBearerEvent )
+ {
+ case EMsgBearerSuspended:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Bearer suspended" ) );
+ #endif
+ iSuspend = ETrue;
+ break;
+ case EMsgBearerActive:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Bearer active" ) );
+ #endif
+ iSuspend = EFalse;
+ break;
+ case EMsgBearerLost:
+ #ifdef _DEBUG
+ WriteToLog( _L8( " Bearer lost - Authoritative: %d" ),
+ aAuthoritativeClose );
+ #endif
+ break;
+ default:
+ //Suppress build warning
+ aAuthoritativeClose = EFalse;
+ break;
+ }
+ }
+
+// ---------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+//
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+#ifdef __EABI__
+ IMPLEMENTATION_PROXY_ENTRY( 0x10207423, CXcapProtocol::NewL )
+#else
+ { { 0x10207423 }, CXcapProtocol::NewL }
+#endif
+ };
+
+// ---------------------------------------------------------
+// Return the implementation table & number of implementations
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/bwinscw/XdmXmlParserU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+ ??1CXdmXmlParser@@UAE@XZ @ 1 NONAME ; CXdmXmlParser::~CXdmXmlParser(void)
+ ?FormatToXmlLC@CXdmXmlParser@@QAEPAVHBufC8@@ABVTDesC8@@PBVCXdmDocument@@PBVCXdmDocumentNode@@@Z @ 2 NONAME ; class HBufC8 * CXdmXmlParser::FormatToXmlLC(class TDesC8 const &, class CXdmDocument const *, class CXdmDocumentNode const *)
+ ?FormatToXmlLC@CXdmXmlParser@@QAEPAVHBufC8@@HPBVCXdmDocument@@PBVCXdmDocumentNode@@@Z @ 3 NONAME ; class HBufC8 * CXdmXmlParser::FormatToXmlLC(int, class CXdmDocument const *, class CXdmDocumentNode const *)
+ ?NewL@CXdmXmlParser@@SAPAV1@XZ @ 4 NONAME ; class CXdmXmlParser * CXdmXmlParser::NewL(void)
+ ?ParseDocumentL@CXdmXmlParser@@QAEXABVTDesC8@@PAVCXdmDocumentNode@@@Z @ 5 NONAME ; void CXdmXmlParser::ParseDocumentL(class TDesC8 const &, class CXdmDocumentNode *)
+ ?ParseDocumentL@CXdmXmlParser@@QAEXPAVCXdmDocument@@ABVTDesC8@@@Z @ 6 NONAME ; void CXdmXmlParser::ParseDocumentL(class CXdmDocument *, class TDesC8 const &)
+ ?ParseDocumentL@CXdmXmlParser@@QAEXPAVCXdmDocument@@ABVTDesC8@@PAVCXdmDocumentNode@@@Z @ 7 NONAME ; void CXdmXmlParser::ParseDocumentL(class CXdmDocument *, class TDesC8 const &, class CXdmDocumentNode *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/eabi/XdmXmlParserU.DEF Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+ _ZN13CXdmXmlParser13FormatToXmlLCERK6TDesC8PK12CXdmDocumentPK16CXdmDocumentNode @ 1 NONAME
+ _ZN13CXdmXmlParser13FormatToXmlLCEiPK12CXdmDocumentPK16CXdmDocumentNode @ 2 NONAME
+ _ZN13CXdmXmlParser14ParseDocumentLEP12CXdmDocumentRK6TDesC8 @ 3 NONAME
+ _ZN13CXdmXmlParser14ParseDocumentLEP12CXdmDocumentRK6TDesC8P16CXdmDocumentNode @ 4 NONAME
+ _ZN13CXdmXmlParser14ParseDocumentLERK6TDesC8P16CXdmDocumentNode @ 5 NONAME
+ _ZN13CXdmXmlParser4NewLEv @ 6 NONAME
+ _ZTI13CXdmXmlParser @ 7 NONAME ; #<TI>#
+ _ZTI21CXdmXmlContentHandler @ 8 NONAME ; #<TI>#
+ _ZTV13CXdmXmlParser @ 9 NONAME ; #<VT>#
+ _ZTV21CXdmXmlContentHandler @ 10 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/group/XdmXmlParser.mmp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmXmlParser
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET xdmxmlparser.dll
+TARGETTYPE dll
+UID 0x1000008d 0x10207412
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+//Application classes
+SOURCE XdmXmlParser.cpp
+SOURCE XmlFormatter.cpp
+SOURCE XmlParserNodePath.cpp
+SOURCE XdmXmlContentHandler.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/xml
+SYSTEMINCLUDE ../../../inc
+
+
+LIBRARY hal.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+//For debug libraries
+DEBUGLIBRARY flogger.lib
+LIBRARY xdmengine.lib
+LIBRARY xmlframework.lib
+
+#if defined( ARMCC )
+ DEFFILE ../eabi/
+#elif defined ( WINSCW )
+ deffile ../bwinscw/
+#elif defined (WINS )
+ deffile ../BWINS/
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmXmlParser
+*
+*/
+
+
+
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+XdmXmlParser.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XdmXmlContentHandler.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmXmlContentHandler
+*
+*/
+
+
+
+
+#ifndef __XDMXMLCONTENTHANDLER__
+#define __XDMXMLCONTENTHANDLER__
+
+//INCLUDES
+#include <contenthandler.h>
+#include "XmlNodePathInterface.h"
+
+using namespace Xml;
+
+class CXdmDocument;
+class CXdmXmlParser;
+class MXdmNodeInterface;
+class CXmlParserNodePath;
+
+//CLASS DECLARATION
+class CXdmXmlContentHandler : public CBase,
+ public MContentHandler,
+ public MXmlNodePathInterface
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS Constructor
+ * @param CXdmXmlParser Reference to the main parser class
+ * @return CXdmXmlContentHandler A new content handler
+ */
+ static CXdmXmlContentHandler* NewL( CXdmXmlParser& aParserMain );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CXdmXmlContentHandler();
+
+ public: // New functions
+
+ /**
+ * Reset content handler
+ * @return void
+ */
+ void Reset();
+
+ /**
+ * Set the target document
+ * @param CXdmDocument& Reference to a document model
+ * @return void
+ */
+ void SetTarget( const CXdmDocument& aTargetDocument );
+
+ /**
+ * Set the target element
+ * @param CXdmDocumentNode Referene to document/fragment root
+ * @return void
+ */
+ void SetTarget( const CXdmDocumentNode& aDocumentRoot );
+
+ /**
+ * Set the target document and element
+ * @param CXdmDocument Reference to a document model
+ * @param CXdmDocumentNode Referene to document/fragment root
+ * @return void
+ */
+ void SetTargetL( const CXdmDocument& aTargetDocument,
+ const CXdmDocumentNode& aTargetNode );
+
+ public: //From MXmlNodePathInterface
+
+ /**
+ * Return the target attribute
+ * @return CXdmNodeAttribute* Target attribute
+ */
+ CXdmNodeAttribute* TargetAttribute() const;
+
+ private:
+
+ /**
+ * C++ Constructor
+ * @param CXdmXmlParser Reference to the main parser class
+ * @return CXdmXmlContentHandler
+ */
+ CXdmXmlContentHandler( CXdmXmlParser& aParserMain );
+
+ /**
+ * Symbian OS second-phase constructor
+ */
+ void ConstructL();
+
+ private: //From Xml::MContentHandler
+
+ /**
+ * Get extended interface
+ * @param TInt32 UID of the interface
+ * @return TAny* a general pointer to the interface
+ */
+ TAny* GetExtendedInterface( const TInt32 aUid );
+
+ /**
+ * Called on content: <elem>content</elem>
+ * @param TDesC& Content bytes
+ * @param TInt Error code
+ * @return void
+ */
+ void OnContentL( const TDesC8 &aBytes,
+ TInt aErrorCode );
+
+ /**
+ * Called on document end
+ * @param TInt Error code
+ * @return void
+ */
+ void OnEndDocumentL( TInt aErrorCode );
+
+ /**
+ * Called on element end
+ * @param RTagInfo& Tag info
+ * @param TInt Error code
+ * @return void
+ */
+ void OnEndElementL( const RTagInfo& aElement,
+ TInt aErrorCode );
+
+ /**
+ * Called on prefix mapping end
+ * @param RString& Prefix
+ * @param TInt Error code
+ * @return void
+ */
+ void OnEndPrefixMappingL( const RString &aPrefix,
+ TInt aErrorCode );
+
+ /**
+ * Called on error
+ * @param TInt Error code
+ * @return void
+ */
+ void OnError( TInt aErrorCode );
+
+ /**
+ * Called on ingnorable whitespace
+ * @param TDesC8& Whitespace bytes
+ * @param TInt Error code
+ * @return void
+ */
+ void OnIgnorableWhiteSpaceL( const TDesC8& aBytes,
+ TInt aErrorCode );
+
+ /**
+ * Called on processing instructions
+ * @param TDesC8& Target
+ * @param TDesC8& Data
+ * @param TInt Error code
+ * @return void
+ */
+ void OnProcessingInstructionL( const TDesC8& aTarget,
+ const TDesC8& aData,
+ TInt aErrorCode );
+
+ /**
+ * Called on skipped entity
+ * @param RString& Name of the entity
+ * @param TInt Error code
+ * @return void
+ */
+ void OnSkippedEntityL( const RString &aName,
+ TInt aErrorCode );
+
+ /**
+ * Called on document start
+ * @param RDocumentParameters& Parameters
+ * @param TInt Error code
+ * @return void
+ */
+ void OnStartDocumentL( const RDocumentParameters& aDocParam,
+ TInt aErrorCode );
+
+ /**
+ * Called on element start
+ * @param RTagInfo& The starting element
+ * @param Xml::RAttributeArray Attributes
+ * @param TInt Error code
+ * @return void
+ */
+ void OnStartElementL( const RTagInfo& aElement,
+ const Xml::RAttributeArray &aAttributes,
+ TInt aErrorCode );
+
+ /**
+ * Called on prefix mapping start
+ * @param RString& Prefix
+ * @param RString& URI
+ * @param TInt Error code
+ * @return void
+ */
+ void OnStartPrefixMappingL( const RString& aPrefix,
+ const RString& aUri,
+ TInt aErrorCode );
+
+ private:
+
+ /**
+ * Append attributes from the parameter array
+ * @param Xml::RAttributeArray& Attributes
+ * @return void
+ */
+ void AppendAttributeValueL( const Xml::RAttributeArray& aAttributes );
+
+ /**
+ * Handle next element
+ * @param RTagInfo& The new element
+ * @param Xml::RAttributeArray& Attributes
+ * @return void
+ */
+ void HandleNextElementL( const Xml::RTagInfo& aElement,
+ const Xml::RAttributeArray& aAttributes );
+ /**
+ * Is the parameter descriptor a whitespace
+ * @param TDesC8& Bytes to check
+ * @return TBool
+ */
+ TBool IsWhiteSpace( const TDesC8& aBytes ) const;
+
+ /**
+ * Append a new namespace
+ * @param TDesC8& Prefix
+ * @param TDesC8& URI
+ * @return void
+ */
+ void AppendNameSpaceL( const TDesC8& aPrefix, const TDesC8& aUri );
+
+ /**
+ * Set the namespace information to the current node
+ * @param RTagInfo& Element
+ * @param MXdmNodeInterface* Node interface
+ * @return void
+ */
+ void SetNamespaceInformationL( const RTagInfo& aElement,
+ MXdmNodeInterface* aXcapNode );
+
+ private: // Data
+
+ TInt iContentIndex;
+ TBool iFinished;
+ TBool iIsRootNode;
+ TBool iTargetFound;
+ TXdmElementType iElementType;
+ TBool iPartialDocument;
+ CBufFlat* iContentBuffer;
+ CXdmDocument* iTargetDocument;
+ CXdmDocumentNode* iRootNode;
+ CXdmDocumentNode* iDocumentSubset;
+ CXdmDocumentNode* iCurrentNode;
+ CXdmNodeAttribute* iTargetAttribute;
+ CXmlParserNodePath* iNodePath;
+ CXdmXmlParser& iParserMain;
+ };
+
+#endif // __XDMXMLCONTENTHANDLER__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XdmXmlParser.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmXmlParser
+*
+*/
+
+
+
+
+#ifndef __XDMXMLPARSER__
+#define __XDMXMLPARSER__
+
+#include <parser.h>
+
+//CONSTANTS
+_LIT( KParserLogFile, "XcapXml" );
+_LIT8( KDefaultMimeType, "text/xml" );
+
+using namespace Xml;
+
+//FORWARD DECLARATION
+class CXdmDocument;
+class CXdmLogWriter;
+class CXmlFormatter;
+class CXdmDocumentNode;
+class MXdmNodeInterface;
+class CXdmXmlContentHandler;
+class MXdmNamespaceContainer;
+
+// CLASS DECLARATION
+class CXdmXmlParser: public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS Constructor
+ * @return CXdmXmlParser New parser intance
+ */
+ IMPORT_C static CXdmXmlParser* NewL();
+
+ /**
+ * Parse an XML document
+ * @param CXdmDocument Document instance
+ * @param TDesC8& The raw XML data
+ * @return void
+ */
+ IMPORT_C void ParseDocumentL( CXdmDocument* aDocument,
+ const TDesC8& aXmlDocument );
+
+ /**
+ * Parse an XML document
+ * @param CXdmDocument Document instance
+ * @param TDesC8& The raw XML data
+ * @param Pointer to the document/fragment root
+ * @return void
+ */
+ IMPORT_C void ParseDocumentL( CXdmDocument* aDocument,
+ const TDesC8& aXmlDocument,
+ CXdmDocumentNode* aDocumentSubset );
+
+ /**
+ * Parse an XML document
+ * @param TDesC8& The raw XML data
+ * @param Pointer to the document/fragment root
+ * @return void
+ */
+ IMPORT_C void ParseDocumentL( const TDesC8& aXmlDocument,
+ CXdmDocumentNode* aDocumentRoot );
+
+ /**
+ * Format a document model into textual form
+ * @param TBool Indicates whether the document is whole
+ * @param CXdmDocument The document instance
+ * @param CXdmDocumentNode Pointer to the document/fragment root
+ * @return HBufC8* The document in textual form
+ */
+ IMPORT_C HBufC8* FormatToXmlLC( TBool aIsWholeDocument,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aRootNode );
+
+ /**
+ * Format a document model into textual form and append the fragment
+ * in the first parameter to the correct place inside the document.
+ * @param TDesC8& The fragment to append
+ * @param CXdmDocument The document instance
+ * @param CXdmDocumentNode Pointer to the fragment
+ * @return HBufC8* The document in textual form
+ */
+ IMPORT_C HBufC8* FormatToXmlLC( const TDesC8& aXmlFragment,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aTargetNode );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CXdmXmlParser();
+
+ public:
+
+ #ifdef _DEBUG
+
+ /**
+ * Write to log file
+ * @param TRefByValue<const TDesC8> The log line
+ * @return void
+ */
+ void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
+
+ #endif
+
+ public:
+
+ /**
+ * Stop the parser
+ * @return void
+ */
+ void FinishParsingL();
+
+ private:
+
+ /**
+ * C++ constructor is private
+ * @return CXdmXmlParser
+ */
+ CXdmXmlParser();
+
+ /**
+ * Second-phase constructor
+ * @return void
+ */
+ void ConstructL();
+
+ #ifdef _DEBUG
+
+ /**
+ * Return the current system time
+ * @return TInt Current system time in integer format
+ */
+ static TInt TimeL();
+
+ /**
+ * Write the formatted document to the log folder
+ * @param HBufC8* Pointer to the data segment
+ * @return void
+ */
+ void DumpDocumentL( HBufC8* aDocData );
+
+ #endif
+
+ private: //Data
+
+ TInt iDumpIndex;
+ TPtr8 iXmlDocument;
+ CParser* iXmlParser;
+ CXdmLogWriter* iLogWriter;
+ CXmlFormatter* iXmlFormatter;
+ TRequestStatus* iClientStatus;
+ CXdmXmlContentHandler* iContentHandler;
+ };
+
+#endif //__XDMXMLPARSER__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XmlFormatter.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXmlFormatter
+*
+*/
+
+
+
+
+#ifndef __XMLFORMATTER__
+#define __XMLFORMATTER__
+
+// INCLUDES
+#include <e32base.h>
+#include "XmlParserNodePath.h"
+#include "XmlNodePathInterface.h"
+
+//Konsts
+_LIT8( KXmldocumentStart, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
+
+//Forwar declarations
+class CXdmDocument;
+class CXdmXmlParser;
+class CXdmDocumentNode;
+class MXdmNodeInterface;
+class CXmlParserNodePath;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXmlFormatter ) : public CBase,
+ public MXmlNodePathInterface
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Symbian OS Constructor
+ * @return CXmlFormatter* New XML formatter
+ */
+ static CXmlFormatter* NewL( CXdmXmlParser& aParserMain );
+
+ /**
+ * Format a document
+ * @param TBool Indicates whether parameter is a whole document
+ * @param CXdmDocument* The target document
+ * @param CXdmDocumentNode* The target element
+ * @return HBufC8* The document in textual form
+ */
+ HBufC8* FormatLC( TBool aIsWholeDocument,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aRootNode );
+
+ /**
+ * Format a document
+ * @param TDesC8& An XML fragment to append
+ * @param CXdmDocument* The target document
+ * @param CXdmDocumentNode* The target element
+ * @return HBufC8* The document in textual form
+ */
+ HBufC8* FormatLC( const TDesC8& aXmlFragment,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aTargetNode );
+
+ /**
+ * Destructor
+ */
+ virtual ~CXmlFormatter();
+
+ private: //From MXmlParserNodePathInterface
+
+ /**
+ * Return the target attribute
+ * @return CXdmNodeAttribute* target attribute
+ */
+ CXdmNodeAttribute* TargetAttribute() const;
+
+ private:
+
+ /**
+ * C++ constructor
+ * @return CXmlFormatter
+ */
+ CXmlFormatter( CXdmXmlParser& aParserMain );
+
+ /**
+ * Symbian OS second-phase constructor
+ * @return void
+ */
+ void ConstructL();
+
+ /**
+ * Read data from the format buffer into a contiguous segment
+ * @return HBufC8* An XML document in textual form
+ */
+ HBufC8* BufferToStringLC();
+
+ /**
+ * Check the next element in a document
+ * @param CXdmDocumentNode& An XML element
+ * @return void
+ */
+ void CheckSubsetPath( const CXdmDocumentNode& aNode );
+
+ /**
+ * Reset the internal format buffer
+ * @return void
+ */
+ void ResetFormatBuffer();
+
+ /**
+ * Find the (local) name of an element
+ * @param TDesC8& The whole element string
+ * @return TPtrC8 Name part of the element string
+ */
+ TPtrC8 FindElementName( const TDesC8& aElementString );
+
+ /**
+ * Format namespace declarations
+ * @param CXdmDocumentNode& An XML element
+ * @return MXdmNamespaceContainer& Namespace container
+ */
+ void FormatNamespaceDeclarationsL( const CXdmDocumentNode& aRootNode,
+ const MXdmNamespaceContainer& aContainer );
+
+ /**
+ * Format the parameter element and its descendants
+ * @param CXdmDocumentNode The element to format
+ * @return void
+ */
+ void FormatElementsL( CXdmDocumentNode* aCurrentNode );
+
+ /**
+ * Format a leaf element
+ * @param CXdmDocumentNode The element to format
+ * @return void
+ */
+ void FormatLeafElementL( CXdmDocumentNode* aCurrentNode );
+
+ /**
+ * Format the start of the parameter element
+ * @param TDesC8& Element prefix
+ * @param TDesC8& Element URI
+ * @return void
+ */
+ void FormatElementStartL( const TDesC8& aPrefix,
+ const TDesC8& aElementData );
+
+ /**
+ * Format the end of the parameter element
+ * @param TDesC8& Element prefix
+ * @param TDesC8& Element URI
+ * @return void
+ */
+ void FormatElementEndL( const TDesC8& aPrefix,
+ const TDesC8& aElementData );
+
+ /**
+ * Format an empty element
+ * @param CXdmDocumentNode The element to format
+ * @return void
+ */
+ void FormatEmptyElementL( CXdmDocumentNode* aEmptyNode );
+
+
+ /**
+ * Append a namespace mapping
+ * @param TDesC8& Element URI
+ * @param TDesC8& Element prefix
+ * @return void
+ */
+ void AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ /**
+ * Append XML fragment into the format buffer
+ * @return void
+ */
+ void AppendXmlFragmentL();
+
+ /**
+ * Return the prefix of the parameter element
+ * @param MXdmNodeInterface& An XML element
+ * @return TPtrC8 Prefix
+ */
+ TPtrC8 Prefix( const MXdmNodeInterface& aInterface );
+
+ private: //Data
+
+ TInt iFormBufferPos;
+ TBool iTargetFound;
+ TBool iIsAppended;
+ CBufSeg* iFormatBuffer;
+ TPtrC8 iDocumentFragment;
+ CXdmXmlParser& iParserMain;
+ CXdmNodeAttribute* iTargetAttribute;
+ CXmlParserNodePath* iNodePath;
+ TXdmElementType iElementType;
+
+ };
+
+#endif //__XMLPARSERNODEPATH__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XmlNodePathInterface.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MXmlNodePathInterface
+*
+*/
+
+
+
+
+#ifndef __XMLNODEPATHINTERFACE__
+#define __XMLNODEPATHINTERFACE__
+
+// INCLUDES
+#include <e32base.h>
+
+class CXdmNodeAttribute;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( MXmlNodePathInterface )
+ {
+ public:
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual CXdmNodeAttribute* TargetAttribute() const = 0;
+ };
+
+#endif //__XMLPARSERNODEPATH__
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XmlParserDefines.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XmlParserDefines
+*
+*/
+
+
+
+
+#ifndef __XMLPARSERDEFINES__
+#define __XMLPARSERDEFINES__
+
+// INCLUDES
+#include <e32base.h>
+
+_LIT8( KEquelsSignString, "=" );
+_LIT8( KQuotationSignString, "\"" );
+_LIT8( KSlashString, "/" );
+_LIT8( KCommentString, "<!--" );
+_LIT8( KEmptyElementString, "/>" );
+_LIT8( KStartBracketString, "<" );
+_LIT8( KEndBracketString, ">" );
+_LIT8( KXmlNamespaceString, " xmlns" );
+_LIT8( KPrefixSeparatorString, ":" );
+_LIT8( KNewlineString, "\r\n" );
+_LIT8( KSpaceString, " " );
+
+const TInt KStartBracket = 60;
+const TInt KEndBracket = 62;
+const TInt KSpace = 32;
+const TInt KEquality = 61;
+const TInt KQuotation = 34;
+
+#endif //__XMLPARSERDEFINES__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/inc/XmlParserNodePath.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXmlParserNodePath
+*
+*/
+
+
+
+
+#ifndef __XMLPARSERNODEPATH__
+#define __XMLPARSERNODEPATH__
+
+// INCLUDES
+//#include <parser.h>
+#include <e32base.h>
+#include <badesca.h>
+#include <contenthandler.h>
+
+class CXdmXmlParser;
+class CXdmDocumentNode;
+class MXmlNodePathInterface;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CXmlParserNodePath ) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ static CXmlParserNodePath* NewL( CXdmXmlParser& aParserMain,
+ TXdmElementType iElementType,
+ const CXdmDocumentNode& aTargetNode,
+ MXmlNodePathInterface* aPathInterface );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TBool CheckNextNode( const CXdmDocumentNode& aNextNode );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ TBool CheckNextNodeL( const TDesC8& aNextElement,
+ const Xml::RAttributeArray& aAttributes );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ virtual ~CXmlParserNodePath();
+
+ private:
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ CXmlParserNodePath( CXdmXmlParser& aParserMain,
+ TXdmElementType aElementType,
+ MXmlNodePathInterface* aPathInterface );
+
+ /**
+ * Copies the request data
+ * @param aRequestData Data to be sent
+ */
+ void ConstructL( const CXdmDocumentNode& aTargetNode );
+
+ private: //Data
+
+ TInt iIndex;
+ TBool iComplete;
+ TXdmElementType iElementType;
+ MXmlNodePathInterface* iPathInterface;
+ RPointerArray<CXdmDocumentNode> iNodes;
+ CXdmXmlParser& iParserMain;
+ };
+
+#endif //__XMLPARSERNODEPATH__
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/src/XdmXmlContentHandler.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,512 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmXmlContentHandler
+*
+*/
+
+
+
+#include <XdmDocument.h>
+#include <contenthandler.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+#include "XdmNamespaceContainer.h"
+#include "XdmXmlParser.h"
+#include "XdmNodeInterface.h"
+#include "XmlParserNodePath.h"
+#include "XdmXmlContentHandler.h"
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::CXdmXmlContentHandler
+//
+// ---------------------------------------------------------
+//
+CXdmXmlContentHandler::CXdmXmlContentHandler( CXdmXmlParser& aParserMain ) :
+ iFinished( EFalse ),
+ iTargetFound( EFalse ),
+ iPartialDocument( EFalse ),
+ iParserMain( aParserMain )
+
+ {
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::NewL
+//
+// ---------------------------------------------------------
+//
+CXdmXmlContentHandler* CXdmXmlContentHandler::NewL( CXdmXmlParser& aParserMain )
+ {
+ CXdmXmlContentHandler* self = new ( ELeave ) CXdmXmlContentHandler( aParserMain );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::ConstructL()
+ {
+ iContentBuffer = CBufFlat::NewL( 50 );
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::~CXdmXmlContentHandler
+//
+// ---------------------------------------------------------
+//
+CXdmXmlContentHandler::~CXdmXmlContentHandler()
+ {
+ delete iNodePath;
+ delete iContentBuffer;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::SetTarget
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::SetTarget( const CXdmDocument& aTargetDocument )
+ {
+ iTargetDocument = CONST_CAST( CXdmDocument*, &aTargetDocument );
+ iRootNode = iTargetDocument->DocumentRoot();
+ iDocumentSubset = NULL;
+ iIsRootNode = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::SetTarget
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::SetTarget( const CXdmDocumentNode& aDocumentRoot )
+ {
+ iTargetDocument = NULL;
+ iRootNode = CONST_CAST( CXdmDocumentNode*, &aDocumentRoot );
+ iDocumentSubset = NULL;
+ iIsRootNode = ETrue;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::SetTarget
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::SetTargetL( const CXdmDocument& aTargetDocument,
+ const CXdmDocumentNode& aTargetNode )
+ {
+ iElementType = aTargetNode.ElementType();
+ iTargetDocument = CONST_CAST( CXdmDocument*, &aTargetDocument );
+ if( iElementType == EXdmElementAttribute )
+ {
+ iTargetAttribute = ( CXdmNodeAttribute* )&aTargetNode;
+ iDocumentSubset = CONST_CAST( CXdmDocumentNode*, aTargetNode.Parent() );
+ }
+ else
+ {
+ iTargetAttribute = NULL;
+ iDocumentSubset = CONST_CAST( CXdmDocumentNode*, &aTargetNode );
+ }
+ iNodePath = CXmlParserNodePath::NewL( iParserMain, iElementType, *iDocumentSubset, this );
+ iRootNode = iDocumentSubset;
+ iPartialDocument = ETrue;
+ iCurrentNode = NULL;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::TargetAttribute
+//
+// ---------------------------------------------------------
+//
+CXdmNodeAttribute* CXdmXmlContentHandler::TargetAttribute() const
+ {
+ return iTargetAttribute;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::Reset
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::Reset()
+ {
+ iTargetDocument = NULL;
+ iTargetAttribute = NULL;
+ iDocumentSubset = NULL;
+ iRootNode = NULL;
+ iCurrentNode = NULL;
+ delete iNodePath;
+ iNodePath = NULL;
+ iFinished = EFalse;
+ iTargetFound = EFalse;
+ iPartialDocument = EFalse;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::GetExtendedInterface
+//
+// ---------------------------------------------------------
+//
+TAny* CXdmXmlContentHandler::GetExtendedInterface( const TInt32 /*aUid*/ )
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnContentL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnContentL( const TDesC8 &aBytes,
+ TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnContentL()" ), aErrorCode );
+ iParserMain.WriteToLog( _L8( " Bytes: %S" ), &aBytes );
+ iParserMain.WriteToLog( _L8( " Error: %d" ), aErrorCode );
+ #endif
+ if( iPartialDocument && !iTargetFound )
+ return;
+ TInt length = aBytes.Length();
+ TPtr8 desc( CONST_CAST( TUint8*, aBytes.Ptr() ), length, length );
+ desc.TrimAll();
+ if( desc.Length() > 0 )
+ {
+ iContentBuffer->InsertL( iContentIndex, desc );
+ iContentIndex = iContentIndex + desc.Length();
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnEndDocumentL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnEndDocumentL( TInt aErrorCode )
+ {
+ iIsRootNode = ETrue;
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnEndDocumentL() - Error: %d "), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnEndElementL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnEndElementL( const RTagInfo &aElement,
+ TInt aErrorCode )
+ {
+ TPtrC8 element( aElement.LocalName().DesC() );
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnEndElementL() - Element: %S Error: %d "),
+ &element, aErrorCode );
+ #endif
+ if( iCurrentNode != NULL && iContentBuffer->Size() > 0 )
+ {
+ TPtrC8 data( iContentBuffer->Ptr( 0 ) );
+ iCurrentNode->SetLeafNode( ETrue );
+ iCurrentNode->SetLeafNodeContentL( data );
+ iContentBuffer->Reset();
+ iContentIndex = 0;
+ }
+ if( iCurrentNode != NULL && iCurrentNode->NodeCount() == 0 )
+ iCurrentNode->SetEmptyNode( ETrue );
+ if( iPartialDocument )
+ {
+ if( !iFinished )
+ {
+ if( iCurrentNode != NULL )
+ {
+ CXdmDocumentNode* parent = iCurrentNode->Parent();
+ #ifdef _DEBUG
+ TBuf8<64> parentName;
+ TBuf8<64> currentName;
+ parentName.Copy( parent->NodeName() );
+ currentName.Copy( iCurrentNode->NodeName() );
+ iParserMain.WriteToLog( _L8( " Parent: %x - %S "), parent, &parentName );
+ iParserMain.WriteToLog( _L8( " Current: %x - %S"), iCurrentNode, ¤tName );
+ #endif
+ if( parent != NULL && iCurrentNode != parent )
+ iCurrentNode = iCurrentNode->Parent();
+ iFinished = iCurrentNode == iDocumentSubset->Parent();
+ if( iFinished )
+ iCurrentNode = NULL;
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( " Current: %x"), iCurrentNode );
+ #endif
+ }
+ }
+ }
+ else iCurrentNode = iCurrentNode->Parent();
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnEndPrefixMappingL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnEndPrefixMappingL( const RString& /*aPrefix*/,
+ TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnEndPrefixMappingL() - Error: %d "), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnError
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnError( TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnError() - Error: %d" ), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnIgnorableWhiteSpaceL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/,
+ TInt /*aErrorCode*/ )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXmlNode::OnIgnorableWhiteSpaceL() - Error: %d" ), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnProcessingInstructionL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnProcessingInstructionL( const TDesC8& /*aTarget*/,
+ const TDesC8& /*aData*/,
+ TInt /*aErrorCode*/ )
+ {
+ #ifdef _DEBUG
+ // iParserMain.WriteToLog( _L8( "CXmlNode::OnProcessingInstructionL() - Error: %d" ), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnSkippedEntityL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnSkippedEntityL( const RString& /*aName*/,
+ TInt /*aErrorCode*/ )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXmlNode::OnSkippedEntityL() - Error: %d" ), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnStartDocumentL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnStartDocumentL() - Error: %d "), aErrorCode );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnStartElementL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnStartElementL( const RTagInfo& aElement,
+ const RAttributeArray& aAttributes,
+ TInt aErrorCode )
+ {
+ TPtrC8 name( aElement.LocalName().DesC() );
+ TPtrC8 uri( aElement.Uri().DesC() );
+ TPtrC8 prefix( aElement.Prefix().DesC() );
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlNode::OnStartElementL(): Error: %d" ), aErrorCode );
+ iParserMain.WriteToLog( _L8( " URI: %S" ), &uri );
+ iParserMain.WriteToLog( _L8( " Name: %S" ), &name );
+ iParserMain.WriteToLog( _L8( " Prefix: %S" ), &prefix );
+ #endif
+ if( iPartialDocument )
+ {
+ if( !iFinished )
+ {
+ if( iTargetFound )
+ {
+ iCurrentNode = iCurrentNode->CreateChileNodeL();
+ HandleNextElementL( aElement, aAttributes );
+ }
+ else
+ {
+ if( iNodePath->CheckNextNodeL( name, aAttributes ) )
+ {
+ if( iElementType == EXdmElementAttribute )
+ AppendAttributeValueL( aAttributes );
+ else
+ {
+ iTargetFound = ETrue;
+ iCurrentNode = iDocumentSubset;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ iCurrentNode = iIsRootNode ? iRootNode : iCurrentNode->CreateChileNodeL();
+ HandleNextElementL( aElement, aAttributes );
+ iIsRootNode = EFalse;
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::HandleNextElementL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::HandleNextElementL( const RTagInfo& aElement,
+ const RAttributeArray& aAttributes )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::HandleNextElementL()") );
+ #endif
+ iCurrentNode->SetNameL( aElement.LocalName().DesC() );
+ SetNamespaceInformationL( aElement, iCurrentNode );
+ TInt count = aAttributes.Count();
+ if( count > 0 )
+ {
+ CXdmNodeAttribute* attribute = NULL;
+ for( TInt i = 0;i < count;i++ )
+ {
+ attribute = iCurrentNode->CreateAttributeL();
+ CleanupStack::PushL( attribute );
+ attribute->SetNameL( aAttributes[i].Attribute().LocalName().DesC() );
+ attribute->SetAttributeValueL( aAttributes[i].Value().DesC() );
+ CleanupStack::Pop(); //attribute
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::CompileAttributesL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::AppendAttributeValueL( const RAttributeArray& aAttributes )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::AppendAttributeValueL()") );
+ #endif
+ TInt count = aAttributes.Count();
+ TPtrC8 targetName( iTargetAttribute->EightBitNodeNameLC()->Des() );
+ for( TInt i = 0;!iFinished && i < count;i++ )
+ {
+ TPtrC8 desc = aAttributes[i].Attribute().LocalName().DesC();
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( " Name of attribute %d: %S"), i, &desc );
+ #endif
+ if( targetName.Compare( desc ) == 0 )
+ {
+ iFinished = ETrue;
+ TPtrC8 value( aAttributes[i].Value().DesC() );
+ iTargetAttribute->SetAttributeValueL( value );
+ }
+ }
+ CleanupStack::PopAndDestroy(); //desc
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::OnStartPrefixMappingL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::OnStartPrefixMappingL( const RString& aPrefix,
+ const RString& aUri,
+ TInt aErrorCode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::OnStartPrefixMappingL() - Error: %d" ), aErrorCode );
+ #endif
+ AppendNameSpaceL( aPrefix.DesC(), aUri.DesC() );
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::IsWhiteSpace
+//
+// ---------------------------------------------------------
+//
+TBool CXdmXmlContentHandler::IsWhiteSpace( const TDesC8 &aBytes ) const
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::IsWhiteSpace()") );
+ #endif
+ TBool ret = ETrue;
+ if( aBytes.Length() > 0 )
+ {
+ TChar ch = aBytes[0];
+ ret = ch == 32 || ch == 10 || ch == 13 || ch == 9;
+ }
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::AppendNameSpaceL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::AppendNameSpaceL( const TDesC8& aPrefix, const TDesC8& aUri )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::SetNameSpaceInformationL()") );
+ #endif
+ if( iTargetDocument != NULL )
+ {
+ MXdmNamespaceContainer* container = iTargetDocument;
+ container->AppendNamespaceL( aUri, aPrefix );
+ }
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::SetNameSpaceInformationL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlContentHandler::SetNamespaceInformationL( const RTagInfo& aElement,
+ MXdmNodeInterface* aXcapNode )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXdmXmlContentHandler::SetNameSpaceInformationL()") );
+ #endif
+ TPtrC8 prefix( aElement.Prefix().DesC() );
+ if( prefix.Length() > 0 )
+ {
+ aXcapNode->SetPrefixL( prefix );
+ }
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/src/XdmXmlParser.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmXmlParser
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <hal.h>
+#include <parser.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <parserfeature.h>
+#include <XdmNodeAttribute.h>
+#include <XdmDocument.h>
+#include <xdmlogwriter.h>
+#include <XdmDocumentNode.h>
+#include "XdmXmlParser.h"
+#include "XmlFormatter.h"
+#include "XmlParserDefines.h"
+#include "XdmXmlContentHandler.h"
+
+// ----------------------------------------------------------
+// CXdmXmlParser::CXdmXmlParser
+//
+// ----------------------------------------------------------
+//
+CXdmXmlParser::CXdmXmlParser() : iDumpIndex( 1 ),
+ iXmlDocument( ( TText8* )"", 0, 0 )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::NewL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C CXdmXmlParser* CXdmXmlParser::NewL()
+ {
+ CXdmXmlParser* self = new ( ELeave ) CXdmXmlParser();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXdmXmlParser::ConstructL()
+ {
+ #ifdef _DEBUG
+ iLogWriter = CXdmLogWriter::NewL( KParserLogFile );
+ WriteToLog( _L8( "CXdmXmlParser::ConstructL()" ) );
+ #endif
+ iXmlFormatter = CXmlFormatter::NewL( *this );
+ iContentHandler = CXdmXmlContentHandler::NewL( *this );
+ iXmlParser = CParser::NewL( KDefaultMimeType, *iContentHandler );
+ }
+
+// ----------------------------------------------------
+// CXdmXmlParser::~CXdmXmlParser
+//
+// ----------------------------------------------------
+//
+CXdmXmlParser::~CXdmXmlParser()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmXmlParser::~CXdmXmlParser()" ) );
+ #endif
+ delete iXmlParser;
+ delete iLogWriter;
+ delete iXmlFormatter;
+ delete iContentHandler;
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::ParseDocumentL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmXmlParser::ParseDocumentL( CXdmDocument* aDocument,
+ const TDesC8& aXmlDocument )
+ {
+ #ifdef _DEBUG
+ TInt start = CXdmXmlParser::TimeL();
+ #endif
+ CXdmDocumentNode* root = aDocument->DocumentRoot();
+ if( root == NULL )
+ aDocument->CreateRootL();
+ User::LeaveIfError( iXmlParser->EnableFeature( EReportNamespaceMapping ) );
+ iContentHandler->SetTarget( *aDocument );
+ Xml::ParseL( *iXmlParser, aXmlDocument );
+ iContentHandler->Reset();
+ //self->ParseL( aDocument, aXmlDocument );
+ #ifdef _DEBUG
+ TInt finish = CXdmXmlParser::TimeL();
+ WriteToLog( _L8( "CXdmXmlParser::ParseDocumentL() - Parsing took %d milliseconds" ), finish - start );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::ParseDocumentL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmXmlParser::ParseDocumentL( const TDesC8& aXmlDocument,
+ CXdmDocumentNode* aDocumentRoot )
+ {
+ #ifdef _DEBUG
+ TInt start = CXdmXmlParser::TimeL();
+ #endif
+ User::LeaveIfError( iXmlParser->EnableFeature( EReportNamespaceMapping ) );
+ iContentHandler->SetTarget( *aDocumentRoot );
+ Xml::ParseL( *iXmlParser, aXmlDocument );
+ iContentHandler->Reset();
+ //self->ParseL( aXmlDocument, aDocumentRoot );
+ #ifdef _DEBUG
+ TInt finish = CXdmXmlParser::TimeL();
+ WriteToLog( _L8( "CXdmXmlParser::ParseDocumentL() - Parsing took %d milliseconds" ), finish - start );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::ParseDocumentL
+//
+// ----------------------------------------------------------
+//
+EXPORT_C void CXdmXmlParser::ParseDocumentL( CXdmDocument* aDocument,
+ const TDesC8& aXmlDocument,
+ CXdmDocumentNode* aDocumentSubset )
+ {
+ #ifdef _DEBUG
+ TInt start = CXdmXmlParser::TimeL();
+ #endif
+ User::LeaveIfError( iXmlParser->EnableFeature( EReportNamespaces ) );
+ User::LeaveIfError( iXmlParser->EnableFeature( EReportNamespaceMapping ) );
+ User::LeaveIfError( iXmlParser->EnableFeature( EReportNamespacePrefixes ) );
+ iContentHandler->SetTargetL( *aDocument, *aDocumentSubset );
+ Xml::ParseL( *iXmlParser, aXmlDocument );
+ iContentHandler->Reset();
+ //self->ParseL( aDocument, aXmlDocument, aDocumentSubset );
+ #ifdef _DEBUG
+ TInt finish = CXdmXmlParser::TimeL();
+ CXdmXmlParser::WriteToLog( _L8(
+ "CXdmXmlParser::ParseDocumentL() - Parsing took %d milliseconds" ), finish - start );
+ #endif
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::FormatToXmlLC
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmXmlParser::FormatToXmlLC( TBool aIsWholeDocument,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aRootNode )
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmXmlParser::FormatToXmlLC" ) );
+ TInt start = CXdmXmlParser::TimeL();
+ #endif
+ HBufC8* ret = iXmlFormatter->FormatLC( aIsWholeDocument, aDocument, aRootNode );
+ #ifdef _DEBUG
+ DumpDocumentL( ret );
+ TInt finish = CXdmXmlParser::TimeL();
+ CXdmXmlParser::WriteToLog( _L8(
+ "CXdmXmlParser::FormatToXmlLC() - Formatting took %d milliseconds" ), finish - start );
+ #endif
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::FormatToXmlLC
+//
+// ----------------------------------------------------------
+//
+EXPORT_C HBufC8* CXdmXmlParser::FormatToXmlLC( const TDesC8& aXmlFragment,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aTargetNode )
+ {
+ #ifdef _DEBUG
+ TInt start = CXdmXmlParser::TimeL();
+ #endif
+ //HBufC8* ret = self->FormatLC( aXmlFragment, aDocument, aTargetNode );
+ HBufC8* ret = iXmlFormatter->FormatLC( aXmlFragment, aDocument, aTargetNode );
+ #ifdef _DEBUG
+ DumpDocumentL( ret );
+ TInt finish = CXdmXmlParser::TimeL();
+ CXdmXmlParser::WriteToLog( _L8(
+ "CXdmXmlParser::FormatToXmlLC() - Formatting took %d milliseconds" ), finish - start );
+ #endif
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlParser::FinishParsing
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlParser::FinishParsingL()
+ {
+ #ifdef _DEBUG
+ WriteToLog( _L8( "CXdmXmlParser::FinishParsing()" ) );
+ #endif
+ iXmlParser->ParseEndL();
+ }
+
+#ifdef _DEBUG
+
+// ---------------------------------------------------------
+// CXcapPartDocOperation::DumpDocumentL
+//
+// ---------------------------------------------------------
+//
+void CXdmXmlParser::DumpDocumentL( HBufC8* aDocData )
+ {
+ if( aDocData )
+ {
+ RFile file;
+ RFs session;
+ TPtr8 pointer( aDocData->Des() );
+ _LIT( KXmlFileExtension, ".xml" );
+ TBuf<128> nameBuf( _L( "C:\\logs\\XDM\\request" ) );
+ nameBuf.AppendNum( iDumpIndex );
+ nameBuf.Append( KXmlFileExtension );
+ User::LeaveIfError( session.Connect() );
+ TInt error( file.Replace( session, nameBuf, EFileWrite ) );
+ if( error == KErrNone )
+ {
+ file.Write( pointer );
+ file.Close();
+ iDumpIndex++;
+ }
+ session.Close();
+ }
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::TimeL
+//
+// ----------------------------------------------------------
+//
+TInt CXdmXmlParser::TimeL()
+ {
+ TInt period = 0;
+ User::LeaveIfError( HAL::Get( HALData::ESystemTickPeriod, period ) );
+ TInt millisecsPerTick = period / 1000;
+ return User::TickCount() * millisecsPerTick;
+ }
+
+// ----------------------------------------------------------
+// CXdmXmlParser::WriteToLog
+//
+// ----------------------------------------------------------
+//
+void CXdmXmlParser::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const
+ {
+ VA_LIST list;
+ VA_START( list, aFmt );
+ TBuf8<KLogBufferMaxSize> buf;
+ buf.FormatList( aFmt, list );
+ iLogWriter->WriteToLog( buf );
+ }
+
+#endif
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/src/XmlFormatter.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,471 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXmlFormatter
+*
+*/
+
+
+
+
+// INCLUDES
+#include <XdmDocument.h>
+#include <XdmDocumentNode.h>
+#include <XdmNodeAttribute.h>
+
+#include "XdmLogWriter.h"
+#include "XmlFormatter.h"
+#include "XmlParserDefines.h"
+#include "XmlParserNodePath.h"
+#include "XdmXmlParser.h"
+
+// ----------------------------------------------------------
+// CXmlFormatter::CXmlFormatter
+//
+// ----------------------------------------------------------
+//
+CXmlFormatter::CXmlFormatter( CXdmXmlParser& aParserMain ) :
+ iTargetFound( EFalse ),
+ iIsAppended( EFalse ),
+ iParserMain( aParserMain )
+ {
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::NewL
+//
+// ----------------------------------------------------------
+//
+CXmlFormatter* CXmlFormatter::NewL( CXdmXmlParser& aParserMain )
+ {
+ CXmlFormatter* self = new ( ELeave ) CXmlFormatter( aParserMain );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::~CXmlFormatter
+//
+// ----------------------------------------------------------
+//
+CXmlFormatter::~CXmlFormatter()
+ {
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::ConstructL
+//
+// ----------------------------------------------------------
+//
+void CXmlFormatter::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::Prefix
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXmlFormatter::Prefix( const MXdmNodeInterface& aInterface )
+ {
+ return aInterface.Prefix();
+ }
+
+// ---------------------------------------------------------
+// CXdmXmlContentHandler::Reset
+//
+// ---------------------------------------------------------
+//
+CXdmNodeAttribute* CXmlFormatter::TargetAttribute() const
+ {
+ return iTargetAttribute;
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FindElementName
+//
+// ---------------------------------------------------------
+//
+TPtrC8 CXmlFormatter::FindElementName( const TDesC8& aElementString )
+ {
+ TInt index = aElementString.LocateF( 32 );
+ if( index > 0 )
+ return aElementString.Left( index );
+ else return aElementString;
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::ResetFormatBuffer
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::ResetFormatBuffer()
+ {
+ iFormBufferPos = 0;
+ delete iFormatBuffer;
+ iFormatBuffer = NULL;
+ delete iNodePath;
+ iNodePath = NULL;
+ }
+
+
+// ---------------------------------------------------------
+// CXmlFormatter::BufferToStringLC
+//
+// ---------------------------------------------------------
+//
+HBufC8* CXmlFormatter::BufferToStringLC()
+ {
+ HBufC8* ret = HBufC8::NewLC( iFormatBuffer->Size() );
+ TPtr8 pointer( ret->Des() );
+ iFormatBuffer->Read( 0, pointer, iFormatBuffer->Size() );
+ ResetFormatBuffer();
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::CheckSubsetPath
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::CheckSubsetPath( const CXdmDocumentNode& aNode )
+ {
+ iTargetFound = iNodePath->CheckNextNode( aNode );
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::FormatLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXmlFormatter::FormatLC( const TDesC8& aXmlFragment,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aTargetNode )
+ {
+ iIsAppended = EFalse;
+ iTargetFound = EFalse;
+ TBool addToRoot = EFalse;
+ iFormatBuffer = CBufSeg::NewL( 128 );
+ iElementType = aTargetNode->ElementType();
+ iDocumentFragment.Set( aXmlFragment );
+ iNodePath = CXmlParserNodePath::NewL( iParserMain, iElementType, *aTargetNode, this );
+ CXdmDocumentNode* element = aDocument->DocumentRoot();
+ CXdmDocumentNode* root = element;
+ CheckSubsetPath( *root );
+ if( iTargetFound )
+ {
+ addToRoot = ETrue;
+ iIsAppended = ETrue;
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, KXmldocumentStart );
+ iFormBufferPos = iFormBufferPos + KXmldocumentStart().Length();
+ FormatNamespaceDeclarationsL( *root, *aDocument );
+ TInt count = element->NodeCount();
+ if( count > 0 )
+ {
+ for( TInt i = 0;i < count;i++ )
+ {
+ element = element->ChileNode( i );
+ FormatElementsL( element );
+ }
+ }
+ else FormatElementsL( element );
+ if( addToRoot )
+ AppendXmlFragmentL();
+ TPtrC8 name( root->EightBitNodeNameLC()->Des() );
+ TPtrC8 prefix = root->Prefix();
+ FormatElementEndL( prefix, name );
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC()
+ HBufC8* ret = BufferToStringLC();
+ return ret;
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FormatElementsL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::FormatElementsL( CXdmDocumentNode* aCurrentNode )
+ {
+ TBool ready = EFalse;
+ TBool addNow = EFalse;
+ if( !iTargetFound && !iIsAppended )
+ {
+ CheckSubsetPath( *aCurrentNode );
+ addNow = iTargetFound && !iIsAppended;
+ }
+ TPtrC8 prefix = Prefix( *aCurrentNode );
+ TPtr8 pointer( aCurrentNode->ElementDataLC()->Des() );
+ FormatElementStartL( prefix, pointer );
+ while( !ready )
+ {
+ if( aCurrentNode->IsLeafNode() )
+ FormatLeafElementL( aCurrentNode );
+ TInt nodeCount = aCurrentNode->NodeCount();
+ if( nodeCount > 0 )
+ {
+ CXdmDocumentNode* child = NULL;
+ for( TInt i = 0;i < nodeCount;i++ )
+ {
+ child = aCurrentNode->ChileNode( i );
+ child->IsEmptyNode() && !child->IsLeafNode() ?
+ FormatEmptyElementL( child ):
+ FormatElementsL( child );
+ }
+ ready = ETrue;
+ }
+ else ready = ETrue;
+ }
+ if( addNow )
+ AppendXmlFragmentL();
+ FormatElementEndL( prefix, FindElementName( pointer ) );
+ CleanupStack::PopAndDestroy(); //ElementDataLC()
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::AppendXmlFragmentL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::AppendXmlFragmentL()
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, iDocumentFragment );
+ iFormBufferPos = iFormBufferPos + iDocumentFragment.Length();
+ iIsAppended = ETrue;
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::FormatLC
+//
+// ----------------------------------------------------------
+//
+HBufC8* CXmlFormatter::FormatLC( TBool aIsWholeDocument,
+ const CXdmDocument* aDocument,
+ const CXdmDocumentNode* aRootNode )
+ {
+ iIsAppended = ETrue;
+ iFormatBuffer = CBufSeg::NewL( 128 );
+ CXdmDocumentNode* root = CONST_CAST( CXdmDocumentNode*, aRootNode );
+ if( aIsWholeDocument )
+ {
+ CXdmDocumentNode* element = NULL;
+ iFormatBuffer->InsertL( iFormBufferPos, KXmldocumentStart );
+ iFormBufferPos = iFormBufferPos + KXmldocumentStart().Length();
+ FormatNamespaceDeclarationsL( *root, *aDocument );
+ TInt count = root->NodeCount();
+ if( count > 0 )
+ {
+ for( TInt i = 0;i < count;i++ )
+ {
+ element = root->ChileNode( i );
+ FormatElementsL( element );
+ }
+ }
+ }
+ else FormatElementsL( root );
+ if( aIsWholeDocument )
+ {
+ TPtrC8 name( aRootNode->EightBitNodeNameLC()->Des() );
+ TPtrC8 prefix = aRootNode->Prefix();
+ FormatElementEndL( prefix, name );
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC()
+ }
+ HBufC8* ret = BufferToStringLC();
+ return ret;
+ }
+
+// ----------------------------------------------------------
+// CXmlFormatter::FormatNamespaceDeclarationsL
+//
+// ----------------------------------------------------------
+//
+void CXmlFormatter::FormatNamespaceDeclarationsL( const CXdmDocumentNode& aRootNode,
+ const MXdmNamespaceContainer& aContainer )
+ {
+#ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlFormatter::FormatNamespaceDeclarationsL start" ) );
+#endif
+ TPtrC8 name( aRootNode.EightBitNodeNameLC()->Des() );
+ TPtrC8 prefix = Prefix( aRootNode );
+ iFormatBuffer->InsertL( iFormBufferPos, KStartBracketString );
+ iFormBufferPos = iFormBufferPos + KStartBracketString().Length();
+ if( prefix.Length() > 0 )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, prefix );
+ iFormBufferPos = iFormBufferPos + prefix.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KPrefixSeparatorString );
+ iFormBufferPos = iFormBufferPos + KPrefixSeparatorString().Length();
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, name );
+ iFormBufferPos = iFormBufferPos + name.Length();
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC()
+ if( aContainer.Count() > 0 )
+ {
+ TPtrC8 uri( _L8( "" ) );
+ TPtrC8 prefix( _L8( "" ) );
+ for( TInt i = 0;i < aContainer.Count();i++ )
+ {
+ uri.Set( aContainer.Uri( i ) );
+ prefix.Set( aContainer.Prefix( i ) );
+ AppendNamespaceL( uri, prefix );
+ }
+ }
+
+ // go through possible attributes after namespaces
+ for ( TInt i = 0; i < aRootNode.AttributeCount(); i++ )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, KSpaceString );
+ iFormBufferPos = iFormBufferPos + KSpaceString().Length();
+
+ CXdmNodeAttribute* attr = aRootNode.Attribute( i );
+ TPtrC8 name( attr->EightBitNodeNameLC()->Des() );
+ iFormatBuffer->InsertL( iFormBufferPos, name );
+ iFormBufferPos = iFormBufferPos + name.Length();
+ CleanupStack::PopAndDestroy(); //EightBitNodeNameLC()
+ iFormatBuffer->InsertL( iFormBufferPos, KEquelsSignString );
+ iFormBufferPos = iFormBufferPos + KEquelsSignString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KQuotationSignString );
+ iFormBufferPos = iFormBufferPos + KQuotationSignString().Length();
+ TPtrC8 attrValue( attr->EightBitValueLC()->Des() );
+ iFormatBuffer->InsertL( iFormBufferPos, attrValue );
+ iFormBufferPos = iFormBufferPos + attrValue.Length();
+ CleanupStack::PopAndDestroy(); //EightBitValueLC()
+ iFormatBuffer->InsertL( iFormBufferPos, KQuotationSignString );
+ iFormBufferPos = iFormBufferPos + KQuotationSignString().Length();
+ }
+
+ iFormatBuffer->InsertL( iFormBufferPos, KEndBracketString );
+ iFormBufferPos = iFormBufferPos + KEndBracketString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KNewlineString );
+ iFormBufferPos = iFormBufferPos + KNewlineString().Length();
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlFormatter::FormatNamespaceDeclarationsL exit" ) );
+ #endif
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FormatLeafElementL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::FormatLeafElementL( CXdmDocumentNode* aCurrentNode )
+ {
+ TPtrC8 escape( aCurrentNode->EscapeLeafNodeContentLC()->Des() );
+ iFormatBuffer->InsertL( iFormBufferPos, escape );
+ iFormBufferPos = iFormBufferPos + escape.Length();
+ CleanupStack::PopAndDestroy(); //EscapeLeafNodeContentLC()
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FormatEmptyElementL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::FormatEmptyElementL( CXdmDocumentNode* aEmptyNode )
+ {
+ TPtr8 empty( aEmptyNode->ElementDataLC()->Des() );
+ iFormatBuffer->InsertL( iFormBufferPos, KStartBracketString );
+ iFormBufferPos = iFormBufferPos + KStartBracketString().Length();
+ TPtrC8 prefix = Prefix( *aEmptyNode );
+ if( prefix.Length() > 0 )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, prefix );
+ iFormBufferPos = iFormBufferPos + prefix.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KPrefixSeparatorString );
+ iFormBufferPos = iFormBufferPos + KPrefixSeparatorString().Length();
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, empty );
+ iFormBufferPos = iFormBufferPos + empty.Length();
+ CleanupStack::PopAndDestroy(); //ElementDataLC()
+ iFormatBuffer->InsertL( iFormBufferPos, KEmptyElementString );
+ iFormBufferPos = iFormBufferPos + TPtrC8( KEmptyElementString ).Length();
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FormatElementStartL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::FormatElementStartL( const TDesC8& aPrefix,
+ const TDesC8& aElementData )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, KStartBracketString );
+ iFormBufferPos = iFormBufferPos + KStartBracketString().Length();
+ if( aPrefix.Length() > 0 )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, aPrefix );
+ iFormBufferPos = iFormBufferPos + aPrefix.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KPrefixSeparatorString );
+ iFormBufferPos = iFormBufferPos + KPrefixSeparatorString().Length();
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, aElementData );
+ iFormBufferPos = iFormBufferPos + aElementData.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KEndBracketString );
+ iFormBufferPos = iFormBufferPos + KEndBracketString().Length();
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::FormatElementEndL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::FormatElementEndL( const TDesC8& aPrefix,
+ const TDesC8& aElementName )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, KStartBracketString );
+ iFormBufferPos = iFormBufferPos + KStartBracketString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KSlashString );
+ iFormBufferPos = iFormBufferPos + KSlashString().Length();
+ if( aPrefix.Length() > 0 )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, aPrefix );
+ iFormBufferPos = iFormBufferPos + aPrefix.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KPrefixSeparatorString );
+ iFormBufferPos = iFormBufferPos + KPrefixSeparatorString().Length();
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, aElementName );
+ iFormBufferPos = iFormBufferPos + aElementName.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KEndBracketString );
+ iFormBufferPos = iFormBufferPos + KEndBracketString().Length();
+ }
+
+// ---------------------------------------------------------
+// CXmlFormatter::AppendNamespaceL
+//
+// ---------------------------------------------------------
+//
+void CXmlFormatter::AppendNamespaceL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, KXmlNamespaceString );
+ iFormBufferPos = iFormBufferPos + KXmlNamespaceString().Length();
+ if( aPrefix.Length() > 0 ) //Not the default namespace
+ {
+ iFormatBuffer->InsertL( iFormBufferPos, KPrefixSeparatorString );
+ iFormBufferPos = iFormBufferPos + KPrefixSeparatorString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, aPrefix );
+ iFormBufferPos = iFormBufferPos + aPrefix.Length();
+ }
+ iFormatBuffer->InsertL( iFormBufferPos, KEquelsSignString );
+ iFormBufferPos = iFormBufferPos + KEquelsSignString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KQuotationSignString );
+ iFormBufferPos = iFormBufferPos + KQuotationSignString().Length();
+ iFormatBuffer->InsertL( iFormBufferPos, aUri );
+ iFormBufferPos = iFormBufferPos + aUri.Length();
+ iFormatBuffer->InsertL( iFormBufferPos, KQuotationSignString );
+ iFormBufferPos = iFormBufferPos + KQuotationSignString().Length();
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/XdmXmlParser/src/XmlParserNodePath.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXmlParserNodePath
+*
+*/
+
+
+
+#include <contenthandler.h>
+#include "XdmDocument.h"
+#include "XdmXmlParser.h"
+#include "XdmDocumentNode.h"
+#include "XdmNodeAttribute.h"
+#include "XmlParserNodePath.h"
+#include "XmlNodePathInterface.h"
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::CXmlParserNodePath
+//
+// ---------------------------------------------------------
+//
+CXmlParserNodePath::CXmlParserNodePath( CXdmXmlParser& aParserMain,
+ TXdmElementType aElementType,
+ MXmlNodePathInterface* aPathInterface ) :
+ iElementType( aElementType ),
+ iPathInterface( aPathInterface ),
+ iParserMain( aParserMain )
+ {
+ }
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::ExtractString
+//
+// ---------------------------------------------------------
+//
+CXmlParserNodePath* CXmlParserNodePath::NewL( CXdmXmlParser& aParserMain,
+ TXdmElementType aElementType,
+ const CXdmDocumentNode& aTargetNode,
+ MXmlNodePathInterface* aPathInterface )
+ {
+ CXmlParserNodePath* self = new ( ELeave ) CXmlParserNodePath( aParserMain, aElementType, aPathInterface );
+ CleanupStack::PushL( self );
+ self->ConstructL( aTargetNode );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::~CXmlParserNodePath
+//
+// ---------------------------------------------------------
+//
+CXmlParserNodePath::~CXmlParserNodePath()
+ {
+ iNodes.Close();
+ }
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::ConstructL
+//
+// ---------------------------------------------------------
+//
+void CXmlParserNodePath::ConstructL( const CXdmDocumentNode& aTargetNode )
+ {
+ #ifdef _DEBUG
+ iParserMain.WriteToLog( _L8( "CXmlParserNodePath::ConstructL()" ) );
+ #endif
+ CXdmDocumentNode* current = CONST_CAST( CXdmDocumentNode*, &aTargetNode );
+ while( current != NULL )
+ {
+ iNodes.InsertL( current, 0 );
+ current = current->Parent();
+ }
+ }
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::CheckNextNodeL
+//
+// ---------------------------------------------------------
+//
+TBool CXmlParserNodePath::CheckNextNodeL( const TDesC8& aNextElement,
+ const RAttributeArray& aAttributes )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXmlParserNodePath::CheckNextNodeL" ) );
+ #endif
+ if( !iComplete && aNextElement.Length() > 0 )
+ {
+ TInt attrCount = aAttributes.Count();
+ RPointerArray<SXdmAttribute8> attributes;
+ CleanupClosePushL( attributes );
+ for( TInt i = 0;i < attrCount;i++ )
+ {
+ SXdmAttribute8 attribute;
+ attribute.iName.Set( aAttributes[i].Attribute().LocalName().DesC() );
+ attribute.iValue.Set( aAttributes[i].Value().DesC() );
+ User::LeaveIfError( attributes.Append( &attribute ) );
+ }
+ HBufC* unicode = HBufC::NewLC( aNextElement.Length() );
+ unicode->Des().Copy( aNextElement );
+ if( iNodes[iIndex]->Match( unicode->Des(), attributes ) )
+ {
+ iIndex++;
+ if( iElementType == EXdmElementAttribute )
+ iComplete = iNodes[iIndex] == iPathInterface->TargetAttribute()->Parent();
+ else /* or else if, the next if is not needed */
+ {
+ if( iIndex == iNodes.Count() )
+ iComplete = ETrue;
+ }
+ }
+ CleanupStack::PopAndDestroy( 2 ); //unicode, attributes
+ }
+ return iComplete;
+ }
+
+// ---------------------------------------------------------
+// CXmlParserNodePath::CheckNextNodeL
+//
+// ---------------------------------------------------------
+//
+TBool CXmlParserNodePath::CheckNextNode( const CXdmDocumentNode& aNextNode )
+ {
+ #ifdef _DEBUG
+ //iParserMain.WriteToLog( _L8( "CXmlParserNodePath::CheckNextNodeL" ) );
+ #endif
+ if( !iComplete )
+ {
+ if( iNodes[iIndex]->Match( aNextNode ) )
+ {
+ iIndex++;
+ if( iElementType == EXdmElementAttribute )
+ iComplete = iNodes[iIndex] == iPathInterface->TargetAttribute()->Parent();
+ else /* or else if, the next if is not needed */
+ {
+ if( iIndex == iNodes.Count() )
+ iComplete = ETrue;
+ }
+ }
+ }
+ return iComplete;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/group/bld.inf Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XDM protocols bld.inf
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+//--------------------
+PRJ_PLATFORMS
+//--------------------
+DEFAULT
+
+//--------------------
+PRJ_EXPORTS
+//--------------------
+
+//XDM Literal definitions
+
+ ../XcapProtocol/XcapAppUsage/inc/XcapAppUsageDef.h |../../inc/xcapappusagedef.h
+
+// IBYs
+../rom/XdmProtocols.iby CORE_MW_LAYER_IBY_EXPORT_PATH(xdmprotocols.iby)
+
+//--------------------
+PRJ_MMPFILES
+//--------------------
+../XdmXmlParser/group/XdmXmlParser.mmp
+../XcapProtocol/XcapUtils/group/XcapUtils.mmp
+../XcapProtocol/XcapCache/Server/group/XcapCache.mmp
+../XcapProtocol/XcapCache/Client/group/XcapCacheClient.mmp
+../XcapProtocol/XcapAppUsage/group/XcapAppUsage.mmp
+../XcapProtocol/XcapHttpTransport/group/XcapHttpTransport.mmp
+../XcapProtocol/group/XcapProtocol.mmp
+../XcapProtocol/XcapOperations/group/XcapOperations.mmp
+../LocalProtocol/group/LocalProtocol.mmp
+../LocalProtocol/LocalOperations/group/LocalOperations.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/inc/XdmNamespace.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmNamespace
+*
+*/
+
+
+
+
+#ifndef __XDMNAMESPACE__
+#define __XDMNAMESPACE__
+
+#include <e32base.h>
+
+NONSHARABLE_CLASS ( CXdmNamespace ) : public CBase
+ {
+ public:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ IMPORT_C static CXdmNamespace* NewL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ IMPORT_C TPtrC8 Uri() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ IMPORT_C TPtrC8 Prefix() const;
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ IMPORT_C virtual ~CXdmNamespace();
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXdmNamespace();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL( const TDesC8& aUri, const TDesC8& aPrefix );
+
+ private:
+
+ HBufC8* iUri;
+ HBufC8* iPrefix;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/inc/XdmShutdownSwitch.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MXdmShutdownSwitch
+*
+*/
+
+
+
+
+#ifndef __XDMSHUTDOWNSWITCH__
+#define __XDMSHUTDOWNSWITCH__
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS( MXdmShutdownSwitch )
+ {
+ public:
+
+ /**
+ * Pure virtual callback function to be implemented in the
+ * derived class. This function is called when timer has
+ * compeleted.
+ * @param aStatus The integer value of iStatus of the timer class
+ */
+ virtual void SwitchOff() = 0;
+ };
+
+#endif // __XDMSHUTDOWNSWITCH__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/inc/XdmShutdownTimer.h Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmShutdownTimer
+*
+*/
+
+
+
+
+#ifndef __XDMSHUTDOWNTIMER__
+#define __XDMSHUTDOWNTIMER__
+
+//FORWARD DECLARATION
+class CXcapProtocol;
+class MXdmShutdownSwitch;
+
+NONSHARABLE_CLASS ( CXdmShutdownTimer ) : public CTimer
+ {
+ public:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ CXdmShutdownTimer( CXcapProtocol& aXcapProtocol,
+ MXdmShutdownSwitch* aShutdownSwitch );
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void ConstructL();
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void Start( const TTimeIntervalMicroSeconds32 aShutdownDelay );
+
+ private:
+
+ /**
+ * Returns the MIME type of the messages
+ * @return TPtrC8 The MIME type of the messages
+ */
+ void RunL();
+
+ private:
+
+ CXcapProtocol& iXcapProtocol;
+ MXdmShutdownSwitch* iShutdownSwitch;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/rom/XdmProtocols.iby Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XdmProtocols.iby
+*
+*/
+
+
+
+
+#ifndef __XDMPROTOCOLS_IBY__
+#define __XDMPROTOCOLS_IBY__
+
+#ifdef __XDM
+ #ifdef __XDM_XCAP
+ file=ABI_DIR\BUILD_DIR\XcapUtils.dll SHARED_LIB_DIR\XcapUtils.dll
+ file=ABI_DIR\BUILD_DIR\XcapCacheClient.dll SHARED_LIB_DIR\XcapCacheClient.dll
+ file=ABI_DIR\BUILD_DIR\XcapCache.exe PROGRAMS_DIR\XcapCache.exe
+ file=ABI_DIR\BUILD_DIR\XcapHttpTransport.dll SHARED_LIB_DIR\XcapHttpTransport.dll
+ ECOM_PLUGIN( XcapAppUsage.dll, 10207416.rsc)
+ ECOM_PLUGIN( XcapOperations.dll, 10207410.rsc)
+ ECOM_PLUGIN( XcapProtocol.dll, 1020740F.rsc)
+ data = DATAZ_\private\10207421\backup_registration.xml private\10207421\backup_registration.xml
+ #endif //__XDM_XCAP
+ #ifdef __XDM_LOCALSTORAGE
+ ECOM_PLUGIN( LocalProtocol.dll, 10207458.rsc)
+ ECOM_PLUGIN( LocalOperations.dll, 10275086.rsc)
+ #endif //__XDM_LOCALSTORAGE
+#endif //__XDM
+
+#endif //__XDMPROTOCOLS_IBY__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/src/XdmNamespace.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmNamespace
+*
+*/
+
+
+
+
+#include "XdmNamespace.h"
+
+// ----------------------------------------------------
+// CXdmNamespace::CXdmNamespace
+//
+// ----------------------------------------------------
+//
+CXdmNamespace::CXdmNamespace()
+ {
+ }
+
+// ----------------------------------------------------
+// CXdmNamespace::NewL
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmNamespace* CXdmNamespace::NewL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ CXdmNamespace* self = new ( ELeave ) CXdmNamespace();
+ CleanupStack::PushL( self );
+ self->ConstructL( aUri, aPrefix );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ----------------------------------------------------
+// CXdmNamespace::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXdmNamespace::ConstructL( const TDesC8& aUri, const TDesC8& aPrefix )
+ {
+ if( aUri.Length() > 0 )
+ {
+ iUri = aUri.AllocL();
+ iPrefix = aPrefix.AllocL();
+ }
+ else User::Leave( KErrArgument );
+ }
+
+// ----------------------------------------------------
+// CXdmNamespace::~CXdmNamespace
+//
+// ----------------------------------------------------
+//
+EXPORT_C CXdmNamespace::~CXdmNamespace()
+ {
+ delete iUri;
+ delete iPrefix;
+ }
+
+// ----------------------------------------------------
+// CXdmNamespace::Uri
+//
+// ----------------------------------------------------
+//
+EXPORT_C TPtrC8 CXdmNamespace::Uri() const
+ {
+ return iUri != NULL ? iUri->Des() : TPtrC8();
+ }
+
+// ----------------------------------------------------
+// CXdmNamespace::Prefix
+//
+// ----------------------------------------------------
+//
+EXPORT_C TPtrC8 CXdmNamespace::Prefix() const
+ {
+ return iPrefix != NULL ? iPrefix->Des() : TPtrC8();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xdmprotocols/src/XdmShutdownTimer.cpp Tue Feb 02 01:05:17 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CXdmShutdownTimer
+*
+*/
+
+
+
+#include <e32base.h>
+#include "XcapProtocol.h"
+#include "XdmShutdownTimer.h"
+#include "XdmShutdownSwitch.h"
+
+// ----------------------------------------------------
+// CXdmShutdownTimer::CXdmShutdownTimer
+//
+// ----------------------------------------------------
+//
+CXdmShutdownTimer::CXdmShutdownTimer( CXcapProtocol& aXcapProtocol,
+ MXdmShutdownSwitch* aShutdownSwitch ) :
+ CTimer( -1 ),
+ iXcapProtocol( aXcapProtocol ),
+ iShutdownSwitch( aShutdownSwitch )
+ {
+ }
+
+// ----------------------------------------------------
+// CXdmShutdownTimer::ConstructL
+//
+// ----------------------------------------------------
+//
+void CXdmShutdownTimer::ConstructL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXdmShutdownTimer::ConstructL()" ) );
+ #endif
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+// ----------------------------------------------------
+// CXdmShutdownTimer::Start
+//
+// ----------------------------------------------------
+//
+void CXdmShutdownTimer::Start( const TTimeIntervalMicroSeconds32 aShutdownDelay )
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXdmShutdownTimer::Start()" ) );
+ #endif
+ After( aShutdownDelay );
+ }
+
+// ----------------------------------------------------
+// CXdmShutdownTimer::RunL
+//
+// ----------------------------------------------------
+//
+void CXdmShutdownTimer::RunL()
+ {
+ #ifdef _DEBUG
+ iXcapProtocol.WriteToLog( _L8( "CXdmShutdownTimer::RunL() - Close transfer media" ) );
+ #endif
+ iShutdownSwitch->SwitchOff();
+ }
+
+